#circuitpython-dev
1 messages Β· Page 62 of 1
ah wicked thanks @slender iron
Not that I object to learning a new tool. Hopefully a new or updated guide will follow soon.
Ohh that's good to know. good info @willow totem
The Wokwi simulator is excellent for helping people with issues in #help-with-circuitpython
Yep wokwi supports ESP32's, Pico+PicoW, arduinos, stm32. They have components (led/LCD/etc) and screenshot taking with lcd peripheral.
My test was for heap size (actually done by gregorik from espressif but needed fixing up)
I'd just make a new board def. That will be clearest for folks. The boards are well labeled with the version.
Yes, that is true the underside of my board is labeled as "v1.1" and this is a genuine board I received directly from Espressif.
I am now of the opinion that there is some value in creating a new v1.1 board as there will surely be a v1.2 or v2.0 in the future, and being able to use board.NEOPIXEL code unchanged on both versions is also of value to users. Also, there is some v...
ship it!
π
Yay, live release on stream
Sold to 9.0!
I just hope cardputer keyboard will be in a 9.0.x or 9.x
Releases closer to October get the Hacktoberfest sprint bug hunt treatment. Something to consider for a major release in the fall.
we can do 9.1 pre-releases after 9.0.0 is branched too
it will be in 9.0.x something, I assume
thanks all!
thanks for hosting @onyx hinge !
Thanks for hosting Jeff! Have a great week everyone!
Thanks!
Thanks everyone
@midnight ember the pi's with vscode-insiders pointed at them using remote explorer / remote SSH extension
The batch script at the end of this issue is a workaround/fix for "Github Desktop changes paths every version update". It works very well and can recommend.
Instead of pointing the path to the new Github Desktop .exe manually every version change just point it at the .bat and it will keep track of it every version change.
@tulip sleet Synergy was the virtual KVM I was thinking about. There's no mention of it being owned by Google at any time. I'm sure at one time there was a google branded fork of Synergy. https://en.wikipedia.org/wiki/Synergy_(software) It does still exist.
fwiw the original synergy went under some other sort of closed source license. an open source fork of synergy is https://github.com/debauchee/barrier but I've never actually used it.
Here is the notes document for next Mondayβs CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and weβll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/11hSXWvZY9pqH1RNT7wBU3gzwwDjjEJVO2yg_-E999D4/edit?usp=sharing
Thanks for hosting @onyx hinge!
@lone axle I'm playing with ruff, and found one thing: https://docs.astral.sh/ruff/faq/#how-does-ruffs-linter-compare-to-pylint
Many of the rules we are disabling, ruff doesn't care about in the first place. Would we want to remove all the # pylint: disable=xxxx?
That's a good point. There are a lot of pylint comments embedded everywhere, in everything.
Nice, that is good to see that it's defaults are somewhat in line with our usage at least. I would be in favor of removing the pylint disable lines anywhere possible.
(which is perhaps everywhere)
And as an FYI - added it to requests and only got one file changed
Also - it looks to match isort.
Are the spaces between imports really necessary? From my point of view I'll only ever import things that exist on the microcontroller. So I don't understand the need for sorting by 3 different types 2 of which mean nothing to me. Maybe it's more useful for Blinka users that have a Linux environment? If that's the case then I'm ok with the change otherwise I preferred the condensed chunk of imports. It helped make scripts smaller.
Can I get the pythonistas role please, feel bad making others read my bits by always being text only
Done, you're now in circuitpythonistas too.
Much obliged
Build with DEBUG=1 on the command line and you should get IDF logging out. It can give you more detail.
I was wondering about debug builds.. I've done that but then I can't figure out how to see the debug output.. the serial console just puts out the normal stuff
On some boards there is a pin labeled DBG on the silkscreen that you need to hook up a USB to serial converter in order to read the output from it. (or using something else that can read from a serial line)
Hey @willow totem do you have tips on how you're using custom CircuitPython firmware on WokWi? I love using it for quick testing and teaching, but the CirPy UF2 images I've seen on Wokwi are pretty old
whether ruff or isort is added, the spaces will be there. It's to show separation of where the import is from. Once your line-ending issues are resolved, it won't be a big deal
@lone axle and @onyx hinge did a quick ruff example. Took from micropython, our rules and some line-ending things:
https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/171
Most of the changes are because I also removed all the pylint comments. Since requests already has isort it didn't change any of those
Would main be different from 9.0.0rc.1 right now? My assumption would have been that they were pretty much the same but I'm noticing some different behavior from a build of main vs. a downloaded rc.1 around USB Host stuff with the Feather USB Host device.
@lone axle compared to 9.0.0-rc.1 there are two emrged PRS: #9020 and #9055
you can check this online: https://github.com/adafruit/circuitpython/compare/9.0.0-rc.1...main
Thank you. I think something must be wrong with my local environment
my builds of main are succeeding but USB Host doesn't seem to work at all with them. When I download builds from S3 (downloaded abosolute newest as of a few min ago) it does work albeit with the unplug / replug. Somehow my local builds aren't complete or something
check if your submodules are up to date?
I had forgotten that at first but have updated them now
that's the only guess I have at the tip of my tongue
So this guy from espressif setup some heap size sketches in arduino micropython circuitpython +1 i forget. I just modded it, but the basic principle is it loves elf and bin files. I think a uf2 is out of the question except maybe for pico/w. This is wokwi-ci btw https://docs.wokwi.com/wokwi-ci/getting-started
But also vscode does similar, and I believe you can do the same online, but you need to click into the interface then press F1 (what a choice of key - if loads you forgot to click inside code not diagram), then a command pallete loads like vscode, and you search for upload
Here's the thread @devout jolt that mentions the original repo, and urish's changes to instead add workflow assets (I set reports to be uploads as release assets), and notification when the C3 is fixed https://github.com/wokwi/wokwi-features/issues/754
This bit is the bit of code you care about, it makes a disk image etc then merges all together after building https://github.com/tyeth/esp32-lang-lab/blob/main/tests/python/circuitpython/test-circuitpython.sh#L49-L139
I tried adding this at the end of this file: https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h
#define CIRCUITPY_DEBUG_TINYUSB 1
I was able successfully make a build but as far as I can tell enabling the debugging did not work. When the device connects to the PC there is only 1 serial port and it's the standard serial output / REPL. If I enable the USB Console line with boot.py then it typically appear...
awesome thanks. I've only ever use it via the website and mucking about with "diagram.json" to specify different firmwares
yeah similar, but had a play with CI a few times, and vscode a load for attempting to do cpy/mpy things, c++ works fine, build times online are too long, but I've got access to long builds. I really want CI to work for me, but there will eventually be a cost so still scoping what works best.
I secretly hope some philanthropicly minded org goes and buys out the project / Urish for a few years, only so it's fully open sourced and equally worth his time. 70% is in github anyway
ahha totally. how did you even learn about the wokwi command palette? I've never come across it
pure luck, maybe the man told me when I asked how to do something, or maybe I spotted it on the wokwi discord or some random docs (he had vscode instructions in a google doc for a few months), but it was like a gotcha moment and remember feeling like they thought it was intuitive (but F1 π€¦ )
Useful server to be honest, great for silly / crazy questions, example projects, bugs although get some helpers fending off initial bug reports sometimes, but Urish is fantastic and loves the simulator to match reality (where poss)
@midnight ember I would be curious if you checked out this branch: https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/171 and then ran pre-commit, if you would have any errors...
ruff doesn't seems to care about strings using " instead of ' like black does. Is that something we care about? I would assume without this check we will eventually diverge from the consistency of using " unless necessary that black has built for us. Personally I don't really mind either way, but I do know that in my own code I kind of switch it around somewhat randomly based on how I'm feeling in the moment so without some tool assistance I don't use them consistently.
oh, actually I did not read enough of the documentation before running I've just now noticed that running as a linter is different from running as a formatter
okay, yeah nevermind it does make them consistent when you run the formatter. Interesting that the commands are seperated. I assume that ultimately we'd integrate this with pre-commit though so it ends up still being a single command to run?
I did, my setup has both enabled
can you share your pre-commit config?
I have a setup similar to what it might look like that mostly copies the CircuitPython pre-commit config (pylint, but also pydocstyle, isort, and pyupgrade).
does it use https://github.com/astral-sh/ruff-pre-commit?
Scroll up 3 messages. I have a whole PR
ahh, thank you
I guess they renamed their github account
https://github.com/charliermarsh/ruff-pre-commit automatically redirects to https://github.com/astral-sh/ruff-pre-commit
The important changes are in:
.gitattributes
.pre-commit-config.yaml
pyproject.toml
Should totally be able to update cookiecutter with these
Also fixes some info in related boards.
It will make the same changes as isort (and maybe a few others)
Do you have the 1MB version? I just received the 65MB Daisy Seed. It's much smaller than I expected, KB2040 size. I'll look into spinning up a new dedicated linux pc this week, have a feeling cmake builds are in my near future.
Yay! π Congrats and a big thanks
tinyusb was recently updated
Automated website update for release 9.0.0 by Blinka.
I think got updated with a fetch-all-submodules. I'll try a fresh clone later on.
git status will tell you
β― git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
that looks good to me
I can't find any information about this. Just about using JTAG. Nothing jumps out at me as a "dbg" pin on the pinout of a bare esp32..
hrm.. yeah, i built this DEBUG=1 but i get no more info from UART0 than before, just the normal code.py output.
on c3?
no, ESP-WROOM-32..
Sorry, I've changed gears from that i2c pulldown thing until I get another one to ensure it's not just hardware ghosts.. this is that Sunton cheap yellow display that I'm trying to get going π
DEBUG=1 should turn on the CONSOLE uart from the IDF
is there a log level or something else I have to change? because it shows nothing besides normal code.py output on UART0
make sure you clean and rebuild
that's probably it..
idf settings changes (which DEBUG=1 does) aren't smart enough to trigger an IDF rebuild
too little flash to make a debug build, apparently π the fun never stops.
is there a list somewhere of mpconfigboard.mk parameters like that? I feel like I always have to hunt for things like that
and as i ask, i find the Documentation pdf
generally it's CIRCUITPY_<modulename>. py/circuitpy_.mk has a full list
Assigning to dan to coordinate with 9.0 release.
doesn't seem like disabling ulab or any other module changes the size of the final image.
ugh.. i wasn't making clean again.. disregard..
https://github.com/jepler/wwvbpy/pull/72/files @lone axle here's one of my experiences switching to ruff
Is there a easy way to increase the debug log verbosity?
You could add your own printfs if you know where in the code you are looking at
CircuitPython version
Adafruit CircuitPython 9.0.0-rc.1 on 2024-03-14; Waveshare RP2040-Zero with rp2040
Code/REPL
import board
import time
import neopixel
import usb_hid
import supervisor
from digitalio import DigitalInOut, Direction, Pull
from adafruit_debouncer import Debouncer
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
keyboard = Keyboard(usb_hid.devices)
pixels = neopixel.NeoPixel(board.GP16,...
blog post is at 9pm ET on 3/18. 3*3 = 9, 18/2 = 9.
π 9.0.0 loaded on several boards -- "no anomalies to report"
thank you for testing!
keyboard = Keyboard(usb_hid.devices)
will raise an exception if you are not connected to USB. So catch that. Maybe wrap your entire program in a try-catch, which is perhaps most easily done by turning the program into a def main() and then wrapping a call to that.
Yes, I tried, but I don't understand what to wrap. I wrapped the constructor (of the Keyboard class) and the import. I also wrapped everything after the keyboard was created. No response at all. Also, I have the LED flashing red when an exception occurs, but it is flashing yellow as if it is just loading. Maybe I'm not using Try correctly?
something like this doesn't work:
try:
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
keyboard = Keyboard(usb_hid.devices)
except:
pixels[0] = (255,255,0)
I didn't just mention that the code stops running. Before the keyboard is created, the code is executed, after it is not. And the exception is not caught.
The IDF's menuconfig has one more level I think
you can do make BOARD= DEBUG= menuconfig
This feels connected to #8409, the mount point "link" in the root folder does not show up in an os.listdir("./') from the root folder. Also, if from the root folder you enter os.listdir('./Beryllium/mnt') the SD card contents are not displayed, same for os.chdir('/Beryllium') followed by os.listdir('mnt').
CIRCUITPY_WIFI_SSID = "Myssid-ABCDEF"
CIRCUITPY_WIFI_PASSWORD = "pass with spaces"
CIRCUITPY_WEB_API_PASSWORD = "qwerqwer"
CIRCUITPY_WEB_API_PORT = 80
Ok I'll try the 9.0
I found the problem. Once I run . esp-idf/export.sh in a terminal session the make html fails. I need to start another terminal sessione and then it works
Renamed module keypaddemux in keypad_demux.
Usage example:
import board
import keypad
import keypad_demux
km = keypad_demux.DemuxKeyMatrix(
row_addr_pins = (board.KB_A_0, board.KB_A_1, board.KB_A_2),
column_pins = (board.KB_COL_0, board.KB_COL_1, board.KB_COL_2, board.KB_COL_3, board.KB_COL_4, board.KB_COL_5, board.KB_COL_6)
)
event = keypad.Event()
while True:
if km.events.get_into(event):
print(event)
We use the RP2040 for developing ham radio kits, we currently use another boards firmware to be able to access GP29 which is default locked to voltage detection on the basic pico.
https://shop.rf.guru/products/2023-p-521 is one of the first products, many in the pipeline.
Am I missing something with the synthio documentation? It has the following:
- attack_time: float - The time in seconds it takes to ramp from 0 volume to attack_volume
- decay_time: float - The time in seconds it takes to ramp from attack_volume to sustain_volume
- release_time: float - The time in seconds it takes to ramp from sustain_volume to release_volume.
I am guessing that attack_volume and sustain_volume should be attack_level to sustain_level. There is no release_volume.
Note https://pid.codes, if your product is open source.
Yes, export.sh activates a Python venv, so you have to reinstall from requirements-doc.txt in that venv
This has all the changes I wanted - thanks!
This takes about 1400 bytes on an RP2040. It's only turned off by default on atmel-samd boards. @tannewt Do you think we should turn this off elsewhere by default?
This is the only PR that was added post 8.2.10. There may never be an 8.2.11, since 9.0.0 final is now released. Noting this for posterity.
fwiw I have another keyboard in my collection that would use this. I'd like for it to be available on some feather, such as rp2040 or esp32-s3...
A small addition to the supervisor to allow applications to manually run background ticks.
After developing a few more jcurses programs that spam serial and gpio requests I noted that usb takes up to 10 seconds to appear, due to how few background ticks were run.
With this addition, it's possible to now run background ticks without relying on sleep.
I'm sorry, I led you astray.
It's possible to create Keyboard() before USB is connected. The adafruit_hid library will then wait for USB to connected before proceeding. By default it waits forever. I forgot the timeout was indefinite. See https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/01610da60bcf4ac23304b6ee410b46b8bbb35cd7/adafruit_hid/keyboard.py#L41 for the documentation. (There is some stuff missing in the online ReadTheDocs documentation: I will fix that.)
You can...
OK, glad to hear of other use cases. I'll ask @tannewt about whether to put this in 9.0.1 or leave it on main.
@slender iron opinion about whether to add keypad_demux to 9.0.x or just leave it on main and publish a 9.1 beta shortly? I have a small number of other things for a beta that are not necessarily consequential (e.g. renaming nrf -> nordic)
I guess cardputer keyboard support on a stable release would be nice
9.0.0 @ 9:00 pm local time, feeling like an extra lucky release this time!
That was deliberate - I finished the post at 8:40 and decided to set it to publish at 9 π
I guess we can release CircuitPython 13 at 1PM
So CP 10.0.0 on October 10 at 10 am ?
only if it works out π
@lone axle et al: re library docs. Is it written down somewhere that we should document the constructor (__init__()) in the class docstring? I noticed some missing documentation in adafruit_hid, and it was because the info was in the __init__() docstring. Apparently the convention is not python-wide. There is a setting autoclass_content = 'both' in the sphinx config file, but we don't set that by default. https://blog.sandipb.net/2016/10/10/documenting-both-class-and-constructor-in-sphinx/
i wonder if there are other libraries with this issue. I worked on adafruit_hid years ago when this was all really early.
hmm, never mind, I think adafruit_hids conf.py is out of date
most libraries have autoclass_content = 'both'
I don't believe it is written anywhere. The two places that I know of that it might make sense would be the RTD page of "Sharing a Library" guide: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs, but currently this is focused on the actual RTD service integration, not the docstrings that the docs are built from. or maybe to a lesser extent this one about typing information: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/typing-information which does include a section about type hints in __init__ but not specifically anything about it's interoperation with sphinx docs.
thanks!
We can try to add a check for that with the ruff addition automation. I wonder how many others are inconsistent with the majority, it'll be nice to get them on the "same page"
We can require those via pre-commit with either pydocstyle or ruff...
someday we also need to modernize what we do in the learn github repo for python scripts, right now there's pylint (old version) + no black
(and not via pre-commit either)
I'd just do 9.1 and do a pre-release
and leave 9.0.x for fixes only
It may be a good time to do the 1.22 MP merge and make upstream PRs
I don't have anymore sweeping changes to make so I wouldn't be a good person to test the new ruff stuff.
You could checkout the branch and then re-update one of the newest and see what happens
You should get no lf errors
FoamyGuy brought up a question about the built-in binascii vs adafruit_binascii. Is binascii built-in for the majority of the boards or should I only use adafruit_binascii?
@midnight ember for web-based stuff? All those boards are going to have builtin binascii, or at least I'd be rather surprised otherwise
makes sense
someone needs to make "caniuse.com" but for micropython & circuitpython π
alternate useful idea: a way to query "has wifi but not binascii"
is that the programming equivalent to LMGTFY? π
That sounds more like something to run actions on to really know for sure. I wouldn't even know where to begin to look that up.
The list would probably be a mile long now. It would be a shorter list to know what board it's not included in.
Rather than add a new routine, we could have time.sleep(0) run background tasks. There is sort of a precedent for this in CPython:
https://docs.python.org/3/library/time.html#time.sleep :
On Windows, if secs is zero, the thread relinquishes the remainder of its time slice to any other thread that is ready to run.
This could be done in common_hal_time_delay_ms() or even in shared-bindings/time.
Also there seem to be unnecessarily multiple implementations of `common_hal_time_del...
The support matrix makes finding it out fairly easy it turns out: https://docs.circuitpython.org/en/latest/shared-bindings/support_matrix.html?filter=binascii (I didn't know it had filtering, this is really convenient actually, I should use it way more often.)
It would be a shorter list to know what board it's not included in.
Got me thinking and it turns out this filter supports negation too! so you can search -binascii to find boards that do not support π€―
@lone axle who can update https://learn.adafruit.com/welcome-to-circuitpython/pycharm-and-circuitpython? With 9.0.0 released we can add information about the board stubs
It is a website that shows support for a huge number of web browser features, by browser & version. https://caniuse.com/?search=canvas
I am not certain of the entire list of who. I do have access to edit the page though so I could add a section for that.
ooh and you can have a positive and negative filter both. "-binascii ssl" gives 0 matches. https://docs.circuitpython.org/en/latest/shared-bindings/support_matrix.html?filter=-binascii&filter=keypad is an example where there are matches: keypad but no binascii
Nice!
but of course there could be some Airlift-having device with no binascii
I highly doubt anyone with a circuit playground express is going to want to run base64 encoding. thank you. that'll do. going forward with using the built in.
hmm that could be a problem, i don't want to disclude airlifts.
The irony is I could have googled that. π
I did also literally give you the website's name, you could have looked at it too π
ask Dan, I'm bad at looking at things unless someone shoves it in my face a couple times.
too many projects, too easy to get sidetracked with rabbitholes
the examples are already using the built-in wifi for wifi.radio which excludes airlift AFAIK. TBH I would be pretty surprised if any of the SAMD21s would be able to use airlift and make requests successfully anyway. If binascii is on M4s I'd just roll with that since I think it's overwhelmingly likely airlift based project will be using something "bigger" than SAMD21 anyhow.
I didn't realize until now that circuitpython does not have base64 module like CPYthon does. Is that excluded intentionally to save space or would there be some interest in having it added as core module? It might be nice to make code a bit more portable between circuitpython and cpython.
think i'm just going to delete the twitter example. it's broken, their new api is broken, it's not worth the hassle. the documentation is horrible. i got Mastodon up and running in about 15 minutes. i shouldn't have to spend more than 24 hours of research trying to figure out which twitter api documentation is current and what works. i'd rather go back to playing with the crypto chip.
does anyone have any objections to deleting the broken adafruit_circuitpython_requests Twitter API example?
removing it sounds fine to me.
even if someone needs binascii that doesn't have it on their board (including airlifts) they can just import adafruit_binascii and change the code a little to use that.
i just want to avoid support problems if the change will cause some.
that is what lead me to finding the community library circuitpython_base64 to begin with.
sure
I do not want to expose this. It is an implementation detail that shouldn't be exposed. time.sleep(0) doesn't make any sense either. Theoretically the background tasks run every VM loop anyway.
Please file an issue that explains the issue (or link to one if you already have). If this is on ESP, we may need to tweak the tinyusb task to run more often instead.
@dhalbert thank you so much for explaining!
It explains the whole situation perfectly!
Good morning all. I was wondering if there was any ballpark estimate or rule of thumb on when the next merge from upstream MicroPython might occur?
I was just thinking about it. Are you interested in MP 1.22?
I need to check the exact MP version but an update to the deque implementation was recently merged into MP (two nights ago) and it would be very helpful for a project I am working on. Not a show stopper by any means, I have been building my own version of CP with the proposed changes, but if it could be integrated into CP that would be helpful.
Ah, it'll be in the next MP release then
OK, then no hurry! π
They try to release every two months but I'm not sure when they will
You can make a PR to CP with the changes that MP accepted
Oh, OK. I will do that, thanks tannewt!
np
OSN_CREDENTIALS_B = binascii.b2a_base64(b"" + str(OSN_CREDENTIALS) + "") # this works but appends \n
OSN_CREDENTIALS_B = binascii.b2a_base64(b"" + str(OSN_CREDENTIALS) + "", newline=False) # this doesn't
``` fails with `TypeError: function doesn't take keyword arguments`
we must not fully implement it
you can just do .strip() to remove the newline
foamyguy got it to work in a pr we're having the discussion in https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/167 ```py
import binascii
dir(binascii)
['class', 'name', 'dict', 'a2b_base64', 'b2a_base64', 'crc32', 'hexlify', 'unhexlify']
binascii.b2a_base64(b"hello")
b'aGVsbG8=\n'
binascii.b2a_base64(b"hello", newline=False)
b'aGVsbG8='
>>> import binascii
>>> binascii.b2a_base64(b'hello').strip()
b'aGVsbG8='
i was using slices BASE64_STRING[2:-3] which works about the same. just that foamyguy said there might be a way with the argument to not have it append the \n at all from the start.
i think it comes from MicroPython, and the often leave off stuff like that when there's a workaround, to save space
that worked, thank you. think i'll use that.
But I should mention that:
AttributeError: 'Runtime' object has no attribute 'usb_available'
Probably you meant:
if supervisor.runtime.usb_connected:
pass
I was very close to this option, using it as an indication, but your explanation cleared things up. But it seemed to me that this option was not very stable and that you had to adjust the delay time. Perhaps the problem is with my cable.
Sorry for the typo. .usb_connected is what is used internally when you specify a timeout: https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/01610da60bcf4ac23304b6ee410b46b8bbb35cd7/adafruit_hid/__init__.py.
The delay time depends on how fast USB enumeration happens with the host. So you need to allow the maximum possible time. We can't determine whether the host is slow or not there (well, maybe we could test whether enumeration is in progress, but that would be more complicate...
Here is a build for the rp2040 usb host feather. The debug statements are transmitted out the TX pin.
Here is my debug output that shows the same issue. I've marked where I unplugged and replugged the device.
Serial console setup
USBH init on controller 1
sizeof(usbh_device_t) = 184
sizeof(hcd_event_t) = 12
sizeof(_ctrl_xfer) = 24
sizeof(tuh_xfer_t) = 24
sizeof(tu_fifo_t) = 20
si...
In the ongoing saga of this Parallel wired ST7789 ESP32 all in one board.. I've removed the display definitions in board.c, pins,c, etc, and made a circuitpy image with CIRCUITPY_PARALLELDISPLAYBUS enabled to let me try to get the display working from within code.py rather than recompiling the image after modifying board.c over and over.. and after providing the right pin info to the paralleldisplaybus.ParallelBus constructor, the screen turns on, but shows the same lines and garbage that it did as compiled in.. so.. at this point I think the problem lies somewhere within the differences of how CircuitPython paralleldisplaybus is handled vs how the equavlent bus is constructed in the Arduino sketch.. I think this is the point where I set this aside.. π
where do you get these boards?
https://www.aliexpress.com/item/1005006284154750.html <- This is the one I've been working on for a few days.. The SD card, amplified GPIO speaker, and touch were all trivial to make work.. the display must need some configuration or kick in the pants that the arduino driver provides while the circuitpython one doesn't..
actually that didn't help as much as i'd hoped ```py
OSN_CREDENTIALS = str(osnusername) + ":" + str(osnpassword)
OSN_CREDENTIALS_B = b"" + str(OSN_CREDENTIALS) + ""
OSN_CREDENTIALS_B = binascii.b2a_base64(b"" + str(OSN_CREDENTIALS)).strip() # strip removes \n
BASE64_STRING = str(OSN_CREDENTIALS_B) # bytearray
TRUNCATED_BASE64_STRING = BASE64_STRING[2:-1] # slice bytearray head/tail
BASE64_STRING : b'VXNlcm5hbWU6MDEyMzQ1Njc4OQ=='
TRUNCATED_BASE64_STRING: VXNlcm5hbWU6MDEyMzQ1Njc4OQ==
A logic analyzer will really help with debugging this. You could get an rp2040 board to do it
@short tendon should i run black first or just try pre-commit?
That's the 28R which has a SPI screen.. I have one of those en-route, and if I'm honest, should be the one, if any, that get submitted for CircuitPy support.. it's by far more popular than the 22C, which I just happened to have the bad luck of getting
@short tendon ```
C:\Users\Devon\Documents\GitHub\Adafruit_CircuitPython_Requests\examples\wifi\expanded>pre-commit run --files requests_wifi_api_openskynetwork_private.py
[INFO] Initializing environment for https://github.com/charliermarsh/ruff-pre-commit.
[INFO] Installing environment for https://github.com/charliermarsh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check yaml...........................................(no files to check)Skipped
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Passed
reuse....................................................................Passed
Thanks for checking
time.sleep(0) doesn't make any sense either
It would be the do {} while (); of pretty much of what exists already.
Light sleep is already looping backround tasks, so 0 would be a single tick.
Please file an issue that explains the issue
Alright, I will file an issue with details and repro instructions.
we may need to tweak the tinyusb task to run more often instead
I am not sure rising tinyusb task prio is a good idea.
It's not like usb isn't detected at all.. It just...
@short tendon I think it might be helpful to swap the formatting and linting ruff commands so any linting errors get reported on new line numbers instead of old ones.
Totally makes sense
Hmmm. The import fix happens in linting, not formatting. So they can both change lines...
I think it will still report unresolvable errors on the newer lines though. I had an issue using pydocstyle rules where my CI was reporting older lines for this reason, which is why it's on my mind.
Unless I'm misunderstanding what you mean by import fix - I assume you mean isort
I do
Interesting it's not in formatting though, though I guess isort really is technically? linting???
Yeah, it is strange
For what it's worth, I think you'll still get the correct line numbers even after the reordering.
Sounds good. I also assume, those will change less often
@proven garnet do you think we should run PL? The rules are different and not sure how we would find out what ones to disable globally. Strange ones in that PR are: ["PLR2004", "UP030", "UP031"]
I suspect that whatever is required to make this screen work at this point is beyond a board definition and into modifying the common-hal/paralleldisplaybus code
- boards without board.DISPLAY cannot do this. For example, matrixportal s3 does not have board.DISPLAY.
After displayio.release_displays(), there is still a blinka flash when networking seems to be initialized.
Facing this exact issue using a MatrixPortal M4. Any ideas on how to get rid of the blinka flash anyone?
I'd be surprised if that were true. paralleldisplaybus is pretty standard and simple
I'm torn on PyLint. Ultimately yes, but it would mean changing all the # pylint: disable=thing to # noqa: newthing#### which is involved.
Yeah, although there would be fewer of them
There's a lot of assumptions in there, hardcoding dc_levels and the flag set without the opportunity to customize it for one board or another..
I don't think there are many relevant global disables - the .pylintrc files has them and is pretty consistent between libraries.
ya, perhaps. a logic analyzer will tell you
C:\Users\Devon\Documents\GitHub\Adafruit_CircuitPython_Requests\examples\wifi\expanded>pylint requests_wifi_api_openskynetwork_private.py
************* Module requests_wifi_api_openskynetwork_private
requests_wifi_api_openskynetwork_private.py:12:0: C0411: standard import "import binascii" should be placed before "import adafruit_connection_manager" (wrong-import-order)
``` local pylint told me to put binascii before connection manager. i did that and isort failed during the job run.
Also, do you know how to set UP to use a certain pyupgrade version?
Any idea why, with the latest pull from the git repo, my builds still say "CircuitPython 9.0.0-rc.1-7" leading to reminders from circup that there's a newer version..
make sure to fetch tags too
@midnight ember @proven garnet there are some examples-only modifications to the pylint settings made for examples only, fwiw. ```yaml
types: [python]
files: "^examples/"
args:
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
if using isort it will be necessary to disable pylint's wrong-import-order, since as you see they disagree.
consider-using-f-string was more like "you must use f-string or i'll bug you to death about it"
I updated my ruff branch to use PL (pylint) and UP (pyupgrade), just to see the changes
I only needed to re-add 2 noqa statements
like this function that i've used for about 2 years now it complained about ```py
def _format_date(datetime):
return "{:02}/{:02}/{:02}".format(
datetime.tm_year,
datetime.tm_mon,
datetime.tm_mday,
)
so i rewrote it with only f-strings, probably an improvement that needed to be done anyway. now i have a nice f-string version added to my snippets.
```py
def _format_datetime(datetime):
""" F-String formatted struct time conversion"""
return (f"{datetime.tm_mon:02}/" +
f"{datetime.tm_mday:02}/" +
f"{datetime.tm_year:02} " +
f"{datetime.tm_hour:02}:" +
f"{datetime.tm_min:02}:" +
f"{datetime.tm_sec:02}")
Asked a question in the code.
Note also we just merged #9035, which is support for using a demultiplexer on one side of a matrix. You may want (or need) to rebase or merge and modify that implementation to match what you changed here.
I think this is clearer; it still takes a bit of head-scratching to understand the algorithm. A diagram would theoretically help, maybe, but let's not go there yet.
The current defaults are interval=0.020 and debounce_threshold=1. What values would you choose on a typical keyboard to make, say, the rhythm game you are talking about work better. Or what are you choosing for your own use now?
We could also run ruff twice, once for code and the other for examples where we disable the isort rule
The goal of linting and formatting is so code is safe (linting) and looks the same (formatting). It makes code reviews easier and takes peoples preferences to how it should look (there's like 5 ways to format a string) out of it. It would be up to the owners to determine what rules they want to enforce
it makes code reviews harder, imo, because it removes important code smells
and most of the linting rules are completely useless
Personally having different rules feels strange. Because then when you move example code into real code, it re-formats it.
Also @tulip sleet I can look at that fun pre-commit issue this evening, if you want to hand it off to me for a little bit.
that would be great -- I found the whole thing quite frustrating
honestly i've learned most of my formatting from learn guides and repos from circuit python. i think black and pylint had a lot to do with that.
right but the formatters are kind of like the glue that binds all of our code otherwise it would be the wild west for examples. there is a nice sense of consistency when reading learn guides because code is formatted before being shared.
Relevant
It's not lost on me. I know. I really liked the formatting without the line spaces. :/
foolish consistency is the hobgoblin of the little minds
@midnight ember also, just so you know (and haven't checked specifically in CP), f-strings are faster and more memory efficient than any other string formatting. It is sad that we still need to concatenate long strings, so lose some benifit there...
oh i use f-strings for everything now. i'm not complaining. in fact it was very useful to kind of be forced to update that one to f-strings. i didn't even realize all this time that it needed to be updated too until pylint said something.
Is there a formatting override to disable the f-strings check? In some cases I think the .format approach may be more readable.
- Addresses #8967
Rename ports/nrf to ports/nordic to avoid overlap with MicroPython.
probably something like # pylint: disable=consider-using-f-string
Now I have to go rename my entire nrf examples directory.
@wraith crow yes, we can ignore f-strings if we want (globally, or selectively)
i like the recommendation as i do want to move everything to f-strings. i don't think it should be mandatory just yet though.
@tulip sleet I'm running into reset issues with the usb host featherwing code and I'm tempted to remove all of the never_reset and bulk reset stuff
there's an issue for that π do you want to do it on main or 9.0.x?
I was debating doing it on main
it may not save me from this problem though
because the finalizers aren't run in a particular order
so I could still deinit the spi before the max
I was thinking of #8991, that's just finishing off pwmout
but we still need reset_forbidden, I assume (never EVER reset)
oh, it's #8960, that's everything
@slender iron of interest re IDF iram, cache, etc.: https://github.com/micropython/micropython/issues/14005#issuecomment-1996507230
ok, it's only in ESP-iDF 5.0.x, so not an issue for us
good for us for not supporting older ESP-iDF
ya, jim sent me a link to it
I need to write up the noxip thing for clang folks
and finish my impl
especially since not all boards have f-strings enabled
Maybe I mis-read but I thought Dan said all boards do now have f-strings enabled....
oh? I'm sure they didn't work on my samd21, but I didn't try with cp 9
π€· either way, there is still the option to disable the check I guess π
there are also things you can't do with f-strings
I'm pretty sure f strings are on any board. Didn't think you could turn that off. Many libraries use them...
f strings have been on all boards since 7.3.0\
I must have some old versions installed, sorry
I think question number 1 for linting/formatting is do we want to sort imports. If so, it will probably be easier to add isort first and then switch to ruff (if that's the thing we're doing). I'm 100% happy to script it out and open all the PRs (I do know you guys mentioned direct commits to main)
Do ruff and isort produce potentially different orders?
No. I'm pretty sure ruff implemented isort
There should be no changes
That's why it feels like a good first step
I am also happy (if people can decide on rules) to do the whole thing.
if we have to change the same places to do isort+pylint+black as opposed to just ruff+ruff, then we may as well move to ruff without an intermediate step. It could be done in batches of libraries since there would be cleanup
Fair. Please let me know how I can help. I can probably script about 90% if not more. I can also create diff files so you could commit to main
could be scripted, ifthere is manual cleanup needed could be done with pre-commit locally. We might be removing a number of # pylint: ... comments, if I understand correctly.
Yes, I would remove all of those and replace with the new ones (if we are using rust:pylint)
If we open them as PRs, then anything not caught by scripts would be easy to find since it would fail
we could generate PR's to switch over with a script. Many PR's would fail and then they could be cleaned up by hand. If there are easy cleanups those could be automated.
This would be my flow:
- Pick 5-10 repos of different sizes (like ticks, minimqtt, portal base) and create 3 (maybe 4) PRS:
a. With sorting enabled
b. With pyupgrade enabled
c. With pylint enabled (different from the normal pylint)
d. There is also one for docstrings, not sure that would be wanted... - Create a Google doc that lists the PRs and allows for comments
- Either meet over the doc, or have someone review comments and make decisions
- Use said decisions to update all the repos, update cookiecutter and update docs to the rules and why (so someone doesn't come back in 6 months asking why we do x)
CircuitPython version
Adafruit CircuitPython 9.0.0 on 2024-03-19; Raspberry Pi Pico W with rp2040
Code/REPL
import time
import board
import audiomixer
import synthio
import audiopwmio
import ulab.numpy as np
SAMPLE_RATE = 32_000
MIXER_BUFFER_SIZE = 2048
audio = audiopwmio.PWMAudioOut(board.GP18, right_channel=board.GP19)
mixer = audiomixer.Mixer(channel_count=1,
sample_rate=SAMPLE_RATE,
buffer...
BTW, has there been any discussion about making the "update ever N" samples value configurable per LFO?
Probably better fit for #help-with-linux-sbcs but, i wanted to know will there support for blinka on the orange pi zero 3?
@tulip sleet It seemed like all the dependencies were up to date, so I'm not sure what was causing the error. However, I got the CI to pass by installing pre-commit via pipx as opposed to pip so it has an isolated environment and that worked.
I wonder if something is competing with it, but whatever it is, it'd take more digging. Using pipx is a pretty good permanent solution anyway though I think the contributing guide would need to be updated if that's the way it should be done locally too.
Anything I can help look at?
No, I think it's good now. If you're interested in figuring out how its using an older virtualenv, that'd at least solve the mystery. But it really only seems to be on the runner, since I know I'm running 3.12 on my system and have no issues.
I've tried checking versions with pip freeze, seeing if updating the system packages helped, and all nothing. My vote is that it's somehow using the system virtualenv which would be at 3.10 for the runner, but that's wild speciulation a guess.
What is it? I've missed a message somewhere
My vote is that it's somehow using the system virtualenv which would be at 3.10 for the runner, but that's a guess.
I was wondering if it was something like that too. I had hoped thatactions/setup-pythonwould somehow do the right thing and set up compatible versions of other things, but I guess not.
I'm seeing this:
uses: actions/setup-python@v5
with:
python-version: "3.x"
Which should specify the python version if there's one you want...
@tulip sleet and @proven garnet resolved. PR proof: https://github.com/adafruit/Adafruit_Blinka_bleio/pull/67 it's specifically a py3.12 issue. Doing some digging it's possibly an outdated version of setuptools
Feel free to update that other PR and close this one, or merge it in first and fix the other
The goal is to hopefully use 3.12 though π. It also doesn't look like setuptools is outdated if you do pip freeze on the runner.
So the actual issue is that pkgutil.ImpImporter that has been Deprecated since version 3.3 was removed in 3.12. I imagine it may take time for everything to catch up. Is 3.12 needed now? Or could we pin to 3.11?
Setuptools handles it correctly in 3.12 by putting that line inside of an if hasatrr() block, but that's not what's being used here. Here's setuptools 69.2.0 (which is what the runner claims to use in the system, but clearly not the pre-commit venv: https://github.com/pypa/setuptools/blob/6ee23bf0579c52e1cbe7c97fc20fd085ff2a25c7/pkg_resources/__init__.py#L2198-L2199)
It's currently pinned to 3.11 across all the repositories' CIs, including the libraries
Right, I want to stop having to pin 3.11
Itβs mysterious to me why itβs using the wrong setuptools, but maybe itβs the default one for Ubuntu 22.04. Maybe we have to pip or pipe install the right one, but Iβm not sure where to put that requirement
@tulip sleet and @proven garnet figured it out for real
it's the version of pylint we use: https://github.com/pylint-dev/pylint/blob/fc34a4b6abe56f3ac07ca15d846b1c1955545f85/pyproject.toml#L2 it needs setuptools~=62.6. It's removed in 3.0
Or you know we could switch to ruff.... π
π°π³οΈ success!
Adafruit CircuitPython 9.0.0 on 2024-03-19; Wemos Lolin C3 Mini with ESP32-C3FH4
Same problem, manual wifi.radio.connect() works
Nice! We can run adabot to update the pre-commit hooks.
The only issue is that I needed to add a few # pylint: disable=too-many-arguments so updating may cause linting to fail in some projects. Also, I picked 3.0 in the PR, just because it was the first one that worked. There is a 3.1 (it looked like it had the same rule changes)
I don't think that's an issue in the long run - most libraries should pass that check I think (I think the limit is 5 arguments which is plenty in most cases
I have a tool that can help locate and list any result CI failures
But yeah, this also competes with the ruff change so it may be worth figuring that out
Yeah, does seem not the best use of time to fix linting to fix it again...
Haha yeah, but it makes sense now that it's within the venv. I vaguely remember an issue like this when we switched to 3.11 though I don't think it was setuptools but some other package that failed since something was moved or removed.
I think it's funny how long that method had been deprecated. 3.3 was a long time ago...
@proven garnet did you see my thoughts above on how to figure out if the switch to ruff is good?
@proven garnet @short tendon I was confused becaue I saw pylint 3.0.3 referenced here: https://github.com/adafruit/actions-ci-circuitpython-libs/blob/e9f0c3911c4e0cc6bf64f77355cca0ac143811b6/.pre-commit-config.yaml#L21 . I though this version was being used for lib CI actions, but now I see the separate specification in the .pre-commit-config.yaml for the blinka bleio library, etc.
I can't even see how that library uses pre-commit...
I did look at that library yesterday as I was trying to see what was installed where and if something was installing a different setuptools
I am pretty confused by that repo. I wasn't aware it existed
I think it's mainly used here: https://github.com/adafruit/workflows-circuitpython-libs/blob/main/build/action.yml
other then the install.sh which is used to install what the CP library needs
You all have build an impressive build system, but it's a little like a rollercoaster...
Ah, sorry, I should have said that. Yeah, currently all the Blinka stuff uses local versions of CI since dependencies might be different, but it may be worth unifying those.
Yeah, it's wild. This is exclusively for libraries, which all pretty much have the same requirements for builds. The Blinka stuff all use their own local version of pre-commit config, pylintrc, etc.
Yeah, I would say if we decide to switch to ruff then it's not worth linting to then fix to then lint. I haven't been to the meetings in a little bit, so not sure what the consensus is.
Tagging @lone axle who has been involved on that front.
This does remind me that this issue is why I wanted (and honestly should) create a repository for how these issues get solved - community libraries will break if we change the unified library action and downstream users (anyone who uses the cookiecutter) don't update their pre-commit config files.
I would add to that doc, why the pre-commit linters,formaters,checkers,etc where chosen. Seems like a repo would be a good place to keep that history...
I've updated it to latest since it'll be similar to 9.0. It is in the RTD project admin settings under "default version".
Another symptom is that os.rename('./sd','/newsd') effectively separates the physical mount point from the mounted file system. The contents of the sd card can then been seen by os.listdir('/sd') and the original placeholder file can be seen by os.listdir('/newsd'). Doing this also seems to hide the /sd folder (and SD card contents) from web workflow.
Are these things you mention in like 'sorting', 'pyupgrade', 'pylint' like different modules within ruff? Or were the steps outlined here not talking about the switch to ruff?
And did you mean 3 or 4 PRs for like each of those letters a to c or d put into it's own individual PR?
Yes, in the pyproject.toml we would add:
[tool.ruff.lint]
select = ["I", "PL", "UP"]
Where each letter is the option we want to run.
And yes, 3-4 each. It would be so we can show what each one would change. To help see if we want to add them. I can script it all out, so it's not a lot of work
Do you mean just for the first few to see what shakes out or for all of them even after the first few? I think I'd lean toward trying to collapse down to 1 PR per library if possible at least for when we do all of them. Even if the creation of those PRs can be scripted there are still manual steps for approve and then merge (unless there are more automation tools in adabot or somewhere that I don't know of). So at least for my process reviewing and merging 1 PR instead of 3 or 4 would result in substantially fewer clicks and keypresses through the process of all the libraries in the bundle.
Even in a single PR those discrete steps could be broken out for inspection by commiting them individually with the changes associated to each one. You can always view the branch at each of those commits within the same PR.
oh yes. just for a few random ones to help make decisions
What does pyupgrade do? I don't think I've heard of that
And when doing the full thing, I would automate adding one at a time, running and committing
pyupgrade finds things that have changed and updates them. For example f-strings
Is there one of these things select = ["I", "PL", "UP"] for formatting like the functionality that replaces Black? or is that set up some other way?
no... it's strange. this:
[tool.ruff]
target-version = "py38"
[tool.ruff.lint]
select = ["I", "PL", "UP"]
tool.ruff == formatting
tool.ruff.lint.I == isort
tool.ruff.lint.PL == pylint
tool.ruff.lint.UP == pyupgrade
Ahh, the pyupgrade one I have slight reservations on because micropython and thus circuitpython doesn't necessarily always support the brand newest of CPython syntax when it becomes available. Last I knew micropython was targeting 3.4 or 3.5 python syntax though with some newer features like f strings included at this point. I'm not sure if that has been moved forward perhaps though. We can see with testing on hardware when those inital PRs are in, but I worry that some day it's going to make an upgrade to some new syntax that isn't supported by circuitpython and then it will break the library on hardware but the linter / actions checks won't realize that.
Totally don't need to add it. Just showing options
In one last ditch effort to determine why the lilygo tdisplay s3 works with the parallel display bus code while this cheap yellow display board does not, I determined that the only difference I could perceive in hardware, other than the resolution, was that the Lilygo device had a hardware reset pin while the CYD had tft_reset wired to the esp32 en pin. I went so far as to cut the trace to tft_rst and run it to a spare GPIO on the ESP32, tested continuity thoroughly to ensure the surgery was a success, change the code accordingly.. and it has made zero difference.. still lines and garbage.. I give up on this thing..
I would say this plan sounds good to me. I do think 1 PR with separate commits would be fine instead of separate PRs, but for the smaller subset of libraries to check out I don't think it matters as much either way. I would add that part of the testing process on those first couple of libraries should include a trial on hardware both mpy'd and plaintext python. I recall some weird obscure issue in the past where mpy-crossed version of some syntax was causing trouble so I think it's worth doing that kind of testing especially on the pyupgrade changes.
And we can update the cookie-cutter repo with the specific configuration we land on once it's decided.
@onyx hinge you know of a way to compute the length of an array in a type right? I feel like you added it somewhere. ESP removed a constant for how many endpoints chips have and hardcoded the array length
there is an MP_something for that
this is for tinyusb
#define MP_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
do you mean they literally made it 5 or whatever?? oy
I had only thought separate, since two could make the same/similar changes
@slender iron I think I would open a complaining issue about that :forehead_slap:
I can't figure out how they changed tinyusb to still work
yeah MP_ARRAY_SIZE is the ticket @slender iron as long as it's really an array and not a pointer
π
unfortunately that construct results in 0 or 1 for a pointer, rather than an error
all the dcd stuff is gone
I'm mystified too
going afk
but it uses the old macro still
π
The adabot patch is a good candidate for pushing to main some of these changes. Things like pyproject.toml, .pre-commit-config.yaml, and other such files are easy that way.
I then have a tool that will check and record which recent CI builds failed as a result
(also contained within adabot)
The nice thing about the adabot route is that it saves having to submit PRs, and just works by doing a git format-patch application to all the repos
I do have another tool that works similarly in that it pushes to main without a PR but is a little bit more programmatic (it basically takes a repo and can work with it in Python for things like updating TOML files or similar things that might be harder for a git operation (i.e., the files are very different across repos)
I don't think that will be necessary here but it is an option if a patch fails heavily. We can dry-run and see how many would need to be fixed otherwise.
Right, my understanding is that the plan is to do PRs only for the first few to get a closer look at the changes it's going to make. Then do the rest with a patch from adabot. I'll have to look into adabots CI build failure thing, I didn't know she had that ability.
I added it a couple years ago to help with looking for them for cases like this 
It utilizes the previous tool that iterates through the libraries via Python, I thought it was standalone but it isn't.
Here was an example use for converting setup.py to pyproject.toml: https://github.com/tekktrik/adafruit-bundle-toml-switcher
Here's a simpler use case for converting all the YAML files to use the unified composite actions, which I need to review so I remember how it works too π : https://github.com/tekktrik/CircuitPy-Composite-Action-Paster/tree/main
@proven garnet can the patch also run commands? since it would also need to run pre-commit on the repo after the changes?
Has anyone written the implementation?
It looks like there's a similar issue for newly created LFOs.
WAVEFORM_HALFLEN = 2048
lfo_test2 = synthio.LFO(rate=1, scale=WAVEFORM_HALFLEN * 15//16 // 2, offset=WAVEFORM_HALFLEN - WAVEFORM_HALFLEN * 15//16 // 2)
I'd expect that to start around 1024 but there are a load of (out of range) 0 values first before it gets going, see output below for printing the value in a loop doing some other stuff.
0
0
0
0
0
1114
1114
1114
1139
1139
1139
1139
1139
1139
1...
This PR expands CP collections.deque functionality to be more congruent with the CPython implementation by adding iteration, subscription and initialization as well as pop(), appendleft() and extend(). Tests for the new functionality are also provided.
This code is a copy of MP PR #10724 that was recently merged into MP. I have built and tested versions of CP with this code for RP2040, ESP32S2 and atmel-samd M4 boards and everythin...
I took a quick look at this and I don't think there's an easy fix. This also applies to arithmetic blocks, and changing other inputs such as phase or offset.
Here's why: The values are lazily calculated during the generation of audio in the background. There's not even code to enable it to happen at other times (it's tied up with the idea that a LFO gets updated with a "tick").
In the short term it would be good to mention this in the documentation because I'm not surprised that you w...
No but its near the top of my list. I'm updating CP to IDF 5.2.1 before getting back to BLE.
fwiw I've just become aware that black has a CVE and recommends everyone upgrade to current. π’ this is via a non-working PR to adabot: https://github.com/adafruit/adabot/pull/370 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-21503
The patch can't but the other tool I mentioned could
We could also do git submodule foreach on the bundle I think?
I guess the worst thing that would happen is malicious PR's that take a long time to run.
"or if you habitually put thousands of leading tab characters in your docstrings. " I feel like someone found that one accidentally. my recent experience with LF & CRLF spamming me with errors was quite rude looking... though that was pylint.
CircuitPython version
Adafruit CircuitPython 9.0.0-rc.0-7-g6a07412b07 on 2024-03-11; Adafruit Feather ESP32 V2 with ESP32
This also happens with CP 9.0.0 final release.
Code/REPL
see https://github.com/vladak/shield
Behavior
I have a simple setup with Feather ESP32 V2, running on battery power, periodically reading metrics from temperature/humidity sensors, publishing them to local MQTT broker and entering deep sleep. The Feather was running C...
I can't see how it would have anything to do with your issue, but it looks like you're overwriting your IMPORT_EXCEPTION variable after the import attempt. You probably want to test that the variable wasn't already initialized before setting IMPORT_EXCEPTION to None. I'm sure there's a better way but something like:
try:
a = IMPORT_EXCEPTION
except:
IMPORT_EXCEPTION = None
If you publish a lot more frequently to the local MQTT broker, does it fail faster?
We would be quite interested in a test program that is a minimal (fast) reproducible example. For instance, if you send fake data as opposed to actually reading the sensor, does it make any difference?
countio, frequencyio and rotaryio aren't easily doable because the C3 doesn't have a PCNT peripheral. It doesn't have I80 support for paralleldisplaybus either.
So @lone axle, @proven garnet and @tulip sleet would me picking 5-10 repos, creating a branch, adding ruff: format, sort, lint, pyupgrade each as their own commit be a helpful step in making decisions?
I think so π
Any you would like in that list?
pyportal, portalbase, pycamera, neopixel, requests, and any random I2C based driver make sense as a good test set in my mind.
sounds good to me, though I've never done any testing with it personally. I think I purchased the hardware for it at one point but I'll have to dig around in the parts room a bit to find it.
Sorry, I unraveled an even bigger bug.
Adafruit CircuitPython 9.0.0-dirty on 2024-03-19; Seeeduino Wio Terminal with samd51p19
>>> import board, sdcardio, busio, storage
>>> spi = busio.SPI(board.SD_SCK, MOSI=board.SD_MOSI, MISO=board.SD_MISO)
>>> sdcard = sdcardio.SDCard(spi, board.SD_CS)
>>> vfs = storage.VfsFat(sdcard)
>>> import os
>>> os.listdir()
['.fseventsd', '.metadata_never_index', '.Trashes', '.Trash-1000', 'Beryllium', 'code.py', 'boot_out.txt', 'repl.py', 'boot.p...
I used the bme680 library typically for what it's worth but agree it's essentially arbitrary!
I can try to incorporate this into a patch
Because I need a new project to beat my head against.. I've ordered a Lilygo T5-S3 v2.3. It's an ESP32S3 with TF slot, I2C RTC, and 4.7" ed047tc1 EPD. Doesn't look like there's TOO much for support ouside of experimental drivers out there for that panel. We'll see how that goes..
CircuitPython version
Adafruit CircuitPython 9.0.0 on 2024-03-19; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3
Board ID:adafruit_feather_esp32s3_4mbflash_2mbpsram
UID:CD4557DDA3C4
Code/REPL
import alarm
# Full program here, everything else is working fine except for sleep below...
alarmA = alarm.pin.PinAlarm(pin=board.D12, value=True, pull=True)
alarm.exit_and_deep_sleep_until_alarms(alarmA)
Behavior
I have not included all ...
Can do this one. I looked:
You last purchased this item on September 25, 2020
So mines even stemma
CircuitPython.org has a new board rss feed in the top right corner but it hasn't been updated since May 2023. https://circuitpython.org/feed.rss
I'm trying to learn typing and the learn guide is nice but is there a list of all the types? The circuitpython_typing library example wasn't much help https://github.com/adafruit/Adafruit_CircuitPython_Typing/blob/main/examples/typing_simpletest.py
@jepler after the UVC hardfault fix (still waiting for review). It is better, but my arduino example still struggle to run on S3, but run great on other platform such samd51 and nrf52840.
At currently state, S3 does not work with webcamnnoid in Linux, but regconized by windows device mannager (no :warning: sign), and able to stream data if lucky enough. I guesss it is race con...
This adds support for Github-codespaces for CP 9.x.x.
It fixes #9029.
Another major change is that the devcontainer-alternatives are now on a per port basis (major speedup in codespace creation since the codespace only fetches submodules relevant to the selected port). Currently only ports using espressif and cortex-m are supported.
@eightycc
Additionally, support should be provided for other build hosts.
This is for Github-codespaces, and as far as I know, they only provide x86_64 hosts.
The feed says <lastBuildDate>Thu, 21 Mar 2024 06:03:27 -0400</lastBuildDate>. I didn't hear that anyone fixed it -- not sure what changed since you looked.
are RSS feeds meant to be chronological? Should the newest be always at the top or bottom? The order of boards in that feed seems all over the place.
maybe the client software is responsible for ordering them by pubDate
the feed itself is in alphabetical order by board name. Each board has a PubDate. If the feed reader is sorting by that it will be confusing
I didn't know how the RSS page was built so I went on a little exploration to figure out. It looks like ultimately the order would be determined by this loop in the feed template: https://github.com/adafruit/circuitpython-org/blob/ec8c7044857e010c500eac3c9fd280fb25f4aeab/feed.html#L11
Ahhh, I hadn't caught on it was alphabetical, that makes sense
the sort order on the boards web page is by popularity (download count)
which makes for some surprises
I added the feed to an rss reader on my phone and it does seem to handle the chronological sorting automatically
it would be cool to make this data available as JSON so it could be consumed by circuitpython. Then you could have a magtag, or matrix portal etc.. showing the latest new devices supported all the time.
I don't think there's an extensive list like that. It may help to add to that repository. If you want to make an issue to that repo I can assign myself and try to do that since I know I PR'd many of them.
I can also try to make a small example guide in the Playground page if you think that would be helpful.
Absolutely! That would help. I'll make an issue for the typing repo too.
Didn't notice RSS was alphabetical. Yes they're usually in chronological order since... like always. This is the first feed I've seen that isn't chronological. How you even managed to do that is neat. I thought it was a latest boards feed in chronological order. The first board in the list is from May 2023 so if you're expecting RSS in chronological order it will appear as if it hasn't been updated since May 2023.
Having 2 feeds, 1 in alphabetical order and 1 in chronological order would be appreciated. I love RSS feeds but there's no sense in subscribing to a feed that's in alphabetical order as my feed reader will only pull the top 25 and never update. RSS feeds are expected to be in chronological order. As FoamyGuy said last publish date is how RSS feeds notify you of updates.
That's how Adafruit's Blog RSS works.
Submitted as requested. https://github.com/adafruit/Adafruit_CircuitPython_Typing/issues/41
Thank you!
I think it isn't really a "feed" so much as just a regenerated summary. If it would help to sort it by publication date, you could open an issue for that
Where should I open it? Circuit Python main?
@proven garnet Tested and confirmed as requested https://github.com/adafruit/Adafruit_CircuitPython_datetime/issues/10
Circuitpython-Org repo I think is the best place, that is where the change will need to be made to enable it.
Didn't even know that was a repo. Will do.
bookmarked, thank you.
Helped with closing an issue that was 967 days old. π€
yeah but back when the issue was opened you probably couldn't have calculated that it would be open for 967 days
Second, I've been watching this thread for a while. Would happily contribute the cost of a well-earned beverage or two once it's there.
Would it be worth adding a section at the top of the main displayio module docs section: https://docs.circuitpython.org/en/latest/shared-bindings/displayio/index.html#module-displayio that outlines the breaking changes from 8.x? That way anyone whose updated and found their project stopped working will have a chance to find what specific change is needed if the land on this base displayio docs page.
The docstring was showing the pre 9.x displayio API.
So we would sort it by <pubDate>, most recent first.
Yeah, that RSS feed is sorting correctly.
Could you change this to be merging against 9.0.x instead of main? Thanks. You may just be able to click "Edit" to the right of the title and change the base.
there is an edit and it seems to have an option for changing branches but it doesn't show any branches in the list to choose from and typing 9.0.x in there and then enter doesn't seem to do anything.
@lone axle do you see this?
When I created the branch I used:
git checkout -b busdisplay_docs_fix adafruit/main --no-track
Would I need to make a new one with this instead?:
git checkout -b busdisplay_docs_fix adafruit/9.0.x --no-track
I see the dropdown the but there are no actual choices in it only an empty search box
oh
are you looking at your fork or adafruit/circuitpython?
now it's populated
!!
It looks like for the 494 checks, all of the baseline checks and all but two of the board builds passed:
The nordic/hiibot_bluefi board failed initializing submodules; and,
The silabs/devkit_xg24_brd2601b board failed building the en_US version (with Exit Code 2?). Is it possible t...
okay, that saved but made way too many unrelated changes in the PR now. I'll start over on a new branch from 9.0.x
@SAK917 I will re-run the failed jobs. It is not uncommon for there to be CI glitches.
I think I do need to start this from the other branch instead of main. It seems that now it's wanting to change loads of things I didn't really touch.
You should be able to use pre-commit locally to catch these: https://learn.adafruit.com/building-circuitpython/build-circuitpython#install-pre-commit-3096511
What do you think about rp2clock instead of rp2clockio? There are other clock related functions in the SDK that may be useful to integrate in the future such as starting/stopping clocks and measuring the frequency of clocks using the onboard hardware.
I think one way to change this is with the loop here: https://github.com/adafruit/circuitpython-org/blob/ec8c7044857e010c500eac3c9fd280fb25f4aeab/feed.html#L11
This jekyl template docs page shows an example of ording by a specified field: https://carpentries-incubator.github.io/jekyll-pages-novice/arrays/index.html unfortunately it doesn't seem to have anchors for direct linking and it's near the bottom of the page, here is an excerpt of the relevant code:
{% assign sorted_posts = ...
What do you think about rp2clock instead of rp2clockio? There are other clock related functions in the SDK that may be useful to integrate in the future such as starting/stopping clocks and measuring the frequency of clocks using the onboard hardware.
Fine with me!
@lone axle I should have gone through all the circup instruction fixes
Thank you!
glad to know the RSS issue wasn't just my perspective. thank you Melissa.
resolves #1354
After this change there were two devices showing up at the top of the list (out of chronological order) It turns out the date parsing format is very specific, it needs 4 digit years and zero padded single digits, with those changes these devices now get put into the proper place of the order.
Worth considering breaking out the Blinka boards as a separate feed. Right now they effectively get rendered one after another in the same giant RSS feed. This means they won't ever...
How would you name the 2 feeds? Blinka RSS & Microcontroller RSS?
I like the idea of separate feeds. I would be far more interested in subscribing to a latest circuit python microcontroller latest boards feed since I don't use SBC's or micropython.
Looks good. The change of the date on the tdisplay shouldn't be necessary and there are probably many more boards without the leading 0.
Looks like that did the trick @dhalbert, all checks passed! Thanks for rerunning and I appreciate your help.
This also reformats all front matter due to how the file is processed.
The transformation was done with
import datetime
import sys
import frontmatter
for i in sys.argv[1:]:
post = frontmatter.load(i)
date_added = post.get("date_added", "")
if isinstance(date_added, str):
try:
date_added = datetime.datetime.strptime(date_added, "%Y-%m-%d").replace(hour=12)
except ValueError as exc:
print(f"Failed to parse date {date_a...
Is this an alternative to #1355 or a continuation of that?
The fix in https://github.com/adafruit/circuitpython-org/pull/1355 was incomplete, because it still places all blinka boards below all circuitpython boards. Also, we can do better at checking that dates are in a format that jekyll will be able to properly sort.
Normally, the RSS reader handles the sorting and I'm certain this was the case when it was initially tested. The reason Blinka boards are placed separately from the CircuitPython boards is because they are under their own category via RSS.
@slender iron i was going to start looking at the deepsleep bug (9067) unless you have a clear idea of what this is.
not really though I didn't read it closely
I am tempted to get sleep going on the Cx series at the same time
it's waking up immediately on a pin alarm
i have one C3 board I could see about. But I think I would fix that first standalone
ya, and the apis may have changed with 5.2
This updates the underlying I2C API and allocates memory. So, I switched busio.I2C to using a finalizer for reset instead of bulk reset.
This PR does maintain the <category> tag while mixing the two lists togethre.
The problem is that trailing whitespace is valid markup (two trailing blanks signal a line break), so I think you should change pre-commit. Anyhow, I removed the whitespace so this is fine now.
I think it would be better to use <br> in general: it's valid markdown and is not invisible like trailing whitespace. But no problem here now.
Thanks! I think it would be good to write this up in https://adafruit-playground.com/. I could link to that from the "Building CircuitPython" guide and/or at least link to the Readme here.
TypeError: 'Socket' object isn't subscriptable
I believe I found the cause for this. I've updated (rebased) the branch on top of current main and test built espressif, but didn't re-test anything.ese
PicoW + WIZnet W5100S hat gets
MemoryError:in thecontext.wrap_socket()line, not sure how to debug or proceed from there.gc.mem_free()= 76064 after the exception.
this may simply not be a good combo, with wifi taking up extra RAM. I think SSL needs some large blocks of memory that may simply not be left after parsing in all the wiznet code. anyway, that's a total guess.
it would be good to write this up in https://adafruit-playground.com/.
Yes, that is on my todo-list.
https://github.com/micropython/micropython/pull/14136, which is not yet merged, may improve some temporary storage issues when compiling .py files.
is this related to something known?
Adafruit CircuitPython 9.0.0 on 2024-03-19; Adafruit-Qualia-S3-RGB666 with ESP32S3
>>> import cm_test
----------------------------------------
Fetching from http://wifitest.adafruit.com/testwifi/index.html
Traceback (most recent call last):
File "adafruit_connection_manager.py", line 271, in get_socket
OSError: [Errno 113] ECONNABORTED
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cm_test.py", line 32, in <module>
File "adafruit_requests.py", line 597, in get
File "adafruit_requests.py", line 535, in request
File "adafruit_connection_manager.py", line 282, in get_socket
RuntimeError: Error connecting socket: [Errno 113] ECONNABORTED
>>>
where cm_test is this example from the library:
https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager/blob/main/examples/connectionmanager_helpers.py
nope, I haven't seen this before. Are all the libraries completely up to date?
hmm. maybe. i just loaded the libs. but took them from a bundle zip from a guide example.
let me try a manual loading of the libs directly from the main bundle zip
it could just be a bug in the cm test
i originally hit it through the qualia support lib
but then recreated more directly as above
qualia.get_local_time() end up with same error
is your settings.toml in good shape?
I'd try this with some other moregeneric ESP32-S3 board
Two questions:
- Is this while you are battery powered and not connected to USB, or connected to USB? In the latter case it will be a "fake" deep sleep.
- The example above does not include
import board, so it will fail immediately (and not because of sleeping).
@danh library updates seems to have fixed it
Adafruit CircuitPython 9.0.0 on 2024-03-19; Adafruit-Qualia-S3-RGB666 with ESP32S3
>>> import cm_test
----------------------------------------
Fetching from http://wifitest.adafruit.com/testwifi/index.html
Text Response This is a test of Adafruit WiFi!
If you can read this, its working :)
----------------------------------------
>>>
could you download the bundle again and see if there's a library difference?
still got the zip...looking...
got it from here fwiw:
https://learn.adafruit.com/qualia-s3-compass/code-the-compass
how do you diff .mpy's ?
$ diff lib1/adafruit_connection_manager.mpy lib2/adafruit_connection_manager.mpy
$ diff lib1/adafruit_requests.mpy lib2/adafruit_requests.mpy
no diff
I can't see how it would have anything to do with your issue, but it looks like you're overwriting your IMPORT_EXCEPTION variable after the import attempt. You probably want to test that the variable wasn't already initialized before setting IMPORT_EXCEPTION to None. I'm sure there's a better way but something like:
try: a = IMPORT_EXCEPTION except: IMPORT_EXCEPTION = None
Thanks. Maybe it would be sufficient to move the line with `IMPORT_EXCEP...
do like strings foo.mpy and the version number should be one of the first strings
still same. let me see if i can recreate the issue.
still same = versions agree using strings
1.0.1 and 3.0.1
@tulip sleet nevermind. can't reproduce. something must have just been weird.
π€· that is odd, if it happens again ...
@tulip sleet hmm...actually, still seeing some weirdness. qualia.get_local_time() not working again. and different error this time.
Adafruit CircuitPython 9.0.0 on 2024-03-19; Adafruit-Qualia-S3-RGB666 with ESP32S3
>>> from adafruit_qualia import Qualia
>>> from adafruit_qualia.graphics import Displays
>>> qualia = Qualia(Displays.ROUND28)
>>> qualia.get_local_time()
Connecting to AP peanuthamper
Getting time from IP address
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_portalbase/__init__.py", line 492, in get_local_time
File "adafruit_portalbase/network.py", line 270, in get_local_time
File "adafruit_portalbase/network.py", line 237, in get_strftime
File "adafruit_requests.py", line 597, in get
File "adafruit_requests.py", line 535, in request
File "adafruit_connection_manager.py", line 236, in get_socket
gaierror: (-2, 'Name or service not known')
>>>
and after a soft reset:
Adafruit CircuitPython 9.0.0 on 2024-03-19; Adafruit-Qualia-S3-RGB666 with ESP32S3
>>> import cm_test
----------------------------------------
Fetching from http://wifitest.adafruit.com/testwifi/index.html
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cm_test.py", line 32, in <module>
File "adafruit_requests.py", line 597, in get
File "adafruit_requests.py", line 535, in request
File "adafruit_connection_manager.py", line 236, in get_socket
gaierror: (-2, 'Name or service not known')
>>>
that looks like this code:
addr_info = self._socket_pool.getaddrinfo(
host, port, 0, self._socket_pool.SOCK_STREAM
)[0]
somethings getting into a weird state
after a power cycle:
Adafruit CircuitPython 9.0.0 on 2024-03-19; Adafruit-Qualia-S3-RGB666 with ESP32S3
>>> import cm_test
----------------------------------------
Fetching from http://wifitest.adafruit.com/testwifi/index.html
Text Response This is a test of Adafruit WiFi!
If you can read this, its working :)
----------------------------------------
>>>
i think it is just doing a DNS lookup
try some other board, and try older versions of 9.0.0. But I am wondering a little bit about your local network. Could try phone hotspot as an alternative
any specific 9x?
beta 0, alpha 4, but that's just a rough guess.
Adafruit CircuitPython 9.0.0-beta.0 on 2024-01-27; Adafruit-Qualia-S3-RGB666 with ESP32S3
>>> from adafruit_qualia import Qualia
>>> from adafruit_qualia.graphics import Displays
>>> qualia = Qualia(Displays.ROUND28)
>>> qualia.get_local_time()
Connecting to AP peanuthamper
Getting time from IP address
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_portalbase/__init__.py", line 492, in get_local_time
File "adafruit_portalbase/network.py", line 270, in get_local_time
File "adafruit_portalbase/network.py", line 237, in get_strftime
File "adafruit_requests.py", line 597, in get
File "adafruit_requests.py", line 535, in request
File "adafruit_connection_manager.py", line 236, in get_socket
gaierror: (-2, 'Name or service not known')
>>> import cm_test
----------------------------------------
Fetching from http://wifitest.adafruit.com/testwifi/index.html
Text Response This is a test of Adafruit WiFi!
If you can read this, its working :)
----------------------------------------
>>>
@gilded cradle hey, any ideas on above?
Let me catch up...
@tidal kiln I'll be afk for maybe an hour
@tidal kiln I'm not familiar with connection manager. Name or service not known looks important, but it doesn't really give much info.
Also not familiar with gaierror
am i being dumb in how im using the qualia lib?
I'm going to look at the connection manager code and see if there's anything that stands out
@tidal kiln in adafruit_requests, line 535 is a comment on GitHub. Are you sure it's up to date?
@tulip sleet I'm going to have to back out my i2c changes because the esp32-camera is using the old api still
This depends on esp32-camera support: https://github.com/espressif/esp32-camera/issues/649
@gilded cradle hmm....well its from latest bundle. but latest bundle is:
@tidal kiln yeah, there was a release of requests 3 days ago. Maybe bundles aren't building for some reason?
yah. looks like. seriously doubt there have been no library updates since 3/7
@tidal kiln maybe download some of the files manually from repos just to test your code and then we can fix the bundle releaser (not sure where it is or how it's done).
I wonder why its broken
Not sure, but I don't recall seeing a release in quite q while
I think this is the actions that releases the bundles, but not completely sure: https://github.com/adafruit/adabot/blob/main/.github/workflows/bundle_cron.yml
I wonder if there is a way to disable the idle based disabling.
Ah ha, cool
it's a bit odd that we have to make changes to Adabot every 60 days in order to keep the bundle building
I think the bundle is on a cron, so will likely only run starting later tonight
I don't see one in the settings
maybe if the action were moved from Adabot over to the Bundle repo it wouldn't be able to hit 60 days because any time it releases I assume it counts as "activity" so it will be resetting it's own timeout anytime any library changes.
it could still clone and use adabot code from inside of the action I think even if it were moved to the Bundle repo.
.github/workflows/cron_keepalive.yml?
That makes sense to me @lone axle
Catching up but I think the cron settings live in circuitpython-org for certain things, that runs adabot
I think the bundle is one of them
Another option might be to commit the daily report into Adabot when it gets run from this action: https://github.com/adafruit/adabot/blob/main/.github/workflows/reports_cron.yml in addition to uploading to S3
if that committed the current file when it runs (replacing the old one if we don't want 2 complete archives) it would mean there is activity every day.
Ah interesting, that one has a direct API to re-enable it.
Is the issue that adabot needs a daily update?
Maybe not daily, but probably at least semi-regularly.
at least once every 60 days it seems.
Why is that? I don't see anything in the workflow regarding that. I assume I'm missing something.
it was in screen shot above
That's what @lone axle suggested.
Gotchya, sorry about that, thanks!
I tried this on my memento. It runs but the camera stops working. I'll look tomorrow if @jepler doesn't get to it first.
No worries
@gilded cradle i tried to manually grab latest libs, but still getting same weirdness. but could still be related to something in the libs. will wait till bundle release is fixed and try again.
ok, I suspect it will work tonight.
yep. it'll be next week until i can try this again. but its just initial steps for something non-urgent. so can wait.
thanks all for looking into this!
I'm sure you already know, but MicroPython's ssl module (built on tls module) accepts anything with the stream protocol and turns it into a secure stream. We've done a lot of work on that to make it CPython compatible, support SSLContext, certificates, etc.
CircuitPython version
Adafruit CircuitPython 9.0.0 on 2024-03-19; Raspberry Pi Pico W with rp2040
Code/REPL
import math
import time
import gc
import board
import audiomixer
import synthio
import audiopwmio
import ulab.numpy as np
SAMPLE_RATE = 32_000
MIXER_BUFFER_SIZE = 2048
audio = audiopwmio.PWMAudioOut(board.GP18, right_channel=board.GP19)
mixer = audiomixer.Mixer(channel_count=1,
sample_rate=SAMPLE_RATE,
...
@bablokb Thank you, it's good with me. Didn't know that GH-codespaces had that limitation.
Do you all want to stick with the current line length? I personally like 120, but have no strong preference...
I think it would cause a lot less churn to stick with the current length, since otherwise parameter lists, etc, might be rewrapped onto one line.
A "once" waveform cannot in general interpolate between the last and first entry. This would, for instance, make a sweep with waveform [0, 37678] be wrong: it would become a triangle waveform. So, something "had to give".
My choice was to change how a once_lfo=LFO(once=True) interpolates across its cycle, compared to a normal_lfo=LFO(once=False): Consider the case when phase is exactly .999: normal_lfo.value should be almost exactly waveform[0] (plus a tiny bit of waveform[3] in ...
The separate flash may be under the can on the module. A few chips even have them in the package.
I've run into many gaierrors in the past with requests projects that are online 24/7. I think it's wifi or dns lookup related. Used to get them all the time with 8.2.5, updated my main project to 8.2.7 and haven't had any issues. I think a lot of it also might have to do with the way the socket is continually retried inside a while loop.
Gai Error might be in part due to syntax <#help-with-circuitpython message>
response = requests.get(DATA_SOURCE).json()
response.close() # this has issues closing sockets and can lead to gaierror if using an explicit response.close()
vs
response = requests.get(DATA_SOURCE)
json_response = response.json()
response.close() # this is a little longer but plays much nicer with socket close
``` I haven't encountered a gaierror since about 8.2.5. It has more to do with syntax and placement of additional requests within a while true loop. it can allow it to iterate too many times if a failure occurs. instead of gracefully failing a gaierror is a crash. i think what i did to get around it just a general exception handler that will break or trigger microcontroller.reset. i've literally never had to touch it since. it's probably been up and running flawlessly for more than a month now.
snippet to try ```py
while wifi.radio.ipv4_address:
try:
print("| | Attempting to GET Weather!")
if debug_OWM:
print("Full API GET URL: ", DATA_SOURCE)
print("\n===============================")
with requests.get(DATA_SOURCE) as owm_request:
# uncomment the 2 lines below to see full json response
# warning: returns ALL JSON data, could crash your board
# dump_object = json.dumps(owm_request)
# print("JSON Dump: ", dump_object)
try:
owm_response = owm_request.json()
if owm_response["message"]:
print(f"| | β OpenWeatherMap Error: {owm_response['message']}")
owm_request.close()
except (KeyError) as e:
splash_label.text = "Getting Weather..."
owm_response = owm_request.json()
print("| | Account within Request Limit", e)
print("| | β
Connected to OpenWeatherMap")
i will be updating it to 9.0 soon
CircuitPython version
Adafruit CircuitPython 9.0.0-beta.1-52-g84e937f1c4 on 2024-03-20; Raspberry Pi Pico W with rp2040
Code/REPL
import board
import bitbangio
import digitalio
import time
def doit():
with digitalio.DigitalInOut(board.GP13) as en:
en.switch_to_output(value=True)
time.sleep(1)
with bitbangio.SPI(clock=board.GP15, MOSI=board.GP14) as spi:
spi.try_lock()
spi.configure(baudrate=1...
Fixes https://github.com/adafruit/circuitpython/issues/9074
Manually verified with this code before and after the change.
import board
import bitbangio
import digitalio
import time
def doit():
with digitalio.DigitalInOut(board.GP13) as en:
en.switch_to_output(value=True)
time.sleep(1)
with bitbangio.SPI(clock=board.GP15, MOSI=board.GP14) as spi:
spi.try_lock()
spi.configure(baudrate=10, polarity=1, phase=0, bits=8)
...
Figured out what is responsible for changing all the LF's to CRLF's. It's Github Desktop. Here's a file in Notepad++ with line endings specifically setup to do LF and save as Unix. As soon as I import into Git it changes them and notifies me about it with a yellow warning.
Is it possible to set the "board description string" during init vs at compile time?
Alternately, is there an informational string which can be set during init?
anything you print in boot.py goes to boot_out.txt
not sure where exactly you want to have access to that string?
Let me try to clarify: I am talking from the firmware for the board.
Is there any text which can be set in the board_init() which is accessible to a user from their code.py?
I don't think there is.
I mean you have access to everything in memory, you could just set some string in any module
most everything "in a module" is designed to be read-only, so that it goes in flash. Module dictionaries are read only, and of course strings are all immutable. So, it'll be more than just putting something in board init, unless there's some facility that already exists and I'm just not thinking of it.
@tannewt thanks for the log, I will try to find other keyboards to test with, and also look more at the log.
you could put a function in board module that returns the value in question, that might be easiest
board.submodel() or whatever your goal is
or you might be able to make the whole board module MP_DEFINE_MUTABLE_DICT but that also allows unlimited user modification (and I'm not sure that really works across soft resets)
I was not aware of board.submodule(). I will look for an example.
The issue is not a showstopper but it could be useful to the end user.
oh, that is something I just made up
you can put about whatever you want in the board module, you could make your own function
I tested this out locally and it does look like it's working successfully to me. The contents of the local RSS are now intermixed and represent reverse chronological order of release. This does feel like it's most correct to my mind, I would be in favor of merging this change.
With that being said, practically speaking inside of "FeedR" (Android RSS reader app) it doesn't seem to make a difference. Both the local feed from this branch, and the currently live feed on the real site are sorte...
I'm back on an old idea: introducing a deinitialized TYPE. I believe that overall this can reduce code, but it entails a bunch of changes. This is only compile-tested on rp2040 macropad but it gives the idea: https://github.com/adafruit/circuitpython/compare/main...jepler:circuitpython:deinited-type2?expand=1
many "check for deinit" calls can be removed, because for instance once an I2C object has had its type changed to Deinitialized, you can't call the C function busio_i2c_scan from Python code with that object anymore.
This change decreases flash usage by 356 bytes(!) and for some reason even frees up 16 bytes of RAM. That's enough that I feel like I must have messed up my measurements. The bulk savings may come from properly marking raise_deinited_error() as NORETURN, not sure.
@slender iron @tulip sleet while I shouldn't go further down this tangent road right now your thoughts would be valuable.
My main concern with this change is adding the time on there making it more difficult to maintain. Is there a way to do it without adding the 12:00 on there?
I can try it without the 12:00s.
addendum: 392 bytes saved on rp2040 macropad just by marking NORETURN but 0 bytes on trinket_m0. I think this is because with LTO, the compiler is able to effectively determine that raise_deinited_error() does not return. rp2040 doesn't use lto.
@gilded cradle do you know why 12 hours was being added to all the times? <pubDate>{{ board.date_added | date: '%s' | plus: twelve_hours | date_to_rfc822 }}</pubDate>
@onyx hinge probably to mitigate an issue with tiemzones or something
@onyx hinge - is there documentation or an example of a board with a custom function (or property) exposed to the end user?
@empty salmon not that I see with a full text search
This is an interesting idea. One question I have is how it would affect some singletons. Admittedly this could be pathological:
>>> import board
>>> i = board.I2C()
>>> i.deinited()
>>> i.unlock() # a harmless operation: works
>>> i.deinit()
>>> i.unlock()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Object has been deinitialized and can no longer be used. Create a new object.
>>> i = board.I2C()
>>> i.unlock() # works again
>>>
I can imagine a use case where you deinit `board.I2C() to do something DigitalInOut'ish on its pins, like force an I2C bus reset. Then you create it again. Would your change prevent that?
@empty salmon what name it that you're computing in board.c that's going to vary? Can you explain the use case?
@tulip sleet my proposal would make i.unlock() throw instead of being "harmless".
er the unlock-after-deinit already throws so that's fine, it would still throw
@slender iron In regards to that Parallel Display all in one board that's been keeping me up at night, at your suggestion, I've hooked D0-D7, WR,RD,DC,CS up to a logic analyzer and the results seem strange to me. I can clearly see the init sequence I have specified in the board.c, however, with commands sent without data parameters (ie 0x21, 0, i can see the 0x21 signal which lasts 10 milliseconds, however commands with data parameters only last for 7microseconds, with data parameters lasting 300 nanoseconds..
@tulip sleet - The use case is mostly theoretical at this point.
From my prior query, I have a board that will have a minor variance. Because of display availability, the board will ship with one of 2 displays. They are functionally so similar I would rather not end up with 2 firmware. Within board_init() I am able to detect which display it has and use the appropriate init code.
I was thinking it might be nice for the end user to be able to detect the variance from within their code.py.
It's not critical by any means.
here is an example of a function in board (defined in pins.c) that you would call and it would do something. It could query or use a value set in board.c.
Thanks @tulip sleet !
i wonder in the long run in we might just as well merge board.c and pins.c, since pins.c implements board π
I'm definitely thinking about this area of the code in the back of my mind. I want to remove all bulk resets which puts more reliance on finalizers and deinit. A related piece is preserving some objects outside the heap. This gets trickier with display busses that use I2C and SPI. I don't really want to allocate them off the heap just in case.
I wouldn't tell the user. Just make board_init() setup board.DISPLAY and don't worry about it
@onyx hinge it crossed my mind to try and "move" management of memory from the VM to TLSF at the end of the VM's execution.
the memory would stay in the same place, it'd just change who manages it
@slender iron - that is my plan.
TBH: the value of having a board function is really for support in the event of an issue being reported.
how are you detecting the difference? could you tell from a photo? that's one of the first things we usually ask for
I had a similar idea back in the day, but sort of the reverse: I was going to turn supervisor allocations into GC allocations whenever the GC was available.
is the board embedded in a case? Otherwise I'd suggest you mark the actual physical board to distinguish them
so you don't have to depend on software to distinguish them
from a support point of view (suppose one display turns out to fail more often) I think that might be better
.. leading zeros are required for frontmatter to treat them as dates
rather than strings, apparently per the YAML specification.
This was done by script:
import re
import datetime
import pathlib
import sys
import frontmatter
rx = re.compile(r'^(\s*)date_added:.*$', re.M)
for path_str in sys.argv[1:]:
print(path_str)
path = pathlib.Path(path_str)
post = frontmatter.load(path)
date_added = post.get("date_added", "")
if isinstance(date_added...
I will add something to the silkscreen on the board to denote difference.
The other value to "being able to detect in code" is I typically develop a library of example code and if there was a reason to "do something different" then I could detect in code.
Again, "nice to have" vs "important to have".
@slender iron ESP-IDF v5.1.3 broke pin wakeups that go high to wake up. I keep editing my post in the issue to add details. I have tracked down some IDF changes about this. I am going to see if this is a regression that was fixed later.
you could test with my 5.2 branch
if it's working sure
ya, I had to roll back the i2c changes but it boots and runs
the camera code stops working once I insert an SD card so I need to debug that
i cloned your repo but the main branch seems to be way out of date. I'm confused. I know you forked from micropython, not circuitpython
I never update main
ha!
I only have feature branches
and you never delete branches either π
git switch -c feature_branch adafruit/main
I never delete anything if I can help it π
I just buy bigger hard drives
bundle was released overnight!
how did it get kicked to run again?
I clicked the "Enable workflow" button
so it gets unenabled every 60 days if something-something doesn't happen? I missed part of that discussion
ya, if the repo has no commit activity
jim said 1.23 is a couple weeks out and has no mpy version changes
1.24 may not have mpy changes either
sounds good; I could do the merge, and can also work on upstream PR's
I think we did want to block the bulk reset removal on it
@tulip sleet I released the GPS library, thanks for the quick fix.
I assume that happened as a result of the release I did yesterday
I decided it was too easy not to do immediately
sure, I will await a good starting point
@dtorres-sf I reproduced this problem, and started to track it down, as noted above. I think it may be a bug in ESP-IDF, not in our code. However, we are going to upgrade to ESP-IDF v5.2.1 in CircuitPython 9.1.0. When I test with ESP-IDF v5.2.1, the problem goes away.
So at this point, I don't think it is worth a temporary fix for this.
We should have a beta 9.1.0 fairly soon. In the meantime, could you stick with 8.x.x? Another alternative, if easy for you, is to make your pushbutton p...
@dhalbert thank you for the quick investigation, root cause, and suggested workarounds. We can definitely stay on 8.x.x and then retest on 9.1.0 when that is ready and upgrade our boards. Thanks again!
is there a trick to running pre-commit on M1 Macs?
what's the issue, is it the Python version?
not sure the exact issue other than it appears to have issues with importing modules
it also happens on my intel mac so it doesn't appear to be related to the system architecture for me
[end of output]```
likely an issue with my setup
Today is March 22, 2024 so this looks to be updated with the latest boards. Now I have an RSS feed for CircuitPython.org latest added boards. This is great! Thank you.
This sort of issue is a good reason to consider using a venv.
@ornate breach it's a problem with very old pylint (still required in some of our repos). If you search the channel for "impimporter" you'll see other folks who've run into it. (including me) in github CI we've pinned python3.11 for running pre-commit for this reason. #circuitpython-dev message
old pylint + specific install method used by pre-commit + python 3.12 = broken
oh okay, that makes sense. somehow my intel mac is still on python 3.8 xD
my mac mini is on 3.12 though
there's currently some interest in switching to ruff, which would replace pylint. which would be yay
Moving back to 9.x.x because it depends on espressif (hopefully) updating esp32-camera.
@slender iron so 5.2 can't be in 9.1.0 because you need I2C updates for espcamera? I thought that both the old and new i2C APi was available, but maybe that was in 5.1.x.
it can be but not the I2C API update
both are available in 5.2
I noticed while testing the other RSS feed changes that the images weren't loading successfully (at least in the client app I tested which was FeedR on Android). They appeared as "broken image" icons.
Inspecting the code of the feed item within the app revealed that the image URLs were relative rather than absolute. When the page gets rendered in an HTML page that works fine because the client browser will know it's relative to the host of the page being viewed.
I don't know if RSS spe...
Interest * 1000
I'm wondering what it would take to add displayio to the unix CircuitPython port. I would like to do unit tests for displayio. I've also uploaded the executable to ChatGPT and can have it write and run code for me.
If you publish a lot more frequently to the local MQTT broker, does it fail faster?
We would be quite interested in a test program that is a minimal (fast) reproducible example. For instance, if you send fake data as opposed to actually reading the sensor, does it make any difference?
No, in fact is seems more stable. I have reduced the code to an endless loop that merely sends random data to the local broker:
while True: ...
Does anyone have a minute to walk me through the process of getting a valid CREATOR / CREATION ID to submit a new board? I believe I have something worth submitting in terms of popuarity, price point, and features. I think I get it, but want to make sure I do it right..
I'm crying out for something like this! I have a 5x Rotary Encoder I2C Expansion Board with MCP23017 - I can read the raw values from the pins but having IncrementalEncoder would be a huge help!
or i guess there's no reason not to use the UUID mapper, given the lack of branding of the hardware
Make a PR to here: https://github.com/creationid/creators
you can make a creator ID for the board designer and then a separate file for the board ids
I'll give it a go..
Do you know about Blinka and https://github.com/adafruit/Adafruit_Blinka_displayio ? You can run CircuitPython code on CPython on Linux.
This is handy, Iβm gonna get added π
~~Hi! I'm working on adding a new board to CircuitPython and I'm almost done. The board is an ESP32-S3, and for some reason, the only way I can get it to properly install is by flashing the tinyuf2 combined.bin bootloader to the board with esptool.py, then install the firmware.uf2 that I've compiled. I've tried just flashing the firmware.bin (and tried the circuitpython-firmware.bin) that I've compiled, but those don't seem to work. I've also found, in the build directory/esp-idf subdirectory, this flash_args file:
0x0 bootloader/bootloader.bin
0x410000 circuitpython.bin
0x8000 partition_table/partition-table.bin
0xe000 ota_data_initial.bin
I'm able to locate the bootloader.bin and partition-table.bin files, but the other 2 files aren't anywhere in the build directory. Is there something I'm missing about how .bin files get built for Espressif boards? Just to reiterate, the .uf2 file works fine~~
edit: sorry, this can be ignored, I think I just needed to do a make clean
is there a rhyme or reason to the creation ID we assign in the last 2 bytes?
@h-milz This works for me, when #define ULAB_SUPPORTS_COMPLEX (1). You have to give the dtype explicitly.
Adafruit CircuitPython 9.0.0-1-gdc69c29dac-dirty on 2024-03-22; Adafruit Feather RP2040 with rp2040
import ulab.numpy as np
np.array([1,2,3])
array([1.0, 2.0, 3.0], dtype=float32)
np.array([1,2,3+0j])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
np.array([1,2,3+0j], dtype=np.complex)
array([1.0+0.0j, 2.0+0.0j, 3.0+0.0j], dtype=com...
As a point of interest, turning on complex support made the RP2040 CircuitPython firmware about 12kB larger.
Hey @lone axle I updated my community bundle PR https://github.com/adafruit/CircuitPython_Community_Bundle/pull/209
Hi! This is my first attempt at adding a board to CircuitPython, I just received a Waveshare ESP32-S3 GEEK,
and noticed it wasn't yet supported in CircuitPython, so I did my best to follow the "How to Add a New Board to CircuitPython" guide on the Adafruit website. I've also tested the firmware built by my configuration files, and everythi...
@dhalbert : Note on Adafruit-Playground is available:https://adafruit-playground.com/u/picofun/pages/using-github-codespaces-for-circuitpython-development
@h-milz This works for me, when
#define ULAB_SUPPORTS_COMPLEX (1). You have to give thedtypeexplicitly.
This is actually a good point. I should, perhaps, inspect the arguments of array, and depending on the results, decide on the dtype. But that raises a question about the design concept: array defaults to float, because float was the most-inclusive dtype at the beginning. We have added complex since, so, if we don't want to default to complex, then we can't really save the...
I don't think ntp is useful without a complete and current timezone-database. Translation to the correct local time is complicated. A better approach is to query an api that directly returns the correct local time.
@bablokb I have added a page in the Building CircuitPython guide that points to your Playground note. I will also blog it on the Adafruit blog.
I should, perhaps, inspect the arguments of
array, and depending on the results, decide on thedtype
@v923z That would make it work more like numpy, I suppose. You would know better if there are any traps introduced by such a change. It would require scanning all of the input values, since the user might have passed in, say, a mixed int/float list. I'm not sure if that counts as an expensive operation or not.
Something slightly mnemonic is often chosen, or if the mfr part number can be used, that's good too. But as long as it's unique, it doesn't really matter.
For creator ID's, if the mfr has a USB VID, that's a good choice.
I posted this issue up in the forum (https://forums.adafruit.com/viewtopic.php?t=209383), but have gotten no responses, so I figured I would post the issue here.
Currently running CircuitPythone 8.2.6 on Raspberry Pico W.
My code looks like the following snippet:
===================
import adafruit_sdcard
import storage
....
sdcard = adafruit_sdcard.SDCard(spi1, digitalio.DigitalInOut(sd_cs))
vfs = storage.VfsFat(sdcard)
//# The following line FAILS if there is NO Termina...
I don't think this is a generic CP issue, I no longer have a keyboard feather wing but I'm pretty sure I used to mount SD cards on the keyboard feather wing with CP 7.x and 8.x using a Raspberry Pi Pico without a terminal connected. I do the same thing regularly using Espressif chips/boards using CP 9.x.
I have seen intermittent mount failures with some SD cards after soft board resets and have taken to ejecting and reinserting the card and/or power cycling the board if I encounter mount ...
Which SD breakout or accessory are you using? Could you show the wiring in a clear picture? (The current pictures are unfortunately pretty blurry.)
Also try sdcardio instead of adafruit_sdcard, though that may not be the issue. sdcardio is native and will be faster.
I don't have a board to test with so I just looked over the pin assignments
I'm thinking a BUTTON pin would be nice
// BUTTON
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) },
Thanks! I've added this now, along with formatting changes per the pre-commit GitHub action.
I think this is a typo, LCD_DC is supposed to be GPIO8
Good catch, you're right, I'm going to re-test the firmware on my board with that change before committing the fix, because I'm surprised the LCD even works with that pin being incorrect.
Does CP support yield from?
I'm not sure what the "standard" is here, but just a thought, if it was me, I think I would name this SPI bus SD_SPI to avoid any possible confusion with the LCD SPI channel and in case it's possible to build another SPI channel using free GPIO pins.
it should. I was confused by the mpy-cross error you got in that library. This works, for instance:
>>> def g():
... for i in range(3):
... yield i
>>> list(g())
[0, 1, 2]
>>> def h():
... yield from g()
>>> list (h())
[0, 1, 2]
but there are bugs: https://github.com/micropython/micropython/issues/9651
I ask, because I was working through the ruff library tests and got that in pycamera. I'll make the change and see if I can compile it
Here are the ones I needed to ignore:
["PLR2004", "UP028", "UP030", "UP031", "UP032"]
from here: https://docs.astral.sh/ruff/rules/
Would be curious if anyone thinks we shouldn't ignore any of those...
That makes sense to me. Would anything need to change with the mpboardconfig.h SPI definition? https://github.com/adafruit/circuitpython/blob/e79e04cb29e352a836eb0665777167825f03e3e8/ports/espressif/boards/waveshare_esp32_s3_geek/mpconfigboard.h#L38-L40
PLR2004 I can understand suppressing, because a lot of the "magic" numbers are definitely fixed and don't need naming. Plus names take space and are slower.
UP028 if it works is good (yield-in-for-loop)
UPO31 (don't use consecutive {0} {1} etc.) is worth appying
UPO32 (f-strings) I would also fix because it's almost always better and smaller
okay, yield from compiled fine...
I worry on UPO32, since if could update something to break with these: https://docs.micropython.org/en/latest/genrst/core_language.html#f-strings-don-t-support-concatenation-with-adjacent-literals-if-the-adjacent-literals-contain-braces-or-are-f-strings
I would just fix those particular cases as needed
does mpy-cross fail if it's an invalid f-string style?
ok, it's a mystery, mpy-cross ingesting the yield from in https://github.com/adafruit/Adafruit_Blinka_bleio is fine. I don't know why that failed during the CI build
mpy-cross is just the interpreter, more or less, so you can just test the construct in the REPL or in a program
I don't think it fails hard, it gets the wrong result
So I would worry someone writes code, run lints, changes it to an invalid f-string and it isn't tested and caught...
there are few or no examples of compile-time string concatenation in the libraries. I wouldn't worry about this as a blocker on converting to f-strings in general
it just means the PR's that change code need review by humans
which should happen anyway
I don't think so but the other two examples (Espressif:M5 Stack Cardputer/Raspberrypi:Cytron EDU Pico W) I spotted used a different construct in mpconfigboard.h
#define CIRCUITPY_BOARD_SPI (1)
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO18, .mosi = &pin_GPIO19, .miso = &pin_GPIO16}}
I'm not sure that's necessary though, I suspect the existing DEFAULT_SPI_BUS statements will also work.
Is there a way to speed up refresh rate on eink in CircuitPython? The refresh rate on the default program that came with this thing was super zippy, and in CP, it's significantly slower. I know there are things built in to keep it from refreshing too often, but I don't understand why the speed is affected. The default program had a menu chooser, and flipping between things was super fast and responsive. It was likely MicroPython.
I expected that part to remain the same, but displaying this rectangle is super slow.
I guess I'm not sure what refreshing text or refreshing based on button presses looks like, I haven't tried yet.
displayio is not that fast; If it was MicroPython it was probably using framebuffer, which is simple and mostly in C
but doesn't have groups, etc.
Ah fair enough.
Bummer.
I'll have to seriously rethink my plans for this board then.
I thought of everything based on the speed of the program it shipped with. π€·π»ββοΈ
which board?
Pimoroni Badger2040W.
I was going to try to implement a game or two. Turn based, not live action or anything. But I'll have to keep the speed in mind now.
Make it a badge, have something interactive, and remote control the LEDs I added to it.
The latter has no cares about the display speed. So that's easy enough.
I think it'll be fine, it's mostly rearranging my expectations is all.
you could have someone review your displayio code. There may be ways to speed it up. I ma not the greatest person for that though, I've never written a significant displayio program from scratch
Looking at the schematic, it also looks like the board would support 4 bin SDIO connections. I don't have any experience with using that but I believe sdioio.SDCard should support it so you may want to at least add the SDIO D2 pin GPIO38
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
It could be confusing to add six specific SDIO pin names since some of them overlap with the SD_SPI pins.
Tim is going to be helping me with the whole thing, I'm sure he can help there as well.
Thanks for the suggestion!
There's almost nothing to it at the moment. I haven't done displayio stuff either, really. So I'm struggling to even get a rectangle to display. π
The screen is black, but only a third of it should be, so obviously I don't know what I'm doing.
Β―_(γ)_/Β―
Fun little board, though. No RGB LEDs so I soldered a STEMMA QT cable to a NeoPixel stick, and tah-dah, RGB LEDs. I'll incorporate it into the 3D printed case we're designing.
Alright, lunch time here. Thanks for the info and suggestion, @tulip sleet! Appreciated as always.
6 draft PRs for BME680, NeoPixel, PortalBase, PyCamera, PyPortal and Requests. All have commits in this order:
- Add ruff formatter
- Add ruff isort
- Add ruff lint
- Add ruff upgrade
- remove upgrade UP028
- remove upgrade UP031
- remove upgrade UP032
Happy to add to in-the-weeds if this would be a good use of time
Thanks!! Yes, the details could be mentioned if there's something to decide on
In looking at the board's example MicroPython code, they're not using pin 38 in the SD card example:
spi = machine.SoftSPI(
baudrate=10000000,
polarity=0,
phase=0,
bits=8,
firstbit=machine.SPI.MSB,
sck=machine.Pin(36),
mosi=machine.Pin(35),
miso=machine.Pin(37))
...
That's correct, the example is using SPI mode but the hardware has been implemented to support both that mode and the 4 Pin SDIO mode.
Notice the two columns of pin names at the bottom of the schematic section. The Left column are the SDIO pin names and the second column are the pins names for using SPI mode.
Many thanks,
requested a pid over there ;')_
On Tue, Mar 19, 2024 at 2:14 PM Dan Halbert @.***>
wrote:
Note https://pid.codes, if your product is open source.
β
Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/pull/9060#issuecomment-2007147353,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJRTN25D6R7CHSTX5DG673YZA24PAVCNFSM6AAAAABE5FB6MWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBXGE2DOMZ...
Curious, why does it need to be timezone aware?
Not working yet.
I've changed your mpconfigboard.mk to include Adafruit_ESP32_Spi library as frozen module.
`
USB_VID = 0x2886
USB_PID = 0x80F4
USB_PRODUCT = "Seeeduino Wio RP2040"
USB_MANUFACTURER = "Seeed"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
CIRCUITPY__EVE = 1
CIRCUITPY_PICODVI = 1
Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI
FROZEN_MPY_DIRS += $(TOP)/frozen/Ad...
I've looked over the pins and while adding a generic pin for GPIO38 seems to me like a plus I don't see any problems with this as it's now configured.
As a user, I'd say the current way it works is probably okay (float as a default), as long as the documentation is in sync (i.e., https://docs.circuitpython.org/en/latest/shared-bindings/ulab/numpy/index.html).
I've looked over the pins and while adding a generic pin for GPIO38 seems to me like a plus I don't see any problems with this as it's now configured.
Thanks! I've added Pin 38 as an available GPIO pin now.
Just out of curiosity, why is 120m unstable?
With ESP-PSRAM64(H) chips, I didn't have a single crash due to psram.
It's a supported frequency according to the datasheet. Is there an idf timing issue?
If you want to look at a simple game example, I have this here: https://github.com/skerr92/KeyBoy/blob/main/Firmware/Games/Loose_Cows/Loose_Cows.py
Itβs a cute little game to catch cows in a field
Using displayio (with st7789 TFT though)
@ornate breach Yeah this is an eink, so it has to be something pretty static, and definitely turn based so there's an obvious reason to pause while it refreshes. π
This is neat though!
Yeah, makes sense. π I figured it would be a good reference either way. It took me a bit to figure it all out with displayio
I get so mired in all of it. My brain starts to glaze over.
It's frustrating because I can write LED code with my eyes closed, but displayio is like a completely separate language.
But that is due to my history with coding, heh. I recognise that.
Itβs still a fun journey with displayio currently. I made one game and am working on others but it definitely takes a bit of mental fortitude to push through.
I'm lucky to have Tim excited to help me out with it. π
Tim is really great at that kind of stuff, itβs definitely awesome of him to lend his talent π
He wrote Snake for my last badge. This time we're coming up with some ideas, some more complicated than others. We'll see what happens. I'll definitely share the final result. π
This is true. The syntax used in led animations and displayio might as well be two different languages. Think of it like this. If you had a wall of LED strips, perhaps even a wall of matrices, you'd want to find a way to output things to them in the most efficient way... and with layers. That's all displayio does. Pixels are pixels. π
I had an LED wall for over a year. Never put one up in my office here.
I can't even call show() anymore in displayio. EVERYTHING CHANGED. :lolsob:
(I legit learned that today.)
Syndrome proved we can chain up to 25 matrix panels on a Matrix Portal S3. Matrix panels are a far more effective (and expensive) way of having a wall full of pixels.
I'm sorry
Hah! Probably less work to mount as well.
aww. yes. there was transitional code for show from 8x to 9.x and would be deprecated in 9.x There are sooo many breaking changes in 9.x that it's kind of like learning circuit python all over again.
Ok I seriously just burst out laughing at this. Thank you.
It should be worth it though. 9.x has a ton of great improvements.
I should, perhaps, inspect the arguments of
array, and depending on the results, decide on thedtype@v923z That would make it work more like numpy, I suppose. You would know better if there are any traps introduced by such a change. It would require scanning all of the input values, since the user might have passed in, say, a mixed int/float list. I'm not sure if that counts as an expensive operation or not.
It's not cheap. The float-int distinction wouldn't even cut it, be...
@v923z I'm not pushing for it, just wondering. @h-milz I will close this now because I think it's all explained. If not, please reopen.
finally figured out the CRLF issue for windows users. Go to C:\Users\Username\.gitconfig and modify ```py
[core]
autocrlf = input
This stackoverflow topic had the answer https://stackoverflow.com/questions/71995658/how-to-stop-github-desktop-from-changing-my-line-endings
autocrlf = false will fail. autocrlf = true will fail. autocrlf = input works.
Looks like I missed 1 example. Updated Youtube API example.
NTP returns time in UTC (i.e. UK-time). But most of us don't live in UK, and we want our devices to run with local time. So you need two things: the device must know it's timezone and it must have all the logic and data available to convert UK-time to local time. So it must know the offset, the exact dates for DST-switch and so on.
You can hard-code all of this for your specific location, but as soon as you share your code other users will have problems.
So it is much simpler to query ...
Be able to set the connection timeout is crucial in asyncio environments.
That's actually a bummer as I'm porting the MiniMQTT lib to asyncio to get a fully non-blocking experience. So at least for the connection phase it won't be that "non-blocking" for now.
In my case I would set the connection timeout very small and build a asyncio based retry mechanism on top. That would give other tasks time to run during connection failures.
So requiring this, would set the RTC time, and thus if you used local time in your project it would cause issues?
I always set my RTC to UTC and when I want to display it translate it. This way I don't need to adjust the RTC for things like daylight savings (summer time) or when it changes timezones.
That is what you usually do on PCs/laptops. But how will you do this on a MCU with limited amount of memory? And I am talking about programs you can put on Github that others can download and just use, without tinkering with the adjustment logic. With CircuitPython, we don't have a complete datetime.datetime module or any of the datetime.tz* modules. Unless you use adafruit_datetime as an addon-package. But that library has a large memory footprint as stated in the Readme.
From the t...
I hear your points, and not arguing for or against. It would be nice if you could turn it on or off, or pick a build that had it enabled. I'll have to do some footprint comparisons in my own time.
I understand the goal of copy/paste code. I use the following for simple apps, which I find works fine on MCUs
import time
OFFSET = -60 * 60 * 5 # currently in CDT
def get_local_time(offset=None):
if offset is None:
offset = OFFSET
return time.localtime(time.mktime(tim...
general question: Has anyone considered the potential for implementing a VNC server in CircuitPython that could present itself to a host computer over USB ethernet? I'm thinking of how:
- macOS Finder has a built in VNC client, and I'm guessing VNC is also easy to do on Windows and Linux
- Potentially VNC over USB-Ethernet would avoid the problems of DNS and TLS certificates that make it difficult to do HTTP-only web GUIs unless your server is running on localhost
Context for the VNC over USB-Ethernet idea:
- https://github.com/adafruit/circuitpython/pull/8831 (Add UVCFramebuffer to allow CircuitPython to send video to a host computer)
- https://forums.adafruit.com/viewtopic.php?p=1001421#p1001421 (#CircuitPython2024: IP over USB)
One of the main use cases for such a thing would be to let a small, cheap device present a big comfortable configuration GUI without having to add a large display to your BOM.
CircuitPython version
9.0.0-stable
Code/REPL
# SPDX-FileCopyrightText: 2024 Tyeth Gundry
# SPDX-License-Identifier: MIT
# the dotstar should use SPI pins, they'll be natively better setup for it.
# Neopixel on A3, POT on A2, dotstar on gpio 35+36, tacho on MISO, 4PST on
# A0(GPIO18),A1(GPIO17),SDA (GPIO7),SCL, mosfet on TX (GPIO5)
#
# NeoPixel on A3 (GPIO8)
# Potentiometer on A2 (GPIO9)
# DotStar on SPI pins:
# Data on GPIO35 (SCK)
# Clock on G...
I tried to reproduce this on a QT PY ESP32 Pico with the following code.py:
import analogio
import board
import time
potentiometer = analogio.AnalogIn(board.A2)
while True:
print("Hellorld!",potentiometer.value)
time.sleep(10)
I got the same error after a soft reboot:
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 6, in <module>
es...
That could explain something. I had it written initially for a QTPY S2, and
thought I'd seen valid values, but to be honest can't be sure. I did just
realise at the pub I'm probably using analogio or the pin incorrectly.
On Sun, 24 Mar 2024, 18:10 RetiredWizard, @.***> wrote:
I tried to reproduce this on a QT PY ESP32 Pico with the following code.py:
import analogioimport boardimport timepotentiometer = analogio.AnalogIn(board.A2)while True:
print("Hellorld!",pote...
CircuitPython version
S3 Wifi vs Airlift WiFi initial negotiation timing.
I first noticed this issue around 8.2.3 to 8.2.5 where connecting to wifi (without web workflow env enabled) was taking 5-10 seconds vs almost instantly within milliseconds in prior versions. ESP32SPI (airlift) in particular was much much faster to connect to wifi.
Was told by Danh this was abnormal behavior and that both should be connecting at about the same instantaneous speed... at least to wif...
Next thing I tried was adding the sensors back, so the program was acquiring the sensor readings and sending the data to the broker in a tight loop, every 0.1 second or so. The main loop looks like this:
while True:
humidity, temperature, co2_ppm = sensors.get_measurements()
data = {}
fill_data_dict(data, batter...
Ok, rebased on main and integrated the demux keypad.
I also spend a couple of hours testing almost every switch and button I had lying around; that includes multiple keyboard switches, through-hole and face-plate-mounted buttons, and a rubber dome pad. Surprisingly, almost all read consistently with interval=0.001 and debounce_threshold=3. The noisiest switches required debounce_threshold=5.
From a typing perspective, I can't tell the difference between threshold values 3 and 5 (a...
Using CP 9.x I tried the wifi.radio.connect on an ESP32 Pico, ESP32-S2 and ESP32-S3 all of which executed instantly. I also tried connecting to WiFi using a Nano Connect RP2040 w/ESP32SPI and it did take a second or two to connect using a while loop.
while not esp.connect_AP(os.getenv('CIRCUITPY_WIFI_SSID'),os.getenv('CIRCUITPY_WIFI_PASSWORD')):
pass
I also threw the code.py example above onto an ESP32-S2 board and the first three output lines all printed with no noticeable...
That was a quick example and probably a bad one as that particular API does take a while to pull the JSON that's normal.
Would probably be better to use the standard wifi connect simpletest than an API. I think Anecdata might have some kind of testing tool for wifi socket connection timing.
I don't have any ready-made performance tests, but a couple of notes...
Airlift isn't CircuitPython core, so any issues there should be filed in the ESP32SPI library or NINA repo. NINA uses a much older version of the ESP-IDF, so it wouldn't be surprising if the performance is different (also, there is a Python library and an SPI transaction before it gets to the actual wifi connect C code, but those shouldn't be noticeable).
I've always assumed that wifi connection can take up to a cou...
Nice, thank you. I'm averaging 3.4s. Maybe it's just me but in the past it seemed like the connection time was more like .4 seconds and now it's taking 3 seconds longer.
It could be explained as simply as having my connection print statements right next to each other and what I thought was a faster connection was just the arrangement of my prints?
CircuitPython version
dafruit CircuitPython 9.0.0 on 2024-03-19; Raspberry Pi Pico W with rp2040
Code/REPL
import socketpool
import wifi
from adafruit_httpserver import Server, Request, Response
ssid = "Unintended Consequences"
password = "xxxx"
print("Connecting to", ssid)
wifi.radio.connect(ssid, password)
print("Connected to", ssid)
pool = socketpool.SocketPool(wifi.radio)
server = Server(pool, "/static", debug=True)
@server.route("...
Im not seeing slower wifi connect times with web workflow enabled either. Must have been my imagination. Sorry about that. :/
Yeah, keep the timing block as simple as possible.
If (web workflow) auto-connect is enabled ('CIRCUITPY_WIFI_SSID'), connection time in code.py should be virtually zero, since it's already connected. The core connection code checks for an existing connection and exits if it's already connected, so there is minimal code to run and the timing should be negligible.
For non-(web workflow)-autoconnect, a lot of things could be different over such a long span of time: RSSI, core code cha...
Ah ok. I had a fundamental misunderstanding of how web workflow launches then. It has to be just the way I was setting up prints back then. I've been using the same code snippets for wifi connection for a while. Perhaps the changes in connection speed prior to then was simply due to the way I used to do wifi connection prints.
We can go ahead and close this one unless anyone wants to look into it deeper? I'm not as confident this is a real issue anymore.
I think this is a known mismatch with the library version. Try this library branch:
https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/tree/reuseaddr
Either way, I get the same error when I get to "sock.setsockopt":
Traceback (most recent call last):
File "code.py", line 25, in <module>
File "/lib/adafruit_httpserver/server.py", line 186, in serve_forever
File "/lib/adafruit_httpserver/server.py", line 227, in start
File "/lib/adafruit_httpserver/server.py", line 205, in _set_socket_level_to_reuse_address
OSError: [Errno 95] EOPNOTSUPP
Same, tried the library you posted and getting the same error.
Adafruit CircuitPython 9.0.0 on 2024-03-19; Raspberry Pi Pico W with rp2040
Board ID:raspberry_pi_pico_w
Connecting to WiFi...
β
Wifi!
Traceback (most recent call last):
File "code.py", line 28, in <module>
File "/lib/adafruit_httpserver/server.py", line 186, in serve_forever
File "/lib/adafruit_httpserver/server.py", line 227, in start
File "/lib/adafruit_httpserver/server.py", line 205, in _se...
Tried using Connection Manager just to see if the socket management might change something
import os
import adafruit_connection_manager
import wifi
from adafruit_httpserver import Server, Request, Response
# Get WiFi details, ensure these are setup in settings.toml
ssid = os.getenv("CIRCUITPY_WIFI_SSID")
password = os.getenv("CIRCUITPY_WIFI_PASSWORD")
print("Connecting to WiFi...")
wifi.radio.connect(ssid, password)
print("β
Wifi!")
# Initalize Wifi, Socket Pool, R...
I believe the example being used is from the manual simpletest https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/blob/reuseaddr/examples/httpserver_simpletest_manual.py and it's throwing errors in 9.0 at least on the Pi Pico W anyway.
httpserver_simpletest_auto.py fails as well with the same error.
After trying a couple more examples from the repo couldn't get any of them to work on the Pico W.
There have been problems with MQTT keepalive timeouts in the past. I find the MQTT keepalive semantics confusing. But you should not be hitting an internal watchdog in any case.
I see in your setup documentation that there is some kind of 15 minute timeout on the local MQTT server. But are there other (default) timeouts that might be shorter?
Interesting update: Since my use case is actually making an AP, I tried this code.py:
`import socketpool
import wifi
from adafruit_httpserver import Server, Request, Response, SSEResponse, GET
wifi.radio.start_ap('MyAP')
pool = socketpool.SocketPool(wifi.radio)
server = Server(pool,debug=True)
print(wifi.radio.ap_active)
@server.route("/")
def base(request: Request):
"""
Serve a default static plain text message.
"""
return Response(request, "Hello from the ...
I'm getting the same result for that too. Interesting error message lol.
I think the way its written in the library, the except only runs if the type of error is AttributeError. Since the type of error actually being thrown is OSError , the the error is just raised instead of handled.
As to knowing the actual cause of the error, I'm way out of my depth. I just wanted to display a lil' sensor reading, and I thought this would be faster than hooking up a display π
re: non-existent variable- Try power cycling the pico, the wifi hardware might still be conn...
That makes sense, all of it. Thanks. Can always add AttibuteError as a separate exception. I'm not sure if that will have any negative effects but for now it is a workaround for this specific issue.
def _set_socket_level_to_reuse_address(self) -> None:
"""
On systems that have SO_REUSEADDR, prevents "Address already in use"
error when restarting the server.
"""
try:
self._sock.setsockopt(
self._socket_sourc...
This should get sorted out in the library. If I understand it correctly, if the .setsockopt call can't be run (by removing it, or catching any exceptions), the server should still work, but there may be edge cases where it will run out of sockets.
Out of curiosity when did you see the [Errno 112] EADDRINUSE? I can hit the server a bunch of times successfully:
10.0.1.33 -- "GET /" 380 -- "200 OK" 125 -- 63ms
10.0.1.33 -- "GET /" 380 -- "200 OK" 125 -- 190ms
10.0.1.33 -- "GET /" 380 -- "200 OK" 125 -- 95ms
10.0.1.33 -- "GET /" 380 -- "200 OK" 125 -- 44ms
10.0.1.33 -- "GET /" 380 -- "200 OK" 125 -- 144ms
and lots more...
When I hit file save in Mu. Apparently once you get the server up and running you shouldn't attempt to save code.py again? If I leave the server running yes I can refresh the browser as many times as I want without issue.
Looks like this is more than a library issue... I don't think SO_REUSEADDR is implemented in the raspberrypi port
https://github.com/adafruit/circuitpython/blob/ac66da21fe33567c50f5716bf040ce5c88e1e12b/ports/raspberrypi/common-hal/socketpool/Socket.c#L1186
Probably the testing so far has been with espressif
@jepler, do you think mp3 decoding will be add to esp-s3 board port ?
thanks
There have been problems with MQTT keepalive timeouts in the past. I find the MQTT keepalive semantics confusing. But you should not be hitting an internal watchdog in any case.
I see in your setup documentation that there is some kind of 15 minute timeout on the local MQTT server. But are there other (default) timeouts that might be shorter?
The 15m cache timeout is only used in the MQTT Exporter (I had original problem with data not getting through over the WiFi for some reason ...
Trouble with UVC: When I enable UVC on my Raspberry Pi Pico the pico fails to boot. I can enter safe mode and remove boot.py and then it will boot.
# boot.py
import usb_video
usb_video.enable_framebuffer(32,32)
Adafruit CircuitPython 9.0.0-6-gac66da21fe on 2024-03-23; Raspberry Pi Pico with rp2040
I get the same result with Adafruit CircuitPython 9.0.0 on 2024-03-19.
untested
In #9081 it was noted that the raspberrypi port doesn't implement setsockopt for the case required by httpserver.
(neither do SSL-wrapped sockets but that's another matter)
I appreciate your testing. Did you try with a longer interval, such as the 0.008 you suggested? I think I will leave the current defaults alone for now. The overhead of the interrupts is lower with 0.020, and for most people, the current defaults seem fine. I did some testing with tactile switches and keyswitches when I chose that value. Those who are using keypad for a performance keyboard can decrease the polling interval. It would be good to write this up somewhere once it's merged.
I didn't immediately reproduce a problem on:
Board ID:adafruit_macropad_rp2040
UID:DF609C80673F1B26
boot.py output:
```with boot.py:```py
import usb_video
#usb_video.enable_framebuffer(128, 128)
usb_video.enable_framebuffer(32, 32)
```and no code.py. However with the framebuffer size set to 32x32 I don't get any video, either (I get an all-green frame, which may be just the behavior of qv4l2, the linux program I use to display usb video). At 128x128 it does work. I don't know why 32x32 would not work, though. I recommend filing an issue, especially since I didn't see quite the same behavior you did.
no board crashes though
I'm going to learn guides doing updates that match a recently submitted PR in the learn repo and noticed this:
It seems like this warning should be removed to me, at this point it may cause more confusion than help since it references old versions that are no longer listed by default.
Should I remove that while I've got this guide open or just leave it?
oh, sure, that's really old
I think this may have been among the first of the displayio projects
@onyx hinge We required SOREUSEADDR in 9.0.0, but it turns out that setsockopt in Pico W only implements one thing in common_hal_socketpool_socket_setsockopt(). Should it just call the lwip setsockopt routine instead? I was surprised.
lwip_setsockopt isn't available, because it requires the fd-based layer and that cascades into a whole bunch of stuff
so we get to reimplement the bits we need π
i will see what needs to be done to implement REUSEADDR, unless you think it's impossible. Should go into 9.0.x. I thought your refactoring of lwip would add this, but you're saying it's too much code?
also saw this:
// All socket options should be globally distinct,
// because we ignore option levels for efficiency.
but the common-hal does look at the option level
i don't know if that's you or something copied from MPy
@tulip sleet in micropython it's lwip_socket_setsockopt in extmod/modlwip.c
thanks, can just do what that does for SOREUSE
so that comment above is obsolete and will be more obsolete, I think
Any Learn Editor ninja's in here? I'm trying to update these links to point to their new places in the docs:
So far the only one I changed is BusDisplay but I can't seem to get the bold to get re-applied
take a look at https://github.com/adafruit/circuitpython/pull/9082 ?
In the edit view the text does show as bold:
were you already working on this or did i provoke you π
well I mean the bold dropdown and and switch are enabled, within the preview the text does not visually appear bold like the other pre-existing links that I haven't touched yet.
i think we started at the same time, I didn't see the email
@onyx hinge could you base it on 9.0.x?
@tulip sleet oh sure!
The actual HTML can be messed up. Check the <> option in ...
Weird, if I delete the text entirely make new text and make it bold it appears bold at first but as soon as I add the link it visually reverts back to not bold.
Ooh thank you
I never knew there was a way to access the plain HTML π€―
I have a lot of trouble with "contagious" formatting tags in Learn. Like, try to add a non-code-formatted period after a code-formatted word. Easiest thing to do is to hint enter to start a new paragraph, type the . and then delete the new paragraph newline
Okay, I think I figured it out. Thanks again.
The front end places <strong> tags outside of <a> tag but visually that order doesn't seem to be respected by the rendering. <strong> needs to be inside of <a>.
I think this is inherent in TinyMCE< which we use
update busdisplay docstring example code
Updated version targets 9.0.x branch.
that was weird, something (probably a github browser extension) suggested an entirely wrong title for that PR
So I've just tried to set up a Parallel Display Bus ILI9341 on an entirely different ESP32 and entirely different screen, tested functioning with Arduino_GFX library in the arduino framework, but I get the same visual garbage that I was getting on the all in one unit I've been trying to make work for a few days.. Seems to me like, while the Parallel Display Bus functionality might work for the Lilygo TDisplay S3, it does not work for at least some other setups.
anytime you see weird spacing check out the html view. another thing that can pop up is if you are copy/pasting text a bunch of <span> tags can sneak in
Good to know, thank you!
#9084 is meant to fix this. Could you someone test the build artifact? Thanks.
https://github.com/adafruit/circuitpython/actions/runs/8421732172?pr=9084
I'll close this for now. If someone wants to do a timing test matrix like, that would settle it one way or the other, I think.
| 8.2.0 | 8.2.10 | 9.0.0 | |
|---|---|---|---|
| web workflow | |||
| no web workflow |