#circuitpython-dev

1 messages · Page 422 of 1

onyx hinge
#

now RTD builds are doing this ...

tulip sleet
#

by the time you return, we will be working on CircuitPython 9 🙃

#

@jaunty juniper RTD ^^

onyx hinge
#

yeah it'll be a bit before I return

jaunty juniper
#

hmffff that's a super useful error message

#
Read the Docs build information
Build id: 16910203
Project: circuitpython
Version: latest
Commit: None
Date: 2022-05-14T12:49:43.558024Z
State: finished
Success: False

versus

Read the Docs build information
Build id: 16909970
Project: circuitpython
Version: latest
Commit: 9fb4582cc881d6b45e3eebfee64308549b64df84
Date: 2022-05-14T11:39:27.431669Z
State: finished
Success: False
#

I don't understand, no error message, it just stops at git clean -d -f -f

#

that's the example:

submodules:
  include:
    - one
    - two
  recursive: true

that's what we have:

submodules:
    include:
        - extmod/ulab
        - frozen
#

so it might be because "frozen" is not actually a submodule

#

so that means we would have to list them all manually ? >_>

tulip sleet
jaunty juniper
#

we can call a custom command too, looking at that

tulip sleet
#

can you use the cross-RTD links and not fetch the submodules? Are the links that will be created here in this RTD, or are they across to the libraries RTD?

jaunty juniper
#

RTD calls the matrix, to list submodules the matrix needs to know what is inside the frozen modules directories. For a directory called Adafruit_CircuitPython_CircuitPlayground, the RTD is called circuitplayground (how do we know that ? is it always the same format ?), but we want adafruit_circuitplayground in the list. I don't want to do string transformations (like replace("_circuitpython_","_")) and some are not on RTD

tulip sleet
#

I think the matrix script looks either for a directory (that is not examples/, etc.), or it looks for the top level .py file?

#

no string transforms are necessary. It determines the import name from the submodule code

jaunty juniper
#

it takes every .py and every directory that contains py files that is not in the exclude list

#

but that requires checking out the frozen directory

tulip sleet
#

same algo is used for freezing

jaunty juniper
#

yep

tulip sleet
#

that is the original motivation

#

so if you could do a custom command that just fetches submodules under a particular dir? or could get the info from .gitmodules

jaunty juniper
#
build:
    os: ubuntu-20.04
    tools:
        python: "3"
    jobs:
        post_install:
            - git submodule update --init --force frozen
tulip sleet
#

that is simple

jaunty juniper
#

that's also what I expected the submodules rule to do, but it doesn't do that, nor accept globs

tulip sleet
#

there's probably an issue for that 🙂

jaunty juniper
tulip sleet
#

trying to parse the version name?

jaunty juniper
#

oh right !

tulip sleet
#

i had that issue before in some way

jaunty juniper
#

it passes with a tag 👍

#

