#circuitpython-dev
1 messages ยท Page 365 of 1
Who has a Neo Trinkey? Do all four pixels on it act as status LEDs? Like CPX etc?
Mine's not here yet.
I have one, but haven't tried
I'll find out soon enough, but figured I'd ask in case anyone's played with them yet.
Well, all 4 turn red when entering bootloader mode
Ok, that's a start. Can you make a CircuitPython error to see if they do error codes or not? I feel like no. CPX doesn't.
sure
Thanks!
@idle owl, just one lights up (the one by the word trinkey)
Ooh! Ok. Excellent.
np
@tulip sleet I think the issue may be if click 7 is already installed
the pip -r won't update for some reason
I downgraded to click 7.0 and then installed requirements-dev and it did upgrade, and that was with pip 20.0.2 hmm
ยฏ_(ใ)_/ยฏ
For the new Neo Trinkey - Hello, anyone has CircuitPython examples that can be edited for a head start? I just got a Neo Trinkey and don't know where to start. So far the only thing I figured out was to press the reset button 2 times really quick after plunging in to the PC, and changing to USB storage mode (all LEDs turn green). Apologies if was already answered, but I couldn't find any documentation so far.
Here's the CircuitPython download: https://circuitpython.org/board/neopixel_trinkey_m0/
just drag the .UF2 to the BOOT drive. Then connect to the REPL via Mu or screen or Tera Term or some other terminal program. You can try NeoPixel examples from the CPX or similar board
Ok, understood. Thank you very much
neopixel.mpy and adafruit_hid are already on the board, so you don't even need to load those librarires
import board,neopixel
np = neopixel.NeoPixel(board.NEOPIXEL, 4)
np[0] = (10,0,0) # turn the first neopixel red
You read my mind. About to ask how to enable a specific pixel. Appreciated!
enjoy!
Firmware
Adafruit CircuitPython 6.2 and earlier on 2021-04-07; Teensy 4.0/4.1
Code/REPL
"
import rtc
import time
r = rtc.RTC()
r.datetime = time.struct_time((2019, 5, 29, 15, 14, 15, 0, -1, -1))
"
Behavior
Traceback (most recent call last):
File "", line 1, in
TimeoutError: Clock stretch too long
Description
- Error while using i2c...
- Only happens when...
- might be related...
Thanks ๐
Iโd suggest the new library that @jposada202020 added to draw lines with arrows:
TTGO T8 ESP32-S2 ST7789 is missing the board.LCD_MISO - using CircuitPython 6.2.0
TTGO T8 ESP32-S2 ST7789 is missing the board.LCD-MISO definition
apparently it's because it doesn't have one
I have added in the meantime a dot ending. It is available now in the Adafruit Community Bundle.
Thanks, I finally found https://github.com/adafruit/circuitpython/pull/4124#discussion_r571247612 which showed that the MISO is N/A => not required or connected
do the individual core modules take up the same amount of room for each port and/or board?
I wouldn't expect huge differences, but compiled machine code would vary between architectures, e.g., ARM vs. non-ARM
Firmware
Adafruit CircuitPython 6.2.0 "adafruit-circuitpython-feather_m4_express-en_GB-6.2.0.uf2"; Feather M4 Express
Code/REPL
import rtc
import time
import supervisor
my_real_time_clock = rtc.RTC() #Uses Internal ADC on AtSAMD51
#To set the time one has to run this script with the following line uncommented.
#With the Lipoly battery connected to ...
I think the main thing is putting it in the right place, module-wise.
Sorry for forgetting to update the PR title; it no longer targets audiocore
I am late to the party, did re-arrange #4560 the report ID get both mouse and gamepad work with iOS. I have seen similar issue with BLE HID as well on the arduino nrf52. Plan to get back to implement it in the near future. Another way it adding additional HID interface for gamepad, it may work.
As it is possible to config USB devices on a custom build, any hints where to start when trying to implement this?
https://learn.adafruit.com/building-circuitpython/customizing-usb-devices
I've read some docs about the requirement.
- A boot keyboard only does 6kro. But this is already the case in the current implementation
- The interface descripter field bInterfaceSubClass should be set to 0x01 (Boot_Protocol)
- A boot protocol keyboard must support GET_REPORT, GET_IDLE, SET_IDLE, GET...
I am starting to implement dynamic control over USB and USB HID descriptors right now. I may not get to boot keyboard immediately, but it will be possible. So I would say not to start on it yourself right now, because the underlying code is going to change a lot in the near future.
All that we really need is a separate USB descriptor (separate endpoint) with an appropriate USB HID descriptor. Almost any commercial keyboard does this and we can vet our choices against the descriptors from s...
Hey @lone axle - What's your live stream schedule?
Normal time is Saturdays at 10am US central time. I will be 1 hour early this week though 9am US central.
Perfect. Will try to catch it then!
Hi guys! I've noticed in the module support matrix that i2cperipheral is not listed for Qt Py M0. That means that it doesn't work at all or that it's not included by default?
it's not included in the firmware, it may work if you compile your own custom firmware with it enabled
I tried searching for the precompiled library but didn't find it
it's not an external library, it has to be compiled in the firmware
do you know the sketch from Malcom in the middle with the broken lightbulb?
I think this is pretty familiar for most of us.
To everyone who watches this: please check out this youtube creator called nartharie . He has created some of the must absurd and funniest videos I've ever seen, but he's still at 280 subs at the time of writing. So please discover this before all your friends or acquaintances or whatever do and be...
now I need to learn how to compile circuitpython...
Do you know why i2cperipheral was not included by default on Qt Py? I don't want to compile everything and find out it doesn't work on on SAMD21 because reasons
it is enabled on some M0 boards and works, but sacrifices have to be done in order to make Circuitpython fit on really small boards
to enable it you would have to disable other modules
do you know for sure it's a size constraint and not another reason?
yup, the M0 boards keep hitting that wall, it's a real issue
I did a build to see, it fits without disabling anything (with en_US), see if that works
http://www.neradoc.me/builds/circuitpython-qtpy_m0-6.2.0-i2cperipheral.uf2
oh yeah that's gonna be slow
your image seems to be starting
let me test i2cperipheral now
if it fits, maybe can be left on by default
ah, and I just noticed that both the board and rpi are missing the i2c pullups
that's not a module that has much demand I believe, and it gets complicated because some other languages take more space, which makes it a support nightmare when different localizations don't have the same modules, it's difficult calls
by it fits I mean: 436 bytes free in flash firmware space
indeed
I would much sooner remove the midi module
but that's because I'm not a musician ๐
that would be an issue for that guide though, and that's too bad since it's awesome ๐
https://learn.adafruit.com/guitar-hero-midi-controller
I would make the midi module a library and include i2cperipherals by default keeping in mind that the board has a stemma qt connector
or at least make i2cperipherals a library so I don't have to create the universe before eating an apple ๐
haxpress just means the board has the flash soldered on, right?
yes
@dhalbert I couldn't reproduce the issue with latest 0539b88a6bd4237ef02ea35cd5e97f638fd132df, the REPL connected immediately, i am using minicom on ubuntu 20.04. How is your testing,
@jaunty juniper your image works, I can see the device with i2cdetect
however my compile crashed
does it need a special version of arm-none-eabi-gcc?
I remember that being the case when I build the bootloader
@bleak heath do a clean whenever you see a QSTR error
the deps for the QSTR code aren't sufficient
@lone axle @still zephyr @mental nexus what to you think about having a separate org and bundle for the circuitpython widget libraries and such? I'm not sure we as Adafruit want to signal that long term support is from us. We could actually put them under the circuitpython org
I could compile after make clean, thanks
I looked in every file in boards but I can't find a list of libraries to compile per board. Where did you enable it when you compiled?
we could move the community bundle to the circuitpython org too
@bleak heath its in mpconfigboard.mk or mpconfigport.mk
I would be okay with whatever you think is best. I would love to see them in the main bundle because I think it makes them easier to find and thus more likely to get used. But I can understand that does imply longer term support which may not be something Adafruit would want to do on some of them. Some of them have been used in Learn Guide projects already. The IconWidget is the one that comes to mind it was used (and made for) the Touch Deck project, if any were going to get long term support from Adafruit I would think that may be one.
I like that idea. I think it would make it more likely that folks find and use the stuff within it.
oh, maybe I misunderstood. You meant the org on github. not circuitpython.org the web page
right, the circuitpython github org
I think I can make a public librarians team there
if they do move to a new org, if possible I'd love to get at least one of us to have access to create repos. Especially in the near term there are going to be a few that need to get created in order to split up what's currently in the displayio_layout library.
No problem on my side, I think is good idea
@lone axle exactly. I think that'd be awesome
kk, we'll need to think through moving the community bundle
strange thing, I can find the libraries in mpconfigboard.mk but only for haxpress, for the regular qt py it's missing
Also, I think is a good point that Foamyguy is making
We are thinking of ways to help folks discover the displayio widgets, one idea that came up was a learn guide that illustrates their usage. Do you think it would still be appropriate to make something like that if those were outside of the main bundle (assuming of course ladyada is interested in having that guide made)
want me to make a widget or graphics team?
@lone axle ya, I think that'd be fine still
graphics
graphics would be good I think. or even displayio if you want to make it more specific
agreed
@mental nexus has the animation stuff that I would not call widget
displayio or graphics is fine by me
put CIRCUITPY_I2CPERIPHERAL = 1 in mpconfigboard.mk
@slender iron now I understand why you were asking to change the ADABOT ๐ parse bundle
it is ready, i just burn my API limit ๐
@still zephyr it didn't hit me until a few minutes ago that we should use the circuitpython org for community libraries
yup, just completed compiling, it works
the regular QT PY uses CIRCUITPY_FULL_BUILD = 0 to disable a lot of stuff, whereas the haxpress picks and chooses a few
@slender iron I have a more "technical approach" type question I'm interested in getting your thoughts on as well. Currently all of our widgets extend one or both of the superclasses Control or Widget that are in the displayio_layout library e.g. https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout/blob/main/adafruit_displayio_layout/widgets/widget.py When those widgets move to seperate libraries, where do you think these super classes should end up?
got it, my problem was the lines for the rest of the modules were missing. It is a cleaner file but for a noob it's more complicated to figure out how to enable/disable modules
I think layout is fine because it's what uses those APIs for layout
okay, cool. Thank you.
you should have a circuitpython invite waiting
got it. Joined, thank you.
np, this should work out well
Join also, thanks
๐
we can move the community bundle once we think the tooling will be ok
I added an in the weeds topic to discuss it
@idle wharf will be happy
ah, should I add him to the graphics team too?
that I do not know, I was talking about the community bundle
kk
I am still seeing this on Linux with Ubuntu 20.04. I have an Intel-based motherboard. (I think yours may be AMD?) Seen on both a Feather Sense and a CPB. There is no code.py on the board, so it goes straight to the REPL.
Here's a Beagle trace:
nrf-repl-5-second-delay.tdc.zip
Steps:
- Start trace
- plug in board
- wait a few seconds for enumeration to finish; confirmed by watching `/var/log/sy...
One suggestion. Let us know if you'd like to leave it as is.
I'd recommend aliasing these as plain TX and RX for compatibility with examples that use the plain names. (Alias means to have a second entry with the same value.)
@tulip sleet I'm getting swamped with email and github notifications from that one commit I was mentioned in, I think it sends me one for every merge onto main. Any news from Github about that?
Is there any way we could retroactively go in and delete the message for it?
I got a reply from GitHub and have posted it in the community thread, and asked for the replier to reply there as well. https://github.community/t/i-am-getting-notifications-due-to-being-mentioned-in-a-commit/172531
@tyomitch This all looks good. Would you mind putting your comment above in an issue so we can think about that for the future? I'll merge this now.
Looks like it needs a translation merge. Sorry about that!
@tulip sleet nice to know you got a response, but I can't tell if they understand that these notifications are persisting past the point that a PR is merged - I'm getting them constantly for a PR that was merged a week ago. Like, this is clearly a bug - there is no circumstance in which these notifications would be useful to anyone.
i know, it was not a great reply. Feel free to add to that thread.
We don't need extra resolution to remove these notifications, they should not be created at all
_it does appear that any time that commit is pushed to a new branch, we are sending you a notification for the @mention in that commit message. _
so even though it's merged, when that commit is referenced in a push (even in a fork), we now get the notifications.
I tried this on Windows also, with Tera Term, and it never actually seems to connect, which I haven't seen before. I could get a trace there too, if you want, but you have a Windows machine also.
Great, thank you for your feedback! I guess most of the time we will use TX1 and RX1 but still nice to have the aliases. I just added them in e5cffa9
Is there anything to be done here?
https://www.adafruit.com/product/4900 say "Adafruit QT Py RP2040"
This is also matching other "QT Py" product.
Thanks for noticing the inconsistency!
When the object is printed the first entry will be used. So I'd suggest the 1 versions first since that's what you'll mostly be using.
We've marked the main branch as 7.x so now is the time to do it. In particular, 1.14 will bring a new mpy version. The sooner we switch to it, the simpler it'll be to match 7.x mpys to 7.x CP builds.
This should only impact the lengths when the service is remote.
The interrupt may have a higher priority than the serial output's
(USB) interrupt and may never make room. This makes prints from
interrupts (like the BLE event calls) best effort for what can be
queued up. The rest of the output will be dropped.
API-related comments, originally from #4447:
The synthesiser can implement the AudioSample protocol, but in addition to that, we'd like to be able not to pass it a buffer upfront, but to call a write method instead that queues data up. That way we'd be able to pipe MIDI from BLE or USB directly into this object.
OTOH,
- that would make looping (or even passing the same AudioSample to
play()repeatedly) impossible; - the protocol for
audiosample_reset_buffer_funhas no way to ...
anyone have the GPIO pinout for the QtPy RP2040?
nvm, found the listing in pins.c. Btw, there seems to be an error:
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO27) },
MP_QSTR_D3 should probably be GPIO26
.. and use the same one in samd, nrf, and raspberrypi.
nrf used a different one which may be the cause of #3875 (but I didn't actually test so I don't know if it's fixed)
If we want to substitute a smaller implementation (like one without a table, as discussed in #4559) now we can do it just once instead of 3+ times.
esp32s2 wasn't touched, as it is using a hardware quadrature decoder module.
i can test this on samd later cause im going to make a rotary trinkey
To me there's no significant difference on what name the files are stored under, it's reasonable to include it in the community bundle. Of course the decision on long-term support is really Adafruit's to make.
My git/github game is pretty weak, so I can't offer much assistance on a transfer. But if you define a place for new things, I will follow y'all's lead.
I like the idea of using these libraries to build up the circuitpython org
I don't understand the nuance between Community Bundle and circuitpython.org. That'll be something to learn about "in the weeds" on Monday.
the circuitpython github org
not the website
github.com/circuitpython/CircuitPython_Community_Bundle vs adafruit/CircuitPython_Community_Bundle
Oops, that does seem to be an error of significance A3 vs D3. The board markings are A3, luckily (and probably why we didn't catch that during testing).
Let's put @slender iron github deep dive in our requirements.txt ๐
Just in case anybody else tries to get CircuitPython on to the TTGO T8 ESP32-S2 ST7789 . I have created a cheat sheet to configure the DIP. switches. How to Install CH340 Drivers https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all
@tulip sleet yeah, I only caught it because I ported over some Pico state machine code and used the D3 tags. It was complaining that a pin was in use and I couldn't figure it out.
also, the GPIO going in reverse direction compared to D0, D1, ... messed me up a bit too (matters when using sequential pins for the state machine)
Was away so just scrolled back to see the discussion. The question about Control class is imminent. Based on some of the new widgets it will make sense to add some new standard response functions to the Control class. I think Control class is a good example to highlight the kinds of decisions to be made.
Thanks KevinT in discord who noticed this discrepancy.
@ladyada The silk is A3, so normally someone wouldn't use D3. I can backport this to the 6.2.x branch so in case we do a 6.2.1 it will be in the stable release. But I'm not sure this is worth a release on its own.
i2cperipheral isn't an option for RP2040?
there's a draft PR, but not done yet: https://github.com/adafruit/circuitpython/pull/4367
@dhalbert
Johnson-Davies' algorithm inherently drops one count on direction change, which is unfortunately the problem you were trying to solve. However, it is very good in many other ways.
Interesting to only interrupt on one signal (not both). Sure that would reduce noise by half and use half the resources. I suspect that the reverse direction drop bug could be fixed . It is an interesting approach of awaking onChange for only one pin, lets try it. I don't understand why the wiki a...
I tested this on a Feather Sense (nrf) and a QT Py M0. On both I got no position changes: .position was always 0.
I did not test with an RP2040 board.
Reloading both boards with 6.2.0 showed both could work. However, I noticed that the nrf and the atmel-samd implementations run in opposite directions! One goes up, and one goes down, when turned in the same direction.
Test program:
import board,rotaryio,time
r = rotaryio.IncrementalEncoder(board.A0, board.A1)
while Tru...
Thanks @dhalbert I will pull out my windows machine to test with
I know @slender iron and @tulip sleet have been doing a ton of of work on the BLE stack recently (with more to come)... does anyone know if there is or will be a way to connect a single NRF52840 (ideally running CP) to multiple centrals? The use case (from an AT perspective) is that users want to use iOS switch control (which is basically switch scanning for disabled users - from a code perspective it is just acting as an HID Keyboard) with both their phone and their tablet and switch between the two.
So, I guess the questions are:
- Does BLE let the peripheral do this? disconnect and reconnect between centrals?
- Does CP expose it?
- Are there other use cases that put this on the roadmap?
Thanks
At one point I wanted one CP device to act as a mouse for two computer. It is not really the kind of usecase you will find in "simpletest" example and that was trial and error. Also I cannot garantee from time to time I did not have to help one of the PC to connect. I manadged to do it (I need to dig the code) but both PC were receiving exactly the same mouse movement (but it was also the goal as this was a multi-PC mouse jiggler). There might be missing piece of functionality to have fine tune control on the behaviour. The trick that made it work for me (but I recently discussed that here or in meeting) was to re-advertise yourself once the first PC would connect, because by default or in sample code, it stop advertising, blocking the next device to connect.
The only big difference here would be that we'd want to send to one at a time. That is, EITHER you're sending keyboard keystrokes to the iPhone, OR to the Tablet, and you want the CP device to switch between them (without having to change anything on the phone or tablet)
Yeah, I fully understand the usecase.
From memory, when you advertise, you can specify the "name" you use. And actually there was a bit of a mess there, because I played so much with Bluetooth binding, mostly with the same board, that it was hard to have a clean config on the PC side to experiment. But the idea could be to advertise under different name. And when you want to switch, to disconnect and advertise under the other name. So only one "personality" would be visible at a time.
I have physical Bluetooth (no BLE) keyboard that do have multi host, and a button to switch from connecting to one device or the other. But I don't know if it is pure software trick, or if there are separate MAC address or some hardware need for that functionallity.
Gotcha - Actually, I kind of like that approach - if the BLE device could advertise "Phone Switch Control" and "Tablet Switch Control" the devices could bond/pair to the name and then internally do the connection switching...
Keep us (me) posted, it is very interesting. I remember one of the issue I had with my code, my code would be stuck on waiting for the first PC before it could advertise with the name known by the other PC. So it would only work when both PC (or at least PC number 1) was present. But I guess I could make the code work better. The idea at the time was the wireless mouse jiggler to keep the PC from going to sleep, and if my CP board was on, I wanted all the PC to stay up. Since I both use my personal and the corporate PC for teleworking... Nowdays I just plug a different CP board on each PC and do that in USB, it solve my problem too.
I think that for what @misty garnet tries to do (and for other to replicate) this will be much easier with a QT Py RP2040 than making a custom firmware for the QT Py (M0) or QT Py (M0) Haxpress.
I'll convert this to a draft and do further testing before taking up anybody else's time. I stand by the idea that it's a good idea to unify these, especially when discussing alternate implementations of the quadrature state machine, but clearly the implementation is flawed.
Hi guys! I'm trying to use regex on a Qt Py M0 but seems the "ure" library is not compiled in. I can't find it as an external library anywhere or the option to compile it in the firmware. Any hints?
@tough flax @thorny jay You can advertise multiple times and then have multiple connections, theoretically. This case has not been well tested, but I think someone tried it before. Since the connections are identified, you can choose which one to send to.
Cool - I'll setup a Circuit Playground BLE and get the basics around sending to one central working today and see if I can add a second device. Do you know if there's a limit on the # of connections?
Given the +/- spread, maybe delay merging this?
With a slightly different heuristic (but still simpler than the one currently used), the spread looks more convincing:

As for the per-language stats, note that the limiting factor for a board is the biggest translation: it doesn't matter if other translations get smaller, you still cannot add new code if it doesn't fit wit...
Can you share the scripts to generate the graphs?
I'm not sure which board or translation you verified, but on trinket_m0 with de_DE this saved more like 28 bytes. However, anything is welcome.
It's probably 4 right now. The Nordic SoftDevice needs a static RAM allocation for various buffers and storage per role, connection, etc. We are keeping that storage under 56kB. It can be adjusted, but it's very tricky to do so.
The complexity of the formula is not really important, because it contributes negligibly to build time, I would think. The important thing is to reduce the size of the largest language build.
unrelated, I recall raspberry pi being limited to 7
Can you share the scripts to generate the graphs?
import os, re
for fn in os.listdir():
if os.path.isfile(fn) and ("build-arm " in fn or "build-riscv " in fn):
board = re.split('[()]', fn)[1]
if board in ("spresense", "teensy40", "teensy41", "feather_m7_1011", "feather_mimxrt1011", "feather_mimxrt1062",
"imxrt1010_evk", "imxrt1020_evk", "imxrt1060_evk", "metro_m7_1011"):
continue
with open(fn, "r") as f:
head = "Build " + board + ...
The complexity of the formula is not really important, because it contributes negligibly to build time, I would think.
Certainly so; but it does contribute to the time it takes to read the code and understand how it works :)
This allows the compiler to merge strings: e.g. "update",
"difference_update" and "symmetric_difference_update"
will all point to the same memory.
Shaves ~1KB off the image size, and potentially allows
bigger savings if qstr attrs are initialized in qstr_init(),
and not stored in the image.
this one is enabled with CIRCUITPY_RE, but you'll need to disable stuff you don't need, I managed by setting CIRCUITPY_USB_HID and CIRCUITPY_USB_MIDI to 0.
I'd say the simplest way to see what is in a build is the support matrix https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html
And the available compile flags are in https://github.com/adafruit/circuitpython/blob/main/py/circuitpy_mpconfig.mk
(Micropython modules dropped the "u" prefix in Circuitpython https://circuitpython.readthedocs.io/en/latest/docs/library/index.html)
That's the thing, I didn't find "ure" at all in the support matrix. In the meanwhile I could use beginswith and substring. It's a crappy solution but works for now.
yep, it's just re like the C python one
MicroPython put u at the front so they would have the freedom to deviate from the CPython API. Our policy has instead been to say that our modules that have the name name as the CPython API implement subsets only of those API's
When I google "circuitpython regex", this is the first page: https://circuitpython.readthedocs.io/en/6.1.x/docs/library/ure.html
that is a doc bug; we need to fix the index ahd heading terms
google results are often not pointing to the latest readthedocs, that's frustrating too
actually it points to the 6.0 version, I clicked on "View the latest version"
i just activated 6.2.x in readthedocs. We also have a robots.txt to update. Sometimes we miss these when doing a release. Thanks for pointing this out.
Reverts adafruit/circuitpython#3291, which added our own robots.txt. I discovered that readthedocs will automatically generate an appropriate robots.txt based on which versions are activated and/or hidden. We can manage the visible versions from readthedocs.
The robots.txt file is at https://circuitpython.readthedocs.io/en/robots.txt.
See https://docs.readthedocs.io/en/stable/versions.html#states:
! Note
Active versions that are hidden will be listed as Disallow: /path/to/v...
Good catch. I didn't find that the last time I looked into it either.
Ah there was an obvious problem, yay. Setting back to ready-for-review!
Good catch. I didn't find that the last time I looked into it either.
Yes, maybe this is new, but it's eminently sensible.
@tulip sleet what problem are you still seeing with that rotaryio PR?
oh weird, I totally missed the 'swapped' field of encoders. haw.
does not using bitfields save code space?
I assumed the *in order* comment was indicating that there was a deliberate sequence point between the two pin reads, though I could not imagine why.
OK, I pushed several changes:
- Changed 4-bit struct fields to whole bytes. The amount of RAM saved is minimal, at the cost of larger code size, which is an issue on some boards.
- Fixed
nrfISR for rotaryio: it was not setting the values properly. - Made the direction of rotation be the same across the three ports. Used the
atmel-samddirection as the default, since there are more boards out there. This necessitated remembering the pin swap onraspberrypi, and it needs to start out ...
@onyx hinge my commit started out as just fixing the nrf ISR (nrf was still not working), but it expanded
I would like to work on the algorihtm more later, like notice the initial state. Your unification PR makes that work much easier - thanks!
@tulip sleet I'm not against changing rp2040 to use the equivalent of pin-change interrupts, fwiw
we should check the direction on STM
i don't have the immediate RP2040 chops to change it to regular interrupts
I shouldn't take the time right now and I couldn't do it without reading the datasheet anyway
same here
oh oh it was the new state ^ ..., now I see it
yeah, that was not congruent with the atmel-samd
I understand now why you had to make an additional change. I had not successfully removed all of this "alternate" quadrature algorithm, there was still a new_state ^ ... operation.
This allows using any pair of pins, and does not use up a state machine. The GPIO peripheral of the RP2040 seems to support both edge interrupts, though CircuitPython may not use this facility yet.
@tulip sleet maybe it should be part of my CP2022 laundry list, but I often find myself feeling that there's the opportunity for more code sharing among the ports than we've achived. I even sometimes notice it when working on a fresh implementation, but don't necessarily I have the time available to work on that. btw thanks for the testing and bug fixing on this PR!
and maybe I personally work on it by making sure I do take the time
I am also attempting to create an AP using CP on a FeatherS2 as well and tried this approach based on the example code in esp32spi_simpletest.py and adafruit_esp32spi.ESP_SPIcontrol.
the message coming back is always RuntimeError: ESP32 timed out on SPI select - is this expected? is there a workaround?
I noticed that some of the exam...
@matthewjerome The ESP32SPI library is only for Airlift configurations, where an ESP2 is used as the wifi co-processor (e.g., PyPortal). It is not for use with the native ESP32-S2 networking.
The pinout card does mention DAC0 (PA02) and DAC1 (PA05) on the raspberry-pi-type header.
https://files.seeedstudio.com/wiki/Wio-Terminal/img/WioT-Pinout.jpg
Some other pins on the header are not in pins.c
I noted:
GPCLK0, GPCLK1 and GPCLK2 (resp PB14, PB12 and PB13).
I2S_LRCLK (PA20), I2S_SDIN (PA21), I2S_SDOUT (PA22), I2S_BLCK (PB16).
Looking at the pinout card and the schematics, I was wondering if some pins could also get aliases: I2C1_, I2C0_, maybe even use the GPIOxx name...
All set now after trading reviews :) . Thanks @jepler for doing the refactoring.
Looks like three boards are out of space. The simplest fix is to disable the module for those builds.
Looks good. Thank you!
@tulip sleet I'm trying to merge everything into the NRF port, but something is blocking my builds:
Traceback (most recent call last):
File "../../tools/gen_nvm_devices.py", line 2, in <module>
import cascadetoml
ModuleNotFoundError: No module named 'cascadetoml'
make: *** [build-feather_nrf52840_express/genhdr/devices.h] Error 1
I notice we now have the "data" folder in root, is there something I need to do beyond a simple submodule update?
cd circuitpython #top level
pip3 install -r requirements-dev.txt
we now need a bunch of Python modules for the builds
cascadetoml is one that is installed
you may get a really strange python error after this, which is due to click not updating properly. if pip3 list does not show click as 7.1.2, do pip3 install --upgrade click
So I should be doing all builds in a virtual environment now? That's a lot of dependancies
you don't have to, unless it would mess with your regular python environment. I just installed those things for me too in general
just don't sudo pip3 install
ok. I got a some warnings about sphinx but the build seems to work so whatever
ERROR: sphinx-rtd-theme 0.5.2 has requirement docutils<0.17, but you'll have docutils 0.17 which is incompatible.
ERROR: awscli 1.19.48 has requirement docutils<0.16,>=0.10, but you'll have docutils 0.17 which is incompatible.
i think that might have just been released. I have 0.15.2
Hi, I'm probably missing something obvious but I have failing checks (in Pre-commit hooks) for https://github.com/adafruit/Adafruit_CircuitPython_IRRemote/pull/46 and I've not yet found where to look for the error. AH, this is some surprise from black maybe but I thought I'd see a report of what was wrong...
@ionic elk i just did pip3 install --upgrade -r requirements-dev.txt and it fixed some things and caused other complaints, which I fixed manually.
@simple pulsar black said it would reformat adafruit_irremote.py
did your local pre-commit not catch this?
Doesn't it go ahead and just do the re-formatting?
no, because that would require a new commit. You can run the pre-commit hooks locally:
pip3 install pre-commit
cd your-repo
pre-commit install # just once for each repo
pre-commit was really meant to be used locally before you push (hence the name). we are using it in the CI as a double-check
Very cool! It all looks good to me. Thank you!
Thanks, I'll have a look later
I hadn't followed the complete story on intro of black
Strange behavior!!! If anyone want's to try reproducing.... On a Raspberry Pi4 -- with latests update/upgrades if I use the chromium browser to access the Adafruit Learn "new guides" page it locks up the Pi 4 console session (GUI) I can still ssh into it but I have to power cycle to get the console back -- even a reboot does not work.... This happen on both a 4Gbyte and 8Gbyte RPI 4.... very strange
will test tonight, I get you back with my results..
sorry -- not CP related
what is the version of the browser?
@still zephyr thanks
@tulip sleet 88.0.4324.187
It's OK with Chrome on my linux box and with Safari on Mac.
@tulip sleet have you played with a funhouse at all yet?
no, but i have one on my desk
It does not appear to have a UF2 boot loader -- and when I wanted to install CP-- I found I had do to an erase_chip before flashing or else it would not boot-- if/when you try it, I'll be curious of you find the same.
Also the board seems to heat to about 10 degrees above ambient ๐ฆ both sensors agree. I was hoping for better thermal isoloation of the sensors.
i will pass that on. I would not expect it to have a uf2 bootloader on it due to the testing cycle, but having to erase first is a nuisance. are you seeing the test program?
the sensor heating may be self heating, I don't know. they heated up awfully fast from being plugged in
I saw the test program at first power -- worked fine. Now have CP installed
@solar whale The physical design looks like it's intended to minimise conduction over the pcb to the temp stuff
Yes -- seems like self heating -- same as pyportal and other. It looks like an attempt was made to thermally isolate them
yes, that was the idea, but they are still pretty close to the regulator
i meant that the sensors themselves may be self-heating due to being queried all the time
I've seen that on the CLUE's sensors but it's pretty small, like 0.1 or something
sometimes humidity sensors have an internal heater, for instance
I don't usually see that on breakouts.
I'm watching the aht20 slowly rise now -- with the simpletest under CP.
Have you got it horizontal or vertical?
That house has no chimney, maybe that's the problem
@simple pulsar I had it horizontal --- -- just went to vertical
interesting -- when vertical, the temperature is dropping.. slowly
it is difficult to find a cool spot on the board. The ESP32-S2 module is a pretty hefty power draw, and the neopixels are also an issue, and so is the backlight
The backllight on the CLUE makes a massive difference. https://forums.adafruit.com/viewtopic.php?f=19&t=175494. You may get some convective cooling if it's vertical, maybe.
I was just curious what other's were seeing. It'll take some experimenting -- I was hoping the layout would help more.
My main reason for asking about the board was to see if others had to do the "pre erase" step. I think I had to do that on some other esp32s2 boards as well, but it should probably be noted in the guide...
@simple pulsar looks like it -- I'll have to see if I can turn the backlight off.
Certainly worth comparing the two scenarios with other parameters constant.
quick test -- the backlight clearly has an impact. Lots to explore....
Is there anythin special about installing on the FunHouse? Ifollowed the instructions for teh MagTag (using the appropriate bin of CP) and get nothing.
@solar whale had to do an esptool.py erase_flash before loading the bin
i have one but have not tried anything yet!
OK. Trying that now
That did the trick. Thanks.
Now you can answer all the questions about it on the forum ๐
That's not ideal.... heh.
Part of why I'm playing with it. Another reason is that I've been building this sort of board is various forms for about 5 years. Latest was a Feather M4 Express + Airlift + 128x64 OLED.
FYI I found that the PIR fit better in the lower set of holes.
I could not get it to go in the upper set
Same. It sticks out SOOOO much. Lower profile would be nicer. I'll be taking the plastic off the header pins to save a couple mm.
Is that a cap meant to come off the back of that header on the back of the board, or is it something glued on?
It looks like the cap that comes on the mini SWD headers, but it didn't come off easily so I stopped messing with it.
It's just a clip to cover the holes.
Right, I get that much, but I meant there's something on the back of it, as dastels said, covering the holes.
I think it is just not lined up well with the upper holes
it works from either side, though I think it is a creative use of that connector
OK so that bit does come off. Got it.
Yes... but probably most useful on the front
I suppose convenient if you wanted to mount it on the back, and point the thing into a room and have the display pointed the other way or something.... But yes, most likely useful on the front.
Sorry for starting the โobviousโ I misunderstood what you were asking.
No worries! I appreciate the response!
The question wasn't that clear because it's not an obvious thing. It kind of blends into the connector if you're not looking for it.
I think this board will be fun.
I'm curious about the cap touch slider -- have not tried that yet....
I am not familiar with using one. I assume there is no support for it ...yet other than as 5 pads or is there something out there for it?
Never-mind -- it's all in the funhouse library --- woohoo https://github.com/adafruit/Adafruit_CircuitPython_FunHouse/blob/main/adafruit_funhouse/peripherals.py
code doesn't work. /me puts print next to "this shouldn't happen comment", reruns and the print is printed ๐คฆ
It's safe to say I don't entirely follow what has been done, but it gained us 200 bytes on trinket_m0 and apparently it works (I didn't test it for myself). It might be worth offering this change to MicroPython as well, if you feel like it.
Cool! The funhouse simpletest is very nice!
This looks like it started happening at commit accc454 in CP (perhaps due to picking up new tinyusb commits, where it looks to have started with commit 1e2c554). I haven't yet identified the code causing the issue, although it appears that the USB interrupt handler stops getting called after the first character of input.
we have itsybitsy RP2040 in stock now for folks who want something with more pins than qt py!
A new chip means a new ItsyBitsy, and the Raspberry Pi RP2040 is no exception. When we saw this chip we thought "this chip is going to be awesome when we give it the ItsyBitsy ...
That is awesome at a great price!
Hey @idle owl - I was just throwing together a test using the CPlayground BLE and noticed that the guide didn't have any BLE CP demos... would it make sense to add a link to them (I know the list is huge and it's not built-in on the circuitplayground library) https://learn.adafruit.com/adafruit-circuit-playground-bluefruit
Nevermind - I see it
I am super tired and might not be 100% - It just seemed to not be where I expected it
@tough flax don't forget to take a break; you need to rest
Yes yes - I know
@anecdata thank you for clarifying - this makes sense now
Confirmed, same behavior. I tested first with chromium 86.0.4240.197 and it works without a problem, then I upgraded the system and under chromium 88.0.4324.187, the system just froze, I did not even get to new guides, just in learn. Same as you, I did not test SSH stuff (lazy me ๐ณ )
@still zephyr thanks! Glad to hear it is not just me!
@solar whale @still zephyr I reproduced this as well, and did log in via ssh. I was running top via ssh. I opened chromium, went to https://learn.adafruit.com, saw multiple chromium-browse processes appear and then all but one disappeared, and the mouse and screen froze. doing an sudo reboot from ssh did not work; I had to power cycle, as you did. I think it's worth filing an RPi bug or bringing it up in the forum. I don't think we can blame learn.adafruit.com but it's an easy example of something going wrong.
the cpu was getting pretty hot; it clocks down when hot, right? I have a finned heatsink on mine.
@tulip sleet Thanks, for sure is in the RP side. Yes RP clocks down when hot
ugh, hitting the QtPy memory limits ๐
Adding the senseBox MCU board after it got approved in the circuitpython repo: https://github.com/adafruit/circuitpython/pull/4576
@tulip sleet @still zephyr I posted to the Raspberry Pi General forum https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=309218 -- I'll report any feedback.
@solar whale I also saw this lockup just with https://learn.adafruit.com. The "latest" page has many animated images; the home page has fewer, but still many images.
I'll add something to your thread.
@dhalbert @hierophect I am trying to implement soft reboot without reset_cpu(). But after git-merging the latest updates, I have a trouble around python memory allocation. When light sleep or deep sleep is executed and python VM is rebooted, I get a MemoryError in gc_collect() in parse_compile_execute(). I use m_new_obj() to allocate a new TimeAlarm object in _get_wake_alarm() to return an alarm object to user, when woken up from sleep. If I comment out the m_new_obj(), the Memo...
@jun2sak could you give a github link to the line in question?
I'm not super excited about how the check of the value in ICSR has to be written, but I don't have an alternative to offer -- getting the right "core_cmZZZ.h" header included is apparently tricky.
@dhalbert The below function is called from _get_wake_alarm() when woken up from sleep.
https://github.com/adafruit/circuitpython/blob/15764b4c24e64e1c5f5e6cae7c35379500beea6b/ports/nrf/common-hal/alarm/time/TimeAlarm.c#L45-L57
and MemoryError is raised in gc_collect() call shown below (line 108). This is to create another python VM to re-execute code.py
https://github.com/adafruit/circuitpython/blob/15764b4c24e64e1c5f5e6cae7c35379500beea6b/lib/utils/pyexec.c#L63-L111
Pardon the ignorance, but working through the weblate list, I came across the string "out must be a float dense array" in the "ulab" library. What, pray tell, is a "float dense array"?
Source: https://github.com/v923z/micropython-ulab/blob/ef65415b5503ae71cc0a9064197f2e3fa5365d74/code/utils/utils.c#L46
I think it's a "dense array of floats", and I would translate "dense" as "dense" as in there is no holes in it (ulab arrays can be sparse)
Dense meaning that there's a value in each element? Such as [1.1,2.2,3.3,4.4] as opposed to [1.1, nil, 2.2, 3.3, nil, 4.4, nil]?
in numpy/ulab arrays/matrices can be sparse to spare memory space, meaning they are not coded as a continuous list of values, but with skipped blocks and such
I'm not completely sure of the details, but I think ulab users who know what they are doing will understand the french term dense in this context (or look it up)
Gotcha. Thanks @jaunty juniper! ๐
Thanks, we will see
Just getting into Raspberry Pi and Arduino after a career in software development. Testing is a big part of my process. How is most testing done? Are there automated tools to help testing?
no testing in Arduino, on rasperry pi you usually use python, so you have all the usual testing tools available โ just mock the hardware parts
I'm working through translations, doing some consistency checks and such, and I've come across a few strings in the core that are leading to some confusion...
For example, in the "safe_mode" code, there are references to both CircuitPython and MicroPython. See this last switch block: https://github.com/adafruit/circuitpython/blob/0365755ebd88b0d640aa006a2b9d7a340edefcf4/supervisor/shared/safe_mode.c#L167-L200
Should these (and others) be unified to reference only "CircuitPython",
@fossil gorge I saw those messages too. I wanted to just remove "MicroPython" entirely
to me the messages read fine still
e.g., "MicroPython fatal error." becomes just "Fatal error"
They do indeed, but it would seem that to a newcomer or someone not quite aware of the CircuitPython/MicroPython history, might be thrown for a loop.
Good point. Already mentions "CircuitPython" in the entry/header message
Thanks for feedback
I was thinking of a system to mock components by a second Raspberry Pi. It would drive a Raspbery Pi or Arduino with test input. It would respond ot output too.
Woudl there be any interest in such a tool?
Should I create an issue to remove the extra/double references to the platform @onyx hinge? Or something to maybe discuss at Monday's meeting?
I'd recommend creating a Pull Request if you're comfortable, it seems straightforward enough to me.
there may need to be discusion but it can be concrete with a PR to refer to
Great call, I'll go ahead and do that.
appreciate it!
Thanks!
Im unable to build CP at all on M1 due to the inability to build may-cross from source in setting up my toolchain. Looked at the MicroPython solutions to this but not able to implement on the CircuitPython git sync - I know this detracts that the Espressif nature of this specific issue, but all the same stuck with this atm
If you can't build mpy-cross, then other things will not build as well. What is the error?
its as follows in a clean case sensitive APFS case sensitive sparse image :
`pixel@Andrews-Mac-mini circuitpython % make -C mpy-cross
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
../py/persistentcode.c:419:2: error: mp_raw_code_save_file not implemented for this platform
#error mp_raw_code_save_file not implemented for this platform
^
1 error generated.
Command '['clang', '-E', '-DNO_QSTR', '-Ibuild/tmp', '-I.', '-I..', '-Ibu...
Battle.net crashes when a CircuitPython device is connected
Devices and Versions
Some examples from devices on my desk:
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Trellis M4 Express with samd51g19Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Feather M4 Express with samd51j19Adafruit CircuitPython 5.0.0-alpha.0-6-g31e459169-dirty on 2019-07-24; Adafruit CircuitPlayground Express with samd21g18
Behavior
The presence of a CircuitPython boar...
@wildestpixel Try changing line 399 in circuitpython/py/persistentcode.c to this:
#if defined(__i386__) || defined(__x86_64__) || defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
(Oh what fun HID is)
Thats a big step in the right direction I just need to add a path export - may-cross is built, just the arm-eabi to link up :
/bin/sh: arm-none-eabi-gcc: command not found
ah - now at this :
`pixel@Andrews-Mac-mini atmel-samd % make BOARD=circuitplayground_express
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
../../py/gc.c: In function 'gc_sweep':
../../py/gc.c:298:68: error: 'MP_QSTR___del__' undeclared (first use in this function)
298 | mp_load_method_maybe(MP_OBJ_FROM_PTR(obj), MP_QSTR___del__, dest);
| ...
today I'm using a fuzzer on the micropython regular expression library (same one as used in circuitpython). wow, no problems (crashes or assetion errors) found! The fuzzer has tried such interesting regular expressions as a|xยชy+|(b[-------------------------------------------------------(b-------------------------c-d]) whatever that means ๐
I'm not sure quite what it means, but I think I'm a little surprised that the bot didn't sensor that message! ๐
I think moderators may be exempt from the filter
Do a make clean BOARD=circuitplayground_express. The first failure may have messed up the QSTR generation.
Remove mentions of 'MicroPython' in error messages as they could lead to confusion in lesser-experienced users
This change comes as [a brief discussion on Discord](#circuitpython-dev message) with @jepler with regards to translations and references to "MicroPython" changed to "CircuitPython" being done in weblate.
Rather than updating translations to convert "MicroPython" to "CircuitPython", I inquired about making the change in...
I am absolutely fine with this and I think the context is obvious. And the messages become shorter. Thanks!
all good I couldn't see the wood for the tress last night before going to bed. I'm building on M1 - Thanks Dan!!!!
@tulip sleet @still zephyr From the Raspberry Pi forum -- a workaround, not a solution. Turning off hardware acceleration seems to stop it from freezing. I turned it off in Chromium Advanced Settings.
@dhalbert @hierophect The MemoryError problem is solved. I found that common_hal_alarm_gc_collect() under ports/nrf/common-hal/alarm/ causes it, and porting esp32s2 implementation into nrf has solved the problem.
Now I have another question.
True deep sleep is implemented in common_hal_alarm_enter_deep_sleep(), and it is now declared with NORETURN. It means processor is reset when woken up from deep sleep. Current esp32s2 port implementation is NORETURN.
If we change true deep sleep...
so it doesn't look like we'll get circuitpython on the ESP32-C6
it has USB-Serial/JTAG but not USB-OTG
more reason to get the BLE loader working
I wonder how much of a leap it would then be to support the original ESP32? That would add a huge installed base to CircuitPython-capable boards.
Thanks for the info.
Moves away from the ethos of having native usb to copy to upload as MSD. There were previous efforts to put CP on old NRF feather, but cancelled due to lack of native usb in MCU
There's been discussion of using BLE as an alternate mechanism to native USB
Q: anyone aware of a reason why SAMD os.stat atime/ctime/mtime are correct for an SD card, but not ESP32-S2 (FeatherS2)? Using sdcardio.
don't know, but sdcardio doesn't matter for the purposes of the question.
If we change true deep sleep design from cpu reset to software reboot,
Hi I thought were changing simulated deep sleep (alarm_pretending_deep_sleep()) to not do a cpu reset. But true deep sleep can do whatever is necessary. I cannot find above where we talked about avoiding a reset on real deep sleep. Is that because the RTC gets reset?
@dhalbert I got it. It would make sense.
I don't mind the RTC reset issue. I would first try cpu reset for true deep sleep. Thank you.
the MICROPY_COMP_CONST define flag is the toggle for the micropython const() syntax right?
I've yet find a comment confirming so concretely...
or maybe not?? For anyone else interested I'm looking in /py/parse.c
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather M4 CAN with same51j19a
Code/REPL
import rgbmatrrix
Behavior
code.py output:
Traceback (most recent call last):
File "code.py", line 7, in
ImportError: no module named 'rgbmatrix'```
Description
I have a Feather M4 CAN that I was trying to connect to a Featherwing RGB Matrix. It appears the "rgbmatrix" module is included in the 6.2.0 release for Feather M4 Express,...
AH! found it
py/parse.c:711: // code to assign dynamic constants: id = const(value)
should that kind of question go in #help-with-circuitpython or here since it involves internals?
I'm trying to read a simple encoder (photo interrupter on tt motor) with circuit python -- and since interrupts aren't available I was trying to find the best way to read it on the Clue. countio seems not to be implemented on the Clue. It would be nice to add it or perhaps someone could suggest a workaround.
Also in py/mpconfig.h:
// Whether to enable constant optimisation; id = const(value)
#ifndef MICROPY_COMP_CONST
#define MICROPY_COMP_CONST (1)
#endif
Here is fine, because it's about the internals
Build failure: looks like protomatter is only handling SAMD51, not a more general SAMx5x.
@daveythacher Could you be more explicit? Which datasheet? Are you saying something about the filtering?
The datasheet:
https://cdn-shop.adafruit.com/product-files/3006/MAX98357A-MAX98357B.pdf
It is possible due to wiring and ground noise for there to be a some disruption in sound quality. There are filters on the output per the datasheet for long speaker wires. There are some bank capacitors also per datasheet. The IC is designed to support low noise production and has measures on board to limit noise from making it to the output. However some of these are automatic and work in certain plac...
OK, we'll have to wait for https://github.com/adafruit/Adafruit_Protomatter/pull/38 to be merged and a release to be made.
Did you end up finding what you needed? Is there something else you think would be beneficial if it was also linked in the main guide?
I see there are two examples, but they're both using the Bluefruit LE Connect app. There are guides in Learn that cover communicating between two CPBs.
Hi, does anyone know if its possible to behave like multiple usb devices at one time? like a keyboard and a mouse? or in my case a keyboard and a midi controller? I cannot see anything specifically saying its possible or not, but I have not found any examples either
I saw one reference about recompiling circuitpython to change the usb defines in some way but it was a bit over my head
Yes, we do this all the time. CircuitPython by default presents a mouse, keyboard, gamepad, consumer control (media keys), mass storage (CIRCUITPY), and MIDI. Some things are missing from some boards for space or hardwrare reasons.
oh ok, so i have this KMK powered keyboard... can i just start using the midi functions if i fiddle with the KMK main loop you think?
kmk is a keyboard firmware
yes, but depending on the timing of things, you may have to wait for something to finish before doing something else
..not the midi variety ... i wish typing and musical keyboards had different names when you are also talking about midi!
we know about kmk ๐
thats great, thanks @tulip sleet
i 3d printed a mechanical keyboard and it wanted a teensy but all i had was a pico which id never done anything with, but here i am typing on it
works great
i want to see if i can switch to a kmk layer and for all the keys to become midi buttons
buttons/notes
@cyan turtle that sounds like a neat project!
it makes me think of the keyboard layout that https://www.linusakesson.net/sixtyforgan/index.php put on a QWERTY keyboard, designed after accordion keys
If a shared-module function will call nlr_raise on some problem should it bother returning an error code or success bool?
it's better but not vital to have the shared-binding code do the raise instead of the shared-module. Also don't call nlr_raise directly if you can help it: use one of the mp_raise... functions/macros instead
there are cases where we use common-hal or shared-module code outside of a python context, and there raising for an error doesn't work.
Hello, i have a board samd21 and im trying to learn curcitpython/micropython. I googled some keywords and the first thing was adafruit's page. I tried to install it on my board from the guide but had no success. Is there anyone who has the time to help me?
@bleak latch ask in #help-with-circuitpython ; there are more eyes there; this is more of "circuitpython-dev"
@marble hornet example where i had to change it: https://github.com/adafruit/circuitpython/pull/4439/commits/08c5dbb0033c2f3838d7d52f98d3844a56253f81
alright thanks!
๐, makes sense.
thank you. still getting used to writing c like c and not c like python ๐
Running the MagTag sports schedule viewer code with the MLB schedule causes a memory allocation failure. This didn't rear its head until now because MLB was off season. Now the file is apparently too large and the MagTag crashes.
File "code.py", line 189, in fetch_sports_data
MemoryError: memory allocation failed, allocating 103 bytes```
how big is the json? cause we have 2MB of PSRAM
<@&356864093652516868> coming up in about 70 minutes, we'll have our weekly meeting. See you in the voice chat. Please fill out the notes document if you have notes for hug reports, status updates, or in the weeds! https://docs.google.com/document/d/1N52qeTToB6s5QCgMq1IjLdMgkWoKfJZV_BiDkTCKQvg/edit?usp=sharing
CircuitPython Weekly for April 12, 2021 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 participate, ...
Good afternoon all you wonderful people 
We're finishing up our internal meeting. We'll be there soon!
@lone axle Did you stream last week? This newsletter is pretty chonky, so if you still plan to add a stream, please save it for next week ๐
I did stream, but forgot to go back and add it to the newsletter. Sounds good. I'll put links for both if I remember next week
Cheers!
I do love that I wrote up the instructions, and we've all sort of shunted that info out of our brains in favor of using the writeup instead. ๐
just lurking
Watch it!
Watch it every year christmas eve with friends
Before, or after "Christmas Vacation"?
It's always Xmas in Heaven...
One would think the ideal would be both
Alex sits down with Thea Flowers, who creates brilliant synth modules and accessories under the moniker Winterbloom. Her "magical music machines" include the first Eurorack module that can be reprogrammed with CircuitPython, as well as a hilarious (and functional!) panel inspired by the Untitled Goose Game. Join us!
// https://winterbloom.com/...
Putting AfterEffects out of business with smooth display animations with #circuitpython. https://t.co/o3gCES87D1
Build a controller with Pi Pico to manage audio and video of videoconference applications (i.e. Google Meet, MS Teams and Zoom.us).
Reduced version of the schedule library for CircuitPython
Heck yeah!
+1 praise for @jaunty juniper --- thank you ๐
Great job on that find @jaunty juniper !
Making sure that everyone in the community gets the recognition for their help! ๐
๐
@tulip sleet So I tried using device cleaner and it didn't work, still doesn't recognize the feather
I'd like to extend a hug to @fossil gorge for being the second member of the weblate gang to make a PR!
I will get back to you; we are doing our public audio meeting right now
ok
Thanks Jonny. I did make one a while ago which was also translation related
With so many folks working on BLE file transfer, hopefully something general enough can come out of the larger community
You're welcome
Worth putting a link to OurCade in the meeting doc?
sure!
I'll grab a link and drop it in my section, thanks for the idea!
@slender iron - Your idea reminds me of the demo Google Wave had on writing and framing the U.S. constitution. Text, language, who provided what & when
Go for the whole US.Code ๐
There's only so much storage space GitHub will allow!!!
I'm looking at gitlab so I can create fake accounts for people ๐
and bills will be pull requests
I'd live to see PR's from Congress
Heads up -- some laws & codes are actually protected. You can't redistribute them or make them easily accessible. Absolutely 100% baffling, but it's an intentional effort to gatekeep.
"code is law" by LAWrence Lessig
ya, me too
washington has a pending broadband bill that I want it for
but I'm deep in the history of the state code now
Hurray 6.2.0!!!
๐ฅณ 
USA constitution must have been full of bugs... I understand you can only do patching and never a new release. (not an expert)
And git revert
ya, we have amendments. the framers never thought they'd get it perfect to start
bread first... this must be a COVID trend.
(foamyguy meant breadth first vs depth first)
That is correct, though bread first sounds way more tasty. I dropped a link to the video I worked from if anyone is interested learning searching algorithms in JavaScript
I got that, I am all for tree visit, branch by branch.
HugoPython
@fossil gorge https://github.com/adafruit/circuitpython/issues/2854
(Btw @fossil gorge - Got my Keychron today)
@cobalt grail k3?
K4
Thanks kindly! Feel free to assign to me in GH
I approve!
It would be the third ๐
Protocol fuzzer can be used for BLE protocol, like the file transfert.
I believe someone used it for testing the UART of the PM2.5 sensor I worked on some time ago.
We rule!
@thorny jay I used aflplusplus https://aflplus.plus/ and the unix build of circuitpython
๐ฐ ๐
have to drop off for another meeting
Same, birthday party here.
๐ be safe y'all
happy birthday ๐
๐
How does one determine object size in bytes in CircuitPython? With regular Python one can do sys.getsizeof(). The best I could find is by inference of free memory:
gc.collect()
before = gc.mem_free()
data = get_data_from_somewhere()
gc.collect()
after = gc.mem_free()
print( after - before )
Is there a better way?
@slender iron I'm happy to transfer (and potentially rename) jepler_udecimal into the circuitpython org, but nobody is collaborating with me on it.
How is going to work? could you explain the mechanics?
ah
Is there a preference on naming prefixes for libraries under this CircuitPython_[Something] or something else as a prefix?
To follow up, would it need a separate/new CookieCutter?
So we come as a group and decide what we support and if not we leave it in our repos?
I do think we can make some tweaks in cookiecutter to help with creating the libraries meant for this.
Is adabot going to build these add bundles? and the lists?
I'm excited, and sounds really good. I think we're all talking through potential "gotchas" or questions that might rear their heads later
to paraphrase: "no plan survives contact with implementation"
So dicussions will be in #circuitpython-dev ?
Until #circuitpython-libraries becomes needed ๐
cool
๐
I feel like this channel could be #circuitpython-dev given how often people get confused about its purpose
I'll second that too
Agreed!
Even if there isn't a separate cp-library channel It would be clearer
getting ahead of the const question .. https://gist.github.com/jepler/338f7ba7ca96259f3a73198dd4e55971#gistcomment-3703170 some file sizes & infos about const()
Updated. Open to suggestions/feedback on the channel description.
a thought -- add on a link to the help channel after the .org link...."For general help with CircuitPython, please visit the #help-with-circuitpython channel."
Sounds good.
I was going to suggest before so that it's visible on narrower screens
I'll admit, it's a mouthful. Even on a 1920x1200 monitor, it'll be too wide.
Same here, but I don't run Discord at full width, closer to 1550, and it's lengthy
Made it even shorter.
Kattni ftw on the wordsmithing ๐
It should be clear enough that we mean "with CircuitPython". If not, we redirect folks in the help-with channel if they post general questions.
thanks @idle owl
Need to drop off. Thanks everyone, and have yourselves a wonderful week!

"All happy families are alike; each unhappy family is unhappy in its own way." -- there's something similar to this in software. All complicated software is complicated in its own way.
Thanks all!
Thanks everyone ๐
thanks everyone! thanks scott!
Thanks
Thank you everybody
Stream on Friday, @slender iron ?
50/50 here, which is acceptable for a single person using it
@slender iron After a week or two of using those Aide-Tek SMD parts cases, are you still ๐ with them?
100% I've been using them for longer than that
I just brought it up when I finally got around to putting a bunch of my stuff into them
Gotcha -- I'll probably be getting some shortly, directly from the manufacturer. Same pricing (or cheaper), free shipping if you pay via PayPal, and cuts Amazon out of the equation. Thanks for showing them off the other week, I appreciate it.
I got one of those and loaded it up with many little sensors and breakouts. I'm totally happy with them as well.
I'm thinking of getting a 2pack of their 96-count containers -- it's a variety of small, medium, and large all in one. I don't do that much with SMD, so that'll last me a long while. [famous last words, right?]
Yeah just like every time we upgrade the CircuitPython chips, we're NEVER GOING TO RUN OUT OF MEMORY AGAIN!
I've gotten to the point where I double up the count/capacity of what I think I'll need....and hopefully I'm not that far under-estimate.
Good catch on OHS. I'll get it out of the template as well.
We really need a way to avoid this on https://circuitpython.org/downloads:
I can look at removing it
I mean we want it once we have an unstable release, but in the meantime, it's confusing.
yup yup
I bet the update script can check to see if the new stable is a prefix of the pre-release
I believe it does
it does already?
which is why I'm surprised
for version in info["versions"]:
previous_releases.add(version["version"])
previous_languages.update(version["languages"])
if version["stable"] == new_stable or (
new_stable and version["version"].startswith(this_version)
):
info["versions"].remove(version)
that part should do that (maybe)
I do not see a define for checking if an object is None like #define MP_OBJ_IS_NONE. is none the NULL pointer?
no, there is a static instance for None I think
How do you check if a passed mp_obj_t is the single instance? (idiomatically)
(probably what i should have asked instead of is it NULL ๐ )
mp_const_none
Thank you!
@slender iron I think it's worth changing the description in the #help-with-circuitpython channel at this point. We highlight Codecademy every other newsletter, I think having something more applicable to the channel at this point is worth it.
I'll do it tomorrow.
๐ works for me
But wanted to mention it while I was thinking about it
oh that's actually a bad loop: for x in list: list.remove[x] gets items to be skipped
so when there's a new stable, we remove the old stable, which gets the unstable to be skipped in the loop, and therefore not removed
yup ๐
Closing for now, not seeing me returning to this anytime soon. possible would reopen when other developments in the bundles are done.
Loop on a copy when removing past releases.
Fixes leaving 6.2.0-rc.0 when releasing 6.2.0.
3 mooore trinkeys! (renamed rotary trinkey)
the current files.json on circuitpython-org still needs to be cleaned by hand if we don't want to wait for the next unstable release
@jaunty juniper Let me know when the PR is merged, and I'll mention it to Justin.
we could also change the test to compare < version numbers instead of version["version"].startswith(this_version) but that's only for edge cases, like if we do a 6.2.1 right now, I believe the RC would stay, since it doesn't start with 6.2.1
@slender iron To pop the stack with the discussion from the meeting earlier - if _pixelbuf is smaller than adafruit_pypixelbuf (which I agree it is), why is _pixelbuf turned off for the smallest boards? Wouldn't it make more sense to have it turned on if it's smaller? Or I am misunderstanding something here.
Like QT Py M0 requires adafruit_pypixelbuf to use NeoPixel.
@todbot I don't know of a better way from within CircuitPython. The heap analysis script I have could be useful. Maybe this is hitting a dictionary growth curve or something.
@idle owl we can't turn it on if we don't have space. the py version allows us to load it as-needed
@slender iron Hmm fair enough.
The feather_m4_can build is broken.
If you turn off storage, people can't do storage.erase_filesystem(), or remount to store stuff locally.
If you turn off storage, people can't do storage.erase_filesystem(), or remount to store stuff locally.
It would be really good to re-enable storage, if you possibly can, including on the rotary TrinKey (where I can't comment on the actual line).
If you turn off storage, people can't do storage.erase_filesystem(), or remount to store stuff locally.
Is it possible to file an issue on Battle.net? I'm not sure it's something to fix on the CP side.
Okay, I know this isn't a question but I got a thing working!
Adafruit CircuitPython 6.1.0-rc.0-1351-g390295dd2-dirty on 2021-04-12; Adafruit Feather nRF52840 Express with nRF52840
>>> import capsuleio
>>> print(capsuleio.read())
None
>>> capsuleio.load("can you see me?")
>>> print(capsuleio.read())
can you see me?
>>>
soft reboot
$(I hit ctrl-c then ctrl-d)
Adafruit CircuitPython 6.1.0-rc.0-1351-g390295dd2-dirty on 2021-04-12; Adafruit Feather nRF52840 Express with nRF52840
>>> import capsuleio
>>> print(capsuleio.read())
can you see me?
>>>
And just realized it i did it on the wrong branch
and @jaunty juniper semver.compare() can do comparisons too: 6.2.0-rc.0 is < 6.2.0. I was just looking at this over the weekend. Not sure why the current code doesn't work.
semver.compare() can do comparisons too: 6.2.0-rc.0 is < 6.2.0. That would cover more cases, I think.
I looked at packaging.version.parse, same thing
One more thing. Sorry for the review delay!
Let's remove the M4 comment because the M7 is the same architecture.
#if (defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1))
This is fine for now. Someone else can update it later if they want.
Want me to not merge the existing PR?
I thought of a possible case, let me see if I can remember it. Maybe not... I guess unstable releases will always have a suffix.
I think it was like 6.2.1 and 6.2.11, where the prefix is not always before a '-'
we are already using semver anyway, so it seemed easy
like right now if we released a 6.2.1 without making a beta first, 6.2.0-rc.0 would not be removed (then again it should not be there in the first place)
but semver would take care of that
@idle owl it's merged
@jaunty juniper Cheers. I'll mention it tomorrow.
How much of the BUNDLE FLY is what I described "in the weed" on February 10th, 2020: https://www.youtube.com/watch?v=UUogvZhp7tI&t=3810s
My description was limited to board bundle, but the use case describe going in the learn guide and downloading everything what you need in a single zip. ๐
Notes document can be found here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/blob/master/2020/2020-02-10.md
Visit the Adafruit shop online - http://www.adafruit.com
LIVE CHAT IS HERE! http://adafru.it/discord
Adafruit on Instagram: https://www.instagram.com/adafruit
Subscribe...
Looks like we could use this to factor out our actions: https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
In this guide, you'll learn how to build a composite run steps action.
fireware: 6.2.0 release(any version after 6.0.1)
hardware: any esp32-s2 board
Test code:
import time
import board
import touchio
Atouch4 = touchio.TouchIn(board.IO4 )
touch5 = touchio.TouchIn(board.IO5 )
touch6 = touchio.TouchIn(board.IO6 )
touch7 = touchio.TouchIn(board.IO7 )
while True:
if touch4.value:
print("touch4 Touched!")
if touch5.value:
print("touch5 Touched!")
if touch6.value:
print("touch6 Touched!")
if touch7.value
...
I noticed that the example code there uses
raw_data = json.loads(magtag.fetch(auto_refresh=False))
I added stream protocol support to json.load a while back to support memory-efficient large json document loads. Does magtag.fetch or some peer api return an object that implements circuitpython stream protocol?
usable like
raw_data = json.load(magtag.fetch_stream(auto_refresh=False)) if it does. This would prevent a round trip through a string allocation saving 328+KB of con...
@tulip sleet Is it generally okay to use mp_obj_t in the shared-module?
Or is that a "tell me your use case" kind of judgement?
sure, if you need to, there's a lot of casting there back and forth. Try to find a routine that's like what you want to do.
you use mp_obj_t when you have an object whose type is not exactly known.
Use grep -r or ag to search a typical module implementation for mp_obj_t uses.
๐
First off, this Pr is not done and will need to change before it is ready.
Since this is my first significant change to the core, I'm not fully aware of what needs to change; I thought a pr would be the best forum to discuss modifications.
Goal
Add a module to the circuitpython core that allows a limited length string(1) to survive between supervisor reloads.
The proposed name for this is capsuleio. It can store some data in a "time capsule" that can be dug up between supervis...
I do not think think this is a reasonable thing to do. Have you considered such boards as the QT PY? This will take 1/32 of its total memory. Probably many folks are running those right on the edge and 1kb would push them over the edge and unable to update.
What does the data sheet say on typical circuitpython boards w.r.t. program/erase cycles on the embedded flash, and whatโs the typical cycle count on express board flash? I imagine if you take into account whatever load leveling is ther...
Looks like three boards are out of space. The simplest fix is to disable the module for those builds.
Done! #4583 took care of two boards; the third one had to have synthio disabled even so.
You forgot the โ:โ in the last if clause
I'm not sure what you're saying? Are you saying board.IO7 isn't working as a TouchIn, or something else? Are you touching 4, 5, 6, 7 in sequence.
I edited your initial post to put the code and output in triple backquotes: ``` so it's formatted nicely. Also I fixed the typos, including what @moltar808 noted.
alarm.sleep_memory and microcontroller.nvm both provide persistent storage with a simple bytearray-style of storage. Rather than pass a string, arbitrary bytes is more flexible, though a bit less convenient. Anything can be converted to bytes. The API of those modules would be what to follow. This would be called supervisor.persistent_memory or something like that. (We need to think of a good name.)
@WarriorOfWire I have seen use cases of needing persistent storage and restarting som...
I didn't touch 5,6,7but it return value is touched
If I changed the init order to 4,6,7,5,then 4,6,7 will return touched. so. only the lastouchpad can work.
ๅไปถไบบ๏ผ"Dan Halbert" @.>
ๅ้ๆฅๆ๏ผ2021-04-13 20:50:08
ๆถไปถไบบ๏ผ"adafruit/circuitpython" @.>
ๆ้ไบบ๏ผfredqian @.>,Author @.>
ไธป ้ข๏ผRe: [adafruit/circuitpython] toupad doesn't work in esp-s2 (#4596)
I'm not sure what you're saying? Are you saying board.IO7 isn't working as a TouchIn, or something else? Are you tou...
Firmware
Adafruit CircuitPython 7.0.0-alpha.1-78-g37887c42a-dirty on 2021-04-13; Saola 1 w/Wrover with ESP32S2
Code/REPL
import wifi
Behavior
Nothing appears in the REPL shell anymore.
However, it is still listening, as pressing CTRL+D makes the on-board LED go back from from white back to "flashing" green.
And Putty keeps the connection open and can reconnect to it perfectly fine, even if the REPL doesn't come back sti...
yay! It's alive again. yesterday during the meeting I inattentively shorted GND, 3v3 and 5v together by mis-inserting an arduino shield 1 pin off (yeowch). I successfully found the small power supply filter inductor that bravely acted as a fuse, and bypassed it. 
(I also had a spare but this is good)
There is a calibration problem. They are all reading some value, but some think they are being touched. Try this sample, and you'll see that the raw values change:
import time
import board
import touchio
touch4 = touchio.TouchIn(board.IO4 )
touch5 = touchio.TouchIn(board.IO5 )
touch6 = touchio.TouchIn(board.IO6 )
touch7 = touchio.TouchIn(board.IO7 )
while True:
print("touch4", touch4.value, touch4.raw_value)
print("touch5", touch5.value, touch5.raw_value)
print("...
When there's no SPI flash chip (e.g. non-Express board), does CircuitPython live in the same space as the lib and code files?
they are all in internal flash, which is divided up between the CircuitPython firmware and the CIRCUITPY drive
Ok, so that means, the more modules enabled in CP, the less space there is for CIRCUITPY? In this specific situation.
I asked yesterday why _pixelbuf wasn't enabled on small builds when it's smaller than the otherwise necessary pypixelbuf, and was told that we can't turn on _pixelbuf due to space restrictions. And after thinking about that answer, became confused.
it's not a dynamic choice: on non-Express boards we allocate a fixed amount of space for CIRCUITPY. On SAMD21 boards it's 192kB for CPy and 64kB for CIRCUITPY. so everything, including _pixelbuf has to fit in the 192kB.
yah, if it were dynamic, then every time you loaded a new build of circuitpython, if CIRCUITPY changed in size, we'd have to erase it and reformat it, which would be a bad experience
Ah.
Fair enough.
Another, tangentially related, question. How do I erase Neo Trinkey if there's no storage module.
Because apparently LED Animations is supposed to fit, and it's certainly not doing so for me. So I wanted to try again. (If the answer is something that takes more than 5 minutes to do, then skip it for now, as I was told to move on from this. I'm figuring this will come up though and wanted an answer.)
we fixed that: https://github.com/adafruit/circuitpython/pull/4595
but it's not in 6.2
you can get absolute newst and it will be in there
I'll grab whatever off of S3 for now.
Yeah that, lol.
It is not there. ๐
>>> import storage
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'storage'```
Also related, is there a way to make it turn off the NeoPixels when you enter the REPL? Neo Trinkey has one status pixel, but four NeoPixels. So if you have code that turns on the LEDs red, for example, and then enter the REPL, one LED turns white out of four, the other three remain red. It was confusing me for quite a while. I imagine it would confuse others.
ah storage was added to the other trinkey boards
Ah.
when ladyada added them, but not the neopixel one
https://github.com/adafruit/circuitpython/blob/37887c42a4c678a3671f60cd7e0f76e894daee05/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk#L21
Indeed. Ok.
It is perhaps by design. I wonder if the Trinket M0 erase file will work. I will test it.
It appears to work.
Still doesn't fit. Ok, actually moving on then. ๐คทโโ๏ธ
adafruit_led_animation ?
that's huge, it's like 47kB
There are optimisations to be had, but we did not write it with that intention. And haven't had time to go back and do so.
the trinket has a 48kB drive
Hello circuitpython folks! I am wondering how to get involved in circup development? I've found the github page, and am reading through the code and issues.
Are there other resources or meetings around this, aside from the github?
@idle owl ok, my review was bad, i asked her to add it and thought she did
I once made a trimmed-down version of the animations library, removing some I didn't need
maybe remove some of the animations that don't make sense with only 4 pixels ?
yeah
I can do it for myself, but it's not a good experience for a guide.
I'm able to copy some of them out myself, but I see that being a support nightmare if we suggest it to users in a guide.
Unless we can figure out a way to dynamically bundle individual parts of libraries. heh
that is what people often have to do to support adafruit_hid on trinket, removing the devices they don't use
Yes! So it's not specific to circup, but we do a weekly CircuitPython community meeting on Mondays at 11amPT/2pmET, where we discuss all things CircuitPython, including circup if there's anything to discuss.
You're starting in the right place - issues and code are a great place to start. But we'd love to have you in the Weekly meeting.
If you find an issue you'd like to work on, comment on it, and then you can begin a discussion.
Hmm that's a fair point.
or if you have new code that doesn't match an issue you can make a PR and discuss it there
Or file a new issue if you're not ready to PR!
Need for storage.erase_filesystem(), etc.
@tidal kiln Ping me when you're around, I have a question about how you feel about whether something would turn into a major support issue or whether it's reasonable. No Canadian rock band. Thanks!
@idle owl is _pypixel on in trinkey?
Yes. As far as I know. Only NeoPixel is frozen in, and using the NeoPixels works without adding any libs.
Well Neo Trinkey specifically. I don't know about the other Trinkeys.
_pixelbuf is on, adafruit_pypixelbuf is not frozen in. To be clear.
@idle owl hey. what's up?
Ok. So the Adafruit LED Animation library is large. But there are obvious use cases for it being used on smaller boards. We all have personally simply copied over the animations we wanted to use, and used them as such. But we've never suggested that to users anywhere official, e.g. Learn. Is it going to be a support nightmare to tell folks "Hey, just copy PART of this library over, only the parts you want to use, and then you can use it on any board."? I feel like you'd have a better feel for how this would play out support-wise than I do.
I mean, I guess it would mean documenting each part of the lib, saying "this is what this piece does" and then tell folks to pick and choose based on what they want to do with the animations, maybe? I personally see it turning into an issue where folks never copy over what they need, or they copy over parts of it, and try to run code that uses all of it. And the code will fail.
"animations" = the code in the library's animation folder?
Yeah, but also the stuff in the main adafruit_led_animation folder, not all of it is always needed.
So one could cherrypick from any of the available files.
i think that would be worth a new page in the guide
"Using on small boards" or some such
Right, I agree. But do you think it's even reasonable?
with a guide page, probably. that's about the best that could be done.
Ok
i could conceive of adding a feature to the project bundler to specify individual files
I was also wondering about this.
other than a magic refactor that doesn't require any shenanigans
Right.... we could factor out some of the animations into their own libraries or something. Maybe the ones written by other folks.
You could also label that section of a guide as "Advanced" or something. Not sure if that will help with reducing support or not
Which is to say, I don't think they've been used internally.
This has been the general policy for things like adding to the HID library
Sometimes it helps, other times, people simply go straight through all pages in a guide no matter what and get frustrated.
I didn't expect this to be come HID-level-popular ๐
I should have.
Maybe two libraries? Core animations with ones like Solid/Blink and then dunno what to call it but another with the fancier ones?
LEDs are the bestest most funnest!
That would mean redoing everything that currently uses it.
I love that library, both as someone who used it and added my own animations to it!
we have a similar problem with some very complete sensor libraries, which provide many features that often people don't need. they are big
I love it too ๐
I just noticed this on 6.2.0 on a CPX with fresh (20210413) libraries, mic.record() hangs in a reproducible way under some circumstances. I tried a few things based on my first discovery of this. It looks like playing a wav file to the speaker does it.
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit CircuitPlayground Express with samd21g18
>>>
>>> import board
>>> import audiobusio
>>> import array
>>> mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DAT...
@tulip sleet Did you see my comment about NeoPixels and the REPL? #circuitpython-dev message
yes, that could be an issue to file, and ask limor about the experience she might want
Ok. I think we have multiple solutions here for the animations situation.
Ah will do.
I wrote the MagTag (and PortalBase) library and I wasn't aware of the stream protocol implementation, so there may be some room for improvement.
I didn't test, but this looks change looks like a good one.
As it is, with the Neo Trinkey specifically, the non-status NeoPixels remain lit up if they were lit up from code in code.py when you enter the REPL. The status LED changes to indicate that you have entered the REPL. So, for example, if you had all four LEDs turned red in your code, and then entered the REPL, three would remain red, and one would turn white. This confused me as I moved onto something else and forgot I had entered the REPL - I figured out what was going on when I came back to ...
Filed and pinged Limor.
we should clear on soft rest - @dhalbert would know if theres' any hook for running a neopixel_write(0) during a soft reboot
Sounds like there may need to be some tree-shaking going on in circup or the new one (brain keeps yelling 'SUPA-FLY'), so shed any modules that aren't referenced from a library
Not now, but down the road somewhere
API
alarm.sleep_memoryandmicrocontroller.nvmboth provide persistent storage with a simple bytearray-style of storage
@dhalbert That sounds like a much better interface, especially since that mirrors the literal, physical underlying hardware. I really like your suggestion of putting it with the supervisor namespace as the "time capsule"* should share the same lifetime.
<br>
@WarriorOfWire: Agreed 1k is not a reasonable amount of memory for non-full builds of cp. The .....
Would it be reasonable to merge that with the alarm sleep memory ?
- implement this the way alarm.sleep_memory is implemented where alarm is available.
- remove alarm.sleep_memory, and use this instead.
The use case is similar: remember data when exiting and reenteringcode.py, without using the flash, reset on power cycle / hard reset.
Re: circuitpython library slimming.
I've come across a related issue in specifying what resources get installed on which server. There are two approaches that might be helpful:
- Top-down specification of library resource groups or
- Bottom-up scanning of resource groups from libraries
With 1, someone would specify a collection of labels--tags that are over/around the library. A label has a definition, and corresponds to resources you can install. This might be just a subset of the library's files, or there could be some processing of the library itself. Labels can also have their own configuration/schema, and take in parameters that are processed to add more flexibility.
With 2, a scanning program can look at a library, and build a dependency graph from how different modules import and relate to each other. This gives you separable chunks, each associated with a module entry point.
Some combination of these two might let you say things like: "I want the library that is a subset of this library, created by starting with this file, and ignoring these other files or this function definition," or something like "What is the API/docs for the super-slim animation library?"
These interfaces can also be pulled up into a UI with labels/checkboxes. This is definitely an area where there's been lots of work, because compilers and resource bundlers cut out extra code and stuff to slim things down.
All excellent ideas!
@makermelissa If I remember correctly a bytes will work but doesnโt avoid the large response allocation. Would want to push it all the way back to an object with a read(n) that gets the data from the network buffer e.g., some response.body type of thing. In that way you could deserialize the json as the bytes arrive, keeping your response buffer trim and a more polite memory footprint with small objects.
@deep saffron Can you file an issue with that suggestion? Either on CircuitPython and I'll label it libraries, or maybe circup is a good place for it. Basically I don't want it to get lost on Discord.
I don't know where is best to put it, but we do have a Libraries label on the CircuitPython repo.
I'm eager to have i2cperipheral supported on the Teensy 4.X with CircuitPython, so I can use two Teensy 4.1 units as I2C Responders on a very short I2C bus. I'd like to know more about how I and my organization can increase the priority or this issue and/or support someone working on it.
Just for background I'd also like to understand if it's not currently supported only because it's low priority or if it's because of issues with I2C in general on the Teensy 4.X.
you can subscribe to https://github.com/adafruit/circuitpython/issues/2470
its our low priority, but if someone implements and submits a PR, we'd help get it merged!
Sure! It sounds like something on its way to a proposal, with more input and brainstorming barnstorming needed. I'll put them somewhere, and file an issue or some kind of breakout soon.
Excellent thank you!
I'd like to use the Arduino Zero and the Teensy 4.X for my project, if I can use both of them as I2C Responders on a very short I2C bus. How can I encourage and support this work?
your best bet is to find someone from the teensy forums who knows the iMX chip and can implement and submits a PR!
@jaunty juniper If you're around, I have a question about what would need to happen to fix the circuitpython.org/downloads pages from having 6.2.0rc still showing up.
ummmm
I'm not sure, I would think rerunning https://github.com/adafruit/circuitpython/actions/runs/720449113 should do it, if that's a thing
Oh hmm. Ok.
There's a link to rerun it.
For me ๐
But sometimes Actions likes to cling to old configs. ๐
I guess it can't hurt anything rerunning it?
I don't quite know
knocking on wood
hmmm it didn't like it
Said something about a missing log.
unable to post new file {"message":"_data/files.json does not match 1995bcdc1e8da34492446eb1008665e2dd0e213c","documentation_url":"https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}
Oh hmm.
Hmm. Seems more likely that it doesn't like rebuilding without a new release or something.
I'll be back in a bit, need to eat.
you can get the file by running RELEASE_TAG=6.2.0 DEBUG=1 python3 build_board_info.py > files.json on a checkout of the 6.2.0 tag (warning: there's 2 debug messages at the top of the file that need to be removed first)
and then manually edit it on the circuitpython-org repo
Could you elaborate, please? What is the advantage of copying in and out of the safe place vs storing directly to the safe place?
It doesn't have to be pre-allocated and use up precious space in RAM if not used.
I have a somewhat better API idea:
Don't provide a fixed-size area but to instead just do something like supervisor.persisted_bytes = some bytearray or bytes. So it could be as large or small as you want. When the VM exits, the bytes are either left where they are (as des...
Hi, did any of the pulseio code change for CPX between 5.x and 6.x? I've just noticed one of my IR sending programs doesn't function on 6.0.0 and 6.2.0 but does on 5.3.1
Hmm.... that sounds involved. I'm not sure I'm following.
I can do a PR with the updated files.json
oh and what I said wouldn't work actually, 6.2.0 doesn't have the latest version of build_board_info.py
Good to know.
Let me know when/if you do this so I can tag Justin to review it, please.
@tulip sleet Is this still as simple as it comes? https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/CircuitPython_Essentials/CircuitPython_HID_Keyboard.py
Or perhaps a different way to ask the same thing is, are we still doing HID this way, or is there some newer way we'd rather do it.
This seems simpler: https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/master/examples/hid_keyboard_shortcuts.py
I'll start with the simpler version and see where it gets me.
I'm doing some diff juggling to keep the download counts
Ah nice. Thanks so much!
Took a few tries, but I got it going.
Ok now I kind of get why it's so complicated on Learn. It's waiting for the release so it doesn't spam.
Which I now need to add.
@slender iron We need a notes doc for next week.
ah! sorry
No worries! I have a weekly reminder for it and it popped up, so I figured I'd share.
thanks
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/10lckbM5mFHKpZLjH7k8IeSUo5t8Sa1rkoPA30iuOKDc/edit?usp=sharing
CircuitPython Weekly for April 19th, 2021 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 th...
As @neradoc pointed alarm.sleep_memory has the same functionality.
The main differences appear to be:
- It is port dependent and seems to only be supported on esp32s2 (stably that is)
- It is grouped with the alarm module meaning implementing it is paired to the alarm module
- It is fixed length where this could be dynamic length
Possible Solution
merge alarm.sleep_memory and capsule as a supervisor.saved_memory* singleton with a max length that is included in only fu...
ok, I have squinted long enough at diffs
Manual fix to remove the unstable release. The files.json was generated by the fixed script running on 6.2.0, and copying the downloads stats from the current one. Also for some reason rp2pio was missing and now isn't. Ok then.
@idle owl ๐
Thank you!
If you stare even longer, they start to stare BACK!
๐
Approving - can't review inline in GitHub, can always roll it back.
- Why limit the max length?
- Why take ram away from devices whether they use the feature or not?
- If you prefer, the previous 2 can be summed up as โwhy does this use static allocation?โ
supervisor.persisted_byteswas proposed as a name to use. I +1 that name.
@WarriorOfWire: Agreed 1k is not a reasonable amount of memory for non-full builds of cp.
This is not what I attempted to communicate - I intended to represent that statically allocating a buffer that will be rarely use...
I noticed my CPX was still on 5.3.1. When I upgraded it to 6.2.0 the IR sending stopped working, I could still see the IR flashing with the aid of a camera. Checked 6.0.0 and that's also broken.
I tried to pick up the signal at the IR diode with my (digital) SQ25 analyser but a few things conspired against me there. I duplicated the sending code and sent pulses to A2 too. That shows timing of the pulses is good on 5.3.1 and is all over the place on 6.2.0.
Good 5.3.1
2...
I had a look with logic analyser on dupe code sending to A2 pad on CPX and the timing is way-off: https://github.com/adafruit/circuitpython/issues/4602
FYI, I don't know if there's any shared code here but I've just spotted some problems with pulseio.PulseOut timing on #4602 which breaks IR sending.
Would it be reasonable to merge that with the alarm sleep memory ?
- implement this the way alarm.sleep_memory is implemented where alarm is available.
- remove alarm.sleep_memory, and use this instead.
The use case is similar: remember data when exiting and reenteringcode.py, without using the flash, reset on power cycle / hard reset.
The use case is similar, but the implementation may not be. In the deep sleep case, we go almost all the way to a reset. On some chips...
@jaunty juniper ๐
@tulip sleet You around for a question? I have some code that works with two options and I'm not sure which one is better.
yes, here, we got a backyard table delivery and I had to put it together to clear the driveway
Hah! That'll be nice though.
Ok, here is the code snippet, with both of the two options, one in the first section, one in the second section ```python
while True:
if touch1.value: # If touch pad 1 is touched...
while touch1.value: # Wait for release...
pass
keyboard.send(Keycode.SHIFT, Keycode.A) # Then send key press.
if touch2.value: # If touch pad 2 is touched...
while touch2.value: # Wait for release...
time.sleep(0.1)
keyboard_layout.write("Hello World!\n") # Then send string.
@tulip sleet Is it better to use pass or time.sleep() for waiting for the touch pad to be released?
Both work, seemingly the same.
doing time.sleep will debounce
Alright. That's what I had at first, but that's not what another example had, so I started to second guess.
you may be lucking out that the bounce time is shorter than going around the outside loop, but I have had switches that bounce for up to 100msecs
yeah, is this on a SAMD21?
yeah, you may see worse behavior on a faster board
Ah ok.
anyway, all set!
Ooo a streaming parser! I would very much be interested in testing that out.
I did some quick tests of that 400kB ESPN JSON and it appears to occupy 1.2 MB of RAM (and 60 seconds) after parsing the entire thing into one big object. This matches my expectations of an in-memory tree parser. So I suspect JP's literally just hitting the RAM limit.
Could Arduino take any longer to update the board manager? Oi. Last time it took this long, I thought it was frozen and force quit it and borked the whole IDE. At least I know better this time, but gah.
Trying to figure out why an Arduino example works in a way that my CircuitPython supposed equivalent isn't. I mean I get why the CP version isn't working right, but I'm wondering how the Arduino example manages it. LED rainbows and taking touch input while running them.
Thank you for re-framing your point and elaborating on Dan's. I now see how I miss interpreted both of your statements and guidance.
I hear you regarding statically allocating and how having the persisted data be any size tailors any cost involved not to the board or build but rather to the specific use case/call (?). That went right over my head for a bit: thank you for explaining.
I have a few questions to make sure I head in the right direction:
- Would it make sense for the message s...
@tulip sleet what exactly does gc_collect_ptr actually do?
in the case of gc_collect_ptr(shared_alarm_get_wake_alarm()) say
it marks that object and any objects it points to as not being garbage. It gets called indirectly from gc_collect() in main.c
You're awesome. Tested and working great. Thanks!
when gc_collect() is done marking everything that is not garbage, it goes through the heap and finds the unmarked objects and says they are garbage and their storage can be reused.
Where's the best place for an overall Learn Guide request, like can we put the I2C address in every primary learn guide on an I2C breakout and/or keep the I2C Addresses guide updated?
I can put feedback on each guide page as I discover it. I typically check the product page, the primary guide, then the I2C Addresses, and finally the library (maybe should just go straight to the library)
You beat me to my suggestion. I'm the one who writes most of the product guides, so I'll try to work on including it. It would go into the Pinouts page.
that would be awesome, thanks!
Feedback on each guide is probably the best option. I'm not sure what happened to updating the I2C guide, but I will work on remembering to include it on new guides I write. (Please provide feedback on those guides if I forget! I see that feedback and try to deal with it weekly... except right now because newsletter. But that's an easy one I can fix even with the newsletter.)
OK, I'll leave feedback on product guides, and the I2C Addresses guide when I find one
I typically only put it in there if it's written on the silk, or included in the product page copy. But that's a bit lazy and I will work on being better about it.
Thanks!
ah, the silk, of course :headdesk: I think it is usually there
Not always!
It's often on the bottom, so by the time you're looking for it, it's already facing a breadboard.
I'll focus on the I2C Addresses page, and go through everything on my desk that's not already there
that page is really useful for identifying conflicts (in advance)
my code tries to detect what kind of device based on I2C address
"the right direction" being towards supervisor. persisted_bytes as Dan has suggested above.
We would store .persistent_bytes in the supervisor module dictionary, which we would make mutable. We would treat it similarly to the .wake_alarm attribute in alarm, whose module dictionary is also mutable. gc_collect_ptr() is called specially on the .wake_alarm object, for instance.
https://github.com/adafruit/circuitpython/blob/9a3f04a1b838988264a68c5d3c0e083a0c5c3163/shared-bindings/alarm/__init__.c#L204
I do not remember if anything is done with the heap when the VM is stopp...
that's the real genius of stemma QT breakouts: you don't put them on a breadboard, so you can read the address ! They thought of everything !
I love the Stemma QT breakouts, I always forget to order enough 50mm cables though
You're awesome. Tested and working great. Thanks!
I tossed a bunch of cables in my last order for that very reason. Couldn't find any ๐
Alright, that works. I'll try to be better about adding new products to it as well.
I think others are better informed about the lifecycle of the Circuitpython init/teardown than me, though I do need an excuse to use this Segger. Iโd love to see what Dan has to say there โค๏ธ
Also to be clear, I donโt particularly care whether itโs a copy or marked objects. My care is that users should only โpay for what they useโ as far as ram goes and just about any dynamic allocation strategy will accomplish that.
@tulip sleet I remember seeing a discussion from you about your preferred terminology for when an alarm "goes off" vs "triggered", but I can't remember which was better
is alarm_time_timealarm_find_triggered_alarm an ok function name?
I agree that the sleep memory is a better option. Also, this PR for selecting the next file to run is pretty close: https://github.com/adafruit/circuitpython/pull/3454 I'd much rather see that finished than add another way to store arbitrary data across runs. The more state that is unique to a particular run, the more difficult debugging will become.
There is a reset_board function. Here is the CPX version: https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/boards/circuitplayground_express/board.c#L55
CTRL-D is checked in a different task from the regular VM. I suspect the regular VM task is stuck somewhere.
Sorry, please do the rest in the file too.
Awesome! Thank you for this!
This is somewhat reminiscent to me of the I2C/wifi issue, but in that case, the USB connection was broken, not just silent.
that sounds fine to me. I thought "goes off" has the word "off" in it, which can be confusing, perhaps especially to non-native speakers.
Yet another way of passing data to a program that has started would be via sys.argv, which is non-CircuitPython-specific.
I agree that the sleep memory is a better option
Does all of alarm need to be implemented at once? can just alarm.sleep_memory be implemented depending on the port?
Sorry that's what I get for trying to do it late at night :(
Yet another way of passing data to a program that has started would be via
sys.argv, which is non-CircuitPython-specific.
That does remind me! I would like to have os.environ it's very often used for passwords and other secrets. https://github.com/adafruit/circuitpython/issues/4212
Does all of alarm need to be implemented at once? can just alarm.sleep_memory be implemented depending on the port?
No. The expectation is that individual alarm types may or may not be available on...
When we're the client, we don't know the characteristics max size. We used to assume 20 which is way less than what is possible. This impacts receiving notifies that are >20 bytes at a time because the MTU was negotiated higher.
This seems OK to me, though it might allocate quite a large ringbuf if buffer_size is significant, so I'm a little concerned about that.
This PR suggests some changes to the internal structure of the Alarm module to fix some bugs with light sleep and hopefully make the sleep program flow easier to follow. Starting as draft so it isn't accidentally merged.
- Changed
shared_alarm_save_wake_alarmto take an alarm parameter. This means it can be called directly in Light Sleep to set the current alarm without an intermediary static variable, and it doesn't impact deep sleep inmain.csincecommon_hal_alarm_get_wake_alarm/`...
Old structure:

