#circuitpython-dev

1 messages ยท Page 288 of 1

manic glacierBOT
slender iron
#

@raven canopy @pastel panther see the issue above about formatting all libraries with black (a python code formatter)

#

I talked with john about it yesterday

ionic elk
#

by the way @tulip sleet @slender iron, when I implemented core temp I also went ahead and added the core voltage implementation, and I noticed there isn't really any corrective measure added for the regular ADC in that case. Reading the core voltage reference returns 1.28, so adding a corrective factor at ADC startup would likely add a pretty significant increase in accuracy. Is that something we care about? I don't see it implemented in other ports.

pastel panther
#

@slender iron will do

slender iron
#

@somber coral is sprinting on it this morning

pastel panther
#

ok

idle owl
#

@gilded cradle Please jump into CircuitPython voice to do an audio check if you can

gilded cradle
#

kk

serene warren
#

Lurking (it's an ISTJ thing ๐Ÿ˜Ž )

idle owl
#

@serene warren Excellent! Can you move your entry in the notes to alphabetical order please? Thanks!

modern wing
#

Good afternoon all you wonderful folks -- happily lurking today! ๐Ÿ™‚

idle owl
#

@gilded cradle Can you do notes today?

gilded cradle
#

Sure

idle owl
#

Thanks!

serene warren
#

Oops, will do. habit of just adding to the end.

gilded cradle
#

@serene warren, I moved your hug report to the right place

serene warren
#

Thank you @gilded cradle

half sedge
#

Lurking or not even there today.

timber mango
#

lurking today

sterile bronze
#

Lurking

turbid radish
#

Lurking

modern wing
#

yep!

tidal kiln
#

lurking
hug to danh for helping figure out some BLE stuff

errant grail
#

lurking

fierce girder
#

hmm not hearing any audio

lone axle
#

your icon has a cross through the headset

onyx hinge
#

@fierce girder click the crossed out microphone icon next to your name at the bottom left

fierce girder
#

thanks ๐Ÿ™‚

river quest
#

Scott's talk from PyCascades:
https://2020.pycascades.com/talks/pythons-next-decade-and-us/

time-coded url:
https://youtu.be/2WdjlznbD0o?t=29274

stand-alone video on our youtube, unlisted:
https://youtu.be/qOcDabScXO8

PyCascades Day 2

The following times are all in Pacific Standard Time(PST).

9:15am - 9:45am Welcome to PyCascades
9:45am - 10:10am Terri Oda: Rock on: Building hardware and software for a MicroPython decibel meter
10:20am - 10:45am Julia Piaskowski: Adventures in Babysitti...

โ–ถ Play video

Letโ€™s brainstorm where Python will grow in the 2020s! Who will be using Python in 2030 and why? How will people use Python? Where will Python fit in the global computing community? What can we do to make our ideal Python over the next decade? What TLC will help Python the most?

...

โ–ถ Play video
gilded cradle
#

Cool

river quest
#
Adafruit Industries - Makers, hackers, artists, designers and engineers!

Congrats MicroPython 10,000+ stars on GitHub! MicroPython is a a lean and efficient Python implementation for microcontrollers and constrained systems, and itโ€™s what CircuitPython is based onโ€ฆ

slender iron
#

๐ŸŒŸ

river quest
#
Adafruit Industries - Makers, hackers, artists, designers and engineers!

Get a CLUE at PyCon US! Digi-Key and Adafruit have teamed up to get the latest and greatest Bluetooth and CircuitPython powered boards to each attendee, the CLUE! Hereโ€™s a video from our showโ€ฆ

turbid radish
#

Awesome! a CLUE for all PyCon attendees!

river quest
#
Adafruit Industries - Makers, hackers, artists, designers and engineers!

The Open Hardware Summit 2020 wrist-watch badge is CircuitPython poweredโ€ฆ and itโ€™s the 100th BOARD in circuitpython/downloads. As we see new photos, updates, videos, and more, weโ€™โ€ฆ

#

Latest Open-Source Hardware certifications:
Worth noting a trendโ€ฆ Feather format, AND/OR supporting CircuitPython continues to be popular in industry as well as open-source hardware communities.
https://blog.adafruit.com/2020/02/06/latest-open-source-hardware-certifications-make-by-mweinberg2d-ohsummit-oshw-oshwa/

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

Latest Open-Source Hardware certifications at MAKE byย Michael Weinberg โ€“ Theย Open Source Hardware Associationย (OSHWA) runs aย free programย that allows creators to certโ€ฆ

fierce girder
#

hooray ๐Ÿ™‚

old smelt
#

Joining late. Lurking. May have to leave early.

river quest
#

here's the DRAFT of the upcoming โ€œPython for microcontrollersโ€ newsletter that ships out tuesday at 11am ET via adafruitdaily.com - please send any links, news, events and more via an issue/PR, or @ us or really any thing ๐Ÿ™‚ we'll get it added!

https://github.com/adafruit/circuitpython-weekly-newsletter/blob/gh-pages/_drafts/2020-02-11-draft.md

turbid radish
#

Definitely we can get some info into the newsletter this late but we need it very shortly, either in the GitHub repo or tag me this hour

slender iron
marble hornet
#

Lurking

#

Un lurking

graceful heart
#

lurking

slender iron
#

๐Ÿ‘‹ @graceful heart

graceful heart
#

๐Ÿ‘‹

tiny oriole
#

just lurking ๐Ÿ™‚

#

relatively new to the discord community, but definitely getting acquainted and welcome to help out

raven canopy
#

Hey! Got swooped up impromptu style at work, and have another meeting shortly. I'll try to get some notes in...

Outside of that: Group hug to all!!

lone axle
#

go ahead and read mine sorry

#

I will try again for my status report. Looks like I had the wrong mic selected in discord ๐Ÿคž hopefully got it set correctly now.

slender iron
#

๐Ÿ‘

fierce girder
#

good point, I should add myself to the document, thanks

gilded cradle
#

Yeah, I try and type what people say, but miss things sometimes

timber mango
#

Text only, no mic.

serene warren
#

Wow, I'm part of a focus (people who aren't coders - well, not a very good one ๐Ÿ˜‰ )

#

sorry bout that

slender iron
#

๐Ÿ™‚

errant grail
#

Yes, still lurking.

onyx hinge
#

@errant grail momentarily confused since you did not have a muted mic icon

graceful heart
#

๐Ÿž

onyx hinge
slender iron
#

@fierce girder I'd be happy to sync on low power ideas. I was hoping to start with time.sleep actually stopping the core

half sedge
#

Thanks for reading and pasting the link. It is chaos at home right now.

turbid radish
#

Good idea @idle owl

lone axle
graceful heart
#

+1 for that idea

half sedge
#

Droid?

slender iron
#

a star wars droid toy

gilded cradle
#

Thanks

modern wing
#

Thanks!

turbid radish
#

Thanks all!

serene warren
#

great meeting

errant grail
#

Thanks! And sorry @onyx hinge for the lurk/non-lurk/murkiness with the mic icon.

tiny oriole
#

good to meet you all!

graceful heart
#

๐Ÿ‘‹

half sedge
#

@idle owl Did you have a look at the enhanced thermal camera?

slender iron
#

<@&356864093652516868> Next week's meeting is on Tuesday 2/11 (24 hours after the normal time) at 11am Pacific / 2pm Eastern here on Discord.

idle owl
#

@half sedge Are you going to rearrange the meeting notes, or should I?

#

I haven't had a chance to look at it, no @half sedge

half sedge
#

@idle owl please do it, my son is using the xomputer

#

@idle owl What about your blog post on MLX? I guess if the enhanced version is much better I could try a learn guide?

idle owl
#

@half sedge The blog posts for guide releases are short, don't go into much detail, and are meant simply to inform that the guide has been released.

pastel panther
#

@half sedge apologies if I glossed over it; I was talking about the remote control R2 or BB-8 style droids that you can build at Disney Land

half sedge
#

@idle owl Right now I believe I found a bug in the screenshot library. Display IO to BMP thing.

turbid radish
#

@idle owl, phil said he's in until 5 pm

idle owl
#

@turbid radish I thought he emailed during the meeting.

turbid radish
#

@idle owl, sorry, gmail just refreshed, cool, thanks

idle owl
#

@half sedge Please file an issue if you found a bug.

half sedge
#

@pastel panther so nothing I could shop online...

#

@idle owl the issue is filled with picture and BMP.

solar whale
#

@slender iron I think you mean 2/18

slender iron
#

@solar whale ah, thanks!

pastel panther
#

@half sedge unfortunately not, unless you could find one for sale on a place like ebay. Some people might put them up for sale on the Galaxy's Edge discord?

fierce girder
#

@slender iron thanks, re: power. Are there any projects that you know of where CircuitPython code is optimized for battery?

slender iron
#

<@&356864093652516868> Next week's meeting is on Tuesday 2/18 (24 hours after the normal time) at 11am Pacific / 2pm Eastern here on Discord.

half sedge
#

@pastel panther I think there is already someone working on sphero thing, and some look like BB8

marble hornet
#

@slender iron I think I figured out how to phrase what I was proposing last week. Do you have a minute ?

onyx hinge
#

afk

slender iron
#

@fierce girder I want to work on it soon

onyx hinge
#

@errant grail no harm done

slender iron
#

@half sedge @drowsy geyser was working on it

half sedge
#

@pastel panther Nearest Disneyland is in Paris for me... not too far, but I don't know if they have those droid.

#

I think that finding affordable BLE device that can be enhanced with CP could attract a lot of people to CP.

#

It need to be hackable, easy to find online, and have a Wow effect.

pastel panther
#

@half sedge looks like Paris will be getting a Galaxy's Edge/Star Wards Land where they have the shop to build the droids, however it it probably be a while

half sedge
#

@pastel panther I'm keep an eye on that. With my kids getting older and older it gets hard to justify that it is for them.

pastel panther
#

I have two droids for myself ๐Ÿ™‚

#

I like your idea about a flashy thing that can run CP. Gotta run but we can chat more later. Feel free to DM me

half sedge
#

@pastel panther if/when our timezone agree.

idle owl
#

Dropping off. Thanks everyone.

gilded cradle
#

I'm gonna drop off too

timber mango
#

Wait please.

#

@gilded cradle I have a demo to show you.

#

If I install PyLint locally and use the same configuration file Adafruit uses, would I be able to run it before pushing to git?

slender iron
#

@tulip sleet I bet we could get a big speed up by keeping track of the allocation search start for different block sizes

tulip sleet
#

I was thinking about something like that, but I was surprised MPy already doesn't do that

#

you still have to gc, but makign allocation faster would be good

slender iron
#

ya me too, seems like most allocations would be 1-5 blocks

tulip sleet
#

i thought/hoped maybe damien would comment further on the overall allocation strategy

slender iron
#

I'm kind of curious to track them

#

jimmo just did a video about the micropython gc too

idle owl
#

@timber mango Yes, there's a guide about it as well.

lone axle
#

@timber mango you would be able to run it locally if you do that. Though I'm not sure how to actually get the configuration to match. When I tried it, there were a few differences.

timber mango
#

I conquered my problem with Github! ๐Ÿ˜ƒ ๐Ÿ‘

lone axle
#

Some IDEs have it integrated as well. I use PyCharm a lot and it's got PyLint built in that will go ahead and highlight issues as I enter code to it

