#circuitpython-dev

1 messages · Page 53 of 1

onyx hinge
#

📆

onyx hinge
#

Howdy folks and particularly <@&356864093652516868> -- we'll be having the meeting in about 65 minutes from now! Please take this time to add any notes to the notes doc: https://docs.google.com/document/d/1S1W7c3Rq2PIV4TVrRahtz3Em5cfJpEEPi6sSyW_mk5U/edit?usp=sharing

tulip sleet
#

@lone axle all these "unpin sphnix" PR's -- it's tested, is that right, so you are just looking for approvals?

#

for a non-controversial change, you could merge without approval

slender iron
#

I was just starting to approve and merge them

tulip sleet
#

assuming you have the privs

lone axle
lone axle
# tulip sleet assuming you have the privs

I don't have privilage for it on these ones. Merge button is disabled saying it needs an Approval, and the approv button is disabled for me saying PR author cannot approve.

I am saving a list of the repos that were like this though. In the long run I think it would be great to have their permission configuration changed to match the rest of the others so that the patches can apply to all of them without the manual PR ones.

#

There are 6 more that I'll finish up after the meeting, I set it down for lunch before the meeting.

lone axle
turbid radish
#

Please tell folks about the newsletter - it's free top subscribe, no ads or spam

#

to

midnight ember
#

a lot of new PR authors, very nice to see. 🙌

solar whale
#

👋

manic glacierBOT
gilded cradle
#

You're welcome

silver tapir
#

