#circuitpython-dev

1 messages · Page 351 of 1

tidal kiln
slender iron
#

is it just one transaction?

#

it could be that it dislikes the address probe

tidal kiln
#

yah. i recreated via repl for the underlying single transaction.

#
Adafruit CircuitPython 6.2.0-beta.0 on 2021-01-22; Raspberry Pi Pico with rp2040
>>> import board
>>> import busio
>>> i2c = busio.I2C(board.GP27, board.GP26)
>>> i2c.try_lock()
True
>>> buffer = bytearray(2)
>>> buffer[0] = 0x01 | 0x80
>>> buffer[1] = 100
>>> i2c.writeto(0x29, buffer)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] Unsupported operation
>>> 
#

same thing works fine on itsy m4, fwiw

slender iron
#

hrm, that seems like it should work

#

can you scope them both and compare?

tulip sleet
#

beta.1 is just out

slender iron
#

thanks @tulip sleet !

#

I found an older talk from katie bell: https://www.youtube.com/watch?v=U33L10xoWzM

Katie Bell

https://2020.pycon.org.au/program/HHPFHW

The vast majority of code is written through some kind of text editor, whether it's notepad, a sophisticated IDE, or a heavily customised Vim environment. These tools mitigate common text editing problems like unclosed brackets and syntax errors, but can't eliminate them completely.

In th...

▶ Play video
tulip sleet
#

yw, i just meant for @tidal kiln 🙂

tidal kiln
#

@slender iron sry. had to answer door right after last message.

slender iron
#

np

tidal kiln
#

should i just try a firmware upgrade real quick?

tulip sleet
#

i don't know it would fix it, but worth trying, no specific fix for that that i know of

#

always worth testing with latest

slender iron
#

they look identical to me

#

can you make sure and capture from power up of the sensor?

#

there might have been a previous transaction that messes it up (specifically the address probe method is different)

tidal kiln
#

ok. let me upgrade firmware and repeat experiment and report back.

#

could be an oddball sensor too. i sanity checked with a bme680 and that seemed to talk just fine.

slender iron
#

yup. the probe works the same on blinka on rpi

tidal kiln
#

it didn't throw the os error. but it's still NAKing.

#
Adafruit CircuitPython 6.2.0-beta.1 on 2021-01-27; Raspberry Pi Pico with rp2040
>>> import board
>>> import busio
>>> i2c = busio.I2C(board.GP27, board.GP26)
>>> i2c.try_lock()
True
>>> buffer = bytearray(2)
>>> buffer[0] = 0x01 | 0x80
>>> buffer[1] = 100
>>> i2c.writeto(0x29, buffer)
>>> 
#

itsy m4 for comparison

#
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit ItsyBitsy M4 Express with samd51g19
>>> import board
>>> i2c = board.I2C()
>>> i2c.try_lock()
True
>>> buffer = bytearray(2)
>>> buffer[0] = 0x01 | 0x80
>>> buffer[1] = 100
>>> i2c.writeto(0x29, buffer)
>>> 
idle owl
lone axle
#

Huzzah! I have the intial code almost ready to go. Few more CI quirks to fix up tonight.

#

I used this as my excuse to finally get pre-commit going locally.

marble hornet
idle owl
lone axle
#

I've just skimmed the issue so far. But you are totally right about "View" I kind of just lifted that term from my Android development background. There is not (yet) a specific displayio concept using that term that I am aware of. I will put some more thoughts in the issue tonight.

idle owl
#

Right on! I basically put down everything I "ran into" while using it.

#

It's meant for discussion for sure.

slender iron
#

@tidal kiln I'm out of ideas

tidal kiln
#

ok. i'll keep poking at it.

#

just wanted to make sure it wasn't something known w/ pico

#

thanks for looking

slender iron
#

nope, an issue would be good

tidal kiln
#

ok. np. i'll just dump the above info and link to forum thread.

marble hornet
#

@idle owl if/when you have the time could you snap a photo of the light_box interface?

idle owl
#

The GUI on the display? @marble hornet

marble hornet
#

Yes please , I'm having a hard time visualizing what looks like from just the code

manic glacierBOT
#

Re this thread:
https://forums.adafruit.com/viewtopic.php?f=60&t=174668

Maybe some weird edge case for this hardware combo? Used an Itsy M4 as a sanity check and it works fine there. Tested via REPL doing essentially the same I2C transaction as the library.

RPi pico

Adafruit CircuitPython 6.2.0-beta.1 on 2021-01-27; Raspberry Pi Pico with rp2040
>>> import board
>>> import busio
>>> i2c = busio.I2C(board.GP27, board.GP26)
>>> i2c.try_lock()
True
>>> buffer = bytea...
idle owl
#

The way I did the color balance control is because there are only so many buttons available.

#

It's controlling that when the little select < is on that line.

#

otherwise brightness.

manic glacierBOT
#

Ditto for me, neither 6.1.0 or 6.2.0-beta.1, they get to the end, no errors show, but no rainbow and fomu flashes red, no usb drive appears

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2019 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 1209
Match product ID from file: 5bf0
Opening DFU ca...
idle owl
#

@marble hornet Great start on the docs!

crimson ferry
#

