#circuitpython-dev
1 messages ยท Page 8 of 1
Changed as suggested.
Changed as suggested.
Changed as suggested.
Changed as suggested.
i mean if i felt really inspired i could write something like "argonblue's guide to annoying things about CircuitPython that i had to learn the hard way and are too difficult to search for", but maybe it would only be helpful to me
Tbh this is probably the kind of stuff where I actually might be able to help out with CP. Aside from usually being reasonably good at writing clear explanatory things, I think I'm enough of a noob that it's not hard for me to imagine what might throw people, but also have just about enough knowledge to be able to possibly explain some of it.
i'm also a CircuitPython n00b, but one with a couple of decades of software development experience, so i've Seen Some Thingsโฆ
Oh I'm just a general n00b when it comes to EE/code ๐
Seen Some Things โข๏ธ
Changed as suggested.
Changed as suggested.
More explaination provided.
Changed as suggested.
So, I agree that this should be more than ADC and also include DAC for other platforms. You also had suggested bufferedanalogio. I took a poll and it seems it reads better and is preferred over analogbufferedio. So I will be renaming the module to bufferedanalogio with BufferedIn with read() and BufferedOut with write(). Hope that agrees with most.
Changed as suggested.
Changed as suggested.
Did change the interface from readmultiple() to read(). I agree. if no arguments, then fill the buffer using buffer length. Otherwise use the argument checking to make sure the unsigned integer is no greater than buffer length. This should not affect speed or operations in most cases. Buffer initialization WILL BE left to user for max speed and flexibility.
by the way did you find the answer to that ? BLE is partially supported on ESP, but you can't create a service, which makes the most common uses (HID, UART, etc.) impossible, but it's possible to connect to an existing service, for example I connected a C3 to a Xiao sense, where the Xiao was a UART passthrough to the computer (for multiple other BLE boards) - it was a test, not a long lasting installation so I can't speak for stability. I also have tested today adafruit_ble_radio to broadcast messages between a Xiao, a QTPY C3 and a Feather S3.
No, though I told the person asking that it wasn't supported on CP yet
They were pretty disappointed, kinda think the product pages for S3 boards could do with noting this and the deep sleep bug
Build Doc: Build and Valudate Stubs failed. Filename but no line number. Is there a way to resolve this?
How about analogbufio or (more awkward sounding) bufanalogio? I like the first because it starts with analog, and buf is good enough (buffered is pretty long).
Add LOLIN S3 board.
Good morning sleeping Circuitpythonistas! Remember, there's no meeting today -- it's a US holiday. We'll see you tomorrow at the usual time.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.0-30-g14498f793 on 2022-09-04; Waveshare ESP32-S2-Pico with ESP32S2
It's a build from adafruit-circuit-python.s3.amazonaws.com
Code/REPL
import wifi
a = wifi.radio.start_scanning_networks()
for i in a: print(str(i.ssid))
wifi.radio.stop_scanning_networks()
del wifi
Behavior
On first boot:
 I also agree its quite long. I like starting it with analog too and bufio has a kind of mening to most of us anyway. So, anaolgbufio it is .... going once, going twice, .....
