#circuitpython-dev
1 messages Β· Page 33 of 1
though we could use rp2040js to verify that it is
Hi! I have a (quick?) CircuitPython library aesthetics vs efficiency question. This is not critical, but I am curious: does const() really help? How do I test this? I've not found any real data on the benefits of const.
In the adafruit_seesaw library there are two approaches for defining a configuration class:
https://github.com/adafruit/Adafruit_CircuitPython_seesaw/blob/main/adafruit_seesaw/attiny8x7.py
https://github.com/adafruit/Adafruit_CircuitPython_seesaw/blob/main/adafruit_seesaw/samd09.py
The "attiny8x7" approach is obvious & readable, while the "samd09" approach uses const for most everything, The result is rather verbose for the amount of information conveyed. Is it worth it? Also, is const() useful when inside of tuples like analog_pins? For Seesaw, every bit of speed can really help, so I'd like to regularize these config classes if so. Thoughts?
const() only helps in very specific cases
In this case, I don't think the names in the samd09 file provide any extra info
too bad we can't have const int tuples
I'm not sure what you mean by that
like analog_pins = (1,2,3) vs analog_pins = (const(1), const(2), const(3)) I assume the latter does nothing useful
ya, the latter will just leave in extra function calls during the tuple construction
b"\x01\x02\x03" is the most compact way of expressing it
(this is the crux of my question: the samd09 version uses const() and then puts those in tuple)
the samd09 version pretty much compiles to the same as the attiny8x7
and by "compiles" that includes mpy-ification
_PWM_0_PIN = const(0x04)
_PWM_1_PIN = const(0x05)
_PWM_2_PIN = const(0x06)
_PWM_3_PIN = const(0x07)
pwm_pins = (_PWM_0_PIN, _PWM_1_PIN, _PWM_2_PIN, _PWM_3_PIN)
becomes:
pwm_pins = (4, 5, 6, 7)
both in memory when loaded and in mpy
its a way to give a value a name without the name being included in the compiled version
hi, I am trying to mount my circuitpython storage on an android device via termux. Does anyone know what drivers are needed on a linux device to mount it? I am hoping if I can find an equivalent for termux/android I can get it to work.
yea the mass storage. I am able to see the device in lsblk and in /sys/bus but nothing from fdisk -l. When connected to an x86 linux laptop it shows as fat12 and I am wondering if somehow it can't read that fs type
yeah so bummer there's no way to have a const tuple (e.g. mapping to int16_t[] or similar)
note that the micropython import itself does add some bytes to the mpy though, so that's not quite free π€
(but it beats keeping the variable names)
(but it doesn't beat not using names)
(except in readability)
yea, read that and it vaguely mentions an issue and says it is unsupported but I was hoping with a little work I could get it working. This is a headless server so that android editor doesn't work in this case
@lone axle is the guide author
in the same way that const(int) essentially does a preprocessor fill-in of that int to where it's used (instead of making a python number), it would be cool there was a similar fill-in from tuple(ints) to an array of ints, and get comparable speed benefits from doing if num in my_tuple
correct, but I assume a linear search of int_t would be faster than a linear search of mp_obj_t (or whatever the appropriate type is), especially for small lists like analog_pins
no but it's still python, there is no int_t, a tuple remains a tuple, you want an array if you want optimized for type
or a bytearray
yeah so this answers my original question of "should I make attiny8x7.py look like samd09.py?" with "no"
agreed. samd09 would be fine like the attiny8x7 version
because that pinmap is accessed for every adafruit_seesaw analog call, so making it as fast as possible is worth it. but looks like, not much I can do
because the names don't add aty value
I would usually say yes, for readability, it has no cost when in use, but in this case i don't see the point in replacing "18" with "_PIN_NUMBER_18"
@sage elm I do not know how to mount the device from terminal, so can't offer much help on that front. I do think the issue was that Android didn't have support for FAT12 or whatever was needed to read from CIRCUITPY drive. I've noticed that some newer devices do have support for that though. On my newer phone if I plug in a circuitpython device with an OTG cable the OS notices when it's connected and basically mounts it automatically just like it would for a thumb drive or external hard drive. I maybe had to choose the "transfer files" or similar option from a thing in the notifications, but I'm not 100% certain, it's been a little while since I messed with it from Android.
The guide hasn't been updated to reflect it, but at least some devices can now connect it like storage and use it basically the same way that a PC does rather than requiring any extra mechanism to transfer files.
or in this case _PWM_PIN_POSITION_IN_THE_LIST
This page makes it seem like you might need to run a command in order for it to request permission for accessing storage, which I do think would be required to get it to be able to see or edit files on CIRCUITPY. If you haven't run this command and accepted the permission I would give that a try. https://wiki.termux.com/wiki/Internal_and_external_storage
are you having speed issues with seesaw ?
@sage elm @foamguy that's right, FAT12 was not supported on Android, at least in the past
@lone axle thanks for the pointers!
there were some third-party programs that did support it, maybe "manually"
@tulip sleet @lone axle that should be a software thing right? I am running a custom firmware with root access so I am wondering if I might be able to get around it if it is not a hardware issue
Some quick websearching does not turn up "now it's supported". The latest Android device I have is a Samsung tablet that's Android 11
one more gotcha I found, if you are using an OTG cable with either micro, or USB C on the Android side... When I was messing with it, it was pretty particular about which way the stuff was plugged in (i.e. OTG on the android side, vs. OTG on the microcontroller side. iirc it liked on the android side better, but I'm not 100% certain any more.)
it is not just a matter of turning it on; somebody has to have written the code
in general, yes. reading 8 pots or 8 encoders at once introduces enough lag in a UI that some tricks have to bring the lag down to make a UI responsive
There is support in some newer devices. I assume support was added to Android itself, because I think it's unlikely the manufacturer of my specific device would have done the work for it, but I also don't know that for sure, or when it may have been added. Just know my current phone can work with them successfully whereas my older ones could not.
fair, but I guess if it is a driver that I might be able to install from a repo then it could work? termux has access to linux repos (I think debian) so was hoping they might have a package for a driver
what android version is your newer phone
Current phone says Android 9.
mine is running lineage os version of android 11
I might mess with changing cables or something but serial port works fine from the terminal so I think that should mean that data connection is working
I guess if it is a FAT12 issue maybe I can bug the lineage OS folks to see if anyone has info on that.
Thonny uses the REPL to do file I/O, so in principle you can avoid needed to access directly. There are other tools (ampy, outdated, and various tools for MicroPython) that do similar things. Whether they will run on Android is a q
I just verified on my device with a USB C OTG cable when I plug it in like Phone> <OTG> <Micro USB Cable> <PyGamer Device. It shows up automatically in my notification drawer with 2 entries. One about being connected as a keyboard (I assume because CP presents as HID also), and another that says "Adafruit USB Drive, For transfering photos and media". If I click on that latter one it opens up a file browser and I can see the contents of CIRCUITPY.
oh interesting. thanks! so somehow it is possible. what type of phone is this?
note that the official command line tool for Micropython is now mpremote, it's not fully supported with CP, but maybe we could look into some of it (not support mount but check that it can run and upload files)
Mine is a CAT S61, not exactly widely known or used.
some of these tools used uos internally and similar stuff. It would be nice to have some kind of tool like that besides Thonny.
what does mount do that we can't do?
oh ok nice I will check out ampremote. I mostly just want to be able to use my local ide and then scp the files over to update the code
local IDE on Android?
local ide on pc
interestingly it seems microcontroller dependent too though. When I plug in a Feather ESP32S2 TFT with the same cabling, the microcontroller turns on and Android has a notification entry that says "Android system charging connected device via USB". If I click on it, it takes me to a menu of different ways to connect, but all of them are grey'd out. I can't actually select anything in there. And I do not have the the entry about file transfer and it doesn't seem like Android can see any of the files for this device as opposed to the PyGamer.
i'm confused, why not just plug the board into the PC?
I wonder if the PyGamer is big enough to have a FAT16 filesystem
I have an led matrix panel connected to my wall which has the usb c connected to the android device. I wanted to use the android device as a server to be able to scp the files to. I don't want to take the device down everytime I want to test something
the circuitpython device is a Adafruit matrix portal which has the M4 chip
it's really interesting, it mounts a HOST directory onto the board. Meaning from the mpremote REPL you can execute code and import modules that are not on the board - for a speed cost on import
does it have it's own seperate power source? Another potential concern would be if the Android USB port will supply enough power to drive the matrix.
mpremote uses uos.ilistdir() I noticed, and maybe ubinascii, but i got it to work by creating those as .py files
ah ok, I thought maybe it was a FUSE filesystem
it seems to be giving it enough power so far. I can also connect to the serial console so data seems to possibly be working over the same cable
I will try a Matrix Portal with the same setup so you can have at least one other data point with that hardware.
thanks @lone axle !
The matrix portal behaves the same as the ESP32S2 Feather TFT, so does not connect and allow editing files :(. Dan may be right about the PyGamer using a different FAT because of it's larger storage.
PyGamer is only 8MB, so I wouldn't expect it to be FAT16, hmm
yea from my linux laptop. fdisk -l shows it is formatted as FAT 12. is pygamer a version of circuitpython?
it's a hardware device: https://circuitpython.org/board/pygamer/
The Adafruit PyGamer is an entry-level gaming handheld for DIY gaming and maybe a little retro-emulation, all in one compact dev board.The PyGamer is powered by the ATSAMD51 microcontroller with 512KB of flash and 192KB of RAM. There is an additional 8 MB of QSPI flash for file storage, handy for...
oh ok, sorry, just looked back at your message, this is the device that worked
Yep, the PyGamer does allow my phone to see its files.
I plugged in my PyGamer. fdisk -l says it is FAT12
I am baffled as to why you would see a difference between the two
I have one other Android device I'll try. It's Android 11 or 12, I'm not sure which. It is much less standard than typical smartphones though, so I'm not sure how much knowledge of it's behavior will carry over, I am curious now though.
This one was a bit of a mix of the others. It has the 2 entries in notifications, one for keyboard, and one that I assume tried for storage. But the mssage is different and it says "this device isn't in a supported format" or something similar, and if I click on it, it's going to a wizard which looks like it's going to try to format it, which I definitely don't want it to do. So perhaps slightly closer to working than on my phone, but still not quite working all the way. This was with the Matrix Portal. And this device has regular USB ports so there is no OTG cable in the mix.
thanks for checking! I am gonna look into mpremote and check with the lineage OS folks. it seems like it could be possible since you have had mixed results
@lone axle @sage elm On my Samsung Tablet, Android 11, I can use a regular USB stick with the OTG cabling I have. A FAT12 CIRCUITPY does not show up, but the fake UF2 BOOT drive does show up, and it's also FAT12. So it might be because it's presenting as a composite device
I could turn off everything but CIRCUITPY in boot.py, but it would still be a composite device with just one device, the MSC device
haven't tried that yet
Interesting, another different behavior. I do like Android, but it's consistency or lack thereof is maddening sometimes π
I have Samsung phone with Android 9 as well and it doesn't work with the PyGamer the same way the Cat S61 does. It's similar with 2 notification entries, but the storage one says "drive corrupted click here to fix" but I'm too scared to click it.
I thought I had success with more devices in the past, but don't remember any specifics about which combinations worked.
What version of CircuitPython is on the PyGamer?
I get "Unsupported Adafruit USB Drive" on any of these. It offers to reformat, but letting it reformat brings up the same message again.
The PyGamer is slightly unusual in that it has its own power source. I don't think this has anything to do with composite devices
@devout jolt thanks for asking about the const usage, I caught up (thanks everyone who chimed in). Maybe it's worth making the others like your file then as the improvement π
Adafruit CircuitPython 8.1.0-beta.1 on 2023-03-30; Adafruit PyGamer with samd51j19
Board ID:pygamer
updating to that didn't help for me. OK, file this away as clues
There is something about the filesystem that Android doesn't like. I'd like to see the system log, not sure if that's possible
System log from the Android side? I can collect those at some point.
yes, I will see if I can do it on the tablet
plug it in and see what syslog says and why it doesn't like the filesystem
I verified just now on my phone that I can edit code.py and save it and everything works as expected. I had done that in the past but not recently. Works out perfectly on that phone with the PyGamer.
One, tricky bit for getting the logs I guess is by default those go though USB and communicate with a tool called ADB on the computer. Since the microcontroller needs to be plugged in though it occupies the typically sole USB port.
so i think the problem is not FAT12 support (any more), but something else. But why that PyGamer is special I have no idea. It's some accident of the filesystem. I'll bet if you storage.erase_filesystem()d it, it would stop working
I'd love to have one of these! Hope you guys have them in stock again!
Don't hold your breath for that one to come back in stock. Definitely sign up to be notified in case they do though! Chances are though that the next one you see will be respun with a better microcontroller chip. π
fwiw it looks like digikey still has some: https://www.digikey.com/en/products/detail/adafruit-industries-llc/4242/10230001 It's definitely one of my favorites as well. Hoping for a next gen one to drop sometime.
Late to the conversation, but according to my experience, const would only help when you are in the edge for a library to work in memory constraint board. the Definition of some_variable = const( ) as previously mentioned will add some memory usage too. However, we have used the names across the libraries as it is more readable. AKA easier to understand the name, than a Register Hex Address. I do like the way you define the pins and it could help to define some things in some of the libraries.
I tried this on a production (non-green) board, and could not get it to fail after about 10 minutes of waiting. I made the loop as fast as possible:
import board
from adafruit_neokey.neokey1x4 import NeoKey1x4
keys = NeoKey1x4(board.STEMMA_I2C())
while True:
keys.digital_read_bulk(0xff)
I am going to close this for now, but please reopen if you see it again on a production board.
I have noticed CIRCUITPY problems on the Metro M7 1011. I have had CIRCUITPY intermittently be reformatted after a reset, and have also written files that never show up (e.g. write test.py, but can't import it, even after a Linux sync). Something about filesystem writes appears to be flaky.
@tulip sleet @lone axle I tried using logcat on the android device to view logs when plugging/unplugging the m4 I see it recognizing the device but no (obvious) errors
this was from termux as root. I can possibly try from adb because my device has two usb ports
Thanks Kattni, Foamyguy!
thanks - i am surprised there are no errors reported in the log, since there are other errors reported, higher up, I think
I was seeing the device show up when I opened my file explorer app and it asks if I want to mount it. it fails and I got this in the logs for that app:
β53 D/SYSFAC> Checking FAT
β54 D/SYSFAC> FAT FAILED suspicious sectors per cluster count 0
β55 D/SYSFAC> Checking ExFAT
β56 D/SYSFAC> ExFAT FAILED invalid FAT count
β57 D/SYSFAC> Checking NTFS
β58 D/SYSFAC> NTFS FAILED suspicious sectors per cluster count 0
β59 E/TABLE> FileSystem Error: libs.va1
β60 D/PartitionTable> MasterBootRecord
β61 D/UsbMSDevice> Initializing 1 partition...
β62 D/UsbMSDevice> Partition 1, Logical Block Pos: 1
β63 D/UsbMSDevice> Create partition 1
β64 D/SYSFAC> Checking FAT
β65 D/SYSFAC> FAT Type:0, FAILED length=131072; index=131072
β66 W/Partition> Unsupported fs on partition libs.va1
β67 D/UsbMSDevice> Done!
β68 D/UsbHelper> No partitions!
Circuitpy laptop eta wen.
Jokes aside, congratulations!
π
@slender iron which HDMI display are you using for testing? I think maybe I should get one.
@tulip sleet adafruit has some. I'd use one of those. not exactly sure where I got this one
ok, thought it was an adafruit one. There is one in a case: the rest are bare with driver boards. I could make a case
what res is yours
say I don't think we support "RGB" TFT display interface in Circuitpython ?
not yet. though it's on our radar
or parallel 16 bits ? (only 8)
(I was browsing larger screen ESP32 boards on aliexpress)
we do 8 bit parallel
rgb displays typically don't have their own ram
but 8 bit parallel still assumes the display does
Hello! I've written some cybersecurity labs in circuitpython but I'd like some help making more for an upcoming kids cyber camp. Where would be the best place to find circuitpython devs for paid educational projects?
there was a job board on adafruit website
I just looked it up, thank you!
thanks for the quick release @tulip sleet
you're welcome; no problem
Thanks @silabs-ChatNguyen, sorry for my delayed response. This week is a bit hectic with some travel thrown in the mix. It doesn't look like I'll be back home again to pick this up until early next week.
Could you pull code and try again with ubuntu or rebuild without option -j ?
make BOARD=explorerkit_xg24_brd2703a slc-clean (clean code)
make BOARD=explorerkit_xg24_brd2703a V=2 (without -j )
I did pull the code again this evening and tried without the -j option. I think the bui...
Hello. I am having issues installing Circuit Python. it seems cargo is too old on debian distros.
I have some log files. Is this where I post log files?
Sorry. I thought I had log files.
Let me retry and show the output if that would be okay...
yeah
minify-html keeps hanging the system (armv7l) and then gnarly output presides.
I installed rustc and some other dependencies. I will post the output of the build errors if anyone will get to it. Anyway, thank you in advance.
Yeppers. minify-html is the issue for me so far...
(doesn't help, but shows that it's known to be an annoying dependency)
Would you like my output?
I won't know what to do with it, but go on, others might (if not today, tomorrow)
Anyway, I will post in case others may find it useful:
Okay.
Is there a way to just not use minify-html?
For instance, say I do no have a need for use in html pages. Maybe I can erase or not install that specific package?
or would I need to install an updated version of cargo via the rust compiler?
Anyway. It is probably too late now. Off into slumber!
I got 16 bit parallel working with FrameBuffer on the ESP32-S3 it was hackety-hacky but worked for the HACKTablet. Hereβs the issue: https://github.com/adafruit/circuitpython/issues/6049
Lol.. What is completed? Nothing.. Excellent work sir!
On Tue, Apr 11, 2023 at 9:52β―AM Dan Halbert @.***>
wrote:
Closed #3763 https://github.com/adafruit/circuitpython/issues/3763 as
completed.β
Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/issues/3763#event-8975658511,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ARRY7JLGAZ2BCMYV5IA5JQTXAV43PANCNFSM4UCPIZMA
.
You are receiving this because you ...
Try CIRCUITPY_WEB_WORKFLOW = 0 inside of mpconfigboard.mk for the board that you are building. I think web workflow is what uses minify html. My environment has a lot going on, so I'm not certain I tested properly, but I got a successful build of a ESP32S2 Feather with this configuration set after having uninstalled minify-html in my python interpreter.
@kmatch98 hi, i've been working recently on esp32s3-wroom1-n16r8 and rgb lcd, i just read all the messages here and i would like to ask you if you can help me understand here what's happening with my code.
I have two different TFTs, one is 7 inch (800 x 480) the other is 10 inch (1024 x 600) the only way i found to make the screens go decent without errors or so is using double buffers, but to maintain synchronisation with the two buffers, i need to set the "full refresh" to true.
I past...
This looks like great work. As for the frame per second. Based on your dot clock and all the timings, if you calculate the max possible frame rate, does it match to what LVGL is saying. From what I remember (itβs been a while since I worked on this), I think getting 30 fps was really at the high end. I suspect you canβt achieve this for the larger display but you can calculate your best case based on your settings and the number of pixels.
If you redraw the full framebuffer each time, I t...
The Onewire reset function returns false when it finds one or more devices on the bus by detecting a presence pulse following the reset low state. Unfortunately, if the bus faults to a stuck low condition for an number of reasons (i.e. 2 terminal device attached backwards, no pullup, hardware failure, etc) the reset will also return false indicating the presence of devices.
A stuck low bus will report a serial number of all zeros, which again unfortunately resolves to a valid crc8 of 0, in...
Thank you for your reply.
After some tests i can say that:
-
if i have to redraw little portions of screen but i use the double frame buffer, nothing changes (as expected)
-
if i have to redraw little portions of screen but i use singla frame buffer + bounce buffer, i also can set the lcd clk at higher speed so i can get 50 fps (that would be the case of some static interfaces with little widgets and no animations).
-
i am going to 80Mhz with octal PSRam in DDR and the DMA is automati...
Deleted this comment. Not nice
extmod is the MicroPython implementation. The CircuitPython one is:
The link is here: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/onewireio/__init__.c#L40
Would you mind making a PR to fix these two issues? Thanks!
I don't think this should block 8.1. iMX is still very much in flux.
Also, can you please explain if i have to use esp-idf "draw_bitmap" or the init of the lcd screen, because i saw from the other messages here that you override those and you used your own, do you think that it could solve my problem?
CircuitPython version
Adafruit CircuitPython 8.0.5 on 2023-03-31; Adafruit Feather M4 Express with samd51j19
and also tested on ItsyBitsy 8.0.5 with same results.
Tested with the Feather M4 on versions as far back as 6.3.0 with same results.
Code/REPL
Adafruit CircuitPython 8.0.5 on 2023-03-31; Adafruit Feather M4 Express with samd51j19
>>> import analogio
>>> import board
>>> a = analogio.AnalogOut(board.A0) # A0 slowly climbs to 3.3v and holds
...
I overrode some of those functions because an earlier revision of the esp-idf didnβt support some of the functions that I needed. I think the latest version has added all of those. So At first glance I donβt suspect that is affecting your performance. It may be primarily limited by the PSRAM access speeds.
As for βarbiterβ Iβm havenβt heard that term so unfortunately canβt provide any new insight. Keep digging, sorry I canβt be more helpful.
Thank you for the clues, your help is fundamental since i'm new to this and i'm trying to figure out what is the correct direction to take, i'll keep digging.
Much appreciated!
Currently on esp32-s3, jtag support is broken.
On none of the board definitions is #define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) enabled like it is on C3.
Enabling it creates linking errors.
Those linking errors can be fixed by appending:
ifeq ($(IDF_TARGET),esp32s3)
SRC_C += \
supervisor/usb_serial_jtag.c
endif
after line 242.
But still, after compiling a debug build with those fixes and #define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) in the board definition, we can see:
`...
tl;dr usb resets & disables jtag
ran through source
couldn't find anything
searched all refs of jtag
searchef on micropy as well
and @lone axle It's been hard to find a Python-only minifier that's not really old. https://pypi.org/project/html-minifier/ is very simple; it might be good enough
It's been hard to find a Python-only minifier that's not really old. https://pypi.org/project/html-minifier/ is very simple; it might be good enough.
@crimson ferry I have a PR for allowing HEAD requests with files on httpserver (as in curl -I someurl) which currently return a 400 error, but I want to make it return the header (with file size or 404 for example).
I can look into other behaviors to fix with it.
- getting
http://192.168.1.28/existingdiris an empty page - getting
http://192.168.1.28/existingdir/is a 404
Since we don't have directory listing, a directory URL could send a 403 like apache does instead.
I was also looking into adding some syntax like @errohandler(404)
@jaunty juniper Ignore my comments-thrashing on that PR... combination of some existing quirks in the library, test code amplifying those quirks, and bad test hygiene. HEAD could be handy. I'm no expert on web servers, I just know how I use them. Standard behaviors are good. Some .htaccess features (like directory listings and default index file name) could be simulated with an appropriate route (and server code.py). We may be starting to get complex enough with this library where un-obviously-malformed code runs but gives unexpected results.
I'm not sure it's true now, but it would also be good if the file access stuff disallowed /../ etc.
I tried that, doesn't sem to work, fortunately
# PATH = "/www"
% curl -i http://192.168.6.161:8080/../settings.toml
HTTP/1.1 404 Not Found
Content-Length: 0
Content-Type: text/plain
Connection: close
it looks like curl might fix the URL, I'll see if a raw request makes a difference
oh, yeah, -v shows that
b'HTTP/1.1 200 OK\r\nContent-Length: 143\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\nAdafruit CircuitPython 8.1.0-beta.1-23-g0aea45516 on 2023-04-12; Adafruit FunHouse with ESP32S2\r\nBoard ID:adafruit_funhouse\r\nUID:C7FD1A71736D\r\n'
that's in response to b'GET ../boot_out.txt HTTP/1.1 \r\n'
oops
I can fix
Currently it just adds root path and filename together as strings, it could be prevented by checking if file path contains ".."
this would be within the root path http://192.168.1.50/subdir1/../index,html but is there really a use case for it?
do we need a CP library channel?
If you specify subdir1 as root, this would prevent accessing file outside subdir1
curl, python requests, and browsers translate that kind of url
this is a very elementary security provision
you don't want someone to access ../settings.toml
also I was thinking that root_path shouldn't default to "/" but to not serving files because of that
is there a way currently to wildcard a route (so that any file in a directory can be accessed)?
you can set the root directory iirc
There are wildcards, haven't tested it with files though
server.start takes a root_path that defaults to "/"
so set it to something like /static
Wait, are you all talking about hosting a tiny site on a microcontroller? Sounds like yes, and if yes, sounds like you're saying it would actually be quite simple for folks to get to the settings.toml file if it's public? (Maybe I'm way off here on what you're even talking about.)
yes
a PR by somebody would be welcome
I can work something out
@plucky tulip can you say more about wildcards? is there a syntax?
An explanation of how to use the update would also be appreciated.
There is a doc about it
https://docs.circuitpython.org/projects/httpserver/en/latest/examples.html#url-parameters
It is a newly added feature
Pretty interesting
That does not seem good.
but URL params aren't paths
It should be possible to make a simple handler that takes "/<file_name>" and returns HTTPResposne.send_file with that file_name
I can make it default to "/static" or I like "/www"
it seems like the combination of "/" root and raw requests are a problem, any other security holes?
or maybe remove default and require people to provide the parameter manually
what's your threat model?
if you open it up to the internet, there is no hope
sure, so define what situations you want to handle
and which you don't
otherwise talking about security is pointless
we want to plug known. holes that make it easy to exfiltrate secrets
yeah it makes sense to me, to avoid unexpected default behavior
easy for whom
it shows as a usb drive when you connect it, there is very little that could be easier
But still, it is a server
what does that mean?
Can be accessed not only via USB
you could have it physically secured, but it's on the network
if you forward a port from your microcontroller device, you are as good as hacked
dos-ed at the least
Maybe we want it configurable with default to false, something like, "directory_ascending"
and the local network is already protected with a password
i think we just shouldn't allow it; it has very little real-life use
DOS is certainly an issue, but it doesn't leak secrets. Let's fix the obvious holes.
Preventing DDOS on microcontroller would be hard in my opinion
o
without other tools
it doesn't even have to be distributed
you can just send it a request that doesn't fit in memory
that is not a secret-leaking threat, it's a denial-of-service threat. I'm willing to have the latter but not the former
right, so that kind of decision is part of the threat model
it would be nice to have it written down, so we can refer to it later
Ok, so to sum it up:
- no accessing files in parent directories
- no default "/" as root path
Anything else?
so that we don't get scope creep fixing things that fall outside our threat model
@plucky tulip If you could add a sentence to two to the README re the threat model as part of your PR, that would be great
Sure thing. I will work on it during weekend
are the urls considered case sensitive?
yes
It will introduce breaking changes though
because the filesystem isn't
some are
the fat12 on the circuitpython devices isn't
open("CoDe.Py") works, so for file paths, it won't be case-sensitive
not sure about other fat types on sd cards
ok by me if routes are case sensitive but file accesses are not
so I suggest the file paths are normalized to lower case before being used, to avoid a situation when you can sidestep a blacklist by using different case
If you do it this way, it should work in theory
also, maybe unicode normalization?
what about things like slashes that are url-encoded in the path?
would that let me escape from the web root directory?
i think we don't handle escapes at all now
should we?
Can you give an example of what you mean?
http://example.com/%2fetc%2fshadow
% escapes are not currently parsed
yeah url decoding is out of scope as far as I'm concerned
if/when they are added, then we'll need to up the security
so if your file name has a space, you can't access it?
this is a SIMPLE HTTP server
I believe you can just use space in url
I believe you believe wrong
the browser encodes it behind your back for you
I'm not saying we need to add this, I just want the decision to be documented
mapping urls to filesystem paths is a huge can of worms
fwiw with the implementation here: https://github.com/FoamyGuy/CircuitPython_PyBadger_Snake/blob/main/code_badge_with_wsgi.py the server does not expose any directories. The only file on the device that it will the contents to is static/index.html and even that is for convenience of updating. It could be a hardcoded string in the .py file I'm pretty sure and then no other files would ever be read or returned by the code that handles the web requests.
You are right, my bad, just tested it
url decoding is too big, I wouldn't do it
Oh excellent. Thank you. That was my concern.
we are talking about adafruit_httpserver
the original motivation for HTTPServer was to serve Wordle-ish sites. It has grown, of course
I know, and this code uses something different (WSGI), but wanted to make sure Kattni knew that this things she's trying to use next week isn't going to expose her important files.
there is also the problem of guessing the mime type
right, so when I was asked to make a Wordle server, the existing WSGI servers weren't that helpful. So I took a tiny file-serving server and adapted that.
do we trust the content of the files? that is, no files uploaded by external users?
By default there is no way to upload files, but one might code the request handler to do that
Can you give an example?
well, you have to serve the file with the right mime type for that file, html files with text/html, javascript files with application/javascript, images with image/jpeg, image/png, image/gif, image/webp, image/tiff, image/bmp and so on...
yes, but where is the problem
you have to know the type of the file to serve it
it is now determined by its name
how
and if the extension is not on the list, or there is no extension?
then "text/plain"
so if I put, say, a .cbr file in there, it will be served as text?
wouldn't application/octet-stream make more sense?
sorry, I got carried away, please ignore me
I need to go to bed, goodnight
It could be considered, it was "text/plain" in the first version of the lib and I left it that way
by the way, I'm using that library in fluffbug, and it made things a lot easier for me, thanks
it's a really nice library, I've loved it from the beginning
Glad to hear that π
So, let's maybe start with the ".." in path and root path issue, and then expand on that if necessary, @tulip sleet ?
I usually do this by converting the path to absolute with abspath, and then checking that it starts with the directory I need, in big python at least, that's much more proof than searching for forbidden character combinations
there has to be something like it internally, no?
in the filesystem code, if nowhere else
it's pretty crude, I think
if you want to do it by searching for ../ then you also need to check for a leading /
Not only for ../ but for .. in general
like http://example.com//etc/shadow
you can have .. in a file name
I remember an issue with nginx static files and paths that starts with ..
it's a tricky thing
This probably wouldn't work due to concat with root path
in fact you could have .. at the end of a directory name too, like /foo../bar
and that's a perfectly valid path
These are very edge cases I believe, as it a simple http server on microcontroller, I believe we can just force some rules on users
as long as you document them
Fair point
I would filter for "../", I don't want to filter every path with a complex RE or something
and you probably want to disallow backslashes alltogether
I will try to come up with something
This a a bit different scenario, as it is during development
but it allows access to the whole filesystem, so there is no problem of escaping from a directory
Can we do a milestone for v3 of adafruit_httpserver, we could bundle all incoming changes and then release it as a new major version, I am also working on authentication system and some unifications/name changes so I could also add that? @tulip sleet
just throwing this over the wall while I'm on vacation. It adds envelope (A/D/S/R) to synthio. I hope to work on it further by the end of pycon...
https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/milestone/1 We really appreciate your work on this library
May I ask how did you made that request, mine from Chrome, curl and VSCode extension have the .. truncated before the request gets to server
you can do it with a raw TCP socket
I'm not sure how Neradoc did it, but something like this https://gist.github.com/anecdata/80bb4b685b19ca5d27f443d5e278d61e
Thanks
adsr = np.concatenate(
(
np.linspace(3277, 32767, num=40, dtype=np.int16, endpoint=False),
np.linspace(32767, 0, num=20, dtype=np.int16, endpoint=True),
)
)
#...
synth = synthio.Synthesizer(sample_rate=48000, waveform=waveform, envelope=adsr, envelope_hold_index=42)
A basic linear volume ramp, then slight decay, followed by a sustain at about 80% of full scale. At 48kHz, it takes about 0.2s to ramp to full volume.
The envelope can in principle ...
good evening, I was pointed here for the individuals that could answer a technical question about adding libraries before compile
I could be wrong but Ive only ever gotten my code in python [https://github.com/FriendlyNGeeks/PiVAC] to work with the _thread lib, running a http/json server on one thread and a seprate fetch loop on another thread. If a dev were to accidently point me to the make files I could copy over from micropython it would save me days in trying to write custom driver support for the feathers3 reverse tft and 8pwm feather servo
looks like the ci docs failure is due to weblate being down for maintenance.
Set up AtomS3 Lite ESP32S3 Dev Kit uf2 file
In circuitpython AtomS3 Lite ESP32S3 Dev Kit Downloads page
I pushed DOWNLOAD BOOTLOADER ZIP button.
web browser shows 'Not Found'.
How can I get tinyuf2-m5stack_atoms3_lite-0.13.0.zip file ?
Thanks @silabs-ChatNguyen, sorry for my delayed response. This week is a bit hectic with some travel thrown in the mix. It doesn't look like I'll be back home again to pick this up until early next week.
Could you pull code and try again with ubuntu or rebuild without option -j ?
make BOARD=explorerkit_xg24_brd2703a slc-clean (clean code)
make BOARD=explorerkit_xg24_brd2703a V=2 (without -j )I did pull the code again this evening and tried without the -j opt...
Ah, yea. I knew this day would come. I've never made a Git PR and I'm by no means an experienced Git user or proficient C programmer. So this will take time and probably significant hand holding. Time to watch some YouTube videos.
@jedgarpark @todbot in case this is of interest, I'm working on adding ADSR-style envelope to synthio. I think it's ready for somebody to try. However, I'm on vacation :grinning: so I won't necessarily act on feedback in a timely fashion. The changes also give another bump in loudness, because I improved (I hope) how the overall envelope of all playing notes is bounded.
@jepler that's great, I'de love to try it out.
@jepler it works, thanks so much! Going to see if i can figure out how to adjust the ADSR values.
It has been merged into tinyuf2 but not yet released.
You can get a version from the CI here: https://github.com/adafruit/tinyuf2/suites/12173228814/artifacts/642620143
The JTAG/serial and native USB peripheral share pins. CircuitPython is switching from the JTAG/serial unit to the full usb peripheral. Without doing this, the CIRCUITPY drive and such wouldn't work. I'd suggest using the native JTAG pins if you really need it. I do my ESP debugging with printfs and panic backtraces.
@slender iron do you want to try again for a triage meeting? I have to stop kind early today, like around 1pm your time
I'm gonna go get my package right now but then can in 5 min or so
sounds good
Alright, thanks.
A final note as I close the issue: This isn't in any of the docs I could find. Perhaps it should be added.
@tulip sleet I'm in the Amelia voice channel
This frickin' rules. Thank you @jepler!
To investigate: whether TinyUF2 is causing this problem, and was it a recent TinyUF2 change?
Will merge, but will open an issue assuming it needs to be addressed further.
adsr = np.concatenate(
(
np.linspace(3277, 32767, num=40, dtype=np.int16, endpoint=False),
np.linspace(32767, 0, num=20, dtype=np.int16, endpoint=True),
)
Why is the first value "3277"? I would expect it to be zero.
I think the solution for this is to save the monotonic value when the rtc is set and the new value. Then, monotonic going forwards will be "monotonic offset + (rtc time - rtc set time)".
Add guidance on these pins names to the "how to add a board" Learn Guide
@jepler this seems to be an ASR envelope, and is working very nicely (or maybe I haven't found the decay time control?) Here's my guess at what the adjustable values are:
attack_time = 40
sustain_level = 32767
release_time = 140
asr = np.concatenate(
(
np.linspace(3277, sustain_level, num=attack_time, dtype=np.int16, endpoint=False),
np.linspace(sustain_level, 0, num=release_time, dtype=np.int16, endpoint=True),
)
)
synth = synthio.Synthesizer(
...
Could not assign SPIM3 unless the speed is >8MHz, and then reassign the device to that in that case.
@rich123 Would you be interested in working on this?
@rich123 Would you be interested in working on this?
I can see if I can give it a go. Will have to see what I need to install to actually build the code for the ESP chip first.
@anecdata is this still an issue for you? There was a timer fix that helped this to some extent, we seem to remember.
@anecdata are you still seeing this?
Here is an issue this would be nice for: https://github.com/adafruit/circuitpython/issues/7405
Would updating the documentation be enough to fix this? I'd rather not have to track all returned values to filter duplicates.
@anecdata TinyUSB has been updated with significant fixes since this report. If you have time, could you re-test?
Let's close this and open a new issue that's more precise if this comes up again. It's really hard to follow what's going on here.
Re-test after DVI changes are merged. There are some interrupt fixes being done for that.
Just curious of the DVI changes were merged or if there is a PR for them? Saw the update on AAE but only in passing. Just got the feather for it
May have been fixed by #7845, so let's re-test.
I'm still prepping them for a PR. My branch is here https://github.com/tannewt/circuitpython/tree/feather_dvi
Thanks
lots of issues need to be re-tested, I guess I know what I'm doing this weekend :p
I'll check internally. Not sure that the RMT carrier feature supports 0/100% duty cycles in hardware. I suspect the driver is not validating these edge cases. Wiring the pin to constant high or low signal could be a reasonable workaround for the time being.
I don't have any devices with me to test, so please feel free to remove the workaround if your testing indicates it's not needed. I don't have any specific recollection, so I can only rely on what was in the related commit message:
After this change, it's possible to connect multiple times to wifi in different runs of code.py or the repl after soft rebooting.
so it sounds like @DavePutz 's testing shows this is no longer needed.
I can't do any testing before May so I recommend going ...
Adafruit CircuitPython 8.1.0-beta.1-23-g0aea45516 on 2023-04-12; Raspberry Pi Pico W with rp2040
Reset between testing each type of socket.
Web Workflow not enabled, same as before:
5 SOCK_STREAM, then RuntimeError: Out of sockets
3 SOCK_DGRAM, then RuntimeError: Out of sockets
4 SOCK_RAW, then RuntimeError: Out of sockets
Web Workflow enabled, same as before:
5 stream
2 dgram
4 raw
<details>
<summary>(test code...)</summary>
import wifi
import sock...
0% duty cycle is constant low. But 100% duty cycle isn't constant high, it's a pulse chain without a carrier (which has plenty of real use cases). The RMT should be able to do this by disabling the carrier option, but I haven't tried.
I think this should be a fully configurable ADSR (instead of jepler's original where the decay rate is the same as the release rate), but perceptually the sound seems to "bounce" down-then-up, after the decay. Weird.
attack_time = 100
decay_time = 50
release_time = 300
attack_level = 32767
sustain_level = 5767
adsr = np.concatenate( (
np.linspace(2, attack_level, num=attack_time, dtype=np.int16, endpoint=False),
np.linspace(attack_level, sustain_level, num=d...
@lone axle you mentioned trying the adafruit_httpserver library with ESP32SPI, but ESP32SPI doesn't have socket.bind() and other server related methods, were you talking about another library ?
I thought it was httpserver, but perhaps not. Maybe this one is what I was thinking: https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/main/examples/server/esp32spi_wsgiserver.py
in which case, I also notice now that I could probably lower the chunk size to help the RAM trouble.
I see
I took the UniversalSocket class I made for websockets, added some server functions and was able to run httpserver on a PyPortal, at least right now I have a page that sends a text to the pyportal's screen without changing the code inside adafruit_httpserver or adafruit_esp32spi, which is a testament to duck typing
Nice!
how did you get os.getenv to work in that environment?
os.getenv is just one way to get the ssid and password
the issue is just sockets, I've put my current version here:
https://github.com/Neradoc/Circuitpython_Universal_Sockets
that's where I saw the os.getenv
are you under the impression that it's not implemented on all ports ?
oh I guess it is π€¦ββοΈ
I use the same names as the web workflow because I just copy my settings.toml, even though the web workflow is not on the pyportal
gotcha, i don't mess with esp32spi much anymore and I use settings.toml mainly for native-wifi-specific stuff, so I just didn't associate it
I'll upload my full test code, a web page with a text, size and color fields, that sets what is shown on the screen of the board, tested on FunHouse and PyPortal
I guess there's still CIRCUITPY_BLE_NAME and CIRCUITPY_PYSTACK_SIZE
I think the ESP-equivalent of listen is client socket connected and available
not so clean though
no, it just doesn't seem to map well
I haven't revisited my weather station project because of that bug, it completely derailed my project. The bug was in 7.x and continued into 8.x beta. We're now past the 8.x stable release date. It's been permanently off for months. Got sidetracked with other projects. I'll make it a point to load this one back up tonight and test with the current stable version of 8.0.5. I am still hesitant to close this issue as it was a doozy of a bug. Will check and report back.
I switched to the Adafruit ESP32-S3 which was exhibiting the same symptoms at the time during 7.x and 8.0 beta. Gave up on it at that point.
Adafruit CircuitPython 8.0.5 on 2023-03-31; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3
Board ID:adafruit_feather_esp32s3_4mbflash_2mbpsram
Been running like a dream for an hour. Everything is much much faster too. I don't want to swap the UM FeatherS3 back in because it's deep inside an enclosure and would take about 20 m...
Closed 6791. Runs great on 8.0.5 so far. No more hard faults. π
S3 has stability now with wifi projects. Looking good.
It's been off since January. Nice to have it back on my desk working. Thank you to all the developers who work on circuit python every day. β€οΈ
I still have no idea what the original culprit was or what fixed it. As long as it's working it doesn't really matter.
I installed
Adafruit CircuitPython 8.1.0-beta.1 on 2023-03-30; M5Stack AtomS3 Lite with ESP32S3
successfully.
Running 6 hours, no hard faults, definitely fixed.
- If the first element of ADSR is 0, it's just like starting the sound 1 time-unit later, so start with nonzero. 3277 was left over from when the attack portion was 10 units long, so it's about 32768/10.
- it is ADSR, not ASR, because you can set the "envelope hold index" to set a sample within the envelope array which is used during the sustain portion. So for instance if you have the very simple ramp [10000, 20000, 30000, 20000, 10000] and set the hold index to 2 (indicating the element ...
# Time is in units of 256 samples, e.g., ~5ms at 48kHz
attack_time = 40
peak_level = 30000
decay_time = 40
sustain_level = 20000
release_time = 140 ...
renamed the parameter to envelope_sustain_index
ref: issue #7859
Added a second read to onewireio reset function to verify reset line transitions to high state to detect stuck low faults. A return value of True indicates no devices present (i.e. no presence pulse detected) or a stuck low or stuck high fault.
@silabs-ChatNguyen Thanks! that did it :smile:
Adafruit CircuitPython 8.1.0-beta.0-68-g5c4dfcf59-dirty on 2023-04-15; Sparkfun Thing Plus MGM240P with MGM240PB32VNA
@crimson ferry are you able to use adafruit http and continue to do other task while server is waiting for socket connections?
Code changes to allow 64 character hex WiFi passwords to be used with wifi.radio.connect.
Fixes adafruit/circuitpython#7677.
The pull request I just pushed worked when built for my Adafruit ESP32-S2 Feather. My 64-char WiFi password was accepted and the Feather authenticated with my AP.
The Magtag Google Calendar from the learning guide uses some Arial PCF fonts that apparently contain bitmap elements with a width and height of 0. The DisplayIO argument validations introduced in https://github.com/adafruit/circuitpython/pull/7548 cause the example code to fail.
Traceback (most recent call last):
File "code.py", line 233, in
File "adafruit_magtag/magtag.py", line 170, in set_text
File "adafruit_portalbase/__init__.py", line 291, in set_text
File "adafrui...
@deep acorn You can poll with adafruit_httpserver https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/blob/main/examples/httpserver_simple_poll.py. Tight loop or asyncio will let you cooperatively multitask.
I'm realizing the only reason I hesitated adding the test for the 0 width/height object for the border wrap issue is that I don't know how to call a micropython max() function. Is there a way to call something like mp_MAX(0, source->width - 1) rather than adding an if statement and two assignment statements?
i.e.
int16_t x = mp_arg_validate_int_range(args[ARG_x].u_int, 0, mp_MAX(0, source->width - 1), MP_QSTR_x);
rather than:
if (source->width == 0) {
int16_t x = m...
@slender iron Hope you see this after the weekend I did try the DVI support for a while with some success. If you need any testing let me know.
Couple notes:
- Disk access would go at times, more so if I created my own display. Many times this would corrupt the FS.
- Something in ColorConverter is causing an issue when colors change. If I just hard coded a the conversion code from 565->8bits color it worked. I can show an example later if needed.
16 bit didn't seem to go smoothly and I didn't look into it any further.
Was fun to play with overall though!
MIN() and MAX() macros are defined in py/misc.h. This may already be included by something you're including, so just try it first.
- Move loading .js scripts from to end of for faster rendering
- Add back-button support for file system/editor navigation.
ref: https://stackoverflow.com/questions/43043113/how-to-force-reloading-a-page-when-using-browser-back-button - Close WebSocket when navigating away from /cp/serial. Don't leave it dangling.
ref: https://stackoverflow.com/questions/4812686/closing-websocket-correctly-html5-javascript - Use better looking Blinka icon (32x32 - adds ~1.5K to image)
Hope you find ...
Thanks @dhalbert! I'm pretty sure you already pointed me at those macros a while back, sorry for may poor memory :cry:. I really appreciate all the support you've given me over the past couple years :grin:
Thanks @jepler, that makes sense. This is a lot of fun to play with and already so very useful.
Some comments from trying it out:
-
On key release, the envelope currently plays from
envelope_sustain_indexwhich causes a jump in loudness if the note is still ramping up from. The more expected behavior would be to play from equivalent loudness. -
Synths often use MIDI velocity to change the amplitude envelope: both peak/sustain levels and attack & release rates. e.g. play softly t...
@onyx hinge pinging you regarding #7718 in case it has fallen off your radar
https://github.com/adafruit/circuitpython/pull/7718
Hello @dhalbert,
I have made some changes based on your previous feedback.
Could you help me to review it again?
Thank you in advance!
Got an error on the S3 using the LC709203F, might be related?

[As suggested by anecdata](#help-with-circuitpython message) I've now added into my 500 line weather station script to try/except the error.
i2c = board.I2C()
battery_monitor = LC709203F(board.I2C())
battery_monitor.thermistor_bconstant = 3950
batter...
Traveling, won't be able to review right now.
Thank you! -- just a request for three trivial alphabetizations.
@DJDevon3 Yes, this seems like the same issue.
Scott and I triaged the 8.1.0 and 8.x.x issue list on Friday. We moved #7718 to 9.0.0 given that it is a behavior change.
Still occurring with Adafruit CircuitPython 8.1.0-beta.1-25-g4d7e54310 on 2023-04-16; Adafruit PyPortal with samd51j20.
Even simpler to demo is to control-C during run, the KeyboardInterrupt pops into the title bar. Hard reset, and the KeyboardInterrupt is still in the title bar after the tio reconnects and code.py is runing and printing to the serial console.
The title bar otherwise stays current: for example, control-C then control-D will refresh away the KeyboardInterrupt...
I found a driver library that runs successfully on microcontrollers (ESP32 S2 only one tested). But seems to raise an exception consistently when running on RasPi w/ Blinka.
With a bit of experimentation, I've discovered that a small time.sleep(0.1) inserted during the initialization of the driver after an existing RESET command, and before it starts doing anything else seems to resolve the issue and allow the Pi to use the driver and hardware.
Since it does seem to work as-is on microcontrollers, I assume the Pi can just get through the execution faster and happens to be "too fast" so the sensor isn't fully back up and running after the reset yet.
I can PR the library to add that sleep, but I hesitate since it does work on microcontrollers as-is. Should it use an optional argument or something to signify to sleep so that devices that don't need it don't have to spend any time on it? Or if the sleep time is small enough is it okay to just include it and have it wait for everyone?
The issue is documented more here: https://github.com/adafruit/Adafruit_CircuitPython_SI7021/issues/35
were you running a debug build?
I wasn't so far, just a normal build
hrm. ok. I suspect the second core is executing some code from flash during a flash operation then.
I'll check it all
I'm rapidly approaching the moment I hack on lld to make it do what I need
"move this function and everything it needs to ram"
It seemed to only occur if I created my own framebuffer. I don't think I saw it occur when I was using the one created automatically
hrm ok. I didn't get the framebuffer creation working for myself
were you trying on a board without a built in display?
I was finding that it didn't start a second time on the feather dvi
Tried it on the feather DVI board only.
I would release displays. Create the new framebuffer and framebufferio and then saves wouldn't work. But I didn't dig too deep
It did
hrm. I was seeing it hang in start up
I can try it out some more too. I know its extra preliminary so didn't dig too deep yet
nah, I'm still poking at that bit
hoping my fresh eyes today will see something
the picodvi lib doesn't have a deinit so I've gotta do it myself
I think folks will want to be able to switch modes though
Yeah if you want to specify your own bit depth or resolution not sure how else you can do it
ya. I know retro computers can switch between monochrome text mode and lower res color
so I want us to be able to do that too
The Python on Microcontrollers Newsletter is ready to crib from for the 2PM meeting, in GitHub
Yes, right now releasing just jumps from whatever spot in the envelope to the first index after the sustain index. Given the underlying table-based approach I chose, what else would be sensible to do? Or should I abandon the table-based approach? (it's not too late for that)
I'd like to directly support velocity (as relative note volume), but I don't know what the API would look like. Notes would either become objects with multiple properties, or all the 'parts' would be packed together in...
Thank you! -- just a request for three trivial alphabetizations.
Hi @dhalbert @tannewt
I have alphabetized them.
Unfortunately, build CI/docs failed, CI has problems when downloading some required packages.
Could you help me to fix this problem?
Tried various combinations of printing as fast as possible before serial is connected, and calls to supervisor.runtime.usb_connected and supervisor.runtime.serial_connected.
Not able to reproduce with:
Adafruit CircuitPython 8.1.0-beta.1-25-g4d7e54310 on 2023-04-16; Raspberry Pi Pico W with rp2040
Though I don't think we ever saw a reproducible procedure. I also haven't seen this in Discord since the two previous occurrences mentioned above.
I think this can be closed.
@lone axle I have some guide feedback on the PyCharm and CircuitPython page in the Welcome guide. They're using a newer version, and evidently the UI has changed significantly. I didn't confirm this. Can you take a look at the page and update it if indeed an update is needed? Thanks!
Yep, I'll take a look and update as needed. I've got a brand new version now as well so should be able to get it updated for the latest.
Excellent. Thank you!
I don't consider this a bug. tio is reconnecting after the "clean" status bar is sent. This is just a client timing issue. CP can't really know the best time to send the new title bar.
The title bar is not sent if USB is not connected, so, yes, this sounds like a timing issue.
I don't think 0 width or 0 height blitting should be valid. It should always have some pixels to blit. The client code shouldn't try it.
Same, haven't heard of it since.
@silabs-ChatNguyen I reran it. This can happen because GitHub Actions is unreliable.
I don't think 0 width or 0 height blitting should be valid. It should always have some pixels to blit. The client code shouldn't try it.
I kind of disagree, since it makes some client-side algorithms easier for the edge cases. Similar to how drawing things off the edges are OK, [3] * 0 is OK, zero-byte transfers in other cases are OK, etc.
One typo. Looks good otherwise. Thanks!
// test if bus returned high (idle) and not stuck at low
<@&356864093652516868> The weekly meeting will take place here on Discord at the normal time of 2pm Eastern, about 90 minutes from now. We look forward to hearing from you! You can fill in your hug reports and status updates and review the document ahead of time here: https://docs.google.com/document/d/1qghGAtx8DGO8UV_0hIy9R8n3UWM9ICSSSMR0Wkgs0u4/edit
CircuitPython Weekly Meeting for April 17, 2023 Here is the notes document for next Mondayβs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youβll be ...
@tannewt Still fail. Seem CI needs to update the package cache (sudo apt update) before installing the package.
@slender iron are you available to read the core section when the time comes?
I think the time is the case. The sensor does have a required conversion time that is not present in the library. however this time is max=10.8 ms (table 2 datasheet) for a temp 14 bit resolution. We do have, sleep time in some sensor libraries to allow the sensor to get back to normal, and as you mentioned in the issue the library does this when using the function _data(self). I do have seen problems with this sensor when you try to read the temp or humidity and the sensor is already doing a conversion, that is why the library uses the start_measurement function
I'm still dealing with internet dropping occasionally for 2-6 minutes just a heads up.
Represent!
I'll be at pycon as well!
Universal programable device in pocket calculator style
There is numerical block for better native enter numbers
and QWERTY block for write programs
Instead of searching 2nd,3th colorful symbols on chaotic ABCD keyboard you can type SIN,COS etc.... on well known QWERTY keyboard
Your formulas are send to REPL for execution
Common features:
-w...
That's a lot of new contributors. That's awesome.
Scott got his 1 page finally? π
what generates the stats?
There are scripts in adabot that compile them.
@tulip sleet want to merge https://github.com/adafruit/circuitpython/pull/7833 even though the docs build is having trouble? I don't think it is their issue
I deleted all the relevant caches, re-ran and was going to check again. I will take a look.
I was really impressed with tabler
Yay PyLadies!
debounce isn't easy without keypad library you're not alone.
It was all we used to have. I have some pseudocode that works, but it's a bit extraneous. Neradoc's suggestions were slimmer, which is good because this demo is already pretty beefy.
π
The django tabular dashboard is gorgeous. Worth checking out his stream to see that one.
Went deep on the DAC testing. Very nice CGrover!
Of course wait until the meeting is over to watch the video.
https://www.youtube.com/watch?v=_IGj-wyZRRc
This pedal uses demucs to split any song into 4 tracks: vocal, drums, bass and others (which includes guitar, keyboards, winds, etc), and then you can use the pedal itself to control playback and mixing of those channels, with a rotary encoder assigned to each track.
It's all open hardware and open software, using a case from a JΓcara instead o...
There is a comic in there that explains what is that weird green wood thingy. Working on an english translation of this comic.
π π
Hope y'all have a most excellent time!
Thank you, Melissa!
Hope your move and your projects go well Melissa.
Thanks
ohh danh on the circuit python show? β€οΈ
yup!
yup, and I'm hosting
Thanks for another excellent meeting!
Thanks
Thanks all, have a wonderful week!
@crimson ferry Did you notice the whizz-bang I named after your suggestion? π
i remember you mentioned a plan, but didn't see the #thing
the sewer scout?
Link to Onewire software reference has changed since Analog's acquisition of Maxim Integrated.
Here is the notes document for next Mondayβs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youβll be attending the meeting - itβs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weβll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/1O1R88xjW7HiJjJ1zOHpSwMhXNh-jX7-BOy8P8jLgLyA/edit?usp=sharing
CircuitPython Weekly Meeting for April 24, 2023 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canβt make the meeting and would still like to parti...
CircuitPython version
Adafruit CircuitPython 8.0.5 on 2023-03-31; Adafruit Feather ESP32-S2 TFT with ESP32S2
Code/REPL
import board
from analogio import AnalogOut
a0 = AnalogOut(board.A0)
a1 = AnalogOut(board.A1)
while True:
for i in range (0, 65535, 64):
a0.value = i
a1.value = i
Behavior

When inst...
The GitHub Actions bug is a GitHub problem; there's an issue about it: https://github.com/actions/runner-images/issues/7452. I'll merge now anyway, because this should be a transient problem.
Thank you for this excellent PR!
@lone axle I'll let you merge the pull request if that's alright, as I'm really rusty with the process π
Given the underlying table-based approach I chose, what else would be sensible to do? Or should I abandon the table-based approach? (it's not too late for that)
Oh, if the API is still fluid, I have opinions! π
The current waveform approach is interesting and allows for complex envelopes, so it'd be great for LFOs, but I don't see how to make it work easily as an ADSR envelope, where the envelope can constantly change based on user playing.
Most of the synth APIs I have come acros...
Will do. Thank you!
@slender iron I did not realize that the silabs PR has 150MB of .zip files (I thought they were much smaller). This is much larger than anything in any of other port directories. I think we really don't want this: we want that stuff to be a submodule. And we don't want it in the history either. I think I need to revert the PR and clean out the history of those large files.
@slender iron do you think I should do a force push, or do something trickier to get rid of that history?
we don't want the files in the history because we then need to download them?
force push is ok with me
I will do that immediately
@slender iron I have to undo the branch protection rule temporarily
kk. I'll be up from my desk soon when ari wakes up
@slender iron talk to you in Amelia for a bit?
https://github.com/adafruit/circuitpython/actions/runs/4723264172/jobs/8379062335#step:5:124 anyone know if this is fixed in main yet? Needs an apt-get update I think
This is some problem at GItHub Actions, I believe: https://github.com/actions/runner-images/issues/7452
@onyx hinge I just did a push -f to adafruit/circuitpython with Scott's overseeing, because of some large files that were in the SiLabs PR. (see above).
so if you just pulled within the past hour, you will want to pull again to get rid of that merge commit.
No, I just got back from the trails
Suspect the problem is missing apt-get update though
but why should we have to do apt-get update? That is their Ubuntu image problem
I mean, I agree but in the past they've closed it as "meh"
(the Ubuntu archive now only has a package newer than the one referred to in cached data in the Ubuntu azure image)
@silabs-BelaV @silabs-ChatNguyen I merged this PR, and then realized that the ports/silabs/tools/slc_cli_linux/* files were 150MB. That is much larger than anything else in this repo. We would really like these files to be somewhere else. Do you have another repo you can submodule them from, or just fetch them as necessary in the Makefile, say?
I undid the merge commit by force-pushing to get rid of the history with these files.
Let's wait a bit (like until tomorrow) and see if they fix it. It's only breaking the doc build
I deleted all the caches that might be causing this
Oops phone use problems
Please note: https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners
Note: Always run sudo apt-get update before installing a package. In case the apt index is stale, this command fetches and re-indexes any available packages, which helps prevent package installation failures.
(having the indexes be there at all is an attractive nuisance)
:throws up hands: oh well, it will slow down things, and notice in that 6486 above it says that it didn't work even after that
This error occurs even after adding sudo apt-get update in the command:
https://github.com/actions/runner-images/issues/6488#issuecomment-1295789463
@mimartin12, @abulka : Please always use
sudo apt-get update: Duplicate: #6486
They should remove the index from the runner images so it just always fails when not following the instruction without which it works most of the time
@onyx hinge so in build.yml:
run: |
sudo apt-get install -y latexmk librsvg2-bin texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
pip install -r requirements-doc.txt
add sudo apt-get update as the line before? Simple as that?
I think so!
there are few other apt-get install lines in other places
but I think we can just do it once there, since the other things run after that
Not necessarily, each one gets a fresh vm right?
Each job that does an apt get needs it afaik
workflows/build.yml
177: sudo apt-get install -y latexmk librsvg2-bin texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
workflows/pre-commit.yml
33: run: sudo apt-get install -y gettext uncrustify
actions/deps/ports/broadcom/action.yml
10: sudo apt-get install -y mtools
actions/deps/external/action.yml
33: run: sudo apt-get install -y ninja-build
build.yml and pre-commit, yes, but the actions.deps/... I think those are used inside the workflows
hmm, maybe not, because they are used in individual board builds
from custom-board-build.yml
This is to fix issues like https://github.com/actions/runner-images/issues/7452, and is recommended by https://docs.github.com/en/actions/using-github-hosted-runners/customizing-github-hosted-runners.
Thank you! Good to merge if green
I don't have a logic analyzer, but AnalogIn measurements indicate the same issue with:
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather ESP32S2 with ESP32S2
It's amazing this hasn't been noticed until now.
Mini module:
2 IO18 on the module is pulled up to VDD33 through a 10 kΞ© resistor. For details, please refer to Figure
5 and Figure 6."
(https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_en.pdf p.11 via <https:/...
I don't have a logic analyzer, but
AnalogInmeasurements indicate the same issue with:Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather ESP32S2 with ESP32S2It's amazing this hasn't been noticed until now.Mini module:
2 IO18 on the module is pulled up to VDD33 through a 10 kΞ© resistor. For details, please refer to Figure
5 and Figure 6."
GPIO18 is apparently used for serial bootloading as a TX line for UART1. I guess that's in the ROM. It is a strong design suggestion that this pin be tied to 3.3V to prevent it floating.
From https://www.espressif.com/sites/default/files/documentation/esp32-s2_hardware_design_guidelines_en.pdf:
GPIO18 works as U1RXD and is in an uncertain state when the chip is powered on, which may affect the chipβs entry into download boot mode. To solve this issue, add an external pull-up resistor....
I'm experiencing the same bug on Adafruit CircuitPython 8.1.0-beta.1-27-g3871501b5 with QT PY ESP32-S2.
It would be very helpful to get this fixed especially when working with Adafruit IO.
Here's my code:
from microcontroller import watchdog
from watchdog import WatchDogMode
from time import sleep
wdt = watchdog
wdt.timeout = 10
wdt.mode = WatchDogMode.RESET
counter = 0
while True:
counter += 1
if counter >= 5:
raise Exception("Simulated Error.")
...
The decision about blitting zero width or height bitmaps is above my pay grade :grin: but in case it helps I poked around the libraries for awhile.
I believe the MagTag issue stems from this code fragment in the adafruit_bitmap_font.pcf libarary:
width = metrics.right_side_bearing - metrics.left_side_bearing
height = metrics.character_ascent + metrics.character_descent
bitmap = bitmaps[i] = self.bitmap_class(width, height, 2)
...
Looks like the weblate branch is messed up. Can it be configured to rebase instead of merge?
Ran it with the try/except for 24 hours successfully. The device rebooted when I unplugged my multi-card reader. Windows must have gone around and touched every other USB device because the S3 weather station rebooted. That reset the clock back to 0 for me in looking into this issue. 24 hours without a single error is definitely an improvement as before it was about 10-12 hours reliably failing two days in a row. Granted I've only had the feather weather station up and running for 2 days s...
@dhalbert @tannewt @RetiredWizard We appreciate your quick and extensive assistance to merge our pull request, and we are thrilled to have made it to this stage. Our new Pull Request for submoduling the ports/silabs/tools/slc_cli_linux/ is created: https://github.com/adafruit/circuitpython/pull/7874
I used the weblate administrator interface to reset changes back to our main branch.
I used the weblate administrator interface to reset changes back to our main branch.
Thank you!
Thank you for your patience with this, and for doing the submoduling. This PR does still have at least one commit (50d82ef30e9392186dd43a449429d48c5277664d) in it that adds the original .zip files (and then one that takes them away). So after a regular merge, the intermediate commit will still be in the history, and the .zip files will be part of the history, and will get fetched when the rjepo is cloned.
I think we could do a squash merge (these are currently disabled on this repo), and g...
Brought this in up in our discord #help-with-git: #help-with-git message
LGTM! Thanks @CanyonCasa.
Don't do extra work yet, because I think the squash merge on our end may be easiest, once I confirm it's OK.
I am surprised codespell didn't catch that.
@tulip sleet what's the state of everything?
silabs resubmitted the PR. They made a repo for the .zip files and submoduled it, which is great. I plan to merge that PR as a squash merge, so the intermediate commits with the .zip file history disappear.
It may or may not be true that the .zip files are still accessible via the reflog even after I did git reset --hard HEAD~1; git push -f. If so I can clean that up later. Or, I think that the reflog will get gc'd after 90 days or something (I may be confused about that, but I know some things have a limited lifetime.)
why did they leave the files zipped?
you could squash the branch before doing a merge
the branch is in their repo; not sure I have sufficient access to do that.
The .zip files contain CLI executables, part of their IDE or similar
it's like 150MB
I think the squash merge PR will be fine, and GitHub will figure out the squash, instead of my having to do it by hand and possibly make a mistake. I just have to temporarily enable squash merges and then disable it again.
ya, I think that's ok. theres a lot of noise in the commits anyway
yeah, thanks, I'll proceed.
looks like the repo they submodule doesn't have zips
we should probably add a CI check for large files
or turn off lfs some how if that's our limit
I think these were smaller than LFS limit
didn't retiredwizard need to enable lfs for them?
yes, looks like they unzipped it. https://github.com/SiliconLabs/circuitpython_slc_cli_linux it's only a few hours old
comment here, maybe: https://github.com/adafruit/circuitpython/pull/7833#issuecomment-1508219340
regular file size limit (before LFS) is 50MB, so these were just under (or at least some of them were).
ah, from the other sdk
actually I see different sizes, maybe 100MB is the limit
yeah
we should have a CI test for file size
Ok, makes sense. 0 width or height is fine with me.
We already request an update once serial is connected here:
I am trying to understand how CircuitPython works on Micro:Bit v2. I looked at https://github.com/adafruit/circuitpython/pull/5002. But I am unsure how the published hex file gets loaded (https://downloads.circuitpython.org/bin/microbit_v2/en_US/adafruit-circuitpython-microbit_v2-en_US-8.0.5.combined.hex). I understand that I need to use Bluetooth on https://code.circuitpython.org/ to edit the code.
I'm glad to write some documentation if I can get an understanding of it all.
I can imagine a
synthioshape of the above takingenvelope_levelsandenvelope_ratesReadableBuffers params. The user would adjustenvelope_levels[2]to change the sustain level andenvelope_rates[0]to change attack rate.
I'd prefer 8 separate parameters with better names. indices are hard to understand.
I'd prefer 8 separate parameters with better names. indices are hard to understand.
Me too. But for some reason I was assuming we need to stick to ReadableBuffers to allow real-time control of these params. I am probably wrong about that.
the Micro Bit works by showing a MICROBIT drive on which you drop hex files (it's a programmer chip)
like hex files downloaded from make code
unless it changed in a new version of v2 ?
I guess the site also has a feature to directly send the code to it
as far as I know it doesn't need to be put in bootloader mode though, the drive is always there
it appears to be the same. They seem to have tried hard for upward compatibility, even to the extent of NOT taking advantage of the USB on the nRF52833
Maybe have a separate data class that holds config params, or use a namedtuple?
yeah the USB pins are not connected
the original design seemed to try to get as many manufacturers involved as possible π
note that the "display" is not handled in Circuitpython. We have the
_pew module for the pewpew, so the fastest way might be to port that to NRF
(it's an LED matrix, requiring to actively "scan" through rows and columns)
I did a test build and got this error. Only extra thing I did beforehand was sudo apt install default-jre, on Ubuntu 22.04.
...
arm-none-eabi-gcc -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -T"build-devkit_xg24_brd2601b/autogen/linkerfile.ld" --specs=nano.specs -Xlinker -Map=build-devkit_xg24_brd2601b/circuitpython_efr32.map -Wl,--gc-sections @build-devkit_xg24_brd2601b/linker_objs -Wl,--start-group -lgcc -lc -lm -lnosys /home/halbert/repos/adafruit/scircuitpython/por...
I did a test build and got this error. Only extra thing I did beforehand was
sudo apt install default-jre, on Ubuntu 22.04.... arm-none-eabi-gcc -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -T"build-devkit_xg24_brd2601b/autogen/linkerfile.ld" --specs=nano.specs -Xlinker -Map=build-devkit_xg24_brd2601b/circuitpython_efr32.map -Wl,--gc-sections @build-devkit_xg24_brd2601b/linker_objs -Wl,--start-group -lgcc -lc -lm -lnosys /home/halbert/repos/adafruit/scircu...
I did a test build and got this error. Only extra thing I did beforehand was
sudo apt install default-jre, on Ubuntu 22.04.... arm-none-eabi-gcc -mcpu=cortex-m33 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -T"build-devkit_xg24_brd2601b/autogen/linkerfile.ld" --specs=nano.specs -Xlinker -Map=build-devkit_xg24_brd2601b/circuitpython_efr32.map -Wl,--gc-sections @build-devkit_xg24_brd2601b/linker_objs -Wl,--start-group -lgcc -lc -lm -lnosys /home/halbert/repos/adafruit/scircu...
So after dropping the hex file to MICROBIT, then edit and run using code.circuitpython.org?
edit with the mobile app or code.circuitpython.org yeah, Thonny should work I think
I am not sure the intent of the CORS implementation in Web Workflow is correct. From my
limited understanding of the feature, it is not for server based request validation but
for informing the client what domains are OK for requests following. As it is currently
implemented in "web_workflow.c:_origin_ok", HTTP requests are rejected if the "Origin:"
HTTP header attribute is set and does not match one of the built-in domains or IP.
Returning a 403 error in this case does not seem correc...
All set, built successfully, thanks!
Validate Origin/Host headers as follows:
- If No Origin: specified, then return OK
- If Origin: does not have http: scheme, treat as # 1 above
- If No Host given, and Origin: specified, return 403
- If both Host: and Origin: are specified, check for hostname match (including port #)
Origin: is OK if same as Host: --> return Origin:, otherwise 403. - Special debugging case allowed for Origin: equal "localhost" (ignoring port #)
See discussion in #7875 for rationale and deta...
@brazen hatch I think I found a stack checking bug. It might be related to what you are seeing
STATIC void start_mp(supervisor_allocation *heap, supervisor_allocation *pystack) {
supervisor_workflow_reset();
// Stack limit should be less than real stack size, so we have a chance
// to recover from limit hit. (Limit is measured in bytes.) The top of the
// stack is set to our current state. Not the actual top.
mp_stack_ctrl_init();
uint32_t* stack_bottom = stack_get_bottom();
if (stack_bottom != NULL) {
size_t stack_length = stack_get_length();
mp_stack_set_top(stack_bottom + (stack_length / sizeof(uint32_t)));
mp_stack_set_limit(stack_length - 1024);
}
ctrl_init will set the top the stack to where it currently is
but we likely want it higher than that if it is fixed
this is my corrected version
where we set the top explicitly
otherwise our checking won't kick in until it is too late
Well, I will try it on all esp.
(that's in main.c)
it didn't fix my crash though π€¦
(gdb) bt
#0 HardFault_Handler () at supervisor/port.c:313
#1 <signal handler called>
#2 0x98d5613c in ?? ()
#3 0x33f3deee in ?? ()
really helpful
yea stack debugging do be like that
I still havent gotten jtag working on esp so I canβt even do that
the panic handler will dump a backtrace for you on esp
and there is a way to add code to do it too
yea that looks the same like your snippet though
itβs unknown addresses
did you use the backtrace decoder tool?
nothing really helps for stack debugging
tried it all
π
itβs been the pot I have been boiling in for 2 months now
π€ this stack_ctrl thing fixes it
it does look like it applies to esp
since esp has a fixed stack too
Looks like the crash is gone, the recursion depth hard limit still is there but it probably make sense that this fix doesn't impact that
Iβm in kind of a mess, testing will take more
Related? #5233
In this particular case, USB is connected, so I don't think it's directly #5233. However, SPIM3 is flaky in various ways, so in the long run, I think we should avoid assigning it unless the user really wants/needs it.
Said mess:
Dynamic console support.
It works, some prints are forgotten though and I need to swap em.
This was a nightmare.
Now finally going to test the pystack change.
So my diff is now:
diff --git a/main.c b/main.c
index 6ff6202d6..f41d3956d 100644
--- a/main.c
+++ b/main.c
@@ -153,18 +153,17 @@ STATIC void start_mp(supervisor_allocation *heap, supervisor_allocation *pystack
supervisor_workflow_reset();
// Stack limit should be less than real stack size, so we have a chance
- // to recover from limit hit. (Limit is measured in bytes.)
+ // to recover from limit hit. (Limit is measured in bytes.) The top of the
+ // stack is set to our current state. Not the actual top.
mp_stack_ctrl_init();
- if (stack_get_bottom() != NULL) {
- mp_stack_set_limit(stack_get_length() - 1024);
- }
-
-
#if MICROPY_MAX_STACK_USAGE
// _ezero (same as _ebss) is an int, so start 4 bytes above it.
- if (stack_get_bottom() != NULL) {
- mp_stack_set_bottom(stack_get_bottom());
+ uint32_t* stack_bottom = stack_get_bottom();
+ if (stack_bottom != NULL) {
+ size_t stack_length = stack_get_length();
+ mp_stack_set_top(stack_bottom + (stack_length / sizeof(uint32_t)));
+ mp_stack_set_limit(stack_length - 1024);
mp_stack_fill_with_sentinel();
}
#endif
I just merged it with the existing code with my last braincell. It's cooking now. Pi 1fps.
Also, that is stack, not pystack.
@brazen hatch do you do make -j4 on the Pi 4?
what do you mean by hard limit?
it may be limited by the esp stack size now
(not sure which stack limits recursion)
there is a separate error for running out of pystack though
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
NLR jump failed. Likely memory corruption.
I think I did it wrong.
I didn't change the max stack usage part
He is prolly talking about the effectiveness limit of pystack.
Passed a certain point, you don't get any increased. It's different for every mcu.
@wraith crow Could you toss me your main.c?
the c stack still limits recursion I think
on some ports it is fixed and others it is dynamic
Yes. It's got 4 cores so why not?
i just meant if you're not doing that, try it
π€
FYI this breaks turtle because it changes subscr errors from IndexError to ValueError. I'll look at fixing this.
I'm actually out at the moment I'll send over the main.c when I'm back home, although I just pasted in Scott's code segment. And yep I was talking about the effective limit of the pystack
I got it booting, it's prolly good now. Thanks anyways.
Now I will test it.
Hi folks, apologies, this is probably a silly question. I am using the latest build (8.0.5) for the Raspberry Pi Pico W. I want to use GPIO24 to tell if the board is charging or not, I can do this pretty simply in MicroPython with charging = Pin(24, Pin.IN) but I can't seem to find anyway to do this with CircuitPython.
When I look at the board pins.c file, I can see that it's not 'mapped' (Sorry if that's not the right term) and then I try to do things like charging = digitalio.DigitalInOut(board.GP24) it errors with AttributeError: 'module' object has no attribute 'GP24', as I would expect it to as it's not in the 'board' class.
Is there any way that I can read if this pin is 1/0 to tell if the board is charging using CircuitPython?
24? I can't see it on the silk screen even.
Perhaps it has to do with the wifi module.
Wait let me fetch a normal pico.
Uhh, that isn't broken out even on a normal pico.
Am I blind or something?
Pins of the cpu not broken out, are not defined in the board pin definition.
If you want to map that pin, you will have to do a custom build.
I'm not sure what you mean by "charging". GPIO24 is used to talk to the radio module
on the regular Pico, GPIO24 is used to sense that VBUS (USB voltage) is present
There is microcontroller.pin which usually has all pins on the microcontroller even if they aren't broken out on the board
there is no microcontroller.pin.GPIO24 on the Pico W; I thought there would be, but there's not, because it's reserved for radio module comm,
we didn't bother to make it accessible
GPIO24 is not useful to monitor for VBUS on the Pico W, because it's used for another purpose
ESP32S3: PASS (12k pystack)
def test(no):
try:
test(no+1)
except RuntimeError:
print("Done")
a = "for i in range(10): test(0)"
for j in range(3000): exec(a)
exec (at this scale) was immediately safemoding on all
Hopping on s2 now.
I also did a stack integrity check, pass.
Passing diff:
diff --git a/main.c b/main.c
index 6ff6202d6..f007154e1 100644
--- a/main.c
+++ b/main.c
@@ -153,22 +153,17 @@ STATIC void start_mp(supervisor_allocation *heap, supervisor_allocation *pystack
supervisor_workflow_reset();
// Stack limit should be less than real stack size, so we have a chance
- // to recover from limit hit. (Limit is measured in bytes.)
+ // to recover from limit hit. (Limit is measured in bytes.) The top of the
+ // stack is set to our current state. Not the actual top.
mp_stack_ctrl_init();
- if (stack_get_bottom() != NULL) {
- mp_stack_set_limit(stack_get_length() - 1024);
+ uint32_t* stack_bottom = stack_get_bottom();
+ if (stack_bottom != NULL) {
+ size_t stack_length = stack_get_length();
+ mp_stack_set_top(stack_bottom + (stack_length / sizeof(uint32_t)));
+ mp_stack_set_limit(stack_length - 1024);
}
-
- #if MICROPY_MAX_STACK_USAGE
- // _ezero (same as _ebss) is an int, so start 4 bytes above it.
- if (stack_get_bottom() != NULL) {
- mp_stack_set_bottom(stack_get_bottom());
- mp_stack_fill_with_sentinel();
- }
- #endif
-
// Sync the file systems in case any used RAM from the GC to cache. As soon
// as we re-init the GC all bets are off on the cache.
filesystem_flush();
@tulip sleet @slender iron - Ah right, that makes sense. I had used it with MicroPython on a regular pico so that is why I could do it. No bother. Thank you both so much for your help anyway. I forgot the RP2040 can't just grow extra pins because I want them.
anyone use a stack larger than 4k on rp2040?
While deving pystack, I used it with 7k, rp2's effective limit
And that was stable.
yeah, on micropython you're monitoring some changing value that is not vbus if you do that on a Pico W. We do have GPIO24 on CircuitPython on the plain Pico. It is board.VBUS_SENSE or board.GP24.
Sorry, i am using the pico lipo shim from pimoroni and USB Voltage being there means it will be charging.
I fully didn't explain myself. Long day.
You could hook a wire to the red led if you really wanted to.
I have 2 of those.
The soldering iron is packed away. I will just do without. It was a 'nice to have' and my soldering isn't that precise.
Ah I can just rely on my voltage figure being > 5v for charging! Sweet
ESP32S2 PASS (12k stack)
Do I feel like firing up C3? Naaaahhh.
I do not have a working ESP32 board for now. So can't test that now either.
@slender iron I'd say go ahead and pr it.
It's a fix for this much. Since S3 is stable, the others will also be.
S3 was the worst in crashes with big pystacks.
@ladyada
Board name
Name is "Prop-Maker", with a hyphen, to match the FeatherWing name; not "PropMaker", and not "Prop Maker".
Pin names
Board-specific pin names were a bit tricky to decide on. Let me know if you have other ideas.
I2S pins
I2S pins match the argument names for the constructor:
audiobusio.I2SOut(
bit_clock: microcontroller.Pin,
word_selec...
missing parameters in wifi module on 8.0.3 can anyone confirm these wifi.radio.connected returns boolean on 8.0.5 or 8.1 eps32boards
the docs are newer than 8.0.3
thank you i will proceed to update @slender iron
they usually match the state of main
https://docs.circuitpython.org/en/8.0.x/README.html for 8.0.x stream
there is a selector at the bottom of the left sidebar
doesnt seem to be selectable in either chrome or edge for version btn left
8.0.5 seems to also be missing the same few params
possibly missing from shared-bindings/wifi/Radio.h
it's only in main, it's 2 weeks old
https://github.com/adafruit/circuitpython/pull/7823
Add wifi.radio.connected, wifi.radio.ap_active
prior to that, you would test if there is an ip_address to know if you are connected
@jaunty juniper thank you for finding the implantation date. would there be a docker image i could clone down and build main firmware for my feathertftreverse
interestingly it says 8.0.4 in the title π€
was there no docs build for 8.0.5 ? (might not have been needed)
or the doc build failed for some reason
no, but we have a guide
https://learn.adafruit.com/building-circuitpython
oh but you can download main
just to confirm main on git is not the prebuilt 8.0.5
on the board page on https://circuitpython.org/ there is a absolute newest link
every merged PR is built and uploaded there
yeah i can download whole main which i did last week to read through some source code to compare with micropython i can redownload it but a bit confused on build process as i got me an expressif docker container and was using a one line docker CL to build micropython for S3
yeah i have 8.0.5 installed as we speak still no connect boolean
no I mean you can download the binary for latest
bin update?
what board is it ?
feather s2 tft reverse
which for en_US leads to
https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/adafruit_feather_esp32s2_reverse_tft/en_US/
and the top UF2 is latest
remember it's beta though
standby for confirm pretty sure its gonna be 8.1.0
it will be newer than 8.1
yeah, latest
(newer than the current beta)
we are in there ppl
a version like 8.1.0-beta.1-23-g0aea45516 means about 23 commits after 8.1.0
@jaunty juniper @slender iron @tulip sleet thank all three of you for directing me to various trouble shooting. hope version filter gets fixed on site
the version filter was broken in 8.0.x due to a Javascript problem, but it works with latest, at least for me
someone get me a frontend dev lolz jp looks like a jquery not defined error not related to circuitpython
I'm a glutton for punishment so I went ahead and ran your test script on the C3, no crash, but the effective pystack size is pretty low on the C3, around 2200.
what do you mean by effective pystack size?
The size at which increasing pystack no longer increases the recursion limit. I thought you said that the c stack was probably the limiting factor after pystack reaches a certain size.
ya, I think the cstack is restricting recursion
pystack will hold the frames themselves I think
the python portion of the frame at least
(instead of the heap potentially)
That's consistent with what I was seeing when I ran stackless builds. I believe I was turning off the cstack use as well in that case.
I'm not sure how stackless works
I don't think the stackless builds were running into the recursion limits.
My condolences. Thanks for testing it though.
Yea, stackless is still superior for massive recursion.
But for anything else, the depth settable pystack reaches, is plenty enough. Except for c3 I guess.
Dinner bell is ringing, but I'll build the ESP32 Huzzah image tonight and test on that as well. I'm really excited the dynamic pystack looks like it's getting close to done π
c3 can't have much of a CP user base though considering how hard it is to work with
hard horrible
Feather ESP32 Huzzah ran through the test script without a crash with pystack set to 9000, the recursion limit appears to be around a pystack size of 3900.
Thanks for testing it!
So this issue is entirely fixed by this change.
The effective limit seems so smaller on esp than on rp2.
Perhaps combining 'reserved psram' and 'resizable pystack', we can go even further.
Add a new mode to OnDiskGif with the use_palette keyword. Set to true the GIF will decode to an indexed bitmap and a palette. On a 240x240 GIF this saved around 54KB. Yay! I have not done any speed comparisons.
As the GIF gets smaller the palette becomes less efficient because (right now) I do not dynamically change the palette size which I believe can change per frame. So it allocated 256 entries to use (largest possible).
import time
import gc
import board
import...
I have only done an initial test on an ItsyBitsy M4. Seemed to work on the RP2040 DVI while I was experimenting with that but having some DVI issues and have not tried on a TFT on a RP2040 yet.
Still occurs with:
Adafruit CircuitPython 8.1.0-beta.1-25-g4d7e54310 on 2023-04-16; Raspberry Pi Pico W with rp2040
It probably isn't worth the extra code to filter, easy enough to find uniques in Python. I thought it might arise from something in the driver or sdk.
Does TinyUF2 touch the RTC?
After many rabbit holes in the circuitpython code, I didn't find where the default seconds are set. It seems possible that some code path is missing a check for whether to reset the date, or using an unitialized date to set the RTC.
But with more testing, I did find that the issue trigger is more complex. Hard reset always resets the date to 2000, as expected. Early CP8 versions will maintain the year 2000 date after a hard reset and through several UF2 loads...
I think there's no reason that synth.envelope = synthio.Envelope(attack_time=37, ...) couldn't be made to work.
If it's what y'all want I can abandon the arbitrary-buffer-based way of this PR as it stands, and switch to something more like the mozzi's envelope generator.
switching synthesis to be based on frequency in (possibly floating point) Hz instead of MIDI notes would be a topic for a future PR.
Is there any way for me to add a built-in module to a circuitpython uf2? The end goal is to have these custom libraries available to users of a robot I am designing (using Pico W) without having to install the libraries manually/separately.
Yes, you can "freeze" CircuitPython libraries in when you build CircuitPython: https://learn.adafruit.com/building-circuitpython/adding-frozen-modules (and see that whole guide.
Thank you!
There are two waiting PRs from Neradoc and one from me on adafruit_httpserver, anecdata already reviewed Neradoc's ones. Could someone please review mine and merge them all so that it is possible to continue working on v3.0.0 of the lib?
@todbot in the mozzy way what parameters define a 'plucked' note's envelope?
I suspect you'll need to increase the c stack size to get more recursion
Well, that can already be done the old way.
So are you pr'ing the fix?
Or do you want us to handle it?
It's your find afterall.
I was going to include the fix in my dvi PR
which is getting closer and closer
the c stack size is only dynamic on some ports. I don't think it is on ESP
because we inherit the stack size from esp-idf
-
Changed attenuation value from ADC_ATTEN_DB_0 to ADC_ATTEN_DB_11. This change increases the measurable input voltage range from range of 100 mV - 950 mV to range of 150 mV - 2450 mV. Reference: https://docs.espressif.com/projects/esp-idf/en/v4.4.4/esp32/api-reference/peripherals/adc.html#adc-attenuation
-
Scaling the 12-bit values received from ADC DMA engine to 16-bit value before returning the data. This change makes the values returned via
anlogbufio.readintocall 16-bit values simi...
Q: do these changes match up (attenuator included), with the values returned by analogio.AnalogIn? If so, that's great, and is what should have been intended.
Here's what I tentatively have (only this draft documentation) for a more mozzy-like envelope:
class synthio.Envelope(attack_time: float, decay_time: float, release_time: float, _attack_level: [float](https://docs.python.org/3/library/functions.h...
If it's what y'all want I can abandon the arbitrary-buffer-based way of this PR as it stands, and switch to something more like the mozzi's envelope generator.
I'm ok with a buffer if it is a shape. I'd avoid a buffer if you'd want each index to mean something else. In that case, it should be named values.
(I leave the synth decisions to folks who've done it.)
@plucky tulip Dan has looked at the code, I will test. Should Neradoc's two be merged, or what's the desired sequence once these three are all approved?
In my opinion both Neradoc's PRs can be merged and released as 2.5.0, as they do not contain any breaking changes. Then if everything is correct, mine could be merged, without releasing it as 3.0.0 as there are more changes to come, I already have files but not PR yet as there would be some conflicts
OK, I'll merge Neradoc's two and use that as the baseline for testing, thanks.
Ok, If there are any conflicts with my branch after merge I will fix them right away, Thank you
@blissful pollen when testing the gif stuff with dvi did you update to my latest branch?
Nice optimization! Just a couple things.
Please rename this to something more descriptive while you are in here.
mp_obj_t filename = all_args[0];
Why make this sub-struct?
@crimson ferry Conflicts resolved, thank you for merging and in advance for testing
I implemented a lot of the CORS stuff before realizing browsers wouldn't allow .local access from non-local pages. So, it's probably overly complex.
Q: do these changes match up (attenuation included), with the values returned by
analogio.AnalogIn? If so, that's great, and is what should have been intended.
Yes, the changes match up with analogio.AnalogIn. Typically one would expect the input voltage range to be from 0v to 3.3v for ESP32 ADC pin. So this change brings it to best possible range 150 mV - 2450 mV.
@todbot in the mozzy way what parameters define a 'plucked' note's envelope?
This is the problem with ADSR envelopes in general. Many synths solve the problem by defining a curve shape (linear, exp, inv exp) to the rates. But the synth libraries I know only do linear rates for their ADSR (e.g. Mozzi, TeensyAL, [DaisySP](https://github.com/electro-smith/Daisy...
Here's what I tentatively have (only this draft documentation) for a more mozzy-like envelope (and the Synthesizer object will have a runtime-assignable
envelopeproperty):class synthio.Envelope(attack_time: float, decay_time: float, release_time: float, _attack_level: [float](https://docs.python.org...
Not yet. I am planning to try when Iβm off work today.
kk. I think I need to update the picodvi module. should be good when you are off work π
limor is testing now
Spoiler alert on both "Show and Tell" and "Ask an Engineer"!
Did you ear about an incoming Pimoroni product that use two RP2040 and SRAM chip to do a higher resolution DVI output.
Apparently it permit to dedicate the RP2040 to making the DVI signal, and the added memory use as a buffer where on RP fill in write mode, then the display connected RP read that same memory.
This is what I have understood from a Tom's hardware video.
ya, I saw mention of that. I was a bit worried when they said "I assume that means they'll support 1080p"
my understanding is that clock speed is a limiting factor as well as ram
Not sure that is even possible, but all of this is above my league.
It was never the complexity - just the restrictions on device naming that irked me. I couldn't figure out what problem it was solving and it seemed a bit backward (client/server roles reversed) from the spec. If there is no real specific need for it, it should be removed.
@slender iron Got the latest code, haven't done a lot of testing yet but the colors in the GIF using either colorconverter and palettes are off. Trying to figure out why still.
got a pic?
The CC one may be something about processing speed. I previously cut CC down to the bare minimum and seemed better. Palette confuses me. The colors are slightly off (compared to the CC colors that are correct but missing in places)
do you have test code I could run in my branch?
Sure though the GIF palette code is on that PR I just submitted
I can start with the cc version
import board
import gifio
import displayio
import time
import picodvi
import framebufferio
import gc
display = board.DISPLAY
splash = displayio.Group()
odgcc = gifio.OnDiskGif('/homer-64x64.gif', use_palette=False)
odgp = gifio.OnDiskGif('/homer-64x64.gif', use_palette=True)
start = time.monotonic()
next_delay = odgcc.next_frame() # Load the first frame
odgp.next_frame()
end = time.monotonic()
overhead = end - start
facecc = displayio.TileGrid(odgcc.bitmap, pixel_shader=displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565_SWAPPED))
facep = displayio.TileGrid(odgp.bitmap, pixel_shader=odgp.palette)
facep.x = 64
#splash.append(facecc)
splash.append(facep)
display.root_group = splash
# Display repeatedly.
while True:
#time.sleep(max(0, next_delay - overhead))
time.sleep(0.3)
next_delay = odgcc.next_frame()
next_delay = odgp.next_frame()
Sorry down to one monitor so I can't have discord nicely on the second while testing this
Okay one small fix line #60 in the shared-module ColorConverter.c it shifts green 12 to the right. It should be 13:
uint32_t g3 = (color_rgb888 >> 13) & 0x7;
That fixed a lot for the palette
I'll send another picture of the palette only with a larger GIF. There are some missing pixels still but much less
seems like the black pixels could be incorrectly transparent ones
ah, missed a return
on line 319
π
Seems to work for me
PicoDVI in CP support 640x480 and 800x480 on Feather DVI, Pico and Pico W. 1 and 2 bit grayscale are full resolution. 8 and 16 bit color are half resolution.
Memory layout is modified to give the top most 4k of ram to the second core. Its MPU is used to prevent flash access after startup.
The port saved word is moved to a watchdog scratch register so that it doesn't get overwritten by other things in RAM.
Right align status bar and scroll area. This normally gives a few pixels of pad...
I'll try to test it some more hopefully tomorrow
are you going to show and tell it today?
(otherwise I will)
I can do turtle instead
I was thinking of it, to show off the Palette PR too
π I'll do turtle
I loaded up a 320x240 gif that would not otherwise fit
Welcome, thanks for adding the support! You did the heavy lifting. Now to think where I can plug a RP2040 DVI into an unsuspecting TV with HDMI π
π
OK, I'll re-work this PR so that it uses a parameter-based envelope instead of a table-based one. Thank you for the input.
The part where it fixes the stack crashes, has been tested by me and and Retiredwizard, across all esp mcu's.
Thanks @jepler! I am astounded that we can get polyphonic synth functionality in CircuitPython.
Tested new stack code on RP2040 and SAMD51, no issues....
This is from the PR artifact:

@tulip sleet is it worth adding this to the 8.0.0 release notes ? It's not referenced in any release, and somebody didn't find the info when looking for it
- The property
supervisor.runtime.autoreloadreplacessupervisor.disable_autoreload()andsupervisor.enable_autoreload()
Thanks - I missed that when I did the others. Updated in GitHub and in the original 8.0.0 blog post.
thanks 
Thanks for this!
I tested with a Metro ESP32-S2 and a Pi Pico W. Works great. I translated my current ASCII passphrase to hex and that worked fine.
I made a couple of changes:
- Moved validation routine out of
argcheck.c, since it was rather specific, and not like the other validation routines. Usedunichar_isxdigit()to do hex-digit checking. - Added
password-length documentation. - Ran
make translate.
I will merge when/if the build succeeds.
I just ran into that, maybe the instructions to allow read/write to the actions should be not only in the troubleshooting, but prominent as a step of the setup for releases
@sean-bayarea I've tested the connection issue of this example without problems on a Pico W running CircuitPython 8.0.5 and the latest MiniMQTT library. I am connecting to the HiveMQ public MQTT broker.:

Below is a copy of the ipynb file you uploaded earlier. At the bottom, I've updated your code snippet a bit to move the try/except inside the while True: loop.:
[CPX_blin...
I would say the device/server side is fixed if CORS support is desired (What problem is is solving??? Example, please).
The REST / Serial API is now fully functional independent of device host name used. As far as the web-editor goes, that is not fixed - it needs some code changes to allow normal naming without restrictions.
BTW - not all environments / platforms support mDNS out-of-the-box and/or may not resolve .local names. mDNS does not traverse subnets. However, there exists p...
Hi, has anyone programmed the KTIR0711S reflective sensors in CircuitPython? I don't know how to go about it, and I can't find anyone doing anything with them on the internet.
8.1.0-beta.1 works fine for me on my Odroid Go. The issue must have been fixed.
@makermelissa Do we need this for S2 and S3? Looks like the web installer will use mass storage when needed.
@VictorioBerra Are there any other boards that the UC8151D doesn't work with? I can't find my S3 TFT. I tried mimicking it by having my feather rp2040 EPD init a display to simulate an on board display but the UC8151D still works fine.
Great! Code looks good for consistency, etc. Other people tested the actual video, so I did not do that.
@tannewt All I have is the two tri color 2.9" EPDs and the S3 TFT. I plan on getting more in the future but im just now diping my toes into all of this.
8.1.0 as time goes on is looking tastier and tastier.
In the beginning, Jepler created the attack and the sustain. And synthio was without form and void and darkness was upon the face of the delay. And the Spirit of Jepler moved upon the face of the waveform. And he said, 'Let there be synth.' And there was synth.
Ok, no problem. I'll pick up another S3 TFT with my next order.
Tagging @kvc0 and maybe @FoamyGuy:
Compilation generates this mild warning:
../../shared-module/vectorio/Circle.c: In function 'common_hal_vectorio_circle_get_pixel':
../../shared-module/vectorio/Circle.c:26:22: warning: taking the absolute value of unsigned type 'uint16_t' {aka 'short unsigned int'} has no effect [-Wabsolute-value]
26 | int16_t radius = abs(self->radius);
| ^~~
The radius struct element is already unsigned:
https://githu...
the STEVAL-MKSBOX1V1 https://www.st.com/resource/en/data_brief/steval-mksbox1v1.pdf has a rich set of sensors and other capabilities. Has anyone done a port, or interested in doing one? What will be the best starting point?
it looks like there may be STM32L4 support already
L4R5 has a linker script
but maybe a lot undone: ifeq ($(MCU_SERIES),L4) # Not yet implemented common-hal modules: CIRCUITPY_ANALOGIO ?= 0 CIRCUITPY_AUDIOBUSIO ?= 0 CIRCUITPY_AUDIOIO ?= 0 CIRCUITPY_COUNTIO ?= 0 CIRCUITPY_FREQUENCYIO ?= 0 CIRCUITPY_I2CTARGET ?= 0 CIRCUITPY_NEOPIXEL_WRITE ?= 0 CIRCUITPY_NVM ?= 0 CIRCUITPY_ROTARYIO ?= 0 CIRCUITPY_RTC ?= 1 # todo - this varies between devices in the series # This slide deck https://www.st.com/content/ccc/resource/training/technical/product_training/98/89/c8/6c/3e/e9/49/79/STM32L4_Peripheral_USB.pdf/files/STM32L4_Peripheral_USB.pdf/jcr:content/translations/en.STM32L4_Peripheral_USB.pdf # cites 16 endpoints, 8 endpoint pairs, while section 3.39 of the L4R5 datasheet states 6 endpoint pairs. USB_NUM_ENDPOINT_PAIRS = 6 UF2_FAMILY_ID ?= 0x00ff6919
and bluetooth coprocessor BlueNRG-M2SP
any other ports to use as template?
