#circuitpython-dev

1 messages · Page 420 of 1

onyx hinge
#

OK, sounds like you're considering all angles.

#

I had a new idea for saving memory on get-only or getset-only properties. I'll briefly mention it here. We tried before to find some way to encode the "this property has no setter / deleter" within the object itself, but there's really no space to do so. so here's how you do it: You encode it by where they're placed in flash, using sections. So you place all the "get only" properties in section A, all the "get + set" properties in section B, and the "full properties" anywhere outside those sections. Then, you just have to have a way to compare the address of the property for whether it falls in the given section. There are some details to work out, but I think this approach may actually work.

#

(that new address-checking code just gets added in 2 paths, or at any rate I think it should be)

jaunty juniper
#

I would need to make specific measurements but the new delay feels frustratingly long compared to before

manic glacierBOT
#

Not sure if best to ask/mention here or discord or forum...

I have been playing around with adding ability to talk to Dynamixel Servos, as mentioned in the couple of PR's and earlier issue.
For the heck of it I ported over the DynamixelSDK python code to talk to servos using the rs485_dir

When I tried it on the RP2040 with my mods to support the direction pin, the python code error happened in the dynamixel library code that None class is not itterable...
In the function: https://gi...

solid fjord
jaunty juniper
#

yeah, when searching for those, google is... 🤷 I believe we actually have better results since removing some older versions from readthedocs, where it used to point you to 4.x or something

#

though machine in 1.0.0 is not much better

solid fjord
#

Thanks,
Note: with the issue, I fixed once case of it so far in my copy of the DynamixelSDK code, by:

            rdata = port.readPort(wait_length - rx_length)
            if (rdata != None):
                rxpacket.extend(rdata)

But I am almost sure I still need to it in other places in their code as well, Like the Protocol2 file...

dusk mauve
#

taking a look at my QT Py ESP32-C3 boards, trying to build/flash... No luck so far getting them to boot with CircuitPython. Don't think it's my dev env, since S2/S3 boards build/flash fine. Is there a special trick to it?

#

Actually, I guess it could be running fine, but it sounds like USB mass storage isn't a thing on the C3 so file management has to be done with Thonny or something?

#

Ahh, yes! Answered my own question. Without USB mass storage it works fine but just needs to be interacted with via serial. 😄

