#circuitpython-dev

1 messages ยท Page 415 of 1

onyx hinge
#

other than that it just installs a non-specific version of black, so you can skip that step once you follow CircuitPython instructions for uncrustify on mac

#

just activate that venv instead of doing the setup step then

idle owl
#

ok

onyx hinge
#

thanks for asking instead of blindly typing your password ๐Ÿ™‚

idle owl
#

Thank you for clarifying!

lone axle
#

Is there a quick way to check (or a cached place to look) for which languages on a given build result in the largest build size?

#

i.e. which language(s) are most important to test when looking at a PR in a library that is frozen in to some of the smaller builds.

onyx hinge
#

@lone axle sadly, no.

lone axle
#

Happy to have confirmation. I'll check a few 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 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/1fJ0odbK7m4jWHTnKL1medCeZAGBTZiNIW0np6nOd4hc/edit?usp=sharing

idle owl
#

Ooof. It reformatted SO many files. I had to git stash and drop after copying my changes out and paste them back in (because I don't know how to do things the right way). Mine was not reformatted though, so it must be correct.

onyx hinge
#

huhhhhh that's odd

#

I thought theirs was the same as ours ๐Ÿ˜• was it .c files or .py files?

idle owl
#

Py.

#

Started looking at git diff and it was going on forever, so I q'd out of it, and blew away the changes.

#

I guess that means it didn't touch my file. ๐Ÿ˜•

#

I can't get to the beginning of it, too much scrollback. But, it ended with the Black format message.

#

"Both C and Python code are auto-formatted using the tools/codeformat.py script."

#

I guess it did C first?

#

I can apparently pass arguments to only do the changed file, but there's no instructions on how to do that.

manic glacierBOT
main furnace
#

If I connect via the uart, can I use rshell with the broadcom port of CircuitPython?

crimson ferry
manic glacierBOT
#

I too would love to be able to disable the logo and the terminal output from my ssd1306. At the moment I'm having to use the adafruit_ssd1306 driver instead of the adafruit_displayio_ssd1306 because of the issue when my code that displays a splash in the boot.py and it finishes in the gap between code.py starting I see the logo and the words "code.py running" which is not what I want to see. Using the other driver it just seamlessly changes from one image to the next image that is ran from co...

idle owl
crimson ferry
#

I don't seem to have that one

idle owl
#

I'll transfer it then.

crimson ferry
#

thank you!

idle owl
manic glacierBOT
#

This is such a neat idea! Looking over the tasks you've outlined with an eye toward finding some part that I might be capable of helping with, I'm curious if the internal HTTP server that you mentioned is something that will get written with python code? or it's internal to the core and thus written in C?

Generally we need C code for things that run outside the VM. My plan was to look into the HTTP Server that the IDF has and probably use it. It might be pretty big though. We could proba...

crimson ferry
#

@idle owl follow-up Q: if a Learn Guide is broken due to a library issue, do we want to track the issue in both places? If the library fix is long-term, it may help the guide to switch to a more friendly data source (in the present example)

idle owl
crimson ferry
#

ok, I'll do that

manic glacierBOT
idle owl
#

Oof. I can't get this I2C power pin to turn off. I thought my initial more-complex code was wrong, but I'm trying the basic code, and setting it True or False has the same results - the STEMMA QT connector still has power, and data is being read from the sensor.

#

@tulip sleet Even with the pin being turned on by default in CircuitPython (presumably on startup), shouldn't I be able to control it in code.py? Or am I missing something obvious here.

tulip sleet
#

which board is this?

idle owl
#

Feather ESP32-S2, rev B.

#

(I assume it's rev B, there's no marking on the back, it's one of the original boards.)

tulip sleet
#

loooking...

idle owl
#

I'm running absolute latest CircuitPython to have Limor's fancy code to start up both rev B and C.

#

Point was to duplicate it in Python. Which I think I did. But it's not affecting the pin.

tulip sleet
#

i need to look at the rev B schematic; I have it in eagle

idle owl
#

Ok

#

When the duplicated fancy code didn't work, I went back to basics, and that isn't doing anything either.

manic glacierBOT
slender iron
#

@tulip sleet when do you want to chat?

tulip sleet
slender iron
#

I was planning on going for a run

#

free tomorrow between 11am and 4pm pacific

#

(or later after my run)

tulip sleet
#

i might be free by 5pm your time, but that's dinner. tomorrow afternoon my time is good; taking Jesse to a long appt in the morning, back around the time you'll be free. tomw is probably better

#

we can say 11am your time 2pm my time tomw

slender iron
#

๐Ÿ‘

tulip sleet
#

i'll put it in my calendar

slender iron
#

(other folks are welcome to join too. we'll meet here on discord)

#

idea is to go over stuff before I'm out

blissful pollen
slender iron
#

Thanks Mark! I don't think there is. Your reviewing helps a bunch though.

tulip sleet
#

@idle owl could you post your code? I will try barebones with current CPy and also maybe one before Limor's code fix

idle owl
#
import time
import board
import digitalio
import adafruit_mcp9808

# i2c_power = digitalio.DigitalInOut(board.I2C_POWER)
# i2c_power.switch_to_output()
# time.sleep(0.1)
# rest_level = i2c_power.value
# print(i2c_power.value)
# i2c_power.switch_to_output(value=(not rest_level))
# print(i2c_power.value)

i2c_power = digitalio.DigitalInOut(board.I2C_POWER)
i2c_power.switch_to_output()
i2c_power.value = True

mcp9808 = adafruit_mcp9808.MCP9808(board.STEMMA_I2C())

while True:
    temperature_celsius = mcp9808.temperature
    temperature_fahrenheit = temperature_celsius * 9 / 5 + 32
    print("Temperature: {:.2f} C {:.2f} F ".format(temperature_celsius, temperature_fahrenheit))
    time.sleep(2)
#

Fancy code is commented out.

#

Was trying to get it to work. When it seemed like it was in terms of making things opposite, but nothing was happening with the pin, I switch to original.

#

So, no idea if I even did the commented out bit properly, but it looks like what's in CircuitPython.

tulip sleet
#

I only have the TFT one, but I think it should be the same. I'll check the schematic

idle owl
#

Um... I'm not certain it is the same. I mean, you should still be able to turn off the pin, but I feel like there was a difference. Could be wrong though.

tulip sleet
#

VSENSOR part looks the same

idle owl
#

Ok, then maybe it is

#

Except the pin is TFT_I2C_POWER on that one, I thought. Combined for the TFT and I2C.

#

I guess the logic should be the same though.

tulip sleet
#

yes, it does control both the BME and the TFT, but the TFT is just another connection to VSENSOR

idle owl
#

Ah ok

tulip sleet
#

ok, hmm, on the TFT, the I2C pullups are powered by VSENSOR, but on the plain rev B, they are always powered. I think at least some sensors may end up being powered by the pullups by accident

#

that would explain it

idle owl
#

oof.

#

Ok.....

#

Well then. I guess I'll ask Limor what she wants to do. Means you can't force low power with a sensor plugged in? Or maybe it stops talking to it in deep sleep anyway..... I don't know.

#

I have to go fix veggies for dinner. I'll pick this up tomorrow. Thanks for looking into it.

tulip sleet
#

that is part of the redesign. Yes, ask Limor

#

there are at least two low-power problems with the <rev C plain Feather

idle owl
#

Hmm... ok

#

Heading out. Talk to you tomorrow for specifics. Or read back here to find them if you post here.

tulip sleet
#

no, that's wrong, I am thinking of the QT Py

#

bye, and good dinner!!

crimson ferry
#

@idle owl if all else fails, we could have a rev B pins.c and a rev C pins.c, and check hasattr for _INVERTED

manic glacierBOT
#

An interesting data point which may (or may not) be of use.

I have a Lolin S2-mini (ESP32-S2) running CircuitPython 7.2.3. The device is driving 240 WS2812C-2020 "neopixels".

It's been glitching just as described above.

On the rare occasion where I plug it into my computer (Windows 10), I might get the "Unrecognized USB device" error. In these cases, the device still receive power but does not have any communications. What is relevant here is that it does not glitch in this situa...

misty garnet
#

is asyncio pretty lightweight or does it add significant overhead?

manic glacierBOT
manic glacierBOT
shut dew
orchid basinBOT
orchid basinBOT
solar whale
#

Does anyone know how we can tell what boards support the BLE workflow? VIa code.circuitpython.org I can connect to a feather bluefruit sense but I am also trying to use a Maker Diary nrf52840 USB Dongle and I don't seem to be able to get it to show up. It does not show the blue status LED on boot and may well not support the BLE workflow but I was curious how to look at the build to determine what boards do support it.

lone axle
manic glacierBOT
#

I'm looking at how to adapt the existing code to work with the ESP32-S3 lcd driver code, and I could use some pointers. It is a slog for me to understand some of the code, so I'd appreciate even a few sentences to guide me in the right direction.

The ESP-IDF functions don't really act like a "bus" like the I2C or SPI buses, so I'm trying to figure out an easy way of doing this.

Background:

  • The ESP-IDF lcd peripheral library has a _draw_bitmap function that takes a draw window. ...
lone axle
idle owl
lone axle
#

ty, I'll give it a shot.

lone axle
idle owl
idle owl
#

Thanks! ๐Ÿ˜Š

solar whale
#

You are now a Micropython core developer!!

idle owl
#

Hah! I don't know about all that ๐Ÿ˜„

idle owl
#

She used "contributor" which I guess is vaguely more accurate.

#

@solar whale Anyway, if you test it, let me know. I'm going to add a page to the Feather ESP32 V2 guide on using MicroPython. Which I will probably ask for your help with.

solar whale
idle owl
#

Excellent! Thank you!

solar whale
#

I still can't build MP locally

#

Just have not had time to figure out why not.

idle owl
#

I did not venture into that yet. I was going to wait for a build on their end as well.

slender iron
#

@solar whale I'd expect it to work I think

#

(the maker diary board)

solar whale
#

I thought so too -- but do I have to tap reset as it is starting? I tried, but I have not yet been able to see it in code.circuitpython.org

#

No big deal -- I'll keep trying

slender iron
#

ya, I think would will to get it in pairing mode

#

is there no status led?

solar whale
#

no that blinks blue.. just a red led

slender iron
#

I think it should have different blink rates

#

that's just a power led though I think

#

the board def doesn't have a status led defined

solar whale
#

I may just have to play with the timing. Good to know it "should" work.

solar whale
slender iron
#

the page says it has an rgb led

solar whale
#

it does

slender iron
#

its a pwm rgb led?

#

you could add it. I believe we do support that

solar whale
#

I'll add it to my "todo" list! Be fun to try. but that should not prevent it from working woth BLE should it?

slender iron
#

no, I don't think it should

#

but it'll make it easier to understand what is going on

solar whale
#

OK -- sorry -- I have to run. I'll take a look at it later today or tomorrow to see I fI can make any progress -- as well as look into adding the LED

slender iron
#

np. thank you!

manic glacierBOT
#

@justinesmithies Would it be ok for you to have the splash setup in code.py? That way you won't have a gap where CircuitPython has control of the display.

Yeah minutes after submitting my comment that exact thought popped into my head. But it would be good and I'm sure that I'm not alone to have some kind of option in displayio to disable the terminal output / logo.

crimson ferry
#

Does a library in / override a frozen library?

tulip sleet
crimson ferry
#

thanks, came up in a library issue

lone axle
#

That is super useful! I didn't realize there was a way to make it not use the frozen one.

tulip sleet
#

@slender iron I am available now, but see you are working with Limor.

#

happy to wait for that to finish

slender iron
#

I'm in the circuitpython voice channel

tulip sleet
#

@onyx hinge we are going over issue lists before Scott leaves, if you have time, in the public CircuitPython voice channel

#

if not we'll just do it the two of us

manic glacierBOT
idle owl
manic glacierBOT
#

The IncrementalEncoder class needs two Pin instances to be instantiated, therefore it cannot be used with rotary encoders that are attached to a(n i2c) GPIO expander.

I'm wondering whether it would be possible to extend it, or to create a version of it which can work with values coming from an expander. An added bonus could be to make use of any interrupt pins on the expander which are connected to GPIO pins on the board.

idle owl
#

So apparently at once point, wifi had reset() but now it does not? I'm not sure what you would use in place of that. Since I have no idea what it previously did.

#

It was suggested that I use this loop in my current example. I have it almost working properly, but it fails on this with no attribute found, and the documentation backs that up.

manic glacierBOT
crimson ferry
#

@idle owl closest thing is:py wifi.radio.enabled = False wifi.radio.enabled = True wifi.radio.connect(secrets['ssid'], secrets['password']) # _added later_

idle owl
#

Hmm ok.

crimson ferry
#

less intrusive would be to stop the station, then start it and re-connect

idle owl
#

I'm kind of fuzzy on what I was trying to do anyway. Chances are I will be handing this off to someone else. I'm 20 minutes shy of the timebox I was given for it, and moved on to something else because I was kind of going in circles.

crimson ferry
#

(there's is no explicit wifi disconnect or reset (native esp32-s2), but supervior.reset would be the next escalation)

idle owl
#

Ok. Good to know.

#

Thank you!

tidal kiln
lone axle
tidal kiln
#

yah...seeing the second PR now too...

lone axle
tidal kiln
#

ha! ok. so maybe some mystery still to it.

#

oh well. the docs are up now at least.

#

thanks for looking into that!

lone axle
#

You're welcome

manic glacierBOT
misty garnet
#

is RS485 (rs485_dir keyword) support planned for the SAMD or RP2040 boards? There should also be a note in the docs indicating the it currently is only working for the ESP32 boards

manic glacierBOT
weary hill
#

Hello all. I just released Piku v0.2.0. It will now automatically install a package dependencies, you can also now install specific versions of packages, it creates a lock file like poetry/npm etc, and there is an update command to update all packages to latest.

split ocean
#

say @lone axle i'm trying to install vectorio_helpers w circup, but it's throwing a warning WARNING: vectorio_helpers is not a known CircuitPython library.

#

ah looks like they just aren't in bundle yet. I've installed them by hand, and the line works well, about to try outlined rectangle.

crimson ferry
#

Is there any CircuitPython mdns example code? I'm having issues, but not sure which side of the keyboard they're on ๐Ÿ˜‰

lone axle
slender iron
# crimson ferry Is there any CircuitPython `mdns` example code? I'm having issues, but not sure ...
# SPDX-FileCopyrightText: 2022 Scott Shawcroft for Adafruit Industries
# SPDX-License-Identifier: MIT

"""
"""

import mdns
import microcontroller
import socketpool
import wifi

from adafruit_httpserver import HTTPServer, HTTPResponse

print("connecting")
wifi.radio.connect("skylab", "freewifi")
print("Connected")

pool = socketpool.SocketPool(wifi.radio)
server = HTTPServer(pool)

m = mdns.Server(wifi.radio)
print(f"Listening on http://{m.hostname}.local:80")
m.advertise_service(service_type="_circuitpython", protocol="_tcp", port=80)

for service in m.find(service_type="_circuitpython", protocol="_tcp", timeout=5):
    print(service.service_type, service.protocol, service.hostname, service.instance_name, service.port)


@server.route("/temperature")
def base(request):  # pylint: disable=unused-argument
    """Return the current temperature"""
    # pylint: disable=no-member
    return HTTPResponse(body=f"{str(10)}")


# Never returns
server.serve_forever(str(wifi.radio.ipv4_address))
crimson ferry
#

Thanks! I got finding working, though it safemodes if there are no services of a given type.

slender iron
#

Please file an issue. I may not have time to fix but it'll be good to track.

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.3.0-alpha.0-52-g4465adfe0 on 2022-03-21; FeatherS2 with ESP32S2
(this is the version that corresponds to the mDNS merge)

Code/REPL

import wifi
import mdns
from secrets import secrets

print(" Connecting", end="\r")
wifi.radio.connect(secrets['ssid'], secrets['password'])
print(wifi.radio.ipv4_address)

print("Starting mDNS server...")
server = mdns.Server(wifi.radio)
service_types = ("_http", )

pr...
slender iron
manic glacierBOT
split ocean
#

@lone axle does this look like it should work? open_box = outlined_rectangle.OutlinedRectangle(pixel_shader=palette4, width=10, height=6, x=40,y=300, outline_color_index=0, outline_thickness=4)

#

i'm getting an error File "outlined_rectangle.py", line 48, in __init__ TypeError: extra keyword arguments given

lone axle
split ocean
#

thanks!

#

I'll do that now

#

vectorio is really cool!

lone axle
#

Indeed! it's a great way of drawing basic shapes without Bitmap overhead.

blissful pollen
#

you can even say vectorio really connects the dots...

split ocean
#

i'm playing around with it making this little circus game thing, based on some bouncing ball code from @devout jolt

lone axle
#

Oooooh fun! that is coming out fantastic

split ocean
blissful pollen
#

that's cool, and now i have that classic circus music stuck in my head

split ocean
#

haha so sorry. I just learned recently that that was written as a military march, and boy would the composer be disappointed at how it now means ๐ŸŽช ๐Ÿคก to us

blissful pollen
#

ha that's a cool random fact. I mean sorta has things choreographed to it still

split ocean
#

@lone axle I've updated to S3 latest (Feather RP2040 w TFT FeatherWing for hardware) and the error has shifted! File "outlined_rectangle.py", line 61, in __init__ TypeError: 'module' object is not callable

lone axle
split ocean
#

right on, not urgent! Thanks much.

pallid echo
#

Lady Ada mentioned that in a revision of one of the Feathers she fixed the deep sleep current draw. Was that something related to these internal pull-downs and external pull-ups If it is, my intuition says we could fix this in software for the older revision of the board. Sorry if I remembered incorrectly.

#

I bumped into this because I wanted to see whether it was feasible to go into deep sleep in the asyncio library on the MagTag when all tasks are busy. Maybe by pickling the co-routines into RTC memory. I really like the async API.

manic glacierBOT
solar whale
#

@idle owl I tried the 20220323 nightly build for MP on the feather esp32 v2 and I no longer get the invalid Pin error with scl = Pin(20)) but I am not able to access my I2C device ```MPY: soft reboot
network config: ('10.0.0.161', '255.255.255.0', '10.0.0.1', '75.75.75.75')
MicroPython v1.18 on 2022-03-23; ESP32 module (spiram) with ESP32
Type "help()" for more information.

import pos
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pos.py", line 31, in <module>
File "lsm6dsox.py", line 95, in init
File "lsm6dsox.py", line 152, in __read_reg
OSError: [Errno 116] ETIMEDOUT

solar whale
#

I tried a simple test -- connecting Pin 22 (SDA) to Pin 13 (LED) then ```from machine import Pin
p = Pin(22,Pin.OUT) --- the RED LED comes on
p.value(False) --- the RED LED goes off

then move to Pin 20 (SCL)
p = Pin(20,Pin.OUT) --- no response on RED LED
p.value(False) --- no response on RED LED
p.value(True) --- no response on RED LED

also tried Pin 14 -- works as expected -- LED responds
also reading back pin 20 after setting it to True or False. It always returns 0. Other pins return the expected value>>> p = Pin(20,Pin.OUT)

p.value()
0
p.value(True)
p.value()
0
p = Pin(22,Pin.OUT)
p.value()
0
p.value(True)
p.value()
1

onyx hinge
#

wow is github having trouble yet again today? I'm getting a lot of unicorn pages accessing actions results. githubstatus is all green though ๐Ÿ˜•

sterile crag
#

I am looking for a program that runs on MacOS to log CircuitPython output. Thonny has a scrollback buffer of only about 1000 lines I can select with <command>A. Mu has a larger buffer, but no SelectAll shortcut. On Windows I use putty, but I can't/don't want to install putty on MacOS. I tried rshell, but it only runs with MicroPython (It needs ubinascii.unhexlify.) Likewise screen does not seem to work with CircuitPython.
TLDR: I need output logging on MacOS and CircuitPython.

jaunty juniper
#

screen works with Circuitpython, but I don't even know how to get the scrollback if possible, though there should be a way to output to a file automatically

tulip sleet
#

There was a different issue with the QT Py ESP32-S2, which has also been fixed.

jaunty juniper
#

tio -log logfile /dev/cu.usbmodemBLABLABLA for example will connect and log all to a file

#

or just something like cat /dev/cu.usbmodem146443133 > output.log will log all to a file

onyx hinge
#

@jaunty juniper ooh I didn't know about the -log option of tio, I'll remember it!

sterile crag
#

@jaunty juniper Thanks. tio -loutput.txt /dev/tty.usbmodem487F307DBD4D1 works. Didn't think of the cat solution.

#

tio is nice because I can use the REPL.

lone axle
#

@split ocean I tested out that outlined rect code you posted here last night and I am seeing the box drawn on the display. I put the code I ended with here: https://gist.github.com/FoamyGuy/296abd0d2800e1790b8c76276838ab27 I tried to copy the constructor from your message and just fill in the minimum other code to run on RP2040 + 3.5 FeatherWing. I did need latest from S3, but after that I'm seeing it get drawn.

#

If your still seeing the module object not callable when you get back to it, maybe try this bare bones version to see if you still get that error. And if possible you can send the code you have to me and I can try it on my end to see if I can track down the specific cause. Looking back at the error message and the lines of code referenced I'm not seeing any immediate issues jumping out, but could still be something that is somewhat environment dependent that I am missing.

manic glacierBOT
split ocean
#

@lone axle I tried that code to the same error -- maybe this has to do with me running outlined_rectangle.py and line.py as their own libraries and not from the vectorio_helpers library

lone axle
split ocean
#

i had already made that change to the Line import in outlined_rectangle

lone axle
#

line 29 in outlined_rectangle.py is currently:

from vectorio_helpers.line import Line

but something like this should work I think if you moved it out on it's own:

from line import Line
#

Hmmm, then I am less sure. I would have expected it to work like that but maybe my understanding of how the imports work is not quite accurate.

split ocean
#

ahah! i had done that wrong. I had made it import Line oops ๐Ÿ™‚

#

@lone axle ok now it works! thanks.

lone axle
#

Ah. I'm surprised it wasn't a module not found error. So there is definitely still a gap in my understanding. Glad that got it going for you though ๐ŸŽ‰

split ocean
#

Yay! Say, do you think things like rotation and scaling could be possible one day in vectorio?

lone axle
#

I think it will involve some geometry to do the rotation function on the given points in the polygon. So it'll take a bit of math to do but I think we can make a fairly easy to use helper class.

stuck elbow
#

rotozoom

lone axle
#

ah that does exist as well. in bitmaptools, though I don't think it can be used on vectorio shapes.

stuck elbow
#

you just multiply it all by a matrix

split ocean
#

Yes, i wasn't about to solve those points in my head as i built the flags so i made them in Rhino, rotated them, and used Grasshopper to export the vertex coordinates to bring into CircuitPython

jaunty juniper
stuck elbow
#

fat is not case sensitive

lone axle
#

I will make an attempt at a helper class for it in the next few days and add it to the repo if it ends up working how I am imaging.

jaunty juniper
#

so import Line imports line.py

split ocean
#

oh @lone axle one other question related to the outlined_rectangle -- is there a way to have the rectangle fill be transparent and the stroke opaque?

#

related question -- is there a reason the outlined_rectangle seems to use a three color palette with first color for outline and third color for fill? I'm not sure what the second color is there for.

lone axle
lone axle
split ocean
#

right on, thanks

idle owl
solar whale
idle owl
#

I will give it a try though.

solar whale
#

Good luck!

idle owl
#

Thanks!

manic glacierBOT
slender iron
#

unicorn when getting build output is frustrating

manic glacierBOT
manic glacierBOT
idle owl
#

I noticed the Python Discord folks had a custom badge for their Discord chat on their various GitHub repos. I had Bruce design one for us. We can host it in the Bundle repo, and link to it that way in all of the Adafruit CircuitPython libraries. It would replace the "chat" badge. This won't show the total number of folks online like the current chat badge does, but I think that's fine. If anyone else has opinions on this, please let me know.

manic glacierBOT
#

Not sure your exact need is, but if you are ok with disabling the terminal in the python-side, you can make use of this recently-added feature and move the root_group outside of the visible display. Keep in mind the terminal will still be present in memory and will reappear whenever you fall back into the REPL.

If you want to prevent an image from flashing on the screen, you can set auto_refresh to false while you make the change y...

idle owl
#

@solar whale I made the LED blink using the MicroPython REPL!

#

Also, I guess I'm getting similar results: >>> i2c = I2C(1, scl=Pin(20), sda=Pin(22), freq=400000) E (1051500) i2c: /home/micropython/esp-idf-v4.2/components/driver/i2c.c:767 (i2c_set_pin):scl gpio number error

#

Or an error, anyway.

#

๐Ÿ˜• Not sure what to do with this. I wanted to try to do a simple scan, but it won't even initiate properly.

#

Wondering if there's some place where "valid" pins for I2C etc are called out explicitly, and this didn't get added there.

#

Also I have no idea how to upload a... main.py I guess it is. I got to the REPL and made the board do a thing, but I'm unclear on using MicroPython past that ๐Ÿ˜„

jaunty juniper
#

ampy --port /dev/tty.something put "main.py"

idle owl
#

Ooh.

#

Ok

stuck elbow
#

close your repl for it

jaunty juniper
#

yep, you can also change the name with put main_test_file.py main.py for example, so you can test different files without renaming them locally

idle owl
#

Does MP have a serial console like CP?

#

It won't break out of the REPL for me at the moment, so I wasn't sure.

jaunty juniper
#

it works like CP, except no autoreload

idle owl
#

Ok thanks.

#

Also, I might have the wrong build which might explain the invalid pin.

jaunty juniper
#

also, you can use Thonny or Mu, enable the "file" panel, it will automatically switch to and from the REPL as needed, though uploading files is a little awkward with those

idle owl
#

I downloaded the generic ESP32 build, but the REPL is reporting a specific board name. I have to head out for a bit. I'll look further into this when I'm back.

#

I verified my download... so I'm not sure what to make of this.

orchid basinBOT
manic glacierBOT
#

It'll be simpler to support this through os.getenv(): https://docs.python.org/3/library/os.html#os.getenv Having it be a function will give us more flexibility to run code on access.

Also note the dotenv Python library looks like a really good model. https://github.com/theskumar/python-dotenv It is used to manage environment variables for projects in regular Python with .env files.

slender iron
#

@idle owl do we have a standard pin name for battery voltage?

idle owl
#

I'm not sure we do for battery voltage, but let me check.

tulip sleet
#

it tends to be called BATTERY and VOLTAGE_MONITOR

#

often both

idle owl
#

What Dan said.

slender iron
#

kk

#

thanks!

idle owl
#

YW.

#

Hokay, so, MicroPython. REPL says MicroPython v1.18 on 2022-03-23; LILYGO TTGO LoRa32 with ESP32 I downloaded the generic ESP32 version, and it's reporting that board.

#

Wondering if that's why the pin assignment is failing.

#

But not sure how to get the right version if the website isn't providing what I need.

#

I mean, yeah, build it, but I don't know how to do that.

mental nexus
#

@slender iron thanks for the pointer to FrameBuffer. FrameBuffer experts: Are there any good examples showing to how a framebuffer gets hooked up to a physical display (eg how a display is initialized and connects the display board to a framebuffer) and then how displayio and framebuffer are setup to talk together.

slender iron
#

I know when I use it on broadcom, it handles the framebuffer to display bits

#

it is also used for matrix displays

#

and protomatter handles the framebuffer

solar whale
#

@idle owl I think you want the esp32 spiram build for the v2

idle owl
#
Type "help()" for more information.
>>> from machine import Pin, I2C
>>> i2c = I2C(1, scl=Pin(20), sda=Pin(22), freq=400000)
E (69290) i2c: /home/micropython/esp-idf-v4.2/components/driver/i2c.c:767 (i2c_set_pin):scl gpio number error```
#

Still getting the same error.

solar whale
#

Use I2C 0

idle owl
#

ok

#

That means changing the 1 to a 0 right?

solar whale
#

Yes

idle owl
#

Same error.

solar whale
#

Weird

#

Try SCL in pin 14 just to see if it accepts it.

idle owl
#

I did that earlier, and it did work.

#

I can do it again though, hold on

#

Worked this time too.

solar whale
#

That is a 20 not a 2O

#

Looks ok

idle owl
#

Fairly sure? I'll type it carefully this time.

#

Ya still error.

solar whale
#

I donโ€™t know why it works for me.

idle owl
#

That's not what failed for you?

#

I was unclear on where yours was failing.

solar whale
#

No

#

This I2C config works

idle owl
#

I'm simply trying to do the I2C scan to see if the device shows up. Can't even get that far. ๐Ÿ˜•

solar whale
#

Just canโ€™t use it

idle owl
#

Ah.

#

I copied that line from the "Getting Started with ESP32" page. Am I doing it wrong?

solar whale
#

Try without setting the great

#

Frequency

idle owl
#

ok

#

Same.

solar whale
#

Iโ€™ll be home in about 15 min. Iโ€™ll check mine again.

idle owl
#

Ok, thank you!

onyx hinge
#

@idle owl this does work in arduino?

idle owl
onyx hinge
#

the i2c thing

#

on deadly pin 20

solar whale
#

I have not tried it

idle owl
#

Um... let me see if I tried it for the guide.

onyx hinge
#

haha / argh

idle owl
#

Scan at least worked in Arduino.

onyx hinge
#
Author: Alberto Garciฬa Hierro <alberto@frsky-rc.com>
Date:   Wed Apr 21 22:01:14 2021 +0100

    Enable IO20 on ESP32
    
    Some newer ESP32 variants (like ESP32-PICO-V3 and ESP32-PICO-MINI-02)
    do implement this pin and it can be used as a normal GPIO.
    
    Fixes #6016
    Fixes #6837
    
    Closes https://github.com/espressif/esp-idf/pull/6918

diff --git a/components/soc/esp32/gpio_periph.c b/components/soc/esp32/gpio_periph.c
index a413203741..d993cb42ac 100644
--- a/components/soc/esp32/gpio_periph.c
+++ b/components/soc/esp32/gpio_periph.c
@@ -35,7 +35,7 @@ const uint32_t GPIO_PIN_MUX_REG[SOC_GPIO_PIN_COUNT] = {
     IO_MUX_GPIO17_REG,
     IO_MUX_GPIO18_REG,
     IO_MUX_GPIO19_REG,
-    0,
+    IO_MUX_GPIO20_REG, // This corresponding pin is only available on ESP32-PICO-V3 chip package
     IO_MUX_GPIO21_REG,
     IO_MUX_GPIO22_REG,
     IO_MUX_GPIO23_REG,
diff --git a/components/soc/esp32/include/soc/soc_caps.h b/components/soc/esp32/include/soc/soc_caps.h
index ae88415cb4..03597fe989 100644
--- a/components/soc/esp32/include/soc/soc_caps.h
+++ b/components/soc/esp32/include/soc/soc_caps.h
@@ -116,8 +116,8 @@
 // set pullup/down/capability via RTC register. On ESP32-S2, Digital IOs have their own registers to
 // control pullup/down/capability, independent with RTC registers.
 
-// 0~39 except from 20, 24, 28~31 are valid
-#define SOC_GPIO_VALID_GPIO_MASK        (0xFFFFFFFFFFULL & ~(0ULL | BIT20 | BIT24 | BIT28 | BIT29 | BIT30 | BIT31))
+// 0~39 except from 24, 28~31 are valid
+#define SOC_GPIO_VALID_GPIO_MASK        (0xFFFFFFFFFFULL & ~(0ULL | BIT24 | BIT28 | BIT29 | BIT30 | BIT31))
 // GPIO >= 34 are input only
 #define SOC_GPIO_VALID_OUTPUT_GPIO_MASK (SOC_GPIO_VALID_GPIO_MASK & ~(0ULL | BIT34 | BIT35 | BIT36 | BIT37 | BIT38 | BIT39))
 
diff --git a/docs/en/api-reference/peripherals/gpio.rst b/docs/en/api-reference/peripherals/gpio.rst
index 9f92f8d5be..93a5e05523 100644
--- a/docs/en/api-reference/peripherals/gpio.rst
+++ b/docs/en/api-reference/peripherals/gpio.rst
@@ -118,6 +118,11 @@ Overview
          - 
          - 
          -
+
+       * - GPIO20
+         - 
+         -
+         - This pin is only available on ESP32-PICO-V3 chip package
        
        * - GPIO21
          - 
```a change is needed in esp-idf for it to work, such as this one.  It's in esp-idf v4.4 tag but not in older ones. which version is actually used to build micropython?
solar whale
#

@onyx hinge wild guess. Did you erase the flash before loading MP?

onyx hinge
#

I don't even have one of these boards ๐Ÿ™‚

solar whale
#

I meant @idle owl

solar whale
#

Shucks

idle owl
onyx hinge
#

oh so it does

#

it will probably need v4.4 to work

idle owl
#

Oof.

onyx hinge
#
    # build the boards, based on the IDF version
    for board_json in $(find boards/ -name board.json | sort); do
        mcu=$(cat $board_json | python3 -c "import json,sys; print(json.load(sys.stdin).get('mcu', 'unknown'))")
        if idf.py --version | grep -q v4.2; then
            if [ $mcu = esp32 ]; then
                # build standard esp32-based boards with IDF v4.2
                if echo $board_json | grep -q GENERIC; then
                    # traditionally, GENERIC and GENERIC_SPIRAM boards used manifest_release.py
                    MICROPY_AUTOBUILD_MAKE="$MICROPY_AUTOBUILD_MAKE FROZEN_MANIFEST=$(pwd)/boards/manifest_release.py" build_board $board_json $fw_tag $dest_dir bin elf map
                else
                    build_board $board_json $fw_tag $dest_dir bin elf map
                fi
            fi
        else  
            if [ $mcu != esp32 ]; then
                # build esp32-s2/s3/c3 based boards with IDF v4.4+
                build_board $board_json $fw_tag $dest_dir bin elf map uf2
            fi
        fi
    done
#

oof that paste, but yes they build esp32 with idf 4.2 and the newer chips with idf 4.4. so this won't work without the right idf

idle owl
#

Hmph. Ok.

solar whale
#

but why does it work differntly for me -- at my desk -- wiil have an example in a minute

#
Type "help()" for more information.
>>> 
>>> from machine import Pin,I2C
>>> i2c = I2C(0,scl=Pin(20),sda=Pin(22))
>>>```
onyx hinge
#

is this the same build artifact that kattni used?

solar whale
#

but Pin 20 in non functional for me -- Is that related to the IDF?

idle owl
#

Looks like it....

solar whale
#

should be -- I will upload the file I loaded

idle owl
#
Type "help()" for more information.
>>> from machine import Pin, I2C
>>> i2c = I2C(1, scl=Pin(20), sda=Pin(22), freq=400000)
E (69290) i2c: /home/micropython/esp-idf-v4.2/components/driver/i2c.c:767 (i2c_set_pin):scl gpio number error```
#

er

#

I2C 0 gives the same error

onyx hinge
#

It's not identifying itself closely, since that's not exactly "v1.18"

idle owl
#

that was my first try.

#

Right but the build day is the same, and they only do nightlies, afaict.

solar whale
#

I can use Pin 20 all I want, but it always reads 0 --- even if I just set it as an output and write a 1 to it

idle owl
solar whale
#

and you really have a v2 board ??

#

has F in the circle on the back

idle owl
#

Yes to both.

solar whale
#

says V2 in big letter

idle owl
#

Yep ๐Ÿ™‚

solar whale
#

I'm baffled

onyx hinge
#

F? weird, how did you get my report card from 9th grade health class?

solar whale
#

both as to why you get differnt results and why Pin 20 does not work for me....

idle owl
#

Agreed.

solar whale
#

@onyx hinge what is the issue with the IDF version?

onyx hinge
#

@solar whale they had to add BIT20 to SOC_GPIO_VALID_GPIO_MASK so that it became possible to use pin GPIO20

solar whale
#

Ah -- so taht explains why for me, Pin20 is still not functional

#

maybe

onyx hinge
#

idf 4.2 does the check a bit differently but yeah

#

it has const uint32_t GPIO_PIN_MUX_REG[GPIO_PIN_COUNT] = { and in the middle: ```c
IO_MUX_GPIO18_REG,
IO_MUX_GPIO19_REG,
0,
IO_MUX_GPIO21_REG,
IO_MUX_GPIO22_REG,

#

I don't know why kattni and jerryn would have different wrong results but I'm pretty sure it's not going to work with today's idf 4.2.

#

Kattni, you got thrown in at the deep end ๐Ÿ˜•

idle owl
#

When am I not?

#

Is there a possibility for a weird bug? No? TOO BAD. KATTNI WILL FIND ONE.

onyx hinge
#

where do micropython nightly builds come from?

solar whale
#

So I guess it is in MP's court to update to 4.4

idle owl
#

They build and upload to the downloads section of the website.

solar whale
idle owl
#

I only just now figured out the snek in the MicroPython "M" logo. ๐Ÿคฆ๐Ÿปโ€โ™€๏ธ

solar whale
#

I'm not sure what else to do -- except wait for a comment on the issue -- hopefully it will be seen even on a closed issue.

onyx hinge
#

I literally can't find the script that checks out esp-idf version 4.2 within the micropython github. I can find evidence of 4.0.2 and 4.4. ```tools/ci.sh: ci_esp32_setup_helper v4.0.2
tools/ci.sh: ci_esp32_setup_helper v4.4

idle owl
solar whale
#

but @idle owl maybe you should add your experiences - since they are different. -- feel free to open a new issue and reference the old one if you prefer.

idle owl
#

I'll open a new one so it's not you reposting the same thing.

onyx hinge
#

further action is required and the existing issue is closed, so there should be a fresh issue. my feeling.

idle owl
#

Yeah agreed. Jerry, you can post to the new issue if you like once I file it.

solar whale
#

yup -- I thought I could re-open the issue like you can for CP

#

ok -- will do

idle owl
#

It's kind of a new problem though.

#

Pin 20 is exposed, it's not working for I2C is the issue.

solar whale
#

can you jsut do p20 = Pin(20,Pin.OUT)

#

then ```p20.value()
p20.value(True)
p20.value()

#

that is, is it just I2C

idle owl
#
E (2562560) gpio: gpio_set_direction(263): GPIO number error```
solar whale
#
MicroPython v1.18 on 2022-03-23; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> 
>>> from machine import Pin
>>> p20 = Pin(20,Pin.OUT)
>>> p20.value()
0
>>> p20.value(True)
>>> p20.value()
1
>>> 
onyx hinge
#

I thought earlier you said the value was always 0

solar whale
#

wwoah -- this is new for me --

#

let me connect an I2C device

onyx hinge
#

earlier when you got 0, was an i2c device connected?

#

it's remotely possible that a freshly reset device could be have differently too

solar whale
#

bah ````>>>
MPY: soft reboot
network config: ('10.0.0.161', '255.255.255.0', '10.0.0.1', '75.75.75.75')
MicroPython v1.18 on 2022-03-23; ESP32 module (spiram) with ESP32
Type "help()" for more information.

from machine import Pin
p20 = Pin(20,Pin.OUT)
p20.value()
0
p20.value(True)
p20.value()
1
p20.value(False)
p20.value()
0
p20.value(True)
p20.value()
0

onyx hinge
#

is it just changing randomly? sum(p20.value for _ in range(1000))

solar whale
#

sum(p20.value() for _ in range(1000))
0

onyx hinge
#

okay, so it's not randomness

solar whale
#

as you said may have been a reset condition

#

oh wait -- I hat it connected to Pin 13

#

with it disconnected

#
106
>>> ```
idle owl
#

I clicked the reset button, and tried to make p20 again, and am getting the same error.

onyx hinge
#

wait what, connecting something to pin 13 makes pin 20 behave differently?!

#

I'm going home.

solar whale
#
106
>>> sum(p20.value() for _ in range(1000))
92
>>> sum(p20.value() for _ in range(1000))
86
>>> sum(p20.value() for _ in range(1000))
93
>>> ```
#

I had pin 20 connected to pin 13 so it could blink the led

idle owl
#

So I'm not sure what to put in this issue ๐Ÿ˜•

solar whale
#

I would just report the errors you see. I'll add my contradicting errors ...

onyx hinge
#

I am not having a good time imagining how jerryn's getting these results

idle owl
#

Ok.

onyx hinge
#

all of kattni's results make sense to me, idf doesn't want to support pin 20

#

I've tried to build micropython for ESP32 but using IDF 4.4. No idea if this works, and no hardware to test on.

idle owl
#

Ooh on it.

solar whale
#

is taht for the SPIRAM

onyx hinge
#

this is esp32 build-GENERIC/micropython.bin and the ref is v1.18-244-g66fe3d5cb

#

I don't know if it's spiram or not because frankly I don't understand how esp-idf builds. but spiram is not related to the issue, so a non-spiram build should also load(?)

solar whale
#

teh V2 is the SPIRAM version

onyx hinge
#

OK, well, it's GENERIC not GENERIC_SPIRAM

solar whale
#

Tah tis a different build in the MP site.

idle owl
#

Trying it anyway, I guess.

solar whale
idle owl
#

It is sad...

solar whale
#

I have to go -- sorry -- will check on how you made out later, but I can't do any more on this untill tomorrow morning.

#

๐Ÿ˜ฆ

idle owl
#

Connecting to serial is displaying this repeatedly, no breaking out of it: rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 271414342, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3f400020,len:197668 ets Jul 29 2019 12:21:46

idle owl
solar whale
#

You too!

onyx hinge
#

OK, boo. 4.4 + GENERIC_SPIRAM doesn't fit in flash. ```/home/jepler/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: micropython.elf section .iram0.text' will not fit in region iram0_0_seg'
/home/jepler/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: IRAM0 segment data does not fit.
/home/jepler/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 440 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

idle owl
#

Hmm.

onyx hinge
#

I hope you can get yours esptool'd back to something that doesn't bootloop ๐Ÿ˜•

idle owl
#

On it.

solar whale
#

Thanks for trying @onyx hinge Good evening !

onyx hinge
#

It was clearly foolhardy to submit & accept that PR without testing (aside from building) but that's water under a bridge now.

#

it's so weird to not have CI artifacts from github but they have their own ways I guess

idle owl
#

Yeah...

#

Hmm......

#
>>> i2c = machine.I2C(scl=machine.Pin(21), sda=machine.Pin(22))
Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead
>>> i2c = machine.SoftI2C(scl=machine.Pin(21), sda=machine.Pin(22))
>>> i2c.scan()
[]
>>>```
#

The power LED isn't illuminated on the I2C breakout, so it's not getting power from the STEMMA QT connector.

#

Looking to see which thing is the power pin

onyx hinge
#

21 & 22 now, not 20 & 22?

#

oh and yes there's the power pin to activate, micropython won't do that for you

idle owl
#

Oooooohhh... I did it!

#

hold on

#

scanning again

#

I pasted that... no wonder it worked

#

I didn't notice the pin number difference.

#

No, it's failing.

#

I got power to the breakout, but I2C is failing again.

#
E (437660) gpio: gpio_set_direction(263): GPIO number error
E (437660) gpio: gpio_set_level(215): GPIO output gpio_num error
>>> i2c = machine.I2C(scl=machine.Pin(20), sda=machine.Pin(22))
Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead
E (449630) gpio: gpio_set_direction(263): GPIO number error
E (449630) gpio: gpio_set_level(215): GPIO output gpio_num error```
solar whale
#

Need the 0 before pin

idle owl
#
E (528380) i2c: /home/micropython/esp-idf-v4.2/components/driver/i2c.c:767 (i2c_set_pin):scl gpio number error```
solar whale
#

Itโ€™s backโ€ฆ.

idle owl
#

So I didn't actually get anywhere. ๐Ÿ˜ฆ

#

Though I apparently learned enough to make a power pin work without help.

onyx hinge
#

that's still with their nightly, since mine didn't work at all?

idle owl
#

Yes

solar whale
#

Progress is not always forward.

manic glacierBOT
idle owl
#

Here's what I have for the issue:

#

I submitted the fix to #8393 to expose pin 20 on ESP32. On the Adafruit Feather ESP32 V2, SCL is pin 20. When trying to initalise I2C, it is not accepting pin 20 as a viable option for SCL.

>>> from machine import Pin, I2C
>>> i2c = I2C(0, scl=Pin(20), sda=Pin(22))
E (2540280) i2c: /home/micropython/esp-idf-v4.2/components/driver/i2c.c:767 (i2c_set_pin):scl gpio number error

I2C set up works with pin 14 as SCL.

If I try to simply init pin 20 as an output, it also fails.

>>> from machine import Pin
>>> p20 = Pin(20, Pin.OUT)
E (19500) gpio: gpio_set_direction(263): GPIO number error

It has been suggested that perhaps the issue is resolved in the ESP IDF v4.4, but an attempt to build MicroPython with that version resulted in a failure to fit in flash. So, I have not tested this possibility.

idle owl
#

Feels like I'm out of my wheelhouse here, so it seems awkward.

onyx hinge
#

you gotta power past the awkwards, that is all

idle owl
#

Does that seem acceptable?

onyx hinge
#

you can say "@onyx hinge suggested that ..." it's ok

idle owl
#

Ok, thank you

onyx hinge
#

otherwise no change to suggest

idle owl
solar whale
idle owl
#

OK, I need to go dinner before our meeting.

#

Be back in a bit.

manic glacierBOT
#

What exact code are you running? The prints don't match the code. (udp vs tcp).

I'm able to run a modified version ok:

code.py output:
192.168.1.94
Starting mDNS server...
_http _tcp
BRW7429AF6E7F02 Brother HL-L2340D series _http _tcp 80
_udp
_upnp _tcp
_udp

My version:

import wifi
import mdns

print(" Connecting", end="\r")
wifi.radio.connect("ssid", "password")
print(wifi.radio.ipv4_address)

print("Starting mDNS server...")
server = mdns.Server...
manic glacierBOT
onyx hinge
#

supervisor.set_next_code_file(__file__, reload_on_error=True) hum this treats KeyboardInterrupt as an 'error' so it tricked me for a bit how to get out of it.

manic glacierBOT
onyx hinge
#

safe mode via reset button would be one way

manic glacierBOT
ornate breach
#

Amazing how a misplaced NOT operand can mess up a whole utility

mental nexus
# slender iron and protomatter handles the framebuffer

I looked through the framebuffer code, and it looks like it creates a memory buffer and displayio (somehow) can write directly into it. If I can expose the pointer to the ESP32-S3 buffer, this might work. However, in the ESP-IDF code, after it writes to the lcd framebuffer in PSRAM, and it calls to flush the cache. Will the framebuffer code flush the cache? https://github.com/espressif/esp-idf/blob/56659cdf36790e182451cd892ea349b29a27d333/components/esp_lcd/src/esp_lcd_rgb_panel.c#L334-L337

slender iron
#

It won't but I think you could put it in the swap buffers call

manic glacierBOT
mental nexus
#

Ok, Iโ€™ll look at that. Also, I canโ€™t decipher how displayio โ€œknowsโ€ itโ€™s a framebuffer and writes directly to memory.

slender iron
#

I think that's FramebufferDisplay's job

#

the whole group/tilegrid stuff writes into memory with a given format

mental nexus
#

This has a lot of tentacles, so it will take me a bit to grasp all of them.

slender iron
#

ya, it's not simple

mental nexus
#

I need to get out my pinboard and string again.

mental nexus
slender iron
#

it's a peer of Display I believe

inland mural
#

Hi! I was wondering if anyone can help me with my problem. I have a project for school, and I'm trying to operate 16 individual servos on circuit python using a 16-channel PCA9685 connected to an Arduino nano. Right now, I'm just trying to have one servo on channel 0 move, so that I can test them individually for functionality purposes. However, I'm getting this error on circuit python and I'm not sure if it's a hardware or software problem. Any advice? Attached is my simple code and then the error ๐Ÿ˜ซ .

slender iron
manic glacierBOT
manic glacierBOT
lone axle
#

Animating very quickly has some clipping artifacts. But for static or relatively slow moving things it will simplify things I think. Perfect for things like the triangle flags across the top of your latest demo

split ocean
#

@lone axle nice!

lone axle
#

Ooh, the previous video accentuates the clipping because it's moving by 10 degrees each frame. Moving by only 1 degree it's much smoother:

split ocean
#

do you base pivot point on COG?

lone axle
#

Not sure I know what COG mean

split ocean
#

sorry, center of gravity, or some other geometric center

#

(COG was a sort of misnomer that stuck in cg animation)

lone axle
#

Ah. I think that it rotates around the origin point (0, 0) in the plane with the points it's initialized with.

split ocean
#

picking an optional pivot point would be highly rad

lone axle
#

So if you use some negative and some positive starting points it will rotate about the center. I think mine is not quite the real center because I eyeballed the points to use to get it centered-ish.

split ocean
#

thanks I'll play around with it

lone axle
#

I'll need to play with it some more to get a feel for how it works. I think it should be possible to make the pivot point more arbitrarily selectable by transforming the points before feeding them to the rotation math.

split ocean
#

right on, this is exciting

manic glacierBOT
#

S3 is quirky too, but I think PR fix will fix S3 also. Thanks!

I often put a while True: loop after test code (with a pass or a sleep or a print) because I don't want to immediately drop into the REPL, partially since sometimes memory effects can take a moment to manifest. On S3, the non-existent checks would not crash immediately, but would either reset the serial connection or safe mode after entering the while loop.

manic glacierBOT
weary hill
#

@proven garnet I merged your pull request and released a new version with the initialize command. I also added an directory option to the create command and some tests to make sure creating/init in an existing directory didn't copy over existing files (hopefully).

lone axle
split ocean
#

ooh pretty! thanks @lone axle great stuff

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.

It works just fine on two of the boards I got, so I am not sure ...

manic glacierBOT
solar whale
onyx hinge
#

Does anyone know what board the "cp32-m4" is? It's in the duplicate pid/vid script, but was never documented on circuitpython.org. https://circuitpython.org/board/cp32-m4/

This board hasnโ€™t been fully documented yet. Please make a pull request adding more info to this file.The description should be written to inform a CircuitPython user what makes the board unique and link to relevant info about it.PurchaseAdd any links to purchase the board

#

huh added by bryan / siddacious

manic glacierBOT
#

To me, it made more sense to track which boards go together in a cluster; when reviewing a request to actually use a duplicate vid/pid, you want to know what board(s) it is aliasing.

I also revamped the detection of non-USB boards so that a board .mk file that couldn't be parsed by the code here would raise a problem instead of just being skipped for the purposes of checking.

There were some lines with comments on the end, and some variation in capitalization of the IDs. These are all n...

manic glacierBOT
#

CircuitPython version

adafruit-circuitpython-raspberry_pi_pico-en_US-7.2.3

Code/REPL

def PlayTone(inst, length, pitch, mixer, volume, effect):

    tone_frequency = int(440 * (pitch ** 1.059463094359))
    tone_length = int(length // tone_frequency)

    sine_wave = array.array("h", [0] * tone_length)
    for i in range(tone_length):
        sine_wave[i] = int((1 + math.sin(math.pi * 2 * i / tone_length)) * (volume / 7) * (2 ** 15 - 1))

    sine_w...
manic glacierBOT
trim elm
lone axle
trim elm
#

Cool

slender iron
#

@onyx hinge esp32-m4 was a board that was geared to fitting a SAMD51 in an ESP32 footprint. never was produced

idle owl
#

Quick show of L or D, who here uses light mode appearance on GitHub, and who uses dark mode appearance?

#

Pretty close to equal. Interesting, though I was basically expecting as much.

#

A fix for the reason I asked just popped into my head so before I bother asking for opinions on a thing, I'm going to try my fix.

misty garnet
#

it doesn't look like there is any 'flush' equivalent for busio.UART? Is this something that's not supported by the hardware?

manic glacierBOT
idle owl
#

So I resolved the issue with the white border not working on light mode by making it grey or Blinka-purple. But now I'm not sure which one looks best. I also included the original version with no border, which looked fine on light mode, but optical illusion made it look smaller than the other badges on dark mode. Thoughts? I'll upload them separately so folks can use reactions to cast their "votes".

#

No border:

#

Grey border:

#

Blinka-purple border:

slender iron
#

it should all be transmitted when the write call returns

#

(it might be once the byte is copied to the peripheral)

misty garnet
#

I had to add a 1ms sleep after the write before I toggled the drive enable line on a RS485 transceiver otherwise I would get bit corruption on the last byte, so it seems like it didn't fully push out that last byte before the line was de-asserted

slender iron
#

what port?

misty garnet
#

I'm using 4 SAMD21 QTPY M0

#

in a multi-drop rs485 config

slender iron
#

it's not unheard of to return a little too early

#

I'm not sure what the SERCOM exposes that we could wait on

misty garnet
#

looks like the write is non-blocking, but it waits until all bytes are transmitted

#

does async_status.txcnt get reset to 0 before each transmission?

slender iron
#

I have no idea. I haven't looked into it

misty garnet
#

cause it just checks if the transmission count is >= the length of the data before returning

tulip sleet
misty garnet
#

@tulip sleet where is tx_cnt zeroed, before each write?

tulip sleet
#

circuitpython/ports/atmel-samd/asf4/samd51/hal/src/hal_uasrt_async.c (from ASF4)

#

it is copied from tx_por

#

tx_por is zeroed in uasrt_async_write(). also see uasrt_process_byte_sent(), which increments tx_por.

misty garnet
#

got it, thx

slender iron
#

@tulip sleet what is the httpserver code based on?

tulip sleet
#

looking for that...

slender iron
#

๐Ÿ‘

tulip sleet
#

i didn't know about either of those beforehand

slender iron
#

I looked at them

#

I've run up against the fixed route paths

#

I was thinking I'd do /fs/<file path>

tulip sleet
#

i added routing only at the last minute

slender iron
#

it bugs me that routing isn't just an if/elif

tulip sleet
#

that sounds fine; one or both of those has file serving in their examples/ directory

slender iron
#

but no frameworks I can find actually do that

tulip sleet
#

I agree, I thought that was weird; it's WSGI or nothing

slender iron
#

I was looking at ASGI too but it uses dictionaries everywhere

tulip sleet
#

i looked at flask and some other stuff, but they were all too complicated or depended on urllib or whatever

slender iron
#

ya, web stuff tends to be complicated

#

maybe I care about memory use too much

tulip sleet
#

it's not you, it's CPy ๐Ÿ™‚

#

does micropython have something?

slender iron
#

pfalcon did picoweb

#

I couldn't find a common C http server either

#

ESP-IDF has a custom one

tulip sleet
#

is too big

#

you could take the routing arg stuff from one of the tiny WSGI servers and add it on to mine. I have no attachment to what I did; it's just that my first prio was serving a big file, and I had to make that work

slender iron
#

I think my gut wants to undo the routing stuff

#

and have an iterator that returns a request

tulip sleet
#

you can take it out; it's not that functional; it was just an idea I had at the last minute

slender iron
#

I generally don't like function calls that never return because they hide stuff

tulip sleet
#

for people who want routing, we can have a WSGI server

slender iron
#

totally

#

and that approach makes sense for cpython interop

tulip sleet
#

I did test it on CPython

#

I think

manic glacierBOT
slender iron
#

I mean with other CPython web code. it should be easy to sit on top of CPython sockets

tulip sleet
#

if you make an iterator instead of serve_forever(), what will each iteration return?

slender iron
#

a request object

tulip sleet
#

after it has been served?

slender iron
#

with method, path and headers

#

no, to serve

tulip sleet
#

or will you need to call a respond function

slender iron
#

ya, you'd need to call something on it

#

to respond

jaunty juniper
#

note that wsgiserver does not call a function that does not return, it polls, you specify an application when setting it up, it's that app that does the routing if any (using adafruit_wsgi in the example)

tulip sleet
#

so it could serve a file if there is no matching route

#

it was a bit tricky to get the root of the file serving path right

slender iron
#

I don't understand the "application" pattern either

tulip sleet
#

or, like in the example, file-serving is in the app

slender iron
#

doesn't get web stuff

jaunty juniper
#

what they call app is an object instance that you can call with the request data

blissful pollen
#

I'm reading all this and think I really have to read up on wsgi. Been too long since I really looked at stuff like that

tulip sleet
jaunty juniper
#

technically it can also just de a function

tulip sleet
#

with rationale

jaunty juniper
#
def do_the_thing(request, start_response):
    # do the thing

wsgiServer = server.WSGIServer(80, application=do_the_thing)
wsgiServer.start()
while True:
  wsgiServer.update_poll()
tulip sleet
#

Scott, Neradoc would steer you right on this, more experienced than us with this

jaunty juniper
#

I'm not that experienced though, but the core code is really that simple, it calls the "application", which is a function (or a callable object), whenever there's a request in the poll

slender iron
#

my struggle with these apis is that they put a layer of code between the code.py code and the users code in a function

#

which is why I lean towards a loop over requests

#

I totally get that this is weird for how it is done in normal cpython

jaunty juniper
#

yeah it's a callback that is automatically triggered by the poll

#

which is my preference personnally

slender iron
#

right. I'm not a fan of hidden event loops

jaunty juniper
#

basically like the neotrellis library versus keypad

slender iron
#

ya

#

and clearly this is more my issue than an issue for others

#

๐Ÿ™‚

jaunty juniper
#

but your idea can be made into the other if that's what the user prefers too, with a library

slender iron
#

ya, and they can coexist

slender iron
#

I like that it gives you a connection level function

manic glacierBOT
manic glacierBOT
viscid pine
#

@slender iron do you have any objections to how i wrote the control flow for installing the uart driver? If needed i can try make it less... like that

slender iron
#

I thought about it but no since the install params are different

#

one thing I thought about was if you should just always do the event

viscid pine
#

it seems more straightforward for sure

#

and its not like esp platform would care about one extra task doing nothing

slender iron
#

you just need to ensure you only care about ctrl-c on the debug uart then

#

but waking the task is ok

misty garnet
#

is there a list of supported flash chips?

manic glacierBOT
#

@rmilby13 That is a good idea. However I would recommend you look into using two RP2040s. Do you want to create a repo with discussions enabled where we could chat about it? If you want to use a single RP2040 this gets more complicated. There is a lot to talk about and they do not like that stuff here. I honestly am not sure they will get around to this, since its the only multicore MCU they support. Any meaningful API for building this would need their support, so that is too bad. They could...

manic glacierBOT
#

CircuitPython version

adafruit-circuitpython-bundle-7.x-mpy-20220322

UF2 Bootloader v3.14.0 SFHWRO
Model: Metro M4 Express
Board-ID: SAMD51J19A-Metro-v0

Code/REPL

from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import label
from adafruit_led_animation.animation.rainbowsparkle import RainbowSparkle
import audioio
import audiomp3
import board
import digitalio
import displayio
import framebufferio
import neopixel
import r...
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Thanks for the merge! Though .... I've just re-compared the pinout to the schematic and LED_DAT should be LED_DATA ๐Ÿคฆ. Do I need to raise a separate PR for that, or can the change be merged again if I just update this branch?

Also, we have the 3 ADC pins labelled ADC0, ADC1, and ADC2 in the schematic, but A0, A1, and A2 in the pin def. I believe that's to be consistent with CircuitPython's typical naming so probably doesn't need changing ๐Ÿคท .

proven garnet
#

If anyone with the keys to RTD has a chance, adafruit_motor's documentation failed to build

#

I couldn't find anything small to submit a PR for to get it to retrigger ๐Ÿ˜…

proven garnet
#

Thanks!

tulip sleet
#

ok, it worked!

proven garnet
#

Fixed, thanks again!

proven garnet
#

Does that have an RTD project made for it?

#

Because it's status is unknown and it brings you to a broken link

tulip sleet
#

it is missing the webhook; I'll add it

#

I triggered the motor build directly in rtd

proven garnet
#

Yeah, was it that pypixelbuf got changed to pixelbuf?

#

I can't find usage of pypixelbuf anywhere

#

I noticed that while I was typing some time ago and meant to follow up haha

tulip sleet
#

we renamed it to adafruit_pixelbuf in the C implementation. We need to archive one of these, I think. @idle owl ^^

#

anyway, I will add the other one

proven garnet
#

Sweet, thanks!

tulip sleet
#

@idle owl we have pixelbuf and pypixelbuf in the bundle. Can we drop one now because we aren't building <7.x bundles?

proven garnet
#

That worked, closed the pertinent issue!

jaunty juniper
#

@tulip sleet it's:

MP_DEFINE_CONST_FUN_OBJ_0(time_not_implemented_obj, time_not_implemented);
#

(that is swapped in the module globals table based on defines)

tulip sleet
jaunty juniper
#

testing it on QTPY, that seems to take 24 more bytes, maybe not worth it

tulip sleet
#

or FUN_OBJ_VAR_BETWEEN, with 0 and 1

#

Does it mess up Thonny?

#

Right now you don't see the NotImplementedError, which is kinda bad. You see th arg error

#

It's worth 24 bytes, I think, to make it throw the right thing

jaunty juniper
#

in Thonny the error is just ignored, says "could not determine epoch, assume 1970" (I don't know why they need it)

manic glacierBOT
#

The current way of writing to SD cards is slow, because the usual path uses "cmd24", which requires that the SD card fully commit each 512-byte block as it is written. (There is limited use of "cmd25" but only when a single writeblocks call spans multiple 512-byte blocks)

Implement cmd25 in sdioio, with logic similar to what was done for sdcardio (#5510)

#

I instrumented CircuitPython so that I could easily cause RTC overflows.

diff --git a/ports/atmel-samd/common-hal/rtc/RTC.c b/ports/atmel-samd/common-hal/rtc/RTC.c
index e2a67bd17..1d16e9b86 100644
--- a/ports/atmel-samd/common-hal/rtc/RTC.c
+++ b/ports/atmel-samd/common-hal/rtc/RTC.c
@@ -68,6 +68,9 @@ int common_hal_rtc_get_calibration(void) {
 }
 
 void common_hal_rtc_set_calibration(int calibration) {
+    mp_printf(&mp_plat_print, "Warping RTC in calibration setter\n");
...
onyx hinge
#

@tulip sleet ^ I'm hoping I did something wrong in my testing setup but it seems the RTC can "overflow" well before the count register actually wraps around. does that make any sense to you at all?

tulip sleet
#

you mean the overflow interrupt gets set early?

onyx hinge
#

yes, it seems that way

tulip sleet
#

i am just looking at the code

onyx hinge
#

RTC_Handler overflowed with overflow_ticks=0xfffffffd
I saved off the value of the count register inside the interrupt and then print it later outside the interrupt

tulip sleet
#

i was hoping if we synchronize the read then it should be sync'd up. I didn't read anything in the datasheet that it might be early

#

so my/your hope/assumption is unfounded

#

i did some forum searching etc about this and didn't see any cautions. We can open a ticket with Microchip about it too

#

seems very bad

onyx hinge
#

adding the 'sync' in the interrupt doesn't markedly change the outcome. ```while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COUNTSYNC | RTC_MODE0_SYNCBUSY_COUNT)) != 0) {}
overflow_flag = true;
overflow_ticks = RTC->MODE0.COUNT.reg;

tulip sleet
#

i have to be afk for a bit but will check back with you about this, not sure how to get around it

onyx hinge
#

just not use the overflow interrupt

onyx hinge
#

though that's not working for me either, is there a 2nd bug?

tulip sleet
onyx hinge
#

yeah basically.```c
static uint32_t _get_count(uint64_t *overflow_count) {
#ifdef SAM_D5X_E5X
while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COUNTSYNC | RTC_MODE0_SYNCBUSY_COUNT)) != 0) {
}
#endif
// SAMD21 does continuous sync so we don't need to wait here.

uint32_t count = RTC->MODE0.COUNT.reg;
if(count < rtc_old_count) {
    // Our RTC is 32 bits and we're clocking it at 16.384khz which is 16 (2 ** 4) subticks per
    // tick.
    overflowed_ticks += (1L << (32 - 4));
}
rtc_old_count = count;

if (overflow_count != NULL) {
    *overflow_count = overflowed_ticks;
}

return count;

}

#

if we avoid caring about exactly when the OVF interrupt fires, we can just look for a wrap in _get_count. Missing one isn't important, unless you don't call a time-fetching function for over 1.5 days.

tulip sleet
#

are you testing this on samd21 or 51?

onyx hinge
#

samd51

#

it's true, we should test on both

#

hah OK I think I figured out the other bug, it was in my rtc-warping code

tulip sleet
#

backspacing

onyx hinge
#

you can write RTC->MODE0.COUNT.reg = 0xffffff00; but it doesn't mean that the value changes immediately

tulip sleet
#

so maybe the interrupt is not early after all

onyx hinge
#

OK I'll let this run for a few thousand overflows but I think it's "right" now.

tulip sleet
#

oh, nvm, you are reading it back as already warped

#

when the clock speed is slow

#

i'm grasping at straws

onyx hinge
#

so does that equation 5ร—PGCLK + 2ร—PAPB < D < 6ร—PGCLK + 3ร—PAPB mean that reading the RTC COUNT could be up to 6 RTC ticks behind the interrupt? I was seeing up to 3..

manic glacierBOT
onyx hinge
#

also no workflows were started for that PR ๐Ÿ’ข

manic glacierBOT
#

Thank you for your detailed report.

RGBMatrix is continuously scanned by software inside the microcontroller using a timer interrupts. NeoPixel has to disable interrupts in order to correctly 'bit bang' the WS2812 protocol. So in this case it is unfortunately going to lead to the matrix glitching or blanking. You may get different results if you can use SPI as the neopixel communication method instead: https://learn.adafruit.com/circuitpython-neopixels-using-spi

I am not sure why MP3 p...

tulip sleet
onyx hinge
#

Same

tulip sleet
#

so in any case, it can be behind. I think your solution is find, though it does have the need to fetch the time often enough

idle owl
tulip sleet
#

it is the pypixelbuf one, substituting for _pixelbuf. ok, sounds good. I will make some PR's.

idle owl
#

We should literally archive the pypixelbuf repo.

#

Once we're done making sure it's not referenced.

tulip sleet
#

yes, I will add a message to it. Or do you want to do it or assign someone?

#

we just need a PR for the bundle

idle owl
#

I can archive it, there's a process to it.

tulip sleet
#

i will look in the learn repo

idle owl
#

Which I could explain, but could also simply do it in the same amount of time.

tulip sleet
#
Welcome_to_CircuitPython/code.py
13:* adafruit_pypixelbuf.mpy
idle owl
#

Hah ok.

idle owl
tulip sleet
#

i started to do that, but then discovered a bunch of libraries still refer to it, so multiple more PR's:

#
halbert@tuna:~/repos/Adafruit_CircuitPython_Bundle$ ag pypixelbuf
libraries/helpers/pixelbuf/README.rst
93:This example tests that pypixelbuf works.
97:    class TestBuf(adafruit_pypixelbuf.PixelBuf):

libraries/drivers/neopixel_spi/setup.py
39:        "adafruit-circuitpython-pypixelbuf",

libraries/drivers/neopixel_spi/README.rst
25:* `Pypixelbuf <https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf>`_

libraries/drivers/neopixel_spi/neopixel_spi.py
34:    import adafruit_pypixelbuf as _pixelbuf
39:        import adafruit_pypixelbuf as _pixelbuf

libraries/drivers/neopixel_spi/requirements.txt
7:adafruit-circuitpython-pypixelbuf

libraries/drivers/dotstar/adafruit_dotstar.py
25:        import adafruit_pypixelbuf as adafruit_pixelbuf

libraries/drivers/is31fl3741/adafruit_is31fl3741/is31fl3741_pixelbuf.py
25:        import adafruit_pypixelbuf as adafruit_pixelbuf

libraries/drivers/neopixel/neopixel.py
27:        import adafruit_pypixelbuf as adafruit_pixelbuf

circuitpython_library_list.md
280:* [Adafruit CircuitPython Pypixelbuf](https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf.git) ([PyPi](https://pypi.org/project/adafruit-circuitpython-pypixelbuf))

docs/drivers.rst
513:    PyPixelbuf <https://circuitpython.readthedocs.io/projects/pypixelbuf/en/latest/>
dusk mauve
#

Did my first esp32s3 build/flash today with an esp32s3-box and the latest main branch. the build/flash worked great! display works, USB-CDC serial console is operating.

Only oddity is that the USB filesystem is corrupted in a weird way I haven't seen before. the image is what it looks like on my Win11 system but the behavior is similar on an ubuntu system as well.

Is this a known issue (or a familiar pattern) or is it worth submitting a bug?

tulip sleet
#

did you erase flash before flashing the initial stuff?

#

you can do import storage; storage.erase_fileystem() and see if it fixes it up

#

in the repl

dusk mauve
tulip sleet
#

let us know if that does not work

idle owl
dusk mauve
tulip sleet
#

it's also good when the filesystem gets corrupted due to resetting too soon, etc.

dusk mauve
#

Thankfully I haven't run into that yet but super good to know.

dusk mauve
#

build/install from main on two other s3 boards i have on hand (devkitc-1-n8r2 and devkitm-1-n8) went great! lots of good work in the last few months on the s3 port. ๐Ÿ™‚

lone axle
stuck elbow
#

depends on the board, I think this one is used by default, but you can override it in the board definition

lone axle
#

Thank you, I had recalled seeing on your devices it's a custom one and I found where that was set in the mk files.

idle owl
#

One final call for which Adafruit Discord badge you prefer! Add a reaction to which one you like better, if you're interested.

#

Grey border:

#

Blinka-purple border:

#

Really only matters on dark mode - they look basically the same on light mode.

tulip sleet
#

@tidal kiln - neopixel_spi is still at 0.9.3; how do you feel about it being 1.0.0? (I have to make release to change pixelbuf stuff.)

#

made executive decision to do so, since it's been around for years

idle owl
#

Version numbers are free ๐Ÿ˜„

#

@solar whale So.... MicroPython question. Is there any point in using the nightly build on the ESP32 V2 Feather since pin 20 doesn't work anyway? Or is there still some improvement in the nightly build?

#

I'm writing a guide page for MP on the V2, and wanted to know if I should be pointing folks to the nightly, or the stable.

tidal kiln
#

@tulip sleet np. what @idle owl said ๐Ÿ™‚

idle owl
#

Ok thanks!

tulip sleet
#

@onyx hinge should rtc_old_count be reset anywhere? It's fine, right because a hard reset will zero it, and the ticks counter is not reset on a soft reload.
The CI job was never scheduled, not sure how to poke it.

onyx hinge
#

@tulip sleet I rely on it being zero'd at startup. If there was ever a case where we changed the rtc COUNT register we would want to do something about rtc_old_count there, but there is no such place.

tulip sleet
#

no githubstatus incidents to blame this on

onyx hinge
#

I force-pushed the branch and CI has picked it up now

tulip sleet
#

excellent, thanks

manic glacierBOT
onyx hinge
#

I guess you could fix the missed overflow problem (the hypothetical "if you somehow go 1.5 days without calling a time function") by putting the overflow interrupt back and just having its action be to call _get_count and discard the result.

idle owl
#

Blergh. Pylint issue I've never run into before, and after reading up on the PEP that led to it, I still have no idea how to fix it. I get what the problem is, but I don't even see why Pylint is failing on the line it's failing on, and I definitely don't see how to resolve it. Implicit string concatenation found in list (implicit-str-concat) is the failure. On line 16 in this file. Where is it even concatenating those into a string? I see it's an item in the for, but it's not used in the prints, so... I'm lost.

#

@jaunty juniper Your dot is green, but it doesn't mean you're around. If you are around... Do you understand this Pylint failure I'm getting and/or have any suggestions to resolve it?

winter mortar
#

You're missing a comma between 'WPA-PSK' and 'WPA2-PSK4'

idle owl
#

Really? The code runs. Weird. Trying that.

winter mortar
#

that's why you're getting the "implicit concatenation" warning

idle owl
#

๐ŸŽ‰ Your code has been rated at 10.00/10 (previous run: 9.58/10, +0.42)

jaunty juniper
#

yeah:
['Open', 'WEP', 'WPA-PSK' 'WPA2-PSK4', 'WPA/WPA2-PSK'] becomes
['Open', 'WEP', 'WPA-PSKWPA2-PSK4', 'WPA/WPA2-PSK']

idle owl
#

Oof.

#

Why didn't the code barf when run on the board?

#

Or if it doesn't need that particular authmode, does it ignore it?

#

(I didn't write this, I've been tasked with getting it on GitHub.)

jaunty juniper
#

well actually pylint could also complain about a variable defined but not used since authmodes is not used

#

so, that it is wrong is irrelevant :p

idle owl
#

It's in the for, is that not considered "used"?

#

Oh hmm.

#

Fair enough.

jaunty juniper
#

it's not in the code you posted

idle owl
#

for (ssid, bssid, channel, RSSI, authmode, hidden) in station.scan():

#

oh.

#

that's singular.

#

Wow.

#

I have no idea why either of them are there, then. Or how the code runs happily. But I don't know MicroPython at all, really, so ...

jaunty juniper
#

maybe it was originally supposed to match authmode and what is in authmodes, like authmode in authmodes or authmodes[authmode] if authmode happens to be an index...

#

like some more generic code that was reused

idle owl
#

That would make a lot of sense. Limor loves reusing other code.

#

Hmm. I'm wondering what to do with this then. I mean, it works as-is, but that's not great.

#

I guess start by asking Limor where it came from. It's not in the quickstart for the board, or the docs for the network module.

jaunty juniper
#

oh yeah authmode is an int

idle owl
#

Wait.. what does that mean

#

Practically speaking.

#

I know what an int is.

jaunty juniper
#

that authmodes[authmode] gives you the human readable version

idle owl
#

Oh ok

jaunty juniper
#

which explains why it was there

idle owl
#

except it's not used properly here?

jaunty juniper
#

it's not used in this code

idle owl
#

like there's a middle piece missing?

#

Ok

#

Trying to figure out how to present this to Limor.

#

I mean, in the end, if it runs, is it worth figuring out where that piece went? Or not and better to ignore it?

crimson ferry
#

I would think authmodes would be more useful for Access Point

jaunty juniper
#

you can remove authmodes or add something like:

print("   - Auth: {}".format(authmodes[authmode]))
idle owl
#

I tried deleting both authmodes and authmode but it fails on line 14 with ValueError: too many values to unpack (expeccted 5)

#

Hmm ok...

jaunty juniper
#

no you can't change the tuple in the for

crimson ferry
#

yeah, or that too

jaunty juniper
#

it's unpacking each result of the scan

idle owl
#

Ah ok

jaunty juniper
#

like that here, somebody's printer:
(b'DIRECT-C6-HP OfficeJet Pro 6970', b'\x80\xe8,\x02\x1c\xc7', 6, -81, 3, False)

#

(and you see authmode is 3, which is 'WPA2-PSK')

#

is the 4 a typo too ?

idle owl
#

Someone's random WiFi scanning with the code I posted above. ```* SunGuest

  • Channel: 5
  • RSSI: -88
  • BSSID: 92:....
  • Auth: WPA/WPA2-PSK```
jaunty juniper
#

oh yeah my typo lol

#

oh wait no ๐Ÿคท

idle owl
#

Thank you so much! I think I have the right amount of info to take to Limor, and working code either way. Much appreciated!

crimson ferry
#

you may want to use some caution posting full MAC addresses, they can provide location info

idle owl
#

Oh right

#

That's not the Feather MAC, it's the WiFi MAC.

crimson ferry
#

right, either way

idle owl
#

um... Can I do a string that uses .format(*bssid) but only displays part of it?

crimson ferry
#

":".join("%02X" % _ for _ in buf[4:7]) + ":RE:DA:CT"

idle owl
#

Or does it matter for the code, it's don't paste it into Discord?

crimson ferry
#

just Discod

idle owl
#

Oh ok ok ok. That makes more sense. Thank you for the heads up.

crimson ferry
#

oops, I should fix that code line, it's adapted for something specific

#

first three bytes is manufacturer, last three bytes is the specific device

jaunty juniper
#

not sure how you get to a location from the MAC of an access point ๐Ÿค”

crimson ferry
#

there are databases

idle owl
#

I'm happy to be paranoid about that sort of thing.

crimson ferry
#

same

jaunty juniper
#

I mean, in google's vaults maybe ?

crimson ferry
jaunty juniper
#

like, from phones pinging locations of networks they detect ?

idle owl
#

@crimson ferry Do you have info on what part is ok to display? Or is it the whole thing together that matters, and showing the first two parts is ok or something?

#

I need to edit the screenshot for this guide to cover them up.

crimson ferry
#

it's pretty much ok to display the first three bytes, since that's just manufacturer

idle owl
#

Keen thank you.

jaunty juniper
#

oh yeah some app that does some snooping

crimson ferry
#

Mobile app makers (or their 3rd-party ad "partners") LOVE to have access to wifi to see what's around to pinpoint location even if you have location off (can't do that anymore on iOS from what i understand). Also, retail areas love to watch even client devices as they roam around.

#

(I just try to stay away from posting any unique identifiers)

crimson ferry
#

.eu has better laws, but the U.S. is the wild west for data aggregators

idle owl
#

Heh. Nah, all good. Thank you for the pointers.

#

Passed Pylint remotely for the PR. And works running it on the board. Seems like a win to me.

idle owl
misty garnet
#

does anyone use VSCode + WSL to do their development and building?

tulip sleet
onyx hinge
#

@tulip sleet so the thought would be, it doesn't matter if in the irq the overflow hasn't happened yet, just so that the old-ticks value gets updated so on a real call after overflow the overflow occurs. however, I'm not sure that's bulletproof, because (say) the pre-overflow value could be 0xffff_fffc one time and then 0xffff_fffd the next "overflow", it would not record an overflow.. if we actually care about that case, more thought is required.

tulip sleet
onyx hinge
#

no, I meant 3 days later

tulip sleet
#

oh, i see if it was not called at all the next cycle, I see

onyx hinge
#

the userspace code has to be very careful never to call a time function over 3+ days, or it would work just fine. this would be an "every 6 days, a slim chance" problem.

#

userspace isn't quite the right term

tulip sleet
#

I think the current PR is better than the existing code, in any case, because waiting a complete cycle before calling time is much rarer than calling it a lot

#

so let's merge and you can write a "Very Long Term" issue. Does that make sense?

onyx hinge
#

I also think it's an improvement, though it still isn't tested on samd21 by me

#

either just in the normal case or in the overflowing case

tulip sleet
#

can you easily test it with your setting of the clock reg? I think you are almost all set to do that. That would be great.

#

I would include this in beta.0 or whatever

onyx hinge
#

write on the PR for me to do it and I'll try to get to it on monday ๐Ÿ™‚

tulip sleet
#

thank you!

#

maybe I will try a test right now, looks easy enough

manic glacierBOT
manic glacierBOT
#

@jepler I tested this on a CPX, using your test code above, with the SYNCBUSY part commented out. I stopped it after the last runs below. Looks OK, if I understand correctly. Looks like the problem is not present on SAMD21.

Warping RTC in calibration setter count=ffffff06 rtc_old_count=00000000
 18725: duration 20141596

Warping RTC in calibration setter count=ffffff06 rtc_old_count=00000000
 18726: duration 20080574

Warping RTC in calibration setter count=ffffff06 rtc_old_coun...
manic glacierBOT
#

After #6202 I think there's a (new! but extremely implausible) scenario where time will fail to progress. Adding back some form of the RTC interrupt would fix it, but the details got a bit messy as I considered them. Rather than try to fix this even rarer and even easier to work around bug (just call time.monotonic daily!) we decided to take #6202 and file this bug.

Basically, imagine a program that goes through the following steps:

  • records a starting time
  • waits for an event to oc...
orchid basinBOT
manic glacierBOT
#

vectorio shapes do not currently support being hidden by the group that contains them.

This sample code illustrates the issue:

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

display = board.DISPLAY

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.append(circle)

...