#circuitpython-dev
1 messages Β· Page 419 of 1
@proven garnet, there is a missing " at the end of the log doc comment
"" instead of """
ok, you merged my fix
@tulip sleet Learn PR merged.
Good catch! I resubmitted because I think it freaked out at base: float = math.e so I just used the literal and did base: float = 2.71828 which is the value.
I think it was the missing "
maybe also math.e.
You can run the doc build in your own repo: go to the top level and do make html.
Ah good call, I'll check it out
adafruit_bus_device is built-in now, no need to freeze it in. The other frozen modules have been put intentionally (in particular the ESP boards with no PSRAM benefit from common modules being in the flash).
@tulip sleet good call, I think if I just define it as e it should be good to go
PYI file seems happy with that
Yeah, exactly, I thought it would freak out like a .py file because e doesn't get a value but since it's a type shed it's fine
I updated all the frozen modules, since that's a good idea in general. This is easy to do, go to the top level of the repo and do make update-frozen-libraries.
Hi, thanks, just some copy-editing in the comments and disabled code.
// Currently I have disabled the setting into wait mode as this impacts lots of different
// X - As mentioned above VAL1 turns off, but it's set to the timing for frequency. so
Don't #if 0 here. You can just remove the bad code. You can include it commented out in the comment above, but we can also always use git to find the old code.
Note the DEBUG_UART pin definitions in mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h. These can be commented out if you don't want a debug UART. That is a way to turn the DEBUG UART on and off.
So then you can use #if defined (CIRCUITPY_DEBUG_UART_RX) as the guard instead of a new preprocessor macro name.
Suggestion re turning debug UART on and off.
I'd suggest that you merge or rebase from upstream. I think your local repo is out of date with respect to what messages are needed, so when you run make translate, you don't get the latest. Note that the line in question is just a comment too.
@FoamyGuy Do you think this is ready to merge?
@FoamyGuy Do you think this is ready to merge?
I do believe so. After the latest round of changes I re-tested the functionality to make sure it's still working as intended, and I also tried with differently sized bitmaps as well as invalid types to ensure that the enforcement of both is working properly.
As far as I can tell it's good to go.
Fixes #4647 by adding all signatures to the stub using @overload
@tulip sleet What are an example of two features of CircuitPython that are essentially Python features? I know we have a few, but I'm looking for a good example of two that are basically Python, but we implemented them in CP. Overall, I also know it's a subset of Python feature, that we don't have everything.
That work like the Python versions work, I think I mean.
longints is a good example of a nice Python features that we have (came from MicroPython)
i mean, kind of the whole language. The q is more like what's omitted and what's not, versus regular Python
Ok
floats -- some tiny languages don't provide floats
Thanks π
This looks OK by me! @jepler do you want to review again?
Hello. Is there much work planned for the micro:bit V2 in the near future? I was looking to use it for some BLE work. I've got further than I thought but I'm running out of internal flash storage space and I don't think the 5x5 LED display is usable? https://forums.adafruit.com/viewtopic.php?f=60&t=189257&p=921555#p921555
Was there anything in particular that inspired the micro:bit V2 port?
it is not a high priority right now. It is interesting because it can use the BLE-only workflow. But now we have the ESP32-C3, which we are making boards for, and that's an in-house product we need a port for
I've started my work on the Adafruit CLUE but the micro:bit V2 is attractive for me because it's very good value and cheap enough to make it an option to give them away.
it would be nice to have a built-in module to drive the LED display on the micro:bit, like I believe there is in Micropython, maybe that could be ported ?
it's a matrix so I believe it requires constant background scanning
Yes, I knew is had some DAL code that did the magic to do the variable brightness display but it didn't occur to me that it might not be present until I started using the V2 board!
do we a have library for that in CP ?
i do not know
the _pew module maybe ?
it's related, not sure it's enabled or been tested on the microbit
@tulip sleet @jaunty juniper Thanks for the status. I'll continue with the CLUE for now and check back in a month or two to see if anything has happened with BLE in MicroPython or CircuitPython for microbit: V2
BTW, what are the ADCs like on the ESP32-C3? Espressif don't seem to excel in this area...
There are still some bugs, but the basics work. test program toggles between two different "slow pwm" modes each time a char comes in on usb.
import supervisor
import array
import board
import rp2pio
import adafruit_pioasm
import touchio
import sys
t = touchio.TouchIn(board.D4)
# SOS, sort of
a = array.array('H', [0x8080, 0x8080] * 4)
b = array.array('H', [0x2020, 0x2020] * 4)
delay = 1
text_program = f"""
out x 8 [{delay}]
set pins 0 [{delay}]
wait_hi:
...
Thanks for noticing this redundancy!
I did not know about @overload -- very nice!
Sounds good, I uploaded change that checked for either the RX or TX pin.
I verified that if I build for imxrt1060_evk the code is built in and if I build for example: teensy40 which does
not have these defines, it does not include this code and UART4 works fine and all of the logical serial ports
on the Teensy can talk to each other.
// TODO: Switch this to using DEBUG_UART.
This TODO is now done.
I thought I needed to delete a comment, but apparently not.
Anyway, thanks for these fixes!
Any reason why the circuitpython Github Actions would randomly cancel? It was mid-running mine but says it was cancelled. I didn't push any code or anything.
Someone else cancelled it?
Or something weird happened on GitHub's end.