#
>>> ```
jaunty juniper
solid fjord
#

Thanks will change to that instead

#

It appears to work 😄

manic glacierBOT
dusk mauve
#

When maintaining/building CircuitPython drivers is it worth it to do testing on the cxd56 port? I haven't gotten my hands on a Spresense board yet but it seems like a cool board, just haven't seen many projects using it yet.

manic glacierBOT
manic glacierBOT
tulip sleet
dusk mauve
# tulip sleet We sell the board but the port is maintained by Sony. You could test if you want...

The HX711 driver I submitted to community bundle this weekend is a bit-bang thing, so I’d expect some timing deviation from platform to platform. So far I haven’t seen any issues in testing so far (samd, esp, stm, rp2040 look good) except form some wacky results with nrf, but haven’t dug deep into that yet.

It’s good to know that Sony themselves maintain the port though. Wasn’t sure how that worked

jaunty juniper
#

would it make sense to have a board definition for the pico with Maker Pi Pico [base] ? It's technically an expansion board, but it would have the advantage of using the neopixel as status LED (and there's a model with the pico pre-soldered on it).
https://www.adafruit.com/product/5160

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Hi Wattsie,

I'm afraid I haven't been working on it. Truthfully, the availability of
Adafruit's QT Py ESP32-S2 has lowered the priority of this for me -- I
would still love to be able to chain 2040's together through their S-QT
ports, but the esp32-s2 aren't that much more expensive and can use WiFi
for communication, so I've been going in that direction.

But if you manage to get the I2C peripheral mode working, I'd certainly
love to have that as an option -- and can happily promise to sin...

onyx hinge
tulip sleet
#

<@&356864093652516868> Reminder: CircuitPython weekly meeting today 11am Pacific / 2pm Eastern / 1800 UTC here on Discord. Here is the notes document for todays meeting: https://docs.google.com/document/d/1QEMJLYwOVee_Bi0MKcS4SW5jKSc5SA0rr14YBfRhjRQ/edit?usp=sharing

Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! We may have some remote participants from PyCon.

subtle fog
#

We're working on getting mypy working, and figuring out which CPython version and libraries need to be installed. More in thread.

subtle fog
#

I'm tracing up to the root dependencies that will be imported by other libraries. So far, I'm getting to _blueio (Adafruit_Blinka_bleio). Let me know if I'm on a fools errand 😛

lone axle
steady garden
#

Trying to build the pulse oximeter library under Windows 10 and running into problems installing the pythonnet sub dependency. Recording what I know here in case someone else is having the same problems

subtle fog
tulip sleet
lone axle
subtle fog
#

I'll open an issue just to get that convo started, but will focus on _bleio then

proven garnet
#

@gilded cradle what's your recommendation for semver release for that typing package requirement fix? Increase patch version? Or minor?

timber mango
#

When I run pre-commit I am getting errors from pylint:
************* Module adafruit_ble_ibbq
adafruit_ble_ibbq.py:141:16: E1101: Module 'struct' has no 'unpack_from' member (no-member)
adafruit_ble_ibbq.py:162:51: E1101: Module 'struct' has no 'unpack_from' member (no-member)

#

I didn't make any edits to that

lone axle
subtle fog
#

I think we are primarily concerned with

jaunty juniper
gilded cradle
#

@proven garnet probably the lowest number since it's more of a bug fix than a new feature.

proven garnet
#

Thanks @lone axle and @gilded cradle!

dusk mauve
#

Haven't used bitbangio yet but is there a provision for bit-banging variable-size shift registers? Or is it just for broad protocols?

edit: Should've just RTFM'd, looks like its just I2C/SPI at the moment. Might make a feature request (or try my hand at a PR) for a 'general purpose shift-register' class to add in there

tulip sleet
#

i.e. bitbangio is the "soft" implementation of busio

dusk mauve
dusk mauve
# tulip sleet bitbangio is generally a subset of busio, implemented as "manual" bit-flipping. ...

My main desire is to get more deterministic behavior when doing two-wire "clock-then-read-a-bit" stuff.

For the HX711 driver I've found that RP2 PIO is amazing for this kind of simple stuff. But flipping bits at a high level ends up with different timings on different platforms... Which is only an issue when the chip I'm reading from has a threshold shorter than the shortest pulse possible with high-level bit banging.

Captured some data illustrating this here:

https://github.com/fivesixzero/CircuitPython_HX711/issues/2

onyx hinge
#

But that's not for clock and data so it may not serve your need

dusk mauve
#

yeah, in this use case it's a "clock rising edge, clock falling edge, read in a bit, repeat" scenario.

#

I guess most general purpose shift registers won't have strict timing requirements so it'd just be for edge cases like the HX711 that have a max time limit between pulse edges before it resets

tulip sleet
#

if you just use SPI, in what way does that not work?

dusk mauve
#

I haven't tried using SPI actually, the chip doesn't explicitly use/support SPI since it's just a two-wire thing.

tulip sleet
#

it sounds like SPI + MISO

#

maybe with bits to ignore

dusk mauve
#

Hmm, yeah... Thank you for that hint. Might be able to just wrap it in SPI. I just need granular clock count control (to clock only 25, 26, or 27 times)

onyx hinge
#

Or with rp2040 try PIO peripheral

dusk mauve
#

took some time to learn PIO and massage the behavior into place while tracking with a logic analyzer.. But the results were worth the effort.

Some screenshots of logic analysis are in the issue I posted above, with PIO performing incredibly well.

onyx hinge
#

That is rather inconvenient to implement!

dusk mauve
#

Had to brush up on bit shifting/masking to make sure things aligned right with Pythonic 32-bit ints

onyx hinge
dusk mauve
tulip sleet
#

The nRF implementation is multi-tasking, and will be interrupted for BLE things. You may see similar issues on ESP32-nn, with its background wifi tasks. So we provide things like PulseIn and PulseOut to guarantee timing. But you need both at once, so SPI and PIO sounded like candidates.

dusk mauve
digital shoreBOT
#
adafruit
Owner

adafruit#3230

Category Channels

8

Text Channels

61

Voice Channels

6

Members

34194

Roles

35

lone axle
#

👋

tulip sleet
lone axle
turbid radish
lone axle
#

Ooh neat, looking forward to that guide. I'd be happy to help out with testing new ports like that but don't know how yet.

#

plus1 for that keynote about the EHT. It was super fascinating!

candid sun
#

plus 1000 for this haha

thorny jay
#

Could I have git on the CIRCUITPY drive? Would that work?

random junco
#

I would love a PyCharm plugin for something like that. 🙂

thorny jay
#

What about rsync between CIRCUITPY and another folder (I am on Windows, so maybe not for me...).

lone axle
jaunty juniper
#

yeah I would like some plugin like that

#

I have a backup command in discotool

thorny jay
#

Mu keep a copy of the file as long as it is open, in case of problem I can save it elsewhere, maybe Notepad++ have that too.

turbid radish
#

Thanks all for attending!

candid sun
#

mu's logs have also saved me many a time

crimson ferry
#

Do we have any, even rough, histogram-type data on editors / IDEs people use for CircuitPython?

candid sun
#

thanks for hosting @tulip sleet

thorny jay
turbid radish
#

Yes, thanks Dan!

jaunty juniper
#

I use that to back up all connected boards, but it's manual

alias cpbackups='discotool backup --format "{timestamp}-{device}_{drive}_{serial}" ~/Backups/CPBackups'
thorny jay
#

Work in progress... but super slow.

lone axle
crimson ferry
#

fwiw, I use Atom, but that's not one I see people mention a lot

blissful pollen
#

I wonder if it would be possible for a CP core module (optional of course) to be set up to do backups back to the host device, then it is editor agnostic. May be too much trouble

tulip sleet
#

I think Mu, PyCharm, VSCode, and to a lesser extent Atom, and much lesser, vim, emacs, Notepad++

tulip sleet
jaunty juniper
#

Circuitpython knows nothing of the host device

lone axle
#

Maybe sublime too. I think Scott uses that one, though I'm not sure about on circuitpython code vs. core development.

blissful pollen
#

Yeah I guess the CP device would need USB host to now be the device too

crimson ferry
#

The trouble I have with most editors is that they don't seem to handle multiple simulataneous Circuitpython devices very well (if at all) ...they get very confused (Atom does handle this well)

thorny jay
#

What about not writing to the device at all, but only copying the whole stuff to CIRCUITPY when you click a button? I am still in the rsync kind of mode, a solution external to the editor would work for all... like an USB key backup program that detect the mass storage and take a copy.

dusk mauve
tulip sleet
#

@idle owl @gilded cradle : Came up in today's meeting, and I brought it up In the Weeds; might be something for someone to work on in the sprints for Mu, VSCode, PyCharm, emacs, vim, atom: implement auto-backup when writing to CIRCUITPY from an editor or IDE.. This would be an IDE/editor-specific plugin or whatever that writes a copy of what you write to CIRCUITPY somewhere else as well.

#

also some discussion above ^^

lone axle
jaunty juniper
#

somebody shared that a long time ago, which uploads to a board when saving a file in the designated directory basically

#!/bin/bash

if [[ -z "$2" ]]; then
    TARGET="/Volumes/CIRCUITPY/"
else
    TARGET="$2"/
fi

echo "$1" to "$TARGET"

fswatch -o $1| while read num; do cp -vX "$1" "$TARGET";echo "sync";done
dusk mauve
#

When maintaining a Community Bundle library should I submit a PR to the bundle for new version releases, to make sure that the submodule points to the latest tag/commit? Or does the bundle release script handle pulling the latest version?

idle owl
tulip sleet
#

Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern / 1800 UTC here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/19SfrFM1BeAqltmW6iBdWZYqqQ4lmiQaiqLzV8_ea7eo/edit?usp=sharing

lone axle
#

@idle owl have you talked with any of the sprinters about updating version of pylint used by pre-commit? I noticed that was changed in this PR: https://github.com/adafruit/Adafruit_CircuitPython_BLE_iBBQ/pull/9/files and wanted to check with you before leaving feedback for it. My assumption is if / when we want to update that we'll do it as a patch or script across all libraries at once rather than one-offs in PRs like this.

jaunty juniper
subtle fog
jaunty juniper
lone axle
jaunty juniper
#

oh yeah it might something like that too

idle owl
manic glacierBOT
old smelt
#

Sorry for the confusion! Wasn't able to make the meeting and forgot to note it in the doc!

lone axle
old smelt
#

Ah - okay.

#

Probably was.

manic glacierBOT
warm flame
#

I received my Lilygo T-oi plus Esp32-C3. I'll have to make the pinout file.

proven garnet
#

@lone axle we only want to type functions and methods, not attributes, right?

#

Or the more the merrier?

lone axle
proven garnet
#

Sounds good, thanks!

silent brook
# lone axle correct. Only function arguments and returns. We tried on attributes (or "normal...

Good to know, I put up a PR (https://github.com/adafruit/Adafruit_CircuitPython_RFM9x/pull/73) with a wider reach of annotations in it (beyond just function and method returns), I'll scale it back and keep this guidance in mind for the future!

GitHub

Addresses issue #65
Adds type annotations across the file.
Items of note:

I had to add a None check for an Optional[bytearray] on line 873 to ensure incorrect usage is checked
I inferred types to ...

manic glacierBOT
devout jolt
#

Not sure where to ask this, but it seems CirPy ESP32S3 internals-related. I'm experiencing disturbingly high-current draw (150mA) on QT Py ESP32-S3 when sitting idle in the REPL. Right out of reset it'll draw ~50mA but then jump to 100mA. If I do import adafruit_ble; r = adafruit_ble.BLERadio(), current draw immediately goes to 140mA and keeps rising, with temperature at the Vreg going up to 150ºF and feeling dangerously hot. And the temp keeps increasing, seeming to be in a slow thermal runaway. These photos were taken about 10 minutes apart. There's a thermocouple kapton'd on top of the Vreg. This is running Adafruit CircuitPython 7.3.0-beta.2 on 2022-04-27; Adafruit QT Py ESP32-S3 no psram with ESP32S3 and on a fresh local build

tulip sleet
devout jolt
tulip sleet
#

we should test it against other ESP32-S3 boards doing the same thing. But getting it in the issues system will add it to the to-do list.

crimson ferry
#

Is there a way to force USB [re-]enumeration? I regularly get events on CircuitPython devices that eject the drive and it doesn't remount, though serial does re-connect. macOS.

manic glacierBOT
lone sandalBOT
manic glacierBOT
devout jolt
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.3.0-beta.2 on 2022-04-27; Adafruit QT Py ESP32-S3 no psram with ESP32S3

Code/REPL

import _bleio

Behavior

I'm experiencing worryingly high-temps (150ºF) and high-current draw (140mA) on QT Py ESP32-S3 when sitting idle in the REPL. Right out of reset it'll draw ~50mA but then jump to 100mA. Upon import _bleio current draw immediately ...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit QT Py ESP32-S3 no psram with ESP32S3
Board ID:adafruit_qtpy_esp32s3_nopsram

Code/REPL

import time
import board
import neopixel

print("Hello, world!")

pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)

pixels.brightness = 0.3

while True:
    pixels.fill((255, 0, 0))
    time.sleep(0.5)
    pixels.fill((0, 0, 0))
    time.sleep(0.5)
    print("Hello, world!!!")

###...

crimson ferry
#

there's no way for the device itself to know if the host recognizes its USB volume though, right?

#

I try to reset only as a last resort due to the file system corruption risks and the data loss (no sleep alarm memory and I'd rather not use nvm unless I have to)

manic glacierBOT
manic glacierBOT
#

ok just to verify you're getting the same power draw on the Feather and the QT Py S3, its just the S3 is warmer right?
there's not a lot of ground plane on the QT to dissipate the generated current, and it is a dual core 240 mhz processor. so being toasty isnt that out of bounds

@UnexpectedMaker are you seeing similar power draws? i dont have one of your boards with me right now to check :)

manic glacierBOT
#

I am also seeing similar power consumption, but not excessively high temperatures. The regulator on top is at most 50C, and the ESP32-S3 is about 45C. I have essentially the same measuring equipment as @UnexpectedMaker. I also tested with a Thermoworks Thermapen Mk4 cooking thermometer, which has more sinking ability.

My QT Py has header pins installed, which are getting warm and probably acting as a good heat sink. @todbot, it appears you do not have header pins installed.

manic glacierBOT
manic glacierBOT
#

I'm thinking this is just a vreg heatsinking issue with the QTPy just being so small that there's not much copper on the board and the ESP32 being known for having 130mA BLE "by default" that people complain about it.

The Feather ESP32-S3 I have has similar current consumption, but its vregs don't get that hot (40ºC at most)

I tested all 3 of my QT Py ESP32-S3s:

  • All three behaved the same: 140mA when running "BLE_uart" Arduino sketch
  • Headers do seem to act as heatsinks, it was ...
#

@todbot I think it's less about the LDO and more about the lack of ways for heat to exit the board. My TinyX boards run hotter than my Feather format boards, with the same specs. The Feather boards have 3x more PCB surface exposure to air, allowing more heat to get into the copper pours, and then dissipate out off the board.

The QT Py is smaller than my TinyX boards and double sided as well, so even less air contact area for heat to dissipate. That might be reflected in components that get...

manic glacierBOT
thorny jay
manic glacierBOT
#

No, I stumbled upon this by working on a new display, and I simply forgot to set it to monochrome. Normally you would never use SH1107_addressing with color or grayscale displays, because it doesn't really make sense for them. So this really isn't a problem as such, other than maybe it should be an exception being raised rather than a crash. On the other hand, adding a check and an error message is going to waste additional space in the flash, so I'm not sure it even makes sense to fix it. ...

tulip sleet
#

Hi @onyx hinger, welcome back! If you have a brainstorm for flash savings, go to it. These are the open 7.3.0 issues:

#

Of these, I am working on 6263, but it's in progress with Espressif, and may not get resolved soon. I will probably work on 6311 as well. 6307 is external. 6286 and 6258 deserve some checking by either of us.

onyx hinge
#

thanks! is 6311 another i2c thing?

tulip sleet
#

yes, I think so

#

6113 could just use a validation chek

#

as you discussed

#

it can use one of the argcheck.c checks

onyx hinge
#

hmm I was hoping to save hundreds of bytes but I only saved 96 bytes 😕

tulip sleet
#

oh :/

#

more checking on it to do?

#

per Limor, i am working on a hw test suite, first for digitalio, then analogio, to vet the S3 port

#

will also be applicable to any other port

onyx hinge
#

I think I made an incorrect estimate, because I forgot a property always has a pointer to the property type object

tulip sleet
#

more savings on larger ports, probalb

onyx hinge
#

yeah

manic glacierBOT
onyx hinge
#

well, there's the patch. didn't save as much as I'd hoped, but I know this idea of saving the wasted space for the deleters and setters had been rattling around in your head @tulip sleet and mine for awhile without being successfully implemented..

tulip sleet
onyx hinge
#

pygamer saves 940 bytes so that's substantial

#

must be a lot more properties

tulip sleet
manic glacierBOT
#

I've tried again in #6337 and did get some savings. The approach it takes is to organize "get-only" properties into one region of flash and "get-set" properties into another; in each flash region, they're assumed to have just 1 or 2 proxy slots rather than the traditional 3. It avoids adding additional Python types or performing weird "low bit tricks", and saves 8 bytes for get-only and 4 bytes for get-set (each). However, ~100 bytes of code end up added. There is still a net savings on Trink...

manic glacierBOT
manic glacierBOT
proven garnet
#

@lone axle lightly following along on my lunch break, I'm happy to break out some of those Protocols into the circuitpython_typing library. Good point on Pixel, I had added the led based things to it not too long ago

#

Also, good point that if a ton of classes use value similarly, it makes sense to define the duck for wherever it quacks 🦆

manic glacierBOT
#
#

.. but the core says (at least according to source code comments inherited from micropython development):

        if (mp_is_nonblocking_error(error)) {
            // https://docs.python.org/3.4/library/io.html#io.RawIOBase.read
            // "If the object is in non-blocking mode and no bytes are available,
            // None is returned."
            // This is actually very weird, as naive truth check will treat
            // this as EOF.

The Python docs make the distin...

onyx hinge
#

@tulip sleet do you think https://github.com/adafruit/circuitpython/issues/6213 and https://github.com/adafruit/circuitpython/issues/6286 are related? Or is it just concidentally the same message?

GitHub

CircuitPython version 7.2.1 and later Code/REPL import board uart = board.UART() Behavior on reload: >>> soft reboot Auto-reload is off. Running in safe mode! Not running saved...

GitHub

CircuitPython version Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Metro M4 Express with samd51j19 adafruit-circuitpython-metro_m4_express-en_US-7.2.5 Code/REPL import busio from board impo...

tulip sleet
onyx hinge
#

I was confused by the reporter's follow-up about clock stretching, that seemed like a non-sequiteur to me

tulip sleet
#

me too

onyx hinge
#

this is busio.I2C(board.SDA, board.SCL) so it would not be the default BOARD object

tulip sleet
#

good point 🙂 , really need to test here with a similar setup

onyx hinge
#

it's an interesting clue if it could be related to clock stretching. the sample code is incomplete and for a non-adafruit board

tulip sleet
#

i am looking to see what the actual I2C device is

#

it looks like some home-grown microcontroller software, because the firmware is upgradable

#

but I don't see still why that would cause the error that it caused

manic glacierBOT
#

I'm trying to duplicate this, but my set-up isn't like the original reporter, and the original report is not a complete program.

My test board is a pygamer, because it was handy, the same microcontroller family, and has a built-in i2c device

My test:

import busio
from board import *
import adafruit_lis3dh 

i2c = busio.I2C(SCL, SDA)
assert i2c.try_lock()
print(i2c.scan())
i2c.unlock()
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=25) # address jumper is pulled hig...
#

Agree on closing this issue. Everything seems to be working as intended. I was all excited to try BLE on ESP32 and was startled it was so hot when idly grabbing it. But after reading up, I see ESP32 BLE is much less developed than NRF. Not surprising, I guess.

@ladyada ahaha that heatsink is adorable! I'm sure I'd fat-finger it to oblivion. And right now I'd rather use an NRF52840-based approach.

onyx hinge
#

I don't see anything in busio.I2C that would make a reset-during-clock-stretch different than at any other time

manic glacierBOT
manic glacierBOT
#

I just tried both the .bin and the .uf2 and both work as intended. I think this issue can be closed.

Pedantically, here's what I did:

Test .BIN

onyx hinge
#

@proven garnet How do you feel about me using the photo with you, me, melissa and kattni in an adafruit blog post about pycon? I would say something like "we were also joined by Alec [or Tekktrik, your option] who has been helping us with CircuitPython for a few months".

#

if you want to see the photo before I post it I can DM

manic glacierBOT
proven garnet
#

@tulip sleet or @onyx hinge - that doc PR I made to the core passed doc build if you want to cancel it and move on

tulip sleet
#

eventually we might check to see if a PR is ONLY comment changes, which would mean doc only, and not build boards

manic glacierBOT
orchid basinBOT
orchid basinBOT
ruby atlas
#

I created a concurrent flasher... Would love it to get some love from others!

jaunty juniper
jaunty juniper
#

so, I'm exploring a trick where we add a subdirectory to the adafruit_circuitplayground that is used to host the frozen version by using symbolic links, like this, and change the frozen dir accordingly:

frozen_version/
  adafruit_circuitplayground/
    __init__.py
    circuit_playground_base.py
    express.py
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_version
manic glacierBOT
jaunty juniper
#

and that compiles and runs

#
>>> import adafruit_circuitplayground
>>> dir(adafruit_circuitplayground)
['__class__', '__name__', '__file__', '__path__', 'sys', 'cp', 'express', 'circuit_playground_base']
>>> from adafruit_circuitplayground import cp
>>> cp.temperature
26.1708
jaunty juniper
#

size change:

circuitplayground_express  248476 bytes (latest)
circuitplayground_express  247352 bytes (cpx_frozen_lite)
onyx hinge
#

@jaunty juniper that's interesting! I don't think symlinks (which mean no complicated processing of files or filenames) were discussed the last time this idea came around. I like it.

#

or anyway it wasn't a part of the conversation I was aware of.

jaunty juniper
#

I remembered how the stage frozen library does it

#

I tested running circuitpython-build-bundles in the library's directory and that worked without taking additional files, maybe because of the prefix. I haven't tested with the full bundle build, if there's an issue we could always add a special subdirectory to ignore (like "test" or "docs" is)

manic glacierBOT
jaunty juniper
#

seems to work fine with the bundle too

orchid basinBOT
tulip sleet
#

@jaunty juniper this seems quite nice; will it work on a Windows build?

#

not working on Windows is not necessarily a show-stopper

jaunty juniper
#

that is the question. I'm not setup to build CP on windows, I wonder what git does with symlinks there

#

if it checks out the original file instead of the symlink, that might compile ok, if not 🤷

#

note that the builds that use the stage frozen library also rely on symlinks

tulip sleet
#

we build some representative builds on Windows

#

so if stage works, it probably will

jaunty juniper
#

first, the PR to adafruit_circuitplayground must be made and released, so that the files even exist

#

I'll open both, with a comment on how one depends on the other

manic glacierBOT
#

This PR requires an update and release of the adafruit_circuitplayground library (followed by updating frozen modules in this PR) before it can be merged.

It changes the frozen directory of the circuitplayground library to a subdirectory with a copy of the library made using symbolic links excluding the CPB specific file. Reduces the size of the CPX build by 1148 bytes.

Note: it's important now to NOT freez...

manic glacierBOT
#

On samd21, common_hal_os_urandom() just does return false; -- I guess there's no RNG there. That's why the random number generator is seeded so much more poorly on cpx. However, at pycon we were testing with cpb, where we do have a RNG. It's odd, then, that the initial random numbers appear to be so poorly distributed on cpb as well. Perhaps the behavior of os.urandom on cpb bears a bit more investigating.

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.3.0-beta.2 on 2022-04-27; Raspberry Pi Pico with rp2040

Code/REPL

import time
import board
import pulseio

pulsein = pulseio.PulseIn(board.GP21, maxlen=5)
time.sleep(2.2)
pulsein.pause()
if len(pulsein) == 5:
    x = [pulsein.popleft() for _ in range(5)]
    print(x)
else:
    print(len(pulsein))

Behavior

Output doesn't match input. Final pulse width is at the beginning of the list

De...

manic glacierBOT
#

I've fixed a wrong sizeof() as indicated by some builds, and also this alignment issue pointed out by the old 8086_commander CI build:

../../supervisor/shared/usb/usb.c: In function 'usb_return_boot_py_data':
../../supervisor/shared/usb/usb.c:161:27: error: cast increases required alignment of target type [-Werror=cast-align]
  161 |     usb_build_descriptors((usb_identification_t *)temp_st...
manic glacierBOT
manic glacierBOT
#

I battled with RST a little bit and now the frozen modules link to their respective github repository or documentation if possible, parsed from the README.rst of the frozen directory (the badge on Adafruit libraries), which is a little hacky but works. (Except stamp_carrier_board, which has neither).

I marked the frozen modules with a (*) that matches the one in the text at the top, and copied the style of the links to builtin modules. I also tinted them slightly blue because... Frozen.....

manic glacierBOT
onyx hinge
stuck elbow
#

"No results matched your search.", phew!

onyx hinge
#

that means you can go on vacation next week, yay!

stuck elbow
#

if I went on vacation, I would actually have time/energy to work on CircuitPython

manic glacierBOT
manic glacierBOT
#

This is not a good fix as it stands, as it doesn't address the 'automatically seed' path. That's the path that is trouble for microcontrollers that don't implement os.urandom.

It's also puzzling that several of us believed the problem affects CPB: The problem of bias of the first RNG output for small seed values would only affect manual seeding OR the fallback to seed from monotonic time when os.urandom is not available. This would be the case for samd21 (CPX) but should not be for nrf52 ...

manic glacierBOT
onyx hinge
#

OK I feel like I've gone around in circles on this RNG thing and ended up nowhere. 😕

stuck elbow
#

it's a spiral

#

you are making progress, just vertically

onyx hinge
#

platforms with os.urandom support "should" be doing as good as possible, but that leaves out boards like cpx (no os.urandom is possible), but those have the least possibility to get better behavior by throwing more code at at, since there's no room for more code.

stuck elbow
#
def random():
    return 4 # determined with a fair dice roll
onyx hinge
#

and trying to make the RNG smaller hasn't worked out, it may be kinda junk but it is tiny

tulip sleet
onyx hinge
#

To my understanding, it doesn't seem to need support in the SERCOM or equivalent. It's just a pin you set before doing a TX and clear when TX is complete.

#

but I have never actually used RS485 to my recollection

tulip sleet
#

i was not planning a release this week, unless you think there's an important bug we fixed. But I could do one just to keep up, and it would test the circuitpython.org PR generation.

onyx hinge
#

but because we're poor at splitting implementation between ports & shared-modules it'd be additional work to actually make it work cross-port this way

tulip sleet
#

does the user flip the direction pin or shared-___ should?

onyx hinge
#

the existing API has

rs485_dir (Pin) – the output pin for rs485 direction setting, or None if rs485 not in use.
rs485_invert (bool) – rs485_dir pin active high when set. Active low otherwise.
which unless we want to do incompatible changes is what we're stuck with.

tulip sleet
#

from SAMD51 datasheet; SAMD21 datasheet does not mention RS485

onyx hinge
#

without support in the sercom-or-equivalent, you aren't guaranteed alignment between TE and TXD at the start of a transmission, or a particular GTIME-like delay at the end.

tulip sleet
#

so without hw support, ideally we would raise an error if you specified RS485-relevant parameters as not None

onyx hinge
#

I have assumed that what Kurt wrote is working in practice

tulip sleet
#

so he's simulating RS485, but without the timing guarantees, is what you're saying?

#

I guess it would not hurt; I was just wondering about support issues.

tulip sleet
#

so, the RP2040 impl is rather more casual, without timing guarantees (there could be an interrupt that delays things).

onyx hinge
#

yes, lots of things could interfere

#

but what I don't know is the consequence of it

tulip sleet
#

Some people have talked about using PIO for RS485; that sounds more like the direction to go. My inclination is not to approve, because it's not really RS485, and could fail in mysterious and intermittent ways. Would you agree with that?

onyx hinge
#

canbus is broadly similar, a multidrop bus, but it requires HW support for managing access & defining who wins if multiple devices try to access simultaneously. RS485, it's much murkier.

#

"hey does this actully work in practice?" seems like a valid question to ask at this point. because Kurt may know even if we have no idea

tulip sleet
#

he tried with some servos, and it seemed to work, but that is not "it works reliably"

onyx hinge
#

and the mimxrt one is "maybe using HW support [rts], maybe not"

#

The timing of this control is critical, especially when switching from the send to the receive
mode, as the application has to make sure that the device is in reception mode before data
are sent by the other entity.
The master has to free the Tx/Rx line in no more than a bit time, otherwise there is a
collision with the slave response. So the DE signal has to switch from high to low level within
the bit time that follows the last bit of the last byte sent by the master.
So basically there's no guarantee that this requirement is being met [from the st pdf]

tulip sleet
#

I will ask about this in both PR's.

#

Certainly merge the translation PR

onyx hinge
#

OK

#

hmm rerequesting review from myself doesn't actually clear the "approved" status

#

will you "request changes"?

tulip sleet
#

You can dismiss your review, I think.

on another note, I am doing an experiment on Trinket M0, just removing the deleter slot in properties it uses entirely, to see what savings there is. That is a lower bound on the properties stuff. But maybe you have that data already.

manic glacierBOT
#

Hi - my understanding is that you are simulating RS485 serial hardware, which guarantees certain timing on the direction pin, as described, for instance, in https://www.st.com/resource/en/application_note/cd00249778-managing-the-driver-enable-signal-for-rs485-and-iolink-communications-with-the-stm32s-usart-stmicroelectronics.pdf (linke courtesy @jepler).

if, say, an interrupt occurred before the pin was toggled, the signal might get delayed, or it might get lengthened if the interrupt occu...

manic glacierBOT
#

I did an experiment on the Trinket M0 build: I just removed the deleter slot from mp_obj_property_t.proxy, and adjusted all the intiializers referenced by the Trinket M0 build. I made no other code changes, so it's not functional, but gives us a lower bound on what would be saved.

Removing the one slot saves 144 bytes. If all the Trinket M0 properties were read-only, which is not true, then the total savings would be 288 bytes. A quick manual count shows ~24 read-only properties. And thi...

onyx hinge
#

I think because you'd created the issue to update libs before 7.3.0 final, that you were closer than you actually are.

tulip sleet
#

I think the ESP32-Sn I2C issues may just have to be deferred past 7.3.0

onyx hinge
#

drat

#

I wish I had been able to reproduce the safemode i2c problem issue, but I wasn't able to with just the particular accelerometer I had for quick testing. It sure could be specific to that peripheral

tulip sleet
#

i will see what the Espressif person comes up with. My fix works for some I2C, but it's an accident

#

that is really mysterious, since there's no obvious cause, it's almost like a memory smash or something

onyx hinge
#

yuck. too bad nobody's written valgrind for microcontrollers.

manic glacierBOT
#

busio was having a default timeout for clock stretching of 255 microseconds but cannot change it, so instead we discovered that bigbangio accepts the timeout parameter. Since TIC max clock stretching is 1.5ms we set the timeout to 1500us.

@phantomsixthplayer Do you think the clock stretching is related to this safe mode problem? We were not sure why you mentioned it.

manic glacierBOT
#

I was wondering about making it look like this, rather than marking each one. There would be a line break or paragraph break before the frozen modules. Not sure which is "better":

**adafruit_bus_device, adafruit_pixelbuf, analogio, audiobusio, audiocore, audioio, bitbangio, board, busio, countio, digitalio, errno, math, microcontroller, neopixel_write, nvm, onewireio, os, pulseio, pwmio, rainbowio, random, rotaryio, rtc, storage, struct, supervisor, time, touchio, traceback, usb, usb_cdc...

#

I'm concerned that this RS485 might work "most" of the time, but would randomly fail occasionally due to timing issues. For casual servo work that might be fine, but not in other cases.

Understood!

However today on all of the Teensy 4.x board you two choices. Either it works most of the time, or works none of the time. None of the Uarts have any CTS pins exposed, as such you do not have a way to synchronize a pin with when transmission completes.

Your Uart Write code here is...

manic glacierBOT
#

Your Uart Write code here is neither synchronous nor asynchronous as it returns as soon as it places the last byte in the output queue of the IMXRT processor.

Both the atmel-samd and the nrf ports wait until the UART peripheral is no longer busy to return. I think, but am not sure, that mean that the last byte has been transmitted out of the FIFO. If the i.MX port is not doing that, then it should, and we would welcome that fix.

Re RS485. We could place a warning in the documentation ...

manic glacierBOT
#

I didn't spot any problems, but no testing performed.

Note: This is to fix the issues in https://github.com/adafruit/circuitpython/issues/6310

Please use the special syntax (by editing the initial comment on the PR) to 'link' issues that will be fixed by a pull request. It's super helpful. You can do this anytime before the PR is merged. (edited to add the link to the docs)

#

Before this change, it took 1085ms to generate 100000 random numbers (10.85us/number). After the change, it took 1104 (11.08us/number). The performance impact on m0 will likely be a bit higher, as it requires a longer instruction sequence to multiply 64-bit numbers together.

On a Trinket M0, your benchmark with the old RNG ran in 5067. With this new one, it takes 5216. That seems quite tolerable.

blissful pollen
manic glacierBOT
#

Working towards #6326. Adds links to guides for some of the more essential functionalities, particularly those in the CircuitPython Essentials Learn guide. These all seemed to be at the bare minimum of things that should get links to tutorials first, though more definitely still remain. If there are any others that fit, I can add them to this PR in a single commit.

Includes:

  • board
  • busio
  • bitbangio already references busio, so I would say this would get resolved too
  • ...
tidal kiln
tulip sleet
#

or there is an issue with the bootloader board name vs the CPy board name

#

they are often not the same

tidal kiln
#

thanks. need me to do anything other than point it out?

tulip sleet
#

just filing an issue is fine

tidal kiln
#

main cp repo?

tulip sleet
#

on circuitpython-org

onyx hinge
#

Rather than tinkering with it a lot can I just state that it works for specific neopixel chips and leave it at that?

tulip sleet
#

the new code uses a faster clock and multiple clock delays per instruction, to achieve different timings. It's pretty similar otherwise

#

Maybe better to copy the new code, so people don't use the old timings

#

the old code didn't work on certain strips

onyx hinge
#

yeah

#

You can use any NeoPixel (including a NeoPixel strip) but this code example only drives a single NeoPixel at a time.
I'd almost just rather change this bit, but it's probably just the laziness speaking. But also this example IS direct from the pio examples repo from raspberry pi, just adapted to CircuitPython

#

"you can use any WS2812-compatible NeoPixel"

tulip sleet
#

You could put a pointer to the current code as an aside; point into the cpy repo

onyx hinge
#

that's not a bad idea

tulip sleet
onyx hinge
#

it's got history, I know.

tulip sleet
#

I looked at the page and I didn't realize how detailed it was. It's a detailed tutorial for a timing sequence that doesn't work, maybe it should be reworked, sorry

#

and the neopixels it didn't work on are WS6812B's (see slack)

onyx hinge
#

OK, seems like doing what we can to stamp out the incorrect "everybody knows that..." would be for the good. I'll get it on a list to revisit.

#

I amended the text somewhat to say 'this is what the code does .. it's not the most compatible .. see circuitpython C code for the best example' and I can do more to improve it later.

crimson ferry
#

is UART parity acted on by the core in some way... report exception or no bytes read if it's wrong?

tulip sleet
crimson ferry
#

thanks, I couldn’t find any checking either, so I wondered if there’s any point in using parity. I have a CRC.

tulip sleet
#

I don't think there's any point, really. it's expensive in terms of bits, it misses many multi-bit errors, most data is 8 bits, not 7, etc. it was conceived of decades ago when computation was expensive, and communications could easily be less reliable.

#

example is that server RAM is ECC, not simple parity

manic glacierBOT
crimson ferry
#

@tulip sleet Thanks , that improved throughput ~38%, a lot more than I would have guessed. The setup is (3) esp32-s3 boards feeding 921600 UART packets (several hundred bytes each) almost as fast as they can to a single esp32-s3 receiver. Still slower than I expected, have to time the CRC separately to see how much that's contributing.

manic glacierBOT
manic glacierBOT
#

Hello I am new to Circuitpython

I just wanted to ask since strings are not allowed how can I send a Ascii string over Uart and the \n\r (basically ENTER over Uart):

My current code looks like this def get_psuState(): # Einlesen der psuState Daten
uart.write("psuState")
bytes_psuState = uart.read(173) # Read psuState over UART
string_psuState = ''.join([chr(b) for b in bytes_psuState])
string_psuState_split = st...

manic glacierBOT
onyx hinge
#

I wonder what "duty ratio 50%" means in this bit of the ws2818 datasheet. since the data is emphatically NEVER at a 50% duty cycle.

stuck elbow
#

on average?

tulip sleet
onyx hinge
#

@tulip sleet did you discover anything interesting about the "reset time"? this datasheet has 280us.

tulip sleet
#

I am not sure we do a "reset", in general

onyx hinge
#

that seems to be the term for the time between sequences/refreshes

tulip sleet
#

there is no explicit hundreds of microseconds delay anywhere, I think

manic glacierBOT
solid fjord
#

Sorry if these are semi random questions, but a few of us have been wondering a few things about the MSC drive you write out to the boards
So far I believe that all of the ones I tried are: FAT12 with 1 FAT copy and are marked in the MBR as with partition type 1. Do you ever instead use lets says Fat16? If so do you change the partition type?

onyx hinge
#
    if (block_num == 0) {
        // fake the MBR so we can decide on our own partition table

        for (int i = 0; i < 446; i++) {
            dest[i] = 0;
        }

        build_partition(dest + 446, 0, 0x01 /* FAT12 */, PART1_START_BLOCK, supervisor_flash_get_block_count());
``` looks like the partition table always says FAT12. However, I think some CIRCUITPY are big enough that they're actually FAT16.
solid fjord
#

