#circuitpython-dev

1 messages · Page 305 of 1

half geyser
#

I think I see part of the problem, though -- Visual Studio Code seems to be launching a version of python whenever I save, which is manipulating the file on the drive. That resets the autoreload timer.

#

Yes, disabling the Python Language Server in VSCode fixes the issue.

stuck elbow
#

yay for stuff doing things behind your back

half geyser
#

Anyway, it's been a productive day! My NRF52833 is now sleeping at 340 uA. That's still about 50x more than it should be, but it's coming along nicely.

#

And USB plug/unplug is reliable now.

old smelt
#

Thanks @crimson ferry. I only have a single board plugged in when I'm seeing this. Behavior seems to point to the PID/VID recognition issue.

#

Tried a fresh local build last night and ran across this error:

../../lib/protomatter/core.c:442:13: error: dereferencing 'void *' pointer [-Werror]
             *core->addrPortToggle = newBits ^ priorBits;
             ^~~~~~~~~~~~~~~~~~~~~
../../lib/protomatter/core.c:442:35: error: invalid use of void expression
             *core->addrPortToggle = newBits ^ priorBits;
                                   ^
cc1: all warnings being treated as errors
make: *** [build-evo_m51/lib/protomatter/core.o] Error 1```
half geyser
#

@old smelt yeah, it looks like upstream is broken. All of my PRs have been failing with that error.

old smelt
#

Ok.

half geyser
#

I thought I saw a bug report about that, but I guess not.

old smelt
#

Am I able to check out the latest stable release? Say, 5.3.0, and build that?

#

Guess I'm grabbing the very latest of everything right now

half geyser
#

That should work, yeah:

git checkout 5.3.0
git submodule update
old smelt
#

Thanks.

#

I'll do that for now. I searched the Issues on github for this error - didn't see anything. Maybe searching for the wrong string? I assume it is already a known issue if things are breaking.

old smelt
#

Ok.

#

Thanks @half geyser - 5.3.0 build worked.

half geyser
#

@old smelt hooray!

#

Also, final update for the night: I realized the LRCK and SCK lines were flopping around on I2S which was probably causing the I2S microphone on this board to do odd things. I set those to output, driven low, and now the board is down to about 11 uA. Hooray!

manic glacierBOT
onyx hinge
#

@half geyser wow that is huge! (or tiny)

#

@old smelt sorry about the trouble with our master branch, I trusted too much in some automated checks and some bad commits got merged to master branch that shouldn't have 😦

half geyser
#

@onyx hinge I'm pleasantly surprised!

tulip sleet
#

@onyx hinge I was going to approve your build fix PR last night, but it was failing on multiple boards. But now it's succeeding. Did you fix something?

onyx hinge
#

@tulip sleet yes I force-pushed a second change

half geyser
#

I noticed that the "RTC" on the NRF is actually just a counter. Nothing is retained in case it crashes. I guess the answer there is to not crash...

#

(And maybe save the time occasionally in flash.)

tulip sleet
#

@half geyser if the power is still on, then RAM should be the same? So you could just save it in RAM on each tick? Or is that not the use case you are talking about?

half geyser
#

@tulip sleet That's a good idea, actually. And a candidate for a patch. Place rtc_offset in uninitialized memory.

onyx hinge
#
        if (block_num > 1) {
            return 1; // error
        }
``` am I overlooking something about this code, or is it nonsense?
half geyser
#

I mean, that comment's not wrong...

tulip sleet
#

@onyx hinge I'd look at the blame history

onyx hinge
#

I think the second check is supposed to be num_blocks, like it is in write

half geyser
#

I know I asked this before, but I'm almost at a point where I can actually work on it. But: What would be the best way to add an I2S Microphone?

#

I see I2SOut and PDMIn. The logical solution is to add an I2SIn object.

onyx hinge
#

Yeah we'd like to see I2SIn added, it just hasn't happened yet. the nrf52 has the hardware for it I think

half geyser
#

But I2SOut has a lot of generic I2S blocks, it's just specialised for I2SOut.

onyx hinge
#

refactor as appropriate

#

not sure if you can get both to work at the same time. I wrote the i2sout but let's just say I'm not sure I'm proud of the code

half geyser
#

I think you can, but it requires they both be at the same rate. Probably.

#

That's fine, because we'll need PWMOut, which I've tested works.

#

Does the build system allow me to have an I2S.c inside common-hal/audiobusio/? Would I need to add an I2SIn.c to every other platform?

onyx hinge
#

Or, at least, each port which has audiobusio; looks to be just nrf and samd

#

(huh I thought samd did have i2sin...?)

#