Blinka has terminalio, but I'm guessing I should expect support to be quirky or partial? I get no exceptions. I don't see any Blinka issues or PRs for terminalio. I was hoping to do one of these:logbox = displayio.TileGrid(terminalio.FONT.bitmap, #... logterm = terminalio.Terminal(logbox, terminalio.FONT) print("TFT!", file=logterm, end='\r\n')

onyx hinge
#

@lone axle before I put you too terribly on the spot, do you mind if I write this in my update for next week's newsletter?

To make it work how I wanted, I had to write a function to precisely wrap text according to its width in pixels. Discord's FoamyGuy (Tim) has stepped up and plans to bring this feature to a future version of the adafruit_display_label library.

lone axle
#

But also I didn't realize you could use terminalio like that in CircuitPython so that neat to me!

idle owl
#

@onyx hinge I call @lone axle out regularly in my update 😄

crimson ferry
#

@lone axle ah, thanks, so maybe I go learn purple pillow, or is there something better on RPi?

marble hornet
#

@idle owl 😅 the chat really helped. And that really packs a lot of control onto one page, I like the control scheme. I see how grid layout was crucial.

lone axle
#

@onyx hinge thank you for checking. And yep all good by me. adafruit_display_text is the library (granted though the naming is confusing at the object level with label)

onyx hinge
#

Corrected, thanks!

marble hornet
#

Isn't the Text class name reserved for paragraphs, once they're implemented?

lone axle
#

@crimson ferry what is the end text you are trying to end up with? would it make sense to put it in a label and update that instead of having the scrolling and print() statements?

idle owl
#

@marble hornet Glad it helped! Thank you very much, it took a bit of thought to manage to figure out how to control everything I wanted to in the way I wanted to.

lone axle
#

Hmm I'm not sure about the reservation. the existing bitmap_label works well with paragraphs I think as long as you have a big enough display and/or small enough font.

#

it doesn't do auto-wrapping, so you do have to add linebreaks, but there is a helper function for it in the library now (formely was in PyPortal library)

marble hornet
marble hornet
crimson ferry
#

@lone axle for now I just want the most of screen to be a console of scrolling text. I use the terminalio construct to do that in CP, so I thought I'd just cut-and-paste 😉

idle owl
lone axle
#

It would be neat functionality to have in Blinka_Displayio.

idle owl
#

Context: I'm going to add Bluetooth to this project I'm working on, and wanted to use the Adafruit services if possible instead of the Nordic UART services, but it looks like I might have to go with Nordic because it's 2 buttons, and a 5-"button" joystick. (As in the joystick is coded like buttons, not a joystick.)

#

Oh hmm. other bits are available for future buttons and switches

lone axle
#

I think button service may work for at least 8 buttons because I believe there are 8 in the Bluefruit Connect app and I think it uses that.

idle owl
#

@lone axle I think the Bluefruit Connect app uses the Nordic UART service.

#

It's the Circuit Playground app that uses the Adafruit services.

lone axle
#

Ah I see. So the buttons are going the other way. Physical button values into the phone. Not virtual buttons in the phone telling their value to the microcontroller.

idle owl
#

Um... no? I've had it where a Bluefruit was looking for a button packet from the phone, and did a thing based on that...

#

I thought?

#

Or used button packets as a way for two Bluefruits to talk, but it worked with the app too.

lone axle
#

It's been a while since I messed with it. But on the Android Playground app at least I think it's the A/B buttons on the playground sending their value into the phone, it puts some things on the screen based on which one is pressed.

idle owl
#

Ok right

#

That's the other app, yeah

#

I see what you're saying though

#

I think. That the Adafruit services isn't for sending from the phone to the board, it's the other way around. Now that I'm looking at it, that makes sense. So I probably need the UART service anyway.

#

Because the ButtonService is coming from the board, not the app.

#

Got it. Yeah.

thorny jay
#

I would like to thanks the CP community and in particular @slender iron .
Thank to him and likely to the skills acquired here, I recently found a second job in electronics and I am doing good progress designing board and writing code in assembly language.
This is eating a bit my time and I will likely have a bit less time for CP now. I hope to come back stronger when I will regain some equilibrium in my free time.
I was just hired* by Shenzhen Longteng Electronics Co., Ltd.

  • The game Schenzhen I/0 was hinted by Scott in his last Deep Dive when explaining the RP2040's PIO.
idle owl
#

@thorny jay Congratulations!

slender iron
#

congrats!

thorny jay
idle owl
#

😄 Hah! Your post makes more sense now.

slender iron
#

haha, ok

#

I found it too similar to my day job

#

I wanted more registers than the game gives me

thorny jay
#

Well, it seems to be like PIO assembly, and those sleep you put.

slender iron
#

ya, definitely

manic glacierBOT
lone axle
#

@marble hornet here's what I got for thoughts and tips on streaming: https://gist.github.com/FoamyGuy/96dd64865cf77f9fe100fc0f7a764543 I tried to keep it relatively short, but am happy to expand further if you're interested in something specific. Also one other thing I'll mention is so a private test stream at least a day before you intend to do the real one. Youtube I think may have a 24hr waiting period depending on your account.

marble hornet
#

Thanks for taking the time to write it up😁, I'll give it a read through and see if i have any clarifying question.

lone axle
#

would it be possible and make sense to have pre-commit take care of pylint and the sphinx build also? so that a single step can take care of more of the pre-reqs

fossil gorge
#

Do you mean the tidying up, or verification?

manic glacierBOT
idle wharf
#

@prime flower I was just this weekend porting a library to CP to talk to my Bloomsky weather station and was thinking about how to handle some datetime stuff. So I REALLY appreciate you eliminating my need to think about that with your work on https://github.com/adafruit/Adafruit_CircuitPython_datetime !!
I'm going your latest PR in my library tonight.

mild fog
slender iron
#

I don't know of any plans

#

I think it's feasible though

mild fog
#

Thank you much! 🙌

prime flower
#

@idle wharf no problem! Feel free to review the PR thats outstanding (fixes bugs)

manic glacierBOT
manic glacierBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

57

Voice Channels

6

Members

26992

Roles

34

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I'm hoping what I did still achieves the goal. I now have that firmware.uf2 installed in my ESP32S2 Metro

I'm running my simplified deep sleep and increment counter test, powered by a USB power brick and posting the loop count to UART on pins 5/6. I'll try the test with a 10 second deep sleep first and see how high I get, then use a 60 second.
code:

import busio
import board
import alarm
import time

def alarm_deepSleep(how_long):
    time_alarm = alarm.time.TimeAlarm(monoto...
manic glacierBOT
#

@tannewt @hathach I tested this on a variety of boards with 6.2.0-beta.1. On the problem boards, the writes are severely delayed or never complete. The different behaviors may help in debugging.

Metro M0 Express (SAMD21): problem: finishes, but /var/log/syslog shows USB issues
Metro M4 Express (SAMD51): problem: finishes, but /var/log/syslog shows USB issues
Feather STM32F405: problem: gets completely stuck and never finishes: /var/log/syslog shows worse problems than SAMD

Feath...

onyx hinge
lone axle
#

Yep, will do.

onyx hinge
#

Appreciate it!

uncut nexus
#

@slender iron - have you used DEBUG=1 build on the RP Pico with the SWD debugger?

slender iron
#

@uncut nexus early on I did. I followed the instructions to do swd from an rpi4. I didn’t use a jlink

uncut nexus
#

Did you run into an issue where an assert in the SDK function hw_claim_clear() was constantly getting triggered?

slender iron
#

No I didn’t see that. Sounds like it could be a bug in our code

#

Could also see if it was a pico-ask bug that’s been fixed. They are fixing stuff in the develop branch

uncut nexus
#

OK, I'll check there. It seems like the hw_claim_clear() expects the pio being cleared to already have been claimed; which is of course not true at boot

turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

57

Voice Channels

6

Members

27002

Roles

34

manic glacierBOT
#

The brownout enabled may have been causing the issue. I ran the 10 minute loop of the program above until it reached 125. I think changed it to 60 minutes and hooked the board up to power from the barrel connector and I have my Raspberry Pi 4 logging the Debug UART port and also the UART on pins 5/6.

I just checked and we are up to 25 minute/loops without a PowerON exit from deep sleep. All exits from deep sleep have been with been with DSLEEP status.

I'll keep this running until i...

slender iron
#

@uncut nexus that definitely sounds like my bug then! I did swd debug very early on when I was crashing because the code ran into the file system portion of the flash. 🙂

uncut nexus
#

@slender iron - I posted the issue on the Raspberry Pi Pico forum - I'll see what they have to sat about it. We may need to check the claimed status before 'unclaiming' when we want to reset the state machines.

slender iron
#

Ya that’s fine with me if we track it too. Can probably tell with the program id

tidal kiln
gilded cradle
#

@tidal kiln nope, I don't. Is there something that needs changing?

tidal kiln
#

yah. there's a weird copy edit issue. not even sure what the original intent was for the section in question.

gilded cradle
#

It's Kattni's guide, so it's likely on her, but I don't think she is working today or tomorrow.

tidal kiln
#

ok. thanks. nothing super urgent. i'll send her an email.

gilded cradle
#

ok

tidal kiln
gilded cradle
#

Oh yeah, things have probably changed since I made that

tidal kiln
#

there's one feedback thats essentially asking how to use with non-built in display boards

#

since it only uses board.DISPLAY syntax

gilded cradle
#

I think there's a number of examples in other guides, so maybe a little blurb about replacing it with the output of initializing the driver in place of that?

tidal kiln
#

or show both? change code to do something like:

display = board.DISPLAY
# now use display in rest of code
#

that way you can say something like "if you don't have a built in display, change that line to"

display = <insert external disp init here>
#

but the rest of the code would be the same

gilded cradle
#

That sounds good

tidal kiln
#

cool. thanks.

#

also not super urgent...just going through guide feedbacks.....

gilded cradle
#

Ah, ok. Makes sense

manic glacierBOT
cedar moth
#

Hi, apologies in advance for the noob question or if this is the wrong place. This is my first time trying to contribute to an open-source project, and I have read your Design Guide and tutorials on contributing using GitHub. I am working on a project (carbon monoxide monitor for a boat) that uses your Adafruit FeatherWing OLED - 128x64 OLED Add-on For Feather - STEMMA QT / Qwiic. Everything is working great, but I need to be able to sleep the display to prolong battery life and realized that the current Adafruit SH1107 driver does not have this functionality. After reviewing the SH1107 datasheet, I have figured out how to implement sleep/wake functionality and have it working on my test rig (a Feather M4 Express connected to the OLED FeatherWing). I have implemented the functionality in a forked version of your current Adafruit_CircuitPython_DisplayIO_SH1107.py driver. Since this seems like something others might want to use, I was wondering what the correct / courteous approach is to offering this work as a potential contribution to the driver? Does one simply submit a pull request out of the blue, or should I bring it up somewhere like here in Discord or on your forums first to see if you are even interested? Should I submit an issue first? Again, this is my first time trying to contribute to open-source and I haven't seen anything about typical GitHub / open-source "social protocols" so your input (and patience) is appreciated!

tulip sleet
#

Go ahead and make a PR to the library, with an explanation of your goals, and we'd be happy to discuss it there. You could also make an issue, but if you have suggested code, a PR is fine.

cedar moth
#

Thanks Dan, will do shortly. Appreciate it!

onyx hinge
tulip sleet
#

that looks like a bad cache as before 😦

onyx hinge
#

subprocess.CalledProcessError: Command '['/opt/hostedtoolcache/Python/3.8.7/x64/bin/python', '-m', 'virtualenv', '/home/runner/work/circuitpython/circuitpython/.idf_tools/python_env/idf4.2_py3.8_env']' returned non-zero exit status 1.

tulip sleet
onyx hinge
#

@tulip sleet yes I can put in a PR to use a new cache key

tulip sleet
#

or just add it to your current PR, since that PR so simple and already approved.

onyx hinge
#

I'll do that

manic glacierBOT
analog bridge
#

for #4083 is a merge from main needed once the key is updated or can it be ignored since the PR is regarding RP2040

tulip sleet
#

yes, we can ignore the xtensa failures

manic glacierBOT
onyx hinge
#

argh, I pushed the key-changed to the wrong branch and wandered off

manic glacierBOT
manic glacierBOT
main furnace
#

How would I check board for an SPI function?
if 'SPI' in dir(board): ...?
I'm thinking about a pull request for the adafruit_seesaw package. I want to maintain the existing behavior (create a TFTShield18 object with the default board.SPI) but allow the package to load if the board doesn't have SPI (RP2040 pico I'm looking at you).

tidal kiln
#
>>> import board
>>> hasattr(board, "SPI")
True
>>> hasattr(board, "PANCAKES")
False
>>>  
simple pulsar
#
>>> import board
>>> hasattr(board, "SPI")
True
>>> hasattr(board, "PANCAKES")
False
>>> hasattr(board, "CREPES")
True
manic glacierBOT
#

@tannewt One more post before happy hour. (us retirees can start happy hour anytime we want)
My increment and deep sleep test has worked without PowerON problems for over 261 minutes. That's higher by a lot from what I remember.
I also put the new firmware.uf2 onto my other Metro that is setup for remote temperature humidity logging. That system post everything via mosquitto/ nodered to an influxDB database. I include the alarm.memory loop counter in that posting. It up to 130 right now...

tidal kiln
#

mmmmmm.....crepes...

onyx hinge
gloomy shuttle
#

@tidal kiln any more thoughts on the adafruit_nunchuck library. Are you happy with the latest approach you purposed? If so, I would like to get moving on the other extension controllers like the Classic Controller, Guitar, etc. Also, I have several questions about implementation (e.g. this library vs community bundle library.

tidal kiln
#

hey. haven't had a chance to look at status quo today.

#

just read the thread

gloomy shuttle
#

No problem. Just thought I would check here.

tidal kiln
#

looks like you're getting OK performance with the classic controller now?

gloomy shuttle
#

Yes, using the values property works the best. The do_read with the other functions makes it pretty clean and only requires one i2c transaction.

tidal kiln
#

ok. cool. then i think now we're just working details of how to code it. like what you're asking about _buttons() etc.

#

but the basic approach seems to be working

idle wharf
#

Should dir(library) be sorted the way it is in CPython ? That might be a MP optimization now that I write this...

#

They don't mention it in their docs

tidal kiln
#

@gloomy shuttle added some comments over there

manic glacierBOT
#

This will allow microcontroller.cpu.temperature, etc. to work properly on an RP2040 or other multi-cpu chip. It will default to the values for cpu 0. In addition, it adds microcontroller.cpus, indexed by cpu number, to allow access to the values for other cpus (for example, microcontroller.cpus[1].voltage) Note that microcontroller.cpus is only added for chips where CIRCUITPY_PROCESSOR_COUNT is defined to be > 1.

idle wharf
clever wren
#

a few weeks ago I recall LadyADA wanting to know what projects people are wanting to do that can't be done with the current version of Circuit python. so that they knew what the community wanted to use Circuit python for. I tried to find where to send my input but couldn't find where to send/give my feed back.

fossil gorge
# clever wren a few weeks ago I recall LadyADA wanting to know what projects people are wantin...

Here's the blog post about it: https://blog.adafruit.com/2021/01/01/where-should-circuitpython-go-in-2021-circuitpython2021-circuitpython/

To sum it up, post it somewhere - GitHub Gist, blog post, tweets, Adafruit Forums, etc. Tag it with #CircuitPython2021 and email a link to it to circuitpython2021@adafruit.com

Adafruit Industries - Makers, hackers, artists, designers and engineers!

As 2021 starts, let’s take some time to share our goals for CircuitPython in 2021. Just like past years (full summary 2019 and 2020), we’d like everyone in the CircuitPython community to cont…

gloomy shuttle
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
gloomy shuttle
#

What is the proper way to indicate a method is deprecated in a library?

cedar moth
#

Hi, I just submitted a PR on Adafruit_CircuitPython_DisplayIO_SH1107 and the checks failed on the Pre-commit hooks with the following error:

#

I don't think this is related to my code and wasn't sure how to handle it?

gloomy shuttle
#

Mine just did that for the first time today too, so I am curious as well

cedar moth
#

Glad it isn't me then... this is my first PR so I figured I probably did something wrong!

idle wharf
#

@cedar moth try changing latest

-   repo: https://github.com/python/black
    rev: latest
    hooks:
    - id: black

to 19.10b0
in .pre-commit-config.yaml

You didn't break it... but you can fix it 😉

#

Actually use "stable"

cedar moth
#

I will try, thanks for pointing me in the right direction.

idle wharf
idle wharf
#

I'm also doing Github actions stuff for work today... might as well do them for CP too 😉

gloomy shuttle
idle wharf
#

SAK, I told you to use stable because that was the value in Nunchuk which I assumed was working... give me a few minutes to read the docs 😉

cedar moth
#

OK 🙂 Thanks for the help!

manic glacierBOT
idle wharf
#

It is 6:20pm Pacific so people might not be around...

cedar moth
#

Understood, I am Pacific time as well

idle wharf
#

@cedar moth you could try the latest versions to see if it works 😉

cedar moth
#

OK, will do that now.

#

@idle wharf This is my first PR so just want to be sure, would I make the changes to .pre-commit-config.yaml and then commit it like any other changes in my PR?

idle wharf
#

Yes, edit that file, commit it your branch and the PR will see it automatically and the Github action will run again.

#

your same branch

cedar moth
#

cool, thanks! I will report back when it is done...

idle wharf
#

It failed but it failed because it found issues

#

So that's good

cedar moth
#

Yes, got past the previous error, thank you @idle wharf !

#

I feel a little weird updating the license text, is that appropriate? I would use the text from a file that is passing, but am not sure if that is overstepping my bounds since it is Adafruit code?

idle wharf
cedar moth
#

I have to say, I am learning a ton on my first PR... thanks for all the hand holding @idle wharf , I appreciate it!

idle wharf
#

I see in another repo those files have

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

You can add that too @cedar moth

cedar moth
#

Will do it now...

idle wharf
#

Thanks @cedar moth !

trim elm
#

@idle wharf looking now, it won’t load on mobile. But if they’re just missing the copyright, then just add it to the top of the files

idle wharf
#

@trim elm No worries... I think we're close. Do you know which version of black and reuse-tool is preferred? pre-commit is unhappy with stable and latest.

trim elm
#

@idle wharf So I think I actually forgot to add the licenses like I did in other libs. If you feel comfortable running pre-commit and adding licenses, go ahead, but if you don't, I'll do it tomorrow.

idle wharf
#

I think SAK is doing that right now

trim elm
#

Ok. Sweet. I should be reasonably available the rest of the night so feel free to ping me with any more questions

idle wharf
#

Actually @cedar moth, looks like all these files need to be updated.

The following files have no copyright and licensing information:

  • .gitignore
  • .pylintrc
  • examples/displayio_sh1107_game_of_life.py
  • examples/displayio_sh1107_random_motion.py
  • examples/displayio_sh1107_simpletest.py
#

If you don't want to do that, that's fine too 😉

cedar moth
#

I just got them all and resubmitted 🙂

idle wharf
#

💥 Boom ! Nice !

cedar moth
#

Wife just got dinner ready, will check back in a little bit to get this wrapped up.

idle wharf
#

When you're wanting to continue: Add a blank line to the end of .gitignore
@trim elm It also failed on black. I thought black would just change all files and pass.

#
black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted /home/runner/work/Adafruit_CircuitPython_DisplayIO_SH1107/Adafruit_CircuitPython_DisplayIO_SH1107/examples/displayio_sh1107_random_motion.py
reformatted /home/runner/work/Adafruit_CircuitPython_DisplayIO_SH1107/Adafruit_CircuitPython_DisplayIO_SH1107/examples/displayio_sh1107_simpletest.py
reformatted /home/runner/work/Adafruit_CircuitPython_DisplayIO_SH1107/Adafruit_CircuitPython_DisplayIO_SH1107/setup.py
All done! ✨ 🍰 ✨
3 files reformatted, 3 files left unchanged.
trim elm
#

@idle wharf So black has to be run locally for it to pass. The command that runs on the CI just checks the files but doesn't actually modify them

idle wharf
#

@trim elm Gotcha... that makes sense now that I think about it.
so SAK should just run black .

trim elm
#

I'd personally recommend just installing pre-commit through pip and running the whole thing with pre-commit run --all-files

#

I'm honestly not sure. I think we may have moved to doing that (running black .), but the safest bet would be to run black --target-version=py35 .

idle wharf
#

Kewl.. @cedar moth when you're back. I'm a nightowl if you want help. Thanks @trim elm !

fossil gorge
#

You can also setup pre-commit to run as a pre-commit hook on your local repo, to get that feedback as early in the process as you can

tulip sleet
#
pip3 install pre-commit
cd your-repo
pre-commit install  # do this in each repo
#

This will save you pushing multiple "fix" commits to the library

#

you may need pip3 install black ,etc. if you don't already ahve it

fossil gorge
#

Just make sure you use Python3/Pip3

#

in case you have python around that's calling to python2

tulip sleet
#

oh, and pylint

#

eventually we will document this in the "contributing libraries" guide

cedar moth
#

@idle wharf I am back and just got caught up. I thought I had my IDE setup to run Black automatically, but it appears to be doing it to only Python files, sorry.

cedar moth
#

I have Pylint and Black installed and my Python version is good (no 2.x lurking anywhere), so I will install Sphinx and pre-commit and try following the instructions above.

idle wharf
#

Try it without Sphinx first. I don’t think it’s required for pre commit.

#

To build locally yes. Hugo may know.

fossil gorge
cedar moth
#

Unfortunately I just realized that things are never simple... my Python environment is an Anaconda environment and I just checked that Pip doesn't play well with Anaconda and the pre-commit package isn't available through Anaconda.

tulip sleet
#

@fossil gorge I would rather just list things for people to install. A virtualenv is yet another complication, and black, Sphinx, and pylint are all things people might install for themselves anyway.

idle wharf
cedar moth
#

I use Anaconda for work, I can look into setting a different environment up for this but I am trying to figure out if it is a rabbit hole I should go down...

idle wharf
#

@cedar moth only if you want to.

tulip sleet
#

at one point we had a vagrant environment people could use, but it aged badly, and was more trouble to set up than to just use vanilla setups

fossil gorge
idle wharf
#

@cedar moth one of the library reviewers or adafruit folks will look at that repo and get it spiff’d up.

cedar moth
#

I am happy to help if I can, but I am starting to feel like some of what I would need to do might start infringing on Adafruit standard operating practices since it isn't just my code I am starting to muck with?

tulip sleet
#

i understand that a prepackaged thing is nice, but if we were to do that, then a self-contained dev environment with everything (e.g. the tool-chain too) might make more sense. However, everyone is different. The vagrant env depended on virtualbox, and getting that installed properly was more work than just saying "start with a clean system"

#

the python environment on Macs is enough of a nightmare, and the BIg Sur security lockdown is also a complication. A clean Ubuntu is a really good place to start.

gloomy shuttle
#

I think I have sorted out the pre-commit stuff, but now I am running into a build docs issue. adafruit_nunchuk.Nunchuk:6:Unexpected indentation.

jaunty juniper
#

I did debug builds on my mac using docker (and virtualbox) and a clean Ubuntu, it really helps not having to bother with installing more stuff on the mac and screwing with python and whatnot

fossil gorge
blissful pollen
fossil gorge
#

Probably should just setup a dedicated Linux box or VM of some flavour for this work.

cedar moth
#

@blissful pollen Agreed, this is my first PR and everyone has been awesome... and I am learning a ton.

gloomy shuttle
#

I am on not on Big Sur, but I am using a Mac as well and just set up a custom virtual environment for CP stuff and installed everything needed there and that seems to be working pretty well for me.

tulip sleet
#

@gloomy shuttle you removed some blank lines whic you might need to put back.

gloomy shuttle
#

Yeah, when I copied something they got removed. I have them added back in my local repo but the build docs is failing locally now with the spaces added back.

cedar moth
#

I am almost 100% certain I have run Black on the three example .py files in the repo I am working on but are failing the Black test in the PR. I don't see any specific error in the test, just that Black is reformatting those three files. On my end it doesn't seem like anything needs changing?

fossil gorge
#

Could also be whitespace at the end of a line, or end of the file

cedar moth
#

I think I may have figured it out looking at what Black did on my end in the commit. What is the maximum line length standard for Adafruit?

idle wharf
#

That is provided by black

cedar moth
#

We use 120 characters for my work and that is what I have black set to. I see a case where it reformatted a statement in one of the example .py files that was originally three lines into a single line.

#

I believe the black default is 100 characters?

tulip sleet
#

we use black --target-version py35 and use the default length

idle wharf
#

If you let black format the files and then commit them. I think you’ll be good. Just don’t edit the files again

cedar moth
#

I just looked, black defaults to 88 characters

#

About the ONLY parameter you can muck with in black is the max line length, and I had that set to 120 for work. Let me change it back and re-blacken the files and see what happens.

gloomy shuttle
cedar moth
#

Looks like the line length was the problem for the three examples, sorry about that everyone. Now onto what is wrong with setup.py...

cedar moth
#

There were a number of Pylint errors and I seem to still be having a Black issue, the PR check says Black is reformatting the setup.py file but I can't seem to get Black to find anything on my end.

#

I am trying to get my IDE to pass the -t py35 parameter danh said is used to see if that could be the issue.

idle wharf
#

have you tried running black from the command line and doing the commit also from the command line ?

#

If your IDE's settings are the issue... that would work around that

cedar moth
#

I think I need to do that at this point... trying one last thing and then will resort to the command line.

idle wharf
#

this is the change it is making when it runs

    install_requires=[
        "Adafruit-Blinka",
    ],
#

before its all one line. After is ^^^

cedar moth
#

How did you see that Patrick, by running it on your local system?

idle wharf
#

Command-line 😉

#

yes. I also ran pre-commit locally. That is the only thing not passing.

#

with that change, all looks clear

cedar moth
#

So weird, I can confirm that black working on my end and reformatting the file when I put in some extra blank lines and spaces at the end of lines, but it isn't making that change.

idle wharf
#

black --version
black, version 20.8b1

#

I think but I am not 100% sure that pre-commit is running black . not with a target version.

#

It is true in some adafruit repos there are checks that run with that --target, but I don' think precommit does.

#

CP team just started rolling out pre-commit

cedar moth
#

I am running 19.10b0. I am going to have to setup a dedicated "working on Adafruit open-source" environment on my system since the Anaconda version environment I use for work isn't being flexible. It won't let me update Black beyond the version I have now.

#

I have manually made the change to setup.py and am going to push, fingers crossed!

idle wharf
#

🤞

#

I think you nailed it !

cedar moth
#

Whoever reviews my PR is going to need a beer... or three 😐

idle wharf
#

lol... No I think your original changes are quite easy to review.
I made 7 commits today to a work repo to get github actions to set a timestamp properly... it happens. 😉

cedar moth
#

Hey thanks for all the help and support Patrick, I would have been dead in the water on that first error if it wasn't for you!

idle wharf
#

Glad to help... people help me too

#

precommit passed !

cedar moth
#

I think the biggest thing I have learned is to just take the bull by the horns on this stuff (while still knowing my place). I didn't realize how much ability to just dig into things and fixing them was an option, I thought just dealing my my code was the limit.

idle wharf
#

You got further this time. Its building the docs

cedar moth
#

Looks like Sphinx completed with Error Code 2

#

Unexpected indentation... let me see what I did there, I have never used Sphinx before.

idle wharf
#

RE: Environment. If you're on MacOS. I really like pyenv to manage python environments

cedar moth
#

I got too fancy with the docstring formatting and overly indented the five numbered items I think.

#

I am on Windows

idle wharf
cedar moth
#

Or four numbered items, in the sleep method.

idle wharf
#

Oh look... https://pypi.org/project/pyenv-win/ I've never used it

cedar moth
#

I will look into virtualwrapper. Anaconda works great for our work but it does tend to lag behind on release versions. On the other hand it is pretty much rock solid. I am using Visual Studio Code for the IDE and have installed the Python extension for VS Code. That should give me a separate environment from Anaconda that I can install all the required functionality into without affecting my Anaconda environment.

gloomy shuttle
idle wharf
#

Pyenv lets you install Python, Anaconda, ... all the things side by side

idle wharf
gloomy shuttle
#

thanks

idle wharf
#

The reviewer can always rebase and merge if they want..

#

@cedar moth... I bet it passes this time !

cedar moth
#

Let's hope they aren't picky... I am going to have 50 commits for just adding about 15 lines of code to a driver! 😫

idle wharf
#

And helping fix something that was broken

cedar moth
#

My fingers are sore from all the crossing! This is commit #9, though to be fair only three are directly related to my proposed addition.

idle wharf
cedar moth
#

Holy crap!

#

My first PR ever... that was a learning experience! THANK YOU @idle wharf !!!

gloomy shuttle
#

@idle wharf do you know the proper way to indicate a method is deprecated in a library that you don't want to remove yet?

cedar moth
#

@idle wharf If you live in the Seattle area I will buy you a beer after this COVID crap is behind us. I REALLY appreciate all the help and patience.

idle wharf
#

I do live in Seattle... in Ballard.

cedar moth
#

I am in Gig Harbor 🙂

idle wharf
#

@gloomy shuttle I don't know of any official way other than that when they release the change, the Major version number should be incremented. There was a liibrary where the name of the library and the class name of he object didn't match. I fixed that and that's the only thing we did. Up the Major version and put a note in the release. In the CPython world there's all kinds of ways and python decorators like @deprecated. In CP its all handled in the docs.

idle wharf
#

OK... going to be AFK for a while. Congrats @cedar moth on your first PR !

cedar moth
#

Night, thanks again!

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

The fix is only used for less than 1ms during enumeration and power on, for CircuitPython it’s unlikely you’ll have another serial port running — and another serial port is the main trigger for the bug. Also for basic GPIO it’s probably not an issue at all, it would only really be a problem if it’s assigned to a peripheral.

The fix will not output anything to the pin, but it will stop the output path from an active peripheral for a short period. The function select changes both the output ...

manic glacierBOT
fossil gorge
manic glacierBOT
#

Build CI test is failing for the trinket_m0 ja translation with:
`Build trinket_m0 for ja (clean_build) took 34.80s and failed
make: Entering directory '/home/runner/work/circuitpython/circuitpython/ports/atmel-samd'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR updated

188168 bytes used, -8 bytes free in flash firmware space out of 188160 bytes (183.75kB).
10060 bytes used, 22708 bytes free in ram for stack and heap out of...

#

Builds OK on my local machine:

`$make BOARD=trinket_m0 TRANSLATE=ja

Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR updated

186896 bytes used, 1264 bytes free in flash firmware space out of 188160 bytes (183.75kB).
10060 bytes used, 22708 bytes free in ram for stack and heap out of 32768 bytes (32.0kB).

Converting to uf2, output size: 374272, start address: 0x2000
Wrote 374272 bytes to build-trinket_m0/firmware.uf2
`

manic glacierBOT
#

I think the refs are ...

jepler@eric:~/src/circuitpython$ git diff 6.1.0-beta.1 6.1.0-rc.0 -- extmod/ulab/
diff --git a/extmod/ulab b/extmod/ulab
index 8242b8475..c4b06e419 160000
--- a/extmod/ulab
+++ b/extmod/ulab
@@ -1 +1 @@
-Subproject commit 8242b84753355433b61230ab6631c06e5ac77f35
+Subproject commit c4b06e419f3d515478b05bb8ce03ebdb29cddec4

there are a lot of ulab commits in that range, because CircuitPython had fallen behind.

$ git rev-list 8242b84753355433b612...
marble hornet
#

@idle owl I think there is an error is the lc709203f guide, here
the class should be called LC709203F but is called LC709023F with the 0 and 2 switched.
Is there a public facing interface for the community to pr changes?

(I pinged you as the guide lists you as the author, idk if that's the usual method?)

Adafruit Learning System

Keep track of when to charge your batteries!

manic glacierBOT
manic glacierBOT
lapis hemlock
onyx hinge
#

@lapis hemlock thanks for the amazingly quick bug fixing

lapis hemlock
#

@onyx hinge I have noticed that the github checks run much faster. Is it because you modified the script a couple of weeks ago, or has github in general become faster?

#

I am talking about a factor of 3-4, which is significant.

onyx hinge
#

I dunno, could be

lapis hemlock
#

I am not complaining, mind you!

onyx hinge
#

the adafruit/circuitpython checks are still taking quite some time

#

looks like #299 was quick because it failed

#

some kind of github checkout problem

tulip sleet
#

@onyx hinge I can finish this off if it runs past your break start

onyx hinge
#

I'm around until at least noon

#

and i'm not going far on this week off

lapis hemlock
onyx hinge
#

I think it's just github being github..

lapis hemlock
#

I can compile the code locally.

onyx hinge
#

@lapis hemlock yeah I think everything is fine, the build failed for some github reason not a real reason

#

@tulip sleet do you know if there's a reason we're using actions/cache@v1 instead of @v2 ?

lapis hemlock
#

@onyx hinge Thanks for the info!

manic glacierBOT
onyx hinge
#

I thought maybe there was a way a "workflow_dispatch" could be used to clear an actions cache but that does not appear to be the case.

manic glacierBOT
#

@aallan I think you are assuming that USB is init on power up. That's not generally true though because we'll start to see battery powered boards where USB is connected later. (CircuitPython is likely to restart user code after USB starts though so the impact will be short lived.) I think the fix could be improved to reset the pin function back to the original value. As-is I don't think it changes it afterwards.

#

Hi @netroy, an issue with this PR was that when it expanded the timeout system to support non-blocking calls, it inadvertently set the default timeout of a socket to 0 instead of the Cpython default of None (ie infinite timeout). #4049 will change back to None, but until then you can use settimeout(None) to extend the timeout yourself. I think that should resolve your problem, but feel free to follow up with an issue if it doesn't.

lone axle
#

@marble hornet, @idle owl There isn't a full PR system for learn guides. There is a Feedback? Corrections? at the bottom of the navigation links on the left. The guide authors can see the messages reported in there. In the specific case of this fuel gauge I think some portion of the library repo had the incorrect name for a while and was just recently spotted and corrected. That's likely why the guide page is now "out of sync" with the library.

lone axle
#

I had a free minute waiting on a big file to move around, and I have access to edit the guide page so I went ahead and fixed the name of the class. Thanks for reporting @marble hornet if you have a second try checking again and verify it looks good now.

marble hornet
#

@lone axle looks good.

lone axle
#

Thank you

manic glacierBOT
onyx hinge
#

it ensures any successful build updates the cache, but I'm not sure that really helps once a bad cache can be retrieved..

idle wharf
#

@marble hornet , @idle owl Just a heads up, if I remember correctly, the lc709203f guide change request was submitted when I did the PR to fix the name in the library itself. So it is in the queue. My guess is the Adafruit team was busy on RP2040 at the time.

#

And I see @lone axle fixed it... nvm. 🙏

manic glacierBOT
manic glacierBOT
#

sys.platform is missing from the raspberrypi ports.

I started to make a PR, with #define MICROPY_PY_SYS_PLATFORM in mpconfigport.h. However, it seems to require some thought. According to the docs for sys.platform:

For baremetal ports it is an identifier of the chip on a board, e.g. "MicroChip SAMD51". It thus can be used to distinguish one board from another.

(This is exactly what I want it for... to distinguish between boards in the Gameduino driver and assign the...

ionic elk
#

Could a python-y person explain what MP_QSTR___del__ is within shared-bindings? Something is automatically closing every socket before I get to it on a soft reboot and I think this is it, but I'm not 100% sure

slender iron
#

that could be the finalizer

ionic elk
#

googles finalizer

slender iron
#

it requires you allocate the memory stating it has a finalizer

#

basically runs when the memory is cleaned up

manic glacierBOT
ionic elk
#

gotcha, makes sense

#

well, now I feel foolish for engineering this whole automatic cleanup system that does nothing

slender iron
#

np 🙂

ionic elk
#

Why don't we just use finalizers for every kind of hardware object that gets reset? Seems like this could have been used for UART, I2C, PWM, etc

#

instead of these search and shutdown reset_all functions

slender iron
#

that's a good question

ionic elk
#

I didn't even know they were a thing haha

#

thought manual was the only way

slender iron
#

finalizers are weird to use because you don't know when they run

#

although we do shutdown the heap well so they should run then at least

ionic elk
#

I just found it because I discovered something was running socket.close on soft reboot, only on my open sockets, before it hit reset

tulip sleet
#

they are not so useful on the python side of the world, because when they run is indeterminate.

ionic elk
#

so my manual reset would look for things to do, and not find any

#

@tulip sleet does that apply here? because I have several very clunky reset_all functions that would be made much simpler if they worked like socket does here

tulip sleet
#

no, because they are more guaranteed to run. But if someone pressed reset or there was a crash, they would not be run. I'm not sure that's an issue

ionic elk
#

I mean I'm glad to get rid of this socket tracking system - it was storing things in an array and was super messy since Sockets could have variable indexes

tulip sleet
#

it's just that in the python world, people don't use them a lot

ionic elk
#

They won't run on a crash? That... might be bad? I dunno.

tulip sleet
#

are the reset_all() run on startup, or do you start from a known state?

ionic elk
#

they're all run in reset_port()

#

which is run in cleanum_after_vm

tulip sleet
#

is it run at the beginning of main() too?

ionic elk
#

and right after board_init yeah

tulip sleet
#

so you need them anyway?

ionic elk
#

so yes

#

I guess so

#

I mean for most chips having the reset at startup is probably unnecessary

#

I can't think of any cases in STM32 land where we'd need it. Maybe for weird edge cases somewhere

#

Should I keep my double-check system for closing Sockets in the event of a crash or just get rid of it?

tulip sleet
#

but the reset at the beginning is truly everything, so you don't need to keep track.

#

sockets is different, they are not hardware, unless you reset the whole chip.

#

in other words there is no socket state to reset on power-on

#

unlike, say, I2C state or pin state or whatever

#

but if you can do socket reset based on finalizers, that sounds nice. I would just worry about an error condition or some crash that left you without a Socket object to finalize and reset. The finalizer depends on there being a Python object.

ionic elk
#

I didn't do it, it was there already - I just found out about it after I realized the stuff I made wasn't actually doing anything haha

#

I'm currently dealing with some kind of issue where LWIP thinks there are more file descriptors in use than Python does

#

But I think that's something else

#

I wish there was some kind of global LWIP function that would give me every active file descriptor, or guarantee they were all closed, or something, but I don't see anything to that effect.

tulip sleet
#

i know zero about it, sorry

manic glacierBOT
lapis hemlock
manic glacierBOT
manic glacierBOT
#

I've been working on this more in my #4049 PR build. Here are the results I get, with extra debug information added from the C level:

None
ip 192.168.10.117
Init IO
GetIO
New Socket:60 errno:9 Bad file number
New handle index:0
Wrapping socket:60
Counter: 0
Sending to Adafruit IO...
Data sent!
Counter: 1
Sending to Adafruit IO...
Error sending data - try again  Failed SSL handshake
Counter: 1
Sending to Adafruit IO...
New Socket:62 errno:9 Bad file number
New handle inde...
#

wifi.radio.connect() call seems to improperly raise a ConnectionError: No network with that ssid even when the SSID is found by a WiFi scan.

Platform: Adafruit CircuitPython 6.2.0-beta.1 on 2021-01-27; Adafruit MagTag with ESP32S2
Code

import ipaddress
import ssl
import wifi
import socketpool


# Get wifi details and more from a secrets.py file
try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there...
ionic elk
#

@slender iron you want me to make that hotfix for the default socket timeout?

slender iron
#

I think that'd be best

#

small fixes go faster on their own

manic glacierBOT
#

NO AP FOUND is an "Espressif-specific Wi-Fi reason-code: when the station fails to scan the target AP, this reason code will be reported." there is the explicit scan you do in your code, but the esp32-s2 also scans implicitly when connecting, there could be a bug in the IDF. Just curious... does it also happen if you don't do an explicit scan before connecting (ruling out a bug in our stop_scanning_networks)?

#

PR #3854 accidentally set the default timeout of the Socket module to 0, which does not match Cpython's default of None (as in, never time out). This was causing some user programs to throw unexpected EAGAIN errors. Additionally, when Socket was placed in non-blocking mode (with a timeout of 0), even successful calls from some functions would result in ETIMEDOUT. This PR fixes both issues.

Resolves #3836

gloomy shuttle
#

@tidal kiln thanks for all your help and back and forth on that nunchuck PR.

tidal kiln
#

np. thanks for not giving up!

gloomy shuttle
#

The next question I have is if I want to add support for the other extension controllers where should that go?

#

individual Community bundle library for each based on this one, added directly to this one, or create a new single community bundle library with all of the extension controllers?

tidal kiln
#

good question. not something i want to decide myself. so we'll see if we garner some discussion here and see what makes the most sense.

thorny dove
#

Hi everybody online! Good evening from Lisbon. I am in need of help. Wrote a CP script reading uart.readline() into a bytearray() buffer, to receive GPS AV400 sentences (short messages) from MSFS2020. Printing to the REPL window is OK, but printing to a 20x4 character LCD is garbled with non-ascii characters it are '\x00' in the bytearray(). I tried all sorts of x.decode() or struct.unpack but I did not succeed in either: filtering unwanted values or converting them. I have two screenshots. One with the output to the REPL and a second to the LCD. Anyone that can help me out please?

tidal kiln
#

hey @thorny dove welcome! can you please ask this in #help-with-circuitpython . this channel is more for the core firmware development questions.

thorny dove
#

@tidal kiln Hi, yes, sorry, I forgot to choose that group

tidal kiln
#

all good. no worries. thanks!

manic glacierBOT
#

With settimeout -1 it give other error EATIMEOUT or something and it did print out the client IP address.

I then try with #4049 (without settimeout) and now it proceeds further:

code.py output:
192.168.43.83
Connected by ('192.168.43.17', 22723)
bytearray(b'Hello, world\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\...
#

I think this might actually be a Requests library error after all? Does this line seem like it could be a potential socket leak? The debug output suggests that sockets are not being closed properly - I think what's happening here is that the first call creates a new socket, then the second one tries to re-use that socket and fails, but doesn't close it. I still don't know why the sockets are incrementing by 2 internally, though...

manic glacierBOT
manic glacierBOT
hoary moat
#

@slender iron talking about QuadSPI in deep dive reminded me of the driver I wrote a decade ago. At the time a 4-channel digital O-scope was kind of a luxury. And one that decoded bits to ASCII was $$$. Fun times.

manic glacierBOT
manic glacierBOT
timber mango
#

it is impossible to install micropython on MATRIXBOOT (matrix portal m4).

manic glacierBOT
#

using board.ADC(4) throws an error in Mu. Am attempting to convert the ADC temperature example on page 13 of the Raspberry Pi Pico Python SDK to CircuitPython. Have also posted in the Adafruit Forum and Discord

`import machine
import utime

sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)

while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706)/0....

lone axle
#

I will be streaming some CircuitPython library development this morning if any one is interested in watching along. Will drop links in #live-broadcast-chat in just a moment.

manic glacierBOT
#

Hello,

I designed a custom board prototype based on ATSAMD51G19A and I try to build CircuitPython for it.
I can build without problem with external flash enabled, but I need a build with internal flash too.
When I try to build with INTERNAL_FLASH_FILESYSTEM = 1, I get an ld error :

arm-none-eabi-gcc -o build-0_m4/firmware.elf -DCIRCUITPY_FULL_BUILD=1 -DCIRCUITPY_AESIO=0 -DCIRCUITPY_ANALOGIO=1 -DCIRCUITPY_AUDIOBUSIO=0 -DCIRCUITPY_AUDIOIO=1 -DCIRCUITPY_AUDIOIO_COMPAT=1 -DCIRCUITPY_...
ionic elk
#

This line is messing up my work in Requests: del self._socket_free[sock]. The exception it throws is weird, Error sending data - try again <SSLSocket>, instead of something like Error sending data - try again Failed SSL handshake, so somehow it's returning a class as an exception? And then every call I make to requests from that point on returns the same error message

#

Context:

def _close_socket(self, sock):
    print("REQ _close: attempt to close")
    sock.close()
    print("REQ _close: closed")
    del self._socket_free[sock]
    print("REQ _close: deleted")
manic glacierBOT
ionic elk
#

@tulip sleet would you have any ideas about this? the sock.close() works, but then this wacky delete error blows up the whole program

tulip sleet
#

there is no guarantee that using a del statement will execute the finalizer right away. But I don't know why you would see that error.

ionic elk
#

The error, at least, comes out right away, because the print statement right after the del is never reached

#

Ie I never see print("REQ _close: deleted")

tulip sleet
#

if you catch and print the exception, what is it?

ionic elk
#

That's what's happening

#

code.py code is except Exception as e:, print("Error sending data - try again ", e)

#

and it prints Error sending data - try again <SSLSocket>

#

I could try catching the error locally

#

yeah same thing:

try:
    del self._socket_free[sock]
except Exception as e:
    print("explode!")
    print(e)

literally prints
<SSLSocket>

tulip sleet
#

no, i have no idea 🙂 . I'd set a breakpoint on mp_raise or whatever to see what's being thrown from where

#

if the object has been returned to the heap, then maybe it's a stale pointer

ionic elk
#

bonus info, in shared bindings I have { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&ssl_sslsocket_close_obj) }, but I know it never actually hits my sslsocket_close function because it would throw messages if it did

#

@tulip sleet sorry to keep bugging you, I'm just weirded out by this python stuff. So, print(self._socket_free) returns {<SSLSocket>: False}? Does that give you any clues to what this might mean?

#

_socket_free is a dict, so is this an object being used as a key?

tulip sleet
#

yes, exactly, that's a one-element dictionary

ionic elk
#

so del self._socket_free[sock] is trying to do what, delete the key or the value?

manic glacierBOT
tulip sleet
#

it removes the entry

#

it removes the key-value pair

ionic elk
#

I've found that attempting to print(self._socket_free[sock]) causes an immediate exception returning <SSLSocket>

manic glacierBOT
ionic elk
#

Maybe it doesn't like the objects being compared in that way? I'd like to put in a PR to Requests that fixes this, but this is all feeling super weird and out of my usual domain

tulip sleet
#

are SSLSockets hashable? They need to be hashaable to be used as dictionary keys.

ionic elk
#

I don't know what that means, unfortunately

tulip sleet
#

it means they have a hash() function implemented __hash__ exists

ionic elk
#

Hmm, that sounds promising. Maybe when porting over Socket to SSLSocket I neglected a hash-related thing

tulip sleet
#

did the old code have a dictionary also?

#
//|     def __hash__(self) -> int:
//|         """Returns a hash for the Socket."""
//|         ...
//|
STATIC mp_obj_t socketpool_socket_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
    switch (op) {
        case MP_UNARY_OP_HASH: {
            return MP_OBJ_NEW_SMALL_INT(common_hal_socketpool_socket_get_hash(MP_OBJ_TO_PTR(self_in)));
        }
        default:
            return MP_OBJ_NULL; // op not supported
    }
}
#