Second part: wondering on Teensy when we flash a new copy with the Teensy tool, we end up wiping out the storage. There is an open issue on this #6309 on this. But I sort of wondering as you output stuff to file for location, if you also flash out a beginning FS?

onyx hinge
#

that happens in bool filesystem_init(bool create_allowed, bool force_create), if I understaned the question

#
        if (nclst <= MAX_FAT32) fmt = FS_FAT32;
        if (nclst <= MAX_FAT16) fmt = FS_FAT16;
        if (nclst <= MAX_FAT12) fmt = FS_FAT12;
``` f_mkfs chooses the fat type based on the number of clusters
solid fjord
#

Question is, if for example the .hex file you created, includes the file system which is then flashed... Then wont be able to maintain current contents...

#

I have seen that type code in a few places like in code, but was unsure.

onyx hinge
#

then, no.

#

the build artifacts (hex or uf2 files) shouldn't overwrite the byte ranges that are the CIRCUITPY drive, when they're in the same flash part as the main code

solid fjord
#

Thanks

onyx hinge
#

usually the rule for creating the hex file will only include sections that should be written. ```$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
$(Q)$(OBJCOPY) -O ihex -j .flash_config -j .ivt -j .text -j .ARM.exidx -j .data -j .itcm -j .dtcm_data $< $@