Oh, does PR approval cancel checks in the core?
Just trying to figure out if I should fix anything haha
Which PR? The one I seem from you seems to be running now (or queued at least)
I cancelled the builds that were just doc fixes. I don't see a reason to re-run all the builds just for those.
We have a backlog of merges, and we don't need to spend hours of CPU on things that we know will pass
ooooh got it, thanks!
I ended up pushing an empty commit because I figured it was a fluke, so you may want to cancel again
Thanks!
Thanks @prplz !
For future me, when I get to this: Scott talks about Creation ID on the Deep Dive
https://github.com/adafruit/deep-dive-notes/search?q=creation+id
OK, down to the final set of nits! Thanks for persevering. I changed the style on the error message, and have only a couple of other minor q's.
This looks like some kind of leftover. Just remove?
mp_raise_msg(&mp_type_NotImplementedError,translate("frequency is read-only for this board"));
This test is not exactly for the given frequencies, since the / 1000000 is truncating division. E.g. 24123456 will work for 24 MHz. Is that OK with you?
Not sure how to PR over to what seems to be the commit CircuitPython is using, but I submitted https://github.com/v923z/micropython-ulab/pull/522 to the base repo for this.
Fixes #5763 with the fix suggested by @neradoc by adding docs/templates to conf.py. Building locally, it removes the "View page source" so this should be the fix!
I have reproduced this in a small ESP-IDF example. It is related to clock frequency, and can be ameliorated by a small delay in the ESP-IDF code at a crucial spot.
https://github.com/espressif/esp-idf/issues/8770#issuecomment-1103416705
Awaiting further comments in the ESP-IDF issue.
Incorporated and getting ready to push
No really should be integer value otherwise the test is going to be off - will have to fix that. Guess thats another one of those // divisions
OK, this looks good; thanks for spending time on it!
RIght, I didn't mean it was wrong, just that it accepts inexact frequencies and truncates them to the nearest valid frequency.
The single CI failure is unrelated: it's an atmel-samd board whose build is too big.
Wow - thank you now maybe will look at the stm32
Can someone weigh in on the memory usage aspect of this PR? There's a lot of adafruit_register objects being added, not all of which are used yet, and I don't know the typical use case for this library and whether concern over usage by smaller memory boards is (ever) a priority. I also don't immediately know how much memory adafruit_register objects take but could find that out with testing, but if anyone has an opinion please chime in: https://github.com/adafruit/Adafruit_CircuitPython_EMC2101/pull/23
in my experience the whole inheritance mechanism is pretty heavy memory-wise, because it basically creates an instance of every subclass
This puts us out of space on at least one board.
Error: Build sparkfun_redboard_turbo for ru took 32.53s and failed
make: Entering directory '/home/runner/work/circuitpython/circuitpython/ports/atmel-samd'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
253728 bytes used, -32 bytes free in flash firmware space out of 253696 bytes (247.75kB).
12056 bytes used, 20712 bytes free in ram for stack and heap out of 32768 bytes (32.0k...
@idle owl Looks like maybe you didn't create the meeting doc for next week. If you're stretched for time, let me know and I'll do it.
@ZodiusInfuser one use case for this is better support for the Pimoroni servo board! can you check it out and give some feedback? My implementation of 'pulsle group' based on your code is at https://gist.github.com/jepler/5043843c9c196ad9d513e9f89e48ba79 including a little servo-style demo. Once this is added to CircuitPython, we hope you'd be able to adapt your lib to have full functionality with CircuitPython.
Some logic captures of 'servo-like activity':
-
start times can be staggered

-
start times can be synchronized

-
or they can even be arbitrary

-
If...
"stretched for time" doesn't seem like the right idiom. is it "strapped for time"? π€
I did not. If you could, that would be great. I have it on my list but I kept bumping it. π
Also, what @stuck elbow said.
It's "strapped" as far as I know.
Here is the notes document for next Mondayβs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youβll be attending the meeting - itβs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weβll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1KoigCOGgfnroj0dEE6fgADNeK31mamWpfUOPwzU9TBQ/edit?usp=sharing
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...
Has this been fixed? It looks like the CODE OF CONDUCT now links to an online page (HTML) instead of 404'ing. Or am I misunderstanding?
In the context of Espressif port, does all of Circuitpython run as a single task? But there are interrupts and priorities of various aspects of CircuitPython operation somehow... juggling REPL, USB file operations, chip GPIO and peripherals, etc.? For example, when saving a file to CIRCUITPY, UART gets disrupted. Where do these parts of the code live (task management, interrupts, priorities)?
@jepler Thanks for tagging me! This looks pretty cool, and would be great to have such functionality within CircuitPython!
My time is pretty limited for the next few weeks, so not sure if I will get chance to look at it in detail before next month. From a cursory glance though it seems your PulseGroup has a fair chunk of the functionality of my PWMCluster. It's funny how simple Python makes some of the code, like that one line sort π .
Some logic captures of 'servo-like activity':...
Thanks @ZodiusInfuser ! If there's nothing that stands out as "obviously too broken to build on" we'll keep moving forward on this PR.
Is it possible for it to auto switch to a new sequence after it has finished the first? To overcome some of the glitches I experienced, I ended up having PWMCluster generate an entry sequence and a looping sequence. The DMA would load in the entry sequence, and then if no new sequence was provided by the user, it would switch to the looping sequence then repeatedly do that. This entry sequence let the system finish off any outstanding pulses cleanly and start the new ones the user que...
Oh, another thing. I don't know if CircuitPython already handles PIO cleanup nicely already, but I had many headaches getting it working for the PWMCluster. Ended up discovering a bug with DMA's an in-flight interrupts. https://github.com/pimoroni/pimoroni-pico/blob/7dd1c608619a363a2b531d38a9e5dbc813a8ea6f/drivers/pwm/pwm_cluster.cpp#L151
Hi, I am trying to convince a Nintendo Switch and "Game Builder Garage" that my MacroPad is a mouse (right now a 1D mouse done with the rotary encoder). My code works on a PC, but the Switch detect nothing (but it works with a real mouse). I removed everything I could: Mass storage, CDC Serial, Midi, and Customer_Control and Keyboard from USB_HID. But still not working. I am running out of idea on why the Switch does not like my "Mouse". Any idea? https://github.com/dglaude/CircuitPython_Switch_Mouse_Emulation
as is, there's no way to guarantee a sequence plays at most once, but if you call the start_continuous_write signal again before the sequence is done that's what will happen. Of course, a GC pause or something else could leap out at just the wrong moment and gnaw your face off..
My only guess somewhat of a long-shot I think but I've seen weirder things I guess... Maybe the switch has an internal allow-list of PID / VIDs for supported mice? If possible you could try spoofing the same ones that your working mouse uses to see if the switch recognizes the macropad if it presents those IDs instead of it's own.
Thanks but I don't believe it can be that, it works with any random mouse in the world, or they block Adafruit PID but that would be bad practice. There is already Arduino code to do what I want, but I wanted to avoid C.
Since it was marked over as MIMXRT and that part was resolved by PR: #6261
We can close this one
For my Wemos board, I need a Creator ID.
Since I'm not the Wemos company, I'm not 100% sure how to proceed so I wanted to verify my plan.
I was thinking we could treat it like Espressif, in that is is managed from the https://github.com/creationid/ organization.
So my assumed steps are that I would make a new entry in https://github.com/creationid/creators
And the link would be to a wemos-creations repo in the creationid organization and in that repo I'd make an entry for the Wemos Lolin C3 Mini.
Does that sound like the correct approach?
There is a main circuitpython_task, running at priority 1. There is also a priority 5 (on ESP, higher has higher priority) task that services USB interrupts. There is "core affinity" so that the ESP-IDF wifi code will run on the second core, if it is present.
I doubt that. But it could be that we have composite HID device, and it doesn't like that, though then it wouldn't work with combo keyboard/mouse things, like a wireless keyboard/mouse
if your mouse device descriptor is unusual, it might not like it
the order of devices may matter too
@proven garnet FYI I pushed an empty commit to one of your Adabot patch draft PRs to test how to push to an existing PR, because I can never remember, and was trying to teach someone else. In case you find it later and wonder why.
I think it is the composite. AFAIK Nintendo Switch only accept wired keyboard and mouse. I know keyboard is required for "Fuze4" and mouse is an option for "Game Builder Garage". But I don't have composite device to try that. Right now I switched to testing the mouse_abs as I do have some I2C drawing tablet (uDraw for the Wii) and I would like improve my mouse emulation. Maybe I will learn enough to try to make an alternate mouse under adafruit_hid that is not in the composite. I was hoping that by removing Keyboard and Customer_Control it would be simple enough for the Switch to accept it.
thanks, @tulip sleet, USB interrupts would include drive access and keyboard (control-C)? so if a control-C doesn't take effect quickly, could it be that interrupts are temporarily disabled by some deep esp-idf wifi code (particularly on single-core)?
It's any US B activity. But it could be that it's being blocked by single-core wifi. If you have an example, an issue would be welcome to document it
thanks, I'll pay more attention to it to see if I can discern a pattern, the control-C delays are not very often
Sounds good! Thanks for letting me know, you saved me a wild goose chase haha

I'm wondering if a different API is better. `def background_write(*buffers: ReadableBuffer, loop=Optional[ReadableBuffer]): ...
This would 'play' each positional argument buffer exactly once, and then play the loop kwarg buffer forever, if given. If no loop, then it would stop instead of looping anything.
This change would be to enable the use case where a special 'transitional' output needs to be played just once, to do with a change in PWM duty cycle that crosses the buffer wrap p...
busio was having a default timeout for clock stretching of 255 microseconds but cannot change it, so instead we discovered that bigbangio accepts the timeout parameter. Since TIC max clock stretching is 1.5ms we set the timeout to 1500us.
@errant grail I'm not sure what the error was with the PR, but note that the bundle tool picks the latest release for each repo, you need a release in your repo to work with the bundle, with a version tag following the Semver rules (x.y.z mostly)
(Also, ideally you would submit a PR from a branch, to make it easier to deal with git stuff)
I get the feeling this is a Scott thing so I opened a PR and will wait.
@idle owl which NeoPxiel strip was it that did not work with my test UF2? Was it part number 4560?
Um....
Let me check.
it was one of the flexy separated ones
No, that one worked
I think it was these https://www.adafruit.com/product/5225
We have allΒ sorts of LED strips for a wide range of needs.Β ChonkyΒ strips? We got those!Β Strips with alligator clipsΒ that are easy-peasy to MakeCode? Oh definitely. ...
ok, I have that in my pile here, not tested yet, thanks
Thanks. Good to know. Iβm not multi-git-lingual yet, use Github desktop/web and not command line git.
This looks good to me. @xuhow, could you now also prepare a PR for https://github.com/adafruit/circuitpython-org, to add a description and photos?
Yes, I just submitted this PR
@onyx hinge could you take a look at https://forums.adafruit.com/viewtopic.php?f=60&t=189312, re MP3 looping issues in 7.2.5? Thanks.
@tulip sleet tested and replied this time, after I dropped the ball once.
it works for me, but I used different mp3 files and skipped the "responding to button presses" part
@lone axle Do you have a moment? I have a cookiecutter question. Or rather I'm looking at it, and it looks like a thing generates a certain way, but I want verification.
yep, whatcha seeing?
Ok, in the README that's generated for the libraries (https://github.com/adafruit/cookiecutter-adafruit-circuitpython/blob/main/{{ cookiecutter and 'tmp_repo' }}/README.rst) am I seeing right that the Discord badge is included in every possible library type you can generate?
I want to change it to the Adafruit Discord custom badge I had made, but I'm not sure Community libs would want that.
This is the badge block with the line of code before and after it: ```{% endif %}
.. image:: https://img.shields.io/discord/327254708534116352.svg
:target: https://adafru.it/discord
:alt: Discord
.. image:: https://github.com/{{ full_repo_name }}/workflows/Build%20CI/badge.svg
:target: https://github.com/{{ full_repo_name }}/actions
:alt: Build Status
.. image:: https://img.shields.io/badge/code style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black
{% if cookiecutter.library_description != "" %}```
Which implies to me that it's included regardless.
I'm not sure community libraries would want even the current chat badge.
That does look correct to me. currently the badge is included for all types, and it's the same for all of them.
Hmm ok.
I want to update the badge to this: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/main/badges/adafruit_discord.svg
Which maybe isn't right for Community libraries.
So you'll want something like:
{%- if cookiecutter.target_bundle == 'Adafruit' %}
# [new badge image and url]
{%- else %}
# [current badge image and url]
{% endif %}
yep your welcome, I can test it out and review later on tonight if no one beats me to it today.
Appreciate it!
Badge and ignore is the new "whatever and chill".
@idle wharf Are you also around here?
@lone axle Patrick suggested a fix for an issue in my PR, but I'm unclear on the execution of it. Do you understand? https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/181#issuecomment-1105684863
Right now it's {%- if cookiecutter.target_bundle == 'Adafruit' %} .. image:: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/main/badges/adafruit_discord.svg {%- else %} .. image:: https://img.shields.io/discord/327254708534116352.svg {% endif %}
I get that it needs more - somewhere, but that section has multiple ways of doing that.
Ahhh yeah. The hyphens are the way to tell it to not put newlines in the finished render. I'm still a little unclear on the difference between hyphen in the opening "tag" and the one in the closing tag. Honestly for all the ones I've done I just did a bit of guess and check. When I pasted the code earlier I just copied the start of a different if statement assuming it would need to be the same. But it looks like I grabbed it from a place that didn't need to cut out as many spaces.
Ah bleh. Ok. I'll see if I can get Patrick to b a little more explicit. Because I don't want to keep pushing to the PR for folks to test repeatedly.
My top two guesses are either {%- at the beginning of the endif or -%} at the end of the else. Or possibly both, but I'm not certain.
I think I'm more confident in the beginning of the endif
Ok, I'll ping Patrick with that idea and see if it's what he's thinking.
So I have something that needs to be done. But it's tedious. And requires a Circuit Playground Bluefruit (which are out of stock if you don't already have one).
Fortunately, I do have one! (Took a minute to find it though)
Nice! Ok.
I have a PyCon2019 repo with examples in it. And they should all work on the CPB, even though they were written for the CPX. I need them all tested so I can copy them over to the new PyCon2022 repo, or update them as needed when copying them over. Big difference is, you need to manually load libraries onto the CPB, they're not all built in.
Like I said, it's tedious, and I absolutely understand if you're not interested π
That shouldn't be an issue, I can get started on it tomorrow morning if that's ok
Sure! That would be fine. Let me get you links to the two directories.
Oof it's still on master. Should fix that.
Not right now though. Too much else going on.
The IR example, if there is one, which it looks like there is, will not work.
There's always time to do it later on π
There's no IR on the Bluefruit.
It's going to bug me.
Fixing it now.
So the links I posted will be wrong, switch them to main
Noted! I can test on the CPX as well, just for parity (and my own sanity if I hit an issue)
Which version of circuit python would you like me to test for?
Perfect, I'll get those loaded up and ready to go, and thanks for fixing the links as well
Great, I really appreciate this. So much to do, and this is equally important.
Not a problem, it's the perfect project for me right now
If you have the accessories needed for these (a potentiometer you can connect to a CPB, a servo you can connect to a CPB, and an alligator clip NeoPixel Strip), you could test them as well. Let me know if you can't, and I'll shove it into my schedule since I plan to have all of that with me for folks to try at the Open Spaces. https://github.com/adafruit/PyCon2019/tree/main/Accessory_Examples
I'll dig those out, I have all of those, plus the ability to power them if the board can't source it so I should* be able to test it
Amazing. Thank you so much!
I am around. I read the thread.
Anyway, I put suggested changes into your PR which are my best guess.
I've not done a lot of cookicutter in a while. So testing it will be your best strategy.
I saw! Thank you! Submitting the suggestion now.
Updated!
Issue #4452. In stm32_peripherals_rtc_set_alarm(), if the STM chip has a high-speed crystal, the value of rtc_clock_frequency is 32000. The SubSeconds calculation in line 185, however, will overflow whenever (raw_ticks % TICK_DIVISOR) is > 1000. The multiplication by 32 will give a value > rtc_clock_frequency. Since alarm.AlarmTime.SubSeconds is an unsigned 32-bit int, the result will wrap around and the sub-seconds time calculation will be very incorrect. The fix is to adjust the calculatio...
@lone axle This is the PR - Patrick helped on it, so if you could do a final test, that would be great. Whenever you have time is fine! https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/181
took a look and tested all 3 bundle types, all looks good to me. Left a review and merged.
I am looking to change some of the clock configuration for the SAME51 for and external clock. If I wanted to change a config in this file "circuitpython/ports/atmel-samd/asf4_conf/same51/hpl_osc32kctrl_config.h" can that value be overwritten somewhere else, or do I need to edit this file before I build?
In circuitpython.org here on the open pull requests list. Where / how does site.data.libraries.pull_requests get populated? https://github.com/adafruit/circuitpython-org/blob/d7485d0039ad444433ef16be27ec9e16761e62cc/contributing/pull_requests.html#L13
This page in the jekyll docs talks of it coming from the _data folder, and there are some json files in there, but seemingly nothing related to pull requests. When I build/run the site locally it's showing the most up to date info on this page so I know its fetching it but can't figure from where, or where it gets stored.
Ah, I may have found it actually. The configuration makes it load from here it looks like: https://github.com/adafruit/circuitpython-org/blob/d7485d0039ad444433ef16be27ec9e16761e62cc/_config.yml#L40-L42
And it seems maybe the PR portion of that json file may get generated by this https://github.com/adafruit/adabot/blob/main/adabot/update_cp_org_libraries.py#L81-L113 I tried running it locally but I seem to have hit the github rate limit rather quickly. Is there some way to raise it? Does adabot wait for an hour regularly during running to get it to reset?
I think it's authenticated as me when when I run locally? I've put an access token into env.sh for it at least, and when I check the rate limit for foamyguy it shows 0 remaining for ~1 hour. It shows I only used 60
curl -I https://api.github.com/users/foamyguy
# ...
x-ratelimit-limit: 60
x-ratelimit-remaining: 0
x-ratelimit-reset: 1650599111
x-ratelimit-resource: core
x-ratelimit-used: 60
yeah that's your limit from your PC, not the limit of the user you are pointing to
unauthentified is 60, authentified is 5000
you need an ADABOT_GITHUB_ACCESS_TOKEN in the environement
at least I think, that might be only for adabot to push stuff
let me see if I have notes from when I worked on adabot
okay, thank you. I've got that in env.sh but I guess it's not being utilized when I run it atm. Bedtime for me but I'll tinker with it more tomorrow. I may just need to let that execute or source it or something before starting.
hmmm
here is what I have in my notes about how I ran my tests
ADABOT_GITHUB_ACCESS_TOKEN=ghp_BLANKEDOUTTHATSMYTOKENDONTLOOK GITHUB_ACTOR=Neradoc python3 -m adabot.circuitpython_libraries --output_file _test_final.txt --print 2
(as I was testing a fix in that module)
CircuitPython version
From tip of `master` yesterday.
Code/REPL
None.
Behavior
Building the mpy-cross program using MinGW, fails in the last link-step:
LINK mpy-cross.static.exe
x86_64-w64-mingw32-gcc -o mpy-cross.static.exe
...
x86_64-w64-mingw32-gcc.exe: error: f:gvVC_2019VCToolsMSVC14.29.30133libx86: No such file or directory
/usr/bin/sh: f:gvVC_2019VCToolsMSVC14.29.30133AtlMfclibx86: command not found
/usr/bin/sh: f:ProgramFile...
From tip of
masteryesterday.
Did you mean main? master is defunct.
We do build on Windows as part of our CI checks with MSYS, see here: https://github.com/adafruit/circuitpython/blob/main/.github/workflows/ports_windows.yml
Is there something different with what you are doing?
We do build on Windows as part of our CI checks with MSYS,
MSYS does not normally use (or need) a LIB env-var, does it? Like I wrote LIB is a MSVC (+Borland, Watcom) thing.
Try adding a MAKEFLAGS += --warn-undefined-variables to py/mkenv.mk.
Then watch all the warnings. In a CI job a warning: undefined variable 'LIB' would probably show up.
But not here; it's a legitimate env-var for other compilers.
I saw the email - thanks so much!
@KurtE
Been playing around with different processor and SD Cards. And it seems some SD cards will work and some not. I have been using 3 different SD Cards for testing
- Samsung 64GB Ultra
- Samsung 32GB EVO
- Transcend 8GB premium.
- Adafruit SPI Flash SD Card (yep picked one up)
The 64GB worked without an issue, for the 32GB card had to increase the timeout in the SD lib to 400 from 200 and then it worked. The 8GB had a problem with-didn't want to work. The Flash SD Card o...
I think I pulled in all of the changes. requested on this last review.
@onyx hinge Your flashing script will be tested today or this weekend, finally. Also converted to something that runs on Windows potentially because my housemate is joining the flashing party.
Okay, the fix should be merged into master for 8.0.0!
@idle owl good luck! If it doesn't work feel free to ping me, I'll help if I can
I have Rose and Brian who will insist on helping, so you're off the hook for this one. Thank you for writing up the script, though. Even if it doesn't work, it's still a solid place to start. Really appreciate it!
Also stumbled upon 9 more CPBs. Tossing them into the pile! π
Thanks - you can "Add suggestion to batch", and then consolidate them in one single commit.
I think this should go away too?
Just __WFI();, is that right?
Hi!
On my nucleo-f446re board from ST, I've been trying to add support for resetting the MCU in DFU mode.
Because circuitpython does not yet support this board, I decided to give it a shot and try running it on this board.
I've managed to execute the 'REPL' from a serial console so far.
My local fork has a change that adds support for the board: https://github.com/flom84/circuitpython/commit/8bc5752e1f647f6ffe74a287becdbf303fbc2079.
I also implemented reset to DFU mode once I had...
I did the change as requested...
Warning, my email system is having some issues right now so not sure how long before messages make it through.
Thanks again
Ran into this issue while working on a PIO driver for the HX711 load cell amplifier.
It sends out 24 bits at a time and Python's built-in types don't offer anything to map to that properly. Based on a quick read of the docs I figured I could just throw a 3-element bytearray() into readinto() and it'd retrieve RX FIFO data in 24-bit chunks, 8 bits at a time. That resulted in some really weird output that didn't match what was on the wire and didn't seem to have a discernable pattern.
...
The old formulation
- could cause an
- wouldn't work if there were ID3 tags at the end
- would choose whether to background-refill the inbuf
based on a check before skipping to the next sync word, which
could be incorrect.
I think point3 triggered point 1, leading to the EOF
problem fixed in the first commit. This would depend on specific data
sizes and offsets occuring in the file such that a read would be
scheduled but then the buffer would be filled and left 100% full ...
so there was a real problem, not sure how this user had the luck to trigger it with all their mp3 files though
Same encoding across the board for them?
Though seems like someone else would have run into it too at some point.
you never know how many people just gave up and did something else
Changes look fine, but I did not test. If you want a test I would need an mp3 file to try it on.
Attachment has affected mp3s (I tested with 1.mp3): https://forums.adafruit.com/download/file.php?id=92072
forum thread: https://forums.adafruit.com/viewtopic.php?f=60&t=189312
Valid point. Hope it wasn't many and this user simply hit the failure jackpot.
- could cause an
missing words?
@proven garnet I think plan to revisit the two draft PRs you created after PyCon, and we'll get them sorted out then. I let Eva know that they were out there, and she'd likely be doing the patching, but I do still want to see if you can do an Adabot patch too. Anyway, FYI. No action needed on your part.
@idle owl I just noticed that while the new discord badge does appear correctly on github, unfortunately it doesn't load correct on RTD
I think one way to fix it is use this URL for the SVG instead:
https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
I did check the github one when I tested the cookiecutter change, but didn't think to try RTD, assumed it would be the same. π
Oof. Sigh. Ok.
Can you test it on the TestRepo?
It has RTD set up.
I did test that raw. URL with a local built sphinx page and it does seem to resolve it.
Yep, I can PR it to the TestRepo too.
Ok that would be good, simply to be sure.
I'll have Eva do it - she had to run a patch script locally, Adabot couldn't handle it.
But only when she has time again. Might have to deal with this for a bit.
Hi @tulip sleet, it I manadged to make the mouse being detected by the Nintendo Switch by creating a custom USB-HID descriptor not using "composite" and just describing a mouse. I am still very confused on why and how it work. It is a bit black magic to me as I did not modify the mouse code from the library. Also I copy/pasted a descriptor, but I cannot say I understand every byte of it. Here is a the code, maybe you want to give a look: https://github.com/dglaude/Wii_uDraw_for_Nintendo_Switch
If it works, that is great. It's hard to get descriptors right, so congratulations!
Did a bit of reconfiguring of the STM32F405 so tested the following
- Only a SD card reader (Adafruit SDIO/SPI Card Reader) was attached on pin 10 and the STM32F405 was able to read the 64GB card.
- attached a SPI SD flash breakout where the SD Card was connected to the Flash SD and then to the STM and only the sd Flash card was able to read. The SD Card reader show "No SD Card"
Yes I am running without only the _WFI(). The setting the processor to
kCLOCK_ModeWait sets the process into the low power mode as was mentioned
earlier in issue, And since we are not setting into
this mode we don't need to then set it back into normal run mode. There is
only one other place that calls SetMode and it already set it into run mode.
Sorry about not knowing the ways of the review system to know that the
different changes could be batched.
If you want I could git rebas...
Did a bit of reconfiguring of the STM32F405 so tested the following
- Only a SD card reader (Adafruit SDIO/SPI Card Reader) was attached on pin 10 and the STM32F405 was able to read the 64GB card.
- attached a SPI SD flash breakout where the SD Card was connected to the Flash SD and then to the STM and only the sd Flash card was able to read. The SD Card reader show "No SD Card"
UPDATE: Got it working when I put the SD Card first then the sd flash breakout
Hav...
Have you had any luck with two SPI SD flash breakouts working?
Haven't tried 2 yet. Still have to solder up the second breakout board I got.
Sounds like a plan!
@idle owl I got a bit interested in trying out the badge change using git submodule foreach It does correctly update the badge URL in all of the repos in the bundle and I believe it could commit/push the change as well though I haven't done that yet. next week or whenever you'd like later on we could run this on a small subset of libraries, double check that it works okay and then run it against the full list. I pushed what I came up with here: https://github.com/FoamyGuy/bundle_change_discord_badge
I keep meaning to order some of these, but as I have said before (broken record) I can not order direct from Adafruit... Won't ship to PO or PMB...
Looked at Amazon, but price was considerably higher and delivery slow.... So next options are Digikey/Mouser...
CircuitPython version
CircuitPython 7.2.0 on AiThinker ESP32-S3-32S dev kit
https://circuitpython.org/board/espressif_esp32s3_devkitc_1_n8/
https://docs.ai-thinker.com/_media/esp32/docs/nodemcu-esp-s3-32s-kit_v1.0.0specification.pdf
Using Thonny
Code/REPL
import board
import displayio
import adafruit_displayio_ssd1306
i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_addredd=0x3C)
Behavior
%Run -c $EDITOR_CONTENT
Trac...
board.I2C() is a shortcut for the default I2C pins on the board, as defined usually by the silkscreen.
That board does not have default I2C pins, so you gotta chose your pins and use busio.
For example if you were using IO1 and IO2:
import board
import busio
i2c = busio.I2C(scl=board.IO1, sda=board.IO2)
Also, I believe we don't have a build of Circuitpython for that AI Thinker S3, you are using the build for this Espressif board ?
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html
hmmmm I can't repeat it but I got a board into a state where pioasm_txuart would just send the absolutely shortest pulses. it may be related to my work in https://github.com/adafruit/circuitpython/pull/6300 the branch I was in at the time. I've failed to reproduce it, so not filing an issue π
Nice one.
But, here, there is no mention of this you typed:
https://learn.adafruit.com/monochrome-oled-breakouts/circuitpython-usage
By importing busio and with help(busio) I can see I2C class. This should be written on the page I mention.
Yes I know this is not for the AiThinker board. This is the closest to this dev kit. If you need me to try something for you with this board, please do.
I will try OLED and let you know if it works.
The board module has LED_DATA but it should probably be using the standard name NEOPIXEL.
I ended up adding support for one 'once' buffer and one 'loop' buffer. this covers the glitch-free pwm case, and also the simplest case of non-looping background writing.
I2C SSD1306 OLED works like a charm with AiThinker ESP32-S3-32S dev kit and espressif_esp32s3_devkitc_1_n8 7.2.0 BIN.
Note: so far digikey and mouser don't have them and/or in stock... Will check a few others
@DanWill7 @KurtE @anecdata
Have you had any luck with two SPI SD flash breakouts working?
So I soldered up another of Flash SD Cards so I am now using 2 of the Flash SD Cards seems like ONLY ONE CAN BE USED AT A TIME. I tried this with 3 separate processors - QTPY RP2040, Teensy 4.1 and a STM32F405. Unfortunately don't have any other Adafruit boards to test with so maybe some else can.
All this is a bit of an update. I rewickered the script to trap the error and continue just in case to:
import os
import busio
import digitalio
import board
import storage
import adafruit_sdcard
import time
# This helper function will print the contents of the SD
def print_directory(path, tabs=0):
for file in os.listdir(path):
stats = os.stat(path + "/" + file)
filesize = stats[6]
isdir = stats[0] & 0x4000
if filesize < 1000:
...
Same problem here, on 2 different new boards, same boot loader info, same model
I didn't find a function for screen rotation, font size, etc. Can someone put some light here?
Thank you.
Original reporter says this fixes their mp3 files: https://forums.adafruit.com/viewtopic.php?f=60&t=189312&p=922186&e=922186
I wonder if it would be worth it to add some instrumentation in the SD Code base to get more clues on where it is failing...
But for now maybe, just note that it does not appear to work, with multiple devices.
I'm thinking about making a thin "adapter" pcb, to replace the square display on the hallowing with this
Cool. I like the display FPC breakout youβve got.
it's very useful
Just a few months ago I realized that there is no standard for display pin outs. Strange but I guess thatβs how it is.
For 'how do I' questions, please use our forums or discord, thanks!
https://github.com/adafruit/circuitpython/issues/6304 I feel this should simply be closed up (it's misconfiguration that isn't worth the trouble of diagnosing, and anyway it's inherited from micropython) but I'm having trouble writing a nice polite message to go with the closure. π
Hi everyone, just wondering could you please update this tutorial : ) I am new in circuitpython dev and I just want to implement my own module in C so that it can run faster. https://learn.adafruit.com/extending-circuitpython/overview
If board.NEOPIXEL is the convention, and the appropriate name for multiple LEDs (rather than board.NEOPIXELS), then this sounds fine to change. I went with LED_DATA because it's more generic and matches the pin name on the schematic. This by extension means our C++, MicroPython, and CircuitPython board definitions are consistent.
Let me know whichever way, as we'll have other board hopefully launching this week with a similar setup that I'm yet to raise the PR for.
Not sure did I miss any changes here?
Also not sure if I can now combine (git rebase -i HEAD~3 and combine changes as they show both of us on the changes?
If you want I could git rebase -I . several of them back into one commit and then push it up?
We don't really care about merging commits for "cleaner" commits. It's too easy to make a mistake.
This looks fine as is. I was just asking to confirm your intentions. The advantage of the __WFI() is that on many processors it does reduce power consumption somewhat (to 1/3 or by 1/3, I forget which). It is not a deep sleep but it saves power.
@onyx hinge did you want to re-review https://github.com/adafruit/circuitpython/pull/6270 or shall we merge it?
@dhalbert - side comments/information... I am not sure if you are interested or not, but have had some conversation up on MicroPython PR about maybe trying to preserve the File systems between program updates... As with the latest Teensy 4.x firmware, which the current released Teensy app will update your boards to, Only updates parts of the Flash memory.
More details on Paul's security page: https://www.pjrc.com/teensy/td_code_security.html
Also the conversation continued over from...
Preserving CIRCUITPY is the behavior we would want to have. It sounds like as long as the filesystem started on a 64kB boundary, the bootloader would do the right thing? We can await more info on this.
Preserving CIRCUITPY is the behavior we would want to have. It sounds like as long as the filesystem started on a 64kB boundary, the bootloader would do the right thing? We can await more info on this.
As shown on the code security page I linked to, with the new bootloader the first 512kb will always be erased, unless you are running with security mode (files encrypted) only those who have the key file can upload... in that case always the first 1mb is erased. Table on that page shows...
Another idea is to add TinyUF2 as a resident bootloader in addition to the Teensy one. It's already implemented for i.MX.
https://github.com/adafruit/tinyuf2
Let's open a new issue about Teensy bootloader support if you would like to handle that in CircuitPython.
@gilded cradle hey. planning any blinka releases soon? wanting to get this fix released, but also not super urgent, so can coordinate with some other release
https://github.com/adafruit/Adafruit_Blinka/pull/577
@tidal kiln I wasn't planning on it, but feel free to do a new release if you need it.
ok. thanks. might make one real quick. just to get that fix out.
@tulip sleet would you be available to do the 'core' section of the state of circuitpython?
sure
Thanks!
<@&356864093652516868> in about 80 minutes we'll have our weekly meeting. Please add your notes to https://docs.google.com/document/d/1KoigCOGgfnroj0dEE6fgADNeK31mamWpfUOPwzU9TBQ/edit?usp=sharing - I can't wait to catch up with everybody!
CircuitPython Weekly for April 25, 2022 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, ...
As I mentioned in the comments for #6287, the latest version of the Teensy 4.x bootloader chips is now setup to not erase the full flash chip, but instead will always erase the first 512kb for normal Teensy boards or 1MB if the teensy board was purchased with the ability to download encrypted images and have the board locked such that only the person with the lock key file, can reprogram it.
Note: If your program is > 512KB the program code will erase more 64KB chunks.
Also note: that ru...
Thanks!
@lone axle I keep forgetting to ask: Can the tabLayout touch response and tab highlighting be generalized to make a βradio buttonβ widget?
Interesting thought. There are probably a bunch of parts of it that could be removed for use in that fashion. But the core technique used for tracking "currently selected" state and changing between sprites to visually differentiate could probably re-used for that.
Also worth noting, 100+ USB cables, even short ones, weigh A LOT.
thanks folks!
Thanks all!
Thanks, everyone! Super bummed I wonβt be able to meet those that are going to PyConβ¦but hopefully next year!
CircuitPython version
Adafruit CircuitPython 7.3.0-beta.1-23-g0642917cf-dirty on 2022-04-25; SparkFun Teensy MicroMod Processor with IMXRT1062DVL6A
Code/REPL
Adafruit CircuitPython 7.3.0-beta.1-23-g0642917cf-dirty on 2022-04-25; SparkFun Teensy MicroMod Processor with IMXRT1062DVL6A
>>> import board, busio
>>> uart1 = busio.UART(board.TX1, board.RX1, rs485_dir=board.D2)
Behavior
uart_construct: tx:0x6007e45c rx:0x6007e480 rts:0x0 cts:0x0 rs485:...
π see y'all!
The new driver class should be useful when ladyada releases her version of the NAU7802 breakout board.
For sure!
import time
import board
import bitbangio
from adafruit_lc709203f import LC709203F, PackSize
# Create sensor object, using the board's default I2C bus.
# battery_monitor = LC709203F(board.I2C())
i2c = bitbangio.I2C(board.SCL, board.SDA, timeout=1000000)
battery_monitor = LC709203F(i2c)
# Update to match the mAh of your battery for more accurate readings.
# Can be MAH100, MAH200, MAH400, MAH500, MAH1000, MAH2000, MAH3000.
# Choose the closest match. Include "PackSize." before it, as shown.
battery_monitor.pack_size = PackSize.MAH400
while True:
print("Battery Percent: {:.2f} %".format(battery_monitor.cell_percent))
print("Battery Voltage: {:.2f} V".format(battery_monitor.cell_voltage))
time.sleep(2)
File "code.py", line 9, in <module>
File "adafruit_lc709203f.py", line 119, in __init__
File "adafruit_lc709203f.py", line 164, in power_mode
File "adafruit_lc709203f.py", line 247, in _write_word
OSError: [Errno 5] Input/output error```
CircuitPython version
Adafruit CircuitPython 7.3.0-beta.1 on 2022-04-07; Adafruit Feather ESP32S2 with ESP32S2
Code/REPL
import time
import board
import bitbangio
from adafruit_lc709203f import LC709203F, PackSize
i2c = bitbangio.I2C(board.SCL, board.SDA, frequency=250000, timeout=1000000)
battery_monitor = LC709203F(i2c)
battery_monitor.pack_size = PackSize.MAH400
while True:
print("Battery Percent: {:.2f} %".format(battery_monitor.cell_p...
@tulip sleet Bug filed. ^^
How would you like notes on changes needed and if it does or does not work?
Yes please! That would be amazing.
Or if you're up for submitting the fixed examples, you could submit them to the PyCon 2022 repo. I haven't pushed the empty directories yet, but I can do that now. Completely up to you though! The CPlibrary example would all have to be renamed from cpx* to cp*, so maybe it's more work than I thought. Notes would be excellent!
I'm just writing a script to handle all cpx to cpb type changes, and well as to prebuild the code.py and put the needed libraries into lib so it shouldn't be too much work. I just wanted to know how to make notes about what does and does not work ahead of running it all π
Oh I reread your message. π€¦π»ββοΈ A gist would work? Or a Google doc? Whatever works for you that you can share with me.
Sounds good! And I can make pull requests for all of the needed cpx->cpb fixes so you don't have worry about finding those yourself
https://docs.google.com/document/d/1QEMJLYwOVee_Bi0MKcS4SW5jKSc5SA0rr14YBfRhjRQ/edit?usp=sharing Here is the notes document for next Mondayβs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youβll be attending the meeting - itβs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weβll read them off during the meeting. Hope to see you there! <@&356864093652516868>
CircuitPython Weekly for May 1, 2022 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 ...
Amazing. Please leave the PyCon2019 repo as is though. I'm pushing the directories now to the PyCon2022 repo, and that's where I'd like to see the updated examples.
@ember iris https://github.com/kattni/PyCon2022
Quick notes on this:
So far it looks like it is not implemented or working on other ports as well including (RP2040, STM32F05)
Does appear like it is implemented on ESP32
@tulip sleet Looking at the CircuitPython repo, is this basically when it started? Short of clicking through endless pages of commits to get to the beginning anyway. https://github.com/adafruit/circuitpython/commits/0.8.0
I guess this is specifically the beginning of CircuitPython? https://github.com/adafruit/circuitpython/commit/25ae844d555b489eebd1ca3e80cc34f67182e205
it's a process
That's fair.
Looking in Scott's repo, the earliest commit I find is
Oh, nice. Ok.
before that we were using MicroPython on ESP8266, etc.
Ah fair enough. That makes sense.
so there were a number of waypoints, as deshipu mentions
I don't even know if it makes sense to include any of this in my talk, but I wanted to make sure my comment about when the community started wasn't wrong. I had to alter it a bit to make it not wrong. π
I didn't know what to search for to find the beginning of it.
I found when Discord was created.
0.8.0 does look like the fork
But we were on Gitter before that.
Adafruit had articles on compiling MicroPython and such even before that
I got paid to write some drivers for featherwings
so Adafruit was sponsoring development even then
Ah yeah ok
https://forums.adafruit.com/viewtopic.php?f=57&t=98919 <-- I think this is my earliest involvement
@stuck elbow I'm going backwards in gitter and you are there before that. It's slow going backwards.
sure, but that was just talking :)
Hah
Now I feel like I need to give a talk where all of this is relevant. Kind of neat info.
start of gitter: https://gitter.im/adafruit/circuitpython?at=586feab0af6b364a293b8237
I felt like it was reading the old stuff off unspun-up disks or magtape or something
tbh I'm not sure it's so interesting
I think as reference points to other things, it might be.
Not so much standalone as dry info.
can't believe it was just a few years back, feels like a different era
I forget that I joined that early on. It felt already established by the time I joined the community, but hardly.
2 BC β before covid
Yeah that's a valid new system.
Covid is the reason I really joined - so I'll count that as a positive
Well, we're happy to have you. π
Thanks and I'm happy to be here, win win π
in Poland we say "nie ma tego zΕego co by na dobre nie wyszΕo" β there is no evil that wouldn't eventually lead to something good
That's brilliant.
Not so great at internalising that, personally. But that's a me-issue.
a happy ending is just a question of picking a good moment ;-)
I'm not sure anyone is great at internalizing that
Hah. Well played.
Making a lot of progress on this talk, at least. Which makes sense, I'm coming down to the deadline. Leaving things like this until the last minute is basically my jam. π
Granted I do my best work at the last minute most of the time, but I don't enjoy the panic scramble.
whens it due? I'm avoiding an article I said I'd write by Wednesday π
Nice. I feel seen. I have a bunch more prep to do for PyCon, flight out is on Wednesday, and the talk is to be presented on Thursday at 11am. I still need to talk through it to make sure it fits in the timeslot, and make slides out of this script outline I'm currently writing. So........
Good luck! I know what that's like for sure
Thanks. Appreciate it.
Testing six kinds of neopixels
Way to be efficient!
I should have done this days ago. Unplugging and plugging was a drag
Are you numb to LEDs yet with all that testing? π
I usually write them on the plane on the way there...
faster than 0.5 seconds flash is too fast
Yeah, I'm not certain that the final draft won't end up that way.
oh, the final draft happens while waiting for my turn in the room
That sounds like I used to deal with everything, but I've been trying to be a little better about it. My keynote at PyOhio 2019 was finalised after 9pm in the hotel room. It was presented at 9am, so no time to work on it before that in the room.
but I was thinking about bringing the digitizer with me, and drawing the slides live during the talk next time
Hah! That would be a feat.
it's not as hard as it seems, I did that with a whiteboard when I had a talk but couldn't speak due to sick throat
I haven't had to give a convention talk but I remember my friend's wedding speech was roughly planned at 2am in my hotel room oops.
people were guessing what the slide means, it was pretty fun
Pretty much this.
Sounds like it!
it was a 20-person conference though
I've heard pycon has grown a little bit bigger than that
Heh, yeah, this is not that.
Well... it's likely to be somewhat underattended this year, as folks are still transitioning from COVID. But it was something like 3500 in 2019, which was the last in-person event they had until this year.
this is a keynote?
Not even close. Heh.
phew
There's a 1-day Education Summit before the conference, and I'm giving a short talk for that.
I have a friend giving a keynote there this year
So it's not even a conference talk.
Keynoting in 2019 was rough. I feel for your friend.
Εukasz Langa
say hello from me if you see him ;-)
Oh I will, if I end up chatting with him, anyway.
we used to go to pycons and europythons together, then he got involved in python core dev more, and I went with micropython
Ah fair enough.
Is your first name enough, or do I need to figure out how to pronounce your last name too? Because I've never heard it said, only read it.
I take saying hi from arbitrary people to other arbitrary people very seriously. π
mi first name or my nick should be enough, though my last name doesn't have anything hard to pronounce, it's just long
Ah ok. So it sounds like it looks then?
yes
Good to know! I haven't been wrong this whole time then.
do-pie-ral-ski
If only DHL would take delivery this seriously, I might have received the PCB I ordered earlier this month by now π
Hah! DHL to Canada is excellent. DHL w/in the US, not so much.
I had a syllable twisted up. Cleared that up.
I know a small amount about a number of other languages, enough to know vowel sounds in a number of others.
whtever, "deshipu" will work
Hah ok π
@ZodiusInfuser you can add an alias for NEOPIXEL - please submit a PR :)
Reworked NeoPixel timings for a number of ports.
Fixes #5505.
Fixes #4102.
Tested with:
- https://www.adafruit.com/product/1426 - Stick of 8 NeoPixels
- https://www.adafruit.com/product/3919 - strip of 20
- https://www.adafruit.com/product/5225 - "Fairylight" slim strand of 20; WS2811-ish, according to mfr
- https://www.adafruit.com/product/1260 - Float RGB Smart NeoPixel Version 2; 6 pin WS2812
- https://www.adafruit.com/product/4560 - Soft Flexible Wire strand
- SeeedStudio WS281...
closed in favor of #6312
Didn't have time to test on any h/w but looked at all the timings in the code. The PIO code I'm most familiar with and looks good to me. The other ports I have done less work with but everything looked right to me matching the timings you are suggesting. But I would defer to someone who has more experience with those ports. If no one is available I can take a closer look later this week if required.
feather_m0_supersized build failure is fixed in #6308 (just a size issue).
@PaintYourDragon probably of interest to you
CircuitPython version
CircuitPython 7.2.5
Code/REPL
git clone https://github.com/adafruit/circuitpython.git
cd circuitpython/mpy-cross
make
Behavior
Traceback (most recent call last):
File "../py/makeqstrdata.py", line 29, in
import huffman
ModuleNotFoundError: No module named 'huffman'
make: *** [build/genhdr/qstrdefs.enum.h] Error 1
make: *** Deleting file `build/genhdr/qstrdefs.enum.h'
### Description
After cloning `http...
According to the information in read the docs, pull up/down and None appear to be included now. Iβll test and confirm that it works with the listed sensors.
Prompt review will be highly appreciated!
Please refer to https://learn.adafruit.com/building-circuitpython/build-circuitpython on how to build CircuitPython. In this case you are missing make fetch-submodules.
huffman is a Python module you need to install via pip3 install requirements-dev.txt. But @deshipu is right: you need to follow the recipe in https://learn.adafruit.com/building-circuitpython/build-circuitpython, as there are a number of steps to prepare your environment. The steps have changed over the years, including recently.
Let me know if you spot any issues. Hoping to launch at the end of the week.
Also I included a NEOPIXEL alias as this was highlighted as missing on Servo 2040 (#6307)
I did also consider including constant tuples for the motor and encoder pairs, as I recently discovered they could be done in MicroPython, but this seemed a bit experimental to include in these CircuitPython definitions.
const mp_rom_obj_tuple_t motor2040_encoderA_pins = {
{&mp_type_tuple}, 2, { MP_ROM_INT(1), M...
I did also consider including constant tuples for the motor and encoder pairs
You could do that, as you did here: https://github.com/adafruit/circuitpython/pull/6208#issuecomment-1081903198. The main issue is to make sure that if a static object has pointers to heap objects, that those pointers are included in garbage collection.
The single build failure is only a size issue, fixed as part of another PR.
I didn't do any testing, but in particular the RP2040 changes look like they do what they say.
Thanks. I'm a bit pushed for time at the moment, so if I do add those tuples it's unlikely to be for this PR
CircuitPlayground (Express & Bluefruit), PyGamer, and PyBadge at least have multiple neopixels attached to board.NEOPIXEL, that's not a problem.
Hijacking this a little bit, we have tools/huffman as a git submodule but also list huffman in requirements-dev.txt. We should do one or the other, but not both...
Looks fine! I had a query/suggestion.
If there is going to be a library you (almost) always use with this board, you might consider putting constant like these and NUM_MOTORS in the library rather than casting them in stone.
Ah okay. There's no specific library for this board at the moment, I was just going to use the existing motor,encoder,neopixel etc libraries, as my time is stretched pretty thin with supporting C++ and Micropython. Something to consider for the future though.
For your reference, another case of putting a tuple of things in the board module, in this case a sequence of pins defining parallel bus:
STATIC const mp_rom_obj_tuple_t camera_data_tuple = {
{&mp_type_tuple},
8,
{
MP_ROM_PTR(&pin_GPIO13),
MP_ROM_PTR(&pin_GPIO15),
MP_ROM_PTR(&pin_GPIO16),
MP_ROM_PTR(&pin_GPIO14),
MP_ROM_PTR(&pin_GPIO12),
MP_ROM_PTR(&pin_GPIO10),
MP_ROM_PTR(&pin_GPIO9),
MP_ROM_PTR(&p...
Thanks for that @jepler. Which file is that in, for reference?
@onyx hinge I will test the multi-servo example; I can just use your example in the PR with a lotta servos, does that make sense?
was going to use a Pi Pico for pin simplicity
@tulip sleet yes the example should work changing the servo count & first pin. the pins have to be consecutive.
I set it at 18 since that's what's on the servo 2040 board
I need to revisit the example a bit to make the spacing exactly what Limor suggested, 2.5ms apart instead of 20ms / servo count apart
the intent of the demo is just to move all motors in a sinusoidal wave, but each motor gets a different phase of the wave
oops meant to leave the reference in the comment: https://github.com/adafruit/circuitpython/blob/bf2fd536d62de2046f11c1bae9807e1fd7f44d88/ports/espressif/boards/adafruit_esp32s2_camera/pins.c#L5
A great addition! I tested this with the gist example, and I get random movement of servos, as expected. The examples use start_continuous_write() instead of the newer name background_write().
Thank you. Itβs difficult to find the correct cookbook to follow.
whoops, I thought I'd updated the PR in adafruit_pioasm. I'll double check. Thanks for the merge!
Per #6313, there are two references to huffman, and there should be only one.
If this builds, it's good to merge. Thanks!
@tulip sleet were you using the example from https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/pull/41 and found it was outdated, or what?
Example to accompany new functionality in
adafruit/circuitpython#6300
wait for that code to be merged before merging this example!
No, I was using the ones listed in the PR: in the Details fold-out
I didn't know there were any in the library
it's easy to miss
there was a gist, and a pasted-in example
I marked https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/pull/41 as ready for review.
Example to accompany new functionality in
adafruit/circuitpython#6300
wait for that code to be merged before merging this example!
oops except I didn't make the change limor wanted yet
back in a bit π
Notes to self and questions on how to best code stuff within CircuitPython.
Side comment: I still wonder why the writes are synchronous. They don't appear to be with MicroPython, and my quick look at PySerial, shows methods like: flush() and out_waiting()...
I guess the next question is, is it worth implementing? That is logically if the busio code is running synchronous, do you gain anything by using this option versus adding your own set of the value of the direction pin around th...
Could you add a little white space to the images to get them to an aspect ratio as detailed here: https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/preparing-the-images. 450 pixels high for the large image and 225 for the smaller will work great.
Thanks - I was meaning to do this.
Fixed by #869, I believe.
Making this a draft so it's not merged before https://github.com/adafruit/circuitpython/pull/6037 is done.
@tulip sleet appreciate the reviews & merges today, thanks
I miss them sometimes, yw
we want to mimic pyserial's behavior so if you implement non-blocking write, please mimic the API as well!
https://stackoverflow.com/questions/25424056/pyserial-non-blocking-write
It still points to /unknown, but that's the best we can do on this side with the limitations of liquid and jekyll needing to build the site pages ahead of time. I think the best solution would be to have stubs generated along with the _data/files.json as @tannewt suggested.
we want to mimic pyserial's behavior so if you implement non-blocking write, please mimic the API as well! https://stackoverflow.com/questions/25424056/pyserial-non-blocking-write
I will be honest and say again I am not a python developer. Nor had great experiences with PySerial... But maybe it has improved since then.
I was looking at the documents at: https://pyserial.readthedocs.io/en/latest/pyserial_api.html#serial.Serial.write
And saw that it then had methods for flush() and...
Note: I see the issue on rs485_dir has shown up through bot, but my main first question to try some stuff out is, suppose that in this function for MIMXRT port we have:
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
const mcu_pin_obj_t *tx, const mcu_pin_obj_t *rx,
const mcu_pin_obj_t *rts, const mcu_pin_obj_t *cts,
const mcu_pin_obj_t *rs485_dir, bool rs485_invert,
uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop,
mp_float_t timeout, uint16_t receiver_buffer_size, byte *receiver_buffer,
bool sigint_enabled) {
Now suppose for the rs485_dir parameter, I would like to implement the code as logically a DigitalIO pin, Is there a preferred way to do this? Or do it under the covers and call off to set the IOMUX settings for digital... And then set the appropriate registers?
it is an actual Pin object, not a DigitalInOut.
you can use the HAL or use raw registers, whatever makes sense. We do both in various implementations. It depends on how helpful the HAL is.
Unless explicitly labelled otherwise (like audio playing), writes to various I/O devices are blocking in CircuitPython. We don't have non-blocking writes in the sense of writes happening the background for UART, I2C, SPI, etc.
We are thinking about non-blocking I/O operations using async/await and asyncio. This provides a nice framework for handling completion, etc., as opposed to explicit polling of completion.
(While composing this, I thought I would test and describe pyserial's behav...
Merging this now, since it keeps getting interrupted, and it looks like it's going to work.
A stray space is causing pre-commit to fail.
Let's make this a little more useful and update frozen libraries.
Any idea how to make Sphinx link to the libraries RTD pages ?
Should the frozen libraries be listed separately from the built-in ones or visually differentiated in some way ?
@Neradoc, would you like to address these before approval?
The frozen modules could be listed after the native modules, something like "Included (frozen) Python modules", or each one could be neopixel (Python module), or something like that.
@tulip sleet are you prepping for a beta ? I'll look at the matrix PR again today or tomorrow, and probably do a circuitpython.org PR to show the frozen modules in a separate list there too (I think they should be separated to explicitly indicate which can be updated from CIRCUITPY)
I am thinking of a beta, but maybe later today. But for this it doesn't matter, because the documentation is /latest and will be updated even without a beta.
(or maybe I'm wrong, but I thought the merge PR's updated RTD latest)
no but it matters for circuitpython.org, the list of modules currently displayed there is the same as the matrix (same code generates it), I don't think there's any harm in having a beta suddenly showing adafruit_circuitplayground and friends in the list, but to display them separated there's some changes both in CP and CP-org needed
good to coordinate, I agree. I am starting on beta.2 and will probably release in a few hours when all the builds have finished.
@onyx hinge I am going to do 7.3.0-beta.2 in a few hours, since it's been about 3 weeks since the last beta. One more merge and then final builds.
@tulip sleet that's awesome. I was thinking of asking
At least I went with stable for the 90 CPBs. π
not a bad idea π
if you need a release during PyCon, happy to do one to make life easiser.
7.3.0 is pretty stable, but I'd be quite bummed if I flashed beta 1, and then you released beta 2. π
Unless I find something that needs to be fixed, I can't imagine needing a release. But I will definitely let you know if there's a reason for one. Thanks!
I just had a panic moment wondering if my code actually worked on 7.2.5, but then I remembered that the CircuitPlayground library isn't frozen into CPB, so the updates to the lib are on the board. π€¦π»ββοΈ
that's a relief. Are you demoing PyLeap, or if not you may want to do supervisor.disable_ble_workflow() in boot.py.
I'm not demoing PyLeap, only bringing along kit to test if needed. The boards are already flashed, so it is what it is at this point π
So I guess if someone's around while testing, I'll show it off. Heh
if people have trouble with BLE, that would be an amelioration that might help. Or you can show it as "coming soon"
Hmm. I don't have any BLE examples even. Though we never really solved the issue with multiple boards in the same room sorting out who is connecting to what. Only sort of solution is for the instructor to do the bit of code that tells you the board's BLE name, and write it on the back of the board before there are 30 of them trying to connect.
I'm not doing that 90 times.
agree with that!
Wait, you don't have to do that ahead of time, because the name gets printed to your serial console.
Hmm. Maybe I should add a BLE example. Low priority at this point, but worth considering I suppose.
Not even sure what I would have it do.
are you giving away these boards, or just lending?
Eventually giving away, but I need to hang onto them through the conference so the final Open Space is still doable.
So probably giving away on Sunday. Or a couple before that.
I don't need 90 CPBs. π
i think maybe best demo is something using the BLE Connect app that controls NeoPixels, sounds, etc.
Fair enough. I wasn't sure whether we were still promoting that.
it's still very useful, and kind of general purpose, at least the button stuff and neopixel stuff is. The data goes the wrong way for other things, though
The UART example is really simple, too
but not so flashy
@idle owl could you reapprove https://github.com/adafruit/circuitpython/pull/6316#pullrequestreview-953856974 ? Thanks - a minor build fix I had tried to add in a translation PR did not get in.
Sure!
thanks!
([more info] is a link to https://docs.circuitpython.org/en/latest/docs/reference/glossary.html?highlight=frozen#term-frozen-module though a guide explaining more (like how to update it by putting a newer version in CIRCUITPY) might be better)
I can see to it that something gets put together. But not until after PyCon.
Looks good though! I like it.
https://gist.github.com/KeithTheEE/a5867fefd0c37ca4781cbb84cceed84a
Here's what I tested, with some changes here and there, everything but the IR and the sound_meter file worked.
To make the examples and their changes easier to follow, how would you like me to go about making the changes and pull requests? I was thinking of forking this: https://github.com/kattni/PyCon2022
add/committing the original files, making the changes and add/committing the changed files (that way the updates are easier to follow)
For from adafruit_circuitplayground.express import cpx must be changed to from adafruit_circuitplayground.bluefruit import cpb all the code should be updated to from adafruit_circuitplayground import cp. And then use cp for all of the code bits.
That is exactly what I was hoping for. Forking it and submitting a PR.
Touch "A7" on the CPB is "TX". It was actually changed in the library overall, so that's what it should be now, though I think we made Express backwards compatible.
As for the audio content from 2019, don't worry about including it. The names are different for 2022 because I talked JP into making new sound clips for me. π
The colors for the potentiometer and NeoPixel strips are still accurate - using the same hardware as last year for that. I apparently didn't give away my fancy soldered up potentiometers.
You can substitute TX for A7 wherever it's found. But I don't mind the pins being changed up for the accessory examples. As long as everything can be connected, I'm happy with it.
@ember iris I don't think the audio imports need to be try / except since these examples are meant to be CPB specific.
If that's what you were thinking.
Is there a A0 equivalent?
Hmm. D12 apparently, according to the CircuitPython pin definition. I think moving to another pin is ok in that case. It's primarily known as board.AUDIO but that's kind of confusing to use for general use, imo.
I vaguely remember that maybe connecting a servo, NeoPixel strip, and potentiometer required all GPIO, but that doesn't make sense as each thing only has one "data" pin.
So eliminating A0 is fine.
I couldn't import audioio on my board--I've never used it so I don't know if I was doing it wrong.
To get it to play tones, I added a try except block:
from audiocore import RawSample
try:
from audiocore import WaveFile
except ImportError:
from audioio import WaveFile
try:
from audiocore import RawSample
except ImportError:
from audioio import RawSample
try:
from audioio import AudioOut
except ImportError:
try:
from audiopwmio import PWMAudioOut as AudioOut
except ImportError:
pass # not always supported by every board!
(this is every import, individual examples being somewhat pared down) This was able to get the wav/tone examples to work
No, nRF doesn't use audioio. That's not a you-problem.
CPB only supports: audiobusio, audiocore, audiomixer, audiomp3, audiopwmio
So you don't need the audioio fallback.
no analog out on the NRF
Ah fair enough. Explains the lack of A0 I guess.
Wait, stupid question: that doesn't mean a potentiometer won't work right, does it?
Given that, for the examples that used audioio, should I adjust them to just use the bare minimum: from audiocore import RawSample or should I keep the try except structure so the demo code can run on both the express and bluefruit?
oright. π€¦π»ββοΈ
Nah, let's break it for Express and make it CPB-specific π
Bare minimum is easier to understand for now.
I won't have any CPX's with me.
And you can remove sound meter. I had forgotten we never ended up dealing with that due to differing opinions on the solution.
Also IR. Because no IR.
Good catch on sound meter.
And how would you like me to change the wav files to match JPs new sound effects?
Oh! OK, choose either space.wav or think.wav for the single-wav playback demos, and choose them both for the button wav demos that require two. Was that all of them? I don't see more looking through the file list, but I'm might be missing something. Not sure what the other wav files in the PyCon2019/audio directory were used for, if they were used at all.
If there's one for touch to playback wav files, use the 1-7 wav files in that case.
Tones played on pin touch, and two 'whoop' sounds played on the two buttons
really easy to change them, but I wasn't sure if you had a favorite sound you wanted
Yeah use 1-7 for touch.
I'm happy with all three new ones. So really ring space and think are all good for button or direct playback.
Awesome! I'll try to make sure they all get some fun use!
JP's been saving me from listening to the same sounds year after year for a while now. Appreciate that so much.
I haven't heard the new sounds yet so I'm lowkey excited to make these changes and hear them π
Nice! Have fun with that. They're fun sounds. Crunchy numbers 1-7 were recorded by him too π
What day are you going to be going through these demos by the way?
Starting Thursday.
Mini-sprint at the Education Summit will be the same content as the Open Spaces at the conference proper.
Thursday afternoon to be specific. But I also want to be able to download the repo to a USB drive before that in case conference WiFi is a disaster.
Which means really early Thursday morning at the latest so I can get it on hotel WiFi.
I should have all the code downloadable shortly today, and I'll redownload it and retest it to make sure I'm testing everything from the right repo after that.
For thursday I probably won't be as available as I'd like in the morning, but I should be pingable in the event of weird code issue in the afternoon.
Ok, I'm not worried about that. I can fix things on the fly if needed. Wouldn't be the first time.
Thanks so much for all the work you put into this!
Also PyCon is Mountain Time. So I don't know where "afternoon" there falls for your afternoon.
Either way, I don't expect to need to ping you once this is all tested and merged. π
@ember iris Please make sure to tag me here with any updates. I'll be around, but not necessarily at my desk, and an actual ping will get my phone and make a sound if I'm in here. Thanks!
Will do, The next update will probably be the first pass at the pull request since the gist and this thread covered just about every change/question I had
Great!
I'll be here as well, just tuned into running through it all
Excellent.
oh--would you like me to run precommit through it?
I don't have pre-commit set up on that repo. I would say run Pylint for the sake of running Pylint, but be reasonable in fixing things, it's ok if it fails on something that isn't really necessary to make the example simple and work. Also, I think don't worry about running Black on it. I didn't run Black on the demo code.
I linted the default demo, but it was failing on no-member in the board module, and whatever it fails on when it can't import something because the libs aren't installed in that environment. And both were wrong, they're issues with how CP interacts with the Pylint environment.
So I left it as is, obviously.
But I fixed the import-order failure, and one other thing, I think.
Sounds good! I don't think any of these edits will strongly change any of the code to a degree that pylint will behave differently but didn't want to run it if I shouldn't have and that sort of thing
Obviously a whole host of Python folks looking at my code makes me nervous, and I want my code to be as "perfect" as possible, but at some point, I simply need to let it go and be ok with getting "well, actually.."d.
Now you get me to blame for the formatting choices π
Makes sense. Yeah, go ahead with Pylint, I'm not sure I ever ran Pylint on the examples, except that most of them came from the Playground library, and they were linted to get in there eventually.
Duly noted π
OK, stepping away. Ping if you need me!
Thanks @dhalbert,
As for how Pyserial works, again I am a novice. My first usages of it was for ROS and did not have great experiences with it... So rewrote the couple of objects into c++...
So I don't understand the relationship with their asynchronous serial transfers and timeouts, if there is no hardware flow control involved. Than the timing should be pretty fixed... Time per character * number of characters.
One thing I noticed in this code and with IMXRT RM is there is some...
@dhalbert Indeed, of interest, thanks. Sounded like you already had this well under control, is why I didnβt chime in. If (when?) we ever have to confront this again in the future, I had some ideas on an ironclad once-and-for-all implementation (no more duty cycle debates). Notes are all in this CircuitPython code, so Iβll just attach the file hereβ¦
code.py.zip
oh I thought consider-using-f-string was disabled in cookiecutter, but it's only for examples apparently ?
We might want to vary it per library, since a library that is only going to run on capable boards should include the check
I mean we would turn it off in the code, if necessary.
should it though ? π
well, like PyPortal, I think it's a good check, more compact than .format()
oh and I don't understand that: (it says "command not found")
pylint (examples code)...................................................Failed
- hook id: pylint_examples
- exit code: 127
docs/requirements.txt: ligne 1: pylint : commande introuvable
.github/workflows/release.yml: ligne 1: pylint : commande introuvable
docs/_static/favicon.ico.license: ligne 1: pylint : commande introuvable
setup.py.disabled: ligne 1: pylint : commande introuvable
.readthedocs.yaml: ligne 1: pylint : commande introuvable
docs/conf.py: ligne 1: pylint : commande introuvable
that is really odd, did you do pre-commit install ? Maybe repeat that? Do you need to pip3 install pylint?
or is this from a CI build?
that's with pre-commit run -a or just pre-commit run with some of those files added
can you run pylint by hand?
is it in your path?
it looks like the pre-commit setup is damaged somehow
yeah and:
pylint (library code)....................................................Passed
pylint (tests code)......................................................Passed
Some pre-commit files use the installed pylint. I think that we have worked to address that but may not have gotten everything
ok, pip installing it in the venv solved it
should have thought of that, but the discrepancy is notable
@onyx hinge as long as you are here, would you mind approving https://github.com/adafruit/circuitpython/pull/6316 ? I had to make one more shrink change
https://github.com/adafruit/cookiecutter-adafruit-circuitpython/issues/121 is my related issue .. maybe we still haven't fixed it?
thanks. I didn't individually check the submodule changes but it should be OK
ty
no, it's still the status quo that a freshly cookie-cut repo will rely on the local pylint https://github.com/adafruit/cookiecutter-adafruit-circuitpython/blob/main/{{ cookiecutter and 'tmp_repo' }}/.pre-commit-config.yaml#L29=
Automated website update for release 7.3.0-beta.2 by Blinka.
New boards:
- sparkfun_teensy_micromod
- elecfreaks_picoed
- wiznet_w5100s_evb_pico
- pimoroni_motor2040
i updated image aspect ratio. please check updated files. TIA
https://github.com/adafruit/circuitpython/actions/runs/2230099481: it looks like it worked, but it didn't:

Perhaps the credential has expired in some way. We might want to move this to adabot from adafruit-blinka anyway. The adafruit-blinka user is not used otherwise, I think.
Hey, there's always the random question about fonts for Circuitpython.
I'm sure I've actually seen it before, does anyone know U8g2 ?
U8g2 is a monochrome graphics library for embedded devices
They have a number of nice bdf fonts in small sizes, with various licenses, it would be interesting to look into it, and reference it in the fonts guide.
https://github.com/olikraus/u8g2/tree/master/tools/font/bdf
https://github.com/olikraus/u8g2/wiki/fntgrp
oof, that took longer than expected.
@idle owl I've submitted the pull request. I should be able to make changes tomorrow as needed, but I'll be afk for large gaps through the day
CircuitPython version
Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Feather ESP32-S2 TFT with ESP32S2
Code/REPL
import board
import pulseio
import array
import time
x = pulseio.PulseIn(board.D5, maxlen=11)
y = pulseio.PulseOut(board.D6, duty_cycle=65535)
y.send(array.array('H', [350] * 23))
time.sleep(0.1)
print(x.popleft())
Behavior
prints 0
Description
A wire is connecting D5 to D6. The code should print a value around 350 ...
Thank you for this report and diagnosis. This may be related to #4300 and perhaps some other PulseIn issues as well.
If you see a fix to prevent the overrun, a PR would be welcome.
I wonder if it would make sense to have a "last version working for this board" setting for boards on the circuitpython.org, so that people don't download, say, 7.2 for the hallowing m0 express, and get a broken screen this way?
the website would then not offer the non-working versions for download
From @PaintYourDragon's comment here: https://github.com/adafruit/circuitpython/pull/6312#issuecomment-1110313993.
I collected some data like this in an ad hoc manner while working on #6312, but this is a good approach if/when we need to revisit this.
"""
NEOPIXEL IN-VS-OUT SIGNAL COMPARATOR.
This does NOT generate NeoPixel color data, doesn't have to. Rather, it's
used to observe how a pulse train is reshaped on its way though pixels.
Connect A0 & A1 to potentiometers to a...
@PaintYourDragon Thanks! I collected some data like this in an ad hoc manner while working on the PR, but this is an excellent approach if/when we need to revisit this.
Most builds have something wrong. The question is what is a showstopper; that bug is definitely one. I would like to get that bug fixed soon.
the thing is, if we know a build is broken on a given board, we could save users some frustration
maybe at least display a warning for known broken builds?
only on the board page for which the issue exists, of course
basically per-board release notes
we could also put there information about a filesystem size change or about the need to update the bootloader and such
A highly visible note could be added temporarily in the description, or we could add another field that is usually empty. Then individual PR's could be made and undone to cicuitpython-org
Some of these warnings are in the guides, fairly prominently. We should add a guide warning for Hallowing right now.
Given limited development time, I would rather spend time fixing the actual bug, though.
I mean, I don't necessarily expect people to dig out their hallowings from their drawers for a couple of months still
which version works? I will put a warning in the guide now
it got broken with 7.0-beta, the 7.0-alpha all work
(to help ameliorate this particular showstopper)
and everything older than 7.0 of course
ok, I added a warning to the guide page, and also renamed the guide to include M0 (It just said "Hallowing" before that)
you did a bisect to the commit you mentioned, is that right?
Further testing leads me to believe that it's commit f0859ac that broke this.
Confirmed via bisect.
in a way, I did it manually
I verified and am now looking at the SPI bus
but the checkout just before it works, and just after it doesn't
I have the first part of the code in place, and at times trying to figure out why board resets.... Maybe it was sitting on a couple of stray wires...
I was again curious with two things with the code:
a) is it faster than just rolling your own? dir_pin.value = 1, do your writes dir_pin.value= 0
b) I wondered if the code in a) would work right anyway...
Short answer is a) may be similar speed wise, but both currently have problems... I will now fix the rs485_dir version. picture wor...
Forgot to mention, if you are curious of the python code I am running:
import time
import board
import busio
import supervisor
from digitalio import DigitalInOut, Direction, Pull
initial_baud = 115200
if hasattr(board, 'NEOPIXEL'):
import neopixel
led_colors = [
(255, 0, 0),
(0, 255, 0),
(0, 0, 255),
(255, 255, 0),
(255, 0, 255),
(0, 255, 255),
(255, 255, 255),
(0, 0, 0),
]
col...
quick update: I updated the write code like:
size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
if (self->tx == NULL) {
mp_raise_ValueError(translate("No TX pin"));
}
if (self->rs485_dir && len) {
GPIO_PinWrite(self->rs485_dir->gpio, self->rs485_dir->number, !self->rs485_invert);
LPUART_WriteBlocking(self->uart, data, len);
// Probably need to verify we have completed outp...
This issue is specific to popleft so shouldn't affect #4300 which is calling getitem.
It looks like this bug is duplicated across all ports that have pulseio except raspberrypi which is using a different convention to address the buffer.
It's a simple fix so I'll go ahead and submit a PR.
Tested and working correctly on an esp32-s2. I went ahead and made the change for all ports that have the bug but I don't currently have boards for testing.
Hi everyone,
I'm Mithun, a bit new to circuitpython. Tweaking with ATSAMD21 in adafruit feather M0 Express board.
I designed a custom ATSAM21D uc based stack for my project and before I could print and eval, chip shortage hit. Luckily I got adafruit feather M0 Express to test code and circuitpython in mean time. Circuitpy or micropython is great when I import my code as mpy files. Thanks for all the dev work.
I'm trying to use watchdog timer, timer based callback(soft interrupts) in code, but feather M0 express doesn't seem to support timer based callbacks. Arduino C has** timer based interrupt functionality**, So I was wondering if circuit python or its port to samd21 doesnt have timer functionality. ?
**watchdog mode ** In my circuitpython workspace, I can build firmware for my feather_m0_express board, but when I include CIRCUITPY_WATCHDOG = 1 it fails to compile, with errors pointing to RTC. I'll post the error in appropriate place, new to discord so don't want to spam everyone's msg with the traceback. Would love to hear from someone who managed to get watchdog timer working on ATSAMD21
thanks again, If this is not a right place post, please direct me to appropriate thread.
there are no interrupts in CircuitPython at all, it's a design decision
thanks @stuck elbow
I think there was some work on watchdog for samd51, rp2040 and esp32-s2, but not for samd21
I've always meant to ask, why was that the decision to not add interrupts as opposed to MicroPython? Not disagreeing, just genuinely curious what the rationale was. Is it philosophy (they're not beginner friendly to use?) or difficult with the current implementation?
They are difficult to explain, have hard to understand constraints, are difficult to use and ultimately you are better off using interrupts through the built-in libraries and async code.
Also, you get a whole new class of concurrency bugs, that are hard to diagnose and fix
Gotchya, thanks for explaining!
@shadow summit this could be helpful: https://learn.adafruit.com/cooperative-multitasking-in-circuitpython-with-asyncio/overview
One more question, I was trying to port circuitpy to my custom board, which is samd21 same as feather m0 express, in my schematic I used both PA and PB ports designing from datasheet and feather m0 express as reference.
I tried assigning PB1, PB3 TO PB6, the compilation fails, when I dig deeper, in port to SAMD21 pins PB02, PB03 are defined in config file, but other pins are not defined in following files. Correct me If i'm looking at wrong places in code.
atmel_start_pins.h( https://github.com/adafruit/asf4/blob/84f56af13292d8f32c40acbd949bde698ddd4507/samd21/atmel_start_config.atstart )
https://github.com/adafruit/asf4/blob/84f56af13292d8f32c40acbd949bde698ddd4507/tools/samd21.json
https://github.com/adafruit/asf4/blob/84f56af13292d8f32c40acbd949bde698ddd4507/samd21/include/pio/samd21g18a.h
thanks
that's because samd21g18a doesn't have those pins, check the 5.2.1 section of the datasheet
they are not broken out in that package
ooh that explains it, while trying to code I looked at feather m0 schematic and saw some unused pins, I'm jumped to use them and spent time trying to debug.
thanks a lot
I think this is caused by a buffer overflow in PulseIn.c which I think I have a fix for. I was getting checksum errors with a dht22 after the first reading but rock solid after the fix. Should I submit a PR?
Maybe I'm off here but while this may fix the symptom is the root case earlier in most ports where this code occurs:
if (self->len maxlen) {
self->len++;
} else {
self->start++;
}
It seems in other instances start is increased the max_len is checked but in this instance it is not. If this is similar to the line (just after the one you changed): self->start = (self->start + 1) % self->maxlen; would that fix the cause?
FWIW, I seems to have the same problem, let me know if there is anything I can do to help test.
@tulip sleet is there a version that the TFTs stopped working? The circuitpython I built a week or two ago with a TFT and ESP32-S2 works fine.
And it was built with the tip of main at the time
Or did that include the fix you mentioned in that issue?
it should include the fix; the fix was merged late on April 9
Okay cool
FWIW, I seems to have the same problem, let me know if there is anything I can do to help test.
Which version are you using? #6272 was merged late on April 9, so builds since then should work, such as 7.3.0-beta.2, released last night.
@edmundopl Which version does not work for you? Try 7.3.0-beta.3 if you are further back.
@dhalbert, just loaded 7.3.0-beta.2, and it does work, but it sounds like you aren't completely happy with the fix, so let know if there are any other builds you want tested.
Fixes #6277.
SAMD21 ticks depend on the event system, which was getting reset between VM instantiations. But permanent displays depend on ticks being on to refresh. Fixed by not resetting the event system when ticks are in use.
@deshipu could you try this? Thanks.
It is. Should I go ahead and add a change to bound self->start to maxlen but keep the additional bounding in popleft? The espressif port has an extra increment by 2 I wasn't sure about but looking into that it's also problematic so maybe I could fix that in this PR as well? That one appears to be the cause of #4368
It does look to me like it's not wrapping properly at that one spot, and you can remove the modulus elsewhere where you added it. In the case where it's checking for two values in a row, there the modulus may need to be one less. I will look at this in more detail tomorrow. But try fxing the increment in the case:
if (self->len < self->maxlen) {
self->len++;
} else {
self->start++;
}
Thanks, when you test these new fixes, do they work as well as your original ones?
Sorry, I somehow missed your replies here. Yes, the storage managment you describe sounds like a fine plan.
I agree about limiting it to ASCII; that's not a problem.
Testing for #6318 and #4368 seems to fix both issues now.
This fix looks good to me, and thanks for finding the root cause and testing! @gamblor21 Do you want to take another look?
Looks good to me now too, thanks for the fixes!
I just tried by flashing the adafruit-circuitpython-hallowing_m0_express-en_US-20220428-90b78fe.uf2 from S3 on my Hallowing M0 Express, but the screen remains dark.
Checking out the branch and compiling it manually worked. The display now shows the REPL as it should.
@stuck elbow PRs are not on S3 (until they are merged). If you can't build it locally, you need to go to the "Checks" tab and click on "Build CI on: pull_request" on the left, and scroll down to the Hallowing M0.
here: https://github.com/adafruit/circuitpython/actions/runs/2236406159
ah you did build it locally π
I tried to do that, but I couldn't find any s3 links
these are not S3 links, they are github artifacts
where exactly?
if I go to hallowing_m0_express step, there is an "upload to S3" step with a checkbox, but it doesn't show an url
no that's the log, ignore the log
ignore the steps too, the artifacts are on the CI action, not the steps
this:
which leads to https://github.com/adafruit/circuitpython/actions/runs/2236406159
where there's this:
so 2 ways: the little popup menu, or the "Build CI" page
it's weirdly convoluted, I guess that's why they added the little popup menu
or you know, make BOARD=hallowing_m0_express is almost faster π
thanks, I think I found it
yeah, it's faster, but I never know if my environment is not broken somehow at a moment
@deshipu Thanks for testing!
I just tried by flashing the
adafruit-circuitpython-hallowing_m0_express-en_US-20220428-90b78fe.uf2from S3 on my Hallowing M0 Express, but the screen remains dark.
FYI, that is the last merge, not this PR. We don't push tentative PR builds to S3, but you can get the builds from the artifacts, e.g. https://github.com/adafruit/circuitpython/actions/runs/2236406159. If you click on a Details link above, and then choose Summary on that page, you'll get to a...
@tulip sleet if you are willing to share, I would be very interested to know how you debugged this
also, thank you for your work on this!
oh, sure, and you're welcome. The commit we both found changed how ticks were handled on SAMD21. It now uses the event system, which gets reset before the 1st VM and in between VM instanations. There is this comment:
// SAMD21 ticks won't survive reset_port(). This *should* be ok since it'll
// be triggered by ticks and no Python will be running.
But for a display that needs to survive across VM's, this is a problem, because redisplay is a background task that is triggered by ticks. (So it's not "ok".)
supervisor_enable_tick() and supervisor_disable_tick() reference-count requests for ticks. When the VM finishes, for this case, the reference count is non-zero. But the event system was getting reset and stopped anyway. So I prevented that from happening. Alternatively, I could have examined the reference count and restarted the ticks if the reference count was > 0.
I am familiar with this code because I had to fix some previous issues when we fixed the auto-reload bugs (multiple times) in 7.2.x.
To actually debug it, I added tick-enabling at various places to see if that helped. At the right place, it did. But supervisor_enable_tick() did not help, and port_enable_tick() (which the former calls) did. So I realized it had to do with the state of the reference count.
I did not use the J-Link in this case because getting a debug build to fit on M0 is painful. Also I originally added mp_printf()s, but that did not work because a lot of the activity was before USB was active. We should add a UART debug-print mechanism, as is present in some other ports.
I consider this a pretty serious bug both for you and us, since it completely disabled at least one board, Hallowing M0 (maybe also CPX with a TFT Gizmo, for instance).
thanks!
I wonder if not resetting the ticks ever (except for just after power on, of course) would be a better solution
I mean, why are they reset in the first place?
I'm a bit worried that this might introduce bugs that only are visible when a display is being used, because otherwise they would be masked by the event system reset
it's the event system that is reset, so I prevented that, but only in the case when ticks were active. I think in terms of power consumption it's better to shut down the event system. But I agree that maybe it doesn't make sense. I was thinking of adding some boolean that said a display was in use, but checking whether ticks were enabled is good enough. I can check by checking channel assignment for the event, instead of actually checking the reference count.
Also maybe we should not use the event system. Scott found the event system quite useful, but maybe it's not useful in this case. A lot of the power-saving work Scott did a while ago was to enable ticks only when necessary. It took a while to catch all the corner cases for that. In this case, I think he forgot about long-lived displays across VM's
When he returns, I will discuss this with him.
I suppose when you have a display you don't much care about low power, the savings would disappear next to the backlight draw
that makes sense, but I don't know that we considered that point explicitly
In the SAMD51 implementation, ticks are always on. So maybe not using the event system and adopting the SAMD51 style is better. But I haven't looked to see whether that's actually possible. Scott started using the event system for a reason, and I don't know what it is
a simple RTOS underneath everything would do a lot of this management for us, and save us from having to write and debug these task and time-keeping mechanisms. But there may not be room in the M0 builds for, say, FreeRTOS.
yeah, freertos seems like an overkill
anyways, this solves the immediate problem, thanks again
you're welcome, and you were right to bug me about it
I still think that some way of adding notes for individual boards/versions would be a nice thing to have
it wasn't just a roundabout way to bug you
for example I would put a note on the ugame10 that anything past 6.x is not tested
or maybe I should just remove it from the list
7.3.0-beta.2 (and most, but not all, builds after 7.3.0-beta.1) seems to work after multiple installs and reboots.
Thanks
for something essentially unchanging you can put it in the board's markdown file in the circuitpython.org repository
something that comes "from the build" could be interesting, it would be a way to let us note in the core (like in a .mk file) "this board / this whole port is beta" and change it with a release..
good point
You are right, you were not hinting. I realized the technical problem was more severe than I had first thought. So I felt bad about the bug and decided it really needed to be fixed soon. I had just finished the NeoPixel stuff, and there are plenty of serious bugs to fix.
the thing with ugame10 is that it's a really old design, with a lot of problems, that I don't feel like keeping working, and while about 80 units are out there in people's drawers, I seriously doubt many people will want to update them ever
Code looks good to me. Relying on testing by @deshipu
I think saying "I'd really like to see this iss added to [milestone] due to [justification]" does seem perfectly reasonable. "I'd like #.... to be added to 7.2.x since it's a serious regression" and in this case supported by "and it affects adafruit products" doesn't hurt.
I think it is OK to retire boards from circuitpython.org; perhaps we should have an "archive" section.
i am all for ways of reducing the PR build times, though figuring out a faster way of doing multiple languages is really the big multiplier there, and we haven't come up with a fast way of doing that that doesn't take significant extra space.
funnily enough, I don't know anyone who uses circuitpython in any language other than English
at one point we regular dumped stats about downloads by language. it wasn't none, but it wasn't a lot.
I wonder if it would be possible to build the languages on request
[download count query redone below]
wow, someone uses Polish!
I'm going to improve that query, not sorted right
SELECT board, count(*), language FROM "default"."adafruit_circuit_python_downloads_details" where board <> '' and language <> '' and version in ('7.2.0', '7.2.1', '7.2.2', '7.2.3', '7.2.4', '7.2.5', '7.3.0-beta.0', '7.3.0-beta.1') group by (board, language) order by board, count(*) desc
I'm surprised how much en_GB there is, you'd think they could just use US
some of these may be automatic downloads, we don't know
I'm not sure who really uses "pirate", for example
pimoroni, obviously ;-)
@tulip sleet it crosses my mind that we could do something that uses a lot more flash on every board that's not very flash-constrained. we don't have to use the same approach everywhere, if the payoff is good
touche'!
good point
when it comes to building languages, I mean
probably a dumb question, but do I need to create a boot.py file or does that already exist? first time Ada trinket m0
these queries are from AWS Athena; we normally use these for download counts to sort the order in circuitpython.org
you need to create it, but it's just another file, like any other
okay ty
@blissful pollen thanks for these reviews, esp with Scott away and now with folks about to be at PyCon.
Hi, I love the circuitpython on wifi capable board but this is always bugging me:
- Every tutorial tell you to put your wifi credentials/token in a secret.py files (to understandably not version it with the code)
- Some board are placed just out of reach for other people to mess with, or at least plug a usb cable if they really want to.
- The mass storage function is amazing to upload new code but makes the secrets.py file extremely easily accessible too.
It would be nice to have a way...
#6270 added the ability to update tilegrid.bitmap to a new bitmap different from the one the TileGrid was initialized with. Currently this functionality is limited to such that the new bitmap must be the exact same size as the previous bitmap. Enforced by a check in the core setter that raises an exception.
During the development of that functionality I did try bitmaps of different sizes, it didn't cause a crash or other major problem, but also did not display the new bitmap properly. I...
@edmundopl Which version does not work for you? Try 7.3.0-beta.2 if you are further back.
7.3.0-beta.2 ..... Worked for me now
7.3.0-beta.1 ........ Not working
7.2.5 ................... Not working
Thanks for following up, is working now in 7.3.0 beta 2, tried it on 2 boards, good job!
Youβre welcome. Feel free to tag me if you need one. I can usually make time for a visual review if nothing else.
You can always compile the file with mpy-cross to secrets.mpy, would that work for you?
I have not thought of that as I have not played with mpy files yet. It would fix my main concern yes. Thank you very much !!
If someone opens the .mpy file with an editor, the strings are still readable, surrounded by binary stuff. It is not encrypted in any way. But you can raise the bar a bit by encoding the passwords and decoding them in your code.
You can disable making CIRCUITPY visible, though physical access to the hardware can override that:
https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/circuitpy-midi-serial#circuitpy-mass-storage-device-3096583-4
@jaunty juniper @tulip sleet might be worth adding an explicit call out for this editor/feature?
https://forums.adafruit.com/viewtopic.php?f=60&t=190691
to guide here:
https://learn.adafruit.com/welcome-to-circuitpython/recommended-editors
like a paragraph about BOM and encoding configuration in editors ?
That sounds like a good idea, maybe in the Troubleshooting section. And if the MicroPython/CircuitPython parser doesn't absorb BOM's, maybe it should.
I searched for BOM in the micropython issues and no result, I would advocate for the VM to ignore the utf8 BOM if present, I might open an issue to suggest/ask about it
Then again:
The IETF recommends that if a protocol either (a) always uses UTF-8, or (b) has some other way to indicate what encoding is being used, then it "SHOULD forbid use of U+FEFF as a signature".
text files were too portable
I am working on a custom board which is really close to the Feather M4 CAN. Ran into a odd issue where USB is working fine on Mac OS and Windows, but was not working on Linux (ubuntu). I am trying to chase down what little is different, but is there anything the might jump to mind that could be causing that.
Sometimes USB on the host gets broken for a particular port, and a reboot is helpful. I would suggest trying that first. It is related to the USB controller on the motherboard. It can even stop all USB communication, including to your mouse and keyboard. The situation has gotten better with recent versions of Linux. I am running Ubuntu 22.04 and have seen this problem much less often on 22.04 than with the standard kernels for 20.04.
Otherwise I can't think why you would be seeing regular USB not working on Linux for the REPL, CIRCUITPY, etc.
Thanks for the thoughts. It has been odd because I have been consistently able to develop and flash using Windows and Mac on several machines. But more than one linux systems has issues. When looking at the lower level events we see the USB having an issues an then trying to mount again... but nothing seems to be unhappy on the other OS system. We even had one dual booted, same USB port worked in windows but not in linux.
The problem can be provoked by resetting too quickly while it. The motherboards are standard Intel chipsets, on Dell Optiplex machines, quite vanilla. I have seen this on a really old machine (like 2011), and and 8th generation motherboard machine.
it is the Linux USB driver, which gets tangled up. But that is not necessarily your problem.
however, in general I do not have problems
I will play with some things, just odd behavior and very little different between this and the feather.
Is the Feather fine, and this is not?
Yeah, and I even compiled a mildly edited custom firmware and put it on the feather. It points some some minor implementation change that Linux does not like
you can point me to the changed source if you want and I will take a look
that sounds like it
It could be hardware, but there is sooooo little different.
One of the few changes is this setting is now a 1 to enable an external oscillator over a crystal
hpl_osc32kctrl_config.h
// <e> 32kHz Ultra Low Power Internal Oscillator Configuration // <i> Indicates whether configuration for OSCULP32K is enabled or not // <id> enable_osculp32k #ifndef CONF_OSCULP32K_CONFIG #define CONF_OSCULP32K_CONFIG 1 #endif
so if you undo that, does it work?
I would say make the changes one at a time, and see which one causes the issue. The clock can be derived from the USB clock if USB is on, and if it isn't, then you will may have USB problems due to clock skew.
search for "clock recovery" in the data sheet
I don't know why it would work worse on Linux
For the PyCon development sprints, is there going to be a GH label for those PRs? Really excited to see what gets submitted π
I don't understand this - if I put in 127 which is (as I understand) the correct value here, circuitpython crashes before setting up USB communications again. Anything less than 127 will work though apparently... But I don't see where this limit could come from?
@dhalbert do you have any idea what that could be about? Are those last two bytes just enough to hit a stack size limit maybe?
For reference, I'm testing this on the solderparty RP2040 stamp. I don't have anything set up to debug the crash currently - USB doesn't come up so I just know that it "didn't work".
@dhalbert do you have any idea what that could be about? Are those last two bytes just enough to hit a stack size limit maybe?
I don't know, but I was going to look later. I think there may be a write past the end of something. Your shorter ones may be working by accident. Also, does odd vs even size make a difference (e.g. 128 vs 127?)
Also, does odd vs even size make a difference (e.g. 128 vs 127?)
Ah, that seems to be it actually! At 128 it works. Increasing CIRCUITPY_DEFAULT_STACK_SIZE didn't help. Not sure what this means? Is this some alignment thing?
Documentation regarding memory has been created here (https://learn.adafruit.com/Memory-saving-tips-for-CircuitPython?view=all)
Maybe some tips on audio.
Are these buffers where the UTF-16 values go? Then I'd think they need to be a multiple of two bytes.
@kbanks-krobotics Are you still able to PR this? I'm doing some documentation things and am happy to PR what you wrote if not!
No, these buffers are used to hold the "unexpanded" ASCII values. They are memcpyd into from mp_buffer_info_t.buf and then the whole usb_identification_t struct is memcpyd again into the temporary storage in main.c. The ascii data is then read bytewise by pointer in usb_desc.c.
@dhalbert I had second thought and was planning to try later to inspect the mpy for that. Thanks for the clarification. Also thanks for this doc link, that seems a good option to me.
This will be launching today (fingers crossed), and already has the CircuitPython definition merged into the main release.
On hold, as we investigate something.
I mentioned this somewhere else, but can't remember where: an alternative is to use TinyUF2 as an alternate bootloader. This is what we do on ESP boards to make loading CircuitPython easier for most uses.
I mentioned this somewhere else, but can't remember where: an alternative is to use TinyUF2 as an alternate bootloader. This is what we do on ESP boards to make loading CircuitPython easier for most uses.
Sorry, I don't understand enough about your internals for some of these things. However with the Teensy boards, the bootloader support is built into hardware chip... But again how it works on normal power up cycle or reboots without reprogramming your code is in control
Resolves #5995 by adding documentation for watchdog.WatchDogTimeout, including example usage from a previous, relevant commit.
ESP32-S2 boards (and STM) also have a built-in bootloader. The TinyUF2 bootloader runs as a secondary bootloader on boards like that (the original bootloader always runs the secondary bootloader). A UF2 bootloader presents as a fake USB drive. You have probably seen this on other Adafruit boards, or on the RP2040. No other program is needed: you just drag the firmware .UF2 file to the drive to upload it.
@tulip sleet this talk about structured concurrency in game engines in interesting. If you ever are considering how to advance concurrency in CP with something like trio it will be worth a watch
i will put it on my watch list later. I really like trio - the problem is getting it ported to CircuitPython. The library is quite large.
thanks for pointing it out
Pin 2 an 8 are always pulled high according to the schematic so I'm checking those off the test list since I see that this is true when testing.
This is in some sense an incompatible change, as it alters the sequence of random values for any particular given seed.
@kattni brought it to my attention that the very first number after seeding is highly non-uniform. This is exposed by a program like the following, which tries 10,000 different random seeds and records the out come of randint(0,2) for each seed:
try:
import random
except ImportError:
import urandom as random
s = [0] * 3
for i in range(10000):
...
The CircuitPython core documentation is a terse reference, not a tutorial. In many cases, we have some other sources of documentation that we hope users will find useful. Let's link to them! I think most modules fall into one or more of these categories:
- There's a tutorial guide for it. Link to the tutorial.
- It's intended to be used by a wrapper library (for example, neopixel_write). Link to the wrapper library and to its learn guide
- It's a subset of a standard Python module. Link...
Change looks fine. I tested with a few ranges of seeds. While having a random source of seeds (chicken and egg problem) would provide a better test after testing some large ranges I'm fairly confident in the distribution. If anyone has a concern I can look at it more (it has been a while but I wrote lottery quality RNGs many years ago).
I will leave this as unmerged as to the decision if this is incompatible enough due to changing what the seeds will generate.
There are a few of you on here that I sponsor on GitHub. Just wanted to apologize because I have to put all sponsorships on hold for the time being due to circumstances. Just didn't want you to think I stopped supporting you for some other reason. I will be back, though. Thank you.
yasmarang is a cute little rng, but it doesn't have the best properties. pcg32 is a much more modern design though it does depend on 64-bit multiplication being 'fast enough' relative to the need for random numbers.
Surprisingly, this also gives back 44 bytes of flash on trinket_m0. (on raspberrypi, without lto, it takes 396 more)
pcg32 is taken from https://github.com/imneme/pcg-c-basic and is Apache-licensed.
Not yet tested on hardware, and as the unix build uses modurandom instead...
This is an alternative to #6325 since it replaces the whole pseudorandom number generator with a new one.
The existing code was setup that allowed you to specify an RTS
pin to be used as an RS485 direction pin, however there are no
RTS pins that are exposed on any of the Teensy 4.x boards.
Instead Arduino code base allowed you to specify any GPIO pin to
work instead. So I added the code in to facilitate this.
In addition the alternative code to wrap your own GPIO pin set high and low
around call(s) to uart.write() will not currently work, unless maybe you
fudge it and add your own del...
Note: This is to fix the issues in #6310
I made a little random number generating benchmark and ran it on the only device I have on hand, pygamer.
import random
import adafruit_ticks
def bench(f):
t0 = adafruit_ticks.ticks_ms()
f()
t1 = adafruit_ticks.ticks_ms()
diff = adafruit_ticks.ticks_diff(t1, t0)
print(diff)
def random_speed():
random.seed(37)
for _ in range(100000):
random.random()
bench(random_speed)
Before this change, it took 1085ms to gen...
it has been a while but I wrote lottery quality RNGs many years ago
@blissful pollen story time π
Not an exciting story, but I worked for the lottery here for almost 20 years. So I wrote, researched, purchased and investigated multiple types of RNG software and hardware. The one I wrote myself was just to award prizes in a second chance type draw. We had to send the code off to a 3rd party that analyzed that it was truly random (and nothing was hidden in the code).
NIST has a set of RNG tests if we ever really need to be sure things are random. It can get kinda crazy though because even if your RNG code is good the code calling it may not be and so on. And being random numbers you only ever have a confidence level it is random.
don't the esp32 have some kind of cryptographic peripheral?
Several microcontrollers have "real" random number generators, and we try to use them. It's at os.urandom if available.
@blissful pollen that sounds like it was either fascinating or dull or maybe some of each.
in this case I'm just suggesting taking an existing algorithm, which is popular enough that people have Opinons about it but it's not "obviously totally broken" as a non-cryptographic PRNG.
but just making a small tweak to the current RNG is also enough to make the extremely gross error go away so that's also just fine by me.
As a slightly off topic - in that other ports have similar limitations, like RP2040, I am playing with a first cut of making the same logical code work more or less the same on it...
That is the construct code has added (also remove the error message)
if (rs485_dir != NULL) {
uint8_t pin = rs485_dir->number;
self->rs485_dir_pin = pin;
self->rs485_invert = rs485_invert;
gpio_init(pin);
claim_pin(rs485_dir);
gpio_disa...
Not sure if this is right or not, but as can be seen by my last github post, I thought I might hack a little on RP2040 code for rs485_dir and try it out with my updated Dynamixel code, but received an error on the line: in the library:
rxpacket.extend(port.readPort(wait_length - rx_length))
Turns out that if I do
>>> recv = uart.read(6)
>>> print(recv)
None
Where on Teensy 4.1 (MIMXRT) I was not erroring out with:
None
Traceback (most recent call last):
File "code.py", line 90, in <module>
File "/lib/dynamixel_sdk/protocol1_packet_handler.py", line 427, in writeTxRx
File "/lib/dynamixel_sdk/protocol1_packet_handler.py", line 239, in txRxPacket
File "/lib/dynamixel_sdk/protocol1_packet_handler.py", line 146, in rxPacket
TypeError: 'NoneType' object is not iterable
Yeah it was for sure a bit of both.
A lot of the RNG comes down to what it should be able to do. Should the RNG be able to run a lottery or generate the most secure crypto keys or is it "good enough" for what most people need out of CP.
I think for most CP users something that is fairly uniformly distributed is key, even if maybe it is weaker in predictability.
My gut feeling is if you think the new library is better and not causing grief with space or processing time, it likely is the better option long term.
My thought is the speed isn't as important. What I have seen done if it is, is you pre-generate a pool of random numbers that you refill as required
So I'm working on adding a community bundle driver for the HX711 load cell ADC and I'm running into an issue building doc.
One of my modules uses rp2pio, which works great, but since my dev env doesn't have rp2pio, Sphinx flips out and refuses to build.
No module named 'rp2pio'
In the past I've just pip installed Adafruit-Blinka to get Circuitpython libraries into the env but this one doesn't look like it comes along with Blinka, for understandable reasons.
Any suggestions on getting this to build docs properly, aside from just commenting out import rp2pio whenever I want to do a doc build? π
in docs/conf.py there's a autodoc_mock_imports list, I believe you have to add it to that
Exactly the kind of thing I was hoping for. Thanks π
Resolves #6111 by adding a note about memory optimization and reducing memory fragmentation!
As I mentioned in issue #6310 while investigating that the Teensy port
did not support RS485_dir pin on normal GPIO pins, I found that it
was not implemented either as well on some other ports.
So was curious to implement it for RP2040 using same approach as I did
for the MIMXRT in the Pull Request #6328
That is I setup the specified pin as a normal GPIO pin in output mode
and then when you do a write operation it sets the GPIO pin logically
high, and when the write completes I set...
@tulip sleet knowing what you know now do you think the reload bug was the event system timer bug?
Was poking around, and noticed what I think is an older library in need of refactoring. Can someone confirm that before I try to refactor it? It's mostly just redundant code like int(hex(some_number), 16) and things like that but didn't know if there was some reason it was explicitly written that way.
It may just be an old library
oh that's weird, looking at the commit it's someone who "fixed" an error but wrong
- int(i2c_addr, 16)
+ int(hex(i2c_addr), 16)
(the whole CFG_TLS thing too could be written in a better way)
Also, maybe it's not old I think I was looking at the commit history of adafruit_binascii when I said that
Okay thanks for taking a look, it definitely sounds like a refactoring couldn't hurt!
_CFG_BYTE_16 = bytes(bytearray(unhexlify(hex(_I2C_ADDR << 1).replace("0x", "")))) π€
@dhalbert I think you fixed this with this commit, right? Or is it outstanding? https://github.com/adafruit/circuitpython/commit/b48bb75e24ca8502a0950626ae80e8c681049da4
Good point. I think maybe yes, since it was on SAMD21, but it needed to be cleaned up anyway. The new way it's done is a lot more straightforward, though we had to rediscover the corner cases.
Agreed. In the open spaces we were experiencing that the longer reload delay was noticed as "long" by newcomers though. Not sure if there's still room to tweak that
The old short reload delay is unsafe, because it didn't wait for a write to finish or wait long enough for the host to be finished. That's why I lengthened it from 0.5 to 0.75 secs. 0.25 is quite noticeable, though. It might be true that the ticks fix improves this in some way, I and I should re-test.