implemented like that ^^

#

i can look at your PR

#

or is it merged already?

#

#4049, right?

ionic elk
#

Yeah

tulip sleet
#
//|     def __hash__(self) -> int://|         """Returns a hash for the Socket."""//|         ...//|
STATIC mp_obj_t ssl_sslsocket_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
    switch (op) {
        case MP_UNARY_OP_HASH: {
            return MP_OBJ_NEW_SMALL_INT(common_hal_ssl_sslsocket_get_hash(MP_OBJ_TO_PTR(self_in)));
        }
        default:
            return MP_OBJ_NULL; // op not supported
    }
}
manic glacierBOT
ionic elk
#

Are hashes supposed to be unique and unchanging? Because right now they're derived from self->num which is going to go from a viable integer to -1 whenever the socket closes. Which it does, right before this del happens

tulip sleet
#

that is bad 🙂

ionic elk
#

lol

#

not my code!

#

What should they be returning?

manic glacierBOT
ionic elk
#

Should I pass the pointer for the object, or something? That won't be changed until the object itself is destroyed

tulip sleet
#

that is often used for a hash. If the object moves, then that's not a good hash. I would take a look at some other hash functions in common-hal

#

it's not long-lived, is it? In general you have to be careful when computing hashes on mutable objects

ionic elk
#