solid fjord
#

Yes - I noticed in the map files that there looks like there may be some defines for where the FS goes... So will be interesting to see if anything is defined in those areas

manic glacierBOT
#

Background

Hi, I'm working on a package called unigui that wraps displayio functionality into a widget set for use on CircuitPython boards as well as general-purpose computers and single-board computers via Blinka.

Problem

In addition to terminalio.FONT, I would like to have other built-in fonts distributed with my package. I'm accomplishing this for CPython by including BDF font files in my package and using the...

tulip sleet
#

FAT12 was not written out promptly by Windows; they claim to have fixed that. (Had to do with old support real floppies, I think).

At one time I considered faking a FAT16 filesystem with a lot of bad blocks, but that has not really been necessary.

solid fjord
#

I guess the follow on question might be why then use partition type 1? Which by https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs

The partition type (or partition ID) in a partition's entry in the partition table inside a master boot record (MBR) is a byte value intended to specify the file system the partition contains or to flag special access methods used to access these partitions (e.g. special CHS mappings, LBA access, logical mapped geometries, special driver access,...

#

1 is FAT12? Although most code tries to adapt using similar numbers for where the breaking point is for # of clusters

manic glacierBOT
#

My test code is in https://gist.github.com/727e476033edd1ec3dfc3ee995f89f97 and runs on the macropad.