New structure:

@tulip sleet new draft PR is just for structural ideas I'd like to discuss before submitting the RP 2040 and Atmel alarm modules. It shouldn't hold up the existing NRF and STM32 modules, I can just merge them in.
That does remind me! I would like to have os.environ it's very often used for passwords and other secrets. #4212
I presume os.environ would not persist between reloads ๐?
I am more than willing to contribute (to the best of my ability) a "data past reload" functionality if it would be helpful.
Both persisted_bytes or sleep_memory sound good to me though keeping to one API sounds much better.
It looks like sleep_memory fits the same use cases as this so it doesn't sound like this i...
So need to pass stream=True in the requests.get invocation here https://gist.github.com/todbot/3d7b393e1b23095498d854fecfa901af#file-json_memtest-py-L22
and for that to actually work weโd need to update the adafruit_requests library to do something with it (e.g., not receiving the whole response from the socket in the method) here https://github.com/adafruit/Adafruit_CircuitPython_Requests/blob/c55425e17842cce3ec0b34489133436c3e1a3898/adafruit_requests.py#L529
The stream parameter is pl...
Since the original discussion goes back nearly a year, I wanted to confirm what we're expecting.
From what I understand, we want to replace at least the following instances of "CircuitPython" and "Adafruit CircuitPython" with "Python for microcontrollers":
- [ ] REPL welcome line
- [ ] The banner line of the
help()command - [ ] The text written to "boot_out.txt"
- [ ] Error or notification messages, such as the
print_safe_mode_message()method in [safe_mode.c](https://github.com/a...
Another tricky instance we're likely to run into are DocStrings. For example, in the /shared-bindings/supervisor/RunReason.c.
In this situation, it's a simple case of replacing with the correct value, however, other DocString instances may be more involved. More of a heads up as something to keep in mind.
@tannewt I'm not familiar enough with the internal structure of CircuitPython to help with that, but I could try to re-compile the firmware with the DEBUG=1 argument if that could help you or someone else.
<br>
I have also done a couple more tests and this issue seems to be also present on the official 6.2.0 release.
However, it seems like it is intermittent.
For the new tests, I tried reflashing the official firmware provided on circuitpython.org, and the REPL also froze when the...