I have no idea, sorry. The lifecycle of a socket, best I can tell, is that it's created as a socketpool_socket_obj_t, which is then given a ->num attribute corresponding to an internal LWIP socket. When you call sock->close(), num is set to -1.

tulip sleet
#

so the same issue may have occurred on regular sockets.

#

this is a bug. Is there any immutable value in the socket struct?

ionic elk
#

if it's a TLS socket, the socketpool_socket_obj_t is stored as a member of an ssl_sslsocket_obj_t, and LWIP also makes a second secret socket for MBED TLS that persists until the TLS shutdown functions are called

#

an immutable unique value in socketpool_socket_obj_t? no, not really, not at the moment.

#

I could make one, I guess?

#

I've never seen another hash call in common-hal, at least not in the modules I've worked on

#

so this is all kinda new to me

#

So you're saying the address of socketpool_socket_obj_t is not necessarily immutable, it could get moved around for some reason

tulip sleet
#

if it were long-lived, or if we implemented a compacting gc, yes. And the idea is that if two objects are ==, then their hashes are the same. We don't even have an == operator here. This use of dictionaries for sockets is not a good idea if these objects aren

#

aren't nicely hashable

#

even, if say, we remembered the original num, and used it as a hash, then when something gets looked up in the dictionary, and there are two objects with the same hash, then we try to compare them to see if they're really the same