I ended up having to add superstitious extra calls to background-write an empty buffer, and I had to make the non-dithered neopixel also write in a loop= even though a single loop should suffice.

        sm.background_write(
            gamma_program[:0]
        )  # For some reason, needs this (empty write) or the data gets scrambled
        sm.background_write(loop=nongamma_pr...
#

@mwisslead , by design (which I am not particularly fond of), pulsein on all CP boards wraps around if the incoming pulse is longer than the maxlen. I would prefer throwing a "Buffer Exceeded" or some such. In any case, it looks like your example is picking up an initial pulse (low?) then the five pulses (making six) and so wrapping the fifth around to the first position. You could work around this behavior by setting maxlen to 6 and dropping the first value.

onyx hinge
#

@solid fjord probably the OG devices were all fat12 and nobody identified a problem (like, windows/mac/linux all mount fat16 labeled as fat12 in the partition table) so it never got changed.

solid fjord
#

Thanks, we had to add in Fat12 support to our USBHost stuff... By default the SDFat librray has Fat12 turned off. I also had to update the code to allow for single FAT as SDFat assumes 2 fats...

manic glacierBOT
manic glacierBOT
tulip sleet
#

@solid fjord the first block (the partition table? I forget) is faked and is not really stored in flash, because it doesn't change

solid fjord
#

Yep the MBR which includes the partition table (first 4 entries) is record 0

orchid basinBOT
manic glacierBOT
#

Since pulsein is a very primitive protocol, lacking an end of transmission indicator, the only way to 'detect' the end of a series of pulses is by timing out. The somewhat arbitrary timeout value on the RP2040 was set to 65535 ( a little more than 1 second), which is why you see that in your output. If you have a use case that needs a longer pulse length than that, please let's discuss it.
I will look at seeing if the order of pulses can be retained in the case of buffer overflow; but someth...

#

by design (which I am not particularly fond of), pulsein on all CP boards wraps around if the incoming pulse is longer than the maxlen. I would prefer throwing a "Buffer Exceeded" or some such.

We would certainly be interested in adding this capability; it sounds like you have uses cases. It could be a new boolean option that defaults to the old way. It could be a constructor arg or a settable attribute or some other arg.

orchid basinBOT
manic glacierBOT
idle owl
#

@proven garnet Let me know when you're around. I have a potential quest for you.

stuck elbow
#

it's dangerous to go alone, take this

idle owl
stuck elbow
#

one coin
don't spend it all in one place

sharp jacinth
#

Oooh, a mango sounds nice. Promise it's fresh?\

idle owl
#

Oh yes, that is a promise.

sharp jacinth
#

I had ranch style beans for lunch so I have to do something to offset the unhealthy

sharp jacinth
stuck elbow
#

the coin is not bearded

sharp jacinth
#

not anymore!

idle owl
#

@gilded cradle For your PR, are you certain they're accurate? I'm happy to merge but I don't know where that ID comes from.

gilded cradle
idle owl
#

Ahh ok

#

Fair enough!

gilded cradle
#

I'm like 90% sure they're correct unless I made some typos.

#

Maybe more like 98%

idle owl
#

I don't believe you did. I'll scan for that and then merge it.

gilded cradle
#

Cool, thanks.

orchid basinBOT
#

Note, it's also missing on some ESP32S2 and ESP32S3 boards. For some of them it might be because there is no UF2 bootloader available, so that has to be checked, must some are definitely missing.

I ran a script:

adafruit_qtpy_esp32s2.md
ai_thinker_esp_12k_nodemcu.md
crumpspace_crumps2.md
electroniccats_bastwifi.md
espressif_esp32s2_devkitc_1_n4.md
espressif_esp32s2_devkitc_1_n4r2.md
espressif_esp32s3_box.md
espressif_esp32s3_devkitc_1_n8.md
espressif_esp32s3_devkitc_1_n8r2.md...
manic glacierBOT
#

@DavePutz are you saying that [65535, 300, 0, 0, 0] is what I should expect from alternating 300us high pulses and 70000us low pulses? I was expecting [65535, 300, 65535, 300, 65535] or [300, 65535, 300, 65535, 300]. Should I get [65535, 300, 0, 0, 0] using the 5 other ports that have pulseio? Can we agree that something is wrong if I run the same test with a esp32s2 and get a different result?

orchid basinBOT
manic glacierBOT
manic glacierBOT
#

I'm not using Matrix Portal library; direct adafruit_requests post methods with similar network setup via Internet connect guide, leading to the same symptoms mentioned here (hang, USB disconnect). My flash just wiped itself clean as I press reset button. So unless there's a manual wipe button sequence I just pressed, it seems like other things are wrong with my board. Not sure what to do at this point. I'll reset firmware and try to repeat symptoms I guess.

I might as well ask.: Should a ...

void tendon
#

Question re the 2.13" Tri-Color SSD180 Featherwing.
I have it connected to a Feather STM32 and am running the ssd1680_simpletest.py example. It displays the ruler image as expected but... After the 2 min timeout it prints 'code done running' and the 'Press any key...' message on the serial console. Now the funny part, 1 minute later the screen refreshes to black and and it displays on the e-Ink screen 'refreshed c/r Code done running c/r Press any key ...' Where is this coming from? I expected it to leave the last image visible on the screen.

stuck elbow
#

when the code finishes, it will show the repl, if you want it to keep showing the last image, add while True:pass loop at the end of your program

lone sandalBOT
manic glacierBOT
onyx hinge
#

@tulip sleet do these details look right?

#

for the rp2040 neopixel

#

values are all rounded of course

warm flame
manic glacierBOT
#

The 70000us pulse will be interpreted as and end-of-pulse, since it exceeds 65535. So, yes, I would expect that to terminate a pulsein. What I am unsure of is that leading 65535. The default idle_state on a pulsein is false, meaning that no signal should be getting counted until it goes high. I am investigating that. As for the esp32s2, that is using a ring buffer provided by the FreeRTOS layer; and I am not sure what that uses to detect an end-of -pulse.

proven garnet
onyx hinge
#

I wonder what's going on here, and I'm not sure it shows clearly in the video. but, it is like it goes rapidly sometimes and slower other times, in a regular alternating fashion. The loop is simple and without delays, though: ```python
while True:
pixels.fill(rainbowio.colorwheel(j := (j+1) % 255))

#

it's using my background-writing code so it may be something to do with that. just strange.

#

putting in a 10ms delay makes it "just about even" so it's probably fine

tulip sleet
onyx hinge
#

thanks

tulip sleet
#

I'm at a loss to explain the irregularity in the video, could it be gc??

onyx hinge
#

that's the only variable/unpredictable thing that comes to mind, but would gc even be running on most iterations of the loop? doesn't seem like it should, even though it DOES allocate memory every time through

#

cache interaction depending on the relationship of the address of the buffers to the memory that's being DMA'd?

tulip sleet
tidal kiln
tulip sleet
tidal kiln
#

no. only recently realized they were probably hitting that issue.

#

recently = this morning 🙂

tulip sleet
#

I have seen total of one bad flash chip, on a CPB

#

a local user sent me a few bad CPB's, out of about 70 he bought

manic glacierBOT
#

Baseline test of noise signal measured on the PyPortal Titano pin A0 (input to on-board audio amplifier). A 500kHz signal appeared in the spectrum, so the assumption for now is that the PWM brightness signal does bleed through slightly. It peaked at approximately 60mV, -60dB in the spectrum. The PWM noise signal didn't appear to change when the brightness was set to 0.0, 0.5, or 1.0.

<img width="1022" alt="titano_a0_noise_baseline" src="https://user-images.githubusercontent.com/29906257/1...

#

Testing the esp32s2 with the same python code just different pin name, I get no pulses at all for alternating 300us high 70000. I upped the off pulse to 100000 and I get [16128, 306, 303, 303, 303] which except for the first value is ok if long idles are intended to be ignored. For the sequence of [373, 215, 285, 327, 479], I get [33444, 228, 297, 339, 483] sometimes and [0, 228, 297, 339, 483] other times. If I drop the sleep time to 1.1 I get [384, 228, 297, 339, 483].

idle owl
solid fjord
#

Hopefully easy question: I am playing with a Teensy Sketch that allows you to plug in an CircuitPython board and make sure I can talk to all or at least most of the USB pieces. So for example I see your MSC type drive and I show it up as an MTP drive out of the sketch. Also I can send and receive stuff to the main USB Serial object:

I have a Python script on the CircuitPython (T4.1) that has code like:

    cbavail = supervisor.runtime.serial_bytes_available
    if cbavail:
        print("cbavail: ", cbavail)
        led.value = True
        text = input()
        print("*** Serial input ***", text)
        ...
        led.value = False

And when I talk to it with the teensy, the LED is on most of the time

#

Wondering if it might be end of line stuff? That is what happens if lines are sent with <CR><LF> vs just <CR> or just <LF>?

#

Note: after changing this code to look at cbavail... Found it was a bool...

idle owl
#

@onyx hinge Do you know of a simple way to figure out how many PRs were filed by PyCon folks? They were across multiple libs obviously, so I'm unsure how to have tracked them.

#

We also didn't label them.

onyx hinge
#

@idle owl no, not really.

idle owl
#

Ok thanks.

onyx hinge
void tendon
# stuck elbow when the code finishes, it will show the repl, if you want it to keep showing th...

Thanks, yes that works but the real problem is that I read the documentation that says e-Ink displays should not be used as the console. However when you initialize the display the Circuit Python backend sends all print statements to both the USB Serial Port and to the new display you just attached. This causes future print statements from both the program and the REPL to be sent to the e-Ink display as well as the USB serial console.
The 'fix' appears to be to release the display before printing any debug messages with 'print' and before exiting.
displayio.release_displays()

onyx hinge
#

@idle owl I don't think it could have been that many? adabot just has in its last report, "* 10 closed issues by 5 people, 8 opened by 8 people"

#

and that would cover the sprint days

idle owl
#

Hmm. Fair enough. Felt like more than that. Some are still open I think.

#

@lone axle See above. Do you know of any magic to figure out how many PRs came out of the Sprints at PyCon?

#

They were obviously across multiple libs.

#

I started digging around in your and Tekktrik's activity on GitHub because I figured you two reviewed most of them.

#

But I'm not certain of that.

solid fjord
#

Sort of answering own question, I believe you only want <CR> will have my sketch check and only send as such...

lone axle
# idle owl I started digging around in your and Tekktrik's activity on GitHub because I fig...

our recent activity is probably a pretty good start to get them. I don't know of any other specific ways. Maybe API queries with a date range filter if they allow that, but I've never gotten that specific with the API not certain if it does.

I was going to go through this weekend and get a list of them though. Specifically to have the list of contributor names to mention during the next meeting. But that would also give us a count.

idle owl
lone axle
#

Will do.

idle owl
#

Thank you!

lone axle
#

Ohh nice! that search syntax seems super helpful for it

void tendon
#

where did you read that

proven garnet
#

@idle owl I'm about to go for a run, but I'm here for the next 10 minutes and I see you're online!

#

Also tag you're it laugh

idle owl
#

Green dot kind of means nothing for me, I'm always a green dot 😄

#

The PR this came from also changed the spacing and location of the - on everything in the .yaml file.

proven garnet
#

Also, thanks for the cool PIO stuff @onyx hinge, it might come in handy at work so it's been good learning it!

idle owl
#

I did that initially, but thought maybe that was why it wasn't working. So I backed down until I only had what I linked.

onyx hinge
#

@proven garnet glad you're having fun following along.

idle owl
#

So... the spacing could be updated too to match cookiecutter.

#

Anyway... I assume a script could do it?

#

So that's the quest, if you choose to accept - update the libraries to match cookiecutter.

#

The second file in the cookiecutter PR is the one to match.

proven garnet
# idle owl Anyway... I assume a script could do it?

The spacing should be doable, I think PyYAML can do it pretty easily on the first pass through, and I think there was only one thing I would need to do on a second pass through (though I think it only mattered for the workflow YAMLs, I played with it a few weeks ago)

idle owl
#

Alright 🙂

proven garnet
#

PyYAML should make doing the change easy too

idle owl
#

Excellent.

#

No super rush on this, and, maybe do a couple of libs first to make sure CI still passes. Because the TestRepo has very little content.

#

But not NeoPixel 😄

proven garnet
#

Sure thing! I'll let you know if I hit any problems, but I should be able to get something running pretty quickly.

idle owl
#

Thank you so much!

onyx hinge
#

OK wow now I can make a colorwheel cycle so fast it looks like it's just white. video is 8x slow motion. flashing warning again.

idle owl
#

Wow. Impressive.

onyx hinge
#

my loop is ``` while True:
pixels.fill(rainbowio.colorwheel(i := (i + 1) % 256))

manic glacierBOT
#
  • Fix a problem when once=None and loop=None in background_write
  • Fix a problem where a zero-length buffer is passed in
  • Add support for byteswapping via the DMA peripheral
  • add ability to get, clear the txstall flag

This makes it possible to

  • actually wait for the transfer to FULLY complete (not just trickery like in the morse code example)
  • stop a background transfer after a full loop exactly
  • background write neopixels that 'act like' a pypixelbuf without manually swa...
onyx hinge
#

@tulip sleet now that I don't rely on ulab to copy and byteswap my memory, it's much faster and if there's still 'unevenness' I can't see it.

#

seems most of the time was in fact being spent in the byte swapping which is interesting to know. vs doing in the pio's dma peripheral.

#

the speed is a bit of a lie, 12 neopixels can really refresh at about 600Hz I think. but with auto_show=True nothing stops it updating the pixels multiple times (e.g., with .fill()) before the buffer gets looped once

#

1080us data + 320us gap = 1400us ~= 715Hz

manic glacierBOT
fluid ginkgo
#

Does ESP32-C3 have WiFi and BLE Support (With Adequate Documentation) with CircuitPython?

jaunty juniper
manic glacierBOT
manic glacierBOT
rough folio
#

Is there any interest in Prs for bitshifting the serial numbers for various libs into their decimal value? ie, sdc4x returns serials as <serial> <checksum> <serial> <checksum> <serial> <checksum> in a tuple

#

the decimal value for such being the first, second, and third values bitshifted over by 32, 16 and 0 then summed

#

(or at least a method to provide such to avoid breaking changes)

rain island
#

greetings i got my hands on a waveshare RP2040 with 160x80 pixel RGB display and the ST7735R driver is giving me a 26 pixel offset image on it ... i found some arduino topics about some offset registers that have to be changed but i have no clue where to find them in curcuitpython ... am i in the right channel to begin with?

rain island
#

fixed it myself after looking up all the parameters for displayio.Display 🙂

#

now for a more generic question, i want to init this display whenever i start my board, how can i make it available in the repl ?

#

when i put it in the code.py and switch to repl i can not access wwhatever has been done in the code.py

onyx hinge
#

@rain island You can put the initialization code you want to share in some other .py file, and "import" it from both code.py and from the repl.

#

@rough folio I don't know about the sdcx4 in particular and I may be misunderstanding your suggestion but it's worth noting that not all boards can handle 48-bit numbers as integers -- a lot of the older boards don't support "long ints" because there's just not enough space in their flash for the code that enables it.

manic glacierBOT
#

was having multiple issues at the time and wasn't able to get i2c working with the tic driver using busio, then switched to bitbangio as I could set the clock stretch to the same as the tic which is 1500us and haven't had issues since.

I'm having a feeling the heap allocation error might be a coincident when it crashed with using about 20 labels in conjunction with rgbmatrix, mp3decoder and neopixels. I did experience this a lot with the program before however I changed the design and only...

#

I don't really know. :) There are 12 DMAs; audio might claim 2 in the background, and this code now claims up to 2. so it looks like there should be plenty left over.

At first I wanted to say this was no change for existing code, but it IS a change. Before, if you had a LARGE buffer but couldn't allocate DMA, the code would fall back to copying in a CPU loop. Now, it will return an error.

onyx hinge
#

wow those docstrings were all messed up, I should have tested locally after doing copypaste

manic glacierBOT
onyx hinge
#

thanks dan!

#

@lone axle I notice you're scheduled to do the discord meeting on monday, and I'm scheduled on the 16th. The 16th is after I start my vacation. Do you want to swap so I am the host on may 9?

#

june 13 also needs someone else to take it, but I figure once scott's back you'll want to re-do the schedule anyway

lone axle
onyx hinge
#

Thanks!

#

I'll see if I can update the calendar

#

done!

lone axle
#

Your welcome

onyx hinge
#

-byte_count % 4 as a way to find the additional padding needed to make a buffer of byte_count bytes a multiple of 4. is there a less clever way to write it that is still succinct?

#

(-byte_count) % 4 at least makes the order of operations clearer, but I feel like the reason it works is mysterious

onyx hinge
#

I wonder if it's worth adding typecode= to the sm read/write methods. It lets you avoid the memoryview(buf).cast('L') business, which performs allocations.

#

self._sm.background_write(loop=buf, typecode='L', swap=True)

manic glacierBOT
random sedge
#

Any thoughts on adding the rgbmatrix module to the broadcom port (or making a standalone library for Blinka)?

lone axle
#

@low sentinel (or anyone else versed in core stuff)
Do you know how I could call this set_dirty() function:
https://github.com/adafruit/circuitpython/blob/5f4f66774ccb5f7f01d9a1e130676882a73ffed0/shared-module/vectorio/VectorShape.c#L184

From inside of Group.c here when the group gets sett hidden or visible:
https://github.com/adafruit/circuitpython/blob/5f4f66774ccb5f7f01d9a1e130676882a73ffed0/shared-module/displayio/Group.c#L47

I tried adding a similar looking layer initializer thing and then calling it this way:

layer = mp_obj_cast_to_native_base(
                self->members->items[i], &vectorio_vector_shape_type);
if (layer != MP_OBJ_NULL) {
    mp_printf(&mp_plat_print, "calling set dirty vectorio shape\n");
    common_hal_vectorio_vector_shape_set_dirty(layer)
    continue;
}

But it never gets inside of the if statement. I think it's because it's actually a Circle, Rectangle, or Polygon and not specifically a VectorShape.

I can't figure out the proper way to tell the shape object that it's dirty so that it will force a redraw. I'm pretty sure if I can get this to happen along with some other changes I made inside group we'll be able to hide and show vectorio objects by setting hidden on the group they belong to.

#

Ah, I might have figured out a way (unsure if it is good or best way, but it seems to work):

layer = mp_obj_cast_to_native_base(
                    self->members->items[i], &vectorio_circle_type);
if (layer != MP_OBJ_NULL) {
        common_hal_vectorio_vector_shape_set_dirty(common_hal_vectorio_circle_get_draw_protocol(layer));
    continue;
}
low sentinel
#

Yeah was going to call out draw protocol. I added it so common functionality like this can be abstracted. I could have sworn I wrote an example of calling a draw protocol method without knowing the type of the draw protocol implementation or the type of the shape which owns the draw protocol…

I am moving houses at the moment (my first house!) and my office is boxed or

#

—-or I’d go dig around for you!

lone axle
manic glacierBOT
#

Hi, thanks for your query! This sounds like an interesting use case, and the code would almost certainly be welcome in the community bundle if you chose to contribute it.

Can you identify a small subset of pkgutil that will satisfy your use cases and be implementable on CircuitPython? Perhaps you can prototype it in unigui, similar to:

try:
    from pkgutil import get_data
except ImportError: # Running on CircuitPython
    def get_data(package, name): ...

The CPython doc...

tulip sleet
low sentinel
#

holy moley I’m on mobile and that embed is huge sorry

lone axle
#

No worries. Thank you for the pointer!

manic glacierBOT
rough folio
manic glacierBOT
#

With a point in the right direction by WarriorOfWire I think the code from here is how this can be done in the more generic way without having to check for each possible type:

https://github.com/adafruit/circuitpython/blob/5f4f66774ccb5f7f01d9a1e130676882a73ffed0/shared-module/displayio/Group.c#L147-L152

I'll come back to this and attempt something similar for the changes in this PR to minimize the amount of new code needed.

onyx hinge
#

@tulip sleet looking at asyncio.event.Event I'm not sure it could be used for this. The docs sternly warn:

    # Note: This must not be called from anything except the thread running
    # the asyncio loop (i.e. neither hard or soft IRQ, or a different thread).

I'm not sure whether "the background task" fits these criteria, or how a problem would manifest if it didn't.

We have only the one thread, but "the background task" can interrupt code in odd ways that MP authors wouldn't have been considering.

#

a background task 'set' could interrupt the middle of 'wait', putting the Event into an invalid state, I think

#
    async def wait(self):
        if not self.state:
            # Event not set, put the calling task on the event's waiting queue
            self.waiting.push_head(core.cur_task)
```if background tasks run between `if not self.State` and `self.waiting.push_head`
tulip sleet
#

they don't have the background task, it's true, but I was considering just as a convenient boolean that can be polled when the scheduler runs

manic glacierBOT
#

With a point in the right direction by WarriorOfWire I think the code from here is how this can be done in the more generic way without having to check for each possible type:

https://github.com/adafruit/circuitpython/blob/5f4f66774ccb5f7f01d9a1e130676882a73ffed0/shared-module/displayio/Group.c#L147-L152

I'll come back to this and attempt something similar for the changes in this PR to minimize the amount of new
code needed.

Some additional context for $future_reader:

...

onyx hinge
#

I'll try Event and see what happens

onyx hinge
#

@tulip sleet ooh it kinda works .. something's weird though.```python

Let's alternate SOS and TEST, forever, using asyncio:

class AsyncStateMachine:
def init(self, sm):
self._sm = sm
self._event = asyncio.Event()
self._sm.background_callback = self._event.set

async def awrite(self, buf):
    self._sm.background_write(buf)
    await self._event.wait()

async def main():
#sm.frequency = sm.frequency * 100
asm = AsyncStateMachine(sm)
FILLER = array.array('H', [1]) * 8
while True:
for plain, morse in (
("SOS", SOS + FILLER),
("TEST", TEST + FILLER),
):
print(f"Sending out {plain}")
await asm.awrite(morse)
```It quickly completes 3 loops without the LEDs blinking the codes, which is weird. Then after that the "Sending out {plain}" message is shown just as it transitions from message to message. The FIFO doesn't have room for 3 copies of SOS+FILLER (the FILLER is enough to fill the whole FIFO) so I don't know what's happening yet. Anyway, that aside .. is this sensible from a user's point of view: await asm.awrite(morse)

tulip sleet
onyx hinge
#

it's flaky around soft reset and somehow also broke screen refreshing .. it's worse the faster I make the morse code blink. I think this is probably not really OK. And yeah I left it out but asyncio.run(main()).

tulip sleet
#

could also try avoiding using _asyncio and just use the Python versions: change the import in core.py in asyncio

onyx hinge
#

oh I didn't realize I was getting built in versions. Of Task but not Event, I guess?

tulip sleet
#

it is supposed to work, so this is something I/we will need to debug before springing Events on people

#

right, there is no native Event yet, but there's an unmerged PR

onyx hinge
#

I think it's more likely to be a problem with me running Event.set from the background callback

tulip sleet
#

in mp

onyx hinge
#

ah

tulip sleet
#

yes, maybe messing with the asyncio task queue from the background task is not a good idea

#

they are trying to add event support ot pin transitions and other stuff, if I remmember right

onyx hinge
#

I don't think I'll go too much further down this road right now

#

it'd be neat but it's a distraction too

tulip sleet
#

it would be easier just to set a shared boxed boolean or something, and await that. Event has this rescheduling side effect

onyx hinge
#

is that a thing that exists, or that has to be made?

tulip sleet
#

like the way I did the shared control objects in the asyncio guide

#

one task changes the control values, and the other monitors it. They take turns

#

via await asycnio.sleep()

#

did you add the background callback or is that already merged in via the PR?

onyx hinge
#

no it's just in a local branch

tulip sleet
onyx hinge
#

maybe so

tulip sleet
#

is there a .done value for the background PIO or not? That would be simple to poll

onyx hinge
#

yes

#

oops that doc is wrong

#

so there are at least two kinds of completion really

rough folio
#

I guess it's better suited as a documentation change

#

but for example-
scd4x.serial_number -> (int, chk, int, chk, int, chk)
sgp30.serial -> (int, int, int)
SHT31D.serial_number -> int

#

the scd and sgp in particular stand out here because they both use the same int,chk,int,chk,int,chk from the device, but the sdc4x lib doesn't cut the checksums and they both have different property names

#

it's a pretty minor issue I guess but I was still surprised

proven garnet
rough folio
#

grimnoirelabs has a neat toolkit for getting insights on dev activity on github

#

it's a little docker container that runs ES and a frontend- dumps all info about commits, PRs, issues, contributor info into an ES database and then does searches across it

proven garnet
#

Oh that's pretty neat, I'll check it out, thanks!

rough folio
#

it also tracks what organizations are contributing etc

#

was a project by.... some group of decent authority(?) to figure out diversity metrics for their projects

#

oh, linux foundation and community health

lone axle
#

@idle owl @proven garnet Here's the lists I came up with:
users:

awordforthat
jcerise
matt-land
davclark
rmblau
sabadam32
ktkinsey37
ryanskeith

PRs:

https://github.com/adafruit/Adafruit_Blinka_bleio/pull/44
https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad/pull/60
https://github.com/adafruit/Adafruit_CircuitPython_ST7789/pull/32
https://github.com/adafruit/Adafruit_CircuitPython_AHTx0/pull/13
https://github.com/adafruit/Adafruit_CircuitPython_BLE_iBBQ/pull/9
https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/pull/23
https://github.com/adafruit/Adafruit_CircuitPython_BLE_BerryMed_Pulse_Oximeter/pull/10
https://github.com/adafruit/Adafruit_CircuitPython_RFM9x/pull/73
https://github.com/adafruit/Adafruit_CircuitPython_BLE_Magic_Light/pull/10
https://github.com/adafruit/Adafruit_CircuitPython_JWT/pull/11
https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/pull/39
https://github.com/adafruit/Adafruit_CircuitPython_OAuth2/pull/7
https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/pull/116
https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/pull/22

These were just ones that I found with contributors I didn't recognize. 14 PRs by 8 contributors. Many are types but a few were other things. There were also a few from tekktrik, neradoc during this time range that went along with some of these but I kept it to just new contributors that I believe were at pycon.

ember iris
# rough folio but for example- scd4x.serial_number -> (int, chk, int, chk, int, chk) sgp30.se...

I think the deviations in the format are usually because a lot of the circuit python code is adapted from the provided c/c++ driver code that sensirion provides, which also sometimes deviates from datasheet (I think at some point they broke out some of their i2c drivers and bundled that specifically, and newer sensors now refer to the bundle for comms). The different formats can add complexity like you're facing when you just want to add a, "get the serial number" block, that's a good point to highlight

proven garnet
#

@idle owl whenever you get a chance, here's a gist with the result of the .pre-commit-config.yaml that my script outputs. It's slightly different than the one you gave me, it's actually more consistent with the spacing in the - --disable= parts. I also didn't change the black rev, but I can if you'd like!

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I'm not sure if we want this one, but it allows writing with the desired object size without any allocations. Before, memoryview().cast() would cause two allocations:

self._sm.background_write(memoryview(buf).cast("L"), swap=True)

after, you can write

self._sm.background_write(buf, typecode='L', swap=True)

which is allocation-free (as far as I know). background_write doesn't have the slicing arguments, so some use cases might still require allocations (`memoryview(bu...

#

Fixes #6263 by switching to https://github.com/adafruit/esp-idf, which has https://github.com/adafruit/esp-idf/pull/2 applied. The patch in https://github.com/adafruit/esp-idf/pull/2 is from https://github.com/espressif/esp-idf/issues/8770.

When the https://github.com/espressif/esp-idf/issues/8770 patch gets into https://github.com/espressif/esp-idf, we can switch back to using the upstream repo.

I re-tested that the delay is gone with this submodule change with an MSA301 on a Metro ESP...

#

The specific use-case shown above is to implement a NeoPixel-like class in CircuitPython using the background-write functionality.

The core allocates the buffer that is passed to _transmit, and its type is always 'B'. But I need the StateMachine to treat it as an 'L'.

This is an unusual situation. Usually, you'd create your array as the right type, like with array.array('L', ...) or np.zeros(..., dtype=np.uint16).

tulip sleet
#

@onyx hinge does the typecode arg only really need to specify the number of bytes? i.e.g 'L' and 'l' are treated alike? I am just thinking that specifying a typecode is obscure. But specifying the length of the data to transmit at once (1,2,4 bytes) is more in line with what the user is thinking about

#

so pass in a 1 or 2 or 4?

onyx hinge
#

that's an alternative. I was thinking about it in relation to cast which takes B/H/L

tulip sleet
#

maybe that is what a typecode is, and I am re-inventing the wheel

#

a typecode can specify floats and all kinds of other stuff. WE are really just talking about a raw byte/word/long

#

i was trying to see if the cast could be done once, earlier, but given the internal workings of pixelbuf, maybe not

manic glacierBOT
#

This could be explicated further. It could say that the typecode is one of B/H/L, which is used to set the element size as 1, 2, or 4 bytes. Or 1/2/4 could be passed in, since it's the length, not the actual type, that needs to be specified.

I am just thinking that why this needs to be specified requires a few sentences, and maybe better to put it here than repeat it in discord multiple times. It would be in a guide too, perhaps eventually.

"Unlike using memoryview.cast, this requires...

#

CircuitPython version

for itsybitsy m0 and gemma m0


Your adafruit_hcsr04.mpy does not work with CircuitPython 7.x -- To get the sensor to work, I had to install:

adafruit-circuitpython-gemma_m0-en_US-6.3.0.uf2

and then use:

adafruit-circuitpython-bundle-6.x-mpy-20211213.zip

After downgrading the Gemma to these version - the sensor now works perfect.

I tried multiple versions of 7.X - none worked, it was only when I downgraded back to 6.3.0 - that the sensor ...
manic glacierBOT
#

@WarriorOfWire First, thanks for the additional explanation this is all quite helpful. And the ability to define new shapes from python sounds awesome!

Looking into changing this I'm thinking I will need to expose the set_dirty() function in the protocol impl here:

https://github.com/adafruit/circuitpython/blob/5f4f66774ccb5f7f01d9a1e130676882a73ffed0/shared-bindings/vectorio/__init__.h#L22-L28

Does that seem right to you?

I made a first attempt at it and wasn't successful but am...

proven garnet
#

If I do the following, will the range statement eat up a lot of memory, or is CircuitPython smart enough to know to check the bounds:

if thing not in range(1, 14001):
  ...

Or is it better to explicitly check given the range:

if not 1 <= thing <= 14001:
  ...
#

Related to a PR where it seems like fitting on smaller boards was a concern so trying to take that into account

onyx hinge
#

A range object allocate storage for about 3 numbers (start, stop, and step), not 14000 numbers.

#

however, the explicit comparison version won't allocate any objects at runtime

#

oh and your tests aren't exactly equivalent, since the range doesn't include the number 14001

#

the range() version has 18 bytecodes, while the comparison version has 22 bytecodes. [checking in micropython because it's easier]

#
  raw bytecode: 22 19:06:02:04:20:81:b0:57:5b:da:46:07:22:80:ed:31:da:42:42:5a:59:63
  prelude: (4, 0, 0, 1, 0, 0)
  args: ['thing']
  line info: 20
  81          LOAD_CONST_SMALL_INT 1 
  b0          LOAD_FAST 0 
  57          DUP_TOP 
  5b          ROT_THREE 
  da          BINARY_OP 3 __le__ 
  46:07       JUMP_IF_FALSE_OR_POP 7
  22:80:ed:31 LOAD_CONST_SMALL_INT 14001
  da          BINARY_OP 3 __le__ 
  42:42       JUMP 2
  5a          ROT_TWO 
  59          POP_TOP 
  63          RETURN_VALUE 
  children: []
simple_name: g
  raw bytecode: 18 21:08:03:04:60:20:b0:12:05:81:22:80:ed:32:34:02:dd:63
  prelude: (5, 0, 0, 1, 0, 0)
  args: ['thing']
  line info: 60:20
  b0          LOAD_FAST 0 
  12:05       LOAD_GLOBAL range
  81          LOAD_CONST_SMALL_INT 1 
  22:80:ed:32 LOAD_CONST_SMALL_INT 14002
  34:02       CALL_FUNCTION 2
  dd          BINARY_OP 6 <in> 
  63          RETURN_VALUE 
  children: []
stuck elbow
#

I would use the comparison one precisely because of that off-by-one gotcha

onyx hinge
#

it's true, you don't need to remember how range() treats its endpoints if you write the explicit comparisons

#

(and if you don't need the step argument)

proven garnet
#

Thanks @stuck elbow and @onyx hinge for the thorough explanation. My thought was to use the explicit as well, thanks!

stuck elbow
#

the law of the least surprise

onyx hinge
#

I'm pretty sure I'd prefer to write the comparisons version than the range version, and it doesn't consciously have anything to do with 'unsureness' about what is in a range().

proven garnet
#

I agree, particularly because it's use is in conjunction with raising a ValueError so clarity in the code in that area is key I'd argue 😄

onyx hinge
#

(I feel like learning to write for x in range(...) and know what the range means will be valuable to most python learners)

manic glacierBOT
manic glacierBOT
#

I cannot reproduce this with busio.I2C() on a Feather ESP32-S2, either with 7.3.0-beta.1 or the pending https://github.com/adafruit/circuitpython/pull/6366 I2C fix. busio works fine. It's true that bitbangio gives the error above. I have been running for several minutes during each trial. I tested with only USB, with USB and an attached battery, and with a battery only, sending output to the default UART.

@kattni

import time
import bitbangio
import board
import busio
from...
manic glacierBOT
ornate breach
#

Not sure if this is the right place for this, but is the nRF5x support on the Adafruit DAP library complete enough to work?

#

I see there is files for nRF5x but I don't really have an nRF board on hand that I could actually try it out.

manic glacierBOT
manic glacierBOT
#

I'm not sure. I still don't quite have a full picture in my mind of how everything works together. But I'm picking up new pieces each time I dive in and attempt changes like this one so I'm getting closer.

I haven't noticed any unwanted effects of being done this way, however the only test scripts I've used are the relatively basic one in the issue #6204 and more complex one that is a modified version of the TabLayout example from https://github.com/adafruit/Adafruit_CircuitPython_DisplayI...

onyx hinge
#

@tulip sleet my phone popped up with a notification that had your face on it, and immediately disappeared. it could have been e-mail, I don't know. Did you need something?

tulip sleet
onyx hinge
#

OK, it may have been that; I'd read it on my computer a little earlier. Just wanted to check!

proven garnet
#

@lone axle I assume you're probably looking at PRs from PyCon today to try and close out as many as you can, but if you want, I was going to ask for a second look at a PR I'm reviewing. Couple instances of scope creep on it so it's grown a decent amount to the point where I would appreciate a second set of eyes. A second look from anyone would be fantastic though.

#

It's also still WIP based on recent feedback, though

lone axle
#

Anyone have experience with https://github.com/adafruit/Adafruit_CircuitPython_JWT ? I'm having trouble figuring out how to get the simpletest example running. It's expecting a secrets['private_key'] value in order to work but I don't see anywhere showing the correct formatting for that. I've tried generating a keypair and putting the private one in the secrets dictionary but am getting errors from generate() with everything I've tried so far.

onyx hinge
#

I had found that guide but hadn't found the right page yet!

proven garnet
#

Is there any CircuitPython hardware object with a value attribute that is purely read-only?

#

(or purely write-only)

proven garnet
#

Excellent, thank you! And is there a write only counterpart? Trying to determine how specific I need to be.

#

I assume AnalogOut

stuck elbow
#

sadly, no

#

maybe PWMOut.duty_cycle

proven garnet
#

But not specifically any kind of value attribute in something?

warm flame
#

Hi guals and guys ! I just got (last week or so) the Lilygo T-oi Plus that got esp32-c3 on it. There is no port of it yet. The lilygo t-01C3 is not giving me acces to the pins I have on the T-oi Plus

stuck elbow
#

but I think it can be read too

proven garnet
#

Got it, thanks!

warm flame
#

Is there a way I could mod the port for T-01C3 to use T-oi Plus ?

warm flame
#

thanks

stuck elbow
#

ask if you have any trouble with it

warm flame
#

sure will

manic glacierBOT
warm flame
onyx hinge
#

<@&356864093652516868> The weekly meeting is in about 80 minutes from now in the "circuitpython" audio channel. Please add your notes to the document if you haven't already: https://docs.google.com/document/d/19SfrFM1BeAqltmW6iBdWZYqqQ4lmiQaiqLzV8_ea7eo/edit?usp=sharing (and note if you'd like me to read your notes aloud). I look forward to catching up with y'all!

warm flame
#

@stuck elbow I am using the schematic to be sure what pin is what

stuck elbow
warm flame
# stuck elbow not sure what you mean
#define MICROPY_HW_BOARD_NAME       "LILYGO TTGO T-OI PLUS"
#define MICROPY_HW_MCU_NAME         "ESP32-C3"

#define MICROPY_HW_LED_STATUS       (&pin_GPIO3)

#define DEFAULT_UART_BUS_RX         (&pin_GPIO20)
#define DEFAULT_UART_BUS_TX         (&pin_GPIO21)

#define CIRCUITPY_DEBUG_UART_RX     DEFAULT_UART_BUS_RX
#define CIRCUITPY_DEBUG_UART_TX     DEFAULT_UART_BUS_TX
#

the tags after define

stuck elbow
#

I think the names of the pins are defined in the IDF

warm flame
stuck elbow
#

you need to look at where those nets are connected to the microcontroller

warm flame
#

ok

idle owl
idle owl
warm flame
#

@stuck elbow in this github the manufacturer added examples in one of them it says it got 7 neopixel, but I see none on my board

stuck elbow
#

maybe they connect additional neopixels?

warm flame
#

maybe. It's hard to tell

onyx hinge
# warm flame <@351136009922019331> in this github the manufacturer added examples in one of t...

https://www.hackster.io/lilygottgo/lilygo-ttgo-t-oi-plus-740139 there seems to be a neopixel "expansion board" like shown/linked here. it's up to the manufacturer to make sure the data they publish is clear, circuitpython can't do much about it.

Hackster.io

T-OI PLUS is based on the ESP32-C3 main control chip, ESP32-C3 is a safe, low-power, low-cost RISC-V MCU, supports Wi-Fi and Bluetooth 5 (LE By LILYGO.

warm flame
#

Something I won't use

inland tusk
#

Is the weekly meeting going to happen today

lone axle
#

Yes.

onyx hinge
#

We're finishing up our internal meeting, then i'll need 5 minutes to get set up

#

thanks for your patience

inland tusk
#

@errant grail What is your website URL?

errant grail
idle owl
#

@inland tusk Can you mute please?

manic glacierBOT
inland tusk
#

Jeff you have to release me before I can mute

lone axle
candid sun
#

love the targeting computer!

lone axle
random junco
lone axle
slender iron
#

I could play it with one hand while holding a baby

candid sun
#

thanks folks!

random junco
#

thanks all

proven garnet
#

Thanks!

ember iris
#

Thanks all!

proven garnet
#

@onyx hinge - use case for PIO is that we're trying to test an error we get when a pin is short for crazy short amount of time, like 40 nanoseconds. Couldn't even do it with Arduino using inline assembly. But PIO allows us to do even better because we can take advantage of the 8 nanosecond clock tick. Now we can test not just for upper limit but maybe even lower limit!

onyx hinge
#

@proven garnet cool! if you make a special overclocked build you should be able to go even lower than 8ns

proven garnet
#

Good point!

#

@idle owl was the formatting for the .pre-commit-config.yaml okay? My - --disable... lines are all at the same indentation as opposed to the example you linked, I assume that's fine if not preferable?

idle owl
#

I'm not sure why the spacing was changed so significantly in the example. I genuinely don't know what's preferable. The Gist you sent looks appropriate. If you made changes, please let me know so I can take a look.

#

(brb)

onyx hinge
#

this is apparently how far I got in 7 billion humans, and how long ago. no wonder I'm fuzzy on the details

proven garnet
idle owl
proven garnet
#

I'll probably patch this weekend then, will probably 100% post-check this one since I'm not entirely confident something won't potentially trip it up based on the moderate complexity.

stuck elbow
#

@slender iron great to see you back!

slender iron
#

Thanks! Happy to be back

#

ish

#

back-ish

stuck elbow
#

scheduling is always the hardest problem in CS ;-)

slender iron
#

🙂

warm flame
#
#include "shared-bindings/board/__init__.h"

STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
    CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS

    { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
    { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
    { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },

    { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) },
    { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
    { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) },
    { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },

    { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) },
    { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },

    { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
    { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) },
    { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
    { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) },

    { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
    { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
    
    { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
    { MP_ROM_QSTR(MP_QSTR_BAT), MP_ROM_PTR(&pin_GPIO2) },
    
    { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
    { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
    { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
    { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
    { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },

    { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
#

for this

onyx hinge
#

today the import of the notes doc into github was a pain, the "*" were spaced in more than usual and so it wasn't good markdown

onyx hinge
#

so I had to "delete 3/4/5/???" spaces in a lot of places. I hope I got it mostly right.

#

@idle owl why/how would it be any different than usual?

idle owl
#

Where I added the bullets to the list of PyCon PRs?

onyx hinge
#

no, like, all through status updates, almost everyone

idle owl
#

Ohhhhh.

#

OK.

#

Well then. I take it back.

warm flame
#

Am I on the good track or I'm off to be beaten with a stick ?

jaunty juniper
#

don't forget that the pins have to be defined in mpconfigboard.h for the default busses

warm flame
#

this is an other task

#

I am trying my best

#

@jaunty juniper I don't even know how to make the stemma_i2c definition in cpp

jaunty juniper
warm flame
#

np I need it for my project

#

what do I do with those ???

#

The SPI got like 5 different pins

#

and 3 of them are also ADC channels

manic glacierBOT
#

@dhalbert and others - I have been sort of curious why the Filesystem is wiped clean. So I have been doing some experiments.

Most of these are talked about on the Teensy form thread, that @roberthh (MicroPython) created for same issue.

https://forum.pjrc.com/threads/67232-Teensy-4-What-triggers-Halfkay-to-do-a-full-flash-erase?p=280127&viewfull=1#post280127

I hacked up a quick and dirty hex file range dump program from the Teensy_loader_cli app, that simply dumped the ranges of ...

jaunty juniper
#

they seem to be arbitrary names for the pins, in fact that picture on their site with the names on the silkscreen seems... self-contradictory

warm flame
#
// UART
#define DEFAULT_UART_BUS_RX         (&pin_GPIO20)
#define DEFAULT_UART_BUS_TX         (&pin_GPIO21)
#define CIRCUITPY_BOARD_UART        (1)
#define CIRCUITPY_BOARD_UART_PIN    {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
#define CIRCUITPY_DEBUG_UART_RX     DEFAULT_UART_BUS_RX
#define CIRCUITPY_DEBUG_UART_TX     DEFAULT_UART_BUS_TX

Do I keep both def ?

#

silk screens are devious sith lords

jaunty juniper
warm flame
#

yeah the old version had a long ceramic antena

#

the one I got is the one with the ui18 small red ceramic antena

jaunty juniper
#

I'd say we generally don't give pin names if they are not on the silkscreen and just an arbitrary convention of default pins, and I think the C3 can assign MISO/MOSI/SCK to any pin like the other EPS32 chips, but 🤷

warm flame
#

ok so I won't name them

jaunty juniper
warm flame
#

but the debug at the end are using the RX/TX def

jaunty juniper
#

ah well you can replace with the actual values

warm flame
#

but to have access to those you need to solder pins

#

The usb-c is functionnal

#

I'll remove the debug ?

jaunty juniper
#

I guess, I don't know what they're for in this case

warm flame
#

I copied the T-01C3 files

#

since it was the closest to T-oi Plus

#

Do I need to set the reset button and the on off switch from the battery ?

jaunty juniper
#

no that's not something you can access in software

warm flame
#

and for the battery power level ?

#

should I use A0 like the schematic is telling (A0 is also ADC1_CH2 and GPIO2)

manic glacierBOT
lone axle
#

Does anyone know if it is expected for an SDCard being plugged in or not to cause a difference in behavior on the SPI bus?

I'm noticing that a RFM9X FeatherWing has very weird / unexpected behaviors if I have the SDCard plugged in to my PyGamer. But if I remove the SDCard all behavior is normal.

None of my code initializes or does anything with the SDCard, my assumption was that would mean there should be no traffic on the bus related to SDCard stuff. But maybe some occurs inside the core that I am unaware of?

devout jolt
#

I vaguely recall something about init order being important. e.g. must init SD card first maybe?

jaunty juniper
#

oh yeah the SDCard has to be inited so it operates in SPI mode

#

otherwise it can interfere with the bus

#

(it's in sdio mode by default or something)

devout jolt
#

oh so maybe not initing the SD card can cause problems on SPI?

jaunty juniper
lone axle
#

interesting, so possibly if I do initialize it and configure it a certain way it could stop it from interferring?

devout jolt
#

give it a try? 🤷‍♂️ 🙂

jaunty juniper
#

I think if you init it with adafruit_sdcard it should do it

warm flame
manic glacierBOT
manic glacierBOT
warm flame
#

omg I feel nervous

#

lol

slender iron
#

the CI should build it for you

#

CI = continuous integration

warm flame
#

ok

slender iron
#

meaning it compiles all proposed code to ensure it still compiles

warm flame
#

So far one failed

#

😦

slender iron
#

why can't you compile locally? I may be able to help you get it going

warm flame
#

I use VSCode and I always have cmake errors

slender iron
#

what OS are you on?

warm flame
#

win 11

#

even on win 10

slender iron
#

ah, I haven't gotten CP compiling on windows myself