#circuitpython-dev
1 messages · Page 81 of 1
nrf53 and 54
ah, okay. I'm on track to look at nrf52
clue would be fine. just add the circuitpy partition location. don't worry about the SD ones
I wrote this a long time ago, thinking it might be useful for shipping prepared CIRCUITPY filesystems, but it was never used and so I archived it: https://github.com/jepler/mkfatimg
Do we really need CircuitPython to support this? Would it be enough to have a folder -> fat filesystem -> uf2 converter? This would be orthogonal to CircuitPython except for placing the filesystem in the same place.
This would be ideal. Is there a way to pull out of a CircuitPython UF2 all the information needed to append the CIRCUITPY filesystem? It seemed to me this hypothetical tool would need to know some internals of particular CircuitPython builds in order to do that. And/or wo...
If you want me to change the flash partition addresses on that RP2350 board def PR, help understanding the correct start address and size would be welcome.
kk, lemme look
#define CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR (CIRCUITPY_FIRMWARE_SIZE + CIRCUITPY_INTERNAL_NVM_SIZE) https://github.com/adafruit/circuitpython/blob/457edc304a96c64596ae423ca9e3eebd3641fa6d/ports/raspberrypi/mpconfigport.h#L29
circuitpython/ports/raspberrypi/mpconfigport.h
// Setting a non-default value also requires a non-default link.ld
#ifndef CIRCUITPY_FIRMWARE_SIZE
#define CIRCUITPY_FIRMWARE_SIZE (1020 * 1024)
#endif
yup, except when it is 1536k (when the board has wifi I think)
having circuitpy in zephyr board defs would be great. I want to do zephyr uf2 *bootloader at some point
ports/raspberrypi/boards/raspberry_pi_pico2_w/mpconfigboard.mk
# Must be accompanied by a linker script change
CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)'
It is implemented in C and is not loadable at run-time. MicroPython has some provisions for that kind of thing, but we don't (and that mechanism takes space as well).
You could make a custom build for your board: https://learn.adafruit.com/building-circuitpython/customizing-included-modules (but read the whole guide).
so, does any part of the CIRCUITPY drive usually live in internal flash, or does it all go on the external QSPI chips?
The filesystem isn't "appended" necessarily.
Ah okay. I phrased it that way because at some point I recall having success literally concatenating UF2 files to append the CIRCUITPY filesystem on rp2. Looks like there's things like uf2tool now to be little less cavalier about it.
What platform are you targeting specifically? The implementation will depend on that.
For architectures, I think rp2 and esp32 would cover most systems people are concerne...
rp2 doesn't have any internal flash
so it is always external
on nrf, it is all of external flash if it exists
otherwise it is a portion of internal memory
oh wow... ah, so the openocd stuff is magically handling the XIP programming... huh
yup
so, are you suggesting that it would be nice to have a node called "circuitpy" in the dts file which matched the address range used by normal CircuitPython for the CIRCUITPY drive?
it should be a fixed partition
the zephyr ports looks for a circuitpy_partition https://github.com/adafruit/circuitpython/blob/main/ports/zephyr-cp/supervisor/flash.c#L23
but otherwise uses heuristics for it
so, do you mean you'd like to have something that looked kinda like this:
&flash0 {
...
partitions {
...
circuitpy_partition: partition@100 {
...
};
};
};
yes, I think so
Any reason it shouldn't happen?
do you mean get rid of import secrets?
Yes, and things that take secrets (like build them from settings.toml)
what would you replace it with?
I guess I'm not super clear what you are asking. Maybe file an issue on the learn repo about it to start? Have a couple examples of the changes there
before you dive into doing it all
and what would you replace it with?
the start of the second example seems okish
I'm ok calling getenv
ya, I'd love to remove all secrets.py
but it'll take more than just changing the example code
the learn guides themselves may need to be updated
Yeah, so I would l:
- Make sure libs don't need it
- Update examples
- Update learn guides
1 and 2 would be a PR for each lib repo and then a big one for the learn guide
3 isn't doable from github PR unfortunately
Oh 😦
learn is a private database under the hood
Gotcha
I can update any thing in https://github.com/adafruit/Adafruit_Learning_System_Guides
that's only the referenced code, not the prose
we could coordinate with someone like foamyguy who has access but I'm not sure it is a priority
Fair. I guess if it becomes one, let me know and I can help
thank you!
For sure
If we did all the code, but not the guides, the worse case would be someone got stuck and reached out here for help?
I don't think we want that experience from the guide side though
do one and we can go from there
Okay. I'll look at libs and see which ones if any still take secrets as an object passed in
@short tendon I did a lot of the Learn Guides already. There may be some mirrored pages that are still old. Also there are one or two projects that store some complicated thing in secrets.py, like some JSON data, and I didn't revise those to eliminate it there.
Do you think it's worth updating those to use settings.toml?
So if you make a PR to the learn guides repo, you could list the Learn Guides in the PR, and we'll correct them when the PR is merged.
well, the point is you can't really, unless you flatten the JSON into a string in settings.toml
but it's only one or two guides
Some adafruit io or other IoT guide, I think
Ahhh, is it really secret data? Or generic config data that could be moved into another file (and if you have an example I can answer that for myself)
I think it was some secret data ... trying to find it
I can't find it now. I am finding more guides than I thought that still use secrets.py. Maybe I just changed the Eespressif ones. It was months ago -- I don't remember
anyway, we'd certainly be grateful for a PR. You could make an issue checklist for each guide (using [ ] in an issue post -- do you know about that?)
I have been looking for them with https://www.google.com/search?q=site%3Alearn.adafruit.com+"secrets.py"
Okay, I can start working through things. I'll start with building out a list
I kind of remember more now. I think I fixed the guides that were using shared ("mirrored") pages that were using secrets.py, in order to fix as many as possible at first. I did not fix a bunch of guides with unique secrets.py pages.
Gotcha. And there's no way for me to fix those, other than maybe finding where the issues are?
not without becoming authorized to do so
Had some time (and brain power) to think about this some more and I agree. Going to test it out to make sure nothing strange happens.
I've attempted to update all audiosample objects to follow this paradigm, @jepler. This includes the following: RawSample, WaveFile, Echo, PitchShift, Distortion, Filter, and Mixer.
@gamblor21 I know the ESP32 features an 8-bit DAC that was recently supported within audioio.AudioOut, so I wouldn't say that those formats are completely out of the picture. I think what might be a good compromise is to have all internal audio processing run as 16-bit signed interlaced (l/r/l/r), but handle the different output formats in the final stage before output which can be port-specific. I'll definitely look into compiling an issue with this info in so that we can discuss this furt...
Currently, each object which utilizes the audiosample API is required to support multiple formats and manage common audio tasks independently. In order to reduce flash size, complexity, and the barrier to entry to create new audiosample objects (namely audio effects), the audio pathway should be streamlined by using a single format and adding shared resources for general audio processing tasks. These optimizations include but are not limited to the following lists. Feel free to suggest other ...
I've created an issue to continue this discussion: https://github.com/adafruit/circuitpython/issues/10079.
I've included this potential change in a separate issue: https://github.com/adafruit/circuitpython/issues/10079.
The Blues.io circuitpython-fs-builder might be of interest to you, https://github.com/blues/circuitpython-fs-builder
I stumbled across it while playing with the Swan microcontroller a couple years ago. It's really meant for a different use case, but I thought it might be useful for the use case I think you're talking about here. I'm easily distracted though and didn't really follow up. There's a pretty good video explanation starting at around 50:20 of this video: https://youtu.be/fUUOmpEwpCE
The ESP32C2 in this project (https://circuitpython.org/board/espressif_esp8684_devkitc_02_n4/) is designed for 4MB flash. When I flashed it onto my ESP32H2, the filesystem failed to initialize properly. Therefore, I modified the original board configuration to add support for 2MB flash.
Hi - You can't reuse the creation ID -- that's what caused the build failure. But I don't see an Espressif DevKit board for ESP32-C2 with 2MB. And you said you have an ESP32-H2, which is different than an ESP32-C2: it supports different radio protocols.
Happy to help / liase with this as the IO key change and secrets.py has been tripping up my matrix portal and pyportals testing.
I was going to pr the learn guides repo, and then fix the pages too.
@slender iron by my reckoning, seems like the Feather RP2350 CIRCUITPY drive partition should start at 0x100000 (1MB) and have size of 0x700000 (7MB). Does that seem right?
If you are willing to do this yourself or with @short tendon , that would be great.
yup! 1020k firmware + 4k nvm is 1024k = 1m
okay, good. just pushed a commit with that config
For architectures, I think rp2 and esp32 would cover most systems people are concerned about.
rp2 should be possible already. The bootloader allows you to overwrite any portion of flash.
ESP32 doesn't allow a uf2 to write outside of the ota_0 partition. (tinyuf2 README So, we'd need to add the ability to write to the data partition.
Alternatively, idf.py could be used to flash directly. It can include both TinyUF2, Circ...
@slender iron saw your merge. Wondering if you tried building CircuitPython with that board def, and if so, did it work?
Are you ok if I close this PR then?
Sure I guess. I'll continue to maintain my fork that has this patch for my own work since it seems others don't want this.
@tulip sleet are you good changing:
adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, *)
to:
adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, ssid, password, *)
And doing a major version update?
two things:
- that will break existing code, which we might not want to do immediately. We could do:
ESPSPI_WiFiManager(esp, secrets=None,*, ssid=None, password=None), and check for one or the other. - The secrets can also include enterprise credentials. See https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/71a07cc43a80d02d627dce595eeb246e089c2679/adafruit_esp32spi/adafruit_esp32spi_wifimanager.py#L73
# Check for WPA2 Enterprise keys in the secrets dictionary and load them if they exist
self.ent_ssid = secrets.get("ent_ssid", secrets["ssid"])
self.ent_ident = secrets.get("ent_ident", "")
self.ent_user = secrets.get("ent_user")
self.ent_password = secrets.get("ent_password")
So those should also be optional keyword args
or else come up with some other arg scheme that allows passing either
@willow totem ^^
Yuck. I'd hate to have the new ones at the end...
What if we made WiFiManager that was a subclass of ESPSPI_WiFiManager with an updated __init__?
why is it yuck? too many args? They are optional
And once everything is using that (like PortalBase) delete the old one
more that they are at the end after things like debug
they can be in any order if they are keyworded
and then it's harder to remove the secrets when people write code that's positional
i guess the q is how many people are using WiFiManager themselves. Is it prevalent in the exmaples, or is it just in PortalBase, etc.
it's in a bunch of examples
do you think ssid and password should be able to used only positionally, or with keywords? Are there other API's with just positional?
so, I use keywords, but examples don't. And we don't force it
non-upward compatible or not, how should the enterprise args be passed?
I am not averse to using class methods as alternate constructors (factory fns), but I've gotten pushback on that sort of thing
I would do as args:
def __init__(
self,
esp,
ssid,
password,
enterprise_ident=None,
enterprise_user=None,
status_pixel=None,
attempts=2,
connection_type=NORMAL,
debug=False,
):
with no forced keyword args, no *? I would be inclined to force keywords after password, if we are going to make a breaking change.
I'm good doing that
also maybe check if ssid is a dictionary, and print an explanatory message, otherwise when people don't change their code but update the library, the error msg will be very confusing. I may bring this up in an internal meeting this evening to see what folks think.
that makes sense.
If it's good, I can update that, portalbase, hue and any dirrect examples
We could even treat ssid as secrets if it is a dict (e.g. make it backward compatible for now, with a warning).
so, major library change, upward compatible for now, old code still runs, and then we change all the examples and the libraries, and then, a while later, remove the back-compatibility. do any exmaples use secrets=secrets right now?
would you treat password as status_light when that happens since there's a lot of examples that pass that in?
ugh, I didn't know that
and no instances of secrets=secrets
i am liking your subclass idea better, but maybe make ESPSPI_WiFiManager be a subclass of WiFiManager. It just shuffles the args around and passes them up. It could print a warning. Eventually we drop that subclass.
it's a pretty verbose classname now anyway
I like that the best: upward compatible, can print a warning, no "big bang" needed on guide changes, etc.
Awesome. Won't have to release multiple things at the same time
This is experimental and will change as the hardware does.
Thanks! I think I'll swap in a different board for now.
@willow totem what should the AIO names be in settings.toml:
aio_username = getenv("CIRCUITPY_AIO_USERNAME")
aio_key = getenv("CIRCUITPY_AIO_KEY")
or
aio_username = getenv("AIO_USERNAME")
aio_key = getenv("AIO_KEY")
@tulip sleet something like this work:
print("--------------------")
print(
"You are using the legacy ESPSPI_WiFiManager that uses the secrets dict versus passing "
"in vars from settings.toml"
)
print("Please update to using WiFiManager, you can look at the examples on how to update."
print("This class will go away in the future")
print("--------------------")
If it's close we can finesse it in the PR
Use the warnings module:
https://docs.circuitpython.org/en/latest/shared-bindings/warnings/index.html
I suggest wording something like that
warnings.warn("ESP32WiFiManager, which uses `secrets`, is deprecated. Use WifiManager instead and fetch values from settings.toml with `os.getenv()`.")
hmmm just free-associating here but there is this semi-standard format for representing full wifi credentials info in a single string. It's used in QR codes. https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11
but then circuitpython would have to parse it and ugh 🙂
forgot we had that
This is interesting but not sure I want to make humans use that format.
it would be very cool for the boards that have a camera
we could write a little library to parse that string
I'll open the PR as soon as I know the correct/current naming for the AIO keys (so they don't need to be changed again)
I'm looking at my AdafruitIO page and where it shows me the code sample it uses ADAFRUIT_AIO_USERNAME and ADAFRUIT_AIO_KEY
I agree, use the name that shows up when you ask for your credentials
which is as paul mentions
@lone axle did you write a tilemap importer from the tiled app?
I did. The original is here https://github.com/FoamyGuy/CircuitPython_Tiled_Games_Experiments
This one was a bit newer version of it: https://github.com/FoamyGuy/CircuitPython_Pie_Chart_Chomper/blob/main/tiled_game_map.py I don't recall all of the differences, I think allowing the player to move pixel by pixel rather than be constrained to the grid was one but there may have been others.
👍
For some reason unknown to me, they were shifted to an ADAFRUIT prefix. I'd have expected a circuitpy_ or left as-is, but there must have been reasons (like it's not strictly a circuitpython setting)
If you visit io.adafruit.com then click the yellow key (or View Key in burger menu on small screen widths)
Reading qrcode and updating settings.toml with new wifi credentials on memento https://adafruit-playground.com/u/tyeth/pages/memento-flicking-usb-readonly-write-boot-setting-wifi-using-qrcode
It is kinda weird. Since the A in AIO is for adafruit....
Although now I realize my PR is wrong because I used the wrong prefix
I saw this problem recently. I was running make 3.81, while the installation guide for OSX recommends 4.3 or newer.
brew install make fixed it up for me.
Hi Dan, most of the time only one space after the coma is required. In rare case , as technical messages, we use space,space.
" conjonction de coordinations" like "or ni car" is most usefull ex: ""Impossible de construire AudioOut car le canal est déja ouvert" is better for this debug message.
In French:
'Or ' adds a slight contrast ("yet").
'Ni 'negates multiple elements ("neither...nor").
'Car' gives a reason ("for/because"). -> that case
They're often used instead of commas ...
Has a number of fixes and allows higher clock rates.
https://github.com/raspberrypi/pico-sdk/releases/tag/2.1.1
thanks for the explanation!
Thanks @FK-sauve, @andibing, and Noel Gaetan (via weblate -- no GitHub username)!
@danh Would you like me to take #10082?
Sure, if you would like. Worth reading the release notes carefully to see how it impacts us. We manage TinyUSB versions ourselves so that change is not for us. The higher allowed speed for RP2040 is worth investigating -- does the regulator voltage need to be adjusted on a speed change, or is it already OK?
worth tracking what philhower is doing with this
The clock speed change for RP2040 that allows higher rates will have implications beyond regulator voltage. For example, I wouldn't expect anything involving the PIO to work out of the box without clock divider adjustments. I'd be most careful with the CYW43, it's proven to be very touchy.
I think we'll want to pick up the SDK update as a matter of course. If we really want to increase the clock speed that should be a separate issue.
But first there are RP2350 build problems with CP and SDK 2.1.1 that will need to be resolved.
@danh Who is philhower and where can I find their work?
https://github.com/earlephilhower/arduino-pico The best arduino core for RP2xxx
circuitpython already allows for increasing rp2040 the clock speed. it comes with a caveat that peripherals need to be init after it
Thanks, I was not aware of RP2 clock slewing support in common_hal_mcu_processor_set_frequency(). I also see the caveat in the doc. The VSEL settings in ...set_frequency() look like they may have been specialized for the RP2040 but not the RP2350. Can you give me some insight into how these values were derived?
Comparing the tables in the RP2040 and RP2350 datasheets, the voltages for the various settings of VSEL differ. For example, the default code of 0b1001 is 0.860v for the RP2040 but is 1.100v for the RP2350. Of course process and default core clock frequency differences will require different voltages, I'm wondering if the Foundation scaled the code to voltage assignments to match?
I think they are done on the same 40nm process
(not made by the rpi foundation. it is rpi trading)
I'm thinking that if someone is savvy enough to overclock, we might want to give them control over the voltage as well as the frequency?
its mainly used by picodvi on the rp2040
(That's a 404)
Got it. Aside from the frequency/voltage issue, which I don't think we'll get to the bottom of anytime soon, I think updating the SDK version remains a good idea. Do you agree?
There are some CYW43 fixes we should pick up, IMHO.
ya, definitely worth updating
Thanks! The SDK update restructures floating point support for the RP2350 in a way that breaks our build. I'll get that fixed and go from there.
thank you!
One more change to make it clearer that this board isn't from Espressif.
USB_MANUFACTURER = "Unknown"
@mortal kernel see some very recent discussions here: https://github.com/earlephilhower/arduino-pico/issues/2814
I haven't hit the missing return bug yet (still working through floating point issues), but it looks like a show-stopper. We'll see.
@danh Thanks for the heads up!
@tannewt did the PR that was merged 2 months ago that tagged this issue resolve this issue? Specifically, did this target RGB666 SPI mode? If so, can we close this?
@lone axle If I want to do a guide for the RFM library, should I do it in the "Playground" or in the Adafruit Guides? If I start off as a Playground, is it simple to migrate to the Adafruit Guides if you want it there?
I made a Guide a long time ago, so I think I have access.
I think it would be great to have a guide for it, but I don't think it's up to me neccessarily between playground and learn guide. I would say maybe email pt and Limor to ask about it. They may have thoughts on specific ideas or hardware to include if it is a learn guide.
Migrating from playground to guide does require some manual copy/pasting as far as I know. However the text fields do keep their formatting I believe which makes it a bit less tedious. But I don't think there is any high level "migrate" button. Would require making a new guide creating page(s) and copy/pasting from the playground to the guide.
@danh As luck would have it, CP does not use the affected SDK routines enable_interrupts() and disable_interrupts(). CP and its 3rd party libraries instead use save_and_disable_interrupts() and restore_interrupts() which are not affected.
Update Pico SDK to version 2.2.1. Makefile change to support floating-point module rename.
Update cyw43-driver to commit c1075d4.
Resolves #10082.
Minimal testing so far. Submitting as draft to collect artifacts and do more testing.
Would love to see whatever you put together. I use these a bunch
Higher clock rates were already allowed by SDK 2.2.0. SDK 2.2.1 adds PICO_USE_FASTEST_SUPPORTED_CLOCK that when set selects 200MHz as the core clock frequency. Note that this is a build-time setting. It has no effect on the ability of CP to alter the core clock frequency at run time.
I am not sure where to post it but I believe the Adafruit Feather RP2040 with USB Type A Host 5723 should be listed "CircuitPython" category (https://www.adafruit.com/category/956), as currently it is not.
CircuitPython version and board name
Adafruit CircuitPython 9.2.4 on 2025-01-28; Adafruit Feather RP2350 with rp2350a
Code/REPL
from board import SPI, D5, D6
import displayio
from fourwire import FourWire
import supervisor
...
I get the same hard fault with these additional firmware versions:
- adafruit-circuitpython-adafruit_feather_rp2350-en_US-9.2.1.uf2
- adafruit-circuitpython-adafruit_feather_rp2350-en_US-9.2.2.uf2
- adafruit-circuitpython-adafruit_feather_rp2350-en_US-9.2.3.uf2
@mortal kernel https://github.com/raspberrypi/pico-sdk/pull/2310 (those new interrupt functions are now void returns)
Also, it's not necessary to wire up the display just to reproduce the fault:
- I can get the same fault on the Feather RP2350 with the display disconnected
- I got the same hard fault result by running the reproducer above on a Metro RP2350 with no display connected
(Adafruit CircuitPython 9.2.4 on 2025-01-28; Adafruit Metro RP2350 with rp2350b)
Meant to send this last night sorry. I'm on UK time, but a bit of a night owl so very flexible if you want to chat. My desire is to get all the internet connected matrix and pyportal projects working reliably. Mostly secrets updates and try catch count+reboot, but ideally get some memory issues resolved, and adapt to adafruit_json_stream for consuming large json payloads (80k) with displays running, and any other little bits. If any of the upcoming changes make sense for me to do too, then happy to, or together/whatever. Was going to do a few sweeping PRs on the learn guides repo (for the code examples), probably in stages, and do the guide text updates as the guide code PR's get merged.
Shout out to everybody involved in getting DVI output working on the Metro RP2350 with HSTX. Just tried it out tonight on a TV, and it's awesome!
Another data point (thanks to @Neradoc on discord for mentioning this):
If you register a release_displays atexit, like this:
import atexit
atexit.register(displayio.release_displays)
it stops the hard fault when you use the REPL. But, if your goal was to continue using the 2x zoom after code.py ends so you can have it for the REPL (perhaps with USB keyboard), then releasing the display doesn't help.
Same thing as makergo_esp32c3_supemini.
CircuitPython version and board name
Adafruit CircuitPython 9.2.4 on 2025-01-29; 01Space 0.42 OLED ESP32C3 with ESP32-C3FH4
Main branch too
Code/REPL
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Heap allocation when VM not running.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.
Press any key to...
@lone axle I noticed that you were working on joystic activities, maybe link to Fruit Jam.
Not sure where is that taking place, I saw a learn guide piece of code for USB Host joystic and maybe a show an tell piece.
I have two "i2c joystics" that I would love to see supported:
- https://www.adafruit.com/product/5743
- https://www.adafruit.com/product/5753
Then of course I am interested in Wii Nunchuck: - https://www.adafruit.com/product/4836
For that last one, Adafruit as a simple library, and the community as another that support many more joystick over I2C.
The idea would be a joystic library that would abstract various input device and make it easy to adapt games from one platform to another... not sure if that already exist, but sure it would help for the game part of Fruit Jam (we all know most home computer from the 80's were mostly used for games and not for programming... only a few did and are now in the IT business)
Make a game or robotic controller for any I2C microcontroller or microcomputer with this tiny gamepad breakout board. This design has a 2-axis thumb joystick and 6 momentary ...
Back in my day, we used to have these big chunky PC joysticks that would plug into the back of your PC. No, not through USB, they had a DE-15 port and they'd go into the Game ...
Dig out that old Wii controller and use it as a sleek controller for your next robot if you like. The Adafruit Adafruit Wii Nunchuck Breakout Adapter fits snugly into the Wii connector and ...
Tested successfully with the following boards:
- Raspberry Pi Pico
- Raspberry Pi Pico W
- Raspberry Pi Pico2
- Raspberry Pi Pico2 W
- Pimoroni Pico Plus 2W
My vision is for https://github.com/FoamyGuy/CircuitPython_GameControls to basically be the library you mention abrstracting input devices to make it so game code can easily swap to different controllers.
For joysticks specifically currently it's only converting analog data into D-Pad button presses, but ultimately I'd like to make it possible to get the analog values too if games want to make use of them.
It already supports the I2C Stemma gamepad I think, although the class for it is named after the Feather Joywing, I believe they are similar enough to be interchangable for this code, but I haven't actually tested the stemma one I don't think.
PC joysticks and WII nunchuck would be cool to have as well, they aren't currently supported. I could pick up a nunchuck adapter, I'm pretty sure I've got some of those around. I don't believe I have a PC joystick. Maybe someone else would be willing to PR support for it, or eventually I may get lucky and find one in a thrift store or similar.
I can try to have a look, I have the hardware here, and various PC joystic in DB15. I am a bit rusty as I have not done much in the last 6-12 months... I will make PR if I make any progress.
microcontroller allows setting the RP2 core clock frequency, but does not allow direct adjustment of the core supply regulator output voltage. Instead, it selects a core clock frequency based on experimental data valid for the RP2040 only.
Feature request for an additional microcontroller.cpus[x].voltage property that allows setting the core supply regulator output voltage.
So here is the direction I was thinking:
- Get the secrets out of
ESP32SPI- PR here - After that's released update
PortalBaseandHueto go fromESPSPI_WiFiManagerto the newWiFiManager(and any examples) - Update all other examples to not use
ESPSPI_WiFiManagerorsecrets
I have both a Matrix Portal M4 and Matrix Portal S3 to be able to help test anything
And happy to chat anytime. I'm in the US on the west coast, but work east coast hours (utc-5)
Wemos Lolin S3 Mini Pro device with onboard I2C IMU, SPI 0.85" LCD, IR LED, Neopixel and 3 user programmable buttons.
I'd suggest emailing support@adafruit.com
Hey @slender iron did the RGB666 SPI issue get completely resolved? I saw a PR that tagged it but I haven’t actively tried it with SPI.
I haven't seen anything about it go by.
I’ll give it a try this weekend and let you know. I think the PR was just 24 bit color mode support and I don’t know how that maps to SPI displays
If the display init args aren't right, then the display code will try to raise an exception. Raising an exception requires a VM allocation and can lead to this safe mode when the VM isn't setup.
It is what folks will see listed on their computer. So it should encompass the whole board.
The zoom_2x = displayio.Group(scale=2) object will go away when the VM does. It is VM heap allocated. It should replace this with displayio.CIRCUITPYTHON_TERMINAL but I'm not sure why.
I think you want a settings.toml setting for terminal scale.
The
zoom_2x = displayio.Group(scale=2)object will go away when the VM does.
Yeah... I figured something might be going out of scope, but the hard fault message said to file an issue, so I did.
I think you want a settings.toml setting for terminal scale.
Is that a thing that's possible? I didn't find any mention of such things in the docs.
Have you made a pull request for this ID?
I didn't find any mention of such things in the docs.
oh... actually... I just realized that the latest vs stable Environment variable docs are different, and I was looking at stable. Will CIRCUITPY_DISPLAY_WIDTH and CIRCUITPY_DISPLAY_HEIGHT work on something that's not a picodvi display? The latest docs page implies perhaps not?
Documentation for newly added WEMOS ESP32C3 based LCD device.
@tulip sleet I forgot how best to tag you on PRs (assign, comment, here etc). So will tag you here for this one and let me know the best way for the future: https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/pull/216
I saw that, and wasn't sure if you were done or not. Happy to look at it. I saaw you assigned me as a reviewer but then added another commit. If it's all ready I'll now review.
It's all ready. I realize I made a typo on a settings.toml key name
I'm using an ESP mpconfigport that allows overriding CIRCUITPY_BLEIO so I could make builds that enable BLE on S3 boards (and C3 if there wasn't issue #10002) by using the no-ota-no-uf2 partition
https://github.com/adafruit/circuitpython/compare/main...Neradoc:neradoc-allow-override-bleio-espressif
is there a point in PR-ing that ?
Thanks. Making it conditional is good, and certainly convenient for now. Sometime relatively soon we'll start building for larger partitions. The S3 should be able to use no-ota but with UF2, I think.
but tinyuf2 won't be able to write it since it would overflow its ota0 partition
so doing that would have to wait CP10 anyway
ah good point - did you see https://github.com/adafruit/tinyuf2/issues/432 ?
we were just trying to figure out the logistics
I was playing too with using erase_region to avoid erasing the drive when using esptool, and I wonder if there would be side effects to not erase NVS (which is where NVM is stored)
While we are waiting for CP 10, this allows overwriting CIRCUITPY_BLEIO on 4MB espressif boards from the make command, or with the github custom build action on a fork. It it is then possible to make space for _bleio by disabling other modules.
Or by using the no-ota-no-uf2 partition scheme. Note that the no-ota with uf2 build won't work with the current versions of tinyuf2 (pending https://github.com/adafruit/tinyuf2/issues/432) so this requires installing via the bin anyway (or a custo...
Apologies for the late response. Crashing on 9.2.4 when peripheral sends a message.
I want to add this: the number of connections the central shows is 1 even after the peripheral turns off / disconnects.
Here is the code for one of the paws circuitplayground bluefruit. Hopefully this is enough, as crashes occur with one device restart and message.
code.txt
I think is a good idea, even if it is temporary, because it makes it easier to enable BLE now on these boards.
Created a board definition for the Heltec Vision Master E290 device. ESP32S3 N16R8 based with 2.9" Epaper device (SSD1680), RA62 LoRa radio, 2 user programmable buttons, lithium charge circuit and a 40 pin GPIO header. Device uses native USB, and has had a unique community PID registered with the Espressif usb id allocation repository.
It is for this little SAO https://github.com/flummer/dmm-sao using VID:PID from pid.codes: https://pid.codes/1209/FD42/
@tulip sleet I'm working to update PortalBase and can't find a reference anywhere for adafruit_portalbase.wifi_coprocessor.WiFi.manager(). Can it just be removed?
I looked through the bundle for manager( and could not find any either. Does Portalbase do anything with the manager?
nope
Go ahead and submit a PR to remove it, then. How does the network get set up otherwise?
so you can pass secrets_data which isn't in any example (although passed through in via pyportal, but sill not in any example or learn guide), and then in NetworkBase there's a method _get_setting that checks if it's in settings.toml and if not tries to load secrets and will print a warning if you are using it
I was thinking we could pull secrets_data and change the print to a warning
that sounds good
And then maybe after the cp10 release pull all the warnings...
Cool. Will start with PyPortal. This will be a slow 1 PR/Release repeat...
Another quick question. For when I do PortalBase, it has:
OLD_SETTINGS = {
"CIRCUITPY_WIFI_SSID": "ssid",
"CIRCUITPY_WIFI_PASSWORD": "password",
"AIO_USERNAME": "aio_username",
"AIO_KEY": "aio_key",
}
Should I leave that in there and change it to:
OLD_SETTINGS = {
"ADAFRUIT_AIO_USERNAME": "AIO_USERNAME",
"ADAFRUIT_AIO_KEY": "AIO_KEY",
"ADAFRUIT_AIO_USERNAME": "aio_username",
"ADAFRUIT_AIO_KEY": "aio_key",
}
I think it depends on how the AIO values are used in the various Portal libraries and how they are used in the guide projects.
So at some point, the names were updated on io.adafruit to the newer name. I think a lot of things still point to the old names. Tyeth wants to get everything updated to the new names (code, examples, guides)
can you put the values under both names for now? Then the old code will work while we fix the guides
afk for a while
I'll make sure either ADAFRUIT_AIO_* or AIO_* work when I update that repo
And for future people who discover this thread: you must put board.DISPLAY.root_group = None in both boot.py and code.py as it seems the display gets recreated after boot.py finishes. (at least on an M5Stack Cardputer)
Code looks good to me, I'll try it on hardware later.
hey @slender iron looks like that PR submitted did not really do anything for rgb666 support. Might make a small PR this weekend or next for it. Depending on if I can get my build environment fixed lol...
Hmmm.. the 3 bytes in a 4 byte chunk seem like they will pose a real problem for RGB666 🙁
I wonder if I shift it to the front 3 bytes of that will make any difference
So instead of being stored 0b000000RRRRRRGGGGGGBBBBBB it’s 0bRRRRRRGGGGGGBBBBBB000000 though maybe I need to swap reds and blues..
Or however. Hard to format right from my phone. Any thoughts are welcome
@tulip sleet do you know if Adafruit_Blinka_PyPortal is still used? In PortalBase v1.15.0 (Aug 1, 2023) self._secrets was removed, in which the Blinka one still uses. Trying to figure out if I need to update it, or leave it alone for right now. I can update it to use self._get_setting() instead if you want it to work.
It probably was never updated, and no one really uses it, so that wasn't caught. All the (closed) issues are from 2020 or 2021, including https://github.com/adafruit/Adafruit_Blinka_PyPortal/issues/16 re secrets
and see #17, the PR
Yeah, and that was later removed 😦
if it's broken now, and was already broken, you could open an issue, and fix it sooner or later
I wouldn't hold up the other stuff. If it's easy to fix, go ahead
Sounds good. It's easy enough. Will get a PR open in the next day or so
CircuitPython version and board name
Adafruit CircuitPython 9.2.4 on 2025-01-29; Wemos Lolin C3 Mini with ESP32-C3FH4
Code/REPL
import socketpool
import asyncio
from adafruit_httpserver import Server, Request, Response, Websocket, GET
pool = socketpool.SocketPool(wifi.radio)
server = Server(
pool,
# root_path="/static",
https=True,
certfile="cert.pem",
keyfile="key.pem",
debug=True)
websocket: Websocket = None
@server.route("/ws",...
@relic-se any progress on tracking the LFO creation code?
Tried on the Pico2 and worked fine for me. A bit warbly with the default settings in my opinion but you can always up the window/overlap to smooth it out if you want to devote the resources.
@short tendon Your updates to PyPortal and PortalBase are updated and released, as major releases. Thank you! Anything @willow totem know now about updating Portal projects?
@tulip sleet followup on updating WifiManager, Both Hue and LIFX have something like this:
wifi_type = str(type(wifi_manager))
allowed_wifi_types = ("ESPSPI_WiFiManager", "ESPAT_WiFiManager", "Session")
if any(x in wifi_type for x in allowed_wifi_types):
self._wifi = wifi_manager
else:
raise TypeError("This library requires a WiFiManager or Session object.")
Should I just add WiFiManager or change it to just WiFiManager and Session?
what kind of credential args does ESPAT_WiFiManager take?
i mean, does it still use secrets, so you'd need to support secrets anyway, etc? Otherwise, yeah, I'd say get rid of ESPSPI_WiFiManager in those libraries at some point, because we do want to drop it eventually. For now you could open issues to make it a TODO.
for attr in ('post', 'get', 'put'):
if not hasattr(wifi_manager, attr):
raise TypeError(f"This library requires a WiFiManager or Session object with a {attr} method, not {type(wifi_manager)}")
```if you must check, maybe check for what you need?
I understand this code was probably added to help users who passed a wrong argument, but as you're discovering it's fragile
Thanks for creating this issue. When I first started on effects there was discussion about a common utility library (in one of the base audio objects) and I think now that we see the commonalities it would be a good time to revisit that idea.
I really like the idea of a common internal audio pathway format for CircuitPython (16-bit, signed, stereo would be my vote). I think we have to leave sample rate variable but I have never seen code saying if sample_rate == 44.1khz required. That said...
I like that change a lot better
@tulip sleet another thing I noticed when cleaning up PortalBase. With all the work we did last year, we could create a WiFi class that works for radio.wifi and subclass that for the ESP32SPI, and thus make the package smaller. And to start, adafruit_portalbase.wifi_esp32s2 would subclass that with no changes. Thoughts? If there was ever a pico portal, it would make it easier
And then also clean up things like this: https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal/blob/cfba16f908e842ebd2889cd5ffa08e85a09d8989/adafruit_matrixportal/network.py#L90 since it would fail in the s3 portal
I agree, that would be a good idea, though I thought there were some fundamental issues about the behavior of wifi.radio vs ESP32SPI around sockets
So the core of those two classes is basically the same minus connect. It would remove a bunch of boilerplate
I'll draft it out this week
I really just want to re-write all the portal libraries. But will start with some simple fixes.
Want to focus on removing secrets first
So will apologize in advance on all the PRs I'll be opening and tagging you on
I wanted to build CircuitPython with MICROPY_MEM_STATS enabled to debug some out of memory issues I had, but encountered a few compilation errors.
MICROPY_MEM_STATS requires MICROPY_MALLOC_USES_ALLOCATED_SIZE to be set, which in turn causes m_realloc, m_realloc_maybe and m_free to take an extra argument: the previously allocated size.
I fixed what I could with my limited knowledge of that code. Some places of the code still lack a proper support for `MICROPY_MALLOC_USES_ALLO...
I really like the idea of a common internal audio pathway format for CircuitPython (16-bit, signed, stereo would be my vote).
I think that's the only real option here.
I think we have to leave sample rate variable but I have never seen code saying
if sample_rate == 44.1khzrequired.
There are any specific sample rate checks that I'm aware of, but a lot of the audiodelays effects use sample rate to calculate timing properties.
That said we will have to put some thought to ensure ...
Yes, we did it, truly sorry for the delayed response.
On Fri, Feb 21, 2025 at 6:50 PM Scott Shawcroft @.***>
wrote:
@.**** commented on this pull request.
In ports/nordic/boards/omnimo_nrf52840/mpconfigboard.mk
https://github.com/adafruit/circuitpython/pull/10056#discussion_r1965942436
:@@ -0,0 +1,9 @@
+USB_VID = 0x1209
+USB_PID = 0xCECEHave you made a pull request for this ID?
—
Reply to this...
A bit warbly with the default settings in my opinion but you can always up the window/overlap to smooth it out if you want to devote the resources.
The default settings are definitely conservative. If you have a suggestion for a better combo (though more resource intensive), I'd consider changing out the defaults. Otherwise, it's up to the user.
Hi I am still facing this issue, Kindly help me o am very new to this field,
I have flased the pico with circuit python latest version and after replug it removes everthing.
OS: Windows 11
CIRCUITPY: https://downloads.circuitpython.org/bin/raspberry_pi_pico/en_US/adafruit-circuitpython-raspberry_pi_pico-en_US-9.2.4.uf2
Kindly respond
@AnkurG99 Please open a thread in https://forums.adafruit.com or post in our discord https://adafru.it/discord. Please describe what you mean by "it removes everything" where you bring that up.
Hi everyone
I have flashed the pico with circuit python latest uf2
But after that I unplug and replug my pico and my pc is not showing the pico
I tried it with bootsel pressed it shows as rpi-rp2 bit no circuit python was in the folder
Kindly help to resolve this
Adafruit CircuitPython 9.2.4 on 2025-01-28; Particle Boron with nRF52840.
I'm struggling to get a Particle Boron (https://www.adafruit.com/product/3994) to display the CircuitPython drive. In case it's helpful, the version printed on the PCB is v1.5.0, the model number on the sticker is BRN404X, FCC ID is 2AEMI-BRN404X, and the IC is 20127-BRN404X.
I used a J-Link Edu to replace the stock bootloader with the Boron's UF2 bootloader, but when I copied the .uf2 file for CP to the Boron, no Ci...
If you connect to the REPL via a terminal program, and press reset, does it say you are in safe mode because it couldn't create CIRCUITPY?
This could be because the external flash on the board is not an expected part number. What does the printing on the external flash chip say?
Howdy <@&356864093652516868> ! come in from the cold and join us for our weekly meeting in about 70 minutes from now! And if you can take the time now to add your notes to the document, that's super helpful: https://docs.google.com/document/d/1nJs-ZrRGrey76S8DlqTuS4wzoIXLvEyXdewi0lbNx3o/edit?usp=sharing
CircuitPython Weekly Meeting for February 24, 2025 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates before the meeting, alphabetically by your username. During the meeting, we go through them in order. If you can’t make the meeting and would...
Is that a thing that's possible?
Not yet but you could add it.
Yeah... I figured something might be going out of scope, but the hard fault message said to file an issue, so I did.
Issue is still good. It shouldn't crash regardless.
Will CIRCUITPY_DISPLAY_WIDTH and CIRCUITPY_DISPLAY_HEIGHT work on something that's not a picodvi display?
I don't think so. It depends on the board_init's display init code.
This is fine with me. Please ensure pre-commit passes though.
I think I also found a bug in pre-commit:
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
diff --git a/shared-module/atexit/__init__.c b/shared-module/atexit/__init__.c
index 6cc13e9..3960732 100644
--- a/shared-module/atexit/__init__.c
+++ b/shared-module/atexit/__init__.c
@@ -47,7 +47,7 @@ void shar...
I tend to be quiet
👍
Yep
And a nice case of "it works on my machine" :/
For the record, the python venv is a fresh install, and I have the same version (4.1.0) of pre-commit than the CI.
You're welcome! Chime was such a fun project.
- for 1280x720 output
Thanks Dan for dealing with the Docs
Thanks for hositng Jeff! have a great week everyone 👋
Thanks all!
@solar whale ok, https://docs.circuitpython.org/projects/rfm/en/latest/ looks ok now. Took me a while to find the right place in rtd
@d1ffeq-diy I haven't dig too deep into it as of yet. If you've got the know-how, feel free to poke around in the core. Otherwise, because the work-around is fairly simple (just providing your own waveform), I've got this as a low priority item atm.
This PR fixes a bug where OnDiskBitmap was unable to read small indexed bitmaps with a small header (e.g BITMAPCOREHEADER or BITMAPINFOHEADER). This is especially true with a monochrome bitmap.
I have attached the required code + bitmap to reproduce this issue. Here is the output of the script on a build that doesn't include this PR (warning: french):
Auto-chargement activé. Copiez ou sauvegardez les fichiers via USB pour les lancer ou démarrez le REPL pour le désactiver.
main...
Nothing comes up on the serial terminal when I reboot, it seems to be unable to connect. Yet, the LED still has the characteristic 3 white blinks.
I don't know which chip is the flash chip (it's not called out in their datasheet), and it could be under either of the two large metal shields. In the meantime, I'll see if I can deceiver any of the marking on the chips that are visible.
Thank you!
There was one chip with markings visible that might be the flash. The complete set of markings are:
mx25 r6435f 8j606 000-x
When I googled this, I noticed there were a couple links to forum posts related to issues using this flash in other devices (STM32U5 and nRF9160).
Dan, Should the docs rebuild automatically now if I submit a new PR?
Once it's merged, yes, it should.
The build has support for only "MX25L3233F", which is half the size Maybe they changed the flash chip at some point. https://github.com/adafruit/circuitpython/blob/4cce4fa88707a2a9500bf3e8d16482ef6fa76436/ports/nordic/boards/particle_boron/mpconfigboard.mk#L9
I'll submit a PR to add that flash chip. I'll tag you when that's done.
BTW, I know of no CircuitPython support for the LTE hardware.
- Fixes #10096
Add another flash chip for Particle Boron. User's sample has an 8MB chip.
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/1bNFt1NA9zvPNA-9fpOf6_6CKmBYoHS0k9QKDYaF9TLg/edit?usp=sharing
CircuitPython Weekly Meeting for March 3, 2025 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates before the meeting, alphabetically by your username. During the meeting, we go through them in order. If you can’t make the meeting and would st...
@tulip sleet would you have a few minutes to chat this week about some thoughts I have on PortalBase and all the duplicated NetworkBase code in all the portal libraries? If not, I can throw together a doc to outline it
@slender iron do you know of any core code or examples for writing to UART or the 'data' line of USB serial? I've tried poking around on terminalio foreground/background colors and cursor stuff in the past and ran into trouble because I need to add prints to understand/change/debug the code, but the prints go to the serial console which include the code I'm trying to understand or change and it either goes infinite or breaks.
If I can get to the point where I can add "print" statements that don't go to terminalio but do go anywhere else I can see I could take another crack at those features and perhaps emoji.
I use console_uart_printf to have a separate uart
The default settings are definitely conservative. If you have a suggestion for a better combo (though more resource intensive), I'd consider changing out the defaults. Otherwise, it's up to the user.
Yup more just a comment vs a change required. The documentation says how the user can change it if they want.
This code shows you where all the output can go: https://github.com/adafruit/circuitpython/blob/4cce4fa88707a2a9500bf3e8d16482ef6fa76436/supervisor/shared/serial.c#L380-L452
Thank you!
Hi! thanks for the PR. We don't mind seeing changes for alternate configuration options like MICROPY_MEM_STATS if the impact of the required changes can easily be managed.
we kinda get to live with whatever uncrustufy does; and the CI runs the canonically correct version. Even if it looks wrong to your eyes and mine :-/ Unlike the ideal for pre-commit, we depend on an externally installed uncrustify program; I think micropython-uncrustify from pip install -r requirements.txt.
def...
@lone axle for changes like in https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout/pull/97/files, is ruff doing the work of black, and also rewriting .format() to f"...", etc., and also removing the pylint annotations? Maybe not the last thing. If so for first and second, that's great.
It is doing the work of black, and it is rewriting .format() to f-strings, however that is actually turning out to be problematic in some cases for us because mpy-cross doesn't support multi-line fstrings like
print(
f"something {var}"
f"something else {other_var}
)
It is not removing the pylint comments I removed them from this repo. And I realized that I've forgotten to search the rest of the ones I've done recently 🤦, I'll plan to do a more full sweep to cleanup any remaining pylint comments after ruff is in place for everything, and I'll try to remember to search for them on any moving forward.
you could add a + but it might take it away!
This is fixed here: https://github.com/micropython/micropython/pull/15217
Maybe I should merge that in, in 9.2.5, and you can update which mpy-cross you are using.
Thank you! that led me to this format which satisfies both ruff and mpy-cross
print(
f"local_*: ({local_x: >4}, {local_y: >4}) "
+ f" width: ({0: >4}, {self.width: >4}) "
+ f" height: ({0: >4}, {self.height: >4}) "
)
Note the weird case in the last file in that link I sent, where non-f-string with curly braces doesn't work.
if ruff doesn't undo that, then let's leave that for now, and we can do better after the next merge from micropython
speaking of ruff, are we doing something about the preview mode warning ?
oh wait preview = true has been added to ruff.toml
yes, in cookie-cutter and all of the newer... yep
how do you locally disable a rule with ruff ?
but wouldn't that be a breaking change if you are using 9.2.4 or earlier?
# noqa: PLR0913
or what ever you want to disable
ah thanks
I didn't enable preview mode in imageload because it gave me errors that I didn't want to look at
Success! Boot_out.txt reads:
Adafruit CircuitPython 9.2.4-194-ged3b5087e2 on 2025-02-24; Particle Boron with nRF52840 Board ID:particle_boron UID:BC5C7AA50C685D7C
How will we handle this for versions less then 9.2.5 (or when ever it gets merged)?
I am not going to do this after all; I realized it is a bad idea because of that. It will wait for 10.0 or so, whenever we do the next merge from upstream.
Gotcha. Feels complicated.....
@short tendon I think I did all the PR's except for MQTT which I left to the AIO folks
There's one comment on the AzureIoT one that's in your court
replied there
@short tendon I see the screenshot: it shows settings.toml with empty values, but then it uses id_scope, etc. in the call to IoTCentralDevice() without fetching the values.
got it. fixed
@tulip sleet thanks so much. If you have time tonight still to do releases, I can pull the new bundle down tomorrow and see what's left. If not no worries
I may leave those to @lone axle, who has a way of listing what needs to be released.
I think I will stop for now. Thank you so much for all these updates
Now that the Metro rp2350 is in production
I'm looking for the pico-sdk adafruit_metro_rp2350.h
I'm not sure where to make a request for it - support@adafruit?
@tulip sleet or @slender iron
maybe I can get away by pretending to build the code for adafruit_feather_rp2350.h
some of the named pins will be wrong, but it would certainly work. You're right, we should submit a PR there.
Sounds good. I can just manually update my bundle repo... Not sure why I didn't think of that earlier
oh, if you pull the latest from everywhere, even though there are no tags, yes!
thanks, using the pico-sdk feather rp2350 board file for the metro did indeed get the hello_serial pico-examples to say "Hello, world!" out the uart (pretending the metro was an adafruit_feather_rp2350 )- I just had to flip the RX/TX switch that @meager fog conveniently provide on the metro rp2350
@samblenny Are you planning on working up a PR on this? If not, I think I have an update in mind that would work, although I don't know if it's optimal. If you're working on something, I'll wait and see what you come up with :grin:
I don't have any plans for a PR on this any time soon. Just stumbled across the hard fault as I was using CircuitPython to check wiring for a thing I'm doing with Zephyr. Mostly I'm focused on the Zephyr stuff.
If you've got a plan for a way to make REPL text more legible on these little high res displays, or at minimum to just stop the hard fault, that sounds great. I'm curious to see what you come up with.
I have to clean up the PR and properly document it, but if you want to give the attached firmware a try and let me know how it works that would be cool. Add a CIRCUITPY_TERMINAL_SCALE=2 to the settings.toml file. The setting won't take effect until a hard reset or power cycle.
As discussed in #10084 this adds a settings.toml parameter to override the default terminalio scaling factor for displayio.CIRCUITPYTHON_TERMINAL.
This doesn't resolve the reported hard fault but is hopefully a more robust method of performing the scaling that the technique currently causing the fault.
Someone is now tasked to add the missing boards; thanks for pointing that out.
I came back across this today, I'll go ahead and close it. We could always re-open or make a new one in the future if we want to add these device simpletest scripts and are able to come to some consensus on where they belong and how they are kept etc.
tannewt's opinion is probably more relevant than mine. I'm not super familiar with the core implementation. Looking at the code diff in your PR though, what you've done seems plausible.
Did you happen to come across the code that is supposed to make sure that display.root_group is not set to a heap allocated group that will go away when the supervisor does a soft reset? From what tannewt said in https://github.com/adafruit/circuitpython/issues/10084#issuecomment-2675171082, I think something is supposed to make sure the root group gets set to displayio.CIRCUITPYTHON_TERMINAL?
I did not, as I try and work out the memory issues here, I'll keep an eye open for it, but I read the comment a little differently. I thought tannewt was just letting you know that by appending the scaled displayio.CIRCUITPYTHON_TERMINAL to a VM heap allocated group it wouldn't survive a reset.
There's something that's allowing a hard fault, which is not supposed to happen.
I'm not sure if I added this to the proper location and the use of a new compile parameter may also not be acceptable, however I figured that the M0 boards are running into build size issues more and more frequently and perhaps a generic option to exclude newly added features would be a solution that could work for more than this PR.
Why not use CIRCUITPY_FULL_BUILD instead? This is essentially CIRCUITPY_NOTFLASH_LIMITED already.
Thanks for adding this! One question.
I thought about it, but I thought the last time I looked at FULL_BUILD, it had a lot of side effects. I was worried that turning FULL_BUILD off would turn off other things that wouldn't be noticed until someone tried to upgrade their board.
I did notice some of the other M0 boards were using the FULL_BUILD setting so if you think that's a better approach, I'm happy to get this working using that parameter.
As I think about it more, I think I'm realizing that using the new parameter going forward as I had envisioned it would also pick up multiple side effects just like the FULL_BUILD parameter. I think you're right and they're redundant. I'll go ahead and make the change. Thanks!
I'm seeing the exact same behavior. Often times the hostname will be a single control character (I've seen 0x01: SOH - Start of Header, 0x02: STX - Start of Text) as well as random strings as show above.
This prevents me from loading into the web workflow code editor. Depending on the state I can occasionally just refresh the browser (WITHOUT restarting the device) and the hostname will change allowi...
The PR adds the functionality you want but doesn't fix the crash. We can leave the issue open until a separate crash fix.
I have an esp32c3 device with build in i2c touch sensor. The touch SDA is on GPIO11, which is by default SPI_VDD on the ESP32c3, but the VDD_SPI_AS_GPIO efuse was factory burnt on it, and it has an external flash chip, so gpio11 should be available for use as gpio.. however no matter how I try to build a circuitpython image, on boot it always tells me that SDA (gpio11) is in use.. I see a comment in the pins.h for the luatos core esp32c3 board that mentions having to burn the efuse and recompile to enable gpio11, but I can't find any information on what I would need to change in the board definition to be allowed to use gpio11..
See https://github.com/adafruit/circuitpython/blob/d85765662ec34f6f30f02b4e6f647a35327e05c3/ports/espressif/common-hal/microcontroller/Pin.c#L110. Remove that line, which is in a list of pins never to use for GPIO.
I thought it might be something like a list of forbidden pins.. I guess there's no way to modify that on a per-board basis, rather than globally..
The way to conditionalize it would be to add a CIRCUITPY_something flag and define that flag to 1 in the mpconfigboard.h (the flag would have a default value of 0 in mpconfigport.h). See for example the CIRCUITPY_ESP_USB_SERIAL_JTAG usage in that file.
I assume there isn't an ESP-IDF CONFIG_blah flag that is set for this fuse setting, but if there is, you could check for that. You would set that in the board-specific sdkconfig.
What does
uncrustify --versionprint for you?
Well, Uncrustify-373ed72
The other thing I wonder about here is whether these sites should (mostly) change to use
gc_alloc/gc_free. Since we ALWAYS have gc enabled in any circuitpython build, we can depend on it being available; and its call signature doesn't change depending on MICROPY_MALLOC_USES_ALLOCATED_SIZE. On the other hand, does that mean MICROPY_MEM_STATS doesn't track gc allocations in the first place? I'm not super ...
has Micropython implemented keeping the order of items in dict() ? Or is it still not in it (I believe there are memory use reasons not to do it)
I can't find any reference to CIRCUITPY_GETPASS in the Circuitpython code. Am I missing something or can I eliminate the parameter as part of the PR I'm working on?
you can use collections.OrderedDict
it was implemented a year (?) ago
nope, OrderedDict.move_to_end() is the thing that got added
no I know that, I'm just wondering where MP is at with this
since it's technically an incompatibility with Python 3.6
on the one hand, it seems to be used entirely in the .mk files to select which files to include. on the other hand, as far as I know we just want to be consistent and pass them all into the build. How's it relating to whatever you're working on, that it presents a difficulty?
Is there a trick to getting my newly defined CIRCUITPY_ESP_VDDSDI_AS_GPIO to be set to default 0 during compile? I've added CIRCUITPY_ESP_VDDSPI_AS_GPIO ?= 0 within mpconfigport.mk under else ifeq ($(IDF_TARGET),esp32c3) but on compile, it tells me it's not defined when it hits the #if CIRCUITPY_ESP_VDDSPI_AS_GPIO in the common-hal/microcontroller/Pin.c I'm clearly missing a step.
@fringe yarrow it has to be added to CFLAGS. ```CIRCUITPY_WIFI ?= 0
CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI)
there are .mk flags and c preprocessor flags. In this case, I don't think it really needs to be a .mk flag. You can just define it in mpconfigport.h:
#ifndef CIRCUITPY_ESP_VDDSPI_AS_GPIO
#define CIRCUITPY_ESP_VDDSPI_AS_GPIO (1)
#endif
Then put
#define CIRCUITPY_ESP_VDDSPI_AS_GPIO (1)
in your mpconfigboard.h
the reason to use a .mk flag is that you need to do something conditionally in the makefiles
like turn a source file on or off
hrm.. I was following the example of CIRCUITPY_ESP_USB_SERIAL_JTAG, which is defined in the .mk file..
ok, sorry, that is a wider spread. there isn't another example of a .h-only variable in the pins file
you don't need to conditionalize it on C3 either, just the above is enough. I don't know if other chips have that fuse. Ideally all the listings of that pin as "forbidden" would be conditionalized, on other chips as well, probalby C6 and maybe others
assuming you are submitting a PR
I was, but clearly I dont understand it well enough at this time.. other chips have that, but I don't believe they all map to GPIO11 like the C3 and C6
i stand corrected..
CIRCUITPY_GETPASS doesn't present a problem, I missed the reference in py/circuitpy_defns.mk so I just thought it was something that could be cleaned up. Thanks 😁
the fact that it IS a fuse indicates that maybe we should check that fuse bit to decide how to handle GPIO11 on MCUs where it exists.
That was my original idea but I fell down the rabbit hole of trying to make it user configurable instead..
and static const uint64_t pin_mask_reset_forbidden means it's currently a compile time constant, so making it build-time configured may be the way to go. I guess.
I don't see any problem with taking these changes, if they're useful to someone. A CI-time build that enables USES_ALLOCATED_SIZE would be helpful to try to prevent these sites breaking, but can be done as a separate PR if it someone wants to put in the work.
All set, this is using the CIRCUITPY_FULL_BUILD parameter now.
@onyx hinge would I be ok using the microsecond timer in arduino?
@slender iron The one in pico-sdk? I think so, but I'd only be able to test it tomorrow.
I don't understand why your systick code wasn't working for me 😕
in arduino
I didn't test in CP at all
I moved it off systick and am using the tx sm for the initial timeout
but using it for rxing bytes makes it too slow to turn around the ack
I'm sure you'll get something that's solid, between the three of you
The M0 boards now have many new setting lines that were copy/pasted identically (?) them. What did you turn off that was on previously for M0 boards? I'd prefer that changes were made in mpconfigport.mk for M0 boards, so they could share the settings. You can adjust what CIRCUITPY_FULL_BUILD does there rather than in each board's mpconfigboard.mk.
ESP32C3 and C6 boards have an eFuse (VDD_SPI_AS_GPIO (BLOCK0)) which, when burnt either by user or on factory devices with externally powered flash, GPIO11 is usable as a GPIO. common-hal/microcontroller/Pin.c locks this by activating the GPIO_SEL_11 bit of pin_mask_reset_forbidden.
It would be useful for the pin mask to check if the efuse has been burnt before disallowing access to the GPIO11 pin when building said mask for the esp32c3/6.
I went through the logic in py/circuitpy_mpconfig.mk and tried to identify everything that was turned off when FULL_BUILD was turned off which is the list of parameters I added to each of the boards that had overflowed by adding the new TERMINAL_SCALE logic. Not every M0 board needed to be updated although it's possible that all the boards I didn't update already had the FULL_BUILD turned off.
Other than the CIRCUITPY_FULL_BUILD option I didn't turn anything else off on the boards, the lis...
Would something like this be a more acceptable approach?
SB_VID = 0x239A
USB_PID = 0x8014
USB_PRODUCT = "Metro M0 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C, W25Q16JVxQ"
LONGINT_IMPL = MPZ
CIRCUITPY_RAINBOWIO = 0
CIRCUITPY_FULL_BUILD = 0
# Re-enable some of the features that CIRCUITPY_FULL_BUILD=0 disables
MICROPY_PY_ASYNC_AWAIT = 1
CI...
If anyone gets a moment this can use a review: https://github.com/circuitpython/CircuitPython_Library_Screenshot_Maker/pull/32 I noticed that the screenshot tool was not showing png or jpg files and have fixed it. I also removed the restriction on showing settings.toml and always show it instead of only when certain libraries are present.
I reviewed it but don't think I have access to approve.
Thank you. We can probably get you added if you want to be member of Circuitpython org, though I don't know exactly how to add or if I have access to do that.
I have no problems being added if wanted. Guess it never came up before.
For the small M0 builds, instead of the original idea of CIRCUITPY_NOT_FLASH_LIMITED, I would just do CIRCUITPY_TERMINAL_SCALING or CIRCUITPY_TERMINAL_SCALE. Then turn that off for the boards where it doesn't fit.
I know you are trying to figure out how to solve this problem more generally. When a board overflows, we only want to turn off one or a few features to get it to fit. Either we should do that per board, or we should make up a CIRCUITPY_MEDIUM_BUILD (I don't like the name...
Hi! Is there a way to have the 'i2ctarget' module working on the XIAO ble board?
Not sure that is useful to everybody, or if there is enough space or all that kind of reason why it could be missing.
But it is rather easy to make your own build, or even get the firmware generate just by making a PR and have it automatically generated.
I think there was a podcast from Dan explaining how to do that very recently, where he was explaining.
thx. i'll check that out
i2ctarget is only implemented on the RP2, ESP32 and Atmel ports, it's not available on the NRF52 port. I don't know what it would take to port it
I'm guessing you're using the XIAO Sense with the nrf52840 - the Feather Sense from Adafruit doesn't have i2ctarget either, so might not be available on nRF boards, but one of the devs can probably explain. If you're interested in building CircuitPython yourself, check out the learn guide at https://learn.adafruit.com/building-circuitpython or my interview with danh where he talks about the process is here https://www.circuitpythonshow.com/@circuitpythonshow/episodes/building-circuitpython-with-dan-halbert
well there you go then. 🙂
I believe we don't have a per-port support matrix, so knowing that involves looking into the source files (knowing what you're looking for). Like that for example:
❯ find . -name i2ctarget
./shared-bindings/i2ctarget
./ports/atmel-samd/common-hal/i2ctarget
./ports/espressif/common-hal/i2ctarget
./ports/raspberrypi/common-hal/i2ctarget
Remove extraneous debug printf's.
Noticed by Jolsen in discord, and diagnosed by @Neradoc: #help-with-circuitpython message. Thanks!
Yeah, so it is possible to see what module is in what board, but not the reason it is not present. And there is no "higher level" view on X is not supported on MCU Y.
You have to look in the "ports" folder in the source to find out.
We had similar kind of discussion on having somewhere explicitly written that this some mcu are alpha or experimental and not feature complete. Now that is in the release notes: These ports are considered alpha and will have bugs and missing functionality:
I don't remember if I wrote a script that would use the support matrix script to make a list per port or if I only thought about it 🤷
it would be nice to add port name and some kind of filter on the support matrix -- not asking you to do it!
building the matrix does not work on my local repo rn:
Traceback (most recent call last):
File "tools/build_board_info.py", line 288, in <module>
generate_download_info()
File "tools/build_board_info.py", line 257, in generate_download_info
board_info = board_mapping[board_id]
~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'nordic'
with print outputs, this happens to be when going through a Zephyr-cp board
I'll remove zephyr-cp from the SUPPORTED_PORTS for now
Welp, I figured out a way to add support for inverted colors to TileGrid. But there might be a slight issue with the terminal reading random-ish bits out of memory to set the inverted state for each tile 😅🦓.
@slender iron catch-22 on web workflow:
If something goes wrong when starting up web workflow that raises an exception (e.g. zero-length SSID), then an exception is raised, which doesn't work because no VM, so it tries to go into safe mode, but then tries to startweb workflow again, so loops.
So should we NOT enable web workflow on safe mode? That's overkill sometimes for people who require it. Maybe at least not start web workflow on certain safe mode reasons.
The specific problem here was that in the web installer, if you don't fill in the SSID value, then it ends up being CIRCUITPY_WIFI_SSID="", which is caught as the wrong length. But someone could do this wrong by hand too.
Maybe exceptions with no VM should have their own special safe mode reason.
Simlar issue to https://github.com/adafruit/circuitpython/issues/10086 but that didn't cause a loop, just safe mode
Looks like a "punch card" from long ago....
I was totally getting the punch card vibe from it as well!
@tulip sleet I think a special safe mode could work. We could also make web workflow check the ssid length itself.
so it doesn't safe mode.
that's kinda my expectation. core code calling apis should make sure arguments are valid
The specific reason is "Heap allocation when VM not running."
SafeModeReason.GC_ALLOC_OUTSIDE_VM. I wonder if that reason is good enough not to start web workflow, because there might be other things that go wrong that might raise an exception (some bad wifi problem, or USB problem, maybe?).
But certainly if the credentials are bad it should just not bother, too.
perhaps we should have "exception raised outside VM" as another reason
alternatively we could make exceptions work without the vm and then catch them
I was thinking about that a bit too. For now I will just ignore zero-length ssid. Adding another SafeModeReason is a storage drag on the tiniest builds.
I started to do it, but I will stop.
@tulip sleet as an FYI, tonight I'll open up 4 more small PRs for secrets.py updates. And then this is all that's left to do in the bundle:
Soooo close
And then onto the guide
and @willow totem need to look a little deeper, but think there's only one repo in the bundle left pointing directly to AIO_USERNAME/AIO_KEY
I see a similar situation, where code is paused when fetching a URL from the web workflow, to the point of causing a complete freeze of the board, losing USB and everything. When the board's code is particularly busy, this happens easily.
The freeze seems to be triggered by some access by web workflow, including the single scanning done by the web workflow home page of another board or the recurrent scanning by discotool manager (both of which retrieve some information on the board after det...
Tested successfully with this:
import board
import displayio
import terminalio
palette = displayio.Palette(2)
palette[0] = 0x000000
palette[1] = 0xffffff
bbox = terminalio.FONT.get_bounding_box()
tg = displayio.TileGrid(terminalio.FONT.bitmap, pixel_shader=palette,
tile_width=bbox[0], tile_height=bbox[1],
width=10, height=4, default_tile=0)
for i in range(40):
tg[i] = i
main_group = displayio.Group()
main_gro...
If the CIRCUITPY_WIFI_SSID="" in settings.toml, the web workflow will get an internal exception when trying to start, and will raise an exception that causes a safe mode, because there is no VM to help raising the exception. I'm assuming this starts a startup-loop, because CIRCUITPY never appears.
It is kind of easy to get CIRCUITPY_WIFI_SSID="" if you don't give an SSID when using the part of the web installer that adds credentials.
Fix is: don't try to start the web workflow if ...
IThe use of a tuple for the coordinates seems unusual to me. The constructor takes x and y arguments. Are there other displayio things that take tuples for (x, y)?
IThe use of a tuple for the coordinates seems unusual to me. The constructor takes
xandyarguments. Are there otherdisplayiothings that take tuples for(x, y)?
tilegrid.contains() https://github.com/adafruit/circuitpython/blob/22e5a09c196bcd7b32bd6aba0e5367e1c13afac7/shared-bindings/displayio/TileGrid.c#L302 acceps a tuple for x,y coordinates, although they are display pixel coordinates, not tile index coordinates. Also iirc I added contains() and used a tuple to make it co...
Got it, thanks for the explanation.
Got it, thanks for the explanation.
I've got a few ideas in mind that might be able to trim some bits of code. I'll see if I can get it under the limit for the one that overflowed.
Thanks for the reversion. I now see that the build failures due to size are >1kB, which is way more than the code you added. I think this is because adding CIRCUITPY_TERMINAL_SCALE is the first instance of using common_hal_os_getenv_int() in these builds, which cause all the getenv mechanism to be linked in. Previously the build did not use getenv at all, and that code was omitted at link time.
I think the most straightforward fix here is to guard the code you added with
#if CIRCU...
I was able to shave 30 or so bytes by refactoring the nested for loops, and the larger branching if statements. However it's still not enough to fit the feather m0 supersized.
I've disabled rainbowio on that device for now which makes it match the feather m0 express.
If someone can point me towards how to use MP_DEFINE_CONST_FUN_OBJ_VAR or whatever is needed to define a function that has 4 total arguments I can try splitting x and y values back out of the tuples, perhaps losing the...
If you think using the tuple is more consistent with the rest of the API, then I'd say stick with that.
There are a bunch of uses of MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN . I remember being mildly tripped up about counting the self argument or not, I think, but I don't remember the details.
Remaining TODO:
- [ ] mobile layout for index.html
- [ ] /libraries design
- [ ] guide block loader
- [ ] header spacing clean up
Also updates to latest jekyll and related dependencies, some dev speedup, utilizes latest ruby and yjit.
Best way to run in dev is now with bin/dev.
okay, I'll leave it alone for now. it does also match the tile getter and setter that use square bracket access in python code like tg[(3,0)] = 24 which accept tuples as the value in the brackets and without the parens tg[3,0] = 24 which is essentially the same as I understand it.
This needs to handle dirty area inside of set_inverted. Currently the change wont become visible unless something else changes causing the area of the tile to get refreshed.
In the example script above it works because it gets set before being rendered the first time I think. But with an added time.sleep() and then changing some invert values they do not take effect currently.
I think the most straightforward fix here is to guard the code you added with
I love it :heart:, Thanks!!!
Oops, I just re-read you code and see I was so excited at the solution I missed the details of your suggestion. I'll fix and resubmit :grin:
It looks like I still have to guard the call I added to common_hal_os_getenv_int or I get an undefined reference. Since the call has to be guarded and by guarding the call and the include at the top, getenv is apparently not linked in, is there still any added value in guarding the contents of shared-module/os/getenv.c?
The latest commit resolves that issue by forcing refresh on tiles when their inverted state changes.
This new example code validates that it behaves as expected:
import time
import board
import displayio
import terminalio
palette = displayio.Palette(2)
palette[0] = 0x000000
palette[1] = 0xffffff
bbox = terminalio.FONT.get_bounding_box()
tg = displayio.TileGrid(terminalio.FONT.bitmap, pixel_shader=palette,
tile_width=bbox[0], tile_height=bbox[...
I meant add guards both places. Guard your own call to common_hal_os_getenv_int() that you added in this PR, and guard the contents of getenv.c so this won't happen again. That's the advantage of the latter.
I'm not sure, but I wonder if my recent IRQ changes on RP2350 are causing a problem during storage.erase_filesystem(), and maybe flash writing in general. I'm seeing Thread 1 "rp2350.dap.core0" hit Breakpoint 3, reset_into_safe_mode ( reason=reason@entry=SAFE_MODE_HARD_FAULT) at ../../supervisor/shared/safe_mode.c:114 114 if (_safe_mode > SAFE_MODE_BROWNOUT && reason > SAFE_MODE_BROWNOUT) { (gdb) where #0 reset_into_safe_mode (reason=reason@entry=SAFE_MODE_HARD_FAULT) at ../../supervisor/shared/safe_mode.c:114 #1 0x200002a0 in isr_hardfault () at supervisor/port.c:557 #2 <signal handler called> #3 hardware_alarm_irq_handler () at sdk/src/rp2350/pico_platform/include/pico/platform.h:189 #4 <signal handler called> #5 0x00000de4 in ?? () while inside f_mkfs. I can't see the outer stack frames, but it's possible that this interrupt is being delivered when "most but not quite all" interrupts are supposed to be disabled. I can't find where hardware_alarm_irq_handler is at a higher priority in the sdk though.
I can confirm that I have the same crash on a M4 express CAN board when CIRCUITPYTHON_TERMINAL is in a group, so I think it's neither board- nor scale-specific.
I somewhat circumvented the problem by removing the terminal from all groups before the program ends, but it's still crashing if I do a KeyboardInterrupt from the serial console (I've tried to use try/catch, but this doesn't seem to work with async code?)
I somewhat circumvented the problem by removing the terminal from all groups before the program ends, but it's still crashing if I do a
KeyboardInterruptfrom the serial console (I've tried to usetry/catch, but this doesn't seem to work with async code?)
You can use the atexit module to guarantee that some code will be called:
import atexit
@atexit.register
def release():
some_group.remove(displayio.CIRCUITPYTHON_TERMINAL)
this crash is ... odd. It moves around. This time (it happens with some frequency) the crash was inside common_hal_os_urandom. The disassembly was .. wrong. (gdb) disas common_hal_os_urandom Dump of assembler code for function common_hal_os_urandom: 0x100419a4 <+0>: movs r0, r0 0x100419a6 <+2>: movs r0, r0 0x100419a8 <+4>: movs r0, r0 0x100419aa <+6>: movs r0, r0 0x100419ac <+8>: movs r0, r0 0x100419ae <+10>: movs r0, r0 0x100419b0 <+12>: movs r0, r0 0x100419b2 <+14>: movs r0, r0 0x100419b4 <+16>: movs r0, r0 0x100419b6 <+18>: movs r0, r0 0x100419b8 <+20>: movs r0, r0 0x100419ba <+22>: movs r0, r0 0x100419bc <+24>: movs r0, r0 0x100419be <+26>: movs r0, r0 0x100419c0 <+28>: str r3, [r4, #0] 0x100419c2 <+30>: cmp r1, #0 0x100419c4 <+32>: beq.n 0x10041aaa <common_hal_os_urandom+262> 0x100419c6 <+34>: ldr r6, [pc, #244] @ (0x10041abc <common_hal_os_urandom+280>) 0x100419c8 <+36>: mov r8, r0 0x100419ca <+38>: mov r7, r1 0x100419cc <+40>: add.w r5, r6, #31 look how the initial instructions are all replaced with movs . After a fresh run the instructions are restored. so it's like there's a problem with flash or something ...
At the time of the crash nesting_count is 0, so it's not supposed to be an interrupts-disabled time. and i reverted my "mask interrupts by priority" code as well.
and sometimes it is successful
Perhaps there's some XIP involvement there.
Looks like xxxxxxa0 to xxxxxxbf got zeroed in the XIP cache.
@onyx hinge could you reproduce the 240mhz thing with tinyusb and pico-sdk? I'm more likely to do that than arduino
@slender iron almost certainly but it looks like I'm putting that business aside for now so I'll stop banging that drum so hard
I think the dvihstx library is complex because it is based on the original picodvi code
CircuitPython version and board name
metro rp2350
Code/REPL
>>> storage.erase_filesystem()
Behavior
Usually freezes with the white LED on.
with pico-probe a variety of weird crashes and double faults are observed. For instance on one occasion it crashed within a function in flash that appeared to have its content overwritten; but on restart, the content was restored (so problem with XIP cache?)
(gdb) disas common_hal_os_urandom
Dump of assem...
discord stream of consciousness from me: #circuitpython-dev message
@short tendon if there are any more settings.toml PRs you can tag me on them. Dan is going to get back into some other tasks to get them wrapped up so that some other future fun things can move forward. I'll be out for a chunk of tomorrow, and do have some other things going on as well but I'll get them reviewed when I can.
Awesome, there's just a few more. Not sure if it's easy to release the current set or not. I'm using the bundle to find them, but pulling the main branch on a bunch to get them current.
@lone axle this is what I think is left
@short tendon I can release those 4 that I just merged in a few moments. Are there others that you know of that are already merged but not released?
the conf.py ones are odd, I wonder what is in those
Those are pointing to secrets for autodoc
Oh, in the mocked list. Interesting, I didn't know that would work for something like secrets.py that was a file on flash instead of a core module
I guess without it, it may try to link it to the cpython secrets docs
And these:
- CircuitPython_LIFX
- Adafruit_Wiznet5k
- Adafruit_Pastebin
- Adafruit_OAuth2
- Adafruit_Qualia
- Adafruit_ESP32S2TFT
okay I think those are all set
Awesome
@lone axle if Dan is out for a bit, willing to peak at the questions here: https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/pull/245
Yes, but I'm out for the night. I've added it to my list.
The version.json file is populated _reply_with_version_json, and the hostname is only set on https://github.com/adafruit/circuitpython/blob/main/supervisor/shared/web_workflow/web_workflow.c#L846.
common_hal_mdns_server_get_hostname (which also has a raspberry pi implementation whi...
Wait, just noticed that the logic around how the hostname is populated was changed in ed0e640fb8eb00fcac455034fe3eea18d07da81b, so maybe this is a question for @tannewt?
On Show and Tell @FoamyGuy demonstrated how he was able to modify the terminal font color which got me thinking that the same functionality could be used to enable the VT100 Escape sequences for setting the terminal background and foreground. This PR adds support for all the color attributes as well as the reset to default sequence.
I used the following code.py file to test the functionality:
ans = ''
while ans.upper() != 'Q':
ans = input('Enter ESC sequence: ')
print(ch...
This adds a target for an ESP32C3 device with an SPI ST7789 display, an external 16MB flash, buzzer, user programmable button, lithium charge circuit and a UART broken out to an unpopulated GPIO header.
The device also has an I2C CST8xx touch device, but it is not usable unless #10100 is actioned, as the SDA line is on GPIO11, which is usually reserved as "VDD_SPI" but, since this device has external flash, and has had the BLOCK0 VDD_SPI_AS_GPIO efuse burnt, there is no technical reason ...
hey we need to fix the version number of adafruit_rgb_display by making a new release with a valid version number (latest has 3.13 which is not x.y.z)
https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/issues/130
https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/releases
can we just do a release without a new commit by adding a tag ? can we delete the tag/release and redo it ? will that break something like pypi ? I don't know how to github that properly
My recollection is that another release without any change does break something but I don't recall exactly what.
This needed validation on the x,y values in order to avoid hard faulting if the user passes values outside the range of the tilegrid size. After adding those it pushed the feather_m0_supersized over the limit again.
I ended up disabling displayio on that device which leaves plenty of room. I am open to suggestion if there is something else that would be better to disable on that device.
Looks good - thanks for your patience on this!
Thanks for adding this! One question.
I think you can do this but you'll want to "yank" the bad release on PyPi.
worst case you can make a trivial change
Higher end ESP32S3 N8R8 device with 400x300 EPD, SD card slot, 24 pin GPIO header, 3 user programmable buttons and a bi-directional rocker switch with click, battery header and lithium charge circuit.
EPD is driven by SSD1683 driver chip.
seems fine. one question, but it's just for my curiosity.
I quickly perused the issues to see if I could make a useful PR while we're at it (like #120 about ImageFont.getsize() being deprecated), but I don't have compatible hardware to run the example
Thank you for taking this on! Unfortunately, I don't think this is the right approach.
Instead, I think it'd be better to make a terminal-specific pixel_shader. Tilegrid passes in the tile coordinates to the pixel shader. The shader can then store the foreground and background color indices for each tile.
This would then leave TileGrid nearly unchanged and not cost more memory for inverts on every TG. It'd also allow recoloring of foreground and background of each character.
What do ...
I'd rather you factor out the code to mark a tile area dirty so you can use it here. That way we can optimize set_tile to skip a dirty area when the tile index is set to the current value.
This will allocate one byte per tile. It may save some code size to do so but it'll leave 7 unused bits.
What do you think about this? It'd do something for all palette sizes.
if (self->inverts[tile_location]) {
input_pixel.pixel = common_hal_displayio_palette_get_len(self->pixel_shader) - 1 - input_pixel.pixel;
}
Add:
if (self->inverts == NULL) {
return false;
}
@lone axle let me know if you want to chat about the invert support
Would someone like to try fixing it here:
https://github.com/adafruit/circuitpython/blob/e5c2902295401b3d1b8d041dd38751b48057c76a/shared-module/busdisplay/BusDisplay.c#L420
It should set it as the root group even if it is in a group. (Maybe force it to false.) Or we need a finalizer for all group objects that remove the children from them.
Note that framebuffer displays always set it:
https://github.com/adafruit/circuitpython/blob/e5c2902295401b3d1b8d041dd38751b48057c76a/shared-module/framebufferio/FramebufferDisplay.c#L329
Okay, trying to see if my understanding of your suggestion is right... With the new kind of pixel_shader there would still also be a need for a "normal" palette right? The new kind of pixel shader would essentially store the 2D grid, and for each location it holds two index numbers which represent foreground and background, but then something still needs to reference a Palette at those indexes to get the color value?
Could it be not specific to terminal somehow? I think it'd be great if there were still some way to use it with TileGrid too, that would give us similar highlighting cababilities within display_text and similar libraries.
Web workflow responses are currently blocking. So, if they take a while, then everything else will be starved. I think the easiest way to fix this will be switching to Zephyr (or another RTOS). That way the web workflow can run in a separate thread and yield as it waits for sockets.
@lone axle Yup! That sounds right. Maybe a "PaletteExpander"? It takes the tile dimensions, input bit count (2) and then the output palette.
Sounds like a new module too so we can selectively enable it.
then for every tile it maps input values to output values
terminal would use it when enabled to provide coloring. otherwise it could use palette directly still
Okay, I think I understand. I can take a crack at it. I've never made a new module before, I could give that a try, but may move back to displayio to start dev if I can't the "plumbing" working for a new module.
Based on the direction #10102 appears to be heading, this will probably need to be re-worked once that PR is merged. If each tile does get a foreground/background color index then perhaps this can be made more compliant and apply from the current cursor rather than applying to the entire screen.
I suspect this is a mismatch of my expectations of how the IDF works. I thought it duplicated the given string and then held onto it: https://github.com/espressif/esp-idf/blob/0461e2ff88369c3da0d4caced31e8488f53376cd/components/esp_netif/lwip/esp_netif_lwip.c#L1689
However, there is some tricky task stuff here that may mean we sometimes corrupt the hostname before it is copied. Maybe we need to read it back until it matches after setting it?
@slender iron What if it didn't store 2 values for foreground and background, but instead just the boolean to represent inverted? It could still be packed more effeciently than the byte array from the PR. Then it can just do the "inversion process" on the color before returning it if inverted state is true for that tile. It could also still potentially be used in cases where the palette length is >2 like you mentioned in one of the PR comments by getting the "opposite" index from within the length of the palette.
If it stores foreground and background indexes then it seems to only really be meant for use on 1bit bitmaps where color index 1 is foreground and 0 is background or vice versa. If the bitmap has more colors in it, then any pixel that happens to not have 0 or 1 wouldn't get changed by this new pixel shader (if I am understanding).
I'm less concerned about bit packing if the memory isn't owned by tilegrid. That way it is opt in. You can take in the number of input colors and store that many mappings per tile.
and the value size of that mapping is dictated by the number of colors in the output palette
Do I understand this correctly? when terminal wants to "highlight" a cell will it need to basically call a function on this new pixel shader to update the mapping for that cell? So in the most basic case of 1bit color at the start every cell has both colors mapped to itself 0:0, 1:1. Then terminal wants to highlight the cell at 0,0 so it tells this new pixel shader to update the mapping for cell 0,0 to 0:1, 1:0.
Right. That'd be 1 bit to 1 bit mapping. (So maybe expander name isn't ideal.)
TilePaletteMapper or TilePaletteFilter come to mind for me but I'm not sure if they are right either. Including Tile in the name helps convey to my brain at least that it's storing the 2d grid mapping.
That makes sense. TilePaletteMapper sounds good
This causes tuh_inited to be placed in RAM so that it can be called from the second core. I'd really love a linker to handle this for me. (Maybe a leave project.)
oh I hadn't even figured out that was a regular expression or glob or something. I was looking for sections/symbols named "cmved". thanks for the clarification!
@lone axle not rush, but tagged you on what should be the last 11 secrets.py library updates. They are all super small
Is blocking new to CP9 ?
The test code above with 8.2.10 on the same QTPY S2 goes without error for over 10 minutes.
So I hope there is some way to mitigate the issue to return to the previous behavior. I can live with the board stuttering when a file is uploaded or it's scanning MDNS, but the problem is the complete freeze for minutes or never recovering, plus drive corruption when USB fails.
On 9.x latest, the test starts failing within 30 seconds. In fact it's quite regular, the first err...
Okay just so I'm on the same page, we're looking at:
You're saying that the call to esp_netif_set_hostname may potentially trigger some asynchronous process to set the hostname so by the time it uses the provided char* (pointing to cpy_default_hostname) it's gone out of scope and is being overwritten by something? Yeah I could see that causing a...
The underlying async call looks like it would be happening here: https://github.com/espressif/esp-idf/blob/0461e2ff88369c3da0d4caced31e8488f53376cd/components/esp_netif/lwip/esp_netif_lwip.c#L212-L227
But it looks like that should still block until it receives a result. I don't see anything that wouldn't require the return value that it gets from eventually executing the callback.
3 open PRs and then no more secrets in the bundle! After those get in, on to the learn guide!
Would someone like to try fixing it here:
I can start poking at it, but my time is spread pretty thin at the moment so it may take a while. If anyone else has an interest don't wait for me :grin:
There is a possible race condition. The global variable nesting_count used in common_hal_mcu_[en,dis]able_interrupts is volatile but accesses to it in these functions are not atomic. Since this variable is manipulated with interrupts partially enabled, it may get clobbered.
No problem! I figured we'd need values for default foreground and background.
Yup, that was my conclusion too. It looks like it should work. :-) Maybe this is an IDF bug.
Maybe LWIP does a second delay. I know the MDNS code does this a lot where it issues a message to another thread to set a value. Reading it doesn't and reads memory directly.
No, it isn't new to CP9. CP9 did upgrade to IDF 5 though. It was a big step and the "wake circuitpython up from socket activity" is complicated. https://github.com/adafruit/circuitpython/blob/a1f4eeace37b5c960b083bec31b4e26de5814f40/ports/espressif/common-hal/socketpool/Socket.c#L69
The easiest way to hunt this down may be a git bisect. It'll be time consuming but also enlightening.
website data for newly added board.
Images automagically compressed by Calibre's image-actions ✨
Compression reduced images by 28.7%, saving 94.66 KB.
| Filename | Before | After | Improvement |
|---|---|---|---|
| assets/images/boards/large/lolin_s3_mini_pro.jpg | 61.96 KB | 38.32 KB | -38.2% |
| assets/images/boards/large/spotpear_esp32c3_lcd_1_69.jpg | 75.51 KB | 57.50 KB | -23.9% |
| assets/images/boards/original/lo... |
The problem is reproducible on an Adafruit Feather RP2350 with an HSTX to DVI adapter attached. Reproducing the problem also requires initializing picodvi.Framebuffer. I used Scott's demo ruler app from the adapter tutorial.
Running with stock 9.2.4 problem does not occur. A top of main build does fail. I protected nesting_count in common_hal_mcu_disable_interrupts() by completely disabling interrupts at entry and re-enabling on exit by save_and_disable_interrupts() and restore_interrupts() but this does not resolve the problem.
Quick question about reviews/merges. If (say for https://github.com/adafruit/circuitpython/pull/10052) I see the changes jepler requested were complete and I know I could dismiss his review to approve/merge it. But would the core team prefer I wait for the re-review? I know things can get busy but also don't want to cause more chaos so figured I'd ask.
@onyx hinge For #10104, did the Metro RP2350 you tested with have PSRAM installed?
No
The reason I'm asking is that tlsf does not differentiate between PSRAM and RAM allocations. Because all XIP address space accesses, including PSRAM accesses, will not work once we're inside port_internal_flash_flush, any IRQ 1 accesses to PSRAM via XIP may fail and/or corrupt the XIP cache. This will need to be covered, but since it's not the problem right now I'll disable PSRAM on my board.
Couple other thoughts (not sure if they are great or bad ideas yet):
- SYNTHIO_MAX_DUR is referenced often with the LFO ticking. Maybe worth picking a set processing length.
- And in that theme maybe then worth moving some LFO stuff outside of synth? Haven't thought too long on that.
- Also worth thinking as the zephyr work progresses being able to properly schedule these actions (rather then running in
RUN_BACKGROUND_TASKS) should be considered.
I hadn't spotted the bootloader version was a defined value, and since adding the TDisplayS3 bootloader option it needs the latest tinyUF2 release to pick it up.
Otherwise currently stalls at downloading bootloader stage:
This should pick up https://github.com/adafruit/tinyuf2/releases/tag/0.21.0
This PR adds
- Basic VT100 scrolling (full screen only, I'm looking at scrolling range but it's fighting me)
- A place holder for the VT100 cursor On/Off sequence
(thinking may be useful after #10102) - Support for a third parameter passed to the screen attribute
(allows for somewhat common reset/foreground/background sequence) - Add
ESC[Hwhich does the same thing asESC[0;0H
@willow totem as and FYI, writing tests against the examples in the cpython folder works awesome. I updated minimqtt_adafruitio_cpython to just loop 3 times.
@mock.patch('sys.stdout')
def test_minimqtt_adafruitio_cpython(mock_stdout, aio_env):
from examples.cpython import minimqtt_adafruitio_cpython
mock_stdout.assert_has_calls([
mock.call.write('Connecting to Adafruit IO...'),
mock.call.write('\n'),
mock.call.write(f'Connected to Adafruit IO! Listening for topic changes on {ADAFRUIT_AIO_USERNAME}/feeds/onoff'),
mock.call.write('\n'),
mock.call.write('Sending photocell value: 0...'),
mock.call.write('\n'),
mock.call.write('Sent!'),
mock.call.write('\n'),
mock.call.write('Sending photocell value: 1...'),
mock.call.write('\n'),
mock.call.write('Sent!'),
mock.call.write('\n'),
mock.call.write('Sending photocell value: 2...'),
mock.call.write('\n'),
mock.call.write('Sent!'),
mock.call.write('\n')
])
I think as long as we add manual check that runs these, so the repo owners could run it before merging a PR it would work great. I'd propably update the examples a bit as well...
I have changes ready that add a CIRCUITPY_TERMINALIO_VT100 compile flag to disable the new VT100 escape sequence support on all SAMD21 boards using the mpconfigport.mk file. I figured I should wait to submit the commit so that these failures could be checked out....
It looks like flash is overflowing in some languages for some boards. Maybe the code size is making terminalio just big enough to exceed the flash in certain situations for certain languages. @dhalbert might be able to verify.
Hello is there a way to improve the error message that we receive when the user has not setup the wifi SSID and password in the settings.toml. I was using the Pyportal Titano without the correct configuration in the settings.toml, and following the learning guide and I got the following error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "conexion.py", line 66, in <module>
File "adafruit_esp32spi/adafruit_esp32spi.py", line 690, in connect_AP
File "adafruit_esp32spi/adafruit_esp32spi.py", line 558, in wifi_set_network
File "adafruit_esp32spi/adafruit_esp32spi.py", line 429, in _send_command_get_response
File "adafruit_esp32spi/adafruit_esp32spi.py", line 307, in _send_command
TypeError: object of type 'NoneType' has no len() ```
Using the code here https://learn.adafruit.com/adafruit-pyportal/internet-connect
board.DISPLAY is not defined on RP2040-zero with ssd1306. Is there another way to do this?
I'm beginning to think that the problem is interaction between DMA read access activity to the HSTX peripheral and the XIP section while programming a flash block. It's possibly a starvation issue for XIP during flash programming. Going through the Pico SDK and RP2350 bootrom code with a fine-toothed comb I'm not finding any nits that would cause breakage from the brief delay introduced by running the IRQ service routine for the frambuffer.
Admittedly there remains much hand waving in this e...
Something to consider about the switch from secrets.py to settings.toml... In some cases secrets.py was used in the blinka / raspberry pi context i.e. https://learn.adafruit.com/bluetooth-le-broadcastnet-sensor-node-raspberry-pi-wifi-bridge/install-pi-bridge-software. We can't simply swap this and instruct the user to create settings.toml because in cpython there is nothing that will automatically load values from settings.toml into environment variables.
I don't know if / how many more instances of secrets.py usage on rpi there are, but if there are others it would be nice to be consistent with how we change them. In my mind it makes the most sense to alter the script to "manually" read settings.toml and set environment variables out of each value found in there before accessing any of them. That code will differ from what is needed on circuitpython, but it will result in the user experience setting variables being mostly the same between MCU and rpi.
but there are other options, like just having them make environment variables in the normal linux way. Though it's temporary unless put into .bashrc or similar.
Can you open an issue in the repo?
I added this on the ticket. It's what I do in my personal projects:
try:
import tomllib
except ImportError:
import toml as tomllib
# Get Adafruit IO keys, ensure these are setup in settings.toml
# (visit io.adafruit.com if you need to create an account, or if you need your Adafruit IO key.)
with open("settings.toml", "rb") as toml_file:
settings = tomllib.load(toml_file)
aio_username = settings("ADAFRUIT_AIO_USERNAME")
aio_key = settings("ADAFRUIT_AIO_KEY")
It was added in py3.11 so totally good to use (updated to use toml for old versions)
I'm happy to update any CPython examples to use this
might be worth considering the minimum version we want to support for blinka. Currently it's listed at 3.7 in the blinka repo, but libraries and circuitpython typing are 3.8 I believe, and even that is EoL now. It might be time increase that.
if we use something requiring 3.11, and the minimum supported version for blinka remains lower than that we would need to probably call out that the specific examples require something higher than the minimum of blinka.
is tomllib available on pypi for older versions of python ? if so it could be an added requirement
or is it like try: import tomllib / except ImportError: import toml as tomllib ?
I was thinking earlier it might be nice if blinka would do this automatically when it's imported. I'm not sure if an imported library has access to the location of the file that imported it though, which it would need in order to find the settings.toml file that the user was instructed to create next to the project files.
hmmm there's always os.cwd() or whatever it's called, but that might not be right, not sure how to get the path of the __main__ script caller, but that should be possible ?
We could put in a call to release displays if it only affects storage.erase_filesystem() but my worry is that it affects any flash writes...
That seems like a bigger change. Would we be good with the toml load approach to start?
and adding toml to Blinka
toml; python_version < '3.11'
@jepler AFAIKT it affects all flash writes. storage.erase_filesystem() is performing a large number of back-to-back writes which serves to hit the problem reliably. There's no error detection/reporting mechanism in flash write SDK or bootrom code, so when it fails it does so silently. Sigh.
I'm giving myself a crash course on DMA/HSTX/TDMS operation. It's impressively complicated.
Hi, yes no problem ill put it in the Adafruit_CircuitPython_ESP32SPI, Foamyguy or Danh can move it afterwards if that is not the correct repo. 🙂 Thank you!
That's totally the right one. High likelihood I'll tackle it
There's another spot in ByteArray.c:write_page() that writes flash. This instance does not disable audio DMA.
while it's true that the audio dma disable maybe should be done in nvm's write_page as well, this was added to fix bad audio output while interrupts were delayed, not to fix incorrect flash writes or bad xip after flash writes. For more background:
- #8121
- #8123
Tangentially related, the code in supervisor_flash_pre_write() and supervisor_flash_post_write() is redundant with SDK 2.1. The Micropython folks must have hit the same problem with PSRAM config across flash writes and fixed it in https://github.com/raspberrypi/pico-sdk/pull/2082. Likewise, the necessary XIP cache flush went in with SDK 2.0.
board.DISPLAY is a short hand for "the built in display, if this board has one in its board definition". If you create a display object in your code with a line like display = ssd1306(...) then you'd write display instead of board.DISPLAY.
.. and use it to give a better type hint for supervisor.runtime.display.
I'm pretty sure this should be
//| AnyFramebuffer = (
As in... AnyFramebuffer is any of these types, not to be an instance of them
On a quick check in a blank file
foo: int | float
bar: foo # Variable not allowed in type expression (by pylance extension on VSCode)
foo = int | float
bar: foo # nothing reported
PS: Same thing applies below
thanks! This is a mistake I commonly make.
It turns out the broadcom and zephyr port bindings weren't being shown in the docs, so I added them.
board.DISPLAY is a short hand for "the built in display, if this board has one in its board definition". If you create a display object in your code with a line like display = ssd1306(...) then you'd write display instead of board.DISPLAY.
yep. If you do display.root_group = None with your own display, it doesn't work like that, though, is my point. At least on my RP2040, I needed to also run those 2 supervisor lines to remove the initial flash of console. Even with that, if your loop br...
I've never built and run my own circuitpython firmware. How difficult is the process if I wanted to do something simple like add a check right after the esp_netif_set_hostname call to verify that it was actually set?
It's not that hard if you are familiar with software development on Linux. See https://learn.adafruit.com/building-circuitpython.
I would like to do a 9.2.5 release pretty soon, but consider this a blocker. What is the best short-term way forward? Is it
In the meantime, I recommend backing out #10049 and explicitly turning off HSTX DMA during flash write operations.
Or are we on the way to a fix?
Is there anything to be done with DMA priorities that could improve glitching?
I've not nailed the root cause. Earlier I wrote that it appeared not to be IRQ related, but on closer examination this may not be correct. The flash write code in the SDK appears to assume that interrupts are completely disabled and the "victim" core is entirely quiescent. There's a very funky window where the bootrom is re-entered to re-initialize XIP that could be hazardous to interrupt.
I'm adding a third DMA channel to re-trigger the command DMA channel in framebuffer to eliminate the ...
I've added the logic to disable the advanced VT100 escape sequence for samd21 boards but haven't utilized it yet so that the overflowing boards could be examined in case there is a better approach to resolve the overflows for the particular boards.
<@&356864093652516868> Meeting in slightly less than 1.5 hours, at 2pm US ET / 11 am US PT. Add your notes to https://docs.google.com/document/d/1bNFt1NA9zvPNA-9fpOf6_6CKmBYoHS0k9QKDYaF9TLg/edit?usp=sharing
We usually just copy the product page contents if someone else wants to do it.
Please do disable this on small boards. No need to add new features to them.
Is this enabling or disabling it?
That command is enabling the features. I'll go ahead and submit a commit that disables them...
<@&356864093652516868> We're wrapping up our internal meeting & will start the discord meeting soon!
brb
Informal hug report (I have no notes): I love the C64 emulation on Fruit Jam
@thorny jay it's now able to start & play a game. my high score is 29.
this is in pico-sdk not circuitpython
Yeah, I assumed it was not python code...
I hope there will be a known of famous keyboard mapping... maybe I will use my hardware C64 keyboard, it was running great in BCM64 bare metal on Raspberry Pi.
New to Building Embedded Systems? When we started working with embedded systems, we were overwhelmed by the lack of information available to beginners. We are sharing useful reference materials to get you started with programming and embedded systems development. We hope this resource serves as a shortcut on your journey. Table of Contents: Pro...
https://www.reddit.com/r/ClaudeAI/comments/1iyumpf/i_uploaded_a_27yearold_exe_file_to_claude_37_and/
We're vibin' with Claude 3.7 and writing uBlox drivers 😎🤖🛰️
Heeeey, we're just having a super chill vibe here at the desk of Ladyada—writing a driver for the uBlox M8Q (https://t.co/gUDOC2ma4m), which has both I2C and UART interfaces. As expected, it can do everyday NMEA
I think the simplest thing is to disable the HSTX display before doing erase_filesystem. It resets anyway so just turn it off early.
Let's deal with other flash writes during HSTX separately. I haven't actually see it myself so I'm wary it is a big issue.
Not visiting Brussels this time, sorry David
I have opinions about Europe. 😉
And we have high speed train.
thanks for reading my notes. python 3.9 itself was released in 2020.
On some system, you can have many version of Python running side by side in perfect chaos...
Blinka installs typing
yes in docker python3.8 installs the older adafruit-circuitpython-typing==1.10.1 which is the one that's 3.8-compatible.
[apologies, I need to sign off. have a good week all!]
I have an epaper device (esp32s3) which utilizes a master/slave pair of SSD1683 epd drivers to achieve a resolution of 792x272. The way it works is that it splits up each line of the buffer, sends the bytestring to enable the master ram, writes half to that, sends the bytestring to enable the slave ram, writes half to that, repeat until buffer is empty.. Is there a way within board.c to redefine the function that handles writing bits to the epd, or is this something that will require modification of displayio or the epd code elsewhere?
Thanks all
Have a great week, everyone. Bye!
I think I will have to re-listen to this "in the weed" section. 🙂
Thanks for hosting Dan. Have a great week everyone!
Also I was wondering about the time zone of Tiny USB (UTC+7?) and @slender iron (UTC−8?).
That must make working together on something a bit challenging.
It is 16 hours one way or 8 hours the other day?
thach is in vietnam
DST will be in effect next week 😬 In the USA
This is what I assumed.
For US...
I think you'll need to modify displayio because we haven't done a display like that before.
So maybe we need the warning for EU people...
I can get it to display on one half.. so at least i know i can send useful data to it.. that much is working..
Here is the notes document for next Monday’s CircuitPython Weekly Meeting (March 10, 2025). 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/14g8cgraUdNkIX4AiUpA_r2YfkXm_8MIflEEAMV8GrDM/edit?usp=sharing
Question for the core team that got lost in the weekend when I thought of it: for PRs that someone else has reviewed and requested changes is it okay for me to dismiss that review if I see those changes were made correctly? Would like to help / speed up reviews but also don’t want to create unintentional chaos (the PR for pitch shifting is what I had in mind).
@tulip sleet and @lone axle high level, does something like this look good?
Do I understand correctly you had test_def defined in your bash environment with value 'test', and you also had test_def=1 in the toml file?
yup. you can see I exported test_def up top to start. To show updating
Oh, right missed the top few lines.
I would lean towards having Blinka not overwrite pre-existing environment vars when it loads the settings.toml file. Maybe it can just print that there was a conflict and the value of each?
I don't think it's overly likely to come up, but if we overwrite an existing environment variable it might break something outside of Blinka.
it would only be in that python session
I wouldn't print the data - as it could be secret
good point
What ever way people think it should go
to me a setting in the local folder should trump the global
okay, if it's just inside the session it's not that big of a deal. I thought that was updating the actual environment variable as visible to bash and everything else too.
only downside is they would need to import board (or something) to get the code to run (unless someone has an idea how to force it to happen)
My assumption is/was that any code trying to interact withing something settings.toml file would be from a library or example that is already either itself importing something from Blinka, or imports something that imports something from Blinka.
@short tendon can you try pip3 install adafruit-blinka-bleio and then in the python shell import _bleio and see if it runs your loading hook? if it does I think that would at least cover the script from the broadcastnet PR
although that may just not work on windows for other unrelated reasons.
If you can push your current version that you got these screenshots with I can try it on a pi in a little while.
I'd follow dotenv and not override environment variable. https://github.com/theskumar/python-dotenv#getting-started
Ya, either dismiss or ping the other person
I tried, but it didn't. Pushed up my branch here: https://github.com/justmobilize/Adafruit_Blinka/tree/settings-toml
you can do:
pip install git+https://github.com/justmobilize/Adafruit_Blinka@settings-toml
but be aware with the submodules, it's a little slow
Things like using the minimqtt library wouldn't need anything blinka specific.
Could make a helper (like Dan said), and run it automatically when you import board
@short tendon I think we need to do something like str(value). I got this traceback from having a numeric value for a variable in settings.toml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/timc/venvs/blinka_venv/lib/python3.11/site-packages/board.py", line 21, in <module>
from adafruit_blinka.agnostic import board_id, detector
File "/home/timc/venvs/blinka_venv/lib/python3.11/site-packages/adafruit_blinka/agnostic/__init__.py", line 47, in <module>
os.environ[key] = value
~~~~~~~~~~^^^^^
File "<frozen os>", line 684, in __setitem__
File "<frozen os>", line 758, in encode
TypeError: str expected, not int
It would be in __init__.py
since that gets run on import
And I would be inclined to say that we can just add import board to examples that need settings.toml values. Even when board is otherwise strictly needed. Importing it will get Blinka to to run this for us.
import adafruit_blinka may be more affordant, since it's clear why it's being imported.
pylint/ruff will complain about it not being used, thought.
Thinking that might point back to from adafruit_blinka import getenv
that does sound better to me than import board although I do notice with the current code import adafruit_blinka doesn't seem to run the code that imports from settings.toml
I think it if moves to adafruit_blinka/__init__.py instead of adafruit_blinka/agnostic/__init__.py perhaps that would make it work with the other import
I was just typing that 🙂
or go back to patching os, which will always work, and doesn't require any extraneous imports
Now I am liking that better
... I think that's the best solution, since you always have to import that to get at getenv
so nothing extraneous
the patching mechanism is simple
Something still needs to be imported to patch...
But where would we patch os from? if it's inside of Blinka I think we are right back to the problem of these scripts don't actually cause blinka to get imported.
🤦
I take it back
try:
from adafruit_blinka import getenv
except ImportError:
from os import getenv
maybe we make it explicit? something like from adafruit_blinka import load_settings_toml
again, you'll have to flag it is OK for ruff/pylint
I was imaging it as a function that the code also needs to call load_settings_toml()
so then linter won't see it as unused.
no, all of that sort of stuff all comes from CPYthon AFAIK under blinka.
that is, a CPython script has to be different anyway, because the network code is different
right, requests instead of adafruit_requests and the boilerplate that entails.
in CircuitPython, you have to import wifi or set up ESP32SPI, etc.
so I like that load_settings_toml
Hi @tulip sleet, I have been investigating why there was no rainbowio in my Trinked TRRS. Actually I compared various Trinked to try to understand the logic.
And this is how I discovered https://github.com/adafruit/circuitpython/pull/9190 and the fight for space (also found out that neopixel is also out, and that is odd for something on the board).
I understand the choices made, even if keypad was a surprise, but I wonder if for such limited board, Adafruit should not stick to "mono-language". It make it less accessible, but might reduce the number of hard choices.
I guess I will be able to work around and make that Trinked do what I want, but this is all a bit of a bad surprise.
it's that neopixel isn't frozen (I think you know that). rainbowio can be coded as a few lines of python, so that wasn't a big deal
I understand what you are saying about mono-language, and I have argued that sometimes, but I could imagine that some of your users don't speak english well
I was thinking of a build where the error messages are numbers or short text codes, and they print as a URL to a page in a glossary on circuitpython.org with a language selection with all the error strings (and can be manually augmented with solutions and links to guides)
and on code.circuitpython.org they show up as the text in your preferred language (and as a clickable link)
we would want two builds then, so even more board defs. I have thought about error messages being external and stored in a file in CIRCUITPY, and looked up from there. Then there's a single build (which is "language-less") and you can change languages by swapping that file out. But it's harder for beginners.
I can install and import neopixel and I made that neopixel run the rainbow with colorweel code I found here: https://learn.adafruit.com/hacking-ikea-lamps-with-circuit-playground-express/generate-your-colors#colorwheel-or-wheel-explained-2982566-3
I think my problems are solved now.
My code was made for the Trinked M0 and it also assume there is an LED, so I will have to emulate LED behaviour with the NeoPixel.
I like that though, you would download the language file on the boards page, with instructions there, instead of the current language menu
I think we already had that discussion about language, maybe more than once. And maybe I was also advocating for externalisation of the message (at least I wanted that for having one build rather than one per language).
We also have had the discussion about not being able to support M0 board anymore (I think this is where size is an issue at each new version). But that Trinket TRRS is a rather new board, that is both M0 and want to support each and every language.
yeah, Adafruit has a bunch of SAMD21 chips they don't know what to do with
@lone axle is there a decision on the way forward for blinka (can't quite tell)?
My understanding is that we want to refactor your loading code so it lives in a function at from adafruit_blinka import load_settings_toml user code will then have that import and call load_settings_toml() and then continue as normal.
and still need a tweak so that non-string toml values will not raise an exception.
after playing around with it, i'm confident someone who understands pointers and bit math could make this work through modifications of shared-module/epaperdisplay/EPaperDisplay.c and how the buffer is sent to the display..
Great will do (and will test with some different toml files)
@lone axle like so?
Also, If settings.toml is invalid, shoulf it print a warning or raise an exception?
Yes, that matches what I had in mind. Re: print warning or raise exception. Im leaning toward raise exception. If the invalid file prevents parsing of the variables and the code is expecting to use some of them it'll likely fail somewhere else later on anyhow, I think it's nice to have the exception come as soon as the problem is recognized. It could always be downgraded to only print a warning later if it turns out to be too disruptive
I'm looking for the source code for flash_nuke. The existing uf2 doesn't seem to work on RP2350 boards. I've tried it on Adafruit, Pimoroni, and Raspberry Pi boards without success.
Is there any more needed from my side?
If possible, it would be really awesome, if this could be merged ahead of Hackaday Berlin (happening March 14th to 16th 2025), as attendees will receive this device in their goodie bags (though we will preprogram them).
I think it came from the RPi folks
there's a new universal flash_nuke UF2, which one are you using ?
Thanks, I'll give it a try.
I don't know if that's the original or the new one ?
https://datasheets.raspberrypi.com/soft/flash_nuke.uf2
well it works on a pico 2 so it's the updated one
Both the version @jaunty juniper linked and the version @tulip sleet work. They're definitely not the same, but any port in a storm.
Gadgetoid works for Pimoroni, not RPi (as far as I know).
I'm testing on an RP2350 feather right now.
I don't have the technical expertise to review the new pitch shift code, and I didn't test it either, but I reviewed everything else and it looks good. thank you for taking on that cleanup.
Tested both on RPi Pico 2W, Pimoroni Pico Plus 2W, and Adafruit Feather RP2350. Both Gagetoid pico-universal-flash-nuke and the Raspberry Pi flash_nuke work on all of these devices. Thanks everyone!
I updated a mirrored page used in many guides to link directly to https://datasheets.raspberrypi.com/soft/flash_nuke.uf2
This is closed by #9325
As noted in my comment on #4525 this is seemingly the same issue, just with different symptoms on different operating systems.
I just downloaded a project bundle (from https://learn.adafruit.com/adafruit-trrs-trinkey/neopixel-blink) and the README.txt say:
But right now there is only the "CircuitPython 9.x" version/folder proposed, so the text is a bit odd, there is no "two folders". Right now I cannot find a proper wording that match both when there is a single folder, or two folders.
Also if anybody know where is that file coming from and plan to update, then maybe also update "CircuitPython 7" to "9"?
This looks good, although probably worth adding a link to the flashing instructions under the download_instructions key, like this board does: https://github.com/adafruit/circuitpython-org/blob/main/_board/aramcon2_badge.md?plain=1#L15
(See earlier comment)
This looks good, although probably worth adding a link to the flashing instructions under the download_instructions key, like this board does: https://github.com/adafruit/circuitpython-org/blob/main/_board/aramcon2_badge.md?plain=1#L15
(See https://github.com/adafruit/circuitpython-org/pull/1592#discussion_r1979685632 )
Have a good time at Hackaday Berlin!
Awesome, thanks, and I will
Oh yeah, the image was updated, but not the copy. I can do it since the adafruit products are the easiest ones to add.
Note to self: Constructing a new framebuffer via common_hal_picodvi_framebuffer_construct() after picodvi_autoconstruct() leaks memory and dma channels. Attempting to create a large framebuffer will exhaust memory, resulting in a crash due to an attempt to de-init the clobbered framebuffer object. This needs a separate issue.
is it "issue worthy" that REPL tab completion of builtin module names works for import but not from? So import dis[tab] gives you import displayio but from dis[tab] doesn't complete and leaves you with from dis
I don't see how it leaks DMA channels.
I have tried to declare a property getter like:
static mp_obj_t tilepalettemapper_tilepalettemapper_obj_get_width(mp_obj_t self_in) {
tilepalettemapper_tilepalettemapper_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(common_hal_tilepalettemapper_tilepalettemapper_get_width(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(tilepalettemapper_tilepalettemapper_get_width_obj, tilepalettemapper_tilepalettemapper_obj_get_width);
MP_PROPERTY_GETTER(tilepalettemapper_tilepalettemapper_width_obj,
(mp_obj_t)&tilepalettemapper_tilepalettemapper_get_width_obj);
and include it in locals_dict_table
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&tilepalettemapper_tilepalettemapper_get_width_obj) },
The code compiles and I can run it on a device, but when I try to access the property print(tpm.width) it seems to be returning the function instead of calling it <bound_method>. If I use print(tpm.width()) then I get the value instead of the function.
Does anyone know what I am missing in order to make it work without user code needing to call the function?
@tannewt Turns out it wasn't actually leaking DMA channels, it simply wasn't resetting the DMA channel numbers in the framebuffer object so it was attempting to un-claim them twice. It looked like a leak on first glance. Since zero is a valid DMA channel, I changed the channels in framebuffer to int and set them to -1 when not assigned. I did spot the other memory leak in the patch you referenced plus at least one more. Since I'm deep into this code, are there any other patches?
shouldn't it be tilepalettemapper_tilepalettemapper_width_obj in the dict table ?
which is the getter declareed with MP_PROPERTY_GETTER
I’m at work so can’t easily find the reference but if you look at the audio effect Echo it uses get/set properties I documented. There is a function call that assigns the get/set as a property after the getter and setter functions. And then a reference in the dict to it.
Ah, yes I think that is right Neradoc
trying it now
Yep, that was it. Thank you! to both of you.
Since I'm deep into this code, are there any other patches?
That's my working branch and has all of my changes.
This adds VT100 ranged scrolling support (ESC [###;###r). This can be useful for keeping a status line at the bottom and/or top of the screen while scrolling.
I'm realizing that submitting these incrementally is probably creating extra review work so I'll try not to do this again going forward. Sorry. :frowning: The good news is that I don't plan on adding any more VT100 sequences until the inverted tile support is available.
I think this PR adds a bit more code than the earlier ones....
As a side note, the formatting of the terminalio documentation is not working right https://docs.circuitpython.org/en/latest/shared-bindings/terminalio/
Is there somewhere I can look to figure out how to fix the formatting?
The ja builds of the two samd51 boards overflowed slightly, I can disable the new VT100 features on those boards but the Pimoroni board seems to be something else, I can compile the ja firmware locally without an issue, perhaps it's a CI glitch?
@lone axle re: David's comment above: is that README.txt from the Learn system?
I cannot find it in a search of all adafruit repos
Yeah, I think it must be from whatever builds the bundles inside of learn.
I would lean toward either not including it, or having it point to a file in a repo somewhere so that it's easier to update.
Yeah, not sure where it come from, but the thing that build the zip must have it....
I have no clue about the implementation of it.
I'll email learn about it
@slender iron I have gotten a good start on TilePaletteMapper implementation on this branch https://github.com/FoamyGuy/circuitpython/tree/tile_palette_mapper.
It is pretty much functional, but I've found a potential snag with this alternate type of pixel_shader approach... How can the TilePaletteMapper tell the TileGrid to mark an area dirty when a given mapping has been updated? In my test code right now I'm cheating by setting the tile_index back to itself at the same time that I update the mapping in the tpm.
@willow totem exciting! We are down to just MiniMQTT to get rid of all the secrets and update all the AIO env names. Anything you need from me on that PR?
Found the root cause: In supervisor_flash_init() flash_do_cmd() is called without disabling interrupts. PR will follow shortly.
RP2350 would double-fault and hang-up during a storage.erase_filesystem() with a picodvi.Framebuffer object active. In supervisor_flash_init() a call to flash_do_command() was performed without disabling interrupts. Added needed calls to disable and enable interrupts.
Resolves #10104.

Jokes aside, This causes ESC[H to clear but only go back up to the end of the first line.
Tested. I'll be doing more ansi work now that the nice infra for ANSI is merged in.
I'm pushing this as an individual fix as it breaks displayio terminal applications.
I think pixel shaders have a blanket "needs refresh" they can set.
Its not a ideal but a start
Drafting while I test out some speed/memory improvements
Thanks, I did catch this and one of the later PR commits replaced the uint_8t with an int_16t just in case we ever work with really big screens :grin:
The -1 flag functionality was actually replaced by the calculation of n_args though so I do like defaulting all the elements to zero. I'll do that in the ranged scroll PR.
I'll get to it today sorry. Is there a decided method for env variables and settings.toml on cpython like for here: https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/pull/245/files#diff-68e9c15f52a7828a566c61e73213c9d7494b59055485e4e2ad51ae85ed5cb17dR13
Appreciate the sleuthing @eightycc !
it could use from adafruit_blinka import load_settings_toml there I believe, and then the instructions become to create settings.toml file and put it in the dir with the script running, much like how it works on MCU's
I wonder whether this disable should be done inside supervisor_flash_pre_write & similar for the enable in post_write.
I think this can go in as-is but some thought might be given to whether to move the disable/enable interrupts call, as my previous comment mentions.
Oh, don't be sorry. I'm not sure if there is a decided method. Pick what you would like and I'll update them if needed
@jepler Absolutely. I'm preparing a second PR that I'll be submitting shortly that cleans up pre/post flash processing plus a few other minor issues in framebuffer.
Okay, I think this is ready for review now.
I was able to build to two samd51 ja translations locally, however given how close they are, I think it makes sense to leave this feature disabled for them.
I was looking at why simply setting the top of screen pointer slowed down when scrolling and realized that the screen is marked dirty and has to be redrawn when this occurs. Given that, there actually is no speed advantage to leaving the pointer version of the scroll code in place, however I'm wondering if I might be able to add optional hardware scrolling support to the display driver libraries (I've mostly been testing on an ili9341).
If I give up on the hardware scrolling approach, it ...
All testing was performed on a pyportal titano with this script:
import time
from displayio import Palette
from tilepalettemapper import TilePaletteMapper
import board
import terminalio
import displayio
time.sleep(1)
p = Palette(2)
p[0] = 0x000000
p[1] = 0xffffff
bbox = terminalio.FONT.get_bounding_box()
main_group = displayio.Group()
board.DISPLAY.root_group = main_group
tpm = TilePaletteMapper(p, 10,4)
tg = displayio.TileGrid(terminalio.FONT.bitmap, pixel_shade...
Havent read previous conversation (if any) on the topic, sorry if im adding useless feedback
My 2 cents for the "lets read a setting" function changes:
- Modifying
os.environfeels wrong, and having a function do it adds a possible "race" (read from env before loading the TOML) - Once we start changing, why not be future proof? Could add something like
def read_setting(name: str, /) -> str | NoneIdea being that users/guides always use that, and the underlying implementation can change transparently - Such function could use
warnings.warnwhensecrets.pyis used as fallback, and remove the logic at some point in the future - To prevent extra flash consumption, it could just be an alias to
os.getenvon firmware
FYI the read setting stuff, is just for Blinka. Getting os.getenv to act similarly. So it's getting the two to work more the same (which is what Blinka is for, yes?)
Yeah, I don't think this needs to be a function in the core really. It's convenient to have settings.toml parsed automatically and variables exposed as os.getenv.
In blinka we want to match as close as we can, but we didn't come up with a satisfying way to make it happen automatically, so a function that does the loading was added. It does mean if some code were to try accessing variables from settings.toml before the load function is called they won't get the values that it might expect, but I think that is something we can't really do anything about unless we come up with some other mechanism that can make it automatic in the blinka context.
I don't necessarily see a need for one that allows the user to specify the toml file. They can always write code that does that if it's what they need. settings.toml is the specific file that it's intended to deal with and I think that is okay since it matches circuitpython's usage of that file.
I did think Blinka could come with its own shell wrapper...
I think it's worthwhile implementing full ANSI since we can. I'll be doing full color support and cursor once this is merged in.
@brazen hatch I was looking at foamyguy's PR (#10113) to see how to implement the new palette for the terminal. I think we'll need that for the ANSI cursor commands. If you're going to look at it as part of your ANSI work, I'll move on to something else though 😁
Not to mention making the color commands actually work properly....
I have a different plan.
Map of uint8_t's pointing to palette colors used for each tile.
This way we won't need to forcibly set user's palette.
Yea thankfully I have apps that work on different terminals all the same so I can switch terminals quickly to check
Cool, I'll move on thanks!!!!
@onyx hinge With picodvi.Frambuffer fresh in my mind, I'm considering giving the framebuffer in psram a shot. It would use up the single RP2350 xip streaming channel, but it's not in use now. Any other plans for the xip streaming channel that might take precedence?
Makes sense. I thought it was more about unifying reading from secrets.py/settings.toml... Thus the suggestion for a public-facing API that would never change, but whose implementation would (avoiding future changes to guides and whatnot)
As per loading TOML into env though, wouldnt it be better to get the function run on __init__ so that user doesnt need to invoke it? Would also mean it gets called as soon as posible, reducing risk of reading before loading
The problem we found was, whose __init__? there are multiple different libraries you might use to start using the network: adafruit_requests, socketpool/socket, etc.
I meant blinka, right after declaring the function, you also execute it... Still not a failproof solution
ah, i see
@mortal kernel absolutely no plans by me. I'd ask Scott. does the bandwidth even vaguely work out to be enough?
Could perhaps use {site,user}customize.py
Though, that would be a suggestion for user to do, not something a library can provide (i think)
Bandwidth will be a close shave, at least according to my back-of-the-envelope calculations. Only way to know for sure is to give it a go.
I'm counting on retrace intervals to give the xip streamer time to catch up and its FIFO to buffer the difference.
but blinka doesn't always get imported by some of the examples, so in that case it won't run.
I think the current load_settings_toml is pretty low overhead, and is only one or two lines of code. The scripts already have to be different on Blinka vs a board, because there is no network setup needed on Blinka (no import wifi ,etc.)
So I don't see it as a big thing to ask. And if you want to use env variables, you don't have to use load_settings_toml
Yeah, i know, but my point is: if blinka gets imported to call that function, might as well get the import to call the function as a side effect
Though being explicit might be best than a silent side effect
we discussed that yesterday but decided against it because then we will also have a linter warning for "unused import"
Best solution would be to "proxy" the os module, such that import os gets a os.py defined in blinka loaded (that passed logic thru to the actual os module, providing the extra logic to read from TOML), but i dont think that's posible
what would this enable that having it internally wouldn't? I don't think its worth doing to get the same functionality
a handful of atmel boards overflowed and I disabled the new module in them. I am not sure how to fix the zephyr builds that failed.
Bigger, fluffier framebuffers. We max out at 640x480 with a bit-depth of 8 (RGB332). That takes ~300KB which often fails to allocate with even the slightest amount of SRAM fragmentation.
you probably won't be able to get much larger outputs because you'll need to overclock your pixel clock
any higher bit depth and you'll be pulling more bits per pixel too
I think the answer to fragmentation is using settings.toml to start up in the mode you want
True on one and possibly both counts. I'd stick with the 640x480, but the additional depth would jump up the image quality. Especially for photos. And you're spot on re: settings.toml. Me, I'm just looking for something fun and tractable to do, so please forgive me for playing around a bit.
The palette and the ansi code is pushing the same boards so it probably makes sense to link the parameter flags
Rather than setting two parameters in the atmel-samd/boards mpconfigboard.mk files, I think the CIRCUITPY_TERMINALIO_VT100 I recently created should default to your new parameter. (After #10108 was merged, it's being set immediately following CIRCUITPY_TERMINALIO, but doesn't show up here?). I'm also setting the VT100 parameter to 0 for all samd21 boards in the atmel-samd mpconfigport.mk which could be removed if you make this change and decide to disable the new palette for all samd21 boards...
How do I best go about discussing the default stack size on m4 boards, here or in a new issue on Circuitpython repo?
The pyportals and matrix portals aren't able to do some graphical web learn guide projects, but upping pystack size to 1600 allowed them all to run. I wasn't sure of the current default value, but had an old settings.toml with 1536 in, which apparently matches github. [CIRCUITPY_PYSTACK_SIZE]
I was debating adding a settings.toml with the setting to some learn guides and their code, or whether v9 just needs a bump for those boards [like some extra level of indirection has been introduced so maybe this is expected].
As I think about it, the two features aren't technically, necessarily linked so perhaps two parameters is appropriate. Trade-offs... :shrug:
I'm realizing that submitting these incrementally is probably creating extra review work so I'll try not to do this again going forward. Sorry. 😦
More PRs tend to be smaller in scope and are easier to review. So, please keep doing small PRs.
Code looks fine. Thanks for adding this!
I'm wondering if I might be able to add optional hardware scrolling support to the display driver libraries (I've mostly been testing on an ili9341).
I wanted to do this since I knew that SPI displays can. However, I've never come up with a good displayio internal system to do it. Furthermore, often the SPI displays are oriented 90 degrees from the direction we actually want to scroll. In those cases, it doesn't help text rendering.
The picodvi output would be able to do this too thou...
I find this happens a lot for the pico as well. If adjustments are made, possibly there too
Thanks for taking this on!
I'm thinking over how to organize the memory internally. The array of uint16_t for every tile is nice because it has a bunch of small allocations instead of one large one. It does cost the array of pointers though. This could be optimized to allocate the tile mapping only when changed. If the pointer is null then it'd just map 1:1 (or have a default mapping).
Definitely try with a palette larger than the input bitmap has. We'll want that for coloring text in a...
//| """Remaps color indices from the source bitmap to alternate indices on a per-tile basis. This allows for altering coloring of tiles based on their tilegrid location. It also allows for using a limited color bitmap with a wider array of colors."""
Return a tuple instead of a list because tuples aren't mutable. I'm worried that mutating the list will be expected to change behavior.
I think you want to pass in the full input_pixel here instead of tile_location. That way if the dimensions of the tilegrid and the tilepalettemapper are different you can still map cleanly.
Ah! Let's take in the number of input indices and then adjust the value length based on the number of colors in the palette.
@short tendon I wanted to test my code to iterate through an object's items in the json_stream library using the test values in the test file, and discovered that the library breaks on a json that contains a string with escapes inside, like say {"bad_string": "\"}"}, or the dict_with_all_types test value in the tests, because it doesn't know about backslashes. The tests pass because it doesn't try to recover stream["_check"] which would cause an EOF error. Did you look into it or have any insight about it ?
I'm attempting to solve it for now by assuming backslashes only exist in strings and ignoring the next character, or I could just ignore the issue and leave it for later, it's not specific to the iterator code.
I had the assumption that it could only really work when the size of the TileGrid and the TilePaletteMapper match. What would be the expected behavior if those sizes differ? If the mapper is bigger I suppose it doesn't matter too much beyond spending extra memory to store mappings that won't be used. If the mapping is smaller though what does it do for tiles outside the range of the mapper? I'll look at input_pixel closer, I'm not sure what all is on that object.
Would it have some other mechanism for mapping the colors? The way it is now I think this would require one array of length equal the number of colors in the colorspace for each tile. Is there enough room to store that?
Sadly, I guess I didn't write good enough tests. Could do something like:
char = None
prev_char = None
while True:
prev_char = char
char = self.read()
...
if not in_string:
in_string = char == ord('"')
else:
in_string = char != ord('"') and prev_char != ord('\\')
...
Hand typed, not tested, but you get the idea...
Do you have a test that fails?
I was thinking it'd repeat the mapping. So if TPM is 10 wide and tile 12 was requested then it'd match 2.
The other way to handle it is to "pass" the value through and do no mapping. That way you could only have a portion of a tilegrid mapped. That might be clearer.
Thinking this over and re-reading everything here a few more times I think maybe I'm understanding better. When it's changed to use the number of input colors rather than the number of output colors it wont be storing such a long array as long as the input image is still indexed. I'll attempt ColorConverter
I think keeping them separate makes sense, but I also don't have a strong preference one way or the other. If it's possible to set it in one spot as disabled for all SAMD21 boards that sounds more convenient than adding to each of board individually though.
You'd store one 24 bit color for every input value. So if it is 1 bit color, you store 2 RGB colors that then are converted via ColorConverter. This is how non-indexed bitmaps, OnDiskBitmaps works. The value is the color in that case. ColorConverter just switches it to the output color space.
something like this closes the quote and tries to json load an invalid string:
dict_with_escaped_quote ={
"bad_string": "\"}\"",
"bool": True,
}
data_io = io.BytesIO(json.dumps(dict_with_escaped_quote).encode())
json_data = adafruit_json_stream.load(data_io)
print(json_data["bad_string"])
print(json_data["bool"])
which ends with:
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 2 (char 1)
While something like that:
dict_with_escaped_quote ={
"bad_string": "\"",
"bool": True,
}
data_io = io.BytesIO(json.dumps(dict_with_escaped_quote).encode())
json_data = adafruit_json_stream.load(data_io)
print(json_data["bad_string"])
actually gets into an infinite loop.
Awesome. I'll add those and work on a fix (unless you want to)
adding this to test_all_types causes an error too, it gets confused by the quotes and starts a "child" object or something
assert stream["_check"] == '{"a": 1, "b": [2,3]}'
i'm looking into it
Putting your assignment here will turn it off for all samd21 boards by default. The board files can still turn it back on if needed.
- Add bus, port_numbers and speed to USB devices. Allows for differentiating identical devices.
- Autodetect display and adjust if widescreen
- Enable I2S DAC via its reset pin
- Show keyboard emoji in status bar. (Only works over serial connection now. Built in font doesn't have the emoji.)
Thinking this over and re-reading everything here a few more times I think maybe I'm understanding better. When it's changed to use the number of input colors rather than the number of output colors it wont be storing such a long array as long as the input image is still indexed. I'll attempt ColorConverter
Right the input array length is dictated by the number of input indices to map. The size of the values in the array is dictated by what you are outputting. (The size of the palette or...
@tannewt I'm trying to change get_color() to take the input_pixel, and the output pixel, basically trying to match displayio_palette_get_color() signature.
It seems to me that input_pixel doesn't have enough information on it for TilePaletteMapper to determine the appropriate tile_location. input_pixel.tile_x and input_pixel.tile_y sound promising, but the values within seem to be in pixel units, not tile units, or else I'm misunderstanding what they represent. When my 10x4 TileGri...
Looks good to me, tested the fruit jam artifact build on hardware. Confirmed the HSTX shows up as built-in display now.
I don't see the keyboard emoji, but it may be something weird with my setup.
Regarding https://github.com/adafruit/circuitpython/pull/10073:
I have an idea. A whole fs into an oneliner. I'm doing the generation script right now.
If I just disable auto-reload, import os, and blast things in code.py, eventually overwriting code.py itself, it's gonna work perfectly.
or with the github custom build action on a fork
I have never built CircuitPython locally, and I would prefer to avoid setting up and validating a custom build environment just for this purpose. Thus, I'm excited to use GitHub actions.
@Neradoc ... I'd like to try this. Presume that I have already:
- created various github actions in the past
- forked this repository, and
- enabled github actions in my fork of circuitpython
- want to enable this for an ESP32-S3 board with 4MB fl...
@slender iron What do you think about something like this?
It can make .img's, it can attach em for easy file loading and it can make the string.
They only limit on this is ram and compile size.
If it works for my bloated project on C3 I think we can consider it good enough.
Besides, one could pack a downloader.
Do you think this is a good solution to the bundling problem?
We could instead load it into /boot.py so that usb doesn't get the time to start up.
Though iirc we can race it even in code.py
@devout jolt pinging for interest. Once I finish this util I'll opensource it.
I think this approach is much better since it's universal, doesn't require messing with tinyuf2 and is pretty tidy overall.
I could just add a "wget edition" with preset credentials fairly quickly.
This PR is a small package of fixes made while resolving #10104:
- Makes updates to nesting_count during interrupt disabling atomic in
common_hal_mcu_enable_interrupts(). - Fixes miscellaneous memory leaks and factors tear-down of partially constructed Framebuffer objects in case of resource allocation failures.
- Minor code cleanup in RP2350 Framebuffer
- Removes redundant, as of Pico SDK 2.1, XIP cache clean before flash writes and PSRAM configuration preservation around flash write...