ionic elk
#

I don't know when if ever a socket could be compared to another with ==

tulip sleet
#

they would just not be equal, because it defaults to comparing the addresses

ionic elk
#

If we remembered the original num and used it as a hash, could you have the scenario where a socket object is created, closed, and then another socket object is created again with the same hash since LWIP will reuse the number, and they'd be considered equivalent?

#

that would be bad, right?

tulip sleet
#

well, no, because there's no __equal__ defined. But it's an abuse of dictionaries to do this. Is there something else about a socket that's immutable, like the port number or something? I have defined a few hash functions, but hey are based on something immutable in the object, like for instance it's a BLE UUID or a BLE address, both of which don't change after creation

ionic elk
#

Are sockets in Cpython hashable?

tulip sleet
#

i have no idea, i'd have to look

ionic elk
#

I don't see any references to it in the documentation

#

*documentation, typo

tulip sleet
#

no, they aren't

ionic elk
#

so maybe this just calls for rethinking the code in Requests

#

There are no aspects of Socket I would consider immutable

tulip sleet
#

yes, so what is the dict used for, and is it the only dict?

#

it just says whether it's free or not, right?

ionic elk
#

I'm not a regular Requests contributor so I'm not totally sure, there are two dicts in Session:

self._open_sockets = {}
self._socket_free = {}
#

