#circuitpython-dev

1 messages · Page 38 of 1

tulip sleet
#

yes, I was thinking that, since synthio is done too

#

I'll work on that, not a ton of things to write up

slender iron
#

👍 thanks!

manic glacierBOT
vale spire
#

heyya, a big cause of stack usage is the NLR buffers
you might be interested in https://github.com/micropython/micropython/pull/11445 (just merged this week) which was added specifically to reduce stack (and let us implement https://github.com/micropython/micropython/pull/11421 without using even more stack). there's some commentary there about the savings

GitHub

NLR buffers are usually quite large (use lots of C stack) and expensive to push and pop. Some of the time they are only needed to perform clean up if an exception happens, and then they re-raise t...

GitHub

This fixes #967 and my duplicate issue #11389. It makes the behavior closer to CPython and makes it easier to debug Python code that the interpreter is failing to import.

manic glacierBOT
manic glacierBOT
slender iron
#

Thanks @vale spire I was seeing the nlr struct as 52 bytes a piece. We were up to 216 for the full frame due to inlining.

tulip sleet
#

@slender iron @onyx hinge I have an 8.2.0 beta 1 prepared and will do it as soon as some pending builds complete correctly. It has all the synthio changes, the stack-frame slimming, and other rather minor stuff.

#

nothing else I see in the PR's is urgent

onyx hinge
#

very nice!

tulip sleet
#

minor problem in github right now: closed PR's are all marked as "Review Required". I have opened an issue with GitHub about this.

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 8\.2\.0\-beta\.1
orchid basinBOT
tulip sleet
manic glacierBOT
vague thicket
manic glacierBOT
random junco
onyx hinge
#

@tulip sleet any idea what's up with this PR build? It's failed a couple times on the scheduler "set up submodules" step with no useful info visible. https://github.com/adafruit/circuitpython/actions/runs/5216407307/jobs/9428497119

GitHub

CircuitPython - a Python implementation for teaching coding with microcontrollers - Add minimally tested Adafruit MatrixPortal S3 board def & update protomatter · adafruit/circuitpython@50951d8

#
subprocess.CalledProcessError: Command '['git', 'submodule', 'update', '--init', '--depth=1', 'extmod/ulab', 'lib/', 'tools/']' returned non-zero exit status 128.
Error: Process completed with exit code 1.```
#

oh it's probably due to not finding the ref in protomatter, because it's the subject of an active PR .. but due to the lack of visible output that's just a guess

tulip sleet
onyx hinge
#

Anybody tried an nrf board lately? I have a CPB that starts fine with 8.1.0 but not with 8.2.0-beta.1. I'll take a bit of time to bisect it before filing an issue.

#

there don't seem to be any recent nrf-specific changes so that's weird

jaunty juniper
#

could it be a bootloader issue ?

#
Adafruit CircuitPython 8.2.0-beta.0 on 2023-05-24; Adafruit Circuit Playground Bluefruit with nRF52840
Board ID:circuitplayground_bluefruit
UID:0A629303D56807CF
boot.py output:
onyx hinge
#

@tulip sleet do I have to use nrfutil to update this uf2 bootloader? ```UF2 Bootloader 0.2.11-8-g2c13fd5-dirty lib/nrfx (v1.1.0-1-g096e770) lib/tinyusb (legacy-755-g55874813) s140 6.1.1
Model: Adafruit Circuit Playground nRF52840
Board-ID: nRF52840-CircuitPlayground-revD
Date: Jul 13 2019

#

@jaunty juniper what's your tinyuf2 version at?

jaunty juniper
#

yeah absolutely, the old bootloader can't install UF2 with a payload over 512kB, which CP8 has gone over, I'm actually surprised it installs 8.1.0 at all

onyx hinge
jaunty juniper
#

yeah, we mentioned it a few weeks ago

tulip sleet
jaunty juniper
#

I prefer using the arduino IDE to install the bootloader (it installs 0.6.2)

tulip sleet
#

That sounds a lot easier. Is that in the guide ?

jaunty juniper
onyx hinge
jaunty juniper
tulip sleet
#

we should clean all this up: make a uniform guide page that could be mirrored (if possible), and update the circuitpython.org instructions to point to the guide

#

@jaunty juniper is the guide page in good shape, or should it be updated per your forum post?

onyx hinge
#

thanks both of you, I now have 8.2.0-beta.1 booting on my bluefruit.

jaunty juniper
#

also, can I task you guys with trying to convince the boss to update the NRF52 boards testers with a more recent bootloader version ? It would be nice if new boards sold were not unable to install CP without installing some toolchain first

tulip sleet
#

I have pointed that out, and I think it will be happening. But there's a large stock.

thorny jay
#

Also, I think I never updated the bootloader for my NRF board... every time it did seems complex/long, and since there was no need, I skipped that step.

jaunty juniper
#

and it's not required unless you have a UF2 over 512 kB in payload (wich means a 1MB UF2 file), which the CP8 build for CPB has gone over recently

manic glacierBOT
#

In my testing, the feather bluefruit can do 12 voices at 48kHz! This is a simple case (no LFOs, no ring modulation) so other situations might require a lower sample rate, fewer voices, or both.

The sound is a little artifacty & low-fi but I think that's down to the speaker & use of PWM instead of I2S.

However, and this is what made me think this wasn't working adequately back at pycon, touchio.TouchIn seems to wait for such a long time that it can cause audio crackles & drop-outs, so it...

idle owl
tulip sleet
idle owl
#

Nice, thanks. I'll use the existing list of links from Neradoc for now.

#

@tulip sleet Is something = ((a, b), (c, d)) a list? List of tuples. Or is it something else....?

stuck elbow
#

tuple of tuples

idle owl
#

Oh.

#
COLORS = (
    (255, 255, 0),  # Yellow
    (0, 255, 255),  # Cyan
)
#

Same?

stuck elbow
#

or how we mathematicians like to call them, a matrix

#

yes

idle owl
#

Ok, thanks.

#

I'll update my comments.

#

What about this one? ```py
SEND_ON_PRESS = (
Keycode.B,
Keycode.THREE,
)

stuck elbow
#

a tuple

idle owl
#

Ahh.

#

Ok.

#

Thanks!

#

The formatting is what made me second guess it.

stuck elbow
#

anything like (... , ...) is a tuple (sometimes the parens can be skipped), anything like [... , ...] is a list, anything like {... : ..., ... : ...} is a dict, and anything like {... , ...} is a set, and you can nest them all inside each other in arbitrary ways

idle owl
#

Right... I'm remembering now.

#

Silly formatting confusion.

manic glacierBOT
onyx hinge
#

@tulip sleet is my spelling wrong or something? ```h = digitalio.DigitalInOut(wake_hi)
h.switch_to_output(True)

l = alarm.pin.PinAlarm(wake_lo, value=False, pull=True)

input("hit enter to sleep")
alarm.exit_and_deep_sleep_until_alarms(l), perserve_dios=(h,))

I get "TypeError: extra keyword arguments given".
tulip sleet
#

perserve_dios -> preserve_dios

onyx hinge
#

NotImplementedError: preserve_dios

#

yup it was me, thank you

#

happen to have any idea how implementable it would be on nRF?

#

you can have a pin skip the gpio setup which maybe leaves a pin's output state alone? i dunno. bool nrfx_gpiote_in_config_t::skip_gpio_setup

tulip sleet
#

or it may be trivial, if pin state is always maintained

#

i just haven't looked; would need to spend a few minutes with the datasheet. Is h a power control pin?

onyx hinge
#

the idea is that this is to make one key in a key matrix be the wake up key

tulip sleet
#

it's not meant for alarm pin control, it's meant for other pin control

onyx hinge
#

so you set the column high and use the row as the wake pin

tulip sleet
#

got it

onyx hinge
#

oh good, I was becoming concerned the idea didn't make sense

tulip sleet
#

i'll look now ...

#

so it's possible, just need to avoid resetting the pins

#

the datasheet is not clear on this

onyx hinge
#

oh, cool!

tulip sleet
#

there is a lot of worry in the nRF forums about whether pin states are retained across reset, but that is not the issue here

#

@onyx hinge note edit: the datasheet is not clear on this, as far as my skimming could determine, but the reponse in the forums is probably correct

manic glacierBOT
willow totem
#

anyone using the scd4x co2 sensor? Specifically the adafruit scd4x circuitpython driver. I'm getting data_ready=false most of the time I try to check it (about every 30secs), but if I check in a loop (with 0.1s delay) then it reaches ready after 0.5-3.5s (varies). This seems like unexpected behaviour, and I've changed the default i2c frquency (its an es32s2), but still needs to be called in a loop rather than being ready after each new reading dataset is ready for pulling or has been updated (there is no pull method, only property accessors for co2/temp/hum). This is the repo of my code: https://github.com/good-enough-technology/Good-Enough_Air-Quality-Device_CO2-SCD4x_PM-SEN5x_CircuitPython

GitHub

Circuitpython code for the adafruit ESP32-S2 Reverse TFT (240x135) with Sensirion SCD4x CO2 sensor and SEN5x Particulate/Gas sensor - GitHub - good-enough-technology/Good-Enough_Air-Quality-Device_...

slender iron
#

@jaunty juniper you got a minute to talk keyboard layouts?

jaunty juniper
#

yes ?

slender iron
#

so I'm working on usb host and I think I'm to the point where I want to convert hid reports back to a serial stream into cp

#

I want to support setting a custom mapping

#