analogbuffalo
the vampire slayer
Funny. Engineers are horrible at naming things, but I appreciate all the attempts (cause i'm horrible too).
8.0 is a major release (even if in Beta), so that part of the description does not make sense anymore.
@tulip sleet: I have made all the suggested changes to #6757 and renamed the module, re-tested, and pushed. Just FYI.
Got it, thanks! I will do some code reviewing soon (as opposed to just naming and doc).
Thanks.. I still have some work flow issues anyway
Can you test with 8.0.0-beta.0 to rule out some quirk in that daily build?
With Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; Adafruit QT Py ESP32S2 with ESP32S2, this code.py runs continously with good, full AP results:
import time
import supervisor
import wifi
def scan_wifi():
for network in wifi.radio.start_scanning_networks():
print("{0:02X}:{1:02X}:{2:02X}:{3:02X}:{4:02X}:{5:02X}".format(*network.bssid), end=" ")
print("{:>2d}".format(net...
For some Espressif Feather boards, reduce power during rel deep sleep by disabling NeoPixel and/or I2C power pins with a pull-down instead of a pull-up. This reduces deep sleep consumption from about 480 uA to about 75 uA.
More could be done on TFT boards, which don't have this. I think maybe we need to pass a deep_sleep boolean to board_deinit() for these boards so we don't disable the display during fake deep sleep.
Repeated the exact same code.py I did above, on beta-0:

This time it once more worked.. but only once..
Tried with your code snippet too, pretty much same results..
It only once registed:
E4:5F:01:05:51:4E 1 -29 [wifi.AuthMode.WPA, wifi.AuthMode.PSK] XY Pi400
(I do not mind sharing my pi's mac)
I perhaps should mention:
- There is no .env file for web workflow provided.
- This board is in a diy airtight box, safe from any tampering.
- The Pi400 wifi is 10cm away from it.
- The power is supplied via the Pi400, it is more than adequate.
Lack of .env, or of any valid Station or AP, should not be a problem. Scanning is independent of Station and AP. I wonder if the box material is attenuating wifi signals, but it's still hard to explain why it would only receive on the first try. Can you test it outside of the box, and also closer to some other APs? Do you have another (perhaps different) device you can try inside the box?
Chief, da box plastic.

Tested it outside the box in the same setup, and it's the same.
Tested on fone, near more ap's:

Also, those char's are new and annoying.
@unexpectedmaker Was the name deliberate?
Could you trying closing the file after you finish playing it?
@UnexpectedMaker Was the name deliberate?
Oh, I missed this, sorry. Hmm, seems like a typo. I'll do a PR today to fix it, sorry.
@UnexpectedMaker looks like the same issue exists on the FeatherS3 for GPIO39
{ MP_ROM_QSTR(MP_QSTR_I39), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control
Thank you for answering.
I'll try closing the file.
This PR adds support for the Challenger RP2040 WiFi/BLE board.
Hi! This is probably memory fragmentation. Try following this advice, from https://learn.adafruit.com/circuitpython-essentials/circuitpython-mp3-audio:
Because creating an MP3Decoder object takes a lot of memory, it's best to do this just once when your program starts, and then update the .file property of the MP3Decoder when you want to play a different file. Otherwise, you may encounter the dreaded MemoryError.
.. and from the same guide page here's the "official" way to play multiple MP3 files sequentially. as far as I know, this can play dozens and dozens of files without encountering MemoryError (I've left it playing an album on repeat overnight):
# You have to specify some mp3 file when creating the decoder
mp3 = open(mp3files[0], "rb")
decoder = MP3Decoder(mp3)
audio = AudioOut(board.A0)
while True:
for filename in mp3files:
# Updating the .file property of the e...
web workflow: URLs like curl -v -L http://circuitpython.local/cp/devices.json redirects to the hostname, but because of the added integer that is often appended by [something in] the network: Could not resolve host. Is it possible for the CP device itself determine its actual network hostname and fix the redirect URL? Other deices do get the full network mDNS hostname with server.find.
worth opening an issue about this
I will write one
This was actually fixed years ago in #1645, but that fix is in fat_vfs_rename() in extmod/vfs_fat.c, and the web workflow code is calling f_rename() directly, which bypasses the fix. We need to study a bit more about whether to move the check into f_rename() or call fat_vfs_rename() instead.
Oh nice. Yeah, I may take a look at the code. I was looking at the f_rename() function last week, but with trying to add a fix, I was starting to feel a bit out of my depth, so I put it aside.
However, I think I'm familiar enough and comfortable enough with the current Web Workflow code that I could probably see if changing to fat_vfs_rename() would just work or if it would with minor modifications and make those modification.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; Adafruit QT Py ESP32S2 with ESP32S2
Code/REPL
# From another device on the network, augmented names are found:
m = mdns.Server(wifi.radio)
for service in m.find(service_type="_circuitpython", protocol="_tcp", timeout=5):
print(f"{all_the_things}")
"""
Adafruit QT Py ESP32S2-5
cpy-f66961-281.local
192.168.6.180:80
"""
# This does not work:
# curl -v -L http://cpy-f6696...
I wanted to do more tests, but I believe that's a bug in the mdns implementation, the board believes there are other devices with the same name and adds -num
Espressif?
plus I think that internally it only recognizes the base name, so the "origin" test will fail anyway
it seems awfully similar to the age-old iPhone (3) or MacBookPro (2) issue.
what is the "origin test"?
it tests the request's origin to allow or not
by IP address works, so the links and redirects could use that
yeah I use the IP in the app and completely ignore the name, but redirections don't do that
<@&356864093652516868> Hey! I know it's Tuesday but I'm hosting the weekly meeting in Discord today in the Circuitpython voice channel and the #circuitpython-dev text channel at the usual time of 2PM ET / 11PM PT. Please add your note to the document, and also let me know if you need me to read them out for you: https://docs.google.com/document/d/1PUjxzPDp0X9ACzeeiRug8NznRZA8ku0l5pPHi69UP7U/edit?usp=sharing
We're happy to have any and all join us! If you want to start by just listening in, that's great. When you decide you'd like to give your own status updates or hug reports, ask to be added to the <@&356864093652516868> role so that you can speak in the voice channel.
CircuitPython Weekly Meeting for September 6th 2022 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to ...
I am getting a "Build-Doc: Failed to parse Python stub" in my C-code. But no indication of which line is troublesome. Is there a method to find out?
I imagine it's not a line-specific issue, that there's something that needs to be done before building the docs, or it's a hiccup. I don't know, however, so someone more familiar will need to reply.
I'm using a PervasiveDisplays panel with the epaper feather friend, and the datasheet requires you to send a color frame with all zeros:

But it looks like displayio will only write a second frame if the display specifies tricolor or grayscale, which is not the case.
I believe that sometimes there is an intermediate file in your shared-bindings folder that may show the error. Worth looking. Iโm not great with doc issues myself though
Did you try to do make html at the top level of the repo?
just did. its the same as in the report. it seems to complain about something never touched...(at least I dont thinkso)
can you paste the error msgs here including the reference file?
or I can look in the PR build, I realized, hold on
circuitpython-stubs/alarm/init.pyi
[ERROR] Failed to parse a Python stub from shared-bindings/analogbufio/BufferedIn.c
Traceback (most recent call last):
File "/home/latkinso42/research/circuitpython/tools/extract_pyi.py", line 189, in convert_folder
tree = ast.parse(fragment)
File "/usr/lib/python3.10/ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "<unknown>", line 34
...
^
IndentationError: unindent does not match any outer indentation level
//| class BufferedIn:
//| """Capture multiple analog voltage levels to the supplied buffer"""
//|
//| def __init__(self, pin: microcontroller.Pin, buffer: WriteableBuffer, *, sample_rate: int = 500000) -> None:
//| ...
//|
//| def deinit(self) -> None:
//| """Shut down the `BufferedIn` and release the pin for other use."""
//| ...
//|
//| def __exit__(self) -> None:
//| ...
//|
//| def read(self) -> None:
//| """Fills the provided buffer with ADC voltage values."""
//|
There is a missing ... for read(self). Also the indentation for the ... for __init__() does not match the others. (That's probably not an error but it should be consistent.
gotcha. never had to debug documentation before. Learning something new here...
Thanks.
test with make html before you push to save time. Also note there was a pre-commit error in the PR (C indentation, it looks like)
yeah.I uninstalled pre-commit due to env issues. Guess I will have to resolve them ..eventually.
I remember thinking of this at the end of last week, and it popped into my head again. Limor had me do a microcontroller.reset() in both places in my code that have error catching. I had used sleep_memory to increment an "error count". Does sleep_memory persist through microcontroller.reset()? Or is the error tracking now superfluous.
I know it persists through sleep, which was the plan for it initially.
@idle owl sleep_memory does not persist through a reset (microcontroller.reset() or reset button) or power cycle
Thanks! I need to update my code. ๐
you can try supervisor.reload()... sleep_memory will persist, but reload may not recover from more severe issues
It's not severe issues.... it's WiFi or Adafruit IO not connecting errors. try/except to keep the code running, but instead of hoping the try/except is enough, include a reset.
supervisor.reload() might be enough there?
maybe, I usually try reload before reset
Ok. I haven't managed to hit either in a long time.
(I keep a reload count, then if it doesn't recover after so many reloads, then I reset)
fixes #6870 by sending an empty second frame if write_color_ram_command is specified but no highlight_color or grayscale is given.
Demonstration: https://twitter.com/pepijndevos/status/1567198891887529986
FYI an actual driver for PervasiveDisplays panels lives here, feel free to adapt if you ever want to support these displays in some Adafruit product.
just a variable in sleep_memory
Nice ok
a byte valiue
I think the top of your mailbox code did use sleep memory and kept track of .. something forget itโs been a bit ๐
It does, but I introduced a microcontroller.reset() in a couple of places that would flush all of that.
It's still using sleep memory.
To keep track of metadata basically.
wake count, send count and error count.
something like```py
alarm.sleep_memory[2] += 1
print(f"reload #{alarm.sleep_memory[2]}")
if alarm.sleep_memory[2] > 5:
print("โ ๏ธ Too many reloads: resetting... โ ๏ธ")
# reset will clear alarm.sleep_memory
microcontroller.reset()
there may be a more pretty way, but I just keep a few values in there to track things across the boot.py-to-code.py divide (w/o having to write to boot_out.txt) and across reloads
Happily lurking for today's meeting ๐ต๏ธ
No notes for this week. I have mostly done Arduino for HackWatch on the T-Watch-2020 and Teensyduino for a Teensy 4.1 (that one could run CP too, but right now I do USB-Host and that is not available in CP yet).
@idle owl and @crimson ferry if you want something to persist across power cycles, you could use microcontroller.nvm to use the non-volatile memory.
Hmm. Thanks! I'll think on it.
Wait, do all boards have nvm? Or is that board-specific?
jepler: Martha Wells shared she finished a new Murderbot novella, thought of you. ๐
I've not run across any that don't, but I suppose it's possible a few might not.
Good enough ๐
different sizes of nvm, but not an issue for just a byte or three
right
Nice
Probably missing all of todayโs meeting. No real notes to add that I can think of, group hug to all
That's what I have written down.
@tulip sleet joining us soon?
@onyx hinge sure I will do core
I even waited to paste that 2nd one!
Sorry about that.
It's ok, there's a good reason
๐จ ๐ช ๐๏ธ ๐ง
๐ Congrats, @gilded cradle
Thank you ๐
@random junco The voice channel has been created - please let me know if you run into permissions issues. It looks right!
Thanks!
Thank you everyone
Thanks!
Thanks!
Thanks!
As in, maybe make time with someone to test it during the week, to make sure you can do voice and video, etc. So I can fix things if they're not right. ๐
PervasiveDisplay panels support a fast update mode, which requires that the first frame contains the old display data, and the second frame contains the new display data: https://docs.pervasivedisplays.com/epd-usage/epd-driving-sequence/small-epds/fast-update/ssf-upload-image-data/dtm1-and-dtm2-registers
I'm not sure if this is an easy change or a major overhaul. It'd basically require to double-buffer the whole display I think?
If the 128 u32 buffer fitted the entire screen, it'd b...
Does it matter where in the code this goes, as long as it's not inside a loop?
I can confirm similar behavior on an ESP32-S3 sitting on my desk right next to the router.
I'm basically just doing
wifi.radio.connect(secrets["ssid"], secrets["password"])
and sometimes after resetting it just errors with
ConnectionError: No network with that ssid
and indeed scanning at this point returns no networks. A hard reset will bring it back to working normally.
@idle owl I didn't show the part where that block is inside some code that detects that the current run was a reload (e.g., using supervisor.runtime.run_reason is not supervisor.RunReason.STARTUP)
Apologies, everyone, for missing the weekly meeting today. I got caught up in a work emergency. Never fun when something blows up after a holiday weekend. ๐ฆ
probably at the top: detect that this is a reload and not a reset, increment the reload count, then if it's too high (not fixing the issue presumably), then reset
No worries! I hope the fire is quashed.
This definitely makes sense.
Thanks!
Not yet, but the firefighters are pouring metaphorical foam on it currently, and it should be under control shortly. ๐
Good step then!
I do want to slap the person who decided that 430pm on the Friday of a holiday weekend was a good time to push an untested code update to production (bypassing our QA environment), but thatโs a whole other rant. ๐คช๐คฆโโ๏ธ
Uffffffffffffffff. Slap indicated, indeed.
@crimson ferry I got it to work! It wasn't at first but then I realised I was already using alarm.sleep_memory[2] for something else. Changed it to [3] and now it's working as expected. Thank you!
@crimson ferry OK, the code seems to work. Can you take a look at the snippet and tell me if I commented it correctly? e.g. Do I actually understand what's going on... Because I have to explain it in the guide.
sure... where's the snippet?
Oof I copied something else since that. Hold on.
# If the reason the board started up is not the standard CircuitPython start up...
if supervisor.runtime.run_reason is not supervisor.RunReason.STARTUP:
alarm.sleep_memory[3] += 1 # Increment reload number by 1.
print(f"Reload number {alarm.sleep_memory[3]}") # Print current reload number.
if alarm.sleep_memory[3] > 5: # If reload number exceeds 5...
# Print the following...
print("Reload not resolving the issue. \nBoard will hard reset in 20 seconds. ")
time.sleep(20) # ...wait 20 seconds...
microcontroller.reset() # ...and hard reset the board. This will clear alarm.sleep_memory.```
yup, that describes it, maybe specifically mention "standard CircuitPython start up" is a reset (rather than reload)
Ah ok. Yep.
it seems to me that reset vs. reload are terms beginners need to grok
Agreed, at this point. I'll try to include mention in the guide that can be pointed to later.
Or we should add it to the Welcome guide somewhere.
FAQ probably.
Added reset-type after CircuitPython in that first comment.
And will clarify in the guide.
sounds good, it's a little bit of complexity to have a two-tier reload then reset, but: it allows sleep_memory use on a higher frequency than someone may want to use on nvm; it probably cures many many ills not needing a full reset (ejecting and breaking off serial console, etc.)
Yeah, I'm imagining I might be told to take it out. But I really like the idea of error tracking, so you know if your code is running into errors via Adafruit IO. If you want to know that anyway. There's a variable to set if you don't want it. ๐
Thanks again for your help!
Fighting with pre-commit. It expects version 3.10.4.final.0 for some reason. danh worked on this with suggestions, but i've tried many things now and it still presents. My current python is Python 3.10.4 .. the final.0 part isn't part of the install.
FIting==Fighting
If anyone has a moment, this PR fixes a botched PyPI release due to a faulty pyproject.toml - the upload on PyPI is currently not working. Not sure how extensively it's used so just wanted to bring it up:
I guess my script thought it should have been packages - I think I got the rest correct during the transition, but I guess something to keep in mind if there are other reports of dud installations.
TFW you forget to run Pylint, but it passes in the PR anyway. ๐
@crimson ferry Oof, another question. When my code stops running, and the board is "reloaded", the serial console shows "soft reboot". Is "reboot" synonymous with "reload"? Should that serial message be changed to "soft reload"? Or is a "soft reboot" something different from both a reload and a reset? (Working on quickly explaining the difference in this guide, and realised it was using a different term.)
Will probably want someone to proof this explanation in the guide before I ship it.
Done
Yeah, I think the terminology has been a little loose. supervisor and microcontroller use the terms Reload and Reset. Reload would be all but the first of these reasons: https://docs.circuitpython.org/en/latest/shared-bindings/supervisor/index.html#supervisor.RunReason. Reset, typically pressing the button or calling microcontroller.reset() could be any of these reasons: https://docs.circuitpython.org/en/latest/shared-bindings/microcontroller/index.html#microcontroller.ResetReason
Still Fighting
Ok... checking those links now.
Hmm, ok, fair enough
So reboot/reload in terms of "soft reboot" are probably synonymous then? Seems like it.
I won't get into the gritty of it, but I'll include that the "soft reboot" in the serial console is like a reload.
Anyone who knows, please let me know if this is a valid explanation. ```You may have noticed that the actions "reload" and "reset" are both mentioned above. It's important to understand the difference.
A reload is what happens when you hit CTRL+D from the REPL, as well as when the board reloads and the serial console shows a "soft reboot" before beginning to run your code again. It is also what happens when you call supervisor.reload() in your code, as shown above. Data stored in alarm.sleep_memory will persist through a reload.
A reset is what happens when you press the reset button on your board. It can also happen automatically for a variety of reasons, including a low voltage brown out or a watchdog timer. It is what happens when you call microcontroller.reset() in your code, as shown above. Data stored in alarm.sleep_memory will not persist through a reset.```
(TFW you're staring at the screen waiting for a response, and realise you never sent the message. ๐คฆ๐ปโโ๏ธ )
It reads okay to me. I'm assuming you really want to concentrate about the status of sleep memory, as there are a few other things that could differ.
That's the point of it in this code, anyway.
We can do a more thorough explanation in the Welcome guide FAQ eventually.
I wonder if its worth bolding the last line in each paragraph, or something to just really emphasize that point. But the wording reads fine to me
I like that. I bolded "will" and "not", but the whole sentence is probably better. I'll italics those two words.
It had formatting, but it wouldn't have shown up here anyway, so I used code formatting.
Yup figured as much. Hopefully that helps at least really call attention to it. I still fall back to the "I dunno what is going on so pull the power" reset sometimes
That's what I had originally
but it made my error tracking useless.
Because they were tracked in sleep_memory
So I made the code more complicated to keep my data ๐
haha also works. I had a "reset reason" adafruit io feed for a long time to try to track down reasons things were not working
Thanks!
Hmm.... where were you earlier? lol. That's also a really good way to do it.
Wait, no. Not for this. It wouldn't have been obvious enough.
Sadly working to afford all the random stuff I like to buy ๐ It's not infallible but can be a nice to have
Hah! Aww. Good call on nice to have. I feel like it's not needed here though. Might have been too much.
Mostly because it doesn't make it clear what happened in the code, necessarily.
Which is what I'm trying to do I guess.
Hmph. Could have tracked Adafruit IO and WiFi errors on separate feeds. That would have been ultra clear.
The only issue is when you have wifi issues and you cannot log an error with adafruit io
I am looking at some use cases for OTA type of updates where the UF2 file is transferred into fileystem and then update on a reset or bootloader call.
I am having trouble finding a method that does not still require the UF2 to be moved on to the mounted drive preventing the self update processes when it is firmware and not just application software.
It seems the ability to pass a file reference when saying on next reset use the bootloader mode. Similar to MBOOT with Micropython
not sure I follow, you want to update tinyuf2 ?
or do you just want to update Circuitpython ?
Update circuitpython from a UF2 that was trasfered to the fileystem by some method
the OTA update is done like this, not with a UF2 but a bin https://docs.circuitpython.org/en/latest/shared-bindings/dualbank/index.html#module-dualbank
unless you write some python code to translate the UF2
which wouldn't be too hard I assume, it has a spec and it's made for that
Bin is fine, I have my own custom build system setup so I can spit that out. Okay so the UF2 update mechanism is actually using the SAM dual bank setup? and why the filesystems are not shared? Or is this avoiding UF2?
the UF2 bootloader is a firmware that simulates a USB drive and reads the UF2 file dropped on it, which contains instructions on what and where to write things. As fas I know, it doesn't write to the other bank since it's run when connected to the PC and doesn't need to be able to recover
like the Circuitpython UF2 is just telling it to write the CP binary to the OTA0 partition
I don't know what you mean by sharing filesystems
what you want is just read the bin and use the dualbank module
Thanks @jaunty juniper this is really helpful.
My meaning is that lets say in Micropython there is a singular filesystem. But Circuitpython at least makes it appear like there is one user filesystem, and the bootloader fileystem. But it sounds like it is a simulated
no as I said there is no filesystem in tinyuf2
it's just receiving the file dropped as if it were a serial communication sending data
my understanding is that since USB MSC works at the block level, the UF2 file format is made so that each 512B block contains binary data and instructions on where to write it, so that it works even if sent in a random order
Makes sense, but at first glance it felt like two. Sorry for the misunderstanding. So typical usage is the OTA0 partition when using UF2 based updates, and if I utilize the dualbank module I can manually pick which bank, and use a bin file to update on or the other...
I think the module will only write to the other bank, the one you are not running on
and in theory if you write something non-CP while in CP, then switch, and you switch back from the other without writing anything you would get back to CP
or write another version of CP and then decide to reboot back to the previous one
Thanks, based on reading that is what I would assume as well
that's actually funny, considering sometimes people ask if we can run Arduino and CP at the same time, technically you could write some Arduino code on the other bank and reboot between them
(maybe not, I don't know the intricacies)
One of the developers I am working with was asking about switching between C and CP so I totally understand, so it is funny timing because that was before I realize dualbank was implemented in circuipython
@jaunty juniper This is super helpful, I was not aware of the module and was busy chasing bootloader modes and how to manage that. This appears to fit my use-case well
it eats up quite a lot of flash, so believe me it is implemented ๐
Hi jepler! Thank you for answering.
I'll refer to the web site and review the source code.
Any one using Python 3.10.6 instead of 3.10.4 for builds?
@hidden rain I just ran a test in docker similar to #circuitpython-dev message in ubuntu:kinetic which has python 3.10.6 as the official ubuntu python3.10 package and it also succeeded. ```python3.10 --version
Python 3.10.6
On all my systems I simply run the python that is shipped with the operating system (I prefer to use debian stable while I think dan uses ubuntu lts). You mentioned using a "deadsnakes" ppa back on 8/27. If you haven't resolved this and gone back to the standard operating system package of python, I think it's probably still the root of your problems; or at least, it's a very clear difference between the systems that work (mine, dan's, our CI system and my docker-based tests) and your system.
If you have the ability to try out a fresh virtual system without installing a non-standard python or any ppas I suggest you give that a whirl; it's unfortunate if you have a broken linux installation but sometimes it's just par for the course and on the balance it may be rational to discard it and use a fresh system instead.
I started fresh about 8/29. It seems Ubuntu 22.04 with python 3.10.4 has a broken virtualenv (no deadsnakes, no ppa). It seems to think it needs Python 3.10.4.final.0, thus the mismatch. I was thinking uninstall pre-commit at local and top level, then try Python 3.10.6
OK, what steps do you use on ubuntu 22.04 with python 3.10.4 to see that there's a "broken virtualenv"?
(and what message do you get)
Well, when I ran pre-commit it complained about it not being 3.10.4.final.0. I looked the issue up on pre-commit github and the main developer kept refering to links having a solution.. but I got lost
(I should make an addendum to what I stated above about our CI system; it does NOT use OS python packages so it is not a good test)
Oh I did have to use python-is-python3
that's an operating system package so it "should be fine"
No.
I don't necessarily know what you should do. I'm trying to gather information about what commands you are running and what output you're observing, so I can try to reproduce and understand your problem
this message?
File "/home/latkinso42/.local/lib/python3.10/site-packages/pre_commit/repository.py", line 84, in _hook_install
raise AssertionError(
AssertionError: BUG: expected environment for python to be healthy immediately after install, please open an issue describing your environment
more info:
virtualenv python version did not match created version:
- actual version: <<error retrieving version from /home/latkinso42/.cache/pre-commit/repogpa7707b/py_env-python3/bin/python>>
- expected version: 3.10.4.final.0
Try "pre-commit clean" then "pre-commit run" again.
yes.. I did that... no luck ๐ฆ
OK, let's see if virtualenv itself is happy when not used via pre-commit. virtualenv .venv; .venv/bin/python3.10 --version
When you created your fresh system did you copy any files (e.g., in your home directory) from another system?
my system happens to give me a different virtualenv path but it works when I directly run the python executable inside: ```~/.cache/pre-commit/repo1wj1vf0l/py_env-python3/bin/python --version
Python 3.10.4
how did you install pip and virtualenv? I installed from apt with `apt install python3-pip and python3-virtualenv, but I'm aware the internet gives different advice about this.
OK, then I agree your "virtualenv" command is broken.
no idea how to fix... it came this way
how did you install pip and virtualenv? I installed from apt with `apt install python3-pip and python3-virtualenv, but I'm aware the internet gives different advice about this.
and what's virtualenv --version say?
20.16.3
I have success with both the one from python3-virtualenv (which reports virtualenv 20.13.0+ds from /usr/lib/python3/dist-packages/virtualenv/__init__.py) and the one from pip install virtualenv (which says virtualenv 20.16.4 from /home/jepler/.local/lib/python3.10/site-packages/virtualenv/__init__.py)
is virtualenv the same as python -m venv ?
no joke, virtualenv and venv are sworn enemies https://stackoverflow.com/questions/44091886/whats-the-difference-between-virtualenv-and-m-venv-in-creating-virtual-env
well, OK, maybe it's a bit joke but no they're different
let me look at my history
ok.. not in my history as explicite. must have been a side effect or it came with Ubuntu 22.04
@onyx hinge so there's a bug reporting the wrong error with format that is fixed in latest MP, is it worth opening an issue on our side ?
@jaunty juniper If you think it'd be important to fix in 8.x.x; otherwise, as part of 9 we anticipate getting all fixes from MP by merging a future release.
@hidden rain can you please show the full output of virtualenv --version?
virtualenv 20.16.3 from /home/latkinso42/.local/lib/python3.10/site-packages/virtualenv/init.py
OK this time I have reproduced the problem
vvirtualenv 20.16.3 from /home/jepler/.local/lib/python3.9/site-packages/virtualenv/__init__.py
ijepler@bert:~/src/circuitpython$ virtualenv --clear .venv; .venv/bin/python3.10--version
created virtual environment CPython3.9.2.final.0-64 in 213ms
creator CPython3Posix(dest=/home/jepler/src/circuitpython/.venv, clear=True, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/jepler/.local/share/virtualenv)
added seed packages: pip==22.2.2, setuptools==63.4.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
bash: .venv/bin/python3.10: No such file or directory
well..at least I dont feel so alone...
er no, I haven't. I went back to my desktop system, not my docker, which has 3.9. 
Sigh
no, the slightly lower version is not the cause. Back in the right environment, ```jepler@92e02290abdb:~$ virtualenv --version
virtualenv 20.16.3 from /home/jepler/.local/lib/python3.10/site-packages/virtualenv/init.py
jepler@92e02290abdb:~$ virtualenv --clear .venv; .venv/bin/python --version
created virtual environment CPython3.10.4.final.0-64 in 111ms
creator CPython3Posix(dest=/home/jepler/.venv, clear=True, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/jepler/.local/share/virtualenv)
added seed packages: pip==22.2.2, setuptools==63.4.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Python 3.10.4
OK how about the full output of virtualenv -vv --clear .venv
wow..its rather large
save to a .txt and attach then
the output is long enough that discord rejects it, I guess. It used to offer to auto-convert to a .txt attachment but I guess not anymore
ah forget it, it was already reported (I even commented on it...) and you fixed it in MP ๐
try info001.txt
"executable": "/home/latkinso42/research/circuitpython/.venv/local/bin/python", OK so as others have seen in related issues on the internet, virtualenv is improperly placing the Python executable within the environment, but it still doesn't answer why
Please show the full output of export | grep local
export | grep local
declare -x PATH="/home/latkinso42/.local/bin:/home/latkinso42/Installs/gcc-arm-none-eabi-10-2020-q4-major/bin:/home/latkinso42/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin"
declare -x SESSION_MANAGER="local/MST-Ubuntu64:@/tmp/.ICE-unix/1002,unix/MST-Ubuntu64:/tmp/.ICE-unix/1002"
declare -x XDG_DATA_DIRS="/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop"
OK maybe this time I really reproduced it
When I did this, my virtualenv test started failing: pip install -U setuptools
??.. you would like me to execute that last part?
no
OK, I want you to try removing setuptools installed via pip: pip uninstall setuptools and then ensuring it's installed via apt: apt install python3-setuptools
setuptools 59.6.0
```You should end up with version 59.6.0
I think this is the bug you're hitting: https://github.com/pypa/setuptools/issues/3278
should i use sudo, its locked
export SETUPTOOLS_USE_DISTUTILS=stdlib you could also leave the setuptools version unchanged but try this workaround https://github.com/pypa/setuptools/issues/3278
yes for apt command you would need to use sudo
pip list | grep setuptools
setuptools 59.6.0
setuptools-scm 7.0.5
OK then back up and try virtualenv -vv --clear .venv; .venv/bin/python3.10 --version
I mean, try it next
it's just a command you ran before
It's late o'clock here, so I'm going to head out.
looks like it might be "fixed", I'd try pre-commit clear / pre-commit run again
Looking at cleaning up the typing for adafruit_requests and it looks like it should just be updated to remove CircuitPython 6.0 features. Along those lines, it looks like set_socket() was depreciated in favor of instancing a Session, and while that could be removed, plenty of examples (and probably Learn Guides use that method. Is it worth removing set_socket() and doing clean up, or keeping it in. For reference, a GitHub search under adafruit org had 85 hits for set_socket usages in the Code category.
Happy to take that on, but not sure if it's worth it. I don't think it needs to be removed for any reason, just that it could (ignoring breaking legacy code).
I guess it then also means changing the handful of other libraries that work with it (e.g. - adafruit_esp32spi)
Other projects have taken priority. Not sure when I'll get to this, so closing.
@proven garnet my understanding is that Requests supports two incompatible workflows: esp32spi and espressif native. It may be quite complex to consolidate them without side effects in tons of user code. The NINA firmware code exposed by esp32spi is based on Arduino wifi code, and isn't typical socket code like we see in CPython, WIZnet, or espressif port of CircuitPython.
Thanks @DJDevon3 :)
Both have been fixed in this PR https://github.com/adafruit/circuitpython/pull/6873
@proven garnet @crimson ferry I started some branches to update and remove things in adafruit_requests (partly as part of adding async support) and improving the error exceptions, but did not finish it yet.
https://github.com/adafruit/Adafruit_CircuitPython_Requests/compare/main...dhalbert:Adafruit_CircuitPython_Requests:async
https://github.com/adafruit/Adafruit_CircuitPython_Requests/compare/main...dhalbert:Adafruit_CircuitPython_Requests:change-exceptions (I think some of this was done already in another PR)
Also in ESP32SPI:
https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/pull/167 (This is on hold because a change breaks some examples)
Does anyone know if this very useful fix Melissa implemented to disable the border on IL0373-based displays has made it into the MagTag's libraries/7.3.3? Not sure how to actually use it in CP: https://github.com/adafruit/Adafruit_CircuitPython_IL0373/pull/26/commits/188bac3bcc24af49dc89403d05e2a7b41fbb1da3
@makermelissa (or anyone else) Are you familiar with E-paper mechanisms and could review? This looks sensible to me, but I don't have experience with the details.
CircuitPython version
Adafruit CircuitPython 7.3.1 on 2022-06-22; Adafruit Feather ESP32S2 with ESP32S2
Code/REPL
import time, wifi, ipaddress
from secrets import secrets
ssid = secrets["ssid"]
password = secrets["password"]
wifi.radio.connect(ssid, password)
timer_A=0
ping_addr = ipaddress.ip_address('8.8.8.8')
while True:
ping = wifi.radio.ping(ping_addr, timeout=1)
print(f'{ping=}')
time.sleep(0.2)
Behavior
p...
Looks like it. My bad. Thanks for pointing me at that.
This means that the OS version of uncrustify can be used, rather than the pybricks one.
For now this is a test to see whether it comes up green.
Gotchya, that's helpful context!
Okay, if you're tackling it then I don't want to double up. Thanks!
I think I'll hold off on working on type annotation clean up for those for a bit - the main issue is that it's a bunch of Protocols intricately arranged, and I suspect once requests and other libraries potentially change those will simplify a lot. Part of the typing is just handling 6.0.0 things.
ALL: Still getting miscellaneous build issues after a push; Is there a way to test out on my local system first? I understand than make translate, make html and pre-commit should cover most issues. Are there other actions that might show failures locally? Also I am confused by some of these weird build actions that do not seem relevant to anything I coded. Otherwise very close! Advice?
@tulip sleet I don't know if you read the scrollback last night but I think I got to the root of lee's problems running pre-commit. current setuptools is incompatible with debian's python, and everybody's been finger-pointing about it for months. There are two workarounds, to set an environment variable or to uninstall setuptools updates and use the debian/ubuntu package version. https://github.com/pypa/virtualenv/issues/2350 https://github.com/pypa/setuptools/issues/3278
I saw that but didnโt see the final conclusion. Great! I can write it up explicitly in the Building guide.
I am afk but will look at the build errors when I return
setuptools 65.3.0
```If this is above 60, and you're on an ubuntu/debian system, then I think pre-commit won't work
@hidden rain the failure seems to be pre-commit still https://github.com/adafruit/circuitpython/runs/8218802346?check_suite_focus=true -- I had hoped after the work we did last night you were finally able to run pre-commit successfully locally. If not,.. let's go through it again. What commands are you running, and what messages are you seeing?
The command to run locally would probably be pre-commit run --all so that it checks all files. By default it only checks modified files that are not yet committed.
also I would nix the extra emphasis punctuation in this message: ``` +msgid "%q must be a bytearray or array of type 'h', 'H', 'b' or 'B'"
Yes !! Please Do! The write -up will save lots of pain for others.
I ran pre-commit this AM without errors! -- that is locally. The one you just linked was from before the fix on my Ubuntu. When I run t now, however, there are no file to check. (what now?)
pre-commit run --all.
By default [pre-commit] only checks modified files that are not yet committed.
I said this a moment ago but didn't specifically tag you
ok.. it failed; had to perform a 'make translate'; then it passed! Yeah!
I suppose I need to make an inert change, make html, make translate, pre-commit run --all, then commit, then a push. Will that flush out all the gremlins?
I can't promise all gremlins will be flushed
but yes you need to run pre-commit --all, which will tell you about problems and auto-correct some of them. Once it reports no problems, and other checks you know how to make (make html, make translate) work without error, you can commit and push.
if you "pre-commit install" then it will automatically run on the files being committed, just a reminder since before now you haven't been able to run pre-commit at all and probably have it disabled and may have forgotten about it
Is it possible to create an HTTPS webserver on the ESP32 with this implementation? It looks like the ESP32 is capable of this. Here is the example provided : https://github.com/espressif/esp-idf/blob/36f49f361c001b49c538364056bc5d2d04c6f321/examples/protocols/https_server/simple/main/main.c
There is this reference to SSL Certifications + WSGI server but this isn't exactly the same : http://eventlet.net/doc/modules/wsgi.html#ssl
@onyx hinge which do you think is the easier to do/explain for the pre-commit fix: the env variable or use apt instead of pip setuptools?
I'm not sure! For the env variable you have to explain putting it in bashrc, for the apt setuptools it could be wrecked at any moment by pip installing something that requires a newer setuptools
and besides that I think that long term setuptools doesn't plan to support the scheme that the environment variable enables, it's a legacy thing they want to remove as far as I understand it
which tool is ultimately responsible for the actual fix for this: is it that Python needs to get repackaged, or setuptools, or something else?
ideally virtualenv would change so that it creates .venv/bin/python and .venv/bin/activate regardless, because other tooling as well as humans expect that
pre-commit says it doesn't want to use venv instead of virtualenv because venv is not avail everywhere
I don't think I know the answer to that yet, unfortunately. There's a lot of finger pointing among the projects, currently. except for ubuntu/debian, which as far as I can tell hasn't been apprised of the situation (via a bug report on bugs.debian.org) and so hasn't had the chance to point the finger back at anyone else.
yes, that was my impression too -- nobody seems to be moving toward a solution
virtualenv seems like it could make a small and pragmatic change and get a LOT of people back on track by doing so
OR they need to clearly document the proper method for finding the python executable within the venv and that ".venv/bin/python" isn't it. (apparently Windows is .venv/Scripts/python or something, so it's already not exactly the contract they have with consumers)
so I think I will document the .bashrc / .bash_aliases fix, as it seems to be the simplest. I could look back but do you have the setting at your fingertips? I saw it in some issue thread.
(I put everything in .bash_aliases so I don't have to modify .bashrc)
let me find it again
export SETUPTOOLS_USE_DISTUTILS=stdlib
huh I didn't know about .bash_aliases
This is in the default .bashrc near the end:
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
======================
Setuptools and the PyPA have a `stated goal <https://github.com/pypa/packaging-problems/issues/127>`_ to make Setuptools the reference API for distutils.
Since the 60.0.0 release, Setuptools includes a local, vendored copy of distutils (from late copies of CPython) that is enabled by default. To disable the use of this copy of distutils when invoking setuptools, set the environment variable:
SETUPTOOLS_USE_DISTUTILS=stdlib
```It's considered deprecated to do this per setuptools docs
does SETUPTOOLS_USE_DISTUTILS need to be set when you install pre-commit or just when you use it?
sounds like the former??
It has to be set when the virtualenv is created
I think that'd be the first time you "pre-commit run"
so when doing pre-commit install
ah, ok, maybe not much happens for pre-commit install
@tulip sleet some kind of initial power related race condition?
https://forums.adafruit.com/viewtopic.php?t=194231
ok. asked for code.
@onyx hinge @hidden rain OK, documented the workaround here: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code#workaround-for-pre-commit-issues-on-ubuntu-and-debian-3086216 and also put a warning in "Building CircuitPython" guide that refers to there.
When entering deep sleep, the user may want to set certain pins to be in a particular state. For example the I2C-power pin on a Feather ESP32-S2 might beenabled to, say, allow an external sensor to run during deep sleep, or disabled to minimize sleep power.
Discussion with @ladyada yielded the idea of passing a list of DigitalInOut's to alarm.exit_and_deep_sleep(). The state of those pins would be preserved.
Subject to refinement as implementation progresses.
thank you!
Can we get support for the Tiny pico Nano from UM, added to the circuitpython supported boards?
Can we get support for the Tiny pico Nano from UM, added to the circuitpython supported boards?
_Originally posted by @sshinnawy in https://github.com/adafruit/circuitpython/issues/6685#issuecomment-1239739189_
@unexpectedmaker if ya can help out - it would be awesome :)
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/1r6zSavb6KeDuuclsBSNZVMwQ7CxCNq1dZr7ML8r6oCA/edit?usp=sharing
CircuitPython Weekly Meeting for September 12, 2022 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to p...
Closing in favor of an implementation of #6876.
Thanks!
Thanks for all your hard work to help me resolve this!
@idle owl I figured out the adabot issue with the Library Infrastructures page, unsurprisingly it was me

I submitted a PR for it, just a heads up! 7th time's the charm!
Does on normally pressed the "Resolve Conversation" button on every sub-issue?
Yes, but you don't have to add a comment for each one. The other people in the conversation get an email for every reply, so if you are just agreeing, just resolve.
Gotcha
Yes. It is used in the read()
I think we settled on analogbufio
changed as per sugested.
you're welcome. I'm just glad to have gotten to the point of knowing a workaround, even if I don't feel like I quite "got to the bottom of it"
Hahaha. Who wrote this terrible code? Run git blame and it turns out it was you.
if you're not writing bad code, you're not writing much code
100% of my bugs I wrote have been in code
also, always make changes on production server and commit form there, this way git blame just shows "root" and you can deny eveything
I wanted to have a t-shirt made that said "Write code. Not too much. Mostly C". (well, forgive me for the "C" part, I was suggesting it in a C++ shop..), making reference to Michael Pollan's advice to "Eat food. Not too much. Mostly plants."
I've not had a chance to look at the ESP32 support yet, I've been moving into a new workshop/factory, but I'll have a look at this today and add support for my TinyPICO and Nano boards :)
I believe in kondomari code management strategy
delete all code that doesn't spark joy
@proven garnet @idle owl I noticed that part of the libraries section doesn't usually paste into the weekly meeting ".md version" properly .. I wonder if it could be fixed in adabot
@makermelissa (or anyone else) Are you familiar with E-paper mechanisms and could review? This looks sensible to me, but I don't have experience with the details.
I went through this too and looked a bit into shared-bindings and seems reasonable to me as well.
Happy to look into it! If you make an issue, feel free to tag and assign it to me! Otherwise I will in a little bit.
When a push initiates a work flow that fails, I typically try to resolve then push again. At this point the workflow shows several failed instances followed by successful instances. Do the old one eventually disappear or is there another action required on my part?
You do not have to do anything else besides push again to trigger the workflow to run. Looking at the PR I see the pre-commit failing but everything else passing
Yes, that was nearly a day ago. jepler help me fix my pre-commit environment and I pushed abut 6+ hours ago.
For some reason, its not showing up
The last commit I see pushed was 23 hours ago hmm
I guess I could touch a few files and re-commit/push
You could double check it did push or yeah touch a file and re-push
On your GH repo the last commit I see is 23 hours ago
ok..that push worked..we'l see if everything goes smoothly
@onyx hinge So.... at this point should I write an "enter deep sleep" function since it will be used in two separate situations in this code? I'm genuinely a bit fuzzy on how this is going to work. Two separate alarms waking the board up for different purposes. Are you interested in helping me work through this tomorrow?
gut guess, if you use the function 2 times but differently each time, probably not worth it being a function
Ok fair enough.
@onyx hinge just to make sure I'm looking at this correctly, the problem is the missing newlines?
And that the list should be "under" those bolded items missing newlines?
Actually, to be honest, how is it copy/pasted? I know the output from adabot, but where (or I guess what file?) is it actually being copied from?
and yes my fix was adding some newlines
the flow is that whatever's in the doc is exported from google as .txt, then pasted into github with a ".md" extension
Got it, thanks! I'll get on that ๐
Awesome! I will try to test it on actual hardware tomorrow to make sure nothing broke with all the changes, but wouldn't expect that
Most ports/*/boards/*/board.c files contain identical do-nothing versions of board_init(), board_requests_safe_mode(), reset_board(), and board_deinit(). These can be replaced by default MP_WEAK versions of these routines. There was a limited attempt to do this in the past for some ports, but this does it for all boards.
The advantage of using the default MP_WEAK versions consistently makes it less work to change the signatures of any these routines (which I am contemplating ...
Cannot reproduce it on my beetle ESP32-C3..
Did 20 reloads and tried some resets, all fine, no signal reduction.
So, S2 and S3 have the issue but not C3.
I will update the title respectively.
This seems like https://github.com/adafruit/circuitpython/issues/6018. I think it used to work and then stopped working for some reason. A simple trial would be to lengthen the timeout in the program, which is currently at 2 seconds. This is on my list to debug for 8.0.0, but I haven't gotten there yet.
Guess what I connect a OLED just for display terminal output..?
I "reviewed" by looking for removed lines that seemed like they shouldn't have been:
git diff -U0 origin/main...dhalbert/weak-board-defs | grep '^[-+][^-+]' | sort -u | less
but I didn't see any removed lines that looked like function bodies, so the weak replacements should be good to go.
Approving based on kattni's testing, I didn't do a technical re-review
@kattni I will merge what have now to make further testing easier, and open an issue for the Thonny issues you are seeing.
Thanks @jepler!
Tested with Thonny. I'm still getting the PROBLEM IN THONNY'S BACK-END error after rebooting the board. Tried it with/without boot.py, with/without .env, and with the same code as Dan used. I can consistently get the error when restarting the board or restarting the Thonny app. If I click the STOP button to restart the Thonny back-end, Thonny begins working smoothly again (including with the status bar enabled and a code error introduced, so much of this issue is resolved in the PR's curren...
@tulip sleet: I re-requested review of #6757. I "believe" I have addressed all concerns, wishes, and comments. Perhaps we could narrow down any remaining concerns. Thanks -Lee
I will be testing functionality next. I have to finish some other things so it may be tomorrow or later before I get to it. Thanks for all your work on this!
Understood. Will patiently wait at this point. I hope to add BufferedOut and extend to SAMD51 in the future. Hope to invite a few micro groups to ferret out the implementation for other platforms if possible. Thanks for your review and everyone in the group too! - Cheers
Seems CIRCUITPY_TERMINALIO=0 will remove fontio module too
What's the largest int the SAMD21 can hold again?
It's works fine for me, no need to use while True to blocking script:
- commenting
supervisor_start_terminalfunction incircuitpython/shared-module/displayio/Display.candcircuitpython/shared-module/displayio/display_core.c - commenting
root_group = &circuitpython_splash;incircuitpython/shared-module/displayio/display_core.c
dockerfile / linux command:
WORKDIR /root/circuitpython/shared-module/displayio
RUN sed -i 's/supervisor_start_terminal/\/\/ sup...
Thanks! Also, I submitted a PR to make the MQTT library keyword only for MQTT.init() which is technically API breaking, though I couldn't find any learn guide or libraries that did it positionally. There's just a lot of arguments so this might help keep people from mixing them up. Thoughts? Happy to close it if it might introduce unforeseen issues though.
Not sure what the best format would be.. but getting into the bootloader on this board is a bit odd, since it does not have a boot button... so figure it maybe worth placing it here.
Hi, double pressing reset is the default instruction in the learn guide. It's common to every NRF and Atmel board, and all Adafruit boards (RP2040 and ESP32-Sx). There is no need for a special case for this board.
@anecdata - I was able to reproduce this issue; but what I saw on a network analyzer is that the mDNS queries were still being sent; but the mDNS server (which I had running on a separate ESP32) stopped responding. What are you using for a mDNS server? Also, did you run any Web Workflow activity during your testing? I did that and did cause a hard crash.
Tested on a KB2040 and it worked fine.
@DavePutz I'll go back and verify, but I believe I tested this with web workflow on and off. I may be misunderstanding something, but there is no mDNS server other than the mdns.Server(wifi.radio) which is used to do the network queries. I have a number of other devices with web workflow running (and I had one with manual pre-web-workflow mDNS running), and they should all, in theory, show up in the .find listing (and often do, until it the .find starts coming back empty.
Other behav...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.0-22-g3ba385ff5-dirty on 2022-09-08; Raspberry Pi Zero 2W with bcm2837
Code/REPL
None
Behavior
The DEBUG section of the Broadcom learning guide indicates that DEBUG UART is enabled by default on the default RX and TX pins, however 8.0.0 doesn't have the console enabled on the RX/TX pins. The CIRCUITPY_CONSOLE_UART_TX/RX parameters are set in mpconfigport.h
Description
7.3.3 builds ...
Cytron Maker Feather AIoT S3 has been redesigned with Espressif WROOM-1 N8R8 module to replace the obsolete Ai-Thinker module. Hence the change in pins assignment.
Thanks.
This is really more of a support question, more suited for the forums (https://forums.adafruti.com) or discord (https://adafru.it/discord)
This may be due to a corrupted filesystem. Do this in the REPL:
>>> import storage
>>> storage.erase_filesystem()
That will erase and reformat CIRCUITPY.
If that does not work:
- Which version of CircuitPython?
- Is this is a regular Pi Pico?
- Are you using Thonny, or are you using the CIRCUITPY drive with an regular text editor...
my pico after flashing circuitpy python is in readonly mode and I am not able to write any code in it.
Wonderful Mark!
I wasn't aware of how many RP2040 variants exist.
I ultimately hope to duplicate this functionality to SAMD51.
Also perhaps experiment with BufferedOut perhaps using a DAC.
In the short term, I did it to be able to read ADC data at 5 microseconds
or less.
Yet I hope it will help many others too!
Thanks for your testing, review and assistance in this project.
-Lee
On Thu, Sep 8, 2022 at 6:30 PM Mark @.***> wrote:
@.**** commented on this pull request.
Tested...
Did you sell enough of the original version that you want to continue to support owners of that board? If so, maybe this should be a new board with a different name (V2 or whatever)?
it worked. thank you
Nope, the original board not even went to mass production stage. The Ai-Thinker module is already obsolete when we tried to place order for mass production. So it's alright to use back the old product name.
Thanks.
I'm working on this as a new library!
Also note https://github.com/adafruit/Adafruit_CircuitPython_BLE_Eddystone as a model of another beacon library
Apropos of nothing, turns out you can set up a PinAlarm and a TimeAlarm in the same code with no issues. Not sure we've really tried that before, so I figured I would mention, it works smoothly.
The correct link for adafruit forums is: https://forums.adafruit.com/
Actually I may have spoken too soon.
@tulip sleet Jeff was helping me yesterday, but it appears he it not around at the moment. I can show you my code, but the concept is that I have a TimeAlarm and a PinAlarm set up, and the final line of the code is alarm.exit_and_deep_sleep_until_alarms(pin_alarm, time_alarm). The time alarm works great. However, now that I set it back to a higher value as it should be, it's become clear the pin alarm is no longer functioning. Or not consistently anyway. I got it to wake up on PinAlarm a moment ago, but otherwise it has ignored it entirely the rest of the time.
exit_and_deep_sleep_until_alarms(*alarms). The * means it takes one or more alarms
Correct, but not clearly to me. I would never have figured that out without Jeff telling me.
An example of what that line can look like with two alarms + would be helpful.
i am editing that doc for other reason now and can make it clearer
Oh ok, that works. I have it on my list to file an issue. I will not file that one.
Any suggestions for the issue I'm now having with this hardware?
I think I thought it was still working because the time alarm was so short, it looked like it was responding to the switch. It was not.
Now it works again once.
does it work at all if you just remove the time alarm?
Trying that.
PinAlarm back to functioning exactly as expected.
it worked several times in a row?
Yep.
Takes a minute to sleep once it starts sending data, but that's normal because of the delay. But it wakes up immediately when I move the magnet.
ok, if you can reproduce and file an issue, that's good. Try a long time alarm and try the pin alarm triggering several times in a row.
Ok,. pin alarm works with a longer time alarm. Waiting for the time alarm to trigger now.
How would I go about forking a library into the adafruit org? I wrote a library for BLE iBeacons per library request issue.
Happy to take this offline if it makes more sense
That's not how you would do it. You would want to transfer ownership.
We don't typically add forked libraries into our ecosystem.
Got it
That is presuming you wrote it for Adafruit ultimately.
Yup!
Then yeah. Transfer ownership. If you can't transfer directly to Adafruit, transfer to me, and I'll do it.
@tulip sleet Ok, with a longer time alarm, everything works. My initial code was a 20 second time alarm to verify it was working. Which made pin alarm unhappy.
so if the time alarm went off before the pin alarm, there was a problem? If you can show a simple example, that would be great
@crimson ferry I found one issue with tracking "reload" instances.... When you're iterating on code on an ESP32 in, say, Thonny, where you have to enter the REPL to update your code, every time you CTRL+D to run the code again, it tracks a reload, which means after 5 iterations, it jumps into the hard reset code block. Obviously once everything is working properly, there's less iteration, but I feel like this has a chance to be a problem.
I guess that's a possible description? I'm uncertain what part of it was causing what issues though.
I rewrote the doc example to be this. Maybe you can adapt it to show the issue (this is not printing the wakeup reason, for example):
import alarm
import time
import board
print("Waking up")
# Create an alarm for 60 seconds from now, and also a pin alarm.
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 60)
pin_alarm = alarm.pin.PinAlarm(board.D7, False)
# Deep sleep until one of the alarm goes off. Then restart the program.
alarm.exit_and_deep_sleep_until_alarms(time_alarm, pin_alarm)
Ok, yeah mine prints what woke it up.
Let me make sure I have this backed up and try your example.
@proven garnet I see it
Sweeeeet
@tulip sleet Of course now it works fine with the shorty example, even with the timer at 20 seconds. ๐คท๐ปโโ๏ธ
I won't file an issue and assume it's a me-problem. This project will not run into it anyway.
Ufff, I can't get it to enter the REPL with this code.
Sigh.
FINALLY. Had to quit Thonny, connect using tio, and then spam CTRL+D while moving the magnet back and forth, and it finally found its way into the right place.
Now to look up how to rename a file.
Blergh. Is it os.rename()?
yah
@tulip sleet Sorry to bother you, but I think you might use a CPX as a timestamper for the weekly meeting, and if so, is the code available? (If you don't mind) I'm thinking I'd rather use my CPX than my Macropad because I'm lazy
I received the code yesterday. Was going to get an updated version to you this weekend.
thanks!
press reset when you start recording to start it from 0:00
will do
This isn't workiing.
Ok, maybe it worked this time?
Appears to have. Oof.
Pro tip: Do not run that code with a super short timer. You will be stuck in it.
I wonder if the timer had already expired by the time you got to it
oh yeah, good point, I forgot about that since I disable autoreload in all my boot.py - the code could check for reload reason to distinguish. Another thing I think I thought of in a dream last night (o_O) was to track the rate of reloads instead... so like 5 in 5 minutes is bad, but 5 in 6 months is probably not so bad. But these are nuances. that anyone can embellish with later to their own liking ๐
This is me manually reloading out of the REPL. ESP32 workflow, no CIRCUITPY drive. Rate would also be a valid way to deal with it, good dream call. I think the code already checks the reason, but only to see if it's NOT the standard startup. It's not checking what type of reload it is.
Oooh an error at the perfect time!
hooray fior serendipity
OK, I have the two different reasons. It does distinguish between REPL_RELOAD and SUPERVISOR_RELOAD.
I can use that pretty easily, I think.
Does this work like I want it to? py if supervisor.runtime.run_reason is not supervisor.RunReason.STARTUP or supervisor.RunReason.REPL_RELOAD:
I get confused with this stuff sometimes.
And end up iterating in circles.
or should I do is not in (supervisor...STARTUP, supervisor....REPL_RELOAD):
i think not in (...) is more likely to do what you want. the first might not have the precedence you want (you might be doing a logical or of the is not with REPL_RELOAD; i'd have to check the language reference to be sure)
That's what I was thinking. Which is why I asked. Felt like it wouldn't work.
I always have to check too, or add defensive parentheses
I think you're really just trying to see if the code has triggered a lot of reloads before resetting, so is supervisor.RunReason.SUPERVISOR_RELOAD maybe
Ok that seems to be working. REPL reload no longer increments Reload number:
I have run into this issue today with my QT PY ESP32 S2. @denschub is right, about a noisy power source. I was using a 3' long USB-C cable, and then I switched to a 1' short USB-C cable and it connects to WiFi just fine. I was using the wifi connect example found here https://learn.adafruit.com/adafruit-qt-py-esp32-s2/circuitpython-internet-test
@tulip sleet How do I explain in words the final value in this line of code? voltage = ((voltage_pin.value * 2) * 3.3) / 65536
I know what the 2 and 3.3 are.
I know what the 65536 is, but I'm not sure how to explain it in words.
voltage_pin.value varies between 0-65535 (65535 is 2**16-1), a full-scale value for an analog input. So the /65536 (consider it as a being done first), converts the value to a value between 0.0 and 1.0. Then the 2 and 3.3 scale it to the actual voltage.
algebraically, this is the same, and maybe is a little clerear:
(voltage_pin.value / 65536) * 2 * 3.3
so the full scale is 3.3/2 ??
3.3 is the reference voltage, 2 compensates for the voltage divider.
you might want the division at the end to avoid loss of precision, though, but i'd have to think about it some more to be sure
I am genuinely surprised I remembered that much.
I can pretty easily explain it out of order if keeping it that way makes sense.
the div is floating point anyway, so I don't think it matters much in this case
the 65535 value relates to the bit depth of the ADC, which can vary. CP scales everything to 16 bit (design choice to make things less confusing). Arduino does similar, but 10 bit.
Right, I actually took this from Arduino code, and had to get help with why I was getting garbage voltage values in CircuitPython.
oh right, i keep forgetting that division is floating point by default in Python3
So.... good as is and explain out of order? Or PR it to what Dan did and make it clearer?
i like dan's wording for use as general description
the whole ADC bit depth thing can be a confusing topic
Agreed
on both counts.
I was mostly asking what I should do with the code.
It would be cleaner to explain in order, but not that much.
yeah, i think Dan's rewrite of the expression doesn't lose precision because division is floating point, so changing the code should be harmless. i'd suggest asking someone else who's familiar with floating point issues to review it just in case
Ok, submitting a PR. @tulip sleet I realise none of the parens are necessary, but should I include unnecessary parens around the * 2 code anyway? Or is this clear enough.
are u shooting for more readable code? or concise code?
Easier to explain code, I suppose.
could split to multiple lines?
like one line to compute voltage at pin
second line to compensate for voltage divider
I understand what you mean, the Arduino code does it that way.
I think this is ok as it is. This code is already kind of chonky though, so adding a bit more chonk probably won't hurt things.
VOLTAGE_AT_PIN = ADC_COUNTS * MAX_ADC_VOLTAGE / MAX_ADC_COUNTS
VOLTAGE_OF_INTEREST = some math based on VOLTAGE_AT_PIN
That is genuinely confusing to me. ๐
Arduino did each line of math separately with its own comment. I thought that's what you were getting at.
Verified Dan's math works the same. (I knew it should, but always test code.)
I'll sit on this PR until I get through the rest of the code walkthrough so I stop bogging down our CI for small changes.
Ok, this sounds like it's not yet properly handling mDNS Hostname conflict naming. While in theory, every device should have a unique name because of using the MAC address, this isn't always the case such as with an improperly setup network where multiple mDNS resolvers keep trying to resolve the same host.
This is good info because there may need to be some updates to code.circuitpython.org to deal with this there too.
Uff I just realised this helper function isn't really necessary here. It turns one line of code into one line of code, and both are the same length and require the same data to work.
Unless I'm missing something obvious, it seems superfluous.
@tidal kiln Am I right that this seems kind of pointless? ```py
def send_io_data(feed, value):
"""
Send data to Adafruit IO.
Provide an Adafruit IO feed name, and the value you wish to send.
"""
return io.send_data(feed["key"], value)```
Or am I missing something obvious.
As in does io.send_data need something more complicated? I don't think it can, because the it would use the exact thing provided by the function.
got more context? where'd that come from?
My code, hold on.
I don't think it's saving any space or complication later in the code.
It doesn't look like it really is simplifying anything that much to me
That's what I was asking.....
Do I have to add key for the basic code to work?
I wasn't sure there.
I can't drop in io.send_data where send_io_data is located? I have to change what's provided to it at that point?
It looks like Scott used f_rename() instead of fat_vfs_rename() so that he could get some status information about specific failures and relay that info back via HTTP error codes. Adding some additional checks from fat_vfs_rename() to Web Workflow should be pretty straightforward.
I'm going to test this and see what happens.
don't need to add a key, but send_data wants the key for the feed
why the call to io.create_and_get_feed() each time?
Ah. Failed to send to Adafruit IO. Error: can't convert 'dict' object to str implicitly
Because it doesn't matter if it tries to create it every time, and it was cleaner than only creating all the feeds once, and then getting the data in the loops. I talked to Justin about it when I first added that feature, and he said that.
ok, yah, doesn't really seem to help much
could just:
send_io_data(io.create_and_get_feed("battery-voltage")["key"], f"{voltage:.2f}V")
wait, not that
i think that starts stacking up too many bits of syntax on the same subexpression, which makes it less readable
io.send_data(io.create_and_get_feed("battery-voltage")["key"], f"{voltage:.2f}V")
I didn't realise I had to specify ["key"] without the function. I'm happy to keep it in there.
Not using the create_and_get_feed means adding the code to create each of the feeds, and then checks to determine if the feeds have been created, and if they have, do not create them again. This code isn't a setup/while True: loop situation because of the alarms and so on. So it reruns the entire program every time the alarms are triggered. Which, if not written right, would be attempting the feeds every time anyway.
That's why I used it so folks didn't have to create the feeds manually, and it doesn't hurt it to try every time apparently.
Significantly less code when there's a lot of feeds to deal with.
Add some information on how to load circuitpython on the Feather Huzzah32, and how to use the webwork flow.
Stylistically, I don't know if it's correct. Looking for feedback.
one thing that might help is changing send_io_data() so it takes the feed name as a parameter, and calls io.create_and_get_feed() on it. that way there's less repetition where you call send_io_data()
ok, sounds like spamming the calls to create is benign, so guess makes sense in that context
Justin verified this. So yeah.
so seems like just a code readability thing
I may have done this previously in another project where I used this function, because it sounds awfully familiar. But I don't understand how it would work, when the current content of the function is a return.
Sure does. Now that I understand a bit better what it's doing.
could be one liner:
io.send_data(io.create_and_get_feed("battery-voltage")["key"], f"{voltage:.2f}V")
or two liner:
feed = io.create_and_get_feed("battery-voltage")
io.send_data(feed["key"], f"{voltage:.2f}V")
or other
owait, would I return io.send_data(io.create_and_get_feed(feed)["key"], value)
it would probably look something like like
def send_io_data(feed_name, value):
"""
Send data to Adafruit IO.
Provide an Adafruit IO feed name, and the value you wish to send.
"""
feed = io.create_and_get_feed(feed_name)
return io.send_data(feed["key"], value)
and then the call sites would be a bit cleaner, like
send_io_data("error-count", alarm.sleep_memory[2])
Ah yes.
@tame creek Any reason why what I typed out wouldn't work? e.g. is there a specific reason to make it two lines in the function?
i think two lines is more readable, and it's probably well within the optimization capabilities of the byte code compiler to eliminate the temporary variable
def send_io_data(feed_name, value):
return io.send_data(io.create_and_get_feed(feed_name)["key"], value)
one line version
i like the two line version better
Ok rad, thanks.
@tame creek This is such an excellent change. Really goes with my explanation of why there's a function to begin with (repeated code can sometimes be factored into a function). In theory, though there's not really two-way communication about guides, I wouldn't have been able to justify the repeated create_and_get_feed usage. ๐
Thank you so much!
Fixes #6812.
Tested on Feather ESP32-S3 TFT using Web Workflow offline file manager:
- Tested that attempting to move a folder into itself fails
- Tested that attempting to move folder into another folder that doesn't exist fails
- Tested that moving a folder into another folder that does exist still works
- Tested that moving a file into a folder that exists still works
- Tested that renaming a folder still works
- Tested that renaming a file still works
- Tested renaming and movi...
This feels like something that in the todo list for the learn guides but wanted to check....
When in the WebUI
"USB is using the storage. Only allowing reads. See the CircuitPython Essentials: Storage guide for details."
And the link:
https://learn.adafruit.com/circuitpython-essentials/circuitpython-storage
But nothing on that page explains how to handle the webui not having write access to the filesystem. (that I saw)
Maybe that link should be to here instead
https://learn.adafruit.com/getting-started-with-web-workflow-using-the-code-editor#disabling-usb-mass-storage-3125964
This will work for now until I can get around to adding guide links (#1034)
Reminder: Move guide link into metadata that was added in #1045 while adding this.
ah that doesn't mention ejecting (unmounting) the drive though which is a much simpler solution
This seems likely. Please either use the "Feedback? Corrections?" link on the left side of the guide page that needs to be updated, or email support@adafruit.com with all of this information. Both will get it to the right folks.
Will do.. and good idea @jaunty juniper I'll also open a CP bug to change the URL
also your link is wrong, it should be https://learn.adafruit.com/getting-started-with-web-workflow-using-the-code-editor/device-setup#disabling-usb-mass-storage-3125964
don't know why it's missing the sub-category, if you were in single page mode it would also be different https://learn.adafruit.com/getting-started-with-web-workflow-using-the-code-editor?view=all#disabling-usb-mass-storage-3125964
Learn guide section links never work right for me ...
there's something mysterious about them sometimes
This was discussed a bit in cp-dev
A better url to put there would be:
https://learn.adafruit.com/getting-started-with-web-workflow-using-the-code-editor/device-setup#disabling-usb-mass-storage-3125964
And I think both this page and that guide should say that you can eject the drive as well.
I'll do a PR for this page and submit feedback ...
@Neradoc sent a PR review your way.
Thanks, that's a better link, using the new guide.
Note that, from a test build for the FunHouse, this increases builds by 64 bytes. I wonder if we could use a shortened URL redirect (from adafru.it or circuitpython.org) to reduce the binary size.
If there is an Adafruit shortened URL for all Learn Guides, that would be very cool for lots of boards I bet...
I wonder if we could define shortened links on circuitpython.org instead of adafruit.it, so we could create them directly from the Circuitpython repo, like in a .mk file that would be parsed and sent to the cp.org repo with releases
@idle wharf this works: https://learn.adafruit.com/3654/device-setup#disabling-usb-mass-storage-3125964
I don't know if there is an adafru.it equivalent (adding a number to adafruit.it redirects to the product of that number)
I'll amend my PR
<div id="usbwarning" style="display: none;">โน๏ธ USB is using the storage. Only allowing reads. Try ejecting the CircuitPython drive. See <a href="https://learn.adafruit.com/3654/device-setup#disabling-usb-mass-storage-3125964">Getting Started with Web Workflow</a> for details.</div>
Thanks, that's a better link, using the new guide.
Note that, from a test build for the FunHouse, this increases builds by 64 bytes. I wonder if we could use a shortened URL redirect (from adafru.it or circuitpython.org) to reduce the binary size.
EDIT: like is already the case with http://Adafru.It/mpy-update in the "bad MPY format" error.
Also I did suggest a change without commenting on it to call it "CIRCUITPY drive" rather than "Circuitpython drive".
<div id="usbwarning" style="display: none;">โน๏ธ USB is using the storage. Only allowing reads. Try ejecting the CIRCUITPY drive. See <a href="https://learn.adafruit.com/3654/device-setup#disabling-usb-mass-storage-3125964">Getting Started with Web Workflow</a> for details.</div>
it's not like we are doing the 9001 builds ourselves ๐ ๐ซค
True...
Community Help Desk
What's the correct repo to open up a functionality issue with web workflow editor?
There's no way to open up the editor on additional devices on the network. when you click on a device from the other devices popup you then go through the normal chain of popups, which ultimately results in a link back to the circuitpython.local device, not the other device.
I believe it's here: https://github.com/circuitpython/web-editor
ta
Only RUNMODE_UF2 isn't supported on esp32c3, other modes should work fine. I'll PR a fix for this.
https://picockpit.com/raspberry-pi/everything-about-the-raspberry-pi-pico-w/
follow instruction in here to get the led flashing!!!!! With wifi set-up.
I have the same question as @ScottMonaghan , VL53L4CX library in circuitpython would be fun-ominal ! lol.
The Community help desk is over here for anyone interested: https://discord.com/channels/327254708534116352/1017944115939385464
@MicroDev1 Just to be clear, did you test this on a C3? I was going by what I saw in the datasheet but I may well be wrong.
Yes, I did test it. The description for this can also be found in C3's Technical Reference Manual.
...software can force switch the chip from SPI Boot mode to Download Boot mode
by setting register RTC_CNTL_FORCE_DOWNLOAD_BOOT and triggering a CPU reset...
Yes, I did test it. The description for this can be found in C3's Technical Reference Manual.
...software can force switch the chip from SPI Boot mode to Download Boot mode
by setting register RTC_CNTL_FORCE_DOWNLOAD_BOOT and triggering a CPU reset...
Cannot reproduce using adafruit feather s2, ran anecdata's snippet for an hour np. Tested during adafruit's Community Help Desk on Saturday morning 9/10/22
Running @anecdata's demo code on an Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; Adafruit Metro ESP32S2 with ESP32S2 and I can replicate the bug.
On a hard reset, the first attempt to use the wifi works, it can scan nearby networks and connect to one with it's ssid/password. It can then do standard networking, get and post data, etc.
Softresets thereafter fail to find any wifi network on the scan.
To do an extra test I erased the flash, reloaded the binary and tried the...
Tried again on 8.0.0-beta.0-41-g33a100611 on ESP32-S2:
With some slightly different results:

This is with 2 soft reloads, same hardware setup, on ljinux since the results don't differ anyways.
It can see the networks that are not too far or too close..
Actually, on first boot, those networks are considered to have, bad reception..

Something very weird is going on..
That brings up another point about the RSSI data actually being flawed. In my test I have 2 AP's sitting right next to each other which usually provide near identical signal according to my wifi manager app on my tablet and phone... but scanning with that code within esp32-s2 showed an unusual amount of deviation between my AP's to the point it gives me reason to question the accuracy.
@jaunty juniper I have a question. Is there a CircuitPython equivalent to the Arduino while !serial or whatever it is? Which is to say, I would like my example not to run until the serial connection is established, because it involves interactive prompts.
The networks however should still be visible and connectable, regardless of RSSI..
that would be supervisor.runtime.serial_connected
Ooooh. Ok
though there might be a slight race condition on connect, so maybe add a small sleep after that
if you see the first print being missed
Worked on this S2. I'll try it on the ESP32 in a bit here.
there's also usb_cdc.console.connected and usb_cdc.data.connected if you need to look at the data channel, both would only work on USB boards
Oh good to know. In this case it needs to work on ESP32. So.... hopefully it does ๐
Works on ESP32.
@tulip sleet that might be far fetched, but do you think it would be possible to use ota_1 to extend the file system ? It would require both the CP fat code and tinyusb MSC to support some form of address translation because the ota1 and fat partitions are not contiguous, but I believe that tinyuf2 never writes to ota1 (at least CP) so it would make it possible to reclaim the space without changing the partition scheme.
And having an option to erase_filesystem() to switch between modes (with the extended mode making the dualbank module return an informative error).
Most people (if any) don't use dualbank, and that would more than double the space on 4MB boards, without requiring doubling the number of tinyuf2 builds for ESP boards, or making it much harder to enable dualbank for those who want it.
I am sctv [I know, just starting to realise it's a bit confusing]
It's amazing to get circuitpython onto the esp32, currently using a AI Thinker / Wroom32 with the Huzzah firmware.
Hi
Would love an update on the WiFi capabilities of the PicoW with CircuitPython.
Any ballpark on when this will see the light of day?
Thanks!
After a little poking around and trial and error testing I found what seems like a reasonable way to set these parameters without commenting out the logic in circuitpy_mpconfig.h.
If I move the two UART definition lines from ports/broadcom/mpconfigport.h to ports/broadcom/boards/raspberrypi_zero2w/mpconfigboard.h the console uart pins are enable and function properly.
I have no idea if this is the optimal solution, but if it's a least a reasonable short term option, I'll be ...
Oh right, that's an inconsequential issue if it doesn't even work for you, my apologies.
I grabbed the nightly from Adafruit CircuitPython 8.0.0-beta.0-41-g33a100611 on 2022-09-10; Adafruit Metro ESP32S2 with ESP32S2 this morning to check if the bug had been fixed and it hadn't.
I left the code running while I went about my day and came back to
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 7, in <module>
MemoryError: Failed to alloca...
I noticed the LED pin definitions was missing from the Zero 2W board so I added them to this PR as well.
Have you tried manually adding gc.collect in spots?
@midnight ember thanks for your help... it's still not booting when I plug it in, but at least I can mess with some of the configuration to try and fix that now.
ha love the name! ๐ฆฅ
It's a low profile Choc switch keyboard :-). Grumpy Sloth is the overall brand.
FYI nvm.toml is a git submodule
Cheers
it's pulled when you make fetch-submodules
and you can navigate to it from the CP github repo as it's linked
yeah i think that's for adafruit uses only to support new chips, you can submit a pr to have any chips you need supported, just make sure the configuration is right and that usually involves diving into datasheets.
I'm wondering if the board not connecting / booting when I plug in the USB is something to do with these values:
USB_PID = 0x801F```
I ended up just traversing the folder structure and reading the text files, it looks like our SPI Flash module is supported already.
what do you mean by not connecting and not booting ? you seem to be able to access the REPL ?
Yeah.. only the first time I flash the board
nice Ronny, you're doing soooo much better than my first time. you're knocking it out of the park so far.
As soon as I disconnect the USB and plug it back in, I can see the power status LED is on, but it's like my PC can't see the device at all.
Cheers bud
if the flash is correctly configured, it might be an issue with the crystal and timing, I seem to remember something like that
look for PICO_XOSC_STARTUP_DELAY_MULTIPLIER
don't know where that section is for requesting a usb descriptor.
it's not in the board guide?
(like if you git grep PICO_XOSC_STARTUP_DELAY_MULTIPLIER you'll find uses of it)
it shouldn't cause any issue
you do need a unique vid/pid to submit to the CP repo
if the board is open hardware there's https://pid.codes/howto/
if not, you wanna request a PID from Raspberry Pi
.. the default is intended to be the equivalent of the original, implementing DISPLAYIO && TERMINALIO.
This is a possible alternative to #6889, if I understand the intent.
I didn't do any testing, just compile-tested feather rp2040
I just searched my repo using VS Code and found some examples... but it looks like that's done the trick
It's connecting now and the CIRCUITPY drive appears each time. But the KMK firmware doesn't appear to be working. EDIT... nope it's working fine. I'm just being a muppet.
Time for bed I think. Thanks for the help @jaunty juniper
I see simplifications possible in sdkconfig. The same simplifications should be in the QT Py C3 def, which you may have copied from.
Can remove these do-nothing lines.
This should be automatic; I removed similar lines from other boards.
@TimonPeng would this work for you? It's more general.
I changed my mind about this for now. I'll approve, and we can clean up the sdkconfig files for all C3 boards at once, and consistently.
Some of the ESP32-C3 sdkconfig files can be simplified. Do it consistently across all the C3 boards.
This is an interesting idea. I think we could reorder the partitions to make them continguous.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; Raspberry Pi Pico with rp2040
Affects all boards, the chance of it occuring it higher on faster boards.
Code/REPL
Ljinux
Behavior

Description
Sometimes, when polling stdin, the console receives parts of the title-set ansi escape code sequence, circuitpytho...
An easy mitigation for me was to simply create a bufferclear command and add it to the boot scripts, right after the serial connection occurs.
Also, it IS in stdin, it's treated as text in the buffer, and I can move my cursor to it.
You can now disable the status bar: #6847. For example, in boot.py:
import supervisor
supervisor.status_bar.console = False
This means that at some point during the boot proccess, circuitpython decided to send the title-set, but sent it incompletely..
I don't think it is being sent incompletely, but the sending starts before the USB connection is fully up. This should be fixed.
Oof. What did I do to get here? ```OK
soft reboot
raw REPL; CTRL-B to exit
CTRL+B got it back to the regular REPL. So it's not an issue. But I have no idea what sequence of events got me to the raw REPL.
i think that's a feature that Thonny uses to more efficiently upload files etc on ports without USB mass storage access?
yeah that's usually thonny or ampy, there's a ctrl-* shortcut too
https://docs.micropython.org/en/latest/reference/repl.html
ctrl-A enters raw mode (by default)
I quit Thonny, and connected using tio. Hit enter a couple of times to get anything to show up in tio and ended up there.
Because I can't scale the shell in Thonny that I know of, and I needed a guide-readable screenshot of the output of this program
yup thonny left it in that state then
Ah fair enough.
Good to know.
So Thonny pretends to be in the REPL, and is secretly using the raw REPL to do things? I mean the REPL works as expected in the Thonny shell.
it goes into the raw repl to do its stuff, reading files list, getting board information, etc
Hmm ok
I now have a script to identify what's-what on a reed switch. ๐
Multimeter works as well.
But you can do it with CircuitPython if you want!
I don't know in what circumstances it would leave it in that state exactly
i would hope that Thonny would consistently exit raw REPL mode when it exits, but maybe it sometimes doesn't?
Yeah no idea here either.
If it's possible to mess things up, I'm almost always able to do it.
Thanks folks! Good to know there's a likely reason for it.
is there a supported method of bundling your own code.py and libraries into a firmware compile?
I've got to flash a bunch of boards with CP and I was hoping there's a slick way to package all the things into a single uf2 and move that one file over.
Not that I know of, but you can just pack them in and disable usb access unless some pins are bridged
# in boot.py
from storage import disable_usb_drive
disable_usb_drive()
what board is it ?
thank you. I'm not concerned about access after
@jaunty juniper I was afraid you'd ask. it's a custom board with rp2040. -- I'm afraid because the answer is to use picotool but I'm not sure how to prevent it from pulling all 98m of flash
not 98. 8m
the RP2040 can save the full flash with the command:
picotool save --all my_full_board.uf2
you can then use that to flash any new board as an exact copy of the one you saved
(provided they are the same, because that will contain firmware, flash config, etc)
for whatever reason I can't get the range command to work the way I hope. flashing 8M when I only have 2M just takes longer than I'd hoped
well you want the drive to be formatted though
If it is a matter of flashing many boards fast, you can try creating a bash script that flashes many at the same time
usb cables are cheap.
a "detect the presence of a new RPI-RP2 and copy file" script
that's why I was wondering about compile time. Picotool works great by dumping all contents to uf2 and then I have the 1 file. It' just a bit long to wait per board.
my alternative isn't terrible. I can write a script to monitor serial -- flash CP, wait for boot. Copy contents
I have a few hundred to do so I'm trying to cut as many corners as I could ahead of time ๐
Best of luck.
thanks for the quick responses to you both
I'm getting mixed answers on how to split up an f-string. It's in a print statement. I can't find a single common answer. I hit enter halfway through the line in PyCharm, and it did a thing, but Thonny is complaining about a syntax error when actually running it.
Here's what I have right now: ```py
print(f"Terminal pin assignments:\nTerminal 1 = {TERMINAL_ONE}\n"
f"Terminal 2 = {TERMINAL_TWO}\nTerminal 3 = {TERMINAL_THREE}\n")
i think this is one of those places where MicroPython/CircuitPython is missing functionality
e.g. separating the second line into its own print()
Interesting. And annoying at the moment. ๐
it might result in two I/O operations where a single print() call would result in one, in case that matters
just add +
between the strings
Ok trying that.
2 prints will also do the same but with one more "\n"
what if you ctrl-D in Thonny before you quit ?
(so it's in "running code.py" mode)
Not sure, working on a guide at the moment, so I don't really have time to troubleshoot it.
CircuitPython version
Initially:
Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; ESP32-S3-Box-2.5 with ESP32S3
Board ID:espressif_esp32s3_box
UID:C7FD1A1E7C45
After lots of 'internal watchdog timer expired' errors I downgraded CPY to:
Adafruit CircuitPython 7.3.3 on 2022-08-29; ESP32-S3-Box-2.5 with ESP32S3
Board ID:espressif_esp32s3_box
Code/REPL
# SPDX-FileCopyrightText: Copyright (c) 2022 Tim Cocks for Adafruit Industries
#
# SPDX-License-Id...
Fix for CircuitPython v8.0.0-beta.2: display_shapes.polygon color fill is rendering very slowly
#6734 removed support for auto brightness left a call in displayio_display_background to set the brightness to a 1.0f fixed value. In the previous code another function call checked that auto-brightness was set to True and skipped any work if it was not true and limited to how often the brightness was set.
With t...
I was just reading through all of that code today and eyeing with suspicion that unconditional call in displayio_display_background, which seems to run every time the displayio background task runs, which might be more often than the refresh rate. I was wondering if the PWM update blocks for until the end of the current PWM cycleโฆ
I wonder if this is also going to fix #6838.
I would like to see about putting this check inside fs_rename() so it can apply in more cases (and moving the existing check out of fat_vfs_rename()).
Can we update to esp-idf-v5.0 now or post CP-8?
I tried updating to master a couple of months ago, just to test some I2C fixes. There was a lot to do: many changes to make. We will do it post 8.0.0.
Iโm beginning to suspect that since disabling auto refresh restores the ability to control brightness, the SAMD51 TCC timer used for the display backlight PWM is shared with the display auto refresh timing somehow.
@dhalbert ref comment regarding shared TCC timer in https://github.com/adafruit/circuitpython/pull/6894#issuecomment-1243289895
Most of the pins are connected to LEDs and we do not want them to turn on by default.
To check #6838, I tested with a Feather ESP32-S3 TFT with this fix. Now the display is dark until the brightness is set explicitly, but the brightness can now be controlled. I don't think this is a timer issue; the code that @gamblor21 removed forced the brightness to 1.0 on every refresh. But now there's a new bug that the brightness is not set correctly on initial startup.
Fixed by #6894, but now the brightness must be set manually at the beginning, or the display is dark. Opening a new issue for that.
After #6894, on-board displays are dark on initial boot on various boards, including FunHouse and Feather ESP32-S3. Not a problem on PyPortal.
Set brightness is being called from the constructor and it does seem that (on my device) the brightness cannot be changed so the bug may be in set brightness.
@tulip sleet I have a strong suspicion where that brightness bug is but dealing with some stuff at work so cannot look at it. Not sure how priority it is but can probably take a look later today if needed.
I neglected to say that in the REPL, it's possible to set board.DISPLAY.brightness, and it will work. It just comes up dark.
I was starting to look at it. If it's in the constructor I will look there.
you can give me a hint ๐
The constructor seemed seems to call set-brightness (so it should set it properly) so I'm guessing the bug is in set brightness itself. Also in my stand alone test (just used my own screen) I could not set the brightness (but it defaulted on full)
i will take a look; ttyl!
Iโm beginning to suspect that since disabling auto refresh restores the ability to control brightness, the SAMD51 TCC timer used for the display backlight PWM is shared with the display auto refresh timing somehow.
I think this is not the case, given observations by @gamblor21 in adafruit/Adafruit_CircuitPython_Display_Shapes#57 that creating an independent PWM object does not cause the same delays. I think it's more likely that unconditionally updating the PWM object on each displayio...
deleted this out of circuitpython-help as this is more of a dev question: I'm looking to source chips for a design I'm likely going to use a CircuitPython capable MCU to power. While searching, I discovered something called SMBus? Does anyone know if SMBus based devices are suitable for use with circuitpython devices? Or should I stick to SPI/i2c chips?
SMBus is kind of a subset of I2C, but with stricter timing and voltage specifications (among other things). a chip that supports SMBus but not I2C might have trouble talking to a number of I2C sensors otherwise supported by CircuitPython
There are issues with SMBus and repeated start: https://github.com/adafruit/circuitpython/issues/6044
are you talking about SMBus-capable microcontrollers or sensors?
@tulip sleet I was looking at capacitive touch sensors
like, the actual chips on digikey.
can you give an example?
facepalm๐คฆ๐พโโ๏ธ
no, no I can't because everything on digikey that is normally stocking is currently either i2c, i2c/smbus, or spi....I saw a few "SMBUS" items and freaked and it's literally not even an option for my needs.
I do have another question about captouch sensors, I know there was a chip shortage special or some kind of youtube video of ladyada searching digikey related to the mpr121 going away and her searching for such chips. Is there a recommended replacement for mpr121 designs in the adafruit catalog? It looked like there was going to be a replacement design coming out, and then I saw an updated mpr121 design with "stemma" ports, and idk what to think of the current state of captouch chips in the adafruit ecosystem, but I'd very much so like to align my design with future adafruit products because I love circuitpython. Is there something coming or did something come out?
@tulip sleet @hidden rain this may be fixed in an upcoming virtualenv release
I would like to see about putting this check inside
fs_rename()so it can apply in more cases (and moving the existing check out offat_vfs_rename()).
Did you mean f_rename()? If so, is it used in other places too? Your suggestion also makes sense to reduce duplicate code.
I believe the problem is that board_init(), which sets up the display and the PWM, is called before reset_port() in main() (in main.c). So pwmout_reset() gets called after the initial brightness setting and gets messed up. Before #6894, brightness was set again, and the PWMOut was restored, but that isn't happening anymore. I will try some reordering.
@midnight ember The host goes first, than alphabetical
So you're in the right spot. ๐
same for status updates, under you?
Correct
And if you want to read off your updates, a mod will need to add you to the CircuitPythonistas role. You also have the option of lurking and the host will read it off
Same board is available from Estar Dyn shop https://www.aliexpress.com/item/1005004316882797.html but with different VID/PID 2E8A/0003 and in 4mb (W25Q32JVxQ)
yes please, pretty sure i'll be present for this one. requesting CircuitPythonistas role.
<@&356864093652516868>: In just over 90 minutes from now at 2pm EDT / 11am PDT is the weekly meeting! Please update the weekly doc with your status updates and hug reports. I look forward to seeing you there. https://docs.google.com/document/d/1r6zSavb6KeDuuclsBSNZVMwQ7CxCNq1dZr7ML8r6oCA/edit
I mentioned it to Kattni too, someone will get you setup
Done and welcome!
I think it's too late for this week: but here's the fix for the weird formatting that happens in the copy/paste for the weekly meeting "State of": https://github.com/adafruit/adabot/pull/300
Def too late today. Merged.
Thanks!
because it's come up before and might again: i'm not sure of the best place to record this information for future use, but to help with attributions, username tlyu on GitHub is me
Thanks for the heads up! I'm sure if we don't remember immediately, it will eventually percolate through and we'll know. ๐
Email's taking 100 years to load. Guess it's a good thing I don't really need it right now. ๐
I might be a few minutes late...
We'll cover you if needed.
PyCon UK will be returning to Cardiff City Hall from Friday 16th to Sunday 18th September 2022. More details coming soon!
I got a steam engine!
Here it is powering a dynamo connected to an LED light.
thanks for the is note! I won't repeat myself to you unnecessarily
Reed switches. ๐
@midnight ember ๐ Caveat: this guide is a WiFi Mailbox Notifier project. The LoRa version is destined for an upcoming guide.
Thank you, @lone axle ! ๐
yes, then i'll wait for the destined version ๐
I'm sorry, I need to step out (family emergency)
The LoRa guide is waiting on some it's-not-out-yet-don't-ask new hardware. ๐
For sure! Thanks for tracking it down and the fix 
That's how you create boards!
Ok, back. it's all good.
๐ for the titano fix!
Thanks. It became that problem that was gnawing away in my brain so I had to look at it more last night.
@minor plume You can copy from command line and avoid those files with a specific tag in the command, so I imagine circup could use that somehow? I have no idea how circup works though.
Yeah, Iโm not sure either. Running a discotool cleanup automatically would work, I think, but Iโd kind of like a cleaner solution.
circup uses python's shutil copytree
Sounds good, I can keep up with it then
PaintYourDragon's ears are turning red and his mouth starts frothing anytime someone says Halloween.
Another item to keep in mind for reviewers is if an issue is not labeled for Hacktoberfest we need to tag it so the submitter gets credit
Iโll have to look if you can give exclude patterns to copytree. It seems to me you can do it, but I donโt remember for sure.
Feel free to let me know if you want to divvy things up or delegate @idle owl
If that applies
I've only participated twice in a community event, circuit python day and community help desk, had a great time both times so I'm all for more.
the thing is extended attributes are not actual files, they can't be excluded with a pattern
but also I don't get extended attributes when I use circup, fancy opening an issue to talk about it ?
I'm happy to help out as well. Definitely also like the idea of coordinating an october help desk to coincide with it so we can offer help to folks interested in contributing during hacktoberfest.
I'll jump back in and do more reviews again, I've been trying to get my office setup for it and am just about back online
Thanks
Kinda but not really. The first thing you can do though is to find out if Adabot adds Hacktoberfest labels to the libs that fall under the Blinka umbrella if they have the Good First Issue label, and if they do not, get them included. ๐
Sure. I can do that. I was definitely getting the extended attribute files when I ran it this weekend.
๐
Thanks!
great job @random junco !
Great job @random junco
thanks all
Thanks! Great Job @random junco!
Thanks everyone. Great job hosting and thanks again for joining the lineup Paul!
Iโm planning to help out with Hacktoberfest PR reviews too. Been trying to get all my devices and sensors and stuff in one place so can manage them easier.
@random junco thanks for hosting today!
That's great, Tammy! For the most part, I don't think coordination is needed for that part, it's more of a dive in and help situation. And since Adabot handles the labeling, there's really not much to do but sit back and wait for PRs. ๐
Yeah. Itโs been hard for me to test stuff because all my hardware has been scattered around my house. I swear that those boards have feet or something! ๐ But I think Iโve almost got everything in the same place now.
That I understand entirely. ๐
I even found a PyBagde in my guest bathroom cupboard yesterday! ๐คทโโ๏ธ
yeah that's weird, we could have circup delete the attributes from the downloaded files in advance just in case. When I run xattr -r ~/Library/"Application Support"/circup I don't get any attributes on the bundle files
๐ Ok, that's special.
Huh. Weird. I donโt know if itโs actually a discotool issue, a circup issue, a macOS beta issue, or something else yet.
it might be a security change that adds the quarantine flag to files downloaded via python or something, can you run xattr and see what attributes there are ?
Did you mean
f_rename()?
Yes, sorry, fixed.
Huh. The version of xattr on my system (0.9.9) doesnโt seem to support the -r flag. Let me see what I can do.
@jaunty juniper So it looks like the bundle zip files downloaded by circup on Saturday (and the extracted files from them) all have the โcom.apple.provenanceโ extended attribute. I wonder if the right solution is to make circup remove that attribute from the zip files before extracting them on a Mac.
yeah that should not be difficult
Iโll look at the code for circup and see about adding that. Should be an easy fix.
I feel like the last version of macOS used a different attribute for quarantined files. Maybe it should just clear all extended attributes from the downloaded zip files before doing anything with them.
yeah it seems to be part of new Ventura security features
Fun fun. Fortunately, I just looked at the code for circup, and it seems to be an easy enough fix.
Didnโt even notice till just now. I have a purple tag. ๐
@turbid radish The newsletter is updated for the weekly meeting: https://github.com/adafruit/circuitpython-weekly-newsletter/pull/375
if anything is wrong in the PR, please let me know
