#circuitpython-dev
1 messages ยท Page 340 of 1
had to change things like tuple to Tuple[str, int] in the commented interpretable section thingies
the mypy targets? what's the right thing to call those
I have this to offer to further reduce the size of circuitpython. It looks like it lets de_DE fit on feather_m0_express feather_m0_supersized and metro_m0_express along with the changes in this PR: https://gist.github.com/jepler/1f40cdadfabe61661c5fbad8ab58f030
It removes a little-used (I believe!) feature, calling the built in function pow with 3 arguments: pow(a,b,c). This is perhaps useful if you want to implement the RSA cryptosystem in pure Python code, but otherwise not much. ...
@onyx hinge how much does it save?
Is it possible that this is being overzealous about resetting modules, and is messing with pins related to the REPL?
i am about to add some stuff necessary to support deep sleep, etc., that will exist even without CIRCUITPY_ALARM=1, and may use up your savings ๐ฆ
@tulip sleet my local build of metro_m0_express for de_DE of that PR has 140 bytes free after that change. Before, that PR had -244 bytes free in my local build
we talked about disabling EPD on m0 devices, but I don't remember if we concluded that was something to investigate or not.
i think that would be fine. I also think we could try turning off _pixelbuf
_pixelbuf is 3200 bytes
As I said, I view this as temporary until gcc 10. I don't think we should spend a lot of time getting a couple hundred bytes here and there. It's a tremendous time sink.
you said there's a preview build available?
Thanks, I pointed a draft PR at it so we can check it out
The esp_idf submodule has been mistakenly updated to an old ref, please correct it.
Should self->num be assigned -1 here so that the closed socket can be recognized? Otherwise, wont a subsequent call risk doing lwip API calls on some subsequently created socket?
@tulip sleet Something is up with the way Learn is processing the file. I just uploaded a new version, and it came out the same size. Here is the smaller file:
Trying one more thing.
Nope. Emailing learn.
sounds good; they made a lot of changes recently, and I guess this is a regression
Wait it's not Learn.
I just checked the new version of the exported file. It's huge.
Eagle is doing something
This is how big it should be.
seems like a bug... do you recognize that resolution number as typical?
what version of eagle are you using?
I 'll try it too. I wonder if it's peculiar to the board or to the eagle version
@tulip sleet https://learn.adafruit.com/assets/97223 I decreased it in Photoshop.
9.6.2 Eagle @tulip sleet
That resolution is pretty typical I think.
I only ever change the resolution
i tried the same thing in Linux Eagle 9.6.2, same size, and the resulting image is the right size.
is this on Mac?
Yeah
did you update to Big Sur yet?
Absolutely not.
my only Mac is Big Sur; I only use it for BLE testing
yeah, I guess, try reinstalling. I wonder if the resolution is being confused by the "hi-dpi" stuff on Mac
but why would it show up now?
Hi, ย I'm experiencing a bug in Eagle that i'm not able to fix. When i export a PNG image of the board (monochrome, 1000 dpi) the dimension of the exported png are doubled. if i measure the size from eagle and then from an image editor software (illustrator, gimp, photoshop) the dimension are always...
I haven't the slightest. Wondering if it's been happening and I haven't noticed.
was reported ages ago
did you do the export while using the laptop screen only, as opposed to desktop monitor, or vice versa?
I think it might depend on the resolution of the screen
Desktop monitor, but I always have displays connected and use them as my main screen.
so for hi-DPI screen, it gets it wrong??
anyway, photoshop to the rescue, but now you'll have to check in the future
Yeah. Trying a fresh install now.
Same thing.
And I deeply uninstalled it with an app that clears everything.
True on hi-dpi screen on windows too https://forums.autodesk.com/t5/eagle-forum/bug-export-image-produces-wrong-resolution-when-windows-10/td-p/8215012
I am using Windows 10 on a high resolution laptop (Dell XPS 13). The Windows "Make everything bigger" setting is set to the default of 300%. (If this option is turned off - ie: set to 100% - everything in eagle is microscopic). When I choose Export Image, it shows me the correct image dimensions in ...
I don't have it scaled though
It's using the default resolution afaik
Just checked another one, and it's also huge.
So I have no idea how long that's been going on.
Sigh.
Laptop display isn't even scaled.
None of the connected displays are scaled.
Folks are still reporting it. Well bugger.
@hathach could you take a quick peek at this? I've been trying different ways to get USB to connect to my F103 board, but so far I've had no luck. My current version is just lifting the clock, pin and IRQ settings from the F103 BSP in TinyUSB but it's still not working. Backtrace shows it seems to be stuck checking return tud_cdc_n_get_line_state(0); and return _cdcd_itf[itf].line_state;
@onyx hinge I do not understand why your gcc10 PR is failing. The download filename looks correct.
might be worth turning off the progress messages, which just make the log huge
@gilded cradle Setting brightness of the NeoPixels LEDs using MagTag library is not working.
Or maybe I'm trying to do it wrong.
I hadn't tried it. How are you doing it?
I tried two ways. One I have pixels = magtag.peripherals.neopixels and I did pixels.brightness = 0.2, and I tried doing magtag.peripherals.neopixels.brightness = 0.2 as well in case saving it to a variable broke something, neither works.
Using pixels as the pixel object works everywhere else.
so pixels.brightness should work.
What if you did something like magtag.peripherals.neopixels[0].brightness = 0.2?
tuple object cannot assign attribute brightness
console error.
AttributeError: 'tuple' object cannot assign attribute 'brightness'
Ah, ok. I'm not 100% sure brightness is implemented on the esp32-s2. Do you know if you can adjust it without using the library?
I can adjust it on the external strip. Let me try with the onboard.
ok
Raw CP using neopixel allows setting the brightness, though oddly, setting it to 0 makes them max brightness. But setting them to 0.1 for example, makes them dim.
@gilded cradle ^
Hmm, ok. That's good to know. Can you open an issue on the magtag library? I'm wondering if the 0 for max brightness is a bug that should be opened for circuitpython as well.
@gilded cradle Probably.
@tulip sleet Setting the NeoPixels on MagTag to brightness = 0 makes them max brightness. CP problem or NeoPixel problem?
I'm guessing CP problem, though now that you mention it, it could be a lib problem.
I kind of doubt it's NeoPixel, but maybe.
๐คท would have to explore, but try same thing on, say, a PyBadge
Good idea @tulip sleet
any ideas on this behavior?
https://forums.adafruit.com/viewtopic.php?f=59&t=171983#p840155
@idle owl didn't you run into something similar to what @tidal kiln mentioned?
Not that I'm aware of? Or am I forgetting something?
Ok, maybe I'm just remembering you had an issue with a long running script
@tidal kiln maybe @tulip sleet has some ideas?
i have not seen this before, but it could be blocked on output, that's possible. I haven't seen that behavior on other boards. If I put the host to sleep and then wake it up, I see skipped counts (I was doing doing a 5 or 10 second sleep in that example.)
@tulip sleet Huh. I can set brightness on an external strip to 0 and it turns it off. Set it on a PyBadge or MagTag onboard NeoPixels using board.NEOPIXEL, and it makes them max brightness.
Let me try it using 6.0.0 on the PyBadge.
is it reproducing the desired color at the wrong brightness, or is it messed up?
Color is same. But let me try something other than red.
I wonder if it is esp32-s2 specific
Oh, ok. So looks like a non-processor specific bug. Is that something that could be fixed in the library?
Both using same neopixel lib.
I have no idea.
@tulip sleet 0 makes them max brightness, 0.0 makes them off.
It could be that 0.0 is really like 0.000000000001
So it sounds like something that should be fixed in cp
@tulip sleet CPX is same behavior.
check somethign without _pypixelbuf, like trinket
i mean attach a strip
maybe qt py?
QT Py is a NeoPixel
yeah
@tulip sleet QT Py works properly. brightness = 0 turns off the LED.
Which narrows it to _pypixelbuf ?
Because QT Py required adafruit_pypixelbuf lib.
@tulip sleet rookie mistake
sudo tar -C /usr --strip-components=1 -xaf โgcc-arm-none-eabi-10-2020-q2-preview-x86_64-linux.tar.bz2โ
@idle owl go ahead and file an issue; I don't see an obvious issue in th _pixelbuf code
@tulip sleet Ok will do.
Tested on MagTag, PyBadge, CPX and QT Py. The issue is not present on QT Py which requires adafruit_pypixelbuf. It is present on all other boards, which may narrow it down to an issue in _pixelbuf.
Used simple code that uses board.NEOPIXEL to turn the pixels red, and then tested brightness:
-
Setting
brightness = 0makes the on-board NeoPixels max brightness. They are the appropriate color when this occurs (as in they are not getting incorrect color info). -
Setting `brightn...
@gilded cradle Limor's suggestion on the MagTag lib works, though I don't understand it. I closed the brightness issue on the MagTag library.
Ok, thanks for the update @idle owl
@tulip sleet I'm around if you want to chat
@slender iron on the phone but will ping you later - tnx
k, lets pick a time after you are off the phone. I've got a couple more things to do this afternoon
just got off! wasn't sure how long it would be
๐
hey @slender iron would you be able to review my pidcodes PR? this one specifically: https://github.com/pidcodes/pidcodes.github.com/pull/586
LGTM, though I'm unable to test it.
I think this is specific enough that as long as it's working for you, we can move forward with it without needing a second test check.
Looks like this is a consequence of using the blocking I2C Master Mode. We'll need to replace it with the interrupt mode for repeated starts:
<img width="687" alt="Screen Shot 2020-11-24 at 3 06 50 PM" src="https://user-images.githubusercontent.com/5904176/100145797-daf58f00-2e66-11eb-97ac-56859209e917.png">
Actually, looks like I misread - the reset problem will cause conflicts pins that have been released, but it shouldn't allow pins in the claimed array to be claimed again. This could be an issue with the bit shifting in the pin claiming system.
@slender iron tackling this pin claiming thing on the ESP32-S2, and then my immediate docket is free. What would you like me to focus on next, bugfixes, server or i.MX?
Just a heads up -- not ready for an issue yet -- I updated my Mac to "Big Sur" and now my esp32s2 builds are failing -- I don't have time to dig into it today, but if anyone else has upgraded, let me know if you are also having issues.
Linux builds are fine...
I could try but I was about to upgrade today and now you're giving me cold feet ๐ฌ
Confirm jerryns bug... or keep my productivity for the rest of the week?
i have an upgraded mac but usually dont build there. lol
@solar whale, there is one known issue with the IDF on Big Sur and then an ask for the Apple Silicon to be supported. Maybe the known issue is the same failure you saw?
https://github.com/espressif/esp-idf/issues?q=is%3Aissue+is%3Aopen+Big+Sur
Actually that is specific to using monitor in the idf.
yes -- and I see the same error messages
I think there is also an issue with Big Sur and Silabs support. Not that it is needed unless your serial port adapter is using one.
@supple gale yes -- no SiLabs driver yet. But the board does show up as @crimson ferry discovered so I was trying to build so I could flash it.
@gilded cradle Would you suggest any other libraries for the MagTag other than the following: adafruit_magtag adafruit_bitmap_font adafruit_display_text adafruit_io adafruit_requests.mpy neopixel.mpy simpleio.mpy
Let me check what I'm using...
I had bus_device for some reason, but it appears to be working without it.
Fair enough. Thanks for checking.
np
I've only used the neopixels and buttons from MagTag lib so I have no idea if I missed some other lib needed.
Thanks!
I had the il0373 before, but that shouldn't be required with the newer versions of CP. In fact, I'm removing it soon.
@gilded cradle Actually, I have a favor to ask. I'm doing a libraries page in the MagTag guide like you did in the Matrix Portal guide, but I have no idea why most of those libraries are necessary. If I fill in everything else, can you write up the quick blurbs that explain why each lib is needed?
Sure. I think I copied/pasted from the PyPortal guide that you did for that. ๐
Hah! I don't know if I did that one either though. Because I don't remember doing a page like that, nor do I have any idea what went into the PyPortal library. ๐
@gilded cradle https://learn.adafruit.com/admin/guides/3176/editor/20938
Accounts
You can copy text from the matrixportal guide for requests and io and text stuff. For simpleio, it's used for the tone generation.
Ok doing that now
Awesome
@gilded cradle Are you eventually doing a guide for the MagTag library? Because I did not find the bits I needed very intuitive and had to do a lot of trial and error to get things working.
Also wondering if calling the buttons A-D is the best idea since we labeled them with arrows on the silk.
I was planning on doing a creating projects guide like I did for MatrixPortal
Ah fair enough
Plus A-D won't make sense if the board is rotated or upside down which I think we added support to do.
Hmm.
Though up down left right won't match either!
Hey, here's a terrible idea, use up/down/left/right and have it detect the board orientation and change the button names based on orientation. ๐
@ionic elk if you are comfortable with tcp server you could do that. or imx is good. there is some progress on the metro
@idle owl, it's not really a terrible idea. Possibly a bit hard to implement, but it might be useful for updating display orientation and such.
Anything specifically on the IMX, or just get in there and root around for unfinished stuff
@gilded cradle I mean the whole reason we went with arrows was because we intended to make the board rotatable.
So it's not totally off base.
Ah, I went with A, B, C, D because that's what they were named on board.*
Named on the board... like schematic-wise?
Oh
board.
I read that wrong
I'm tracking now
๐
I mean I guess we had to call them something. Silly they ended up that way though, imo, since we went to all the effort to do the arrows.
We can make more properties and call them up down whatever
Fair enough!
@microDev1 can you point out specific modules where you have also had this problem? Turns out this was just that the SPI module didn't have pin claiming in it. The other Busio modules have it, as does DigitalIO and AnalogIO, but if you've encountered it elsewhere I can fold a fix into my PR.
Resolves #3715. Tested on a Saola Wrover.
I somehow missed this. Verified both work.
Would like to request a PID for an incoming Feather board :+1:
Thanks!
gcc10 giveth and taketh away... Build aloriumtech_evo_m51 for nl took 38.73s and failed make: Entering directory '/home/runner/work/circuitpython/circuitpython/ports/atmel-samd' Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity. /usr/bin/../lib/gcc/arm-none-eabi/10.1.1/../../../../arm-none-eabi/bin/ld: build-aloriumtech_evo_m51/firmware.elf section `.text' will not fit in region `FLASH_FIRMWARE' /usr/bin/../lib/gcc/arm-none-eabi/10.1.1/../../../../arm-none-eabi/bin/ld: region `FLASH_FIRMWARE' overflowed by 18984 bytes
@onyx hinge didn't you try gcc10 a month or two ago?
@slender iron who remembers the past ...?
let me try to build that here locally
we did make some changes "for gcc10 compat"
While this PR originally switched to gcc10, it wasn't working out right now https://github.com/adafruit/circuitpython/pull/3231
right, and early versions of the branch actually had gcc10 I think
yup, it overflows here by 7272 bytes
it's -O2
so we can -Os it
haha, ok. I was hoping you were joking
Are you sure this resets the IOMUX too? Also, you need to make sure the idf isn't changed.
Looks good! Thank you!
@jepler Yup! That's ok with me. Want to turn it off everywhere or for all SAMD21s at least?
@onyx hinge thank you for all of the byte-finding
@slender iron sure thing
@hierophect There is a translation conflict still.
Please let us know what value works for you.
What is the issue? That UART output looks ok.
Ah, true! I think the alternative to that would be to provide the full json string yourself. That's what most uses already do.
It works with 5.3.1 on both right?
@slender iron OK I changed that patch so it's disabled on all samd21 builds, hopefully it'll come through CI okay
๐
The REPL pins are USB pins. The drive wouldn't work if USB was broken.
Correct, I don't seem to have any issues with 5.3.x. I have tried 5.3.x with both the Feather NRF52840 Express and the Itsybitsy NRF52840 Express without problems. When I tried the example code with 6.0.0 it seemed to fail and not advertise, whereas with 5.3.1 I can immediately see "Circuitpython HID" appear in the device list of a host device. I haven't yet stepped through line by line to see if it fails anywhere.
Here you go:
Solder Party (arturo182) Feather ESP32-S2 TFT,bootloader,0x239A,0x00E7
Solder Party (arturo182) Feather ESP32-S2 TFT,arduino,0x239A,0x80E7
Solder Party (arturo182) Feather ESP32-S2 TFT,circuitpython,0x239A,0x80E8
I'm not sure what the easiest way to step through is, if there's a way to feed it through the REPL line by line easily.
thanks @slender iron ๐
@arturo182 hihi since you've formed a company, when you can financially get a USB VID that is the best long term solution
somebody must have ninja'd me
Thanks @hierophect. I'll be ordering a production run soon. If you want one, let me know and I'll ship one off to you.
@slender iron I'm trying to find an example of us manually resetting the IOMUX in any of our implementations, and I don't see anything
the fastLED implementation doesn't touch it
is it gpio_iomux_in?
The ESP32-S2 IOMUX can be set back to digital function 0 which is the default.
How do you know this/what functions have you seen used to do it? I'm finding the IOMUX to be scant on both online and inline documentation.
I tested a build on my BIg Sur mac and the uf2 was generated correctly (Unexpectedmaker_feathers2)
I had to install everything from bare metal as i had done a clean install from USB. So install whatever tools needed, clone the repo, setup the idf and build. I didnt try esptool to flash as I'm doing some other things with the feathers2
Only issue was something with the fish shell and python . I will look at that at some point but building under bash worked fine.
Yes, same.
Wifi and I2C hangs (in my case on the 2nd CTRL-C
Leave either out it doesn't hang. Nothing is actually being done to the
wifi or i2c in my code besides the import and instantiate an i2c object. I
assume wifi is instantiated on import.
On Tue, 24 Nov 2020 at 07:27, Mark notifications@github.com wrote:
If I comment out the import wifi I cannot cause this to reproduce.
Before any reboots, if I uncomment out import wifi it will lock up the
next Ctrl-C.So it appear...
Now it includes bssid info.
cc @bennyE @astrobokonon
When a TLS connection is closed by the server it usually sends a
notice. We see this incoming byte with lwip_ioctl and try to read
it. The read returns 0 but we keep trying anyway. Now, we quit
trying when we get zero back. If the connection was still alive
it'd either read a byte or delay until a byte could be read.
Not sure what happened here but those were very broken :D
Update the frozen Adafruit_CircuitPython_Requests submodule, so we get the Session class that's needed by the ESP32-S2 wifi API.
At first I didn't understand what you were saying about "TLS internal" bytes, since I saw the call to esp_tls_get_bytes_avail, and that is documented as returning the number of application data bytes. But, there's also the call to lwp_ioctl which would return TLS internal bytes. What I'm wondering is, it seems that esp_tls_FOO calls handle the tls and non-tls cases. It makes me wonder why the lwip_ioctl is needed at all; I conjectured it was from pre-TLS-support days but that's not the case...
hmm - which boards have it frozen? it isnt a great library to freeze...there's been a lot of churn in the network libraries and probably will be more to come
oooh yeah that makes sense, ok!
@hierophect hihi, which board you are testing with ? the only f103 I have is bluepill. It did runs tinyusb stock example, so hopefully it is only setup issue.
@tulip sleet, @crimson ferry I am back with another problem as a result of the earlier help I was given. The error I see is Traceback (most recent call last): File "code.py", line 154, in <module> File "adafruit_hid/keyboard.py", line 100, in pressAttributeError: 'int' object has no attribute '_add_keycode_to_report'
I have more information if needed. My guess is that is the result of changes in the libraries since I developed the code a long time ago.
The libraries used by the code are:
import adafruit_trellism4
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode
These libraries are freshly loaded in the lib directory on the CIRCUITPY
Any thoughts about what is causing the error? Thanks
Code is in neotrellis.txt in https://github.com/chuckuntulis/neotrellism4-code
The README.md has a bit more information. Since this is my first attempt to communicate via GitHub, please let me know if you have any suggestions about content or protocol for using this tool.
@split ocean thanks for developing the Neotrellism4 code. I have used it for a long time and it has been very helpful for speeding up Emacs tasks and starting scripts. If you know of any HID library changes that may affect your original code, please let me know.
I was also planning to freeze it in my esp32-s2 feather.
Maybe there should be a manual or automated job that updates all the frozen libraries either periodically or before a release that way all the boards that freeze libraries will get the latest versions in the release?
Hi,
First off, thanks for an awesome library!
I have a string of 300 LEDs that I want to update in sync with music using a chase down the line effect, however, the "show" method is very slow and causes the system to fall behind when processing the music.
I'll share my example code that's running it. I'm currently using a C# application to send a 7 band spectrum from 0-100 for volume, then python is decoding that set of bytes into the proper numbers and when the data is completely rec...
@jepler I would love to test this but I don't have the proper audio hardware at the moment.
I'll post an update if I am able to hack something up to test this out. :)
I couldn't get into the python development environment.
I can't connect to the board with uPyCraft .
If "config->sta.bssid_set = true;" (or false) is being used, this will make the following line always go to else (or not?) :
Line 147:
if ((config->sta.bssid_set == 0) && (config->sta.channel == 0)) {
@forest badgeuntilis changing Keyboard() to Keyboard and the same for ConsumerControl is not what to do. That changes a creation (instantiation) of a Keyboard object into just a reference to the class. Instead you do:
import usb_hid
#...
kbd = Keyboard(usb_hid.devices)
See https://circuitpython.readthedocs.io/projects/hid/en/latest/ for an example.
Hi, this is not really a bug, so it's more appropriate to bring it up in https://forums.adafruit.com. Could you post there, with more details?
Are you running this on a microcontroller board or on an RPi or similar? I'm not sure, based on the network code. I don't see a main program here, either.
Depending on the board, there is a native implementation of some of NeoPixel in an internal module called _pixelbuf. On small boards such as Trinket, that code is not native, but is in Pyth...
@hierophect I am able to see this on basically all of the io modules.

Update... Pin claiming seems to work until IO7 after which pins aren't claimed properly.
@slender iron more considerations about switching from DurationAlarm to some kind of absolute time-based alarm:
-
time.monotonic()is universal (not based on presence of longints), unliketime.time()andtime.monotonic_ns(). So the most basic time alarm type is probablyMonotonicTimeAlarm. -
If we had more than one kind of time-based alarm, we wouldn't be able to tell them apart on wakeup: all we know is that we woke up due to a time-based sleep. So we can't construct an
alarm.wake_alarmwhose type is guaranteed to match the alarm type on the other side of reset, unless we stored state about the original object, which I am somewhat reluctant to do. That could argue for aWakeUpReasonrather than using an alarm object, because it collapses the different time alarms into a single thing. Or, we just say that we always create, say, aMonotonicTimeAlarmregardless of what kind of alarm was set (aDurationAlarm, aTimeAlarm, aStructTimeAlarm, etc.). ... I am a bit inclined toward the latter since it reduces the number of parallel classes.
Interesting to look at other API's: Java and Rust timers provide both absolute time and interval-from-now options.
@tulip sleet When I was playing with deep sleep for arduino you can use small bits of RTC memory could you store an alarm type in there to reference when you woke up?
Though guess you still don't know which alarm it was...
you can only set one time alarm at a time, so that's not such a big deal. mainly we want to distinguish between time alarms and pin alarms (there are also touch-based alarms on ESP32-S2)
Yes, we could use RTC memory for that, but it's a significant complication, and conceivably on some platforms we wouldn't have it, though I'm not sure there are any. I think returning an "equivalent" alarm is ok. For pin alarms, there's a bunch of parameters (which pin(s) (can be multiples), edge triggering, etc.
the time alarms are all implemented the same way at the lowest level. ESP32-S2 API just has sleep for a duration (though it's actually converted to an absolute timer-tick value internally !)
From a user point of view the set MonotonicTimeAlarm with helpers for other time types seems easy to understand and use from an API usage. At least from the projects I want deep sleep for. The two I use cases I have are a set wake up every minute (8:01 8:02 etc.) and the just sleep for 60 seconds elapsed.
Trying to mount an sd card or just a small test on bno055 as below both report: OSError: [Errno 5] Input/output error
code used:
import time
import board
import busio
import adafruit_bno055
Use these lines for I2C
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_bno055.BNO055_I2C(i2c)
User these lines for UART
uart = busio.UART(board.TX, board.RX)
sensor = adafruit_bno055.BNO055_UART(uart)
while True:
print("Temperature: {} degrees C".format(sen...
good; yes usually you would do something like MonotonicTimeAlarm (time.monotonic() + 60) to do 60 seconds from now. If you knew what time it was due to an external clock, then you could relate that to a time.monotonic() time and do something similar, if say you wanted to wake up next Tuesday, etc.
I originally implemented only a DurationAlarm(), e.g. DurationAlarm(60), but that's only relative time, and it's from the time you actually start sleeping, so it could be off by the lag between creation and sleep.
thanks for your comments! it's v helpful to have others consider their use cases
Welcome. Feel free to ping me if you need testing the PR when its ready. I have wanted CP deep sleep for a while now.
@tulip sleet bluez-firmware has been updated to 1.2-4+rpi6, but based on the changelog they haven't fixed the problem
@microDev1 found it, it was a variable size issue with in pin claiming mask operations.
@onyx hinge that's right, there's a fixed firmware still under test: https://github.com/RPi-Distro/bluez-firmware/issues/6
@gilded cradle Thanks for the review!
np
@onyx hinge โค๏ธ again for the workflow_dispatch trigger.
@slender iron Scott, if I told you that ulab has now complete numpy/scipy compatibility (i.e., code can be ported verbatim from CPython), would you still insist on sub-modules as defined in circuitpython?
I don't know off of the top of my head
@slender iron Should MiniMQTT also have a Session class like adafruit_requests does? I don't see why not..
I think you could have on absolute time alarm that has two exclusive kwargs. one for time vs epoch and one monotonic
@hathach I have an APMF103ZE, which is a clone of a larger F103.
At this point, though, I think it's time to just close this PR. I don't know from my testing whether the current issue is actually on our end or whether it's some issue with the knockoff, and I don't have a better board to recommend because there are essentially no F103 dev units meeting CPy's minimum size requirements outside of China. Most users will find that the F4 and F1 lines have almost identical costs at this stat ran...
Yes, because the goal of many small modules is to allow them to be enabled and disabled on a per-board basis. One monolithic module would lead to later errors later in execution when a function is attempted to be used. My understanding is that you can still create a wrapper library that imports all the pieces back together if you want numpy compatibility. Or you can have your cross compatible code import numpy multiple times under the individual module names.
Session is a name from normal requests. I don't think you need it if you already have an object for the connection. requests is weird because it has the top-level functions
@slender iron I asked since you commented that IOMUX needed to be reset to digital 0 - I'd like to know how you found that out. I've seen very little official information that discusses IOMUX, only some blogposts that note it's a bit like the STM32 altfunction system, underneath the GPIO mux.
@ionic elk have you looked in the technical reference manual?
Ok, that's what I had originally (MQTT constructor takes in a socket pool and ssl context as-is) - thank you for the guidance.
I looked in the define tables for how to set IOMUX, but I don't see anything that correlates to a "digital function 0"
what are define tables?
Just the big list of defines they use instead of an enum to plug into IOMUX Set In or whatever it is
ah, did you look in the datasheet for it?
The F103 issue I had was running TinyUSB with freertos, and the same issue was on CPY. It was fixed by making the USB interrupts lower (15 if I remember) than the RTOS interrupts.
My opinion is F103Cx is very attractive due to it's low cost, but that specific IC hasn't the flash for CPY, and when you go to higher boards...it's not so price effective.
I've got a board with L432CE, which Micropython already supports, so I think it'd be a good target chip...not due to price, but it's low-p...
I think it's in the DS actually
Thanks for the reference manual, I actually thought they were all online with their docs
Is there a framework in CircuitPython to support OTA updates ?
@analog bridge no but the partition layout has space for it
I was thinking of grabbing updates from the S3 bucket.
Helping with a connection issue on Discord ([#help-with-circuitpython message](#help-with-circuitpython message)), I was able to connect to an Apple Airport Express set u as "Create a Network" in bridge mode, with
FeatherS2 with ESP32S2
6.1.0-beta.1 on 2020-11-20
adafruit-circuitpython-bundle-6.x-mpy-20201120
@k0d I did try your fix (thanks again for trying it), and I didn't find that it made any impact, at least in my case. If you have an F103 board that is capable of running Circuitpython and would like to pick up this port, I'd be happy to reopen it - I just can't justify spending any more of my time on it. But as you said, the cost appeal of the F103 is mostly for the bluepill type C8 and CB, which are too small for Circuitpython. Once you get up into the R and Z series the price is essentiall...
@slender iron this would make a great into the the weeds topic. We can even setup update priority depending on release tags.
I'm assuming it'd be the python code to manage the update, not circuitpython internals
@slender iron I'm considering whether it'd be better to simply make our own version of gpio_reset that configures the pins how you'd like them - with better default pullup settings, etc
my approach with this is to have a module for it
added ota update topic to cpy meet notes
@ionic elk I think that's fine to have our own.
When circuit python runs into an error and decompresses the compressed error strings--is that handled on the board--and is that handled by the makeqstrdata.decompress function, or is there another program that handles it as well?
so happy it worked out
@ember iris it's done within circuitpython's internals. let me find it
and that is all done on the controller itself right?
yup
thank you!
np ๐
So if I add a new compression scheme, (lzw give or take) the code+codebook/dictionary+compressed translations would all have to be smaller than the current codebook+compressed translations right?
yup, that's the challenge
excellent, then I think I'm following this so far, I really appreciate it
we use it in all of our builds and a few of them are almost full
np! it's a fun challenge ๐
the history of that file can show you how it's evolved too
I didn't even think to look at that-that'll be super helpful!
๐
@ember iris of interest: https://github.com/adafruit/circuitpython/issues/531
@tulip sleet do you remember off the top of your head where the HID descriptors are defined in the code?
hmm, tools/hid_report_descriptors.py
tools/hid_report_descriptors.py. There are also some descriptors in a submodule, but we don't use those
thanks
tools/usb_descriptor/adafruit_usb_descriptor/hid.py are NOT used
that could probably be rationalized
Thank you! This is helping a lot with figuring out where to look and where a lot of this code is coming from!
I was just thinking about this early this morning. I was wondering whether we could compile each language's messages once and just stick them in flash at a fixed place. IN other words, assemble the translations post-compilation. But there'd have to be a table of message ids to offsets into the compressed string data. That might take extra space (or maybe we are doing that already, I don't know -- I was going to talk to @onyx hinge about it but haven't had time yet)
hmm, not a good idea because there'd be unused messages for any particular build that would take up space
is it normal that a small amount of heap memory is lost during each CTRL-C CTRL-D cycle?
This doesnt happen if i remove the import wifi
Its small, around 20 bytes
I think there is a pull request that fixes some of that in review
ahh, thanks
Another question, I have some debug printf in the common_hal_busio_i2c_deinit and the common_hal_busio_spi_deinit and never see these routines entered. Should they be?
esp32s2
the deinit routines are either called by user code or in some cases to deinit board.SPI() or a display SPI object
At first I didn't understand what you were saying about "TLS internal" bytes, since I saw the call to esp_tls_get_bytes_avail, and that is documented as returning the number of application data bytes. But, there's also the call to lwp_ioctl which would return TLS internal bytes. What I'm wondering is, it seems that esp_tls_FOO calls handle the tls and non-tls cases. It makes me wonder why the lwip_ioctl is needed at all; I conjectured it was from pre-TLS-support days but that's not the case...
@slender iron i am running into another dilemma re falling off the end of the program into deep sleep: in some cases it is deliberate, and you don't want the end processing to scribble on the screen stuff like "Code done running. Waiting for reload": you want the screen to stay pristine. But in other cases, you do want the (potentially naive) user to know, hey, yes, your program is done.
I am kind of inclined to say that an explicit deep sleep will leave the screen pristine. A fall-off-the-end will write status messages. You might think the difference is whether an alarm was set deliberately or not, but I can also imagine a simple program that, say, fetches and displays something, and then just finishes, expecting you to reset the board if you want it to run again, vs, say, getting a status message when the default hello-world program finishes.
So I'm thinking a fall-off-the-end would not normally be used deliberately. Limor was already confused by the example I gasve her of falling off the end
@supple gale usually a reset does a bulk reset
she expected an explicit call
fall-off-the-end going into deep sleep is simply a power-saving trick
my worry is that calling a function will be too similar to light sleep
we could have the screen update after only when an exception happens
the name of the function now is supervisor.exit_and_deep_sleep()
I like that name
but if it's a new user, the user likes to know when the program finishes, or whether it's just hanging, hence they want to see an "all done" -type message
looking at init.c in common_hal/board i see
// reset_board_busses() first because it may release pins from the never_reset state, so that
// reset_port() can reset them.
#if CIRCUITPY_BOARD
reset_board_busses();
#endif
reset_port();
reset_board();
reset_status_led();
}
Where reset_board_busses() is where the deint are called
or not even a new user, just a user debugging something that doesn't have sleep as part of its modus operandi
@tulip sleet so you are arguing for what?
@supple gale board busses only applies to board.I2C. not all I2C
ahh
that it's fine to deep sleep on program end, but we're not going to suggest it as a coding idiom, because it will print status messages
instead if you wnat to sleep and freeze what's on the screen , call exit_and_deep_sleep()
the last remaining q is if you set alarms but don't call exit_and_deep_sleep, whether the alarms actually take effect. (so there's deep sleep just to save battery, and there's programmatic deep sleep)
exit_and_deep_sleep() could take the list of alarms, instead of it being a separate call .RIght now it's a separate call so you can fall off the end and have the alarms take effect
right
I think that's all OK. it makes it clearer that something else will happen if you exit any other way like exceptions
thanks, I think it will be clearer, with less implicit semantics. I like the idea of deep-sleeping to save battery if we can even on error, but that's a separate thing.
yup, and we'll have more flexibility then too
one other thing: I like yoru idea of TImeAlarm taking different disjoint keyword args for say, duration/monotonic/struct_time, but then fetching them back is a bit problematic. I could have three properties, I guess, returning None for the ones that aren't right. Ideally maybe there'd be an abstract superclass, but that's painful in the native modules (I think - I can find no examples)
just normalize it to epoch time
that rounds to the nearest second, I guess that's ok
sleeping is not that accurate anyway
well, you can have a fraction of a second
time.time() is an integer, but only exists on longint builds
so I'm not sure we can have alarms on non-longint builds
the main thing is the reference point, epoch (1970) or monotonic (arbitrary)
I wouldn't have different kwargs for type
i thought you suggested that? TimeAlarm(monotonic_time=x) vs TimeAlarm(struct_time=...) vs TimeAlarm(time=x), so not that?
I think you could have on absolute time alarm that has two exclusive kwargs. one for time vs epoch and one monotonic
I suggested two options, not three
time and struct_time would be the same thing
you just check the argument type
you need two because you could have two seconds counts with different reference points
so just TimeAlarm(monotonic_time=x) and TimeAlarm(time=x)
and what would be the read-only property to get the value back?
time?
heh, right
I guess you could go the other way and only support monotonic relative time
RIght now I said this in the doc:
//| def set_deep_sleep_alarms(*alarms: Alarm) -> None:
//| """Set one or more alarms to wake up from a deep sleep.
//|
//| When awakened, the microcontroller will restart and run ``boot.py`` and ``code.py``
//| from the beginning.
//|
//| An alarm equivalent to the one that caused the wake-up is available as `alarm.wake_alarm`.
//| Its type and/or attributes may not correspond exactly to the original alarm.
//| For time-base alarms, currently, an `alarm.time.MonotonicTimeAlarm()` is created.
//|
//| If you call this routine more than once, only the last set of alarms given will be used.
//| """
//| ...
so you get back an "equivalent" alarm
ya, makes sense
ok good, I am not too far off the mark ๐
hey @slender iron I have a question about the 'haxpress' circuitpython builds
when you specify the SPI Flash device, does that mean you have to use that SPI flash or is it more for reference?
The SPI flash devices listed in mpconfigboard.mk are the only ones supported for that build.
we do that to save space; we don't support all possible
okay, so that makes sense
@slender iron @tulip sleet removing epaper display looks like it saves ~3.7kiB on feather_m0_express, going from 2196 bytes free to 5992 free bytes. So not a huge benefit, but there when we need it.
the reason we sometimes list more than one is for manufacturing flexibility
for haxpress we could probably list a few more flash chips (some boards have 2 or 3 listed), but what would the short list be?
I ask because the SPI Flash i use in my SPI Flash build is ~$1, but the adafruit preferred is like ~$0.58
I think each chip uses a few dozen words of flash
I only have the AT25DF081A listed
8Mb (1MB)
I'm just curious how it checks the SPI Flash and validates that you are actually using what is specified. I probably just need to look deeper
it gets the mfr ID fields back from the chip (JEDEC id) and vets them
@onyx hinge I wonder if we should split it out of displayio like we did the audio stuff
I assume you found an example of specifying multiple parts ```EXTERNAL_FLASH_DEVICE_COUNT = 3
EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
doing a code search locally (git grep) for EXTERNAL_FLASH_DEVICES will help find where the magic happens
@slender iron I considered that, or more properly speaking, I considered that you would suggest it. I can see doing it, but this first effort gives us a good idea of the code size savings either way.
pushed to a branch in my fork but I won't PR it
since it's often unimplemented
yup
so we would leave in gizmo, hallowing, and some feather display support built in?
there's an epaper gizmo, though
hmm
I think the circuitplayground displayio build has trimmed other things out though
it doesn't even have longints, i think
but if there's an epaper feather, then not sure how to choose which to omit
One thing I was curious if it's possible to make consistent is the i2c address argument in initializing i2c devices.
import board
i2c = board.I2C()
import displayio
import adafruit_displayio_ssd1306
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64)
sensor = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address=0x77)
for bmp280 it uses address where displayio uses device_address
I'm sure there are other instances. But I'm not sure it's worth filing an issue for a small nuance between libraries.
LGTM, no testing performed.
I'm not sure what the easiest way to step through is, if there's a way to feed it through the REPL line by line easily.
There isn't. If you have a JLink or similar debugger you can do it from the C side of CircuitPython. Let me know if you'd like guidance on how to dig into it.
We should have time to look into this once we get the S2 a bit more settled.
For folks following along. The best places to get details about the chip and the IOMUX are the datasheet and the technical reference.
Yes, the wifi subsystem is initialized on import. It's done here: https://github.com/adafruit/circuitpython/blob/main/ports/esp32s2/common-hal/wifi/__init__.c#L94-L134
@ornate breach I think it's too late to change it
I figured ๐
good to keep in mind for new apis though
yeah, I think it shows a nice progression and standard. Also, curious if there is any drivers written yet for the QT42 capacitive touch sensors yet?
I've got a accessory board I'm working on that uses one, but I don't want to reinvent the wheel if someone has done the footwork already
No harm in updating this. However, it is already out of date. We don't suggest freezing it in for that reason.
@tulip sleet Thanks again. That solved the problem
@ornate breach not that I know of. the place to check is the bundles
๐
I'll double check the bundles. It's my before work starts end of the year goal to get a driver written for it
I don't feel like it should be too hard
Thank you! This was added by a person new to C.
I don't know anything about uPyCraft. If it is running successfully, you should see a drive appear. You can build a debug version of CircuitPython and see what UART logging you get with that.
If "config->sta.bssid_set = true;" (or false) is being used, this will make the following line always go to else (or not?) :
Line 147:
if ((config->sta.bssid_set == 0) && (config->sta.channel == 0)) {
bools are ints under the hood. So it works the same. https://en.wikipedia.org/wiki/C_data_types#stdbool.h
The single failure is a network error. Looks good.
@todbot Any update? Maybe we can close this.
Don't be so tough on yourself :stuck_out_tongue_winking_eye:
Hi @tannewt, I've not been able to reproduce this error on 6.1.0-beta.1 on Metro ESP32S2. So okay for this to be closed I guess. Thanks!
I did not fully follow the implementation of allocate_memory_node or supervisor_move_memory, but I feel I understand them at the high level anyway, and the high level is solid. If there are bugs we can shake them out.
Question: Are these no longer needed because supervisor allocated regions get normal GC?
Nice simplifications enabled by these changes, thanks!
@hierophect it looks like HAL_I2C_Mem_Read uses a uint16_t for the address to read, implying that it can only send one or two bytes before doing the repeat start and read. While this would be useful for most use cases, it would imply putting a limit on the size of the out/send buffer for write_then_readinto which would be a change to the API.
Off the top of my head I can't think of a case where I've needed to write more than 2 bytes to set up a read, so it would probably work for mos...
I resolved the merge conflicts locally, but three builds still don't fit without other changes. I may look at it further to see if I can find the necessary savings. @cwalther is there any part of this we can disable on flash-constrained builds, or is it all-or-nothing?
@tannewt let's say I have soldered the flash chip out. I want to execute from the sd card. Is this possible?
Guys. Do circuitpython libraries work on MicroPython?
I want to use CircuitPython neopixel library
I work on ESP32
Ping me if you answer
@supple gale @idle wharf FYI -- I was able to get things working on my Big Sur Macos system -- had to remove the ~/.espressif folder then reinstall the esp-idf... also using with bash. I was also able to flash the file to the umfeathers2 on /dev/tty.usbmodem01 --- no need for SiLabs driver anymore!
Also successfully built/flashed metro_esp32s2 and magtag.
Added more information about the board and updated the links for purchasing the board.
i would also request someone to update the seeduino_xiao.jpg in the assets, large directory to any one of the images available on Seeed's website or Google.
Thank you
Anyone know of any documentation or examples of creating custom services and characteristics for BLE with circuitpython?
You can compile a version that uses a part of the internal flash for the filesystem.
Assuming you want to act as a peripheral, you could take a look at the services in https://github.com/adafruit/Adafruit_CircuitPython_BLE_Adafruit. Unfortunately there is no Learn Guide for detailed use of the BLE library yet. A key thing to know is that the class variables assigned to instances of Characteristic and the like are characteristic specifications. The actual characteristic objects are created at run time.
This has been helpful
@hierophect yeah, the F1 flash & ram is typically too small to run circuitpython. I am sure it is only clock, pin set-up thing etc since I got my F103 bluepill running in the tinyusb repo. Therefore we could come back to this later on if needed.
As a probably obvious observation removing all the I2C hardware/software init and deint removes the crash as well. I was a bit bored yesterday so did that to confirm. Have a great safe Thanksgiving to those celebrating that. Here in Canada I went skiing :)
I confirm that I have seen the drive appearance, but only these contents are displayed in the terminal environment. I cannot enter the development environment starting with ">>>"
@tulip sleet is that deep_sleep code you are referencing above available for circuitpython on the magtag?
Trying to run this project
https://learn.adafruit.com/pyportal-iot-plant-monitor-with-aws-iot-and-circuitpython?view=all
In this code: esp32spi_simpletest.py
What pins should I use? The uncommented definitions are not defined.
code snippet:
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)
If you have an AirLift Shield:
esp32_cs = DigitalInOut(board.D10)
esp32_ready = DigitalInOut(board.D7)
es...
the next PR on circuitpython-org will be #600 ๐
@quartz wedge I am working on the sleep code right now. It will probalby be in the next beta.
awesome. Thanks!
in the docs language is there a way to specify multiple possible types for a param? and/or object types like BuiltInFont? i.e. in this param it can be either str or BuiltInFont:
:param str text_font: The path to your font file for your data text display.
@lone axle Union[type1, type2]
that is from type annoation, e.g.
def foo(x: Union[int, float]): ...
thank you!
THere is also Optional[type1] ,which means a type1 object or None.
Those pin definitions are not for ESP32-S2, they are for ESP32 when used as a wi-fi co-processor. You'll want code more like this for the ESP32-S2: https://learn.adafruit.com/adafruit-metro-esp32-s2/internet-connect
@tulip sleet didn't you point me at a Linux screen shot annotation program? I can't remember/find it now
ksnip -- it's actually multi-platform
it has attractive numbers in circles for multi-step directions
thank you!
@mpechner, @anecdata is correct. Please try his suggestion and if you have issues we can help with support in the adafruit forums: https://forums.adafruit.com
@onyx hinge if you are looking for more options ive been using and liking Flameshot on Linux.
it has resizable box with many editing and export options.
I use flameshot too, but it doesn't allow supplying an existing image to annotate
Ah I see
but it's the fastest to just pick up a screenshot
I also wish it had a way to copy the last thing again onto the clipboard.
ksnip has some extra annotations, like the red number here:
Initial working version of light sleep and deep sleep, after several API iterations. Started coding from https://github.com/tannewt/circuitpython/tree/sleepio/ .
alarm.time.TimeAlarmimplemented for both monotonic time and epoch time values.alarm.pin.PinAlarmobjects can be created, but cannot yet be used to sleep. (So not yet completely implemented.)- Three ways to wait for alarms:
alarm.wait_until_alarms(alarm1, ...): Wait for alarms without sleeping. Does not distur...
Has anybody seen a CircuitPython / DisplayIO port of the Tetris Animation to display Clock, number and even text? https://github.com/toblum/TetrisAnimation
nope, but it's an interesting idea ๐คจ
Yay, my broad was added to MU editor (or rather it was merged into their master) so it should be part of the next Mu release
initial testing with the UF2 you provided has been successful so far :)
I have eliminated the crash in my test code. I have to do a bit more dissection to verify which change actually fixed things.
ValueError: Layer must be a Group or TileGrid subclass.
# Main tab
main_tab = displayio.Group(max_size=3)
# Create button
graph_btn = Button(x=0, y=0, width=WIDTH/3, height=HEIGHT/6, style="RECT", fill_color=black, outline_color=0, label="Graph", label_font=font, label_color=white)
temperature_btn = Button(x=WIDTH/2, y=0, width=WIDTH/3, height=HEIGHT/6, style="RECT", fill_color=black, outline_color=0, label="Temp", label_font=font, label_color=white)
# Button group
button_group = displayio.Group(max_size=3)
button_group.append(graph_btn)
button_group.append(temperature_btn)
main_tab.append(button_group)
What am I missing?
hard to say, which line is the error at?
line 73 so quite a bit of stuff before this
which one is it in what you pasted?
5
so graph_btn = Button(x=0, y=0, width=WIDTH/3, height=HEIGHT/6, style="RECT", fill_color=black, outline_color=0, label="Graph", label_font=font, label_color=white)
sorry, I can't really tell what happened here with the information you provided
no worries, im new to circuitpython so im most likely doing something very wrong
my guess is that some global or attribute gets set to something wrong somewhere earlier
?serverinfo
@onyx hinge I need to make space for additions for sleep on the M0 boards. Turning off complex arithmetic nets almost 1700 bytes. I'm thinking this will affect fewer people than disabling native _pixelbuf.
I think that's most likely
Let's try to get the movable heap stuff in right after that if we can
.. do you know how much you need for sleep?
i'll look
bbbiab
@onyx hinge de_DE is overflowing metro m0 by 672 bytes
sleep is not actually enabled on the M0 boards; it's just some new stuff in microcontroller and supervisor that tell you why you were running and why you were reset. Eventually we'd want sleep even on these boards, maybe.
Did you see that gcc 10 actually got back 1-2k bytes on a build? or were the results weird?
Some builds got way over full with gcc10, I didn't look at the m0 boards though.
i have it downloaded; i could try some by hand.
gcc10 saved 732 bytes on de_DE on metro m0, bringing it to 60 free bytes (on my sleep tree)
@tulip sleet is there someplace I can easily grab the UF2 for your sleep mode PR? Wanted to try it out and never grabbed a different persons build before (or else I'll figure out how to grab the PR and just build it)
I have to get a clean PR build to have the artifacts show up. Hold on and I'll drop a uf2 here. Do you want MagTag? And do you want uf2 or bin?
I have the feathers2 set up but if you have MagTag ready the bin works, don't think i've got the UF2 loader on it yet
Awesome thanks! (I should still figure out how github works to pull/build PRs)
I'll play around with the feather and post in the PR for sure what I find
Here is a sample program. The key lines for sleeping are the two at the end.
Do read the documentation in ``shared-bindings/alarm/init.cand inalarm/time/TimeAlarm.c` because there are various tricky things to know
Will do thanks. I did read the esp32s2 docs when I was trying it on Arduino earlier too
The driver for the ssd1327 does not appear on pypi.
Driver: https://github.com/adafruit/Adafruit_CircuitPython_SSD1327
The search page: https://pypi.org/search/?q=ssd1327
After talking to @dhalbert on Discord, he plans to disable complex arithmetic to get space for deep sleep. This may leave enough space to let us incorporate this pull request too.
Tested with the FeatherS2 and been working great. One quirk, not sure if it is intended. My program connects to wifi, waits a few seconds and sleeps. If I start the program with USB connected, and then remove the USB the code never detects the removal and wifi is active during deep sleep (I'd assume actually in wait_until_alarm). May just be an item to document.
Tested with the FeatherS2 and been working great. One quirk, not sure if it is intended. My program connects to wifi, waits a few seconds and sleeps. If I start the program with USB connected, and then remove the USB the code never detects the removal and wifi is active during deep sleep (I'd assume actually in
wait_until_alarm). May just be an item to document.
The non-detection of USB being removed is a known issue, and might be fixed by https://github.com/hathach/tinyusb/pull/563. I...
I was helping someone with a PyPortal-using-BLE issue, and it turns out the ESP TX/RX pins on a few Airlift-style boards are labeled only RX and TX, even though they are only connected to the ESP32.
This PR adds ESP_TX and ESP_RX names to the existing TX and RX pins, which is upward compatible.
However, I think that it would actually be better to remove the TX and RX names and also board.UART(), since these are not externally available pins.
If you agree, let me k...
It looks like this is being caused by PR #86 to the adafruit/Adafruit_CircuitPython_CircuitPlayground library . By adding a property of "_unsupported" to the Express class, which raises a NotImplementedError when accessed, it causes any process (like 'dir(cp)) which accesses that property to stacktrace. I guess the question is whether it is more valuable to have a good message when someone tries to access a non-existent feature or to have commands like dir() work.
Thanks for the notice, I havenโt been on Discord for a few days.
Iโm working on the code size, but with no great gains yet. I have one optimization that recovers 64 bytes, but not enough for the metro_m0_express. Will push that shortly, also fixing the conflicts.
I did not fully follow the implementation of allocate_memory_node or supervisor_move_memory, but I feel I understand them at the high level anyway, and the high level is solid.
Thanks for the review. For that matter, I thi...
Correct (unless there are bugs). As long as they live on the GC heap, they are covered by the linked list starting from MP_STATE_VM(first_embedded_allocation). Once they are moved off it, they donโt need it anymore.
That was the goalโฆ although it didnโt end up saving all that much space on the whole.
@brentru - please take a look at your convenience!
Just so it isnโt forgotten, since I canโt seem to reopen #3702:
I believe the fix proposed there is wrong: It prevents printing an exception twice, which I do in #3696 (once to measure the length of the traceback, once to get the text) and which people may want to do for other reasons, itโs available from Python via sys.print_exception(). (For some reason, it also causes the terminalio screen to be drawn over the stage screen, havenโt investigated that yet.)
The problem observed i...
Is the CPython behaviour specified somewhere?
Good question. As far as I can find, only by absence: https://docs.python.org/3/reference/datamodel.html#traceback-objects says how traceback objects are added, but there is nothing that says that any previously accumulated traceback would be cleared when an exception is raised outside of an except block.
I got my MagTag to crash when I fed it some BMP files. Half of them gave back an unsupported format error message, but half of them rebooted the MagTag. Should I create an issue for this, and in that case in what repo?
displayio seems like the relevant place which is in the main CP repo. That's where I'd go
A scary amount of C code in this area, so does seem like the kind of thing that would shoot you on a bad day
Does anyone know if there are any plans for a circuitpython/feather NFC board?
Based on https://www.adafruit.com/product/364 it looks like there's some footprint issues for the antenna
Well, the antenna could be larger than the feather board itself, but that's also just one antenna pictured, there are many kinds/sizes I would imagine.
OK, so I guess I'm sticking with "no" as my answer.
Yeah, it was a long shot
There may be better information from someone else, so don't lose hope
@dhalbert 563 only detect suspend and wakeup. Disconnection is not detected on esp32s2 as it is with stm32 https://github.com/hathach/tinyusb/issues/564 . It probably needs extra test and code to detect this
there is this little stemma breakout NFC device, perhaps it could fit on a feather or similar form factor. Not sure if there are plans in the works to make that sort of all in one device though.
is there any place other than here that the builtins are documented? https://circuitpython.readthedocs.io/en/6.0.x/docs/library/builtins.html I noticed that list.insert() is not on this page, but is possible to use.
@lone axle I don't know whether there's a circuitpython lib for that stemma NFC device though
ah. very good point. I hadn't noticed that.
I just grabbed a few of them in a recent order. Maybe I can cobble together a working diver library.
rise to the challenge
@lone axle youโve given me an idea
Iโm gonna make some kind of RFID microcontroller board for IoT projects
๐
Nice!
I did not fully follow the implementation of allocate_memory_node or supervisor_move_memory, but I feel I understand them at the high level anyway, and the high level is solid. If there are bugs we can shake them out.
I'm using Adafruit CircuitPython 6.1.0-beta.1 on 2020-11-20; MagTag with ESP32S2
the adafruit-circuitpython-bundle-6.x-mpy-20201126 library on a MagTag.
I'm getting intermittent crashes when connecting to wifi. For most of the day yesterday it happened once in a while and if I re-saved in Mu, the connection would work on the second try. Then last night it would not stop crashing and I gave up and went to bed. This morning I'm trying to write the bug report and now it won't crash at all. M...
?serverinfo
sooo close to 26K
Building this branch merged together with #3767, BOARD=metro_m0_express TRANSLATION=de_DE has 744 bytes free.
This is good to go except that we need 3767 to go in first so we have the flash space.
One minor thing. Overall it looks like a huge improvement. Thank you! I restarted the CI hoping to see how well it fits.
I'd also like @jepler to take a look. He did a number of the displayio uses.
Cherry-picked in #3767 for use in #3695.
I did a quick survey of the libraries and learn and did not find any uses of complex literals like '1j'.
I belatedly checked and each build that freezes in Adafruit_CircuitPython_NeoPixel builds in _pixelbuf, according to the support matrix.
pirkey_m0 freezes DotStar but does NOT have _pixelbuf. Other DotStar-freezing builds have _pixelbuf. Does this mean that pirkey_m0 should remove DotStar? I doubt it can add _pixelbuf, but I could be wrong. @tannewt mind filing a PR that calls for the right thing to be done?
My mistake, the line to freeze dotstar into pirkey_m0 is commented out, so no action is needed. My over-eager grep found it and I didn't look carefully.
PR #3773 breaks out the space savings from #3767, so if it's merged this build should be OK.
@lone axle this will be fun ```PS C:\Users\bcr00\Source\bcr\blinka-cli> python .\blinka.py --verbose font --fontpath C:\Windows\Fonts\arial.ttf --fontsize 24
๐ค options = Namespace(verbose=True, locale='en_US', command='font', fontpath='C:\Windows\Fonts\arial.ttf', fontsize=24, func=<function do_font at 0x00000125EFA21280>, tempdir='C:\Users\bcr00\AppData\Local\Temp\tmpnimjj5ku')
๐ค Making a font from C:\Windows\Fonts\arial.ttf 24
๐ค Here is a letter e
**
**
*****```
NotImplementedError: unicode name escapes
``` aww. What, we don't want to cart around a megabyte of Unicode metadata?
This raise a question about unused or never released board...
pIRkey was never released by @ladyada as a product, maybe just in a Top Secret with a few prototype.
This could be the story for PyGamer Advance.
Those are ghost board visible on https://circuitpython.org/downloads
If those start to make problem, it is a bit sad.
Hey there! I am submitting the CP Sapling M0 for the CircuitPython.org site. I believe everything is in order. (There was some weird modes created for images with .iCloud extensions which I think I just need to click the download button in my computer file system if this is an issue for merging)
Let me know if I need to change anything else :)
I downloaded the images locally since iCloud cached them earlier. Re-committed and that made it so the only changes are the files I added for the CP Sapling. Should be good to go now.
@dhalbert @ladyada
However, I think that it would actually be better to remove the TX and RX names and also board.UART(), since these are not externally available pins.
Agreed! I'm ok with renaming the internally connected pins to ESP_ as well.
One or two Guides would have to be updated as well.
Which guides are effected by this change?
@tulip sleet is it true that I could hypothetically read the feather sense sensors from adafruit blinka's ble lib?
yes, the adafruit-circuitpython-ble-adafruit library is already written to make that easy
nice! I don't need to do it right this second, but I was going to refer to it in this guide as a possibility
https://blog.adafruit.com/2020/11/30/its-circuitpython-monday-use-code-adathx-for-20-off-circuitpython-and-15-off-the-rest-of-the-shop/
Your purchases support the further development of CircuitPython. Thanks!
๐๐ฎIt's CIRCUITPYTHON MONDAY at Adafruit! Use the code ADATHX to get 20% off CircuitPython boards and 15% off items storewide! ๐ฎ๐
The date_editted field doesn't do anything. Please remove for now.
Looks good - uart removed, new ESP_ pins are correctly labelled for esp control.
May also need to update MiniESPTool examples (https://github.com/adafruit/Adafruit_CircuitPython_miniesptool/blob/master/examples/miniesptool_simpletest.py)
This looks like it will not need revision because it will just pick up the new names, e.g.:
tx = getattr(board, "ESP_TX", board.TX)
rx = getattr(board, "ESP_RX", board.RX)
You're welcome @ornate breach. Good job on the PR.
Fixes #601. This also hides some unknown boards until we can get them added and adds a missing date_added date to the BLM badge.
Wait, there is a meeting today? Like in 45 minutes from now... I am NOT ready!
<@&356864093652516868> Hi all! Our weekly meeting will be in about 40-45 minutes from now. If you can, please add your notes to the document -- it's super helpful. https://docs.google.com/document/d/1ADivzRhU6vQCSee7Yj0RAtvy0B4hE6tAQ8hr_N8h6sw/edit?usp=sharing
CircuitPython Weekly for November 30, 2020 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 participa...
I updated https://learn.adafruit.com/adafruit-pyportal/pinouts#step-3020486, which mentions the pin names, and also the sample AirLift BLE program here: https://learn.adafruit.com/adafruit-airlift-breakout/circuitpython-ble#copy-and-adjust-the-example-program-3076274-17
II noticed sorting by date descending was working fine, so made some adjustments to the date ascending sort to just return the opposite of date descending rather than do a similar compare.
Lurking today, in the back of the room. Don't mind me, I'm here for the donuts and coffee. Put my status in the Notes Doc. ๐ฉ โ
Lurking
Howdy ๐
@gilded cradle I will be pinging you later for some help with the MagTag library because I have something I want to do and would like to avoid spending hours trying to figure out how when I'm betting you know how immediately. ๐
Lurking
lurking
Last call on neat stuff for tomorrow's newsletter
Sounds good @idle owl
hmmm whenever the newsletter falls on april 1 I think you should do an all pet-photos edition @turbid radish
I'll have to run that by PT, he's the punner-in-chief
@ionic elk you're not muted
@ionic elk your microphone is working ๐
@slender iron Are you running the meeting today?
ty sorry!
rock -paper-scissors
(not just for beginners)
๐๐ฎIt's CIRCUITPYTHON MONDAY at Adafruit! Use the code ADATHX to get 20% off CircuitPython boards and 15% off items storewide! ๐ฎ๐
20% off CircuitPython, 15% everything else (with some exceptions) ๐
Haha, beat me to it Jeff ๐ Thanks
^^ (added to notes at end of community news)
https://github.com/adafruit/circuitpython/pull/3767 https://blog.adafruit.com/2020/11/28/deep-sleep-support-coming-to-esp32-s2-circuitpython/
Initial working version of light sleep and deep sleep, after several API iterations. Started coding from https://github.com/tannewt/circuitpython/tree/sleepio/ .
alarm.time.TimeAlarm implemented ...
@anne_engineer Just finished testing with a custom NAU7802 FeatherWing. Developing a CircuitPython library for it was a worthwhile educational experience. https://t.co/FdBd1mtznC
https://twitter.com/mariocruz/status/1331423755361464320 https://forums.adafruit.com/viewtopic.php?f=60&t=172185&p=840476#p840476
I am working on a stock ticker with @adafruit #MatrixPortal. Possible Christmas gift idea in a beautiful wooden case. Thx to @dastels for some quick guidance on the forums https://t.co/Bnp8zBB5wq
https://github.com/adafruit/circuitpython-weekly-newsletter/tree/gh-pages/_drafts - submit a pull request. You may also tag @anne_engineer on Twitter, or email anneb AT adafruit.com
You can edit files directly on GitHub in any of your repositories using the file editor.
Thanks to other folks who comment on PRs as well -- is it time for you to "level up" and become a reviewer?
yup, I think that's why.
Late and Lurking
@prime flower How big of a server rack are you looking for?
Maybe a 6U.
"future (non binding)" hee hee
I'd check out StarTech on Amazon -- I've heard good things about them, and there might be sales going on from the holiday.
If you have friends in the datacenter industry, there are sometimes mini server racks that are used for shipment then typically discarded. Around a 10U, sometimes bolted to a pallet. Nothing that a socket set that can't handle.
Keep in mind the post holes -- some are square open holes, some are telco/audio gear threaded holes.
CircuitCron-py
Also, consider used from Craigslist/Facebook Marketplace/etc. It's usually a buyer's market. Server racks take up a lot of space, have a limited resale market, and folks want to get rid of them fast.
@modern wing Thanks for the advice, I'll keep the post holes in mind.. My friends who work in datacenters work for DoD/contractors which decommission instead of discard.
Mute buttons are ๐ฅ right now
Just from the mental image of Brent having his boards in a pile in his closet, which is the case for my desk, does anyone have good sorting solutions for dev boards in general?
@ionic elk fortunately my boards are very well organized and fully labelled
๐ฆ
https://www.adafruit.com/product/1149 I am a big fan of the double sided tote box and labelling them.
Sounds like a good MagTag project
I should pick some of those up
@ionic elk HakkoUSA has some wicked good clearance sales on AntiStatic bags (100 for ~$1.50). Them along with Sterlite containers from your local big box stores is my strategy.
And colored electrical tape + sharpie marker on the containers for labeling.
My boards are all generally pretty small (featherwing size) but I need rapid access to them since I use them so often
where do you get the boxes, amazon?
https://www.adafruit.com/product/2938 < and these for sensors, I have one for each "type" of sensor (humid, temp)
studybudy microbit app is interesting
An IoT Trivia app that shows you how to take a JSON web API such as the opentdb.com API and stream and display it on a FeatherS2 in an OLED display. - mytechnotalent/CircuitPython_IoT_Trivia
It turns out the boards are really hard to bork with static. I've been putting ESD foam in the bottom of containers, but I was told it's not necessary.
I didn't realize Adafruit had so many of these boxes, I should just pick up some from them
thanks!
portal library unification & substantial harmonization (PLUSH)
@idle owl Yeah, most of the boards we work with need a lot of effort to zap. But I've had antistatic prevention workflows hammered into me for work, so it feels....weird to not be wearing a strap or work on a mat.
@modern wing Yeah it's weird tossing a board into a plastic container. I still put the foam in with them.
Or had been. I have a bunch of new containers, but no new foam. So...
2 "Feather MIMXRT1011"
2 "SparkFun Qwiic Micro"```
These three seem to each have evil twins
we could (in theory anyway) add a check to the CI to make sure all these strings are distinct
Thanks! Have a great week!
Thanks!
Thanks
true story??
yes
wow ๐
@gilded cradle Ok... So I managed to get text displaying. And instead of trying to figure out how to align a background image, I changed the image so the core of it is on the right. However. Is there a way to have separate text elements of different sizes? I'm trying two add_text and set_text but it displays them sequentially, not at the same time.
@solar whale I have Yubikeys for everything, works on GitHub as well.
@gilded cradle e.g. I want a line that's scaled to 2 like a title of sorts, and then the rest of the lines are normal sized.
Right now, the only way to get separate lines is adding \n in my string. As far as I can tell.
@solar whale @idle owl There's a sale currently for Yubikeys direct from the manufacturer: https://slickdeals.net/f/14588965-yubico-black-friday-savings-any-2-yubikey-5-series-20-off-or-yubikey-security-nfc-50-off-at-13-50?src=SiteSearchV2Algo1
@idle owl I'm not quite sure what you're referring to when you say it displays them sequentially
@gilded cradle It displays the first line, then refreshes and displays the second line where the first one was. Even though I have it set to put the second line further down.
sequentially as in sequence in time. One after the other.
You have different text_position values?
Yes.
Could you send me your code so I can see what it looks like? I'm wondering if it's a bug.
Sure. Hold on.
In the library I mean
Right
@gilded cradle Current working code.
Comment out the image or I can send it to you for the code to run.
I'm going to try running the label code.
Right I figured. Simply reminding you there's a background image in the code.
Oh, You need to pass an index to the second set_text to tell it to update the right one
How does an index work?
I need to do some restructuring so you can pass initial text and that will make it easier.
Oh, first one is assigned 0 (default value), then 1, etc.
So you give the index as the second variable in set_text
So, pass a 1 in the second set_text
Ok trying that now
magtag.set_text("Button A: Holiday Color Cycle\nButton B: Sparkle"
"\nButton C: Comet\nButton D: LEDs off", 1)
Ok, cool
You're welcome. Sorry it wasn't so straightforward.
No worries, this is how APIs evolve.
yep ๐
@gilded cradle @idle owl How about if magtag.add_text returned the index, so you don't have to count:
TEXT_A = magtag.add_text(...)
magtag.set_text(..., TEXT_A)
@tulip sleet there's a PR in for that, but it just needs to be run through black
Here is the notes document for 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/1uYFVByF7eecqYPOPFCLeQt_Bx_3AAErUC_YBZUkLzjY/edit?usp=sharing
CircuitPython Weekly for December 7th, 2020 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 participa...
What's the process for library merges to get released?
I think any circuitpython librarian can create a new release
once that is done, it gets picked up by the bundle automatically
The time between merge and release can create issues. Would it be rude to release my own PRs, as long as they were reviewed and merged by someone else? I don't have any library role, but I'm also happy to be a reviewer... mostly test, not so much code review.
Someone from the core team could answer more definitively. But I don't think it would be rude at all. I do make releases for my own PRs after they are reviewed and merged by someone else.
@crimson ferry we can get you access to do it ๐
Thanks!
hrm, gotta ask about it first. turns out it costs a little money first
I don't want to cause any issues, just want to help wherever it's practical
np, ladyada is looking into it
hey quick question; is it possible to play a sound while I change led colors simultaneously?
right now I have to wait until the wav ends before turning leds on
Try connecting with putty. On the board I'm using currently the Saola M1 all i have to do is put in the com port I don't need to put in the baud rate or anything the board figures it out ymmv
@sleek swan are you referring to the MagTag or a different board?
@gilded cradle circuitplayground express
I dont see how I could this without threading
Ah, I seem to recall an example that could do this using generators. Let me see if I can find it.
amazing
I think somebody came up with it at PyCon last year
@sleek swan https://github.com/adafruit/PyCon2019/blob/master/Attendee_Examples/music_and_lights_using_generators.py
wow that's superb thank you @gilded cradle will try it out right away ๐
yw, poke around at other examples too
Overall this is looking good! A few comments and suggestions but nothing earth shattering.
Why is the requests library being updated?
I think there is something in wifi/__init__.c you'll want to call instead because there may be other cleanup needed (like closing open sockets.)
I think we should raise an exception here, like sys.exit does, instead of deep sleeping directly. That way the life cycle can be managed in main.
This is good to go except that we need 3767 to go in first so we have the flash space.
@onyx hinge isn't 3767 in?
That was me dismissing the comment with a push.
The last commit eliminates the goto and shortens the code by 4 bytes.
But do take a critical look at it if you want to merge right away, I may be too tired for such things right now. ๐
yeah I am feeling confused by the double pointer and the change from *emb = node->next; to emb = &((*emb)->next); .. it seems like one of them must have been wrong
or maybe I am misreading it altogether
The double pointer is so I donโt have to make a special case for the start of thee linked list. What youโre quoting is not a change from one to the other, they are different things.
I was starting to see that
The first removes a node from the list. The second advances through the list.
Or maybe read old and new code separately rather than reading the diff, the diff looks more confusing than it is.
that may well be true in this case
it was exactly because the two different operations changed order that I was confused
@gilded cradle Is there an easy way using the magtag library to clear the display? I need to photo the build for this project and I'd rather have an empty display for those images. Does calling refresh() with nothing else going on clear it?
Trying that.
Nothing happening, but that doesn't mean that's not what it's supposed to do. I'll comment out all the display code for now to get the images.
That worked. I'll uncomment everything when I'm ready for it.
Do I have anything to gain by preloading the font if I'm adding three lines of text at the beginning of my file, before the main loop, and it stays static? There's a preload_font property in the MagTag lib. Wondering if I should be using it. @lone axle You've done a bit with this lib, do you know?
I'm thinking I'm not going to gain much since it's rendered first and stays static. But I honestly have no idea how all of that works.
I am not 100% sure either tbh. I think you are right though the gain may not be much in that use case.
I think the effeciency boost shines more if you are changing the text a lot.
@idle owl it was pointed out this morning in the help-with channel that this guide page has an instance of the .mpy lib vs. module lib switched around. Im going to fix that in a moment. Just wanted to give someone heads up of the small change. https://learn.adafruit.com/adafruit-airlift-featherwing-esp32-wifi-co-processor-featherwing/circuitpython
@lone axle Perfect, thank you!!
I'm not sure how to help. It definitely sounds related to your network setup. Let me know if you'd like tips for debugging it. A start may be repeatedly scanning and seeing how often you don't see your ssid in the list.
@DavePutz What do you think?
@skieast Could you fill us in on where you are at? We'd like to get this fixed this week. Jeff or I can pick up where you left off if needed.
@idle owl did you get the display clearing figured out?
I think using set_background with a color value is the right way to do it.
This raise a question about unused or never released board...
pIRkey was never released by @ladyada as a product, maybe just in a Top Secret with a few prototype.
This could be the story for PyGamer Advance.Those are ghost board visible on https://circuitpython.org/downloads
If those start to make problem, it is a bit sad.
We'll remove them if they start breaking the build but no need to do any work before that.
The downloads page is sorted by download count so that w...
Looks good to me! Thank you!
@kahveciderin It is not possible with the current code. As deshipu points out, you could have a code.py on an internal filesystem to configure and run off the sd card.
Would you mind rebasing this? I'm a bit worried that the diff includes a lot of extra changes.
If you are uncomfortable with git, then I can do it for you.
This is superseded by #3767 I believe. (If not, I can reopen.)
I don't see the value in showing multiple exceptions for a single error. It gives the impression that more than one thing went wrong. i.e. I think CPython is probably not doing it correctly. I do understand, though, the value of #3696 to get a previous traceback. Would it be worth adding a parameter to mp_obj_print_exception() to indicate that we don't want to clear i.e. when calling supervisor.get_previous_traceback() ? That would involve changing the 15 or so places in the code where mp_obj...
@gregdavill I'm going to close this because I believe there are orangecrab and fomu conflicts still. Please either comment or make a new PR when ready.
We're closing this for now because getting the dev kit going requires understanding hyperflash config. We'll reopen when ready to work on it again or create a new PR.
I don't see any issues. What do you have left to do?
There was one question I asked Dan about an optimization, but otherwise as far as I am aware it is ready (minus the couple conflicts I now see which should be easy to fix).
@gilded cradle That makes more sense. I commented out all the code that did anything with the display except for the refresh before the loop, and it cleared it. I figured it was good enough for me to get images.
ok
Thanks for the reply and the suggestion!
That way we have one set we use for all of Adafruit's connected
devices.
It looks fine, but no idea how to test.
.. except for build failures anyway. doxygen needs to be directed away from the newly added md files?
- Remove BrokenPipeError and prefer to return the number of bytes
received. (May be zero.) - Add two minute backup timeout to reduce the chance we hang on
recv accidentally.
Why is the requests library being updated?
The requests library was updated in an upstream merge, but it appeared to me that the commit used was not the merge commit to the library, but the PR commit, which made it not be on the master branch for the library. This updates it to the PR commit.
Changed to RESET_REASON_UNKNOWN for all ports where it's not implemented. RESET_REASON_UNKNOWN came and went a couple of times; I meant to use it.
I changed this to call wifi_reset(), which calls esp_wifi_stop() indirectly. I don't see explicit closing of open sockets, though.
Originally I did do the equivalent of sys.exit(), but there was some issue about distinguishing that exception from normal exit. However, I can make a specific DeepSleep exception so that main knows what's going on. Is that what you had in mind?
ESP32-S2 light sleep is pretty deep in terms of power saving, but allows the program to resume from where it left off. That's why I included it here. But I agree the side effects are significant. I should document what you need to do to really do a light sleep. It looks like if common_hal_wifi_radio_get_enabled(wifi.radio) is what to check about whether wifi is active. Does that sound right to you?
You're right, these disappear. I was copying a similar style from elsewhere (I think microprocessor).
OK. Other chips have various idiosyncratic wakeup mechanisms.
nRF allows an OR'ing of pin DETECT signals (detect low or high). It also has a latch that detects whether the enabled pins were detected, though not necessarily simultaneously. So, e.g., it could wake up when you press buttons 1,2,3, but they don't have to be simultaneous.
SAMD51 has tamper-detect pins with debouncing.
STM is more confusing.
(see above).
I realized today that I need to make sure the filesystem caches are all flushed, etc., so doing it in main.c seems right.
Another possibility is to not have separate wait_until_alarms() and sleep_until_alarms(). Instead, we just have a isngle routine (we have to pick one of the names). If light sleep is possible because wifi is off, etc., then go ahead and do it. Otherwise just wait. There could be a property .light_sleep_possible that would tell you whether you were going to sleep or not, though I'm not sure what the program would do with that if it didn't like the answer.
I was wondering if we should even distinguish between light and deep sleep, because the routine names show what happens (you exit or you just wait). So whichever routine you call, it tries to sleep as deeply as possible, given the constraints of the semanatics for that routine.
@slender iron your speedup on .json fetching rocks! It was taking me about 1:40 to grab a reddit .json w 10 entries in it, now it takes about 20 seconds!
The esp32s2 brings WiFi support and with that the possibility to have a mechanism for OTA updates.
There are two domains for OTA update implementation:
- [ ] User Code Update
- [ ] CircuitPython Update
User Code Update
For this my plan is to expose the circuitpy drive as a network drive.
CircuitPython Update
The plan here is to have the user code handle firmware grabbing and for the flashing part I agree with what @tannewt suggests.
add an esp32s2 specific...
@skieast Could you fill us in on where you are at? We'd like to get this fixed this week. Jeff or I can pick up where you left off if needed.
I thought i was getting somewhere but didnt happen. So not at any state really. I had put it aside for the weekend but will take another look tomorrow.
The same problem occurs with another piece of nodemocu-32-s2.
@60999 Please try to connect with another terminal program, such as putty or Tera Term, as suggested by @dingramax.
I am confused about which board firmware you're using: you say you're using muselab_nanoesp32_s2, but your board is "nodemocu-32-s2", so they don't match. Is it "mocu" or "mcu"? Could you post a pointer to that board? It's possible the pin connections are different.
Naming possibilities:
- Combine
wait_until_alarms()andsleep_until_alarms()into one name or the other, or intotry_to_sleep_until_alarms()(orattempt_sleep_until_alarms()). - Drop the
deepinexit_and_deep_sleep_until_alarms(), and/or addtry_to
The q is whether to try to point out that these routines might not really sleep, or whether to use the word sleep as time.sleep() does, which may not really sleep.
@slender iron when you're up and available, let's talk about some sleep API naming. tnx
I did something without thinking it all the way through, and not sure how to recover. I created a code.py file which does "microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)" then "microcontroller.reset()" -- so now this device boots into bootloader, and when ciruitpython is updated via uploading a new UF2 image, it reboots, sees that code.py file, and reboots back to the bootloader mode.
Any ideas on how to erase the SPI flash filesystem from bootloader mode?
Try connecting with putty. On the board I'm using currently the Saola M1 all i have to do is put in the com port I don't need to put in the baud rate or anything the board figures it out ymmv
I used putty to get the same results.
Is the firmware incompatible? It's also an esp32-s2 chip.
@60999 Please try to connect with another terminal program, such as putty or Tera Term, as suggested by @dingramax.
I am confused about which board firmware you're using: you say you're using
muselab_nanoesp32_s2, but your board is "nodemocu-32-s2", so they don't match. Is it "mocu" or "mcu"? Could you post a pointer to that board? It's possible the pin connections are different.
I use esp32 S2 chip esp-12k development board: nodemocu-32-s2, burning Firmware of
muselab_ nanoe...
@zealous barn the uf2 bootloaders on atmel sam and nrf microcontrollers do not have the capability to interact with the SPI flash.
you could upload a first firmware which does this and returns to the uf2 bootloader, or if it's not important that all the content be erased then you can format the filesystem from within circuitpython.
@zealous barn If you r board is one of these, you can erase the File system by loading one of these .uf2 files https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#old-way-for-the-circuit-playground-express-feather-m0-express-and-metro-m0-express-2978458-27
Unfortunately, not one of those boards (it's my own Programmable USB Hub -- ironically, I'm working on a tool to make it easier for end-users to upgrade Circuitpython and my firmware).
How would I do that, I'm in a infinite loop of bootloader mode - I can't get to circuitpython
Maybe my best bet is to build a custom "erase" UF2
@zealous barn I have not done this in awhile but I think you can just modify this line to for it to recreate the Files system https://github.com/adafruit/circuitpython/blob/main/supervisor/shared/filesystem.c#L96
Thanks for the pointer! Change the call in main.c to "filesystem_init(safe_mode == NO_SAFE_MODE, true);" and I now have a erase UF2 for my board. Thanks so much!
Great!
I'm up now if you want to chat
@zealous barn you can also click reset when the status neopixel is yellow to enter safe mode
I tried that, but couldn't get the timing right (and my board doesn't have a neopixel to help with knowing when)
The custom erase UF2 was easy to create and does the trick
you could do an always safe mode version of circuitpython too
that way you wouldn't lose the filesystem
Would you suggest USER_SAFE_MODE, or some other flag?
Thanks
np
We won't be supporting the C3 because the USB device is a built in USB to UART and JTAG converter. It isn't a generic USB device peripheral. Sorry! Let Espressif know you'd like a full USB peripheral.
Now that we have DEEP SLEEP for CircuitPython, it means we get cute Blinka art with a sleepy snake ๐
@onyx hinge you looking at S2 I2C problems?
#3696 and #3454 could be helpful for user code updates. That way you don't need to overwrite the current, known good file.
Could we prevent the duplicate traceback in a different way? We could clear the traceback before computing it a second time.
I think it's fine as is. 4 bytes isn't worth it.
Thanks! I replied to that comment. I think it's ready to go once it's updated.
Thanks for the continued work on deep sleep api. ๐
I will start running tests on my microS2... will be monitoring the deep sleep current as well... I think we will have the least current consumption in timer alarms as every other type of alarm requires more RTC peripherals to be on.
Looking forward to adding Touch and ULP based alarms as well... :)
It looks fine, but no idea how to test.
@slender iron yeah I can give you an update after we finish cooking
kk, no rush. I can test your I2S PR
fyi micro bit v2s are in the store: https://www.adafruit.com/product/4781
@slender iron OK I'm around now
k, me too
What I think I've learned is, the micro is running but USB has failed or frozen. I believe that because I put a "show a rainbow on the neopixel" in my program, and I see it loop
huh, interesting. I just had an opposite freeze. cp stopped but usb responding
https://gist.github.com/3c1c89ec2e0c5a18f4f7550d4eb0c2dc is my test code, running on a kaluga
I made some changes that made it better, but not fixed, and not good changes...
.. in mp_hal_stdin_rx_chr I added +vTaskDelay(1); and the necessary headers
in the debugger I can't figure out how to step through the USB task to understand what it's doing at this time
you are more advanced with the debugger than I am
I'm trying to add a thing now that will spit out a backtrace whenever a ctrl-c is done over the usb serial
hm this is a different crash profile ... this one was due to writing code.py, and on the next reset I had a freshly formatted filesystem.
we've definitely seen that
kattni filed an issue for it
yielding when erasing flash sounds like a bad idea
since code is loaded from flash
I just had an event like this. Host is Linux. I had written out code.py and the last thing on the console was
Press any key to enter the REPL. Use CTRL-D to reload.soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 29
SyntaxError: invalid syntax
The full backtrace of all threads in gdb said this
Thread 7 (Thread 1073734432):
#0 0x400324cd in xQueu...
4096 is the size of the flash block in esp32s2?
it's the block size of external flash
oh of external flash of course
{
#ifdef CONFIG_SPI_FLASH_YIELD_DURING_ERASE
vTaskDelay(CONFIG_SPI_FLASH_ERASE_YIELD_TICKS);
#endif
}
``` From the function signature it looks like spi_flash_os_yield should be in IRAM? Is 0x4002b038 an address in IRAM?
I don't remember off the top of my head
looks like yes it is
starting at 0x4008_0000 is external, 0x4000_0000..0x4007_1fff are internal.
it must be, the function disassembles to a call to vTaskDelay
disabling it probably messes up usb when erasing
are any of the other tasks not in IRAM?
bool "Enables yield operation during flash erase"
default y
help
This allows to yield the CPUs between erase commands.
Prevents starvation of other tasks.
yeah several are
that could be the issue
including the main circuitpython thread which was executing (I was getting error flashes on the neopixel)
but maybe it was within a cache? who knows.
spi_flash_os_yeield is within usb_device_task so I think that USB can't continue operating until the write completes
I thought there was some code where the actual write was delayed a bit .. must not be?
that's what was confusing me
OK

