#circuitpython-dev

1 messages Β· Page 419 of 1

idle owl
#

And yes, could be copy paste error.

tulip sleet
#

@proven garnet, there is a missing " at the end of the log doc comment

#

"" instead of """

#

ok, you merged my fix

idle owl
#

@tulip sleet Learn PR merged.

tulip sleet
#

ty

#

doing the archiving...

idle owl
#

Thanks for doing it!

#

And thanks for doing that too!

manic glacierBOT
proven garnet
tulip sleet
#

maybe also math.e.

#

You can run the doc build in your own repo: go to the top level and do make html.

proven garnet
#

Ah good call, I'll check it out

manic glacierBOT
proven garnet
#

@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

tulip sleet
#

you mean e or math.e?

#

I guess e is in the module

#

so it's in scope

proven garnet
#

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

manic glacierBOT
manic glacierBOT
idle owl
#

@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.

tulip sleet
#

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

idle owl
#

I think I meant a couple of things that a user would use.

#

Right, yeah.

tulip sleet
#

math library (and we sometimes provide only subsets of that)

#

longints definitely

idle owl
#

Ok

tulip sleet
#

floats -- some tiny languages don't provide floats

idle owl
#

Thanks πŸ™‚

manic glacierBOT
simple pulsar
#

Was there anything in particular that inspired the micro:bit V2 port?

tulip sleet
simple pulsar
#

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.

jaunty juniper
#

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

simple pulsar
#

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!

jaunty juniper
#

do we a have library for that in CP ?

tulip sleet
#

i do not know

jaunty juniper
#

the _pew module maybe ?

tulip sleet
#

it's related, not sure it's enabled or been tested on the microbit

simple pulsar
#

@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...

manic glacierBOT
#

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:
 ...
manic glacierBOT
proven garnet
#

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.

idle owl
#

Or something weird happened on GitHub's end.

proven garnet
#

Oh, does PR approval cancel checks in the core?

#

Just trying to figure out if I should fix anything haha

blissful pollen
tulip sleet
#

We have a backlog of merges, and we don't need to spend hours of CPU on things that we know will pass

proven garnet
#

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

tulip sleet
#

I only do this for things I know will pass.

#

ok πŸ™‚

proven garnet
#

Thanks!

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
proven garnet
#

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

GitHub

I'm working on a project using 4 EMC2101's, an FT232H and a mux. I wanted more control and more status output from the EMC, so I have added register addresses for all, and variable definiti...

stuck elbow
#

in my experience the whole inheritance mechanism is pretty heavy memory-wise, because it basically creates an instance of every subclass

manic glacierBOT
#

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...
onyx hinge
#

@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.

manic glacierBOT
#

@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.

onyx hinge
stuck elbow
#

what is language anyways

#

what is time anyways

idle owl
#

Also, what @stuck elbow said.

idle owl
onyx hinge
#

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

manic glacierBOT
crimson ferry
#

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)?

manic glacierBOT
#

@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':...

manic glacierBOT
manic glacierBOT
#

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...

thorny jay
#

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

GitHub

Contribute to dglaude/CircuitPython_Switch_Mouse_Emulation development by creating an account on GitHub.

manic glacierBOT
lone axle
thorny jay
idle wharf
#

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?

tulip sleet
tulip sleet
#

if your mouse device descriptor is unusual, it might not like it

stuck elbow
#

the order of devices may matter too

idle owl
#

@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.

thorny jay
# tulip sleet I doubt that. But it could be that we have composite HID device, and it doesn't ...

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.

crimson ferry
#

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)?

tulip sleet
crimson ferry
#

thanks, I'll pay more attention to it to see if I can discern a pattern, the control-C delays are not very often

proven garnet
manic glacierBOT
#

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...

manic glacierBOT
jaunty juniper
#

@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)

idle wharf
tulip sleet
#

@idle owl which NeoPxiel strip was it that did not work with my test UF2? Was it part number 4560?

tulip sleet
#

it was one of the flexy separated ones

idle owl
#

No, that one worked

tulip sleet
#

ok, I have that in my pile here, not tested yet, thanks

errant grail
manic glacierBOT
tulip sleet
onyx hinge
#

@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

idle owl
#

@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.

idle owl
#

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.

lone axle
idle owl
#

Hmm ok.

#

Which maybe isn't right for Community libraries.

lone axle
#

So you'll want something like:

{%- if cookiecutter.target_bundle == 'Adafruit' %}
# [new badge image and url]
{%- else %}
# [current badge image and url]
{% endif %}
idle owl
#

Oooh.

#

Ok

#

Good to know. Thanks! I'll submit a PR for it.

lone axle
#

yep your welcome, I can test it out and review later on tonight if no one beats me to it today.

idle owl
#

Appreciate it!

idle owl
#

Badge and ignore is the new "whatever and chill".

idle owl
#

@idle wharf Are you also around here?

#

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.

lone axle
# idle owl <@382939733107408897> Patrick suggested a fix for an issue in my PR, but I'm unc...

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.

idle owl
#

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.

lone axle
#

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

idle owl
#

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).

ember iris
idle owl
#

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 πŸ˜„

ember iris
idle owl
#

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.

ember iris
idle owl
#

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

ember iris
#

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?

idle owl
#

Lastest stable.

#

7.2.5 I believe.

#

Updated the links πŸ™‚

ember iris
#

Perfect, I'll get those loaded up and ready to go, and thanks for fixing the links as well

idle owl
#

Great, I really appreciate this. So much to do, and this is equally important.

ember iris
#

Not a problem, it's the perfect project for me right now

idle owl
#

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

ember iris
#

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

idle owl
#

Amazing. Thank you so much!

idle wharf
idle owl
#

Updated!

manic glacierBOT
#

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...

idle owl
lone axle
dusk gull
#

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?

lone axle
#

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.

lone axle
jaunty juniper
#

I believe adabot runs authentified

#

which raises the limit to like what ? 5000 ?

lone axle
#

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
jaunty juniper
#

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

lone axle
#

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.

jaunty juniper
#

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)

manic glacierBOT
#

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...
manic glacierBOT
manic glacierBOT
idle owl
manic glacierBOT
#

@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

  1. Samsung 64GB Ultra
  2. Samsung 32GB EVO
  3. Transcend 8GB premium.
  4. 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...

manic glacierBOT
idle owl
#

@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.

manic glacierBOT
onyx hinge
#

@idle owl good luck! If it doesn't work feel free to ping me, I'll help if I can

idle owl
#

Also stumbled upon 9 more CPBs. Tossing them into the pile! πŸ˜„

manic glacierBOT
#

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...

manic glacierBOT
#

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 ...

onyx hinge
#

so there was a real problem, not sure how this user had the luck to trigger it with all their mp3 files though

idle owl
#

Same encoding across the board for them?

#

Though seems like someone else would have run into it too at some point.

onyx hinge
#

you never know how many people just gave up and did something else

idle owl
idle owl
#

@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.

lone axle
#

@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. πŸ™

idle owl
#

Can you test it on the TestRepo?

#

It has RTD set up.

lone axle
#

I did test that raw. URL with a local built sphinx page and it does seem to resolve it.

idle owl
#

Ah ok

#

Well blergh.

lone axle
#

Yep, I can PR it to the TestRepo too.

idle owl
#

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.

thorny jay
# thorny jay I think it is the composite. AFAIK Nintendo Switch only accept wired keyboard an...

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

GitHub

Proof of concept to emulate mouse for the Switch with CircuitPython - GitHub - dglaude/Wii_uDraw_for_Nintendo_Switch: Proof of concept to emulate mouse for the Switch with CircuitPython

tulip sleet
lone sandalBOT
manic glacierBOT
manic glacierBOT
#

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...

manic glacierBOT
#

Did a bit of reconfiguring of the STM32F405 so tested the following

  1. 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.
  2. 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...

manic glacierBOT
lone axle
#

@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

manic glacierBOT
manic glacierBOT
#

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...

onyx hinge
#

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 πŸ˜•

manic glacierBOT
#

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.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@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.

manic glacierBOT
#

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:
      ...
manic glacierBOT
manic glacierBOT
manic glacierBOT
stuck elbow
ornate breach
#

Noice

#

Looks great

stuck elbow
#

I'm thinking about making a thin "adapter" pcb, to replace the square display on the hallowing with this

mental nexus
# stuck elbow

Cool. I like the display FPC breakout you’ve got.

stuck elbow
mental nexus
#

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.

onyx hinge
#

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. πŸ™Š

GitHub

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-...

silk raven
manic glacierBOT
#

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.

manic glacierBOT
manic glacierBOT
#

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.

tulip sleet
manic glacierBOT
#

@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...

manic glacierBOT
#

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...

manic glacierBOT
tidal kiln
gilded cradle
#

@tidal kiln I wasn't planning on it, but feel free to do a new release if you need it.

tidal kiln
onyx hinge
#

@tulip sleet would you be available to do the 'core' section of the state of circuitpython?

onyx hinge
#

<@&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!

manic glacierBOT
#

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...

lone axle
turbid radish
#

Thanks!

idle owl
#

@errant grail πŸŽ‰ Thanks!

#

We love seeing more community libraries!

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Category Channels

8

Text Channels

61

Voice Channels

6

Members

34061

Roles

35

mental nexus
#

@lone axle I keep forgetting to ask: Can the tabLayout touch response and tab highlighting be generalized to make a β€œradio button” widget?

lone axle
idle owl
#

Also worth noting, 100+ USB cables, even short ones, weigh A LOT.

candid sun
#

thanks folks!

ember iris
#

Thanks all!

minor plume
#

Thanks, everyone! Super bummed I won’t be able to meet those that are going to PyCon…but hopefully next year!

manic glacierBOT
#

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:...

onyx hinge
#

πŸ‘‹ see y'all!

errant grail
idle owl
#
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```
manic glacierBOT
#

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...
idle owl
#

@tulip sleet Bug filed. ^^

ember iris
idle owl
#

Yes please! That would be amazing.

idle owl
ember iris
idle owl
ember iris
#

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

onyx hinge
#

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>

idle owl
manic glacierBOT
idle owl
stuck elbow
#

it's a process

idle owl
#

That's fair.

tulip sleet
idle owl
#

Oh, nice. Ok.

tulip sleet
#

before that we were using MicroPython on ESP8266, etc.

idle owl
#

Ah fair enough. That makes sense.

tulip sleet
#

so there were a number of waypoints, as deshipu mentions

idle owl
#

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. πŸ˜„

tulip sleet
#

maybe there is something in the adafruit blog

#

I would think so

idle owl
#

I didn't know what to search for to find the beginning of it.

#

I found when Discord was created.

tulip sleet
#

0.8.0 does look like the fork

idle owl
#

But we were on Gitter before that.

stuck elbow
#

Adafruit had articles on compiling MicroPython and such even before that

tulip sleet
stuck elbow
#

I got paid to write some drivers for featherwings

#

so Adafruit was sponsoring development even then

idle owl
#

Ah yeah ok

tulip sleet
#

@stuck elbow I'm going backwards in gitter and you are there before that. It's slow going backwards.

stuck elbow
#

sure, but that was just talking :)

idle owl
#

Hah

#

Now I feel like I need to give a talk where all of this is relevant. Kind of neat info.

tulip sleet
idle owl
#

OK that's worth including.

#

Thank you so much for slogging through that, @tulip sleet

tulip sleet
#

I felt like it was reading the old stuff off unspun-up disks or magtape or something

stuck elbow
idle owl
#

I think as reference points to other things, it might be.

#

Not so much standalone as dry info.

stuck elbow
idle owl
#

I forget that I joined that early on. It felt already established by the time I joined the community, but hardly.

stuck elbow
#

2 BC β€” before covid

idle owl
#

Yeah that's a valid new system.

blissful pollen
#

Covid is the reason I really joined - so I'll count that as a positive

idle owl
blissful pollen
stuck elbow
#

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

idle owl
#

That's brilliant.

#

Not so great at internalising that, personally. But that's a me-issue.

stuck elbow
#

a happy ending is just a question of picking a good moment ;-)

blissful pollen
#

I'm not sure anyone is great at internalizing that

idle owl
#

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.

blissful pollen
#

whens it due? I'm avoiding an article I said I'd write by Wednesday πŸ˜‚

idle owl
#

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........

blissful pollen
#

Good luck! I know what that's like for sure

idle owl
#

Thanks. Appreciate it.

tulip sleet
idle owl
tulip sleet
#

I should have done this days ago. Unplugging and plugging was a drag

idle owl
#

Are you numb to LEDs yet with all that testing? πŸ˜„

stuck elbow
tulip sleet
#

faster than 0.5 seconds flash is too fast

idle owl
stuck elbow
#

oh, the final draft happens while waiting for my turn in the room

idle owl
#

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.

stuck elbow
#

but I was thinking about bringing the digitizer with me, and drawing the slides live during the talk next time

idle owl
#

Hah! That would be a feat.

stuck elbow
#

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

blissful pollen
#

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.

stuck elbow
#

people were guessing what the slide means, it was pretty fun

stuck elbow
#

it was a 20-person conference though

#

I've heard pycon has grown a little bit bigger than that

idle owl
#

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.

stuck elbow
#

this is a keynote?

idle owl
#

Not even close. Heh.

stuck elbow
#

phew

idle owl
#

There's a 1-day Education Summit before the conference, and I'm giving a short talk for that.

stuck elbow
#

I have a friend giving a keynote there this year

idle owl
#

So it's not even a conference talk.

#

Keynoting in 2019 was rough. I feel for your friend.

stuck elbow
#

Łukasz Langa

idle owl
#

Oh nice!

#

That should be good.

stuck elbow
#

say hello from me if you see him ;-)

idle owl
#

Oh I will, if I end up chatting with him, anyway.

stuck elbow
#

we used to go to pycons and europythons together, then he got involved in python core dev more, and I went with micropython

idle owl
#

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. πŸ˜„

stuck elbow
#

mi first name or my nick should be enough, though my last name doesn't have anything hard to pronounce, it's just long

idle owl
#

Ah ok. So it sounds like it looks then?

stuck elbow
#

yes

idle owl
#

Good to know! I haven't been wrong this whole time then.

stuck elbow
#

do-pie-ral-ski

proven garnet
idle owl
idle owl
stuck elbow
#

well "pie" is actuall pee-e, not pie like in raspberry pie

#

like in Latin

idle owl
#

I know a small amount about a number of other languages, enough to know vowel sounds in a number of others.

stuck elbow
#

whtever, "deshipu" will work

idle owl
#

Hah ok πŸ™‚

manic glacierBOT
manic glacierBOT
#

Reworked NeoPixel timings for a number of ports.
Fixes #5505.
Fixes #4102.

Tested with:

manic glacierBOT
#

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.

manic glacierBOT
#

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...
manic glacierBOT
orchid basinBOT
manic glacierBOT
manic glacierBOT
#

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...
manic glacierBOT
#

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...
tulip sleet
#

@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

onyx hinge
#

@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

manic glacierBOT
onyx hinge
tulip sleet
#

I didn't know there were any in the library

onyx hinge
#

it's easy to miss

tulip sleet
#

there was a gist, and a pasted-in example

onyx hinge
#

oops except I didn't make the change limor wanted yet

tulip sleet
#

back in a bit πŸ™‚

manic glacierBOT
#

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...

onyx hinge
#

@tulip sleet appreciate the reviews & merges today, thanks

tulip sleet
#

I miss them sometimes, yw

manic glacierBOT
orchid basinBOT
manic glacierBOT
#

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...

solid fjord
#

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?

tulip sleet
#

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.

manic glacierBOT
#

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...

manic glacierBOT
manic glacierBOT
#

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.

jaunty juniper
#

@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)

tulip sleet
#

(or maybe I'm wrong, but I thought the merge PR's updated RTD latest)

jaunty juniper
#

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

tulip sleet
#

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.

tulip sleet
#

@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.

onyx hinge
#

@tulip sleet that's awesome. I was thinking of asking

idle owl
#

At least I went with stable for the 90 CPBs. πŸ˜„

tulip sleet
#

if you need a release during PyCon, happy to do one to make life easiser.

idle owl
#

7.3.0 is pretty stable, but I'd be quite bummed if I flashed beta 1, and then you released beta 2. πŸ™‚

idle owl
#

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. πŸ€¦πŸ»β€β™€οΈ

tulip sleet
#

that's a relief. Are you demoing PyLeap, or if not you may want to do supervisor.disable_ble_workflow() in boot.py.

idle owl
#

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

tulip sleet
#

if people have trouble with BLE, that would be an amelioration that might help. Or you can show it as "coming soon"

idle owl
#

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.

tulip sleet
#

agree with that!

idle owl
#

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.

tulip sleet
#

are you giving away these boards, or just lending?

idle owl
#

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. πŸ˜‚

tulip sleet
#

i think maybe best demo is something using the BLE Connect app that controls NeoPixels, sounds, etc.

idle owl
#

Fair enough. I wasn't sure whether we were still promoting that.

tulip sleet
#

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
#

Right exactly.

#

And everyone loves flashy. πŸ˜„

tulip sleet
idle owl
#

Sure!

tulip sleet
#

thanks!

jaunty juniper
idle owl
idle owl
ember iris
#

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)

idle owl
#

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.

idle owl
#

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.

idle owl
# ember iris 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.

ember iris
# idle owl <@459119350851567626> I don't think the audio imports need to be `try` / `except...

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

idle owl
#

CPB only supports: audiobusio, audiocore, audiomixer, audiomp3, audiopwmio

#

So you don't need the audioio fallback.

jaunty juniper
#

no analog out on the NRF

idle owl
#

Wait, stupid question: that doesn't mean a potentiometer won't work right, does it?

jaunty juniper
#

hence the fallback to audiopwmio

#

no that's analog in

ember iris
idle owl
idle owl
#

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.

ember iris
#

And how would you like me to change the wav files to match JPs new sound effects?

idle owl
#

If there's one for touch to playback wav files, use the 1-7 wav files in that case.

ember iris
idle owl
#

Oh hmm, let me look

#

Ahh I see it.

ember iris
#

really easy to change them, but I wasn't sure if you had a favorite sound you wanted

idle owl
#

Yeah use 1-7 for touch.

idle owl
ember iris
#

Awesome! I'll try to make sure they all get some fun use!

idle owl
#

JP's been saving me from listening to the same sounds year after year for a while now. Appreciate that so much.

ember iris
#

I haven't heard the new sounds yet so I'm lowkey excited to make these changes and hear them πŸ˜„

idle owl
#

Nice! Have fun with that. They're fun sounds. Crunchy numbers 1-7 were recorded by him too πŸ˜„

ember iris
#

What day are you going to be going through these demos by the way?

idle owl
#

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.

ember iris
#

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.

idle owl
#

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!

ember iris
ember iris
#

I'll be here as well, just tuned into running through it all

idle owl
#

Excellent.

ember iris
#

oh--would you like me to run precommit through it?

idle owl
# ember iris 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.

ember iris
#

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

idle owl
#

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.

ember iris
#

Now you get me to blame for the formatting choices πŸ˜„

idle owl
idle owl
#

OK, stepping away. Ping if you need me!

manic glacierBOT
#

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

jaunty juniper
#

oh I thought consider-using-f-string was disabled in cookiecutter, but it's only for examples apparently ?

tulip sleet
#

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.

jaunty juniper
#

should it though ? πŸ˜…

tulip sleet
#

well, like PyPortal, I think it's a good check, more compact than .format()

jaunty juniper
#

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
tulip sleet
#

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?

jaunty juniper
#

that's with pre-commit run -a or just pre-commit run with some of those files added

tulip sleet
#

can you run pylint by hand?

#

is it in your path?

#

it looks like the pre-commit setup is damaged somehow

jaunty juniper
#

yeah and:

pylint (library code)....................................................Passed
pylint (tests code)......................................................Passed
onyx hinge
#

Some pre-commit files use the installed pylint. I think that we have worked to address that but may not have gotten everything

tulip sleet
#

why is it trying to run pylint on non-py files

#

aha

jaunty juniper
#

ok, pip installing it in the venv solved it

#

should have thought of that, but the discrepancy is notable

tulip sleet
onyx hinge
manic glacierBOT
tulip sleet
#

ty

onyx hinge
orchid basinBOT
orchid basinBOT
manic glacierBOT
tulip sleet
jaunty juniper
ember iris
#

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

manic glacierBOT
#

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 ...

manic glacierBOT
stuck elbow
#

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

manic glacierBOT
#

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...
tulip sleet
stuck elbow
#

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

tulip sleet
#

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.

stuck elbow
#

I mean, I don't necessarily expect people to dig out their hallowings from their drawers for a couple of months still

tulip sleet
#

which version works? I will put a warning in the guide now

stuck elbow
#

it got broken with 7.0-beta, the 7.0-alpha all work

tulip sleet
#

(to help ameliorate this particular showstopper)

stuck elbow
#

and everything older than 7.0 of course

tulip sleet
#

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?

manic glacierBOT
stuck elbow
tulip sleet
#

I verified and am now looking at the SPI bus

stuck elbow
#

but the checkout just before it works, and just after it doesn't

manic glacierBOT
#

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...
manic glacierBOT
#

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...
manic glacierBOT
manic glacierBOT
shadow summit
#

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.

stuck elbow
#

there are no interrupts in CircuitPython at all, it's a design decision

stuck elbow
#

I think there was some work on watchdog for samd51, rp2040 and esp32-s2, but not for samd21

proven garnet
#

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?

stuck elbow
#

Also, you get a whole new class of concurrency bugs, that are hard to diagnose and fix

proven garnet
#

Gotchya, thanks for explaining!

stuck elbow
shadow summit
#

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

stuck elbow
#

they are not broken out in that package

shadow summit
manic glacierBOT
manic glacierBOT
#

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?

manic glacierBOT
ornate breach
#

@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?

tulip sleet
#

it should include the fix; the fix was merged late on April 9

ornate breach
#

Okay cool

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

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++;
}
manic glacierBOT
manic glacierBOT
jaunty juniper
#

ah you did build it locally πŸ™‚

stuck elbow
#

I tried to do that, but I couldn't find any s3 links

jaunty juniper
#

these are not S3 links, they are github artifacts

stuck elbow
#

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

jaunty juniper
#

or

stuck elbow
jaunty juniper
#

no that's the log, ignore the log

#

ignore the steps too, the artifacts are on the CI action, not the steps

#

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 πŸ˜›

stuck elbow
#

thanks, I think I found it

#

yeah, it's faster, but I never know if my environment is not broken somehow at a moment

manic glacierBOT
#

@deshipu Thanks for testing!

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.

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...

stuck elbow
#

@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!

tulip sleet
#

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).

stuck elbow
#

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

tulip sleet
#

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.

stuck elbow
#

I suppose when you have a display you don't much care about low power, the savings would disappear next to the backlight draw

tulip sleet
#

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.

stuck elbow
#

yeah, freertos seems like an overkill

#

anyways, this solves the immediate problem, thanks again

tulip sleet
#

you're welcome, and you were right to bug me about it

stuck elbow
#

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

manic glacierBOT
onyx hinge
#

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..

tulip sleet
stuck elbow
#

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

manic glacierBOT
onyx hinge
#

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.

tulip sleet
#

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.

stuck elbow
#

funnily enough, I don't know anyone who uses circuitpython in any language other than English

onyx hinge
#

at one point we regular dumped stats about downloads by language. it wasn't none, but it wasn't a lot.

stuck elbow
#

I wonder if it would be possible to build the languages on request

tulip sleet
#

[download count query redone below]

stuck elbow
#

wow, someone uses Polish!

tulip sleet
#

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
stuck elbow
#

I'm surprised how much en_GB there is, you'd think they could just use US

tulip sleet
#

some of these may be automatic downloads, we don't know

#

I'm not sure who really uses "pirate", for example

stuck elbow
#

pimoroni, obviously ;-)

onyx hinge
#

@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

tulip sleet
#

touche'!

onyx hinge
#

when it comes to building languages, I mean

unique vapor
#

probably a dumb question, but do I need to create a boot.py file or does that already exist? first time Ada trinket m0

tulip sleet
#

these queries are from AWS Athena; we normally use these for download counts to sort the order in circuitpython.org

tulip sleet
unique vapor
#

okay ty

tulip sleet
#

@blissful pollen thanks for these reviews, esp with Scott away and now with folks about to be at PyCon.

manic glacierBOT
#

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...

blissful pollen
manic glacierBOT
manic glacierBOT
#

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

tidal kiln
jaunty juniper
#

like a paragraph about BOM and encoding configuration in editors ?

tulip sleet
jaunty juniper
#

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

jaunty juniper
#

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".

stuck elbow
#

text files were too portable

dusk gull
#

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.

tulip sleet
# dusk gull I am working on a custom board which is really close to the Feather M4 CAN. Ran ...

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.

dusk gull
# tulip sleet Sometimes USB on the host gets broken for a particular port, and a reboot is hel...

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.

tulip sleet
#

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

dusk gull
tulip sleet
dusk gull
tulip sleet
#

that sounds like it

dusk gull
# tulip sleet you can point me to the changed source if you want and I will take a look

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

tulip sleet
#

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

proven garnet
#

For the PyCon development sprints, is there going to be a GH label for those PRs? Really excited to see what gets submitted πŸ˜ƒ

manic glacierBOT
manic glacierBOT
manic glacierBOT
orchid basinBOT
orchid basinBOT
manic glacierBOT
manic glacierBOT
#

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

manic glacierBOT
#

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.

onyx hinge
#

@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

tulip sleet
#

thanks for pointing it out

manic glacierBOT
manic glacierBOT
#

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...
manic glacierBOT
#

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.

lunar gull
#

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.

manic glacierBOT
#

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...

manic glacierBOT
#

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...

manic glacierBOT
#

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...

onyx hinge
#

it has been a while but I wrote lottery quality RNGs many years ago
@blissful pollen story time πŸ™‚

blissful pollen
#

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.

stuck elbow
#

don't the esp32 have some kind of cryptographic peripheral?

onyx hinge
#

Several microcontrollers have "real" random number generators, and we try to use them. It's at os.urandom if available.

onyx hinge
#

@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.

manic glacierBOT
#

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...
solid fjord
#

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
blissful pollen
#

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.

stuck elbow
#

saving those 44 bytes is tempting

#

precious bytes

blissful pollen
#

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

dusk mauve
#

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? πŸ˜‚

jaunty juniper
dusk mauve
manic glacierBOT
manic glacierBOT
#

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...

onyx hinge
#

@tulip sleet knowing what you know now do you think the reload bug was the event system timer bug?

proven garnet
#

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

jaunty juniper
#

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)

proven garnet
#

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!

jaunty juniper
#

_CFG_BYTE_16 = bytes(bytearray(unhexlify(hex(_I2C_ADDR << 1).replace("0x", "")))) πŸ€”

tulip sleet
onyx hinge
tulip sleet