timber mango
#

@idle owl on the learn site? I will find it then.

#

@lone axle I am running on a Raspberry Pi 4.

lone axle
#

Ah, I know that PyCharm supports linux, but no idea about Rasbian / RasPi specifically, may not be possible in that environment.

manic glacierBOT
timber mango
#

@lone axle I will figure it out. I do not give up easily.

ionic elk
#

@slender iron do you happen to know of any existing hardware projects using Zephyr, by the way? I'm finding virtually none online that I can check my work against. Just a conference badge or something

manic glacierBOT
#

I am working with a Adafruit M0 Express, and have hooked it up to the Adafruit 16 bit I2C ADC ADS1115. I would like to read data at 250 Hz (permitted by the I2C ADS module) and save this data onto the flash on the M0 express.

My trouble is if I just have a while True loop where I read data and write data in sequence, I am only able to record data a couple times a second (far short of 250 Hz). I suspect that this is due to the time it takes to write data, but don't know an awful lot about ...

slender iron
#

@ionic elk only the micropython port

#

I believe that because I assume most our done by companies internally

#

@tulip sleet James Bowman != baldengineer == James Lewis

tulip sleet
#

oops, please fix! or I will

slender iron
#

I just heard you mention it, not sure where it is written

tulip sleet
#

did I write that down in teh notes?

#

no, I didnt', ok, thanks for the correction, if you are editing the audio you could erase that, but not a big deal

slender iron
#

nah, I'm not. just wanted you to know

timber mango
#

@slender iron I looked at Rust for IOT, but I do not want to mess with cross compilation right now and I do not want to learn a new language. I prefer to use and contribute to Circuitpython because of Adafruit's major push for education and women in technology. We need BOTH very badly!

slender iron
#

๐Ÿ™‚

timber mango
#

Besides all that, I write my robot controllers in Python 3 on the Raspberry Pi, and I have been working with Python for many years. I was very happy when I found Micropython and even happier when Adafruit started pushing Circuitpython. I have been telling all my online friends about Circuitpython and how easy it is to get started.

gilded cradle
#

@timber mango, hi, let me know when you can show me the demo. Thanks.

timber mango
#

I have something ready right now. It is just a script that animates the display.

gilded cradle
#

ok, cool

timber mango
#

Do you have the alpha display featherwing?

gilded cradle
#

Yep

timber mango
#

I could zip the script up and email it to you.

gilded cradle
#

Can you push it to your github repo?

timber mango
#

Sure, I can do that. I will make a circuitpython repo. Give me a sec.

gilded cradle
#

ok

timber mango
slender iron
#

@ionic elk I just noticed you hadn't also pinged my on ready PRs. please do it on the PRs themselves instead of discord because it'll sit in my inbox until I get to it then

ionic elk
#

k

slender iron
#

thanks!

gilded cradle
#

thanks @timber mango

timber mango
#

@idle owl Thank you for the awesome tutorial on contributing to Circuitpython! That enabled me to conquer my Github problem.

#

@gilded cradle You are welcome.

manic glacierBOT
gilded cradle
#

@timber mango, looks good. If you want to get the bitmask value a little easier, might I suggest using the bitshift operator? For instance segment A is 1 << 0, Segment B is 1 << 1, Segment N is 1 << 16.

timber mango
#

I prefer the decimal values because I think it makes it easier for people to make the connection to bits in bytes and such. So would C be 1 << 2?

stuck elbow
#

actually hex values would be easiest to read :)

idle owl
#

@slender iron Please pin the message about the change in meeting time for next week.

#

@timber mango You're very welcome ๐Ÿ™‚

timber mango
#

@stuck elbow Hex would be my next choice.

slender iron
#

@idle owl I expected to pin one with the notes doc. I can make it today and replace the existing message

gilded cradle
#

@timber mango, fair enough

idle owl
#

@slender iron Fair enough, I'll make it once I get the video up and I'll include the info in the message.

slender iron
#

k, either way. ๐Ÿ™‚

timber mango
#

@gilded cradle It took a lot less time to make animations after I assigned the bit values to the variables. All I had to think about were the segments after I had that.

slender iron
#

thanks for running the meeting!

stuck elbow
#

it would be nice to pin the notes doc before the meeting, I always have problems finding it

manic glacierBOT
timber mango
#

I submitted a small PR today.

meager fog
#

@tidal kiln hihi ok for the board error

#

wanna add a section to the troubleshooting faq?

tidal kiln
#

sure. can do.

#

basically a catch all for "board" related error messages

meager fog
#

yah

#

i agree the 'no D4 in board' error is usually due to that

#

ok gopher it!

marble hornet
raven canopy
#

@tulip sleet @idle owl csexton/release-asset-action PR was merged earlier, and subsequently tweaked. i just ran a test release on Adafruit_CircuitPython_TestRepo. Uploads were successful.
https://github.com/adafruit/Adafruit_CircuitPython_TestRepo/releases/tag/2.0.6

@idle owl changes were tagged to a release, so we can go about updating the workflows to point to that tag vs master. tag is v2.

idle owl
#

Ok!

#

@raven canopy Let's do it!

raven canopy
#

k. should be able to run as an adabot patch...

idle owl
#

I figured.

raven canopy
#

the bundles will need personal touches though. ๐Ÿ˜„

idle owl
#

Right ๐Ÿ˜„

lunar crown
#

What is the difference between an โ€œExtra Built-In Moduleโ€ described in โ€œExtending-CircuitPythonโ€ and an External Module, a.k.a., extmod such as being used for 'ulab'. Advantages / disadvantages?

idle owl
#

@raven canopy Can we fix the bundle first? Not that anything has been updated properly since this happened anyway, but still.

raven canopy
#

yeah. easy peasy. i'll get it after recovery. sprint days hurt... ๐Ÿค•

idle owl
#

@raven canopy Sounds good. ๐ŸงŠ ๐Ÿ”ฅ

slender iron
#

@stuck elbow we're trying to make the next week's notes doc after the current week's meeting along with pinning it. So, it should be available today

raven canopy
#

@pastel panther would you want to take a crack at running an adabot patch?

pastel panther
#

as long as you can guarantee that my computer won't burst into flames

raven canopy
#

quickly conjures a 'no promises' answer that doesn't sound like a 'no promises' answer ๐Ÿค”

pastel panther
#

that would be a hell of a bug

raven canopy
#

i mean, i could put an HCF print statement in there. ๐Ÿคฃ

pastel panther
#

"I can assure you that unless some malevolent person wrote the code to specifically make your computer burst into flames, it should not"

#

@raven canopy oh, you don't mean a patch to adabot, but having adabot apply a patch?

raven canopy
#

yes yes.

pastel panther
#

is it time sensitive?

raven canopy
#

@idle owl? ^

idle owl
#

Entirely.

pastel panther
#

This is for the bundle fix?

idle owl
#

We have no releases in the entire CircuitPython ecosystem without this patch.

raven canopy
#

same fix, but for all of the libs.

pastel panther
#

Someone else should probably do it

#

I'm trying to finish my thing

#

I'll do the next one

raven canopy
#

releases will work now that master has been updated. they just won't be guarded against further updates.

idle owl
#

Ah fair enough

raven canopy
#

@pastel panther sounds good. just wanted to get your pulse on it.

slender iron
#

@tawdry nimbus any attempts at getting circuitpython on the playdate yet? I met someone else from Panic this weekend at PyCascades and am happy to see you playing with an M0 in #help-with-circuitpython

raven canopy
#

@idle owl actually, wait. the release tags are...misleading. re-written history, back-dated release...master is where we want to be until a new release is tagged. ๐Ÿ˜•

manic glacierBOT
idle owl
#

@raven canopy Ok. It is what it is. At least we know what to focus on if it happens again.

#

File an issue on that repo about v2 not being what you thought it was?

raven canopy
#

if only the official actions supported glob pattern file selection!

idle owl
#

@onyx hinge Ping me when you have a moment. I started documenting running the meeting and I need your input before I keep going the way I am in case it's not at all helpful.

#

@raven canopy yeah, if only. ๐Ÿ˜•

#

@onyx hinge no rush, going afk for ๐ŸŒฎ anyway.

raven canopy
#

but...its not tuesday?

timber mango
gilded cradle
#

You could try and making it an example in the ht16k33 library repo.

timber mango
#

Yes, I could do that. Hmmmmm. I had thought to wait until the final version of animate() was in the library, but that might be awhile because I am looking into a way to write all digits at the same time for some even better effects.

#

If you are content with the demo source as is, I could pretty it up for PyLint and add it to the ht16k33 examples dir.

gilded cradle
#

Sounds good. I can review your PR and make any suggestions I see. Such as #!/usr/bin/env python3 should be removed since that isn't used for microcontrollers and it should be consistent with other examples.

timber mango
#

That sounds good to me!

#

Are there any special changes that have to be made to the Blinka compatible libraries to make them work?

tulip sleet
#

@meager fog @slender iron this is totally bizarre. I fixed bus_device so it doesn't allocate any objects doing its with. It runs quite a bit faster. But when testing, I found it was running slower than the old way in a loop of reads from an LIS3DH. In the old way, just reading was SLOWER than reading and unpacking:

Here is the original bus_device, which allocates objects due to __exit(*exc), which is invoked by the with:

1 cp._lis3dh._read_register: secs: 0.00976563, heap: 96
1 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.00976563, heap: 128

40 cp._lis3dh._read_register: secs: 0.0664063, heap: 3840
40 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.0644531, heap: 5120

50 cp._lis3dh._read_register: secs: 0.0800781, heap: 4800
50 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.0820313, heap: 6400

400 cp._lis3dh._read_register: secs: 0.763672, heap: 38400
400 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.587891, heap: 51200

1000 cp._lis3dh._read_register: secs: 2.54102, heap: 96000
1000 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 1.45508, heap: 128000
#

the number on the left is the number of repetitions. I just do a _read_register(), or I do a _read_register() and then unpack the result, which will allocate a bytestring. Notice that at reps 50 and above, the combo takes LESS time. The second time in each pair should be greater than the first, but it starts being less.

#

Here is the same test with my "improved" bus_device:

1 cp._lis3dh._read_register: secs: 0.0117188, heap: 0
1 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.0078125, heap: 32

40 cp._lis3dh._read_register: secs: 0.078125, heap: 0
40 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.0898438, heap: 1280

50 cp._lis3dh._read_register: secs: 0.0820313, heap: 0
50 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.109375, heap: 1600

400 cp._lis3dh._read_register: secs: 0.621094, heap: 0
400 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 1.04688, heap: 12800

1000 cp._lis3dh._read_register: secs: 1.53516, heap: 0
1000 struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)): secs: 3.47656, heap: 32000
#

the bare _read_register() consumes 0 heap, and is faster than the old way, but when combined with struct.unpack(), it's slower than the old way.

#

I can only guess that there's something about the storage allocator that's slower in the second case than the first. Maybe it's because the blocks are being filled more efficiently in the first case. I thought maybe it was a peculiarity of the LIS3DH, and I read two values at once to see if it was stalling if I read too fast, but that didn't change the weirdness of the result.

gilded cradle
#

@timber mango, there shouldn't be.

timber mango
#

It is that shouldn't be that always gets me into trouble.

tulip sleet
#

test prog:

import time
import adafruit_lis3dh
from adafruit_circuitplayground import cp