(but no, I'm just wrong)

half geyser
#

And does it support adding a common I2S.c file? Or does that have to go elsewhere?

raven canopy
#

@half geyser you'll need the appropriate files in shared-bindings/audiobusio as well. to gate it to certain ports, you'll likely have to use #ifs.

#

@tulip sleet re: bootloader & ubuntu 19+: the udev stuff turned out to be a bit of a red herring. but it did kind of point to timing issues. i'm currently testing a bump in the SINGLE_RESET delay to 75: https://github.com/adafruit/uf2-samdx1/blob/master/src/main.c#L113. will keep pushing, and see if i can get some empirical results...

tulip sleet
half geyser
#

@raven canopy that's what I thought, but since it's not an actual python class but is just a common library, I thought that was a bit odd. Are there any modules that have support modules that don't expose python types?

tulip sleet
#

@half geyser, yes, like time, which only has functions. They're all in __init__.c

raven canopy
tulip sleet
#

we are supposed to be sync'd up with the microsoft repo completely. I am just behind on merges in both directions

#

I've looked at that loop a few times, and thought it seemed really short

half geyser
#

Thanks, @tulip sleet !

tulip sleet
#

@raven canopy the main reason there are even two repos is that MS has some policyt rules that they are not allowed to release binaries, so we have to do that

#

well, maybe not the main reason (because we still want to submit PR's), but that's a consideration

raven canopy
#

do you have to go through and cherry pick?.....

ahh. ok. well, i've got interest in getting it working, so feel free to abuse that to get some grunt work assistance. 😄

tulip sleet
#

I just need to do a merge from upstream and a PR back up; haven't had time yet

#

did you try building their current master to see if it's any better?

raven canopy
#

nope. but i can. watching nina's stream...attention stolen

idle owl
#

@tulip sleet What is an example build without monotonic_ns() or how can I figure that out on my own?

tulip sleet
#

any build without longints, so if you look in circuitpython/ports/atmel-samd/boards/*/mpconfigboard.mk for LONGINT_IMPL = NONE, those are the ones. E.g. Trinket M0

idle owl
#

basically I have some code with bits in it designed to work on both in the event of using one that doesn't have monotonic_ns() and I want to make sure that the code works.

#

Ah. Oi. Ok. 🙂 Thanks.

manic glacierBOT
#

This problem does not occur in current micropython even when MICROPY_OPT_COMPUTED_GOTO = 1.

I compared our py/vm.c with micropython's, because MICROPY_OPT_COMPUTED_GOTO is only significant in that file. There are differences in exception handling based on the flag.

Really interestingly, this micropython commit, which is a minor speedup, https://github.com/micropython/micropython/commit/869024dd6e62905b7e1069b547856a769b3b24ba, changes

    #define DISPATCH() break

to
`...

idle owl
#

Who can help me with a grep command?

#

My brain isn't wrapping around the man file for it.

raven canopy
#

what'ya got?

idle owl
#

I want to grep for a string in a large directory structure, specifically, I want to search for a string in circuitpython

#

Very specifically, I'm trying to figure out where _pixelbuf is getting colorwheel or wheel. Because I think it's in the wrong order.

#

But I can't find it searching files on GitHub. So I need to grep I think.

onyx hinge
#
shared-bindings/_pixelbuf/__init__.c:    { MP_ROM_QSTR(MP_QSTR_wheel), MP_ROM_PTR(&pixelbuf_wheel_obj) },```
idle owl
#

🤦 Did not check that file.

#

Thank you.

tulip sleet
#

I use grep -r or, better, the ag (silversearch) command over the whole tree. @raven canopy, ooh, didn't know about git grep

raven canopy
#

that was @onyx hinge , as much as i would like to take credit. 😄

onyx hinge
#

git grep only greps files that are tracked by git .. but irritatingly it doesn't go into submodules

idle owl
#

Duly noted.

onyx hinge
#
        return (uint8_t)(pos * 3) << 16 | (uint8_t)(255 - (pos * 3)) << 8;

vs

        return (255 - pos * 3, pos * 3, 0)```
idle owl
#

I know it's in the wrong order.

#

I tested it.

#

It's based on our original wheel code

#

which was also broken

#

until I found it and fixed it.

#

fixing it now.

onyx hinge
#

oic

idle owl
#

In theory.

onyx hinge
idle owl
#

Let me check

#

It's basically correct, yes. Except we usually wrap them in int() but the math is accurate.

#

This is for sure correct:

def wheel(pos):
    """Input a value 0 to 255 to get a color value.
    The colours are a transition r - g - b - back to r."""
    if pos < 0 or pos > 255:
        return 0, 0, 0
    if pos < 85:
        return int(255 - pos * 3), int(pos * 3), 0
    if pos < 170:
        pos -= 85
        return 0, int(255 - pos * 3), int(pos * 3)
    pos -= 170
    return int(pos * 3), 0, int(255 - (pos * 3))```
onyx hinge
#

I'm seeing my pygamer not enumerate with current master 😦

idle owl
#

pixelbuf is GRB, not RGB.

#

I'd like to fix it. But this is going to take a little learning I think.

onyx hinge
#

the C _pixelbuf you mean?

idle owl
#

Yes.

onyx hinge
#

oh! is there a reason for that?

idle owl
#

I believe it was written based on the wheel code before I fixed it

#

so it's in the wrong order.

#

wheel(1) and wheel(255) should return red. They currently return green using _pixelbuf wheel.

#

wheel(85) should be green, it's currently red.

#

Blue is correct at 170

#

It means any rainbow code using _pixebuf wheel will have a rainbow starting with green, fading to red, fading to blue, back to green.

#

Which in theory still covers all the colors, but it's supposed to start with red.

#

I have the code in front of me, but it's C. so I'm going to have to put some effort into understanding it

raven canopy
#

@tulip sleet i'm seeing errors on building MS uf2-samdx1:

In file included from lib/samd51/include/samd51j19a.h:546,
                 from lib/samd51/include/sam.h:38,
                 from ./inc/uf2.h:7,
                 from src/main.c:77:
lib/cmsis/CMSIS/Include/core_cmFunc.h: In function 'main':
lib/cmsis/CMSIS/Include/core_cm4.h:85:28: error: listing the stack pointer register 'sp' in a clobber list is deprecated [-Werror=deprecated]
   85 |   #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
      |                            ^~~~~
lib/cmsis/CMSIS/Include/core_cmFunc.h:456:3: note: in expansion of macro '__ASM'
  456 |   __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
      |   ^~~~~
lib/cmsis/CMSIS/Include/core_cm4.h:85:28: note: the value of the stack pointer after an 'asm' statement must be the same as it was before the statement
   85 |   #define __ASM            __asm                                      /*!< asm keyword for GNU Compiler          */
      |                            ^~~~~
lib/cmsis/CMSIS/Include/core_cmFunc.h:456:3: note: in expansion of macro '__ASM'
  456 |   __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp");
      |   ^~~~~

looking at their CI run, i'm guess its GCC9 related...

#

their travis still uses GCC6

tulip sleet
#

yeah, I fixed that in ours, you can just remove the : "sp"

onyx hinge
#

@idle owl OK, how's your understanding of bit shifts in C (or Python for that matter)?

tulip sleet
#

or if you can switch compilers easily...

#

(I have an alias to do that)

idle owl
#

@onyx hinge terrible. I understood it for about 5 minutes after having it explained, did not use it enough, and it drained from my brain.

onyx hinge
#

so the first thing to know is that colors are 0xRRGGBB, hex numbers with 6 digits

idle owl
#

right

#

ohhhhhhhhhh. so you're shifting within that?

onyx hinge
#

each digit is equal to 4 bits, each pair of digits is equal to 8 bits, so it's also 0xRR * 655356 + 0xGG * 256 + 0xBB

idle owl
#

That got complicated quickly

onyx hinge
#

haha sorry, let me slow down

#

If it was decimal it would be 10000 * RR + 100 * GG + BB, because that's how you "move digits over" in decimal

idle owl
#

ah ok

onyx hinge
#

to move over in hex, you multiply by powers of 16 instead, OR you use shifts like << which are in powers of 2

#

(2^16) is 65536, so 0xRR << 16 is 0xRR * 65536

idle owl
#

ok

onyx hinge
#

I know I'm not really explaining it in full, but I'm trying to help you recognize what the patterns in the code mean

idle owl
#

No this is helping

#

a lot

#

the code is making more sense to me

onyx hinge
#
               ^^^^^^^^^^^^^^^^^^^^^^^^^ shifting something by 16
                                         so RR is (pos * 3)
idle owl
#

yeah!

#

and the <<8 is green, yes?

#

and no shifting is blue?

onyx hinge
#
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
shifting something by 8, so GG is (255 - (pos * 3)
#

yup, now you got ahead of me

idle owl
#

and unlike in Python, the 0 isn't bothered with, if something is 0, then it's simply ignored

onyx hinge
#

right

idle owl
#

I think I get what's going on

onyx hinge
#

R << 16 | G << 8 | B

#

but whichever ones are zero are just left out, and there are parens and casts

idle owl
#

the one that confuses me now is the first bit: if (pos > 255) { pos = pos - ((uint32_t)(pos / 256) * 256); } because it looks nothing like that in the Python colorwheel.

onyx hinge
#

(uint8_t)(x) is a lot like int(x) except it also restricts x to the range 0 through 255 inclusive

idle owl
#

ah ok

onyx hinge
#

I think that makes it so that colorwheel(x + 256) == colorwheel(x), but still not for negative numbers

#

I'm not sure why it's written that way, however

#

it's saying pos = pos - int(pos/256) * 256 basically

#

think that's enough background to let you fix the bug?

idle owl
#

Might be. I'll give it a try, and see what happens! Can always git stash && git stash drop and start over.

onyx hinge
#

hm I never thought of doing those commands as a way of discarding my work. interesting.

#

I'm going to go have lunch, I'll check back later in case you had more questions

idle owl
#

Alright, thank you so much for your help!

onyx hinge
#

OK, I think my earlier problem was due to incorrectly updating the tinyusb submodule. phew.

idle owl
#

🎉

#

Updated it, built it, fixed it!

#

@tulip sleet Do I need to do anything else but update the code to create a PR for CircuitPython? e.g. equivalent of running Pylint, Black and Sphinx on the libs. It's a simple fix, swapped two lines of code. No changes in number of characters or anything.

#

I'm not sure I've ever submitted a code fix to CP.

#

Docs yes, code, not so sure.

tulip sleet
#

@idle owl usually there's not much to do. If you changed any message strings, you'd want to run make translate, but not true here. So just go ahead; you already tested it, and it seems like a simple fix

idle owl
#

No message strings changed. Right on, thanks. Will do.

#

@tulip sleet "message strings" are not "comments", correct? so if I add a comment, still no issue?

tulip sleet
#

anything in a translate() is what I mean

idle owl
#

Ok

ionic elk
#

@slender iron is there any one-line command for Jlink that'll upload a bin to a specific file, without opening a GDB server? I'm poring over the manual and can't find one

tulip sleet
#

JFlashExe will do that

#

no sorry, wrong way, I mean JMem

#

are you reading or writing flash?

#

there are commands in the JLinkExe CLI that will do it

#

J-Link Commander (JLink.exe / JLinkExe) is a free, command line based utility that can be used for verifying proper functionality of J-Link as well as for simple analysis of the target system with J-Link. It supports some simple commands, such as memory dump, halt, step, go et...

ionic elk
#

I'd like a command that's equivalent to what I have with my other STM32 programmer, texane/stlink: st-flash write firmware.bin 0x8000000. Run and done.

#

Yeah commander sounded like I had to write and link a configuration file to program it? Which sounds kind of ridiculous, I dunno.

#

I'm not looking to reinvent the wheel was just wondering if you had something you already use.

#

It's not that big a deal, most of the time I need GDB open anyway

tulip sleet
#

looking...

slender iron
#

@raven canopy that's what I thought, but since it's not an actual python class but is just a common library, I thought that was a bit odd. Are there any modules that have support modules that don't expose python types?
@half geyser We tend to put Python-agnostic supporting code in the peripherals directory within a port.

tulip sleet
#

@ionic elk it's not too hard to write a JLink script, but there isn't a pre-existing way to do it, as far as I can see. There's the JFlash tool, but that requires a separate license, and it's really meant for production

ionic elk
#

@tulip sleet yeah I have it, it looks like the STM32 official tools. But it's GUI based too.

#

well whatever nbd

tulip sleet
ionic elk
#

I don't think that works on mac... I don't see a symlink for it

#

There's one for flashing SDI chips though which is kind of neat, actually

manic glacierBOT
tidal garden
#

Hey guys. I'm doing some cycle testing on a part, and driving a stepper motor continously using a metro m0 express board. The board constantly sends a pulse train to the motor controller and each pulse cycle is set to 2mS. I am also using an adafruit i2c backpack connected to a display, and writing the cycle count each time one cycle is completed. I am noticing a delay (motor stops) between the end and beginning of each cycle, that seems to be due to writing the value of the cycle counter to the display. Does anyone have a recommendation for how to decrease the time it takes to do this, so that the motor can continue to cycle uninterrupted, while still updating the display? Is there a better way to send a value to the display, without having to encode the counter value as a string first?

manic glacierBOT
prime flower
#

@crimson ferry did that ESP-IDF transport bug patch get released?

#

It looks like it's from 2019?

manic glacierBOT
crimson ferry
manic glacierBOT
onyx hinge
#

@slender iron is it more natural for sdcardio.SDCard to take a DigitalInOut or a microcontroller.Pin? adafruit_sdcard takes a DigitalInOut but many core things (like, say, busio.SPI) take Pin objects. I coded for Pin.

manic glacierBOT
tulip sleet
#

busio.SPI is assigning a peripheral to pins, so it would take pins. But busdevice SPI takes an SPI object and a DIgitalInOut,

#

does it make sense to pass a busio.SPI to sdcardio.SDCard? I would think so. Do you need to control a CS line too?

#

for that also a DigitalInOut would make sense

onyx hinge
#

here's a before-and-after: ```- spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)

  • sd_cs = digitalio.DigitalInOut(board.SD_CS)
  • sdcard = adafruit_sdcard.SDCard(spi, sd_cs, baudrate=6000000)
  • sdcard = sdcardio.SDCard(board.SPI(), board.SD_CS, baudrate=12000000)
onyx hinge
#

the baudrate change is .. not relevant, ignore it

#

weirdly the docs for adafruit_sdcard, seem to be at variance with how it's actually used ... ``` spi = busio.SPI(SCK, MOSI, MISO)
sd = adafruit_sdcard.SDCard(spi, board.SD_CS)

tulip sleet
#

the advantage of passing an object is that you can do duck-typing, and some things might not have pins, but just buses (e.g. blinka stuff)

onyx hinge
#

yeah the adafruit_sdcard code will work with a bitbangio.SPI or a busio.SPI, but the new thing will only work with busio.SPI

#

similarly, it won't work with things that duck-type like DigitalInOut

#

(you don't want to, you'd lose speed)

tulip sleet
#

i mean it as a general policy; may not make sense in this case. displayio.FourWire takes a busio.SPI, etc.

prime flower
#

@crimson ferry yep - thanks for keeping me updated!

onyx hinge
#

@tulip sleet digging at it a bit, I think that the reasons for FourWire to take microcontroller.Pin chip_select are what makes it natural here too

#

it also is a line of code the user doesn't need to write

tulip sleet
#

so, for speed, that sounds fine, to avoid the common_hal routines?

onyx hinge
#

and @slender iron mentioned the possibility of making sdcardio.SDCard survive reset like displays. In that case, you need to construct the digitalinout object "within" the containing non-gc'd object: common_hal_digitalio_digitalinout_construct(&self->chip_select, chip_select);

tulip sleet
#

that is a good reason

idle owl
#

Maybe the comment I added does?

tulip sleet
#

korean hallowing build is 4 bytes too big. I'll work on squeezing it

#

don't merge it yet

idle owl
#

Noted, I wouldn't have without it passing.

slender iron
#

@onyx hinge Use pins if you only want to support the microcontrollers pins. Use digitalinout if you want to use other pins indirectly

raven canopy
#

@tulip sleet ok, here's where i'm at with MSFT uf2/master: went through about 10 physical resets (double-tap->single->repeat) without issue. but, i only get one successful reset via microcontroller.reset() into bootloader and back; the second .reset() locks up the host once it hits bootloader.

the DBL_TAP_MAGIC values match, so maybe its related to the BOD?

manic glacierBOT
rose root
#

@slender iron what's the info for the weekly Monday CircuitPython meetings?

idle owl
#

@rose root What info are you looking for?

rose root
#

Scott's answering it on his broadcast. I was wondering when the meetings were and how I would join. Scott linked me to the Weekly Meeting notes GitHub repo and I found the calendar link there. @idle owl thank you though.

raven canopy
#

got caught on a phone call: thanks for streaming @slender iron!

#

and...wrong channel lol

timber mango
#

Is the CLUE still an alpha?

slender iron
#

@hollow gazelle @lucid solar @sour lynx just pushed the code from today's stream

hollow gazelle
#

😋

manic glacierBOT
#

Update: With this patchset, usage is down to 10 uA when running on battery. It quickly and reliably wakes from sleep, and it appears to be capable of logging to internal flash.

Why do you think this improves power usage so dramatically? Were we never actually sleeping?

That was poor wording on my part. Without these patches, I couldn't reliably test, since whenever it went on battery it would effectively crash. With this patchset in place, I was able to concentrate on ...

#

WFI does work fine if interrupts are enabled, but without disabling interrupts you can never be sure that there isn't pending data before issuing WFI For example:

sleep_until_time:
       ; ... do some prep involving the RTC
       bl         usb_background
       wfi

usb_background:
       ; ... service USB buffers
       bx lr

Even though usb_background() drains the buffer, you still could have an interrupt arrive between the bx lr and the wfi instruction...

low sentinel
#

@slender iron I just saw the shout out in the weekly minutes - thanks ❤️
I'm still working on it. I do indeed have boring rectangles as well as full polygon support planned. Currently I'm polishing and going over use cases to see what works and what needs more effort. I don't have a debugger so it's all printf for now 🧃
At the moment I'm just banging my head against feature parity with "transpose xy" functionality. After that I'll be working through mirror. I don't really want to do hidden or absolute transform support right yet. Around that point I think it'll be ready for alpha testing by others. I've got a few more features on my immediate plate for the project but they're fun & I'm trying to take care of the boring housekeeping stuff first. (I need transpose and mirror too, I figure a lot of people do) Feel free to PM me if you're curious for more details.

manic glacierBOT
manic glacierBOT
#

Just an observer here, but is this bootloader command what might be needed here?
pyb.usb_mode

It seems that it'd make sense to control this behavior in boot.py, which is accessible by double-clicking the reset button to mount the bootloader's partition. Presumably, if boot.py changes this mode, it could intercept the CircuitPy partition / MSC device from being presented?

manic glacierBOT
#
k0d

I've thought about this a bit, we're not actually exposing this debug_uart object to python, so they won't be able to deinit it. As this would be enabled by board, and the vcp_rx/tx pins are already connected, then it's very unlikely someone would want to use those pins. Plus this would mostly be used for debugging...in which case the user would already be compiling CPY themselves. We should probably not expose the pins to CPY either?

manic glacierBOT
simple pulsar
#

I put in a tiny change to a some code in a learn guide and Travis reports it failing. It's crapping out around some esp8266 bits in build_main_platforms. Is this a known issue? https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/1104#issuecomment-626191315

simple pulsar
#

@onyx hinge cleaned-up the Travis issue I just mentioned, thanks.

onyx hinge
#

happy it worked @simple pulsar

#

@simple pulsar I assume this code is tested by you on the non-magnetometer boards now?

manic glacierBOT
#

A call to time.time() fails with various errors unless a prior call has been made to rtc.set_time_source().

In 5.3 release:

>>> import time
>>> time.time()
947386557

Using current master:

>>> import time
>>> time.time()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: '' object has no attribute 'datetime'

This was on a Metro Express M0. On a CircuitPlayground Express it simply crashes into safe mode.

If rtc.set_time_source() is call...

slender iron
#

@low sentinel sounds good! Thank you!

simple pulsar
#

@onyx hinge Yep, I've got the code running on a CLUE, on a CPB + Gizmo and on CPB only. I hadn't tested the code path on a button press on the CPB as most of my testing has been done on the CLUE - that's the reason for that fix. The code is funny on the CPB only, I think it's firing all the screen writes pointlessly down those unconnected pins!

onyx hinge
#

could be

onyx hinge
#

@simple pulsar I wonder, I see that the Gizmo has a pull down on A3. If you set A3 to GPIO input with pull-up enabled, you shold read .value as True if no gizmo is connected and as False if a Gizmo is connected. The voltages work out at least as long as the pull up is close to the nominal value. But if it's the minimum value of 20k, then the voltage is 0.33 * Vcc and technically you need to get down to 0.3 * Vcc, so this detection method might not work on a small portion of all devices.

simple pulsar
#

The CPB only platform wasn't the main platform and it would change timing a bit so I haven't yet looked at that. Plus I needed to allocate some time to guide writing rather than just coding!

#

I've just used my standard ploy. I've added that to the Going Further page's Ideas for Areas to Explore 🙂

onyx hinge
#

hehe

manic glacierBOT
manic glacierBOT
#

vectorio builds on m4 express feather

Concrete shapes are composed into a VectorShape which is put into a displayio Group for display.

VectorShape provides transpose and x/y positioning for shape implementations.

Included Shapes:

  • Circle

    • A radius; Circle is positioned at its axis in the VectorShape.
    • You can freely modify the radius to grow and shrink the circle in-place.
  • Polygon

    • An ordered list of points.
    • Beteween each successive point an edge is inferred...
low sentinel
manic glacierBOT
#

I was truing an I2C device with the STM32F405 undere CP 5.3.0 and it crashes to the HardFault Handler


You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
                                 Press any key to enter the REPL. Use CTRL-D to reload.


``` when I try to run the ht16k33_segments_simpletest

the code runs f...
simple pulsar
#

Are there any issues with BLE code getting stuck in start_scan()? I developed https://learn.adafruit.com/circuit-playground-bluefruit-quick-draw-duo/quick-draw-duo on a few versions including 5.0.0-beta.2 and it was fine. I just ran it up on 5.3.0 and something is amiss. I have newer libraries too... [added later] turns out 5.2.0 is ok, I put in a ticket for this https://github.com/adafruit/circuitpython/issues/2875

Adafruit Learning System

Challenge a friend to see who can 'draw' the quickest over Bluetooth.

GitHub

I was puzzling over some trivial BLE code not working on REPL on 5.3.0 on an nrF52840 based CPB, e.g.: >>> import adafruit_ble >>> from adafruit_ble.advert...

manic glacierBOT
manic glacierBOT
#

I was puzzling over some trivial BLE code not working on REPL on 5.3.0 on an nrF52840 based CPB, e.g.:

>>> import adafruit_ble
>>> from adafruit_ble.advertising.standard import Advertisement
>>> ble = adafruit_ble.BLERadio()
>>> scan = ble.start_scan(Advertisement, timeout=5)
>>> print(scan)

>>> for adv in scan:
...     print(adv.complete_name)
...
...
...
Traceback (most recent call last):
  File "", line 1, in 
  File "adafruit_ble/__init__.py", line 235, in start_sc...
manic glacierBOT
manic glacierBOT
#

Yes, BLERadio.tx_power is too broad as it stands. Maybe it could be the default power. We could add .default_tx_power as an alias for now, deprecate tx_power in the doc, and then remove it in 6.0.0. Or, since it's not really implemented, probably nobody uses it, and we could just drop it or cause it to throw an error now on "get", since it already throws an error on "set".

rain parcel
#

Has a cloud CircuitPython Mu editor been considered, like MicroBit has? When my Makerspace hosts classes so much up-front time is consumed in setting things up, and the Mu editor is problematic on some devices; it would be nice to have an OS-agnostic solution.

manic glacierBOT
#

Hi,
I'm a little desperate and I'm hoping someone can give me an answer.
I'm trying to display bitmap images on the LCD screen of the '2.4" TFT Featherwing'. I use the displayio module, the ILI9341 driver and the latest version of Circuitpython (5.3.0).
I can display text and draw shapes, but I can't display images with 'OnDiskBitmap()'.

Everything works fine with Pyportal or with a Feather M4 Express + TFT Featherwing, but as soon as I run the same code on the Feather nRF52840 + TFT Fe...

ivory yew
#

@rain parcel I think the new web file API is still in preview, but once that's available that + webserial would make that possible.

manic glacierBOT
#

another piece of information

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.3.0 on 2020-04-29; Feather STM32F405 Express with STM32F405RG
>>> import adafruit_msa301
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_msa301.py", line 53, in <module>
  File "adafruit_register/i2c_struct.py", line 41, in <module>
RuntimeError: maximum recursion depth exceeded
>>> 
ivory yew
simple pulsar
#

Is address_bytes on an Adresss supposed to be in reverse order here? It's a bit wierd!! ```>>> e.address.address_bytes
b'\xZZ\xZZ\xZZ\xc7R\x04'

e.address
<Address 04:52:c7:ZZ:ZZ:ZZ>
type(e.address)
<class 'Address'>
``` - the ZZ is a bit of data-masking.

onyx hinge
#

the docs explain that it is so

simple pulsar
manic glacierBOT
simple pulsar
ruby atlas
#

Huh, builds are failing on check formatting... This black thing wants the code to be unreadable 😦

#

When did black get added to the libraries? I hate it.

#

I can't even find any settings file for black to make it not make function/method args spread over a million lines.

manic glacierBOT
ivory yew
#

black doesn't have many settings (by design)

#

What's the code that's bothering you, @ruby atlas ?

ivory yew
#

@ruby atlas you can use # fmt: off and # fmt: on to prevent black from formatting something if it does something totally egregious.

ruby atlas
#

@ivory yew i really really hate how it formats function args and method args. It makes it really hard to read. I also understand it messes with list formatting too.

#

i'm sure there are many other things I hate about how it formats code. It also makes it much harder to read what actually changed without increasing my git diff -U a fair bit (like -U10)

ivory yew
#

Hrm, there's a way to make it ignore unchanged files

#

not sure if we set that up or not

ruby atlas
#

I saw I can turn it off with # fmt: off, but i'm pretty sure that me doing that for whole files wouldn't be received well.

ivory yew
#

yeah probably not. 🙂

ruby atlas
#

I guess I missed the discussion when black was selected as a way to format the libraries. Been way too busy with work.

ivory yew
#

The whole point of black is to make pickiness about formatting irrelevant.

#

though you can't ever make everyone happy.

ruby atlas
#

Black is awful though - it removes the ability to carefully format things for readability. The opinions in PEP8 and similar are pretty darn good, but still leave room for layout.

#

Anyway, I'm likely not going to contribute to the libraries much with black there. I hate it.

ivory yew
#

that's really unfortunate to hear, considering most projects adopt black to lower the barrier for new contributors so they don't have to worry about adhering to unwritten styling rules.

ruby atlas
#

Ugh. I guess python took a really bad direction this year 😦

ivory yew
#

Is there anything we could do to make it easier for you?

ruby atlas
#

Have black not want to split everything onto one line.

ivory yew
#

It might be worth chatting with Łukasz if you feel strongly about this. He's a super reasonable person and a friend of mine.

manic glacierBOT
ruby atlas
#

Probably. The reason I hate the one-line -per-arg convention is I literally scroll past method and function signatures without seeing them. My brain registers them as ... not sure - I just don't see the code structure anymore with black.

ivory yew
#

Yeah. I mean, ultimately it comes down to taste.

#

I think as projects get bigger and bigger with more contributors, it's valuable to have a tool enforce style rather than have the codebase look like it was created by 100 people with 100 different ideas on stuff.

#

I've definitely seen projects where people just change formatting and then get into arguments about it. 😦

ruby atlas
#

Right... Pylint and PEP8 have been pretty good at helping. But in my opinion, black takes it just a bit too far. From where I'm looking at this, black is changing a half century worth of code formatting conventions.... And in my case, over 35 years of how I'm used to function and method definitions looking when I scan and navigate code. My brain is used to a pattern we've been using for a very long time, and I don't see myself ever liking black. The code doesn't flow visually.

#

But my opinion is probably antiquated and irrelevant.

#

If I have time (hah), maybe I should write an unblack that I can run while I code to layout arguments and large lists in a sane manner, and then rerun black after.

ivory yew
#

haha

#

you can write black plugins, I think!

#

That might be viable. 🙂

#

Obviously our community will be better for your contributions, but if you don't feel happy when doing it that's understandable.

ruby atlas
#

Probably not the right place for this, but has anyone done a survey on developer satisfaction with how black formats code?

ivory yew
#

probably a better question for Lukasz.

#

though I think in the Go community they consider gofmt to be a significant contributor to their developer satisfaction.

half geyser
#

Also, just FYI, I have a terrible patch to Circuit Python that adds a .record() function to I2SOut. It seemed easier to do it that way. For now it's mostly testing, and is useful for me understanding all the little undocumented features of this chip, but might be worth adding something similar at some point: https://github.com/simmel-project/circuitpython/commit/07c27d0cf9a02cad6b7c7213e6521252860840b7

GitHub

Add some absolutely awful test code for recording from i2s. It works,
barely. And maybe not at all.

Signed-off-by: Sean Cross

slender iron
#

@ruby atlas The one-line-per-parameter thing is what bugged me most too but it does make diffs easier to read, especially when you include type hints and a default value for each parameter. I've gotten used to it and totally buy the argument of "lets standardize on one thing even if it isn't perfect. Consistency is the most important attribute of formatting.

main meteor
#

I've been doing it that way for years

manic glacierBOT
#

Ujson should only worry about whitespace before JSON. This becomes apparent when you are using MP stream protocol to read directly from input buffers.

When you attempt to read(1) on a UART (and possibly other protocols) you have to wait for either the byte or the timeout.

Fixes:

  • Waiting for a timeout after you have completed reading a correct and complete JSON off the input.
  • Raising an OSError after reading a correct and complete JSON off the input.
  • Eating more data than seman...
ruby atlas
#

I disagree: readability is the most important attribute of formatting.

#

I also don't buy the diffs argument. Maybe I would have before tools that do excellent diff highlighting. See my comment about having to increase the number of lines of context now to see what changed.

#

I'll engage Łukasz at some point, and hopefully find time for an unblack formatter (or black plugin) that I can use when working on black formatted code. Mostly I'm sad I missed the discussion about whether to adopt black as-is on the CircuitPython libraries and wasn't able to voice my concerns.

topaz quest
#

I realise just sending this for whichever library I was looking at was probably not the best choice — so if anyone has interest in "enforcing" license-tagging of files, I've sent an RFC pull request in https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/pull/99 that uses the REUSE tool 🙂

manic glacierBOT
onyx hinge
#

good morning discord

tulip sleet
#

@ruby atlas I think you may know this, but the one-line-per-element thing can be controlled. The line length is a command-line parameter. So perhaps your "unblack" for your own purposes can just be black -l <something more than 88>.

manic glacierBOT
#

In time, we should transition all background tasks to work this way, but by preserving the existing "supervisor_run_background_tasks_if_tick" code we can do this piecemeal.

Before this, the mp3 file would be read into the in-memory buffer only when new samples were actually needed. This meant that the time to read mp3 content always counted against the ~22ms audio buffer length.

Now, when there's at least 1 full disk block of free space in the input buffer, we can request that the buff...

simple pulsar
tulip sleet
#

@simple pulsar I am debugging some BLE code on master (past 5.3.0) and am not seeing this problem, but I will try to reproduce

simple pulsar
#

I think start_advertising was fine, it was start_scan that was problematic, i.e. some stuff certainly works

manic glacierBOT
#

This code works for me on a Feather nRF52840 with 5.3.0, and the latest adafruit_ble straight from the repo:

import adafruit_ble
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement, Advertisement

ble = adafruit_ble.BLERadio()  # pylint: disable=no-member

while True:
    for adv in ble.start_scan(Advertisement, timeout=5):
        print(adv, adv.complete_name)

I see various advertisements printed.

Note that in the example above, with timeout=5...

manic glacierBOT
#

I've gone back to 5.3.0 on a CPB and it works today, very puzzling. I would normally expect "user error" here but there's not much to go wrong.

I would have upgraded the files in lib after i did the upgrade to 5.3.0 yesterday. I would then have tapped control-d / control-c to reset things. Is there anyway the previous libraries could have had a persisting, negatve effect there?

#

If you did a control-d, it should be fine. A power cycle will definitely reset everything, but I very rarely do that. ctrl-d is fine.

But make sure there aren't two versions of the library, one in lib/ and one in /.

If you did ctrl-d, and then had to ctrl-c a code.py, then it's possible there was some leftover BLE state. In general I test with a code.py, or remove code.py and do manual imports of test programs (so I can have multiple test programs). And as I mentioned, testing...

#

I believe this problem may have been introduced by the lower-power branch.

I don't have a simple how-to-reproduce, because the simple program I created to look for the problem seems to work just fine. It may have to do with high CPU utilization from MP3 decoding, interrupts from sound DMA, etc., it's hard to be sure.

How to reproduce:

  • set up jeplayer and some mp3sa on a pygamer
  • with 5.3.0 loaded, start playing tracks, check that play/pause with the "any" button works
  • with m...
idle owl
#

The CircuitPython Weekly is in a little over an hour. Everyone is encouraged to attend! Please add your status updates and hug reports to the notes doc even if you'll be attending - it's super helpful! Looking forward to chatting soon. Thanks! <@&356864093652516868> https://docs.google.com/document/d/1bzaYoTmWls07acn7JB4z0CX9BiTymQH-22rwZzXIObE/edit#

onyx hinge
#

where has my morning gone? 😭

lucid solar
#

@idle owl I'm skipping it today...I feel sick. Have a good meeting!

idle owl
#

@lucid solar Feel better soon!

ivory yew
#

@narrow dirge it ran away with mine

onyx hinge
#

@lucid solar take care of yourself and take care of others by distance

#

hi @ivory yew 👋

raven canopy
#

hope you feel better soon @lucid solar 🍜

lucid solar
#

Thanks @idle owl @onyx hinge @raven canopy. It's not the virus type of sick thankfully 🙂

raven canopy
#

@solar whale you around? wanted to ask you if you've seen any issues on Ubuntu 20.04 with switching over to the bootloader drive...

manic glacierBOT
solar whale
#

@raven canopy not sure what "bootloader drive" you are referring to

raven canopy
#

FEATHERBOOT and the like

solar whale
#

not that I have noticed.

raven canopy
#

k. thanks. just trying to vector an issue i'm having... 😣

blissful pollen
#

I have managed to get my AHRS library I demoed on show and tell last week into a (somewhat) proper library. I know a couple people here had gave me a start to it and were asking to see it... so here it is!
https://github.com/gamblor21/CircuitPython_AHRS

solar whale
#

just verified taht FEATHERBOOT comes up OK with a feather m4 express

blissful pollen
#

I have only been able to test it was a LSM9DS1 as that is what I have, but seems to work for the most part

solar whale
#

@raven canopy what board?

raven canopy
#

so, far a Metro M4, with bootloader 3.6 and higher. i still need to walk back bootloader versions further. (this is all on an RPi with Ubuntu 19.10+)

solar whale
#

OK -- my bootloaders may be older -- I'll try updating a metroM4

raven canopy
#

@solar whale note: i'm seeing total system lockups with this, so make sure you're in a situation where you can suffer through a hard-reset. 😄

solar whale
#

lockup of the ubuntu Pi?

raven canopy
#

yep

solar whale
#

hmm -- I do have an ubuntu pi -- I have to verify the version etc -- been gathering dust. I can experiment with it - no worries.

raven canopy
#

thanks!

#

updates hug report 😄

solar whale
#

ooh -- my metro m4 is at bootloader 2.0.0 -- time to update....

manic glacierBOT
modern wing
#

Good afternoon all you wonderful folks -- lurking today [as happily as one can be when putting out fires].

maiden chasm
#

Hello to All, I'm also lurking

solar whale
#

@raven canopy as of now my ubuntu pi does not see the metro m4 at all -- CIRCUITPY or METROM4BOOT ... investigating

errant grail
#

Hello everyone! I'm text only today.

solar whale
#

Hi text only....

serene warren
#

Lurking - noted in doc

simple pulsar
#

Lurking sometimes

serene warren
#

Yes

#

Hello

#

Little on loud compared to Kattni

sterile bronze
#

lurking

serene warren
#

or maybe Kattni is low...

onyx hinge
#

OK, starting to record lurkers

#

you know you you are, but I may not..

tidal kiln
#

lurking

inland tusk
#

lurkinkg this week

old smelt
#

Lurking

modern wing
#

....when I said I was putting out fires, that's not what I had in mind 😉

turbid radish
#

Lurking

#

If you all have cool stuff for the CircuitPython newsletter out tomorrow, please email them to me at anneb@adafruit.com now. I'm closing the edit phase soon

uncut nexus
#

lurking today

idle owl
#

They're testing it now. They claimed they'd only do it once.

turbid radish
idle owl
#

Apologies for the delay.

inland tusk
#

10--4

tiny oriole
#

wee woo wee woo

ivory yew
#

I don't have a fire alarm to deal with, but there is an obnoxiously loud bird right outside my window. He is singing the song of his people.

onyx hinge
#

@blissful pollen are you lurking or will you be speaking in the meeting today?

blissful pollen
#

lurking

onyx hinge
#

got it, thanks

raven canopy
#

@ivory yew maybe its waiting for a Big Honking Button response?

ivory yew
#

@raven canopy hehe. I think that would only attract more birds.

onyx hinge
#

Visit the Adafruit shop online - http://www.adafruit.com


LIVE CHAT IS HERE! http://adafru.it/discord

Adafruit on Instagram: https://www.instagram.com/adafruit

Subscribe to Adafruit on YouTube: http://adafru.it/subscribe

New tutoria...

▶ Play video

Join Scott today (Friday May 8th) as he streams at 2pm Pacific. The plan is to recap ESP32-S2 work Scott did this week (lots of exciting progress!) and then start implementing digitalio and (if he’s lucky) busio for the ESP32-S2.

▶ Play video
#

(Scott typically streams at 2PM Pacific time)

solar whale
#

@raven canopy when you get a chance, can you give me teh contents of your /etc/apt for Ubuntu 19.10 on RPi -- mine is very unhappy.... lots of broken links.

raven canopy
#

can do

solar whale
#

no rush

onyx hinge
#

oh no I just realized I fell out of the list of PR reviewers this week. Bad jeff, no biscuit.

raven canopy
#

quality > quantity! 😄

onyx hinge
manic glacierBOT
#

FYI ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.3.0 on 2020-04-29; Feather STM32F405 Express with STM32F405RG

import adafruit_rfm9x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_rfm9x.py", line 49, in <module>
File "adafruit_bus_device/spi_device.py", line 33, in <module>
RuntimeError: maximum recursion depth exceeded

old vapor
#

Hello well I not sure what im doing or did wrong... plugged Feather M0 in double clicked reset got FEATHERBOOT dragged CircuitPython 5.3 on it drive went away and i never see the the drive again what did i do wrong/

manic glacierBOT
ivory yew
#

~eventually~, @slender iron.

slender iron
#

🤞

ivory yew
#

primary goal right now is to just make it easy to use from circuitpython.

slender iron
#

same api would be good 🙂

onyx hinge
#

(does the hostess featherwing have a logo? Is it a cupcake?)

tiny oriole
#

Hello well I not sure what im doing or did wrong... plugged Feather M0 in double clicked reset got FEATHERBOOT dragged CircuitPython 5.3 on it drive went away and i never see the the drive again what did i do wrong/
@old vapor If you double tap the reset button, do you get the FEATHERBOOT?

old vapor
#

@tiny oriole Yes I did

ivory yew
#

@onyx hinge I didn't give a separate logo, but this is what i looks like:

old vapor
#

@tiny oriole Err do

old smelt
#

I am

ivory yew
#

Though I really want to do a pink soldermask for the production one. 🙂

ionic elk
#

@ivory yew where do u get your 3d parts?

tiny oriole
#

try flashing it again? haha. Secondary, i would say doublecheck to make sure you have the latest drivers (Link incoming, one second)

tulip sleet
#

@old vapor exactly which board is it and which .uf2 did you load? Also what is the host operating system?

ionic elk
#

and what is that rendered in?

turbid radish
#

I don't know who I am

ionic elk
#

looks great

ivory yew
#

@ionic elk 3dcontentcentral, mostly.

#

KiCAD, though the product images you see on <winterbloom.com> are rendered in fusion 360.

tiny oriole
onyx hinge
#

@ivory yew looks good .. should still find room for a cupcake

raven canopy
#

@old vapor also, i'd recommend making sure you have the correct firmware file. the names can kind of melt together sometimes.

ionic elk
#

I should swap to kicad if I can get exports that pretty

ivory yew
#

@onyx hinge hehe I'll make a note.

slender iron
#

Hi text only....
@solar whale This is why I thought you were text only

ionic elk
#

my eagle images are always hideous

tiny oriole
solar whale
#

Ahh -- that was in response to Cgrovers post ...trying to be funny...

slender iron
#

ah, ok. 🙂

#

glad you checked the notes doc

old vapor
#

@tulip sleet @tiny oriole Downloaded latest Drivers using Win 10 feather M0 all correct files

tulip sleet
#

Windows 10 does not need drivers, but the installer should not install them anyway

#

it checks it is windows 10

#

however Kasperksy and Norton antivirus can prevent CIRCUITPY from appearing

old vapor
#

Using Neither of those

tulip sleet
#

are you using another third-party antivirus?

old vapor
#

Just Windows

tulip sleet
#

that should be fine.

serene warren
#

@solar whale have you experienced any power issues with the camera? Maybe indicated by grainy B&W images.

onyx hinge
#

I haven't been following, did you check what the onboard status led is saying?

tulip sleet
solar whale
#

not that I have seen -- using with RPI zero w and a USB "power bank" 2.1 Amp

ivory yew
#

Ah yes, the telephone game of carrying a bug between implementations

tulip sleet
#

can you connect to the REPL with Mu or Tera Term?

tidal kiln
#

@old vapor what was the exact full name of the UF2 file you dragged over?

old vapor
#

adafruit-circuitpython-feather_m0_express-en_US-5.3.0

raven canopy
#

welcome to C-land!

ivory yew
#

"copying files and adding a string" basically sums up my 18 years of programming experience.

tidal kiln
#

@old vapor ok. seems fine. then what @tulip sleet asked about connecting to REPL.

solar whale
modern wing
#

That feeder is for the birds 🐦

old vapor
#

I get an error cannot find CP device sorry typing bad just had carpal tunnel surgery

idle owl
#

@wise spoke Are you lurking?

wise spoke
#

y e s

slender iron
onyx hinge
#

hah he beat me

modern wing
#

Early bird gets the worm 😉

raven canopy
#

fights urge to paste... 😉

onyx hinge
#

more press for scott's great livestreams

modern wing
#

His streams are very nice deep dives, showing that programming isn't magical, instantaneous coding -- but step by step problem solving, needing patience, persistence, and even more patience 😉

ivory yew
#

that's a chonky led in the preview

slender iron
#

I think I had it from a college breadboarding kit 🙂

#

not even sure of the resistor value

idle owl
onyx hinge
#

swoon I'll be sharing that with my woodoworking friends

old vapor
#

@tulip sleet so when i connect it back to computer i don't see drive start MU i get Could not find an attached Adafruit CircuitPython device. tried it again when i can see bootloader drive same issue

tulip sleet
#

@old vapor I just want to doublecheck that the bottom of the board says "Feather M0 Express". Did you try copying the .uf2 file again? Does anything unusual happen when you do the copy? Do you see a progress bar that stalls for a while?

#

as Jeff E. asked, what are you seeing on the RGB led (neopixel)?

old vapor
#

thats what is wrong thought is was express but is a basic 😦

tulip sleet
#

ok! there is still a version you can load

old vapor
#

@tulip sleet Thanks and it is back reading is for the mental so i koalafi

lone axle
#

@tulip sleet is there a github link for the new BLE Services stuff? I am curious to try it out to see if the Android version of the app suffers from any sort of similar issues.

onyx hinge
#

LSE = low speed oscillator?

tulip sleet
#

there is LSI and LSE, yes low-speed

#

internal and external

onyx hinge
#

aha

tiny oriole
#

got another call. See ya all! happy coding!

slender iron
#

Adafruit CircuitPython 5.2.0-167-gdcb0e50f0-dirty on 2020-04-22; Feather STM32F405 Express with STM32F405RG

tulip sleet
#

@lone axle you'll need the latest adafruit_ble library

onyx hinge
#

Adafruit CircuitPython 5.3.0-184-g90bd93180 on 2020-05-11; Feather STM32F405 Express with STM32F405RG

raven canopy
#

🎉

solar whale
#

👍

raven canopy
#

@solar whale so, booted my 20.04 first absent-mindedly. booting 19.10 now... 😄

#

you want full folder? or just sources.list?

onyx hinge
#

@idle owl I'll let you wrap up

solar whale
#

@raven canopy a zip of the folder would be best, I think

ionic elk
#

big weedy energy

slender iron
#

@ionic elk did jeff or limor ask you to do more rgb matrix stuff?

ionic elk
#

jeff did

slender iron
#

kk

solar whale
#

when I plug in the board, dmesg looks normal, but it does not mount. i may be missing something.

modern wing
#

Thanks!

serene warren
#

@solar whale I've been using a cell phone or other auto adjust camera for so long, I forgot how wonderful adjusting fstop can be.

slender iron
#

was hoping to see more work on imx too

modern wing
#

And no fire alarms either!

onyx hinge
#

@slender iron Limor told me that @ionic elk would be doing other STM parts. I brought the news to him but assumed Limor would have more deets

ionic elk
#

They are currently simultanious

slender iron
#

kk, np

ionic elk
#

i.MX is more weedy and sometimes frustrating so I figured RGB would be a good relaxing thing by comparison

#

I like physical stuff

onyx hinge
#

👋

slender iron
solar whale
#

@raven canopy oops -- just realized -- I am using 19.04, not 19.10...:-(

raven canopy
#

oh. hehe

#

i don't think i have 19.04 readily bootable. i moved my primary (SSD) to 19.10, have one SD on 20.04, and my other SD on raspbian.

manic glacierBOT
solar whale
#

sorry for the false alarm -- I have not used it in several months and really have no need for it since I now have latest arm tools on raspbian.

raven canopy
#

fair enough. i avoided raspbian; building from source is too long a wait... 😄

solar whale
#

but I can say I have not problem mounting metrOM4BOOT on my Ubuntu 20.04 -mac mini

#

withr 3.9.0 bootloader

raven canopy
#

that's good enough info really. like i mentioned in status, i'm still working my way through finding where the actual issue is.

#

although, could you check one thing for me on the mac-mini? is it using xhci, ehci, or something else for the usb driver?

solar whale
#

If you ever want a "tarball" of the arm tools for raspbian let me know.

#

where to I check for the usb driver?

raven canopy
#

dmesg should show, during enumeration

solar whale
#
[Mon May 11 15:15:24 2020] usb 3-1.4: New USB device found, idVendor=239a, idProduct=0021, bcdDevice=42.01
[Mon May 11 15:15:24 2020] usb 3-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Mon May 11 15:15:24 2020] usb 3-1.4: Product: Metro M4 Express
[Mon May 11 15:15:24 2020] usb 3-1.4: Manufacturer: Adafruit Industries
[Mon May 11 15:15:24 2020] usb 3-1.4: SerialNumber: 4632E64B53574E514D202020FF081736
[Mon May 11 15:15:24 2020] cdc_acm 3-1.4:1.0: ttyACM1: USB ACM device
[Mon May 11 15:15:24 2020] usb-storage 3-1.4:1.2: USB Mass Storage device detected
[Mon May 11 15:15:24 2020] scsi host8: usb-storage 3-1.4:1.2
[Mon May 11 15:15:24 2020] hid-generic 0003:239A:0021.0022: hiddev1,hidraw3: USB HID v1.00 Device [Adafruit Industries Metro M4 Express] on usb-0000:00:14.0-1.4/input3
[Mon May 11 15:15:25 2020] scsi 8:0:0:0: Direct-Access     Metro M4  Express         1.00 PQ: 0 ANSI: 2
[Mon May 11 15:15:25 2020] sd 8:0:0:0: Attached scsi generic sg3 type 0
[Mon May 11 15:15:25 2020] sd 8:0:0:0: [sdd] 16000 512-byte logical blocks: (8.19 MB/7.81 MiB)
[Mon May 11 15:15:25 2020] sd 8:0:0:0: [sdd] Write Protect is off
[Mon May 11 15:15:25 2020] sd 8:0:0:0: [sdd] Mode Sense: 0f 00 00 00
[Mon May 11 15:15:25 2020] sd 8:0:0:0: [sdd] No Caching mode page found
[Mon May 11 15:15:25 2020] sd 8:0:0:0: [sdd] Assuming drive cache: write through
[Mon May 11 15:15:25 2020]  sdd:
[Mon May 11 15:15:25 2020] sd 8:0:0:0: [sdd] Attached SCSI removable disk
#

xhci_hcd

raven canopy
#

xhci it is. thanks!

solar whale
#

👍

#

unless you want me to keep it for some reason, I thin I will "recycle" the ubuntu pi back to raspbian....

raven canopy
#

no reason that i see.

solar whale
#

I forgot I even had it -- but now that it's in front of me , I can think of better uses for it.

raven canopy
#

haha. that's usually how it goes.

solar whale
#

I have way too many toys...

raven canopy
#

that's not a real thing. at least, not in my opinion. 😄

simple pulsar
idle owl
#

Here is the notes document for Monday’s CircuitPython Weekly meeting. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/15gBlvCmwW-f26oYTY5LI897XAfc5GpYlNC7httMFFqU/edit

manic glacierBOT
rare geode
#

language-circuitpython v0.7.0 has been released to APM which brings support for input into the serial monitor (thanks to @timid nimbus!). if anyone wants to give it a shot and let me know of any feedback or issues I'd be grateful. stay safe all!

#

I know there are some existing issues with the bindings file not been located and I've been working for ages on trying to get that to work but I can't figure out why some people can reproduce it and some cannot

slender iron
#

@rare geode what is that for?

#

oh! for atom!

rare geode
#

oh yeah! whoops! should have clarified, it's the atom plugin I wrote a while back

#

the serial port library for node is a nightmare for shipping because it uses compiled bindings

slender iron
#

ya, I bet!

rare geode
#

oh interesting

slender iron
#

do you have a blog about it somewhere? we could add it to our weekly newsletter

rare geode
#

I don't (though I really should start a blog), I wrote it about exactly a year ago and spoke with people here about it. other than that it probably spreads by word of mouth and the search. I'd love for people to be able to use it although the odd serialport errors do worry me a bit, it's not ideal for end users to have to rebuild the bindings

slender iron
#

kk cool! release notes can be a good place to put info about a new release too

manic glacierBOT
slender iron
#

@ionic elk how is the LSE stuff coming?

ionic elk
#

It's done I'm just double checking the stack stuff rn

manic glacierBOT
#

Ok, fixes are in @tannewt. @jerryneedell, the stack sizes have been adjusted - if you could run your stack code on this that would be very helpful.

Important note! Once programmed you may need to reset the power before these fixes will take effect. It appears settings in the Backup Domain like to persist past writes and such, and I've observed that sometimes the chip will not boot when switching between the LSI and LSE, as we saw briefly on the call today. A simple reset does not do the t...

slender iron
#

thanks @ionic elk, looking now

manic glacierBOT
ruby atlas
#

@tulip sleet thanks for the tips re black, will check it out.

manic glacierBOT
#

That was poor wording on my part. Without these patches, I couldn't reliably test, since whenever it went on battery it would effectively crash. With this patchset in place, I was able to concentrate on other parts of the chip in order to bring current consumption down there.

kk, awesome! I'm excited to see the subsequent PRs. Are you blocked on TinyUSB changes now?

simple pulsar
#

How are dict variables laid out in memory? I have one that's gradually growing over time and adding a value to it is eventually giving a MemoryError. I'm wondering if parts of it need contiguous memory?

slender iron
#

it's a hash table that probably doubles in size every time it grows

simple pulsar
#

I've had two of them die i different places on additions but the allocation is only 1016. I think I'll puzzle over this tomorrow.

slender iron
simple pulsar
#

@slender iron thanks

manic glacierBOT
#

TileGrid is well-suited to maximizing bitmap grids. I tried to use it for vectorio but was unable to do so without branching an unreasonable amount.

It does feel similar, yes; but:

  • Positioning is a bit different with vector shapes. x+width has nothing to do with the location of the pixels to be drawn in these shapes.
  • There is no width and height external to the shapes themselves. These are not sprite sheets!
  • I'm hoping to make an mp_shape_protocol in the future and just ...
topaz quest
#

do comments in .py files count against the ram used by circuitpython on the m0? I'm wondering if I just wrote too much code, or too verbose

manic glacierBOT
#

A few questions. Lots for my brain to process. Thanks for this! It'll be a huge benefit for folks. Line might be nice to have too.

This CR is too large, sorry! I've never made a vector display library and didn't know what would work, so I just kind of went for it.

Agreed, Line would be very good. I don't think I want to creep features on this cr any more than it already has though 😓

tulip sleet
#

@topaz quest No, comments are removed and are not kept in RAM. If you are getting a memory error on import, you can try compiling the file to .mpy with mpy-cross and using that instead. Remove or rename the .py file, because it will take precedence over the .mpy file.

topaz quest
#

@tulip sleet ah good — I'll give that a try tomorrow (getting "early in the morning" here) — for the moment I solved it by "hatchetting" the code until it kind of worked, but it's in no way close to a possible pull request 🙂

tulip sleet
#

what that will do is not use up RAM (temporarily) when compiling, because it will have been done in advance. It won't change the size of the ultimate compiled code. Good luck!

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 5\.4\.0\-beta\.0
orchid basinBOT
manic glacierBOT
#

The CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE variable adjusts how much of the flash is dedicated to an internal filesystem, and changing the size causes the filesystem to move. Since it's located in a platform header file, it also causes a rebuild of most of the port.

However it does not cause a rebuild of the linker script, meaning in practice the filesystem is physically positioned at the old location. Additionally, pointers inside circuit python will not match the intended layout.
...

#

This does depend on the tinyusb patch, because tud_task() can hang the system if interrupts are disabled. In fact, the hang only occurs if it would have encountered the disconnect/connect issue that this patch aims to fix.

My concern is that other background tasks require interrupts to be enabled, and I am unable to exercise those. However, I do think that others will begin to report issues with missed events with the lower power WFI patch, and some approach like this will be required ...

onyx hinge
#

Thanks for 5.4.0 beta !tannewt!

slender iron
#

np! all out now

manic glacierBOT
#

Just a follow up on the Terminal in CircuitPython. I’ve got a simple terminal working that is a wrapper around the tileGrid. It handles a few of the basic functions including showing cursor location, text entry, scrolling. It’s adequate for a minimalist text editor built from this editor https://github.com/robert-hh/Micropython-Editor

This library is currently in flux and doesn’t yet meet CP group’s guidelines but perhaps it can point in the right direction.
[https://github.com/k...

manic glacierBOT
manic glacierBOT
#

Try moving into lib/protomatter and checking out 9f71088d2c32206c6f0495704ae0c040426d5764 which is the commit currently in master. That should hopefully fix it.

For the catwan you can just disable COUNTIO for it. It must be tight on space. You can add TRANSLATION=de_DE to the make command if you want to try building it locally.

Thanks!

topaz quest
#

@tulip sleet yeah mpy-cross worked, thanks!

simple pulsar
tulip sleet
#

@simple pulsar thanks, maybe this is fragmentation. I think your last example, in the second post, could be telling and I'll open an issue for that (or you can if you want).

manic glacierBOT
manic glacierBOT
#

from @kevinjwalters:
https://forums.adafruit.com/viewtopic.php?f=60&t=165359 (this example from second post in that thread)

Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit CLUE nRF52840 Express with nRF52840
>>> from adafruit_clue import clue
>>> import time, gc, random
>>> gc.collect() ; gc.mem_free()
89872
>>> a=[(1.0, 2.0, 3.0) for x in range(500)
... ]
>>>
>>> def read(n):
...     for idx in range(n):
...         a[idx] = clue.magnetic
...
...
...
>>> gc...
manic glacierBOT
simple pulsar
#

@tulip sleet Thanks for having a look. I have a bit of a dusty clue library but i'm not sure that could explain why it suddently blows up when i go near monotonic_ns().

manic glacierBOT
#

This is telling, it's something to do with the evaluation of the result in the argument to a function or specifically to print.

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit CLUE nRF52840 Express with nRF52840
>>> from adafruit_clue import clue
>>> import time, gc, random
>>> gc.collect() ; gc.mem_free()
89872
>>> a=[(1.0, 2.0, 3.0) for x in range(500)
... ]
>>> gc.collect() ; gc.mem_free()
71648
>>> read(500)
...
#

It's got weirder, following on from commands in previous comment:


>>> t1-t2
-1782595000
>>> print(-1782595000/1e9)
-1.78259
>>> print(t1/1e9)
18424.0
>>> print((t1-t2)/1e9)
MemoryError: memory allocation failed, allocating 512 bytes
>>> print((t1+t2)/1e9)
MemoryError: memory allocation failed, allocating 512 bytes
>>> print(t1/1e9 - t2/1e9)
-1.78125
>>> print((t1-t2)/1e9)
MemoryError: memory allocation failed, allocating 512 bytes
crimson ferry
#

@rare geode With the Atom plugin, what assumption is made about which USB is used for serial/REPL (assuming I have multiple CP devices plugged in, and they each have unique volume names)?

rare geode
ionic elk
#

@tulip sleet it's been a while since I touched it, but I just noticed that the SAMD implementation doesn't actually do pin claiming. Do you know why that is?

tulip sleet
#

@ionic elk samd implementation of what?

ionic elk
#

pin claiming. There's no array in the samd port that stores what pins are being used by modules

#

It only protects things like the neopixel. But you could otherwise grab a pin that's being used by an existing module and it wouldn't be able to tell.

#

Contrasting to the NRF port, which has a table that stores every pin in use, and the STM32 which was based off NRF.

tulip sleet
ionic elk
#

Ah, gotcha, so it uses pin number for everything then

tulip sleet
#

it uses an integer pin number, but the point is that there's a common register for most pins that says what function that pin has been assigned to (e.g. a particular peripheral function). There's no such common thing in nrf, for instance: each peripheral has a pin mask, and the pin gets assigned to the last peripheral that had the pin chosen in its pin mask.

ionic elk
#

Hmm, interesting. I guess the equivalent for STM would be that each pin has an altfn, but that isn't enough to tell exactly what peripheral you've assigned since a single pin-altfn combination can support multiple peripherals.

#

anyway I'm just asking because I'm implementing it for i.MX now. I think I'll probably just stick with the claim-pin array

tulip sleet
#

in STM does the altfn setting getting cleared if the pin is not in use?

ionic elk
#

spending 8 bytes on a claimed pin array in exchange for not having to do register reads seems like a good tradeoff

#

I have actually never read altfn stuff out of a pin, the ST hal is pretty one-way

tulip sleet
#

in samd the pinmux settings are the ground truth, so it's kind of the same thing as having a pin claiming array

ionic elk
#

I'd have to look up how the actual registers store it and do my own implementation

#

Yeah ST doesn't have that kind of globally stored information they count on you having a bunch of structures for everything that you either pass around or toss and re-do

tulip sleet
#

in the atmel world people are a lot more inclined to use the CMSIS direct-register layer when needed, i guess

ionic elk
#

I could have used it more in STM32, but honestly I just think the HAL is more readable

tulip sleet
#

the hal layers are often relatively thin. they mostly do higher-level driver stuff which you'd rather not write yourself, like buffer mgmt

ionic elk
#

Well, actually, no, the big reason to use the HAL in STM32 is because the registers are different between every chip family

#

lol

#

so you save yourself a bajillion preprocessor statements.

tulip sleet
#

also the hal can be pretty incomplete, especially in asf4. There are multiple layers

#

that makes sense. the samd21/51, and the other related sam<x>11, etc. all have pretty similar peripherals.

#

the samd51 was a bigger departure than most

ionic elk
#

So, if you set a pin for a certain peripheral in SAMD, is it actually impossible for it to conflict with another one and get undefined behavior?

#

Because in STM32, you can totally assign two different clocked peripherals to the same pin and spit out garbage

tulip sleet
#

yes, impossible, because it's set by the pinmux register. nrf sets the crossbar to the last periph you chose: you can't set it to two periphs simultaneously

ionic elk
#

neat

ionic elk
#

still figuring out how i.MX does it

manic glacierBOT
slender iron
#

@ionic elk using register state is better because it can coexist with other code that isn't in circuitpython

#

an in-memory array can be ignored

#

in iMX you'll want to look at the IOMUXC peripheral

ionic elk
#

@slender iron yeah I'm trying to see if it's possible to do in i.MX

#

I can see the advantages

#

but so far, I really can't say I'm a fan of the i.mx docs or commenting... this IOMUXC peripheral is inscrutable

slender iron
#

what are you reading?

ionic elk
#

I've got the MCUExpresso SDK manual, the 1010 Reference Manual, and the actual IOMUXC macro definitions page open

slender iron
#

kk, I'm looking at the reference manual

ionic elk
#

reference manual seems like the best bet, the API manual is basically useless they don't list any of the actual settings or explain very much

slender iron
#

ya, I tend to stay in the data sheet / reference manual

#

the samd data sheet has the reset state but I don't see it here

ionic elk
#

I'm just trying to figure out what the reset state is yeah, so I can implement reset_all_pins

#

but they don't have a macro for it, and they don't list a define option either

slender iron
#

usually it's connecting to GPIO without the input and output buffers on

#

macro for the reset state?

low sentinel
#

(low-pri) mp_hal_ticks_us is not implemented on the samd port.
Not sure I actually want that though - would love a utility function (or macro, whatever) that returns just an unsigned reference counter that counts micros or nanos or clocks... anything finer than milliseconds from the supervisor ticks. I'm probably missing something and this already exists?

ionic elk
#

I'm looking for a "set_pin_disable" thing is what I mean

#

both to use and to know what pins are at startup

slender iron
#

@low sentinel you now need to start your own timer for high res time-keeping because the monotonic counter is only 32768 ticks a second

#

see pulsein as an example

ionic elk
#

in ST hou HAL_GPIO_DeInit

low sentinel
#

thanks

slender iron
#

@ionic elk it might be quickest to just read the registers on start up

ionic elk
#

in ST you've got the HAL_GPIO_DeInit function

#

@slender iron yeah that's probably a decent idea

slender iron
#

the "functional description" subsections are usually the most useful

#

the gpio peripheral has reset bits

#

ah, IOMUXC has reset value in the memory map

ionic elk
#

Hmm, so it's different for different pins I guess

slender iron
#

ya, the 0x5's are gpio

#

0x7 is jtag it looks like

#

so it'll be similar to samd

ionic elk
#

k

idle wharf
#

This isn't urgent... so just whenever has some time...

I saw in the CP 5.4.0 Beta release notes that the OpenMV H7 board was added, which was a big surprise (I own one). It looks like this was some sort of early support step to enable further development... but I didn't find any tracking issues. What's next for the OpenMV running CP?

slender iron
#

It should run but it won't have any camera support

idle wharf
#

I saw Kwabena's comments about making a more universal library for the camera, so I'll watch for that work to happen and come to CP. Thanks Scott!

slender iron
#

cool cool. we mainly just wanted to be able to test on it

#

we do want to do camera support at some point but I doubt we'll ever match openmv's support

idle wharf
#

Love that idea of camera support for CP and ya know a Camera Feather Wing...
And then CP DashCams, CP VanLife\AdvVan Cams, CP Astrophotography... 🙂

slender iron
#

😄

manic glacierBOT
#

as-is:

Circle -> shape:{1012px,  2.9ms, 345429.0pps fill}  shape_pixels:{1098.6us total,  1.1us/px}
Circle -> shape:{ 880px,  2.4ms, 360448.0pps fill}  shape_pixels:{ 732.4us total,  0.8us/px}
Circle -> shape:{1012px,  2.9ms, 345429.0pps fill}  shape_pixels:{ 732.4us total,  0.7us/px}
Circle -> shape:{ 880px,  2.4ms, 360448.0pps fill}  shape_pixels:{ 732.4us total,  0.8us/px}
Circle -> shape:{1012px,  2.8ms, 360446.0pps fill}  shape_pixels:{ 976.6us total,  1.0us/px}
Circle -> shap...
timber mango
#

@gilded cradle How about a 12 character display? 😀 I also have 3 of the 7-segment displays to solder. I will do those tomorrow. Now, I have to wire these up. 😀😉

timber mango
#

They are at addresses 0x70, 0x71, and 0x72

#

Dang, I am out of jumpers. I should have thought to order more when I got the displays. Oh, well, that will have to wait until next month or after. 😦 😦

tulip sleet
#

@idle owl I'm getting the dreaded "toctree contains reference to document 'api' that doesn't have a title". You put something here a couple of months ago that said it was due to autodoc_mock_imports being incomplete. I've added everything under the sun to that, and I'm still getting it. As with you, I cannot figure out what is different in this library vs others.

idle owl
#

@tulip sleet Running locally or it's pushed and running in actions already?

tulip sleet
#

i get the error in both places

#

I can replicate locally

manic glacierBOT
#

Following up on the issue in #2866, the "backup domain" causes issues with low speed oscillators if it does not have write access enabled. This low power domain write access has now been enabled for the F4 family, but the F7 and H7 were skipped as they have different register settings.

This should ideally be solved by moving ALL of the low power oscillator setup code from port.c to the peripherals directory. The HAL RCC setup functions already in use there will handle these low level regi...

idle owl
#

I was going to ask to see it, that's why I asked whether it was pushed.

tulip sleet
#

oh, maybe i haven't pip'd something it needs locally

blissful pollen
#

@tulip sleet I received that same error working on my library. I noticed api.rst was missing a title line compared to the other RST files. I had to look at it in raw to see it

tulip sleet
#

but most of our api.rst files don't have titles, and they don't fail :/

idle owl
#

None of ours have titles. They are auto-generated

#

Let me see the code @tulip sleet, you may need to automock something oddly to make it work. I've had to I think.

tulip sleet
#

hold on one sec, I am trying one trick

idle owl
#

@tulip sleet adafruit_ble isn't automocked.

manic glacierBOT
#

This is fine. :-) Just my initial reaction and clearly you've thought about it way more than me.

I'm a little sad it takes so long to draw a large rectangle and would like to profile to find the slowest parts. The shape API could be extended to allow shapes to provide batch pixels if their implementations have a fast way to determine batches (rather than 1px at a time).

I thought about doing run length masking and pixel values instead of individual ones. However, I needed to pull myse...

tulip sleet
#

@idle owl added it locally (and also made sure it was pip'd); still failing

ionic elk
#

@slender iron @indigo wedge Could I get a quick sanity check on the chip pin reset? From what I can tell, the mimxrt does not have any functions capable of automatically returning pins to a reset state. Additionally, the individual reset states of each pin register at startup are not consistent - the SW_PAD_CTL_PAD_GPIO registers differ in their pullups.
So I think, given this, I'm going to need to store the reset state information per pin, and then add an array of pointers to every pin I can iterate through in order to correctly set pin to the reset state. Am I missing anything that would make this unnecessary?

idle owl
#

@tulip sleet I'll take a look. Cloning now

ionic elk
#

I don't know how critical it is to preserve the pullup information at reset for each pin, but I figure it's important to have the startup state match soft reboot state

indigo wedge
#

@ionic elk Hmm, I haven't looked into the reset states so I'm not that familiar with them, having a table seems a bit overkill but I guess it makes sense for consistency. We could also agree on a reset state and apply that on reset but then the state might differ before the the sw takes over.

ionic elk
#

It seems overkill to me too but I've never seen a HAL layer before that literally doesn't have a function for pin reset

indigo wedge
#

So I'm not sure, maybe @slender iron knows more or can share his thoughts from the viewpoint of CPY

ionic elk
#

So I'm kind of scrambling here lol

idle owl
#

@tulip sleet You're going to hate this.

tulip sleet
#

i made a spelling error

idle owl
#

Wait, maybe not.

tulip sleet
#

is that it?

slender iron
#

I'd default the pinmux to 0x00000005 and then special case the others that don't match like JTAG

tulip sleet
#

when I run sphinx-build locally I always do -a otherwise it caches bad builds

idle owl
#

@tulip sleet No I thought it was a whitespace issue, but it had ignored that change and didn't actually rebuild. So it looked like it passed. nm.

manic glacierBOT
raven canopy
#

@idle owl @tulip sleet intrigued. hopping in too.. 😄

low sentinel
#

@slender iron Build CI has not yet run on the new build configuration. You sure you want to merge now?

slender iron
#

you can merge my PR into yours and then yours will run

#

I won't merge into master until it's green

#

translation files are finnicky

low sentinel
#

Translations are extremely nice polish. It's only a pain when you have a high rate of change (a healthy project) 😄

slender iron
#

yup, agreed

#

oops, I pred to your master branch 🙄

low sentinel
#

I see that. I'll ff my vectorio branch

slender iron
#

you can snag my vectorio if you like too

#

sorry for the wrong PR

manic glacierBOT
low sentinel
#

I was curious anyway; pull --ff-only was clean

slender iron
#

👍

ionic elk
#

@slender iron you have any opinion on this reset pin business?

slender iron
#

I'd default the pinmux to 0x00000005 and then special case the others that don't match like JTAG

ionic elk
#

@slender iron the MUX register isn't really the problematic one

#

it's the PAD register

slender iron
#

looks

ionic elk
#

Basically, a bunch of different pads have different pullup settings

manic glacierBOT
slender iron
#

@ionic elk just ignore pad

#

it doesn't really tell you whether someone is using the pin

ionic elk
#

but it affects the pullup on startup, doesn't it?

#

Since the default for the MUX is GPIO

slender iron
#

yes but I'm ok ignoring the pull strength when determining whether something is "in use"

#

the one thing I don't see is knowing that a pin is being used to read a digital value

#

there is an input buffer but I don't see what turns it off and on

ionic elk
#

Sorry, to back up, what I'm trying to do right now is reset all pins

#

but for reading the MUX to detect pin use, I'm not sure how I could do that either since the GPIO setting for it will be the same when it's used by DigitalIO, so I'll still need a claimed pins table to keep DigitalIO from trying to claim existing pins

slender iron
#

most pads reset to 0x10a0

ionic elk
#

yeah I wasn't sure if you wanted the remaining ones accounted for

#

philosophically, to retain the same known state as startup

#

if it's nbd than it's nbd

slender iron
#

you probably should because the pulls could be things like JTAG that need it

#

my guess is that the pad exceptions match the mux exceptions

#

you can detect output digitalio by reading GDIR

raven canopy
#

@tulip sleet @idle owl i've got it past the title error, but now hitting struct errors...

ionic elk
#

GDIR?

idle owl
#

@tulip sleet @raven canopy Looking at other ones with packages, the api.rst file needs to have every file listed. What did you do to get past the title error?

ionic elk
#

I don't see that, only SION and MUX_MODE

slender iron
#

look in GPIO

ionic elk
#

oh so I'd have a sub-check within GPIO

slender iron
#

yup

#

but I don't think that helps you for input

raven canopy
#

@idle owl list each file in api.rst, drop _service from the title in color_sensor.py, and change the autodoc_mock's entry for adafruit_ble_adafruit -> adafruit_ble.

idle owl
#

ok trying that.

#

Woof.

raven canopy
#

i tried to mock struct but still throwing the error. not surprising since its in the stdlib.

idle owl
#

Hah I just tried that too.

#

Should have known you'd try it.

#

@raven canopy Added adafruit_ble_adafruit back to automock in addition to the rest and it's back to the title failure, but the struct failure is gone.

raven canopy
#

mocking the library for its own docs seems...weird. 😄

slender iron
#

@ionic elk so ya, I think you need a bitmask to track in use. since pins default to in

idle owl
#

@raven canopy Agreed.

ionic elk
#

yeah that's what I've been assuming thus far

#

glad I didn't miss anything though

simple pulsar
#

@idle owl I did see a guide that had some pylint stuff in to workaround a mock failure, is that what you're discussing?

idle owl
#

@simple pulsar I don't believe you saw that - pylint doesn't help with this. Sphinx is failing to build here in a way that is usually resolved by using autodoc_mock_imports properly.

simple pulsar
raven canopy
#

ahh. autodoc is coughing on the const(0xFF) not being an integer...

idle owl
#

@simple pulsar Yes that is a Pylint issue, not a Sphinx issue.

#

Without that Pylint would fail, but Sphinx might build successfully.

#

@raven canopy I leave this in your capable hands, I need to tap out. Newsletter video needs to be done and I probably shouldn't have taken as much time as I already have to try to figure this out.

tulip sleet
#

@idle owl thanks for trying. the things I have to say about sphinx...

topaz quest
timber mango
#

@topaz quest You can open a new issue on the library or core part you are working with.

topaz quest
#

this is a bit of a meta-issue pretty much -- I'm suggesting license-tagging the source to match https://reuse.software/ specs (because right now from the docs pages there's no obvious license/copyright info attached to examples)

We make licensing easy for humans and machines alike. REUSE solves a fundamental issue that Free Software licensing has at the very source. Adopting our recommendations is as easy as one-two-three!

timber mango
#

You can suggest anything in an issue. It does not have to be code related.

topaz quest
#

no that part I guess -- the problem is that this is less library-specific and more "throughout project" kind of suggestion

#

(or if it's not meant to be a throughout project, then I guess that pull request is fine)

timber mango
#

It does not have to be library specific or even core specific. It could even be infrastructure related.

#

Or pretty much anything else.

#

As long as it relates to Circuitpython in some way.

tulip sleet
#

@topaz quest we don't put licenses in the example files because it just bulks up those files, and the applicable license is the license file for the repo anyway

topaz quest
#

@tulip sleet yeah I agree it would bulk up to put license headers everywhere, that's what REUSE is trying to fix by relying on single-line SPDX indentifiers instead

manic glacierBOT
slender iron
#

@topaz quest for project stuff we usually just have it on adafruit/circuitpython. The weekly meeting is the best place to discuss it

#

I'll move the issue

#

ah, it's a PR. I won't move it. 🙂

manic glacierBOT
#

There are two kinds of bootloader for the feather - the built in one, which is stored in a special region of memory, and the UF2 one, which is stored in the beginning of the flash memory and uploads to the flash after itself. To use the UF2 bootloader, you'll need to actually program it into flash using either the built-in bootloader, or by using a dedicated programmer over SWD or JTAG.

The UF2 bootloader is a separate binary that you need to compile from here: https://github.com/adafruit...

topaz quest
#

ah, it's a PR. I won't move it. 🙂
@slender iron yeah sorry, I got overexcited when I was looking at that and didn't think to look up the right way first ^^; I'll open an issue after dinner and reference the pull request as example for implementation 🙂

slender iron
#

np 🙂

#

for a wide change we'd also want to have automated checks to enforce it

topaz quest
#

yep, reuse-tool has a lint mode which integrates with pre-commit and other continuous integrations explicitly for that 🙂

#

(and that's what I love about it)

slender iron
#

👍

#

it's definitely something we should be better about

twilit geyser
#

Does CPy have an mDNS library?

slender iron
#

not that I know of

twilit geyser
#

darn. I was trying to implement something using one. oh well

#

couldn't find one, so i should have figured that

slender iron
#

@prime flower would know for sure

low sentinel
slender iron
#

ya, I feel ya

ionic elk
#

Are there any naming guidelines for custom circuitpython libraries? I'm writing one for the Dyanmixel servos, and I'm not sure what to name it.

#

Hierophect_Circuitpython_Dynamixel?

slender iron
#

ya, that's what I'd suggest

ionic elk
#

Seems like basically everything in the bundle is Adafruit, but I could have sworn there were some user contributed libraries, is that not the case?

slender iron
#

there is a community bundle

blissful pollen
ionic elk
#

😮 how do you post and play overwatch at the same time

#

that's dedication

blissful pollen
#

forgot it was running actually

ionic elk
#

you're not posting on adafruit as you idle on Torbjorn? disappointment

#

that's my pro strat

manic glacierBOT
solar whale
#

alright - I'm hooked. Python virtual environments are really nice.... old dogs -- new tricks 🐶

raven canopy
#

they really are

solar whale
#

I'm done kicking and screaming...

tidal kiln
#

i finally started using venv some months ago. they do help.

solar whale
#

I found it hard to leave Wordstar, too 😉

#

Just ran into a simple case -- the Adafruit_nRF52_Bootloader build Makefile uses "python" -- it works fine with python3 but my newly updated Ubuntu system only has python3 -- at first I edited the Makefile to change "python" to "python3" but that was not very satisfying -- generated a "dirty" build. Creating a python3 venv worked much better.

simple pulsar
#

@solar whale I was disappointed when edlin disappeared.

solar whale
#

sigh...

topaz quest
#

I may or may not have used joe for my first few years as a Linux user because it worked with my muscle memory...

solar whale
#

we better switch to politics ... 😉

#

sorry -- did not mean to stifle the conversation....

raven canopy
#

@solar whale wait till we get you using pyenv to run multiple python interpreters... 😄

lone sandalBOT
lone sandalBOT
manic glacierBOT
crimson ferry
#

boot.py executes first if it exists, then it seems the run priority is: code.txt, code.py, main.py, main.txt ...or is that order not deterministic? (thinking about ways to do OTA code.py update w/o a custom bootloader)

lime trellis
#

Anyone know a better way than

del sys.module['MODULE-NAME']

to remove all instances of a module in the heap? I want to be able to dynamically re-import a file already located on the filesystem.
@tulip sleet - any tips 😇?

tulip sleet
#

basically, no, it's not easy. @marble hornet has been doing this a lot to try to unload and load things to save RAM. But it's painful. are you doing this just for testing purposes or you're writing a big program?

#

consider restarting the whole thing and deciding what to import based on the next task

marble hornet
#

And it is quite doable, you just need to be careful about references

tulip sleet
#

it's not something that people typically do with python

marble hornet
#

^^

#

agreed, technically supported by cpython but not suggested

lime trellis
#

Interesting!
My use case is dynamically updating PORTIONS of a circuitpython script over-the-air by making the code modular and then pushing new .mpy files over RF

tulip sleet
#

i will leave you two to it, good night, but consider just restarting to avoid leaks and fragmentation

lime trellis
#

thank you @tulip sleet 🙂 I will take a strong look at that again

#

@marble hornet can you elaborate a lil more about your references comment?

#

I'm imagining the other potential references made to the module floating around?

marble hornet
#

(is it watch based? )

lime trellis
#

@marble hornet thank you that tabs is open, but I found myself using python3 features in the python3 REPL (like reload()) that wasn't available once I went back to CP.

The goal is basically "hot code swapping" where the VM will do things like:

if X: import everything in /abc/ 
else: import everything in /def/

if that makes sense

marble hornet
#

@lime trellis yes? since python is garbage collected you can "reload" a module be delete every reference to it (this includes the ones in sys.modules) then calling gc.collect . then you need to re-import. I find that using the import <name> statement to be a bit clumsy for this and tend to use the __import__('<pathw/dots>') function . if you want to go into more detail we could schedule a time to chat and code together during a non nocturnal hour.

#

and see if there are better, less-fiddely solutions to your use case

lime trellis
#

@marble hornet those are excellent points, thank you. I also really appreciate the offer! Let me wrestle with things for a while before I take any more of your time. I'll ping ya when I have a better feel for the limitations of my current approach and see if there's time in your schedule

marble hornet
#

sounds good, as a hint I'd suggest two things: removing all bust one reference to modules at the time of import and comparing the previous sys.module.keys() vs the one after importing.

raven canopy
#

@lime trellis also, if you have a trusted source, you could just read the text into a variable and exec() it...

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 3.0.0-alpha.1-5657-g99a833bd6-dirty on 2020-05-12; Adafruit Metro M4 Express with samd51j19
>>> import os
>>> os.listdir()
['.fseventsd', '.metadata_never_index', '.Trashes', 'code.py', 'lib', 'boot_out.txt', 'System Volume Information', 'exec_source.txt']
>>> source_text = ""
>>> with open("exec_source.txt") as f:
...     source_text = f.read()
...
...
>>> source_text
'print(\'exec_test.txt source read...\')\r\nclass foo():\r\n    def __init__(self):\r\n        self.msg = "Hello, I\'m foo."\r\n\r\nprint("class \'foo\' created. creating \'bar\' as an instance of \'foo\'...")\r\nbar = foo()\r\nprint("bar has a message for you:", bar.msg)'
>>> exec(source_text)
exec_test.txt source read...
class 'foo' created. creating 'bar' as an instance of 'foo'...
bar has a message for you: Hello, I'm foo.
>>>
lime trellis
#

@raven canopy holy cow! I never knew about exec ! Thank you 🙂 I have more reading to do now

raven canopy
#

its handy. but i'll stress it again: use with trusted sources only. exec and eval have no real safety net...

lime trellis
#

Yeah they look gnarly! Can't wait to break my board in new interesting ways

#

😛

raven canopy
#

hehe

#

also, just so you're aware. if you use classes/etc like i did above, you can still run into long-living objects:

#
>>> globals()
{'bar': <foo object at 200037f0>, 'os': <module 'os'>, 'source_text': 'print(\'exec_test.txt source read...\')\r\nclass foo():\r\n    def __init__(self):\r\n        self.msg = "Hello, I\'m foo."\r\n\r\nprint("class \'foo\' created. creating \'bar\' as an instance of \'foo\'...")\r\nbar = foo()\r\nprint("bar has a message for you:", bar.msg)', 'f': <io.TextIOWrapper 200032f0>, '__name__': '__main__', 'foo': <class 'foo'>}
lime trellis
#

I believe it! just compiling byte code all willy-nilly haha

#

i love it. Thanks for the tips!

raven canopy
#

happy adventures! 😄

manic glacierBOT
#

Takes polygon from 126k pixels per second fill to 240k pps fill
on a reference 5 point star 50x66px polygon, updating both location and shape
at 10hz. Tested on an m4 express feather.

As a curiosity, the flat-out fill rate of a shape whose get_pixel is return 0;
fills just shy of 375k pixels per second.

Baseline:

Polygon -> shape:{1020px,  8.1ms, 126603.0pps fill}  shape_pixels:{5859.4us total,  5.7us/px}
Polygon -> shape:{ 510px,  4.0ms, 126603.0pps fill}  shape_pixe...
manic glacierBOT
slender iron
#

@lime trellis I highly recommend Dan's suggestion of replacing the mpy and then rerunning the VM. Trying to delete imported modules isn't recommended and I would have no qualms breaking how it works.

manic glacierBOT
manic glacierBOT
prime flower
manic glacierBOT
manic glacierBOT
tulip sleet
#

@slender iron I have finished with Adafruit Services but it needs a CPy build with the PacketBuffer fixes. 5.4.0-beta.0 has that USB disconnect issue (I see it on nRF) and also runs the services demo programs a lot more slowly possibly due to shutdown/wakeup, even though there are no explicit sleeps in the main loop. Are there some fixes for 5.4.0 that are imminent, or should we think about a 5.3.1? We can discuss at meeting tonight... I still have some guide pages to write before it's ready.

manic glacierBOT
#

@tannewt I can look into it if you have a pointer to where else we're doing this. In samd audio it looks like audio interrupts "are involved" (e.g., we look at event_interrupt_active to decide whether more data needs to be fed) but it still didn't work, which is why #2889 had a similar "fix" for audio weirdness. I guess both could use further looking into rather than speculative fixes.