#circuitpython-dev

1 messages ยท Page 395 of 1

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit Feather RP2040 with rp2040
Board ID:adafruit_feather_rp2040

Code/REPL

# FILE: Code.py

import time
import board
import neopixel

#print("Hello World!")

pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)

dir = 0
index = 0
colors = [[255,0,0],[0,255,0],[0,0,255],[255,255,0],[255,0,255],[0,255,255],[255,255,255]]

while True:
    colr = colors[index]
    pixels.fill((colr)...
#

When some filesystem operation on CIRCUITPY causes a write, CircuitPython assumes that you have changed your program, and restarts code.py. Something on your host computer is writing to CIRCUITPY frequently. What is your host operating system, and what editor are you using? It may be a utility program that is writing to the drive or accessing it in some way that causes a metadata update, such an an indexing or backup program, or a disk-checking utility.

If you want to turn this feature o...

#

Yes, the hardware is limited to a few specific watchdog timeout periods.

image

You can find out the specific period that has been set by reading the timeout property. It is intended to always be at least as large as the value assigned. (however, there was a small bug there, see #5549)

>>> microcontroller.watchdog.timeout = 5
>>> microcontroller.watchdog.timeout
8.0
#

dive deeper
โ†’ i thought more in the direction of how can i use it with my linux laptop..
and in the end i probably will land back at the beginning:
wishing just this wonderful simple USB-mass-storage-drive that just works for every one ;-)

for the educational aspect i am on the line with you!
i just get to know that in a growing number of schools here in germany pupils get a personal (lockeddown) ipad from school... apple really did a great job on selling these things and looking...

tidal kiln
#

using HID to start after OS stuff comes up?

tulip sleet
#

there is already code in the hid library to try twice to get a device. DId you try just adding a time.sleep() at the top of code.py to allow time for USB enumeration?

tidal kiln
#

guessing it's timing issue at boot

#

just adding a delay up top was one idea i had too

tulip sleet
#

I would try that. If that doesn't help, I would also try adding a time.sleep in boot.py, on the off chance that for some reason the Pi is not ready to do enumeration or something. keyboard.py already does this in __init__():

        # Do a no-op to test if HID device is ready.
        # If not, wait a bit and try once more.
        try:
            self.release_all()
        except OSError:
            time.sleep(1)
            self.release_all()
#

my guess is that it's getting OSError again for some reason. Could put a try-except around k= Keyboard(), and try it again, or length the timeout above in the library.

tidal kiln
#

the code.py will run at power up, right? or is there some other built in delay?

tulip sleet
#

there's the one-second delay to allow going into safe mode, that's all

tidal kiln
#

and the second try delay above is also only 1 second

#

a typical pi boot is longer than that

tulip sleet
#

yes. Can you reproduce this?

tidal kiln
#

maybe...gathering things to try right now

#

the other scenario would be a reboot (vs. initial power)

tulip sleet
#

so what I would suggest is put the k = Keyboard() in a loop with a try-except, and keep trying over and over, so it works on power up

tidal kiln
#

since the CP board would remain powered

tulip sleet
#

yah

#

if the board remains powered, then at some point it will throw an OSError "USB Busy" exception when the host goes away. I don't know if the RPi cycles the power on its USB ports when it reboots. Maybe not since there's an internal hub

#

So the code.py could catch OSError and do microcontroller.reset() to restart completely. That would be different than the OSError catching at the start. It would be after it was running successfully.

tidal kiln
#

yep

#

would probably need to work in both

#

a try/loop at top to get going

#

and then catch/reboot elsewhere for the reboot scenario

lone axle
#

initializing the Keyboard() inside of try/except in a loop is the way I handled it at one point when working on a project where the microcontrollers were finished booting and trying to connect as a keyboard before their host was ready for them.

tidal kiln
#

@lone axle thanks. did you deal with warm boot scenario at all?

lone axle
proven garnet
#

Hey y'all, I'm adding more typing to libraries, and I'm trying to figure out how CircuitPython handles the __exit__ method, for reference:

def __exit__(self, exception_type, exception_value, traceback)

On my little trinket, I can tell the exception_type is Optional[Type[BaseException]], and that exception_value is Optional[BaseException] since they may not get passed if the context manager doesn't fail. But I'm having trouble figuring out what traceback should be, I can only get it to return None. Does anyone know?

tidal kiln
#

@lone axle yep. like keep everything powered. and then just reset the host system.

proven garnet
lone axle
# tidal kiln <@!382939733107408897> yep. like keep everything powered. and then just reset th...

I don't think we handled that case specifically. In our project everything was powered from the same place, so everything tended to be rebooting at the same times.
This is the code we used (possibly out of date for todays API I think):

kbd_initialized = False

while kbd_initialized is False:
    led[0] = (255,125,0)
    try:
        kbd = Keyboard()
        kbd_initialized = True
        led[0] = (0,255,0)
        time.sleep(0.75)
    except:
        kbd_initialized = False
        led[0] = (63,31,0)
        time.sleep(1)
tidal kiln
#

@lone axle thanks, yep. looks like your use case only had to worry about cold boot.

tulip sleet
proven garnet
tulip sleet
#

Yes, just in case it ever gets added.

proven garnet
#

Awesome, will do then, thanks for the quick resolution!

tidal kiln
proven garnet
#

The workflow just came back with a pylint failure for duplicate code, I think I saw a commit on another library with the same issue that disabled that as well as had an upgrade pylint==2.11.1 . @idle owl, is that one of the changes being/been applied across the board, or how should I handle that?

tidal kiln
#

thanks. should've guessed based on the other guides ๐Ÿ™‚

tidal kiln
idle owl
#

@tulip sleet A bunch of libraries are failing on unspecified-encoding which is calling open() without encoding specified. Should we be specifying? Or should we simply disable the check?

lone axle
tidal kiln
#

the creating-new-labels-in-loop-and-hitting-memory-issue thing seems to come up multiple times a day

#

so wanting to add some new info to discuss that, show a simple example usage code, etc.

#

i think that guide is a better location than the displayio guide

lone axle
#

Ah, good idea maybe a troubleshooting page that shows an example of "bad" code making them in a loop (with plenty of warnings that it's not the right way) and then explain the issue and show the proper way to code it with a single label getting re-used.

tulip sleet
idle owl
# proven garnet The workflow just came back with a pylint failure for duplicate code, I think I ...

Hello! Yes, we are disabling that check on PRs that fail because of it, and in some cases filing an issue about refactoring into a base class and subclassing. Please add ,duplicate-code (exactly like that, comma, no space on either side of it) to the linked line in the .pre-commit-config.yaml file. Please don't alter this file in other PRs without instruction to do so. https://github.com/adafruit/Adafruit_CircuitPython_Motor/blob/93ace61ce2788965474b4d826d3434e7c06cbab8/.pre-commit-config.yaml#L27

idle owl
#

@lone axle Oh, right. My question from yesterday. Don't do it yet, but could your label-removing script be run on the CircuitPython core repo as well? There are 22 issues that still have it, and most of them are on the CP repo. I say "don't do it yet" because I want to find out what Scott's opinion is on it, since that's his thing.

lone axle
# idle owl <@!382939733107408897> Oh, right. My question from yesterday. Don't do it yet, b...

I think that it could. It is essentially a python script that runs in the root of a repo. For the bundle libraries I used git submodule foreach to make it run in the root of each of those repo's. I believe the same script could work for any repo assuming that my user has permission to add/remove labels from issues (I did already for libraries, assume it's same for core but if not I think I would need that).

idle owl
idle owl
#

@proven garnet I replied to the FeatherWing PR, if you want to integrate the linting updates from Dylan's PR into your PR, to get it passing, I'll get it merged.

blissful pollen
#

Random question has anyone ever used framebufferio for something other then 1 bit (sharp display) or 16 bit (RGB matrix) color? Been trying with 24 bit for a proof of concept and something seems off

idle owl
#

@tulip sleet Is Threading.Thread.isAlive deprecated in CircuitPython also?

tulip sleet
#

we don't have threading turned on. where is that?

idle owl
#

Turns out it might be an example for RPi.

#

That confused Dylan.

#

Yeah is for RPi.

#

So nevermind. ๐Ÿ˜„

#

It's simply .is_alive now apparently.

tulip sleet
#

they regularized the camelCase to non-camelcase

#

the actual code is really low-level, too

#

you could just fix the is_alive

idle owl
idle owl
#

@ember iris Can you use a with inside a with?

#

I was perhaps mistakenly under the impression that you could not.

ember iris
#

I think? I'm not 100% though. I was wondering if it was avoided because of the added overhead was too much in an embedded setup

idle owl
#

No, I simply thought you couldn't do it. Is there more overhead? Because that should definitely be avoided in the CP lib.....

#

Ugh. I guess I should try it and actually test it.

ember iris
#

I'm mostly asking because I don't know if there's a reason it's being avoided. I don't know if the overhead is much overhead either just because all I know is that with adds a flag so if there's a problem reading the file or writing the file, and it exits that code block aggressively, it'll make sure to safely close the file

#

That way the user doesn't have to remember and handle all the weird edge cases they could be thrown out of a file write/read

idle owl
#

Though looking at it, I don't quite understand how that block would look if I withed the second bit. Like this? py with self._audio_out( board.SPEAKER ) as audio: # pylint: disable=not-callable with audiomp3.MP3Decoder( open(file_name, "rb") ) as mp3file: audio.play(mp3file) while audio.playing: pass

ember iris
#

But I don't know how the micro python/circuit python handles the implementation of the with

idle owl
#

I see you peepin', @onyx hinge. No idea if you have input on this or are bringing up something else entirely.

onyx hinge
#

no not really

#

I just typed a letter accidentally while looking through discord channels

idle owl
#

Hahaha fair enough.

idle owl
#

Sorry for the disturbance then ๐Ÿ™‚

onyx hinge
#

you can also write with expression1 as name1, expression2 as name2:, it's more compact but may/may not be better

idle owl
#

Yeah, there's two., The one I pasted above is the second one.

#

oh hmm

#

I'm not sure how to do it that way with a pylint: disable= in the middle. I guess I can move stuff around, let Black run, and then put the disable back where it goes

ember iris
#

Huh. That does get to be really messy really fast

idle owl
#

Oh hmm, it works where it ended up anyway.

#

OK, I'll do that on the other one as well.

#

Now mpy-cross and test on CPX, I suppose.

ember iris
#

So what does the block look like now? (I tried typing out what I thought it would become but it got messy and I figured it was too likely to be wrong)

idle owl
#

One looks like this py with self._audio_out( # pylint: disable=not-callable board.SPEAKER ) as audio, audiocore.WaveFile(open(file_name, "rb")) as wavefile: audio.play(wavefile)

#

The other looks like this: py with self._audio_out(board.SPEAKER) as audio, audiomp3.MP3Decoder( open(file_name, "rb") ) as mp3file: # pylint: disable=not-callable audio.play(mp3file)

#

Dunno why one worked one way and the other only worked the other way.... ๐Ÿคท๐Ÿปโ€โ™€๏ธ

#

But its passing pre-commit

ember iris
#

Ok that's about what I thought it would be minus the newlines to break it up

idle owl
#

Black did all of that. ๐Ÿ™‚

ember iris
#

haha black always has a lot of work to do when I write code, so that makes sense that I didn't get that part right

idle owl
#

I opened the Adafruit GitHub page for some reason, and then got caught up in this, and have no idea what I was going to do with the page.

#

There was a reason....

ember iris
#

haha I was going to do something then saw the review requested and looked and can't remember what I was doing beforehand either, something for the FAQ but beyond that who knows

#

I can approve the changes now or I can figure out a test setup to see if it works but I think it should be fine

idle owl
#

@ember iris I tested it. It works.

#

Pro tip: Don't put audio file playback in the loop. ๐Ÿ™„

ember iris
#

Do I add anything to the comment on the merge?

idle owl
#

Nah. No need.

#

Only if you wanted to.

ember iris
#

good to know, thanks!

idle owl
#

Thank you for the thorough review and help!

ember iris
#

No problem!

idle owl
#

If you need something to do.... there's a BUNCH of these.

ember iris
#

Relatedly, there's a bunch of pylint pull requests right now--why are we adding it and what should I look for?

idle owl
#

There's two more of mine, and Dylan is cranking them out as well.

#

Oh!

#

We upgraded Pylint from 2.7.1 to 2.11.1.

ember iris
#

ahhhh

idle owl
#

So, a bunch of libraries are failing Pylint now.

#

So be on the lookout for the exactly what you did on that PR - simply review it as usual.

#

Nothing special except we're trying to sort out Pylint updates.

ember iris
#

Ok that makes me feel better about going through them, I was sidelined with other stuff but saw a ton coming through and instinctively went, "Something is odd about this volume" that makes a lot of sense!

idle owl
#

Dylan is only tagging me on PRs, should I suggest tagging CPLibians too?

#

I think yes. ๐Ÿ˜„

manic glacierBOT
ember iris
#

I'm seeing most of hers, just wasn't sure and was too busy to sit down and sort it out. Now that it's the weekend I'm a bit more flexible

onyx hinge
#

been meaning to do that ^, it worked very conveniently in gifio.

onyx hinge
#

I didn't test it so it's probably broken ๐Ÿ˜•

#

but I like the idea of getting rid of open()

idle owl
onyx hinge
#

it should be compatible, you can use it either way

#

I converted it to draft since I didn't test it and probably won't test it today.

idle owl
#

I'll work with you next week to test it too, if you like.

manic glacierBOT
idle owl
#

Another pro tip - maybe don't leave that code that plays a wav file in a loop on the board when you toss it in the drawer to not pick it up for months and get nailed with a looping wav when you pick it back up ๐Ÿ˜„

ember iris
#

Haha does it instantly remind you what the old code was doing? Maybe that could be a memory trick--make all your code blare loud music right before leaving on vacation

idle owl
#

Hah! Or the worst prank ever. "Want to hate your past self? Check out this video!"

idle owl
# proven garnet Sounds great, thanks!

Excellent, thank you! It'll be a bit of work, but a lot less work than rebasing your PR to match the updates. (Well I find rebasing difficult anyway, not everyone would agree ๐Ÿ˜„ )

#

@ember iris You still around? I may have done something wrong in one of the PRs. Dylan and I are now second guessing what the import foo as bar should be turned into with from foo import bar..... I thought I had it right, but she's been doing it differently...

idle owl
#

Thanks

#

Sorry for use of foo, heh. I try to avoid it as it's incredibly unclear to beginners what's going on with it, but I didn't have time to come up with more descriptive things.

ember iris
#

No worries--is there a place where the conversation is happening on the side as well--I need to double check but I think both options are valid, I need to figure out which one is more 'correct'

idle owl
#

Huh. Ok

#

I will be happy if that's the case

#

(I'll still fix mine if needed)

#

@proven garnet Your Git fu is great! Nicely done on merging branches in that PR!

ember iris
#

Give me a while, I want to make sure I understand both options correctly before I say anything. I have a gut feeling, but I want to be right because I know one of the options uses less memory, and I want to know if the second does as well

idle owl
ember iris
#

Will do!

proven garnet
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.0.0 on 2021-09-20; SparkFun Pro Micro RP2040 with rp2040

Code/REPL

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
Author: Mark Roberts (mdroberts1243) from Adafruit code
This test will initialize the display using displayio and draw a solid white
background, a smaller black rectangle, miscellaneous stuff and some white text.

"""


import boa...
proven garnet
#

took a few merges but I got it!

idle owl
#

@proven garnet Excellent job! PR merged ๐Ÿ™‚

idle wharf
#

You might be gone for the day.. but @idle owl when reviewing library PRs like the linting ones... if we approve should we also go ahead and merge it or leave to the PR submitter to merge?

idle owl
# idle wharf You might be gone for the day.. but <@!330227457296957440> when reviewing libra...

Ok, so in this case, hold off, simply because I'm not sure which one of us has the import style correct on the ones that are left. However! Usually, you would absolutely go ahead and merge the PR. I prefer not to merge my own PRs, and prefer not to have others do the same. In the case of Limor reviewing, she often approves and leaves it to us to merge - she gets to do it how it works for her. ๐Ÿ™‚ But that's not what I try to do otherwise.

#

The other thing is, if the author isn't paying attention, and no one merges it, then it sits. Which also isn't great. At the moment, Dylan's doing a bunch, so it would definitely sit.

idle wharf
#

Ok, so sounds like linting ones are under some sort of organized process and I'll skip those.

idle owl
idle wharf
#

OK, I can help. I finished all my work PR Reviews so I'm sort of in the mode to do some more

idle owl
#

Because either Dylan's got it right, or I've got it right, or both of us have it right. And I might need to fix some PRs.

ember iris
idle owl
#

@idle wharf That's what I needed to hear! Review away!

idle wharf
#

At the end of day its just text files... can totally update them again

idle owl
hoary moat
#

Does anybody know of any CP examples using the RMT peripheral on espressif boards?

idle wharf
#

Tip for those who do work from GitHub, you can filter out Adafruit PRs when you're looking at your PRs that need review.

crimson ferry
#

I don't think it is directly exposed to user CircuitPython code

hoary moat
idle owl
idle wharf
#

Suggestion Box ๐Ÿ—ณ

Adafruit already knows what you've ordered (from their store) why not invite them to opt-in for library update notifications and\or to help to test PRs ?

#

Hmm... that sticker happened automagically

manic glacierBOT
ember iris
# idle owl OK, sounds good. Dinner will be here in the meantime, so tag me when you decide ...

I'm going to keep poking at it, but to my understanding the difference between the two imports is fairly minor and it evaluates to the same thing (just maybe with a slightly different number of steps).
https://docs.python.org/3/library/functions.html#__import__
There's a minor chance one option is better than the other from a memory usage point of view, but I can't tell.
I'd suggest one import is selected over the other just for style consistency
I think from foo import bar is better than import foo.bar as bar but I'm staunchly in one camp over the other.
Thoughts?

manic glacierBOT
#

The issue looks to be that it is getting into the protomatter PWM interrupt handler when things are not set up yet. Note that a similar hang can be generated when running the script from https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython/connecting-with-feather-rp2040-featherwing by hitting CTRL-C during startup. @jepler - I am not clear on why common_hal_rgbmatrix_rgbmatrix_construct is being called to create a PM object when things are in the process of shutting d...

blissful pollen
#

I have the glasses running native with displayio! Runs the same as the rgbmatrix or sharpdisplay using framebufferio.

idle wharf
stoic rain
#

I'm trying to have a pin on a SAMD51 board go high when the board starts, and stay high. It's needed to get the external flash on that board to work. Would this do it if added to the appropriate board.c?

void board_init(void) {
     gpio_set_pin_direction(PIN_PB22, GPIO_DIRECTION_OUT);
    gpio_set_pin_level(PIN_PB22, true);
    gpio_set_pin_pull_mode(PIN_PB22, GPIO_PULL_OFF)
}
gilded pewter
blissful pollen
gilded pewter
manic glacierBOT
manic glacierBOT
blissful pollen
manic glacierBOT
#

All of my ESP32-S2 devices hardfaulted last night within a second or two of recognizing the time change. I periodically check for internet time and update the MCU clock with:
rtc.RTC().datetime = time.localtime(s)
This is not always the pattern in the past; hardfaults occur in other parts of code unrelated to a time change, but this is the closest thing to a pattern I've found for at least some of the hardfaults. I'll try to come up with a minimal example.

dusk mauve
#

Iโ€™ve started looking into helping out by addressing some issues with I2C device drivers but the one area Iโ€™m still foggy on is the best pattern(s) for register read/write and bit manipulation.

Does anyone have recommendations for recently written/updated drivers that can provide good examples of the latest, most CircuitPythonic patterns for register read/write and bit manipulation type stuff? Or is their some doc on standards I should peruse for this? Iโ€™d like to avoid perpetuating bad habits or old, deprecated patterns

ornate breach
dusk mauve
ornate breach
#

Yeah, it can be confusing especially when you go and write your own driver libraries for circuitpython

#

Iโ€™ve written a few for boards Iโ€™ve developed and itโ€™s tricky sometimes

dusk mauve
#

At the very least itโ€™d give me more excuses to break out the logic analyzer and get deeper into the intervals of the base libraries ๐Ÿ™‚

ornate breach
#

Definitely a worthwhile endeavor. Adafruit has done great in taking care of the i2c messages, where all we have to do is make sure we are writing to the right registers with the right size data. ๐Ÿ™‚

#

And then reading the right registers with the right buffer size

dusk mauve
# ornate breach And then reading the right registers with the right buffer size

Right-sizing buffers (and not declaring large ones for lesser-used features unless they're needed) was something that came to mind while I was testing the APDS9960 driver before/after adding type annotations for this PR.

There's a 129-bit bytearray that is only instantiated if a certain feature (gesture recognition) is enabled and it was making my linters angry.

That and a PR I cooked up last night for the SparkFun Qwiic Twist (basically their take on a Seesaw-esque rotary encoder) got me interested in learning more about best-practice patterns around registers.

https://github.com/adafruit/Adafruit_CircuitPython_APDS9960/pull/36
https://github.com/fourstix/Sparkfun_CircuitPython_QwiicTwist/pull/7

ornate breach
#

Yeah, best practices seem to vary by chip manufacturers

#

Some are okay with 8-bit value registers while others want a full 16-bits

#

Texas Instruments uses a lot of 16-bit registers in their i2c devices (2x 8-bit registers) and Microchip does too

#

There is seems to be no true consistency except between similar parts numbers

dusk mauve
#

Yeah I did notice some interesting variations on register structure/size while reading datasheets. I2C might be a healthy-ish standard but reading/writing registers is a wild world.

ornate breach
#

Yeah, even on one device. Some values are only 8-bit and others are 16-bit and an 8-bit value like a status register might be right next to a 16-bit input value register.

#

Or the ADS7138 is a good example of weird I2C registers

dusk mauve
#

Haven't seen that one before, looks like a pretty neat SAR ADC. Was that one you wrote a driver for?

ornate breach
#

Iโ€™ve been working on the driver off and on for some time

#

Havenโ€™t lately. Iโ€™ve got a partially working Arduino driver for it but the circuitpython driver is very much a work in progress

dusk mauve
#

So you've been down this road before, wrestling with registers. ๐Ÿ˜‚

#

At least the APDS-9960 looks like its almost all 8-bit registers, with the 16-bit ones divided into high/low bytes. Some useful data is spread across a bunch of registers, of course, but at least it looks the read/write/read-and-write is all one byte at a time.

ornate breach
#

Well, kind of lol

#

You can read 2 addresses at a time, and you specify the MSB

dusk mauve
#

Ahhh, now I see.

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit Circuit Playground Bluefruit with nRF52840
Board ID:circuitplayground_bluefruit

Code/REPL

DEVICE_NAME = "Playground / ItsyBitsy" # change as required

import board
import digitalio
import time

from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService

led = digitalio.Di...
lone sandalBOT
tulip sleet
#

We tie any flash chip CS lines to the right polarity, because we are using an exclusive QSPI or SPI bus to talk to the chip.

stoic rain
# tulip sleet We tie any flash chip CS lines to the right polarity, because we are using an ex...

That makes sense. Unfortunately, it's about the hardware of the flash and the MCU (this is to fix the issue with external flash on the MicroMod SAMD51). The WP and HOLD/RESET pins on the flash chip are often just tied to 3.3V, but on that board, they're attached to PB22/PB23. To get the chip to work right, those pins have got to get pulled high. Really it's just PB22, but having both HIGH is ideal. Since they're not broken out and are dedicated to the flash chip, using never_reset makes sense.

#

The flash pins work as expected, if WP and HOLD are high.

west hinge
#

I just want to share how to set the ESP32 hostname using circuitpython on a MatrixPortal M4 device. Here is code snipet on how to set the hostname such that when viewed on router you can easily see which device it is.
from adafruit_matrixportal.network import Network

_SET_HOSTNAME_CMD = const(0x16)

SOME UTILITY FUNCTIONS AND CLASSES ---------------------------------------

def wifi_setHostname(NETWORKobj, hostname):
""" Sets the hostname of the ESP32 """
WiFiobj = NETWORKobj._wifi
ESPobj = WiFiobj.esp
resp = ESPobj._send_command_get_response(_SET_HOSTNAME_CMD, [hostname])
del ESPobj
del WiFiobj

if resp[0][0] != 1:
    raise RuntimeError("Failed to set ESP32 hostname")

NETWORK = Network(status_neopixel=board.NEOPIXEL, debug=False)

myHostname = bytearray('xxx_MatrixPortalStockTicker_xxx')
wifi_setHostname(NETWORK, myHostname)

NETWORK.connect()
This code requires ESP32 firmware update 1.7.1 or 1.7.2 or higher.

crimson ferry
#

@west hinge With a minor change to the ESP32SPI library, NINA's setHostname could be exposed, e.g., esp.set_hostname()

#

but looks like there was a NINA fix in 1.7.4, so that may be the dependency for this approach

west hinge
#

yes, setHostname was exposed for arduino interface, but not circuitpython. yes, I was using 1.7.4 for this code.

crimson ferry
#

just tested it out with a ESP32SPI change, works fine with Station and shows up on the router, I'll do a PR

west hinge
#

That would be great. Thank you blinka_cooking ๐Ÿ‘

crimson ferry
manic glacierBOT
onyx hinge
#

I wonder if we can afford to break struct.pack('d') & struct.unpack('d') -- operating on double-precision values. They bring in double-precision arithmetic that costs over 400 bytes.

onyx hinge
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.0.0 on 2021-09-20; Adafruit FunHouse with ESP32S2

Code/REPL

import time
from microcontroller import watchdog as watch
from watchdog import WatchDogMode

# wait for serial out
time.sleep(5)

print("  ", time.monotonic_ns())
watch.timeout = 30
watch.mode = WatchDogMode.RESET
watch.feed()

while True:
    print("  ", time.monotonic_ns(), end="\r")

Behavior

[tio 20:33:01] Disconnected
...
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.0.0-651-g5572876d2 on 2021-11-07; Pimoroni Pico LiPo (4MB) with rp2040

Code/REPL

import pwmio, countio, board
print("import OK")
counter = countio.Counter(board.GP1)
print("counter OK")
motor = pwmio.PWMOut(board.GP8)
print("motor OK")

Behavior

$ picocom /dev/ttyACM1
Adafruit CircuitPython 7.0.0-651-g5572876d2 on 2021-11-07; Pimoroni Pico LiPo (4MB) with rp2040
>>> import crash  # ...
onyx hinge
#

I think maybe my boot_out.txt changes broke safe mode ๐Ÿ˜ฆ

ornate breach
#

boot_out.txt has changed its identity to break_out.txt and has acquired new skills.. breaking out of safe mode

manic glacierBOT
tulip sleet
idle owl
ember iris
idle owl
ember iris
#

Which is pretty great, because it'd be users running into them otherwise!

ember iris
idle owl
#

I tried ๐Ÿ™‚

#

Everything fails, Black reformats it to this, and the Pylint disable has to be put back where it is.

ember iris
#

haha good to know

manic glacierBOT
manic glacierBOT
#

On the Kaluga, performing an Atkinson dither of a 320x240 BGR565_SWAPPED bitmap takes about 82ms. The code
is complex in order to give the best performance I could attain.

I'm anticipating that this PR will fail to build due to running out of space on some builds; similar to

  • #5544

which may mean splitting the functionality out into a fresh module, or making some other compromise.

onyx hinge
#

Good morning / [time-zone appropriate greeting], <@&356864093652516868> ! Our weekly meeting is in about 80 minutes from now. This is shifted 1 hour from previously, as most of the US switched to standard/"winter" time yesterday. In any case, if you plan to participate or just have notes for us, please add them to the document: https://docs.google.com/document/d/13krd3FcC82ir_a0DBnJMaq0OEqJzY_bPgHg_5bhufWQ/edit -- if you will not be reading your own notes, please note [no mic], [missing meeting] etc, and I'll read them out when the time comes. I hope to see many of you in the CircuitPython voice channel!

dusk mauve
#

I've just started experimenting with building my own CircuitPython binaries for a Trinket M0 to make sure that only the things I need are in there and its been fun! But I've got a weird question that the docs didn't seem to have an answer for.

Even though I've added in CIRCUITPY_PIXELBUF = 1 in the mpconfigboard.mk it doesn't look like its showing up in the generated moduledefs.h or being compiled into the final binary. Is this library being legitimately removed somewhere along the line, like maybe its just not something the SAMD21 can handle?

idle owl
onyx hinge
#

apologies, I think I managed an off-by-one-hour error in my message above <@&356864093652516868> ! We've still got 2 hours until the meeting. @idle owl can you just confirm that I'm correct this time?

dusk mauve
idle owl
misty garnet
#

I'm putting .py code in the modules directory but it doesn't seem to be putting them in the build code as frozen modules

onyx hinge
#

thanks

thorny jay
#

That seems right now. The time divergence between EU and US was last week and only last one week (from memory).

misty garnet
#

do I need to include a flag in the mpconfigboard to freeze code in the ~/modules directory?

onyx hinge
#

@misty garnet I don't think we use modules/ for freezing, we use frozen/ and yes each thing to be frozen is listed explicitly. e.g., ```make

Include these Python libraries in firmware.

FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground

#

that's from ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk

#

@dusk mauve my first suggestion would be to make clean, i'm not sure the dependencies are tracked all the way from mpconfigboard.mk, so merely changing that file might not make everything rebuild as needed.

dusk mauve
onyx hinge
#

not really, make clean should get everything.

#

I made this change locally:

--- a/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk
@@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
 INTERNAL_FLASH_FILESYSTEM = 1
 LONGINT_IMPL = NONE
 CIRCUITPY_FULL_BUILD = 0
+
+CIRCUITPY_PIXELBUF = 1
```  and the build doesn't fit anymore so it seems to me that this had the expected effect.
dusk mauve
# onyx hinge I made this change locally: ```diff --- a/ports/atmel-samd/boards/trinket_m0/mpc...

I've ripped out a bunch of stuff to get a max of 15,000 bytes free. I looked at the code for adafruit_pixelbuf in shared_bindings and shared_modules and it doesn't look like it requires any of the stuff I've removed, but it seems like one or more of those could be the culprit?

Here's the full mpconfigboard I'm working with. I've got tag 7.0.0 checked out too btw.

USB_VID = 0x239A
USB_PID = 0x801F
USB_PRODUCT = "Trinket M0"
USB_MANUFACTURER = "Adafruit Industries LLC"

CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21

INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0

# Original Flavor:        185,928 /  2,232 free
CIRCUITPY_USB_MIDI = 0 #  183,932 /  4,228 free / 1,996 saved
CIRCUITPY_USB_HID = 0 #   180,188 /  7,972 free / 3,774 saved
CIRCUITPY_ROTARYIO = 0 #  179,036 /  9,124 free / 1,152 saved
CIRCUITPY_RTC = 0 #       177,612 / 10,548 free / 1,424 saved
CIRCUITPY_TOUCHIO = 0 #   176,292 / 11,868 free / 1,320 saved
CIRCUITPY_PWMIO = 0 #     173,796 / 14,364 free / 2,496 saved
CIRCUITPY_ONEWIREIO = 0 # 173,160 / 15,000 free /   636 saved
#
# MAX SAVED/FREE: 12,768 / 15,000
#
CIRCUITPY_PIXELBUF = 1 #   no change? must already be included?
# CIRCUITPY_KEYPAD = 1 #     TODO

# Uses 1,872 bytes
# FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
onyx hinge
#

I'm near the tip of main fwiw

dusk mauve
#

is main basically the develop branch?

onyx hinge
#

yeah, right now it's the version that will become 7.1.

dusk mauve
onyx hinge
#

At 7.0.0, same behavior for me. That patch above causes the build to not fit.

#

I mean, I see the same behavior at 7.0.0 and at main

dusk mauve
#

Huh interesting. What's the expected behavior if the build doesn't fit? Just doesn't get added to the generated header? I'm more used to a failure toward the end but I've mostly worked with projects build around PlatformIO

onyx hinge
#

```/home/jepler/.local/gcc10/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: build-trinket_m0/firmware.elf section .text' will not fit in region FLASH_FIRMWARE'

#

ooooh here's one thing ... build BOARD=trinket_m0 clean .. specify the board name when you clean

#

may / may not matter

#

I mean, it definitely changes what gets cleaned

#
$ make -f Makefile clean
Makefile:27: *** You must provide a BOARD parameter.  Stop.
#

I would have expected you to see an error from this

dusk mauve
#

I'm doing make clean BOARD=trinket_m0 and it looks like its deleting the right things

#

yeah, got that error the first time I tried blindly ๐Ÿ˜„

onyx hinge
dusk mauve
#

oh, yeah, I mistyped instead of copy/paste ๐Ÿ˜‚ I'm using Barrier to "KVM" 4 systems including my Linux build ThinkPad and copy/paste doesn't always work coming from that system, much to my chagrin

#

Thanks for working with me on this @onyx hinge , I'm gonna retreat into the makefile and general build plumbing for awhile I think. Learned many years ago that it can be perilous to skip learning how that kind stuff works, even in a well-maintained project ๐Ÿ™‚

#

After many years of wrangling Maven POMs this is a breath of fresh air ๐Ÿ˜‚

onyx hinge
#

@dusk mauve best of luck! sorry I didn't have the instant answer

dusk mauve
onyx hinge
#

I have a feeling you'll come back with a solution and we'll say "oh of course"

#

"it's obvious in retrospect what was happening"

dusk mauve
#

"Its not about why the build failed, its about the friends we made along the way."

onyx hinge
#

oh and I should say my moduledefs.h begins

// Automatically generated by makemoduledefs.py.

#include "py/mpconfig.h"
#if (CIRCUITPY_PIXELBUF)
    extern const struct _mp_obj_module_t pixelbuf_module;
    #define MODULE_DEF_MP_QSTR_ADAFRUIT_PIXELBUF { MP_ROM_QSTR(MP_QSTR_adafruit_pixelbuf), MP_ROM_PTR(&pixelbuf_module) },
#else
    #define MODULE_DEF_MP_QSTR_ADAFRUIT_PIXELBUF
#endif
``` (build-trinket_m0/genhdr/moduledefs.h) so by looking at that file and not seeing PIXELBUF anywhere you do seem to be looking at a relevant spot
#

oooohhhhh another thing

#

@dusk mauve makefiles are awful, and you've fallen into a trap

slender iron
#

@dusk mauve I always do V=2 on a make command to see the final result for adding a module. the CIRCUITPY_* will be part of the long command line

onyx hinge
#

X = y # z and X = y are different. The content of the CIRCUITPY_PIXELBUF variable needs to be exactly 1

#

remove the comment and any trailing whitespace on the line

dusk mauve
onyx hinge
#

in some .mk file we compare lots of variables for exactly the content "1" and make a decision based on it

#

mmmmaybe that's the problem here?

dusk mauve
#

Of course its trailing whitespace/comments in a .mk file. ๐Ÿ˜‚ Me and my inline commenting habits, wreaking havoc in an unfamiliar parser yet again.

#

Removed all whitespace and comments from the file. BOOM. There it is.

#

I'm thoroughly confused why the preceding exclusions were 'working', maybe because 0 can have trailing whitespace and 1 can't? Parsers are mysterious things sometimes though, turtles all the way down from there.

#

TIL: Don't add dumb stuff to .mk files, keep those notes elsewhere ๐Ÿ˜„

onyx hinge
#

yeah something like that. If you look for truthiness as exactly the string "1", then "0", "0 " and "0 # I like to write comments" (not even actually sure which one make gives you) all lack truthiness

#

you can put it on its own line though

dusk mauve
idle owl
#

@ember iris Really appreciating my inbox blowing up! Early hug report!

ember iris
#

No problem, I figured I could work through them while eating breakfast. Props to Dylan for getting so many of these going!

#

Related to the pull requests--A lot of the modules have commented out code for alternative setups (spi vs i2c, etc)
Since it's getting commented out, I imaging it's not being evaluated by pylint--in the future should we look for that kind of code, comment it out, get it to pass pylint, then re-comment it out?

idle owl
#

You mean in example code? Or libraries as well?

ember iris
idle owl
ember iris
#

Ok cool then yes, same page. I was mentally going, "Where else might I have seen it" ๐Ÿ˜…

manic glacierBOT
idle owl
tidal kiln
#

@idle owl ping. got read the docs question.

idle owl
tidal kiln
#

do libraries with multiple .py's in a folder need anything special?

idle owl
#

What's going on?

tidal kiln
idle owl
#

Hmm.

#

Looking into it.

tidal kiln
#

thanks!

tulip sleet
#

@slender iron the current BLE HCI is only peripheral, so it would need to be fleshed out for central

idle owl
#

Hmm.

#

I wonder if the update also broke things. Like maybe we need to include the other requirements in requirements.txt in the docs/requirements.txt

#

Blergh.

tidal kiln
#

blergh is all i can offer as well ๐Ÿ™‚

idle owl
#

Yeah I broke it.

idle owl
#

So, this won't be an Adabot fix. This will be a manual fix. Though it seems automatible.

#

@tidal kiln Basically without the other files being installed, the docs don't know what things are. They were using the main requirements.txt file, but I had to change it to include Sphinx to get RtD to run the latest Sphinx version which fixes some docs issues. But I have apparently made more in the process.

#

So! Dylan has another task ahead of her. ๐Ÿ˜•

manic glacierBOT
tidal kiln
#

@idle owl blergh indeed

manic glacierBOT
solar whale
#

progress is not always forward ๐Ÿ˜‰

tulip sleet
# tidal kiln thanks!

@slender iron re naming of "bare metal" Rpi CPy, maybe "OS-less" or "no OS" are alternative names. There could indeed be a CPy that runs under Raspberry Pi OS, just as MicroPython has a Unix port, so need to differentiate from that

modern wing
#

Happy Monday y'all -- enthusiastically lurking ๐Ÿ™‚

mental nexus
#

Lurking yโ€™all. ๐Ÿ‘‹

slender iron
#

@tulip sleet (we're in the voice channel)

#

Most CP installs don't have an OS though. We could call CP unix something special instead

proven garnet
#

Listening in (no chat)

idle owl
#

I did.

#

Already.

modern wing
#

On top of her game ๐Ÿ™‚

prime flower
#

Lurking only

tulip sleet
lone axle
#

Do you follow the amazingly talented Liz Clark of BlitzCityDIY (hint if you don't make sure you subscribe to her channel - after watching this interview). Liz is a prolific creator and you'll find her work on the Adafruit learning system as well as on YouTube.

Subscribe to Liz here: https://www.youtube.com/blitzcitydiy

๐Ÿ’โ€โ™‚๏ธ For more informatio...

โ–ถ Play video
#

We'll use the Adafruit APDS9960 multi-sensor (which we used in the earlier proximity "Don't Stand So Close to Me" lesson), and learn how to use it to recognize gestures. Our challenge and solution will mimic Obi-wan Kenobi's Jedi mind tricks from the first Star Wars movie. Prepare for skills, Python Padawan. Big Learning Awaits! Part of Prof. Jo...

โ–ถ Play video
idle owl
#

We did not.

#

raises hand

thorny jay
#

Hi

idle owl
#

@thorny jay That ATtiny one was difficult, thanks!

slender iron
lone axle
#

Ahhhh

slender iron
#

(it's their website)

#

this is why folks say to use camel case in hash tags KlarDotSH

thorny jay
slender iron
#

good work!

idle owl
#

๐Ÿ˜„ All good!

slender iron
#

you two are doing a lot of good work ๐Ÿ™‚

mental nexus
#

Awesome work on scalable widgets @errant grail

errant grail
idle owl
slender iron
#

@inland tusk probably after SD cards are going and the first version is merged in

idle owl
#

@proven garnet Nice to see you in the meeting! Thanks for all the work you've been doing on the libraries!

slender iron
#

we'll market it with 8 ๐Ÿ™‚

lone axle
#

I think I've run into this issue before as well with readthe docs using an ancient version of causing differences between what I see locally.

gilded cradle
modern wing
#

Thanks everyone!

gilded cradle
#

Thanks everyone

slender iron
#

thanks all!

modern wing
#

Yep, it shows "live in 23 hours" Nov 9th @ 2:30pm eastern to me

thorny jay
#

You can click on "remind me" in YouTube.

idle owl
#

@lone axle If you find the time, please remove Hacktoberfest label from the last 22 repos, most of which are on the CP core repo.

idle owl
ember iris
#

thanks all!

idle owl
#

@lone axle Do you know how to test cookiecutter? Do I run it and specify . ?

#

Seems to be doing something if I do that.

#

Ok, it ran, but it didn't do what I need it to. I am going to need some help, I think. Trying one more thing.

#

Oh wait. Ugh. I think I know what I did.

lone axle
idle owl
#

It did, but it's good enough for testing ๐Ÿ˜„

#

Got it. Thanks!

onyx hinge
#

brrrrr the cold part of the year is coming to my basement

lone axle
#

I keep finding more nifty arguments for the github CLI. just realized you can filter by label with it gh issue list --label Hacktoberfest you can also use --json and specify the fields you want in your JSON objects that get returned, which makes it super easy to chain the results into something else.

idle owl
#

Neat!

#

@ember iris Are you done PRin' it up for a bit?

#

I don't want to clobber your work if you're still going through things.

#

GitHub will let everyone approve at the same time, so it doesn't keep you from duplicating work. ๐Ÿ˜„

onyx hinge
#

Here is the notes document for Mondayโ€™s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youโ€™ll be attending the meeting - itโ€™s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weโ€™ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/1ROYIKjHd8lfuKZJEgcWpzsnfbV4AaZjyvmRipSjxKXs/edit?usp=sharing

idle owl
#

@lone axle @gloomy shuttle With the voice channel only allowing circuitpythonistas to talk, I think you're pretty safe remaining connected, but in the event you forgot you were, you're both still in the CircuitPython voice channel. A circuitpythonista could still surprise either of you if you weren't expecting audio. ๐Ÿ™‚

#

I disconnected you, jfurcean. I don't want to ping you again though.

solar whale
#

@gilded cradle FYI -- just put blinka on a Raspberry Pi Zero 2W running bullseye --- blinkatest.py works !!

#

Next up is trying bullseye with braincraft....but probably not today ...

idle owl
#

@tidal kiln I fixed the MagTag library documentation for testing purposes - the docs are now building properly. We're going to apply the fix across the board tomorrow.

slender iron
#

I just got interrupts going on the zero 2w and uart and usb now work!

#

searches for a mini hdmi

#

mini hdmi works too

ember iris
idle owl
#

Because I also want to know the answer to that one since we did a number of libraries that way, I think.

ember iris
#

I don't think it's an issue, I just wanted to make sure I understood 'why' it was being done

#

*duplicates the above comment to git*

idle owl
#

Ah ok, thanks! I asked her the same thing on an earlier PR (or maybe in Slack?), and thought her explanation was well thought out and figured it was good.

#

Good to know

manic glacierBOT
tidal kiln
#

@idle owl thanks for docs fix

ember iris
#

Ah it's late--I'll try to get it going on my end.

idle owl
ember iris
idle owl
#

Nice!

ember iris
#

Can I request you test the change I'm going to request tomorrow just for my sanity's sake?

idle owl
solar whale
#

@gilded cradle hmm - trying to setup braincraft under bullseye, but bullseye does not appear to support raspistill or raspivid....

gilded cradle
#

Do you think you need to manually install them or is there an error?

solar whale
#

not sure yet .. there is a new camera utility call libcamera ... not sure how to use it yet.

gilded cradle
#

Ok, let me know if you are able to figure it out.

#

Thanks

solar whale
#

from the bullseye announcement ```New camera driver

The driver used by Raspberry Pi to access camera modules has now been replaced with libcamera, a standard Linux API. As with the video driver change, this means less closed-source proprietary code, and makes it easier for third parties to develop new camera hardware and software.

For anyone who has written camera-based applications in the past, this is a very significant change, and is too large to be covered here. There will be a blog post dedicated to the new camera driver published soon, so watch this space!```

gilded cradle
#

That's probably good news since it may mean this could work on non-raspi boards

#

Of course it will probably mean updating guides

solar whale
gilded cradle
#

Thanks

solar whale
#

I tried libcamera-still and it does not display to the braincraft hat screen. I think I'll need to try this first on a full desktop .

gilded cradle
#

Ok

solar whale
#

the good news is libcamera-still -o test.jpg captures an image just fine ...

gilded cradle
#

Nice. I think the problem I'm dealing with is more complicated than I thought...

solar whale
#

I uninstalled pitft for this test

gilded cradle
#

I don't think the fbcp stuff can work without a rewrite on the desktop version of pi.

solar whale
#

agreed!

#

will it work on "lite"?

gilded cradle
#

yes

#

I tested it

solar whale
#

I have lite on my braincraft. the pitft install did not error . What did you test it with?

gilded cradle
#

No errors, just blackscreen

#

I used 2.8" resistive pitft

solar whale
#

ok but you can't get anything to display can you?

gilded cradle
#

i do in lite, just not on desktop

solar whale
#

waht are you using to display in lite?

gilded cradle
#

Same hardware,

solar whale
#

what program?

gilded cradle
#

Pi 4 + pitft

#

Oh, it just displays the commandline stuff

solar whale
#

oh yes, I see the console

gilded cradle
#

Just whatever it would display on hdmi

solar whale
#

but no way to get camera to display.

gilded cradle
#

I haven't gotten that far

solar whale
#

have you tried tensorflow lite demo?

gilded cradle
#

No. I was just seeing the extent of the breakage of PiTFT. Spent most of my time waiting for SD cards to be written.

solar whale
#

I assume it needs raspistill... so likely broken

gilded cradle
#

I'm not sure, I haven't tried. You're way ahead of me there.

solar whale
#

Good to know we are seeing the same thing ... good luck.

gilded cradle
#

Thanks

#

Will probably continue tomorrow

solar whale
#

this is not a good sign ... sigh ERROR: tensorflow-2.3.1-cp37-none-linux_armv7l.whl is not a supported wheel on this platform.

hoary moat
#

Pi zero 2w arrived. I โค๏ธ Adafruit. (The other things in the box are also fun)

hoary moat
spiral elk
#

I've been using Sandisk A1 Ultra pretty much exclusively for everything since Samsung stopped making A1-rated cards

hidden oxide
#

I do believe my problems were with CUDA dependencies though

slender iron
#

anyone want to do a 7.1.0-beta.0?

ornate breach
#

Sure

idle owl
#

@ember iris I am pretty sure I know the location of a 1x4, can I fake it for the 4x4 test? Or will my "fake" test be only as good as your "fake" test? ๐Ÿ™‚

ember iris
idle owl
#

I could drag Dan into it ๐Ÿ˜† - I know he has multiple keypads.

ember iris
#

but all of the test code snippets seemed to work

idle owl
#

Fair enough!

ember iris
#

To the readthedocs yaml--it looks good, but I don't know anything about the sphinx/readthedocs build process so I'm not sure what to look for. Anything specifically I should keep an eye out for?

idle owl
#

We're updating cookiecutter to do the same so all libs have the same files.

ember iris
#

That's convenient!

idle owl
#

@tulip sleet Can I bring you in on the MatrixKeypad linting PR (it's not ready yet, I would tag you when it is so you don't have to pay attention for updates)? Keith suggested a change that we want to test, but I don't know where my 4x4 is (probably in the US), and we need the matrixkeypad_4.4.py example tested. I know you have a bunch of matrix keypads.... If you're too busy etc, I can fake it with my 1x4 keypad that I think I have here. But I figured I would ask.

idle owl
tulip sleet
idle owl
tulip sleet
#

@ornate breach or if you want to do the release notes, just copy a sample beta one from a previous release and do it up in the same style in markdown, and I will finish it off

#

main thing to do is to find the last PR after the 7.0.0 release and then summarize all the PR's until the present

ornate breach
tulip sleet
#

are you interested in this? ๐Ÿ™‚ not try to push you. The PR titles are not necessarily the best summary, so there's a bit of rewriting of the goal of a PR

viral mist
#

hey, @slender iron recommended me this server/channel, because i asked for some help on the pi pico discord.
im trying to port my project (https://github.com/freeyourstream) to the pi pico and i am struggling with the cdc-serial/hid composite device tinyusb configuration. It's my first time go this "low level" with usb on a microcontroller.
Im trying to use the circuitpython code as an example because @slender iron told me it contains tinyusb composite device code. now i cant find it. I had no problem finding the corresponding files in the micropython repo, so what am i missing?
Ps: anybody here willing to help me/guide me with my tinyusb problem more directly?
Thx and have a nice evening ๐Ÿ™‚

GitHub

FreeYourStream UG has 6 repositories available. Follow their code on GitHub.

slender iron
slender iron
hidden oxide
#

I also had problems with the Tensorflow wheel though

solar whale
#

nevermind -- got it...I missed the RESET while blue step...

#

very cool -- 'blink' works

#

as does the rainbow.... woohoo!

#

Is the glasses test also only for the CPB? or will it work on the glasses driver board?

slender iron
#

@solar whale I'm not sure. I don't have a driver board

#

I don't think pyleap actually checks but the code.py might have specific pins in it

solar whale
#

It just worked fine on the driver board!!

slender iron
#

great!

#

the other app, file glider, should be available through test flight this week too

solar whale
#

Nice job!

slender iron
#

The app side is all trevor ๐Ÿ™‚

solar whale
onyx hinge
slender iron
#

I was letting @tulip sleet do the review

onyx hinge
#

ok, I was worried it was being overlooked

manic glacierBOT
ornate breach
#

Iโ€™ve never formally asked to be added/nor has it been brought up but Iโ€™m willing to lend a hand when I can

idle owl
ornate breach
#

Okay, whatever I need to be helpful ๐Ÿ™‚

#

Not sure what Iโ€™d need to help prep a beta release

idle owl
ornate breach
#

Sounds good ๐Ÿ™‚ I have another 2.5hr at work so no huge rush

tulip sleet
ornate breach
#

๐Ÿ‘๐Ÿป

#

Sounds good

tulip sleet
hidden oxide
#

Is it all right to put a new CP supporting board announcement in the Community News section of the CP meeting notes for next Monday?

onyx hinge
#

@hidden oxide the community news section is excerpted from the e-mail newsletter, so the thing to do would be to submit it there. That doesn't guarantee it gets picked up to be read during the meeting, though. Status updates are read during the meeting. https://github.com/adafruit/circuitpython-weekly-newsletter#contribute -- either contribute via github pull request, or e-mail cpnews@adafruit.com

GitHub

Community newsletter for Python on Microcontrollers. Please feel free to put your current news, projects, etc. as a PR or Issue. - GitHub - adafruit/circuitpython-weekly-newsletter: Community newsl...

hidden oxide
#

How about creating an issue

#

?

idle owl
#

For the newsletter? I don't think Anne has that in her workflow... It would likely get missed.

onyx hinge
#

@idle owl did we ever specifically cover new boards in the meeting and/or newsletter?

#

we cover new libraries specifically, and maybe new blinka boards when they used to come along weekly-ish

ornate breach
#

Iโ€™ve seen some of my boards covered

idle owl
ornate breach
#

But itโ€™s rare

hidden oxide
#

Community newsletter for Python on Microcontrollers. Please feel free to put your current news, projects, etc. as a PR or Issue.

#

I just saw the "Issue" thing

idle owl
#

Oh hmm.

hidden oxide
idle owl
#

We should fix that.

idle owl
#

We can fix the template.

onyx hinge
#

@idle owl no, the description of the repo on github

hidden oxide
#

No, it's in the Github repo

idle owl
#

Maybe she does look for issues and I didn't know it.

onyx hinge
#

UDOO Key

The UDOO KEY is a fully programmable Raspberry Pi RP2040 + ESP32 microcontroller with Wi-Fi, Bluetooth and Bluetooth Low Energy. It also gives you access to an AI platform, Clea, with pre-trained AI models. Both microcontrollers can be programmed using different environments, such as TinyML, TensorFlow Lite, MicroPython, C/C++, and more - Kickstarter.

hidden oxide
#

Wow, I'm really blind

#

Sorry

#

I even read the newsletter

idle owl
#

No worries! At least we can find out if filing an issue works for the newsletter and update either GitHub or my brain.

hidden oxide
#

Well, that's a roundabout way to do it

#

hehe

idle owl
#

I'll let you know when I find out.

onyx hinge
#

If Anne prefers not to work via issues, we can update that text but also turn off the issues tab altogether

hidden oxide
#

OK, great

idle owl
onyx hinge
#

I'm going to step away, it's time to start cooking soup!

idle owl
#

I just opened a tab in Firefox, clicked back here to reply to you, and forgot why I opened the tab.

#

Ok, have a delicious one!

onyx hinge
#

or maybe it's more of a stew, there will be big chunks of veggies

idle owl
#

Oh wait, it's to order dinner!

#

We're having Vietnamese.

onyx hinge
#

@hidden oxide we do appreciate you bringing a potential newsletter topic! keep 'em coming in the future too

ornate breach
idle owl
#

Do I remember we started suggesting using bitmap_label over label? Or was it the other way around... FoamyGuy would know, but he's busy tonight.

idle owl
crimson ferry
#

what does this do: MP_STATE_VM(some_singleton)?

tulip sleet
crimson ferry
#

so you always get your correct object in and out of it

#

but it gets automnatically cleared sometimes?

#

(going into REPL, reload)

tulip sleet
#

that struct is traversed during garbage collection, to make sure that anything in it is marked as not garbage (and anything that transitively points from there)

#

when the VM is restarted, it starts fresh

#

there is an MP_STATE_THREAD() also, but we don't have threads turned on

#

or more precisely, there is only one thread

crimson ferry
#

ok, thanks, I'm trying to narrow down a hardfault, and it happens around or soon after that reference... sometimes. but still gathering info

#

and no issue if VM has been restarted, and the some code refers to that macro on the (non-existent) object?

hidden oxide
tulip sleet
#

in order to to clear the unset fields

manic glacierBOT
#

When a function is defined, but its declaration isn't present, the compiler can't check that the declaration and definition match. "-Wmissing-prototypes" enables a diagnostic in this case.

Fixes fall into several categories:

  • Include headers where needed
  • Add/fix declarations / definitions where needed
  • Mark functions as static if appropriate
  • Remove some never-used functions

This patch aims to fix all the diagnostics that occur in the atmel-samd builds, so that the -Wmissi...

onyx hinge
#

This is weird, there are a lot more missing-prototypes diagnostics in the raspberrypi port. did I make an error in #5561 that made most of the files not actually built with that flag? Or is there a reason it could differ from samd to raspberrypi

#

I've looked at the Makefile a couple of times but didn't spot my error yet

tulip sleet
#

which is not enabled on raspberrypi

onyx hinge
#

ah, no, I got the makefile wrong as I initially suspected (once I started seeing more problems on raspi)

-$(patsubst $(SRC_ASF),%.c,%.o): CFLAGS += -Wno-missing-prototypes
+$(patsubst %.c,%.o,$(SRC_ASF)): CFLAGS += -Wno-missing-prototypes

The way I wrote it, the result of $(patsubst) was %.o, so it tacked that on for all object files, not just ones in SRC_ASF. ah, well, it means there's more to do, but it doesn't mean the stuff I fixed was wrong in any way.

#

time to call it a night!

manic glacierBOT
manic glacierBOT
tulip sleet
#

@idle owl @trim elm I am working up this library: https://github.com/adafruit/Adafruit_CircuitPython_asyncio, which is not yet public, but will be soon. It is Python code that is a near copy of some code in the micropython repo (they freeze it in). The code is not formatted with black and does not come close to passing pylint, and probably never will, unless the MPy folks take that as a task. I would like to keep the code mostly the same so it's easy to merge changes.

To prevent failing pre-commit and CI checks, I would need to turn off black and pylint. Can I do this permanently, so that mass updates of the yaml files don't turn them back on? Do you have any other library exceptions like this? Thanks.

manic glacierBOT
analog bridge
#

Is there an easy way to save about 24 bytes (specifically for ja language)?

tulip sleet
#

I think my comment above is the easiest

#

CIRCUITPY_ONEWIREIO = 0

#

right now there are two ways to get OneWire, and we can turn one off for now

#

it was meant to be a staged change, but for these boards, we can avoid that

analog bridge
#

After doing some more changes to the PR code, only arduino_nano_33_iot ja is overflowing by 24 bytes.
With other languages on this board there is room for at least another 216 bytes.

tulip sleet
#

there'll probably only be more increases (slight hopefully) pre-8.0.0, so turning off onewireio is still fine.

#

this board has a lot of pin names

trim elm
analog bridge
#

Thanks @tulip sleet, I will turn off onewireio on it for now.

tulip sleet
trim elm
#

Oh yeah they're all done

#

Pretty sure it only does it on public repos

tulip sleet
#

it actually already updated:

#

in that repo. and it will not be private for long

trim elm
#

huh interesting

tulip sleet
#

i don't care about the public/private bit, it's more that this library needs not to use pylint or black for the indefinite future

#

so i can (hand) merge from upstream as necessary

trim elm
#

Yeah

#

I think just removing these lines should do it

tulip sleet
#

(upstream here is not even a separate repo)

trim elm
#

Oh wait

#

Not all of those

#

Just the first 3

tulip sleet
#

so if a sweep breaks again we will just remoe them again

#

also the .pre-commit-config.yaml ?

trim elm
#

You don't have to

#

@tulip sleet Do you want it to still lint the examples?

tulip sleet
#

that would be fine, and there aren't any right now ๐Ÿ™‚

trim elm
#

Ah ok

#

I'll pr it and we can make sure it works before merging

tulip sleet
#

๐Ÿ‘ thanks

trim elm
#

Opened the PR, never really done this before, so there's a significant chance I've forgotten something, but we'll see

#

No problem

#

@tulip sleet I'm assuming you still want to include licensing info, right? I disabled pylint for the library code but it's currently failing on the spdx stuff

#

(however if you don't we can always remove it)

tulip sleet
manic glacierBOT
manic glacierBOT
#

In code, the Singleton behaves without issue through multiple consecutive constructions, and through many cycles of construct and deinit.

I've been trying to print-debug this, but I'm at a loss. It doesn't seem to happen with Control-C then Control-D, but does happen with Control-C then key to enter the REPL then Control-D. Something seems to get clobbered along the path from wifi_reset() to common_hal_wifi_monitor_deinit() (and its check for common_hal_wifi_monitor_deinited()).

I...

idle owl
#

Give me a minute to read.

#

I feel you should leave the CI files intact.

#

The library's infrastructure should not be altered.

#

Hmm.

tulip sleet
#

I could turn off balck and pylint completely with inline # format off etc. The main thing is preserving the original source so I can do merges in the future

idle owl
#

So here's an option - add # pylint: skip-file at the beginning of each file, and the # fmt: off at the beginning of each file as well.

#

I caution against having differing CI setups on any library, regardless of whether they're needed.

tulip sleet
#

do we have any other such library?

idle owl
#

Not exactly. datetime is close, but I think we managed to lint it and Black didn't do terrible things to it.

#

There are no libraries where we are preserving the lib for merging though.

tulip sleet
#

there is a whole page of lint for this: bad variable names, many other issues

idle owl
#

I'm all for disabling it. But I don't like the idea of removing parts of the CI.

tulip sleet
#

I didn't realize the pylint disabling was so easy.

#

I will revert the PR and add the disabling

idle owl
#

Disable with a comment explaining why, please.

#

Alright, thank you.

#

@tulip sleet I haven't verified that skip-file thing, I only found it. So if it fails, let me know and I'll look into the proper way to do it. Also, if it gets out of hand, there are ways to alter the CI files, but leave them in place that will also cause it to skip things.

#

Remember to remove the adafruit_asyncio.py file as well ๐Ÿ™‚

slender iron
#

looks

#

all of the code looks right to me. I'm not sure why it broke

idle owl
#

Hmm ok.

#

I'm trying to figure out if this is even right. The comment definitely isn't.

#

Was going to try to fix it myself because I think they submitted via GitHub web UI.

idle owl
#

@tidal kiln You seem to know hex values really well.... are 0Fh and 0x0F the same thing? I've never encountered the 0Fh version before. I'm assuming they are the same, but google is giving me binary versions instead of equating them for me.

tidal kiln
#

yep

idle owl
#

Thanks

tidal kiln
#

just different ways of writing it

idle owl
#

Fair enough

manic glacierBOT
#

Found the bug! Well actually two bugs:

  • In wifi/__init__.c, the wifi_inited variable wasn't being reset after wifi_reset routine finished.
  • esp_wifi_get_promiscuous throws ESP_ERR_WIFI_NOT_INIT error when exiting empty code.py or repl. This results in common_hal_wifi_monitor_deinited retuning wrong state and crash happens down the line in queue's deinit routine.
#

These are some small changes needed to use the MicroPython asyncio Python code. Simple task creation and running now work, using a revised version of MicroPython's code, found here:

I would like to get this in to 7.1.x, for experimental purposes, so people can try it, without promising that it will remain the same as it evolves.

#

The Sparkfun SAMD51 MicroMod module ships with a 16MB external flash
chip, but the v1.2 version of the board has a design flaw which
prevents the SPI to the chip from working (PA10 cannot be MOSI).

The switches to the SAMD51's smaller internal flash, and reduces the
CircuitPython build to the minimum, similar to other boards that lack
external flash.

The current 7.0.0 .UF2 for this board has working safe-mode access to the REPL, but CIRCUITPY does not mount (since the SPI to the fla...

stoic rain
#

So, I just found out that atmel-samd board I added before 7.0.0 (Sparkfun SAMD51 MicroMod) has a design flaw that prevents the hardware SPI tied to the external flash from working.It seems that bitbang, software SPI can be made to work, though. Someone got that working on Arduino.

So, question is: would be be fairly straightforward to use software SPI in this boardโ€™s external flash config? And if so, is that a bad idea? ๐Ÿ˜‚

#

In the meantime, Iโ€™ve got a PR that switches to using the internal flash for now.

onyx hinge
# stoic rain So, I just found out that atmel-samd board I added before 7.0.0 (Sparkfun SAMD51...

that is a painful design flaw. As far as I know we have never had to use bitbangio spi for a flash chip before, so it's probably not a simple matter of setting some defines to use it.

Given that the schematic on sparkfun's site is dated a year ago (10/28/2020) it feels unlikely that they'll fix it with a speedy board revision. The closest I've found to a sparkfun statement about the flash chip is from November 2020: https://forum.sparkfun.com/viewtopic.php?f=182&t=54214&p=220455&hilit=samd51+flash#p220447

The flash chip is tied to the bootloader so it's not available for general use unless you remove the bootloader and replace it with your own custom firmware.

#

https://github.com/sparkfun/MicroMod_Processor_Board-SAMD51/issues/2

Thanks for the issue, a fix is on the way. I'll update in a few weeks when the new version is ready. When that happens feel free to reach out to SparkFun's customer service to get a replacement.
though this from September 15 does point at them issuing a revision...

GitHub

Swapped SPI1 lines External W25Q128 flash CIPO/COPI lines are swapped, so flash is unusable with SPI. Equipment SAMD51 MicroMod v1.2 ATP (All-The-Pins) v1.1 breakout Custom motherboard Workaround S...

manic glacierBOT
#

@dhalbert Iโ€™ve asked, but itโ€™s not clear if theyโ€™re going to fix the board. As you note, itโ€™s out of stock and thereโ€™s no info on re-stocking plans, so my guess is that theyโ€™re aware and planning to fix it. Or it could be that the chip shortage is delaying any new spins.

The patch does allow the board to work, which canโ€™t be said of the currently available version. If you donโ€™t want to pull this in yet, then perhaps it makes to take the board off circuitpython.org until the hardware is fix...

onyx hinge
#

I don't understand the comment on the sparkfun forums about the flash chip being for use of the bootloader only, do you?

stoic rain
#

Yeah, I was thinking the same thing is likely @onyx hinge.

#

Nah, that response made no sense, which is why I kept looking at it. My guess is that something got messed up with they switched from QSPI to SPI in the board design.

manic glacierBOT
stoic rain
#

I did find that the HOLD and WP pins also need to be pulled high. I got an equivalent external flash chip working on an Arduino MKR Zero that I โ€œhaxpressedโ€. But if MOSI/MISO donโ€™t work, itโ€™s kinda for naught.

manic glacierBOT
idle owl
gilded cradle
idle owl
proven garnet
idle owl
#

It means it got missed in the update.

manic glacierBOT
proven garnet
#

Oh hey, I guess I'm late to the party haha

idle owl
proven garnet
idle owl
idle owl
#

This commit shows what the patch changed.

#

@proven garnet Dylan is supposed to be working on the last libraries that got missed by the patch (the patch skipped a number of libraries, as always). But she apparently hasn't gotten to this one yet.

proven garnet
manic glacierBOT
idle owl
#

That patch turned out to be kind of meandering, so there's a lot to it.

proven garnet
#

Will do, I'll get to it ASAP!

idle owl
#

Thanks so much!

slender iron
hidden oxide
#

How good

#

๐ŸŽ‰

solar whale
#

Glider connected right up to my glasses driver board...so far just using the explorer.

#

Very nice!

manic glacierBOT
proven garnet
idle owl
#

@proven garnet Thanks so much! For the record, that does explain the anomaly earlier with the PR submitted by another community member. Good catch! I completely missed it.

#

Actually, I'm wrong, it's a slightly different repo altogether ๐Ÿ˜„

#

oops.

#

But still!

proven garnet
#

My pleasure! Glad I was able to help! kgsHype

idle owl
#

So there's no explanation for the anomaly earlier after all. Oh well! ๐Ÿคท๐Ÿปโ€โ™€๏ธ

proven garnet
#

I'll stay on the lookout for others

idle owl
#

@proven garnet Are you interested in helping out with this? I can get you a short list if you'd like.

#

Basically it'd be pretty much what you just did, although some of the changes might already be present.

proven garnet
idle owl
idle owl
proven garnet
#

Sounds good! I'll work off of that when it's ready! ๐Ÿ™‚

idle owl
#

Thanks so much! Really appreciate it. The cleanup after running a patch like that can be tedious, and Dylan's the only one working on it. So this is immensely helpful.

trim elm
#

@idle owl @proven garnet Ok, here's a gist of the files. https://gist.github.com/dherrada/9d8b7abd23c3c7a512615508b6258c8b
file_has_none are (mostly) repositories that aren't fully set up and some repositories that aren't circuitpython libraries, although I'll have to look into gps and st7565

file_has_text_1 are libraries that didn't have the initial patch applied to them

file_has_text_2 are libraries that did have the initial patch applied to them

Gist

GitHub Gist: instantly share code, notes, and snippets.

idle owl
#

OK, asyncio is still WIP. So skip that one.

trim elm
#

Let me know if y'all have any questions or anything is confusing

proven garnet
#

Will do! blinkacomputer

idle owl
trim elm
#

Yes

idle owl
#

OK.

trim elm
#

text 2 are the ones that don't need to be

#

and none are the ones that don't have either and need to be looked at

idle owl
#

@proven garnet Start at the bottom of the file_has_text_1 (43) "pylint-2.7.1" part of the list, please. Then Dylan can start at the top of the list.

trim elm
#

Works for me!

proven garnet
#

Sounds good!

trim elm
#

Thanks @proven garnet

idle owl
#

@proven garnet But as I said, skip asyncio.

proven garnet
#

@idle owl got it! And no problem @trim elm !

idle owl
#

@lone axle Do I remember we started suggesting using bitmap_label over label? Or what am I remembering w/r/t that?

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.0.0 on 2021-09-20; Raspberry Pi Pico with rp2040
Board ID:raspberry_pi_pico

Code/REPL

import time
import board
import busio
import terminalio
import displayio
import aesio
import microcontroller

from config import config
import digitalio


key = b'Sixteen byte key'
inp = b'CircuitPython!!!' # Note: 16-bytes long
outp = bytearray(len(inp))
cipher = aesio.AES(key, aesio.MODE_CBC)
cipher.encrypt_...
proven garnet
onyx hinge
#

Looks like the old 'local' step of pylint didn't get removed from the yml file

#

that's a guess bu tI notice there's (test code) and (tests code)

lone axle
# idle owl <@!382939733107408897> Do I remember we started suggesting using `bitmap_label` ...

Yep, that is correct. I do generally recommend folks use bitmap_label instead of label It tends to use a bit less RAM in the cases that I have tested, and it allows for some additional tricks with colors that are not possible with label The API for both should be identical so swapping from one to the other generally should just be a matter of changing the import and possibly initializer call.

onyx hinge
#

in the list of steps

idle owl
#

Oh.... ok

proven garnet
idle owl
idle owl
# proven garnet So I should remove that hook?

Yes, Jeff is right, remove - repo: local hooks: - id: pylint_tests name: pylint (tests code) description: Run pylint rules on "tests/*.py" files entry: /usr/bin/env bash -c args: ['([[ ! -d "tests" ]] || for test in $(find . -path "./tests/*.py"); do pylint --disable=missing-docstring,consider-using-f-string $test; done)'] language: system

#

That might fix it.

proven garnet
#

Youuuuu got it!

#

I think at least the ones I've seen so far have needed this fix, I can keep applying it if that's the fix

manic glacierBOT
#

Thanks! There does seem to be something fishy going on here.

First, as to the TypeError message you got: decrypt_into takes its output as the second argument, but as inp is a bytes object it cannot be modified. Unfortunately, the error message does not make this clear.

Second, on investigation I'm not sure whether our AES code is correct. I was able to get a correct decryption back to the original plaintext while using CTR mode but not while using the other modes.

Here's the f...

proven garnet
#

I'm also noticing at least on the same repo it's running a workflow called Run Tests that I haven't seen before, is that outdated? I can remove that workflow if its a relic, here and on any others I encounter

idle owl
#

I'm not sure.

#

Everything passed though, I see.

#

@proven garnet Can you title the PRs "Pylint and RTD update patch, and other fixes" or something a little more descriptive? I'm going to tag the review team on it and, while Dylan, you and I all know what you're going for here, the review team may not. Thanks!

#

This one is fine, but moving forward.

onyx hinge
#

Yes, I think so.

trim elm
#

Oh hah yeah I should probably title them that too

idle owl
trim elm
#

@idle owl @proven garnet I'm pretty sure that is for libraries that have a tests/ directory. I don't think we removed it, but I can't say for sure

idle owl
#

I thought maybe that was the case too.

trim elm
#

Hmm

idle owl
#

But checked.

#

@proven garnet Let's leave the tests CI alone for now. Your PR is fine as-is. We'll revisit if necessary at a later time.

proven garnet
idle owl
manic glacierBOT
manic glacierBOT
vocal kindle
#

I'm poking at Blinka/PlatformDetect on MicroPython, and hitting some ignorance on using the functions, or perhaps limitations on the available functions. I want to identify my specific board, which I've built a MicroPython firmware for that identifies it on bootup.

MicroPython v1.17-123-g7f1434442 on 2021-11-10; M5Stack STAMP-PICO with ESP32-PICO-D4

But when I use the functions from learn.ada, it only lists the generic platform...

print(detector.chip.id)
ESP32

since the integrated function only responds with ESP32, not the string from the firmware as listed above

>>>import sys
>>>print(sys.platform)
esp32

Is there a better function I could/should use to get it to return either of the strings below:

M5Stack STAMP-PICO with ESP32-PICO-D4

#

oh...this. Now how to make use of that in PlatformDetect

>>> print(os.uname().machine)
M5Stack STAMP-PICO with ESP32-PICO-D4
#

Had to modify my google query a few more times to find that answer

proven garnet
#

@idle owl we should only disable duplicate code as necessary right? Wait for the CI action to fail? I've been turning them on in my forks to check ahead of time, so I can keep the PRs cleaner if this is the case.

idle owl
proven garnet
#

@idle owl sounds good!

slender iron
#
SD card CSD
bf168000 a96db7ff 325b5a83 00002f00

lexar 16G
800a4000 00774d7f 325b5900 00400e00

sandisk 8G
800a4040 003b377f 325b5900 00400e00

samsung 64G sdxc
800a4040 01dcff7f 325b5900 00400e00
#

bit 1 is always 1

#

which is bit 1?

onyx hinge
#

I think this code is right, at least for cards under 32GB capacity. I think there's a bug that says it's wrong for 32GB and up cards

slender iron
#

I don't think I've shifted in bit 1

#

the numbers would be right if all shifted one more byte I think

vocal kindle
#

under PlatformDetect, chip.py, in this function, is it cluttering the code too much to distinguish the variants of the ESP32 (i.e: ESP32-S2, ESP32-C3, ESP32-PICO-D4 in my usage), versus simply keeping the variants identified simply as "ESP32"
https://github.com/adafruit/Adafruit_Python_PlatformDetect/blob/main/adafruit_platformdetect/chip.py#L153:L170

GitHub

Contribute to adafruit/Adafruit_Python_PlatformDetect development by creating an account on GitHub.

#

obviously that doesn't currently exist, but as I'm adding the ability to do so, eg:

if platform == "esp32":
    self._chip_id = chips.ESP32
    return self._chip_id

I could use the output of the below function to distinguish a particular binary, or output ESP32 if it's not distinguished

>>>print(os.uname().machine)
M5Stack STAMP-PICO with ESP32-PICO-D4
tulip sleet
idle owl
#

I'm leaving it for now, but I have no idea why it got added.

manic glacierBOT
proven garnet
onyx hinge
#

@proven garnet in this case, yes, it would be a safe change to do so, because the use of the mp3 / wave file is done by the time the function returns.

#
896             with audiopwmio.PWMAudioOut(
897                 board.SPEAKER
898             ) as audio:  # pylint: disable=not-callable
899                 mp3file = audiomp3.MP3Decoder(open(file_name, "rb"))
900                 audio.play(mp3file)
901                 while audio.playing:
902                     pass
``` this is line 899 in my copy
#

yeah there are two similar instances, one for wave files and one for mp3 files

#

I think you have to change it around a bit so only change it if you're going to test it. (because the result of 'open' is passed to a function, not put in a named variable right now)

#

ignoring it is also fine with me, using a pylint:disable

proven garnet
#

with audiopwmio.PWMAudioOut(
board.SPEAKER
) as audio: # pylint: disable=not-callable
with open(file_name, "rb") as audio_file:
wavefile = audiocore.WaveFile(audio_file)
audio.play(wavefile)
while audio.playing:
pass

#

That should be sufficient, right?

onyx hinge
#

yeah that looks right

proven garnet
#

Edited the nesting

#

Got it, I'll make that change then in both those places

onyx hinge
#

OK, appreciate your attention to this!

#

I'm headed out for the night

proven garnet
#

Yup yup! Appreciate the late response!

manic glacierBOT
manic glacierBOT
bitter bronze
#

Is this the right place to ask about import problems using Mu and Visual Studio Code when trying to import adafruit_pyportal?

#

Also get import error with import board

#

My end goal is getting WipperSnapper running on PyPortal..

analog bridge
#

Will allocating an object using m_new_ll_obj keep it alive across multiple VM runs?

stuck elbow
#

no, it will just allocate it at the end of the free memory, where all the objects that are not expected to be released during the lifetime of the program go

#

the long-live objects is just an optimization to prevent memory fragmentation

analog bridge
#

so the only option is static allocation?

stuck elbow
#

only option for what?

analog bridge
#

for keeping the object alive across multiple VM run (like the board.BUS) singletons

stuck elbow
manic glacierBOT
tulip sleet
ornate breach
#

Hey Dan, Iโ€™m hoping to finish release notes for beta today. I havenโ€™t had much time the last two days to work on it.

#

I underestimated my day job work load lol..

tulip sleet
# analog bridge for keeping the object alive across multiple VM run (like the `board.BUS`) singl...

I use the "supervisor allocations" to save some data about HID devices between boot.py and the second VM instantiation (for code.py). The supervisor allocations can only be done while the VM is not running, which is a bit confusing. The last supervisor allocation allocates the vm heap with the remaining storage, so there is no more available after the vm starts.

The usb_hid that needs to remember some variable-sized data between VM's. I create a table in the boot.py VM, and pass a pointer to it the calling VM. That routine copies the data onto the stack temporarily. When the boot.py VM finishes, it uses supervisor allocation to allocate space for that and copies it from the stack into the new supervisor allocation block, and then copies from the stack into there. This "data hoisting" up and down was the easiest way I could see to do this for a variable sized block (a few hundred bytes).

manic glacierBOT
tulip sleet
ornate breach
#

I was having a hard time deciphering between what was new, was a fix, etc..

#

but i think i captured all the new boards

#

and at least the asyncio initial support

crimson ferry
#

what's the difference between bytes and ReadableBuffer in readthedocs / shared-bindings?

#

Oh, bytes is an example. Is it preferred in parameter docs to call it out as readableBuffer? Or is it possible some forms of ReadableBuffer wouldn't work in a given situation? Should existing bytes references be replaced with ReadableBuffer?

#

e.g., in Espressif wifi.radio, SSID & password are ReadableBuffer but it would be strange to feed in rgbmatrix.RGBMatrix, which is also an example of ReadableBuffer

idle owl
idle owl
onyx hinge
#

@crimson ferry bytes is a specific type and ReadableBuffer is shorthand for all types that can be treated in a certain way by the core C code, including bytes. Not all ReadableBuffers will make sense in all contexts, but I tend think about type hints as saying what is possible, not what is sensible. This may be inflexible thinking and I'm open to other viewpoints.

crimson ferry
#

in theory, I could set an SSID with a rgbmatrix.RGBMatrix? (technically, SSID can be any bytes, there are no restrictions in the spec)

#

that seems to be the decider for me... if I do it, will it break?

#

if so, maybe I should call it out as what will not break

onyx hinge
#

I'm not sure. An RGBMatrix, when treated as a ReadableBuffer, will probably be more bytes than an ssid should have. (but the type system can't say "it should be a ReadableBuffer and no more than 16 bytes", or whatever the requirement is)

crimson ferry
#

OK, I'll live with the ambiguity ๐Ÿ˜‰

onyx hinge
#

additionally it looks like the length isn't verified to be valid, when it comes specifically to the implementation for espressif MCUs, so you will be able to make a HardFault if you try it

crimson ferry
#

oh, interesting

onyx hinge
#
    memcpy(&config->ap.ssid, ssid, ssid_len);
    config->ap.ssid[ssid_len] = 0;
``` I don't see any validation of ssid_len, which in C is the length of the ReadableBuffer.  Hence I speculate that you might be able to get a HardFault or other ill behavior if you (say) try to set `ssid=bytes([0] * 4096)`
crimson ferry
#

lol oops, we should probably fix that... I'm in there now, I'll see if I can

onyx hinge
#

thanks!

#

similarly for all the other parameters passed in as a pointer + length, there's also password & bssid

crimson ferry
#

I'll research limits on password, bssid is fixed length (6 Bytes)

onyx hinge
#

you can write sizeof(config->ap.ssid) etc to get the size in bytes of the array

crimson ferry
#

64, boom, thx

onyx hinge
#

So, untested, if you write ssid_len = MIN(ssid_len, sizeof(config->ap.ssid)) you would take at most 32 bytes of ssid data, though then the assignment of config->ap.ssid[ssid_len] = 0 because it would potentially assign ap.ssid[32] which is out of bounds. memset(config->ap.ssid, 0, sizeof(config->ap.ssid)); memcpy(...) would ensure that all non-used bytes are zeroed out. [sorry if I'm lecturing you about C you already know, for me this is stuff that I need to work through every time to get right so I'm just thinking out loud and trying to help. let me know if it is not helpful to you.]

crimson ferry
#

"C you already know" lol, not much, so thanks

idle owl
#

I'm using a PDM microphone. I'm getting values back. What do these values mean? What can I expect to be a max value? Datasheet is not helping me here. It's the one on the Circuit Playground Bluefruit (also CPX), and we have it on breakouts.

#

Is it 0-65535 or whatever that common number is?

#

I am trying to make a NeoPixel sound meter, but I want to make sure the max value I use is reasonable. It seems to be currently based on testing, but if I understood what the values meant, I could make a more informed choice.

onyx hinge
#

@idle owl it looks like it's a theoretical 0-65535 range when you specify bit_depth=16 and a theoretical 0-255 range when you specify bit_depth=8 (the default)

onyx hinge
#

but whether the maximum you can shout will really go to 65535 or 255 who can say. It helps that you have loud loud construction going on I suppose

idle owl
#

I guess I could have looked at the code.

#

Yeah, it was bad enough to register.

#

But you have to be close to it to make it work.

#

Tapping the mic with my finger I got it to 4k or something.

#

I don't want folks to have to shout. And we're planning on making it so someone could change something in the example, this is a good thing to be able to change - the threshold.

#

But I need a solid default.

#

It's 2k right now.

onyx hinge
#

It seems a bit like asking "which number should I set my mic's volume to, so that it's never too quiet & never clips", there simply is no iron clad answer.

idle owl
#

Also valid. I'm making notes in the example about what the valid options are, but to choose based on testing I guess.

tulip sleet
manic glacierBOT
analog bridge
#

Thanks @stuck elbow and @tulip sleet. Looks like I will have to use static allocation as supervisor allocations can only be done while the VM is not running.

idle owl
#

@proven garnet I missed something you were doing in your PRs. You're going to have to go back and fix it in the PRs I merged because I didn't notice until now. I explain in the FunHouse PR - please review that comment and apply it to the rest of the repos you've updated. Sorry about that!

stuck elbow
#

Or did I misunderstand it?

tulip sleet
# stuck elbow But that pull request lets you do a normal allocation, and have it moved to stat...

hmm, I think you are right, though I thought I tried this and could not use it for some reason:

// ... If movable is true, memory will be
// taken from either outside or inside the GC heap, and when the VM exits, will be moved outside.
// The ptr of the returned supervisor_allocation will change at that point. If you need to be
// notified of that, add your own callback function at the designated place near the end of
// supervisor_move_memory().
#

the semantics of movable being true or false are quite different

#

@analog bridge ^^

proven garnet
idle owl
manic glacierBOT
crimson ferry
proven garnet
idle owl
idle owl
#

I only learned this last week. ๐Ÿ™‚

#

It's basically with first_item as first_variable, second_item as second_variable:

idle owl
manic glacierBOT
tulip sleet
#

answered in #help-with-circuitpython . Please don't crosspost in multiple channels (or delete the original post if you move it).

proven garnet
idle owl
manic glacierBOT