def time_it(f, n):
    heap_before = gc.mem_free()
    s = time.monotonic()
    for _ in range(n):
        f()
    heap_after = gc.mem_free()
    return "secs: {}, heap: {}".format(time.monotonic() - s, heap_before - heap_after)

def cp_accel():
    cp.acceleration

def read_reg():
    cp._lis3dh._read_register(0x28 | 0x80, 6)

def read_reg_then_unpack():
    struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6))

for n in (1,40,50,400,1000):
    gc.collect()
    print(n, "cp._lis3dh._read_register:",
          time_it(read_reg, n))
    gc.collect()
    print(n, "struct.unpack('<hhh', cp._lis3dh._read_register(0x28 | 0x80, 6)):",
          time_it(read_reg_then_unpack, n))
    print()
timber mango
#

@gilded cradle Please tell me about this should be consistent with other examples thing you mentioned.

#

Is there a standard for this I can read?

gilded cradle
#

I'm not aware of anything published, but I've seen and created enough examples to know I haven't seen that at the top of any other library examples.

timber mango
#

Oh, I deleted the top line. That is only for running on the Raspberry Pi direct.

gilded cradle
#

I figured, but perhaps it hasn't been added to other examples either for historical reasons in that Blinka didn't use to exist, or because maybe it can confuse new users.

timber mango
#

Yeah, that came over when I copied code from another of my scripts to start building the new one.

#

Other than that, is there anything else about the animation demo we should discuss before I put it into the library examples?

gilded cradle
#

Let's see what it looks like after you run it through pylint.

timber mango
#

OK.

#

PyLint is not going to like the way I have declared my constants.

slender iron
#

@tulip sleet I don't feel like I understand the differences enough. I would suggest using an external timer. I don't fully trust our internal time keeping

gilded cradle
#

What do you mean @midnight wedge? If you mean because they're not upper case, that should be fine for examples.

tiny oriole
#

@slender iron Working on a formal pinout for the Adafruit Clue nRF board using the Fritzing pinout and the eagle schematic as reference and found something that seems a bit odd. the AIN# definitions on the microcontroller and the AIN# definitions on the board seem to be at odds with eachother? or am i overthinking something

slender iron
#

I think it is possible that the net name has the external A# name while the chip channel is different

#

at least in circuitpython-land we have a difference between the two

#

@meager fog can clarify

timber mango
#

@gilded cradle I mean the white space around the "="

gilded cradle
#

Ah yeah, well that's why I suggested we look after linting

tiny oriole
#

i figured "D10/AIN7" was possibly coming from a board definition inside the CP firmware, while the "P0.30/AIN6" were coming from the physical chip. Just wanted to confirm before i incorrectly assumed D10/AIN7 matched P0.30 out of just not quite understanding something

slender iron
#

The AIN7 is the net name between the board connection and the mcu

#

The other name encodes the internal adc channel connected

tiny oriole
#

or should I make a separate column for both the net and the chip

slender iron
#

can you show me what you have so far?

tiny oriole
#

Sure. in here? (still need to confirm some of the information i have in there already)

slender iron
#

ya, here is good

manic glacierBOT
tiny oriole
slender iron
#

nice! I believe all pins are pwm because the nrf have a full pin matrix for digital signals

tiny oriole
#

not sure why that posted twice? keeps saying it failed upload

slender iron
#

ยฏ_(ใƒ„)_/ยฏ

#

I see it

tiny oriole
#

Thats kind of what i thought as well, and certainly seems that way looking at the Feather nRF

#

so yeah. i can add another row of labels for the chip-names next to the chip pins if you think it's useful information

slender iron
#

I prefer not to expose the mcu's name because board names are more universal

#

I can find the arduino mapping too, just gotta look

tiny oriole
#

gotcha!

slender iron
#

it doesn't look like there is a separate analog mapping

#

looks like it may have a0-a7 there

tiny oriole
#

Thanks! actually, now that i am looking at the placement of RX/TX i might still break RX,TX,BtnA,BtnB, SCK, MISO, MOSI,SCL, and SDA to their own line

#

I did see from dir(board) that there was a list of "P#" pins too

slender iron
#

ah, ya I see most things have P, D and A names

tiny oriole
#

ah, maybe thats where p0-19 comes from in board then. to help port over from microbit.

slender iron
#

ya, that's what I'd mimic most

#

I'm not a huge fan of the A and D naming we inherited from arduino

tiny oriole
#

i just left it with the pin number only. that way if you come from microbit or CP, its either D or P. BYO prefix

slender iron
#

cool

#

D and A will help if folks run arduino on it first

#

I don't think that microbit micropython has pin objects....

tiny oriole
#

thanks for the help! ill have this pinout flushed out soon. Maybe ill add a brief legend explaining an example of how each pinout information maps to its use.

slender iron
#

cool!

tiny oriole
#

going to assume the same pin warning as on the Feather nRF diagram, since its the same brain and most of the pins come directly from the chip.

slender iron
#

what warning?

tiny oriole
#

max 30mA for entire package, max 10mA per pin, 5mA recommended per pin

slender iron
#

yup, that would be the same

tiny oriole
#

i could see max current 3v3 from regulator having a different rating, but that should be defined by the regulator itself, so i just need to go confirm that both boards use the same

slender iron
#

I think it's a nrf thing

onyx hinge
#

@idle owl can talk about stuff now if you're available

idle owl
#

@onyx hinge Sure.

onyx hinge
#

Wow I missed a lot of chat

tiny oriole
#

ah yep. i think you are right. the datasheet seems to suggest the regulator is inside the nRF52

slender iron
#

@tiny oriole I think it can depend on the pin output circuitry too. usually they can take in more current than they give out

tiny oriole
#

that makes sense if the VIN side of the chip has a tiny bit thicker traces than the VOUT, not to mention that you have built in current draw from keeping yourself alive.

slender iron
#

in the data sheet the per pin limits are in 6.9.3.1

tiny oriole
#

sweet

slender iron
#

not sure where the overall limit is documented

#

but I believe 30ma

manic glacierBOT
tiny oriole
#

interestingly enough the "9.0 Absolute maximum ratings" section does NOT list entire package output.

#

should be identical to the feather though, which lists 30mA

slender iron
#

ya, i'm sure it is somewhere

manic glacierBOT
#

@DavePutz Ya, it is related. See https://github.com/micropython/micropython/issues/5622 for a longer discussion.

The short version is that the *kwargs in the exit of the with causes a dictionary allocation that is two blocks (32 bytes) long. MicroPython (and therefore CircuitPython) optimizes searching for free memory blocks by storing a start location after a successful allocation. However, this location is only updated if the allocation was 1 block long. In this case, it is two block...

idle owl
#

<@&356864093652516868> Next weekโ€™s meeting is moved to TUESDAY 18 February 2020. Here is the notes document for TUESDAYโ€™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! https://docs.google.com/document/d/1cTRyH_oxjhgRwpQPM-oSOIB-chxbplCkyqx2NYRPJ8o/edit

slender iron
#

thanks @idle owl !

manic glacierBOT
#

Is the voltage the reference voltage for the ADC or the core voltage? @dhalbert, it should be adc reference voltage right?

The voltage reading is the "input voltage to the microcontroller", not the regulated core voltage. The idea is to be able to detect sagging input voltage before we hit the brownout limit. So that voltage (wherever it comes from) needs to be compared against a stable internal reference (bandgap-based, probably).

timber mango
#

My only goal in life now is to get a PR through PyLint with no errors.

raven canopy
#

its a right of passage. ๐Ÿ˜„

timber mango
#

After five commits, my PR has finally squeaked by PyLint. ๐Ÿ˜ƒ ๐Ÿ˜‰

raven canopy
#

๐ŸŽ‰

timber mango
#

PyLint is having a major impact on my coding style.

pastel panther
#

the code I was testing uses board.I2C just fine, but using busio.I2C(board.SCL, board.SDA) complains about SCL being in use. As seen above neither work on the REPL

#

I'll file an issue

manic glacierBOT
#

I'm having issues setting up I2C in the REPL:
image

As you can see, in the REPL both methods of setting up I2C fail with complaints about the bus being busy. In the same screenshot you can see the sketch I'm testing working fine using board.I2C()

I discovered this in trying to refactor that code to use busio.I2C(board.SCL, board.SDA); it complains about SCL being busy.

My cod...

tiny oriole
meager fog
#

@tiny oriole @slender iron its to match the micro:bit pin naming - backcompatibility

#

like, to make it so each pin has the same 'analog' and 'digital' names - they may not match the underlying nrf52840 name ๐Ÿ™‚

tiny oriole
#

smart ๐Ÿ™‚

meager fog
#

but thats ok because we hvae a layer of abstraction in both arduino and circuitpython

tiny oriole
#

that actually makes alot of sense

meager fog
#

so "A4" is not necessarily the '840's 4th-input-to-ADC

#

thanks for the diagram, can we add it to the guide?

timber mango
#

I feel pretty abstracted now. ๐Ÿ˜‰

tiny oriole
#

Absolutely. Maybe run it by a few more eyes just to be absolutely certain everything is correct ๐Ÿ™‚

meager fog
#

...a vague feeling washes over you

#

yep will do!

timber mango
#

I have stumbled into a maze of twisty little passages, all alike...

tiny oriole
#

I'm all for helping out in any way i can ๐Ÿ˜„

timber mango
#

I completed my goal for today, in spite of Mz PyLint, and got two PRs in for review. Now, I need a nap. ๐Ÿ™‚

meager fog
#

@tiny oriole its appreicated, is there an original format for the doc? like AI file?

tiny oriole
#

Yep. its an Illustrator file you need the .ai?

meager fog
#

yes please

#

cause that way if there's a typo, we can fix it ez ๐Ÿ™‚

#

how do you want to be credited?

tiny oriole
tidal kiln
#

that is a nice pinout diagram!

tiny oriole
#

I dunno. How does credit usually work for those? Relatively new to that process, hahaha

meager fog
#

can be your name, URL whatever ya like

tiny oriole
#

Ah, Name is fine ๐Ÿ™‚

meager fog
tiny oriole
#

well that was quick! thanks!

meager fog
#

zoom! ๐Ÿšค

manic glacierBOT
manic glacierBOT
#

@tannewt @dhalbert i have edited the patch according to your suggestion.
The test i performed was the following:

  1. connect initialized (with no code.py) device (with a battery) to Windows PC
  2. connected to repl
  3. called storage.remount("/", False) at this point still fails because the drive is mounted
  4. ejected the drive without unplugging from pc
  5. called storage.remount("/", False) which now works
  6. called storage.remount("/", True)
  7. unplugged and reinserted device
    ...
timber mango
fallen anvil
#