both use sockets as keys

tulip sleet
#

are those sets disjoint, is a socket either open or free?

ionic elk
#

Are there specific folks who push the development on Requests? We might want to run this by them

#

I don't know, that's internal lingo

tulip sleet
#

Yes, I would open an issue on Requests, that storing sockets in dictionaries is not a great idea

#

does this code come from CPython requests??

ionic elk
#

Yes

#

wait no

#

not Cpython sorry

#

I read that wrong. This is all from Adafruit_Circuitpython_Requests

#

Original issue was an uncaught exception, but solving it brought me here.

manic glacierBOT
#

Yes, but it was long ago when I build 4.x for SAMD21
I just updated the building environment to
GNU ld (2.34-4ubuntu1+13ubuntu1) 2.34 Copyright (C) 2020 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty.
No more syntax error 👍
But now I get region FLASH_FIRMWARE' overflowed by 116560 bytes`
I can see that d...

tulip sleet
#

@ionic elk ok, the issue is that one shouldn't use sockets as dictionary keys. This code was added recently. That shouldn't be done. You can open an issue and cite me as backup. And we should remove the hash function from sockets.

#

in the past there was also a socket pool, but the sockets were the values, not keys. The keys were tuples

ionic elk
#

@tulip sleet looks like @slender iron was the one who added it, he might have justification for it that we don't know about

#