shall I test test that ? (it takes the github ref, but it's for a fetch)

    jobs:
        post_install:
            - python tools/ci_fetch_deps.py docs main
tulip sleet
#

i'm not sure what you mean

jaunty juniper
#

reuse the ci script that fetches the submodules, the same one that is used for the docs test action

#

instead of having to sync the rtd conf with it

tulip sleet
#

sure, that seems straightforward, and would pick up any special casing it needs to do in the future

#

will be afk for a while

manic glacierBOT
#

Closes #6399
Make Readthedocs's own build process use ci_fetch_deps.py to checkout the submodules in the same way the CI does. That doesn't make github docs CI and the RTD build use the exact same steps (which they didn't already), but submodule dependencies are now in a single place.

Note: the previous version caused an error because RTD's submodule clause requires exact submodules, it doesn't do parent directories like frozen or patterns like frozen/*.

tulip sleet
#

@jaunty juniper When I merge #6400, it should build the docs, I think. It skipped the doc build in the PR build
I am not sure there is a reason to bother to let the current built go to completion, but I will, just in case.

tulip sleet
#

@jaunty juniper

jaunty juniper
#

that's a relief

lone axle
#

Where is the code that is responsible for the tab completion prompts in REPL? Would it be possible to add 1) the files in the root of CIRCUITPY and 2) the files / directories inside of CIRCUITPY/lib/ That way it could auto-complete import [beginning of filename][Tab]

jaunty juniper
#

(so, yes)

lone axle
#

Oh, nice. Thank you

jaunty juniper
#

didn't find it first, found the MP PR to backport the feature (which I remembered happened), the poster's name, then searched for them in the CP repo 🔎 🕵️

manic glacierBOT
#

Note: I personally would prefer that the Serial writes would queue the data and work asynchronous. And in those case where you need to need to know that the data has completed before doing something that you would
add the uart.flush() type capability.

I have not tried any of this on the SAMD, but for example I just tried out the changes for RPI2040 that allowed the RS485 pin to be logically set. And to show why it was needed on the RP2040, here is a sketch running that sets a pin fo...

#
[adafruit/circuitpython] New branch created: 7\.3\.x
manic glacierBOT
#
[adafruit/circuitpython] New tag created: 7\.3\.0\-rc\.0
tulip sleet
proven garnet
#

@idle owl, ran the .pre-commit-config.yaml patch on a few of the libraries and it looks excellent so far so I'm going to let it run

proven garnet
#

Is there something speical about the floppy library that it's .pre-commit-config.yaml is different?

#

Or is it just based on an older? That's the only I don't think the patch managed to get

#

Otherwise, the patch is complete! The few I've checked don't seem to have any CI issues, but happy to fix any I botched gentleblob

tulip sleet
#

floppy was added just recently, so it's probably not up to date

proven garnet
#

I can patch it today then! I'll also PR the cookiecutter as well so future repos will be up to date as well.

proven garnet
#

Cookiecutter is patched with the same changes!

lone sandalBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit KB2040 with rp2040
Board ID:adafruit_kb2040

Code/REPL

import board
import collections
import neopixel
import time

from digitalio import DigitalInOut, Direction, Pull

ROW_PINS = [
    board.D5,
    board.A0,
    board.D6,
    board.SCK,
    board.D8,
    board.MOSI,
    board.D9,
    board.D10,
]

COL_PINS = [
    board.D2,
    board.A3,
    board.D3,
    boar...
manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.3.0-rc.0 on 2022-05-15; Adafruit Matrix Portal M4 with samd51j19
Board ID:matrixportal_m4

Code/REPL

from adafruit_matrixportal.matrixportal import MatrixPortal as mp
m = mp(width=64, height=64, bit_depth=6)

# following lines are NOT needed to produce error
# error occurs with or without attached matrix
m.set_background("/bats.bmp")
while True:
    continue

Behavior

Traceback (most recent cal...

proven garnet
#

One thing I noticed during the patch is that the floppy library isn't available to CircuitPython librarians, should it be or is it still WIP? I don't think I had write access.

tulip sleet
proven garnet
#

Thanks!

manic glacierBOT
#

@dhalbert I didn't have a schematic handy, but hopefully I'm able to make things clearer with a bit more descriptions below.

The board I'm using is the Adafruit kb2040 (based on the rp2040). The issue was discovered using kmk, which uses keypad.KeyMatrix. In the process of troubleshooting I tested KMK code, keypad.KeyMatrix code, and then created my own matrix scanning loop. This was done in the process of isolating the issue in software after I verified that my connections were all solid,...

manic glacierBOT
#

The intent of columns_to_anodes was whether the columns were connected to the anodes or the cathodes of the diodes, e.g. whether the diodes were flipped. But I see you could also interpret it as having the diodes on the rows rather than the columns.

Did you model your keyboard wiring on an existing schematic? Any example schematic that is wired the same way would be helpful for me to look at. Or even a picture, if it's point-to-point wiring. Thanks!

proven garnet
#

@idle owl I reverted part of the cookiecutter patch but tagged you in it.

manic glacierBOT
manic glacierBOT
manic glacierBOT
tidal kiln
manic glacierBOT
#

@dhalbert yes, I understand that the variable means if anodes or cathodes are econnected to the columns.

The way I interpret it is that when that value is true, columns are essentially outputs and when scanning the columns go high. When the variable is false, the columns are inputs, and it's the rows that are driven. I.E. columns_to_anodes = True means that conventional current goes from column pins to row pins; when set to false, the conventional current goes from the row pins to the co...

tulip sleet
tidal kiln
#

a m4sk? yes.

#
UF2 Bootloader v1.23.1-adafruit.1-210-g795abd2 SFHWRO
Model: Hallowing Mask M4
Board-ID: SAMD51G19A-Mask-v0
#

current bootloader. leave that? or update?

tulip sleet
#

Try it with the old bootloader, then try it again after updating the bootloader

tidal kiln
#
Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Monster M4SK with samd51j19
>>> import os
>>> os.listdir()
['.fseventsd', '.metadata_never_index', '.Trashes', 'lib', 'boot_out.txt', 'System Volume Information', 'config.eye', 'hazel', 'splash.bmp']
>>> 
#

want me to erase the FS somehow? it's got stuff from whatever eye thing was last being tested on it.

tulip sleet
tidal kiln
#

use the REPL erase_filesystem() method?

tulip sleet
#

that's fine

tidal kiln
#
Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Monster M4SK with samd51j19
>>> import os
>>> os.listdir()
['.fseventsd', '.metadata_never_index', '.Trashes', 'code.py', 'lib', 'boot_out.txt']
>>> 
#

seems fine? that's with older bootloader.

#

next step is try bootloader update?

tulip sleet
#

yes, as the poster did, same version

tidal kiln
#
UF2 Bootloader v3.14.0 SFHWRO
Model: Hallowing Mask M4
Board-ID: SAMD51G19A-Mask-v0
#
Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit Monster M4SK with samd51j19
>>> import os
>>> os.listdir()
['.fseventsd', '.metadata_never_index', '.Trashes', 'code.py', 'lib', 'boot_out.txt']
>>> 
#

works

#

in general, it seems like something they are doing. very doubtful a hardware failure would happen on two copies, and also after initially working fine upon arrival.

#

but no idea what they might be doing. their description all seems fine.

#

any chance it's some as-yet-unknown OS or 3rd party software thing?

tulip sleet
#

it seems unlikely. The "You are in safe mode because:
CIRCUITPY drive could not be found or created." messages really has nothing to do with USB.

tidal kiln
#

marginal power?

tulip sleet
#

That is an indicator the startup code could not mount or reformat the CIRCUITPY drive. ... maybe ... I have a couple of Macs I could try this on after the meetings

#

if they could try both boards on some other computer... I'm not sure if they said they had access to non-Macs or not

#

we have an internal CPy meeting in a few minutes, then the regular weekly meeting

lone axle
#

<@&356864093652516868> The weekly meeting will occur here on Discord in about 1 hour. You can fill in notes ahead of time in the shared document: https://docs.google.com/document/d/1fc8UvMSBTq0x2Sh94_R6pSRm1v81sZCWA4L7TwsFzfg/edit?usp=sharing Looking forward to seeing you there.

tulip sleet
# tidal kiln marginal power?

also that thread contains a post from lm2425 who says they have the same trouble, also purchased from Pi Hut, so I am wondering about a bad batch

#

worth following up with them as well

#

maybe we can get an Arduino program to identify the flash chip that's on the board, see if it's the right one (and if it responds in Arduino)

manic glacierBOT
tidal kiln
#

claiming same thing happens on mac and win...but win8 😦

jaunty juniper
#

I don't have issues with my monster m4sk on my intel mac mini

#

updated the bootloader with the UF2, installed 7.2.5

tulip sleet
#

i'm still leaning toward hw issue

tidal kiln
#

@tulip sleet the test UF2 does show some SPI flash info

tulip sleet
#

i'll check that id # later

#

do you see that same ID wit hthe test program? That's the ID from the user photo

slender iron
#

is there a picture of the chip?

tidal kiln
proven garnet
#

@lone axle I'm adding the EMC2101 thing to In The Weeds under my name but feel free to edit/add to it.

lone axle
#

Thank you.

lone axle
#

@tulip sleet, @slender iron Is one of you up for reading the core status section during the meeting today?

slender iron
#

I'm around and happy to

proven garnet
#

Before I go down the rabbit hole - decorators also work for classes in CPY, right?

#

I've seen them for functions and methods but can't recall for classes

tulip sleet
#

@lone axle cater JEDEC ID is two nibbles mfr id, two nibbles chip id, one nibble type, and one nibble capacity, so the last 7 says it's the right capacity

jaunty juniper
#

it looks like they have a different chip than the one CP is configured for

lone axle
tulip sleet
proven garnet
jaunty juniper
tulip sleet
#

oops i was looking at matrixportal -- I'm mixing up issues

#
EXTERNAL_FLASH_DEVICES = GD25Q64C
jaunty juniper
#

I can post a build with EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64FV"

tulip sleet
#

ok that's not good. @tidal kiln I will make a build supporting the other chip as well, and we can have them try it

#

we crossed, sure, go ahead, post it in that thread

jaunty juniper
#

I think that's the right value

tulip sleet
proven garnet
#

A totally useful example of course

tulip sleet
#

@jaunty juniper it might be W25Q64JVxQ instead, that's much more common with our boards

idle owl
#

@lone axle We'll be right there. Finishing up a meeting.

jaunty juniper
marble hornet
#

yes please

#

oops

random junco
#

@timid lintel Very cool, nice work!

blissful pollen
#

You can read it, sorry only can half listen at the moment

turbid radish
#

Yay Liz & Paul!

slender iron
#

I think so

#

can't remember

manic glacierBOT
errant grail
#

Good luck pursuing the slightly revised new chapter @solar whale. Have always enjoyed your expertise, insights, and humor. Great laugh, BTW.

tidal kiln
#

@solar whale bummer. you're a great help and contributor here. will be missed. enjoy the change of focus. thanks for all the fish!

slender iron
#

oh, and if you know of a remote file editing protocol that is used in phone apps then let me know. maybe we want circuitpython to do the same

idle owl
#

This came up during the Sprints as well.

proven garnet
#

I think the only thing @tulip sleet had mentioned in one of my PRs was grouping doc things in the core if possible to save CI runs.

#

I know use of Protocol is also pinned to 3.7

tulip sleet
#

I think it's minimum 3.7

#

it's not pinned to a specific version

#

3.x in general

proven garnet
#

Oh I didn't realize, cool!

tulip sleet
#

i think!

marble hornet
proven garnet
#

Nope, you're right Dan!

idle owl
#

pre-commit also works to run it manually. We stumbled onto that during the Sprints.

manic glacierBOT
#

@ladyada, I did swap cols<->rows. If I swap those (and also change the columns_to_anodes accordingly) the buggy behavior goes away.

The problem I'm trying to solve is that (to me) it seems like the code does not work if the output pins of the matrix are passed in as columns. The code appears to not be symmetrical, even though the documentation seems to indicate that it's a supported case.

I wrote my own python matrix scanner, and don't see the buggy behavior either.

I think if the ...

lone axle
proven garnet
#

It's the weird reason you can have failed import and still not fail on type annotations for CircuitPython, that took me a minute to wrap my head around haha

lone axle
timid lintel
#

imho it's important it shows up in all existing PyPortal learn guides

tulip sleet
#

@marble hornet hmm, it might be true that MicroPython does not support annotations with square brackets. Would need to test. We do use Protocols, but as subclasses, e.g. in adafruit_requests:

lass CommonCircuitPythonSocketType(CommonSocketType, Protocol):
timid lintel
#

thanks @idle owl that would be great

lone axle
tulip sleet
#

@marble hornet: this works:

>>> def f(x: Protocol):
...     pass
...     
...     
... 
>>> def f(x: Protocol[True]):
...     pass
#

in CircuitPython

#

even if it didn't, you could always use string annotations, since that defers evaluation of what is inside the tstring

proven garnet
#

I think that's it!

tulip sleet
#

the from __future__ import annotations I added does not actually do anything at all; it is a no-op. I simply made it possible to add that statement without it causing an error

marble hornet
#

I don't think string annotations work in class base lists?

class Foo(Protocol[T]):pass # doesn't work on circuitpython 
# or
class Bar("Protocol[T]"):pass # Errors on cpython and CP
# etc
proven garnet
#

It's more of a warning if anything as well, for some of them

tulip sleet
proven garnet
#

Thanks y'all!

marble hornet
#

If we want to support that syntax, I think there are two-ish (and a half) possible ways to do it?

proven garnet
marble hornet
digital shoreBOT
proven garnet
#

Is it something other than something not being defined yet?

jaunty juniper
#

what does it do to inherit from a protocol in python ??

marble hornet
proven garnet
turbid radish
#

@lone axle please email when the newsletter PR is in. Thanks!

proven garnet
#

You can just define all the methods and attributes in that definition

jaunty juniper
#

but you don't need to inherit, a Protocol declares in a type annotation what attributes you expect

proven garnet
tulip sleet
#

@marble hornet can you point to an example of using generic Protocol inheritance

marble hornet
lone axle
#

I'm going to drop and start getting the video and notes uploaded. Thanks all.

jaunty juniper
#

ah generic types

proven garnet
#

@lone axle did you say you were gonna respond on the EMC2101 PR?

jaunty juniper
# marble hornet

we solve that by putting the protocols in a module that is guarded by try: import typing

lone axle
jaunty juniper
#

so your issue is that you want to put implementation in the class Something(Protocol) to inherit from ?

tulip sleet
#

@jaunty juniper we are discussing this in the audio chat

proven garnet
#

I will say, what would be nice about getting away from try/except, is that my type checker will always say that something either what it is, or Unbound because it recognizes that the import could fail

tidal kiln
jaunty juniper
#

ok, sorry I shouldn't get into it, typing in python is not my battle

marble hornet
#

And/or if you have input and wanna chat I'm around a lot this week

proven garnet
#

Yeah definitely, though my input is gonna probably more about things like that since I'm core-ignorant haha

#

Honestly just having the TYPE_CHECKING or something that will get VS Code to stop being so mad and (fairly) calling everything Union[X, Unbound] would be neato hahaha

tulip sleet
#

@jaunty juniper your MONSTER M4SK fix works! If you do a PR I could do a quick release. Which chip did you add that worked?

#

but I also want to investigate the MatrixPortal memory issue, so i would probably wait for that

#

to make sure there isn't a fix needed for that as well

jaunty juniper
tulip sleet
#

i have an inquiry in for that, and I think I can look at the factory fab stuff too to find out

tulip sleet
#

that makes sense to me, that is a completely typical substitution, and those are the two parts we often use for this

jaunty juniper
#

what is the cost of adding flash types ?

tulip sleet
#

uses up internal flash space

jaunty juniper
#

could there be other boards that have had/could have that substitution that we could anticipate ?

manic glacierBOT
tulip sleet
#

look for any other boards that have only GD25Q64C or GD25Q16C

#

and not the W25Q

#

we have a lot with GD25Q16C only, I don't think we are substituting those

#
ports/atmel-samd/boards/grandcentral_m4_express/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"

ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"

ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = GD25Q64C

ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = GD25Q64C

ports/atmel-samd/boards/pygamer/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = GD25Q64C

ports/atmel-samd/boards/pyportal/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"

ports/atmel-samd/boards/pyportal_titano/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"

ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk
10:EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"

ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk
9:EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ"
#

removed non-adafruit boards, so add to hallowing_m4, monster_m4sk, and pygamer

manic glacierBOT
lone axle
#

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

slender iron
#

@idle owl it looks like the pre-commit upgrade of reuse broke some CIs

#

due to an unused license

idle owl
#

Ok. I'll look into it. I've had to add license types before.

manic glacierBOT
#

m=mp(width=64,height=64,bit_depth=1) works 730b0
m=mp(width=64,height=64,bit_depth=1) works 730b1
m=mp(width=64,height=64,bit_depth=1) works 730b2
m=mp(width=64,height=64,bit_depth=1) works 730rc0

m=mp(width=64,height=64,bit_depth=2) fails 730b0
m=mp(width=64,height=64,bit_depth=2) fails 730b1
m=mp(width=64,height=64,bit_depth=2) fails 730b2
m=mp(width=64,height=64,bit_depth=2) fails 730rc0

image looks improper on 64x64 matrix:
m=mp(width=32,height=32,bit_depth=1) works 730rc0
m...

idle owl
#

@proven garnet Hiya! So we broke some CI. Apparently you can no longer have unused licenses in a repository, or that's what it looks like from the one linked above. I deleted the unused license from the LICENSES directory, and it passed. Is there a reasonable way to sort out what's not passing, and see if it's Reuse-update related?

#

@proven garnet In related news, the Library Infrastructure checks are failing on "incorrect pre-commit version/reuse version", meaning we need to update the version Adabot is checking for.

#

Ooh looks like Eva did it.

#

N. m. hehe.

marble hornet
manic glacierBOT
tidal kiln
#

@tulip sleet @jaunty juniper worth opening a new issue for the qspi thing? for sake of tracking (not seeing one)

#

actually. maybe the PR is good enough. just want to give forums a link to keep an eye on.

idle owl
#

@tulip sleet Ok, so this guide page.... Is meant to explain the difference between .mpy, .py and frozen libraries. I have a snippet of one of the conversations that came out of me asking about it here, and it gets into why .py files take up more memory than .mpy files, e.g. explaining exactly what memory is being used (compiling, and then the resulting bytecode which must be stored in memory during and after the compilation).

Is this getting too much in the weeds for this guide page? Or do you think it's worth including.

#

It would allow me to differentiate between the mpy and py memory usage, but maybe it's too much.

#

I'm trying to make sure this also answers a lot of questions we get. Because we do get a lot of questions about this topic.

tulip sleet
# idle owl <@329766224093249548> Ok, so this guide page.... Is meant to explain the differe...

People ask all the time for the explanation, so I don't think it's too much. import of an .mpy loads the compiled code, import of a .py must compile the code. In both cases the compiled code lives in RAM, and the resulting compiled code is basically the same size in either case. But the compilation takes extra RAM temporarily during the compilation, and if there's not enough RAM available, it will fail. Compilation may also cause some fragmentation, but we are mostly able to avoid that.

#

I am probably just repeating what you said in the guide

idle owl
#

Not yet, I didn't. That's a great wording.

#

Thank you!

#

I'm definitely going to pass this by you before putting it in moderation.

tulip sleet
#

you can bring a pre-made cake to someone's house, or you can make it at their house. Either case, the final cake is the same size. But if you make it their house, you need space and resources temporarily to make it.

#

not sure that's a great analogy

idle owl
#

I get the idea though.

manic glacierBOT
manic glacierBOT
#

If you swap the rows and columns, the key matrix is electrically the same as if you just flipped all the diodes to the opposite direction. There is nothing that the code could do to recognize the difference (and work in one case while not working in the other), both cases are electrically identical. It would really help to see the schematic of your matrix.

Also, what does it mean the code "does not work"? Do you get an error message? Do wrong keys register? No key presses register at all? ...

proven garnet
#

Let me check out gh CLI...

manic glacierBOT
#

The interval you are using is 0.2 secs or 200 msecs. That is a very long scanning time. 0.02 is the default. The errors you are seeing are:

expected keystrokes are sent, but also undesired keystrokes are sent. The undesired keystrokes are always on the same column next row over.

The code is just looking for a completed circuit between a row and a column pin, It could do that in either direction. I'm not sure why it should matter which is the input and which is the output.

Are the...

proven garnet
#

Okay I thiiiiiiiink I can get a list together of the libraries that the patch failed for using gh

#

this @idle owl

manic glacierBOT
#

I tested a few variations of changing objects while the group they belong to was hidden. Here is the base test script:

import time
import displayio
import terminalio
import vectorio
from adafruit_display_text.bitmap_label import Label
import board

display = board.DISPLAY

display.auto_refresh = False

main_group = displayio.Group()

palette = displayio.Palette(1)
palette[0] = 0x125690

circle = vectorio.Circle(pixel_shader=palette, radius=25, x=70, y=40)
main_group.a...
proven garnet
#

@idle owl @slender iron Wrote a script to find the latest CI triggered by me in the main branch across all the libraries (should be the patch). The only one that was flagged was the AzureIoT, but I am pretty confident it worked because it found another failure, though it's cause wasn't that, which I submitted a PR for: https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/pull/57

#

So I think that was the only one. Happy to share the script if anyone wants to check

slender iron
#

haha, great!

#

just the library I was poking at

idle owl
#

Thank you, @proven garnet!

proven garnet
#

No worries! Glad it wasn't any larger of a problem!

manic glacierBOT
#

I made a small 2x2 test setup of four https://www.adafruit.com/product/4978, NeoKey breakout. On these boards, the A connection is the anode, and the C connection is the cathode. Here is the schematic. I only used the SWITCHA and SWITCHC pins.

neokey

I wired the SWITCHAs together as thecolumns, and the SWITCHCs together as the rows. I believe this corresponds exactly to y...

manic glacierBOT
#

I tried the code on a different matrix that is wired in the same manner that I know to work, and the undesired behavior is not present.

@dhalbert thank you for looking into this and for putting time into attempting to replicate the problem. I think that by having the same piece of code work on the known-good matrix, I can safely assume that the code for which I opened this github issue is not the culprit.

To answer your previous question, there are no capacitors on the board.

I manag...

manic glacierBOT
rough folio
#

is there any guidance on building cirPy on windows? or is this a nix/mac only ballgame unless I want to do some digging

jaunty juniper
rough folio
#

yeah fair enough. WSL breaks my existing VM stack which is kind of fun so I was hoping I wouldn't have to deal with that whole affair

rough folio
#

oh well nbd
to that end- are there docs on making board configurations? Or just infer from existing

jaunty juniper
rough folio
#

I've got a little sparkfun esp32s2 which is pretty similar to the adafruit feather so it shouldn't be much work

jaunty juniper
#

which one ?

rough folio
#

esp32-s2 thing plus

jaunty juniper
#

oh yeah that should be rather simple

rough folio
#

very few pin differences
alas, they exist

#

these docs are good thanks

manic glacierBOT
#

The “cleanup” I’m talking about is the “dirty area” left behind when a displayio object has changed location. It’s tracked by the “dirty area” and ends up going through a draw on the next frame. The object is supposed to not draw areas that it is no longer interested in, which leaves the bit flag byte array region covering those areas as 0 which means “this shape didn’t set those pixels’ values.”

I might be misremembering the lifecycle here in group - it has been a while!

The thing I’...

manic glacierBOT
lone sandalBOT
tulip sleet
lone sandalBOT
rough folio
manic glacierBOT
#

@deshipu That could be the case, I'm going to try changing the diodes to a known part. This may align with the fact that I have the same kit, working properly with a Pro-Micro, but that one works at 16MHz rather than 120MHz, which may also align with the loop/transposition workaround.

When you mentioned that the circuits transposed were electrically the same, I recognized that it was the same intuition I had when trying it, the difference is in running the code, the issue with multiple key...

proven garnet
#

Should fontio.FontProtocol be moved to circuitpython_typing? It needs the Glyph class defined, and I don't know if it makes sense to effectively have to mirror that in the other library in case it changes.

#

It just means right now one Protocol needs the stubs while type annotating

idle owl
#

@proven garnet Grabbing a couple of documents, but otherwise I'm ready when you are.

proven garnet
#

Sweet! Be right there

manic glacierBOT
#

The stack size on ESP32-xx may be too small. This code gets a stack overflow on an ESP32-S2 board running 7.2.5

>>> import re
>>> _REQUEST_RE = re.compile(r"(\S+)\s+(\S+)\s")
>>> _REQUEST_RE.match("GET /" + ("a" * 135) + " whatev")
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: maximum recursion depth exceeded
>>> _REQUEST_RE.match("GET /" + ("a" * 134) + " whatev")

(originally noted in https://github.com/adafruit/Adafruit_CircuitPython_HTTPServe...

manic glacierBOT
#

Just a thought....

I routinely compile custom images with MICROPY_ENABLE_PYSTACK turned off and MICROPY_STACKESS turned on. I don't know what I'm trading off with these settings but I've been assuming I've just been making the garbage collector's job harder and reducing the amount of memory I'm able to allocate in my applications.

If the advantage of using the stacks is to keep larger chunks of contiguous memory available, I wonder if they are still necessary on the new multi megabyte m...

manic glacierBOT
idle owl
#

@tulip sleet I decided to make your cake analogy work because I felt like you mostly had it on point, but it needed a little more content to really work. Or, I wrote something terrible that should be deleted. 😆 You can bring a ready-to-eat cake to your friend's house, or you can show up with the plan to bake the same cake at your friend's house. Both completed cakes will take up the same amount of space. However, waiting to bake the cake means you'll need more space and resources before the cake is ready to eat, to combine the ingredients, bake it, and frost it. If it turns out your friend doesn't have the space available, or is missing a crucial ingredient, you wouldn't be able to complete the cake. Basically, if you're unsure whether you'll have everything needed to bake a cake at your friend's house, it's better to show up with a completed cake to ensure there is cake to be had!

manic glacierBOT
idle owl
#

Other than import order sometimes mattering, and dealing with memory allocation, what other "issues" can one run into with CircuitPython libraries? This is something that would be generalisable to all libraries, not something involving a specific library.

stuck elbow
#

memory fragmentation?

idle owl
#

Ooh good one.

#

I kind of explain it elsewhere, but that's a good one to separate out.

stuck elbow
#

loading the wrong library, because you have a leftover .py file lying around? (they take precedence)

idle owl
#

Oooooooh yes. Definitely.

stuck elbow
#

naming your test code the same as the library you want to test (for example "neopixel") and wondering why when you import it, it doesn't have all the things it was supposed to have, only your code

idle owl
#

Excellent

stuck elbow
#

shadowing the built-in libraries in general

#

especially when some 3rd party library uses it, and not you yourself

idle owl
#

shadowing?

stuck elbow
#

if you have neopixel.py it will get loaded instead of the built-in neopixel

idle owl
#

ahh right right ok

stuck elbow
#

not sure if this is relevant here, there is one common mistake with the library API, when people read what parameters a function takes, and then pass them as positional parameters, but don't realize some of the are keyword-only parameters, and then they get a confusing error saying that they provided a wrong number of parameters

jaunty juniper
#

or a directory, which is seen as a package module

#

like don't put all your neopixel scripts and files in a neopixel/ folder

idle owl
stuck elbow
#

@idle owl yup

idle owl
stuck elbow
#

maybe it would be good to mention that modules are only ever imported once, even if you import them in multiple files or many places, the subsequent imports simply do nothing and give you the already imported library

idle owl
stuck elbow
#

some people might expect it would re-load the library

idle owl
#

Agreed

stuck elbow
#

for instance, in the repl, you can import your code to test it, but a second import won't run it anymore

idle owl
#

Riight. Ok, yeah.

#

I'll find someplace to add that.

stuck elbow
#

you can also exploit it to set a global on an imported library in one file, and read it in another :P

jaunty juniper
#

which is how you can get the correct keyboard layout in macropad hotkeys

#

(using a module global variable in the macros scripts to share the Keycode instance)

idle owl
#

So my "Memory Fragmentation" section contains the following. Is there more to be added / a better way to explain it? A memory allocation failure does not necessarily mean you are entirely out of memory. It specifically means that there is not a single large enough chunk of memory to import a library of the given size. CircuitPython memory can become fragmented the more you do, and have smaller chunks of memory available across the entire heap, but not a single chunk big enough to complete a particular task.

#

Comes right after the "Memory Allocation" section. So that's not an oblique reference it starts with.

tulip sleet
#

"It specifically means" in the case of import

idle owl
#

Or at least in the full context of libraries

#

Does that limit the scope to import at that point? Or are there further bits involving the library files etc.

tulip sleet
#

"It specifically means that there is not a single large enough chunk of memory" to allocate the chunk requested. In the case of importing a .mpy file, the library is imported into a single chunk`. In the case of importing a .py file, you could run out of memory because more RAM than you have available is needed for compilation. In that case, the chunk needed is not necessarily large.

idle owl
#

ohhhh

#

Ok yeah.

stuck elbow
#

so there is that optimization thing, that once a module is finished importing, it's moved to the end of available memory, because it's unlikely to be ever freed — and this decreases fragmentation

#

but I'm not sure we want to got that deep about this

tulip sleet
#

so in the kitchen example, you have run out of counterspace, or whatever. It's not that you necessarily need a huge chunk of counterspace all at once, but you keep using up sections of counterspace until there's none left. "I can't find anywhere to put the sugar down!"

idle owl
#

Nice ok

tulip sleet
#

i'm not sure the kitchen analogy is going to be that helpful in detail, maybe, maybe not

#

"there is no way I can make a cake in this closet"

idle owl
#

I feel like maybe not. I probably won't extend the reference beyond earlier usage.

stuck elbow
#

once you finish with one part of the cake, you clean up all the utensils you used to make it, and move the finished part to the end of the counter, to make room for the next step

idle owl
#

OK here's what I have now: ```A memory allocation failure does not necessarily mean you are entirely out of memory. CircuitPython memory can become fragmented the more you do, and have smaller chunks of memory available across the entire heap that add up to the amount needed, but not a single chunk big enough to complete a particular task. Fragmentation can block allocation of any chunk of memory that needs to be contiguous, such as a large buffer. In the context of importing a library file, it specifically means that there is not a single large enough chunk of memory to allocate the memory requested.

In the case of importing a .mpy file, the compiled bytecode is imported in a single chunk. In the case of importing a .py file, the size of the chunk needed for compilation may exceed the size of the chunks available, in which case, you would run out of memory before there is even any bytecode to import.

CircuitPython does do some optimisation to avoid memory fragmentation. Once a library is imported successfully, it is moved to the end of the available memory, which decreases fragmentation. Some fragmentation is unavoidable over time, but the import optimisation definitely helps with avoiding as much initially.```

tulip sleet
slender iron
#

I don't think mpy needs a large chunk either. strings and functions will take linear space

stuck elbow
#

what about the AST representation and so on? I don't even know if micropython has an intermediate representation...

slender iron
#

I don't think it does... but I'm not sure

#

should I throw an exception, return the same weird tuple or just silently fail?

tulip sleet
slender iron
#

I'm not sure why they do it that way

tulip sleet
#

so if for instance the password key does not exist, but you need it, it will return "SORRY, NO PASSWORD" or equivalent for the value?

#

are there issues about it?

slender iron
#

I don't see any issues

#

that are related at least

tulip sleet
slender iron
#

the most common is probably trying to write a read-only file

tulip sleet
slender iron
#

printing isn't really a solution

tulip sleet
#

no, not at all. It doesn't seem to be a high priority to fail more obviously in a non-interactive environment

slender iron
#

ya

tulip sleet
slender iron
#

think I should just return Nones

#

so their returns aren't used

tulip sleet
#

so they return a tuple on error, but a string otherwise?

slender iron
#

get_key is string or None

#

set and unset are weird

tulip sleet
#
    if not os.path.exists(dotenv_path):
        logger.warning("Can't delete from %s - it doesn't exist.", dotenv_path)
        return None, key_to_unset

    removed = False
    with rewrite(dotenv_path, encoding=encoding) as (source, dest):
        for mapping in with_warn_for_invalid_lines(parse_stream(source)):
            if mapping.key == key_to_unset:
                removed = True
            else:
                dest.write(mapping.original.string)

    if not removed:
        logger.warning("Key %s not removed from %s - key doesn't exist.", key_to_unset, dotenv_path)
        return None, key_to_unset

    return removed, key_to_unset
#

It is never going to return False, key_to_unset because the if not removed: will catch both None and False

slender iron
#

ya...

tulip sleet
#

🤷

slender iron
#

I'll just return None

tulip sleet
#

i have something else to talk to you about: more fragmentation after 1.18 merge, I think

slender iron
#

from imports?

#

want to video?

tulip sleet
#

i think so, but not sure;

#

sure, thanks

slender iron
#

np

manic glacierBOT
#

I tried this out and tweaked it a bit to match the Titano display size.

https://user-images.githubusercontent.com/2406189/168932620-c4ccb417-963f-4703-90c3-6f5eae2f10ce.mp4

It's behavior seems normal / expected to me. It's quite "flashy" because of the short sleeps and being made hidden / visible but I think that is expected with this code.

The camera feed / streamed recording it came from has glitch some during the video but the display itself doesn't have the same pause glitch in...

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@dsohrabian We would be quite interested in the simplest example program you have that seems to cause trouble, including your descriptions of what is returned from the requests. 5kB reponses might eventually lead to memory fragmentation, depending on how you hang on to the results. But there also might be bugs in the ESP32 firmware.

After testing, I believe that the hanging issue happens when I import adafruit_matrixportal Matrix object. I have commented out the whole board object in my ...

rough folio
#

so I built circuitpython for the sparkfun ESP32S2 thing board
except it's spamming invalid header 0xfffffff out the whahoozie with this bit of text every second or so

#

steps taken:
clone the esp32s2 feather board configuration and modify the board name in mpconfigboard.h/k
make board=sparkfun_thing_plus_esp32s2 (the new folder)
sudo esptool.py --port /dev/ttyUSB0 erase_flash
sudo python3 esptool.py --port /dev/ttyUSB0 --chip esp32s2 write-flash -z 0x1000 ../circuitpython/ports/espressif/build-sparkfun_esp32s2_thing_plus/firmware.bin

#

which are the steps listed on the micropython site which I perhaps mistakenly assumed would translate here

#

aaand I've just noticed that the feather is not the s2-wroom which is probably what's causing this :bleh:

onyx hinge
#

heya folks! It's not really CircuitPython related (except that I'm CircuitPython related!) but I'll be sharing a few photos during this trip. https://photos.app.goo.gl/u2c52WapAATLQ65u6 including the smallest elevator I've ever been in. I am having a great time but I miss y'all.

Google Photos

11 new items added to shared album

rough folio
rough folio
#

so it was something to do with the offset... writing to 0 instead of 0x1000 fixed that part

#

I suppose reading that in the output of the build would have helped because it says the start addr right there

#

but now the UART port outputs naught but ESP-ROM:esp32s2-rc4-20191025 Build:Oct 25 2019 rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x4002c15e SPIWP:0xee mode:DIO, clock div:2 load:0x3ffe6100,len:0x1368 load:0x4004c000,len:0xa4c load:0x40050000,len:0x2d60 entry 0x4004c1f8

#

which I'm pretty sure isn't what it should be outputting

jaunty juniper
#

here's what I get on the debug output on the FeatherS2, followed by a few more lines in green as ESP-IDF boots I assume

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3ffe6100,len:0x1368
load:0x4004c000,len:0xa4c
load:0x40050000,len:0x2d60
entry 0x4004c1f8
#

~~that's what comes after:

I (79) spi_flash: detected chip: winbond
                                        I (79) spi_flash: flash io: qio
                                                                       I (80) cpu_start: Starting scheduler on PRO CPU.
                                       I (82) gpio: GPIO[21]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
```~~
[wait no, I had not erased first, the green lines come from tinyuf2]
rough folio
#

it looks like it's just bootlooping I think

#

because it's just dumping that text above in a loop

jaunty juniper
#

ah

rough folio
#

RTC_SW_CPU_RST
hm

#

maybe it thinks the RST pin is held down?

#

or something?

#

that should just be... directly wired though right?

#

and even then...

jaunty juniper
#

or is that a watchdog ?

#

have you run erase_flash first ?

rough folio
#

yeah

#

I'll do it again I guess

jaunty juniper
#

I hadn't 😄 😇

rough folio
#

ok yeah so it's definitely bootlooping

#

observationally the feather appears to just interrupt the power for reset if I read the schematic right which I'm probably not?

#

I think I'm probably onto something now because flashing the espressif_saola_1_wroom board boots to SP-ROM:esp32s2-rc4-20191025 Build:Oct 25 2019 rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT) SPIWP:0xee mode:DIO, clock div:2 load:0x3ffe6100,len:0x1368 load:0x4004c000,len:0xa4c load:0x40050000,len:0x2d60 entry 0x4004c1f8

#

and doesn't bootloop

#

it doesn't give a console or anything like I think it's supposed to but

jaunty juniper
#

it is my understanding that the reset pin on the ESP is actually the enable pin

#

so there is no hardware "reset", only power on

rough folio
#

makes sense

#

but with the saola board firmware we're finally somewhere

#

whoops I already posted that

jaunty juniper
#

which I believe is the reasons it needs an external circuit to allow double-click reset to be detected (as the memory is wiped on poweron)

rough folio
#

interesting

#

so should I expect a cirpy console on uart or do I need to get the native usb pins out (which luckily is just a trace cut+jumper to solder)

jaunty juniper
#

you would need the USB, unless setup for repl on debug uart

rough folio
#

gotya
what does one need to do to setup repl on debug uart

jaunty juniper
#

lemme check

#

I believe you would need these in mpconfigboard.h:

#define DEBUG_UART_RX               (&pin_GPIO16)
#define DEBUG_UART_TX               (&pin_GPIO5)
#

with the right pins

rough folio
#

👍 thanks

jaunty juniper
#

or maybe that's just the debug output ?

rough folio
#

unthank

jaunty juniper
#

😄

#

ah the C3 builds use CIRCUITPY_DEBUG_UART_RX/TX

rough folio
#

is that just a pin definition as above or

jaunty juniper
#

yes

rough folio
#

rethank

#

alright well that was a fun little adventure but it looks like I'm pretty much set

manic glacierBOT
#

@dhalbert As @anecdata @jepler mention, I think the hang/freeze is coming from MatrixPortal library.

This import from my code above seems to be the only common thread from prior discussion here and similar symptom of hanging.
from adafruit_matrixportal.matrix import Matrix

I don't know if the repeating post/get requests that are happening in main loop on code.py are coincidental or not.

tulip sleet
#

@slender iron the fragmentation problem looks like it's straightforward. The usual automatic gc_collect() after an import was removed in the v1.18 merge, so restoring that should fix things. py/builtinimport.c was very much reworked in v1.18

onyx hinge
#

oops! that'd be my fault almost certainly. 😕

#

thanks for tracking it down, Dan!

tulip sleet
#

np, bugs are to fix

warm flame
#

Should I program all the Lilygo boards ?

onyx hinge
#

just dropping by 👋

warm flame
#

yes no no yes yes yes no no yes no ?

slender iron
#

Nice find @tulip sleet ! Interesting it makes that much impact

onyx hinge
#

@warm flame we're happy to support more boards (we treat it as a metric or at least a cause for celebration, since we just passed 300), so if you have the boards for testing why not!

warm flame
onyx hinge
#

It's probably wise to only add support for a board you have in hand

jaunty juniper
#

note that we don't do suffix-less ESP32 (yet) which I think is most of their boards

manic glacierBOT
#

It would be nice to have support for copy.deepcopy (or some alternative) on circuitpython. I'm relatively new to circuitpython myself so maybe there is already a simple way to include the copy module when compiling circuitpython and I don't know about it. A cursory look shows the copy module relies on the types module which is also not included.

manic glacierBOT
#
  • Fixes #6402.

  • The automatic garbage collection done after an import got lost in the MicroPython v1.18 merge, which rewrote the import code extensively. Restore it. This reduces heap fragmentation, which can make prevent allocating big buffers after significant imports.

  • Improved error message for RGBMatrix being unable to allocate buffers. Previously, it just threw a blank MemoryError.

rough folio
#

@jaunty juniper I'm back poking at this situation- do you know what common_hal_never_reset_pin is about? I've found it adds pins to a mapping used somewhere, but I've really got no idea what this accomplishes

#

it's one of the handful of differences between the adafruit feather def and the espressif devkit

#

the only real others are the pins.c and reset_board turns on i2c power
actually
what calls reset_board, board_deinit etc?

slender iron
rough folio
#

hm ok

manic glacierBOT
#

Unfortunately I don't know the size of the buffer Protomatter was trying to allocate, so I don't have a size argument to pass. It only passes back an error code.

I see a bunch of opportunities to consolidate errror messages and reduce the number of separate messages to translate (#6392). So I'm hoping to reduce the number of messages post 7.3.0. That was the idea of making this a %q message. For example:

~/repos/circuitpython/locale$ ag "allocate" circuitpython.pot 
513:msgid "Att...
manic glacierBOT
#
[adafruit/circuitpython] New tag created: 7\.3\.0\-rc\.1
orchid basinBOT
idle owl
#

@stuck elbow or @jaunty juniper if you're up for providing feedback and able to view the link above (I don't know how public the previews are), I would also appreciate it.

tulip sleet
idle owl
#

@tulip sleet If you end up wanting to make edits, let me know so I can back out of any editing I'm doing.

#

Oh I need to mention somewhere that the Project Bundle will download frozen modules, but it's ok, they don't run, they simply take up disk space. And how to delete them if you run out of disk space.

#

I feel like the Project Bundler should be mentioned on the existing Libraries page, and then linked into the Frozen Modules section with the info about how they work together in the File Types guide page. We don't mention it anywhere in this guide, afaik.

jaunty juniper
#

what do you want to say about it ?

#

the "download bundle" buttons and how the code is organized inside the zip would be useful maybe

idle owl
#

That it exists, how to use it, and why it makes things easier. I don't think all that needs to be on the File Types page. Put that on the CircuitPython Libraries page, and then link that section in the File Types page when I explain the situation with frozen modules and the bundler.

tulip sleet
#

@idle owl

  1. do you want to say how using mpy-cross makes it possible to import some libraries that couldn't even be imported in .py form on small boards, because they take too much RAM to compile on the board?
  2. "there is nowhere to download frozen libraries, because they are built into CircuitPython" -> ... because a frozen library is built in to in the CircuitPython build for particular boards [or equiv]. Just to emphasize they are not built in to CPy in general.
  3. "If there are not frozen modules" -> "If there are no frozen modules"
  4. bold CIRCUITPY/ on second mention
  5. "memory" usually means RAM. Sometimes people are confused and think that because there's still room on CIRCUITPY, they should be able to import. Maybe define "memory", or use RAM (and explain the difference?)
  6. Title of page could be "Library File Types and Frozen Libraries", since that's a major part of the page.
idle owl
tulip sleet
#

I really like this page; it is a really thorough and readable explanation of something we have to explain constantly

idle owl
#

That's what I was going for 🙂

rough folio
#

the mpy files seem pretty surface level similar to the cpy cache files

#

if I read it right

idle owl
#

@tulip sleet Re: RAM vs memory. Hmm. Maybe include a note at the beginning that for the purposes... wait no. Because I'm about to add something about disk space. Which means the entire page cannot be said to be using "memory" and "RAM" interchangeably. Ok, I'll update it to RAM.

tulip sleet
idle owl
#

Only 44 instances of memory to update. 😖

tulip sleet
#

so maybe have to define RAM vs diskspace

#

no global search/replace in guide pages, right?

idle owl
#

Correct, I have to do it manually. Search in page, and change them up.

rough folio
#

is the largest distinction that an mpy can have C code embedded?

jaunty juniper
#

have we enabled that in CP ? I don't think anyone has tried

rough folio
#

I was just looking over the micropy docs and it mentioned that

tulip sleet
rough folio
#

yeah I assumed the bytecode was different was just curious if that was kind of the end of it or if there was something more

tulip sleet
#

upcoming version of MicroPython will allow executing bytecodes directly from .mpy files, so they don't have to be loaded into RAM, but they have to be contiguous in the filesystem, which we can't guarantee with the FAT filesystem

rough folio
#

that's a pretty tidy improvement though

#

I've been playing around with nuitka at work and started wondering about it and hardware
probably generates too much boilerplate to work

idle owl
#

Ok, yeah, I definitely need to explain the difference because I can't change "Memory Allocation" to "RAM Allocation" because the actual error is "memory allocation failed". I'll ping you in a minute here, Dan, for feedback on this. It feels a bit stilted.

idle owl
#

CircuitPython is unaware of disk space, right? Like it won't error when you're out of it. Only your computer will? Or editor will fail to save or whatever..?

manic glacierBOT
tulip sleet
idle owl
#

Ok thank you

tulip sleet
idle owl
#

CircuitPython will? In the serial console or something?

#

I've only ever seen popups on my machine.

tulip sleet
#

The host notices if the disk is file if the host is writing to CIRCUITPY. But CIRCUITPY will throw an OSError with the ENOSPC code ("no space left on device") if you try to write to a full disk from Python

idle owl
#

Ah ok. Huh.

tulip sleet
#

so that only happens if you mount CIRCUITPY r/w, etc.

idle owl
#

Ahh ok.

#

That makes more sense.

tulip sleet
#

There is one section that references CIRCUITPY filesystem space, which can also be considered memory. Filesystem space is not RAM; it is where files are stored

idle owl
#

That is better.

tulip sleet
#

You could use "RAM memory" once here to make it clearer: The result is a file that is smaller and uses less RAM memory.

idle owl
#

Yeah ok. That seems like a solid idea.

tulip sleet
#

"This page refers regularly to library file memory usage, as well as to RAM usage."

#

these are the same thing, 'This page talks about library file memory (RAM) usage". "as well as" kinda makes one think they might be idfferent things

idle owl
#

Exactly. It made way less sense as an intro to this section once it was shortened.

#

Fixed. Thank you!

#

I think I'm going to do some future proofing and refer to the 7.3.0 version of mpy-cross. Even though we're not stable yet.

slender iron
#

do you want to talk about volatile vs non-volatile

#

aka, whether you lose data on power loss

idle owl
#

I don't think so. This is more about libraries, the explanation of RAM is simply because I used "memory" and "RAM" interchangeably on the page.

slender iron
#

kk

manic glacierBOT
#

Tested with .env:

key=value
  key2 = value2
'key3' = 'value with spaces  '
# comment
key4 = value3 # comment 2
'key5'=value4
key=value5 # overrides the first one
key 6 = value 6 # won't be found
key7 = value unquoted # will go to end?
multiline = 'hello
world
how are you?'
key8 = ' escaped \\ \' '

And code.py:

import time

# time.sleep(10)

import dotenv

keys = ["wifi_ssid", "wifi_password", "foo", "key", "key1", "key2", "key3", "key4", "key5",...
slender iron
#

if user code does wifi.connect() should stopping the VM also stop wifi?

#

Or we can leave it connected and only reconnect if connect() is given a different ssid

#

@jaunty juniper thoughts on wifi connection lifetime?

#

I'm thinking I'll track if a socket is opened by the VM and close those that were

idle owl
#

Time for dins here. Be around later!

manic glacierBOT
rough folio
#

how should I reference pin TXD0 (pin 37) in pins.c?

#

I also see { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, for a number of boards- how does this pull pins?

jaunty juniper
#

that would be IO43 ?

jaunty juniper
rough folio
jaunty juniper
#

which should be the same as SDA and SCL

rough folio
#

oh, DEFAULT_I2C_BUS_SDA/SCL

#

got it

jaunty juniper
rough folio
#

you'd think so wouldn't you

jaunty juniper
rough folio
#

yeah but this doesn't strictly list IO43 which is what I was getting caught on

jaunty juniper
#

it does

rough folio
#

once you've said it, straightforward

#

does it

#

oh bugger

#

sigh Ok thanks

orchid basinBOT
manic glacierBOT
#

Thanks for the update on the USB PID.

Two comments about your custom library:

  1. The usual way to do this is to keep the library in a separate repo, and add it as a submodule. This will allow you to maintain the library separately, and not depend on the circuitpython repo for source control. Also it reduces the size of circuitpython and minimizes the custom code in it.

  2. Consider whether you need to freeze the library. The reason we freeze libraries into certain firmware images ...

manic glacierBOT
tidal kiln
#

@tulip sleet is that weird ESP32S2 TFT feather issue CP only? boards that have that behavior work fine with factory reset UF2?

tulip sleet
#

I don't remember!

#

I think it's in the threads

tidal kiln
#
TFT is working when "double click" switch to get loader
and after a ROM reload. Once any CircuitPython other
than 7,1.1 is loaded, the TFT is off by default. 
#

seems CP only

tulip sleet
#

it should be fixed now

tidal kiln
#

sounds like even the bootloader screen works in those situations

#

forgot the bootloader did that

tulip sleet
#

It sounds like it might have been fixed in 7.3.x but not in 7.2.x, so have them try the 7.3.0-rc.1

tidal kiln
#

but if bootloader is dark also, that'd be something else?

tulip sleet
#

they didn't say they double-clicked. They could try the factory reset. I'd start with that and see if it doesn't show.

tidal kiln
#

it didn't

tulip sleet
#

wait I don't remember that the ESP32-S2 TFT has a boot screen

tidal kiln
#

yah. it shows UF2 splash (not sure what else to call it) when in bootloader mode.

tulip sleet
#

that's the UF2 bootloader, but not the raw bootloader. If they loaded with the raw bootloader, it wouldn't show

#

I would have them erase the whole thing and reinstall the factory reset with UF2 bootloader. Also, the double-click is a bit tricky, have to wait for purple

tidal kiln
#

the factory reset is a UF2 (well one of them), they say they tried that. that would have required getting into UF2 bootloader mode.

tulip sleet
#

the original load is loading a .bin

#

ok, I see, two boards, one doesn't work, yes fishy

tidal kiln
#

it is a bit unclear what they actually did

tulip sleet
#

yes, I would pursue having them do exactly the same thing on both boards

#

I have had to full-erase at least one Feather ESP32-S2 to get it to work right

tidal kiln
#

@jaunty juniper just fyi. see above. relates to a forum thread.

manic glacierBOT
#

Addresses #6392.

To reduce firmware size, this PR uses argument validators where possible and consolidates and simplifies various error messages.

  • I went through all the mp_raise calls, and used validators from argcheck.c to simplify the validation. A few new validators were added, building on #4891.
  • Added mp_arg_error_invalid(qstr), which raises ValueError with the message "Invalid %q". This is useful many places, where there were previously more specialized but not neces...
jaunty juniper
#

oh hey another library that crashes because of typing annotations !

idle owl
#

Uff.

stuck elbow
#

They have played us for absolute fools, Python was never supposed to have strict typing.

jaunty juniper
#

put me on record as being against breaking libraries, bloating code, ram and the core to jump through hoops to add typing to python of all languages.

stuck elbow
#

amen

jaunty juniper
#

opened an issue in adafruit_rfm9x

stuck elbow
#

unit tests, on the other hand...

#

you can add the type annotations in a separate file, then it doesn't add any bloat or break anything

#

I think that would make a lot of sense in CP

proven garnet
#

I also submitted issues for the other libraries with the same issue, less than a handful.

#

Using stubs would be cool, I never really thought about the effect on RAM until it came up in this week's meeting

proven garnet
manic glacierBOT
#

CircuitPython version

CircuitPython 6.0.0 beta 1 and later

Code/REPL

import board
from adafruit_ht16k33.segments import BigSeg7x4

i2c = board.I2C()
display = BigSeg7x4(i2c)
display.brightness = 0.5
display.print("ABCD")

Behavior

Can't find the device when the I2C voltage is 3.3 and running CircuitPython 6.0.0 Beta 1 or later.

Description

I have kind of a weird issue here. This is a follow up for guide feedback. The guide for https://...

proven garnet
#

Never mind, @lone axle is faster than me sonic Thanks!

lone axle
manic glacierBOT
slender iron
#

@tulip sleet my pr ran out of flash so I was looking into graphing section sizes

tulip sleet
slender iron
#

Graph as in dependencies

tulip sleet
#

are you trying to get it to run on M0?

manic glacierBOT
#

I'm using the artifact from a7afd66 (adafruit-circuitpython-lilygo_t_display_rp2040-en_US-20220320-1472b86.uf2). One of my boards seems to work, the other seems to have an issue with the display. It's wired as the demo (https://github.com/Xinyuan-LilyGO/LILYGO-T-display-RP2040/blob/main/firmware/firmware.uf2) runs fine.

Is there anyway to get this build artifact without setting up a ...

slender iron
#

C3 space worries me

tulip sleet
#

how much RAM on C3?

slender iron
#

Don’t remember, on my phone

tulip sleet
#

ah, np, I thought you had sat down to work

#

400kB of SRAM

slender iron
#

Np

manic glacierBOT
jaunty juniper
manic glacierBOT
manic glacierBOT
#

Note also the pre-commit failures here: https://github.com/adafruit/circuitpython/runs/6398538029?check_suite_focus=true. For some files, there is simply extraneous whitespace or a missing newline at the end of the file. For the Python files, they may be failing black or pylint in some way. If you move to your own repo and a submodule, they will not be checked (you could of course check them yourself).

Sorry, I will pay attention to this detail later. Thank you for your answers and help

manic glacierBOT
#

I wonder if there may be a few new questions where it does not say why a pin is invalid (e.g. not a DAC pin) and now just says invalid. But probably worth the space savings.

If you look at the backtrace and the line in question, I think it will be clear it's invalid because of the context. There were already cases where the messages just said "Invalid pin" without further explanation; this just takes advantage of regularizing that.

manic glacierBOT
manic glacierBOT
manic glacierBOT
onyx hinge
#

Wow danh

proven garnet
#

🤯 look at all that room!

#

@idle owl I had forgotten my personal laptop that I do dev stuff on at the office, so I just got it back. I'll get it set up for Adabot and try to submit at least one patch for review this weekend. I'll scream let you know if I have trouble getting it set up!

#

Also, I think I found the way to crunch multiple commits into a single patch; might try to test it with this patch if it makes sense!

warm flame
#

I just installed the build for the Lilygo T-OI plus... looks like it is not operational

#

I f-ed up somewhere

#

Can someone helps me compile the build on Debian ?

stuck elbow
#

you are following the instructions?

warm flame
#

What compiler should I use

stuck elbow
#

it says in the instructions

tulip sleet
#

it's described in the Building CircuitPython guide

warm flame
#

thanks

warm flame
#

I messed up the board.c I think

#

oh dear. I'll have to test stuff all over the weekend

#

lol

#

installing all tools to be able to build circuitpython for that specific board is long

jaunty juniper
#

the ESP IDF environment is quite something

warm flame
#

and I should have installed it in circuitpython directory but didn't

#

so I end up with 2 copies of it

idle owl
warm flame
#

my make BOARD=lilygo_ttgo_t-oi_plus returns me : find: ‘../../extmod/ulab/code’: No such file or directory
make: *** No rule to make target 'lib/protomatter/src/core.c', needed by 'build-lilygo_ttgo_t-oi_plus/genhdr/qstr.split'. Stop.

jaunty juniper
#

did you run make fetch-submodules ?

warm flame
#

nope

#

will try

#

doesn't work

#

will be back later tonight

#

have fun

manic glacierBOT
manic glacierBOT
misty garnet
#

any advice on how robust the rs485_dir timing is on the RP2040? are we better off doing our own software implementation where we can tweak the timing? Is it more or less robust at higher baudrates?

slender iron
#

it looks like it is bitbanged at the C level

misty garnet
lone axle
#

Is there a known issue around make fetch-submodules and the pico SDK?

From https://github.com/raspberrypi/pico-sdk
 * branch            2062372d203b372849d573f252cf7c6dc2800c0a -> FETCH_HEAD
 ! [rejected]        1.3.0      -> 1.3.0  (would clobber existing tag)
fatal: run_command returned non-zero status for ports/raspberrypi/sdk
.
make: *** [Makefile:332: fetch-submodules] Error 128
slender iron
#

no, I haven't seen that

#

seems like that means they changed the 1.3 tag

#

(which is bad form imo)

#

1.3.1 is free

manic glacierBOT
tulip sleet
#

there is a 1.3.1 now

tulip sleet
#

is that entire diagram encoded in the URL? 🙂

manic glacierBOT
lone axle
#

How does the 'Download Project Bundle' button on learn guides "choose" which files to include in the bundle download? I found an instance on this page: https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/play-file where the examples make use of some .wav files but the bundles come with .mp3 files instead of the .wav ones. I clicked through the github link and can see that the library repo this is embedded from includes both mp3 and wav files. But somehow the bundle button is omitting the .wav and including the mp3 even though this particular example is using the wav.

#

I also notice github seems to be changing the name of raw file downloads. when I click these buttons:

I end up with files named examples_dip.wav and examples_rise.wav instead of just dip.wav and rise.wav as is used in the code.

#

Even downloading from the github page directly with this button results in the file named examples_dip.wav

#

I assume maybe github changed this behavior at some point? I'm not sure why they wouldn't serve it using the original filename which they definitely know.

tulip sleet
#

I would think is Learn Guide behavior,

lone axle
#

I guessed that as well, but it appears to be behavior straight from github.

tulip sleet
#

that is totally weird, this seems like a misfeature

lone axle
#

totally agree, cannot fathom why they would think people want the filename to be altered.

#

maybe it's accidental and there is some bug with a slash somewhere in their system.

tulip sleet
#

hmm, that is a human-readable file, but the .wav files are not...

lone axle
#

interesting, or maybe examples/ is a special case directory?

tulip sleet
#

sorry, tried wrong link

lone axle
#

Strange, that would be even weirder for a browser to decide to change it's name. I get the same results in both Chrome and FF here.

tulip sleet
#

i was using the blob instead of the raw link

#
$ curl -I https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/raw/main/examples/dip.wav
HTTP/2 302 
...
location: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/main/examples/dip.wav
...
$ curl -I https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/main/examples/dip.wav
HTTP/2 200 
cache-control: max-age=300
content-disposition: attachment; filename=examples/dip.wav

Note the filename=examples/dip.wav. The browser can't do that so it substitutes _ for /

manic glacierBOT
#

I tested this successfully with a custom build using the branch from https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/pull/117 on a CPX. I ran many of the examples from this guide: https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/circuit-playground-express-library and found them working as expected.

On the CPX builds using current repo the remaining free space for an English language build was:

251864 bytes used, 1576 bytes free in ...
manic glacierBOT
#

In 8.0.0, we are gaining space initially, on a number of small builds. How do we spend it? I was originally going to put back onewireio, but I'm thinking that making f-strings uniformly is quite advantageous, because it simplifies writing many examples and libraries.

We could do that in 8.0.0, but would it be possible in 7.3.0? This PR, starting as draft, tests which builds will fail. In 8.0.0, f-strings takes only 440 bytes more in a Trinket M0 build.

manic glacierBOT
tulip sleet
#

@slender iron turning on f-strings everywhere in 7.3.0 looks like it is going to work with just one board shrink; I am a little psyched about that; it will remove consideration of whether one has to use format() or not in library and example code. Made it ready to review. Going for a walk.

slender iron
#

that's something worth having everywhere

jaunty juniper
#

speaking of f-strings, I completely missed we had that:

Adafruit CircuitPython 7.2.4 on 2022-03-31; Adafruit CLUE nRF52840 Express with nRF52840
>>> value = 1
>>> padding = 5
>>> f"{value:0{padding}d}"
'00001'
manic glacierBOT
#

I believe the difference in space that you find might be in part due to the fact that the Circuitpython PR has not been rebased on latest. And neither has the library PR. Here is what I get when I make sure to pick the right ones:

247828 bytes used, 5612 bytes free in flash firmware space out of 253440 bytes (247.5kB).
246772 bytes used, 6668 bytes free in flash firmware space out of 253440 bytes (247.5kB).

That's 1056 bytes saved. The latest bundle's bluefruit.mpy is 1222 byte...

manic glacierBOT
#

Observing UART problems also with a FeatherS3.
If connecting RX to TX and sending bytes to the UART data is coming with an offset.
As if the queue is not working correctly. Initially, after a reset, the send characters are received 2 or three characters "later"
With every reload of the code this gap increases.
Also, additional UART's created on other Pins than TX and RX are instantiated with no problems but do not work at all.

#

This is fixed in latest, thanks to Micropython 1.18

lexer: support nested [] and {} characters within f-string params

Adafruit CircuitPython 7.3.0-rc.1 on 2022-05-18; Adafruit CLUE nRF52840 Express with nRF52840
>>> 
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== arr = [1, 2, 3]
=== print(arr)  # [1, 2, 3]
=== print(arr[1:])  # [2, 3]
=== print(f"asdf{arr}")  # asdf[1, 2, 3]
=== print(f"asdf{arr[1:]}")  #...
onyx hinge
lone axle
#

is mpy version different for 8? Will we need some update inside of circup? I'm noticing I can't install libraries with it on a build started from current main:

❯ circup install adafruit_display_text
Found device at /media/timc/CIRCUITPY, running CircuitPython 8.0.0-alpha.0-dirty.
Searching for dependencies for: ['adafruit_display_text']
Ready to install: ['adafruit_bitmap_font', 'adafruit_display_text']

Traceback (most recent call last):
  File "/home/timc/.local/bin/circup", line 8, in <module>
    sys.exit(main())
  File "/home/timc/.local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/timc/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/timc/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/timc/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/timc/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/timc/.local/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/timc/.local/lib/python3.8/site-packages/circup/__init__.py", line 1316, in install
    install_module(
  File "/home/timc/.local/lib/python3.8/site-packages/circup/__init__.py", line 1016, in install_module
    bundle_path = os.path.join(bundle.lib_dir(bundle_platform), module_name)
  File "/home/timc/.local/lib/python3.8/site-packages/circup/__init__.py", line 123, in lib_dir
    self.basename.format(platform=PLATFORMS[platform], tag=tag),
KeyError: '8mpy'

tulip sleet
#

8 may be superseded by 9 relatively quickly. We thought 1.19 was quite imminent, but it is a big change, and there are still some PR's in progress in MicroPython. And 1.19 will be a big change for MicroPython, so we might wait a bit for it to shake out.

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 7\.3\.0\-rc\.2
jaunty juniper
#

so we won't need to make CP8 versions of the bundles since the mpy format doesn't change (and we don't do versioning based on code compatibility). It is a potential support issue, what with the bundle having "7.x" in the name. We could change the name but that means changing conventions and therefore tools at many levels.

#

(meanwhile circup can just be told to treat 8 as 7)

tulip sleet
#

I think we will anyway, we usually do, even if they are the same, so it's not a question. We'll have both 7.x and 8.x bundles, same as what we did for 6.x and 7.x

#

we haven't published the 8.x.x release yet; the alpha.0 tag is just a stake in the sand

#

we won't publish an 8.x.x release until 7.3.0 final.

jaunty juniper
#

ok so, when that happens, the bundles add the 8.x and we can just add it to circup

tulip sleet
#

also RTD has to be updated

manic glacierBOT
#

decreasing the frequency of the PWM that drives the display brightness.

Resolves: #6236

I tested successfully on PyPortal Tiano, PyPortal (Standard), and Feather ESP32-S2 TFT.

With this change brightness of all levels 0.1 - 1.0 seems to work well on all 3 of those devices. (values below 0.4 don't work on the Titano under current main).

There is a small amount of extra noise generated by this change that is audible coming from the speaker while it's enabled. But it's quite fai...

orchid basinBOT
manic glacierBOT
#

Driver support for the Electret Microphone Amplifier - MAX4466 with Adjustable Gain to work with circuit python.

Current setup is MAX4466 ---> adafruit voice bonnet --> raspberrypi W via the JST and pin connectors and would love to access the circuit python audio libraries with this microphone hardware.

tulip sleet
#

same as rc.1, except f-strings enabled in all builds (so now in small M0 builds, for instance)

tulip sleet
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Here's a summary of board test results comparing the existing main distribution of CircuitPython with the newly modified test version. I performed two audio noise tests, one using a spectrum analyzer to characterize the overall noise and to measure the contribution of the PWM signal. The other test was more subjective and was conducted by holding the speaker very close to the ear. Ear buds were used in addition to the speaker when testing the PyGamer.

<img width="812" alt="Screen Shot 2022...

manic glacierBOT
manic glacierBOT
#

However, if the Titano displayio brightness PWM frequency setting could be built independently of the other boards, then only the Titano would exhibit the slight increase in audio noise.

We could certainly customize per board by adding a setting value. I'm not sure I understand which values you recommend for which boards.

Only the frequency of the PWM pin that drives the backlight controller needs to be set differently for the Titano build.

#

@CedarGroveStudios Thanks!

@FoamyGuy We could add yet another argument to the Display constructor. I don't think this should be compile-time only for the TItano, because someone could use a similar display as a non-builtin display, and would want the PWM frequency option.

The shared-module constructor argument list is getting kind of ridiculously long. Perhaps we should make a struct definition, with reasonable defaults, and pass the struct. This is a breaking change, but would result...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

OK thank you for taking a look.
transit_board_20220521.zip

This is a .zip of my project. It has a secrets.py that needs wifi and aio values.

I successfully ran this on my MatrixPortal M4 for 24 hours when I don't use my display module and only call requests. So I suspect the requests are not the primary cause, and it could be a joint or separate issue with the display libraries.

In a nutshell my ...

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

I like the idea of it being a constructor argument so that it can be set as needed for each device / display. Refactoring the constructor to taking a DisplayConfiguration or DisplayOptions or something like that with all of the values contained in an object instead of the long list of arguments directly does seem like an improvement to me, but would require a fairly large amount of changes if I understand correctly. All display driver libraries and all built-in display initializations for...

manic glacierBOT
manic glacierBOT
fathom sand
#

Hi, is there anyone having success to talk to a DFR0627 board using CircuitPython?
I can see the board showing up in a i2c.scan()
I also can write to and read from the board.
But “nothing” seems to work.
Even writing a value to a register and reading the register back always only gives 0 as the value read.
Any hints are very welcomed!
https://wiki.dfrobot.com/Gravity%3A IIC to Dual UART Module SKU%3A DFR0627

#

I am experiancing problems while using busio.UART on a Feather ESP32-S3 No PSRAM (and other ESP32-S3 boards)

Assuming TX and RX are connected!

''''
import sys
import time
import board
import busio
import supervisor

uart = busio.UART(board.TX, board.RX, timeout=0.01)
again = 0
count = 0
while True:
if supervisor.runtime.serial_bytes_available:
k = sys.stdin.read(1)
if ord(k) == 27:
break
again += 1
if again > 100:
count += 1
s = f"hello uart! {count}".encode()
uart.write(s)
print("sending:", s)
again = 0
if False:
r = uart.read(uart.in_waiting)
time.sleep(0.01)
else:
r = uart.read()
if r:
print("receiving:", r)
print("done")

''''

The code above "behaves" very different if used on a M4 board compared to a ESP32-S3 board using the same CP version.
(Tested today with CircuitPython 7.3.0-rc.2 on a ItsyBitsy M4 vs. a Feather ESP32-S3 No PSRAM)
And chainging "if False:" to "If True:" does not change the results.

It even seems that the "offset" of the buffer / queue in the ESP32-S3 is increasing with every restart of the code.py app.

tulip sleet
#

@fathom sand please add to that issue we discussed, or maybe open a new issue -- I don't remember whether it was an aside in the original issue or not.

tulip sleet
jaunty juniper
#

so, int.from_bytes is weirdly defined as taking 2-3 arguments, but ignores the 3rd argument, and C python does not take a 3rd argument, so I'm tempted to do that (or use MP_DEFINE_CONST_FUN_OBJ_3 if I get that correctly), or am I missing something ?

- STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 3, 4, int_from_bytes);
+ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 3, 3, int_from_bytes);
jaunty juniper
#

it's keyword only though ?

jaunty juniper
#

so, it should error on int.from_bytes(bytes([0x10,0x00]),"big",444444)

tulip sleet
#

it should; there is minimal validation on some of these keyword-only functions, inherited from micropython

jaunty juniper
#

and it doesn't take keyword arguments (in CP)

tulip sleet
#

so yes, maybe the right thing is to not permit the third arg, which is not implemented and cannot be a keyword

#

I ran into this in some other case; I'll look for it

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.3.0-rc.2 on 2022-05-21; Raspberry Pi Pico with rp2040

Code/REPL

b = (0xFEED).to_bytes(2,"little")
# next line is not correct code
x = int.from_bytes(b, 2, "little")
print(x==0xFEED)

Behavior

C Python raises a TypeError if too many arguments:

int.from_bytes(bytes([0xFE,0xED]), 2, "big")
Traceback (most recent call last):
File "", line 1, in
TypeError: from_bytes() takes exactly 2 posit...

manic glacierBOT
fathom sand
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@dahanzimin if you want to fix it in your own PR, that is fine. Then I can approve your PR (I cannot approve my own). Right now our build is broken, so that's why I went ahead and made a PR.

Please add another level of directory,FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_circuitpython_lib/mixgoce_lib.because dahanzimin/circuitpython_lib is still adding other board libraries

Are these libraries for other boards? Would you consider br...

proven garnet
#

@idle owl, got patches for the .pylintrc files, I can PR those to adabot repo tonight. I should also draft PR those changes to the BNO055 repo right? Anything else I need to do?

proven garnet
#

@tulip sleet trying to understand from last meeting, if CircuitPython had a typing module with an attribute TYPE_CHECKING that was always false, would it be able to be optimized? And if so, would that be for the core or mpy?

#

Or is that not correct?

tulip sleet
#

but I don't think we necessarily want to make typing a required library everywhere. What problem are we trying to solve?

#

Maybe we could make it an almost no-op builtin

proven garnet
#

More of just wondering if moving away from using the try/except block to something that could be optimized

tulip sleet
#

The try/except block is cheap, but it does add a little extra code in the .mpy

proven garnet
tulip sleet
#

we could make a typing that just had the TYPE_CHECKING = false in it, but you still need to avoid from typing import TYPE_CHECKING, Optional etc.
What is an example of using it vs not, and are there CPython precedents

manic glacierBOT
proven garnet
#

Plus the annotations do actually need to be imported

onyx hinge
onyx hinge
onyx hinge
tulip sleet
#

no, you presented that 🙂

#

maybe I said something that inspired you

#

I think I didn't say const, but proposed defining it. You came up with the const() int idea

onyx hinge
#

Hmmm we could add a bit of code to make it as though every file had TYPE_CHECKING = const(0) though. Too bad if someone wants to use that identifier for anything else, ever

tulip sleet
#

also typing.TYPE_CHECKING wouldn't work

#

or do you mean inside a mini typing?

onyx hinge
#

importing a const doesn't make it a const in the module where that imported into. It'd be in the compiler, at the beginning of every module, the constant table is populated with an entry for TYPE_CHECKING with a value of 0.

manic glacierBOT
onyx hinge
#
==> typing.py <==
TYPE_CHECKING = 7

==> typetrick.py <==
TYPE_CHECKING = const(0) # If this line was implicitly at the top of every module...
from typing import TYPE_CHECKING # and we had a mini-typing module...
import typing
print(TYPE_CHECKING, typing.TYPE_CHECKING)
0 7

This doesn't show that the unused code optimization takes place for sure, but I think it's a good sign.

tulip sleet
#

i will be afk for a while

manic glacierBOT
manic glacierBOT
idle owl
#

<@&356864093652516868> The Weekly Community meeting is in < 40 minutes. Everyone is welcome! If you plan to participate, please leave your hug reports and status update in the notes document. Hope to see you all there! https://docs.google.com/document/d/1koPkyRaRg548N7dqxa-ymx8nybmd6kUSXxO-g8ZQDaw/edit?usp=sharing

manic glacierBOT
#

Note: I am still playing with this. I am deducing maybe from some of the information in the PJRC forum thread I mentioned above that maybe some of the header details may be causing it.

I have changed so far that the boot data was different than a normal teensy Arduino build: In particular the size field was 8MB (T4.1) where on Arduino builds it is the size of data written to flash... So I have that one updated...

But now wondering about differences in the first block the flash config...

idle owl
#

We're finishing up an internal meeting. We'll be there as soon as we're done.

#

@inland tusk Can you mute please?

thorny jay
#

@proven garnet without spoiling what you are going to say, I am super interested in your "image transfer setup for the BluefruitConnect library". I think there was only Arduino implementation available so far. I have a direct use for this (if I find some dithering code).

manic glacierBOT
lone axle
#

I think Jeff may have added some dithering functionality to bitmaptools somewhat recently.

slender iron
#

I muted @inland tusk for now

gilded cradle
#

@idle owl you muted him for you, but @slender iron muted him for everyone

thorny jay
manic glacierBOT
#
[adafruit/circuitpython] New tag created: 7\.3\.0
lone axle
#
Adafruit Industries - Makers, hackers, artists, designers and engineers!

On the next episode of  Tom’s Hardware The Pi Cast, the team is joined by Anne Barela, an engineer with Adafruit working on CircuitPython and the Python on Microcontrollers Newsletter. They w…

turbid radish
#

😊

lone axle
turbid radish
#

Thank you very much Jerry!

#

Great work on that @idle owl

thorny jay
lone axle
slender iron
#

does anyone remember the visualizer of people working on an open source code base?

#

its an animation

turbid radish
#

Yes, just a sec Scott

thorny jay
#

Should it be circup detecting frozen module and not installing the matching mpy?

turbid radish
slender iron
#

thank you!

turbid radish
#

Make the directory read only

proven garnet
#

I've definitely had issues with symbolic links in windows

turbid radish
#

There are shortcuts and symlinks, very different

#

in windows

idle owl
#

37:31 37:31 37:32 37:32 37:32

#

37:33 37:33 37:33 37:34

gilded cradle
#

hehe nice

proven garnet
inland tusk
#

Need to unlock my voice rights

proven garnet
#

I basically tried to get the library to work with the image transfer but still WIP

#

I can share my branch with you

thorny jay
#

I might have wrote an issue long time ago to say it was missing. 🙂

thorny jay
proven garnet
#

It so far looks like the app isn't sending it properly