Can I ask more dumb questions about CP on mimxrt? What is the relationship between CP and UF2? I can see that a UF2 compatible file is created by the makefile (e.g. for imxrt1020) but not where the UF2 bootloader is created? On arturo182's site I see a UF2 minibootloader for 1010 but not for other chips, and I don't see imxrt in the adafruit uif2-samdx1 repository either (well, leastways, grep doesn't).

#

The firmware.bin for 1020 isn't getting created with the flash signature (0x42464346) at the start of it but somehow the hex file for 0.5 from the website loads and runs on this board....and indeed, I've had the code running on my board too. I've got myself confused.

#

again.

onyx hinge
#

there's a sub-directory called hw/chip/mimxrt10xx

fallen anvil
#

Yep, thats the 1010 one. I can easily port it but don't want to be repeating work..

onyx hinge
#

@indigo wedge any comment?

fallen anvil
#

(I've just discovered the firmware.bin doesn't include that flash_config and ivt sections...no idea if that's deliberate)

#

..but it explains a lot :-)

indigo wedge
#

yes, CPY doesnt have flash config cause the uf2 bootloader takes care of that, right now the uf2 bootloader is very experimental and the tinyuf2 might not work at all, waiting for HW to develop more

#

i also have a tinyusb fork in my github with a uf2 branch and that one works on my feathers but is super dirty cause that was just a proof of concept

#

tinyuf2 is supposed to be the proper code but is very WiP

#

I'm in a meeting at work right now so can't support much ๐Ÿ˜…

fallen anvil
#

no problem...just trying to figure out where I can help. It does mean the bin isn't a bin thought, it's a part-bin. Are you happy for me to update the Makefile

#

(Don't worry, not expecting support, only nudges!)

indigo wedge
#

if you re-add the missing flash config then you should be able to boot without the bootloader

#

it's on my TODO list to build binaries for both uf2 and without bootloader

fallen anvil
#

Yup, that's my plan. Lord knows how I ever had it booted before!

indigo wedge
#

possible that you had leftover data in flash from another firmware

#

and you lost that when you erased flash

fallen anvil
#

Yeah, could well have. It's very easy to wrap the imxrt boot sequences around your neck. OK, I'll be back, at least I know I'm not wasting my time now.

#

TA!

indigo wedge
#

good luck and sorry for the mess, imx is very WiP ๐Ÿ˜„

fallen anvil
#

Its genuinely no problem, but I only have a very small brain, it's important I don't waste it.

onyx hinge
#

hmm ulab lost all its error strings. wonder how that happened

#

ugh a build problem fixed by "clean"ing

#

oh well, that's one of those things

plucky flint
#

Hi folks... so I'm getting quite a few folks via Mu support channels complaining about Catalina related permissions problems. One relates to access to file systems (we've published a work around here: https://codewith.mu/en/howto/1.0/install_macos#catalina-permissions), but others are saying that they can't establish a serial connection over USB. I'm assuming this is (another) permissions problem, and I'm also assuming some more technical folks on here will have encountered this problem too. In which case, as a non-OSX user, I'd love some pointers to how I might help Mu's users with this issue.

#

Thank you in advance..! (As always)

#

โค๏ธblinka mu

lone axle
#

I don't have specific experience with Mac, but one of the gotcha's I run into on Linux type systems is not having my user in the dialout group and therefore not being allowed to communicate over serial. Not sure if there is a Mac equivalent to that

#

Well, maybe not. The last post mentions that the title is about Mac but some of the commands and things are actually for Ubuntu

timber mango
#

@lone axle Linux and OS X have the same permission setup, since OS X has BSD under the hood.

#

However, the user groups used by OS X may not match Linux.

#

Some call it dialout, uucp, dip, etc.

lone axle
#

Ah, perhaps that could be the issue then. I've gotten caught by it almost every time I try to use my 3D Printer on a new linux PC =x

fallen anvil
#

Not quite. MacOS has cu.X and tty.X devices mapping to the same underlying serial port, trouble is they lock waiting for carrier. You must open the cu.X device if you're using something like a serial emulator. See https://github.com/orbcode/orbuculum/issues/15

timber mango
#

The serial port group is usually called dialout for Linux.

fallen anvil
#

There's a patch for it in the development branch of Orbuculum, but if you don't have access to the source code (e.g. a terminal emulator) then your only option is to be careful to open the correct device.

timber mango
#

@fallen anvil Yes, there are significant differences between OS X and Linux for how serial devices are handled, but the permissions system is the same.

fallen anvil
#

yeah, sorry, wasn't arguing that. The cu.X vs ttys.X issue is a well known one in OSX-land though....could well be their issue cos if memory serves OSX does a reasonably good job of setting permissions on serial ports.

timber mango
#

@fallen anvil If memory serves me, OS X is more picky with handling serial devices, permissions, and groups. OS X (Darwin) and Linux have the same parents (*Nix BSD) but are different species.

plucky flint
#

OK... so to be clear, serial communication in Mu on OSX worked with no problem pre-Catalina. Post Catalina, I get several folks a day asking, submitting bugs, emailing etc.

fallen anvil
#

then I'm afraid that's beyond my paygrade...our problems were much earlier

plucky flint
#

AFAICT if you're an admin user I don't think you encounter the problem (I'd need to check again, this is from memory).

#

but admins not having such a problem suggests permissions to me. In which case, which permissions? (and how do you change 'em)

#

brb

timber mango
#

@plucky flint The first place I look when an Admin account can do something an unprivledged user can not do but should be able to do is permissions and groups.

plucky flint
#

๐Ÿ‘

manic glacierBOT
#

Hi @v923z, thanks for ulab and for jumping in! I'd encourage you to join our Discord chat so we can have quicker back and forth.

I like the idea of moving the non-numpy compatible stuff into a separate module. It also looks like you want to have different size tiers of the library. I wonder if having many non-numpy modules would be a better structure for ulab. That way compatibility is available at the module level and is checked at runtime on import rather t...

tulip sleet
#

@slender iron I've been trying various things with this test program, I keep adding cases.

#

there are weird breakpoints between certain numbers of args

slender iron
#

@tulip sleet I bet those align with allocation sizes

#

is there a new dictionary allocated for function locals

#

?

tulip sleet
#

if you run that you will see zero heap usage for the non-*args case

slender iron
#

kk

#

how are you tracking heap usage?

tulip sleet
#

I'm submitting the busdevice PR and will document the anomaly I mentioned last night.

slender iron
#

kk

tulip sleet
#
def time_it(f, n):
    gc.collect()
    heap_before = gc.mem_free()
    s = time.monotonic()
    for _ in range(n):
        f()
    heap_after = gc.mem_free()
    return "secs: {:.4f}, heap: {}".format(time.monotonic() - s, heap_before - heap_after)
#

the timing is fine; it checks by wall clock

#

just run it once and you'll see. Output is too big to paste

slender iron
#

kk

manic glacierBOT
onyx hinge
#

huh I don't remember seeing the "check out locally" button before. that's neat and is probably going to be super handy now that I know it's there

tulip sleet
teal bear
#

cpx q: hitting reset once or twice doesn't get me "all green" cpx q: hitting reset once or twice doesn't get me "all green"

tulip sleet
#

what color do you see?

teal bear
#

red

tulip sleet
#

then there's something wrong with the USB connection

#

that's the bootloader saying it's not connected via usb

teal bear
#

ah, this may be power only cable

slender iron
#

@fallen anvil I'm up if you have any imx questions for me

teal bear
#

yep - new cable, I have green now. thanks!

manic glacierBOT
#

@v923z I noticed that .shape is a property in numpy and a method in ulab. Would you be receptive to changing this,

Absolutely. That was the leftover of the very first version, and I just haven't got the time to fix it. I have the implementation, I will push the changes soon.

or should we expect to carry such a change locally if we want it?

No, we shouldn't do that.

teal bear
#

carl@twist:/media/carl/CIRCUITPY/Welcome_to_CircuitPython_CPX/.git/objects/e1$ cp -v /home/carl/sbc/cpx/Welcome_to_CircuitPython_CPX/.git/objects/e1/854679c587905cf032fdec2e701bd4614fc414 .

#

cp: cannot create regular file './854679c587905cf032fdec2e701bd4614fc414': Permission denied

tulip sleet
#

@teal bear I"m not sure what the issue is here (maybe very long filenames), but it looks like you're copying the whole repo with .git/*, which you don't need.

teal bear
#

@tulip sleet I don't need any of this right now - but this seems to be a bug in cp 5 (works ok in v4)

tulip sleet
#

the filesystem may have become corrupted. Copy off anything you don't have another copy of elsewhere and do:
import storage; storage.erase_filesystem()

#

what was the actual cp command you gave, so we can try to reproduce?

lone axle
#

also double check the available space maybe. Perhaps the bunch of files that did get copied filled up enough space that there isn't room and it's throwing an error.

manic glacierBOT
#

Hi @v923z, thanks for ulab and for jumping in! I'd encourage you to join our Discord chat so we can have quicker back and forth.

Thanks for the invitation!

I like the idea of moving the non-numpy compatible stuff into a separate module. It also looks like you want to have different size tiers of the library.

I think it is a necessity, actually. Some platforms are rather small, while others have a generous amount of flash. I have been thinking of me...

teal bear
#

cpx_setup.sh should repo it - let me try on a 2nd cpx. I forget flashing a new cp doesn't whack the ... um.. storage?

tulip sleet
#

it would be better to exclude to the . files when copying recursively

lone axle
#

Like danh mentioned you can skip copying the .git/ directory to the CIRCUITPY I haven't explicitly tried but I suspect trying to do something like git pull on a CIRCUITPY drive could get weird since it will be trying to automatically reboot after each file change

teal bear
#

im not asking for help using... i'm trying to report a bug in beta version

lone axle
#

If I were you I would probably try altering this code:

cp -a \
    ${assets}/Welcome_to_CircuitPython_CPX \
    ${target}/CIRCUITPY/

to more selectively target files you care about, perhaps *.py or something to only copy python code files.

tulip sleet
#

I will try your original copy to see whether it breaks thignsd.

#

what is the host system? Linux?

teal bear
#

the sleep 5 may need to be 15. I just dropped to 5 thinking the sync on the line before it should be fine, but the os takes a bit (more than 5 seconds?) to hot plug/mount it

slender iron
#

hi @lapis hemlock !

teal bear
#

Ubuntu 18.04.3 LTS bionic

tulip sleet
#

@teal bear you could put in another while to wait for CIRCUITPY to appear

#

the sync will finish before the flash write and the reboot happen

#

i have never bothered to sync when copying to a BOOT drive

onyx hinge
#

@lapis hemlock welcome!

tulip sleet
#

but it won't hurt

fallen anvil
#

@slender iron thanks. Just had dinner so will get back on things later this evening. Got a clean(ish) build now that can work without without a bootloader. Sounds more grand than it is, most of the work was already done.

timber mango
#

@gilded cradle Hello. Did you code set_digit_raw()?

gilded cradle
#

yes

timber mango
#

Ah, good. Does it respect the state of auto_write?

gilded cradle
#

Let me check. If not, it should.

#

Yes it does.

timber mango
#

OK. That may be all I need to do more interesting things with animations. I will try this out.

gilded cradle
#

ok

timber mango
#

Thank you. I just wanted to double check before I started digging deeper into stuff. ๐Ÿ˜‰

gilded cradle
#

No problem

timber mango
#

Mz PyLint prefers while over for.

teal bear
#

linux q: what group do I need to be in to talk to ttyACM0?

idle owl
#

@teal bear dialout if I remember correctly.

teal bear
#

hey K... yeah, think you are right

idle owl
#

Hey Carl

onyx hinge
#
crw-rw---- 1 root dialout 166, 0 Feb 10 08:40 /dev/serial/by-id/usb-Adafruit_Industries_LLC_ItsyBitsy_M4_Express_E85B723E333583350202025313B440FF-if00
``` On my debian based system, serial devices get assigned group dialout.
teal bear
#

OK, something funky going on with 3 out of 3 cpx - tio /dev/ttyACM0 gives me "connected" but no .. banner or any other sign of life

lapis hemlock
#

hi @lapis hemlock !
@slender iron , @onyx hinge Hi everyone!

idle owl
#

@lapis hemlock ๐Ÿ‘‹

timber mango
#

Yes, for Linux, it is the dialout group.

teal bear
onyx hinge
#

@lapis hemlock btw really appreciate you taking translate() upstream, it made a big difference in the size of our delta.

slender iron
#

@lapis hemlock how do you plan on splitting functionality for code size? How will the python code know which version it has available?

teal bear
#

tried on a 2nd box that has a pretty fresh / un mucked with Ubuntu, same thing

lone axle
#

@teal bear your link seems broken

teal bear
lapis hemlock
#

@lapis hemlock btw really appreciate you taking translate() upstream, it made a big difference in the size of our delta.
@onyx hinge Absolutely no problem. In fact, I wanted to ask you, and @slender iron, what you would still need. I would like to make it so that you can automatically include changes.

#

@lapis hemlock how do you plan on splitting functionality for code size? How will the python code know which version it has available?
@slender iron setting version= 0.30.0-1dim, version= 0.30.0-2dim, perhaps?

manic glacierBOT
teal bear
#

oh.. I need to hit ^c... derp.

slender iron
#

@lapis hemlock our approach with circuitpython is to have separate modules. I'm not sure that lends itself to your tiers though

#

unless you have two array modules

teal bear
#

chases yack... come back here so I can ... now that I have a >>> what was the mkfs thing? /me scrolls and scrolls

onyx hinge
lapis hemlock
#

@slender iron Are you absolutely against using ulab.h to handle this?

onyx hinge
#

@slender iron numpy.array numpy.zeros etc deal with 1d and 2d arrays via a single function/type

slender iron
#

it isn't a question of how the C code does it for me. it is matter of how you write portable python code on top of it

onyx hinge
#

so it's not immediately obvious how to do it "by module"

slender iron
#

I'm ok moving away from the numpy api if it means functionality is split by module

lapis hemlock
#

@onyx hinge I think we should set pre-processor macros for the delta. It is really small now. So many macros won't make the code ugly.

slender iron
#

the benefit by splitting by module is that you get errors up front at import time

onyx hinge
#

@lapis hemlock is this an accident/bug? numpy returns a scalar. ```>>> x = ulab.linspace(0, 10)

ulab.argmax(x)
array([49], dtype=uint16)

teal bear
#

found it: import storage; storage.erase_filesystem()

lapis hemlock
#

@lapis hemlock is this an accident/bug? numpy returns a scalar. ```>>> x = ulab.linspace(0, 10)

ulab.argmax(x)
array([49], dtype=uint16)

@onyx hinge It definitely wasn't intentional.

onyx hinge
#

OK, I'll file an issue so it doesn't get forgotten

#

I'll also work on PR'ing our small delta into something with #ifdefs. this makes me happy.

lapis hemlock
#

OK, I'll file an issue so it doesn't get forgotten
@onyx hinge thanks! To both comments.

onyx hinge
#

do you have any interest in using tech like github actions to build micropython-ulab and run tests?

#

we are talking about putting tests in circuitpython to compare numpy and ulab behavior, but it's another thing that could go upstream to you

lapis hemlock
#

we are talking about putting tests in circuitpython to compare numpy and ulab behavior, but it's another thing that could go upstream to you
@onyx hinge I would find that totally cool, but I have never done that. I would have to look into how I set it up.

onyx hinge
#

Github actions are a bit of a learning curve but that's the direction I'd go. You can define a step series of steps to checks out micropython, builds its unix port, and then runs some tests from a directory you specify... Happy to help you with it and contribute some tests. For instance, using micropython's testing structure you can write a test like this and it checks that python3 and micropython give the same result: ```try:
import numpy as np
except ImportError:
import ulab as np

print(len(np.zeros(8)))

lapis hemlock
#

@onyx hinge OK, I'll do some digging.

slender iron
#

so is the plan to stick to a strict subset of numpy then?

lapis hemlock
#

so is the plan to stick to a strict subset of numpy then?
@slender iron I think so. Extra would be extra, if you don't want it, you set the pre-processor flag, and it is gone...

slender iron
#

I'm ok with extra. I'd just want it on a separate module

onyx hinge
#

in circuitpython we can do our best to approach it. not sure how to make fft/ifft/spectrum fit as "strict subset"

#

but yeah it can go in "extra"

#

the re-org we can carry in circuitpython, where we put some stuff in a different namespace

lapis hemlock
#

@slender iron Actually, I think, at the moment the only extra function is spectrum.

onyx hinge
#

I have to go to a meeting, bbl

lapis hemlock
#

I'm ok with extra. I'd just want it on a separate module
@slender iron A separate module will it be then.

slender iron
#

thanks!

lapis hemlock
#

I might also have to wrap up for today.

slender iron
#

np, we appreciate your help

lapis hemlock
#

It was my pleasure.๐Ÿ˜ƒ

teal bear
#

how can I get the CPX into a known state? so that a bug report says "start with it like this..."

#

right now it seems to be: import storage; storage.erase_filesystem() - and then run ./cpx_setup.sh twice

#

using cp_ver=4.1.2

manic glacierBOT
#

@dhalbert @tannewt the voltage that I'm measuring is the analog reference voltage, compared to the STM32's internal stable reference voltage. The calculation VREFINT/VREFIN_CAL (calibrated value) creates a fraction that can be used to correct for the difference between the actual Analog reference and the ideal (micropython does this). I was wondering if you'd like me to actually use this fraction in the ADC module.

#

For Processor.voltage, we want to measure the VDD coming into the chip. There is an available channel, VDDA, which is the VDDA pin. On the Feather '405, the VDD and VDDA pins are connected to the 3.3V supply from the off-chip regulator.

In the nrf implementation, we read a similar voltage, scale it by 1/6, and compare it to the internal bandgap ref.

In the atmel-samd implementation, there is a scaled version of VDD which we also compare with an internal reference (there are multiple i...

lapis hemlock
#

@lapis hemlock ๐Ÿ‘‹
@idle owl Somehow I overlooked the greeting. ๐Ÿ‘‹

tulip sleet
#

@lapis hemlock and me too ๐Ÿ‘‹ ๐Ÿ™‚

lapis hemlock
#

@lapis hemlock and me too ๐Ÿ‘‹ ๐Ÿ™‚
@tulip sleet Good to meet you, Dan!

ionic elk
#

A2 had a big roof leak right next to my desk so I've been on and off with work today due to power being shut off for safety. Will try to catch up tomorrow.

tulip sleet
#

@ionic elk do you think this might continue into tomorrow into the meetup?

manic glacierBOT
#

my script to setup a CPX with my custom config trips something that results in:
cp: cannot create regular file '/media/carl/CIRCUITPY/Welcome_to_CircuitPython_CPX/.git/objects/12/27f7b26d3603eeb4e1dc44dd6a86918ac01801': Permission denied

to reproduce,
git clone https://github.com/CarlFK/cpx
wipe the cpx: >>> import storage; storage.erase_filesystem()
run this twice:
./cpx_setup.sh
./cpx_setup.sh

I am not reporting here to get help setting up my cpx, I'm reporting because...

ionic elk
#

@tulip sleet It won't affect the meeting, it's just an isolated roof leak next to my desk. We'll be doing the event in the main social area.

timber mango
#

Wow, busy day here!

#

I posted a new animation demo on my Github.

half sedge
#

I have a very strange problem with Label from adafruit_display_text.label on my new CLUE... (well maybe not specific to the CLUE, but this is where I am):

#

This line alone fail and does not display at the right Y:

#

min_label = Label(terminalio.FONT, max_glyphs=10, color=palette[0], x = 0, y = 170)

#

But if I add the following it works as I want:

#

min_label.y = 170

#

So it is like the y = 170 at the creation time was not taken into account, on display it look like y = 0.

slender iron
#

@tulip sleet you around?

idle owl
#

@half sedge The library was updated an hour ago with what I believe is a fix to that issue. We haven't released it yet until it's tested more thoroughly, but you can get the updated .py file from the repo.

timber mango
#

@gilded cradle There is a new animation demo on my Github.

manic glacierBOT
#

run this twice:
./cpx_setup.sh
./cpx_setup.sh

I can reproduce this by just running the cp -a .../.git/objects/.... commands twice, as is done in the "offending" line: https://github.com/CarlFK/cpx/blob/6e019b231d948c3642b9b19f3d59276cf6394e02/cpx_setup.sh#L52.

I'm pretty sure this is related to using the -a/--archive option with cp. Here is the stat on a file in .git/objects (which I used to reproduce):

File: .git/objects/1e/631c4691c07f3b098804f2b2bab42456bd27a5
...
#

@dhalbert that's what I mean. To be more clear, here's the actual calculation I do (same as micropython). Pseudocode:

value = HAL_ADC_GetValue(Handle_ADC_CHANNEL_VREFINT)
adc_fraction = ((float)(*VREFIN_CALIBRATION_VALUE)) / ((float)value);
return adc_refcor * 3.3f;

The actual value provided by that analog read is the VDDA voltage divided by the internal reference voltage which is like 1.25 or something. The VREFIN_CALIBRATION_VALUE is a factory-determined value for this ADC...

tulip sleet
#

@slender iron I was eating

#

back now

slender iron
#

ah, ok

tulip sleet
#

i was testing on a CPB (on-board LIS3DH) and to some extent on an M4 with external LIS3DH

slender iron
#

ok I have a metro m4 with lis3dh going now

tulip sleet
#

I did the original testing on an M0 (when testing with limor)

#

only because I thought I had fried my M4, but it wasn't true

slender iron
#

I've got my allocation tooling going

#

here is the number of gc actions per test pass:

#
{'sweep': 29, 'alloc': 15, 'free': 4, 'realloc': 1}
0 30 gc.collect 3
{'sweep': 9, 'alloc': 16, 'free': 4, 'realloc': 1}

0 461 gc.collect 3
{'sweep': 12, 'alloc': 327, 'free': 121, 'realloc': 1}
0 694 gc.collect 4
{'sweep': 205, 'alloc': 367, 'free': 121, 'realloc': 1}

0 805 gc.collect 3
{'sweep': 246, 'alloc': 407, 'free': 151, 'realloc': 1}
0 865 gc.collect 4
{'sweep': 256, 'alloc': 457, 'free': 151, 'realloc': 1}

0 4715 gc.collect 3
{'sweep': 306, 'alloc': 3207, 'free': 1201, 'realloc': 1}
0 6815 gc.collect 4
{'sweep': 2006, 'alloc': 3607, 'free': 1201, 'realloc': 1}

0 13414 gc.collect 3
{'sweep': 2405, 'alloc': 8007, 'free': 3001, 'realloc': 1}
0 17015 gc.collect 4
{'sweep': 5006, 'alloc': 9007, 'free': 3001, 'realloc': 1}```
#

you can see the 1, 40, 50, 400 and 1000 tuple allocation difference

#

in the "alloc" number

#

after: ```
12 16 gc.collect 3
{'sweep': 1, 'alloc': 10, 'free': 4, 'realloc': 1}
13 20 gc.collect 4
{'sweep': 4, 'alloc': 11, 'free': 4, 'realloc': 1}

31 256 gc.collect 120
{'sweep': 7, 'alloc': 127, 'free': 121, 'realloc': 1}
34 295 gc.collect 160
{'sweep': 6, 'alloc': 167, 'free': 121, 'realloc': 1}

36 355 gc.collect 150
{'sweep': 46, 'alloc': 157, 'free': 151, 'realloc': 1}
40 365 gc.collect 200
{'sweep': 6, 'alloc': 207, 'free': 151, 'realloc': 1}

205 2465 gc.collect 1200
{'sweep': 56, 'alloc': 1207, 'free': 1201, 'realloc': 1}
339 2815 gc.collect 1600
{'sweep': 6, 'alloc': 1607, 'free': 1201, 'realloc': 1}

495 6414 gc.collect 3000
{'sweep': 405, 'alloc': 3007, 'free': 3001, 'realloc': 1}
1252 7015 gc.collect 4000
{'sweep': 6, 'alloc': 4007, 'free': 3001, 'realloc': 1}```

tulip sleet
#

is alloc taking a block?

slender iron
#

its an allocation of any number of blocks

tulip sleet
#

so it's using half the blocks, because it's finding free space?

slender iron
#

I think that is by not allocating to *kwargs

tulip sleet
#

oh, I see, you're comparing my before and after, not new code from you

slender iron
#

correct

#

although that means you save 5 allocations

tulip sleet
#

what is the big 3000 and 4000 in the after?

slender iron
#

ah! that is my count of non-single block allocations

#

I hadn't noticed that

#

that is very interesting

tulip sleet
#
0 17015 gc.collect 4
{'sweep': 5006, 'alloc': 9007, 'free': 3001, 'realloc': 1}

vs

1252 7015 gc.collect 4000
{'sweep': 6, 'alloc': 4007, 'free': 3001, 'realloc': 1}
#

those are identical conditions except for the *args and **kwargs (and the little hasattr() change), right?

slender iron
#

ya, it has hasattr

tulip sleet
#

the hasattr thing was just a minor speedup, it shouldn't alloc anything

slender iron
#

(I have a log of all the allocations if you want it)

#

allocations by number of blocks: {6: 1000, 5: 2000, 1: 6, 3: 1}

tulip sleet
#

i answered you in the issue; the q of why the _register_read is slower than _register_read + struct.unpack() is really confusing. I did all kinds of testing on that, and i don't see why more code is faster

slender iron
#
495 6414 gc.collect 3000
{'sweep': 405, 'alloc': 3007, 'free': 3001, 'realloc': 1}
{6: 1000, 5: 2000, 1: 6, 3: 1}
1252 7015 gc.collect 4000
{'sweep': 6, 'alloc': 4007, 'free': 3001, 'realloc': 1}
{6: 1000, 5: 2000, 2: 1000, 1: 6, 3: 1}```
#

old: 6 [('0x0003c212', '../../py/objfun.c:274', 'fun_bc_call'), ('0x0003af9e', '../../py/runtime.c:636', 'mp_call_method_n_kw')] 1 [('0x0002d458', '../../py/objdict.c:584', 'mp_obj_new_dict'), ('0x0002d902', '../../py/bc.c:185', 'mp_setup_code_state')] 2 [('0x0002dcee', '../../py/pystack.h:85', 'mp_nonlocal_alloc'), ('0x0', '../../py/runtime.c:681', 'mp_call_prepare_args_n_kw_var')] 3 [('0x0', '../../py/gc.c:804', 'gc_realloc'), ('0x00020e32', '../../py/malloc.c:135', 'm_realloc')] 0 13414 gc.collect 3 {'sweep': 2405, 'alloc': 8007, 'free': 3001, 'realloc': 1} {6: 1000, 1: 4006, 2: 3000, 3: 1} 6 [('0x0003c212', '../../py/objfun.c:274', 'fun_bc_call'), ('0x0003af9e', '../../py/runtime.c:636', 'mp_call_method_n_kw')] 1 [('0x0002d458', '../../py/objdict.c:584', 'mp_obj_new_dict'), ('0x0002d902', '../../py/bc.c:185', 'mp_setup_code_state')] 2 [('0x0002dcee', '../../py/pystack.h:85', 'mp_nonlocal_alloc'), ('0x0', '../../py/runtime.c:681', 'mp_call_prepare_args_n_kw_var')] 3 [('0x0', '../../py/gc.c:804', 'gc_realloc'), ('0x00020e32', '../../py/malloc.c:135', 'm_realloc')] 0 17015 gc.collect 4 {'sweep': 5006, 'alloc': 9007, 'free': 3001, 'realloc': 1} {6: 1000, 1: 4006, 2: 4000, 3: 1}

#

interesting that the old version includes a single block allocation

tulip sleet
#

one thing I found is that if I changed the readinto() not to use **kwargs but did NOT change the write(), then I did not get anomalous results. The write() has an extra keyword arg (stop=...). I was looking to see if fewer numbers of args were optimized in some way, but I couldn't find anything like that.

slender iron
#

I think that the number of args impacts an allocation when a function is called

#

if it is a single block then it helps speed up subsequent allocations

#

if its >1 then it doesn't

tulip sleet
#

so in the old case, there are allocs for arg passing and the struct.unpack(), and somehow they help each other out to speed things up. Maybe one is slow and one is fast, and the fast one helps the next one be fast. in the new case, it's always >1 block, and that's always slow

slender iron
#

not only is >1 slow but it gets exponentially (?) worse because each time it has to go a bit further

tulip sleet
#

yes, we saw the i2c transactions take up to 10 times longer just before gc than just after (on the 'scope)

slender iron
#

so I wonder what the best way to solve this is

#

we could just store start locations for N block sizes

tulip sleet
#

that is cheap, you could go up to 16 or 32

#

may be overkill

slender iron
#

cheap memory wise but makes the code a little more complex

#

jimmo mentions the idea in the latest melbourne micropython meetup

#

it's just such a bad worse case

tulip sleet
#

is it worth asking if they are working on this already? I didn't see any PR but I didnt' look that hard

slender iron
#

I saw something more complex that jimmo did making finding the allocation area faster

manic glacierBOT
#

Trivial patch to add a new target which is a directly loadable binary image for the imxrt family of chips. This image is identical to the regular firmware.bin except that it also contains the data necessary for the imxrt to find the application binary in memory and start running it. Specifically, it adds the .flash_config and.ivt sections from the elf file that are discarded when a uf2 image is created.

tulip sleet
#

you could take a look and back off if it looks too complex. I think we have the diagnosis. It would be a nice performance improvement, but the gc always makes predictable faster latency impossible. I.e. great if we can read the sensor faster, but there will still be hiccups.

half sedge
#

Thanks @idle owl I ported my thermal camera to Clue and PyPortal. Except for that bug and computing the optimal position for the graphical element... my code for PyGamer worked almost out of the box for other screen size. I will try to make my code more parametric so that it minimise change between version. Also the PyPortal and PyGamer have and SD card, so as soon as the DisplayIO2BMP library is fixed, I will add the recording function. Here is my now poorly named repo: https://github.com/dglaude/CircuitPython_MLX90640_PyGamer_Plus

fallen anvil
#

Well, that took a while for something so trivial...but at least I know my way around the bootloader a bit better now :-/

slender iron
#

thanks @fallen anvil !

#

@tulip sleet I think I'll go for my run and let my mind chew on it. Thanks!

tulip sleet
#

sounds good!

fallen anvil
#

It raises the question of how to handle memory configuration though. If we assume that we either (a) have the best configuration already loaded or (b) can trust the configuration that uf2 has set up, then we don't need to reconfigure in our code....If we can't be sure that is the case (e.g. loaded from another bootloader) then it's appropriate to re-configure the memory as we do at the moment....on balance I think the latter is the better option!

slender iron
#

could also do something like remember the last allocation or free and reuse it

#

@fallen anvil I agree re-initing would be best because we'll want clock control

tulip sleet
#

i had grander ideas of limited ref counting (e.g. 1-bit ref count) + gc but that's a complete redo

slender iron
#

the other thing to consider is having multiple memories with different access speeds

#

for example, the DTCM on the imx rt is 4x faster than OCRAM

#

k, run time

tulip sleet
#

i 've added that to "watch later"

slender iron
#

๐Ÿ‘

gilded cradle
#

Looks good @timber mango

timber mango
#

Thank you. I did modify things a bit and it depends on the display being initialized with auto_write=False.

#

I will see if I can come up with some animations that show things off better.

#

@gilded cradle Do you think animate() is ready to go into the library, or should it be left outside of it?

gilded cradle
#

Let me play around with it some first.

timber mango
#

OK, that works. I am going to do some more fiddling with it also without any more changes to animate()

gilded cradle
#

You may want to add some error checking such as making sure somebody doesn't specify -1 or 8000 for a digit number.

#

or if they give it as an integer because they onlywant to change one digit

timber mango
#

set_digit_raw() checks the digit number, but does not return an error code. I opened an issue on that.

#

Give what as an integer?

gilded cradle
#

like calling animate(0, A, delay)

timber mango
#

Ah, yes, both must be lists.

slender iron
#

@tulip sleet any idea how long a gc takes?

timber mango
#

Must be animate([0], [A], delay).

manic glacierBOT
#
  • Enable SPIM3 support on nRF52840. SPIM3 is 32MHz, other SPIM's are 8MHz. SPIM3 is buggy and requires its own 8kB RAM block when transmitting to avoid corrupted data.
  • The first SPI allocated is SPIM3. This is now noted in the doc in shared-bindings/busio/SPI.c. This means an onboard display will get to use SPIM3.
  • Two I2C's are now available on all nRF boards because we now can use SPIM0/TWIM0 and SPIM1/TWIM1 for I2C, with SPIM2 and SPIM3 for SPI.
  • Fixed common_hal SPI polarity and...
tulip sleet
#

@slender iron no idea off the bat

slender iron
#

kk, trying the per block size cache thing now

#

@tulip sleet ```
1 lis3dh._read_register: secs: 0.00499725, heap: 0
1 struct.unpack('<hhh', lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.00499725, heap: 32

40 lis3dh._read_register: secs: 0.022995, heap: 0
40 struct.unpack('<hhh', lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.0240021, heap: 1280

50 lis3dh._read_register: secs: 0.0279999, heap: 0
50 struct.unpack('<hhh', lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.0299988, heap: 1600

400 lis3dh._read_register: secs: 0.191002, heap: 0
400 struct.unpack('<hhh', lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.203995, heap: 12800

1000 lis3dh._read_register: secs: 0.470001, heap: 0
1000 struct.unpack('<hhh', lis3dh._read_register(0x28 | 0x80, 6)): secs: 0.501999, heap: 32000

#

๐Ÿ™‚

tulip sleet
#

that is way better

slender iron
#

shaved a bit off the struct-less one too

manic glacierBOT
#

This speeds up code paths that allocate only blocks larger than 1.

I believe imports will be faster because long lived allocations now always update the last free atb by assuming allocations are contiguous on the long lived end of the heap.

@jimmo @dpgeorge I heard you tried this as well but found cases where it was slower. What were they? I've split our py/ patch out into a commit but think it's still too different to apply smoothly in MP since we also have the long-lived stuff.

timber mango
#

@gilded cradle For error reporting, I prefer just returning an error code to the caller which would be 0 for no error, but I can also print an error message. What is the preference for Circuitpython?

#

I have a version that does both right now.

gilded cradle
#

The preference is to call something like raise ValueError('You provided a bad value') except with a better message than that. ๐Ÿ™‚

timber mango
#

OK, I can do that. I just do not care for that approach.

lime trellis
#

I'm debating how to best implement a "deploy" mode for CP where users can choose how the board should behave when encountering things like end of script, safe-mode, resets, etc..

Has this been discussed somewhere I'm missing, or should I open an issue?

raven canopy
#

i think there is an at_exit issue. ๐Ÿ‘€

lime trellis
#

thanks @raven canopy I'll dig it up and read through it.

raven canopy
#

quick search is coming up empty. it may have been brought up during a meeting...

lime trellis
#

hmm yeah I'm not finding it either. Nothing for various safe mode, exit, or fault searches either.

raven canopy
#

i could've sworn someone brought it up recently...

lime trellis
#

which might be ```
import time
import microcontroller

print("Hard fault... Hit CTRL-C to abort restart.")
time.sleep()
microcontroll.er.on_next_reset(classmicrocontroller.RunMode.NORMAL)
microcontroller.reset()

@ruby atlas

#

this is the most I found folks discussing it

raven canopy
#

oh, well, yeah i didn't read what you said in that manner. we do have on_next_reset+reset(). it doesn't make anything easy like atexit for teardown. outside of what is already on the firmware-side, at least. ๐Ÿ˜„

lime trellis
#

right! on_next_reset+reset() is more high level than what I've implemented. I'm trying to chase down all the ways MP can fail into a blocking state

ruby atlas
#

what i was interested in was a way to auto-reboot on soft faults and hard faults without going into the hardfault handler - a way to say that yes, i know this will crash the board, just reboot and keep going.

raven canopy
#

ahh. i vaguely remember that. debug related? or in-the-wild?

ruby atlas
#

it was when i was crashing the Feather NRF with
neopixel_write() of large streams done frequently.

tulip sleet
#

@ruby atlas that is still a bug, right? It's still an open issue and I'm going to look at it at some point

ruby atlas
#

yeah, there's a partial fix in there someplace, but the improved version after PR feedback crashes because of memory corruption :/

#

basically neopixel_write() needs to malloc a buffer big enough on first use and hold it until a bigger buffer is needed.

#

to avoid memory fragmentation.

tulip sleet
#

i'll note that, thanks

ruby atlas
#

there's a small chance i might get time to poke at it, but attempting to ramp down 3 contracts while another threatens to be full time 2 months early is... hard.

tulip sleet
#

got it, np

ivory yew
#

hmmm no audioio on m0 boards?

tulip sleet
#

doesn't fit! on non-express boards

#

@ivory yew which boards are you speaking of?

ivory yew
#

trinket m0

#

can I shed something else? I'm thinking of doing a custom board based on the same processor as the trinket

tulip sleet
#

not included because there's no external SPI flash on the board, so we reserve 64kB of the 256kB flash for CIRCUITPY

#

if the custom board has external flash, no prob

ivory yew
#

hmm okay

#

in the meantime I'm gonna try removing touchio and a few others.

tulip sleet
#

samd21e18 (what's on the trinket) does support i2S if you want that

ivory yew
#

nah it needs to be real simple

tulip sleet
#

longints are already turned off. 192kB is a real squeeze

ivory yew
#

yeah plus I need a teeny wav file in there, too.

#

(17kb)

#

might put some flash on the real one but right now I'm just making a proof of concept

tulip sleet
#

boards/pirkey_m0 and pewpew10 are quite pruned

ivory yew
#

ah cool, good pointers

#

thank you :3

#

let's see if this builds

#

6216 bytes free in flash firmware space out of 188160 bytes (183.75kB).

#

D:

#

6k!

tulip sleet
#

that is roomy!

raven canopy
#

plenty of space to take a nap. ๐Ÿ˜ผ

ivory yew
#

I need at least 18k

#

I could give up and proof this out on a samd21 board with flash but where's the fun in that?

raven canopy
#

analogio?

tulip sleet
#

you need 18kB for the filesystem?

ivory yew
#

need it

tulip sleet
#

that 6kB does not include the 64kB filesystem, which is still there

ivory yew
#

oh sick!

#

then I'm good.

raven canopy
#

oh yeah. der.

tulip sleet
ivory yew
#

I'm on my Windows machine

tulip sleet
#

then zero problem

ivory yew
#

it works. ๐Ÿ™‚

tulip sleet
#

yay!

ivory yew
#

thanks for enabling me, @tulip sleet

tulip sleet
#

@ivory yew ducky haha!

ivory yew
#

๐Ÿ˜„ ๐Ÿ˜„

tiny oriole
#

there is a "tooting your own horn" joke here somewhere...

#

๐Ÿ˜›

ivory yew
#

hahah

#

I could make it a horn. ๐Ÿ˜›

timber mango
#

@gilded cradle There is another new animation demo in my Github. I will upgrade the first two animations tomorrow.

#

I am hoping tomorrow will be the last day of testing.

#

Good night everyone. I have been working with a green display all day and need to rest my eyes.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

hi @tannewt -- I looked into this on MicroPython and tried something very similar. There are two main things to solve:

  • Long runs on >1-block allocations means that the pointer never advances. (e.g. we see this when allocating the complex number type on boards that support double-precision hardware floating point, where the complex type ends up taking two blocks).
  • Patterns of allocs paired with frees/reallocs that cause the pointer to reset backwards, but the next allocation doesn't fi...
manic glacierBOT
manic glacierBOT
#

Allows the drive name to be set in the mpconfigboard.h file, with a fallback to pre-existing behaviour. The name can already be changed from the default by the host of course, but this new define is useful when you've got multiple circuitpython boards on your system and you want to be able to differentiate between the drives when in a compile/upload/test frenzy...and it costs nothing to add in code size or execution time.

onyx hinge
#

@tulip sleet I noticed that it seems like on nrf our code currently limits SPI transactions to SPIMx_EASYDMA_MAXCNT_SIZE (== 16) bytes. I think MAXCNT_SIZE is actually indicating the number of implemented bits in the MAXCNT register. I'm not sure how much overhead there is to initiating each transaction, but it could make a difference.

#

the number of implemented bits also matches for the PWM peripheral. #define PWM0_EASYDMA_MAXCNT_SIZE 15

manic glacierBOT
#

That sounds like a good idea, since the 8kB is otherwise wasted. In fact, in the current implementation, we are only using the first 8 bytes or something like that. But we have to allocate the whole 8kB because otherwise there could be errors caused by contention on the block.

The buffer would be in that space conditionally; you'd check that the SPIM is SPIM3 when making the decision.

manic glacierBOT
#

I noticed that it seems like on nrf our code currently limits SPI transactions to SPIMx_EASYDMA_MAXCNT_SIZE (== 16) bytes. I think MAXCNT_SIZE is actually indicating the number of implemented bits in the MAXCNT register. I'm not sure how much overhead there is to initiating each transaction, but it could make a difference.

the number of implemented bits also matches for the PWM peripheral, ...

manic glacierBOT
ionic elk
#

Would anyone mind maybe giving me an extra set of eyes on Micropython's stm32/adc.c file? They calculate a correction bias for the ADC, but it seems inverted to me - it's vdda-calibration/vdda-measured? If you're vdda-measured is 3.28V, for instance, you want to multiply all ADC results by 3.28/3.3 = 0.994, right?

manic glacierBOT
onyx hinge
#

@slender iron do you know/remember why our make_new signature is different? Is it changes in micropython we don't have yet, or a change we made?

slender iron
#

@onyx hinge in a meeting, can look a bit later

tulip sleet
#

@onyx hinge Thanks! I misinterpreted. I will check later.

onyx hinge
#

Aha! Thanks

slender iron
#

I think there was a spot where we were unpacking and repacking the kwargs

#

native base init wrapper is changed

manic glacierBOT
lapis hemlock
slender iron
#

@lapis hemlock I don't know enough about numpy and such to say.

main meteor
#

Java went the other way and dispensed with unsigned integers.

#

However, Java is targeting a rather different set of use cases.

lapis hemlock
#

@slender iron well, it is not really about numpy, but about how many types we keep.

#

@main meteor My rationale is that you most probably want to analyse sensor data, which is 16-bit unsigned in most cases.

main meteor
#

I agree.

slender iron
#

@lapis hemlock what is the trade-off for having more types? code size?

lapis hemlock
#

@slender iron code size, and complexity. (This latter one won't appear in the firmware, though...)

onyx hinge
#

@lapis hemlock we also had a discussion about whether DSP types would fit in somehow. ARM calls the 16 bit fixed point type q15, for example

lapis hemlock
#

@onyx hinge I can't comment on this, you'll have to tell.

onyx hinge
#

I don't know enough to comment yet either :)

lapis hemlock
#

@onyx hinge Jeff, what is the CP-MP delta now?

onyx hinge
#

For any use I have in mind, I won't think complex values are that important. But we don't have too much idea how our users are going to use it.

#

@lapis hemlock I think it can be zero with my last pull request

lapis hemlock
#

@onyx hinge the question is, whether we can make fft compatible with numpy, and the only way is to include full-blown complexes.

onyx hinge
#

By the way I am traveling during the next two weeks so my contributions will be much slower

lapis hemlock
#

@onyx hinge What happened to the #pragma?

onyx hinge
#

It will go in our makefile, I'm honestly not sure why I put it there in the first place

lapis hemlock
#

By the way I am traveling during the next two weeks so my contributions will be much slower
@onyx hinge I wanted to do some clean-up work anyway, so that's OK. And many thanks for your efforts so far!

#

It will go in our makefile, I'm honestly not sure why I put it there in the first place
@onyx hinge Fantastic.

onyx hinge
#

Tannewt, ladyada and I had a video chat yesterday and we now think that we want to explore the direction of not worrying about numpy compatibility so much. So the complex math thing becomes less important

#

I am going to propose to split ulab into multiple modules at the python level, but there is no patch yet

lapis hemlock
#

I didn't know that Limor was involved in this. Not that I mind, mind you!

onyx hinge
#

She is keen on processing sensor data on it in the clue board

lapis hemlock
#

I am going to propose to split ulab into multiple modules at the python level, but there is no patch yet
@onyx hinge Do you mean .linalg, .fft etc?

onyx hinge
#

Right!

lapis hemlock
#

I can fix that. I need a couple of days, but that is doable.

obsidian compass
#

I am going to propose to split ulab into multiple modules at the python level, but there is no patch yet

#

I like that idea

onyx hinge
#

The main documentation headers become modules and in circuitpython we will prefer to enable only at module level whenever possible

#

Please let me know if you start so we don't duplicate effort, @lapis hemlock

lapis hemlock
#

It will most probably happen during the above-mentioned two weeks.

#

I think I won't have too much time before the weekend.

onyx hinge
#

Okay, time for me to get going! Thanks!

lapis hemlock
#

Bye!

slender iron
#

@lapis hemlock our reasoning for having multiple modules was that we can enable them individually rather than just having a ulab module which will grow as folks add more numpy stuff.

lapis hemlock
#

@slender iron Sub-modules are definitely more organised.

slender iron
#

That only changes the shape of the ulab to python

#

turning off and on a function means that python code errors where the function is called

#

separating it into modules means that errors are found at import

lapis hemlock
#

This is a good point.

slender iron
#

๐Ÿ™‚ it has worked well for our other apis

lapis hemlock
#

However, in the long run we are going to bump into the same issue: the numpy sub-modules are still huge, so it might make sense to turn some function off by means of pre-processor flags.

#

Even if the functions are separated into sub-modules, a la numpy.

slender iron
#

I'd do more granular submodules then. I'm less concerned with numpy functionality now since the return type always is floats.

manic glacierBOT
slender iron
#

CPython modules tend to be very large because they run on systems with much more RAM.

manic glacierBOT
lapis hemlock
#

I'd do more granular submodules then. I'm less concerned with numpy functionality now since the return type always is floats.
@slender iron ????

slender iron
#

my understanding is that ulab code will work differently if numpy is swapped in because the return types are different

lapis hemlock
#

That's right, but the return type won't necessarily be float.

slender iron
#

kk

lapis hemlock
#

Actually, my original reason for keeping some of int types was that you can reasonably OR, AND, XOR etc. them. Imagine that you have a frame buffer, and you quickly want to invert all colour. You then need something that takes characters, and returns characters.

#

Negation (~) is not even defined for float types in numpy.

#

Nor is it in ulab, for that matter.

tidal kiln
#

is there a way to determine the version of a library from within CP?

slender iron
#

ya, they all should have __version__

manic glacierBOT
#

I wonder if having many non-numpy modules would be a better structure for ulab. That way compatibility is available at the module level and is checked at runtime on import rather than function use.

I am not entirely sure I see what you mean...

I think we talked about this on Discord but I'll recap here. The idea is to split ulab into smaller modules than what numpy has so that functionality can be enabled at a more granular level. Enabling and disabling on module boundaries mean...

tidal kiln
#

ah, ok. that's what i thought. seems to work for others. i just happened to try an odd one first. is something broken for neopixel?

>>> import neopixel
>>> neopixel.__version__
'0.0.0-auto.0'
lone axle
#

^ I was just noticing this also

slender iron
#

did you copy it from the repo?

tidal kiln
#

doubt it, but can double check...

lone axle
slender iron
#

kk, sounds like a bug then

manic glacierBOT
#

I think we talked about this on Discord but I'll recap here. The idea is to split ulab into smaller modules than what numpy has so that functionality can be enabled at a more granular level. Enabling and disabling on module boundaries means that errors will be generated when an unsupported module is imported rather than when an unsupported function is called in the middle of code.

Yeah, the discussion on discord was clear, but it is great that you summarised it here, for the benefi...

tidal kiln
#

pfft. yah. maybe that was it. just pushed from the bundle:

>>> import neopixel
>>> neopixel.__version__
'4.1.0'
manic glacierBOT
slender iron
#

@lone axle which zip did you download?

lone axle
#

I see. The one in the mpy bundle has real version 2.2.1 but the one downloaded from the release page reports 0.0.0-auto.0

#

source code zip

slender iron
#

right, that is the one github creates

#

there should be a separate -py zip that has it filled in

lone axle
#

Ahh, I see yep. The mpy zip and the py zip both do have the proper versions reporting from them

tidal kiln
#

@slender iron thanks. appears to have been pebkac in my case.

manic glacierBOT
timber mango
#

I have the following code: ```
from time import sleep
import board
import busio
from adafruit_ht16k33.segments import Seg14x4

Initialize the I2C bus

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

Initialize the HT16K33 with alphanumeric display featherwing.

You MUST set auto_write=False

display = Seg14x4(i2c, auto_write=False)

manic glacierBOT
timber mango
#

When I do display.brightness(2) I get Traceback (most recent call last): File "main.py", line 47, in <module> TypeError: 'int' object is not callable What is wrong?

tidal kiln
#

display.brightness = 2

slender iron
#

display.brightness = 1

#

(I think its a float)

timber mango
#

brightness is defined as a function.

#

0 to 15 int

tidal kiln
#

looks...

slender iron
#

ah, it isn't a displayio.Display

timber mango
#

No, it is the ht16k33 library.

#
    def brightness(self):
        """The brightness. Range 0-15."""
        return self._brightness

    @brightness.setter
    def brightness(self, brightness):
        if not 0 <= brightness <= 15:
            raise ValueError('Brightness must be an integer in the range: 0-15')
        brightness = brightness & 0x0F
        self._brightness = brightness
        self._write_cmd(_HT16K33_CMD_BRIGHTNESS | brightness)
tidal kiln
#

so use = instead of ()

timber mango
#

OK.

slender iron
#

and if you could change it to a float that would be awesome

tidal kiln
#

^^ to match displayio?

slender iron
#

yup

#

consistent apis ftw

timber mango
#

I think I am starting to understand how decorators work now.

tidal kiln
#

yep. that was the key thing here. that @ line above the def.

timber mango
#

@slender iron I might be able to do that. I have been working a lot with the ht16k33 library lately. Is there an open issue for this?

tidal kiln
#

don't see one...go ahead and make one.

timber mango
#

OK.

#

I will open an issue and see if I can fix it.

tidal kiln
#

code-wise, basically just need to map a float 0..1 to an int 0..15

timber mango
#

Right.

slender iron
#

๐Ÿ‘ thanks!

manic glacierBOT
timber mango
#

@slender iron One is glad to be of service.

manic glacierBOT
#

Thank you too!
So again my problem:

  1. I would like to use the two SWD pins.
  2. When the itsybitsy starts because of getting power and I then try to use one of these pins I get an error.
  3. When I manually press the reset key and the itsybitsy restarts, if I then try to use one of these pins, I can use them with no problems.

Neither microprocessor.reboot() nor supervisor.reload() is chaingeing this.

I understand, that this is a complex case!

But when these pin are in use, someone...

ionic elk
#

@slender iron do you have suggestions for testing pulsio PulseOut and PulseIn?

#

I don't see any direct reference to them in the circuitpython startup guides

timber mango
#

Hello guys! I'm working on a GPIO expander board with the PCF8574 and I haven't found a library for circuitpython to use it as external GPIOs.

I have found https://github.com/adafruit/Adafruit_Python_GPIO/tree/c543d1df9c0a71bafb9f0a1f9dceecd79a920e74 this library for Raspberry but what do you think about making a similar one to work with circuitpython and blinka?

If possible I can work on it, of course anyone is invited to help out.

slender iron
#

@ionic elk pulseout is usually IR

#

pulsein is either IR or DHT temp sensor

ionic elk
timber mango
#

@slender iron Should blink_rate also be converted to use a float?

silver tapir
manic glacierBOT
fallen anvil
#

Sorry these patches are trivial, but when I come across things I like to fix them, elsewards that's how bitrot starts.

#

There's one more at /lib/tinyusb/src/portable/nxp/transdimension/dcd_transdimension.c:455 where the cast to (uint32_t*) would be better to be replaced with (void *), but that's in tinyusb and there are only so many PRs I want to have in flight at the same time - is there someone here who can fold that one in, assuming it's valid?

river quest
#

@silver tapir that is cool! thank you!

half sedge
#

Hi, I am kind of looking for someone with a PyPortal Titano and an mlx90640 (and the proper Stemma cable) that could give a try to my code, find the right scale_factor for that board. This is for my parametric version of the thermal camera: https://github.com/dglaude/CircuitPython_MLX90640_PyGamer_Plus/blob/master/mlx90640_scale.py

#

Now, if needed, I can make a version that does only require the PyPortal Titano, and not real camera.

#

It is NOT very important, I can leave without knowing the right factor. ๐Ÿ˜‰

#

@ionic elk I did control an LG TV from a Trinked M0 with just and IRLED and a resistor using an adafruit_irremote and pulseio.PWMOut... I believe that was RC5 code that was directly supported. I may have done some custom hack to support RC6. Here you find code for CPX: https://learn.adafruit.com/infrared-ir-receive-transmit-circuit-playground-express-circuit-python/ir-from-cpx-to-cpx

Adafruit Learning System

Send and receive messages using IR with your Circuit Playground Express!

slender iron
#

@half sedge I'm controlling my LG TV using serial rs232 into it

#

@fallen anvil lots of small PRs are great! I'm happy to review them all. We pay @gentle bronze, the TinyUSB maintainer, as well so don't worry about doing too many PRs there either.

#

@silver tapir I wouldn't draw a line from CPython to MicroPython since the source is separate

fallen anvil
#

Yeah, but that one is so small that it's easier to just wave my arms around and let it get scooped up in some cleanup :-)

#

BTW, just about got my board fully up! RS485 and CAN look like they might get 'interesting'

slender iron
#

nice! it'd be great to add apis for those

fallen anvil
#

Yeah, that's what I was afraid of :-/

slender iron
#

why afraid of it? you are on the cutting edge ๐Ÿ™‚

fallen anvil
#

Another dumb question...Can I pull 'default' pins from the global_dict_table? Means I can keep all my real pinning in one file and just refer to it symbolically elsewhere. I tried #define DEFAULT_UART_BUS_TX ((void *)mp_map_lookup(&mp_globals_get()->map,MP_ROM_QSTR(MP_QSTR_P3_ASYNC_TXD),MP_MAP_LOOKUP)) but that didn't fly.

#

(Don't like being on the cutting edge, only just finding the limits of my ZX81)

slender iron
#

why are you using the pin internally with C? usually we just use a define to map it

#

let me find an example

fallen anvil
#

#define DEFAULT_UART_BUS_TX &pin_GPIO_AD_B0_06 ??

slender iron
#

ya, though those default names are used to create objects already

fallen anvil
#

Thats how I'm doing it, but it means my actual hardware pin definitions are smeared across both pins.c and mpconfigboard.h .... From a embedded-geek perspective I'd prefer to keep them in one place and refer to them symbolically if possible. It's not a big deal, and it turns a const into a var I guess, so perhaps not the best.

slender iron
#

how many pins are you doing that way?

fallen anvil
#

I've only got I2C and default UART in there at the moment. Still finding my way, dunno if I can do it for Ethernet yet, haven't even looked at that. Ethernet is a good example actually, there are perhaps 10 pin definitions...it would be nice to not have them repeated in two places.

slender iron
#

It could be worse. ๐Ÿ™‚ native ethernet will be pretty tricky

#

we're not super happy with how it is done now

fallen anvil
#

Haven't even looked at it yet. My H/W is now stable and I've got a ton of perhiphs up, so its time for bed...

#

(Last Q: Current Ethernet is Wiznet only? No native imxrt support in place? that's going to be a chunk of effort)

timber mango
#

Is there a way to permanently (or until Circuitpython is reloaded) to change the name of the CIRCUITPY drive (Linux)? I often have more than one board connected.

fallen anvil
#

As of today :-) #define CIRCUITPY_DRIVE_LABEL "VersiBoard2" or similar in your mpconfigboard.h

idle owl
#

@timber mango If you simply rename it, it stays renamed through resets until CP is reloaded. Otherwise, build it yourself evidently ^^

timber mango
#

@idle owl How do I rename it?

fallen anvil
#

if the drive is already formatted then fatlabel /dev/xxx NEW_NAME will work

slender iron
#

@fallen anvil correct. only wiznet and we're moving that into python

fallen anvil
#

@slender iron OK. I've got an old rt lwip stack around here somewhere....but now it's REALLY time for bed. night all.

slender iron
#

night @fallen anvil !

timber mango
#

@fallen anvil Thank you!