#circuitpython-dev
1 messages ยท Page 199 of 1
no. straight python thing.
has to do with being interpreted. so it's like trying to do this:
>>> print(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
>>> a = 23
>>>
I dunno, that seems different
with additional layers of stuff coming from the behind the scenes syntax sugar that the @ things do
I'd put it more in the category of defining a function with a reference to a function that hasn't been defined yet in the file
since it's interpreted, it needs to know about it at that point in the code
nope, still doesn't work
I don't think classes are interpreted the same way as code on a repl
but what do i know...
nanny bot doesn't like w t f
hmm.. looks like vs code doesn't handle files moving underneath it well and I ended up with two copies of the driver and tried to build against the wrong one
it could be
nope. still gripes.
Adafruit CircuitPython 3.0.2 on 2018-09-14; Adafruit Trinket M0 with samd21e18
>>> import foo1
>>> import foo2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "foo2.py", line 1, in <module>
File "foo2.py", line 2, in Foo2
NameError: name 'bar' is not defined
>>>
there's one for micropython here from the original repo
https://github.com/micropython/micropython/blob/master/drivers/nrf24l01/nrf24l01.py
There's also a RadioHead driver here
https://github.com/adafruit/RadioHead/blob/master/RH_NRF24.cpp
https://github.com/adafruit/RadioHead/tree/master/examples/nrf24
And the most popular nrf24 library in C/C++ here
https://github.com/nRF24/RF24
@dhalbert thanks for the answer. Are you likely to get your Atmel/MicroChip SAMD code pulled back into MPy at some point? Just wondering how far apart the branches will get, i'm pretty new to all this distributed development stuff
@tulip sleet apparently I don't know how to @ people on Discord either, see above
No problem, i will check ir later today.
Adding draft, it needs to be reviewed.
Anyway I managed to translate all strings but 58 that I couldn't found a fitting expression so I let those blank.
See #1226.
This is an implementation of #703 ... porting WizNet 5200/5500 support across from MicroPython.
Tested on Metro M0 Express and Metro M4 Express with WizNet 5500 FeatherWing.
There's no particular reason this shouldn't be adaptable for other architectures which support SPI.
This particular version doesn't use LWIP as that used up too much memory for use with M0. Instead it uses the WizNet native mode which imposes some limitations but reduces demand on the main CPU.
Example code:
`...
@slender iron or @tulip sleet - I just edited a post I made last night tagging you. I'm not sure how to link to a post - discord is brand new to me. ๐ Anyway, it looks like maybe my mem chip isn't talking. Before I try hot-air rework on the board, just want to rule out anything else.
@dawn rampart You mean link to a previous message?
If they're tagged, they'll see it. There's no way to link to a previous message.
@idle owl - yes, a previous message. I just edited it to tag them. I think that'll work. ๐ Thanks.
I don't think it sends a notification if you edit it to tag someone but it does highlight it, and you let them know to look for it, so it should be fine. ๐
Hi everyone
No, i'm not waiting on you, i'm waiting on my time to free up.
I did start on the classes for RGBLED and a Pure python pixelbuf
https://github.com/rhooper/Adafruit_CircuitPython_RGBLED
from which we can make NeoPixel and Dotstar (and others) inherit.
I'm searching about infos how to change the USB mass storage name on Trinket M0. Any clue?
@timber mango You mean you want to change 'CIRCUITPY' to something else?
@pastel panther exactly
I don't think there is an easy mechanism to do that. It's fairly trivial for the bootloader, but the board files don't have a way of specifying it as far as I know.
It's all source code so it's certainly possible but it would mean editing the main body of the code to some extent
I'm taking a look at it now to see what might be involved
@pastel panther I'm searching too inside the code but I've no luck so far
@pastel panther I'm pretty sure there is a way to do that, becouse if I use the standard UF2 that comes with the Trinket M0, it renames the trinket in CIRCUITPY, and if you change the UF2 with another one compiled that is not including CIRCUITPY, the trinket USB mass storage name became TRINKET_BOOT
I think you may be confusing the bootloader with circuitpython
so the "CIRCUITPY" name should be outside from the bootloader, or at least an alternative name written on the bootloader
but regardless it is certainly possible
oh no, you got it. you're right
this might be worth looking at (from grepping)
ports/atmel-samd/supervisor/filesystem.c: f_setlabel(&vfs_fat->fatfs, "CIRCUITPY");
ports/nrf/supervisor/filesystem.c: f_setlabel(&int_vfs->fatfs, "CIRCUITPY");
I also tried grepping but without ""
for a trinket you'd be looking in ports/atmel-samd
ok, I'll start my search here, it seems that's exactly what I'm searching for. Thank you
Do you have it building normally?
I'm trying to obtain the same result from the Arduino IDE. It's not the same code, but at least I have a point where to start
I don't think I understand.
@tidal kiln When you get a chance, can you respond to this and take a look at the corresponding PR? (If you're not already.) https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/issues/15#issuecomment-427045851
@idle owl yep. got that and few others to look at. seems like the hacktoberfest tag is working!
@tough flax The CircuitPython page of the MPRLS guide went live around 2am ๐ https://learn.adafruit.com/adafruit-mprls-ported-pressure-sensor-breakout/python-circuitpython
do either of you guys understand this?:
docstring of adafruit_max31856.MAX31856.reference_temperature_thresholds:1:'any' reference target not found: (low_temp, high_temp)
At least I think that's what you were asking about earlier.
@pastel panther I do!
When you reference something in a docstring, you have to do double backticks (``) on either side or Sphinx tries to do something with it.
@tough flax As I know you're aware, the lib is brand new, so please post any issues you run into/feedback you have to the library repo. Thanks!
new nickname accquired
@pastel panther Sounds like how a child might pronounce it ๐
totally
That's nickname recursion!
"mumma, kani sez i can be prugummer to"
๐
one more doc/sphinx/rst question: I want the doc for the constructor to make it clear that it can/should take a adafruit_max31856.ThermocoupleType that is included with the lib but it just shows up like ThermocoupleType instead of max31856.ThermocoupleType
The docstring is currently
"""Driver for the MAX31856 Universal Thermocouple Amplifier
:param ~busio.SPI spi_bus: The I2C bus the MAX31856 is connected to.
:param ~microcontroller.Pin cs: The pin used for the CS signal.
:param ~adafruit_max31856.ThermocoupleType thermocouple_type: The type of thermocouple. Default is Type K.
"""
@timber mango @pastel panther you can change the label from python I believe. You'll want to do it in boot.py though
I'll test it myself later when I have a chance
@pastel panther Hmm.
@pastel panther I'm only partially understanding what your concern is here.
Maybe a screenshot will help, one sec
Yes please.
This is how the above currently renders
I would like it to be more clear somehow that ThermocoupleType comes from the driver. Maybe I need to update the docstring(s) for the ThermocoupleType class?
so that it shows up as well?
If that's where the information makes the most sense, then that's where it should be. You could expand the description in the docstring you pasted above to include a note about where it comes from, and then still update the docstring in the class as well if you feel that's not clear enough.
As long as the information provided in the documentation is relevant to what it's describing, it's usually ok for it to be more thorough if necessary. It's when it starts to get tangential that it becomes an issue.
Oooh, adding the docstring for ThermocoupleType made the reference in the constructor become a link
Ok nice!
is there a "mpy-cross-4.x-windows" i was only able to find "mpy-cross-3.x-windows"
The mpy-cross current version is 3.x, it's coincidence that it's been the same as the CircuitPython versions.
hey @tidal kiln I don't know if you get notified but I just updated my MAX41856 driver. If you can re-review it when you have a minute, that would be appreciated
@pastel panther cool. yep. looks like i got a notice. will take a look!
hmmmm. any reason to use | vs. + for something like this?
>>> low_byte = 0x42
>>> high_byte = 0x23
>>> (high_byte << 8) | low_byte
9026
>>> (high_byte << 8) + low_byte
9026
>>>
In that case no, I don't think so but you might get a different result if the thing on the left hadn't been shifted? I may be wrong but I don't think or and + work quite the same and or seems more approprite or perhaps traditional when doing bit/byte manipulation
the use case is for building up the value from multiple bytes, so the shifting will be there.
i've always just used | also.
@pastel panther your latest push didn't show up in the pr. maybe because you rebased it? not sure.
@tidal kiln I'll take a look on my lunch
@tidal kiln Do you have a few minutes? I can get you setup on RTD if you'd like.
In the three minutes since I sent that, I forgot whether I actually sent it or not.... ๐
@tidal kiln If not, it's fine, I'll add CAP1188 and have you do the process on a different one later. Simply figured since we had one outstanding, it was worth asking if you had the time.
@idle owl afk. if you wanna wait can ping u later
Ok, I might do it up. There will be plenty more. Ping me anyway in case I decided to wait.
Oh hah, the power switch on the Hollowing matters for it working when plugged into USB. ๐
been there, done that.
It took me significantly less time than I would have guessed if you asked me how long it would take me to figure out if it happened. So I have that going for me.
@slender iron When you're around, I'd like to go over the current hollowing image code with you. I mostly understand what it's doing but I'd like a better understanding than that.
Hey folks, I've got a bit of a.... bizarre question for y'all with some hypotheses I'd like to bounce off the wall. tl;dr copy-pasting my entrypoint (let's call it a main.py equivalent, though the structure of my app means it's a couple layers deeper than that) line by line into REPL works great, but straight up importing that file (from myentrypoint_frozen import main) will hard lock the board I'm testing on. I ended up narrowing down the problem to an import getting stuck, but ONLY in this scenario - when typing everything into the REPL manually, it works.
My hypothesis here is that I'm somehow running out of RAM (terrifying thought, really, I've got like 256k on the board in question) during the tight import loop, but when punching stuff into REPL, the VM has enough time to breathe and force a GC. This hypothesis seems promising because my friend also working on this project is starting to run into RAM issues on his Pyboard (this project targets MicroPython as well). The thing that confuses me, however, is this piece of the MicroPython docs (I realize CircuitPython deviates from these, but gc seems to be a mostly equivalent-to-upstream module) that implies I should auto-GC if this were actually the case
Automatic GC is provoked under the following circumstances. When an attempt at allocation fails, a GC is performed and the allocation re-tried. Only if this fails is an exception raised. Secondly an automatic GC will be triggered if the amount of free RAM falls below a threshold
(https://docs.micropython.org/en/latest/reference/constrained.html#control-of-garbage-collection)
Do I need to write hooks into __import__ and/or a wrapper function NodeJS-style (mything, mything2, mything3 = customimport('module.path.here', ('mything', 'mything2', 'mything3')) that auto-GCs after imports? Or am I missing something entirely else that would be causing this?
That was a novel, if you'd rather I took this to a Github issue, I'd be happy to. The only other piece of context missing from that book is that the board in question is technically not an officially-supported board - I did a pretty hackish port to the Seeed nRF52840 MDK (https://www.seeedstudio.com/nRF52840-Micro-Development-Kit-p-3079.html) based on the Feather nRF52840 code in the tree, which seems to otherwise work basically perfectly, but it's possible some setting is screwy in the port. I'd have no clue what, though, the boards (based on the code I see in the REPL) appear to be fairly close if not identical other than pinout.
Example: I was just idly typing at the repl:
>>> import board
>>> board.DISPLAY.show(1)
>>>
then it hangs
@sudden coral until @tulip sleet or @slender iron show up, I'm going to venture a guess that they'll want to see the code in question if you have it available
I'm at work - I have links to the Github project (and my fork of CircuitPython) but don't have a board on-hand right now to test any potential fixes (though @bronze shadow possibly could). That said, the codebase is... not small or quick to skim through IMO
@sudden coral there has to be enough room to compile the code. It's possible you're also running into memory fragmentation: there's enough RAM but it's broken up into too-small chunks.
For large programs, you can use the mpy-cross compilers and run those on the host, and then import .mpy files. Not as convenient a development cycle, but it makes larger programs possible.
If I understand correctly, the compilation isn't an issue because I make heavy use of FROZEN_MPY_DIR (and DFU flash new CircuitPython builds with these frozen modules every time the codebase changes). Fragmentation seems... possible and maybe likely.
There's a few files that instantiate fairly large consts at import time (one example file is about 20kb in mpy form)
@idle owl - thanks for the update on the guide - I will be testing this over the next few days (w/a M4 ItsyBitsy)... am I write that there's no C-code for this library? And do we know how fast we can read this sensor?
so I'd fully believe the fragmentation idea. As for fixes though.... heavy use of gc.collect() either at the end of imported files or in an __import__ hook?
@sudden coral also, the nrf52840 port is very alpha, so there may be other bugs. Yes you could try gc.collect() after one or more imports, but also print gc.mem_free() and see what's consuming a lot.
@tulip sleet would it help you if I tried to repro this on a Feather M0 Express tonight (west coast time)? To isolate if the issue is nrf52840 or my code?
I ran some prints of micropython.mem_info() and it SEEMED like I had... like 75% RAM free right before the hard lock, but @bronze shadow tells me he gets the same thing on his Pyboard right before it OOM crashes ยฏ_(ใ)_/ยฏ
@tough flax If I understand you right, no, there's no c-code, it's the Circuit/Python lib only. And read-speed I'm unsure of. The example code has a time.sleep(1) in it, but that's typical in examples to keep the serial output from being spammed, so I wouldn't take that to mean anything about the actual read speed. It's running a pressure sensing gauge with a pre-calibrated and compensated 24 bit ADC if that helps (I'm not sure if this has anything to do with speed)
Just trying to get an idea how fast a sip/puff user will be able to go. On some sensors, they cache the results for a period of time - just wondering if there was something like that to worry about
And it's great that the module is Python-only
@sudden coral it may not fit at all on the M0, an M4 is more like the '840.
Ah yeah I have no idea. Limor might know from testing, but your testing is probably going to be more thorough in the end anyway.
i don't think it's the '840, though it might be, just being cautious.
Right - I'll know in a few days
@tulip sleet Isn't the RAM on M0 Express (the one that shipped with CircuitPython, though I've since reflashed it) 256k as well? Or am I misremembering?
NO, 32kB RAM
I own so many Feathers and other dev boards at this point it's hard to keep track
256kB flash
oh jeez, okay. Brain wires crossed.
our M4's are 192kB RAM, 512kB flash
(there are larger chips available, but they are hard to get)
@sudden coral I will note that this project does in fact run on a pyboard with 192k of ram, though on micropython, and not circuitpython., and GC almost needs run in boot process.
Welp.... might be time for my like fourth DigiKey order in two weeks I guess :)
I'll see if the gc.collect() workaround fixes first, though.
I also have a few ESP8266/ESP32 boards (I believe they're all Adafruit boards even?) laying around that don't really work for the ultimate project due to USB issues, but may work for reproing this freeze.
no CircuitPython on ESP32, just ESP8266
also if you are building large data structures on import, consider if you can pack them into a bytestring or something
Noted. I know there's a MicroPython port, so I could test anything that's generic to python, but I should probably scope this to CircuitPy just to keep this rabbit hole as short as possible.
You could run CP on RPi Zero?
no, just the blinka wrapper so you can use CPy libraries
I mean, does that solve @sudden coral 's issues
As far as data structures go, they're unfortunately a (huge - I'm considering writing a tool to trim this file before MPY freeze) series of namedtuple and class objects, bytestringing those would be ... fun
@tough flax Unfortunately this project is not suited to run on a realtime OS.
Pi Zero has too high of power requirements for this project unfortunately @tough flax , I own a few and considered reusing them.
Ok, just a thought
if the code is open source, drop a pointer and we can make suggestions
@tough flax That's really useful information. I definately appreciate having it.
Spoiling my future Show and Tell post here a bit, but worthwhile: here's the giant file: https://github.com/KMKfw/kmk_firmware/blob/master/kmk/common/keycodes.py
This is my ultra super hacky NRF52840 port if any of it matters: https://github.com/KMKfw/circuitpython/commit/6c0195acd91146ffc64053f70c73d3e329e18b71
lotsa Keycode objects, yes, you might consider bit-encoding that stuff into a single integer to save space
like here I am just using integers for (simpler) keycodes: https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/master/adafruit_hid/keycode.py
If I refactored that Keycode class out into a bunch of helper methods (for some of the crazier stuff I do with them, like chaining modifiers onto them) and left the keycode definitions themselves as, say, tuples of (hid_code, applied_modifiers), would I save much if any RAM here? I realize there's a RAM hit for instantiating classes but I didn't realize it'd be all that extreme
So, I agree with @tulip sleet - all those object allocations are wasteful & will take up way more space then the actual codes.
is the combination of keycode + modifier bits <= 31 bits?
objects know their type, etc., and take more space. Also the long names take space (though maybe not so much of an issue on M4 or '840)
almost certainly yes - I could add, say, 5-10k to each ASCII keycode to detect (for example) LCTRL being applied and be fine
a tuple is still an object
use or-ing, not addition, etc, so you can check bits easily
I'll take a look at refactoring that - sounds probably like less of a headache than changing how importing works to force a bunch of GC events
i know it's not pythonic, but we gotta save space here. code looks interesting but I will not look too deeply to keep it a surprise ๐
You've saved our bacon at least twice on this project (I was the same guy asking about HID composite devices in MicroPython Github the other week), you can look all you want :)
Is micropython.mem_info() at all accurate? If I were to profile this thing a bit by sprinkling that print statement Infinity-1 times across the codebase, would I actually be learning anything useful? Or should I be using gc.mem_free() instead?
.mem_info() and .mem_free() get their numbers from the same place.
awesome
i am all too familiar with HID keycodes ๐
I think this gives me a lot of ideas of paths forward and a few test cases to repro and report back on - thanks as always for all the help @tulip sleet and also @tough flax
@sudden coral circuitpython should collect after import on its own
my guess is that it could be a heap/stack collision
do you have a jlink or similar you can use to see where its locking up?
is that at the end of each nested import? or just at the end of whichever import statement triggered the chain? (ie if I from kmk_keyboard_user import main, will I get GCs for each step along the way, or just when that import returns, which is never on the NRF right now)
I believe its after nested ones
I just got my JLink EDU literally today (ironically, for another board entirely, but obviously it'll work here). If I can find the SCLK and such pins on this NRF I'd be happy to dive in
@idle owl I'm around but sitting at the bmw dealer
Ah ok. Might be worth waiting then.
@tough flax is there any open source prior art on sip/puff code?
meaning I can't video or voice. should be done in the next hour or two
@tidal kiln Yes, there is sip/puff code in LipSync, but it's not Morse Code.
Yah I figured we'd do audio or video, that it would take less time than trying to explain it all through typing. I can wait.
@tidal kiln there may be more... I will be playing around with this tonight, but I have to go heads down on a work issue this afternoon
There is open source Morse Code from Android, but not specifically morse code
I'll have more later
ok. the sensor data sheet has "data rate 200 samples per second"
but other factors could limit that, like pneumatic lag in the tubulation
kk @idle owl
200 per second would be fine - generally, good users can do morse code at 50+ words per minute. Average code length is (around) 3.5 dits or dahs (dots or dashes). So, 150 codes/minute + wait time of 100-300ms per code... I think it will work
100-300 per letter, not code on the delay
@tough flax https://github.com/katlings/pycon-gemma
circuitpython code to do taps to morse code
good to see, quite a bit more is neede for Jim, but I'm glad to see it. Here's his thoughts on this http://www.makoa.org/jlubin/morsecode.htm
Computer Access for quadriplegics. As a ventilator dependent quadriplegics I use computers by sip and puff morse codes
@slender iron - I hate to keep bugging, but would you happen to have time to look into the message I posted earlier?
But I seriously can't jump into this right now
I have the storage for LessonPix > 85% and need to slow that growth/clean up so we can make it to our downtime around Christmas. As much as I love working on this stuff... sometimes it's got to wait ๐ I'm closing Discord - I'll be back tonight ๐
@dawn rampart it does sound like flash issues. is it qspi or spi?
qspi
I bought and put in the W25Q16JV
Okay - I'll try reworking it tonight. I double checked that my layout/schematic are identical to the itsy bisty m4 and checking the doc for the chip it looks good.
There is an Arduino QSPI library which might be a double-check for you: https://github.com/adafruit/Adafruit_QSPI
you'd have to add support for that chip, though, I think
@dawn rampart I usually will use a saleae at that point to verify the data lines are all behaving as expected
@idle owl back if you wanna pypi now
@slender iron I had to google Saleae...hmmm, anyone have a few hundred bucks I could borrow. ๐ @tulip sleet I will take a look. I might just try the rework.
an oscilloscope could be used too
Is there a getting-started guide for CircuitPython on the nRF52 yet? Or really any kind of reference?
@dawn rampart there are saleae clones for $5 at the usual sources
Okay - I have access to an oscilloscope.
@vale arch there's READMEs in the ports/nrf directory in the CircuitPy source but I don't think I've seen, like, web documentation. I've usually been told support is "pre alpha or so" in here
@sudden coral Thanks. Maybe Iโll wait a while longer before investigating.
I'll say that so far the nRF52840 port seems basically rock solid pending whether the issue I had above is device-specific or not (I'm not thinking it is). The Feather nRF52832 port is functionally solid as long as what you're doing is supported by the HW (read: basically nothing over USB unless you want to bitbang it over a breakout)
@dawn rampart Saleae offers multiple discounts on the logic 8 for students, enthusiasts and startups https://blog.saleae.com/saleae-discounts/.
I would highly recommend one buying one from them as it's an invaluable tool. Well worth the price, even without the discounts.
Unlike buying the clones if you buy from Saleae you're supporting the development of the Logic software that makes the whole thing useful.
We offer discounts for: Students Electronics Enthusiasts (non-commercial use) Small Startups Independent Contractors Standard Pricing Student Pricing Enthusiast Pricing Startup/Contractor Pricing Logic 8 $399 $199 $199 $299...
I'll take a look at the discounts.
Only the argument parsing done below should be in this file. The above should go in shared-module. Please also document everything below with the //| rst style so it appears in sphinx.
These structs should go into shared-module as well. This header should only extern it. It should also declare any functions called.
This is done to mirror the common-hal structure where each port actually implements the struct and methods.
@vale arch like was said, nRF52840 is still early alpha. However, ladayada did do a guide on getting the bootloader/firmware onto the Dev Kit (PN: PCA10056DK): https://learn.adafruit.com/circuitpython-on-the-nrf52/nrf52840-bootloader Not too sure how exportable it would be to any other boards that may be available (are there any non-homegown?).
@idle owl at my desk for a few hours
If your looking for something to do, I would love for tft stuff in CP like the hallowing and feather joypad wing
thats on my list after audio mixing
๐
it got bumped so we can ship circuitpython on something new coming
i can use them with arduino so it not like they are useless, but i really enjoy CP
@tough flax for when you get a chance:
https://github.com/caternuson/SipPuff/blob/master/sipnpuff.py
Adafruit CircuitPython 3.0.2 on 2018-09-14; Adafruit Trinket M0 with samd21e18
>>> import sipnpuff
puff count = 6
puff count = 22
sip count = 18
sip count = 41
@slender iron If you're still free, I'm around.
k in the voice chat
OnDiskBitmap solves this by loading pixels off the filesystem when needed.
I'm going to try and add this tomorrow. How many steps between zero and midpoint are needed during the 30ms ramp? I've gotta generate a sample for it under the hood. Should I ramp to the value at the start of the sample instead?
For those following along at home...Mini SAM M4 Update. I removed the 2 MiB flash chip and tried plugging in Mini SAM to the Windows 10 PC...and it registered nothing. No USB device shows up. If I change to BOOT mode, works as expected. Back to CIRCUITPY mode and nothing. I wish I remember, but I think I got a magenta LEG on the APA102 status light. During the chip removal process the markings on the top faded enough I couldn't tell which pin was #1 any more, so I put a new 2 MiB chip back on. Plugged it in and it is back to where it was before. D: and F: drive. REPL works.
BTW - in case others are wondering, this is the most fun project I've done in a while. I love this type of work.
@tidal kiln - that's awesome - have you hooked up a hose & tested it? Any idea how fast it can track accurately?
Flash chips are all new to me. I'm going to investigate the W25Q16JV settings in https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/external_flash/devices.h
@tough flax i repurposed some heat shrink for a hose connection. in terms of speed - it seems pretty responsive, but i have no reference for what is expected. the basic code idea is the same as lipsync - just a polling loop with threshold checks.
AHA!
I think step one would be to get a good measurement of how fast we can accurately get good dots and dashes using this approach. I tend to think it'll be insufficient with the sleeps.
So, the goal is 60 words per minute. Avg 5 letters per word. That's 300 letters/minute or 5/sec. At average 3.5 dots or dashes per letter that's alot
how are sip/puffs translated into dot/dashes?
sip is dot and puff is dash
or vice versa
and technically they're call "dits" and "dahs"
I was using this exact flash: W25Q16JVUXIM - the IM version has a different mem_type. Added it to boards.h and voila! Memory working, CIRCUITPY reporting as 1.97MB
Thinking about possibly asking about an #AssistiveTech topic - thoughts?
then we can make it faster. the lipsync code had the approach of accumulating counts, and then doing different things for different counts:
https://github.com/makersmakingchange/LipSync/blob/master/Software/LipSync_Firmware/LipSync_Firmware.ino#L404
3 dots / letter * 5 letters /sec = 15 dots / sec
that's really fast though
Yup - we need to do track rising and falling edges. - Interrupts or not, we need to restructure that.
Very few can get to 60 WPM, but it's doable (did you read Jim's page?)
no, i did not. is it linked from the lipsync pages?
Hold on
Computer Access for quadriplegics. As a ventilator dependent quadriplegics I use computers by sip and puff morse codes
agree. it will need to be fancier than simple thresholding:
https://github.com/caternuson/SipPuff/blob/master/sipnpuff_morse.py
I've had success with letting people set thresholds by example (long-sip, press button, then long-puff, press button, then set thresholds at 1/2 way to each).
that sounds more like the first code.
as for the timing, we need a running loop watching for rises and falls and checking against monotonic()
With the switch router, we had a separate mode for tuning where we figured out the thresholds.
When we're actually working, we run fast & use monotonic()
Timing of each dit/dah isn't important as long as we don't miss a transition. we just need to know when to stop and calculate a character
So, for his current setting he has an "accept time". If it's idle for that long, the character is done.
Gotta keep track of the current state and how long it's been there. - three options (sip/puff/idle) + a monotonic() when we got there.
i hate to derail, but:
how do i remove elements from a 2d array?
this is the array:
(
(0.000000,1.000000,0.000000,0.000000),
(0.000000,0.000000,1.000000,-0.000000),
(0.000000,-0.000000,0.000000,1.000000),
(1.000000,0.000000,0.000000,0.000000)
)
I've tried
RotationMatrix = Transform[0:3 , 1:4]
but it complains: TypeError: tuple indices must be integers or slices, not tuple
I know how to do it in APL, but not in Python.
tuples are immutable
use a list instead
[] instead of ()
but "remove" = delete? or just access them?
i need to delete the last array, and the first element from each of the nested arrays
i tried () but it complained about invalid syntax..?
if you need to modify the data, then use a list
>>> data1 = (1,2,3)
>>> data1[0] = 42
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> data2 = [1,2,3]
>>> data2[0] = 42
>>> data2
[42, 2, 3]
>>>
What are your plans tomorrow @tidal kiln?
How would you like me to coordinate this? Want to add me to the project? fork it? make my own?
i'd go with making your own
i'm not sure what i have is worth forking, you can just start new
and when/if i can help, i can PR to your project
So, let me pull together some code before I sleep - not much (I'm beat). I'll assemble the board tomorrow, and we can make progress
sounds good
you can totally take the code in that repo if you want
it's just so nascent i don't really think it's a true project worth forking
@dawn rampart Congrats! I put in a comment about the different types - hope that helped.
I'll pull together enough to get the idea - it won't work until I assemble the board, but it should help
So i rebased and fixed the conflicts, then used git push --force-with-lease to my repo and it didn't triggered Travis, am i missing something?
@tulip sleet - I was going to submit a pull request, but if you just want to update on your end, that works too.
@scarlet fjord
>>> data = [
... [1, 2, 3, 4] ,
... [5, 6, 7, 8] ,
... [9, 10, 11, 12] ,
... [13, 14, 15, 16]
... ]
>>> data
[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]
to delete the last "array":
>>> del data[-1]
>>> data
[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
>>>
to delete first element (probably a better way):
>>> for d in data:
... d.pop(0)
...
1
5
9
>>> data
[[2, 3, 4], [6, 7, 8], [10, 11, 12]]
>>>
@dawn rampart please submit a PR or an issue, thanks, helps us not forget
awesome! that worked ๐
Given the recommended playback of 22k samples/sec, that would be 660 sample steps minimum. That's ~2.5mV per step to reach a 1.65V midpoint.
A slow ramp from the current DAC output to the value at the beginning of the sample to be played is an excellent approach and anticipates poorly edited samples. I recommend keeping the ramp steps at no greater than ~2.5mV even though it could take up to 60ms in the extreme case.
Stop, Pause, and Resume would also benefit from the ramp approach. Res...
np. i'm pretty sure my solution is fairly hackish. if you're doing a lot of this, then something like numpy may have some fancier tools.
its not a realtime script so performance doesnt much matter ๐
but it could provide some more capable and easier to use tools for slicing and dicing data
@C47D There are still reported conflicts, so make sure you have fetched the latest commits. I think that's why travis didn't run. We don't mind merges instead of rebases if that's easier for ou.
In the ports/atmel-samd/external_flash/devices.h file, the current settings for the W25Q16JV only list one device with one .memory_type 0x40. Suggest splitting into IQ and IM versions of the chip with different memory types.
`// Settings for the Winbond W25Q16JV 2MiB SPI flash. Note that JV-IQ has a different .memory_type (0x40)
// Datasheet: https://www.winbond.com/resource-files/w25q16jv spi revf 05092017.pdf
#define W25Q16JV_IQ {
.total_size = (1 << 21), /* 2 MiB */
...
ok, moving on to a new problem. this 3x3 matrix is a rotation/scale, and i need to convert that to x/y/z rotation, which i found code for, but it gives me this error:
Transform Rotation matrix:
[[1.0, 0.0, 0.0], [0.0, 1.0, -0.0], [-0.0, 0.0, 1.0]]
Traceback (most recent call last):
File "C:\Workspace\Assets\Blender Scripts\TestArray.blend\foo.py", line 114, in <module>
File "C:\Workspace\Assets\Blender Scripts\TestArray.blend\foo.py", line 73, in DoTransformArray
File "C:\Workspace\Assets\Blender Scripts\TestArray.blend\foo.py", line 99, in rotationMatrixToEulerAngles
TypeError: list indices must be integers or slices, not tuple
Error: Python script fail, look in the console for now...
code:
def rotationMatrixToEulerAngles(R) :
sy = math.sqrt(R[0,0] * R[0,0] + R[1,0] * R[1,0])
RotationMatrix = [[1.0, 0.0, 0.0], [0.0, 1.0, -0.0], [-0.0, 0.0, 1.0]]
rotationMatrixToEulerAngles(RotationMatrix)
now, im pretty sure im using [], which is what I should be using, but... im lost again ๐
do i have to make some temp variables using that same code you sent before?
Hi @dhalbert, indeed the problem was some commit from adafruit master, i updated some strings and Travis is now running, still have a lot to learn about git hehe.
yep, ok... its not clean, but it works:
R0 = R[0]
R1 = R[1]
R00 = R0[0]
R10 = R1[0]
sy = math.sqrt((R00 * R00) + (R10 * R10))
change R[0,0] to R[0][0] similar for others
oh! thanks ๐
@tidal kiln that's more what I was thinking
ignore "sendCode()" for now - just know that it will lookup the right code in lookup tables (which will be configurable)
cool. will look. and my latest iter...
https://github.com/caternuson/SipPuff/blob/master/sipnpuff_morse.py
Similar - I'm shifting bits into a character which will be used to index into a dict or the like
I'm hoping to be able to run this on a Trinket so I'm thinking small ๐
But I'm fine if M4's what we can do
that's why, for now, i'm testing on trinket m0 ๐
Similar approach - just you're bulding a string, not an int
if size is an issue, but M4 would help, how about the itsy?
That's what I'm building tomorrow
I just had to head home before I could wire it up
m4 Itsy + sensor
Right now I'm just working in idle and syntax checking
I think that's what I can do for tonight... tomorrow I am able to work on this until 1:15 EDT. Then after 9pm
ok. feel free to ping me when you want. may be working on other stuff. but happy to help when i can.
but also, these modern tools make async collaboration much easier
Yes, if my code runs (what I sent you) on the setup in the morning, I'll setup a GitHub project page under the ATMakersOrg
caternuson on github, right?
i think it might not get successive dit / dahs? from my quick scan...
yep. that's me on github
You have to have an idle in this code (holding DIT longer doesn't matter)
I'll talk to Jim about what really happens
What probably doesn't work is DIT->DAH without an idle
But we can fix that
Do you have it working w/the device?
does it work by allowing successive DIT (or DAH)s to be generated by holding breath?
This code won't do that - I will ask Jim, but I don't think that's part of the normal A-Z style stuff
It is used like that on the mouse mode
which will be separate
We'll have at least 3 modes - Tuning, Typeing, and Mousing
Jim is in your neck of the woods so at some point perhaps you can meet him
i'm in same neck of woods as scott
Yes - Jim's just north of Seattle - I'm in Tampa
hey @tidal kiln I'm looking here and I see my most recent changes; can you take another peek?
https://github.com/adafruit/Adafruit_CircuitPython_MAX31856/pull/1/commits/efc9b8f6c8233876ee7be95fc5d261e1f67d5672
bah.. pushing a small fix
ok, saul goodman
it's here now: https://github.com/adafruit/Adafruit_CircuitPython_MAX31856/pull/1/commits/6faaf6621611886c5b470c240a8d9b43aa8bb120
Just built current master for pca10059 - after copying .uf2 to board, CIRCUITPY appears for awhile, but
cannot access REPL -- screen /dev/ttyACM0 115200 attaches for awhile, then disconnects -- a few minutes later CIRCUITPY also disappears.
[211289.957497] usb-storage 3-3.2.4:1.2: USB Mass Storage device detected
[211289.957836] scsi host7: usb-storage 3-3.2.4:1.2
[211289.959843] input: Adafruit Industries CircuitPy nRF52 as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.2/3-3.2.4/3...
Build for feather_nrf528232 works OK.
FWIW - I have verified the settings for the _IM variant. This is what I used on my board and it works very well.
Tried rebuilding and flashing latest nrf52 Bootloader to pca10059 Dongle -- same result
Also tried on the PCA10056 DK - same result as PCA10059.
For this I also used the latest bootloader.
Reverted PCA10056 DK to build from 20180921 and it works OK
Same for PCA10056 Dongle -- 20180921 build works
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha.1-2-gf2c960e89 on 2018-09-21; PCA10059 nRF52840 Dongle with nRF52840
>>>
@gentle bronze @tulip sleet the current master appears to have broken the build for the nRF52840 (pca10056 and pca10059) have you been able to get it to work with these? I did build/load the latest bootlaoders as well.
It builds OK -- just does not work....
@solar whale hmm, let me check
Thanks!
@solar whale did you update submodules?
repl doesn't; CIRCUITPY is still tehre
give it time -- it will go away ....
This may be due to @gentle bronze UART work or updated submodules. We can let him debug for now
tooks several minutes for CIRCUITPY for disconnect..... thnask for confirming. No problem waiting for diagnosis, just wanted to make sure it was not something I did wrong.
BTW - current master OK on Metro_m4, PIRkey and feather_nrf52832 -- issues appear to be limited to 52840.
it appears to be one of the submodules; if I roll back to the commit before the uart fixes but do NOT revert the submodules to their previous versions, then it works ok. Now I'll narrow it down to nrfx or tinyusb
I can't update one without the other. @gentle bronze if I roll back nrfx and lib/tinyusb to the versions before the updates, then it works.
@tulip sleet yeah, nrfx did change something with clock and power in latest version, I am rolling it back as well
hold on
was too focus on testing nrf uarte, nrfx later version fix some bug with uarte, thus I upgraded it
if we can adapt to the clock & power fixes, that's fine too
it could be some wip in my usb stack as well
I did make some changes for arduino lately
may break something, didn't test again with uart io, just edit the code, since latest nrfx change some enum name
seem to be the case with tinyusb wip , hold on, I will comment out those code and push the fix. sorry for the issue ๐ฆ
@gentle bronze no worries! Always good to see the WIP activity! Thanks for looking into it. I have to go off for awhile -- I'll be happy to test updates later today if availalbe. No rush. I have plenty of other things to do ๐
due to an cdc flush on write added recently for arduino (not tested on cpython).
Note; happened to update nrfx to 1.3.1 as well.
I comment out the wip on tinyusb and make the push. I will re-add and tested it later. Was adding while test Arduino.
happen to update nrfx to 1.3.1 as well ๐
@gentle bronze tested your new branch - looks good! I'll merge after travix is finished
Hi there,
I'm starting with CircutPy and trying to dump json data over UART to PC. I've tried importing ujson but I don't think it is included in the build. Is there an option to add/install it?
Using: Trinket M0
Version: 4.0 alpha 1
@pastel panther can you make another commit to your MAX repo? it can be trivial - just need it to kick travis. it looks like that repo was not enabled on travis. i've done that now, but can't figure out how to make it force a build on your latest commit. 6faaf66
cool. and travis is churning....
weeeeeee
thanks
welcome to the world of linting ๐
do you know how to read all that and fix?
hmm.. I'll have to adjust my vimrc for CP projectss
@tidal kiln I can run pylint locally, right?
if you want. or just make the changes and commit and let travis check again.
ooh, it looks like the pylint I installed with vs code is already running automatically and highlighting the wrongthink
@solar whale I'm pretty late (west coast time!) But wanted to chime in about NRF52840 experiences. I had the broken REPL problem as well intermittently. Changing baud from 11-whatever to 9600 fixed it for me, though I have other issues with that chip that I discussed in here yesterday (I've now isolated it to "probably a board issue")
This was all on a Seeed NRF52840 MDK that I ported myself (basically uses Feather code but trivial changes to pinout)
Cc/fyi @gentle bronze @tulip sleet
My issues with freezes on import on this device I discussed in here yesterday are now confirmed not to be RAM related - I have like 170k free at time of crash. Seems to be a CPU loop, because dmesg on the host reports all the devices (HID, serial,...) timing out and failing to respond to anything. I tried rebasing off CPY 4.0.0-alpha and ran into git submodule misery so I'm basically stuck until I figure out a workaround there (can shell script around it in my build process)
I can confirm that. I had flashed a pca10059 some days ago, and it works. Today, I updated my local rep, and flashed a new stick, and I have the same problems. It seems that the latest commits to lib/tinyusb broke the nrf port for nRF52840.
Fixed by #1241. Pull the latest and see if it works for you.
make sure you git submodule update after pulling
I had the broken REPL problem as well intermittently after rebasing my CircuitPython fork off master. Changing baud from 11-whatever to 9600 fixed it for me, though on rare occasion the device flips back to the higher baud.......
I get the device freezes/hard locks when importing a heavy module, though - feels like something hitting a while True loop, though I know it's probably not :) otherwise at 9600 I can while True: print to REPL literally all day (confirmed by leaving mine running wh...
Oops, in the time it took me to write that, this was closed. Heh :)
Ok so I have a list being generated and saved to a variable. I have another variable that randomises the order of the list, generates a new list in a random order. I can cycle through each of these lists. However, I want the option to generate a random single member of the list, new each time, implying the possibility that it will be two of the same thing in a row.
And I have no idea how do do that.
are you just trying to get a random item from a list?
yes.
We have a random function, right? list[I] = list_2[random()]
random.choice(your_list)
^^ yah. take a look at that.
Fine..do it the easy way. ๐
It being random though there is a chance you'll get the same thing twice, I belive
Yes that's ok
>>> foo = ["red", "green", "blue", "burnt umber", "bisque"]
>>> random.choice(foo)
'red'
>>>
@raven canopy most times I try and do something interesting with a list, it's already there and likely done better
works on the pca10059 Dongle
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha.1-57-g7b95818c4 on 2018-10-05; PCA10059 nRF52840 Dongle with nRF52840
>>>
>>>
>>>
>>>
>>>
and on the pca10056 DK
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha.1-57-g7b95818c4 on 2018-10-05; PCA10056 nRF52840-DK with n...
so the issue is, I have code that's cycling through the entire list
I'm not sure how to get it to grab a different thing each time
what is the cycle?
oh..you want to go through the entire list. but in a random order?
no
I already have that
ok let me ask you this before we head down this rabbit hole
Hypothetically, if you're doing a slide show on your Hallowing, and you want it to be in a "random" order, do you really want it random in the sense that it's a mystery what it will grab next and could be the same image it just showed? Or are you ok with it randomising the list each time and cycling through it.
Kind of thinking maybe that's good enough, that we don't need two versions of random.
I would just shuffle the list once and go through it
because I'm also not sure how to even tell whether this is working without staring at it for an hour and waiting to see if the same image pops up twice. ๐
i think it could be either
Well randomising the list, cycling through it, randomising it again and repeating is apparently way easier.
since I already have it working.
you can test it by printing out the shuffled indexes as a list each time and then diffing them
slideshow software would typically have settings for picking the behavior
it will have settings yes.
I agree with @pastel panther. Shuffle once. Although, you could use a while during shuffle to ensure no duplicates...
ok two votes for the code I already have working. bonus for me.
^^ agree. just pick one behavior. that one.
three!
my cats agree so thats six
bummer. CP doesn't implement shuffle
>>> dir(random)
['__name__', 'seed', 'getrandbits', 'randrange', 'randint', 'choice', 'random', 'uniform']
>>>
hey @idle owl have you heard anything about cap touch on the m4? I neeeds it and I don't want to have to add a seesaw if I don't have to
It's Weird โข . Really different from the M0, it wasn't as simple as porting over touchio. It's not really a priority so we haven't been working on it.
do you really need m4 for it? the m0 has it.
To be honest, I'm not sure but I have a fair amount in mind for the next board rev like graphics, audio and lots of blinkies
plus I have a bunch of m4s and only one or two m0s
Ok another question. I'm currently looping indefinitely, and I'm not sure how to go through it only once.
the difference in amount of code you can write / libs you can use on the m4 is pretty amazing.
it's practically a Real Computer
i += 1
i %= len(cycle)```is the code that I think is making it loop indefinitely. It's inside a `while True:`
may need to see more of the code
blergh. ok, I'll do a gist. I don't have a repo for it or anything.
i don't s'pose you could just do for foo in things:?
oh right
maybe?
This is destined for a helper library, for what that's worth.
For which I will likely need moar help.... ๐
for c in cycle:?
because I need loop or not to be an option to set. I was hoping to keep everything in the slide_show constructor but I'm not sure how to do that here.
i'd kinda pull the while out of image_display and do like for image in cycle:
then call image_display repeatedly only if it's supposed to loop forever?
something like that.
I added the while because it whinged about the continue outside a loop.
hmm ok
what is image in that though?
iteratorfoo
lemme fork this real quick and sketch out what i mean. :)
right but it's now an unreferenced variable... should I do _ instead?
that works actually
image would be an item in cycle
the slide show is just going through a supplied list of images and showing them
right, but image is a variable if you put it there
and there's no image=something elsewhere
using _ worked
random vs. not random can be done by just how you create the supplied list
i was just thinking something like this: https://gist.github.com/brennen/0aab25d058ca8bc4666cdddf3d620cef
doesn't let you use del the same way though
ah which it needs to for the code to run with unsupported images
oh. theres another sequencey thing, displayio.Group()
so you add it, display it, then pop it back off? is that how it works?
splash.append(face)
board.DISPLAY.wait_for_frame()
splash.pop()
I seriously feel like there's some other way to call i and it will not loop, this all feels like overengineering it, but I also felt today like I forgot everything I knew about Python for a bit there, so I could be entirely wrong
yes
At least I kinda think that's how it works. Scott had to explain it all to me last night and I was fuzzy on it
i mean, with your existing code, you could always just conditionalize the i %= len(cycle) bit.
do that if loop_forever or something, otherwise not.
maybe refactor image_display to work on just one image, and not a sequence
(also, why the heck did i think python didn't have += style assignment operators?)
it has that, but not ++
I've got a mate who falls into that category too. It's kind of crazy. He's also dropped off for a bit, as he does from time to time.
Otherwise this would be running using a generator already ๐
@idle owl i'm 96.3% just thinking out loud...i haven't really looked at this displayio api myself yet.
I feel like that isn't entirely relevant to making it work on one image at a time though... but I don't understand it.
is all that's needed to play along is use a 4.0 alpha build?
Um.. I think so? If you're really playing along, you'd need a hollowing and some .bmp images too
got the board. are the .bmp's somewhere?
I can drop them to you in Discord DM so I'm not spamming this
Ok, so the plan is a slideshow of images you put on your board, and you're able to specify:
- the folder it's in,
- whether or not it continues to loop through the images
- whether they're in order, alphabetical, or random (I feel like in order/alphabetical are the same thing according to the code, so I don't think these actually need to be separate)
- how long each image shows for
OMG. THESE KITTEHZ!!!
I made all of those before Maker Faire ๐
Scott had cat pictures on his so I went with that instead of Circuit Playground characters. Which we already had.
OH
I MADE IT STOP AFTER THE LOOP
So if you call slide_show() the way I just changed it not in a while True: loop, it only goes once.
oh I didn't even need to change it from what we had
just not calling it in a loop ๐คฆ
sighs loudly at herself
So what's the benefit or for _ in cycle: vs say for i in range(len(cycle)): or while True: ?
hmmm. no kitteh :(
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha.1 on 2018-09-21; HalloWing M0 Express with samd21g18
>>> import board
>>> import displayio
>>> import pulseio
>>> backlight = pulseio.PWMOut(board.TFT_BACKLIGHT)
>>> splash = displayio.Group()
>>> board.DISPLAY.show(splash)
>>> with open("kitten1.bmp", "rb") as f:
... odb = displayio.OnDiskBitmap(f)
...
>>> face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0))
>>> splash.append(face)
>>> backlight.duty_cycle = 2**15
>>>
@idle owl kind of hard to generalize about those patterns, i think - sort of depends on what you're trying to accomplish.
hmm
i think of for foo in bar: as the fairly standard pythonic way to iterate over a list, but i haven't actually written all that much python so my opinions are probably suspect.
trying to accomplish the above requirements
that sounds right brennen
which we're basically doing so
ok
probably some memory considerations
(i.e., for foo in bar: makes a copy, i think, so if you're dealing with some large structure and memory is tight, you're probably better off indexing into the list.)
hey folks, I saw you guys were working on some code together an I thought I would mention this site I ended up doing some coaching with someone on:
https://codeshare.io/
you can do simultaneous editing like etherpad or google wave/docs
RAM wise the most efficient is roughly counter = 0; len_list = len(mylist); while counter < len_list: (do thing); counter += 1 IIRC
@idle owl ^ but speaking strictly of readability for _ in cycle is definitely nicer ๐
hmm
I mean, I'm wondering if efficiency is more important, this is going to be a helper lib anyway
@idle owl any idea why no kitteh? i think i pulled out the basics from your gist.
Not sure. I've never tried it in the REPL or with only one image, so I have no idea what the syntax there is
if the files got weird, it won't work, I know that
can see the bmps on my PC - so there at least OK there
and didn't get any read errors
Then I'm not sure at all
can you try above and see if you get kitteh?
I want kitteh
@tidal kiln you closed the bmp file
๐ฟ
it should error in that case ๐
oh! good catch. yah. it's all within the context manager...
ah ok
hang on kitteh! i tries agin!
it does read it as needed so it needs to stay open
KITTEH!!!!
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha.1 on 2018-09-21; HalloWing M0 Express with samd21g18
>>> import board
>>> import displayio
>>> import pulseio
>>> backlight = pulseio.PWMOut(board.TFT_BACKLIGHT)
>>> splash = displayio.Group()
>>> board.DISPLAY.show(splash)
>>> with open("kitten1.bmp", "rb") as f:
... odb = displayio.OnDiskBitmap(f)
... face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0))
... splash.append(face)
... backlight.duty_cycle = 2**15
... board.DISPLAY.wait_for_frame()
...
0
>>>
๐บ
thanks @slender iron
@sudden coral Why does this work: python def image_display(cycle): i = 0 counter = 0 len_images = len(cycle) while counter < len_images: with open(cycle[i], "rb") as f: try: odb = displayio.OnDiskBitmap(f) except ValueError: print("Image unsupported {}".format(cycle[i])) del cycle[i] continue face = displayio.Sprite(odb, pixel_shader=displayio.ColorConverter(), position=(0, 0)) splash.append(face) board.DISPLAY.wait_for_frame() for b in range(100): backlight.duty_cycle = b * max_brightness // 100 time.sleep(0.01) i += 1 i %= len(cycle) for b in range(50, -1, -1): backlight.duty_cycle = b * max_brightness // 100 time.sleep(0.005) splash.pop() counter += 1
That little orange kitten with its paws up is kind of my fave of the bunch.
Also, it loops now even outside a while True loop, so maybe that doesn't work so well for what I need.
Oh I added a separate counter variable and now it acts like it was.
Edited.
Hold up, what am I comparing against to answer why that works but something else didn't? The above-linked gist?
Oh, no it's not that something else didn't
(sorry I'm at work, so a liiiiiitle slow to see these things ๐ )
I simply don't understand why your suggestion works ๐
(no problem, I totally understand.. thank you for taking any time at all!)
The loop in there is basically a really long winded version of a C/Java/Javascript/almost-every-other-language for loop, where we'd write for (var i=0; i<some_huge_number; i++), to take JavaScript for an example. Python (to my knowledge?) doesn't support that, so the manual hackaround with a while loop lets you access the list by indexes to save perhaps a few bytes of RAM here or there (which normally is completely overkill but depending on MCU may matter here?)
It's an M0 with a lot of flash space, so there's a lot of space for files, but the RAM is, as far as I understand it, limited to the M0 limitation, so I figured it might be worth it to try to be more efficient.
I know in CPython for blah in big_list is implemented as a view object that is no-copy, I'm not at all sure about MicroPython. The overhead from that syntax comes from the iteration object magic under the hood (__iter__ and __next__ magic methods)
@sudden coral of course python has for loops
C-style? I only know of for blah in blah2 syntax. I'd love to be wrong!
@sudden coral for index, image in enumerate(cycle):
however, removing items from a list you are iterating over is a big no-no
ah, yeah, I make heavy use of that, but IIRC that's still RAM-heavier than the while loop, so if we're really crunching for RAM, the C-style loop (or while workaround) is probalby still better. M0 has like 32K RAM unlike the huge boards I work on like NRF ๐
for some values of better
ask n programmers for a technique, get n+1 techniques back. :D
ok so is using for _ in cycle: good enough then?
haha, I found 3k @tulip sleet. we were freezing in the stepper tests
Nicely done!
@idle owl probably - and certainly more readable ๐
holy moly!
concur.
ok I'll stick with that then.
3k for crickit boards at least
aha, we got rid of examples/ in the lib builds, but not tests/
ya, just added that to the same list
@idle owl as long as you are not using gettext...
I do not believe I am.
or plan to add it ever
I don't know what it is, so I have no idea if we plan to....
gettext is for translations, mostly: https://en.wikipedia.org/wiki/Gettext
In computing, gettext is an internationalization and localization (i18n) system commonly used for writing multilingual programs on Unix-like computer operating systems. The most commonly used implementation of gettext is GNU gettext, released by the GNU Project in 1995.
it traditionally uses _("foo") to mark strings for translation
so if you use the _ variable for anything else...
oh
@tidal kiln is that the new bmp code?
The nRF5 chips have a proprietary rf mode, that allows them to communicate with older chips like the nRF24.
Would it be possible to support that in the nrf port?
From the nRF5 SDK documentation:
"Enhanced ShockBurst (ESB) for the nRF5 Series is a simple, lightweight protocol, that is on-air compatible with Nordic's nRF24Lxx devices. ESB for the nRF5 Series provides a simple upgrade path for nRF24Lxx based applications."
@stuck elbow yep. using the latest 4.x UF2.
I need to figure out how to get it going on one of my boards
scroll back a bit. i posted a simple example of loading and showing an image.
well, sure, but first I need the board definition matching to my display setup
ooooohhh. "my board" = one of your boards. gotcha!
yeah, I don't have any adafruit boards with displays, they never seem to be available together so that I could order them
I've noticed the CircuitPython Library Bundle doesn't have some of the latest libraries updated. I found the error in the DotStar library from here: https://github.com/adafruit/Adafruit_CircuitPython_DotStar/issues/27 and it looks like the issue was fixed, but it's not in the latest bundle builds.
@dawn rampart you are correct. @slender iron is that something we have an automated check for?
With some luck you could even make them talk to the micro:bits, which would be very cool!
@dawn rampart @tidal kiln we're adding or have added something to adabot to report on libraries with commits newer than releases. @idle owl will be following up on these.
@tidal kiln took me awhile to correctly generate .bmp but it works!
@tidal kiln or @idle owl should I be addressing all of these lint errors or can some of them be ignored/overridden? It doesn't like my ThermocoupleType class because it has no methods and the members are all single character variables
Still to implement: using both instances on nRF52840. Add uart_init() to disable on soft restart. @hathach I will take these up later.
@pastel panther my non-authority answer: you are allowed to disable specific lint complaints, and they should be accepted with justification.
how does one figure out what to call the warning/error as to ignore it?
are the single chr variables axis ('x', 'y', 'z')? i would say those are acceptable to ignore pylint.
use the wording in the pylint error. got a travis run link?
example to grab the pylint disable:
C: 55, 0: Exactly one space required before assignment
_MAX31856_CR0_REG = const(0x00)
^ (bad-whitespace) <<<<
# pylint: disable=bad-whitespace
ah yes, ok
@pastel panther yah. fix as many as you can. then disable specific ones. ideally, as few as possible.
if in doubt, i would leave it as failing pylint, and allow discussion during the PR review.
and re-enable after you disable a section. that's commonly done at the top where the const-y things are defined:
# pylint: disable=bad-whitespace
SOME_CONST = 0x42
SOME_OTHER_CONST = 0x23
# pylint: enable=bad-whitespace
one needed for SPI_Device for some reason:
https://github.com/adafruit/Adafruit_CircuitPython_CAP1188/blob/master/adafruit_cap1188/spi.py#L71
@tidal kiln my new pylint score:
https://www.youtube.com/watch?v=Q9joOlIkf6s
(I hope to god nobody seriously thinks I don't know what thyme is, and actually thought he said time)
@tidal kiln travis is greeeeen ๐
Woot!
And now I know enough about the process to do more significant tests before filing a PR.
That said, my local pylint didn't seem to catch the 'no-member' errors for some reason. ๐คท
They also seem incorrect in that they're not getting that the readinto and writes are being passed through to the underlying SPI object
anyone object to disabling framebuf in 4.x?
@solar whale nice doggo!
@slender iron is there a guide or doc for migrating from framebuf.
planned replacement
not yet @solar whale
I'm getting back to display after this audio work
For example : how would ssd1306 work?
with displayio
The problem with removing framebuf is that there is no python replacement. The python version does not support text
Sure. Iโll be happy to help. May need some guidance.
๐
I would vote remove it then. just eats up space in the interim...
ya, I am because I need the space on the cpx for mixer
Test script is:
import board
import audioio
import digitalio
import time
import array
import math
# Generate one period of sine wav. 16 bit unsigned
length = 16000 // 440
sine_wave440u = array.array("H", [0] * length * 16)
for i in range(len(sine_wave440u)):
sine_wave440u[i] = int(math.sin(math.pi * 2 * i / length) * ((2 ** 14) - 1) + 2 ** 15)
sine_wave440u = audioio.RawSample(sine_wave440u, sample_rate=16000)
length = 16000 // 880
sine_wave880u = array.ar...
@slender iron do you have some idea of what is useful for expected range of PWMOut? Revising the current nRF impl -- it wasn't doing variable freq allocation quite right, and some other stuff needed fixing. Looks like max for simple PWMOut is 16MHz/3. I can prescale clock freq,16MHz down to 125kHz and then the count-up reg can be 3..32767, so I can get pretty good resolution.
@pastel panther If you use the .pylintrc file that we use, you get a more accurate result locally. We ignore some things by default.
@idle owl hmm. pylint kinda automagically installed itself(with permission) into vs code so I'll have to figure out how to specify a config file
Pylint has an order that it looks for that file, in a particular list of places
I'm not even sure about the environment it's being executed in because it's run automatically on save by the IDE
it doesn't help that you can arbitrarily add directories to the workspace. Presumably it would at least be run from the root of the directory you're editing it from if not the directory that the file is in but who knows. Not a huge deal
The other option is to grab the pylint disable command out of .pylintrc and run the whole thing. I do that on files going into the Learn repo.
But you said it's all running automatically, so that's still not an option for you I guess
either way, you'll start to figure out what's ignored and what isn't and ignore it locally without putting a disable into your code.
so far it seems like everything is in sync except the no-member thing which I can hopefully just keep in mind
that's good at least then
can someone review this please? It should be all bueno
https://github.com/adafruit/Adafruit_CircuitPython_MAX31856/pull/1
I approved it, I'll wait on @tidal kiln to take a look since most of the changes requested were his.
okie dokie, thanks
@pastel panther me and a bowl of ice are reviewing it right now ๐
I use my hot air station but that works too. Let me tell you, the CJ in the max doesn't like to cool down in my rather hot office
I took to spraying the probe with water and putting a fan on it.
lol at first I was like "wow @tidal kiln must really like chewing on ice"
๐คฆ
were you able to go T < 0C?
no. To be honest I probably didn't go below 20C
@tidal kiln one thing to note if you're checking the threshold faults is this tidbit from the datasheet that caught me off guard:
" There is a 2ยฐC hysteresis when in comparator mode for threshold fault conditions. "
I had planned to mention that when I added an example for the thresholds
because...
>>> tc.temperature
22.7969
>>> tc.temperature
1.46875
>>> tc.temperature
1.03906
>>> tc.temperature
0.445313
>>> tc.temperature
1.04858e+06
>>> tc.temperature
1.04858e+06
it's just gotta be the conversion from the register bits when the sign bit kicks in
ya
here:
# fix sign if needed
if raw_read & 0x800000:
raw_read |= 0xFF000000
@pastel panther just as a sanity check, hooked it up to an UNO, works with that setup:
Thermocouple Temp: 23.10
Cold Junction Temp: 26.39
Thermocouple Temp: 23.10
Cold Junction Temp: 26.42
Thermocouple Temp: 22.45
Cold Junction Temp: 26.39
Thermocouple Temp: 3.99
Cold Junction Temp: 26.42
Thermocouple Temp: 4.36
Cold Junction Temp: 26.42
Thermocouple Temp: -0.68
Cold Junction Temp: 26.45
Thermocouple Temp: -1.89
Cold Junction Temp: 26.39
Thermocouple Temp: -1.84
Cold Junction Temp: 26.39
Thermocouple Temp: -1.87
Cold Junction Temp: 26.39
Thermocouple Temp: -1.89
oh, you're saying the arduino library works but the CP one doesn't
forCP i'm testing with a Feather M4 Express and CP 3.0.2
Ok, I'll use my metro m4. I have to arrange dinner and do some dishes but I'll take a look when I'm done
sure. np. and no worries. whenever's fine.
I have other stuff I want to get to so I want to put this one to bed
stares at brand new 'scope sitting on bench
@pastel panther this seems to work. see if you can verify.
@property
def temperature(self):
"""The temperature of the sensor and return its value in degrees celsius. (read-only)"""
self._perform_one_shot_measurement()
# read three bytes starting at the MSB of the
raw_read = self._read_u24(_MAX31856_LTCBH_REG)
# why not just do this first?
raw_read >>= 5
# ok, now we're dealing with a 19 bit signed integer
raw_read = raw_read - 0x080000 if raw_read & 0x040000 else raw_read
# convert to temperature
# see Table 3 in datasheet
return raw_read * 0.0078125
i think the issue is due to the difference in the variables between C and python
Not sure why you did the local "-O0". This makes the non-DSP add8signed() not be optimized. Is this a leftover from debugging or was it compiling wrong?
It looks like from this that you have to make separate calls to start or stop playing each voice. I think they could get out of sync? How about if no arg specified it plays or stops all voices?
Suppose buffer_size is an odd number or not a factor of 4. I think self->len will be too small.
@tidal kiln seems like it works! Can you explain how you figured it out?
So @tidal kiln (and everyone). Good news on the pressure sensor. Itโs just the right range of sensitivity and I think we can read it plenty fast.
On the other hand Iโm finding we probably need more math on the sip/puff detection
Something like, if the derivative shifts negative while below a threshold, count that as a sip and vice versus
Versa
Because we are not returning to idle/neutral between consecutive sips
(Or consecutive puffs)
right
And I think we need some basic smoothing on the derivative
But I think the hardware will work great!
hmm. I wonder if you almost want a threshold on the derivative
Bye inserting a 3/32 hose inside a 1/4โ hose makes a great tight fit
maybe not.. just thinking out loud here
So when the derivative shifts from up to down it can mean two things
Another sip or a release of a puff
So thereโs a threshold above which you assume itโs a release of a puff
And below which itโs a sip
I was just thinking that the difference would be that a sip would have a steeper slope than the release of a puff
Perhaps but thatโs going to be very user dependent.
right.. I think your idea is probably more universal
Basically this means that if you switch from puff to sip (space balls?) it wonโt register it until you cross that threshold
Iโm thinking this is a problem thatโs been solve on other variable inputs. @meager fog? @tulip sleet ? Anything to point us at?
Yea, I have no doubt this is a "solved" problem in other domains
Anyway itโs late but I bought Iโd post an update. The itsy m4 rocks for this
Hey folks, any idea why bossac (either from the AUR on Arch Linux or the included tools/bossac_linux) turns off the bootloader light on my Feather M4 Express, hangs for a very long time, then returns SAM-BA operation failed? (I realize it's late even by west coast standards so I totally get if this question sits here until tomorrow)
I was able to flash an M0 Express no problem the other day
Command line I'm using is mostly ripped straight out of the docs online, sudo bossac -e -w -v -R --offset=0x4000 build-feather_m4_express/firmware.bin
or does this board HAVE to flash with the U2F flash drive thingy
has it been loaded (by jlink or similar) with the uf2 bootloader?
rather does it still go into bootloader when you double tap the reset?
it goes into bootloader when I double tap reset it appears: dmesg shows an sdf drive was added. There's also /dev/ttyACM0 still as expected, so I'd think bossa would work
for consistency with how I flash other boards in this project (I target several) I'd love to use bossa but if U2F is the most stable way to flash this thing, sure, why not
do you have a url for where you found that bossa command?
hmm I was thinking the offset might be off but it looks correct (and it would probably be borked if it were wrong)
are you not getting the normal M4BOOT or whatever when you put it in bootloader mode?
it's also alluded to on page 157 of https://cdn-learn.adafruit.com/downloads/pdf/adafruit-feather-m4-express-atsamd51.pdf for what it's worth
M4BOOT being... what? a disk device?
yea
the UF2 abilities seem to be intact, I do get a disk drive when I throw this in bootloader mode. I was just trying to avoid using it if I could due to the complexity of flashing the project I have at hand (which so far targets Micropython on a PyBoard which flashes over... either DFU or pyocd, don't recall, NRF52840 which flashes over pyocd, and now this board... which would be the odd one out)
it's... looking like fixing my flash scripts to support UF2 may be my safer bet though
I see
can you still load arduino builds? If so that would at least let you know that bossac is still working
haven't tried anything arduino on this board so far. I could give it a whirl.
to be honest I haven't used bossac for circuitpython stuff in a looooong time so I'm a bit rusty. I might have an old alias lying around however..
as far as I can tell the bossac command looks good
my old alias was basically the same except it left off the offset because was using it with different chips
hmmm
this same command without the offset thing works fine to flash my m0 express, which just adds to the confusion
I think without the offset it's going to overwrite the bootloader but it should work? I think?
I think I'd really rather not have to crack out my JLINK (or rather, learn how to use it to begin with) to recover bootloader if I screw this up ๐
I'll just add UF2 support to my application if it comes to that.
the jlink is your friend
seriously I use mine all the time, it's nothing to be scared of
and of course they're irreplaceable for debugging
I'm not gonna lie - I write python for a living, but microcontrollers are something I've only recently gotten into (of course I jumped WAY off the deep end of doing advanced stuff with them right off the bat, go figure). I realize I'll have to learn how to use the thing, but midnight-thirty on a Friday is likely not my best time to do so lol
hah
For now, the entire idea of the JLINK is a black box of magic
we're not so different; I'm a ruby guy by day, trying to re-learn some of the stuff I learned in school a loooooong time ago
i did python for my day job in a previous life but most of that I've forgotten too
welp, uf2 flash worked perfectly, got my custom build of circuitpython on the device that way
soooooo I'll go with the thing that works I guess?
the one upside to bossac is you don't have to touch the hardware
but yea, I'd say go with what works until you can get bossac to work. When the geniuses wake up I'm sure they'll have something insightful to share
and 'grats on getting the custom build going. Is it your first time?
on this board, yeah, they just came in today. I've been flashing.... pretty crazy MPY/CPY builds for the past few weeks. Ported (it's hacky and partially unstable) CPY to the MakerDiary NRF52840 SDK, started a MicroPython port to STM32F3....
jumped way in the deep end for not being an embedded stuff guy
sounds like fun
all out of necessity for this particular project (which will end up in #show-and-tell and reddit eventually)
noice
the suuuuuper high level tl;dr (since I've discussed in this channel before, cat's already out of the bag) is a mechanical keyboard firmware
cool; I think scott has a CP powered keyboard, but I think it's wired
I've been meaning to get around to building a mechanical keyboard but it would be replacing my kinesis which seems like a hard act to follow
if you can adjust to layer switching instead of just having 25987543 keyswitches all present (the kinesis is a beast of a board IIRC), I can totally recommend the Keebio Iris or Levinson (both QMK boards, though I've got stuff in the works to convert them to this python firmware. more spoilers... oops). Solid, inexpensive, super flexible
The iris is a bit closer to what you'd be used to with the few thumb buttons. But anyway, this is now a bit o/t, my bad ๐
The iris is pretty nice though one thing that the kinesis has that I haven't seen on many (if any) DIY keyboards is the tenting legs and palm rests
we're talking about CP powered keyboards at 1am-ish so I think it's all good ๐
a few ergodoxes have tenting legs and palm rests - I used to own an Ergodox EZ which came with both. I sold the board but kept the palm rests, lol
I am in fact using them right now with my Iris
new problem, perhaps for @tulip sleet when he's online next: I've identified the problem that I'm having on project import. The NRF52840 didn't show me the error message (and froze the board hard), but the M4 Express shows me an error message and recovers correctly. I'm hitting a max recursion depth error when importing the entrypoint of my project, YIKES! It seems sys.setrecursionlimit is not implemented in either MicroPython core or in CircuitPython for probably obvious reasons, so I'm genuinely unsure how to work around this short of writing some sort of AST parser on the host that scans all imports and crunches them down into a single Py file (if this idea sounds familiar it's loosely what Webpack does in JavaScript land)
however if I copy paste every single line of my entrypoint into REPL the project runs perfectly -I just can't do the shortcut from mything import main without crashing (which means I'm probably teetering within an import or two of the hard limit on CPY)
have fewer levels of function calls
there's VERY few actual function calls of my own in this import/boot process
the recursion depth is presumably coming from __import__ under the hood
hey @stuck elbow , how do I load a bitmap onto my ili9341?
or rather I think I mean how do I do so without going through it bit by bit
@pastel panther I do it like this: http://paste.sheep.art.pl/83d50e7a-70d3-4af2-8530-bddfefb6e5b5
Thanks, it works now. But on the way, I encountered another oddity: storage.erase_filesystem() only restarts the board, but does not erase/format the drive. Its contents remain untouched.
Per https://forum.micropython.org/viewtopic.php?t=3091#p18224 I found out the recursion depth max on M4 Express is 16. So somehow my import chain is hitting 16 levels of recursion. Oh boy.
pyboard limit is a whopping 63 though, allegedly, so this limitation seems goofy on atmel. I'll take a look in the morning to see what I can do to get out of this hole.
It looks like the filesystem_init() for the nrf does not use the "force_create" argument -- opening a new issue for this
It looks like the storage.filesystem() erase was not fully implemented on the nrf port
the nrf port passed the argument to do a "force_create"
https://github.com/adafruit/circuitpython/blob/master/ports/nrf/common-hal/storage/__init__.c#L44
but it is not used by filesystem_init()
nrf port
https://github.com/adafruit/circuitpython/blob/master/ports/nrf/supervisor/filesystem.c#L39
atmel port
https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/supervisor/filesyste...
When I tried to enable the @micropython.arm_thumb decorator for the nrf port, the compilation failed with many pointer type errors, such as the one below:
In file included from ../../py/reader.h:29:0,
from ../../py/lexer.h:33,
from ../../py/emit.h:29,
from ../../py/emitinlinethumb.c:33:
../../py/obj.h:651:10: note: expected 'const compressed_string_t * {aka const struct <anonymous> *}' but argument is of type 'const char *'
mp...
storage.erase_filesystem() passes 2 arguments to filesystem_init but the second was not implemented for the nrf ports. This argument "force_create" is used to force the creation (erasure) of the file system on demand from the REPL.
Note - the nrf port only uses "internal_filesystem" at this time.
tested on pca10059 and feather_nrf52832.
@sudden coral I canโt stay online but you can increase the stack size. Thereโs an open issue about stack size that will pony you to the #define to change.
The micro:bits have a python module "radio", that implements the Nordic Gazell protocol.
This is different from the nRF24 protocol, but would maybe also a nice addition. The Gazell protocol is meant to be used in star topology, using one (always powered) hub, and up to eight (sometimes sleeping) nodes.
Ideal for building your own mice and keyboards.
I just don't know how difficult it would be to port that from Micro:Bit to circuitpython.
hey! may I ask if there is any news on asyncio?? I am writing button and touch for my gui. I am considering how to make the library easy to use by other people (touch screen and button passing to gui objects etc) is there any progress or suspected api for the module??
@marble hornet no news lately that i recall.
Why is discord so against auto scroll ๐
No idea what your talking about i can auto scroll without an issue
Your channels stay scrolled to newest messages even when inactive?
Oh jeez thought I was in general
hehe. i was about to request moving the convo. ๐
thanks @raven canopy
@pastel panther it was some guessing on my part, so i may not be the best person to explain it. but has to do with 2s complement and subtleties of differences between implicit casting in C and whatever Python does.
for example, in the arduino library, there's an implicit cast from uint32_t to int32_t here:
https://github.com/adafruit/Adafruit_MAX31856/blob/master/Adafruit_MAX31856.cpp#L135
followed by an implicit cast from int32_t to float here:
https://github.com/adafruit/Adafruit_MAX31856/blob/master/Adafruit_MAX31856.cpp#L142
so there's some buried magic there that won't happen in python
also - the datasheet could be better, instead of describing the temperature format, it just says look at Table 3, so you have to infer it from there.
also also - you'll need to do a similar fix in your reference_temperature func. there may be a way to do this using struct.unpack, but my bit ninja skills are not that good
@tidal kiln ok, thanks. Based on your suggestion I figured that has something to do with it. Did you test it against any of the values in the table? I was just about to do that
@tidal kiln once you had a clue as to the potential cause how did you come up with the fix? Trial an error?
good idea...easy enough...
>>> def foo(val):
... val >>= 5
... val = val - 0x080000 if val & 0x040000 else val
... return val * 0.0078125
...
>>>
and....
>>> foo(0b111100000110000000000000)
-250.0
>>> foo(0b000001100100111100000000)
100.937
>>>
looks ok
fix wasn't trial and error. decided to just ignore the arduino lib and do something different
i can't find the asyncio module in the micropython repo, is it even worth looking for to add into circuitpython?
@pastel panther it comes down to dealing with the 19 bit signed int, this is stored in 3 8 byte registers, it's probably shifted up so that the sign bit ends up where it does, which would allow for dealing with it like in the arduino code
shifting is like multiplying by 2, so you could just work with the raw value and take that into account
by i just went ahead and shifted it back down
raw_read >>= 5
@marble hornet We have a community member who started looking into it. It's definitely worth looking into, but there's apparently a lot to getting it ported. He's have a lot of life happen though so I'm pretty sure it stalled.
He was last working on paring it down to something that would actually fit because it's evidently massive.
@raven canopy You around?
indeed, i am. ๐
conjures up adabot sorcery knowledge
So as it stands, Adabot only displays the first x-number of whatever's in parts of the output, so for parts of the output that have a lot of results, they're not all displayed (I can try to use more vague words here if needed ๐ )
I assume this is a setting somewhere
I'm going to start keeping track of Everything Library โข in a meta-issue on the CircuitPython repo, and I want it to have All the Things.
So like here ```CircuitPython drivers page missing driver - 14
Not listed on PyPi for CPython use - 18```
Nothing listed below it.
because it's over 5 or something, I don't remember the current limit.
ahh..ok, now i get what you're saying. i don't think it is a passable argument (list_threshold = 5) at the moment. let me take a gander real quick.
I didn't expect it to be passable, I expected to have to edit a file somewhere.
But I guess if you can make it such, that would be amazing. I have no idea if that's even remotely reasonable or not. It hadn't ever occurred to me in the first place.
you are correct; 5 is the magic number: https://github.com/adafruit/adabot/blob/master/adabot/circuitpython_libraries.py#L950
Ok, good job me for remembering a thing!
I'm ok with editing that file and having the change locally. I should probably make the change on a branch so I don't get things all in a twist when I'm keeping it updated otherwise though.
it is doable to make it a passable argument. we could get all sorts of fancy: output to a file vs print, run a single test at a time, etc.
feels like he's walking himself into something, as he often does...
I mean..... I wouldn't object. ๐
๐
๐
It would certainly make things easier on me than going in and changing it every time so I don't screw up the pull when I update.
want to discuss in the weeds on monday? Scott may have some input...
Sure. I'm guessing his input is going to be do it up, but you're right that makes sense to discuss.
actually, is the meeting staying monday, or will it be tuesday? columbus day and all...
Hmm, not sure. Will probably find out Sunday late when Scott gets back. Typically depends on whether it's a day off at his house too.
haha. fair point. i have off, so i could actually discuss realtime vs phone keyboard. ๐
Nice! Well, we'll see. Scott's out until Sunday so we'll know then.
A bit more information -- I was able to successfully mount my SDCard -- SPI device and then initialte a BLE advertisement and it runs OK - however if I then access the SDCard the system resets as above.
Wolf ๐
3777?
I think we have an issue for it somewhere, but there's not a lot of information in it because I think most of the discussion was verbal
Yep that's him
I doubt you'll hear back from him here if you ping him though.
He's kind of dropped off in general lately - we're friends and I haven't spoken with him in a couple of weeks even. Here's the issue: https://github.com/adafruit/circuitpython/issues/619
@idle owl thank you for the help !
So yeah, nothing was ever pushed to GitHub it looks like.
I feel like if it's something you really want/need or want to work on, you should post to that issue and start looking into it. Unfortunately we can't really track community involvement as it's exactly that, community involvement.
๐๐
The last I knew of it, he was still working on understanding it well enough to start paring it down to a usable state with the limitations of CircuitPython. He showed me a number of functions he'd done and how they worked, but I don't know that it's anywhere public. Or maybe it is: https://github.com/wolf/exploring-asyncio
That may be what he was working on.
Sure looks like it. @marble hornet Start there ^^
But I still recommend posting to that issue if you're going to do anything with it as it's always better for us to have the most up to date awareness of things.
Thank you @idle owl I will be sure to put any questions or thoughts or ๐ค breakthroughs(not likely) in there
Thanks!
This is the place to stay up-to-date on the state of the CircuitPython libraries. We will be updating this issue each week with the most recent status from the wonderful Adabot!
If you'd like to contribute, CircuitPython libraries are a great place to start. Have an idea for a new driver? File an issue here on the CircuitPython repo! Interested in helping with current libraries? This issue is the place to start. We've included open issues...
This song keeps repeating "The rebel, the rebel" and I keep hearing "The REPL, the REPL".
...and now i'm hearing the bikini kill song as REPL GIRL! REPL GIRL!
...makes me think of NIN The Wretched.
@idle owl how about super-fancy adabot that updates the issue comment? https://developer.github.com/v3/issues/comments/#edit-a-comment ๐คฃ
๐
although, not sure the URL query strings can be that long.
Could you merge the latest and run make translate again? Build is failing with "message message ID".
The translations have changed since your commits, causing the translate build to fail. Could you rebase or merge with the latest, run make translate, and then recommit? Thanks.
I am observing the same as @jerryneedell
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
uh oh. a heavy table has been tossed...
oh..and this looks like a not fun adabot attempt:
can't figure out making this lib use time.monotonic. It's failing in every possible iteration I can think of and I'm pretty sure I'm going in circles.
@idle owl async for the slide show?
yah
what's the idea for how the slide show will get driven?
I don't understand the question
yah. hard to phrase.
something has to "drive" the slide show
in the simple version, it's a while loop
which works, but the while loop blocks
so that'll have to go away
and something else will have to do the driving
very roughly. you'd have to change from this:
ss.run() # blocking call, returns when slide show is complete, if ever
to something like this:
while True:
#
# do some stuff, like read buttons with GPIO
#
ss.update() # blocking, but only does what's needed and returns
I was more concerned with taking out the time.sleeps than the while loop, but yah.
time.sleep goes away, but you also probably will not have a while True in the class anymore either
right right
and in update would be something like:
now = time.monotonic()
if now - last_update > self.dwell:
# update image
last_update = now
else:
# do nothing. just return.
which means i've been banging my head against useless for the last however long... ๐
I was trying to do that
but....this is just one approach
it was not being cooperative even though I used to have this down so easily
which is why i was asking what the general idea was for how the slide show would get driven
I don't think I know the answer.
mostly because I'm still not sure I understand the meat behind the question.
Or something.
do you understand the approach above?
yes. I think
basically, the responsibility for driving the slide show is outsourced to the main program
that's why I was leaning towards trying to get it all into generators is that's how I know how to do non-blocking sequence code.
ok
it's up to someone to write a program properly to actually create a slide show
but I don't know how to put generators into a lib, etc etc etc.
hmm
I guess that's really the only option.
like, if you forget to call update, or the main program does something else that takes a long time before calling update, the slide show progress is affected
this is pseudo-async, since we don't have threads
right right. I mean conceptually asynchronous. except that's a lot to type.
it's a lot like "blink without delay"
I kinda think of it like arduino where your code.py is responsible for calling loop()
(apologies if that's just confusing things further)
ยฏ_(ใ)_/ยฏ
I don't know arduino, so it's not really confusing, it's not adding anything to what I understand
๐
debating on whether I should wait to see what Limor or PT wants out of this in terms of it being asynchronous. Because this doesn't sound simple and if I head down the wrong rabbit hole that will be super frustrating. I can't wrap my brain around it apparently. Which in itself is super frustrating, really....
Actually it was mentioned. "we'll make it Awesome and Asynchronous after this works, so that it uses time.monotonic() and you just sorta poke it in your loop to 'check in' after dealing with GPIO"
Not sure that clarifies anything for me though.
that's saying the same thing i am, and notionally suggests the approach i showed
ok
"poke" = the call to update done from the main program
update will just be responsible for checking how long it's been since it's been called and then doing something if an appropriate amount of time has passed
hmm.
def update(self):
now = time.monotonic()
if now - last_update > self.dwell:
# update image
last_update = now
else:
# do nothing. just return.
that deals with the image staying up, but I was trying to deal with the fade times
easiest is to just make it part of the showing an image
I have def _fade_in(self): separated out in a failed attempt to get it to work
oh
hmph.
keep track of a fade_status == [None][in][out] and glue it into update and show?
i think you'll want fading in and fading out to be blocking
oh.
otherwise it might not be super smooth if it's driven from the main program
not ideal, but generally easier
but maybe it'd work..hmm..
so something like what @raven canopy is saying...
I only partially understand that.
another variable to keep track of current state "fading in", "showing image", "fading out"
and in update you have a conditional to check that
I know how to use time.monotonic to make code non-blocking. However, I can't wrap my brain around how to do it right here. Because you have to have an initial time and a current time, compare them and blah... and I'm not seeing where to place those two instances to get the correct comparison because it's all spread around the library...
ok that makes a little more sense on that part
and fading in/out would no longer be driven by a for loop
Here's what I have at the moment, basically needless changes to what you already had: https://gist.github.com/kattni/4ad9f5d392b06cd91d30b762dec022af
Running this: ```python
import adafruit_slideshow
slideshow = adafruit_slideshow.SlideShow()
slideshow.order = slideshow.ALPHA
slideshow.dwell = 2
slideshow.loop = True
slideshow.slideshow()```
I know loop is default.
was trying to understand things anyway.
it looks good. Does it work?
yah
In that case, commit it if you haven't done so yet
even if you don't push the commit
I don't even have a repo for it.
or a local thing
been editing it all on the board ๐
terrible.
just git init in the directory and add the stuff and commit
def update(self):
now = time.monotonic()
if current_state == self.FADE_IN:
self.backlight.duty_cycle += DELTA_FADE
time.sleep(0.01)
if self.backlight.duty_cycle == MAX_BRIGHTNESS:
current_state = self.SHOW_IMAGE
if current_state == self.SHOW_IMAGE:
if now - time.monotonic() > self.dwell:
current_state = self.FADE_OUT
if current_state == self.FADE_OUT:
self.backlight.duty_cycle -= DELTA_FADE
time.sleep(0.01)
if self.backlight.duty_cycle == 0:
current_state = self.NEXT_IMAGE
if current_state == self.NEXT_IMAGE:
#
# load the next image
#
you can set up a remote later
@tidal kiln huh. ok...
very rough...still thinking about how the load next should work...and how you've stored the image file list....
yah.... I'm not sure I have any idea.
and ideally, the time.sleep(0.01) should go away
do the same time.monotonic() magic on that too, I guess
I think so
I.. am not sure
it'd be slooooowwwww
it only bumps up duty_cycle when it gets called