#circuitpython-dev
1 messages ยท Page 364 of 1
It should work using Adafruit_Blinka_Displayio. I tested all the color TFTs at the time I wrote it. You may need to change pin names to get it working. You can check this guide: https://learn.adafruit.com/running-pyportal-code-on-blinka-with-displayio
When looking at the mpy-cross pre-compiler I've been unable to find a way to select the native emitter.
Q: is it possible to invoke the emitter option while pre-compiling it on the pc?
This is the help message but adding emit=native either before or after the file parameter raises the error at the bottom
Implementation specific options:
emit={bytecode,native,viper} -- set the default code emitter
heapsize=<n> -- set the heap size for the GC (default 2097152)
```error:
`multiple input files`
Thanks, I'll have to try it again, not sure why I didn't use displayio
I see usage: mpy-cross [<opts>] [-X <implopt>] <input filename>
so mpy-cross -X emit=native filename.py ?
Oh man Iโm pretty sure this is a bad plan and there is so much to respond to ๐
How do circuitpython library developers make reliable libraries if random unrelated exceptions may be thrown at any point in circuitpython code? Are you going to ask every python library that exists to disable interrupt exceptions โjust in caseโ for critical sections of code?
Okay, forget library developers for a second, how on earth do you teach users what is safe to put inside of a `with button.raise_on_pr...
I don't know why we talk mpy-cross here and now... but I came to ask a question about mpy-cross. ๐ Is the CI compiling 200+ times mpy-cross at every PR, with this command: "make -C mpy-cross -j2" ?
I am able to reproduce the Ubuntu issue. It does not work.
Not able to compile circuitPython beyond 6.1.0 using Linux. Master and 6.2 do not work using Linux.
I tried the 6.2 RC and it does not work. Seen before in #4479
You need to install some new prerequisites and bring in a new submodule or two to build. Ask on discord or in the forums for interactive help for this. The Building CircuitPython Learn Guide has been updated. See both the Linux setup part and also on the Build page, a new requirement of doing pip3 install -r requirements-dev.txt.
You need to install some new prerequisites and bring in a new submodule or two to build. Ask on discord or in the forums for interactive help for this. The Building CircuitPython Learn Guide has been updated. See both the Linux setup part and also on the Build page, a new requirement of doing
pip3 install -r requirements-dev.txt.
I followed the build steps...so not sure I see your point. I installed the recommended compiler. I sync and initialized the submodules. If this is true it is ...
We don't use GitHub for support questions like this. Please ask in discord or the forums. I am happy to help you right now in discord; I need more details like your error messages.. It is possible to build on Linux; that's what the core devs do all the time.
it is built as part of the tools to build the build, in the same way other dependencies are installed in each CI worker, I believe specifically for frozen modules
@WarriorOfWire I think you make a good case it is in general a bad idea, and too dangerous. :smile: This was an early-morning thought bubble that does not survive sunlight.
I was thinking of a rather specific case where the operation being terminated abruptly is safe to do so, because it is idempotent or similar. NeoPixel animations are a perfect example. They keep some internal state that can be discarded, and can be stopped at any time (at a Python call boundary, which is what this does....
@tulip sleet can't we have interrupts the same way they are done in micropython?
yes, we can, but the restrictions as described in the MicroPython doc we have felt are onerous to explain to users; that is, it is a support nightmare
so we have always been looking for something safer and easier
any good prospects on the horizon?
I would settle for a feature like gamepad/countio integrated into digitalio
ya but something is better then nothing...?
that's why I opened the other issue asking for use cases. I would like to provide something more constrained than "execute arbitrary Python code when this asynchronous event happens", so settings flags, putting an event on a queue, etc. are all safer, simpler alternatives
there is a lot of discussion in the python world, for instance, about asyncio and how it's difficult to use, and several alternatives. I think part of the problem is that the language itself does not have primitives that lend themselves to easy handling of asynchronicity and concurrency. I'm not sure I know of a language that does, though
@jaunty juniper so yes, please add your use cases to that issue
@low sentinel 'a comments led to think about something like:
with alarm.monitor(alarm.pin.PinAlarm(board.D0))
as stop:
run_animation_once(stop)
You would call stop.value inside the animation at safe places to return early.
well, I saw the question come by in #help-with-circuitpython from people thinking in terms of interrupts to get button presses during otherwise complex animations/computations
we orient them towards a loop with gamepad basically
so when the button press happens, do they want a flag to get set, what are they thinking? The problem is that interrupts is a low-level mechanism. It reminds me of the issues around threads and memory sharing. Threads is low-level; how do you make it safer to use? The usual answers are "share-none", message-passing, etc.
1.) A trigger on a pin-level change from a Hall or other type of limit switch during position feedback control.
2.) The faster the response, the more accurate the positioning, regulated by actuator velocity of course
- Stop the positioning
Both the digital input and the motor pwm is over I2C communication, so super-fast polling will interfere with other I2C communication activities.
is such an implementation possible where state is saved during interrupt and code then resumes once the interrupt is handled?
I often see that people don't think of writing a routine like should_i_stop() and calling it multiple times in, say, an amination. They don't think of writing routines at all, actually. Getting people to think in terms of abstractions is really difficult, and is one of the basic ideas of coding that some people don't quite ever learn, yet needs to be taught early.
what do you mean by "possible"? Yes, the interrupt would happen in the background, and change some state that could be checked. How to check that state is the idiom to provide
it needs to be safe and simple
yeah, that's my solution, a function "check the buttons" peppered every now and then
I am thinking this from the perspective of say a program is running and an i2c sensor interrupts to say that data is available to read
@jaunty juniper can you elaborate on what you want vs. what gamepad (and the other pulse modules) provide?
right, so how fast do you need to respond to that? Do you need to structure the program as an explicit event loop? Apparently yes. There is no implicit concurrency or event-looping in python. So we come up with all these mechanisms to provide it which are hard to explain
my main issue is on the output side... output actions that are needed faster than code loops can happen
even in C I you would probably not want to read an I2C sensor in an ISR, since it could take too long. You want to defer it to a safer time. Specifying when that is, is hard
it requires a style of programming that is foreign to the ordinary straight-line code people are taught.
It is interesting that the basic structure of an Arduino program is loop() !
in MakeCode, you can have multiple groups of program blocks: they run concurrently. There is implicit parallelism. Unfortunately there is no safe mechanism for passing info between the grioups; you just set variables, so it's basically threads and shared memory
I like gathering use cases for it. Now that I've dived more into CP both in python and the core I think trying to collect what people want to do vs the how they have in their head is important.
the RP2040 PIO has some possibilities, especially once CP implements the JMP on GPIO capability, not super simple to program though
I'm thinking say for a button press to abort a long animation - well how does that long animation get aborted if it doesn't still have "if this flag from an INT was set" peppered through-out, or does the developer want it to just stop that routine? like there is a part missing
I don't think that the word "safe" can be used with interrupts no matter what the language is... they always need to be handled carefully.
what we are trying to get past is that people say they want interrupts, which is a low-level mechanism, but we really want to know what they want to accomplish with interrupts. Like, do you need pointer arithmetic or do you need subscripts? One is higher-level than the other
@analog bridge, exactly, so instead of providing a raw interrupt mechanism, what can we do that provides the functionality you want and still be safe. My "interrupts as exceptions" proposal was very unsafe, and was rightly called out
In theory I think countio could be used for a button press. Set that up, and then just check the count. If it goes up the button was pressed. But then you still need to now check that count
countio is a manifestation of a particular use case of interrupts
countio you mean? I think its excluded from most SAMD21 builds for space
ah
at a glance your idea seemed right... the same is done with watchdog exception but I guess if the watchdog triggers then something really bad has happened anyways
yes, the origin of the idea was "I want to ctrl-C the running of a NeoPixel animation programatically".
I think what I don't see (not from you but from the problem) is "and do what" after stopping the animation. Abort the function? and then... something
it was "move on to the next animation". We have a lot of projects like that. E.g. Kattni's Christmas tree, you can cycle through the animations. The code seems more complicated than it should be due to having to be able to interrupt the animations
you could wait until an animation cycle is done, but it might be many seconds
hmm yeah and without somehow maybe marking a function as interruptible how do you determine what to abort from and what to do then
Yes, WarriorOfWire's point is that it's very hard to know when it's safe to interrupt, and hard to protect the unsafe places
the neopixel case is very safe; the animation routines have no external state except the neopixels, so you can just stop them, but in many cases it's not safe
just having an api which can check for if an interrupt has happened and how many time it has happened since the last check should solve many problems...
maybe we can expand countio to accept touch interrupts... a combination of countio and alarm api perhaps...?
Having worked on countio I don't think that would be hard. Or something similar. It really just gets a pin and increases the count when it triggers
ya... so instead of countio expecting a pin, it can expect an alarm object like...
count = countio.Counter(alarm.pin.PinAlarm())
i originally wanted to name alarm to be event, and had some ideas about having alarms put themselves on a queue. This kind of discussion is what I was trying to provoke in the interrupt-use-case issue. One thing you want to do is set a flag, another is to count, another is to enqueue
yes, it's an interesting q of where to put the functionality: is it on DigitalInOut, or countio, or alarm? alarm could have been implemented with functional additions to time, DigitalInOut, and TouchIn
reminds me I was thinking interruptible time.sleep would be nice, though it's doable with a loop
it is not set in stone that we have to keep the current alarm API style. We do redo the API's on major versions if we think they could need revisions
any possibility of attaching a payload as well? Identify specifics of the event without additional polling (which key, which pin, etc...)
@tulip sleet your point of having enough space on board to fit apis could help in deciding what to go for here
Scott has talked about async versions of I2C transactions, etc. I can't remember the overall details at the moment
on even the smallest boards we could use some simple interrupt scheme, for stuff like button pushes to handle animation changes
the SAMD21 was really a stop-gap choice; its small RAM and flash are very constraining, and in the long run its feature set may need to be frozen. We keep finding space, but we are going to run out eventually
I wish it were easier to customize the builds, a web interface that you ticked which modules you wanted to include/exclude and then push go, would be pretty awesome
I wonder for some of the current cases presented in the issue, is a new API that can do a quick callback worthwhile?
Like I define onIntCallback and pass that function and a pin to callbackio or some new API. Then that function can do the simple items like stop a servo when my distance interrupt triggered, do a quick measurement, set a flag, etc.
I thought of this... a web interface to build custom circuitpython... similar to what nodemcu has... https://nodemcu-build.com/
yeah
if interrupt callbacks are done in a "soft" way (not during the actual ISR), that is fine. Some people have said callbacks are too hard to understand; I am not sure about that, but it needs to be taught to people. I don't think we need a separate module, it could be added to alarm, etc.
I would love callbacks
The reason I thought of more a hard call during the ISR is for things that may have to happen "fast" to say avoid the case of the long running animation needing to finish before the interrupt is handled.
But for sure has the downside that a novice could lock things up doing something long
for things that need short latency, we p[rovide them in C. We feel there's too much variability in Python timing to do what MicroPython provides in a way that doesn't require a lot of support to the beginner
Interruptible time.sleep (I called it park_for_interrupts) would be a nice addition as it enables higher level library abstractions.
But the right thing to do here Iโm pretty sure is the api that tells you how many times an interrupt has been triggered since the last time you asked about it.
Very easy to reason about in circuitpython and those 2 building blocks let people build whatever higher order things
I would welcome your thoughts added to https://github.com/adafruit/circuitpython/issues/4542
Oh wow yeah, pre-empting long running events is a good idea. So a limited, bounded feature would be useful (if quite advanced to use)
alarm did initially have wait_for_alarms which did neither a light or deep sleep. light_sleep_until_alarms() really subsumes it, because the semantics is the same as interruptible time.sleep(). In fact, time.sleep() does a light sleep if it can (WFI)
@tulip sleet what is the desired granularity of the alarm module ? can it be implemented for light sleep without having deep sleep implemented on a port, which is a much more complex thing ?
Like, hey this library blocks for a super long time sometimes and I gotta make it timeout
we see that in the networking code, so we have to pass in timeout values
In general thatโs the right way to timeout
alarm was done really quickly to get the MagTag off the ground. we originally thought we would use ESP32-S2 light sleep, but it turned out it shut down wifi and did other undesirable things. I would like to rethink the nomenclature
So this would be a kind of kludgy bolt on to make libraries without timeouts more usable... Hmm. Back to being unsure. Iโll read the issue now.
I am trying to focus the discussion of these things more than what happened in https://github.com/adafruit/circuitpython/issues/1380, which ended up being overlapping discussions of interrupts and event loops.
I'll add some thoughts to the issue later. I'm going to hard interrupt myself and go for a walk ๐
Oh yeah that issue got out of hand ๐
@low sentinel You're perfectly right the original concept of "interrupts as exceptions" was very unsafe. In a language in which we knew that some operation was safe, that kind of semantics is fine, but we don't have that language. At the same time the idea of forcing an early return seems to keep coming up, and it's addressed in an ad hoc way with timeouts and state checking. Maybe there's no avoiding that without knowing if a piece of code is purely functional or not. Maybe you can do all this in Haskell ๐
The C has no idea what python is doing. Itโs kind of like interrupting a different thread in Java. The interrupted thread has no idea it was interrupted until it reaches certain boundaries- like Thread.sleep
so the C just leaves a message under a rock for the Python
Making C able to set an interrupted state and then raise TimeoutException or something on the next sleep would be good imo
Yes basically. Would also need the means to clear it of course
so I think you're saying that the Python code can be littered with "interrupt me here" or "open a window for this exception to come through". Maybe overloading exceptions is still not a good idea for this, I'm not sure
it's not always sleep where we might want to allow it, but it often is
if an interrupt exception happened, then the called routine would catch it and clean up in the finally. If it didn't catch it, then maybe it should never be delivered. It's kind of like saying "this routine is willing to handle these interrupts, else discard them" ??
i'm not sure if that's a lot different than just checking a flag, though you're right, you still need an interruptible sleep
Proposal for having a web interface to build custom firmware where only the modules that are required for a specific project can be selected and if storage space is saved doing this it can be added to the CIRCUITPY drive.
Something like this: https://nodemcu-build.com/
Think Iโm saying something close to that if I understand it - but Iโm talking about 2 different things.
- general interrupts should be polled. A bonus sleep_until_any_interrupt() would be nice.
- very specific kinds of alerts that raise specific exceptions are worthwhile to consider - setting a timed_out bit in c via a timer that will then raise TimeoutException when the python does time.sleep is one place that makes sense to have an exception (on the line that calls time.sleep())
@misty garnet I just created an issue for this #4552.
awesome, thanks
CPython time.sleep() will exit early if a signal is caught after the signal handler is executed. It's very POSIX-y but we might look at how that's used. Not sure it's a great model.
ooh, not quite:
Changed in version 3.5: The function now sleeps at least secs even if the sleep is interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale).
This manifested as incorrect error messages from mpy-cross, like
$ mpy-cross doesnotexist.py
OSError: [Errno 2] cno such file/director
The remaining bits in b must be shifted to the correct position before entering the loop.
For most (all?) actual builds, compress_max_length_bits was 8 and the problem went unnoticed.
Yeah haha time.sleep should always sleep for however long you ask it to unless itโs raising an exception.
itโd be pretty hard to use in circuitpython if sleep was raising non-sleep-related button press exceptions all the time by default. A timeout (or just an interrupted sleep) is a reasonable thing for sleep() to raise. But a general โsomething happened somewhere on this boardโ exception will quickly make projects have to choose between interrupts and library support
thanks for joining in on this; i have to be afk for a while but this is the kind of discussion i am trying to generate by asking issue questions and presenting bad ideas ๐
Hello, I have a couple of questions.
Iโve got my first rotary encoder and trying rotaryio. It gives me this error that I donโt understand where it originates: "ValueError: pull masks conflict with direction masks". I could make the click button work though.
Iโm on M1 Big Sur, and wonder if adafruit_hid mouse and gamepad are supported (at least I tested the former on Win and Mac, and it works on Windows). If not, how likely will they be supported in the future?
Forgot to mention the first question is when I initiate the encoder like this: enc = rotaryio.IncrementalEncoder(board.GP14,board.GP15)
@opaque panther you can get more help in #help-with-circuitpython channel... this channel is primarily used for circuitpython development work. ๐
Thanks! And sorry
@opaque panther seems like a bug. if you use github please file an issue
@dhalbert, @hierophect I understand. I think reset_cpu() can be replaced with something like soft reboot.
Then, I wonder again there would be little difference between deep sleep and light sleep. Original deep sleep causes hard-reset and implies re-initialization of USB, however, in the new design, both of deep sleep and light sleep do soft waiting (idle loop) and soft reboot. Is that OK ?
Just coming in from a really nice discussion on discord about interrupts with a proposal.
Having alarm api return the number of times an alarm got triggered should solve most interrupt use cases.
The api can look like:
pin_alarm = alarm.pin.PinAlarm()
alarm.count_on_alarm(pin_alarm)
triggered_counter = pin_alarm.count
This might render countio obsolete.
The api can look like:
pin_alarm = alarm.pin.PinAlarm()
alarm.count_on_alarm(pin_alarm)
triggered_counter = pin_alarm.count
This might render countio obsolete.
I just re-tested on High Sierra 10.13.6 and Big Sur 11.2.2. In neither case did the mouse work in the stock build
Tested on Catalina and Big Sur with a QT PY M0, with a code that jiggles the mouse for a sec on boot.
The mouse works in Circuitpython 6.2.0-beta2, but not any subsequent version available on S3. Intermediaries are missing due to cleanup, so maybe I'm gonna try to learn to use git bisect. Or lookup when tinyUSB was updated ?
The mouse works in Circuitpython 6.2.0-beta2, but not any subsequent version available on S3. Intermediaries are missing due to cleanup, so maybe I'm gonna try to learn to use
git bisect. Or lookup when tinyUSB was updated ?
This was not what I expected when testing this; I thought it was only dependent on the HID descriptors, so I did not bother to test earlier verions. If you want to learn to bisect, go ahead, but I can track this down too.
The descriptors differ. I'll work on this.
@ktritz this would be way better handled by countio thru direct connection to GPIO... no interpreted application will be good enough to read a hall effect sensor, over i2c, for motor positioning. i wouldn't even build a motor-control-over-i2c in C :/
Firmware
Adafruit CircuitPython 6.2.0-rc.0-60-g27d883286-dirty on 2021-04-04; Adafruit Feather RP2040 with rp2040
Code
Run the following code:
import board, array, rp2pio
rp2pio.StateMachine(
array.array('H', (0,)),
160_000,
first_in_pin=board.NEOPIXEL,
in_pin_count=2,
pull_in_pin_up=0b11,
).deinit()
then exit the REPL
Behavior
After exiting the REPL, the neopixel flash...
User "Tosche" reported on Discord that their chosen pins for IncrementalEncoder didn't work, but it should have worked:
import microcontroller
import rotaryio
enc = rotaryio.IncrementalEncoder(board.GP14,board.GP15)
StateMachine.c's internal routine mask_and_rotate may be dealing incorrectly with NULL pins & zero bit_counts. However, while trying to diagnose this I ran into #4555 and don't have a fix I'm confident of. Here's what I tried:
static uint32_t mask_...
running Adafruit CircuitPython 6.2.0-rc.0-60-g27d883286-dirty on 2021-04-04; Adafruit Feather RP2040 with rp2040
At the repl, run
import rotaryio
import microcontroller.pin as p
r = rotaryio.IncrementalEncoder(p.GPIO1, p.GPIO2)
r.deinit()
At the last line, the board will freeze.
TFW you sit down to solve a simple bug, but discover 3 more ๐ญ
Fixes #4479.
The HID devices were reordered after 6.2.0-beta.2 or so, and ended up being alphabetical. This put MOUSE last, which MacOS did not like. Reordering to KEYBOARD MOUSE ... GAMEPAD ... fixed the problem.
silly macos ๐
i am guessing a bit about gamepad before mouse, it could be something worse, but it makes sense. In any case, moving it up works
@onyx hinge I think maybe we will have an rc.1
unless we just fix these and call it final
do you think the rotaryio-related bugs should be fixed in 6.2.0?
Fixing the mouse problem would be very good. I'm not sure what else is that important.
I am still getting an email every time somebody does something or other with their fork, due to being mentioned in a commit:
i am a bit baffled why github thinks I care
I'm looking at using an I2C pwm breakout to drive the motor ESCs, and and I2C digital breakout to read the Hall sensor switches. Why? Because we need to MUX a lot of these, and I wanted to keep wire count down on the main MCU board, in addition to providing easier forward compatibility to changing the MCU (just have to worry about the I2C instead of matching all of the PWM/DIO pins). You are certainly right to be cautious that this has a lot of communications overhead, but I our time scales s...
same, just got one for that:
Even if a lot of I2C sensor have an interrupt to warn about available data, this is not exposed with the StemmaQT connector, so not maybe not a lot in use. Same for a reset pin some sensor have. So maybe that usecase is not very much CircuitPython.
do you have a guess what action a user is doing that causes this? it's in other people's forks; it's not even a PR
With game programming and Pico-8, this style is more the default way of writing code.
That (and "Scratch programming") was so disturbing to me when I was helping kids in "Coder Dojo" (that is an organisation that does teach programming to kids). I was trying to figure out how it works behind the scene... and for kids that did not seems to be an issue. ๐
I think that is fine. The whole light-sleep/deep-sleep terminology was based on using some terms from the ESP32-S2 IDF (SDK). And it turned out that we couldn't use their light sleep anyway because it shut down too many things. We haven't really found many chips where there is a meaningful light sleep that we cannot already implement by doing a WFI instruction, for instance. I would like to rethink this a bit and perhaps change the terminology incompatibly in 7.0.0, but we do not have to do t...
apparently they forked in November according to the activity page, but the repo page says it's up to date with adafruit, so I wonder if they pulled from adafruit/circuitpython and pushed to their fork's main and there's a bug that thinks the commit is new ?
I don't push to my main when I PR, and it's not the usual method for working on forks, so that would make it rare
i did a little googling and I don't see complaints about this, but I need to do more research. It does seem like something to ask about.
in the meantime, I will avoid @'ing people in commit messages ๐
EDIT: I asked about this in github community: https://github.community/t/i-am-getting-notifications-due-to-being-mentioned-in-a-commit/172531
Support swapped pins, Closes: #4422
Turn off interrupts with deinit(), Closes: #4557
Don't say we have an output pin, Closes: #4556
without glitching when there is a request or other long atomic operation.
Requests consist of (set_up, send, wait for a tremendous amount of cpu time, receive). If that waiting is undesirable, the right way to keep the application responsive is via an async/await request api. If you know how long you have until your next colon flash (and if you only have a blocking requests.get), you should just pass in that timeout value to the requests.get invocation right? This is one way that async/a...
@tulip sleet I started seeing those recently as well (githhub emails from forks) Seems new. Yesterday was the first I noticed it.
or it might be something unique to @onyx hinge -- mine was from his fork as well...
I got one 2 days ago and today, from the same january commit too
ah -- not his fork -- but from an old commit
I'm trying to get started with MQTT on a PyPortal. The tutorial at https://learn.adafruit.com/mqtt-in-circuitpython/circuitpython-wifi-usage talks about importing a "wifi" package I can't find in the circuitpython 6 libraries. If I do import adafruit_minimqtt.adafruit_minimqtt as MQTT it complains that ssl_context isn't set. A clue would be most welcome
closing cause these aren't complex devices, and its better to use a common analogin-using API than a special peripheral!
its better to use a common digitalio-using API than a special peripheral
Yes, the deep sleep call can raise an exception an alarm that can't be used for deep sleep
this is why I rarely use CP for a hobby project on weekends
Ya, I started getting these too
@obsidian dome that's the ESP32-S2 code
you want the airlift version
I looked in github settings and couldn't find one for notifications for mentions in commit messages ๐
@slender iron then when DO you get to use CP for hobby projects?
when I'm willing to ignore bugs
oh I should have tested that โฌ๏ธ (now I have, it works, thanks Dan)
Random cancellation of just one job appears to be a GitHub Actions issue, so merging anyway.
Last time I looked at MicroPython/CircuitPython, several years, go there was still the outstanding issue of memory fragmentation and its impact on the reliability of long running programs. So, is that still an issue with today's modern boards? If so are people just using them for 'fun' projects or are people using them for long running important tasks?
Neither MicroPython nor CircuitPython have a compacting garbage collector. Several years ago CircuitPython implemented "long-lived objects", in which objects that that were probably not going to be garbage (like the results of compiling) were allocated starting at one end of the heap, and regular heap allocation was done starting from the other end. This ameliorated some fragmentation issues.
We have gone to some effort in CircuitPython to provide native and library APIs that allow one to pass in a reusable buffer to write into, rather than always returning a fresh buffer that will be discarded.
As a practical matter, I have some CircuitPython devices that continue running for weeks without encountering a MemoryError; and careful use of try/except where the except clause restarts the board should allow automatic recovery if a MemoryError or other problem is encountered.
(having an automatic restart policy is something we've investigated but hasn't become ready to integrate -- something like https://github.com/adafruit/circuitpython/pull/3454)
Nit-pick for RP2040
new &= 0x3;
int x = new ^ self->last_state;
if (!(self->last_state ^ ~self->last_state))
self->last_state = ~self->last_state;
switch (self->last_state & 0x3) {
case 1:
self->quarter_count -= 1;
break;
case 2:
self->quarter_count += 1;
break;
}
self->last_state = new;
/*
0000 = 0 = 0 = 0 = 0
0001 = 1 = 1 = 1 = -1
0010 = 2 = 2 = 2 = +1
0011 = 3 = 3 = 3 = 0
0100 = 1 = -2 = 2 = +1
0101 = 0 = -1 = 3 = 0
0110 = 3 = -4 = 0 = 0
01...
Is it possible to play an animation on an oled display while the board is doing something else?
@tidal kiln if you get a chance I am interested in getting your thoughts on this new page in the custom font learn guide: https://learn.adafruit.com/custom-fonts-for-pyportal-circuitpython-display/bitmap_font-library?preview_token=yEMPDSSvsD405pEGgJnQpw I am unsure of the moderation process for new individual pages rather than entire guides. If this isn't missing anything that you had in mind I think it's good to go though.
@lone axle Typically you would send it to Anne, exactly the same way you send full guides to Anne. As she's out for a bit, you'll want to send it directly to Limor before making it live. If Carter wants to take a look first, that would also be excellent. But Anne>Limor>live is the standard process. (Since you can't put a page "into moderation", you simply send Anne, or for now, Limor, the link.)
Thank you
@daveythacher can you please provide more context? I don't follow what you are saying. If you're suggesting a change that is unrelated to the specific issues this PR is intended to address, consider filing your own PR or issue.
Many thanks to Tannewt for help getting CircuitPython building. (I had a python module that was not updated.) I'm using the Seeeduino Wio Terminal, and because of the need for high speed i/o, having access to inline assembly is crucial. All I needed to do was include CIRCUITPY_ENABLE_MPY_NATIVE = 1
in /ports/atmel-samd/board/seeedui...terminal/mpconfigboard.mk and it worked. This is circuitpython 6.2.0-rc.0-15-.... Stock, it uses 458,468 bytes in flash (41,244 free); with viper/etc enabled, it uses 478,892 (20,820 free). Is there a reason why this option can't be enabled by default for the Wio Terminal? It costs 20K bytes, but otherwise would go unnoticed by folks who don't need it, and for folks who do need it, it's just there--no need to set up a build environment and go through all that. And then there's the broader question of enabling it for a wider variety of devices. Right now I think it is only enabled for about 4 boards.
@spring jolt my feeling is that 20k is a lot for a feature few people will use
ESP-01 header renamed to AUX, and expanded to 12 pins from 8
pins. Pins 1-8 still accommodate the ESP-01, with expansion to full
SERCOM 4-pad support to allow for SPI and I2C on that expansion port
with additional GPIO control.
Update pins.c with additional signals provided AUX_1-8, along with
UART, SPI, I2C name usage as aliases to appropriate AUX_1-8
signals. Additionally, add several alternate names specific to several
expansion modules - the ESP-01, and the ATW-01 using the WINC_...
This will be more involved than you realize.
This is kind of crazy to me. I have play around with some crazy ideas involving using MPUs as MCUs, Linux, Python, etc. I know there are a few ways to make something like this work, but to be honest I am not seeing it here. Usually something like productivity, cost, etc. helps you net ahead of what you give up.
Please elaborate. How would it "not work"? How would it be "more involved"?
@lone axle what kattni said, in terms of the mod process. for the guide itslef, my 2cents: not sure the ascii art example is needed? or maybe move to a separate "examples" page? so the main page can focus on just what's needed to load and use a font file. can also mention the load_glyph, etc. there.
fwiw, I have devices (mostly Feather M4) that have run continuously since I last updated their software, roughly half a year. they are running large programs (wifi+displayio+sensors, etc), near the available memory limit
@daveythacher There is an implementation in the nrf port that is reminiscent of what you posted above:
https://github.com/adafruit/circuitpython/blob/a1562430f62e04ed6aa08ac7851f2eed0aea0fa2/ports/nrf/common-hal/rotaryio/IncrementalEncoder.c#L37-L66
Thank you I was kind of unsure about the ASCII art one as well. That script is currently the main "simpletest" one in the bitmap_font repository. I think it might be worth changing it's name to something else and using the label example as the main simpletest since that is something more likely that folks will want to do with it I think.
I will add some info about the load_glypyhs usage as well, good idea. Thanks for taking a look
ah, yah, it is the simpletest....hmm. looks like it would work on a native CP board also? so it's not really just a "PC or Raspberry Pi" example?
oh..it uses args
Yep, I'm not sure about the sys.path stuff on CircuitPython as well. If that stuff does work. It could be refactored to have hardcoded variables instead of arguments. and then it may work
if all that were replaced with a hardwired font file name, i think it would then work?
I will give it a try later tonight. If it does work out I'll PR to change the example over so it can work on microcontrollers as well.
ok. and use one of the fonts that's in the examples/fonts folder.
Yep. Do you think I should go ahead and rename it to something like ascii_example and use the label one as the "main" simpletest? or just leave them as-is once this script is fixed up to run on the devices?
that one looks like it relies on having a native display:
https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font/blob/master/examples/bitmap_font_label_simpletest.py
i think having the simpletest just use print is a good idea
sort of an odd library to come up with a simpletest for
since it's not really something you'd use standalone
Is this board still in development and got a rev? I'm surprised because it had a lot of downloads recently.
Why do we need to save this? I was thinking we'd just need to support both ordering but not change how position changes.
One, question. Thanks for the fixes!
Hello,
this issue can be closed. As mentioned in the previous post, I managed to
get the things working but only as fixed and compiled code.
--
Best regards,
Dusan
On Wed, Mar 31, 2021 at 5:20 PM Dan Halbert @.***>
wrote:
@Embedinno https://github.com/Embedinno How are you doing on this?
Would you like to leave this issue open?โ
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/adafruit/circuitpyt...
We updated ulab and it moves most items around, e.g., ulab.linspace becomes ulab.numpy.linspace. Update the guide, but only when 7.0 is out or is at least very imminent.
May I be added to CircuitPythonistas I'll be joining the weekly today
Wait, this is not a non working day in the USA?
Ok, I'll be lurking... my notes are in a poor state. I have not done much, and not documented much from what I did... or it is not CP minded.
This should be the last update requiring PCB updates and pin shuffling to accommodate changes (famous last words), so I think it is at the point where it should be stabilized. Updates were based on early customer feedback and also some future modules we want to add taking advantage of the AUX port. It is at the point now where it does everything we want and satisfies all customer feedback. Photo on the web site is a bit dated - hopefully will be getting that updated RSN. Layout is virtually i...
๐คทโโ๏ธ I don't have kids (so I don't see school schedules) and i'm not religious so I tend to loose track of many of these holidays. But if the stock markets are open. It is not a US Federal holiday. States have their own holiday calendars which may or may not affect some businesses.
Added you to CircuitPythonista's. Happy to see you joining the meeting!
I don't know why this Monday is OFF for me, and Thursday and Friday were also OFF (that seems even less usual in my country, so it might be something special from the place I work). And Kids will start two weeks of vacations, but they had an additional 1 week without schooling before for Corona reason. I am just happy to still know this is a Monday... Also Friday it was 23 ยฐC and today we have little snow, so near 0 ยฐC.
I like the term "blursday" as in I have no idea what day it is, they're all blurring together.
<@&356864093652516868> We're finishing up our internal meeting and will join you for the Discord meeting soon! Please add your notes to the notes doc now if you haven't already: https://docs.google.com/document/d/1sRuIt_eSshrvOPdPVI2f9sZlvCzpVltRkLHKIa3MCHY/edit?usp=sharing
@onyx hinge I'm "lurking" today -- nothing to report.
it was part of the original request, as I understood it. Otherwise, the user could just reverse the pins themselves in the constructor.
April 5th
Text only for me
TinyLetter
The Gameduino code for CircuitPython is released. The Dazzler is available for four (yes four!) different microcontrollers - Arduino, Teensy, Rpi Pico and Feather.
CubeOrb
@daveythacher There is an implementation in the nrf port that is reminiscent of what you posted above:
https://github.com/adafruit/circuitpython/blob/a1562430f62e04ed6aa08ac7851f2eed0aea0fa2/ports/nrf/common-hal/rotaryio/IncrementalEncoder.c#L37-L66
My post before had a slight error, so I deleted it. I think I figured out a fix for it. However I did not repost since it was not directly referenced in the pull request.
Basically it attempted to use XOR and jump tables to remove look ...
welcome!
macOS issues - they're not always strictly macOS issues
Is there a StarTrek UI template for CP? Can I wish one into existence? ๐
๐ ๐
I'm sorry, the replicators are offline. You'll have to make it yourself! ๐
Wish hard enough and somebody might do it. Wouldn't be that much of a stretch considering how many folx have made something that could be templated. ๐
Using microcontroller.reset() or exit_and_deep_sleep() intermittently triggers a "Crash into the HardFault_Handler" and reload into safe mode on the MagTag using CircuitPython 6.1.0.
I encountered this issue while making a simplified derivative of the MagTag cat fed clock project, in which I used exit_and_deep_sleep() to sleep the MagTag in-between minute refreshes. With exit_and_deep_sleep(), the MagTag would hard crash after a...
That explains why 'Tea. Earl Gray. Hot.' didn't work.... ๐ต
Could you do morse code with lights? I have worked on that
Random number seeds?
@slender iron That animation idea is very cool !
Using the MCU's ID as a base seed or value could help make it reproducible
or MAC/HW ID
Here is a link to tips on resolving โMemory allocation failedโ error message, particularly when dealing with graphics, fonts and text. Your suggestions and additions are welcome:
https://github.com/kmatch98/CircuitPython_memory_saving/
I read it this morning.. excellent work! very well done
yup, I think for advertising this would be good
This could be a Learn Guide
No experience with creating a learn guide, but let me know if itโs something I can help with.
I see I'm doing this differently.
Should links in the notes be "raw" links or is OK to use the formatted google doc links?
@gilded cradle Let me know if I can help in the Blinka library, just point me in the right direction.
Go ahead and read mine, seems my mic is messed up
@still zephyr most of the issues are here: https://github.com/adafruit/Adafruit_Blinka/issues
I will take a look this week. Thanks
Thank you
If this is something you're interested in doing, I can look into whether we're spinning new folx up right now. (Anne usually handled that, so we might have that on hold.) Basically, you'd be added as a contributor to the Learn system, and you'd need to learn how to use the system. It's not difficult, but it is its own thing, so it takes a little getting used to.
Let me know if you have any other questions
(joined in case people want to talk interrupts in the weeds; I do not have content and am lurking otherwise)
Will do for sure ๐
I really think we would all benefit from that being a Learn guide though.
Iโm glad to do it, Iโm sure yโall will help guide me through the process of learning the process and tools.
Excellent. I'll look into it. Thanks!
Is the expectation the position will always be a difference to their counter? Is there a need to make direction reversible on the fly? Is there a need to see a roll over point internally? Is there a need to add scaling for revolutions? Can someone implement a new class based on this?
I know jepler's solution had better performance than the solution I was recommending. However there could be different use cases, which I had not considered before. I guess my question is what is the expectati...
fwiw I'm willing to help folks get up to speed on the learn system. I'm definitely not up to the mastery level of Anne, but feel like I have the fundamentals down enough to help others.
Cheers. I'll keep that in mind.
Not trying too sound too ridiculous/smart-alec-y, would a learn guide on using the learn guide be of value?
There is one internally ๐
There are a few with great info in them.
But it still helps to have assistance.
I would like to use circup on my Raspberry Pi Zero for CP library that I need there... is that possible?
I'm not sure if circup would work or not. If not though, I think you could use pip to install the library.
Yeah, I know I need to use pip... it is just that it is "different".
Can we get the "example" and "simpletest" with a circup command? Because this is what I will go for just after downloading the library.
What about build in library? How does circup know if it is frozen or not?
I have some notes on CP LIbraries and relation to Pip
https://gist.github.com/askpatrickw/e69eacd2c60c8e27f255d976ab5e8820
Here it is, just in case it works or is useful. Below is truth table which shows how it is supposed to work through the different steps. This is probably no better than the nrf solution. Assembly wise they are probably close. The look up table is little easier to understand, and maybe the compiler could figure this out. However this and the nrf avoid the table in ROM/RAM.
new &= 0x3;
int x = new ^ self->last_state;
switch (self->last_state) {
case 1:
case 2:
x = ~x;
break...
I have to drop off for a work meeting. Thank you everyone. @thorny jay I see your question and I'll circle back later to chat if someone else doesn't discuss it with you and sort it out.
@mental nexus Approved! I will be helping get you spun up, along with one of our Learn folks. I'll DM you to get some contact info.
Gotta run to another meeting. Will catch the video later on. Thanks all, have a good day!
For me interrupt could just be a "checkbox issue" when someone compare MP and CP. So maybe you just want interrupt for that reason. And avoid someone to switching to MP if he does not have to: https://www.recantha.co.uk/blog/?page_id=20924
And we need to reach that 2500(?) guides!
@thorny jay chasing "checkbox issue"s can waste a ton of time
it's ok if people switch
Thanks all!
Thanks.
when we invent a new feature that can substitute for raw interrupt handlers, we can use the word "interrupt" in the doc so a search will show it up
Thanks
Have a safe and wonderful week everyone!
Thanks everyone ๐
@idle wharf Literal links are better, markdown links description are best. What we do after the meeting is copy the notes document as text into github. So your link "Circup #96" for instance is no longer a link after this process..
I'd rather not add switching counting direction because you can do it outside of this class. My understanding what just that the pin order could be swapped.
Please try 6.2.0-rc.0 (or 6.2.0 if it's released.) We've updated a lot of stuff since then.
May be I missed a bit but why is i2c working fine on #micropython whereas it complains about some pull-up resistor on #circuitpython on #RP2040 ? does anyone have a clue about it?
@lone axle @mental nexus for the new libraries related to displayio, is the name Adafruit_CircuitPython_DisplayIO_XXX, ok, for example for the equalizer would be Adafruit_CircuitPython_DisplayIO_Equalizer. Let me know. thanks
replied
That was fast!
Here is the notes document for Mondayโs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youโll be attending the meeting - itโs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weโll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1N52qeTToB6s5QCgMq1IjLdMgkWoKfJZV_BiDkTCKQvg/edit?usp=sharing
Google Docs
CircuitPython Weekly for April 12, 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to participate, ...
The simpler one saves ~150 more bytes per translation.
I do think we want to use the prefix Adafruit_CircuitPython_DisplayIO_[something] I would lean toward making one library that can hold several of the widgets (assuming they all have the same basic API like ours do from extending our super classes) So I would go Adafruit_CircuitPython_DisplayIO_Widget and then include the equalizer widget and others within that.
If I understood correctly that is how Scott mentioned doing it. Though I did miss part of the conversation so I could have misinterpreted.
Not sure, if we put all the widgets together, we would have the same problem, he commented in all the PRs to make a separate library for each one
So that was my assumption, but not sure now, @slender iron , guidance?
@lone axle Either way, do you want me to work in the cookiecutter to make either Widgets or the other ones?
my suggestion was for one repo per widget
though I think it'd be fine to have variants of one widget in one repo
Good, thanks for the clarification.
Yep, if you've got some time this week you could work on running cookie cutter to create the new repo. We can make new ones for each of the existing Widgets. One thing to think about is where will we put the super classes Control and Widget lots of our other widgets extend those in order to make a similar API across the board.
We could leave it in DisplayIO_Layout but then all of the widget repos would have a requirement to have that library as well.
Gotcha
I don't think we want to have copies of that in every individual library though, some centralized place is best so that changes to those super classes can be made in one spot.
Interesting, question....
What if we left widget in and control in Layout?
I will work on the new libraries this week ๐
Sounds good. Thank you. I do think leaving it there for now is probably best.
Thanks foamyguy
@tulip sleet So highlight the current release of CircuitPython, and we'll highlight final release next week? (Basically checking whether you're doing a final release in the next 6 hours.)
i may release; just have to ask limor one q
Ok I'll hold up then.
ok, I do plan to release
Right on.
@tulip sleet How long will that take? I'll want to link to something. (Not trying to rush you, simply want to know a timeline so I have an expectation to set.)
on the phone, it'll be a few hours. I'd just link to circuitpython.org. I can get you a blog link later
Ok no worries. Thanks.
Regarding Rev - this is actually rev 010 (10) - silkscreened on the board, but not differentiated otherwise. We will continue to support customers that have earlier Revs with a custom build or replace their boards for them so they don't have to worry about it.
Please don't maintain a custom build because it'll fall behind. Instead, create a second board def for this rev and the newer versions.
[adafruit/circuitpython] New tag created: 6\.2\.0
I am not sure what channel I should put this in, but I have an extra ticket (no cost) to the Open Hardware Summit on Friday. Please DM if you are interested and I can update the ticket information.
What happens when your button exception gets rised again inside your exception-handling code? Or is this a one-shot thing?
I think the confusion here is that there are two different deep sleeps. One is "pretending" to deep sleep in order to iterate on deep sleep code when connected over USB. The other is real deep sleep when not connected to USB where everything does actually shutdown. These two modes look the same from the Python code but internally pretend deep sleep looks a lot like light sleep. So, I think deep sleep and light sleep are different and appropriate. Light sleep is pretty similar to `time.sleep...
Automated website update for release 6.2.0 by Blinka.
I'm ok with this but would ask that it not label the builds with the CircuitPython name. Creating essentially infinite combinations will be a huge support burden. (We have trouble with folks mixing different CP versions already.)
I think the micro:bit v2 is a prime candidate for BLE peripheral only CircuitPython. I wonder if we could squeeze into a v1 as well. The 16k RAM is definitely the toughest part.
@slender iron Keyboard nerd question: is macropad one word or two? Google isn't helping.
Text editor doesn't like it as one word. Google has both equally available for purchase and so on.
As a non native english speaker I would say macro pad.
Thanks!
I'll go with that.
looking at the weekly stats, I felt that maths were wrong in: 8 PR merged and 9 authors, but I assume it's 9 authors of new PRs, not the authors of the merged PRs
I think we modified it to include all contributors to a PR, so if someone committed something to an existing PR, it would have two authors. I believe.
@jaunty juniper Adabot. Somewhere in here - https://github.com/adafruit/adabot/tree/master/adabot - is the code that does it. I believe it's in here: https://github.com/adafruit/adabot/blob/master/adabot/circuitpython_libraries.py I always have to dig though, I never remember which does what.
Adabot queries things and generates the report. I don't recall of the top of my head exactly how the queries work though. You might be able to make sense of the code.
that's a big plate of spaghetti !
Very much so ๐
Thank you for the reply, and good news so far: microcontroller.reset() no longer triggers a crash with 6.2.0-rc.0. I will have to let the device run for quite a bit in order to test if exit_and_deep_sleep() still malfunctions, but things are looking good so far.
Tested on Meowbit and Feather, looks good to me!
@mental nexus Just to make sure, about those memory-saving thing, I not an expert at all. ๐ I am actually counting on you to learn stuff. And I guess the real expert will cross check and tell us what is right/wrong, relevant or not. I know my share of stack vs heap stuff from long ago, but Python, MicroPython, bytecode and VM, C stack vs Python Stack, heap usage, garbage collector and optimised way to store certain type as Damien did in MicroPython... I may have read/watch about it, but I don't have all the piece of the puzzle to but super reliable. I can only repeat what I was told and what I have infered from those information.
sorry, I was out on a walk and have no idea. ๐
[adafruit/circuitpython] New branch created: tannewt\-patch\-1
We've got the bulk of boards added. Closing this.
Advanced use of PIO may require state machine coordination. To do that we'll need away to allocate them to the same PIO. The constructor of a state machine could have a colocate kwarg that is another state machine or a count of other state machines that will need to allocate alongside it. Interrupt numbers may also need to be allocated in a similar way.
No worries. I am learning this stuff too so sometimes I just try and put something down and rely on the folks that know deeper to help correct things. I want to let you know I appreciate your ideas and questions because it makes me explore further and try to understand this better. And if we hold back questions they will certainly never get answered. Thanks for being open and raising possibilities, who knows where these ideas will lead us!
that it not label the builds with the CircuitPython name
How about "CustomPython"? Or "MyPython"?
ok so the github API to get issues (PRs are issues in the API) has a "per_page" parameter, which seems to default to 30 when not given, so the adabot stats actually only look at the last 30 issues per repository, and counts those that are merged PRs
changing to a loop that gets all the pages, 100 at a time, according to the API there's 150 issues updated in the last week (35 merged Pull Requests) so we are missing a lot ๐
whoa!
Core
- 35 pull requests merged
- 18 authors - Neradoc, wtuemura, lesamouraipourpre, hathach, sabas1080, tyomitch, ZodiusInfuser, m-byte, dhalbert, weblate, jposada202020, bergdahl, tannewt, hugodahl, microDev1, t-ikegami, jepler, UnexpectedMaker
- 7 reviewers - gamblor21, dhalbert, jepler, tannewt, microDev1, hierophect, ladyada
like, half of those were merged last week, and that's the second page
https://github.com/adafruit/circuitpython/pulls?page=2&q=is%3Apr+is%3Amerged+sort%3Aupdated-desc
so 8 seemed really low to me (also I didn't see my name in the list but shhhh that's not my primary motivation ๐ )
As long as we're code-golfing, here's what I came up with:
#define quadrature_const (0x3443c11cu)
int8_t quadrature_fast(uint8_t a, uint8_t b) {
int idx = (a << 3) | (b << 1);
return (int)(quadrature_const3 << idx) >> 30;
}
This compiles to 6 thumb instructions and 1 out-of-line constant, for a total of 16 bytes. It works by extracting 2 consecutive bits from the constant, then sign-extending to give -1, +1, or 0. However, it mak...
I have the evk and attached a BNO055 sensor to it, wondering whether bitbangio was a workaround for #3763 (it's not)
Devices should be [26,40] but software bitbangio says ...
>>> i2c = bitbangio.I2C(sda=board.SDA, scl=board.SCL)
>>> i2c.try_lock()
True
>>> i2c.scan()
[26, 40, 41, 42, 43, 44, 45]
>>> i2c.scan()
[26, 40, 41]
>>> i2c.scan()
[26, 40, 41]
>>> i2c.scan()
[26, 40, 41]
Underlying cause could be similar to #3845 but not sure yet.
@daveythacher If you're interested in working on this, maybe addressing it in a fresh PR intended to unify encoder handling and close #3875 would be the way to go.
Please also see https://github.com/adafruit/circuitpython/issues/3875#issuecomment-812675213, where I mention another very simple algorithm I found that only uses one interrupt. It misses a count when reversing, which was the original motivation for #3875 and its corresponding PR.
I'm not sure which board or translation you verified, but on trinket_m0 with de_DE this saved more like 28 bytes. However, anything is welcome.
when I pull the tip of main and build, it shows as 6.2.0-rc.0 -- should it now be 6.2.0 or 7.0.0-alpha? -- and how do I get it to update?
it should build as 7.0.0-alpha.0; I pushed a tag to main. do a git log and see if you see that tag.
I do not
I see the tag if I list the tags git tag
i might have tagged the wrong commit. I'll take a look.
I did git fetch --tags now tried git pull --tags it says it is up to date -- rebuilding to see if it changes. -- same 6.2.0-rc.0
[adafruit/circuitpython] New tag created: 7\.0\.0\-alpha\.0
[adafruit/circuitpython] New tag created: 7\.0\.0\-alpha\.1
@solar whale ok, do it again; I have deleted the 7.0.0-alpha.0 tag, because it was at the branch point or was on the 6.2.x branch. We will just discard that. pull or fetch again, and you should see 7.0.0-alpha.1 on the most recent commit (for consistency)
building now... I see the new tag
All better! 7.0.0-alpha.1 --- Thanks!
I get confused easily...
you found a tagging bug, no problem!
@tulip sleet are there any differences now in a 7.0.0-alpha.1 build and a 6.2.0 build? I have run into an issue under 7.0.0 that works under 6.2.0 -- ah -- I see a few commits, but none seem relevant
Sorry to get this message in the middle of your conversation, have any deal with this kind of error when building the docs TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases. If you happend to know the answer please ping me. ๐ Thanks
there have been a number of PR's since 6.2.0 on main, so that's perfectly possible. the alpha.1 label is at the tip right now
OK -- it pertains to a funky issue on the stmpe610 -- just got funkier....
you might try to make sure all the pip3 installed stuff is up to date; this is slightly painful to do easily
maybe try pip3 install --upgrade -r requirements-dev.txt
I've done enough damage for tonight -- Good night all!
7 instructions & no constant (so 2 bytes smaller & no worry about undefined behavior under C)
int8_t quadrature_fast3(uint8_t a, uint8_t b) {
int x = (1 + ((a ^ (a >> 1)) - (b ^ (b >> 1)))) & 3;
return x - 1;
}
x ^ (x>>1) converts a 2-bit gray-coded number to binary. The arithmetic (1+p-q) & 3 gives +1, 0, -1 as +2, +1, 0; then subtracting 1 in signed fashion gives the correct answer. Again, exhaustive verification is feasible.
HOWEVER the caveat with this ve...
No, actually testing this in the board works, it just the CI, that gave me this error. https://github.com/jposada202020/Adafruit_CircuitPython_DisplayIO_Color_Picker/runs/2274359264
ah,ok, this is just a python issue on the new code; are Widget and Control unrelated classes?
they are related, but methods are different
I
from adafruit_displayio_layout.widgets.widget import Widget
from adafruit_displayio_layout.widgets.control import Control
class ColorPicker(Widget, Control):
When the the module color_picker.ColorPicker was in the same module, DisplayIO_layout.widgets, the CI did not complain, as it was in the same repo, now we are trying to get out the widget, in this case ColorPicker out of the displayio_layout to use it as an individual library
Yikes. That's a lot of words. I hardly understand them separately, much less all added together in one sentence!
๐
i googled it, and there are some things to look for, but I am somewhat mystified. For Python 3.7 or before, it says this can happen if you do class C(ThisIsNotAClass)
you are not using metaclasses explicitly, is that right?
No I am not
But in the stackoverflow answer they said that that workaround is for python 2.7
Cool I am trying now the last answer and then I will try that one
The CI uses Python 3.6, so that's why I'm thinking somehow it thinks something is a plain module instead of a class.
mmm I see your point
in other words I think this is some kind importing or definition error; I think the error is misleading
I think the error is actually different, maybe it can't find an import?
Warning, treated as error:
19
autodoc: failed to import module 'color_picker' from module 'adafruit_displayio_color_picker'; the following exception was raised:
20
Traceback (most recent call last):
21
File "/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/site-packages/sphinx/ext/autodoc/importer.py", line 71, in import_module
22
return importlib.import_module(modname)
23
File "/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/importlib/__init__.py", line 126, in import_module
24
return _bootstrap._gcd_import(name[level:], package, level)
25
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
26
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
27
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
28
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
29
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
30
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
31
File "/home/runner/work/Adafruit_CircuitPython_DisplayIO_Color_Picker/Adafruit_CircuitPython_DisplayIO_Color_Picker/adafruit_displayio_color_picker/color_picker.py", line 49, in <module>
32
class ColorPicker(Widget, Control):
33
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
It builds fine on my local machine.
Ohhhhh๐ณ
is it referencing something that is not yet pushed to pypi?
i think you figured out something ๐
autodoc is mocking some class, leading to this problem, right?
yes
so all you need to do is .. rubs crystal ball implement Adafruit_Blinka_Vectorio
can you install blinka displayio and mock vectorio?
goodnight, don't stay up too late
Thanks jeff
No pinging anyone, and not too late solution was removing the documentation, so something is not right see here https://github.com/jposada202020/Adafruit_CircuitPython_DisplayIO_Color_Picker/commit/5af4d088dbc2528de1404095e30ae10c9b9ad6f1 Good Night
There is no circup command to install an example to a device. @gilded cradle has been working on a web based download for projects or learn guides (which is why the json was created) . https://github.com/adafruit/circuitpython-org/issues/491
It don't see why it couldn't be added though. The examples are in the bundle.
Thanks.
The idea is that currently, when you go for the bundle, you can take one of the 3 versions:
- Bundle Version 6.x
- Bundle Version py
- Bundle Examples
So it would make sense to have the same three options when downloading a library individually with circup or any other tool.
Hmm, indeed, parsing the CI logs shows that the effect varies a lot across boards and translations:

Average savings per language:

Circup downloads two bundles one py, one mpy (currently only v. 6) and within each it has a /lib, /examples and /requirements.
Hmm... @gilded cradle I don't see the JSON file in the bundle downloaded by circup.
@idle wharf it looks like the json file is alongside the bundle? take a look at the release assets https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/tag/20210406 and/or the listing of files in s3 https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bundles/adafruit/
@still zephyr your (?) commits come through as "Author: Adafruit Adabot jq....20@gmail.com" when I look at the commits locally. Maybe your git is misconfigured? Or the commits are happening in some other unusual way.
is there a preferred way for a master MCU to communicate with worker MCUs in CP? Like an M4 handing out jobs and reading data from a bunch of little M0 worker bees?
maybe a different answer based on proximity, but let's assume close by for now
hmmm SPI is used with the ESP32 airlift things, I2C is used with seesaw, both using custom firmwares on the peripheral side, not Circuitpython
UART has been used a lot. You could use I2CPeripheral on the worker-bee side, but it is not enabled by default in small builds.
UART is probably the most straightforward
Not really sure, how to configure that
@onyx hinge Thanks for the PR, we have two solutions instead of just one ๐
what does git config user.name say ?
ah that is right, I changed that when was working in ADABOT. Thanks @jaunty juniper
Solved thanks @jaunty juniper ๐
@still zephyr I missed there being a first solution
you can just close mine up if it's fixed already
@onyx hinge I include the following line in conf.py
suppress_warnings = ["autodoc.import_object"]
No I already merged you solution Thnkas for that ๐
does it affect the documentation quality?
Yes, probably, not sure, I will only your solution
The strange thing, is I build the docs locally and it works it was just in the CI failing,
yes I saw that as well (system python is python3.7)
Ok, thanks for confirming, assure me that I was not making a rookie mistake
It's a minor tragedy of github actions that it is next to impossible to recreate its conditions on your own computer
but instead have to run it on their computer time after time
Thanks for all the help
Of course you are welcome ๐
@slender iron @onyx hinge I submitted a GitHub ticket about the spurious notifications, with email examples.
@tannewt I removed support for reversing the encoder when swapping the pins. Please review again.
@tulip sleet oh the encoder counting bug is only on nrf, which doesn't use the table method, but does something else. (just about any method that doesn't look at EVERY edge (A and B, rising and falling) and have an internal state transition will be wrong under some sequence of inputs.)
@jaunty juniper Please file an issue on the Adabot repo with your findings.
If you have not already.
@idle wharf It's not inside the bundle. You can find it in the release assets (https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases) or on the S3 pages(https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bundles/)
My impression was that the "reverse missing" bug was present on both atmel and nrf implementations. I thought they were functionally identical. I cannot remember now exactly what I tried.
I'll file a Pull Request in a few minutes
I think maybe the interrupt routines are missing a few transitions, and they could be smarter about noticing that one is in detent position, and change the count only in that position.
Ah even better. I'll want it tested, and there are a couple of folks who are best for that, so I'll request their reviews and we'll have to wait until they can get to it.
If you want to stop working on this, that's fine. We can just merge your current fix for now. It is as good as the current impl. If you find interesting, feel free to keep working on it, but getting the current PR in would be good.
yes, please test it well
Adabot can be finicky so I don't like merging until it's tested. ๐
I think it will also reduce the risk of hitting the public rate limit due to moving some calls from unauthenticated to authenticated (I had the issue while testing)
That is a big concern.
It borks the reports all over the place when it hits the limit.
Could be why we had it limited in the first place.
But we'll see.
Also I misread what you wrote. That's excellent if it reduces the risk.
currently it just adds one call because the last week issues take 2 pages, but retrieving all open issues (for stats per tag and all) was done in public for all pages after the first one (so if there are 500 issues, you hit the public rate 4 times)
now they will be authenticated too
Great
still hit the auth 5000/h limit during testing but that's what you get when you tweak debug prints while retrieving 300 repos every time !
That would do it ๐
Read ^^ as "chocolate doc" and now I want one.
Given the +/- spread, maybe delay merging this?
Could this be calculated per language both ways, and the best chosen? Or does it have to be uniform across languages? If this change makes a difference, maybe a different calculation would be even better for some languages.
It would be nice to figure out a "right" heuristic. I have some doodles but they've never become mergeable.
The general idea is:
- build an initial huffman table without dictionary entries
- now we can count the original # of bits of any word candidate
- and we can estimate the number of bits of the new dictionary symbol by finding where it would fall in the dictionary
- of course we know the number of uses of the word
The true bit cost is `(dictionary symbol overhead) + uses *...
ugh, why does imxrt place memory starting at address 0x0 !? A literal NULL pointer dereference DOES seem to cause a hardfault, but not *(int*)8
0x0000000000000000 0xc build-imxrt1010_evk/py/qstr.o
0x0000000000000000 qstr_hash
```in fact a function is literally at 0x0!
To clarify, my original motivation was, why use a sophisticated formula with log and a few magic constants, when a near-trivial estimate performs no worse?
@jepler's work, aiming at improving the compression by increasing its sophistication, is in a totally different direction.
You could change it
that's ITCM memory space
@tannewt , just to make sure I'm clear - you are asking to abandon (or modify) this pull request, then add a new board with a different name to differentiate it from earlier versions? Something like bdmicro_vina_d51_xxx where xxx is some designator indicating it is not binary/UF2 compatible with bdmicro_vina_d51?
If so, would it be ok instead to submit a PR that renames the current bdmicro_vina_d51 to something like _prelim, and then the current Rev remain attribute-less?
I ask because ...
@tulip sleet are we ready to start merging power stuff? If we get the API PR in I can start adding changes to the NRF port
Or would you like to wait? I can work on the RP2040 stuff in the meantime
Yes, it's all fine now. 6.2.0 is on its own branch. I need to review your PR's; I am just coming off 6.2.0 release stuff.
interestingly, but tangentially, the RNG peripheral appears to be undocumented, though the source code in the SDK's fsl_trng.c isn't obfuscated or anything. Maybe I'm just not looking in the right document, but it's the one that's otherwise full of register map descriptions
@tulip sleet Yup pretty much what I was considering, wasn't sure about the overhead of having the master MCU open up and listening to a bunch of separate point-to-point UART connections.
CAN is a good option if you have distance to cover
yeah, been playing around with that too and works great for long distance. seems a bit overkill for nearby communications with the extra hardware and stack. Does SPI work at all in this situation?
I created this repo during the weekend - https://github.com/bergdahl/FreeTouchDeck-MaterialDesignIcons
it contains a Python script that converts all SVG format icons from https://github.com/Templarian/MaterialDesign to a BMP (24 bit, 75x75px) suitable for use in https://github.com/DustinWatts/FreeTouchDeck.
I thought it may be interesting for you, as there are 5962 MaterialDesign icons to choose from, and my script is really easy to modify for other image formats as it uses PIL for image manipulation.
I would also be very thankful if some Python guru can explain to me how the following line works, as I am not familiar with that syntax.
rgba[rgba[...,-1] == 0] = [0,0,0,0]
I know what it does, I just don't understand the syntax.
so I printed the number of calls to github.requests in the bot, and I get 1204 authenticated (oof), and somehow 3 not authenticated at the start - meaning they return a X-RateLimit-Remaining bellow 60, despite going through the function that should be adding the auth token, which I don't understand, so I'm looking into that
ah the search API has a different rate limit (30 requests per minute, so it's fine)
The ellipsis stuff is handled by numpy. ... is a special object provided by Python, but it's mostly used by numpy: https://numpy.org/doc/stable/reference/arrays.indexing.html
(and nowadays it's also used for stub files)
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ...
Ellipsis
CustomPython would work MyPython might be too close to MyPy.
SockPython? That way we can make one of these for Blinka:

I think we'll wait to wait until after 6.2.0 to merge this. That will give us time to refine the API if we need to.
@tannewt @jepler ping?
@tannewt , just to make sure I'm clear - you are asking to abandon (or modify) this pull request, then add a new board with a different name to differentiate it from earlier versions? Something like bdmicro_vina_d51_xxx where xxx is some designator indicating it is not binary/UF2 compatible with bdmicro_vina_d51?
If so, would it be ok instead to submit a PR that renames the current bdmicro_vina_d51 to something like _prelim, and then the current Rev remain attribute-less?
No need ...
@slender iron one thing I'm thinking about is how the RP2040 doesn't actually lose RAM state after being put in Dormant mode - even the lowest power state where all ram is in the "power down" mode, it doesn't lose any data. Should I force a reset after it wakes from deep sleep? Or just fold it into the existing fake deep sleep handler?
should I post in https://github.com/adafruit/Adafruit_CircuitPython_RGBLED/pull/15 again to ask how to move forward with it ?
@jaunty juniper I'll post to it. I think I know what needs to happen.
thanks ๐
@jaunty juniper It'll be in the bundle tomorrow but you can download it here once the assets build. https://github.com/adafruit/Adafruit_CircuitPython_RGBLED/releases/tag/1.1.5
I think you would still force a reset because there's pin state, etc., which you want to clear - whatever would be done on a hard reset. We want to make it be a real reset.
Can someone point me to the GitHub repo with Adafruit graphics assets? I seem to remember one with lots of images of Blinka and the other characters.
@mental nexus Not sure it's on GitHub. We have an internal dropbox with assets. I don't think it's public though.
@mental nexus this might help... https://github.com/adafruit/circuitpython/tree/main/logo
Good call.
If you're looking for more than what's there, let me know and I'll grab things for you.
Thank you! Thatโs what I was remembering. Iโll see if that will work or if I need something else.
@mental nexus https://github.com/adafruit/awesome-circuitpython/
looks for "art pack" and it's a link to dropbox
I don't think you need to do a full reset but you will want to do a port_reset and be outside the vm
since all clocks will stop
hey
hey you
we have some RP2040 QT Py in stock
@tough flax ^ has the "bill b jumper"
(already placed my order too ๐ )
bill b jumper โข๏ธ
been waiting for that bad boy! Thx.
Kind of fun because I just got these PCB today
Though I need one more run because my goofiness used the wrong crystal footprint ๐คฆ๐ปโโ๏ธ
Thankfully I can still test without the crystal
I was thinking of using an old btle board that I have laying around but I just realized that its not supported in circuit python. I guess that's what @slender iron is working on now. Do you plan to support that board too? The breakout is discontinued but maybe it will still work if you support Nordic? https://www.adafruit.com/product/1697
@alpine nimbus don't get your hopes up. those old chips are very limited
Ok, I figured
supervisor.reload() doesn't seem to do anything from REPL, which may be expected? just use <CTR><D> instead?
@idle owl do you know if the various programmatic reset options are covered in learn somewhere?
I do not know to what you refer.
like supervisor.reload() and microcontroller.reset()
No, not that I'm aware of. Maybe on the Troubleshooting page, but if so, only the microcontroller one.
Love that it had a name ๐
ok, for some reason, been seeing various "how to reset" questions lately, and all sort of flavors - like "how to reset to bootloader" etc.
Hmm. Seems worth having somewhere. Maybe the FAQ. The Troubleshooting page is getting long.
maybe essentials guide?
might be worth a dedicated page? i think there are a fair amount of options
@tidal kiln Then yah Essentials guide. Welcome is already too beefy, we're losing people in there. Need a sherpa to get through it.
Makes sense. Essentials is getting templated anyway, so I dunno how much we'll even be referring to it. But the page you're talking about writing will be board agnostic, so perhaps mirroring it into guides will be fine.
templated? is it going away?
No, we'll never delete it. But there is a new feature in the Learn backend called Templates, and you can create a template with "Template areas" that you can change, and the rest of it is immutable once added to a guide. So I can write, for example, a page on doing Blink, and have most of it already fleshed out, but the diagram showing where the LED is will be tailored to the specific-board.
So instead of a single page with 10 wiring diagrams on it, each board gets its own.
neat. ok, yah, see how that would work for that guide in particular.
but it happens at the page level? not the guide level?
And, it also means, that the boards that have very specific uses, will only get the parts of the essentials guide that apply. So Neo Trinkey will get a page that is a NeoPixel blink example because no D13 LED.
Correct. Each template is a page that's added and then modified.
I create the template first, then it's available to add to a guide.
But the point is that we won't be mirroring the Essentials guide into board guides anymore, and we'll slowly work backwards through the existing guides until all of them have their own tailored experience. That is a loooooong term thing though.
Moving forward though, templates for sure.
would it be a waste of effort if i created new normal page in the essentials guide, to cover reset?
No. Because I feel like that is board-agnostic.
These templates are because each board is different.
But the reset is the same for all boards, isn't it?
AFAIK ๐
I can't picture needing to tailor anything to a specific board on a page about reset.
So, I think it's fine to create a new page.
The guide will never go away because it's linked so deeply in Learn. We never delete guides/pages - we only deprecate them. If it turns out we decide to deprecate that entire guide (which I kind of doubt will happen), then we can move that page into its own guide or to another home. And "deprecating" a guide means putting warnings on all the pages. It doesn't change access to it.
Thanks! I can review it when you're ready.
excellent!
@idle owl I don't know if you saw the adabot PR I was talking about, you mentioned you wanted to request reviews https://github.com/adafruit/adabot/pull/219
Ah! I did not see it. Thank you for linking it.
@stiff pelican Thank you for the reviews ๐
Is there a specific python version required to build circuitpython?
at least Python 3.7, because we use type annotations for some things, and you can do from __future__ import annotations in 3.7.
I've ran into same error while building wrover on ubuntu 16.04 and while searching for solution on google came across this link. On further looking the issue is related to cmake version (3.5.1) in ubuntu 16.04 as the CMakeLists.txt in ports/esp32s2 of main branch needs 3.13. Using latest cmake 3.20 builds successfully.
@pulsar bloom what is your building computer OS and version?
The build process SEEMS to sometimes ask for "python" when it really wants python3. I made a link to force this.
On Ubuntu you can sudo apt install python-is-python3 which sets up the links for you.
@tulip sleet Win10, Ubantu under WSL2. About to throw my hands in the air and dual boot.
did you install ubuntu 20.04? What are the errors you are getting, and what chip are you building for?
@tulip sleet 20.04 is installed.
i am using native 20.04; we should be able to get it to work
you can use the stock python. don't install another python
did you do pip3 install -r requirements-dev.txt after cloning the repo? There are a number of new pip3-installed requirements for recent builds.
@tulip sleet compilling for circuitplayground_express:
thanks for the tip. Just to add other observation that esp32s2/esp-idf.install.sh sets the virtualenv for python-2.7. After installing the new cmake version 20.2 and put it in my path list, build is successful for espressif_saola_1_wrover.
if you can upgrade to 20.04 things will go more smoothly, though I can understand if that might be an issue.
@pulsar bloom what are the errors you are seeing?
@lone axle Could I merge the two PRs in the Display_text library and make the release? let me know thanks.
@tulip sleet carter@speedy:~/bin/circuitpython/ports/atmel-samd$ make BOARD=circuitplayground_express V=2
GEN build-circuitplayground_express/genhdr/mpversion.h
python3 ../../py/makeversionhdr.py build-circuitplayground_express/genhdr/mpversion.h
GEN build-circuitplayground_express/genhdr/qstrdefs.collected.h
python3 ../../py/makeqstrdefs.py cat - build-circuitplayground_express/genhdr/qstr build-circuitplayground_express/genhdr/qstrdefs.collected.h
QSTR not updated
GEN build-circuitplayground_express/genhdr/devices.h
install -d build-circuitplayground_express/genhdr
python3 ../../tools/gen_nvm_devices.py ../../supervisor/shared/external_flash/devices.h.jinja build-circuitplayground_express/genhdr/devices.h
Traceback (most recent call last):
File "../../tools/gen_nvm_devices.py", line 23, in <module>
typer.run(main)
File "/home/carter/.local/lib/python3.8/site-packages/typer/main.py", line 859, in run
app()
File "/home/carter/.local/lib/python3.8/site-packages/typer/main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "/home/carter/.local/lib/python3.8/site-packages/typer/main.py", line 239, in get_command
click_command = get_command_from_info(typer_instance.registered_commands[0])
File "/home/carter/.local/lib/python3.8/site-packages/typer/main.py", line 425, in get_command_from_info
command = cls( # type: ignore
TypeError: init() got an unexpected keyword argument 'no_args_is_help'
make: *** [../../supervisor/supervisor.mk:55: build-circuitplayground_express/genhdr/devices.h] Error 1
@tulip sleet sorry having problems navigating the forum
you need to update click: pip3 install --upgrade click
@tulip sleet Thanks worked like a champ ๐
i think this points out the need to add some version checking in requirements-dev.txt. Thanks for being a guinea pig on this.
๐ฅ ๐ฅ ๐ฅ we do have some qt's still but they're disappearing fast https://www.adafruit.com/product/4900
Got my two on order... thanks for announcing!
@tannewt We've seen at least two people get bitten by too-old versions of click. I added a few minimum versions to requirements-dev.txt but am quite unsure about what to include here. And should we pin black? It would take some research to find the minimums for some of these on older versions of Python, perhaps.
is there a recommended UNIX distro for Windows WSL that works well for building CP?
I use Debian and have had no issues
ubuntu 20.04 is what i use
Select default_branch:
1 - master
2 - main
Choose from 1, 2 [1]: 2
Traceback (most recent call last):
File "/var/folders/2y/v5rvm0w51gn_1xbkp6tnyspc0000gr/T/tmpZsp2bH.py", line 8, in <module>
import pathlib
ImportError: No module named pathlib
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)
I got this error when running the cookiecutter library creating script. I did a pip3 install pathlib but still no luck. Any suggestions?
the Learn Guide is written assuming ubuntu
good to know, thanls
Is the script running python 3? I've ran into that before where I thought it was but was running 2 and that's why it would fail for me
CP build instructions are pretty good, managed to strip out a bunch of stuff and add I2Cperipheral to my qtpy build
I misread this at first sorry. I got back home a little bit ago and just reviewed and merged those. I see now you were asking if you could do that though.
@ThomasAtBBTF So the essence of your fix is to close the sockets? Maybe we need to document that? Should we keep this issue open and perhaps change the title?
If you have write access and the PRs have been approved by a CircuitPython Librarian you can merge them and make the release. I'm not sure how to check if other people have write access though. Do you know if you saw the merge button on the page? I think that would indicate it. We can check on the next one when it comes up to figure out for certain.
is there any advantage to including a FROZEN directory in the build compared to just copying over an .mpy file into the /lib directory?
No problem ๐
The generated regex code is limited in the range of jumps and counts, and this commit checks all cases which can overflow given the right kind of input regex, and returns an error in such a case.
This change assumes that the results that overflow an int8_t do not overflow a platform int.
Closes: #4500
See https://github.com/micropython/micropython/issues/7078 and https://github.com/micropython/micropython/pull/7080 for additional background and discussion. Cherry-picked back from Mi...
Yes I saw the mere button I have already merge a PR in the DHT library
I think including them in the build allows you to save space in flash which is helpful on the non-express boards that have relatively little storage space.
Okay cool. Have you made a release before?
I made one for one of my libraries for the community bundle, and I saw you made one in the stream
Okay yep whenever the next one comes up ping me, you can make it and I'll look over it. One thing to note is that editing releasing is not good. Github allows it but I think some of the actions assume that it won't run multiple times and gets wonky.
Lets do that, Thanks I ll ping you next time ๐
A frozen module can be executed directly from flash instead of being loaded into RAM first, so it ends up saving RAM space. This is especially important on low-RAM boards like SAMD21 (32kB).
good tips, I assume we can freeze any of our own custom /lib code in the same fashion
yes, a few people have done that; just follow the same directory structure. You can also freeze individual files by using FROZEN_MPY_FILES instead of FROZEN_MPY_DIRS.
I see, Thanks Dan!
I don't think I realized or remembered this. I couldn't get enough RAM for the 480x320 display on the RP2040 but I wonder if I froze in some of the display stuff if I would get enough back.
given the size of some libraries, yes, that might help a lot. Also make sure that you are import .mpy's, since .py imports could fragment the memory (though we have ameliorated that partly through long-lived objects)
@misty garnet no, but you can always import whatever as the sole thing in code.py, and whatever.mpy is fine in that case.
ah yeah, makes sense, thx
someone should write articles like this, but about CP/MP .. https://tenthousandmeters.com/blog/python-behind-the-scenes-10-how-python-dictionaries-work/ I think people would dig it.
Python dictionaries are an extremely important part of Python. Of course they are important because programmers use them a lot, but that's not the...
@tulip sleet just saw the API merge - I have an ortho appointment tomorrow that will take up most of the day (long drive), but I'll try and still get NRF port patched. If not I'll take care of it on Thursday
Hmmmm just thinking about the RP2040 QT Py... in CircuitPython, can a UART be defined on the STEMMA QT pins? Is that something that can be configured?
depends of the capabilities of the pins, I don't know if they are hooked to sda/scl or sda1/scl1, I assume the former, so that's GPIO 24/25 which have UART1 TX/RX
but sda1/scl1 are 22/23 which don't ?
well that didn't help
yeah... my own diagram for the Feather 2040 shows SDA/SCL on pins GP02 and GP03 which are RTS/CTS not RX/TX. So, I guess you'd have to bit-bang it?
@jaunty juniper you're right it looks like it's on GP24/25... which would work with a cross-connected STEMMA QT cable https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/boards/adafruit_qtpy_rp2040/pins.c
I'm not sure, since SDA/SCL are on the silkscreen it seems likely that the stemma is on SDA1/SCL1 which are RTS/CTS
oh it does say "I2C1" next to it
I just looked in the pins.c
yeah, the stemma QT and the board pins are on different pins
so you get 2 I2C buses
I don't see which is which in pins.c
actually I do, SDA is D4 so definitely on the board, so the stemma is:
{ MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_GPIO23) },
I just saw these { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO24) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO24) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO25) },
Good point we still don't know which is connected to the STEMMA without a schematic - it's ok - it can wait ๐
in the specs it says 2 i2c ports, one on the qt connector and one on the pads
@dhalbert
Yes, the need to close the sockets certainly should be documented.
As this "solves" my problem 2.
(Anyway, without that, I suppose there is a chance to "leak memory".)
But my observation that send often does not "send everything" remains. (Problem 1)
Here my "send_line" code:
def send_line(self, l, byte_line):
need_bytes = len(byte_line)
sum_bytes = 0
retries = 0
while True:
try:
line_bytes = sel...
Not sure this is the right place... but on the support matrix ( https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html ) I noticed that QTPy has no space between QT and Py in the new RP2040 version:
"Adafruit QT Py M0" and "Adafruit QT Py M0 Haxpress" vs "Adafruit QTPy RP2040"
If you know the right place (new issue? on circuitpython-org or elsewhere) for that kind of silly comment about the support matrix...
I found other that hurt my eyes/brain:
IMXRT1010-EVK vs iMX RT 1060 EVK
Arduino MKR Zero vs Arduino MKR1300 (maybe that is their name decision)
@dglaude The names come from MICROPY_HW_BOARD_NAME in each board's mpconfigboard.h.
It's also the name that is show in boot_out.txt.
Cc: @tulip sleet Wouldn't that be a good candidate library to add for QT Py Haxpress? Except for Serpente, I don't see a lot of M0 with i2cperipheral. Soldering to Haxpress a QT Py seems more accessible than having to compile a custom version of CircuitPython... some time ago I wanted to do QT Py to QT Py communication, and there were two options: (1) Hack a StemmaQT cable to put RX on TX (port capable of I2C can also do UART) (2) use a standard StemmaQT cable and do I2C, but one require to be i2cperipheral. @misty garnet I am very much interested in any demo of mcu to mcu communication in I2C, if ever you have a project to share.
malloc may be better than I thought initially. They strip the heap, which creates a pipeline of sort. Would be interesting to know latency. I am not sure this changes everything, but makes the common case better. That is neat.
@thorny jay i2c mcu to mcu is something I plan to look into soon, so I'll share my experiences
It is not turned on for any SAMD21 board except maybe one; that may have been a decision made a while ago for space considerations. We could turn it on but we have other things we may want to put in that space even for small boards (like dynamic USB descriptors). But a conditional issue asking for it if it fits would be fine.
Yeah, I carved out a lot of room ditching the USB HID/MIDI for my build
@tough flax the PIO peripheral can implement UART -- we've adapted a receive-only example from the rp2040 examples here: https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/blob/main/examples/rxuart.py
IMXRT1010-EVK vs iMX RT 1060 EVK
The first is the manufacturer's part number for the board; the second is the name.
Arduino MKR Zero vs Arduino MKR1300 (maybe that is their name decision)
Yes, this as as found on Arduino's website.
Of course, thatโs really great Idea. This would let us use 2 qt py RP 2040s as a USB filter given limor was wonderful enough to include my jumper pin๏ฟผ
Add lots of maybes to that statement ๐
CircuitPython doesn't have USB OTG yet so I'm not sure about the idea of a USB filter
Bill is using Arduino for one side of the filter, I think.
this should be considered unofficial, but I hope it helps with pins & so forth until the guide goes up
(schematic)
@tulip sleet oh, that tracks
Send that link to cpnews@adafruit.com ๐
@idle owl okay, done
Thanks!
I am happy to report that after ~30 hours of continued operation the MagTag has not crashed once! The changes in 6.2.0-rc.0 seems to have solved the issue.
Thanks for your time, and sorry for wasting it on an already solved issue.
Thanks again!
Not sure how relevant this is to CircuitPython, but I did some multicore testing with MicroPython on a Pico back in February. I found that global variables require about 1mSec to get updated between cores. The only element that updates faster is a lock. These must be interrupt driven as they update very fast, on the order of a few microseconds.
@slender iron in mimxrt10xx do you know if we have an "uncached data ram" segment defined yet?
if we do it's not named like the sdk wants, I don't think. #define AT_NONCACHEABLE_SECTION(var) __attribute__((section("NonCacheable"), zero_init)) var
@onyx hinge I don't believe we do
@slender iron what's "ocram"?
it's the flexram made available to the dma axi bus
the MPU settings say it isn't cached
ok, so the context of my question is that this example ensures that the DMA descriptor and DMA data are not cached ... sai_edma_record_playback.c:AT_NONCACHEABLE_SECTION_ALIGN(static uint8_t Buffer[BUFFER_NUMBER * BUFFER_SIZE], 4);
so .. how would you recommend accomplishing this in CP?
add the section name into the OCRAM definition
well, here: https://github.com/adafruit/circuitpython/blob/main/ports/mimxrt10xx/linking/common.ld#L98
in .bss
okay, that's a much shorter path to the goal than I was worried about
@slender iron thanks!
hmm, pwmio is supposed to be a core module for the QTPY, but when I did my custom build I had to specifically enable the flag, is this right?
qtpy 2040?
nope, M0
looking...
yes, it should be on automatically. I'll look at a stock build
it is on in the stock build
let me take out out of my mpconfig and see if it still works
yup, no PWMIO module
here's my mpconfig:
CIRCUITPY_PULSEIO = 0
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_USB_HID = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_COUNTIO = 1
CIRCUITPY_I2CPERIPHERAL = 1
CIRCUITPY_SDCARDIO = 1
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
I need to explicitly stick in PWMIO, maybe one of the other flags messes with it?
@misty garnet pulseio and pwmio are connected in the conditional
you are turning off pwmio by turning off pulseio
ah, that would do it then, thx
That was exactly it! Now I installed pyenv so maybe that will make it easy to select which python version to run for different things (assuming I remember to set it right). Thanks @blissful pollen!๐ฅณ
Not sure this is the right place... but on the support matrix ( https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html ) I noticed that QTPy has no space between QT and Py in the new RP2040 version:
"Adafruit QT Py M0" and "Adafruit QT Py M0 Haxpress" vs "Adafruit QTPy RP2040"
Yeah... some of these boards use the names interchangeably like MatrixPortal vs Matrix Portal, which has both printed on the same board.
Thanks for following up @mlupo. No worries having it open while you investigate.
I don't know why folks are having trouble with click. cascadetoml depends on typer and typer depends on a specific version of click. We shouldn't include version specs unless we're the ones that directly require them.
Looks good! Thanks! Please update circuitpython.org as well.
GitHub
for QBasic-compatible music strings
(https://en.wikibooks.org/wiki/QBasic/Appendix#PLAY)
The music parser is WIP and comments are welcome
before the input validation and missing features
are added;...
I'm working on getting the photos updated for the CircuitPython.org update. Should be in the next few days.
Thanks again!
I haven't had time to look into that with any detail. (or test it)
I think the main thing is putting it in the right place, module-wise. How to handle repeat=True I think we need to look at, but the time developing 7.0 may give us an opportunity -- and may end up changing how this works in the process.
@slender iron what are your thoughts on expanding countio to include other interrupt sources as well
https://github.com/adafruit/circuitpython/issues/4554
I want us to consider freezing adafruit_pypixelbuf into boards that need it. Because the dynamic bundler has no way of knowing a piece of code is being used on a particular board, and would therefore have no way of knowing whether that lib is needed or not. So either it's included every time neopixel or dotstar is used, or we have to include a separate section about downloading it separately. Or we freeze it in and it's a non-issue.
@idle owl any idea if there's enough room? I think that's likely to be the trouble
how big's the mpy file?
if it's always in lib, but _pypixelbuf is native, I think import _pypixelbuf will import the native version.
so it can be in the custom bundle but not be used
i think
I have to check that
I think NeoPixel and DotStar look for the native version first
But they fail to run if the native version isn't found
trinket_m0's fullest translation has about 1700 bytes free at the moment
Yes, but if it's not present, obviously it won't work.
Right now, if I were to include a piece of code that used NeoPixel, with the intention of using it on QT Py, and download the dynamic bundle for it, it would include only NeoPIxel.
right, so I'm saying if you always include it in the custom bundle, then you're safe; it will just be unused on boards with native _pypixelbuf. Is that ok?
Oh. Ok I see.
Yeah that would be fine.
So we set it as a requirement for NeoPixel?
As long as we're certain it checks for the native version first anyway.
yah, it's a requirement that isn't used sometimes
Yes it uses native first.
import adafruit_pypixelbuf as _pixelbuf
else:
try:
import _pixelbuf
except ImportError:
import adafruit_pypixelbuf as _pixelbuf```
wait.
No it doesn't.
first let's remove that top block
i mistakenly thought that we named adafruit_pypixelbuf to be _pixelbuf anyway
@analog bridge changing countio is different from what the issue says. generally, I don't think a count of interrupts will be enough. I suspect folks will want more of an event queue that has timing info about the events too
@onyx hinge That top bit is if we were still supporting v5 right?
yes I think so (though adafruit blinka is probably using that top block)
ah.
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.implementation.version[0]
3
er does this lib work with blinka?
That's from NeoPixel, so I certainly hope so
if we have
try:
import _pixelbuf
except ImportError:
import adafruit_pypixelbuf as _pixelbuf
I don't think we need the if statement, because the first import will fail in the right circumstances
Right, that's what I thought
i'm not sure why we thought we needed the if statement at all
it is redundant, it seems to me
it doesn't seem to fit, fwiw
7.0.0-alpha.1-28-g0539b88a6
trinket_m0 de_DE
vanilla
1364 bytes free
w/ _pypixelbuf
region `FLASH_FIRMWARE' overflowed by 1720 bytes
w/ frozen adafruit_pypixelbuf
region `FLASH_FIRMWARE' overflowed by 2644 bytes
Ok. Good to know.
and _pixelbuf is smaller overall
is the custom bundler or circup not installing adafruit_pixelbuf?
Custom bundler. Hadn't tried circup yet.
Actually, I have no way to test.
The only one I could think of, I directly import adafruit_pypixelbuf for colorwheel. So that one downloads it properly.
the metadata says it should install it afaict ```$ < bundle.json jq '.neopixel.dependencies'
[
"adafruit_pypixelbuf"
]
oh hmm.
this is from that new bundle json file
Maybe I'm wrong then.
https://adafruit-circuit-python.s3.amazonaws.com/bundles/adafruit/adafruit-circuitpython-bundle-20210407.json which is what I thought the bundler used
You might be right and I just sent us down some nonsense for no reason.
Wait...
I can test it. Hold on. Let me find some NeoPixel code.
https://adafruit.github.io/Adafruit_Dynamic_Bundler/?libs=neopixel -> downloaded me a zip file with contents ``` 1891 2021-04-07 18:55 adafruit-circuitpython-bundle-6.x-mpy-20210407/lib/neopixel.mpy
5737 2021-04-07 18:55 adafruit-circuitpython-bundle-6.x-mpy-20210407/lib/adafruit_pypixelbuf.mpy
OK, yeah.
I'm sorry.
Need to check DotStar.
But I should have researched better before raising the flag.
Apologies.
[
"adafruit_bus_device",
"adafruit_pypixelbuf"
]
Thanks for bringing the issue forward
I guess we could still update the block at the top of NeoPixel.
save a few bytes of mpy file ๐
same in DotStar.
we could also consider whether we want to rename _pixelbuf to adafruit_pixelbuf, like we did for adafruit_bus_device
I think that has worked out. I'm sure for historical reasons we just weren't ready to do it that way then
What would that do?
it would let a bundle that supported 7.x only eliminate the try/except ImportError
because the first import would get the one in the core, if it's there
OK, I mis-spoke, I wanted to make the names exactly the same
There is code that imports _pixelbuf for colorwheel which is neither here nor there, we'd need to update it, But worth noting.
Ah ok
That's what confused me.
I guess renaming the internal version makes more sense as it's ostensibly not meant to be used publicly as it is now. So there's little to break by renaming it.
@onyx hinge @tulip sleet PRs in for NeoPIxel and DotStar. Tagged you both for reviews. No rush.
Limor got them.
Done and released.
What triggers the creation of a new cp version specific bundle (in this case CP7 bundles) ?
And because I've not been around long enough to know this, what is the approach for supporting 6 and 7 assuming 7 had a breaking change for a library.
We continue to support the latest and the most recent before that. So once 7 is released, we'll support 6.2.0 and 7. For now, we support 6 basically because 6.2.0 stable went out.
And we tell Adabot to create a new version of the bundle.
And to stop making old versions.
OK, so circup should always fallback to "latest" (highest semver) and not fail when it can't match the version. In this case it fails on CP7 daily builds because there is no cp7 bundle.
OR a cp7 bundle could be created.
Hasn't main been incremented to 7.x ? for daily builds and actions, etc..
There's an alpha.1 tag, but there's not a release on GitHub.
I'm not sure what the nuance is here.
As in I'm not sure what a tag vs a release specifically means for other things.
the tag exists so that the builds from main branch won't report as 6.2.mumble. A release will probably not be made until "later", which depends on many factors but mostly feelings
Hmm alright. I guess it's time to tell Adabot to be building a 7 bundle then.
yes the latest builds are identifying them as "7.mumble" now
7.mumble ๐
Has anyone written code that incorporates both the adafruit_hid library and the Adafruit_CircuitPython_MatrixKeypad-master library or can point me in the right direction?
@ember fjord Please avoid cross-posting questions. #help-with-circuitpython is a better channel for that question. You've already asked it there. Please be patient as most folks are community members who help out when they're around.
is my question even written in a way that makes sense that somebody would even be willing to help @idle owl
Yes I think it makes sense.
even the "beginner" chats seem far beyond my skill sets at this point
It takes time to learn. This channel is more for development discussions. The help-with channel is better for questions like yours.
@onyx hinge @idle wharf https://github.com/adafruit/circuitpython-build-tools/pull/68
is that enough to do it?
Then we need to update circuitpython-org to have it when we're ready. But it should build the bundles.
Yes.
Apparently.
PyCharm nonsense.
ah
I opened a PyCharm project in the repo directory and it creates that directory.
So it's delete it or .gitignore it. I usually choose the latter.
there's a way to set up a personal, but system-wide ignore list
oh hmm, I guess I should do that.
One time per computer/account, git config --global core.excludesFile $HOME/.gitignore then add lines to your $HOME/.gitignore file to have them applied in all git repos
Also, circuitpython-build-tools appears to still be using Travis. We should probably fix that.
Oooh ok.
Will that work on Mac as well?
I think it's really handy .. on the other hand, adding ignores in our own repos for packages we recommend users to use doesn't hurt and may help
it should, but if you want me to check you'll need to buy me an MacBook Pro M1 and I'll get back to you
I'll get on that.
thank you!! 
May have broken PyCharm trying to open a project in my home directory.
uh oh
Hah.
bet you wish you'd bought me that machine for testing now.
I created a fresh virtualenv, confirmed it did not have access to click, etc. and then did a pip3 install -r requirements-dev.txt. It did pull in the right versions. I thought that the users having this problem had done pip3 install -r requirements-dev.txt, but perhaps not. So it's a mystery, but it should work correctly. Closing for now.
Ok, @idle wharf in theory there will be a 7 bundle on next build.
Thank you Kattni, now that I know when cp8 comes out I could push that fix.
I call first mention of CP8 ๐
No dibs allowed! ๐
@tulip sleet I did a WSL2 Ubuntu fresh install twice (2 different machines) to build CP, and had to manually update click both times even following the build instructions
That is really strange, even after doing pip3 -r requirements-dev.txt ?
Hi. Is it possible to have a hardware switch to select if the usb storage is mounted or not?
@tulip sleet yup, can confirm that in my CLI history
I created a fresh virtualenv and did that pip3 install and it installed click 7.1.2
so I'm mystified. I may try a clean ubuntu in a VM
I'm pulling the Ubuntu from the Microsoft store if that makes a difference
@Magic not yet, but I am working on it for the next release
still, as Scott points out here, cascadetoml requires something which requires something which requires the right version of click.
@tulip sleet wow thx.
IN the meantime you can do a custom build with MSC (usb storage) turned off, and switch back and forth by loading the stock or the custom UF2
Ah intresting. So the "bootsel" storage will always work if the button is pressed?
i'm confused by your question. RP2-RPI (or is it RPI-RP2? ๐ ) is separate from CIRCUITPY. I'm talking about enabling/disabling CIRCUITPY.
I mean you can use the stock CircuitPython .uf2, or build a custom one with CRICUITPY visibility turned off
you have to use the stock one to put main.py on, then you load the custom one. Loading a new .uf2 does not erase CIRCUITPY. I have an HID volume control I use which does exactly this.
so if you need to change the code, you have to reload the CircuitPython .uf2
ah thx. didn't know that.
@tulip sleet yeah, not sure where the glitch is, here's a bit of the output from the pip3 requirements:
Collecting typer
Downloading typer-0.3.2-py3-none-any.whl (21 kB)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from -r requirements-dev.txt (line 9)) (2.22.0)
Collecting sh
Downloading sh-1.14.1-py2.py3-none-any.whl (40 kB)
|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 40 kB 2.8 MB/s
Requirement already satisfied: click in /usr/lib/python3/dist-packages (from -r requirements-dev.txt (line 11)) (7.0)
downloads typer, but seems to be happy with click 7.0
but then you can do pip3 install --upgrade pip and get an even newer version
i have
halbert@tuna:~$ pip3 --version
pip 21.0.1 from /home/halbert/.local/lib/python3.8/site-packages/pip (python 3.8)
maybe that's it:
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
I'm not saying it's a good thing it's wrong; that's not good. That would explain why it worked for me with a fresh virtualenv. I will try to downgrade the pip in the virtualenv and see what happens
that's also the pip from the main filesystem rather than my local installation, so I need to export a PATH
do you have /home/kevint/.local/... something in your $PATH?
no I didn't
hmm... we may need to add directions about that. I remember something about this adding .local automatically to PATH, but I can't remember who does that
@gilded cradle Thanks for releasing circuitpython-build-tools. I missed that step with the update I submitted. Would have assumed I did something wrong when it didn't do anything new tomorrow. ๐
No worries. I worked on it recently enough that I happened to remember.
@tulip sleet tuna? Is that name a variation on a theme, or singular?
As in are they all fish, or food.....
I tried pip 20.0.2 in my virtualenv, still worked
heh, curious
it is a series of fish: first machine was angelfish, then seahorse, then abalone, crab, tetra, salmon, and finally tuna. Tuna is less dignified than the others
Hah!
I think there were some other ones too.
my previous dev machine was salmon. oh, also char
they were vaguely related by physical size of machine and physical size of the fish
I named one Robocrepe and haven't let it go since. My windows machine is BLACKBOX because the case is sort of a black monolith.
I love it!
Isn't a crab technically a crustacean?
well, sea creatures, I was getting desperate. We don't have an aquarium, so fish you keep as pets did not come naturally to me ๐
๐
Call the next one oscar!
also i have a chinook windows machine. I have far too many computers
You do have many, indeed.
Now I'm coming up with a bunch of sea creature names for you ๐
i would be grateful ๐
trout
@tulip sleet Seriously, ping me next time you need one. I got you.
stingray!
Nice one!
i have a trout already
I had one for a bit. Little one, relatively speaking.
@gilded cradle Oh! Thanks for testing my update! Just saw the GitHub message.
No worries, I kind of had to do it to test my change ๐