Try
git fetchfrom upstream (adafruit/circuitpython), thengit merge, then do amake translateand push again.
I only use the a firefox web browser for github. I don't see those options.
1 messages ยท Page 288 of 1
Try
git fetchfrom upstream (adafruit/circuitpython), thengit merge, then do amake translateand push again.
I only use the a firefox web browser for github. I don't see those options.
I tried "Compare" between "Adafruit/circuitpython" and "hexthat/circuitpython" only 1 file changed.
Was suggested by @tannewt to enforce black style formatting everywhere. This will be many PRs in many repos, so adding a single place to track/discuss this effort.
@hierophect please let me know if/when you'll be able to look at this and if you have anything you'd like me to test.
In the meanwhile I'll get CP onto another board to test and see if the behavior is replicated
I would like to get to the bottom of this - I think I've observed this issue sporadically in the wild, but I never had decent reproducibility. I will try your steps and see if I can get it to do the same.
@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
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.
@slender iron will do
@somber coral is sprinting on it this morning
ok
@gilded cradle Please jump into CircuitPython voice to do an audio check if you can
kk
Lurking (it's an ISTJ thing ๐ )
@serene warren Excellent! Can you move your entry in the notes to alphabetical order please? Thanks!
Good afternoon all you wonderful folks -- happily lurking today! ๐
@gilded cradle Can you do notes today?
Sure
Thanks!
Oops, will do. habit of just adding to the end.
@serene warren, I moved your hug report to the right place
Thank you @gilded cradle
Lurking or not even there today.
lurking today
Lurking
Lurking
yep!
lurking
hug to danh for helping figure out some BLE stuff
lurking
hmm not hearing any audio
@fierce girder click the crossed out microphone icon next to your name at the bottom left
thanks ๐
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
Website for PyCascades 2020, a regional Python conference in the Pacific Northwest hosted in Portland, Oregon, USA.
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...
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?
...
Cool
Congrats MicroPython 10,000+ stars on GitHub!
https://blog.adafruit.com/2020/02/07/congrats-micropython-10000-stars-on-github-micropython-micropython/
๐
Everyone is getting a CLUE at PyCon! Thank you Digi-Key!
https://blog.adafruit.com/2020/02/06/get-a-clue-at-pycon-us-from-digi-key-and-adafruit-digikey-adafruit-pycon2020-pycon-circuitpython/
Awesome! a CLUE for all PyCon attendees!
Lots of bicycle projects starting up!
https://blog.adafruit.com/2020/02/08/circuitpython-gears-up-for-bicycles-adafruit-circuitpython/
OH Summit badge updates:
https://blog.adafruit.com/2020/02/08/open-hardware-summit-2020-wrist-watch-badge-updates-ohsummit-circuitpython-ohsummit20/
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/
hooray ๐
Joining late. Lurking. May have to leave early.
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!
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
@tulip sleet interesting that tinyusb is using by TockOS, a rust RTOS: https://github.com/hathach/tinyusb/issues/279#issuecomment-583957143
lurking
๐ @graceful heart
๐
just lurking ๐
relatively new to the discord community, but definitely getting acquainted and welcome to help out
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!!
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.
๐
good point, I should add myself to the document, thanks
Yeah, I try and type what people say, but miss things sometimes
Text only, no mic.
Wow, I'm part of a focus (people who aren't coders - well, not a very good one ๐ )
sorry bout that
๐
Yes, still lurking.
@errant grail momentarily confused since you did not have a muted mic icon
๐
@fierce girder I'd be happy to sync on low power ideas. I was hoping to start with time.sleep actually stopping the core
Thanks for reading and pasting the link. It is chaos at home right now.
Good idea @idle owl
+1 for board pages on circuitpython.org
+1 for that idea
Droid?
a star wars droid toy
Thanks
Thanks!
Thanks all!
great meeting
Thanks! And sorry @onyx hinge for the lurk/non-lurk/murkiness with the mic icon.
good to meet you all!
๐
@idle owl Did you have a look at the enhanced thermal camera?
<@&356864093652516868> Next week's meeting is on Tuesday 2/11 (24 hours after the normal time) at 11am Pacific / 2pm Eastern here on Discord.
@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
@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?
@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.
@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
@idle owl Right now I believe I found a bug in the screenshot library. Display IO to BMP thing.
@idle owl, phil said he's in until 5 pm
@turbid radish I thought he emailed during the meeting.
@idle owl, sorry, gmail just refreshed, cool, thanks
@half sedge Please file an issue if you found a bug.
@pastel panther so nothing I could shop online...
@idle owl the issue is filled with picture and BMP.
@slender iron I think you mean 2/18
@solar whale ah, thanks!
@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?
@slender iron thanks, re: power. Are there any projects that you know of where CircuitPython code is optimized for battery?
<@&356864093652516868> Next week's meeting is on Tuesday 2/18 (24 hours after the normal time) at 11am Pacific / 2pm Eastern here on Discord.
@pastel panther I think there is already someone working on sphero thing, and some look like BB8
@slender iron I think I figured out how to phrase what I was proposing last week. Do you have a minute ?
afk
@fierce girder I want to work on it soon
@errant grail no harm done
@half sedge @drowsy geyser was working on it
@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.
@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
@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.
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
@pastel panther if/when our timezone agree.
Dropping off. Thanks everyone.
I'm gonna drop off too
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?
@tulip sleet I bet we could get a big speed up by keeping track of the allocation search start for different block sizes
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
ya me too, seems like most allocations would be 1-5 blocks
i thought/hoped maybe damien would comment further on the overall allocation strategy
I'm kind of curious to track them
jimmo just did a video about the micropython gc too
Jim Mussared gives us the low-down on how the MicroPython GC (Garbage Collector) operates. He discusses the pros and cons of the implementation and considers methods that could potentially improve the GC, particularly around reducing fragmentation.
It's a super-interesting deep-d...
@timber mango Yes, there's a guide about it as well.
@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.
I conquered my problem with Github! ๐ ๐
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
@idle owl on the learn site? I will find it then.
@lone axle I am running on a Raspberry Pi 4.
Ah, I know that PyCharm supports linux, but no idea about Rasbian / RasPi specifically, may not be possible in that environment.
It's hard to do in GitHub, because the translation files get all scrambled. Would it be hard for you to start a new PR and make your change on that?
@lone axle I will figure it out. I do not give up easily.
@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
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 ...
@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
oops, please fix! or I will
I just heard you mention it, not sure where it is written
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
nah, I'm not. just wanted you to know
this rust for iot talk is interesting too: https://www.youtube.com/watch?v=uCnnhMleoKA
E. Dunham
https://2019.linux.conf.au/schedule/presentation/119/
Is Rust ready for the embedded world yet? If your IOT project is on ARM or MSP430, it already has native support in the Rust compiler, and AVR and RISC-V have compiler forks available.
But architecture support ...
@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!
๐
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.
@timber mango, hi, let me know when you can show me the demo. Thanks.
I have something ready right now. It is just a script that animates the display.
ok, cool
Do you have the alpha display featherwing?
Yep
I could zip the script up and email it to you.
Can you push it to your github repo?
Sure, I can do that. I will make a circuitpython repo. Give me a sec.
ok
@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
k
thanks!
@tannewt ping: please see above comment about redefining the macros or moving them to mpconfigboard.mk
@tannewt ping; ready for review/merge.
@tannewt ping: ready for re-review
thanks @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.
@hexthat I'll do the merge and push your branch. Thanks!
Saving to flash can take time to erase and we currently block to do it. I'd suggest buffering to 512 byte chunks which will align to FATFS boundaries, it may make it a little faster. I don't think this will help with erase time unfortunately.
@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.
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?
actually hex values would be easiest to read :)
@slender iron Please pin the message about the change in meeting time for next week.
@timber mango You're very welcome ๐
@stuck elbow Hex would be my next choice.
@idle owl I expected to pin one with the notes doc. I can make it today and replace the existing message
@timber mango, fair enough
@slender iron Fair enough, I'll make it once I get the video up and I'll include the info in the message.
k, either way. ๐
@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.
thanks for running the meeting!
it would be nice to pin the notes doc before the meeting, I always have problems finding it
Thanks for the quick response. Do you know if saving to an SD card would speed things up?
I submitted a small PR today.
@tidal kiln hihi ok for the board error
wanna add a section to the troubleshooting faq?
Circuitpython on a wrist here we come !
@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.
k. should be able to run as an adabot patch...
I figured.
the bundles will need personal touches though. ๐
Right ๐
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?
@raven canopy Can we fix the bundle first? Not that anything has been updated properly since this happened anyway, but still.
yeah. easy peasy. i'll get it after recovery. sprint days hurt... ๐ค
@raven canopy Sounds good. ๐ง ๐ฅ
@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
@pastel panther would you want to take a crack at running an adabot patch?
as long as you can guarantee that my computer won't burst into flames
quickly conjures a 'no promises' answer that doesn't sound like a 'no promises' answer ๐ค
that would be a hell of a bug
i mean, i could put an HCF print statement in there. ๐คฃ
"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?
yes yes.
is it time sensitive?
@idle owl? ^
Entirely.
This is for the bundle fix?
We have no releases in the entire CircuitPython ecosystem without this patch.
same fix, but for all of the libs.
Someone else should probably do it
I'm trying to finish my thing
I'll do the next one
releases will work now that master has been updated. they just won't be guarded against further updates.
Ah fair enough
@pastel panther sounds good. just wanted to get your pulse on it.
@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
interesting best practices badge: https://bestpractices.coreinfrastructure.org/en
@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. ๐
Ah, doing those others would be great. Sorry I didn't think of this sooner. By default I mean something like:
#ifndef foo
#define foo (0)
#endif
@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?
if only the official actions supported glob pattern file selection!
@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.
but...its not tuesday?
@gilded cradle and everyone, I had to change the name of my circuitpython goodies repository to Circuitpythjon_Goodies at https://github.com/geekguy-wy/Circuitpython_Goodies so it would not conflict with my fork of circuitpython.
You could try and making it an example in the ht16k33 library repo.
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.
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.
That sounds good to me!
Are there any special changes that have to be made to the Blinka compatible libraries to make them work?
@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.
@timber mango, there shouldn't be.
It is that shouldn't be that always gets me into trouble.
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()
@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?
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.
Oh, I deleted the top line. That is only for running on the Raspberry Pi direct.
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.
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?
Let's see what it looks like after you run it through pylint.
@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
What do you mean @midnight wedge? If you mean because they're not upper case, that should be fine for examples.
@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
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
@gilded cradle I mean the white space around the "="
Ah yeah, well that's why I suggested we look after linting
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
The AIN7 is the net name between the board connection and the mcu
The other name encodes the internal adc channel connected
or should I make a separate column for both the net and the chip
can you show me what you have so far?
Sure. in here? (still need to confirm some of the information i have in there already)
ya, here is good
Is the voltage the reference voltage for the ADC or the core voltage? @dhalbert, it should be adc reference voltage right?
Still need to confirm all pins are PWM, and i still need to add max current warnings to the bottom
Still need to confirm all pins are PWM, and i still need to add max current warnings to the bottom
nice! I believe all pins are pwm because the nrf have a full pin matrix for digital signals
not sure why that posted twice? keeps saying it failed upload
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
circuitpython's pin mapping file is here: https://github.com/adafruit/circuitpython/blob/master/ports/nrf/boards/clue_nrf52840_express/pins.c
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
gotcha!
arduino is here: https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/variants/clue_nrf52840/variant.cpp
it doesn't look like there is a separate analog mapping
looks like it may have a0-a7 there
interesting that this site uses P for pins on the original microbit: https://microbit.pinout.xyz/
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
ah, ya I see most things have P, D and A names
ah, maybe thats where p0-19 comes from in board then. to help port over from microbit.
ya, that's what I'd mimic most
I'm not a huge fan of the A and D naming we inherited from arduino
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
cool
D and A will help if folks run arduino on it first
I don't think that microbit micropython has pin objects....
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.
cool!
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.
what warning?
max 30mA for entire package, max 10mA per pin, 5mA recommended per pin
yup, that would be the same
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
I think it's a nrf thing
@idle owl can talk about stuff now if you're available
@onyx hinge Sure.
Wow I missed a lot of chat
ah yep. i think you are right. the datasheet seems to suggest the regulator is inside the nRF52
@tiny oriole I think it can depend on the pin output circuitry too. usually they can take in more current than they give out
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.
sweet
@xobs want to open a PR for official fomu support?
@aidancuckoo I don't know of a Tomu port. It only has 8k ram so using it won't be pleasant.
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
ya, i'm sure it is somewhere
@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...
Thank you for the PR! Unfortunately I think some of the TinyUSB terminology confused things a bit.
Instead of modifying usb.c, please modify usb_msc_flash.c instead. It is already tracking when the host "ejects" the drive. You'll need to set ejected to true on init and then exposed a similar function to check it from storage.
I don't think this needed. mount doesn't mean filesystem mount here unfortunately. It is plugged/unplugged.
@ThomasAtBBTF Why not just disconnect the power control pin when you are iterating on the circuitpython code? In "normal" operating mode the CircuitPython vm won't reset and therefore won't reset the pin.
If you are designing a custom board you can exempt pins from reset but I'd rather not allow that from Python. The "never_reset" concept is only for use under-the-hood.
<@&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
We don't usually split the object like this because it is included in the shared-module header. It is an interesting idea though.
Getting really close! Thank you for the doc strings!
Mind removing this? I don't think it is used.
I'd drop the _ on the EVE class since the module name already has it. I'm ok if you'd prefer to keep it though.
@hierophect I'm ok leaving them in the .h. I relied to the specific comment with details.
thanks @idle owl !
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).
However, this location is only updated if the allocation was 1 block long. In this case, it is two blocks which means that the search always starts from the beginning.
So is that a bug?
My only goal in life now is to get a PR through PyLint with no errors.
its a right of passage. ๐
After five commits, my PR has finally squeaked by PyLint. ๐ ๐
๐
PyLint is having a major impact on my coding style.
@slender iron I'm having issues setting up I2C in the repl:
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
I'm having issues setting up I2C in the REPL:

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...
@slender iron
@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 ๐
smart ๐
but thats ok because we hvae a layer of abstraction in both arduino and circuitpython
that actually makes alot of sense
so "A4" is not necessarily the '840's 4th-input-to-ADC
thanks for the diagram, can we add it to the guide?
I feel pretty abstracted now. ๐
Absolutely. Maybe run it by a few more eyes just to be absolutely certain everything is correct ๐
I have stumbled into a maze of twisty little passages, all alike...
I'm all for helping out in any way i can ๐
I completed my goal for today, in spite of Mz PyLint, and got two PRs in for review. Now, I need a nap. ๐
@tiny oriole its appreicated, is there an original format for the doc? like AI file?
Yep. its an Illustrator file you need the .ai?
yes please
cause that way if there's a typo, we can fix it ez ๐
how do you want to be credited?
Here ya go
that is a nice pinout diagram!
I dunno. How does credit usually work for those? Relatively new to that process, hahaha
can be your name, URL whatever ya like
Ah, Name is fine ๐
k! hceck it here https://learn.adafruit.com/adafruit-clue/pinouts
well that was quick! thanks!
zoom! ๐ค
I think you meant to post the files?
I don't think it is a bug because if you update it on a larger allocation you'll ignore smaller holes the next time. We could, however, track a few start locations based on the allocation size say 1-4 to speed up the smallest, and (likely) most common, allocations while falling back to the largest tracked location if the allocation is above that.
@tannewt @dhalbert i have edited the patch according to your suggestion.
The test i performed was the following:
storage.remount("/", False) at this point still fails because the drive is mountedstorage.remount("/", False) which now worksstorage.remount("/", True)While I think that rawsize is actually quite useful in an embedded environment, I am going to move all numpy-incompatible functions/methods into a separate module that you can easily switch off. I believe, that should satisfactorily settle the issue.
Blinka on Orange Pi Plus 2e
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.
@fallen anvil just guessing but the bootloader may be living here https://github.com/arturo182/tinyuf2
there's a sub-directory called hw/chip/mimxrt10xx
Yep, thats the 1010 one. I can easily port it but don't want to be repeating work..
@indigo wedge any comment?
(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 :-)
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 ๐
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!)
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
Yup, that's my plan. Lord knows how I ever had it booted before!
possible that you had leftover data in flash from another firmware
and you lost that when you erased flash
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!
good luck and sorry for the mess, imx is very WiP ๐
Its genuinely no problem, but I only have a very small brain, it's important I don't waste it.
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
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)
โค๏ธ

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
this relatively old arduino forum post seems to indicate that it might apply to mac also: https://forum.arduino.cc/index.php?topic=83703.0
Mac OS X 10.6.8 Serial Port no USB option
Well, maybe not. The last post mentions that the title is about Mac but some of the commands and things are actually for Ubuntu
@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.
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
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
The serial port group is usually called dialout for Linux.
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.
Originating reference seems to be at https://stuffthingsandjunk.blogspot.com/2009/03/devcu-vs-devtty-osx-serial-ports.html
@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.
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.
@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.
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.
then I'm afraid that's beyond my paygrade...our problems were much earlier
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
@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.
๐
@v923z I noticed that .shape is a property in numpy and a method in ulab. Would you be receptive to changing this, or should we expect to carry such a change locally if we want it?
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...
@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
@tulip sleet I bet those align with allocation sizes
is there a new dictionary allocated for function locals
?
if you run that you will see zero heap usage for the non-*args case
I'm submitting the busdevice PR and will document the anomaly I mentioned last night.
kk
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
that's in nargs.py
just run it once and you'll see. Output is too big to paste
kk
@GathererA Is there a need to keep this pull request open?
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
@slender iron PR with noted anomaly; https://github.com/adafruit/Adafruit_CircuitPython_BusDevice/pull/43
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"
what color do you see?
red
then there's something wrong with the USB connection
that's the bootloader saying it's not connected via usb
ah, this may be power only cable
@fallen anvil I'm up if you have any imx questions for me
yep - new cable, I have green now. thanks!
I'd expect an SD card to be slower since the only interface we support is SPI. However, it could surprise me if the erase is faster.
@v923z I noticed that
.shapeis 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.
It is always a great please to respond to my own comments, but I just wanted to relay a "never mind" to myself. I will remove rawsize, and insert the itemsize, and `size'. That should be a fitting replacement.
cp 5.0.0b5: running https://github.com/CarlFK/cpx/blob/master/cpx_setup.sh errors near the end - a bunch of files get copied, then:
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
@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.
@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)
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?
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.
Hi @v923z, thanks for
ulaband 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...
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?
it would be better to exclude to the . files when copying recursively
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
im not asking for help using... i'm trying to report a bug in beta version
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.
I will try your original copy to see whether it breaks thignsd.
what is the host system? Linux?
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
hi @lapis hemlock !
Ubuntu 18.04.3 LTS bionic
@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
@lapis hemlock welcome!
but it won't hurt
@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.
@gilded cradle Hello. Did you code set_digit_raw()?
yes
Ah, good. Does it respect the state of auto_write?
Let me check. If not, it should.
Yes it does.
OK. That may be all I need to do more interesting things with animations. I will try this out.
ok
Thank you. I just wanted to double check before I started digging deeper into stuff. ๐
No problem
Mz PyLint prefers while over for.
linux q: what group do I need to be in to talk to ttyACM0?
@teal bear dialout if I remember correctly.
hey K... yeah, think you are right
Hey Carl
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.
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
hi @lapis hemlock !
@slender iron , @onyx hinge Hi everyone!
@lapis hemlock ๐
Yes, for Linux, it is the dialout group.
https://paste.ubuntu.com/p/JnDRB82fXn/but cp on fomu does, so my tio n right n stuff are working :
@lapis hemlock btw really appreciate you taking translate() upstream, it made a big difference in the size of our delta.
@lapis hemlock how do you plan on splitting functionality for code size? How will the python code know which version it has available?
tried on a 2nd box that has a pretty fresh / un mucked with Ubuntu, same thing
@teal bear your link seems broken
@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?
I also have the STM32 feather, which I think uses SDIO for the SD card. Do you know if that is likely to be faster when that functionality is added to circuitpython?
oh.. I need to hit ^c... derp.
@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
chases yack... come back here so I can ... now that I have a >>> what was the mkfs thing? /me scrolls and scrolls
@lapis hemlock with our delta so small right now I think we will be okay to "git merge" your branch into ours when we want. the main thing that I don't know how to solve is this difference: https://github.com/adafruit/circuitpython-ulab/commit/21b5a130c8eb905c8115ced8debfd71a57f1cf7d#diff-ac8558a5a5fa3fd6f736dd11828c3f90L168
@slender iron Are you absolutely against using ulab.h to handle this?
@slender iron numpy.array numpy.zeros etc deal with 1d and 2d arrays via a single function/type
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
so it's not immediately obvious how to do it "by module"
I'm ok moving away from the numpy api if it means functionality is split by module
@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.
the benefit by splitting by module is that you get errors up front at import time
@lapis hemlock is this an accident/bug? numpy returns a scalar. ```>>> x = ulab.linspace(0, 10)
ulab.argmax(x)
array([49], dtype=uint16)
found it: import storage; storage.erase_filesystem()
@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.
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.
OK, I'll file an issue so it doesn't get forgotten
@onyx hinge thanks! To both comments.
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
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.
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)))
@onyx hinge OK, I'll do some digging.
so is the plan to stick to a strict subset of numpy then?
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...
I'm ok with extra. I'd just want it on a separate module
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
@slender iron Actually, I think, at the moment the only extra function is spectrum.
I have to go to a meeting, bbl
I'm ok with extra. I'd just want it on a separate module
@slender iron A separate module will it be then.
thanks!
I might also have to wrap up for today.
np, we appreciate your help
It was my pleasure.๐
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
Right. Is it ok to keep this way? This arrangement does uncouple the shared-module from shared-bindings a bit more.
Yes, it is much easier to maintain this way - thanks
I'd prefer to keep it thanks. The two modules are used like this
from _eve import _EVE
from eve import EVE
class Gameduino(_EVE, EVE):
...
So it's a little more explicit to keep the underscore naming.
@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 the record, the value returned by my current implementation is usually 3.28 when plugged into USB)
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 ๐
@idle owl Somehow I overlooked the greeting. ๐
@lapis hemlock and me too ๐ ๐
@lapis hemlock and me too ๐ ๐
@tulip sleet Good to meet you, Dan!
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.
@ionic elk do you think this might continue into tomorrow into the meetup?
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...
@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.
Wow, busy day here!
I posted a new animation demo on my Github.
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.
@tulip sleet you around?
@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.
@gilded cradle There is a new animation demo on my Github.
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...
ah, ok
i was testing on a CPB (on-board LIS3DH) and to some extent on an M4 with external LIS3DH
ok I have a metro m4 with lis3dh going now
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
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}```
is alloc taking a block?
its an allocation of any number of blocks
so it's using half the blocks, because it's finding free space?
I think that is by not allocating to *kwargs
oh, I see, you're comparing my before and after, not new code from you
what is the big 3000 and 4000 in the after?
ah! that is my count of non-single block allocations
I hadn't noticed that
that is very interesting
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?
ya, it has hasattr
the hasattr thing was just a minor speedup, it shouldn't alloc anything
(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}
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
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
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.
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
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
not only is >1 slow but it gets exponentially (?) worse because each time it has to go a bit further
yes, we saw the i2c transactions take up to 10 times longer just before gc than just after (on the 'scope)
so I wonder what the best way to solve this is
we could just store start locations for N block sizes
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
is it worth asking if they are working on this already? I didn't see any PR but I didnt' look that hard
I saw something more complex that jimmo did making finding the allocation area faster
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.
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.
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
Well, that took a while for something so trivial...but at least I know my way around the bootloader a bit better now :-/
thanks @fallen anvil !
@tulip sleet I think I'll go for my run and let my mind chew on it. Thanks!
sounds good!
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!
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
i had grander ideas of limited ref counting (e.g. 1-bit ref count) + gc but that's a complete redo
ya. I suggest watching https://www.youtube.com/watch?v=H_xq8IYjh2w to see jimmo talk about his ideas
Jim Mussared gives us the low-down on how the MicroPython GC (Garbage Collector) operates. He discusses the pros and cons of the implementation and considers methods that could potentially improve the GC, particularly around reducing fragmentation.
It's a super-interesting dee...
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
i 've added that to "watch later"
๐
Looks good @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?
Let me play around with it some first.
OK, that works. I am going to do some more fiddling with it also without any more changes to animate()
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
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?
like calling animate(0, A, delay)
Ah, yes, both must be lists.
@tulip sleet any idea how long a gc takes?
Must be animate([0], [A], delay).
shared-bindings/busio/SPI.c. This means an onboard display will get to use SPIM3.@slender iron no idea off the bat
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
๐
that is way better
shaved a bit off the struct-less one too
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.
@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.
The preference is to call something like raise ValueError('You provided a bad value') except with a better message than that. ๐
OK, I can do that. I just do not care for that approach.
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?
i think there is an at_exit issue. ๐
thanks @raven canopy I'll dig it up and read through it.
quick search is coming up empty. it may have been brought up during a meeting...
hmm yeah I'm not finding it either. Nothing for various safe mode, exit, or fault searches either.
i could've sworn someone brought it up recently...
which might be ```
import time
import microcontrollerprint("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
well, MicroPython put it in as sys.atexit() https://github.com/micropython/micropython/pull/4978
_i was adding an extra _ _
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. ๐
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
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.
ahh. i vaguely remember that. debug related? or in-the-wild?
it was when i was crashing the Feather NRF with
neopixel_write() of large streams done frequently.
@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
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.
i'll note that, thanks
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.
got it, np
hmmm no audioio on m0 boards?
trinket m0
can I shed something else? I'm thinking of doing a custom board based on the same processor as the trinket
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
samd21e18 (what's on the trinket) does support i2S if you want that
nah it needs to be real simple
longints are already turned off. 192kB is a real squeeze
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
boards/pirkey_m0 and pewpew10 are quite pruned
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!
that is roomy!
plenty of space to take a nap. ๐ผ
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?
analogio?
you need 18kB for the filesystem?
need it
that 6kB does not include the 64kB filesystem, which is still there
oh yeah. der.
if you are using a Mac, watch out copying files to the tiny filesystem. use cp -X. See https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#running-out-of-file-space-on-non-express-boards-20-44 scroll down to OSX hidden files section
I'm on my Windows machine
then zero problem
it works. ๐
yay!
tested display on CLUE @ 32 MHz - works great - much faster :)
This looks good! I tested a CPB fetching acceleration in a tight loop for 15 minutes with no issues. I won't merge pending any further comments by others.
@ivory yew
haha!
๐ ๐
@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.
I'd prefer usb_msc_enabled to be usb_msc_ejected to match the internal name. I can update it tomorrow if that is easiest.
Ok, I can live with that.
But what about the two "unusable" pins?
If you don't want to change the code there, how about to get a reference to the allocated pin objects in microcontroller. So they become usable.
As I am not an native english speaker, can you please elaborate what you mean with: "concept is only for use under-the-hood"
The two SWD pins should be usable. If they aren't it is because there is a bug. It is complex because when reset, the pins should be in SWD configuration. I'm not sure what you mean by a pin reference.
I meant that the concept of never_reset is meant for use in C code ("under the hood of Python") only. Thanks for requesting clarification. I'm happy to elaborate.
Thank you! Please just update the existing bin target. There is no reason to not have it there and it'll be automatically distributed.
I wonder if we should put the displayio buffer in this ram as well. That way we could check the location of the buffer and skip the memcpy.
hi @tannewt -- I looked into this on MicroPython and tried something very similar. There are two main things to solve:
Implemented the requested changes. I did not retest on actual hardware.
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.
@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
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.
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, ...
@tannewt I'm guessing you mean that the two SWD pins should be usable by SWD, right? As in, under normal operation, they should not be accessible as GPIO pins, ever. Or should they be SWD pins only on reset, and then become accessible as GPIO pins for code.py? Asking because I want to make sure my STM32 port is aligning to this as well!
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?
This is also happening with atmel-samd boards. I suspect something with TinyUSB broke this.
PR'd to micropython-ulab to make their master branch build with circuitpython and with micropython! https://github.com/v923z/micropython-ulab/pull/37
@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?
@onyx hinge in a meeting, can look a bit later
@onyx hinge Thanks! I misinterpreted. I will check later.
Aha! Thanks
I think there was a spot where we were unpacking and repacking the kwargs
native base init wrapper is changed
Oh, I get it now. VREFINT readings go up as VDDA goes down, since it's the stable internal reference voltage compared to the external voltage. So VREF_CAL/VREF is the correct ratio.
@tannewt @dhalbert translation fix is in so this should be good to go, regardless of whether we want to add correction to the ADC in the future.
@onyx hinge @slender iron Hi Jeff/Scott, what do you think of getting rid of signed integers in favour of complexes? https://github.com/v923z/micropython-ulab/pull/35#issuecomment-585064657
@lapis hemlock I don't know enough about numpy and such to say.
Java went the other way and dispensed with unsigned integers.
However, Java is targeting a rather different set of use cases.
@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.
I agree.
@lapis hemlock what is the trade-off for having more types? code size?
@slender iron code size, and complexity. (This latter one won't appear in the firmware, though...)
@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
@onyx hinge I can't comment on this, you'll have to tell.
I don't know enough to comment yet either :)
@onyx hinge Jeff, what is the CP-MP delta now?
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
@onyx hinge the question is, whether we can make fft compatible with numpy, and the only way is to include full-blown complexes.
By the way I am traveling during the next two weeks so my contributions will be much slower
@onyx hinge What happened to the #pragma?
It will go in our makefile, I'm honestly not sure why I put it there in the first place
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.
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
I didn't know that Limor was involved in this. Not that I mind, mind you!
She is keen on processing sensor data on it in the clue board
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?
Right!
I can fix that. I need a couple of days, but that is doable.
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
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
It will most probably happen during the above-mentioned two weeks.
I think I won't have too much time before the weekend.
Okay, time for me to get going! Thanks!
Bye!
@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.
@slender iron But ulab.h https://github.com/v923z/micropython-ulab/blob/master/code/ulab.h serves a similar purpose. I don't mean to say that I am dead against sub-modules, I only wanted to point the option out.
@slender iron Sub-modules are definitely more organised.
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
This is a good point.
๐ it has worked well for our other apis
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.
I'd do more granular submodules then. I'm less concerned with numpy functionality now since the return type always is floats.
@tannewt if that comes out to be the case, do you think using an internal fork of TinyUSB makes more sense?
CPython modules tend to be very large because they run on systems with much more RAM.
@iayanpahwa I'll just fix TinyUSB. :-) I plan on looking at it later while I watch Ask An Engineer.
I'd do more granular submodules then. I'm less concerned with numpy functionality now since the return type always is floats.
@slender iron ????
my understanding is that ulab code will work differently if numpy is swapped in because the return types are different
That's right, but the return type won't necessarily be float.
kk
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.
is there a way to determine the version of a library from within CP?
ya, they all should have __version__
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...
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'
^ I was just noticing this also
did you copy it from the repo?
doubt it, but can double check...
Adafruit_CircuitPython_MCP230xx downloaded from the release page of that repo (https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx/releases) is reporting 0.0.0-auto.0 also.
kk, sounds like a bug then
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...
pfft. yah. maybe that was it. just pushed from the bundle:
>>> import neopixel
>>> neopixel.__version__
'4.1.0'
@hierophect the default "reset" state of the pins should be SWD. If user code uses them then they won't be until they are deinit or the VM finishes and resets them.
@lone axle which zip did you download?
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
right, that is the one github creates
there should be a separate -py zip that has it filled in
Ahh, I see yep. The mpy zip and the py zip both do have the proper versions reporting from them
It may be faster when SDIO is added. I don't really know and we have no immediate plans to add SDIO support.
Ah! Thank you! I hadn't thought about the bin being used by uf2. Looks great!
@slender iron thanks. appears to have been pebkac in my case.
Good catch! I bet it will speed things up.
Ok, looks good to me! Thanks!
Thanks @jimmo! I bet the perf tests that improved used fewer 1-block allocations than the others. I may play around with them later to see.
@dhalbert Are you ok merging this? I think it'll generally be an improvement and be a drastic improvement in the pathological case.
Can you have EVE subclass _EVE instead? I'm a little nervous that the multi-inheritance isn't well tested.
Would you mind using \ so the macro can span multiple lines then so it is more readable?
I have the following code: ```
from time import sleep
import board
import busio
from adafruit_ht16k33.segments import Seg14x4
i2c = busio.I2C(board.SCL, board.SDA)
display = Seg14x4(i2c, auto_write=False)
Just two comments. Getting very close! I'd love to chat about how we can use _eve for the internal display stuff too. I'd love to see a CircuitPython prompt on a TV via EVE HDMI. :-)
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?
display.brightness = 2
looks...
ah, it isn't a displayio.Display
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)
it's a property, not a function:
https://github.com/adafruit/Adafruit_CircuitPython_HT16K33/blob/master/adafruit_ht16k33/ht16k33.py#L88
so use = instead of ()
OK.
and if you could change it to a float that would be awesome
^^ to match displayio?
I think I am starting to understand how decorators work now.
yep. that was the key thing here. that @ line above the def.
@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?
don't see one...go ahead and make one.
code-wise, basically just need to map a float 0..1 to an int 0..15
Right.
๐ thanks!
Ok, I think it should be ok now.
@hexthat any time you start adding more translations please start with https://github.com/adafruit/circuitpython/blob/master/locale/zh_Latn_pinyin.po, click the pencil edit icon and then commit to a new branch. I think these changes were confused because the commit was done on an old version of master rather than the latest.
Thanks!
@slender iron One is glad to be of service.
@tannewt Changes made to all boards. Tested with the Meowbit, Feather and Espruino Wifi, which covers all flag options.
Thank you too!
So again my problem:
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...
Awesome! Thank you for redoing all of these. Feel free to merge once CI is happy.
@ThomasAtBBTF thank you for the clear recap of the issue. I don't believe the issue is any user code. My guess is that the state of the pins on start up varies with reset as you are seeing. It'll take some debugging to sort out what state the pins are in when you are seeing them as in use.
@tannewt Note, I'm going to revert to the old strategy on USE_INTERNAL_SPI rather than adding it to every single port.
Ah, ok. I see it'll require changes outside of stm32f4.
@tannewt USE_INTERNAL_SPI is used in DisplayIO, which is cross port, so it's failing CI. But if you mean you'd rather it be added to every port as a universal default requirement, than I can do that instead.
Fixes #2616.
common.template.ld.Tested with turtle on a CLUE. Seems mildly faster.
Tested SPI reads with an LIS3DH in SPI mode on a Feather nRF52840.
Awesome! Thank you for redoing all of these. Feel free to merge once CI is happy.
@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
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.
Seems there's a good pulsein tutorial here: https://learn.adafruit.com/ir-sensor, but I can't find anything that uses PulseOut
Looks good to me! Thank you!
I will merge! I think it's a real-life improvement for a number of cases.
@slender iron Should blink_rate also be converted to use a float?
@river quest I'd just started with the timeline for micropython.
Fix crowbarring of 32 value into 8 bit register sequence, which was generating an alignment warning.
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?
@silver tapir that is cool! thank you!
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
Here you can do "music" or "ringtone" with pulseio.PWMOut: https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Annoy_O_Matic/main.py
And there is that Theramin: https://learn.adafruit.com/trinket-gemma-mini-theramin-music-maker/circuitpython-code
@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
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'
nice! it'd be great to add apis for those
Yeah, that's what I was afraid of :-/
why afraid of it? you are on the cutting edge ๐
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)
why are you using the pin internally with C? usually we just use a define to map it
let me find an example
#define DEFAULT_UART_BUS_TX &pin_GPIO_AD_B0_06 ??
ya, though those default names are used to create objects already
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.
how many pins are you doing that way?
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.
It could be worse. ๐ native ethernet will be pretty tricky
we're not super happy with how it is done now
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)
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.
As of today :-) #define CIRCUITPY_DRIVE_LABEL "VersiBoard2" or similar in your mpconfigboard.h
@timber mango If you simply rename it, it stays renamed through resets until CP is reloaded. Otherwise, build it yourself evidently ^^
@idle owl How do I rename it?
if the drive is already formatted then fatlabel /dev/xxx NEW_NAME will work
@fallen anvil correct. only wiznet and we're moving that into python
@slender iron OK. I've got an old rt lwip stack around here somewhere....but now it's REALLY time for bed. night all.
night @fallen anvil !
@fallen anvil Thank you!