(I use colemak myself which shouldn't be default)

jaunty juniper
#

so you need to convert keycodes to keys then to composite keys to get the matching characters

jaunty juniper
#

so, a HID keyboard typically sends keycodes, unless you use a n-rollover type that instead sets bits, the bit position telling you which keycode is sent

slender iron
#

right, this is 8 byte reports with a bitmask for modifiers + 6 slots for keycode

jaunty juniper
#

yeah that's the standard one byte per keycode, unless all FF I think ? (or 7F ?)
the n-key uses a bitmap instead

tulip sleet
#

merging in steps

jaunty juniper
#

the layouts and keycode libraries that we have convert from letter to combinations of keys, they can be reversed to make it easier to index into

slender iron
#

ya, so I think I want a library that will take a standard definition and bitpack it into what we need

jaunty juniper
#

right now I use the xml files from https://kbdlayout.info/ to generate the layout files for windows, and I don't have a good source for mac

slender iron
#

the linux or bsd files should be somewhere

pallid creek
#

I’ve been playing with the Waveshare rp2040 1.28 inch round LCD board with touch support. There is already a CircuitPython build for the non-touch version of this board. Since this board has slightly different pin definitions (plus a touch sensor on I2C) would it be worth creating a second build? Alternatively could the build auto detect the board variant and adjust the pin defs?

tulip sleet
manic glacierBOT
lone axle
#

Does anyone leave circuitpython device connected via USB to computers that get shut down over night and booted back up daily? I've started noticing that if I leave certain devices plugged in that my computer will refuse to boot. The power in the computer turns on and powers the USB devices including the microcontroller, but then the computer never goes into post boot, grub or the OS login. If I unplug the microcontroller, then the computer will instantly start going on and finish the boot process normally. In my case it's a desktop running Ubuntu, but considering how early in the process it happens I'm guessing the OS isn't really a factor. Has anyone else experienced a similar issue where a computer will not complete the boot process while a microcontroller is plugged in, but then does move on instantly if the microcontroller is unplugged?

blissful pollen
willow totem
lone axle
#

Thank you both. The storage drive is an angle I hadn't considered. I could try testing with one that has storage disabled. My best guess so far was that maybe the connected devices are pushing it over some limit of how much current it's happy to deliver to the USB while it boots up. In my case it's got a hub with a few things other than the microcontroller as well, but it does boot up fine with all of that stuff plugged in.

willow totem
#

Try to update computer bios firmware, you might get lucky

manic glacierBOT
#

I tested and it's working great for the most part. The changes I made to the MatrixPortal library were successful. I did have 1 hard crash and it may not have been related to this PR. Basically, I was:

  1. I had a slots demo running
  2. renamed it to slots.py
  3. copied over a different code.py
  4. pressed Ctrl+D to soft reset the board

I tried the same thing a second time, but it just stopped doing anything once I renamed code.py. Anyway, it's pretty minor and unlikely to happen most of t...

manic glacierBOT
manic glacierBOT
winged willow
#

Oh btw if anyone wants it, I had to write a usb device descriptor and associated code to get my pico to show up as a joystick (since the adafruit gamepad in HID is pretty limited) to add a few more axis and buttons etc

midnight ember
#

@lone axle sounds like BIOS boot priority order if it has a mass storage device. i haven't encountered that with windows at all. definitely worth looking into because i have encountered it in the past with USB mass storage devices that are attached during boot just not adafruit products in particular. you can disable USB as a boot device in BIOS until you explicitly need it for that purpose.

#

the only time i ever enable usb as a boot device in bios is for updating the bios. i use it, update the bios, then disable it again because of issues like this which can happen.

manic glacierBOT
manic glacierBOT
brazen hatch
#

^ spam.

manic glacierBOT
manic glacierBOT
#

Not got around to creating a clean starter template yet, but this now has all the features I was looking for (except forwarding previously unforwarded errors to MQTT feed - TODO).

  • Logs errors at boot / safemode, plus Reason + traceback + timestamp.
  • Traps errors in code.py and saves to NVM before rebooting to save to flash filesystem in appropriate json file
  • Configurable error/boot/safemode log lengths, with free disk space checking and file rollover (If not enough space to add entry,...
thorny jay
#

Sorry I missed the weekly meeting, but I listened today to the "in the weed".
I was wondering what was wrong with keeping the current status quo where each major release has corresponding "mpy" zip file for the library. A few time there was no change in mpy format, but there was a new zip, just because the documentation say you must download matching library zip.

manic glacierBOT
#

I like the idea of an advanced example. I could certainly find it useful especially when beta testing and running into random hard faults or exceptions. A quick way to log errors to help myself and/or developers could be handy. It depends on the board though, some boards like an M0 just won't have much if any room for that kind of thing. I like the general idea.

manic glacierBOT
digital shoreBOT
onyx hinge
#

@slender iron @idle owl @gilded cradle will you folks be able to read the "state of" subsections you customiarily do?

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.0-beta.1-1-g24a58c3f5 on 2023-06-09; Adafruit QT Py ESP32S2 with ESP32S2

Code/REPL

import os
import ipaddress
import wifi
import socketpool

print("ESP32-S2 WebClient Test")

print("My MAC addr:", [hex(i) for i in wifi.radio.mac_address])

print("Available WiFi networks:")
for network in wifi.radio.start_scanning_networks():
    print("\t%s\t\tRSSI: %d\tChannel: %d" % (str(network.ssid, "utf-8"),
...
manic glacierBOT
manic glacierBOT
onyx hinge
#

good morning my fellow <@&356864093652516868> -- we'll have the weekly meeting here and in the circuitpython voice channel in about 70 minutes. Please take the time to add your notes to the notes document! https://docs.google.com/document/d/1GiH22DPaCVQ8D4cjhq2yJR73_bm3sTRZ35IE_L2bFBc/edit?usp=sharing

manic glacierBOT
onyx hinge
#

this is new, something (maybe discord streamer mode?) is ellipsizing a bunch of folks names in user lists... but not all. There's a related option which I hadn't noticed before. Turned off, because I think we usually want to see folks names in the video.

#

i'll be back in a few minutes to go through the pre-meeting items and let folks do mic checks

slender iron
#

that's probably the folks who have the new number-less usernames

devout jolt
#

nope!

turbid radish
#

🎉

lone axle
#
Patently Apple

In September 2021, Patently Apple posted a report titled "Apple is Reportedly Designing Various Embedded Subsystems across all Operating Systems using RISC-V." Today we're learning that there could be a major tectonic shift in the industry away from the Arm architecture to RISC-V by major players such as Qualcomm, Samsung, Nvidia and others that...

turbid radish
#

Colorful?!?

slender iron
#

I found these guide pages here:

tulip sleet
#

i think we need to mirror that in a few other places

gilded cradle
#

Thanks everyone

lone axle
#

Thanks for hosting Jeff. Have a great week everyone!

random junco
#

thanks for hosting jepler!

languid whale
onyx hinge
#

after upgrading the uf2 bootloader then reinstall 8.2 via uf2

devout jolt
#

thanks for hosting @onyx hinge!

tulip sleet
onyx hinge
#

Here is the notes document for next TUESDAY'S CircuitPython Weekly meeting. It is a day later than usual due to the US holiday of Juneteenth. It'll be at the normal hour of 11am Pacific / 2pm Eastern 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/1EHTaN12CCR8flRsp8fqL9uBP5Nw6PXX6mwCpdu_o5TU/edit?usp=sharing

devout jolt
manic glacierBOT
languid whale
# tulip sleet Of course let us know if updating the bootloader does not fix the problem

Thanks, Dan. That did the trick.
Now, however, Windows 11 complains a bit saying that it cannot copy the last bit of the uf2. Probably because the device exits the bootloader before the windows transfer is finished. I can see the drive change from FTHR840BOOT to CIRCUITPY as windows throws up the error. The board works fine, but probably a little alarming.

tulip sleet
lone axle
#

@tulip sleet The HTTPServer library raises this exception when I attempt to use it:

Traceback (most recent call last):
  File "code.py", line 46, in <module>
  File "adafruit_httpserver/server.py", line 151, in serve_forever
  File "adafruit_httpserver/server.py", line 178, in start
AttributeError: 'socket' object has no attribute 'bind'

I'm not certain if I have set up the socket correctly, I tried to match how it's done for requests. My code was essentially:

import adafruit_esp32spi.adafruit_esp32spi_socket as socket
# ...
socket.set_interface(esp)
server = Server(socket, "/static", debug=True)

Do you think it is possible to add bind() inside of here? https://github.com/dhalbert/Adafruit_CircuitPython_ESP32SPI/blob/compatible-socket/adafruit_esp32spi/adafruit_esp32spi_socket.py I could try to head down that road, but I'm not sure what the implementation would look like.

#

It looks like HTTPServer also makes use of accept(), listen(), and setblocking() as well in addition to bind()

tulip sleet
jaunty juniper
#

at least I think ?

#

I think it's a trick actually, not a real bind

tulip sleet
#

i don't know whether it's worth adding to http_server?We need to detect the implementer. Seemds like bind() can't be implemented by itself

#

@lone axle in any case, I wouldn't worry about it now, since it already doesn't work, right? merging the PR's is not going to break the possibility of server, since it's not possible in straightforward way already

lone axle
#

Yeah, I think it may be best left outside of HTTPServer. Since those functions aren't supported "for real" in the nina firmware. That UniversalSocket that Neradoc linked is a nice workaround that allows it to do something similar and I think having that "layer" in the code makes sense for folks doing it that way since the underlying sockets are still different with regards to those functions that are used in this use-case.

#

And yep, it doesn't work today, so nothing that works now is breaking. Just a possible new thing that won't actually work (without some layer inbetween like that UniversalSocket).

manic glacierBOT
manic glacierBOT
#

@todbot Yep, I've used that in the past with a Pi Pico and ESP32-S2 board. I can't believe I didn't think about using it this time...

Funnily enough my build uses the exact same pins as you mentioned (not that there's many to choose from on a Xiao!) and it works wonderfully. I used some code that you wrote as a basis and ran with it; I've fallen into the Eurorack universe so it's ended up with a pair of CV inputs, a pair of pots and a rotary encoder. It's in the middle here, and I apologis...

atomic summit
#

Hey folks 🙂 I remember seeing a board pin definition file that setup 2x I2C objects ( 2 different buses) but I cant seem to find it now.

I'm about to update my FeatherS3 pin definitions (finally) as I made the vertical STEMMA QT connector have seperate IO in my P7 (current) and P8 and U8 boards, and I want to expose that as an I2C object.

#

Any ideas which board might still have 2 defined that i can look over to ensure I do it right ?

tulip sleet
tulip sleet
atomic summit
#

I was only looking in the Espressif ports dir as I though there was an Adafruit ESP32 one from memory, but might have ben the rp2040!

atomic summit
jaunty juniper
#

the ESP32 QT PYs do it too

atomic summit
#

oh, lookin at the wrong board 😦

#

Ok, got it. I wasn't configuring it right - glad I asked !

#

Thanks @tulip sleet & @jaunty juniper 🙂

#

Hmm, so where does board_stemma_i2c_obj get defined?

#

Or more importantly, how does board_stemma_i2c_obj get associated with the second I2C array pins element?

#

I'm clearly missing something obvious

tulip sleet
tulip sleet
#

##-style concatenations happening

atomic summit
tulip sleet
#

np 🙂

manic glacierBOT
manic glacierBOT
pallid creek
#

Question: would there be interest in adding anti-aliased versions of the vectorio shapes?

#

I maintain a pure JS implementation of HTML Canvas. I think adding AA polygons and lines would be pretty straightforward.

low sentinel
#

I put some performance ifdefs in vectorio and displayio to dump pixel fill rate to serial log. If you get into it, you might take a look at some of those and see how your changes impact the simple circle/square draw routines' fill rates. Have fun 😄

blissful pollen
tulip sleet
onyx hinge
#

Ugh it's the long lived allocator

tulip sleet
#

that was fast!

onyx hinge
#

I'm guessing

#

We'll I saw something similar and ignored it but had a fear

#

There is a lot of objects referring to other objects in there by pointer and that tends to be trouble

manic glacierBOT
#

CircuitPython version

8.2.0-beta.1

Code/REPL

# see forum thread

Behavior

when some synthio objects (particularly the Synthesizer itself?) are imported, synthio breaks.

these objects refer to each other in complicated ways, e.g., AudioOut -> Synthesizer -> Note -> LFO

If one of these objects is moved (made long-lived) it would break the relationships.

At the same time, Notes in particular are not conceptually "long lived", so the usual th...

onyx hinge
#

that said, this user's code isn't creating the objects in what I thought was the problematic way so maybe it's something else

#

(at the top level of the imported file)

tulip sleet
jaunty juniper
#

that reminds me, I had someone having an issue with what seemed to be a display bus not being released when inited at the top of an imported module (so I suspected long lived) but I couldn't repro (they solved it by initing in code.py) so 🤷

onyx hinge
#

I think it's still relatively feasible to compile with the long-lived allocator disabled, that would be an easy way to confirm it was related or even a cause

#

just make gc_make_long_lived(void*old_ptr){ return old_ptr; }

blissful pollen
atomic summit
#

Hiya - I'm trying to build/test my FeatherS3 changes off a brand new fork and setup of CP on my machine, but I'm unable to build due to this error...

                 from ../../shared-module/displayio/Bitmap.h:33,
                 from ../../shared-bindings/displayio/Bitmap.h:30,
                 from build-unexpectedmaker_feathers3/autogen_display_resources-en_US.c:2:
esp-idf/components/newlib/platform_include/assert.h:20:10: fatal error: sdkconfig.h: No such file or directory
 #include <sdkconfig.h>
          ^~~~~~~~~~~~~
compilation terminated.```
#

I've triple checked I've installed everything correctly - but I did see this when running ./install.sh and . ./export.sh

#
fatal: No tags can describe '630c2724fc8c69eeaaa1bb025de52b99c5cb11aa'.
Try --always, or create some tags.
WARNING: Git describe was unsuccessful: b''```
#

I'm using python 3.9.17 for CP building.

#

But the rest of the install script ran and it seems it installed everything, but I've never seen that error before (not that I've noticed).

stuck elbow
#

seems like they edited git history

#

or something

lone sandalBOT
atomic summit
# stuck elbow or something

Possibly - I don't think the 2 issues are related - but I'm unable to build and I cant see what else could be causing this.

stuck elbow
#

I know there has been a change to how you checkout the git submodules, did you do it the new way?

atomic summit
#

Yeah, I did a port specific fetch - and then when it built is grabbed the esp-idf submodules like expected

#

trying a make fetch-port-submodules again

#

That didn't help. Tomorrow I'll try to revert back to an earlier CP tag and see if that fixes the issue.

stuck elbow
#

you could also try falling back to the global make fetch

tulip sleet
tulip sleet
#

Note that I am using adafruit/circuitpython, not my fork. But you said it was a brand new fork (or brand new clone)? Perhaps your fork has some version skew in it.

manic glacierBOT
onyx hinge
#

Is it probably needing git fetch --tags https://github.com/adafruit/circuitpython?

#

or make fetch-tags at the top level

tulip sleet
onyx hinge
#

@tulip sleet that's not how it looks in my testing, if I take care that no tags are available in the initial clone. [output snipped except for last command]

$ git clone --no-tags https://github.com/adafruit/circuitpython test
$ cd test
$ make -C ports/raspberrypi/ fetch-port-submodules
$ tools/describe
fatal: No names found, cannot describe anything.
#

this machine is also on an old git, git version 2.30.2

tulip sleet
#

sorry I meant that it fetches tags for the submodules, not the main clone

unique python
#

Last time I compiled for S3, I had to make sure to fetch the tags right after I cloned the forked repo:

#
% git clone <fork url>
% cd circuitpython
% git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD
% make fetch-submodules```
tulip sleet
#

maybe my fork has the tags I need already?

#

but the example above is not a fork

unique python
#

I see.. I thought it was.

tulip sleet
#

i mean the example of cloning adafruit/circuitpython (which is a fork of micropython). But I was not cloning my personal fork.

unique python
#

Sorry, yeah... jepler's example is not a fork. I think UnexpectedMaker's is though.

onyx hinge
#

My example is not a fork but I simulated one aspect of some github forks -- no tags, or tags that lag compared to "official" -- by using git clone --no-tags.

lone sandalBOT
manic glacierBOT
#

On devices where the code & CIRCUITPY reside on the same flash chip, the erase cycle (esp_partition_erase_range in this case) prevents other code from running unless it's been specially placed in RAM. I suspect this probably hasn't been done. (I didn't do it!)

Are there any Arduino examples that combine protomatter & USB mass storage? If so, how do they behave when writing to mass storage?

brazen hatch
onyx hinge
#

A newly created fork with the defaulted "Copy the main branch only" checkbox has no tags, so git fetch --all if it implicitly refers to your fork will not get the tags. git fetch --tags https://github.com/adafruit/circuitpython will. If you have an older fork without that setting, or you turn off the setting when forking, then you get a snapshot of the official tags that will not be updated without explicit action on your part, so for instance your build would still describe itself relative to 8.2.0-beta.1 even after 8.2.0-rc.0 is released.

manic glacierBOT
pallid creek
#

I did some more thinking about anti-aliasing over night. I don't think it is possible to add AA to the retained scenegraph nodes like vectorio shapes. My understanding is that DisplayIO doesn't use a backbuffer. Pixels in the dirty area are sent directly to the display, which does have an internal framebuffer but usually can't be read back to main memory. That means there is nothing to composite the partial pixels against. It would be possible to draw AA lines within a bitmap because then we have both the source and destination pixels. Bitmaptools has a function to do this. The other challenge is bitmaps use indexed palette, not full color, but I think there could be ways around that. General AA probably is impossible with current displayio, but for certain cases like drawing a chart with lines it should be possible.

slender iron
#

would be interested in how you'd change/improve displayio

#

@pallid creek I wanted to utilize the native scroll but it is often not the direction that would be helpful

pallid creek
# slender iron would be interested in how you'd change/improve displayio

Fundamentally I think DisplayIO is perfect for the constraints of drawing over a serial bus from a slow CPU with very little RAM, which has historically been the case for most things that CP runs on. Now with the Pico having a full in RAM framebuffer is possible and we have compute to spare. I'd suggest creating something like a CanvasBitmap class. You put that as your only object in the scene and then draw to it using fillCircle, drawLine type code. So you'd only get AA by opting in by using this new class.

slender iron
#

We do have framebuffer classes already for this

pallid creek
#

Meaning only on a device with the memory to support it.

slender iron
#

that displayio can render to

#

yup. displayio works on the samd21 with 32k ram 🙂

pallid creek
#

Which class is that?

slender iron
#

framebufferio.FramebufferDisplay is the displayio -> framebuffer

pallid creek
#

I see Bitmap. Do you mean framebufferio? I thought that was for LED matrixes

slender iron
#

it is used for led matrixes, picodvi and broadcom (raspberry pi sbcs)

#

It isn't used for spi displays atm

pallid creek
#

oh, interesting. Hmm. That opens some new possiblities. I need to write up some experiments.

slender iron
#

🙂

#

I created displayio so I'm happy to chat about it. mark, jepler and foamyguy have dug into displayio too

slender iron
#

some displays do have a sync line that could help with tearing

#

get a pyportal if you want to got down this rabbit hole because it has parallel display connection and the tear line (iirc)

pallid creek
#

I have a Matrix Portal on a 64x32 LED matrix. Is that the same chip underneath?

#

I've been doing desktop graphics since my Apple IIc as a kid, and I worked on the Java Swing toolkit and it's research predecessor. Modern GPU stacks are so complex. I like getting to mess with pixels and bits directly again. 😉

slender iron
pallid creek
slender iron
slender iron
pallid creek
slender iron
#

I'm not sure how fast it runs. @onyx hinge has done most of that work

#

it is literally PWMing RGB leds for you afaik

onyx hinge
#

the heavy lifting of doing that is done by the protomatter library. updating the special internal format used for clocking data out to the display takes a negligible amount of time, but I don't have a specific number handy. the displayio "fill" routines are still the displayio fill routines, though you can choose not to use displayio and just directly access the framebuffer as an array of 16-bit unsigned values (RGB565)

manic glacierBOT
manic glacierBOT
lone axle
#

Is it possible to change a string somewhere inside of the core to make a custom build that has a different default drive name other than "CIRCUITPY" ? I can rename it from a PC and it seems to stick, but I have a case where it'd be nice to have a different name as part of the built itself.

jaunty juniper
jaunty juniper
#

or on the make command line

stuck elbow
#

the name is set when the filesystem is created

#

you can actually change it from circuitpython code

jaunty juniper
#

yeah it won't change the name on an existing drive

lone axle
#

That's okay, I can use storage.erase_filesystem() if needbe to get it to re-init. Or in some cases I may loading circuitpython for the first time so maybe it won't have created the filesystem at all yet, but I think micropython is pre-loaded, I'm not sure how that factors in.

lone axle
#

Is there some 'trick' to using it? I added in mpconfigboard.mk

CIRCUITPY_DRIVE_LABEL = "CUSTOMNAME"

made a build loaded it on a device and then did storage.erase_filesystem() from REPL, but the drive came back as CIRCUITPY still when it re-connected.

slender iron
#

that may be too long

#

maybe not. I think the limit is 11

brazen hatch
#

EY YO

#

TELNET WORKFLOW

slender iron
#

@brazen hatch any issues with the stack changes?

brazen hatch
#

Nope, all that code runs under the million execs.

slender iron
#

👍

brazen hatch
#

Oh I did have a weird one yesterday

#

one moment

lone axle
brazen hatch
brazen hatch
# slender iron <@614096041083404300> any issues with the stack changes?

In one specific script, I had to do double

try:
    try:
        code
    except KeyboardInterrupt:
        raise KeyboardInterrupt
except KeyboardInterrupt:
    pass

To catch a single ctrl c.
If I used raise, it was caught. But a real one was not caught unless I did the double.
However I was like, "This is under 20 other functions. I cannot open an issue for that."

#

I did go back all the way to 8.0.0 and was reproducible.

#

But, nobody gonna find the root cause.

#

It would be a waste of time debugging it.

#

Heap and stack issues really are a pain.

slender iron
#

weird!

brazen hatch
#

Yea, it was only under a very specific script.

#

If it was on C3 I would just blame it there. But it was on S3.

manic glacierBOT
atomic summit
#

Thanks everyone for your feedback re the tags stuff - though I wasn't able to solve that tag error - I was able to get CP to build after @supple gale pointed me to the macOS brew gmake learn guide!

manic glacierBOT
tulip sleet
onyx hinge
#
Run wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
--2023-06-14 02:14:28--  
Resolving developer.nordicsemi.com (developer.nordicsemi.com)... 104.20.252.111, 104.20.251.111, 2606:4700:10::6814:fc6f, ...
Connecting to developer.nordicsemi.com (developer.nordicsemi.com)|104.20.252.111|:443... connected.
HTTP request sent, awaiting response... 526 
2023-06-14 02:14:28 ERROR 526: (no description).```looks like something's gone wrong on nrf's site, or maybe they've intentionally removed the old nrfutil.

oh it's a cloudflare error due to nordic having a wrong certificate, possibly. https://http.dev/526
http.dev

What is '526 Invalid SSL certificate'? Learn how to use and/or fix this HTTP status code, with free examples and code snippets.

slender iron
lone sandalBOT
onyx hinge
#

the "526" problem may have resolved, I've tried restarting those last failed builds again this morning.

tulip sleet
#

@onyx hinge I found tools/merge_micropython.py a few days ago. Thanks for that. I had done some of that by hand, but it pointed out some other things. I ran each stage one at a time to check for errors.

#

still have to review a couple hundred files

onyx hinge
#

That's Scott's script but yes it is helpful!

#

Depending where you're at I'd be around before the CE meeting to talk through any vexing parts

lone axle
jaunty juniper
#

I got the wrong file 😉

lone axle
#

Yep, I definitely owe it to you and then finding those pycubed devices when I grepped for the name that you pointed out to me. Those seem to be the only ones with the custom name in the repo

manic glacierBOT
manic glacierBOT
#

I'd like to leave it for now. I was wrong about it being the cause of the user's problem, but there's a real problem here which can arise when you do something like

# go_audio.py
speaker = I2SAudioOut(...)
synth = Synthio(...)
speaker.play(synth)
``

```py
# code.py
from go_audio import synth
synth.press(...)

which I believe is because of long-lived objects; the "synth" that is played on "speaker" is not the same "synth" that is imported from code.py, and so things don'...

midnight ember
#

If I have an itsybitsy, s2, s3, and another s3 all plugged in via USB it'll do a keyboard interrupt on all of them. It's frustrating to deal with.

brazen hatch
#

Wow what? That sounds like a bug..

#

Of bombows that is.

midnight ember
#

It happens when I open Mu too. REPL will attempt to connect to all of them and do a keyboard interrupt on all of them.

jaunty juniper
#

yeah I think it's a Mu issue that I have seen on Mac too, when there are multiple devices

#

at least I think I have seen Mu send ctrl-C when you open the serial panel sometimes

#

and that doesn't seem intentional to me

midnight ember
#

maybe that's why because i usually have Mu open 24/7, possible just a Mu issue.

idle owl
#

I can't remember if MacOS pokes all boards when doing things. I think it might. It will definitely poke one board during unrelated events from time to time.

#

Which seems likely to affect multiples.

jaunty juniper
#

there's software that can ping the drive and cause a reload

#

usually on mac the only issue I have is a reload within seconds after the board starts, but not always

#

(and the bug of opening a file on the wrong board with the Finder that was solved by setting a random device ID when formatting the CIRCUITPY drive)

idle owl
#

Hmm fair enough

midnight ember
#

in windows if i open a CIRCUITPY drive sometimes it will soft reboot all CIRCUITPY devices too which isn't an issue as most of my scripts will just run again. i think it has to do with USB waking or touching somehow.

jaunty juniper
#

I know some software like to ping drives when you do certain things, I think photoshop does or did that for example, some might do that when you want to save, like they are checking the drives before giving you the dialog or something

midnight ember
#

yes it feels something like along those lines

jaunty juniper
#

opening a file too tends to update the files "acess time" on macos (causing a reload) but I usually keep the files open during a dev session so it's not a big deal for me

#

so yeah manually managing reloads can be a good solution to avoid those

midnight ember
#

with multiple devices and projects i ping pong back and forth between them sometimes and if one of them hasn't been touched in a while it's like it sends a "soft reboot all the things" message to all the others.

jaunty juniper
#

that's so weird, could it be the text editor going like "hey let's save all" with multiple files open ?

#

or I guess yeah windows going "let's refresh all those drives"

midnight ember
#

for the soft reboot i think it's windows touching usbs

#

for the keyboard interrupt error probably mu

#

the keyboard interrupt error might as well be a hard fault because it stops anything in its tracks.

#

didn't know there was a way to catch and pass it, will be trying that when i have time.

crimson ferry
#

yeah, I have autoreload disabled in my standard boot.py to avoid all those spurious reloads

crimson ferry
jaunty juniper
#

as far as I know, I haven't seen it come back

crimson ferry
#

cool, yeah I've been erasing file system when I upgrade to get the proper uuid

#

I have too many problems with multiple devices plugged into USB without doing that

slender iron
manic glacierBOT
#

on specific SCK/MOSI/MISO pins, the common_hal_busio_spi_construct method always skips some miso pins which will lead to a invalid pin exception when SPI initialized

So the problem is on second loop of searching for mosi pins:
` for (uint i = 0; i < sck_count; i++) {
if (mcu_spi_sck_list[i].pin != clock) {
continue;
}
// if both MOSI and MISO exist, loop search normally
if ((mosi != NULL) && (miso != NULL)) {
for (uint j...

manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.1.0 on 2023-05-22; Adafruit Feather Bluefruit Sense with nRF52840
Board ID:feather_bluefruit_sense
UID:EA475CB29F814523

Code/REPL

import gc
import time
from adafruit_ble import BLERadio
from adafruit_ble.uuid import StandardUUID
from config import cfg

# For the wind speed and direction measurement
wind_device_name = "ULTRASONIC"
wind_service_uuid = StandardUUID(0x180d)  # New: UUID of the service in ...
manic glacierBOT
#

CircuitPython version

8.1.0

Code/REPL

import time
import ssl
import socketpool
import wifi
import microcontroller


# wifi.radio.connected

network = {"SPARK-YK3MAZ": "2XSGVxdwd9JDF"}
networkName = list(network)[0]#first network
networkPassword = network.get(list(network)[0])
print("connecting to "+ networkName)

connectionAttemptCounter = 0
while True: # connect to wifi
    try:
        wifi.radio.connect(networkName, networkPassword, time...
neon panther
#

Hey all, not sure if im in the right place but im having trouble adding frozen modules to a new board build im trying. i get the following error. what am i missing?
make: *** No rule to make target '../../frozen/Adafruit_CircuitPython_LSM6DS/frozen_cpx', needed by 'build-raspberry_breadstick/frozen_mpy'. Stop.

stuck elbow
#

hard to say without knowing what you did

neon panther
#

just added
# Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LSM6DS/frozen_cpx
to the boards/raspberry_breadstick/mpconfigboard.mk file
it builds fine without this line

tulip sleet
neon panther
#

OH, yup. that will do it. make sense as per insturctions to. i just misread and took the first line and modified it

#

Thank you!

lone sandalBOT
timid bolt
#

Greetings @tulip sleet , you were right about the size of the CPython asyncio library. Because I didn't realize that mpy files are inflated into RAM at runtime, the library uses too much RAM even for my tastes. 😳
So then...🥁 I've written code do to runtime freezing of loaded modules. Basically you boot, load all your modules into RAM, and then freeze them to flash. Now it is effectively the same as if all the modules were compile-time frozen and you have nearly 100% heap free to start running your program.
I've written the code for Micropython, but it could work for CircuitPython too. Let me know if you think this would be useful for CircuitPython.

slender iron
timid bolt
#

I use the filesystem.

slender iron
#

nice!

#

MP was doing something similar but it needed a custom filesystem

#

please make an issue or PR with more details

timid bolt
#

Well I needed to add an optional "mmap" method to the block device interface in order to get the flash address of files.

#

And I only plumbed mmap up through FAT FS. Idk how Little FS works, but if it is one of those flash filesystems that relocates blocks internally, then that would be problematic for implementing mmap.

slender iron
#

not all of them are XIP

manic glacierBOT
timid bolt
#

Yeah, I'm only using RP2. You don't need XIP, but you do need flash in memory space. But if you don't have flash in memory space, does compile-time freezing even work?

slender iron
#

where internal is in the memory map but external isn't

timid bolt
#

I claim it has feature parity with compile-time freezing. Do you think there is case where compile-time works but run-time does not?
It doesn't have to use the filesystem if the internal flash is not a filesystem. The linker could allocate it space statically.

stuck elbow
#

will it work with files larger than one block?

manic glacierBOT
stuck elbow
#

even if they are in non-consecutive blocks?

brazen hatch
#

a vfs class object that stores stuff in ram.

#

Or are you talking about mmap?

manic glacierBOT
#

Does it catch the exception repeatedly, then reset? ...or does it eventually connect? Failure 15 is WIFI_RADIO_ERROR_4WAY_HANDSHAKE_TIMEOUT. I recall it has occurred before if signal strength is poor, or also if there are more than one AP device with the same SSID (but different password). There are probably other triggers for that exception. Can you give more detail on the network environment (distances, number of APs, channels used, signal strengths if known from other connections, etc.)?

timid bolt
# stuck elbow even if they are in non-consecutive blocks?

It depends what we're talking about. The original mpy files don't matter. They get loaded into RAM as usual and then they could be thrown away. Then the freezing code freezes data structures from RAM into a file on flash. Conveniently the oofatfs library has a function for creating contiguous files on disk, and that is what I use. So the frozen file which the RAM contents is dumped to is contiguous, which is nice. Technically the whole file does not need to be contiguous, it only needs to be contiguous to the granularity of heap allocations, but I wouldn't worry about optimizing for that.

timid bolt
brazen hatch
#

So you are effectively making swap space for data structures huh..
Well sign me up.

onyx hinge
#

Conveniently the oofatfs library has a function for creating contiguous files on disk, and that is what I use
🤯

manic glacierBOT
manic glacierBOT
#

Before this PR, a call to start an AP with an invalid channel (not 1-13) would succeed, but the channel would be set to 1, and on espressif, the supplied SSID would be superceded by the default naming, ESP_XXYYZZ.

This PR borrows from the Monitor code and adds the check that the supplied channel is 1-13:

>>> wifi.radio.start_ap(ssid="ssid", password="password", authmode=[wifi.AuthMode.WPA2, wifi.AuthMode.PSK], channel=14)
Traceback (most recent call last):
  File "", line 1...
tulip sleet
#

@timid bolt Neat! If you are writing to CIRCUITPY, then the filesystem needs to be read-only to the host, which is not the usual case. So we need to think about that. Perhaps it should be another chunk of flash, and not necessarily even a filesystem. Also, we don’t want to write to flash on every restart and import, so it would be good to remember a signature or something and treat it as a cache or similar so an identical import does not cause a rewrite.

spare jacinth
#

While writing some code yesterday i found out that we cant define functions with positional-only arguments - or did i do something wrong. Which arent a extremely useful feature but....

def foo(var, /)

How hard would it be to add support for them? I dont mind writing some C, at all, but im not familiar with how the interpreter works and dont want to try and do something that is way above my knowledge

#

After a little thinking i feel like it would need:

  • add positional-only argument "type" (new entry on an enum?)
  • recognize the / in definitions to mark previous arguments as positional-only and next ones as keyword-only
  • enforce that positional-only cant be used with their names (perhaps just mangle their names?)
    But i have no idea how hard these would be
manic glacierBOT
#

Maybe it's not related to this issue, but let me share an observation:

I'm using an Wemos D1 R32 with the CircuitPython firmware 8.1.0 for doit_esp32_devkit_v1.
This was working fine for two days with code with utilizes a SS1306 on I2C to show its IP address.
In addition the on-board LED is used for blinking each 0.5sec.
The complete code section for I2C, display and wifi IP address is enclosed by try/catch. So even if it fails because of an I2C issue or no IP address it would start bli...

onyx hinge
spare jacinth
timid bolt
# tulip sleet <@1065334137243836517> Neat! If you are writing to CIRCUITPY, then the filesyste...

Since this is FAT, I set the System, Hidden, Read-only attributes on the file which should discourage the host OS from messing with it.

What is your concern about writing to flash every restart? Is it wearing out the flash? What is your experience with that in practice?

I wanted to make the frozen files durable (re-usable across reboots) however the qstr table is a large obstacle for achieving that. The freezing could be durable without freezing the qstr data structures, and this would add maybe ~15% of the module size back into RAM. So it depends on what tradeoff you want to make.

spare jacinth
#

i mean, i definitely get the idea of adding a new type of arg, and the extra parameter/argument/field and its logic where needed, but how that's implemented is way above my understanding

onyx hinge
#

I can echo that sentiment.

onyx hinge
# spare jacinth i mean, i definitely get the idea of adding a new type of arg, and the extra par...

It looks like what has stalled the acceptance in micropython is the request to split it into two PRs (just syntactically accepting "/" is the first part, and actually treating positional-only arguments properly is the second part, if I understand it right). In CircuitPython we're on the verge of changing our "mpy format" for CircuitPython 9 so it's a good time for us to take such a change. If you're familiar with using git, you could see what happens if you try cherry-picking that patch series onto circuitpython; it might be trivial or it might be difficult, because we carry various other changes to the core code.

spare jacinth
#

im only familiar with basic git commands. would it be something like git cherry-pick <hash>? guess i would also need the remote (and branch?) somewhere...

#

for now i simply named the "positional-only" argument of my mini-library (which almost nobody will ever use :p) with a dunder prefix, probably good enough for my use case
but the syntax seems like a useful feature to add, and if my limited knowledge can help, will sure do!

onyx hinge
#

I tried starting the cherry-pick and there are quite a few merge conflicts. It looks like it would make sense to try this again later after dan's work to merge micropython 1.19 into circuitpython has been done.

#

I am just guessing that the conflicts are in areas where micropython changed since our last merge

tulip sleet
timid bolt
tulip sleet
#

yep, a separate part of flash would be fine, and it wouldn't even need to be a file system

#

but then we have to decide how much to dedicate

timid bolt
#

BTW, how does this work in CircuitPython: I have a bunch of files open for write and I plug-in a MSC host. How do you stop CircuitPython from using those files?

tulip sleet
#

i don't know what we do if you plug it in when running, but I think we probably prevent the host from getting r/w access if CircuitPython already has it.

#

i'm not even sure we run USB enumeration if you plug in when running.

#

Have you seen the LittleFS MicroPython direct execute of MPY from the filesystem? I think we talked about that already.

timid bolt
tulip sleet
#

Scott is sitting next to me and he says for all boards with native USB, CIRCUITPY is read-only for CircuitPython unless you remount in boot.py. Only on ESP32, ESP32-C3 (no MSC) do we make CIRCUITPY writable when code.py starts.

timid bolt
onyx hinge
# tulip sleet Scott is sitting next to me and he says for all boards with native USB, CIRCUITP...

for boot_out.txt, there'a "pre USB enumeration" phase where the filesystem can be written without worry about interfering with the host. could this new mpy "optimization" step be done there?

@timid bolt can you explain again why it's important that the FAT files be contiguous? many devices directly map CIRCUITPY's storage into the regular data address space but not all (M4 Express, for instance)

#

and I'm not seeing why, without counting on flash being linearly mapped in the microcontroller's address space, FAT being contiguous matters

timid bolt
#

The whole file doesn't need to be contiguous, but it does simplify the implementation.
What needs to be contiguous are individual heap allocations when frozen. So if your flash block size is 4 kB, and you have a 5 kB array that you want to freeze, then you would need 2 contiguous blocks to do that. This situation is uncommon but not improbable in practice.

brazen hatch
tulip sleet
#

@timid bolt cached .mpy is interesting, but this is also a rabbit-hole. For asyncio, we have an existence proof that a small functional library is possible, from the MicroPython version. So I would rather head in that direction than work on ameliorations for large code size.

We can always freeze asyncio(EDIT: if necessary) (whatever version) on boards that have the firmware space, which is most. It is not code that changes very often.

brazen hatch
#

Imagine having ljinux which is 80kb cached. The boot time would be nothing.

tulip sleet
#

have you tried freezing ljinux?

brazen hatch
#

Nope. But I could.

#

Should I try it?

tulip sleet
#

of course!

brazen hatch
#

Actually I will do the complete toolset just to see.
jcurses, ljinux, cptoml, telnet_console and their deps.

#

What borb should I try it on?

#

I have too many now can't choose.

timid bolt
tidal kiln
timid bolt
tulip sleet
tulip sleet
brazen hatch
#

Well I am freezing onto yd-s3 which has 16mb of storage.

tulip sleet
brazen hatch
tulip sleet
#

this is nRF, so pretty diff. UF2 is protected and in flash

brazen hatch
#

Yea, I have barely touched nRF. Didn't know.

#

I haven't updated my bootloader ever.

#

Wait, is there no way to freeze .mpy's directly? It has to be a folder? Or am I missing something?

tulip sleet
#

there is some latent support for single files, but it's inherited from MicroPython.

brazen hatch
#

in py/circuitpy_mpconfig.mk:

PREPROCESS_FROZEN_MODULES = PYTHONPATH=$(TOP)/tools/python-semver $(TOP)/tools/preprocess_frozen_modules.py
ifneq ($(FROZEN_MPY_DIRS),)
$(BUILD)/frozen_mpy: $(FROZEN_MPY_DIRS)
    $(ECHO) FREEZE $(FROZEN_MPY_DIRS)
    $(Q)$(MKDIR) -p $@
    $(Q)$(PREPROCESS_FROZEN_MODULES) -o $@ $(FROZEN_MPY_DIRS)

$(BUILD)/manifest.py: $(BUILD)/frozen_mpy | $(TOP)/py/circuitpy_mpconfig.mk mpconfigport.mk boards/$(BOARD)/mpconfigboard.mk
    $(ECHO) MKMANIFEST $(FROZEN_MPY_DIRS)
    (cd $(BUILD)/frozen_mpy && find * -name \*.py -exec printf 'freeze_as_mpy("frozen_mpy", "%s")\n' {} \; )> $@.tmp && mv -f $@.tmp $@
FROZEN_MANIFEST=$(BUILD)/manifest.py
endif

It's really not ready for .mpy.
I should eventually fix this. It wouldnt even take that long.

manic glacierBOT
manic glacierBOT
crimson ferry
#

Any obvious reason why an ESP32-S2 with watch.timeout set to 300 (seconds) would reset with reason microcontroller.ResetReason.WATCHDOG with no apparent long timeout happening?

brazen hatch
#

A crash of some sort.

#

Many weird crashes are triggered by watchdog.

crimson ferry
#

that reset reason I thought was for alarm watchdog timeouts

#

should go 5 minutes, but it's happening quickly

#

it resetting, no safemode

#

Before I added alarm watchdog, it would crash but not reset itself. But adding the alarm watchdog makes it reset itself, just without the expectd timeout.

brazen hatch
#

Sounds like broken watchdog logic to me..
Like, it setting up the internal timer, then crashing, and then acting as if it was a user-set timeout instead of a crash.
But it's 4 am.. So eh idk..

manic glacierBOT
lone sandalBOT
manic glacierBOT
#

I think that's an error from some combined SAM D/E document. The product page for that processor says

Number of CAN Modules 0

https://www.microchip.com/en-us/product/ATSAMD51P20A

The two Adafruit MCP2515 boards (FeatherWing and Pico PiCowbell) are designed for 3.3v microcontrollers, but the CAN L and H are:

5V as required by the CAN Bus transceiver

I'd be a little surprised if the SPI speed is a bottleneck in an application. But true, the CAN-FD transceivers can oper...

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
wide thunder
#

Hello, I tried to compile circuitpython but got an error
CMake Error at esp-idf/tools/cmake/build.cmake:287 (message):
Some Python dependencies must be installed. Check above message for
details.
Call Stack (most recent call first):
esp-idf/tools/cmake/build.cmake:416 (__build_check_python)
esp-idf/tools/cmake/project.cmake:384 (idf_build_process)
CMakeLists.txt:19 (project)
Im using Fedora Linux

spare jacinth
#

Never compiled it myself, but the "python dependencies must he installed" sounds like you need to install some package with pip that will get used during compilation

#

And probably the error message told you which package(s) you are missing

brazen hatch
manic glacierBOT
manic glacierBOT
#

Similar behaviour ~24h later.

Meanwhile I modified the code in a way that no longer a sleep in my implementation's while-loop is used, but a check with time.monotonic(). The idea was that maybe the WiFi handling is blocked and D1 R32 and the router get in trouble (because of an expired lease). But this idea seems to be incorrect.

Next step was to restart the router by its web interface.
Remarkable
In the moment the restart sequence starts, the D1 RS32 get unblocked from "UID: ..."...

idle owl
#

@slender iron You around for a question?

#

(I saw you messaged in help-with not that long ago, so I thought it worth seeing if you were still around.)

#

I have a Feather nRF52840, freshly loaded with 8.2.0-beta.1. Copy the UF2 over, CIRCUITPY never shows up and the LED is solid yellow. This isn't in the Troubleshooting page that I saw, it only references safe mode regarding the LED being yellow. And this is not one of the states, especially not for 7.x+.

#

Trying to test wiring on a personal project, and not even sure where to start with this.

blissful pollen
#

There was some problem discussed a few days ago about the nRF bootloader needed up be updated as the UF2 size got too large

idle owl
#

Wow.

#

So I loaded stable, and got safe mode and here's why. You are in safe mode because: CIRCUITPY drive could not be found or created. Press reset to exit safe mode.

idle owl
#

This is running CP 8.1.0. Well, "running". Is the UF2 size thing a beta issue?

blissful pollen
#

I'm not 100% sure, let me see if I can find the messages. I just happened to read it as the discussion was ongoing

idle owl
#

I'll update the bootloader anyway.

#

It, um.... copied the UF2 file to the BOOT drive, and did nothing.

blissful pollen
#

#circuitpython-dev message

There was discussion then and before relating to this issue: https://github.com/adafruit/Adafruit_nRF52_Bootloader/issues/213

Not 100% sure if that is the issue you are experiencing but sounds similar

GitHub

Set up Feather nRF52840 Express with 6.0.0 bootloader. CircuitPython e9369d50e16e557ccd1a98c06d6e36bb87b908b7 . UF2s for the opt build flash ok but DEBUG=1 builds do not. Describe the bug Only part...

idle owl
#

UF2 won't work and I can't figure out how to get into DFU mode. Says ground DFU pin and reset pin at the same time

#

I don't see a DFU pin/button

#

wait is it part of the JLink header?

#

CIRCUITPY showed up eventually.

#

But I think the bootloader on this thing is ancient.

slender iron
idle owl
#

Yes I'm going through that.

#

And it's not working.

slender iron
#

if circuitpy shows up eventually then uf2 should still be working

idle owl
#

I tried it again, and it copies the bootloader UF2 file to the BOOT drive as a file, and nothing happens.

#

I redownloaded the file to try again there too.

#

Where are those files? Maybe the guide is out of date.

#

Wait, edited the guide page and clicked the button.

#

I have a link.

slender iron
#

what version does the boot drive say it is?

idle owl
#
Model: Adafruit Feather nRF52840 Express
Board-ID: NRF52-Bluefruit-v0
Bootloader: s140 6.1.1
Date: Dec 21 2018```
#

Downloaded straight from GitHub, still copies over as a file.

slender iron
#

that's too old to update via uf2

idle owl
#

🤦🏻‍♀️

#

I had the serial connected in iTerm

#

So the nrfutil couldn't connect to it.

slender iron
#

I've done that 🙂

idle owl
#

Trying the beta again

slender iron
#

after the bootloader update?

idle owl
#

Worked. Thanks, folks.

slender iron
#

💤 for me. ✈️ tomorrow morning

manic glacierBOT
thorny jay
#

"💤 for me. ✈️ tomorrow morning" <= Sleeping before going to the city that never sleeps... seems very much appropriate. (no tag to avoid waking you up)

slender iron
#

<@&356864093652516868> Just a reminder that the meeting is tomorrow (24 hours later then normal) due to the US holiday Juneteenth today. Thanks!

manic glacierBOT
lone axle
#

@tulip sleet in the esp32spi socket, do you think it would make sense to raise TimeoutError from here in recv_into instead of break: https://github.com/dhalbert/Adafruit_CircuitPython_ESP32SPI/blob/743afe6ae442efcc20bf79dd5c878677b7f85998/adafruit_esp32spi/adafruit_esp32spi_socket.py#L129-L130 In testing MiniMQTT more thoroughly I think that I am understanding that CPython and builtin wifi sockets do raise this exception when they reach their timeout if they haven't gotten any data. (I have a very simple CPython test script that does)

The behavior is used here: https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/40b90968fb744ebaffce6b09ca27b5a7e747bbff/adafruit_minimqtt/adafruit_minimqtt.py#L1028-L1032 for "standard" sockets. If I am understanding correctly we could implement that behavior in esp32spi socket, and then not have the need for the logic here that is treating them differently.

I wanted to hopefully confirm whether any of this makes sense before I go too far down the road on attempting that change and testing the results though.

tulip sleet
manic glacierBOT
#

CircuitPython version

8.1.0-beta.1-44
(Running on a Seeed XIAO nrf52840 Sense)

Code/REPL

import board
import busio
import time
from adafruit_lsm6ds.lsm6ds3 import LSM6DS3
import digitalio

# board.IMU_PWR provides the power to both the LSM6DS3 chip and also the pullups to the I2C bus
pwr = digitalio.DigitalInOut(board.IMU_PWR)
pwr.switch_to_output(True)
print("Starting")
time.sleep(5)
print("Connecting to IMU")
with busio.I2C(scl=board.IMU_SCL,...
brazen hatch
#

Pico-sdk update blocked by -Wundef of py/circuitpy_defns.mk.
Do I remove the flag, or do I duplicate the file and include it for use only on pico-sdk?

#

Most certainly this ain't gonna change from the pico sdk side.

manic glacierBOT
gusty elk
#

what is CTX mode in aesio?

manic glacierBOT
lone sandalBOT
crimson ferry
#

why does adafruit_feather_esp32s3_nopsram board.c have (no never reset debug uart)```c
void board_init(void) {
reset_board();
}

void reset_board(void) {
// Turn on I2C power by default.

gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT);
gpio_set_level(7, true);

}
but `adafruit_qtpy_esp32s3_nopsram` `board.c` hasc
void board_init(void) {
// Debug UART
#ifdef DEBUG
common_hal_never_reset_pin(&pin_GPIO43);
common_hal_never_reset_pin(&pin_GPIO44);
#endif
}

#

maybe we need a canonical board def for each chip, boards defs maybe vary based on what other board(s) were used as a template

manic glacierBOT
crimson ferry
#

Another difference: adafruit_feather_esp32s3_nopsram mpconfigboard.h has the standard busses like this:c #define DEFAULT_UART_BUS_RX (&pin_GPIO38) #define DEFAULT_UART_BUS_TX (&pin_GPIO39) but adafruit_qtpy_esp32s3_nopsram mpconfigboard.h has:```c
#define CIRCUITPY_BOARD_UART (1)
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO5, .rx = &pin_GPIO16}}

vale spire
# tulip sleet got it 🙂 I agree it would be useful, and we can take inspiration and code from ...

hi @timid bolt (I'm from MicroPython project) I'm not sure if you saw it linked from the PR that @tulip sleet already linked to, but the real PR of interest (IMO) is https://github.com/micropython/micropython/pull/8381

so to clarify a point from the discussion above, our plan wasn't to have contiguous files on littlefs, rather to have a dedicated mmap'able filesystem for .mpy files. this could in theory be written to by the device, but our plan (as implemented in that PR) was just to have a way to have mpremote send the filesystem image over to the device. (it's really fast, because you're just writing whole contiguous sectors... i.e. 8-64kiB at a time)

see https://github.com/micropython/micropython/issues/8426#issuecomment-1276997914 where i have some performance stats for MSC vs mpremote vs mpremote-mappable-filesystem

(it's basically fast enough that for most projects you can just deploy the entire filesystem in your regular dev cycle -- copying a whole directory tree of .mpy files is basically as fast as copying a single .py file in other ways, i.e. mpremote/ampy/msc)

I'm not quite following your discussion about FAT and contiguous files with respect to freezing (freezing is completely unrelated to the filesystem), but happy to answer any questions. I've talked to Scott about this a fair bit -- we spent some time exploring the possibility of the .mpy format being broken up into (say) 512 byte chunks which would allow .mpy files to be mmaped from any filesystem, but this comes at a huge cost and i don't think worth pursuing

GitHub

This is part 2 of #8191 (new mpy v6 file format). The PR adds the ability to place .mpy files in a special filesystem ROM and import them inplace so they don't take up much RAM. This is essen...

GitHub

Are there any plans to increase MSC support here? CDC+MSC may be great Thanks

manic glacierBOT
#

Hi Everyone, I'm Ron from WIZnet HK.

After viewing these issue, I wanted to try to modify our socket section that allows the SSL function could work on our PICO board in circuitpython.

Will there be anyone could help me to give some guideline to work on this development?

Also, I had join the discord chat as well. Which hastag section that I bring up this topic?

manic glacierBOT
manic glacierBOT
tulip sleet
#

@ruby pilot @timid bolt You may also be interested in Greg's thoughts and work on asyncio (or really its underpinnings). See https://docs.google.com/document/d/1xlzTEdP8ovTtz5Sx8voP8R9M8fY88LuyiWBYu0muiRc/edit#heading=h.e5q2xniyfysc, which maybe you have already seen, and is reflected in https://github.com/adafruit/circuitpython/pull/7711. Greg and I discussed this and think it is going in a different direction than what MicroPython has done for asyncio and is thinking about for the future, but you may still be interested. Greg has been experimenting with sample code (not yet published) that uses what the PR and the asyncio library rewrite provide.

manic glacierBOT
#

On my i5-1235U laptop this speeds LTO "partition=balanced" builds substantially, because each "partition" can be run on a separate CPU thread. I used "pygamer" as my test build with a parallelism of -j4, and took the best elapsed time reported over 4 builds.

The improvement was from 34.6s to 24.0s (-30%).

A link-only build (rm build-pygamer/firmware.elf; make -j...) improved from1 17.4s to 5.1s (-70%)

The size of the resulting firmware is unchanged.

Boards that are nearly full u...

manic glacierBOT
spare jacinth
#

Is support for settings.toml with os.getenv written in C or Python?

I would like to open a PR adding support for booleans on it, as (dis)abling stuff from it seems like a common scenario.

And asking is faster than digging the codebase 😬

tulip sleet
brazen hatch
#

My keyboard is dying. It's got bools

#

And strings and math stuff.
I just need to do more advanced types at some point.

spare jacinth
#

I also made a very basic parser a week(ish) ago, will try and PR your repo with some stuff

#

But that will be in, at least, a few hours 🙃

brazen hatch
#

Well, if you need me, I am here.

manic glacierBOT
#

The DevZone post you link to says:

Just adding that the UARTE TX has to be stopped explicitly when it's finished. If you just close the UART without stopping the transactions the UART will continue to keep the clocks running, as described above.

This can be done through the nrfx_uarte_tx/rx_abort() functions, or the TASKS_STOPRX/TX registers directly.

If you do this before disabling the UART the above workaround is not needed.

Could we do the _abort or use the TASKS_ST...

slender iron
#

<@&356864093652516868> Just a quick reminder that the meeting is in 20 minutes.

tulip sleet
#

was spacing out on that 🙂

#

was planning to walk to the grocery store

idle owl
#

My audio output is borked. I can't hear anything yet.

slender iron
#

k, we'll wait

midnight ember
#

i usually play a youtube video in the background when swapping between audio sources to know when i'm on the right one

idle owl
#

Fixed.

#

Well workaround fixed anyway.

spare jacinth
#

FYI: I sometimes have to rejoin the channel for audio to fix

idle owl
#

I rewired a bunch of things last night and apparently the audio is borked.

idle owl
midnight ember
#

make sure audio/mic is selected in discord. it's possible for the computer audio/mic is set independently of what's set in discord. i've done that a few times.

idle owl
#

This was entirely my rewire. I had music playing, and it wasn't coming through either.

#

So I switched everything to my Scarlett monitor, which works fine, and put on headphones instead.

timid bolt
# vale spire hi <@1065334137243836517> (I'm from MicroPython project) I'm not sure if you saw...

Hi @vale spire, I looked at PR 8381 and it seems like it is only going to access from flash the bytecode and string constants stored in the mpy file. I initially did something like that but was disappointed in the results because it didn't free up enough RAM. The bulk of RAM usage came from the globals/locals maps of the modules and their types. Just freezing the strings and bytecode didn't put a big dent in RAM usage, so I ended up taking a different approach. This approach works like a relocating garbage collector that relocates module-related data structures into a 2nd gen flash heap.

manic glacierBOT
onyx hinge
#

ooh cool about the swirl grid

midnight ember
#

pushing developer mode to production, reseting every 5 seconds is fine. 😛

#

USB and simple file editing FTW!

idle owl
#

You're welcome!

midnight ember
#

awesome story

#

I've never heard of LLD or LLVM, short explanation please?

#

thank you

#

ah ok

onyx hinge
#

LLVM is a set of compiler and toolchain technologies that can be used to develop a frontend for any programming language and a backend for any instruction set architecture. LLVM is designed around a language-independent intermediate representation (IR) that serves as a portable, high-level assembly language that can be optimized with a variety o...

tulip sleet
#

ok now

onyx hinge
#

@midnight ember maybe check out what scott did with json streaming, it sounds like it could be useful here.

spare jacinth
slender iron
onyx hinge
#

The lld subproject is an attempt to develop a built-in, platform-independent linker for LLVM.[49] lld aims to remove dependence on a third-party linker. As of May 2017, lld supports ELF, PE/COFF, Mach-O, and WebAssembly[50] in descending order of completeness. lld is faster than both flavors of GNU ld.[citation needed]
I think it's "l" for llvm + "ld" as the standard name of the unix linker

midnight ember
#

i'm used to only using the requests library, is it the chunked stuff? that could be helpful sure. i have no experience with it. have a link i could check out for a stream example?

tulip sleet
midnight ember
#

Here's an example of a geographic area. too much data for an m0 for example.

#

did you ever figure out how to play the enterprise game Jepler?

#

the grid mounting thing i'm definitely getting some

onyx hinge
#

@midnight ember I didn't play trek on runcpm, no. I did on my real xerox 820 🙂

midnight ember
#

TRRS guide, hence the audio issues getting back to discord? Usually happens when playing with audio projects.

idle owl
#

I used to be able to do them in 42 seconds!

#

That's amazing!

midnight ember
#

Very nice Melissa, great updates.

onyx hinge
midnight ember
#

thank you

gilded cradle
#

Thanks

#

I also have some thoughts

brazen hatch
#

1 whole version (8.0) is enough of a transition period I feel like.

gilded cradle
brazen hatch
#

cptoml could be feature complete (with lists and dates) in like 2 days of work..

crimson ferry
#

need to make sure we educate users on what the key fields in settings.toml do, web workflow or not, WiFi credentials without enabling web worklfow, etc.

#

...resolve the question of whether auto-connect is made distinct from web workflow

onyx hinge
#

maybe start with just a very small number though?

crimson ferry
#

yeah, wifi being the key thing (oh, sorry, that was about guides probably)

manic glacierBOT
#

We have an existing line of code that sets different flags for SDK files (including -Wno-undef) but it evidently is not being applied to this file. It may be because it is a ".S" file or for another reason I'm not aware of:

SRC_SDK := $(addprefix sdk/, $(SRC_SDK))
$(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK) $(SRC_CYW43)): CFLAGS += -Wno-missing-prototypes -Wno-undef -Wno-unused-function -Wno-nested-externs -Wno-strict-prototypes -Wno-double-promotion -Wno-sign-compare -Wno-unused-variab...
crimson ferry
#

secrets.py access tend to be in the high-level device helper libraries

onyx hinge
#

about 125 bundle examples seem to use secrets.py; about 106 learn files (just looking for the string "import secrets"). fwiw.

#

libraries/helpers/portalbase/adafruit_portalbase/network.py:37:18: from secrets import secrets

crimson ferry
#

esp32spi wifi manager

#

esp32spi also has enterprise credentials from secrets

gilded cradle
#

I think the way this will affect guides the most is instead of telling users to add some API key to secrets.py to instead add them to settings.toml.

midnight ember
#

yes

onyx hinge
#

@crimson ferry I didn't find it in a super quick search, is ther an issue proposing the enhancement of "connect based on settings.toml but do not start web workflow"?

midnight ember
#

can do 👍

crimson ferry
#

I'll check, Neradoc would know

onyx hinge
brazen hatch
#

Also at some point, we should also try to make it store multiple wifi credentials for portable boards.
Because with software implementations it means no web-workflow.

midnight ember
#

yes that would be preferable to be able to separate them and disable web workflow if possible for a requests only project

#

sounds like a plan

brazen hatch
#

Yea that code still needs work, to be able to handle it from software.
Cause those interfaces cannot be stopped, disabled of handled like a console object.

#

unlike usb_cdc

midnight ember
#

does neradocs keyboard layouts have capability for different keyboards like azerty? could use some of that?

brazen hatch
#

me waiting for them to find out arrow keys

#

It's 3. 3 bytes.

#

And some function keys also have similar keycodes.

midnight ember
#

⬆️ ⬇️ ⬅️ ➡️

brazen hatch
#

Alt + 91 + 65
Alt + 91 + 66
Alt + 91 + 68
Alt + 91 + 67

midnight ember
#

das nicht keyboard uber funct nein!

brazen hatch
#

Yea, I have my own full curses implementation.

midnight ember
#

lol

brazen hatch
#

but it's absolutely massive.

#

It does all the console handling and the switching.

midnight ember
#

if there's a problem the translators will likely be the first to let you know

brazen hatch
#

I just shoved everything terminal related there.

midnight ember
#

i've been using unicode in repl lately for status connections

#

they stand out and are very helpful

brazen hatch
#

I do ansi escapes for terminal detection and size too.

onyx hinge
midnight ember
brazen hatch
#

toasterborb?

onyx hinge
#

°F I hope

midnight ember
#

F

brazen hatch
#

Ah. Good.

midnight ember
#

converts to Murica units

onyx hinge
#

I mean, 31°C is not that fun. but it could be worse

#

👋

idle owl
#

Thanks all!

gilded cradle
#

Thanks

onyx hinge
#

ttyl

manic glacierBOT
brazen hatch
#

Also something I forgot to bring up. Perhaps it would be worth it having a persistent list of consoles in circuitpy so that we can have persistent custom REPL inputs.
And to mirror output to all of them like how micropy does.
This would be really hard to implement though, cause all the objects in there, regardless of their contents would have to be persistent across reloads.

#

So something like replio.consoles[]. Where you can just append or remove any as long there is at least one.

#

There could be a replio.active where you just put one by index, or None to mirror to all.

#

To do it under my stuff it would be trivial now, but doing it on the core could unlock so many more possibilities.

#

Like actual telnet workflow. Or even ssh workflow if someone is daring enough to make it.

idle owl
#

Audio update: The plug into the speaker wasn't in completely. Fixed.

spare jacinth
#

Will try and make a PR at some point, but some discussion on what/how to do should precede it

manic glacierBOT
slender iron
#

Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern 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/1VFqasfzcuR1nmpfB-IxASRSf9isPpRWfG1O3ZAUnp8Y/edit?usp=sharing

manic glacierBOT
slender iron
#

@onyx hinge @tulip sleet when do we want to triage 8.x.x so that we can get 8.2 stable?

manic glacierBOT
#

Will there be anyone could help me to give some guideline to work on this development?

I don't know a lot about SSL but can help guide you in CP. @victorallume's comment seems on the right track. The goal would to to have the native ssl module wrap a non-ssl, Python-only socket object.

Also, I had join the discord chat as well. Which hastag section that I bring up this topic?

#circuitpython-dev is the best place to discuss modifying the C core of CircuitPython. Note that most o...

slender iron
tulip sleet
idle owl
#

Ugh, compiling Arduino. Starting my entire journey into this with CircuitPython seriously spoiled me for a lot of other languages.

onyx hinge
#

@slender iron yeah todbot has experienced the same thing. for me it's better if I scope the I2SOut / PWMAudioOut object using a with statement.

It appears that during flash writes background callbacks don't run (expected) but instead of audio DMA stalling or re-cycling old samples, it gets noise instead.

I looked around but couldn't figure out why.

On reflection today, I guess that when a DMA descriptor gets chain-to'd doesn't wrap or get reset to its initial address, but keeps DMA'ing on into higher addresses. The fix would be to place the buffers so that they could be "ring"'d? which would make old samples get looped when this happens. https://www.raspberrypi.com/documentation//pico-sdk/hardware.html#rpipede9f09e5034a1bdad43

#

this user is reporting it when only printing to the console, hm.... that's different than what I've encountered.

manic glacierBOT
wraith crow
#

I just listened to today's meeting. I'm really looking forward to the possibility of native keyboard support for the REPL 😁. In terms of a lightweight editor, I've been using an edlin (dos line editor) clone that I Frankenstein'ed together but I wonder if something like @slender iron's basicpython.py interface would work. Some work needs to be done to optimize the save/load functions but the simple line number editing model used by Basic is something that most people would be familar with and if not it's easy to learn.

willow totem
#

@candid sun sorry to ping you directly. I saw the newsletter mentioned you're writing a guide and playing with the ikea air quality module (SEN54). I sorted the library if you haven't done that bit yet, it's ported from the official sensirion one (plus the base i2c driver). https://github.com/good-enough-technology/CircuitPython_sensirion_i2c_sen5x

GitHub

Python I2C sensor driver for Sensirion's SEN54, SEN55 and SEN50 sensors - GitHub - good-enough-technology/CircuitPython_sensirion_i2c_sen5x: Python I2C sensor driver for Sensirion's...

candid sun
manic glacierBOT
#

I think I'd disagree here. I'd quite like having the expected errors made explicit, so we already know that e.g. NRFX_ERROR_DRV_TWI_ERR_DNACK should deliberately be interpreted as MP_EIO. This means that in future if someone does something that will generate that error message, they know that is the correct translation. I would expect gcc to optimize this out in any event

slender iron
manic glacierBOT
willow totem
# slender iron https://www.adafruit.com/product/5774

very generous to include the kicad script too, nice work. Wish I had bought some nylock stuff one of those many times I got tempted. Assume you making a whole wall of it for JP., aka the largest circuitboard ever produced by adafruit..

manic glacierBOT
#

Good point, yes, I have tested it using the code provided in #8093, and the
second print statement now produces an OSError - which is what I would
have expected.

Phil

On Tue, 20 Jun 2023 at 23:39, Dan Halbert @.***> wrote:

@furbrain https://github.com/furbrain Before I approve, I just want to
check that you have tried this on hardware after the latest round of
changes.


Reply to this email directly, view it on GitHub
<https://github.com/adafruit/circu...

manic glacierBOT
#

I absolutely agree and also feel uncomfortable using undocumented registers. However:
I did add the _abort calls but these don't seem to actually reduce current consumption on my chip - only the peripheral reset code seemed to work. I've therefore included both strategies in the PR. The RADIO peripheral on nRF52840 does also use a (documented) register at offset 0xffc for power cycling the device, so I would hope that this is in fact a general architecture decision.

manic glacierBOT
manic glacierBOT
#

@tannewt Thank you. I think it's ready for a look, though I hadn't made it back to write out a comment with my current thoughts yet.

The current version resolves the original issue of spending time to render hidden objects by introducing a new boolean field that gets set to true once the hidden object have been rendered the first time. It still takes the same amount of time when it does initially render after becoming hidden, but then on subsequent refreshes it gets skipped.

With the c...

ornate breach
#

It’s me every day lol

idle owl
#

Sadface.

ornate breach
#

Unfortunately the gubment doesn’t like open source

manic glacierBOT
crimson ferry
#

kattni...

onyx hinge
#

@tulip sleet @slender iron sorry, I was "out" yesterday afternoon. I'd be happy to meet sometime today, maybe in the hour before the other meeting tonight?

slender iron
tulip sleet
slender iron
#

that'd work for me too

idle owl
idle owl
#

I have an idea though.

tulip sleet
idle owl
#

We don't delete deprecated libs, we make them read-only.

#

So...

#

This is kinda that?

crimson ferry
#

the previous version would always be in the repo

idle owl
#

I know.

tulip sleet
#

The library is fine. I wouldn't comment out the code, just delete it, it's in the git history.

idle owl
#

I thought about that too.

#

OK.

#

Do what Dan said.

crimson ferry
#

NTP library already had a complete switcheroo from esp32spi to native wifi

#

OK, sounds like a good plan, thank you

tulip sleet
#

of course we will note the deletion in the release notes

idle owl
onyx hinge
#

@tulip sleet @slender iron I am available anytime to start this meeting

tulip sleet
#

i can start now, finished that build

slender iron
#

me too

manic glacierBOT
lavish saffron
#

Hi, I'm on macOS Monterey with Sphinx installed via Brew. When I try to build docs I'm getting an exception:

(venv-adafruit) ?127 Adafruit_CircuitPython_Wiznet5k/docs % sphinx-build -E -W -b html . _build/html
Running Sphinx v5.3.0

Extension error:
Could not import extension sphinxcontrib.jquery (exception: No module named 'sphinxcontrib.jquery')

The extension is listed in conf.py which is all the help that Google gets me. Any help greatly appreciated!

manic glacierBOT
idle owl
#

🤷🏻‍♀️

#

I'm sure it's going to fail later when it gets to the part that uses it. But...

idle owl
#

Sure looks like it did.

#

I exited the virtualenv, and it still runs with that line commented out.

#

So apparently no need to pip anything.

manic glacierBOT
idle owl
#

This seems like a terrible workaround.

lavish saffron
idle owl
#

Possibly anyway.

manic glacierBOT
idle owl
#

Usually you toss things into the autodoc_mock_imports to get Sphinx to stop trying to use them.

manic glacierBOT
#

Yes, the implementation of deep_sleep_... is to raise a DeepSleepRequest exception. It may be that printing this exception causes a problem, or something else is weird.

You should probably either change this to catch Exception or (Exception, KeyboardInterrupt), rather than BaseException, since even if it "worked" it would erroneously turn a DeepSleepRequest into a 10s delay & supervisor reload.

lavish saffron
# idle owl Possibly anyway.

The only place I can find it (BBEdit searched everywhere in the folder) is in api.rst. Can I delete it from there?

idle owl
#

So yes 🙂

lavish saffron
manic glacierBOT
jaunty juniper
#

ah in a library yeah

#

that is managed manually, sometimes a library is actually missing docs for a submodule because of that 😅

manic glacierBOT
manic glacierBOT
#

It looks like this one (and others in this section) are could be moved over to the Core Modules section, but I'm not sure I could put it in order alphabetically. Would it be work combining the "MicroPython libraries" section entirely into the "Core Modules" section?

I think this would be OK, perhaps adding a warning at the top that though they appear to be in alphabetical order, some modules are at the bottom. Note that help() is already at the bottom. Could also add a link to the Modu...

orchid basinBOT
manic glacierBOT
#

Hi @dhalbert , unfortunately no. I was a little wary of trying to use an Arduino library to set adjust overclock settings on a MatrixPortal for fear of damaging it. But also I got swamped with work so this is sadly been sitting on my work table waiting for me to have a minute to pick it up again. If you have any other suggestions that might be a little more straightforward, happy to try them. Otherwise, I should hopefully get a chance to dig back in and try messing with the Ardiuno library th...

manic glacierBOT
#

I don't know if this will be of any possible use as in my case I was only using a single 64x32 Panel but fwiw, when I started filling up my panel with lots of pixels I would see similar distortions as you've displayed. Since it seemed to be related to how many pixels I lit, I guessed that it was a power issue and in my case I was able to boost the voltage on my supply by a volt or so which eliminated the distortion issues. My power supply should have been able to provide more than enough curr...

manic glacierBOT
#

Scratch that... I just went back and re-tested on my panel and noticed that my power supply had a current limit set for about an amp so when I lit all the pixels up the supply went into current limiting mode. Turning up the voltage reduced the current needed which is why that solved my problem but I just increased the current limit at 5V and that also solved the issue, so increasing the voltage probably isn't they way to go.

tulip condor
#

the things to make a library available for circuitpython in C are C macros right ?

#

Where are they defined like MP_DEFINE_CONST_FUN_OBJ ?

tulip sleet
#

the MP_ macros are nearly all defined in various files in py/

#

we use ag or similar search programs rather than GitHub search (which is getting better0.

tulip condor
#

Id like to see the definition of the macros so I can understand how it works since it seems three of them are used to make a C library for use in the circuitpython libraries

#

Seems like it's in py/runtime.h but I cant find it

#

Ah found it: #define MP_OBJ_QSTR_VALUE(o) ((((uint32_t)(o)) >> 1) & 0xffffffff)
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)(((uint64_t)(((uint32_t)(qst)) << 1)) | 0x0002000000000001))

tulip sleet
#

yes that macro is in py/ somewhere. But for a sensor like this, it would be easier to write the interface code in CircuitPython, rather than port the C library. Looking at the datasheet, this is a pretty low-level sensor, which outputs pulse trians at various frequencies. This would require real-time reading of the pulse trains, it appears. But CircuitPython needs to do other things in the background that will interfere. You may want to use pulseio.PulseIn, or frequencyio.FrequencyIn to read the frequencies.

Or, rather than using this sensor, choose another color sensor that is easier to use: https://www.adafruit.com/search?q=light+color+sensor

tulip condor
#

I already paid 40$ for 2 of them 😦

tulip sleet
#

for the TCS3200

#

see code.py on that page. The code uses PulseIn

#

quite simple

tulip condor
#

Ok I'll do that. I know im missing a third macro(?) I dont understand what they do yet but I see it in every circuitpython libraries definition (like displayio) so you can call them in circuitpython after compiling them after the circuitpython core/sdk . And the circuitpython guide says you have to use all 3 or it wont work (Im missing the third one)

tulip sleet
#

there are many details needed to adding a C library. Far easier to code in Python if you can

#

we don't call the built-in modules "libraries"; we call them modules, to distinguish them from the libraries written in Pytnon

#

the "extending circuitpython" guide is out of date, unfortunately

tulip condor
#

I see. So if I understand in doubt I should ask here and I will probably be told this can be done with user code. Otherwise Id be given some hints as out to make a module for it because the guide is out of date ?

tulip sleet
#

we'd like to update the guide but haven't had time, and it's a bit of a moving target. And yes, we have native modules like PulseIn that will help solve your problem without C code.

The best way to add a native module is to take an existing one that's similar to what you want to add, copy it, and replace the insides.

#

Then you get all the boilerplate initially.

tulip sleet
#

@timid bolt is this relevant to your async goals? https://github.com/micropython/micropython/pull/6125 I think we already discussed this.

_Background: the aim is to make events in MicroPython more generic and efficient, rather than having busy polling (based on POSIX poll) and being restricted to stream IO. _

manic glacierBOT
#

Restating this without use of id:

Put the following in nested.py:

# content of nested.py
l = [[]]
l0 = l[0]

and the following in code.py:

# runtime
import nested
nested.l0.append("test")
print(nested.l)

With python3, it prints [['test']], while with circuitpython it prints [[]]``, because in circuitpython nested.l0andnested.l[0]` are not the same object due to the implementation of "long lived" being unable to move objects.

onyx hinge
#

@tulip sleet @slender iron fwiw I started looking at making long-lived optional and I noticed that gc_alloc has changed radically in micropython (code size optimization & "split heap" support) so in terms of sequencing our work it doesn't make sense to do until the micropython merges are complete.

tulip sleet
#

there are also now "tracked allocations" which don't get gc-d, for long-lived buffers. Not sure if this would be a substitute for our non-heap allocations before the VM starts.

#

or maybe that is what you meant by "split heap".

onyx hinge
#
        #if MICROPY_GC_SPLIT_HEAP
        area = MP_STATE_MEM(gc_last_free_area);
        #else
        area = &MP_STATE_MEM(area);
        #endif

I don't exactly know what it is, I just saw these lines in gc.c..

timid bolt
timid bolt
tulip sleet
#

it is just that they are also talking about not spin-polling in that PR and the zephyr isuse

#

i was wondering if the approach in 6125 is at all related to your ideas

timid bolt
#

It certainly has similar goals, thanks for pointing it out, but I haven't dug into the PR though. And the zephyr issue says, "might be a while until it's finalised".

tulip sleet
#

yeah, I'm not expecting to wait until it's done, just whether the approach is interesting and whether we might end up on convergent tracks with them

#

or whether that PR is more restricted in what it can support than your approach

manic glacierBOT
#

There's still more code in gc_alloc that could be simplified, but this will wait until after the micropython merges because there's also upstream churn.

I tested this on the unix port (only) with LL both enabled and disabled. The mpconfig.mk has to be edited to change the setting, so CI will only test one way.

It's not quite fair to say this "closes" #2687 but it does allow someone who is affected by the difference in identity semantics to turn it off in a custom build.

In practice...

#

The maximum GIF width is 320 pixels, because there's a statically allocated buffer that's a single line of the image. The height is not limited, but on Pyportal Titano, if I increase the mag height to 480, 480x320 images run out of RAM. Shorter images can display, but they're pretty uncommon (I tested with 480x150, etc.).

GIFs that are too large for the display get cropped to the right and bottom.

In the long run there will be boards with more RAM that could handle larger images, so we ...

manic glacierBOT
manic glacierBOT
manic glacierBOT
slender iron
#

pretty cool llvm optimization viewer

manic glacierBOT
manic glacierBOT
manic glacierBOT
slender iron
#

should we require usb host init in boot.py and skirt the issue of deinit and re-initing it?

manic glacierBOT
slender iron
#

@crimson ferry we'll update to idf 5.x for CP 9.0

manic glacierBOT
#

I tested on an S3 Box Lite using the code above, with CircuitPython 8.1.0. I let the terminal program sit without input as described above for 15 minutes and did not fall into safe mode. When I entered a blank line, the program exited as expected.

Have you been able to reproduce this on any other Espressif boards? I also tried a Metro ESP32-S2, and could not reproduce.

tulip sleet
#

@slender iron @onyx hinge addressed three 8.2.0 issues. Two PR's reviewed and merged. #7680 is addressed by a PR to be reviewed. Could not reproduce S3 Box Lite issue: moved it to Support. That leaves only #8068 Odroid Go issue as remaining to be addressed or deferred.

#

i'll make an rc.0 after those two issues are off the milestone.

midnight ember
#

learned how to get my working branch sync'd up to my main branch from the adafruit main. 🙂

#

will be working on switching requests secrets.py to getenv a bit tonight.

tulip sleet
slender iron
tulip sleet
#

are there multiple versions?

#

certainly won't hold up 8.2.0

#

I'll start the release build

#

ah, found one more PR to approve.

slender iron
#

@tulip sleet just closed it

manic glacierBOT
#
[adafruit/circuitpython] New branch created: revert-8094-fix_i2c_hangs
#
[adafruit/circuitpython] New tag created: 8.2.0-rc.0
orchid basinBOT
manic glacierBOT
#

Yes, I think that could work, but would need to change to a callback related method. I disagree with the comment about the timeout not getting called in #2253 - could have the callback set a flag and then poll for this flag while checking the time and abort if the time increases by a certain amount before the flag is set.

I'd be happy to look at this, though I have found a different route around this problem in my use case in any event.

manic glacierBOT
#

@furbrain Moving discussion from #8093 here:

My idea above was to modify nrfx/drivers/src/nrfx_twim.c to include a timeout in the synchronous transaction busy-wait loops like you see in the original post. I never got around to this, but it's not such a big deal: we already have our own patches in our fork of that library. I could put this on the list for 9.0.0. I would also check whether Nordic has already done something about this, because I think there were other people with the same i...

manic glacierBOT
#

Ah ok, I was going to try and avoid modifying the nrfx library as it was
third party.

On Fri, 23 Jun 2023 at 20:26, Dan Halbert @.***> wrote:

@furbrain https://github.com/furbrain Moving discussion from #8093
https://github.com/adafruit/circuitpython/issues/8093 here:

My idea above was to modify nrfx/drivers/src/nrfx_twim.c to include a
timeout in the synchronous transaction busy-wait loops like you see in the
original post. I never got around to this, but it...

manic glacierBOT
tulip sleet
languid whale
slender iron
languid whale
brazen hatch
#

Borb working vs borb not working.

#

and perhaps CURRENT.UF2

#

md5sum

lone axle
#

I noticed a failed action run this morning on the task that generates images of learn guide repo projects: https://github.com/FoamyGuy/Adafruit_Learning_System_Guides/actions/runs/5363751471/jobs/9731528043 looking further into that it appears that the bundle metadata that ordinarily would exist here: https://adafruit-circuit-python.s3.amazonaws.com/bundles/adafruit/adafruit-circuitpython-bundle-20230624.json doesn't for some reason. Instead we get an XML error which the json parser does not like.

jaunty juniper