The HEIF encoder is a bit complex, but it would be a nice alternative format. Jpeg is a bit old :p
(but it's kinda like vfat, it will never die...)

slender iron
#

could be a beta too

#

I definitely think a release this week would be good

#

I think the idf update and the web workflow changes are unreleased

tulip sleet
#

i certainly can do one sooner rather than later.

slender iron
#

thank you!

tulip sleet
#

I will merge from 8.2.x and maybe update frozen

lone axle
#

ability to update WIFI credentials via on-display controls would be awesome!

slender iron
midnight ember
#

That's a neat project DGlaude! Would like to see a demo of that.

midnight ember
tulip sleet
#

@mortal kernel do you still have a Ventura machine you could make comparison traces on? I saw delayed writes of some kind when using the initial cluster-number-only traces, but it was not clear if the "delays" were unrelated to the original write transaction or not. Thanks.

midnight ember
#

Been seeing a lot of Mac related questions in discord lately, seems like a big problem. Good luck to the Devs!

mortal kernel
tulip sleet
midnight ember
#

@gilded cradle All your efforts with the Qualia library is greatly appreciated. There are a lot of new displays and they keep coming out with new ones.

silver tapir
#

Please sidetrack :p

midnight ember
#

ESP BLE 🙌

gilded cradle
#

Thanks @midnight ember

mortal kernel
midnight ember
#

Take care of your mom. ❤️ Been praying for you and your family.

#

Welcome @short tendon ! First meeting. blinka_cooking

tulip sleet
#

could you put your exact tests in the issue? or could be in the PR, though I'm not sure where, maybe tests/circuitpython-manual

mortal kernel
#

It's in the issue.

tulip sleet
#

ah ok, I saw that line. I thought you were maybe copying files of various sizes

#

i had some multi-file copies that generated cp errors

mortal kernel
#

Multi-file copies are good for hitting secondary effects, but tend to muddy diagnosis.

tulip sleet
#

I am going to blog the issue in the Adafruit blog and also point to the current "best" workaround (czei's remount script). Will also post on Mastodon. This is all to increase exposure, and also make more people aware and maybe report it.

mortal kernel
#

iOS results so far are a relief. The >8MB results are disappointing because my fake FAT16 won't be a viable workaround.

tulip sleet
wraith crow
midnight ember
#

I used that and it did work

slender iron
#

sockets also have finalizers

gilded cradle
#

Thanks for hosting Jeff

midnight ember
#

but moving the session outside the while true loop made the biggest difference and _free_socket became unneeded at that point.

mortal kernel
lone axle
#

Thanks for running the meeting Jeff. Hope everyone has a nice week!

midnight ember
#

Thank you for hosting Jepler 🤗

onyx hinge
#

👋

#

do good work everybody

#

I think the other part of "make gc 'do the work' of collecting unused sockets" would be that a failed socket() call that returns the equivalent of an EMFILE error would gc.collect() and try a second time before failing for real

midnight ember
#

oh i had them spread all over the place 😅 because of the early 8.0beta with leaked sockets issue which was eventually fixed. so i thought by 8.2.8 that would have been cleaned up, so i removed them all, and it appears it wasn't... at least not with the way I was attempting to iterate through sessions.

#

@short tendon fyi that multi API script hasn't worked in a while. last time i updated it was before Twitter removed API access. most of those API's likely no longer work. part of updating the API examples to be 9.0 ready is going back through them all to ensure they work. Like the Twitch API example I found was broken so I'm sure there will be more.

onyx hinge
#

Here is the notes document for next Monday’s CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1jtCjgV5NExzjBZxgPpE8dY_D42g4DAJv6w24TaARTRw/edit?usp=sharing

manic glacierBOT
empty salmon
#

I wanted to circle back on a question I posted recently regarding USB VID:PID
(I would link it but as mentioned, it’s very difficult to find ‘human’ content in this channel)
I am designing an education board which will ship with CircuitPython and which uses the RP2040. The Adafruit guide indicates people in my situation need to contact the appropriate manufacturer for getting an assigned PID.

I reached out to Raspberry Pi (via their online form) on Thursday and was granted a PID today.

… so the process works 👍🏼🤩

short tendon
manic glacierBOT
#
efc

@anecdata, thank you for suggesting safemode.py. I have created the following safemode.py script and the devices I am testing have now been up for nearly 3 days. In those three days I have detected at least 4 crashes into safe mode, but the device has reset itself and continued on with the task.

import microcontroller
microcontroller.reset()

I would love for the wifi tools to be more stable, but this workaround at least keeps us up and on the network. Thank you!

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.5 on 2023-11-15; Adafruit-Qualia-S3-RGB666 with ESP32S3

Code/REPL

https://github.com/adafruit/Adafruit_CircuitPython_Qualia/blob/main/examples/qualia_paint.py

Behavior

After about every 10 reads or so from the capacitive touch screen, there is a noticeable delay. You can really tell by running the paint program:
![IMG_5512](https://github.com/adafruit/circuitpython/assets/2681417/db0b1b3d-...

slender iron
#

anyone worried about me requiring a directory exist and be empty for a mount point?

#

that way it'll be listed when listing the parent directory

stuck elbow
#

that's how posix does it, except for being empty

slender iron
#

if it isn't empty then the files aren't listed when something else is mounted right?

mortal kernel
slender iron
#

👍

mortal kernel
#

Linux has a "union" mount that can be used with pseudo filesystems with a notion of upper and lower directories, but I've never used it.

slender iron
#

I haven't either

manic glacierBOT
#

Currently to toggle the usb filesystem, usb hid and midi, we need to have to edit boot.py.

However, if you want to toggle it frequently it becomes quite annoying.
And it's hard for applications to just set it for the next boot in a clean manner, since there is no such ready-made api.

For ljinux, from 6.x I had implemented a config.json which stored stuff for boot.py and the os to read/write.
But during 8.x I switched to using settings.toml and the os just set the values with m...

#

CircuitPython version

8.x / 9.0

Code/REPL

N/A

Behavior

When dragging something into the web-workflow upload button, it works fine the first time, but if the upload fails / you reload the page / anything unsuccessful happens, the selection is not cleared, even if you reload the page.
If you try to use the same upload box, the drag and drop fails and you get the thing you dragged to open in another tab.
If you try to use the other upload box (the...

manic glacierBOT
#

A lot of the configuration is either complicated (HID report descriptors), or you want it to be conditional, such as hiding the CIRCUITPY drive, but only if a button is not pressed, etc. So, yes, you could conditionalize the boolean things, or set their default values, but it would be a subset of what you can do in boot.py.

(The title of this issue says "only", but it seems like that's not what you said in your post.)

onyx hinge
#

@tulip sleet it's possible that the USB descriptor configuration stuff can be made somewhat less complicated now that we have host_malloc...

#

the core C code that is

tulip sleet
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.6 on 2023-09-12; Raspberry Pi Pico with rp2040

Code/REPL

import rotaryio
import board

last_encoder_position = None
encoder = rotaryio.IncrementalEncoder(board.GP7, board.GP8, 1)
while True:
    position = encoder.position
    if last_encoder_position is None or position != last_encoder_position:
        print("Encoder pos: " + str(position))
    last_encoder_position = position

Behavior

H...

manic glacierBOT
manic glacierBOT
manic glacierBOT
gilded cradle
#

@onyx hinge I have some questions regarding the 3.7" 240x960 bar display. Is that one you got working?

onyx hinge
#

@gilded cradle I don't remember. I can go look at what I have. I think one of them was 240x960, that sounds familiar.

gilded cradle
#

Ok thanks, I can't get the overscan_left + width to be > 320, but timing says it should be 360.

#

So last 40 pixels are cut off

onyx hinge
#

I have a screen marked "HWTL31601G02-04" but it's about 3.3" and I have a screen marked "BL-HD458002" but it's about 4.8" -- so I may not have that one

gilded cradle
#

The 4.8" one is actually 4.58", hence the hd458 and I got that working. The one I have that is causing trouble is marked HD371001C40.

#

So it doesn't sound like you have it.

onyx hinge
#

what i have

manic glacierBOT
gilded cradle
#

Ok, I think the TL032 one is already done as well.

#

I'll check with limor and see if she has some arduino code or something I can go off of. Thanks @onyx hinge.

manic glacierBOT
onyx hinge
gilded cradle
#

yeah

onyx hinge
#

pretty sure I don't have one. should I order one?

gilded cradle
onyx hinge
#

I hope so too

gilded cradle
#

🙂

tidal kiln
#

does busio.I2C/SPI/UART.unlock() ever throw an exception?

tulip sleet
#

also there is no lock/unlock or UART, since it's not a shared bus

tidal kiln
#

oops. yah. was just naming all the busio things.

tulip sleet
#

i forget too 🙂

#

i looked at the code -- this is not from memory

tidal kiln
#

and that's a generic behavior, right? (attempting to use a deinitd object)

tulip sleet
#

right, those classes check all over the place for deinited objets

tidal kiln
tulip sleet
#

ok, Blinka might be a different story

#

I'll look

tidal kiln
#

but Blinka should try to match

tulip sleet
#

yes

tidal kiln
#

so just wanting to verify specifics of what's being matched

#

i.e. native CP behavior

tulip sleet
#

I think we wanted to make unlock() be idempotent. So, yes, Blinka should not complain.

manic glacierBOT
tulip sleet
#

let me check Espressif, because it uses a semaphore

tidal kiln
#

or complain in the same way CP does

#

which is never?

tulip sleet
#

right, never, just double-checking on Espressif

#

yah, same on Espressif

tidal kiln
#

cool. thanks. so fix for Blinka should be trivial.

tulip sleet
#

i think so

onyx hinge
#

thanks for the merges dan

#

Jpeg decoding is not quite right

#

but it's clearly something!

devout jolt
onyx hinge
#

Now it's perfect

manic glacierBOT
#

Something's wrong with the doc build; I'll get that sorted soon.

Testing file:
test

Testing code:

import jpegio
import displayio
import adafruit_pycamera
import numpy
cam = adafruit_pycamera.PyCamera()
j = jpegio.JpegDecoder()
with open("test.jpg", "rb") as f: b = f.read()
w, h = j.decode(b, None)
print(w, h)
bm = displayio.Bitmap(w, h, 65535)
j.decode(b, bm)
arr = ulab.nu...
stuck elbow
#

jpegio sounds like arpeggio

onyx hinge
#

hah

#

it's the equivalent of tra la la in some old tavern song

manic glacierBOT
slender iron
#

@onyx hinge I have a Q about background tasks when you have a chance. On reset, the whole callback structure is cleared to zero. The webworkflow only sets it function once so if it is queued during a reset, then it stops working

#

Should I change it to only clear next?

#

or have web workflow set func again?

#

seems to me that any CB off the python heap should be untouched

onyx hinge
#

@slender iron trying to piece together my train of thought. is this background_callback_reset?

slender iron
#

yup. can video if that's easier too

onyx hinge
#

and changing it for heap vs non-heap objects was at 64460107531ee110c809edec7823a557e1455b49

slender iron
#

yup

onyx hinge
#
jepler@bert:~/src/circuitpython$ git grep '^static background_callback_t'
ports/cxd56/supervisor/port.c:static background_callback_t callback;
supervisor/shared/status_bar.c:static background_callback_t status_bar_background_cb;
supervisor/shared/tick.c:static background_callback_t tick_callback;
supervisor/shared/usb/usb.c:static background_callback_t usb_callback;
supervisor/shared/workflow.c:static background_callback_t workflow_background_cb = {NULL, NULL};
```Here are the non-heap background_callback objects I can spot easily
#

so this could be affecting a number of things

slender iron
#

haha, I was just going to look at that

onyx hinge
#

So background_callback_reset should .. reset all GC-based ones but leave all non-GC based ones?

slender iron
#

ya, I think so

onyx hinge
#

is the memset just in the wrong spot?

slender iron
#

I assume a non-heap one will use a non-heap function and data

onyx hinge
#
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c
index cceda7d413..68a174e806 100644
--- a/supervisor/shared/background_callback.c
+++ b/supervisor/shared/background_callback.c
@@ -130,7 +130,5 @@ void background_callback_reset() {
             *previous_next = cb;
             previous_next = &cb->next;
-            cb->next = NULL;
             new_tail = cb;
-        } else {
             memset(cb, 0, sizeof(*cb));
         }
slender iron
#

why would we need the memset at all?

onyx hinge
#

I'm not sure; it was part of the original design is all.

#

it helps make things GC'able but this is only called when zapping the heap

#

(right?)

slender iron
#

ya, I believe so

#

could check data too

onyx hinge
#

well test with -memset too and see how it goes? audio and keypad would be good to check, one or the other

slender iron
#

so any callback that reference data on the heap are dropped too

#

👍

onyx hinge
#

could check if the callback's data is heap and clear that too

diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c
index cceda7d413..99170d6015 100644
--- a/supervisor/shared/background_callback.c
+++ b/supervisor/shared/background_callback.c
@@ -118,5 +118,5 @@ void background_callback_end_critical_section() {
 
 
-// Filter out queued callbacks if they are allocated on the heap.
+// Filter out queued callbacks before tearing down the heap
 void background_callback_reset() {
     background_callback_t *new_head = NULL;
@@ -127,11 +127,9 @@ void background_callback_reset() {
     while (cb) {
         background_callback_t *next = cb->next;
-        if (gc_ptr_on_heap((void *)cb)) {
+        // unlink any callback that is either on the heap itself, or refers to heap data
+        if (gc_ptr_on_heap((void *)cb) || gc_ptr_on_heap((void*)cb->data)) {
             *previous_next = cb;
             previous_next = &cb->next;
-            cb->next = NULL;
             new_tail = cb;
-        } else {
-            memset(cb, 0, sizeof(*cb));
         }
         cb = next;
slender iron
#

Yup, that's what I'm thinking

onyx hinge
#

oh but in case you unlink a callback that is off-heap, but its data is on heap you DO need to clear .. something

#

you need to clear prev? ```c
void PLACE_IN_ITCM(background_callback_add_core)(background_callback_t * cb) {
CALLBACK_CRITICAL_BEGIN;
if (cb->prev || callback_head == cb) {

slender iron
#

I'd assume the owner of it would reset the data

onyx hinge
#
diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c
index cceda7d413..07d4461a7c 100644
--- a/supervisor/shared/background_callback.c
+++ b/supervisor/shared/background_callback.c
@@ -118,5 +118,5 @@ void background_callback_end_critical_section() {
 
 
-// Filter out queued callbacks if they are allocated on the heap.
+// Filter out queued callbacks before tearing down the heap
 void background_callback_reset() {
     background_callback_t *new_head = NULL;
@@ -127,11 +127,10 @@ void background_callback_reset() {
     while (cb) {
         background_callback_t *next = cb->next;
-        if (gc_ptr_on_heap((void *)cb)) {
+        // unlink any callback that is either on the heap itself, or refers to heap data
+        if (gc_ptr_on_heap((void *)cb) || gc_ptr_on_heap((void*)cb->data)) {
             *previous_next = cb;
             previous_next = &cb->next;
-            cb->next = NULL;
+            cb->prev = NULL; // invariant for un-queued callbacks
             new_tail = cb;
-        } else {
-            memset(cb, 0, sizeof(*cb));
         }
         cb = next;
slender iron
#

only if it is removed I think

#

👍

onyx hinge
#

are you going to test with it? if that doesn't work we should probably go to video and see what we can figure out together. I'll be around for a couple hours.

slender iron
#

ya, I'll test this. I think it'll work

onyx hinge
#

now I'm looing at previous_next = &cb->next next to cb->next = NULL and I'm not sure this is a correct 'remove from linked list' operation.

#

I need pictures or something

slender iron
#

ya, I think the old code completely cleared it

#

well, maybe not. new_head is set via previous_next

#

I'm right there with you

#
        // Unlink any callbacks that are allocated on the python heap or if they
        // reference data on the python heap. The python heap will be disappear
        // soon after this.
        if (gc_ptr_on_heap((void *)cb) || gc_ptr_on_heap(cb->data)) {
            cb->next = NULL;
            cb->prev = NULL; // Used to indicate a callback isn't queued.
        } else {
            *previous_next = cb;
            previous_next = &cb->next;
            new_tail = cb;
        }
onyx hinge
#
// Filter out queued callbacks that refer to GC heap before tearing down the heap 
void background_callback_reset() {
    CALLBACK_CRITICAL_BEGIN;
    background_callback_t *cb = (background_callback_t *)callback_head;
    callback_head = NULL;
    callback_tail = NULL;
    while (cb) {
        background_callback_t *next = cb->next;    
        // Set 'not on queue' invariant
        cb->next = cb->prev = NULL;
        if (!gc_ptr_on_heap((void *)cb) && gc_ptr_on_heap((void*)cb->data)) {
            // This background task was queued and not on the GC heap,
            // so re-enqueue it
            background_callback_add_core(cb);
        }
        cb = next;
    }
    // Flag shouldn't be set here, but clear it anyway
    in_background_callback = false;
    CALLBACK_CRITICAL_END;
}
#

no that's not so good because background_callback_add_core also sets/clears CALLBACK_CRITICAL_END and has the side effect of calling port_wake_main_task

#

callback_add_core2? 🤣

slender iron
#
            *previous_next = cb;
            previous_next = &cb->next;
            cb->prev = new_tail;
            new_tail = cb;
#
  1. set next of the previous cb 2. set our next to be set 3. set our prev to the old tail 4. now we're the tail
thorny jay
# midnight ember That's a neat project DGlaude! Would like to see a demo of that.

Thanks to @onyx hinge for reading my notes, I felt I made it long and complicate but he did read that great.
DJDevon3: As already hinted here, I don't plan to go on Show and Tell with my doorbell project, because it end at 2AM (my time)... and pressing the doorbell button will wake up everybody (also I have 4 Pavlov's dogs that go check the entrance door when they hear the old doorbell).
Picture 1: This is my bodge wire job (the blob is some UV nail gel to secure the cable).
Picture 2: This is the central relay that open/close 4 separated circuit at the press of the main doorbell button, that way I can work various solutions with the peace of mind that some sound will be produced even if my code crash.

onyx hinge
#

background_callback_add_core wants to add at the end of the list, so that a callback that pathologically re-adds itself still progresses. I don't know that the order is important during reset.

#

@thorny jay UV nail gel has many uses indeed

gilded cradle
#

@onyx hinge after looking into the settings for that display, I think there is a bug somewhere, so maybe you should pick one up after all.

onyx hinge
#

@gilded cradle OK, I will. can you put what you know so far into an issue please?

gilded cradle
#

Sure. In CircuitPython?

onyx hinge
#

yes

gilded cradle
#

Ok, will do.

slender iron
#

@gilded cradle any data you'd like in the directory listing json? I'm changing it to include whether it is writable and free space

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.5 on 2023-11-15; Adafruit-Qualia-S3-RGB666 with ESP32S3

Code/REPL

from displayio import release_displays
release_displays()

import time
import random
import displayio
import busio
import board
import dotclockframebuffer
from framebufferio import FramebufferDisplay

tft_pins = dict(board.TFT_PINS)
tft_timings = {
    "frequency": 16000000,
    "width": 240,
    "height": 960,
    "over...
gilded cradle
slender iron
#

hrm, total number of files may be hard. total size is easy

onyx hinge
#

@gilded cradle let's eliminate overscan_left. what if you simply specify a framebuffer of 360 pixels wide?

gilded cradle
#

I tried that. Same result.

onyx hinge
#

what if you ask for 368 pixels?

#

and if that doesn't work, what about 384. I am wondering if there's a required "pixels are a multiple of N", where N might be 16 or 32.

gilded cradle
#

Ok, that's working

#

So it looks like 16

onyx hinge
#

does that get you a stable display?

gilded cradle
#

yes

#

But the width might not be quite right

onyx hinge
#

cool. displayio will still think the width is too much, so I'll have to do .. something.

#

I can't find where in the esp-idf source code this "multiple of 16" error is actually being raised.

manic glacierBOT
#

I don't know the exact model of the encoder anymore unfortunately and i tried all the settings, like i said a divisor of 1 leads to the correct total counted clicks, just the way its counted is wrong (2 position changes every two clicks).

I think the problem is that the library counts every falling edge twice while not counting rising edges at all, which probably makes no difference if the encoder has more than 1 count per detent. Maybe this graphic will help:

![encoder](https://github...

gilded cradle
#

I'll have to see if I can find something like that.

manic glacierBOT
#

Do you have another non-RP2040 board to try, such as a SAMD21 or SAMD51 (or Espressif or nRF)? The internal implementation is different for those processor families. If you get different results, then that says something is different about the RP2040 implementation. We have done testing of this and it didn't seem off (for instance the rotary encoder on the MacroPad, which uses an RP2040).

manic glacierBOT
#

These details apply to RP2040; other microcontroller families may use other methods for quadrature counting

The IncrementalEncoder on the RP2040 uses all quadrature edges (different than either of the images you showed).

Each transition 00 -> 01 -> 11 -> 10 -> 00 increases an internal counter by 1, and any transition in the reverse direction decreases it by 1. (invalid glitches like 00 -> 11 or 01 -> 10 do not change the count; non-changes like 00 -> 00 do not change the count)

W...

manic glacierBOT
slender iron
#

I think we're defaulting new ESP file systems to extended

#

and not preventing their use with dual bank afterwards

manic glacierBOT
#

For a (width + left_overscan) of 360, e.g., debug info shows the following:

E (3410) cache: esp_cache_msync(35): size isn't aligned with the data cache line size (32)B
E (3410) lcd_panel.rgb: rgb_panel_draw_bitmap(742): flush cache buffer failed

Internally add extra pixels as needed at the end of a pixel row, like an automatic overscan_right.

This may not be compatible with all panels, but there's not really another alternative with this peripheral. So let's try this!

Clo...

onyx hinge
#

@gilded cradle adafruit_qualia_s3_rgb666/firmware.uf2 locally built from the code in https://github.com/adafruit/circuitpython/pull/8698 if you want to try it .. but I'll be AFK for the rest of the evening

GitHub

For a (width + left_overscan) of 360, e.g., debug info shows the following:
E (3410) cache: esp_cache_msync(35): size isn't aligned with the data cache line size (32)B
E (3410) lcd_panel.rgb: r...

slender iron
#

We are checking for extended with dualbank

#

its in shared-bindings

#

(I expected common-hal)

gilded cradle
#

Thanks @onyx hinge

onyx hinge
#

I'll actually try it tomorrow and get it fixed for real @gilded cradle

gilded cradle
#

Thanks @onyx hinge

manic glacierBOT
manic glacierBOT
#

I ran the test code.py from #8690 and didn't see any delays/hangs in the timer printouts and was able to copy multiple files via web workflow without the webpage crashing. Thanks!!! :grin:

I successfully copied a 4Mb file which did hang the code.py file while the transfer was happening but once the transfer finished everything behaved normally.

I was able to hang the code.py running on the serial terminal by doing a page refresh on the web workflow directory listing, at which point the...

lone sandalBOT
manic glacierBOT
#
  • Fixes #8489.

As suggested in https://github.com/adafruit/circuitpython/issues/8489#issuecomment-1836574464, use DMA when the PIO transfer size exceeds the FIFO depth. Since the FIFOs might or might not be joined, figure out the FIFO depth in the constructor and remember it. (It's hard to retrieve the JOIN info from the config, so just use an extra byte to remember it.)

Tested using the test program in #8489 from 1-12 pixels. No jumping seen.

This is close to my first foray into PIO...

onyx hinge
#

@gilded cradle I still don't have that display 'in hand' but I double-checked that I don't get an exception when setting up a display with ```
"width": 240,
"overscan_left": 120,
"height": 960,

gilded cradle
onyx hinge
#

OK.

#

FWIW if a is an int, then a / 16 in C is a lot like a // 16 in Python: it doesn't result in a float like a / 16 does in Python or Javascript.

gilded cradle
#

Ah ok. Well, tried again and it's working this time, so I'm not sure what happened the first time.

#

@onyx hinge ^

onyx hinge
#

woohoo thank you for re-testing!

gilded cradle
#

yw

onyx hinge
#

@gilded cradle so the bars show correctly and the displayio width of the panel is what it should be?

gilded cradle
#

Let me verify...

onyx hinge
#

(it prints a width of 240 here)

gilded cradle
#

yes

onyx hinge
#

thank you! your notes and testing were helpful

gilded cradle
#

Awesome. Thanks for fixing so quickly.

manic glacierBOT
#

The cause of this was incorrect code in background task reset. This happens after code.py is run. Background tasks are a linked list of callback objects with function and data to call when running background tasks. The web workflow has a callback object it reuses to queue its work and sets the function to call once at the start. The background task reset code was completely zeroing the whole callback object including the function pointer and breaking it forever more. #8699 preserves callbacks...

tulip sleet
#

@slender iron @onyx hinge I am making an 8.2.9 release. Anything to backport from main? I don't think so.

slender iron
#

not that I can think of

onyx hinge
#

nothing on my mind

slender iron
#

web workflow issues are improved on 9

onyx hinge
#

if you're doing a 9 release I wouldn't mind getitng the jpeg decoder in 🙂 I just marked it ready for review.

tulip sleet
#

I will do a 9 release soon. I was just going to ask about those pending PR's.

orchid basinBOT
manic glacierBOT
slender iron
#

@onyx hinge I just replied on the flipper zero board def

#

0x400x is IDF defaults and are probably wrong for circuitpython

onyx hinge
#

oh dang, I thought it was OK to go in. I'm sorry.

slender iron
#

I know, we overlapped

manic glacierBOT
tulip sleet
#

We can put it in as is and ask that they change it. Not sure it's worth reverting.

slender iron
#

ya, fine to leave IMO

#

its on main so it won't be released immediately

manic glacierBOT
#

I ran the test code.py from #8690 and didn't see any delays/hangs in the timer printouts and was able to copy multiple files via web workflow without the webpage crashing. Thanks!!! 😁

Yay! Thanks for testing!

I successfully copied a 4Mb file which did hang the code.py file while the transfer was happening but once the transfer finished everything behaved normally.

This is expected. The web workflow code waits for the whole file before returning to python code. I don't think this ...

crimson ferry
#

does CP 9 now have everything from CP 8?

tulip sleet
#

no, i have to merge up

manic glacierBOT
#
[adafruit/circuitpython] New branch created: 8.2.x-to-main-2023-12-06
#

Could you explain this in more detail please? I'm not sure if you mean the REPL or not.

I have a tio terminal session connected to the micro controller, doesn't matter if it's in the REPL or running a python program.

I also have the web workflow file browser open in a web browser window (http://10.0.0.218/fs/#/) .

If I hit the refresh page button on the web browser the web workflow web page refreshes but the tio serial terminal hangs and will not respond to any input including Ctrl...

tulip sleet
onyx hinge
#

@lone axle not sure who I should ask, but my addition of the pycamera library to the bundle seems to have gone wrong. My library got moved to the end of its list and with no description; the files in it don't seem to be in the bundle. https://github.com/adafruit/Adafruit_CircuitPython_Bundle/commit/f0a9f54ebbaf2d79b2d66f48155bbc6a01f01089

#

and something happened to another module but that's my fault and I know why ..

#

is it because I was missing ".git" on the URL?

lone axle
lone axle
onyx hinge
#

@lone axle I took the liberty of requesting your review

manic glacierBOT
crimson ferry
#

exceptions know the line numbers where they're generated, but in general... is the runtime self-aware about what line number is executing? it would be super-handy for safemode to document where it went bad

mortal kernel
tulip sleet
crimson ferry
#

is it worth an issue for enhancement? are there other non-exception circumstances besides safemode when execution stops and the runtime would still be intact?

manic glacierBOT
tulip sleet
manic glacierBOT
#

It would be very helpful to know which line number was executing when a safemode occurred, perhaps with a supervisor attribute.

It's a reasonably-involved process (not beginner-friendly) to make a debug build, collect a backtrace, and decode it. And sometimes the backtrace is corrupted, or otherwise incorrect due to different build parameters with DEBUG=1, or perhaps other reasons.

Related to #1054

Brief Discord discussion [here](https://discord.com/channels/32725470853411635...

meager fog
#

@gilded cradle can you help @crude blaze with some questions on the tinydrm/fbtft overlay

crude blaze
#

hey @gilded cradle
Limor mentioned you had already created an overlay using the tinydrm ili9341 driver?

crude blaze
#

ok nvm actually looks like its already working 🙂

#

ah nope it was a lie, its actually loading the fb driver

crude blaze
#

with the tinydrm drivers available it seems to give me a white screen/does not init the controller for some reason

gilded cradle
# crude blaze hey <@478616919721771019> Limor mentioned you had already created an overlay us...

Hi @crude blaze. I had not created a tinyDRM overlay. I had previously worked on an installer script that installed a MIPI driver that somebody else had made here https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/main/adafruit-pitft-mipi.py and there was talk of somebody having already created tinyDRM drivers here https://github.com/raspberrypi/bookworm-feedback/issues/130

GitHub

Contribute to adafruit/Raspberry-Pi-Installer-Scripts development by creating an account on GitHub.

GitHub

I am able to set up a TFT with an ILI9341 display that correctly shows the command line. However, once the driver is added to /boot/config.txt, removing it does not make the display stop working, s...

crude blaze
#

ah I see! thanks for the links, will take a look

gilded cradle
empty salmon
#

Destroy display[0] or Not?
I see several CircuitPython boards with an integrated display. They create their display in board_init() and it’s available as board.DISPLAY within CircuitPython.

Some firmware also has board_deinit() which will release the display if the user code calls displayio.release_displays().

Most CircuitPython tutorials (and troubleshooting suggestions) recommend calling displayio.release_displays() early in their code.

The problem is there appears to be no way to re-initialize the integrated display without power cycling the board.

  1. Is there a way for a board to re-initialize the integrated display?
  2. Should boards with integrated displays ignore board_deinit()?
stuck elbow
#

you can re-initialize it by using the python libraries for the given displays

#

the only reason you would call release_displays on a board with a built-in display is if you wanted to initialize it with your own code

empty salmon
#

The problem I see (and have encountered) is that tutorials often say to release_displays and then the user has no clue why their code stops working with the integrated display.

#

A search of this discord amplifies this issue. It has been confusing and troublesome for both board developers and end-user CircuitPython coders.

stuck elbow
#

you call release_displays as part of initializing a display in python

#

for boards with built-in displays you don't do it

#

because you never initialize the display in your code

empty salmon
#

I understand the logic.
I’m saying, the situation causes problems for both board developers and end-users.

Unless there is a valid reason, it would seem - at initial blush - that the board should not deinit the integrated display.

stuck elbow
#

how would you reinitialize the display then?

empty salmon
#

if the integrated display is not de-initialized then it would always be available as board.DISPLAY

stuck elbow
#

I will give you an example. I have a tile-and-sprite engine called Stage that I use for games. It's much simpler than displayio (and faster thanks to that), and it doesn't have software rotation of displays. For the MeowBit, the board_init initializes the display up-side-down, and uses displayio's software rotation to make it look right. In the mewobit port of Stage, the initialization file releases the displays, and initializes the display with correct orientation, so that Stage works correctly. If your change was added, this would no longer work.

#

There may be other reasons why people might need to use a python library for a built-in display.

#

besides, having a command that does nothing would only be more confusing in the long run

empty salmon
#

Rotation is an interesting point as it is “usage” specific. This would also be true for any other parameters which are only available during initialization. (BTW: some initialization parameters would benefit form being available after initialization but that becomes a whole other topic).

stuck elbow
#

it's not just rotation

#

there are framebuffer-based display drivers that don't use displayio

empty salmon
#

The only current path may be to have a re-init capability of the integrated display.

stuck elbow
#

you might want to use gifio directly, skipping displayio

#

there is a lot of reasons why you might want to disable displayio

empty salmon
#

Yes. Which is why there should be an intuitive documented way for a user to get back board.DISPLAY

#

currently, there is not user-friendly message and no codeable solution

stuck elbow
#

the board_init is not just for displays

empty salmon
#

I understand. I’m saying, if the end user has a well documented coding method which can make board.DISPLAY stop working, it seems intuitive there should be a coding method for getting it back.
The problem is rooted in the prolific advice to use displayio.remove_displays() as a catchall troubleshooting step.

stuck elbow
#

prolific?

#

you only ever use release_displays when you are initializing a display, and then you have a method of gettingit back right there

#

literally on the next line

empty salmon
#

If you search in this discord and on the web, there are many many posts advising end users to call release_displays() as a step.

stuck elbow
#

and I bet chatgpt is also giving all sort of stupid advice

empty salmon
#

It may be be bad advice but it’s broadly mentioned

#

The advice is in many adafruit learning guides … and without guidance on “when not to do it”.

stuck elbow
#

can't control that

#

do you have an example of a learn guide that advises to call release_displays without initializing the display?

#

we should probably fix those

empty salmon
#

That is not what I said. I was saying there are guides that give examples and it’s easy to mix when the guide is talking about an integrated display vs an external one.

stuck elbow
#

any advice taken out of context is always going to be bad

empty salmon
#

Again, the issue is not calling release_display and then initializing explicitly. It’s calling release_display and having no intuitive way to get board.DISLAY back.

stuck elbow
#

okay, let's consider a hypothetical scenario

empty salmon
#

We need to decide the persona of the majority of CircuitPython developers.

#

_ I’ll pick this up shortly. I need to walk the dog_

stuck elbow
#

A user of a board with a built in display has some kind of problem, and to solve it, they randomly try to copy-paste pieces of code they find in different guides. Eventually they find the mention of release_displays and add it to their code. Their display stops working, so they try to find a way to get it working again. Now, there are two possibilities: right now, there is no such way, so they just remove the release_displays call and try other things to fix their problem. With your proposed change, they find the function to call to get the display back, and add it to their code somewhere after release_displays. Their code is now even worse than it was.

empty salmon
#

I believe the differences of our viewpoint comes down to the persona of the target end-user. Novice users find the current behavior of release_displays() on an integrated display to be confusing while more advanced users find it adds flexibility.

onyx hinge
#

@empty salmon I agree there is probably room for improvement here. This is something that core devs are looking at and may change for version 9: https://github.com/adafruit/circuitpython/issues/8675

Part of what we're looking at doing is something like

Instead, we can add an explicit supervisor.runtime.display = that allows for setting a single display to preserve outside the VM and use for the terminal
based on the discussion I was a part of, it's not clear to me whether that'd complement or replace board.DISPLAY.

If you wanted to organize your thoughts and add them to that issue it would be totally appropriate. Thanks!

GitHub

Right now display core will move I2C and SPI objects that they need to keep outside the VM. This is bug prone. Instead we should ensure the used object is already outside the Python VM. It can eith...

manic glacierBOT
empty salmon
#

Thanks @onyx hinge - I read that issue and will set aside some time to assemble a coherent comment.

lone sandalBOT
manic glacierBOT
slender iron
onyx hinge
slender iron
#

np

manic glacierBOT
tulip sleet
#

@slender iron what is left to merge that you would like in alpha.6 (or beta.0)? @onyx hinge jpegdecoder is still in process, right?

#

not necessarily going to do this now, but I could do it by tomw

slender iron
#

I'm looking at jpeg PR now

#

alpha.6 as-is would be good I think

tulip sleet
#

I thought the output was still a bit buggy, as noted internally?

slender iron
#

maybe alpha because I'm changing how storage.mount works in my wip SD card pr

#

the PR is marked as ready

tulip sleet
#

yes, I'm thinking there are still some evolving and not-yet-added things

manic glacierBOT
thorny jay
#

I worry a little bit that we could be forgetting #CircuitPython2024 (not that I have any clue what I could write there) ... or is it a blogpost that @slender iron does on the first of January?

slender iron
#

I intend on doing it.

#

We did just get the email setup

#

good to have a reminder though

onyx hinge
#

I think it's ready but the api needs review

onyx hinge
#

which I see scott was kind enough to provide, thanks!

manic glacierBOT
#

If we're planning to try incorporating the esp32 jpeg decoder, we may want to hold off on this specific API; the esp32 simd decoder may not support the /2 /4 /8 downsampling; I'm not sure yet.

/8 downsampling is very useful (for thumbnailing photos taken on a camera, it makes the highest resolution downsample to 320x240 or something)! (and downsampling after decoding isn't viable, as the simd decoder only decodes full images, so it would need 10MB+ RAM for the full image).

Setting back ...

onyx hinge
#

word is to just go with tjpg decoder for now. I'll try enabling jpegio more widely, then turn it back off where it doesn't fit, and finally set the PR as ready for review again. so, maybe not for this release dan is planning to do.

stuck elbow
#

I wonder if it would make sense, once this lands, to add jpg support to image_load using jpegio, if it exists

#

I know you can use jpegio directly, but having a simple wrapper in image_load would give a consistent interface

#

plus, image_load can autodetect file type

onyx hinge
#

that sounds very possible to me, not that I am super familiar with image_load

manic glacierBOT
digital shoreBOT
#
adafruit
Owner

.adafruit

Members

38,223

Roles

38

Category Channels

8

Text Channels

63

Voice Channels

7

Threads

20

Boost Count

22 Boosts (Tier 3)

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

Hi guys,
I try to "port" circuitpython to a cheap, bit older board:

Heltec WifiKit 32, featuring esp32 + Oled.
Pinout, Schematics and Specs here: https://resource.heltec.cn/download/WiFi_Kit_32/

So far I got the circuitpython build framework incl. esp-idf up and running and succesfully built and flashed resulting firmware.

However, I don't get a Repl or human readable Console output after the bootloader init.

This is what I get in CuteCom:
![Bildschirmfoto vom 2023-12-0...

manic glacierBOT
#

Hi and thank you so much for answering that quickly.

The esp_restart() is only for testing purpose.

I expected at least seeing the printf() output, but instead I just get garbage.

Thus I suspect having some esp-idf uart stuff not configured right.

The mentioned Heltec Lora 32 V3 board is a ESP32-S3 and has some other relevant GPIO pinout.

Okay, I try to do the github stuff with forking and so on.

I hope that will help.

manic glacierBOT
pulsar sleet
#

I am trying to recompile circuit python so I can see when circuit python allocate memory and when trying to compile i get this error

│ /mnt/e/circuitpython/ports/atmel-samd/../../tools/gen_nvm_devices.py:9 in main                   │
│                                                                                                  │
│    6                                                                                             │
│    7                                                                                             │
│    8 def main(input_template: pathlib.Path, output_path: pathlib.Path):                          │
│ ❱  9 │   flashes = cascadetoml.filter_toml(pathlib.Path("../../data/nvm.toml"), [])              │
│   10 │                                                                                           │
│   11 │   template = Template(input_template.read_text())                                         │
│   12                                                                                             │
│                                                                                                  │
│ ╭─────────────────────────────────────── locals ───────────────────────────────────────╮         │
│ │ input_template = PosixPath('../../supervisor/shared/external_flash/devices.h.jinja') │         │
│ │    output_path = PosixPath('build-matrixportal_m4/genhdr/devices.h')                 │         │
│ ╰──────────────────────────────────────────────────────────────────────────────────────╯         │
│                                                                                                  │
│ /home/carson/.local/lib/python3.10/site-packages/cascadetoml.py:163 in filter_toml               │
│                                                                                                  │
│   160 │   acceptable values for the given keys."""                                               │
│   161 │   root_toml = root / ".cascade.toml"                                                     │
│   162 │   if not root_toml.exists():                                                             │
│ ❱ 163 │   │   raise ValueError("Missing root .cascade.toml")                                     │
│   164 │                                                                                          │
│   165 │   template = list(root.glob("*.template.toml"))                                          │
│   166 │   if not template or len(template) > 1:                                                  │
│                                                                                                  │
│ ╭────────────────────────── locals ──────────────────────────╮                                   │
│ │   filters = []                                             │                                   │
│ │      root = PosixPath('../../data/nvm.toml')               │                                   │
│ │ root_toml = PosixPath('../../data/nvm.toml/.cascade.toml') │                                   │
│ ╰────────────────────────────────────────────────────────────╯                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯```
The command I am running is `circuitpython/ports/atmel-samd$ make BOARD=matrixportal_m4`
stuck elbow
pulsar sleet
#

11.4.0

stuck elbow
#

and did you run make fetch-port-submodules?

pulsar sleet
#

no I forgot

manic glacierBOT
pulsar sleet
#

Can I compile circuit python in wsl or should I switch to linux (i dual boot)

blissful pollen
pulsar sleet
#

Ok. I was wondering because I tried to compile and it took forever but I restarted the command and its working

#

is this normal

blissful pollen
#

The errors are not normal

pulsar sleet
#

internal screaming intensifies

#

what is boot2.elf

#

I am running with verbose mode (make -j BOARD=adafruit_kb2040 V="steps commands rules")

midnight ember
#

I've been able to make builds with WSL but the python pathing can be tricky to setup.

short tendon
#

Best practice for WSL: treat it like it's own OS. if you try to share entire projects across it doesn't really work. But if you just want to copy the build/final files across, it works like a champ.

manic glacierBOT
pulsar sleet
#

probably should have asked this before I downloaded the circuit python source but is there a debug build I can just download. I know there is a flag that can be set to log allocations

onyx hinge
pulsar sleet
#

How do I enable build flags. I found a flag called MICROPY_DEBUG_VERBOSE and setting it in py/mpconfig.h does nothing and setting it in ports/raspberrypi/boards/adafruit_kb2040/mpconfigboard.h causes errors (I wrote it to try to set the flag even if its set so these errors show that I would already be set and my config wouldn't matter)

pulsar sleet
#

I think I figured it out. There is a file called py/circuitpy_mpconfig.h that I had to configure

mortal kernel
# pulsar sleet How do I enable build flags. I found a flag called `MICROPY_DEBUG_VERBOSE` and s...

You can pass DEBUG=1 into make like so: make BOARD=my_board DEBUG=1 -j8
Also, it's often handy to have REPL plus messages on a UART port, so add these lines (adjusting the pins as necessary) to your board's mpconfigboard.h:

#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO1)
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO0)

Finally, you can tweak your optimization flags in your ports Makefile like this (RP2 example):

#Debugging/Optimization
ifeq ($(DEBUG), 1)
  CFLAGS += -ggdb3 -Og
  # No LTO because we may place some functions in RAM instead of flash.
#

Giving you a friendlier debug build for use with GDB.

pulsar sleet
#

so this is would make a build that prints debug messages and when something allocates memory make -j BOARD=adafruit_kb2040 DEBUG=1

mortal kernel
pulsar sleet
#

Ok. I am asking about compile flag things because here https://github.com/adafruit/circuitpython/blob/7715ff09cc663b80403f8907fe90c00fd89c9706/py/malloc.c#L85 it looks like m_alloc will print messages when something allocates memory but I want to know where I enable the flag thing. I tried to set it in py/circuitpy_mpconfig.h and I set MICROPY_MALLOC_USES_ALLOCATED_SIZE to 1 because it is needed but but then I am getting errors.

GitHub

CircuitPython - a Python implementation for teaching coding with microcontrollers - adafruit/circuitpython

mortal kernel
pulsar sleet
#

it looks like DEBUG_printf gets define when a flag is set. How could I check is DEBUG is set in the make command

#

do I do something like #if DEBUG

mortal kernel
pulsar sleet
#

I tried to compile circuit python for the matrix portal m4 but I get a error saying that build-matrixportal_m4/firmware.elf section '.text' will not fit in region 'FLASH_FIRMWARE'

spare jacinth
#

sounds like: you dont have enough flash for all the code 😅

pulsar sleet
#

the only changes I made is

-#define DEBUG_printf DEBUG_printf
+#if MICROPY_DEBUG_VERBOSE || defined(DEBUG)  // print debugging info
+#define DEBUG_printf(...) mp_printf(&mp_plat_print, __VA_ARGS__)``` in py/malloc.c
and
```-  CFLAGS += -ggdb3 -Og -Os
+  CFLAGS += -ggdb3 -Og -Os -D DEBUG``` in ports/atmel-samd/Makefile
mortal kernel
# pulsar sleet the only changes I made is ```-#if MICROPY_DEBUG_VERBOSE // print debugging inf...

That port already takes up all available flash, so adding just a few debug strings pushes it over the edge. Upgrading your toolchain to GCC 13.2 can claw you back a few bytes. See here: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads. You can also try narrowing the scope of your debug messaging. Finally, you can also see if there are any features you don't use that you can throw over the side. Each has its own flag like CIRCUITPY_PIXELBUF that you can set to 0 in the port or board mpconfigboard.mk.

pulsar sleet
#

Ok thank

mortal kernel
pulsar sleet
#

Ok

#

Would the compiled version work without adding DEBUG=1 to the make command

mortal kernel
pulsar sleet
#

I get the same errors when removing it so

mortal kernel
pulsar sleet
#
gcc (Debian 12.2.0-14) 12.2.0```
And I downloaded the latesd version of cp so I think 9.0.0
mortal kernel
#

If you cloned the repo and didn't do a git checkout then you have main which is 9.0.0. You'll need the updated toolchain (gcc 13.2) I noted earlier to do a build that fits.

pulsar sleet
#

how do I install gcc 13.2

tulip sleet
#

@pulsar sleet I do not think you are going to find out as much as you want by turning on debugging and allocation logging. There are many allocations that will be mysterious. I would suggest instead that you start with a minimal version of the Python program, and then add features one at a time.

pulsar sleet
#

I know. I need a way to see how big a object is in memory but I don't know how and I don't want to mess around with circuit python's code that much

mortal kernel
tulip sleet
#

there are allocations that are made for compiled code and for internal use that are not part of any Python object

#

I agree we could add sys.getsizeof()

tulip sleet
onyx hinge
#

note that there are two parts of "getsizeof": enabling the built-in but also implementing MP_UNARY_OP_SIZEOF for relevant types. For instance, getsizeof(a bitmap object) will fail because this is not implemented; this is true for probably ANY type we have added to micropython: ```>>> import displayio

b = displayio.Bitmap(320,200,65535)
import sys
sys.getsizeof(b)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported type for sizeof: 'Bitmap'

tulip sleet
stuck elbow
#

what if you wrap it in memoryview?

onyx hinge
#

TypeError: unsupported type for __sizeof__: 'memoryview'

stuck elbow
#

boo

onyx hinge
#

if implemented the sizeof a memoryview would be small, behavior on standard python is to not count the referred-to memory: ```>>> b = b"x" * 1024

sys.getsizeof(b)
1057
sys.getsizeof(memoryview(b))
184

#

(python 3.11)

pulsar sleet
#

I install gcc13 and now I get this error

tulip sleet
#

@pulsar sleet here is build of CIrcuitPython 8.2.x for the MatrixPortal M4 with uheap enabled. I had to do a bit of fiddling to get it to compile. However, I repeat that this is not going to tell you as much as you want to know, because native objects have internal allocations that don't necessarily show up here, as jepler mentioned.

Adafruit CircuitPython 8.2.8-7-gc5c7d110df-dirty on 2023-12-10; Adafruit Matrix Portal M4 with samd51j19
>>> 
>>> 
>>> b = bytearray(100)
>>> import uheap
>>> uheap.info(b)
Array of size: 112

128
>>> 
pulsar sleet
#

Thank you soo much

tulip sleet
pulsar sleet
#

I am getting space issue again. I disabled some stuff but then trying to build with DEBUG disabled should be smaller than a standered build but its not

#

All I did was disable

MICROPY_PY_BUILTINS_HELP
MICROPY_PY_BUILTINS_HELP_MODULES
MICROPY_PY_BUILTINS_INPUT
MICROPY_PY_BUILTINS_MEMORYVIEW
MICROPY_REPL_AUTO_INDENT
MICROPY_REPL_AUTO_INDENT ``` and I disabled SPI and I2C by commenting out the lines that those pins are defined
#

building without DEBUG worked after clearing the build foulder

mortal kernel
pulsar sleet
#

Printing when allocations happen. My issue is that adding a print function that would print the text takes up too much space

mortal kernel
pulsar sleet
#

Ok

#

I am trying to compile Circuit python but I am getting this error

../../py/objarray.c:70:17: error: 'array_decode' declared 'static' but never defined [-Werror=unused-function]
   70 | STATIC mp_obj_t array_decode(size_t n_args, const mp_obj_t *args);
      |``` Is `STATIC` equal to the C `static`
pulsar sleet
#

Figured it out. I needed to reenable bytearrays

short tendon
#

Question (on my path to write out some changes to requests and sockets):

Would it make sense to rename adafruit_esp32spi/adafruit_esp32spi_socket.py to adafruit_esp32spi/adafruit_esp32spi_socketpool.py and then import the latter in the former? Since it's really a fake pool?

pulsar sleet
#

for some reason when I downloaded the github for circuit python this file had asf_assert instead of assert on line 98 and 75

define ASSERT_IMPL(condition, file, line) **asf_assert**((condition), file, line)
void **asf_assert**(const bool condition, const char *const file, const int line);
                                                                              ```
GitHub

Microchip/Atmel ASF4 code libraries. Contribute to adafruit/asf4 development by creating an account on GitHub.

#

should I replace asf_assert with just assert. It only happens in the utils_assert.h files

manic glacierBOT
#

When testing stuff, running experimental builds or other weird stuff, safemode is great.
Now that safemode.py exists, it can do so much more.
But on production (for those few that want to ship CP), it may be desirable to not permit the user to enter safe mode through the boot button.

CIRCUITPY_DISABLE_SAFEMODE_TRIGGER
This would disable the ability to press the boot button to enter safe mode.
This would not stop the code from entering safe mode.

What do you about it?
I can prob...

main furnace
#

Trying to use NeoKey1x4 with QTPY_M0 but not enough memory. Maybe I can use a custom build if I remove unused features.

manic glacierBOT
#

safemode.py is new to me, but one option would be to put some self destruction code in safemode.py or just restart if someone tries to enter safemode... so I am not sure you need CIRCUITPY_DISABLE_SAFEMODE_TRIGGER if those work around are OK.

What would it be, a compilation option so that if you create custom CircuitPython firmware (that you rename another name) you can enable that flag?
Or is it something in boot.py or settings.toml.

There are a few things that people that wan...

manic glacierBOT
lone axle
#

I've compiled together the list of everything that shook out from the Adabot patch and subsequent release sweep that I don't think I have access to solve. 1 with a pypi token issue, 1 with a GH token issue perhaps the same thing as a different one that Jeff found the settings fix for. And then the list of repos that had additional branch protections which prevented the adabot patch from comitting directly.

#

There were a few other failures sprinkled in that I have loaded up to look into further today but upon first glance they all looked unrelated to repo settings so I'm hopeful that I'll have the means to get the sorted out.

lone axle
#

Does anyone know of a way to force pre-commit to wipe and re-install it's dependencies? Or show me what version it's using for it's tests (version of pylint specifically) I've run into a situation where running pre-commit locally is having a different result then what happens when it runs in the github actions. I noticed the pre-commit config file specifies pylint rev: v2.17.4 so I manually installed that and confirmed if I run it directly on the files I do get the same error messages as the actions container with it.

But if I just run pre-commit run -a locally it's still passing and not having that same error. Which leads me to conclude it's using a different version than the one now installed in the venv all this is running in, and also seems to be a different version from the one specified by the pre commit config file since it has different results when run directly on the same files. Unless there is some other thing that could account for that difference?

#

pre-commit clean turned out to the be answer to wipe and re-install everything and that has worked to get me in sync with behavior from actions 🎉

tulip sleet
tulip sleet
#

@lone axle requests.get() should not require the timeout argument. What is the pylint error you are getting? Let's not change the code, let's change the check

lone axle
onyx hinge
#

that's a rather opinionated diagnostic.

lone axle
tulip sleet
#

I think it is new. It makes sense that a timeout is a good idea. I'd suggest making a constant maybe instead of using using 30

onyx hinge
#

Error: examples/ble_broadcastnet_blinka_bridge.py:18:11: W3101: Missing timeout argument for method 'requests.post' can cause your program to hang indefinitely (missing-timeout)
It's not incorrect in the sense that calling a function without a required keyword arg is .. pylint just thinks it's bad practice not to specify this optional keyword arg.

tulip sleet
#

it was added in pylint 2.15.x

lone axle
tulip sleet
#

that would be a lot less verbose

lone axle
#

I can do that, although it feels a bit akward to add that to adabot specifically though, would we create the same wrapper in other libraries that use requests?

tulip sleet
#

i am surprised requests.get() has no default timeout

#

this seems like a larger thing. lemme look at issues in the requests library

tulip sleet
#

I think it would be fine for now to provide something like from adabot import REQUEST_TIMEOUT and do timeout=REQUEST_TIMEOUT everywhere, so that you can change it if 30 seems too long or to short

#

maybe REQUESTS_TIMEOUT with an S

lone axle
#

Sounds good. I'll add that change to the adabot PR and take a similar approach with other libraries I run accross with the same error raised by pylint.

#

I have run into a seperate question around actions / infrastructure now as well. In our workflow file (gh release) we have something this:

upload-url: ${{ github.event.release.upload_url }}

What is github.event.release.upload_url or how does it get populated? I have a case where it seems that is being empty or null and then the thing it's passed to fails because it's a required argument. I'll do some digging in the actions docs.

manic glacierBOT
#

I got some further success:
After compiling the esp-idf system/console example and having similar behaviour (garbage on the console) I suspected indeed UART misconfiguration and found out, that the CP2102 of this board is connected to Custom UART 1, so using the default led to the issues described.

Now I have console output, yayyy!
Let's fight the next issues...

'''
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv...

lone axle
#

Thank you!

tulip sleet
#

i use other things from this API to find out stuff about the PR, etc.

manic glacierBOT
#

My comment is specific to the board.DISPLAY capability and related CircuitPython behavior; and more specific to boards with integrated ePaper displays. (I realize this is a very small segment but they pose an interesting set of scenarios.)

For a novice user - which CircuitPython has as a core persona - the behavior of displayio.release_displays() is confusing when the user did not initially use displayio to create the display.

With respect to ePaper displays, treating them as ...

#

Latest Github master source:

While porting to a board:
https://github.com/szsoftware/circuitpython/tree/heltec-wifikit-32-v2

After appearing of this message and studying the source (supervisor/shared/serial.c), I found out that the above message should better be: "Serial console setup done."

Otherwise, developers like me could think something with console setup is wrong, but it's a success message.

lone axle
#

Does anyone recall any history on https://github.com/adafruit/Adafruit_CircuitPython_Register_SPI ? It's readme contains instructions for installing with circup install register_spi but it appears it was never added to the library bundle so that doesn't work ATM. Should it get added to the bundle or perhaps have it's readme adjusted?

onyx hinge
lone axle
# onyx hinge I don't know what the development status of that is. I see you did the 1.0.0 rel...

Good question, I do not recall to be honest what I was thinking when it I released it. Forgot that I had done that. My best guess is that I just saw it in the list on the contributing page under library infrastructure and released to get it out of that. But it does appear I may have jumped the gun on it. There is an issue on that repo that was discussing anything further needed to be ready but it didn't get much traction. https://github.com/adafruit/Adafruit_CircuitPython_Register_SPI/issues/1

#

I don't know if "un-release" is a thing that can happen but if so perhaps that would be appropriate for this library.

tulip sleet
lone axle
orchid basinBOT
onyx hinge
#

@lone axle discord is taking steps to make links to uploaded files expire, so I replaced your link with a copy of the file I uploaded as a github gist.

lone axle
#

Thank you, I initially tried attaching it directly to the doc but it turns out that isn't possible.

manic glacierBOT
orchid basinBOT
manic glacierBOT
onyx hinge
#

@lone axle I could grab the library section if you want a break during state of circuitpython

manic glacierBOT
orchid basinBOT
slender iron
#

it is segmented eink which is weird

onyx hinge
#

oh very interesting!

manic glacierBOT
#

To be clear, you want this to be settable in settings.toml?

I mean, is there a better way to permenantly set a flag?
nvm would be nice here, as we could make an efuse of sorts.
A module could set a specific bit, and early boot could read it.
But since we don't have a region (to my knowledge) specifically for internal flags, it's not something I wanna do.

This is handled in supervisor/shared/safe_mode.py, wait_for_safe_mode_reset().

I was thinking of just blocking off repl and ...

slender iron
tidal kiln
#

oh yah. huge hug to @danh for dealing with this macos stuff.

onyx hinge
#

I hope it wasn't at 2AM

thorny jay
#

Sorry I was editing while you were reading.

lone axle
#

No worries

midnight ember
#

I replicated the displayio issue on my own esp32s3 rev tft feather and confirmed the bug on 8.2.9 with the latest 8.x bundle.

#

Jepler and Melissa doing wizardry this week

manic glacierBOT
thorny jay
# onyx hinge I hope it wasn't at 2AM

I had it late (22H00) and early (8H00) but since it is only the music, it may have run during the night without anybody noticing. 🙂
It could be the wind, or "electricity in the air"... I need to measure the minimum time a human close the circuit when pressing the doorbell button, and use that timer for debouncing so that a 1 is only a 1 if it is a 1 for at least x milliseconds.

midnight ember
#

Neradoc's keyboard layouts for different languages has been an invaluable asset to point people at.

lone axle
#

If I understand right that'd make those fonts installable via circup which would be very convenient as well!

thorny jay
#

Fontz: I usually cherry pick in the Learn Guide repo for font to use in my projects. 🙂

midnight ember
#

The amount of detail with resin surpasses FDM 3D printing but the chemicals...

thorny jay
gilded cradle
#

@onyx hinge In the summer, you have to deal with direct sunlight prematurely curing the resin

midnight ember
#

amazing update Jepler!

onyx hinge
midnight ember
#

Appeciate all your work Melissa doing great things!

gilded cradle
#

Thanks

midnight ember
#

❤️ Sending you good vibes Scott. God bless you and your family.

thorny jay
#

No that code was after the book.

#

Maybe next book will contain CP stuff, that would be great. 🙂

slender iron
#

thanks for hosting!

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit Feather ESP32-S3 Reverse TFT with ESP32S3
Board ID:adafruit_feather_esp32s3_reverse_tft

adafruit-circuitpython-bundle-8.x-mpy-20231210

Code/REPL

# SPDX-FileCopyrightText: 2021 Tim C for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
CircuitPython simple text display demo
"""
import board
import terminalio
from adafruit_display_text import bitmap_label
import displ...
onyx hinge
#

@tulip sleet did someone do a merge of 8.x to main recently? I think we talked about that being a good idea to do

onyx hinge
#

aha great

manic glacierBOT
#

nvm you're right just needed a hard reset

import board
import terminalio
from adafruit_display_text import bitmap_label
import displayio

display = board.DISPLAY
print(display)
# Update this to change the text displayed.
text = "Hello, World!"
# Update this to change the size of the text displayed. Must be a whole number.
scale = 1

text_area = bitmap_label.Label(terminalio.FONT, text=text, scale=scale)
text_area.x = 10
text_area.y = 10

text_group = displayio.Group(...
lone axle
#

Here is the notes document for next Monday’s CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1Jzrzv6IAmRjEdOTQcFm_VghdlLhwG3r-AJlZBHTid68/edit?usp=sharing

devout jolt
#

Thank you @tulip sleet for MacOS USB serial chip testing Playground page! It always feels like a roulette "will this board show up?"

tulip sleet
#

But the doc is pretty terrible about describing things like this.

devout jolt
tulip sleet
devout jolt
pulsar sleet
#

I finally got circuit python to compile with allocations printing. The bulk of the size being used was from just the DEBUG flag. Compiling with the debug stuff on without needing the DEBUG flag worked

tulip sleet
lone axle
#

Thank you!

manic glacierBOT
manic glacierBOT
keen eagle
#

macOS Sonoma 14.2 actual release is out today, confirmed it still has the same issues with small FAT drives

manic glacierBOT
manic glacierBOT
#

For a novice user - which CircuitPython has as a core persona - the behavior of displayio.release_displays() is confusing when the user did not initially use displayio to create the display.

I agree. That's why I think it should be removed.

With respect to ePaper displays, treating them as general purpose for console output is potentially damaging. Every time the user has an error in their code or hits CTRL-C the ePaper display is called upon and refreshes. This adds wear an...

manic glacierBOT
manic glacierBOT
#

Honestly, I have no clue. This is what the flashing tool reports and I don't know where else to get the info from:

esptool.py v4.7.dev3
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 26MHz
MAC: 24:0a:c4:5c:11:d8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from ...
#

RFM was a leftover from the (only) other Heltec Board files I took for reference.
Removed it.

I just learn about the circuitpython framework and building process and after studying the freeze terms and ideas I wonder myself why one put this into default firmware.

However also this is a leftover from the other heltec board available in Circuitpython and there it passed the pull request/implementation process.

I remove it for now.

manic glacierBOT
manic glacierBOT
#
[adafruit/circuitpython] New tag created: 9.0.0-alpha.6
onyx hinge
#

thank you @tulip sleet

manic glacierBOT
orchid basinBOT
tulip sleet
#

Notable since alpha.5: jpegio, synthio enhancements, update to Espress ESP-IDF v5.1.2

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Raspberry Pi Pico W with rp2040

Code/REPL

import time
import os
import wifi
import traceback

AP_SSID = "Bob"
AP_PASSWORD = "YourUncle"
DELAY = 5

time.sleep(3)  # wait for serial
print("="*25)

# start clean
if wifi.radio.connected or wifi.radio.ipv4_address:
    wifi.radio.stop_station()
if (wifi.radio.ap_active) or (wifi.radio.ipv4_address_ap):
    wifi.radio.stop_a...
crimson ferry
#

When (web workflow) auto-connect is enabled, is it expected for "auto-connect " to be printed to the console when attempting to manually connect? It will do that endlessly (no exception) and need a restart to connect again.

onyx hinge
#

The meeting calendar has been updated with the 2024 meeting dates, including January 2, 2024. The 2022 events have been removed.

manic glacierBOT
#

We do treat eink specially internally. Specifically we respect the refresh time spacing that manufacturers suggest be 180 seconds. Showing errors is very valuable.

The refresh time is a problem. The user can set this when creating an epaper display using one of the libraries such as adafruit_ssd1681.mpy but for an integrated display, this is hard coded. Because of this, mot boards with an integrated display choose to use as short a value as possible.

Note, with the proposed super...

onyx hinge
#

@gilded cradle so far it looks like support for jpeg images was limited to the pyportal library, not the portalbase library. is there a reason for that, or is it just how things ended up? I am asking because I wondered if the existing code could be made to transparently switch to using jpegio to decode a jpeg image locally.

gilded cradle
#

@onyx hinge I'll take a look. Not sure the reason. Perhaps it was added by a user.

onyx hinge
#

@gilded cradle OK, let me know -- if it makes sense to do, I can probably take on the work since I want to change it anyway.

gilded cradle
onyx hinge
#

adafruit_pyportal/network.py

#

def process_image, called from fetch

gilded cradle
gilded cradle
onyx hinge
gilded cradle
onyx hinge
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Hmmm. Problem is deeper than I thought. The call to cyw43_arch_disable_ap_mode() in #8326 is calling cyw43_wifi_set_up(..., false, ...) so that's not the error. There's a recurring bit of code in #8326:

    while (port_get_raw_ticks(NULL) < deadline && (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_xxxx)) {
        RUN_BACKGROUND_TASKS;
        if (mp_hal_is_interrupted()) {
            break;
        }
    }

that looks like it delays but never actua...

manic glacierBOT
#

Prior to #8326 common_hal_wifi_radio_start_ap() was not testing cyw43_tcpip_link_status() after calling cyw43_arch_enable_ap_mode() so with #8590 applied it appeared that the AP could be started, stopped, and then started again successfully. #8326 adds testing of cyw43_tcpip_link_status() which returns CYW43_LINK_DOWN for the second start attempt, resulting in the RuntimeError: AP could not be started exception.

The CYW43_LINK_DOWN status is returned because the CYW43 driver'...

manic glacierBOT
#

Tracing asynchronous events from the CYW43439 shows that it is reporting that the AP is up on the second start attempt. So, there's a status reporting problem in the CYW43 driver.

Starting AP... 
[    6409] ASYNC(0001,LINK,0,0,1)  // CYW43_EV_LINK, link is up
[    6411] ASYNC(0001,LINK,0,0,1)  // CYW43_EV_LINK, link is up
AP tcpip status: 3  // CYW43_LINK_UP
AP wifi status: 0
        ...wifi.radio.ipv4_address_ap=192.168.4.1
Stopping AP... 
[   11573] ASYNC(0000,LINK,0,4,1)  //...
gilded cradle
#

@crude blaze I just wanted to check in and see if you ran into anything you had questions about with the Raspberry Pi stuff.

onyx hinge
lone axle
onyx hinge
#

my vague understanding was that the adabot action I linked to 2nd is supposed to cause the release to be made but I don't know.

lone axle
#

it looks like there could be logic in adabot.circuitpython_bundle

tulip sleet
onyx hinge
#

oh!

#

I wonder how the release note got generated saying there was a bunch of stuff in it then

#

it still needs to see the bundle re-released, because it needs changes from circuitpyhton-build-tools. so many interconnected pieces.

tulip sleet
#

really weird because the Asset files are quite different sizes

crude blaze
#

turns out all that was missing was to invert the reset GPIO, the default behaviour is just the opposite to how it worked in fbtft

manic glacierBOT
#

Not a status reporting error in the CYW43 driver. The interface flags are getting clobbered due to the AP interface being initialized (possibly in error) after the CYW43439 has brought the link up. Here's what happens on the second AP start:

  • common_hal_wifi_radio_start_ap() invokes cyw43_arch_enable_ap_mode()
  • cyw43_arch_enable_ap_mode() invokes cyw43_wifi_setup()
  • cyw43_wifi_setup() invokes cyw43_wifi_ap_init() and cyw43_wifi_ap_set_up(). This is where the CYW43439 is ...
lone axle
#

Out of curiousity what order does boot.py and the web workflow initialization occur in? If boot.py contained code that added or removed the web workflow configurations from settings.toml would the modified configuration be used when webworkflow is initialized? Or web workflow init happen prior so it won't know about the changes?

manic glacierBOT
#

Issue arose in HTTPServer library in the context of websockets:
https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/issues/73
The library can be improved with a flexible import that looks for either the native hashlib module or the adafruit_hashlib library (web sockets could be run on a board without hashlib (for example, with an ethernet featherwing), but the native module is faster.

Awaiting testing.

#

There is a race condition in the CYW43 driver that is the root cause of this error. I cannot find a workaround, so I'll report it to the CYW43 driver project and we'll have to wait for them to issue a fix.

On the first start of the AP, the CYW43439 takes longer to bring the link up and signal asynchronously than it does on subsequent attempts. For the first AP start cyw43_wifi_setup() is able to complete CYW43_cb_tcpip_init() before the CYW43439 signals that the link is up, so `NETIF_F...

mortal kernel
#

@danh Am I handling #8718 correctly? I could patch the CYW43 driver, but I don't think we want to maintain a CP fork.

manic glacierBOT
tulip sleet
mortal kernel
# tulip sleet we have a fork of the driver already: <https://github.com/adafruit/cyw43-driver>...

I've opened issue https://github.com/georgerobotics/cyw43-driver/issues/106 against the driver. I've not been seeing any response to an earlier issue I opened several weeks ago.

GitHub

CircuitPython attempts to restart AP mode (cyw43_arch_enable_ap_mode) subsequent to its having been previously started (cyw43_arch_enable_ap_mode) and stopped (cyw43_arch_disable_ap_mode). All subs...

crimson ferry
#

I'll test on micropython if I get some time. 8.2.9 with #8590 allows turning AP on and off repeatedly. AP shows up and devices can connect to it on subsequent re-start_ap()s.

mortal kernel
mortal kernel
crimson ferry
#

but I can connect to it

#

I can try some sockets over that connection

mortal kernel
crimson ferry
#

I'm bad at reading code, so I have to test to know what's happening 😉

manic glacierBOT
empty salmon
#

@stuck elbow - getting a little closer.
setting #define CIRCUITPY_REPL_LOGO 0 in pmconfigboard.h and setting CIRCUITPY_TERMINALIO = 0 in mpconfigboard.mk` will prevent the REPL text and the log from appearing on the ePaper but the display still is "refreshed" when REPL is activated (as in the case of an error, using CTRL-C, or when code.py ends).

#

I need to figure out how to prevent the "refresh to blank" in those cases.

stuck elbow
#

on deinit

empty salmon
#

but I thought dinit only gets called with release_displays() ?

empty salmon
#

but if I had used the display (eg I actaull created group(s) and tile(s) and did a display refresh), then 'end fo program' does not refresh the epaper.

stuck elbow
#

maybe it's some kind of a special case in there

#

look at the reset_displays function maybe

empty salmon
#

... reading code now

crimson ferry
#

@mortal kernel CP 8.2.9 on Pico W ...started and stopped AP 5 times to get things rolling, then started it a 6th time and started a UDP server ...an ESP32-S3 station can connect and they can send and receive UDP packets to each other

mortal kernel
onyx hinge
#

My change caused the bundle to fail building. I will fix it asap. We may want to remove the latest release from GitHub as I think it is broken and won't let circup work

#

Sorry

tulip sleet
#

I think it is also on S3. I will remove it there.

tulip sleet
onyx hinge
#

This one. I'm mobile so I don't want to rush to do something

#

I need to update and release circuitpthon build tools for it to work to release. I'm not sure why the ci of c-b-t succeeded.

mortal kernel
tulip sleet
crimson ferry
mortal kernel
tulip sleet
tulip sleet
mortal kernel
#

Also, the bad flag affects ARP/IGMP/MLD/RS reports.

crimson ferry
#

ok, i need to think about how to test that (don't know much about that level and need a computer I can take off the network without disrupting other things)

mortal kernel
manic glacierBOT
#

hardware: raspberrypi RP2040 board with integrated ePaper display
situation: unable to prevent low level refresh of display whenever REPL is reached (error, CTRL-C, or end of code.py)
version: building with 8.2.x branch

I am using the build flag CIRCUITPY_TERMINALIO = 0 and the compiler definition CIRCUITPY_REPL_LOGO 0 to prevent REPL content from appearing on an ePaper display. Howerver, the display still refreshes (to a blank screen with a border) by something in the ...

crimson ferry
#

@mortal kernel I can connect to the AP from a mac laptop, but oddly, I don't get an IP address like I do on the ESP32-S3, so can't do anything with it, weird that the DHCP server would work for one but not the other nope, strike that, it must have disconnected --> I get ping times from the Mac, arp -a finds the PicoW

mortal kernel
#
void cyw43_cb_process_ethernet(void *cb_data, int itf, size_t len, const uint8_t *buf) {
    cyw43_t *self = cb_data;
    struct netif *netif = &self->netif[itf];
    #if CYW43_NETUTILS
    if (self->trace_flags) {
        cyw43_ethernet_trace(self, netif, len, buf, NETUTILS_TRACE_NEWLINE);
    }
    #endif
    if (netif->flags & NETIF_FLAG_LINK_UP) {
        struct pbuf *p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
        if (p != NULL) {
            pbuf_take(p, buf, len);
            if (netif->input(p, netif) != ERR_OK) {
                pbuf_free(p);
            }
            CYW43_STAT_INC(PACKET_IN_COUNT);
        }
    }
}
#

It looks like it will not run pbuf_take so the buffer passed in as buf will get nothing.

#

And no error indication.

manic glacierBOT
#

I'll try explaining again, sorry for being unclear. I was trying to offer you advice about how to fix the build errors.

I looked at the failing build. It appeared to me that this was the salient portion of the build error:

./common-hal/hashlib/Hash.h:29:10: fatal error: mbedtls/sha1.h: No such file or directory
   29 | #include "mbedtls/sha1.h"
      |          ^~~~~~~~~~~~~~~~

I believe this occurs because the Makefile only decides to include mbedtls when ssl is enabled....

lone sandalBOT
gilded cradle
mortal kernel
#

@crimson ferry I have a 9.0.0 alpha build that fixes the race condition in cyw43-driver. It passes your test (repeatedly starting and stopping the AP) and I was hoping you would give it a more thorough testing. I'm not sure of the best way to get you the build artifact.

manic glacierBOT
lone axle
#

Nice, Thank you!

#

I'm thinking about a mechanism that uses a physical switch or button to enable / disable the webworkflow, kind of how the examples for mounting storage as writeable encourage users to set it up.

stuck elbow
#

and writinng stuff in boot.py is easy, because you can remount the drive ro afterwards

crimson ferry
#

@mortal kernel if it’s in your personal repo, I think you can just drop the UF2 here

#

I’m tied up for a few hours, but would be happy to test it when I’m done

manic glacierBOT
#

I noticed that the following docstring was lacking type hints:

//|     @overload
//|     def open(self, /, bytesio: io.BytesIO) -> Tuple[int, int]:
//|         """Use the specified object  as the JPEG data source.
//|
//|         The source may be a filename, a binary buffer in memory, or an opened binary stream.
//|
//|         Returns the image size as the tuple ``(width, height)``."""

When I removed the /, positional-only marker, the type hints appeared.

I'll format ...

#
  • Separate open() [set data source and read metadata] and decode() [actually fill bitmap with pixels] steps
  • add support for any binary stream type. this should include socketpool sockets, allowing jpeg decode direct from net (if it doesn't, it's a problem with socketpool sockets; esp32spi sockets probably will not work)
    • testing only on io.BytesIO though
  • fix type checking of stream types, this was lost in a micropython merge and not hit by testing
    • (any object with some pro...
onyx hinge
onyx hinge
#

thank you

manic glacierBOT
tidal kiln
#

this BMP was generated via the AIO image-formatter service

#

but for some reason can not set the white to transparent

#

opening and resaving the BMP in gimp creates this BMP

#

which works as expected

#

wondering why its not working, why the BMPs are different, etc.

#

test code:

import displayio
from adafruit_pyportal import PyPortal

pp = PyPortal()

odb = displayio.OnDiskBitmap("/radar_orig.bmp")
odb.pixel_shader.make_transparent(0xFFFFFF)
tg = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)

pp.splash.append(tg)
manic glacierBOT
crimson ferry
#

@mortal kernel UF2 tests out with the same test as earlier with successful results like 8.2.8:
• esp32-s3 can connect to PicoW AP, receive DHCP address, and exchange UDP packets
• macOS can connect to PicoW AP, receive DHCP address, ping, arp-a
I'll try a more aggressive test of station + AP and report back

mortal kernel
crimson ferry
#

@mortal kernel ran loops of every combination and sequence of start/stop_station/ap ...everything looks good 🙂

mortal kernel
crimson ferry
#

thanks for getting it ship-shape!

mortal kernel
#

NP. I love a good bug.

crimson ferry
#

did it become clear why 8590 worked on 8.2.x despite the bugs, and 8326 worked initially on main then broke?

mortal kernel
#

The places where it does check we don't seem to hit in CP.

#

Did 8326 ever work for the AP restart case?

crimson ferry
#

no, you're right, it was an independent fix for simultaneous station + ap, and stopping AP (once)

mortal kernel
#

Good, I think we've got all the cases explained then.

#

Does having to wait for cyw43-driver cause you any problems?

manic glacierBOT
crimson ferry
manic glacierBOT
manic glacierBOT
lone sandalBOT
thorny jay
thorny jay
# thorny jay Does anybody has an hint on how to flash the C6 I acquired from Adafruit in Janu...

First I need to figure out if I should use the UART port or the USB port (UART seems to work). Then https://adafruit.github.io/Adafruit_WebSerial_ESPTool/ complain that it does not know the chip: Error: Unknown Chip: Hex: 0x2ce0806f Number: 752910447 (it is the build in CP2102N USB to UART bridge).
Then I need to figure out if I should flash from 0x000 or from 0x1000 like with this tool: https://espressif.github.io/esptool-js/
I am a bit lost, I am not sure if it already work and what to expect from each port... REPL? Mass storage (is it supported)? Should I use BLE workflow?

manic glacierBOT
#

I keep reading "you shouldn't prevent errors from showing on the display". It's on several similar issues.

There are several cases where the display is of little use for error messages, including very low resolution "displays" like pixel matrices, tiny OLED displays, and small very slow ePaper displays.

In my use case, the board has a small very slow ePaper display which is designed for vary infrequent use to display a static image.

Using the two build-time settings do prevent errors fro...

tulip sleet
#

hmm, well, it appears there is a chip ID for C6 in the current WebSerial code.

#

The C6 has a limited USB port. I think you should try the USB port, not the UART port. But you may need to get the board into boto mode.

#

i found my C6 in the back of a shelf and will take a look

thorny jay
# tulip sleet The C6 has a limited USB port. I think you should try the USB port, not the UART...

Thanks, I will try again... at one time I had the RGB LED flashing green, that could be Circuit Python telling me that the "Hello World" program ended successfully, but I did not find a REPL to confirm, not a mass storage.
I used the UART port, because that was the only place I could get a stable Serial... I was able to format and flash with some web tool.
I went using the boot button as I do on other ESP32.

tulip sleet
# thorny jay Thanks, I will try again... at one time I had the RGB LED flashing green, that c...

I am able to get it talking on either port. However, the board I have seems to be a dev sample. I bought it in Jan 2023:

$ esptool.py -p /dev/ttyACM0 chip_id
esptool.py v4.6.2
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-C6
Chip is ESP32-C6 (QFN40) (revision v0.0)
Features: WiFi 6, BT 5, IEEE802.15.4
Crystal is 40MHz
MAC: 60:55:f9:00:00:f6:98:a4
BASE MAC: 60:55:f9:f6:98:a4
MAC_EXT: 00:00
Uploading stub...
Running stub...
Stub running...
Warning: ESP32-C6 has no Chip ID. Reading MAC instead.
MAC: 60:55:f9:00:00:f6:98:a4
BASE MAC: 60:55:f9:f6:98:a4
MAC_EXT: 00:00
Hard resetting via RTS pin...
#

if you use esptools.py, do you also see (revision v0.0). and Warning: ESP32-C6 has no Chip ID. Reading MAC instead.?

thorny jay
tulip sleet
#

So I think the webserial tool is for a more recent version that maybe reports a proper chip id. So try uploading with esptool.py instead

thorny jay
tulip sleet
#

you should be able to pip install esptool on Windows

#

assuming you have Python isntall

manic glacierBOT
#

Here is a simple test:

import time

print("delay 10 seconds ...")
time.sleep(10.0) # allow some time for user to start serial terminal
print("start test")
time.sleep(1.0) # just a simple delay to separate the print statements
print("end test")
# end of program

The first time this code runs (after the board is powered up), the display refreshes at the end of the code execution.
If the code has a while True: loop at the end, then the board will refresh when the c...

#

My understanding is that you've added the display as board.DISPLAY on this board. Our assumption was that board.DISPLAY was usable for status information. It is made available continuously, across Python VM instantiations. If you removed board.DISPLAY, and treated this like any other external display, initializing it with Python code, would you see the refreshes you are reporting?

We can track down the extra refreshes by examining the code, and maybe you can too.

Maybe this should...

#

Yes, I have an integrated ePaper display on the board. I have explicitly compiled CircuitPython to not use it for terminal output.

That is what CIRCUITPY_TERMINALIO = 0 is meant to do - not use the display for console output.

While it is no longer getting console output, it is still being refreshed on the first REPL (or code completion).

orchid basinBOT
#

Our current image compression doesn't run well due to the workflow of limiting to forked pull requests.

This proposed change modifies the image action to run once a month on the first of the month.

It will create a PR with compressed/optimized images that we can review and merge.

This is a suggested workflow from the image-action:
https://github.com/marketplace/actions/image-actions#compress-on-demand-or-on-schedule

manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.7 on 2023-10-19; Adafruit Metro M4 Express with samd51j19

Code/REPL

import pulseio
import time
import board

pulses = pulseio.PulseIn(board.D2)

while (1):
    print(time.monotonic())

Behavior

I have a wire connected to D2, but its not connected to anything else.

If I save this file to the board a few times (causing soft resets), or wave my hand near the wire, or just wait for a while, I ...

thorny jay
# tulip sleet I am able to get it talking on either port. However, the board I have seems to b...
esptool.py v4.3
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-C6
Chip is ESP32-C6 (revision v0.0)
Features: WiFi 6, BT 5
Crystal is 40MHz
MAC: 60:55:f9:f6:94:d8
Uploading stub...
Running stub...
Stub running...
WARNING: Failed to communicate with the flash chip, read/write operations will fail. Try checking the chip connections or removing any other hardware connected to IOs.
Warning: ESP32-C6 has no Chip ID. Reading MAC instead.
MAC: 60:55:f9:f6:94:d8
Hard resetting via RTS pin...```
manic glacierBOT
thorny jay
# thorny jay ```$ esptool.py -p /dev/ttyUSB0 chip_id esptool.py v4.3 Serial port /dev/ttyUSB0...

So I have CP working on my C6... my C6 is not saying EEE802.15.4 and has trouble communicating with the flash. But I can erase the flash, and push CP to it with esptool.py. I did the flashing on UART on /dev/ttyUSB0 but to get the REPL I need to use the USB port that is /dev/ttyACM0 . The thing is that I don't see the mass storage, and I did not succeed with PyLeap to get the BLE workflow working. So right now it is a bit like working on an ESP32 or with MicroPython. But I am fine and happy to have it running CP. Thank you very much. 🙂 ```$ tio /dev/ttyACM0
[tio 17:28:19] tio v1.32
[tio 17:28:19] Press ctrl-t q to quit
[tio 17:28:19] Connected
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; ESP32-C6-DevKitC-1-N8 with ESP32C6```

tulip sleet
#

I don't see the flash chip problem on mine. That is strange

#

it may simply be defective. Did you buy it from us?

thorny jay
#

That explain a lot, that and plugging on the USB where there is no REPL. I got it from Adafruit, but never touched it because I did not read the warning saying: Please note: There is minimal support for this dev board. For example, as of the time of this writing, there is no Arduino or CircuitPython support - only ESP IDF! Please purchase if you're doing development with the C6, and OK with stuff not working 100% out of the box.

#

It is only a few days ago that I saw the board on circuitpython.org/download and I said to myself: "Hey, don't you have that in a box taking dust?" 😉

#

Actually, the product page could be updated since CP support is coming...

tulip sleet
#

there have been revisions to this dev board since we started selling it, but I don't know if we are still selling the original stock

thorny jay
manic glacierBOT
tulip sleet
#

your esptool is v4.3, update via pip and see if it does better about seeing the flash chip

#

I checked stock and it is still the original version

manic glacierBOT
#

I currently use a python REPL on the LilyGo T-Deck and it's apparently been used by a few folks based on the github activity. It's useful when using the device as a standalone CP device.

As Jeff has shown above, this PR makes upgrading that REPL to support multiple line statments (For, If, etc) relatively easy, although I had already started thinking about what was needed without this addition. There has also been mentions of possibly support...

thorny jay
# tulip sleet your esptool is v4.3, update via pip and see if it does better about seeing the ...

Sorry, I had to fight with pip and esptool.py (remove it and re-install it). So now my C6 is in perfect condition and as good as yours. I just need to work around the chip limitation and find a use for it. At least I will be able to test CP release from time to time and report issues. : $ esptool.py -p /dev/ttyACM0 chip_id esptool.py v4.7.0 Serial port /dev/ttyACM0 Connecting... Detecting chip type... ESP32-C6 Chip is ESP32-C6 (QFN40) (revision v0.0) Features: WiFi 6, BT 5, IEEE802.15.4 Crystal is 40MHz MAC: 60:55:f9:00:00:f6:94:d8 BASE MAC: 60:55:f9:f6:94:d8 MAC_EXT: 00:00 Uploading stub... Running stub... Stub running... Warning: ESP32-C6 has no Chip ID. Reading MAC instead. MAC: 60:55:f9:00:00:f6:94:d8 BASE MAC: 60:55:f9:f6:94:d8 MAC_EXT: 00:00 Hard resetting via RTS pin...

manic glacierBOT
slender iron
#

@thorny jay BLE workflow isn't on ESP chips yet. Web workflow should work on c6 though. Only the h2 doesn't have wifi.

manic glacierBOT
thorny jay
manic glacierBOT
#

Do you agree that, given the test example and video results, this as a "bug" and not as an "enhancement" request ?

I don't think you should diverge from standard CircuitPython behavior of showing status on epaper after code finishes. Even if it finishes cleanly, it is important to know that user code is no longer running. It will also include the status bar. We've done this since the MagTag release in November 2020 and no one has complained about it.

The refresh is coming from here: h...

manic glacierBOT
#

When I add the traditional while True: loop to the end and the user performs CTRL-C to get to REPL, there is no reason for the display to refresh but it does.

ePaper "displays" are very different from other displays. They are used for persistent information. Having they cleared outside the users code is the issue I am attempting to address..

manic glacierBOT
#

Usually you want code for the MagTag to go to sleep once the display content has been rendered. You then wake up on a time alarm, a button press (or even orientation change). So the code never reach at the end the REPL) because at wake-up it restart (with the option to save state information between runs).
The only time it reach the REPL would be if you don't catch exception and there is a problem (mostly network issue like WIFI being out of reach or the internet API not responding).
This i...

#

When I add the traditional while True: loop to the end and the user performs CTRL-C to get to REPL, there is no reason for the display to refresh but it does.

It is helpful to know user code is finished. Generally it should keep running. ctrl-c into the repl is a corner case. Autoreload will already skip the refresh to run a new version of code.py. We could skip the refresh if code ended from a keyboard interrupt too. That's a much smaller change than what you are attempting.

eP...

#

Let's bubble back up a few levels ...

As a board developer, if I have set CIRCUITPY_TERMINALIO = 0 and #define CIRCUITPY_REPL_LOGO 0 then I would expect no terminal activity to affect the display.

That is not currently the case.

The code @tannewt pointed to bases its decision to refresh off of epaper_display.core.current_group != &circuitpython_splash. Since this has not been explicitly set, then something has implicitly set it.

#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; FeatherS3 with ESP32S3

Code/REPL

import json
import time

datastr = json.dumps([111, 222, 333, 444, 555] * 10)


# somehow slower than loads_plus_dumps
def loads_alone(datastr):
    return json.loads(datastr)


# somehow faster than loads_alone
def loads_plus_dumps(datastr):
    json.dumps(None)  # adding this line boosts performance!?
    return json.loads(datastr)


# test ...
manic glacierBOT
manic glacierBOT
empty salmon
#

What is the downside to freezing modules in the CircuitPython firmware?

tulip sleet
#

Takes firmware space. Frozen modules can become obsolete and have to be overridden, so users have to understand sys.path.

empty salmon
#

Thanks @tulip sleet. I am assuming the modules are up-to-date as the CircuitPython version itself - e.g. if someone has CircuitPython 8.2.9 then the frozen modules are current as of that release.
Of course, users may not be quick to update to the latest CircuitPython version. And modules can receive bug fixes more often than CircuitPython releases.

#

Also, I really appreciate the contributors. They are quick to help with answers 👍🏼👍🏼

tulip sleet
empty salmon
#

Oh. Good detail to know. I was not aware.

tulip sleet
#

it's based on support experience, and a few things that went wrong. We are not hesitant to make new releases: it's not a lot of work to make a new releases, and there are plenty of integers. But we don't want to make a stable release that is a regression.

empty salmon
#

Really appreciate the insights

tulip sleet
#

yw!

pulsar sleet
#

How does circuit python handle memory. Are object placed one after another or is there blocks that small objects go in

#

like blocks of memory for smaller objects

stuck elbow
pulsar sleet
#

Ok thanks

stuck elbow
#

there really isn't enough memory to do many of the smart tricks that big python does

pulsar sleet
#

what is the pallette object in displayio. Is it just a set of colors. If it is then could I just make one and use that on a whole bunch of OnDiskBitmaps. All my bitmaps are 256 colors

blissful pollen
pulsar sleet
#

Ok thank you. I need this because I have memory issues and ~6 bitmaps all having 4096 byte (256 colors * sizeof(_displayio_color_t)) pallettes does not help

pulsar sleet
#

I tried to make the palette get allocated once and reused. I didn't get a error and my memory errors were fixed (so far) but the colors are sometimes messed up a bit. All the bitmaps are 256 indexed colors. What I did is in OnDiskBitmap.c I defined a pointer that then when creating the palette I check if the palette is NULL and if it is then I would allocate space for the palette and construct the object. I will upload my modified OnDiskBitmap.c file and a image

#

the logos are supposed to be this

pulsar sleet
devout jolt
# pulsar sleet I tried to make the palette get allocated once and reused. I didn't get a error ...

You may want to move this to #help-with-circuitpython as this isn't a dev issue. LEDs act different than screens so you'll usually need to process the images to look more correct. Here's one article about doing that: https://learn.adafruit.com/image-correction-for-rgb-led-matrices?view=all Also Liz has some specifc tips for team logos here: https://learn.adafruit.com/led-matrix-sports-scoreboard/prep-the-team-logos

pulsar sleet
devout jolt
pulsar sleet
#

I modified the ondiskbitmap file in circuit pythons source and that Is the cause of my errors. I used the script to download images that was provided in the article and they worked until I modified the OnDiskBitmap.c file

pulsar sleet
#

It does look like my palettes are different

#

I thought this was going to be easy

stuck elbow
#

you can also convert them manually in gimp

pulsar sleet
stuck elbow
#

another manual thing you could do, is to put both images on one image, side by side, convert that to 256 colors, and then clip back each one to the individual image, but without touching the palette

devout jolt
celest marsh
#

hmm, I'm thinking I need to install the requirements for Python3 in order to build CP in a pipenv - i'm getting errors about dependency conflicts
running on macOS Sonoma with Python 3.11.6

celest marsh
#

oh yea, pipenv was definitely the path forward

celest marsh
#

woo - doing my first board make on my mac
looking forward to diving into new things

#

done - successful build of the grandcentral_m4_express

#

and, ugh, that board is at the other place 🤦‍♂️
guess I'm testing it out later :)

devout jolt
# pulsar sleet How can I do this?

If using ImageMagick on the commandline, I do stuff like this:

# take two images, make one image of them side-by-side
montage -mode concatenate -tile x1 img1.gif img2.gif  img-all.png

# take that image, compress it to BMP3 with reduced colorspace
convert img-all.png -type palette -colors 64 -compress None BMP3:imgall_for_cirpy.bmp

And then I use CircuitPython TileGrid on the combined image to select which of the images I want:

bitmap = displayio.OnDiskBitmap(open("imgall_for_cirpy.bmp", "rb"))
palette = bitmap.pixel_shader
imgall = displayio.TileGrid(bitmap, pixel_shader=palette,
                            width = 1, height = 1, 
                            tile_width = 64, tile_height = 64)  # assumes each image is 64x64
# ... pick an image
imgall[0] = 0  # pick first image
imgall[0] = 1  # pick second image
short tendon
#

Opened up my draft pull request on first steps towards a unified socket handler here: https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/146

Would love any feedback if this is something I can continue to push through.

GitHub

This comes from a thought and discussion to make sockets more usable and have fewer errors when connecting to multiple services (HTTP, MQTT, etc.).
I have come up with the following proposed steps:...

pulsar sleet
#

That would be a lot easier but I figured it out. I used image magick to combine the images then split them localy on my pc. Then I renamed the files to the team names with a python script that didn't do everything perfectly so

pulsar sleet
#

I am still having color issue but they are worse. The palettes on the images are the same

manic glacierBOT
ashen whale
#

@atomic summit (or @ anyone who might know) I'm building a KMK split keyboard with a couple of FeatherS3s and only now just found that BLE isn't fully working, with ESP-32 S3 apparently? Is it clear what does and doesn't work and what sort of effort is still needed to get it done?

ashen whale
#

And are there workarounds of any sort?

stuck elbow
#

you can use zmk or qmk instead

#

though I'm not sure they have the support for s3

#

generally esp32 boards are very power hungry, so not many people want to use them for keyboards

ashen whale
#

On ZMK, there should be support in Zephyr, but not directly in ZMK. I don't think there is in QMK.

#

I understand the power hungry aspect, sure.

stuck elbow
#

most people fall back to nrf52

ashen whale
#

Yes, I've used that.

#

But why "a keyboard won't work" in CP or KMK?

stuck elbow
#

let me find the issue for you

ashen whale
#

thanks

stuck elbow
ashen whale
#

Ah, well, looks like espressif fixed dynamic services on their end so it may be coming to CP.

stuck elbow
#

what works right now is advertising

stuck elbow
#

there are always too many things to work on

ashen whale
#

Ah well, rats. I know, they're spread thin.

stuck elbow
ashen whale
#

Oh, yes, I saw that just the other day! Cool kit!

stuck elbow
#

works as wired so far

ashen whale
#

That's probably what I'll do.

stuck elbow
#

I suppose I could make it work with espnow and a dongle

ashen whale
#

I'll build it, get it working in KMK with all the other bits, then when BLE arrives on S3 (and is better implemented in KMK), hook up the batteries.

#

So the dongle woudl be a USB device on the computer and the halves would chat to it via espnow?

stuck elbow
#

yeah

ashen whale
#

Not a bad idea... So espnow could just relay the hid reports? But for the halves to stay synched they'd need to talk to each other, too. Could have KMK on all three devices and a espnow transport.

#

Or keep the halves connected and just send reports.

midnight ember
#

Spent part of my morning rewiring the TFT featherwing to have backlight pwm capability. The only place I've seen this documented is in the adafruit forums.

#

Started my circuit python journey with an NRF52840 board which the LITE mod was designed to work for. I've seen no documentation about requiring to change that pin location to work with an ESP32-S2 or S3.

#

Unsure if anyone wants to document this with the TFT Featherwing V1 or V2

#

There are power draw implications for screen dimming that I feel like should be documented for those attempting to put the power hungry TFT to sleep until touched.

manic glacierBOT