#circuitpython-dev
1 messages · Page 385 of 1
Tried hot glue at first, but that kept coming off eventually
I got one of the Pimoroni rainbow cases, and a STEMMA SHIM, so now I can test breakouts without that monster acrylic piece with the cobbler and a breadboard on it.
Nice
I thought maybe the SHIM would be blocked by the case
but weirdly, it's not.
The gap for the header is wide enough for it to fit perfectly
Awesome
Now I need to actually set it up. 😄
@tulip sleet I don't see a pullup on this one anywhere. But as we found on the previous one, I might not be finding it. Hallowing M4 Express
I can't remember how to do raw tone code.
Trying to test the Hallowing M4 and getting nothing.
Code is running, not failing. But no sound.
I'm sure it's me not doing this properly.
create a PWMOut with the desired frequency. Then set the duty_cycle to 32768
Oh.
I was trying to use sinewaves and RawSample.
Hmm the speaker is an invalid PWM pin.
@tulip sleet I can't use PWM and the built in speaker?
I found our raw audio code. Finally. 🤦🏻♀️
But it's still not working.
oh, sorry, yeah. I wouldn't bother with sinewaves. Just use a wav file
use audioio.AudioOut
oh fair enough
probably since it's called ENABLE rather than SHUTDOWN the logic works, but software init has to set it
I've tried both setting it to True and False and neither seems to be working.
I don't have one, but the guide says True is the thing https://learn.adafruit.com/adafruit-hallowing-m4/pinouts
Good call.
This was a waste of time.
If that's accurate, then the naming is consistent.
MONSTERM4SK doesn't even have one built in, it's a Molex PicoBlade connector to add one if desired.
hallowing m4 has no pullup that i see, did you get it to wokr?
No.
I gave up and moved on.
Not finding pullups on MonsterM4sk or PyBadge either.
PyBadger lib says enable=True to turn it on tho.
If you see /SD on a schematic, then it will be enable=True
not-SD means active-low shutdown (pull down to shutdown), so that means active high enable
I am fuzzy on active-high vs. active-low. I mean, I understand it means pulling it to 3.3v or GND to enable it, but it doesn't gel in my head as quickly as I'd like it to when you make that statement. I have to think about it more than I'd like to admit before it starts to make sense, and I'm not even sure I'm right.
OH wait.
The pullup doesn't make the true or false different, it makes it default to on instead of off.
🤦🏻♀️ sigh.
This is what I was talking about.
I think you got it: active-high means when it's 3.3V (or whatever voltage), i.e. True, then the thing that's being named is "on" or "enabled" or whatever
Correct, the transfer code won't increment the source address if the overall length is longer than the output length: https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/common-hal/busio/SPI.c#L192
@tulip sleet welp, the usb issue was a problem we had fixed on other ports already
sleeping when we have work to do
I'm tweaking it to check for any background task
may help audio too
well, you have the Beagle now for whatever future highspeed debugging you want to do (e.g. RPi)
i could do beta.0 soon to include this. I am trying a SAMD audio fix but it may not work
it might be this same issue
it's a race between running background tasks and then deciding to sleep
I am making sure that the buffer that finished playing is the one that will be filled next, same as what I did on RP2040, but that used two DMA's, this uses one.
but that may help too
Thanks! Looks good, much simpler than I worried it would be!
Good to see these being added
Thanks for checking all of the implementations!
@tulip sleet Ok. I've gone through everything with a SPEAKER_ENABLE pin, and they all seem to be /SD. So I don't think anything needs INVERTED.
that is great, so the changeover is confined to macropad
Yeah. Based on what Limor said yesterday, I think it might be ok to remove the SHUTDOWN pin now.
Thoughts?
I'd have to update the MacroPad library, but that's all I'm aware of.
maybe it's in guides?
I did a google search over learn, and that seems to be it. It was called speaker_shutdown in MagTag arduino
I just found that.
Yeah the guide has the SHUTDOWN pin.
So I'd update that too.
@tulip sleet CPB has SHUTDOWN as well.
in CPy?
Checking.
{ MP_ROM_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_P1_04) },
No.
Only in the guide is it referenced.
Should be updated in the guide apparently.
Ok, so I can update the MacroPad library and the guide.
Library should wait for another release though.
a quick PR and I'll get it into beta.0. Scott found the i.MX problem so that's a good incentive for beta.0
i can update the CPB guide immediately if you want
Sure that would be great.
done
Also removes SPEAKER_SHUTDOWN which was confusing and inconsistent with other naming. As it is not widely used, it made more sense to remove it now than to wait.
Verified all boards with SPEAKER_ENABLE are named appropriately.
Will require updating MacroPad library (once the next release is completed) and Pinouts page of MacroPad guide.
Thanks for this and for checking all the boards!
There is a race between when we run background tasks and when we
sleep. If an interrupt happens between the two, then we may delay
executing the background task. On some ports we checked this for
TinyUSB already. On iMX RT, we didn't which caused USB issues.
This PR makes it more generic for all background tasks including
USB.
Fixes #5086 and maybe others.
That was a journey. 😄 Learned some things along the way, so it was worth it, I suppose.
Back to trying to templatise the MP3 page.
Woops. Borked my MacroPad. CIRCUITPY is NO NAME. sigh.
This makes sense to me. Nice simplification.
I will do some audio testing when this builds.
This can reduce the amount of boilerplate required. Instead of introducing a macro such as QRIO_MODULE dependent on CIRCUITPY_QRIO and then adding an expansion of it in MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS, one simply writes in the bindings __init__.c file:
MP_REGISTER_MODULE(MP_QSTR_qrio, qrio_module, CIRCUITPY_QRIO);
where the first item is the module name as a qstr, the second item is the module's globals, and the third is the preprocessor macro that expands to (1...
I think I'll look into https://github.com/adafruit/circuitpython/issues/4883 next
hey @tulip sleet , I've got a few Adafruit_CircuitPython_BLE and/or Adafruit_Blinka_bleio questions
sure
In short, have you seen any issues with doing a scan on M1 macs?
ok; this works fine for me (old x86 macbook) but crashes hard on an M1 mac mini:
for adv in self._ble.start_scan(ProvideServicesAdvertisement):
user did not give Terminal bluetooth permission
hmm 👀
What I did to fix it was to add my Terminal app (in my case iTerm2.app) into System Preferences -> Security & Privacy -> Bluetooth and I just drag and dropped the app there.
wow crashing your whole program seems a bit draconian
since we use bleak underneath, trying a pure bleak example is a good way to figure out who's responsible, e.g. try https://github.com/hbldh/bleak/tree/develop/examples
will do, thanks
FYI, I found the issue. The iMX code was sleeping when pending USB actions were queued up. This caused the device to not respond. The interrupt that would have woken from sleep had already occurred.
we could enable keypad in qtpy haxpress, ... there are 80 bytes left in fr, the fullest build with it off. oof.
we could do a qtpy_keebs build with busio off and keypad on, but we don't really want to go down the road of having a bunch of build profiles for otherwise identical hardware
Thanks! Looks good, much simpler than I worried it would be!
Great find, and quick!
I tested audio on RP2040, SAMD51, nRF, ESP32-S2, and STM32F405. There was no change between alpha.6 and this.
STM PWM audio does not sound good, and I'l check on that.
The SAMD21 builds didn't work, so I didn't test those.
While testing audio on a bunch of boards, found that PWMAudioOut on STM (at least STM32F405), does not sound good. It's recognizable, but very noisy. Changing sample rate or sample size (8 vs 16) does not really make a difference.
Instead of calling three routines here, suppose validate_no_duplicate_pins_2() called validate_no_duplicate_pins() on each of the lists it was passed. I can't think of a case where it's OK to have duplicates between the lists. So then a single call does all the validation. It doesn't make a difference in this PR but if validate_no_duplicate_pins_2() were called elsewhere it would save some calls.
Since this only checks pins, we can say "pins" instead of "objects"
mp_raise_TypeError_varg(translate("%q and %q contain duplicate pins"), arg_name1, arg_name2);
Looks perfectly straightforward. No testing done.
OK, great, thanks for all the discussion and your patience with this!
Good catch, missed it the second time.
Makes sense to me. Changed it.
Awesome! I finally tried this out with 7.0.0 Alpha 6 and it's such a relief to have tones again that don't stagger drunkenly along! :-)
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.6-103-gf9f106b58 on 2021-08-20; Cytron Maker Pi RP2040 with rp2040
Code/REPL
import board
import digitalio
import time
button = digitalio.DigitalInOut(board.GP20)
button.direction = digitalio.Direction.INPUT
led = digitalio.DigitalInOut(board.GP0)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = not button.value
print(button.value)
#time.sleep(0.1)
`...
I don't see you set a pull direction in your code ?
button = digitalio.DigitalInOut(board.GP20)
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.UP
Alternatively you can use this:
button = digitalio.DigitalInOut(board.GP20)
button.switch_to_input(digitalio.Pull.UP)
I don't see you set a pull direction in your code ?
Does the board have a pull up ?button = digitalio.DigitalInOut(board.GP20) button.direction = digitalio.Direction.INPUT button.pull = digitalio.Pull.UPAlternatively you can use this:
button = digitalio.DigitalInOut(board.GP20) button.switch_to_input(digitalio.Pull.UP)
It doesn't matter as there is external pull up on my board (Maker Pi RP2040).
Also the LED does...
I think you may be seeing switch bounce. You are reading the button state twice, and the second time may be different than the first, due to bouncing. The delay does debouncing for you.
Also, the LED value is the opposite of the button state. You did not say what you expected, just that you thought it was wrong.
Try this:
while True:
button_now = button.value
led.value = not button_now
print(button_now)
#time.sleep(0.1)
I think you may be seeing switch bounce. You are reading the button state twice, and the second time may be different than the first, due to bouncing. The delay does debouncing for you.
Also, the LED value is the opposite of the button state. You did not say what you expected, just that you thought it was wrong.
Try this:
while True: button_now = button.value led.value = not button_now print(button_now) #time.sleep(0.1)
...
Hi all 👋
In board there are aliases for pins that have certain functions e.g. SD_CS. That got me wondering why the pins for I2S audio are absent - it would be jolly nice! Has this been discussed before or does anybody have any thoughts regarding this? Cheers
@bleak matrix good question! do you have a particular board in mind, or are you just asking generally? If the hardware has an I2S DAC "attached", or there's just one set of pins, or the pins are called out that way on the silk or reference, I think it'd be a good idea to add. If there are a bunch of sets of pins and none of them are any more "official" than the others, then probably not. But there is a lot of grey/gray area, and what I said before is just my first gut reaction to the general case.
It was actually for my SAMD51 board. From my understanding the M4 boards have fixed pins for I2S. Today, I had to go though the documentation - fortunately Adafruit have good docs 😀
However, for the RP2040 PIOs then aliases don't make sense as you say.
@tulip sleet I am working though the last few items on the breaking changes list. One of them is Removal of gamepad from HID library I don't think that library is using the core module gamepad but it does have a gamepad.py file for emulating video game controllers. Is the idea with this one that we want to rename that to something else?
the existing gamepad controller descriptor was not very compatible with much things, so the support for it was moved from the library to the examples, so you would rather make your own descriptor (and the example could be renamed to avoid clash where the unrelated builtin gamepad module is left in)
the breaking change is there is no longer adafruit_hid.gamepad
I don't have the Maker board, but I was unable to replicate this on an QT Py RP2040, mirroring the Cytron Maker Pi RP2040 button circuit here: https://drive.google.com/file/d/1Zp8GYO8x7ThObB1G8RIZx2YdqrXtdUc0/view
The LED and print() both reflected the correct state, regardless of delay.
Thank you. and whoops realized I was looking at an out of date branch that did still have gamepad.py in it.
For renaming it I would propose GameController or even VideoGameController but definitely open to input from others.
In the board module there are aliases for pins that have certain functions e.g. SD_CS. It would be convenient if similar aliases existed for the I2S audio pins. This would make it unnecessary to add conditional logic similar to the following:
board_name = os.uname().machine
if "Grand Central M4 Express" in board_name:
i2s = audiobusio.I2SOut(board.D14, board.D33, board.D32)
elif # etc.
I believe a number of boards have fixed I2S pin assignments including:
- Ad...
BTW Thanks too all who have worked on the audio in Circuit Python. Being able to listen to tunes via C.P. brings a smile to my face 😃
TFW you have to test a CO2 sensor, and end up finding out your air quality is terrible.
I don't have the Maker board, but I was unable to replicate this on an QT Py RP2040 running absolute newest from S3 (
7.0.0-alpha.6-121-ga98363348 on 2021-08-20), mirroring the Cytron Maker Pi RP2040 button circuit here: https://drive.google.com/file/d/1Zp8GYO8x7ThObB1G8RIZx2YdqrXtdUc0/view
The LED and print() both reflected the correct state, regardless of delay.
This is strange. I'm able to reproduce the problem running QT Py RP2040 firmware on Maker Pi RP2040.
I'm also able to re...
Addendum to #5139 to fix linker errors like
arm-none-eabi/bin/ld: firmware.elf.lto.o:(.rodata.busio_module_globals_table+0x1c): undefined reference to `onewireio_onewire_type'
when CIRCUITPY_ONEWIREIO = 0, allowing to actually turn off onewireio (no board currently does that).
This afternoon I'm going to use it to try to make a fermentation tracker build, so I might be about to join you with the terrible air quality realization
I mean, I guess it might explain some things? But still, oi.
Ok now I need to see what my levels are. Time to clean and get this running with fervor 😄
I ran the code, and I'm thinking, that seems a little high, but what do I know, so I googled acceptable levels, and oi.
I'm afraid to do that with the pm2.5 levels of my sensors..
Yeah I feel like I should hook one of those back up and run it again now that I've gotten the CO2 levels in here.
It's a nice one to have running, but I'm way more mindful of cooking now. I made a steak a while back and maxed out the sensor levels due to the smoke.. I've also used it to see how long ago I put something in the oven--it's pretty useful for that since I'm really forgetful
circuit python made the data logging a breeze
For sure.
Suppose you remove the LED part of the code and just print the value of the button over and over. Does it go False when you press it and True when you release? Do you see the same thing with the other button, on GP21?
Hi - "gamepad" is the official HID name for controllers with those page/usage-page numbers, so I think we should keep that. I'll comment more in https://github.com/adafruit/Adafruit_CircuitPython_HID/issues/71
gamepad.py is no longer in the base library, because the gamepad device was removed from CircuitPython 7.0.0. Rename examples/gamepad.py to examples/hid_gamepad.py or similar, because gamepad.py ov...
Hitting ctrl+c in the REPL should cease whatever's running, right?
yes, a few bugs w/r/t to that were just fixed
When I hooked one up a few weeks ago when the wildfires here were worse it was both sad how high it was indoors but also amazing how long it was still compared to outdoors
OK, cool. This board's running 6.3.0 so I presume those bugs still lurk. Good to know that it's not just me being silly.
Oi, yeah, I can imagine.
The BAUD register is 8 bits, and it divides a 48MHz clock. The biggest divisor, 255, gives an I2C SCL rate of 48MHz/2/255 ~= 94kHz. This error is not detected.
To allow lower rates we'd have to change the clock the SERCOM is driven from, but that looks like a can of worms.
@tulip sleet my gut says to just reject low i2c baud rates with a new test, rather than try to modify the sercom's clock dynamically (asf4 is not ready for that), what do you think? Not much below 100kHz is possible
Otherwise if I change the clock in asf4_conf it lowers spi top rate too
samd21 has the same max divisor 255
i think it's fine not to support rates below 100kHz; we were just doing it for debugging
But the base clock is 12MHz maybe?
I see that the hpl routine sets BAUDLOW to zero
yah, maybe. We have much more use for higher SPI than lower I2C
you can always pass a low clock to bitbangio.I2C()
It's not 8 more bits of divider
i forget that stuff
I just learned much of that
``` we'd know if this arithmetic brought in double precision math, right?
I would see if SPI has a lower bound check, if not I would say don't bother to complain
we would see aebi_dmul or whatever it's called, and we would have seen that a long time ago
for SPI we limit the divisor to 255, so it would be capped instead of giving anomalous higher rates
samd_peripherals_spi_baudrate_to_baud_reg_value in peripherals
so I could also implement that: lower cap at 100kHz
it would be better to always round down, so as not to overtax a peripheral that would be marginal at higher speed
I saw the 238kHz (?)comment go by in email, but I can't find it
As far as I can tell the set_vertical_scroll parameter in the Display constructor is not used.
grep -r set_vertical_scroll *
shared-bindings/displayio/Display.c://| def __init__(self, display_bus: _DisplayBus, init_sequence: ReadableBuffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, se...
so that is an overflow problem or something, it needs to confine it to eight bits
24MHz/97 instead of /2401 or something
yes but asf4 blithely throws away the upper bits, rather than returning an error
so the easiest fix is just a hardcoded check so we don't have to touch asf4
ugh, sure
I was just reading some DMA threads in the Atmel forums: "the ASF4 example is just wrong....", etc.
asf4_conf/samd21/peripheral_clk_config.h:#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 48000000 limits seem the same for samd21, assuming this is right
asf4_conf/samd51/peripheral_clk_config.h:#define CONF_GCLK_SERCOM1_CORE_FREQUENCY 48000000
so we have lived with this forever, we were only trying lower I2C freqs for debugging, and that was highly misleading, unfortunately
Looks like this affects samd21 equally (reading source, not testing a device)
This makes sense to me. Nice simplification.
Looks good to me still.
Thanks for really nailing the background processing down.
I probably added it optimistically. (It would really help speed up scrolls in one direction.) In almost all cases I've looked at, the orientation is wrong. We can remove it in 7.0.0 if no libraries use it. We can always add it back if we start using it.
@tulip sleet sorry I missed that I had broken the unix build on the background check pr. I know you wanted to do a beta
I don't think I'll do it today, maybe monday. I am on a good trail on SAMD51 audio
np
The frequency divisor is limited to 255, which gives 48MHz/2/255 ~= 94.1kHz as the lowest speed.
Without this change, values below this cut-off gave higher frequencies instead, which didn't appear to have any relation to the frequency value requested.
Closes: #4883
The functionally labelled pins usually correspond to either silkscreen markings or hardwired connections (e.g. NEOPIXEL, SD-CS). We don't tend to assign function names to pins such as the Grand Central pins above when you'd have to look up the pins anyway. Though there are boards where only certain pins can be used for certain functions, like the I2S examples above, there are other boards where the choice of pins is much wider. For instance, the nRF chips can do I2S on any pins.
The SA...
Looks good; thanks for figuring this out.
Hello Circupers (we need a logo...)
I've been looking at this PR and testing Circup and I am stumped as to why pimoroni_circuitpython_ltr559 needs to be special cased.
https://github.com/adafruit/circup/pull/120
Anyone have time to take a look and can help me understand ?
the pimoroni library doesn't follow the rule: the repository is named pimoroni_circuitpython_ltr559 but the module is named pimoroni_circuitpython_ltr559.py when it should be called pimoroni_ltr559.py
OK so the rule that is coded into cookiecutter is wrong then
I don't know, did they make it with cookie cutter ? does cookie cutter enforce the name for the library ?
I mean, yes they had to use cookie cutter, but does it chose the name of the library ?
yes... I'll make one, one sec
Against the Adafruit bundle:
> grep -r set_vertical_scroll * | sort
libraries/drivers/displayio_sh1106/adafruit_displayio_sh1106.py: set_vertical_scroll=0xD3, # TBD -- not sure about this one!
libraries/drivers/displayio_sh1107/adafruit_displayio_sh1107.py: set_vertical_scroll=0xD3, # TBD -- not sure about this one!
libraries/drivers/displayio_ssd1305/adafruit_displayio_ssd1305.py: set_vertical_scroll=0xD3,
libraries/drivers/displayio_ssd1306/a...
cookiecutter cookiecutter-adafruit-circuitpython
Select target_bundle:
1 - Adafruit
2 - Community
Choose from 1, 2 [1]: 2
github_user []: myuser
author_name: Me Me Me
company []:
library_name: libraryname
library_description []:
library_keywords []:
library_prefix []: prefixname
adafruit_pid []:
requires_bus_device []:
requires_register []:
other_requirements []:
pypi_release [no]:
sphinx_docs [no]:
patrickwalters@Mac-mini ~/code/adafruit ll Prefixname_CircuitPython_libraryname/*.py
-rw-r--r-- 1 patrickwalters staff 1150 Aug 20 13:45 Prefixname_CircuitPython_libraryname/prefixname_libraryname.py
it is a year old repository, could it be an old bug ?
Wait...
I said that wrong.
cookiecutter does drop the CP
OK. I get it. Sorry.
Since this is an existing year old library, I think we go with the PR and not make the library change.
Sound good?
I could make a PR to change the library and examples, but that would affect learn guides, and of their own docs, etc..
seems ok to me
done and done.
@tulip sleet https://forums.adafruit.com/viewtopic.php?f=60&t=182440 don't know if we're seeing filesystem issues in general or not, but maybe you can reply to this with a suggestion or two.
Thank you @jaunty juniper for your help !
I find the rules of cookiecutter + circuitpython-build-tools to be strict and maybe hard to follow, but hopefully moving circup to the json file would give much more flexibility by letting the bundle maker specify any arbitrary pypi and repository name for a module
Yeah it should either be impossible to get it wrong, or very flexible.
@idle owl Did you see this issue about CircuitPython vs. CircuitPython_Org being added to the folder\repo name Cookiecutter creates ?
https://github.com/adafruit/cookiecutter-adafruit-circuitpython/issues/149
Should "Community" now be CircuitPython_Org ?
Not sure on that one, worth discussing.
I'm going to tag FoamyGuy on this issue, I think. Who else has been working on cookiecutter lately? Checking
FoamyGuy 😄
Tagged.
in the same vein, this can't be installed from the pypi name (from dependencies using that) by circup:
https://github.com/circuitpython/CircuitPython_Org_DisplayIO_Annotation
and that:
https://github.com/circuitpython/CircuitPython_Org_Bundle/issues/3
We have a number of things to iron out in this transition, clearly.
I ran a test on all the libraries in circup show
Total Libraries Tested: 333
0 Failed libraries: []
4 Libraries with failed dependencies: [
{'adafruit_pyoa': 'adafruit_display_button'},
{'arrowline': 'vectorio'},
{'jepler_udecimal': 'astroid'},
{'pimoroni_circuitpython_ltr559': 'pimoroni_ltr559'} <-- this is now fixed
]
try the pyi name (which would be used in a requirements.txt file) circup install circuitpython-displayio-annotation
it doesn't work because it's not prefix_circuitpython_thing
so I don't know whatever rule cookiecutter has on that, but circup has not been updated to follow it ?
Ok I'm supposed to have been out a few hours ago, which clearly did not happen. Have a lovely weekend all!
have a nice weekend 🙂
Thanks @idle owl This can wait... I just always pop-up about this time on Fridays.
have a great weekend!
Understood! You can always ping me. I'll reply when I'm back next week. 🙂
AES support is useful on more port then the nRF52840 when using wireless hardware, such as the RFM9x (which does not support AES natively).
If the current module is a generic implementation, please consider building it on ports with enough storage.
will follow up
is there a version of vectorio usable on blinka ?
kattni vacay? :O have fun!
I don't believe there is. (but I would love to be wrong and find out that there is)
When any character that is compressed is two bytes, then all characters in the values and words tables will be twobytes. Instead, only the mulibyte character should take multiple bytes.

This change caused the french version to increase ~500 bytes simply due to two fancy apostrophe's in one phrase.
I thought adafruit_shapes would abstract that for blinka, but it doesn't
is anyone familiar with the post-help actions like this one that failed: https://github.com/adafruit/Adafruit_CircuitPython_HID/runs/3386434781?check_suite_focus=true I'm not sure if this failed due to something inside of the library that it ran on (HID in this case) or if it's something that needs fixed elsewhere like this repo: https://github.com/adafruit/circuitpython-action-library-ci-problem-matchers
In other words, the compression should work in terms of UTF-8 bytes, not in terms of codepoints (characters).
Ah, I hadn't thought about using the shapes library for it. Perhaps there is some way we could make a minimal wrapper around display_shapes that would allow blinka code to use it for implementing the vectorio API.
PyLint 2.10 was released a few hours ago, and it seems that it may have broken our actions run 🙁
Ok, referring to the recent deep dive--this compression is the area of the core lib that I'm interested in but c is not what I'm good at. I have other projects, but would me focusing on attempting a compression implementation (within my means) be more valuable than me working towards supporting some other code, like the sgp40 voc algorithm? Both are things I'm really driven to work on, but their value and their probability of success is different. (Additionally I want to look at the qr codes and ‘flatten’ codes on a curved surface). Setting that aside, I don't want to take up time learning about the qstrings and compression from you if spending elsewhere would be more worthwhile. This is mostly a question because you're next to CP7.0's official release
groan
indeed. I did verify that it's something related to that version. I installed it locally and my pre-commit fails the same way that actions did. So at least it's consistent. Trying to look into it further now to see if there is anything we can do to get it back to working.
If I understand the pre-commit config correctly it seems like we have pegged the pylint on library code to version 2.7.1 but the examples pylint does not specify a version so I assume it uses the latest.
@ember iris I definitely want to talk with jeff about it next week
one of the tricky things with the compression is that its worth accounting for how much code space is occupied by the decompression code
Okay I figured out how to fix it locally. There seem to be 2 things at play. This is the error:
PYLINTHOME is now '/home/runner/.cache/pylint' but obsolescent '/home/runner/.pylint.d' is found; you can safely remove the latter
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.7.11/x64/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/opt/hostedtoolcache/Python/3.7.11/x64/lib/python3.7/site-packages/pylint/__init__.py", line 21, in run_pylint
from pylint.lint import Run as PylintRun
File "/opt/hostedtoolcache/Python/3.7.11/x64/lib/python3.7/site-packages/pylint/lint/__init__.py", line 76, in <module>
from pylint.lint.parallel import check_parallel
File "/opt/hostedtoolcache/Python/3.7.11/x64/lib/python3.7/site-packages/pylint/lint/parallel.py", line 8, in <module>
from pylint.lint.utils import _patch_sys_path
File "/opt/hostedtoolcache/Python/3.7.11/x64/lib/python3.7/site-packages/pylint/lint/utils.py", line 11, in <module>
from pylint.config import PYLINT_HOME
File "/opt/hostedtoolcache/Python/3.7.11/x64/lib/python3.7/site-packages/pylint/config/__init__.py", line 89, in <module>
for filename in os.listdir(PYLINT_HOME):
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/.cache/pylint'
The first thing printed is indicating that the directory they use for caching has changed, and it's a warning that the old (now obsolte) directory still exists but can be deleted. Apparently it's existence is causing the new cache directory to not get created successfully which is what ends up making the final FileNotFoundError
Awesome--I feel like this is an area I can add value to, (and yeah the decompression algorithm, codebook, and sequence all add up fast) but I need to have a number to beat for the trio
don't let the C hold you up. you can get better with practice 🙂
if I can get all three aspects below a target I'd be happy, if I can't prove I could in python, it's not worth while. That's the risk
In my local environment I renamed (instead of deleting) the old now obsolete cache directory and then tried running pylint again and it succeeds.
@lone axle no clue about the "Cannot read property..." error
To fix it in actions I think we have 2 options 1) change the library code pylint hook to use the latest version 2.10.0 so that it will not create the old cache directory. Or 2) add rm -r /home/runner/.pylint.d to the actions before the examples pylint runs so that it will delete the old cache directory.
can we bump the cache key?
this is a library CI run
I'm not sure what that means tbh.
where is the old pylint cache directory coming from?
I think it's getting created when the pylint (library code) hook runs because that one seems to be pegged to version 2.7.1
I could try either (or both) of the ideas that I think will fix it on the HID library. But if I understand correctly implementing either will ultimately require changes across all of the libraries.
there's no global place where either version of pylint is pinned, is that right?
Not that I know of. The two places that are relavent to where it comes from are 1) inside the .pre-commit-config.yml inside each library for the (library code) hook. And 2) inside of workflows build.yml inside each library where it runs pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit which installs the latest release version and I assume is the one that is getting used by the (examples code) hook.
looks like someone else has discovered this: https://github.com/PyCQA/pylint/issues/4883
I was going to ask you if you thought this was basically a bug in the new pylint.
So maybe they will fix this quickly.
yep, I think the intended behavior might have been for it to warn you once (or perhaps on every run) about the old cache directory being no longer needed. But also intended for it not to actually fail to run if it does exist.
when I renamed the old cache dir it does run successfully though so I think the failure is somehow tied to that check that is trying to issue the warning.
In the long run, tracking versions of things like pylint is a total pain. the .pre-config-commit.yaml requires specific versions, not latest, if I remember (I'm looking at the docs too)
I think the compression needs to see which method is more efficient. Most languages using code points with high values are probably using lots of code points with high values.
Throwing a few fancy apostrophes into the middle of many latin characters seems to have been unexpected.
The fancy apostrophe in question is 8217 in hex 0x2019
Also represented as three bytes in UTF-8
echo -n ’ |hexdump -C
00000000 e2 80 99 |...|
00000003
`...
i'm trying to think of how to get around this. we could fork these tools, and set the tag to adafruit-choice, and keep moving it forward as needed. That doesn't really help the pip installs, but maybe we could do something there. We could alnteratley have the build.yml read the .pre-commit-config.yaml and pin its choices to those choices, but then we still need to advance the pre-commit choices at some point, and then we can't use the forked repo thing, because pip is looking on pypi
Hello, I'm trying to code a hotkey for the macropad we got in the last adabox, I can't seem to program a button for the windows magnifier.
The shortcut in windows is 'Windows +'
I tried (0x004000, 'Magnify', [Keycode.WINDOWS, 'z']),
sorry I meant (0x004000, 'Magnify', [Keycode.WINDOWS, '+']),
I've built a micropython integration for tensorflow lite micro: https://github.com/mocleiri/tensorflow-micropython-examples
I've implemented all of the upstream examples except for magic wand. Some are just running micropython code with hard coded sample data and others like micro_speech can run in real-time with audio sampled over i2s.
I'm progressively expanding what has been done and I'm interested in integrating with circuit python to expand the number of people that can use it to ...
hi, this is more a question for #help-with-circuitpython (where I'll try to help you)
Dan-san
Thanks!
I have tried pico-kbd-0-255.uf2.zip and it works fine.
I have confirmed that keycodes that were not entered in the previous version are now entered!
The ¥ character is assigned to the same character code as / (backslash) in ASCII code, but it is not supposed to be displayed unless you have a Japanese display environment.
In my computer environment, INT1 (135) was correctly entered and the ¥ character was displayed.
I can now use the keyboard without resorti...
Great! Thank you for testing. This fix has already been merged as part of #5151, since I felt that the descriptor needed improvement in any case. It is already available in any "Absolute Newest" release, and will be in the next release, which will probalby be 7.0.0-beta.0.
The specific commit is https://github.com/adafruit/circuitpython/pull/5151/commits/38f42818e9a01226cc62d4d1ba7bc4dc264ff5b8.
The portion that you saw showing up as two bytes per character is the "dictionary", which is a small portion of the message data overall. (called "words" in genhdr/compression.generated.h)
It turns out this is not a savings for all languages, basically for the reasons @Docteh mentions above, we need make the compression system accommodate either situation and determine which is more efficient. (Another alternative would be to use an variable length encoding that indexes into the array ca...
Is there a best practice for a "default value" for a uint32 argument to a function in core code? Or is there an existing usage somewhere I could reference? My first inclination was to use -1 but that didn't work since it's an unsigned integer. 0 is a valid value that the user could be legitimately passing so it can't be that either. My aim is to make the argument optional, so if the user passes it then the function will use what is passed, but if they don't then it will derive a value from some of the other non-optional arguments. Maybe it's possible to use None or null for this purpose somehow?
I'll take a look in a few minutes but I think in one case I used MAX_INT or something that was unrealistic to ever occur
or I guess if there isn't a good "default" make it a required keyword?
you can use None as the default arg, check out limit argument in the traceback module:
https://github.com/adafruit/circuitpython/blob/main/shared-bindings/traceback/__init__.c#L94
Thank you. I'll check this out
One more thing, if I understand this correctly... your function doesn't take negative integers so have you tried the following:
{ MP_QSTR_x2, MP_ARG_INT, {.u_int = -1} },
```and then check for negative values
That was my original idea, but the argument in shared bindings is a uint32_t so I ended up with errors since that is supposed to be unsigned.
I attempted to change it over to int instead of uint32_t but that led to errors when I try to compare it to other values which are uint32_t. Perhaps it's possible to do that, but I was unable to figure out the right way.
The pixel_luma parameter of displayio_colorconverter_compute_tricolor in shared-module/displayio/ColorConverter.c is not used at all.
> grep -r displayio_colorconverter_compute_tricolor *
shared-module/displayio/Palette.c: displayio_colorconverter_compute_tricolor(colorspace, pixel_hue, luma, color);
shared-module/displayio/ColorConverter.c:void displayio_colorconverter_compute_tricolor(const _displayio_colorspace_t *colorspace, uint8_t pixel_hue, uint8_t pixel_luma, ui...
Here's an example from usb_hid.Device of taking an int arg, checking to see whether it's in a certain range (there are other validation routines that check min and max), and then assigning it to an unsigned value. You could also cast it explicitly from signed to unsigned:
const mp_int_t usage_page_arg = args[ARG_usage_page].u_int;
mp_arg_validate_int_range(usage_page_arg, 1, 255, MP_QSTR_usage_page);
const uint8_t usage_page = usage_page_arg;
Thank you
Actually, there's a simpler way: mp_arg_validate_int_range et al return the mp_int_t, so you can do it in one go, e.g.
const size_t max_events = (size_t)mp_arg_validate_int_min(args[ARG_max_events].u_int, 1, MP_QSTR_max_events);
I added the return value later, I think.
On the UM ESP32 S2 Feather when I go to sleep with an alarm can I have any effect on GPIO pins during sleep? For example, I would like the UART TX pin to, at a minimum, not float.
are you doing deep sleep?
The pins are disconnected to save power during deep sleep. You could add a mild external pull-up or pull-down to hold the level when it's unpowered
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.6 Adafruit PyPortal with samd51j20
Code/REPL
bitmap_test = displayio.Bitmap(2, 2, 3)
bitmap_test[0,0] = 3 # no error raised
bitmap_test[0,0] = 4 # raises ValueError "value requires too many bits"
# and another example:
bitmap_test = displayio.Bitmap(2, 2, 5)
bitmap_test[0,0] = 15 # no error raised
bitmap_test[0,0] = 16 # raises ValueError "value requires too many bits"
Behavio...
Was this needed or a debug artifact no longer required? I didn't see anything called that required string.h.
Were you setting the entire display dirty on purpose? Not saying you need to for this but could track the min/max x and y values to mark only the changed area dirty.
Good catch thank you. I've removed this in the latest version but will wait to make a new commit until I address the below feedback as well.
how unusual would it be for gc.collect() to take something on the order of a minute to complete?
Yep I think this is correct it should be efficient to track min/max values as is works and then only make dirty the area that actually did get changed. I'll work on that and then make a new commit once it's complete.
Thanks again for taking a look!
I don't have any real insight into how it works but that does sound pretty unusual to me. I can't recall ever seeing it take anything more than maybe a few seconds, typically less than 1 second even.
thanks, I've never seen it take human-scale time either. I'm trying to isolate some hard faults and hangs on MagTag that seemed to increase when I put an I2C RTC on it, so I moved the RTC to the FunHouse and FunHouse got stuck somewhere (keyboard interrupt showed it at gc.collect() bute it should have been in a different place in the loop)
it might be that tons of garbage is being created over and over for some reason, so it's spending most of its time collecting
i.e. it's multiple collects
maybe add a counter to the loop
thanks, Dan, I'll keep that in mind as I watch this. normally, the loop works fine, flashing an LED and updating the clock on the display every second
ah, so you can tell when the loop goes around, so if you have not already added print statements to see where it is, maybe do that. Or maybe I2C is getting stuck
I'll add some debug prints, it's pretty intermittent. I do lean toward something I2C-related
there are some very recent fixes to background processing; try an Absolute Newest build if you have not yet
I do have a loop counter, and pretty much anything that happens gets printed with a timestamp, loop count, memory, and other goodies
Thanks @dhalbert for taking the time to explain the rationale. I believe I understand the intent of the board module now.
These are changes to audio DMA on SAMD to reduce scratchiness and other artifacts. The changes are similar to #5079: determining which buffer to fill is no longer done with a flip-flipping boolean, but instead by figuring out the buffer that finished playing in the DMA ISR. The code has also been restructured somewhat as with #5079. Also some extremely minor changes were made in a couple of RP2040 files.
On my PyPortal, I heard an uncommon trailing artifact when playing a A440 16-bit 32-kH...
@mocleiri my first instinct would be the STM32H7 (probably H743), which we have basic support for, is used by OpenMV, and has a precedent for being used for this kind of application. However, a number of Circuitpython boards use external flash, including the ESP32S2, the i.MX RT, and the RP2040, all of which could theoretically support the firmware size you're mentioning. It'd probably be nice to pair it with a platform that supports a camera or audio features.
"Feature" reports are not currently supported in HID. They can be bidirectional. I believe this requires some additional callback processing for Feature get and set requests.
Narrows #4868.
Most fixed by #5151. Feature reports enhancement moved to #5197.
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.6 on 2021-08-12; Adafruit Macropad RP2040 with rp2040
Code/REPL
## Imports
from adafruit_macropad import MacroPad
## Global variables
os_index = 0
app_index = 0
l_position = 0 ## last position
## Init
macropad = MacroPad()
text_lines = macropad.display_text(title="MacroPad Info")
## Main loop
while True:
diff = macropad.encoder - l_position
l_position = macropad.encoder
...
IIn the code above, trying getting the macropad.encoder value only once, since it may vary between the two calls at the beginning of the loop.
The rotary encoder handling is interrupt-driven, and sometimes can lose clicks when the encoder transitions happen too fast. I'm not sure that's the issue here. There is also a known problem about reversing: #3875. We've spent time tweaking the code, but there's a tradeoff between accuracy in terms of registering false transitions vs losing transi...
LGTM, and we can do more about the error messages issue in another PR
Thanks Dan.
I'll update the code so that macropad.encoder is only evaluated once and then run a few tests.
## Main loop while True: n_position = macropad.encoder diff = n_position - l_position l_position = n_position if 0 != diff: ...
I'll report back with my findings.
Yes. BTW, running 7.0a3.
During the process of creating the ARAMCON 2 Badge, we needed the E Paper Display to refresh more frequently. Therefore, we added an API function that allowed us to change the start_sequence of an EPaperDisplay object and control it's waveform data that is used to update the display.
I'm sure this is not the prettiest way to do it, but we needed a fast solution so I decided to change the core base as little as possible.
I came out with the proposed solution that doesn't change any of the "d...
After updating the code to only call macropad.encoder - the behavior is improved, less positions are lost if turning the encoder fast. I think that in the end the positional code should actually be something like this:
while True:
n_position = macropad.encoder
diff = n_position - l_position
l_position = n_position
if 0 != diff:
if macropad.encoder_switch:
os_index+=diff
## Reset app_selector
app_index = 0
...
Glad it's working better. Are you modifying this code? https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Macropad_Hotkeys/code.py
If you think it could use improvement, feel free to submit a PR, though a feature addition would require a guide update, so I'm not sure we'd do that right now.
Do you think we should close this issue?
I ran some tests and found the if the -Og in the Makefile under the "ifeq ($(DEBUG), 1)" with -O3 resulted in a successful (and debugable) build. @tannewt ; since a normal build also uses -O3 would this be an acceptable change to PR?
Dan,
Let's close this issue, since the root cause is already being tracked on the ticket you mentioned on the first comment.
I'll submit a PR for the Macropad Hotkeys with some improvements. The feature addition - I'll work on it and get in touch once it's ready for release, I could probably take care of updating the guide as well.
Thanks for the help, I learned a couple of things.
The method displayio_copy_coords is identical to displayio_area_copy. Remove displayio_copy_coords as it is the lesser used and replace with displayio_area_copy
void displayio_copy_coords(const displayio_area_t *src, displayio_area_t *dest) {
dest->x1 = src->x1;
dest->y1 = src->y1;
dest->x2 = src->x2;
dest->y2 = src->y2;
}
void displayio_area_copy(const displayio_area_t *src, displayio_area_t *dst) {
dst->x1 = src->x1;
dst->y1 = src-...
Another report of sometimes-wrong NeoPixel colors, in the Arduino library (which I would guess uses the same PIO code):
https://github.com/adafruit/Adafruit_NeoPixel/issues/288
Shouldn't miny = y and maxx = x respectively?
With the current setting say a 1 point fill at (5,10) would mark the dirty area as (5,5) to (10,10) instead of just (5,10) to (5,10). Or another way if x starts at 5 but moves 2 wide to 7, the maxx is still 10 which is larger then the changes area.
Is there a reason the max x/y is +1 that maybe I'm missing?
Thanks for your feedback.
I'm tracking circuitpython integration on: https://github.com/mocleiri/tensorflow-micropython-examples/issues/27
I'm looking at reducing the ops and firmware size in:
https://github.com/mocleiri/tensorflow-micropython-examples/issues/28
I'll start with the Cortex M7 boards like openmv and teensy 4.1 and then into the others you listed.
I'll ping back on this issue once there are firmwares to test.
whoops, yes each should be their own respective values. Thank you
I am not 100% sure about the reason, it seems like displayio_bitmap_set_dirty_area might be inclusive on one end and exclusive on the other, I don't see anything documenting that though. And it's not consistent on every fill which definitely seems odd to me.
I did try initially without the +1s and some of the fills are not showing the far right and bottom edge lines of pixels being filled. Most of the logic was copied from the rotozoom function which does also have the +1s in it's ...
fixed this with latest commit
LGTM! Good job working on this.
Anyone familiar with the new RAYTAC-nrf52840 dongle? https://www.adafruit.com/product/5199 With the pre-installed firmware, I can see it with the nrf-connect app and see changes in the button state and well as set the LED on/off. I tried uploading CP from tip of main to it and it does not seem to boot - I see several errors in dmesg related to the file system. Does this device need some special handling?
dmesg errors ```[439587.025403] sdd:
[439587.027901] sd 8:0:0:0: [sdd] Attached SCSI removable disk
[439607.466351] usb 3-3.2: USB disconnect, device number 8
[439607.481272] blk_update_request: I/O error, dev sdd, sector 11 op 0x1:(WRITE) flags 0x0 phys_seg 8 prio class 0
[439607.481307] Buffer I/O error on dev sdd, logical block 11, lost async page write
[439607.481311] Buffer I/O error on dev sdd, logical block 12, lost async page write
[439607.481313] Buffer I/O error on dev sdd, logical block 13, lost async page write
[439607.481315] Buffer I/O error on dev sdd, logical block 14, lost async page write
[439607.481317] Buffer I/O error on dev sdd, logical block 15, lost async page write
[439607.481327] Buffer I/O error on dev sdd, logical block 16, lost async page write
[439607.481329] Buffer I/O error on dev sdd, logical block 17, lost async page write
[439607.481330] Buffer I/O error on dev sdd, logical block 18, lost async page write
[439607.481344] blk_update_request: I/O error, dev sdd, sector 269 op 0x1:(WRITE) flags 0x0 phys_seg 8 prio class 0
[439607.481347] Buffer I/O error on dev sdd, logical block 269, lost async page write
[439607.481349] Buffer I/O error on dev sdd, logical block 270, lost async page write
[439607.481379] blk_update_request: I/O error, dev sdd, sector 517 op 0x1:(WRITE) flags 0x0 phys_seg 1 prio class 0
I have one of these, but have not tried it yet. Certainly file an issue. I made the board def, and it was tried out, but I did not test it personally.
@tulip sleet Thanks -- I'l file an issue.
did you get a BOOT drive with yours? Out of the bag the blue LED blinks, but the button doesn't seem to do anything in particular
no drive -- I can connect to /dev/ttyACM0 and it reports connections. With nrf-connect app in the "client" tab I can set the LED on/off and in the "log" I can see the button status. I get a bootloader if I power it with button pressed -- I saved the current.uf2 and was able to restore it after trying CP.
I tried using one of the new RAYTAC-nrf52840 dongles? https://www.adafruit.com/product/5199 With the pre-installed firmware, I can see it with the nrf-connect app and see changes in the button state and well as set the LED on/off. I tried uploading CP from tip of main to it and it does not seem to boot - I see several errors in dmesg related to the file system. Does this device need some special handling?
dmesg errors
[439587.025403] sdd:
[439587.027901] sd 8:0:0:0: [sdd] Attached ...
ok, yes, I see the same thing. (I hadn't read the product description yet)
I was just curious what I could do with it and had a few minutes to try it out. I have to go now, but will look at it again tomorrow,
if we still have power...
i got a CIRCUITPY by using the artifact from my PR that added it: https://github.com/adafruit/circuitpython/runs/3245661532
Cool! I'll try that tomorrow - maybe something recent broke.
I tried this the dongle with:
- https://adafruit-circuit-python.s3.amazonaws.com/bin/raytac_mdbt50q-rx/en_US/adafruit-circuitpython-raytac_mdbt50q-rx-en_US-7.0.0-alpha.6.uf2: works and shows CIRCUITPY
- https://adafruit-circuit-python.s3.amazonaws.com/bin/raytac_mdbt50q-rx/en_US/adafruit-circuitpython-raytac_mdbt50q-rx-en_US-20210822-fdfcaf0.uf2: does not work
So a bisect is in order.
I tried a Feather nRF52840 with fdcaf0 as well, and it doesn't work either. So something about the nRF builds has broken since alpha.6.
Is it possible that this problem could be back, on a Macropad running 7.0.0-alpha.6 ?
I’m seeing a very similar problem, except I can’t get the board back by reset — I have to use the nuke uf2 to clear it and start over with flashing. I described what I’m seeing here: https://forums.adafruit.com/viewtopic.php?f=60&t=182523&p=886785#p886785 before I found this Issue.
Bisected to
- d2860b58b06f02303a30a7ff505f3fae2c21ba25, which is #5182
[The title of an issue or PR will be included in the rendering, if you put it in a list.]
- Fixes #5201.
#5182 added a critical section around sd_app_evt_wait(), which prevents USB from coming up (and perhaps other things).
https://github.com/adafruit/circuitpython/blob/fdfcaf0b72c61165922c63985909fef0b4868260/ports/nrf/supervisor/port.c#L367-L372
This removes that critical section, which was not present before.
Other uses I see of sd_app_evt() don't do anything special (no critical sections, etc.)
@tannewt I'm not sure if this the most correct fix, based on what yo...
@mathias I answered in the forums.
Yes, let's mark it as deprecated and ignored in 7.0, then remove it from the core in 8.
I had an additional idea, which was to make the entries in "words" index "values" rather than being code points; the indexing is "utf8-like" if more than 0-255 indices in values are needed. This should be a win on average, as (no matter the language) most code points in "words" should be represented by just 1 byte. However, it ends up a bit worse for latin languages still.
| language | before | after | delta |
|---|---|---|---|
| fr | 1328 | 1312 | -16 |
| de_DE | 1052 | 1032 | -20 |
| j... |
Suppose you remove the LED part of the code and just print the value of the button over and over. Does it go False when you press it and True when you release? Do you see the same thing with the other button, on GP21?
The problem still persists after removing the LED part. It also happens on other GPIO.
I think I've found out the root cause for this problem.
I've done some test using the code below:
import board
import digitalio
import time
led = digitalio.DigitalInOut(board.GP0)
led.direction = digitalio.Direction.OUTPUT
count = 0
while True:
if count > 10000:
led.value = 1
print(count)
count += 1
And what I got was the LED turns on way before the printed counter is > 10000.
Can I confirm that the print function is non-blocking a...
confirmed that build fdfcaf0 also failed the same way on an nRF52840 Bluefruit Sense:
Compiled with this PR -- both the bluefruit sense and the raytac dongle boot normally.
Calling sort() on a Group hard crashed.
The pos_args were modified but the unmodified ones were passed onto mp_obj_list_sort()
This has been tested on a PyPortal with the following code:
import displayio
import board
import adafruit_display_text.label as label
from terminalio import FONT
group = displayio.Group()
for i in range(10):
lbl = label.Label(FONT, text=f"Label {i}", x = 100 - (i * 5), y = 100 - (i * 5))
group.append(lbl)
for layer in grou...
Can I confirm that the print function is non-blocking and calling the print function is actually just adding the value to a queue and it will only be printed after the previous value.
There's a buffer for USB output, and the output is also buffered on the host side. On the host side, the buffer can get very large, so you'll have some lag. When and if the host-side buffer fills up, the USB driver there will do a USB stall to prevent getting more input, and the CircuitPython side will not ...
LGTM! Thanks @lesamouraipourpre.
ouch, how did I miss that
sure
Ok, so folks are apparently running into thinking they don't have to have any BLE code in code.py to have the board show up in the Bluefruit LE Connect app. So I'm updating the guide. Is the following the minimum you would need to have it show up? ```py
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)
while True:
ble.start_advertising(advertisement)```
That wouldn't do anything else, but would it at least show up in the app?
no reason to call start_advertising() over and over. The BLE UART echo example should work with the app: https://github.com/adafruit/Adafruit_CircuitPython_BLE/blob/main/examples/ble_uart_echo_test.py
it is only slightly longer and actually does something
you could do
ble.start_advertising(advertisement)
while True:
pass
that is fine for showing up
agree it's a smoke test
no, the Bluefruit app has UART in it too. We could change the comment
Because this isn't meant to go into being a full on example. Simply to show people what to include in their code so it shows up.
Ah.
Eh I'll include what I pasted to you instead.
With your suggestion
I will submit a PR to the example saying you can use the app too.
Ok thanks
I added the warning and the code to this page: https://learn.adafruit.com/circuitpython-nrf52840/bluefruit-le-connect-basics
The unusual way that exceptions are handled by modifying parse_compile_execute is not what I would have done, but I won't let that stand in the way of incorporating this.
@tulip sleet if you ever had a chance to look, was there anything interesting to us in that latest ARM toolchain update?
https://launchpad.net/gcc-arm-embedded/+announcement/28093 are the release notes. The fixes are minor. I don't think it's worth churning the CI now, but maybe after 7.0.0 final we can switch. gcc 11 would be more interesting since it might save some space
@idle owl I think will take this away, it's old:
everything is always in development :), but I think now this feature is as stable as anything else
@tulip sleet Where is that? In the page I linked?
it was on the front page of that guide
I checked a random build (pygamer) and size was 8 bytes smaller with 10.3.
I was just impatient 🙂
Your impatience means less work for me. I approve 😄
SERCOM0_CORE huh I wonder why SERCOM0..7_CORE appear as strings in firmware.uf2 of pygamer
genhdr/qstrdefs.generated.h:QDEF(MP_QSTR_SERCOM0_CORE, 20, 12, "SERCOM0_CORE")
huh is a qstr
oh samd clock module
?serverinfo
What would I do with time.monotnic() to track time in minutes/hours from start of running code.
Trying to track how long this sensor runs before it fails. I already forgot when I started it, so good job me.
It's on a Pi, so it's not going to reload every time something writes to something on my Mac.
I mean minutes would be fine, I can do math later.
Nevermind. Used time.time(), strftime and gmtime.
Seems to be working. Doubt it translates to pure CircuitPython though. But I don't need it to.
I've been downgrading from 11 because it seemed to be broken. mp is using it though
I'm fine just removing it. My intent was to prevent a background race like the other case but obviously it wasn't correct. :-) We can keep it in mind if we see issues w/it.
<@&356864093652516868> we'll meet in about an hour -- please add your reports to https://docs.google.com/document/d/10fzYN9LFHmhD-v47O-HZw6WN8us9PmUtQTcjUbbHxEU/edit?usp=sharing and note if I'll need to read them
CircuitPython Weekly for 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, add your notes...
pca10100 de_DE fr builds are running out of space.
Yes, https://github.com/adafruit/circuitpython/actions/runs/1159008868 failing on main branch since at least earlier today 😕 @analog bridge
does it have CIRCUITPY_FULL_BUILD enabled?
just checked CIRCUITPY_FULL_BUILD is enabled on pca10100... should it be turned off or should I turn off atexit?
@analog bridge either way is fine
it is kinda strange, CIRCUITPY_FULL_BUILD is enabled but every module is disabled on it... turning full build off frees up about 12500 bytes
https://github.com/adafruit/circuitpython/blob/main/ports/nrf/boards/pca10100/mpconfigboard.mk
it says these are on: bleio, analogio, atexit, audiobusio, audiocore, audiomixer, audiopwmio, board, busio, digitalio, errno, getpass, math, microcontroller, onewireio, os, pulseio, pwmio, rainbowio, random, rotaryio, rtc, storage, struct, supervisor, synthio, time, touchio, traceback, usb_cdc, usb_hid, watchdog
synthio could go too
I assumed most of these modules were off too
building with synthio turned off now.
@slender iron are you changing the apostrophe in that French translation in weblate? I could try but I have never used its web editor before.
I haven't looked at it. I think jeff was going to
@onyx hinge do you have time to look at that/
It looks like that was not changed back by weblate
@analog bridge seemed to be indicating the problem was the new atexit module, rather.
@slender iron did you find out whether you would be around to host the meeting on september 7 (labor day week) or whether we should cancel one?
Jeff sounds like Scott
I can also deal with it.
We'll just have to deal with noise. 🙄
turning synthio off worked 🙂
Finally had a chance to try the @adafruit #wippersnapper beta. Took all of 20 minutes to hook my funhouse LED to an existing feed from an air quality sensor. The LED now lights up when the air quality is poor. No code required! https://t.co/Jy7bY16mdb
Now with flying toasters! The #CircuitPython code for this screensaver is a bit more involved but not much! flap-flap-flap! More info: https://t.co/iSgxpFZSGU
(thx to @carlynorama for the suggestion) https://t.co/oTUlSh57oG
Whipped up a quick little 3D printed test jig for Fibonacci64 Nano, using an Adafruit QT Py, pogo pins, perf board, M2 standoffs, etc. https://t.co/0jzXL811Ms
Protect your passwords (what I use): https://ntck.co/dashlane
🧪🧪Links and Guide: https://ntck.co/3j02oXk
What you might think is just a regular usb flash drive is actually a BAD USB (badusb), a device designed by hackers to hack your computer. In this video, I’m going to show you how to use one and build one with a Raspberry Pi Pico.
----...
CircuitPython recently gained the power to have custom USB descriptors.
With these, we can define a USB HID device that will work with LinuxCNC's
hal_input.
For instance, the Adafruit
Macropad h…
nothing wrong with a long list! kattni does a ton
I do photoshop regularly
ive done some as well, depending what needs to be done with it
You can send me the image and what you need done.
I used to be very much into photoshop (pre CS days), but it's been a while since I've tackled a project with it.
Ok, so for the taco, it's a white outline on a black background. And it's kind of anti-aliased, which is to say the edges are a little fuzzy. It needs to be cleaner than it is, as in the edges need to be clearer, not as "soft".
What is the CircuitPython Code Editor interface?
Will do, thank you!
melissa is actively working to make it much better
@uncut nexus I DM'd you the 🌮
Looks interesting, @gilded cradle!
a walking palindrome 🙂
@idle owl - yep got it thanks!
Threads in the livebroadcast chat might be tough for the broadcaster to keep track of the conversation, as they probably aren't free to click around and catch up on 'more' chats
Discord may not listen , but likely DHS does 😉
while True:
jpeg = cam.capture(jpeg_buffer)
print(f"Captured {len(jpeg)} bytes of jpeg data")
# b2a_base64() appends a trailing newline, which IO does not like
encoded_data = binascii.b2a_base64(jpeg).strip()
print(f"Expanded to {len(encoded_data)} for IO upload")
io.publish(feed_name, encoded_data)
print("Waiting 10s")
Is that reboot something that takes place at a consistent time?--like after the same length of time
Thanks everyone!
Good to be with you!
Thanks all. Thanks for hosting Jeff
You're doing just fine 🙂
Great job, @onyx hinge
A machine that makes tacos out of thin air?
Average time between reboots: 7458 seconds, but there's some error so give or take 50 seconds
Almost exactly once every two hours
Hmm. Sourdough.
👋
Thanks for quick work on this! I will merge assuming it all builds.
I'm going to see if I get a reboot with the co2 sensor disconnected. It'll still send dummy packets to my server using the wifi module. That should at least help reduce the problem space
@solar whale it's shifted 1 byte ```>>> codecs.decode(b"///Y/+AAEEpGSUYAAA==", "base64")
b'\xff\xff\xd8\xff\xe0\x00\x10JFIF\x00\x00'
codecs.decode(b"/9j/4AAQSkZJRgABAA==", "base64")
b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x00'
Ah -- Thank you --that is a huge discovery....
If all else fails -- I can add the 0xff back in by hand!
@lone axle So two things. Adding the other bundle(s) to the Project Bundler isn't going to be much work for Justin, as long as they have the same layouts and include the .json file. Also, I'm going to email intro you to Justin so you can discuss the code - it's apparently well tied into Learn and is gnarly due to 6x/7x support being needed, so extracting it out for the purposes of sharing it between things is not going to happy anytime soon. That said, Justin is happy to discuss it with you so if you'd like to work on something to share between the screenshot maker and Circup, you can at least know what to aim for so that once it's feasible to open up the bundler (once 7x is stable), sharing between all three will be a much easier process. Sound good?
Yep, sounds good to me. Thanks again.
@lone axle Are the other bundles the same, in that, do they have the same features?
@DavePutz Yup, fine with me.
I believe they are. When I started the CircuitPython org bundle I started essentially from a copy of the existing bundle and only changed what was necessary to have different submodules inside of it.
If there are outstanding differences I'm willing to work on normalizing them because I definitely do think it will be easier for all of the tools to work with each of them if they do as much as possible the same.
Great. I'll let you work with Justin then to get the two other bundles added to the Project Bundler, if that works for you.
there is a difference in the convention used to name the repositories/pypi names, but that is not an issue using the json file
the circuitpython org bundle doesn't seem to follow the prefix-circuitpython-library format
Yep that works.
that is true, those libraries don't really have a prefix. I've not looked into it for the Community bundle but I suspect there would be no set rule for those libraries for their pypi names either since they may have all been created differently.
Hmm. I'm not sure what the Project Bundler does, so I don't know whether this will be an issue or not.
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/1bO1IU2lth51Bl0pKTlVy9IYak9HuB7GFfyaRQhFISxs/edit?usp=sharing
CircuitPython Weekly for August 30, 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 the...
We can change anything needed if it pops up as an issue. There aren't many in the org bundle yet, so it would not be such a big hassle to change them now if needed.
Yep. Sounds good.
@onyx hinge Is this the wifi module bug you were referring to? https://github.com/adafruit/circuitpython/issues/5021
I'm inclined to think my issue is related to this, not to the co2 sensor
@ember iris yeah that's the one.
I looked at it for a bit but wasn't able to tease out a cause or fix, didn't get much of anywhere unfortunately.
MP3 playback worked on the Pico. This little speaker is loud.
This is way outside my area of experience, but
When the esp makes a 'connect' call to the router, does is do anything related to the time of the call? Like does it compare it's clock to the routers clock?
This looks super straightforward and I see no reason why we shouldn't add it. Just a couple structural comments.
I'm not sure you need to remove this anywhere. I thought you could re-assign another const pointer.
Please add a comment to document the function.
These three lines should go in shared-modules since they modify object state. shared-bindings shouldn't know about the struct internals.
Running on borrowed time now. The forum post said it failed after "several hours". ```Elapsed: 03:17:19
Data Available!
CO2: 1974 PPM
Temperature: 24.12 degrees C
Humidity: 42.31 % rH
Waiting for new data...```
Thanks for looking into this @mocleiri.
Also, those levels. Oof.
Have they said if they've tried changing power supplies?
I'm not certain. Also, I did not read, they specified 8 hours. Oops. 🤦🏻♀️
It doesn't say anything about trying a different power supply.
So still 5 more hours to be on borrowed time for this issue.
I'll see if my setup fails with no co2 sensor plugged it. If there's no sensor and it doesn't fail, maybe it's related to the co2 sensor. If there's no sensor and it does fail maybe my problem is related to the wireless
@ember iris This isn't the same sensor. This is the SCD-30.
I think I have the forum post, if it's a pi4, then it might be using a pi power supply
which is reliable
I'm using the "official RPi power supply" only because I couldn't find anything else not already in use that was 3A.
Which the Pi 4 apparently needs.
any objection of me merging the PRs that have one build failure due to size? https://github.com/adafruit/circuitpython/pull/5205 for example
No objection.
I don't think so, this question would be much deeper on the underlying TCP/IP. The TCP three-way handshake is a sequence of events. There is a TCP session timeout though which is time-based.
for info about what connect() does, espressif has a great page on the wifi driver incl. a scenario diagram: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-lwip-init-phase
Ok, the only reason I asked, and again, I haven't narrowed the cause of the issue down so I don't know, is because on one of the resets, the time.time() value reset as well, when the rest of the resets didn't experience it. That's not to say that it is related to the time, but if it was the co2 sensor that caused it, I'd expect time.time() to roll over at another random point
looking more at that - the "bad" decode has an extra 0xff prepended.... interesting and I suppose this does point to the core.... I'll take a look at the raw images as well. May be tomorrow before I can do much more, but thank you for the very helpful "nudge"
Additionally, because this issue is pretty predictably once every two hours, I predicted when I'd see it next, and I didn't get the edited code in time. I was 3 minutes too late. So now I have to wait another 2 hours
I don't have the full context of your project's issue and can't help past that question, sorry. let's move this to #help-with-circuitpython (tag me there with the full issue you're having and I'll see if I can help) or the CircuitPython forums
I have some ideas but need to see code
@onyx hinge don't merge 5145 yet, I am waiting to make sure #5206 is ok, and then I will merge against that
@slender iron &^^ (sorry I misread and thought Jeff merged it)
Remove the pixel_luma parameter from displayio_colorconverter_compute_tricolor (Closes #5194)
Not tested, I don't currently have a three colour eInk screen to test with.
@lesamouraipourpre I am cancelling the run for this PR temporarily, so I can get the beta.0 release out and speed up the backlong of builds for the release. I'll re-run this after the release.
@tulip sleet Question. This code. (I can't test it right now because my partner is in a meeting and it is LOUD.) Does this keep repeating the two files over and over, or does it play them each once and stop? ```py
mp3files = ["slow.mp3", "happy.mp3"]
mp3 = open(mp3files[0], "rb")
decoder = audiomp3.MP3Decoder(mp3)
while True:
for filename in mp3files:
decoder.file = open(filename, "rb")
audio.play(decoder)
print("Playing:", filename)
while audio.playing:
pass```
hello friends, how you all doing? I have a question: I've been trying to use the aesio module on my ItsyBitsy M4 but so far no luck (it fails right at the python import statement). If aesio is supported on this board, how do I get it to work? Much appreciated.
I think it loops. If I took it out of the while True: does it play them once each and stop?
right, because the for is inside the while True
So if I take it out of the while True it'll do them once and be done?
yup
Thanks!
aesio is not included on the ItsyBitsy M4; we included it on the boards mentioned here: https://circuitpython.readthedocs.io/en/latest/shared-bindings/aesio/index.html (click the triangle to see the list of boards). We included on nRF boards: that was the original use case.
Perhaps we should include it on more boards. What is your use case?
danh, thank you for you reply. I would like to experiment creating an encrypted file to hold passwords, such that I could send a command from my console (serial) and have the microcontroler "type" the chose option into the host (via hid). Again, it is just an experiment for a proprietary password holder. 🙂
@tulip sleet One more thing: if that could be made available, what I was planning on doing would work even better on the Titano because of that nice display, where the commands could be selected and sent to the python code.
@onyx hinge Are you still around? If not, my question can wait until tomorrow.
@idle owl go ahead
@onyx hinge How would you describe this? ```py
decoder = audiomp3.MP3Decoder(open("slow.mp3", "rb"))
audio.play(decoder)
while audio.playing:
pass```So far I have "Next, you create the decoder object and tell it the name of the MP3 file you'd like to play, in this case, "slow.mp3"." But I don't know how to describe the audio.play() line.
the audio.play line starts actually playing the decoded mp3 on the speaker or headphone
how do you say it about wave files?
Ok, that's what I was feeling, but that felt too simple.
Um... not sure.
That works though.
Thanks, Jeff!
@onyx hinge Ok, one more if you're still around. Otherwise, it, too, can wait until tomorrow.
still conscious
Valid state.
Ok, so this code py mp3 = open(mp3files[0], "rb") decoder = audiomp3.MP3Decoder(mp3) Are you opening the first MP3 file in the list for the purposes of creating the decoder object, which is then used later with decoder.file = open(filename, "rb") to run through the list of filenames?
Or am I not following what's going on there.
Full snippet: ```py
mp3files = ["slow.mp3", "happy.mp3"]
mp3 = open(mp3files[0], "rb")
decoder = audiomp3.MP3Decoder(mp3)
for filename in mp3files:
decoder.file = open(filename, "rb")
audio.play(decoder)
print("Playing:", filename)
while audio.playing:
pass```
yeah, it's a bit of a defect in the API
if you are getting fancy to re-use the decoder object, you still have to construct it with some mp3 file, it doesn't matter which one
then each time before you play you set its file property to the one you actually want to play next
Well in that time it didn't glitch, so my issue is unrelated to the esp32s2
Unexpected! I'll be setting it up that sensor to test it in CircuitPython this week, so I'll keep an eye out for restarts.
I'm going to keep testing as well. Next test is just to plug it back in and see if it happens, followed by swapping the stemma qt plugin I was using, followed by adjusting the time between i2c sensor reads. If I spot anything that might be a 'larger than me' issue I'll keep you posted, but it's probably just a me issue for the time being
Please do keep me posted! I'll let you know if I find anything. I'll be using Feather RP2040 because built-in STEMMA connector makes my life easier, so we'll see if it's cross-port, whatever it is.
I can set it up with an ESP at some point though once I'm done doing my initial testing for the guide.
If I can't narrow it down and if it keeps being buggy when I try a different board that'd be a huge help, but testing on a non-esp is probably best to make sure we're more easily able to pin down exactly what the problem is
FunHouse is ESP with STEMMA, right? I mean I have a million ways to connect things, but I'm lazy 😄
haha I've only got a few, but I've got a soldering iron so I can just make more!
I even have some of those STEMMA to grabby-hands connectors. Used them the other day, so nice.
They went in and out of stock pretty quick I think. Easy enough to make them though if you have the grabby-hands.
Anyway, regardless, I'll give it a test. Up to 6.5 hours/8 on the SCD-30.
So glad I thought to put time code in it. Otherwise it would probably fail over night and I'd have no idea how long it ran.
@tulip sleet Disconnected you from the voice chat.
Relatedly to the CO2 sensors, are you keeping yours within 10 feet of you and at desk level? I noticed if I was next to mine it would read 'dangerously' high, but if I was in the other room it would settle to around 400-700ppm
I am!
I would have to setup data logging to see what happens when I'm not around.
Definitely worth checking, though, thank you.
I'd be willing to be it's way lower over the full room, you're just near it and that's making a locally high reading
I sure hope so, because, oi.
It drops some when the fan is blowing over me/my desk, but still not that much.
Once I'm done testing this for the clock-stretching failure, I'll set it up to data log.
Or I could set up like... the FunHouse with the display, to show the low and the high value.
At least I assume CircuitPython could do that with the appropriate code.
Or maybe I finally use my AIO account for something 😄
Soo many options for fun data 😄
I haven't done enough with data. The most datalogging I've done was this project, and a WHOLE LOT of life happened around it, so I kind of hate the project because of it. https://learn.adafruit.com/data-logging-with-feather-and-circuitpython
I ended up with a ton of data for it though. Including all the buggy data where my freezer was hotter than the sun because of an unsigned int or something 😄
This was after Limor told me to put it in the freezer, but before she subsequently told me not to put it in the freezer because micros don't like freezing temps. The micro and the sensor were fine, it was the code that was unhappy.
Unsigned int in a data log? Yeah that's a true logging project then! That, malformed strings that mess with the parser, etc
Nice 😄
Huh. I haven't thought about testing how the code runs on these at cold temps...
I think for the most part, it's fine, but if you're powering it, maybe unplug it while it warms up when you finally remove it from cold temps. Unless it's gradual, in which case it's fine, but you can end up with condensation. Which is bad. But if left unplugged for a bit, it's fine.
Really, it's probably fine either way, but I think I was pushing the limits of the whole thing putting a little lipo-Feather-sammich in the freezer.
Nothing bad happened, but.... heh.
OK, I need to head out for dinner. Have a good one!
I don't think it needs a test. The compiler would catch any mistakes from removing function arguments. Thanks!
Automated website update for release 7.0.0-beta.0 by Blinka.
New boards:
- morpheans_morphesp-240
- odt_pixelwing_esp32_s2
- ai_thinker_esp_12k_nodemcu
- crumpspace_crumps2
- pimoroni_interstate75
- pimoroni_plasma2040
@slender iron @onyx hinge there is one board whose build is broken due to size, but it's an older version of a low-download-count board. I will fix that post-release.
kk
thanks dan!
I doodled around with ideas to reduce the size of the huffman table in the ja translation, but I don't think there ends up being much gained, or maybe even a net loss.
General idea: Split code points into 8:8 values. Find out the number of distinct upper octets (70 in the case of the ja translation today), and store items as a combination of the lower 8 bits plus an index for the upper bits. In this case, though, only 1 bit per huffman table is saved encoding in this way, but you have to p...
I am getting a "TypeError: function does not take keyword arguments" when using UART.readinto whem specifying nbytes. I then tried passing the parameter nbytes not as a keyword and got the following error: "ValueError: length argument not allowed for this type". I took a look at /circuitpython/shared-bindings/busio/UART.c. I am not sure I understand the code but its not clear whether this is implemented. I am trying to build a generalized set of stream handling functions and found that I had to modify nordic.py to get read_into working. In this case its not clear to me how to work around using python and without recompiling. Any suggestions?
that looks like it is as documented:
https://circuitpython.readthedocs.io/en/latest/shared-bindings/busio/index.html#busio.UART.readinto
Read at most len(buf) bytes
New in CircuitPython 4.0: No length parameter is permitted.
you can use memoryview(buf)[:nbytes] or similar, to pass a view of your target buffer of the desired size
Overall, these save 28 measly bytes on trinket_m0 in en_US, but also make some messages from the REPL translatable.
@onyx hinge ok, thanks, i will try that. @jaunty juniper i just noticed that the first hit on google to read the docs was pointing me to v1...now see that note. thx!
@dhalbert Thanks for your explanation. I understand it clearly now.
So it seems like it's not a bug and I will close this issue.
Thanks everyone.
If I understand correctly this description for the pin parameter is no longer correct. This takes a pin object like board.D13 so it's not a PWMOut object is it?
And the sentence before the parameters could be updated to something like "Create a PulseOut object associated with the given pin."
You're right. the edit was incomplete. I'm doing a minor PR anyway to fix a build, so I'll add a commit for this. thaks!
Two small unrelated fixes:
- Thunderpack_v11 build was too big.
PulseOutdoc update was not quite complete.
Thanks @FoamyGuy for noticing the PulseOut doc issue.
Are you storing the encrypted password and its key on the Titano? Are you sending the encrypted or the plaintext password via HID.
If you are worried about someone looking at CIRCUITPY, you can hide it by turning off the CIRCUITPY drive.
Fix for issue #5091. Changing -Og to -O3 allows RP2040 debug builds to boot and still remain debuggable.
I have a small macropad that has 5 rotary encoders. It appears that CircuitPython has a hardcoded limit of 4 rotary encoders to be setup on the nRF52840. (I use a BlueMicro840).
I created a test program to track the position of all 5 encoders. In the first iteration of the program, I initialize 5 encoders in sequence 1,2,3,4,5 and the 5th one doesn't respond.
In the second iteration, I moved the initializer for encoder ...
CircuitPython doesn't have a limit for the number of rotary encoders.
nRF52840 has a limit of 8 GPIOTE channels, each rotary encoder uses 2 channels and thus a max of 4 encoders can be used.
Leaving this issue open as an error should be raised when we run out of available channels.
thunderpack_v11 build failure is unrelated and is fixed in main.
pca10100 build failure is fixed in main.
LGTM! Thanks @jepler. One comment regarding using %p vs 0x%p.
In CPython 0x%p is preferred for printing object address, I think we should use it instead of %p for consistency.
Other instances I found where just %p is used are in py/objclosure.c and py/objtype.c
Looks like they do tend to use just %p. 0x is added afterwards if not already present.
case 'p':
sprintf(buffer, "%p", va_arg(vargs, void*));
assert(strlen(buffer) < sizeof(buffer));
/* %p is ill-defined: ensure leading 0x. */
if (buffer[1] == 'X')
buffer[1] = 'x';
else if (buffer[1] != 'x') {
memmove(buffer+2, buffer, strlen(buffer)+1);
buffer[0] = '0';
buffer[1] = 'x';
}
WRITE_BYTES(buffer);
break;
...
Closing... fixed in #5210.
That makes sense and explains why performance is much better than in the arduino (Adafruit_nRF52_Arduino) software encoders.
Is there any other functionality that would consume channels as well? i.e. Does the consumption of GPIOTE channels impact other functionality? Take for example alarm.pin? Does that use the GPIOTE or pin SENSE mechanism?
Would there be any chance to add the hardware Quadrature decoder (QDEC) on the nrf52 for the first encoder and switch over to GPIOTE to enable 5 e...
@idle owl After running through that list of changes I did find a few Learn Guide projects that are currently importing _pixelbuf and also a few that have created a PulseOut using the old API that takes a PWMOut object instead of the new one that takes the pin directly. I will be occupied with other things today, but I'll get a PR worked up tomorrow to resolve those.
We've had a lot of discussion of rotaryio in #3875. I found an interesting algorithm, mentioned in that issue, that uses only one interrupt, which would save interrupt channels. We didn't use the QDEC peripheral for the reason you imply, which is that it only supported one encoder.
CircuitPython version
- Adafruit CircuitPython 7.0.0-beta.0 on 2021-08-24; Raspberry Pi Pico with rp2040
- Adafruit CircuitPython 6.3.0 on 2021-06-01; Raspberry Pi Pico with rp2040
(tested on both versions)
Code/REPL
print("Hello, Pi Pico!")
Behavior
I'm working on adding CircuitPython support to my Raspberry Pi Pico simulator on Wokwi.com.
The USB Serial output seems to initialize only after main.py finishes running, so the user can't se...
I think I spoke dismissively about the above-linked algorithm once, but I took the time to actually test it and I think it may be a correct algorithm for quadrature decoding. I believed that any algorithm triggered only by edges from one of A or B had to be wrong, because this particular realization of an A-triggered quadrature decoder is wrong.
There are several differences between the proposed algorithm and mine, including that it i...
The _pixelbuf references should remain until 7 is stable. It was designed to be backwards compatible until 8. adafruit_pixelbuf won't be compatible with 6, so the Learn references are still in place until 7 stable is released. Please proceed with a PR for the PulseOut references. Thanks!
will do, thanks
The behavior you describe does not happen on a real Pi Pico when running CircuitPython. USB is started when code.py starts.
Do you by chance have both a main.py and a code.py? Both are accepted: code.py is preferred for CircuitPython. (The accepted files are code.txt, code.py, main.txt, main.py, searched for in that order.)
Could you describe how you emulate the Pi Pico? Can you trace the USB activity?
Thank you so much for doing this!
@idle owl have you run the scd41 for more than 2 hours with the example code--the loop that check if scd4x.data_ready?
Thanks for the speedy response and for trying to reproduce this on the real Pi Pico!
In this case, I only have main.py (also tried now with code, getting same behavior):
>>> import os
>>> os.listdir('/')
['main.py', 'diagram.json', 'boot_out.txt']
The Pi Pico is emulated using an open source library that I created for the purpose. I can trace USB activity, as well as connect with GDB to debug the CP code that is running inside the simu...
Counting twice as fast may be an issue, especially with encoders that have mechanical detents (clicks). In such case, we would have double-counts per detent. We would need some kind of divider.
@jepler is your new algorithm the same as the one implemented in the arduino nrf52 stack? This is the one I was referring to in my comment above that didn't perform as well as what's curre...
The algorithm I tried implementing was the one @dhalbert linked to, http://www.technoblogy.com/show?1YHJ
So if main.py is an infinite loop, you never see the EP0_IN_BUFFER_CONTROL write?
Both MicroPython and CircuitPython use TinyUSB as the USB stack. CPy calls tud_task() to handle pending USB work in the background. We check for background tasks at safe points in the VM interpreter via RUN_BACKGROUND_TASKS, aka supervisor_run_background_tasks_if_tick(). We see whether at least one 1/1024sec tick has elapsed.
You would probably want to watch for the execution of various routines in `...
Haven't set it up yet. Plan was to do that today. Unrelated to you: The SCD-30 has been running for 23 hours. 🤷🏻♀️
I'd say next to a full day is close enough to say the bug is not repeatable in the scd-30 under the provided information. I'm digging around in the source code for the scd4x to see if I can make a guess as to what's going on with mine, I'll poke around at the scd-30 as well to see if i can find any indication as to what's causing their Remote I/O error
Thanks! Appreciate it. I'll get the SCD-41 up in a little bit here and let it run.
Additionally, I just double checked the low power pull request's command is correct from the datasheet, would you like me to add that note to the review?
Yes please!
@onyx hinge This MP3 code isn't doing what I think it should be.
wait.
Let me try one thing.
Nevermind.
Forgot the MP3 fix wasn't in the last release, and had only tested 1 MP3 until this moment on Pico.
Updated CP and fixed it. Plays two now and doesn't hang.
Was there an bug with gc recently?
that was fixed? not that I remember
Ok, I'll keep poking, then update to the beta release since I'm a few days behind. Just curious if I missed an obvious cause of the problem
Thank you!
Ugh bummer, no strftime in CircuitPython, then?
you would use adafruit_datetime I believe ?
I spoiled myself with using it on RPi.
Oh!
Thanks!
Hmm. We never setup docs for datetime.
CircuitPython version
Adafruit CircuitPython 7.0.0-beta.0 on 2021-08-24; Adafruit Metro M4 Express with samd51j19
Adafruit CircuitPython 7.0.0-beta.0 on 2021-08-24; Adafruit QT Py M0 with samd21e18
Code/REPL
import usb_hid
# fmt: off
# This is only one example of a gamepad descriptor, and may not suit your needs.
GAMEPAD_REPORT_DESCRIPTOR = bytes((
0x05, 0x01, # Usage Page (Generic Desktop Ctrls)
0x09, 0x05, # Usage (Game Pad)
0xA1, 0...
@ember iris Here we go! ```Elapsed: 00:00:34
CO2: 818 ppm
Temperature: 23.2 *C
Humidity: 45.0 %
We'll see if the time math is valid, heh.
Awesome! I think I might actually be hitting a memory error issue, but I'm waiting to see. I've just passed the 2 hour mark and it didn't crash, so now I'm waiting for the free memory to hit 0 to see if it crashes then
I should actually set this up to data log and plug it into a power source instead of my laptop because it'll reboot randomly when things write, I think.
Additionally, if nothing else I'll be able to fork the library and add the single shot sample for the scd41, (but I'm going to have to ask that you test it since I only have the 40) so while I went down a rabbit hole, hopefully I'll be able to have something to show for it 😅
Oh nice! I have no idea how to tell the difference between the chips, so I didn't bother going down that path. That's great! I'm happy to test it.
Well together we have both, so we should be able to figure that out one way or another. I'm hoping it'll throw and error on mine and that'll be how we tell
Oof. Well I'm increasingly confident the issue isn't with the sensor, it was just the sensor was what I was playing with when it happened. So on the plus side we might be able to eliminate that from a concern. I have another hour and 40 minutes before the gc needs to be called, and after that I can write a program to just eat up memory. If I get a reset then, we can be sure that is the cause, then I can upgrade to 7 beta, and try it there and see if it's gone. I just haven't upgrade because I wanted to know 'what' was causing my issue
I'll be honest, I thought the whole mac rebooted, so I didn't think it was the sensor just because I misread it 😅
Is there a way to get issues on all sensors from a specific family, in this case sensirion? (Mild thought with no urgency--I'm still working on the sgp40 voc algorithm and the scd41 single shot made me notice their datasheets are consistent so I might be able to start queuing up some of those issues and seeing if I can't try some of them)
The SCD-30 reset. Crap. It did not error though.
Apparently.
Says 7 minutes elapsed now though. Buffer is too short to see where it reset to 0.
Hmmm
Search https://circuitpython.org/contributing/open-issues but, not really.
Ran to 24 hours at least.
Maybe it resets to 0 at 24!
that would make sense with the way the code is probably written.
I figured, worth a shot but after this I'll poke through them there and just build a personal list
That'll work.
So when it reset, what happened? Did the whole program crash with the I/O error? Or did the sensor value go way off, or did the counter just go back to 0?
No the counter reset to 0. I looked back in the chat here and it was just over an hour ago that I said "23 hours", so I think maybe the counter resets at 24 hours.
I can't view the code without stopping it, but I bet that's the issue.
I don't think it actually reset.
Because it's still running.
But the counter was hours, minutes, seconds. I didn't think about the fact that I should have added days. 😄
Do you have a try/except for the I/O error?
Nope. I wanted it to fail so I had eyes on it actually failing.
This is the basic simpletest code with some time code added to it.
Sweet! I think it was just a rollover of the counter as well
So the scd4x said it needed a low noise power supply, does the scd30 have the same requirements?
No idea!
This is unlikely to be the actual issue
OK, datalogger running, powered from the wall now.
If I was at all savvy, I'd be having it logging to AIO so I could track it remotely.
Alas...
Wait.
Would need a wifi board anyway. This is not one.
So my trusty little red LED will have to do the work for me.
I think we've been focused on the scd30 too specifically: https://raspberrypi.stackexchange.com/questions/89021/how-to-fix-remote-i-o-error-whilst-using-i2c-oled
Hmm.
The clock stretching thing is a legit concern though, as far as I knew.
But it's always clocks, so who knows.
Either way, I have to reply to that forum post saying that it's been running for over 24 hours successfully.
Bleh.
Was genuinely hoping for it to fail.
I was looking for what threw the error and it's not in the scd30's source code. What are the odds their wiring is really long on top of clock stretching? Is it possible to ask for a picture of the wiring setup?
Of course. We do it all the time.
Yeah I've been hoping for my sensor to fail as well. If you can cause a failure, you can fine a solution that should work for them as well
There was no reply to my reply, so I'm imagining this person figured out a workaround or the answer from the other person was sufficient.
I'll reply again, and if you want to reply and ask for a picture of the wiring, that's fine.
Will do, if nothing else it'll be practice for me getting more involved which is a net win to me
Fixes #5213.
@fasteddy516 found that the new usb_hid.Device constructor did not work . I was incorrectly subscripting the C arrays instead of the input arg sequences.
Tested by @fasteddy516.
Any reviewer is fine.
@ember iris Hey, this might be right up your alley: https://forums.adafruit.com/viewtopic.php?f=60&t=182579
BBIAB. Food.
I should be able to help with that one
Great!
Sensor disconnected way earlier than I expected !! D:
But I do think it's tied to memory, so I can just start eating memory to validate that
@ember iris The person on that PR replied about the delay not being necessary. Should I reply and ask them to remove it then?
I find unnecessary delays come back to bite you later when troubleshooting something else and wondering about the delay being there. But if there's a delay on the other one, I guess maybe it's fine to merge it as is?
I was actually about to ask if you should, here's the current reply draft
uint32_t best_numerator = 0;
uint32_t best_denominator = 0;
uint32_t best_error = system_clock;
for (uint32_t denominator = 0xffff; denominator > 0; denominator--) {
uint32_t numerator = (denominator * sample_rate) / system_clock;
uint32_t remainder = (denominator * sample_rate) % system_clock;
For sample rates above around 65536, the math overflows at (denominator * sample_rate)
Personally I'd err on the side of following the datasheet, and not having a delay. But that's just because I usually use datasheets as my mental 'square one' so if I have a bug I can't easily solve, I go back to that to make sure I can follow along with the code.
But you're right, a delay doesn't hurt unless you're doing really time sensitive stuff which I doubt a co2 sensor would be involved in.
Still the sensor reads have a built in delay with
if scd4x.data_ready, so I think it would be safe to remove this delay.As to whether or not to keep the delay in, or remove it, I'm going to have to deffer to someone else here.
It's rambly so I'm editing it, but I'd remove the delay if there's no reason to keep in personally
Because the macropad sine wave contains 100 samples, problems would start at around 65536/100 Hz
I just am getting use to the style of circuit python, what is prioritized over what, so I'm not going to make a call with confidence yet
OK, that sounds good. Clean up the ramble and reply. I wouldn't hedge your bets there though. I think it's fine to definitively request they remove the delay. I can reply after you do and agree.
Understandable. That's why we have a whole team for these things. So there's a variety of viewpoints to help make things clearer in a variety of different ways.
It's super helpful!
So since I have no way to verify what's going on with my sensor, I think I'll set an alarm for 5 hours from when I started running it, and take a look at the data at that point to see if it reset at any point.
@ember iris Ok requested changes on the PR.
@ember iris Also, if you haven't already, please comment on the feature request issue that you're looking into it. Good habit to get into.
You did!
Nevermind
Awesome! I wasn't sure if I should. I'll go and add a comment to the sgp40 feature request then as well
Always! You can always back out of it later if you find it's not your thing, or out of your wheelhouse.
But it means that other folks know someone started it, etc.
SUCCESSFUL FAILURE
IT'S MEMORY RELATED
Ok, I'm going to go start a sourdough loaf and then upgrade to the beta release and see if it's there still
Huzzah!
Excellent on all counts!
After some thought, I would err of the side of a better algorithm as opposed to more encoders. End-users always complain when behavior isn't as expected and appears buggy. Number of encoders being limited by hardware features is easier to "explain away".
I would be completely fine if an exception/error be raised when the number of GPIOTE runs out.
I have been looking at the PWMOut frequency setting, which is pretty grainy at lower frequencies.
@jepler I'd like to help with this. I've been experimenting with this using displayio and my pybadge.
It looks like the DMA will happily update the PWM register faster than the PWM's carrier frequency, but you're right that at higher sample rates maybe not all the samples would actually make it out via PWM
Hi,
I'm currently working on a nRF52840 board as LED controller. The prototype has been assembled. I'd like to have it work with both Circuit Python and Arduino. Would it be possible to receive a VID/PID for this purpose?
Thank you very much!
@tulip sleet The idea is to encrypt a file on the host, then place it on the CIRCUITPY drive. That file would be decrypted by the device firmware (python) after a master password is provided by the user. That's why the Titano would be great because the password could be typed on the screen rather than be sent by a console program to the device. Once the devicce receives the password, it decrypts the file in memory, so CIRCUITPY would never show the decrypted file.
I approved the current change but I haven't tested it--and I only realized after the approval, Should I make an adjustment?
Nah. Datasheet matches and Limor said it LGTH.
Awesome, then I'll test it regardless soon, and I don't see anything else that stands out to me
I'll approve it and merge it.
She probably would have merged it as-was if I hadn't said I would test it.
But I got in before her so she held off. 🙂
Makes sense, I only noticed the added delay because I was hunting down my bug. They're right that the code would definitely work with the added delay, I just didn't know why it was there since I couldn't find a motivation in the datasheet.
I've actually run into troubleshooting other things and wondering why there were delays added to things. So it was a good catch. Because it can cause issues later with something totally unrelated.
So if main.py is an infinite loop, you never see the EP0_IN_BUFFER_CONTROL write?
Correct
You would probably want to watch for the execution of various routines in supervisor/shared/usb.c and tick.c. See usb_background() and usb_irq_handler() in particular
This was a very good pointer, thanks!
So here's what I'm observing:
dcd_init()is called, and registersdcd_rp2040_irq()as IRQ handler for USB.- USB peripheral is enabled, and then the reset sequence happens....
@ember iris So you're pretty confident your resetting issue is memory related and not SCD-4x related?
Exceptionally confident. I can remove the scd4x code and just make it reset on memory alone if you'd like
I mostly wanted to know whether I should leave this running or not. Answer is no. 🙂
I'd say no. I'm about to update to the beta after I reply to the forum question you linked me too, then I'll be able to see if it's a memory issue that's still around.
So go ahead and disconnect it
Right on. Will do.
Now I can see if Arduino works from the IDE version or if I have to do a bunch of nonsense to get the latest version from GitHub.
If it the beta for circuit python solves my boards reset issue, I'll hunt down whatever issue was close between friday night's nightly build, and mondays beta and make note of the problem so we can build confidence in it's solution, but now I'm pretty confident it isn't the sensor in any way.
It ran for 3:53:23 without restarting. 🙂
I think that's plenty of time. I was able to make it shove a giant list into memory, and delete it, and when printing gc.mem_free() I was able to confirm that when it got super low and would normally reset was the same time the board crashed and rebooted. I *recall* (but could be wrong about that) an issue that was marked as closed regarding the call for gc free, so I'm somewhat confident the latest build is free from my issue
Right ok. Makes sense.
It would explain the reason the board didn't reset when I removed the sensor as well, because it didn't occupy the same ram. Additionally it explains why it was so constant with respect to the time it took to reset
Exactly.
@gilded cradle how's the editor coming?
The values steadily dropped over the course of those 4 hours. I forgot to bother to check the values until now. I set it about twice as far away from me on the desk, and the values are about half what they are for the one closer to me. Good call on not trusting those numbers.
The keypad module can be used for MIDI keyboards, and provide velocity sensitivity, with the addition of a millisecond timestamp to the keypad.Event object.
In a recent @jedgarpark livestream, he demo'd a MIDI keyboard using keypad. Like most keybeds, the one demo'd is implemented as two matrices: one for key down, one for key up. The intended use is key velocity, computed by measuring the time between "keypress begin" (key-up matrix 'r...
- Use autoreload for restarting after a write. This gives time for
a follow up command before restarting BLE. - Switch to recursive deletion of directories. This greatly
simplifies deleting directories with contents.
Fixes https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer/issues/7
Adafruit is no longer granting PIDs to folks outside of Adafruit. You can request a PID from https://pid.codes for open source hardware (they have testing pids too) or most chip manufacturers sublicense PIDs. I think Nordic is ok if you use a random PID with their VID.
@idle owl how do I fix this? AttributeError: 'module' object has no attribute 'SPEAKER_SHUTDOWN'
do I just need to update adafruit_macropad?
Oh! I need to submit a PR. Was waiting on the beta. Good catch.
OK I have a local fix for now
This sounds like a TinyUSB issue. dcd_init() shouldn't setup the interrupt handler. That should be left to the client. @hathach thoughts?
CircuitPython intercepts the interrupt so that it can queue up the USB background task. By missing the interrupt, it misses the queued work.
After insisting on making it not backwards compatible because I would fix the only instance of it! I did not. Fixed now though!
@devout jolt you around and free to test funhouse dotstar status for me?
There's a simple fix, that uses 64 bit arithmetic where necessary. But I chose to make a more complex fix, because I also noticed that it could take up to 100ms for the sample rate to be found! The new algorithm is faster (I think it runs in log(max_denominator) time, sort of like gcd) and can also give slightly more accurate results due to comparing the frequencies as floating point instead of integers—it only makes a difference in cases where the sample rate was already being met to withi...
Only supporting one left a white dotstar stranded.
Fixes #5170
@todbot, mind testing for me? I have a Funhouse in the mail but it isn't here yet.
Commenting out the gc.collect() line in network.py of adafruit_circuitpython_portalbase allows the shortened example to work. The longer example still doesn't work. I think there is some interaction with gc.collect() and the network connection.
I tested this with the simple magtag example in adafruit_circuitpython_magtag and added magtag.network.connnect(). It would crash unless I also commented out the gc.collect() in add_text and set_text in __init__.py in `adafruit_...
@tulip sleet @onyx hinge would you mind unassigning yourself from any 7.0.0 issues that you haven't started? that way I can know what I can pick up
@FoamyGuy is this something you ended up taking on or does it still need to be done?
@devout jolt for funhouse
yes
Also, assuming that we find a way to fix or work around the issue, there's still some time between when main.py starts running and USB Serial is up.
This means that the user is not going to see the first few prints, and more importantly, the output in case of a syntax error. I'm wondering if there is anything we can do to delay running main.py until after USB Serial is ready? Perhaps something in boot.py?
@slender iron OK, I just entered a PR for 5092 and checked on the status of #4562, if that's not resolved I can do it next.
and I think that's all that's assigned to me with the 7milestone on it
👍
all dotstars flash yellow four times, the code.py starts
it is 5 dotstars right?
correct. All dotstars are solid white when in REPL. On Ctrl-C, all flash red twice, delay, red twice, delay
that sounds right!
yep looks good to me too
solid white in repl is intended?
yup
dons sunglasses
well, it should be a dim white
thankfully they are dimmed
it sets it once so it only "sticks" with neopixels and dotstars
ok I'm relieved by them being dimmed
looks like it's drawing 10mA for all 5 dotstars (when dim white)
it doesn't expect you to care about battery if in the repl
blinking in the repl is complicated because then you need to share the pins
Anyone have a PR/branch for this? I feel like I've seen one.
What do we need to get it in?
Didn't I change my mind on this because the pins are broken out on pin headers?
like the "pirate" build, I want to see the "tannewt is a monster" build where a loud klaxon goes off semi-periodically every 15 seconds on the piezo while in the REPL to indicate "all is well", all LEDs are on at full brightness, displayio randomly rotates, and all code statements must be prefixed with "please"
morse code
It's coming along pretty good. I have the look about done, but I'm working on the mode switching at the moment. I also need to work on the resizing of the javascript elements (terminal and editor) a little better once I get that done.
kk, nice! I'm excited to try it
🙂
Just to log it here: tested and verified FunHouse dotstars light correctly on startup, code run, REPL, and Ctrl-C code stop.
This keeps the mutex info in the same spot in memory. "Statically
allocating it" with CircuitPython meant that the buffer moved when
the I2C object is moved to keep it alive for a display.
Fixes #4962
Tested and confirmed fixes #4962
Convert from using MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS to using MP_REGISTER_MODULE for displayio, terminalio, and fontio modules.
Related to #5183.
I tested on my pybadge loaded with a test project using the following procedure:
- make clean && make
- copy firmware.uf2 to pybadge
- ensure sure project code works
- refactor module and temporarily comment out MP_REGISTER_MODULE line
- make clean && make
- copy firmware.uf2 to pybadge
- ImportError on pybadge
- uncomment MP_REGISTER_MODULE line
- make clean && make
- copy firmware.uf2 to pybadge
- ensure sure project code works
while you're here, mind removing "(shown by indentation)"? This is not accurate anymore, as the file is automatically indented and any manual indentation is removed.
This looks good, appreciate you diving in. While you're here, can you also correct a doc comment that is inaccurate? you already modified the line it's on.
This looks good, appreciate you diving in. While you're here, can you also correct a doc comment that is inaccurate? you already modified the line it's on.
I unassigned myself from several issues, keeping only #5167 Supplying a larger buffer for RP2040 PWMAudioOut fails, since I worked on this recently. I didn't actually start on this but it's in my brain.
Kk. Thanks!
@jepler I did make these changes in the learn guide at the time that the PR in the Learn Repo was merged.
I believe I got everything updated that needs it. But I am less experienced with ulab (or numpy / scipy) so it may be worth taking a quick look over it to ensure I didn't get anything wrong if you or someone with more experience is up to doing that.
I have had other requests for a timestamp for keypad events for other use cases, and it would be relatively easy to implement this.
I compared limit_denominator() with the Python implementation. I did not try to understand the algorithm, but it looks like an accurate transcription. Does it sound better?
I misunderstood #5092 and was looking at how PWMOut calculates the frequency divisor and top value. It's not that accurate at low frequencies, but I'm not sure it's any worse than other PWMOut impls.
I am not sure this is really fixed completely, but it is better.
Yes, there is a race between main.py and USB coming up. USB is not initialized in the boot.py because you can make changes to USB there.
I do see this race when using tio, which reconnects immediately when it sees that USB is up. A single print("Hello") does not show output after a hard reset, but does after a soft-reload (ctrl-D). We did not see this as an issue before because it was not possible to manually get a connection that fast. However, tio and your simulator reconnect immed...
This implements #5105 but I am not sure of how much space it takes (for small boards), am I doing strings right ?
Additional line in boot_out.txt (there happens to be a boot.py)
Adafruit CircuitPython 7.0.0-beta.0-33-g802ca5425 on 2021-08-25; Raspberry Pi Pico with rp2040
Board ID:raspberry_pi_pico
boot.py output:
board.ID
Adafruit CircuitPython 7.0.0-beta.0-33-g802ca5425 on 2021-08-25; Raspberry Pi Pico with rp2040
>>> import board
>>> board.ID
'raspberry_pi_pic...
This sounds like a TinyUSB issue. dcd_init() shouldn't setup the interrupt handler. That should be left to the client. @hathach thoughts?
CircuitPython intercepts the interrupt so that it can queue up the USB background task. By missing the interrupt, it misses the queued work.
It is originally from raspberry pi team, I remembered we have an discussion with them before pico is released and result in API to get and set irq handler API. It shouldn't be an issue with current implemen...
But I don't see anything in MicroPython that waits for serial to come up either, so I'm not sure why you don't see the problem there. It also does tud_usb_init(), and it does not output anything to USB CDC unless tud_cdc_connected() is true.
With MicroPython I do see that problem, so the default is to use the UART console and not the USB CDC while running in the simulator.
We could wait a short time for tud_cdc_connected() to be true, but we don't really know that it will ever be tr...
Thanks for taking this on @Neradoc. I have one comment regarding doing this as board.ID.
In my opinion board isn't a perfect place for this as it is meant for pins and there can also be a conflict with a pin named ID.
In #5051, @dhalbert suggested doing this in os.uname and that would be my preference as well.
# as a part machine
>>> os.uname()
(sysname='rp2040', nodename='rp2040', release='7.0.0', version='7.0.0-alpha.6 2021-08-12', machine='Adafruit QT Py RP2040 (...
LGTM! Thanks @lesamouraipourpre.
I chose not to add it to uname.machine because it feels wrong to have to parse it to get at the id. In this case, (no regex, promise) machine.split("(")[1].split(")")[0] ? I'd prefer the actual board ID be a clean separate field.
I don't know if machine_id is an option, it's not a C-python thing. Can we extend os.uname like that ?
An alternative mentioned in the original discussion (on circup) would be to replace uname.nodename. On Unix it's supposed to be the "network name" (though...
I'll skim the guide text before closing this up.
Thanks again!
You're most welcome! Happy to contribute and looking forward to contributing more.
This may technically be an incompatible change, as changing the representation in NVS will make the data unreadable by older revisions. I'm going to go ahead and work on this, but we need to consider this wrinkle before deciding if we can still go into 7.0.0 with this change.
(it may be possible to migrate the data forward but that would still make it inaccessible to 6.3)
os.uname is not even present on non-Unix systems (e.g., Windows). The platform module seems to be the preferred place for an OS-independent source of information about the machine you're running on. However, there is no field there for describing the model name of the hardware, which is really what we're looking for, e.g. "Dell Optiplex 5060", or "Circuit Playground Express".
This info is extracted from the BIOS or equivalent on PC's, ...
it feels wrong to have to parse it to get at the id. In this case, (no regex, promise)
I guess we can do something like Adafruit QT Py RP2040 (id: adafruit_qtpy_rp2040) with rp2040 to make it more clear.
I don't know if
machine_idis an option, it's not a C-python thing. Can we extend os.uname like that ?
Good point, I totally forgot the CPython compatibility aspect there.
An alternative mentioned in the original discussion (on circup) would be to replace uname.nodename....
What is the github issue tag for 'issues we need to fix before 7.0 stable'?
its the 7.0.0 milestone
Thank you!
quick q: what is the function for extracting just soc/platform i.e. MICROPY_HW_MCU_NAME like (esp32s2 or rp2040) ?
So I thought I was having the same bug as in https://github.com/adafruit/circuitpython/issues/5021 using a metro exp32-s2 but suddenly I cannot force the bug in any form to occur, and I'm running a direct copy paste of the original program with no changes. Is it worth making a note that after a hard crash and a boot into safety mode, followed by pressing the reset button, I've lost the ability to reproduce the bug using the 7.0 beta?
That should be os.uname().sysname