(the hash function, I don't know about the requests part)

tulip sleet
#

I think he added it so he could put them in dicts in requests. I think he forgot that that paritcular hash might change. But it's not a good idea. They are mutable objects that don't have a reasonable hash

#

the idea was probably to do a quick lookup

#

instead of a linear list search or something

ionic elk
#

Ok, this all makes sense. I'm going to go grab some lunch and then I'll come back and write up an issue for the Requests lib

#

thanks for helping me understand all of this! I would never have gotten there without your help haha

tulip sleet
#

if they need a .free or .open state, that could be added as a built-in attribute. np!

manic glacierBOT
tulip sleet
#

@ionic elk I am writing an issue for circuitpython about the hashing, and trying to figure out if there is reasonable solution or not. For user-defined classes in Python, they are hashable: the hash is the id() (which is the address), and equality is defined as whether the id's are equal.

We have had some issues about ids changing from underneath things: I will find that issue

#

i think if we make the hash be the id() that will be OK, though I think it's worth looking at the requests code to see if it's really necessary to have sockets as dictionary keys, since it seems to be substituting for some attributes that could be on the socket objects themselves.

ionic elk
#

@tulip sleet back, that sounds reasonable to me

manic glacierBOT
#

__hash__() was added to Socket so a Socket could be put in a dict, for use in the adafruit_requests library. However, the hash used is not immutable, and changes when the socket is closed.

The hash returned could be id(), to make it immutable.. However, it might be worth looking at whether the use of Socket in adafruit_requests really needs a dictionary. I see two uses: ._open_sockets and ._socket_free. I'll bring this up in an issue in that repo.

Tagging @hierophect o...

tulip sleet
onyx hinge
#

@tulip sleet besides when objects are "moved" to the long-lived heap, I don't know when else an object's address would change

manic glacierBOT
#

@dhalbert as a follow up to our conversation, just noting that returning (mp_uint_t)self for common_hal_ssl_sslsocket_get_hash does solve the keys issue in #4061, as predicted (I don't know if that's how I'm supposed to code it though, can I use id in the shared-bindings layer?). You mentioned you were concerned about other instances where the ID could change unexpectedly, making the hash mutable, were you able to find those issues?

tulip sleet
manic glacierBOT
#

I disabled a lot of modules (almost everything I found in circuitpy_mpconfig.h) but I still have an overflow and undefined references to neopixel :
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: build-0_m4/firmware.elf section.text' will not fit in region FLASH_FIRMWARE' /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region FLASH_FIRMWARE' overflowed by 68472 bytes
/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: firmware.elf.lto.o: i...

#

You are still using gcc9. Upgrade to the gcc10 toolchain, as suggested. That will gain you some (not a lot) of space. Disable CIRCUITPY_ULAB. Take a look at the other disabled modules for similar boards to yours, such as kicksat-sprite.

Note this important change:

# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os

SAMD51 is now normally compiled with -O2, which makes for considerably larger code.

You disabled neopixel_write, which is needed for th...

#

Users have seen some glitches writing NeoPixel strings on SAMD51 with CircuitPython. I took some timings in July 2020 of the NeoPixel one and zero waveforms, both for the Arduino code and neopixel_write. It seems like some SAMD51 times could be adjusted

image

@PaintYourDragon You mentioned recently about the "1/3 - 2/3" rule of thumb for NeoPixels, if I remember right. Do you see m...

#

This turned out to be a 4(!) part issue:

  • The very first problem was that Failed SSL handshake was being mis-reported as [Errno 128] ENOTCONN by send(). That was my bad, it just needed some extra code to check the MbedTLS errors properly.
  • The first "real" problem, which, jerryn was encountering, was that only _SendFailed exceptions were being caught when Requests made a send_request. So when an SSL connection timed out, which was the case for the 60s delay, the resulting `Fai...
ionic elk
manic glacierBOT
#

Revisiting NeoPixel timing is One Of Those Things I’ve Been Meaning To Get Around To But There’s Always More Pressing Issues. The “1/3 - 2/3 rule” isn’t so much a rule as just a hacky thing that seemed to work for Adafruit_NeoPixel_ZeroDMA and Adafruit_NeoPXL8 but isn’t grounded in science, datasheets, or anything else. It might fall apart on really long runs, I haven’t checked.

Because datasheets lie, and because NeoPixel-alikes reshape the signal on the way out, a winning strategy would ...

ionic elk
#

@tulip sleet so this hash from ID trick is just replacing return MP_OBJ_NEW_SMALL_INT(common_hal_ssl_sslsocket_get_hash(MP_OBJ_TO_PTR(self_in))); with return mp_obj_id(self_in);, right?

tulip sleet
#

yes, that's what I was thinking

ionic elk
#

How did you even know about mp_obj_id()? I can't grep it anywhere else

#

certainly looks a lot cleaner

tulip sleet
#

i looked for the implementation of the id() function by looking for QSTR_id, and then following from there.[

manic glacierBOT
ionic elk
#

@tulip sleet it works! Nice.

manic glacierBOT
lone axle
#

@onyx hinge I'm going to tweak the logic in the wrapping just a bit. In this main if statement that decides what happens with each word I think we don't want to set firstword = True in the last else branch:

if firstword:
    partial.append(word)
    firstword = False
    width += wwidth
elif width + swidth + wwidth < max_width:
    partial.append(" ")
    partial.append(word)
    width += wwidth + swidth
else:
    lines.append("".join(partial))
    partial = [indent1, word, ' ']
    width = measure(indent1) + wwidth + swidth
    firstword = True
#

on lines other than the first one this logic actually ends up applying to the second word which makes it "skip" the check to see if the line is too long. As is if the first two words are "too long" they won't get split

onyx hinge
#

I didn't test this scenario, but the intent is that "firstword" indicates it is the first word on a given line. That word needs to be placed on its line, REGARDLESS of whether it's too long (or you could break it based on individual letters instead of words)

lone axle
#

Ah, I see. It will still need to handle that somehow I think.

onyx hinge
#

OK on reflection I think you are right

#

those doubled spaces seem weird

#

see 'em?

lone axle
#

Ah yeah, I do now

onyx hinge
#

firstword must be doing double duty, preventing an extra space. maybe there's a better way.

#

yay I'm glad you are testing this!

lone axle
#

I see. Yep, by removing first word going back to true it makes the first space of the line always end up doubled.

#

we can "start" the new partial with indent1, word (and no space). Then the space gets added in the next iteration before it's word.

#

I think we may have gotten the word-splitting across lines with hyphens in the other wrap function. I'll try to bring in a similar solution to this one.

slender iron
tulip sleet
#

got it

#

i think just using id() will work. I guess you had to have that odd dictionary, though maybe it could just be a list of free sockets

#

@slender iron in CPython, socket.fileno() will return -1 if the socket is closed.

#

that is supposedly the way to tell

ivory yew
#

hah, @tulip sleet closed an issue as I was applying labels

tulip sleet
#

thank you for the the housekeeping 🙂

ivory yew
#

I was there and tried to leave it better than I found it 🙂

#

I'm sad that I haven't had as much time to spend with CircuitPython lately.

#

But I still love y'all.

tulip sleet
#

you are busy!

onyx hinge
#

you know we'll be here when you get back -- take care @ivory yew

manic glacierBOT
#
manic glacierBOT
#

I followed the guide again to use the exact version of the toolchain, and added the optimization flags but I still exceed the allowed size by almost 13 kb

gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region 'FLASH_FIRMWARE' overflowed by 12984 bytes

I disabled more modules than kicksat-sprite but still oversize :(

I also noticed a lot of multiple definitions notices from ld, is this expected?

gcc-arm-none-eabi-10...
atomic summit
#

My own CP repo was way behind so I pulled latest )(main) and thought I better run ./install.sh again just in case, and it hard crashes and brings down my terminal window (macOS 10.15.7)

#

So I went to a different Mac that has never had a CP redo on it before, cloned, ran .install/sh and again it downloaded all of the espressif tool chain stuff and then brought down my terminal window.
Anyone else seeing this? I can't complete install.sh so can't export & build.
I'm about to kill off my fork and create a brand new one... as I REALLY need to build source ASAP...
but I thought I'd ask if this was a know issue before I re-fork

#

I don't have a user called git, so this would have to be one of the submodules? I've never seen this request before.

#

Ok, I killed off my fork and re-forked. Let's hope this one works ok!

atomic summit
#

install.sh still kills the terminal window "at some point"....

jaunty juniper
#

maybe something in the system log would give a hint why

atomic summit
#

it's probably a python version issue

jaunty juniper
#

I'm not sure what can kill a Terminal window, even quitting the shell doesn't

atomic summit
#

so a clean fork fixed those "git user" permission issues...

arctic oasis
#

Does anyone happen to know if Adafruit plans on stocking the USB C version of the TinyPICO?

atomic summit
#

@arctic oasis that's a Q for me, more than Adafruit 😉

#

Right now I'm only doing small production runs of TinyPICO USB-C, so I'm not distributing them through anyone but me. That might change in the future, but no plans yet.

arctic oasis
#

Sub-one minute response from the creator themselves, and I'm not even a customer (yet), thanks very much!

atomic summit
#

Ok, I tracked down what that ssh error is (I still get it)...

#
Warning: Permanently added the RSA host key for IP address '13.237.44.5' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:raspberrypi/tinyusb.git' into submodule path '/Users/seon/circuitpython/ports/raspberrypi/sdk/lib/tinyusb' failed
Failed to clone 'lib/tinyusb'. Retry scheduled
Cloning into '/Users/seon/circuitpython/ports/raspberrypi/sdk/lib/tinyusb'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:raspberrypi/tinyusb.git' into submodule path '/Users/seon/circuitpython/ports/raspberrypi/sdk/lib/tinyusb' failed
Failed to clone 'lib/tinyusb' a second time, aborting
Failed to recurse into submodule path 'ports/raspberrypi/sdk'```
#

it seems the raspberrypi tinyusb stuff is using SSH and not https for inclusion as the submodule?

jaunty juniper
#
❯ cat ./ports/raspberrypi/sdk/.gitmodules
[submodule "tinyusb"]
    path = lib/tinyusb
    url = git@github.com:raspberrypi/tinyusb.git
    branch = pico
#

yup

atomic summit
#

I've tried changing .gitmodules to:

#
    path = lib/tinyusb
    url = https://github.com/raspberrypi/tinyusb.git
    branch = pico```
#

but still get the same git@ error

#
Failed to clone 'lib/tinyusb'. Retry scheduled
Cloning into '/Users/seon/circuitpython/ports/raspberrypi/sdk/lib/tinyusb'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.```
jaunty juniper
#

so apparently there is such a thing as .git/modules/ports/raspberrypi/sdk/modules/tinyusb/config

#

oh .git/modules/ports/raspberrypi/sdk/config first

#

git modules are complicated

atomic summit
#

I just caved and setup SSH

#

but I'm going to open an issue for this as I don't see why it's setup like this.

#

I mean, it's a raspberrypi thing.... not a circuitpython one, but this is a bad stumbling block for using source.

jaunty juniper
#

oh yeah it's raspberrypi's sdk that uses ssh for their tinyusb fork

atomic summit
#

there needs to be a way to not bring down the raspberrypi stuff (I'm not using it) or to have it not be SSH (IMHO). Nothing else requires SSH.

worthy robin
#

hey, im new to circuitpython, can help me with the new socketpool module?

#

someone*

#

ive worked with the python socket module in the past but im having trouble creating a simple tcp socket with the socketpool module

solar whale
#

@idle owl in the guide for using black, it say to use black --check --target-version=py35 . Is that still correct or shout the --target-version be omitted?

manic glacierBOT
tulip sleet
#

i added a shell alias to include that all the time

solar whale
#

Thanks .

manic glacierBOT
simple pulsar
manic glacierBOT
#

I followed the guide again and then noticed I did a mistake when rebasing my local repo.
Now everything is clean and up to date, but I'm still oversized by 39 kb :(

arm-none-eabi-gcc -o build-0_m4/firmware.elf -DCIRCUITPY_FULL_BUILD=1 -DMICROPY_PY_ASYNC_AWAIT=1 -DCIRCUITPY_AESIO=0 -DCIRCUITPY_ALARM=0 -DCIRCUITPY_ANALOGIO=1 -DCIRCUITPY_AUDIOBUSIO=0 -DCIRCUITPY_AUDIOBUSIO_I2SOUT=0 -DCIRCUITPY_AUDIOBUSIO_PDMIN=0 -DCIRCUITPY_AUDIOIO=1 -DCIRCUITPY_AUDIOPWMIO=0 -DCIRCUITPY_AUDIOCORE=1 -DCI...
manic glacierBOT
manic glacierBOT
crimson ferry
#

@simple pulsar there should probably be a note in the learn guides for S2 board about the voltage limits

blissful pollen
#

@slender iron Looking at the displayio.parallelbus for the rp2040 seems doable, but just wondering if there's a good device to test again? I don't have a display like that so will grab one

simple pulsar
#

@crimson ferry The ESP32 is weirder in some ways. I've not tried MicroPython yet to see if they apply corrections to the raw ADC values.

idle wharf
fossil gorge
#

Just a heads up since I'm not sure who would know about this, but for some reason the CP 5.x bundle doesn't have a link on the "libraries" page.

tulip sleet
#

@fossil gorge We have discontinued the 5.x bundle (it was the same as the 6.x bundle anyway). It is a bug that the text about it is still there. I'll look into that -- thanks.

fossil gorge
#

Ah, good to know. I wasn't using or needing it, but figured I'd mention something was off. I was just on the wrong side of what "off" meant!

orchid basinBOT
solar whale
#

@idle wharf I'm still a bit confused. I don't see where in the repo --target-version is specified. I'm sure I am just not looking the correct place.

idle wharf
#

For a library, using the cookiecutter template, it is specified in the pyproject.toml which black always check.

solar whale
#

I'm looking at the Adafruit_CircuitPython_RFM9x lib. I don't see that file.

idle wharf
#

Adafruit_CircuitPython_RFM9x does not have the pyproject.toml. I'm not sure if that on purpose or not.

solar whale
#

ah -- so it is not in each repo.

#

I have no idea. It's been around a long time.

#

so what does it do if that file is missing?

idle wharf
#

It would run with Black's defaults.

tulip sleet
#

example:

halbert@salmonx:~/repos/adafruit/Adafruit_CircuitPython_BLE$ ag --hidden black
.github/workflows/build.yml
41:    - name: Pip install pylint, black, & Sphinx
43:        pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
48:        black --check --target-version=py35 .
solar whale
#

Ah -- I see it in some other repos -- guess not all have been updated

tulip sleet
#

Note that it's in the .github dir, so you have to search in a hidden dir

solar whale
#

in the rfm9x repo -- the build.yaml does not call black at all ??

tulip sleet
#

that seems like an oversight; it might be missing from a master list of repos that has been used to do bundle-wide changes

idle wharf
#

@tulip sleet you added that to the cookiecutter build.yml but it was reverted because it runs in the pre-commit.

#

I guess the real answer is the repo's aren't all standard yet

tulip sleet
#

I added it? I don't remember.

solar whale
#

something is odd though -- it is not called out in the rfm69 repo either, but a PR yestrday failed CI due to black

idle wharf
#

Sorry, Kattni added it and reverted it. You merged it originally...

tulip sleet
#

oh yeah, there was weird trouble with it, and we reverted it quickly to stop builds from breaking

solar whale
#

it is is not in build.yaml -- is it being run from something else as part of the CI workflow?

idle wharf
#

Pre-Commit

solar whale
#

ah -- it just refers to black -- so I assume it runs without any target-version then

idle wharf
#

Yes, if there is no other setting in the pyproject.toml

#

So for that repo you mention. Its running defaults

solar whale
#

ok -- that clears it up -- thanks

tulip sleet
#

It's fine to open issues on repos that need updating.

#

otherwise we will forget

idle wharf
#

Or make PRs 😉

solar whale
#

It is not causing any problems - just confusing me 😉

#

I wonder what else needs updating -- could be a can of worms!

idle wharf
#

I just used the cookiecutter yesterday for the first time so I just learned all this. timely questions !

oak yacht
idle wharf
#

@oak yacht I will test that.. thanks !

#

@oak yacht "There was a problem downloading the bundle. Please try again in a moment." -- is what you saw ?

idle wharf
#

That's my guess... fixing.

solar whale
#

@idle wharf It has been a long time since I created a new library so I have not used the cookie-cutter recently.

idle wharf
manic glacierBOT
#

The Pi Pico has 2 physical cores, but only one core is usable in CircuitPython. Micropython has limited multicore functionality when used with the pico, allowing the user to start a separate task while passing variables in the task call, like this:

def mytask(pin, delay)
# bang away at a pin or whatever, call with
import _thread
_thread.start_new_thread(mytask, (GP2, 0.2))

mytask runs independently of the main mcu core, and runs until it returns or mcu reset.

Is this plan...

idle wharf
#

Thanks @oak yacht for testing!
Circup 0.9.0 is live
pip uninstall circup --yes && pip install circup && circup --version

tulip iron
#

up sos wrong thread will re post in the help one

ornate breach
#

So I may have found a bug, but I'm not 100% sure if it is or not, or if I want to open an issue on it.

#

when using the following code:

import board
import busio
import adafruit_bus_device.i2c_device as i2c_device

i2c = busio.I2C(board.SCL,board.SDA)

i2c_addr = const(0x40)

print(i2c.try_lock())

print("trying to do this")
i2c_dev = i2c_device.I2CDevice(i2c, i2c_addr)
print("we got to this point")
buffer = bytearray(2)
i2c_dev.write_then_readinto(bytes([0x00]),buffer, in_end=None)
print(buffer)

i2c.unlock()

The code hangs on the line

i2c_dev = i2c_device.I2CDevice(i2c, i2c_addr)```
#

I tried it on 6.1.0.beta.1.8 and also on the very latest beta build for my CP Sapling.

#

It hangs for all the i2c breakouts i have

#

I'm going to try it on a Qt Py to verify.

tidal kiln
#

i've seen that behavior before. not new.

ornate breach
#

any way around it?

tidal kiln
#

it's because you are passing in a locked bus.

ornate breach
#

ah okay

tidal kiln
#

I2CDevice could maybe handle that better

ornate breach
#

you're probably right, let me change it

tidal kiln
#

i've shot myself in the foot with that before when doing stuff in REPL and forgetting i called try_lock several lines prior

ornate breach
#

yeah it works doing this

#

basically just trying to check out if this temp and humidity sensor I made works

#

it kind of does but I'm not 100% sure so more code to verify

lone sandalBOT
blissful pollen
tidal kiln
#

yah. i think you can....been a while.

#

it was more of the general behavior

#

it just silently sits there and never returns from the init call

#

so is a bit ??? when it happens

blissful pollen
#

yeah I gotcha, almost needs a timeout value

tidal kiln
#

or check if it's locked in the I2CDevice.__init()__ and throw an exception to let you know?

blissful pollen
#

Problem is then you're moving any logic to wait for a lock outside of the bus device which, my understanding, was trying to manage some of that

slender iron
atomic summit
#

Oh, I tried git submodule init but not sync 😦

#

I ended up just setting up SSH

slender iron
# blissful pollen <@!252717193496756235> Looking at the displayio.parallelbus for the rp2040 seems...
blissful pollen
#

Thanks, I have something in place that at least doesn't crash my pico, but not sure if it is even working at all. I'll grab one of those to test on

slender iron
#

kk! We could probably find someone to test too

#

did you use the PIO?

blissful pollen
#

Yup, spent most of saturday pouring over the PIO docs (and some of the DMA but realized after that's built into the statemachine code you already have)

#

For parallel though it's a real simple PIO program at least

slender iron
#

nice! yup, it is

#

ya, good place to start

#

doing pulseio with the PWM peripheral is probably doable too

blissful pollen
#

Yeah likely, they had PWM as an example. If I can get this one going I may take a look at some of the utility modules that could use PIO

slender iron
#

👍

static condor
#

Hey all

#

I am new to this forum

mild fog
#

Can one programatically shut down an M4 express board running circuitPython?

slender iron
#

@mild fog no

manic glacierBOT
#

Note that right now we don't use external ram for sockets or pystack. We simply use all external RAM for the CP heap. To allow for more sockets, we'd need to change how RAM is shared between CP and the IDF. Basically now we don't tell the IDF about it. In the future we could tell the IDF and then allocate the heap through the IDF.

One wrinkle is that then the IDF memory may not be DMA-able so for any IDF buffers we'll have to be careful.

#

Before trying countio, an internal pull-up was sufficient to work with both optical and hall-effect interrupter sensors. The pull-up value is not critical for most low to medium-speed applications like motor RPM. Don't know if the internal pull-up value provides enough current for the speed of a remote control IR sensor.

Sensors tested:
Hall-Effect: https://www.adafruit.com/product/158
IR Reflective: https://www.adafruit.com/product/3930
T-Slot Interrupter: [https://www...

lavish saffron
#

What version of C python is CircuitPython / MicroPython based on at the moment?

manic glacierBOT
manic glacierBOT
#

Hello again
Now that the internal flash build works and the board is usable, I'm trying to make the external SPI flash operational.

I'm not sure if I could ask here or open a new issue?

I use the GD25Q64CSIG chip connected with the same pins as on the Feather M0 Express :
flash pins

I successfully used this setup with a SAMD21, but it looks like the SAMD51 does not detect the c...

manic glacierBOT
lavish saffron
#

Hi, I need a little guidance on a pull request. I have a CircuitPython PR (#4078) whose Build CI is failing on the Trinket M0 ja translation due to insufficient firmware flash. The same board builds successfully on my local machine so I am not sure how to proceed. Any and all advice gratefully received!

manic glacierBOT
dull dust
#

I have a Pi Pico with CircuitPython noob question: I'm using the example on the Adafruit website for HID input 'A' and 'Hello World' typed as a keyboard. After getting my brain around the strict requirements for formatting indents 🙂 I managed to get the code working fine. But, how do I get it to run without having Mu present and having to press CTRL-D? Happy if you could point me in the right direction for info, if I've missed something on the website.

idle owl
solar whale
#

Yes, Thanks!

lone axle
#

@idle owl I think so yep. It was the fuel gauge device name being swapped around right?

idle owl
#

I believe so.

#

Guide and lib needed an update?

lone axle
#

The library got updated when someone noticed the name had transposed characters. I remembered seeing that go by. More recently tg-technie noticed the guide hadn't been updated yet.

idle owl
#

Did the guide get updated?

lone axle
#

Yep I got the guide when it was mentioned here.

idle owl
#

Oh great! Thank you.

manic glacierBOT
idle owl
manic glacierBOT
dull dust
blissful pollen
dull dust
#

Thanks for the pointer @blissful pollen I'll try there 🙂 - UPDATE Issue fixed with help from @tidal kiln and @tulip sleet with thanks.

manic glacierBOT
#

@dhalbert if you mean internal state within the Requests library, I think so, yes. We create a sock->num in C when the socket is created, and set it to -1 when closed, and that's all that fileno would be returning. The only potential issue is that TLS sockets don't strictly need to have the original socket open to keep working - in Scott's original implementation, they didn't call the lwip_socket function at all, which is what allocates the file descriptor. But my implementation calls t...

tulip sleet
crimson ferry
idle owl
#

@crimson ferry There was no implication that RPi came first. That name has been used ubiquitously across this field for years.

crimson ferry
#

yeah, it's dangerous to use any of those prefixes

idle owl
#

It's a fun short word that implies small. How can you not want to use it.

idle wharf
manic glacierBOT
idle owl
#

@idle wharf Excellent. Thank you for following up!

manic glacierBOT
manic glacierBOT
#

Hi there,

I'm currently testing a new board that uses the ESP32-S2 and has an integrated SD card. When I try using one of the existing board from the website it works fine but when I flash it with my own board definition the SD card won't work and I get the following error message:

Traceback (most recent call last):
  File "code.py", line 16, in 
  File "adafruit_sdcard.py", line 101, in __init__
  File "adafruit_sdcard.py", line 122, in _init_card
  File "adafruit_sdcard.py", ...
idle owl
#

@tulip sleet Did I see we added code to default to a specific core when using microcontroller.cpu? Or did I imagine that. And if so, where did that end up?

manic glacierBOT
#

My colleague has pointed to this forum post that suggests clearing the "Brownout reset enable" bit before entering deep sleep: https://www.esp32.com/viewtopic.php?f=13&t=19208#p71084.

I'm going to submit this change for IDF master and release/v4.2 branches, so that esp_deep_sleep_start disables BOD reset automatically. In the meantime, please try to add this workaround in your app before calling esp_deep_sleep_start.

tulip sleet
#

@idle owl currently you have to say microntroller.cpu[0]. temperature. That is going to get fixed but PR #4087 hasn't been merged yet.

idle owl
#

@tulip sleet Got it. Was already doing that. Will leave it as is.

#

Thanks!

slender iron
tulip sleet
#

@idle owl just merged it, so it will be fixed in beta.2

idle owl
#

Ok, I'll keep an eye out for the beta, and update the guide page.

manic glacierBOT
idle owl
#

<@&356864093652516868> Meeting in ~40 minutes. Please add your notes to the document. If you're going to be lurking, it's super appreciated if you can add your name to the doc in alphabetical order under Hug Reports and Status Updates with (lurking). Thanks much! Chat with you all soon! https://docs.google.com/document/d/1W2OIZkZ6Rkrl7se8LjBNxb2orUtyb5SmK53AmiAZkrY/edit

manic glacierBOT
cedar moth
inland tusk
#

?show

manic glacierBOT
modern wing
#

Happily lurking today -- notes document updated -- snow shovel not updated. ❄️

idle owl
#

@modern wing Thanks much!

#

@inland tusk Are you participating today or lurking?

fossil gorge
#

Lurking again today, as usual. I enjoy the goodness shared and the company before an architecture meeting!

errant grail
#

Just listening today.

idle owl
#

Be back in a minute.

solar whale
#

Nothing is ever easy.

modern wing
#

Unless its eggs, they go over easy.

solar whale
#

On in NJ, they are runny.

supple dirge
#

lurking

stuck elbow
#

lurking

thorny jay
#

lurking

modern wing
#

$4 for the Pico even 🙂

sweet ocean
#

hey anyone get "Unable to import 'adafruit_trellism4' when trying the blink program in adafruit learn ?

lone axle
tidal kiln
#

** lurking **

lone axle