#circuitpython-dev
1 messages ยท Page 171 of 1
Looks like it is the 69, "Adafruit Feather M0 RFM69HCW Packet Radio - 868 or 915 MHz - RadioFruit"
Oh right. Which one is the board and which one is the wing?
Both are feather boards
The M0 feather adalogger is the last one I need to get setup.
@rigid path what frequency will you be using? 915 or 433?
@solar whale - not sure yet, for now I am playing with a handful of boards. Trying to learn cp.
@rigid path if you use anything other than 915, you will have to work around a bug in the driver see: https://github.com/adafruit/Adafruit_CircuitPython_RFM69/issues/6. It should work fine at 915.
This is only for the rfm69. Not the rfm9x.
@solar whale - Thanks for the heads up.
@notro made good progress on this.
Lets double check everything is setup as we want and uncomment this: https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/supervisor/port.c#L289
The difference in the CP build is that it defines board.RFM69_CS for the chip select. Youโll still need to load the library.
Unable to reproduce this issue with 3.0b. Please reopen this issue if you are still running into this issue. Thanks!
Tested with 3.0b. When SD card is removed, the code continues for a short time, and then eventually hangs. There is no error thrown. This is more likely to be an error in the adafruit_sdcard driver.
I2C is slow enough that this isn't useful.
Reproducing bugs ourselves is good enough.
@raven canopy Congrats! https://blog.adafruit.com/2018/05/24/new-guide-debugging-circuitpython-on-samd-w-atmel-studio-7-circuitpython-micropython-microchip/
So satisfying. Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
is there an issue for SPI DMA? (i didnt see) that would be useful, especially for TFTs
@idle owl it is indeed. especially on the first go... ๐
@raven canopy That was even run on an entire directory full of code.
bonus!
@paulswirhun Since you tried this change of increasing the count, we've turned on the instruction/data cache on SAMD51, which may make the timeout loop now run too fast again. Could you try it again with 3.0.0-beta.0 or the tip of master?
You could add a common-hal method that the shared-bindings code calls. You have room to leave these in right?
SPI is already DMAed. (QSPI isn't currently though.)
Neither 3.0.0-beta.0 or master have the asf4 change so you'll need to build
a custom version to test the increased number.
On Thu, May 24, 2018 at 3:00 PM Dan Halbert notifications@github.com
wrote:
@paulswirhun https://github.com/paulswirhun Since you tried this change
of increasing the count, we've turned on the instruction/data cache on
SAMD51, which may make the timeout loop now run too fast again. Could you
try it again with 3.0.0-beta.0 or the tip of master?โ
You ar...
oooh do we wait for DMA to complete before returning from a transmit?
Yup, we still block. The DMA makes the transfer immune to interrupts and things.
ok i think in framebuf maybe that's where i'd optimize it so it does not block. all good!
There's not enough flash if I leave I2C and UART in. That's the main reason I removed them -- it wasn't because there are no pins for the functionality. To gain space, I have to empty the locals dict, etc. so that the routines aren't compiled in, and that involved a lot of #ifdef'ing.
I don't think anyone is going to try I2C or UART on the pirkey because there's nothing to connect to to use them. We need to keep SPI for the on-board DotStar.
They are pretty big, like 6k.
Yup agreed. We should revamp display support and include this.
@tulip sleet ifdef out names from a module is a precedence I realllllyyy don't want to set
I removed other base modules (like rtc and samd) that weren't really necessary. It's already the case that for certain base modules we don't include everything on certain builds for space reasons, like certain string operations and certain math functions.
I tried creating a set of stubs like common-hal/busio/I2C_not_implemented.c but the Makefile structure makes it hard to substitute these for the full files. Also a set of stubs could have been in shared-modules, but there is already code there to fallover to bitbangio, so that avenue isn't available either.
I am short about 750 bytes. I could look at other stuff, but the build will probably grow slightly in the future anyway. In this case this is functionality that just doesn't exist on the board. It's just one level down in a module instead so we can't just excise a top-level module.
like touchio isn't included, period, there aren't stubs to throw "NotImplemented", etc.
I actually think that if it's completely missing it's clear that it will never work, as opposed to constructors that can't be used because there are no such pins.
I want to do it on the module boundary like touchio. The reason I don't want to change is because MicroPython allows this and it leads to a whole bunch of modules that are a variety of things.
The problem with non-blocking SPI transfers is that we handle CS toggling in software, so we have to wait for the transfer to finish anyways, because toggling CS before it finishes would break things. Hardware CS could be one possible solution to that.
@tulip sleet can you use a set of weak functions to provide generic implementations? it'd be useful for new ports too
oh true... hmm, we could do that as part of the SPI locking process - like, CS is toggled by the DMA interrupt/callback, but you cant use it till then. a little like arduino transactions. just thinking outloud
notro did it for RTC: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/time/__init__.c#L189
@slender iron do you wanna audio chat about the above?
I can in a bit. not at my desk atm
The trivial (and I think most common) case is when the display is the only device on the SPI bus โ you can just tie CS to GND then permanently and only block when a transfer is requested when the previous transfer is still happening. All displays that Adafruit carries support that (perhaps with the exception of the SHARP displays, which as haven't been able to get to work as of yet). That case also lets us optimize busdevice a bit, because we don't have to re-set the speed and polarity each t...
Perhaps this is a good moment to re-implement busdevice in C?
@slender iron discord was not doing well, missed some of your comments until i restarted
yeah, there was a hiccup. had to do the same...
@tulip sleet still want to chat? I'm back at my desk
@slender iron sure
@slender iron is it expected that AudioIO.play() suddenly requires 512 bytes of memory?
it didn't need it in 2.x
Hello everyone, Iโm new here and to Adafruit and Iโm new to all of this coding stuff that Iโve been working on to an extent. I was hoping that some of you guys here could help me accomplish some of the mini projects Iโm working on?
Hi, sure, just ask anything you don't know, and if someone here knows, they will answer.
Thanks man.
So, does anyone here know of any existing libraries for CircuitPython that scroll text on a NeoPixel?
@stuck elbow the constructor grabbed it last time. its used for the double buffer
is there a way to disable it?
what are you playing? a wav file?
yes
no, its needed
can I make it use a pre-allocated buffer somehow?
@slender iron you know if there is such a library?
@wintry notch There was something written for DotStar that does it, it's possible you could port it, but I don't think anything exists at the moment.
It was written specifically to work with the DotStar Featherwing, so it would require porting.
you used a mild curse
Wait am I not allowed to say d*mn?
that's right
Oh ok. My apologies.
Well, anyways, Iโm trying to scroll text on an 8x8 NeoMatrix with a Metro M0 Express as the micro controller. I have been busting my head trying to figure it out for the past few days.
Ah. Yah the only thing I know of was written by a community member for the DotStar Featherwing matrix.
I can link you the guide, which has links to the library in it
Yeah exactly.
Please and thank you.
You're welcome
hey i need to make one anyways, but it'd be in pure python - so you have to scan it whenever you wanna use
Latest changes per our conversation. I2C and UART are back, but appropriate things have been #ifndef'd out of ports.c. I started to do the general fix of making a macro for the _init() and _reset() calls, but it got complicated and I'll defer that to later, in the interest of not accidentally breaking things right now.
@idle owl can I make a new release of cpx lib after Tuesday's merge? I need a tagged release for freezing
@tulip sleet Yah I thought you already had. I didn't add any of the iffy stuff in. Should just be the 3.x update. Actually wait, we have touchio. Want me to test it?
It hasn't actually been tested with 3.0 when it should work
yah, go ahead, and then make a release if it's ok, since you can describe what's new more easily than me
is?
with start tone, I think it's an audioio issue, Jerry caught the one in play_file, I think he missed that evidently generate_sample used in start_tone also uses audioio
I think I know what it is. I think I can fix it.
Oops. Sorry about that. Iโm on a plane with intermittent Wi-Fi, but let me know if I can help. Iโll try.
Hah!
I fixed it!
Now I have to do all of the cross compatibility buggery to get it to work with both
I only have SAMD21 (Trinket M0).
On Thu, May 24, 2018, 3:03 PM Scott Shawcroft notifications@github.com
wrote:
Neither 3.0.0-beta.0 or master have the asf4 change so you'll need to build
a custom version to test the increased number.On Thu, May 24, 2018 at 3:00 PM Dan Halbert notifications@github.com
wrote:@paulswirhun https://github.com/paulswirhun Since you tried this
change
of increasing the count, we've turned on the instruction/data cache on
SAMD51, wh...
And that is the sound of success!
๐
I linted it. It passes.
But let it build anyway.
Hey everyone, just wanted to thank you all for your help! The CP+Crickit Tom Servo is now operational. ๐
It failed.
W:600,12: Attribute '_sine_wave_sample' defined outside __init__ (attribute-defined-outside-init)
I know. Already fixing
it was 9.95 out of 10. That would get a you gold medal in most circumstances
NOT GOOD ENOUGH.
Passed. ๐
I'm waiting until I can pull all of the 2.x crap out of there and have it just be 3.x+ compatible.
ok remerged
ok
i can remerge even a closed PR
@solar whale Thanks for the offer of help, but I sorted it ๐
Nicely done!
@tulip sleet Whenever we're done with 2.x updates, I'll pull all of that out. Space is already so tight with this one, that it'll be worth it to lose backwards compatibility.
@solar whale Thanks ๐
Suggested by @ladyada
@idle owl I retagged to 2.0.0 (need the last digit), but do you know how to trigger a re-make of the files?
in travis?
@tulip sleet I do not. Sorry about that.
Would have had it nailed if I kept it 1.x.x... bleh
I'm out for the evening
@slender iron how do I re-trigger travis to remake a library after changing its tag? Go into travis or do from github?
what do you mean by changing the tag?
@idle owl have a good evening,
kattni tagged the lates cpx lib as 2.0, but I thought it shoudl be 2.0.0, so I edited the release, but the old built .zip files are stil there
lemme look
same is true of the lis3dh lib, labeled 4.2 instead of 4.2.0 .. Maybe it's not an issue that there's no 3rd digit?
its queued up behind the circuitpython test: https://travis-ci.org/adafruit/Adafruit_CircuitPython_CircuitPlayground/builds
ah great ok
it should have the third digit for consistency
I'll redo lis3dh too
thanks
I know you guys are busy with fixing an issue for a new release, but when you guys have a chance. I have a concern about something Iโve been thinking about. I wanted to see if you guys could help me out with writing a function in CircuitPython.
@wintry notch Go ahead and ask and we'll get back to you when we have time.
Also updating all frozen modules (not just for pirkey) as a side effect.
I wanted to write a function that would take 8 strings/values in a table form, and it takes 2 values, either X or . and if it was an X turn on a certain NeoPixel, and if itโs a . turn it off/leave it off.
@wintry notch Is there a reason you want to use "X" or "." as opposed to True or False?
change_pixels((True, False, True, True, True, False, False, True))
something like that?
In 3.0.0-beta.0 2018-05-23, busio.UART read(nbytes) does not return the None value upon timeout, just an empty bytearray.
Tested using Metro M4 express hardware.
does anyone know where I can download cmath? an fft library I'm trying to use has it as a dependency but I cant find the download for it anywhere
For CPython? My first guess would be PyPi...
actually...cmath is a native CPython module.
yeah, that's what I'm confused about lol. cant even import it in repl
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import cmath
>>> dir(cmath)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'cos', 'cosh', 'e', 'exp', 'inf', 'infj', 'isclose', 'isfinite', 'isinf', 'isnan', 'log', 'log10', 'nan', 'nanj', 'phase', 'pi', 'polar', 'rect', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau']
the circuitpython repl, that is
ahhh. we don't have cmath that I'm aware of.
just math:
>>> import math
>>> dir(math)
['__name__', 'e', 'pi', 'sqrt', 'pow', 'exp', 'log', 'cos', 'sin', 'tan', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'copysign', 'fabs', 'floor', 'fmod', 'frexp', 'ldexp', 'modf', 'isfinite', 'isinf', 'isnan', 'trunc', 'radians', 'degrees']
ah ok, is there an equivalent I can use?
the fft deals with complex numbers but I found a recursive version which doesn't (although it sucks and eats memory)
micropython appears to have cmath.
oh huh, can I get at that somehow? I'm using a circuit playground express
it is also still "available" in the circuitpython repo, but it might take a bit of work to get it compiled into a local version. and no, micropython doesn't support the SAMD. sorry.
oh ok, thanks for clearing that up lol, you've saved me a lot of time and head-scratching
you're welcome. sorry i don't have an answer that would help you get past the obstacle.
and to clarify my earlier bumbletygoop. you might be able to build a custom version of the firmware that includes cmath. but, due to memory constraints you'll most likely have to exclude other things. which is probably why it isn't in the released firmware.
sounds good, I might try implementing the required cmath function on it's own but I forget what it was atm
I think there may be some new math-related hardware in the SAMD51 M4 that is not present in the SAMD21 of the CPX.
Metro M4 Express: SAMD51J19A
True Floating Point, iirc...
Yeah that's exactly what I'm thinking. I'm thinking I can do a floating point forth if I wanted to.
Hm. RS485!
last test build of the night. may have figured something out, but we'll see. now it's play time. ๐ฎ
Traceback (most recent call last):
File "main.py", line 10, in <module>
File "/lib/bitmapfont.py", line 28, in init
OSError: 2
trying to use the bitmapfont library but not successful
`import board
import busio as io
import adafruit_ssd1306
import bitmapfont
i2c = io.I2C(board.SCL, board.SDA)
oled = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
bf = bitmapfont.BitmapFont(128, 32, oled.pixel)
bf.init()`
i could just be doing this wrong
@tough ridge cmath is not turned on because there has been no room for it in the past. We might consider turning it on for the M4 builds, but we haven't checked how big it is, and we have other possible uses for the space. If this is the library you're using: https://github.com/peterhinch/micropython-fourier it also uses inline assembler, which we have also not enabled.
Sorry this may be somewhat disappointing. If you feel you have the skill, you could try a custom build enabling these things. They are not going to fit on an M0 board.
oh ok, thanks for the update. I'll make do with a workaround then
I have been looking again at a problem where Gemma M0 using CircuitPython cannot talk to a STM32L-based tinyLiDAR over i2c. I've been using the pins which I believe allow it to use a hardware optimised driver.
Is there a difference between the software implemented i2c and that in the ATSAMD21? What version of CircuitPython would be best to try this with if this is the case? Can I just change pin to a non-hardware capable one and the s/w implementation will kick-in?
Discussion of problem...
@tulip sleet @raven canopy I just took another look at the code and realized that, while cmath is imported, it's never used lol. So I just pulled out the function from the library and it's working fine it seems
score one for the home team!! maybe an earlier version used it. version control is not always as simple as it seems... ๐
If you use bitbangio.I2C, you'll be using the software version. busio.I2C uses the hardware. So try bitbang if you have not already and see what happens.
@tough ridge OK, great! I thought the library you were using required complex arithmetic.
finally got it to fail gracefully! it's kind of kludgey though...
186
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
RuntimeError: Frequency captured is above capability. Capture Paused.
yeah me too...
@tulip sleet & @slender iron, what are your thoughts on using NVIC_DisableIRQ vs common_hal_mcu_disable_interrupts? using the mcu approach was keeping me from fully exiting the endless interrupt loop...
uploading a gist
is it generating an interrupt on every edge?
@mrmcwethy would you be interested in adding eco2 and tvoc properties to the SGP30 driver?
@slender iron only on HIGH: uint8_t sense_setting = EIC_CONFIG_FILTEN0 | EIC_CONFIG_SENSE0_HIGH_Val;
huh, why did you do it on value instead of an edge?
the EIC is only to generate the event for the TC.
could that be why you are running over? if its high, you clear the interrupt and it sets it again because its still high
what is your interrupt handler for?
TCn_Handler
ah
i'm just trying to avoid the same issue as PulseIn locking up. INTFLAG.ERR/INTFLAG.OVF have proved "unreliable" as barometers, since the issue is circuitpython clearing the registers quick enough..
~520kHz. Sending a 512kHz, but it's read as ~520kHz. resolution gets worse as the value goes up...
which may be due to the overflow, and the fact that i'm not handling it (yet)
well, i'm not prescaling it, so it's on GCLK (48MHz).
ah, you are trying to measure the pulse length
just period, but yes, width is included in the TC capture. ๐
so you are generating an interrupt every input cycle
that's my assumption.
how responsive does it need to be? why not increment the counter based on the input and comparing to ticks_ms to measure the duration
it'll be a huge average but that should be ok
well, that's just re-creating PulseIn, and I fear we'll run into the same problem at the current level (~64kHz).
no, pulsein interrupts every input edge
instead, use the tc to count to a top limit and then interrupt
you could measure how long 1000 cycles of the input clock takes then
oh. well, that's what i understood that TC capture was doing. just that TOP = MAX.
is your code anywhere besides the gist?
nope.
I believe you are measure the period of a single input cycle
can you push it somewhere?
there is a fuller version in there. i just posted the three "relevant" functions on that last one.
why not just push the full branch?
vagrant + windows...remember? hehe. I should anyway, just need to copy everything over to the clean git.
ah
i'll have it up in a few.
hello, i have a quick question on bitbangio
@simple pulsar ask away
I was going to try it to see what it does wrt to the i2c issues i've seen
Can it be used with Gemma M0?
That's the only M0 board I have at the moment
ah, I think its off by default to save space
it does appear not to be there
what i2c issues are you thinking of? (are you on github as a different username?)
I'm kevinjwalters on github
ah kk
It was this I was investigating https://forums.adafruit.com/viewtopic.php?f=60&t=129362 - I added some more info yesterday
But I had a bit of a rummage in github and came across this: https://github.com/adafruit/circuitpython/issues/787
the gemma is using the hardware i2c which does support clock stretching
Ah, well i can't get it to work with the little device.
There's an interesting and thorough description of clock stretching on that page I mentioned, it turns out it can occur in different parts of protocol and some implementations don't support all of them
ah
The tinyLiDAR doesn't work with the bog standard arduino or raspberry pi i2c libs
I can borrow a circuit playground express - is the bitbangio going to be included on that?
I think it is
what makes the tinylidar worth the trouble?
you could use the sensor directly
I bought a few including for friends as gifts. It seemed like a nice idea but it turns out i2c isn't a great bus in terms of compliance with spec!
And I thought it would be useful if your boards could talk to them, apparently it does nothing special with i2c, it's just the STM32L device
yup, seems like you may have crossed the time vs cost of buying something else threshold
yeah the stm32 code could be funny
it looks ok on the wire to me so far, it just puts in this extra delay for the ack
maybe i should get another trace with the high analyzer sample frequency, i had it a bit low before and it had missed a short SCL pulse
I'll ask a friend for their CPE at come back to this in a few weeks, thanks for your help
@slender iron i'll have it up later. i bungled the first attempt since i tried a "smooth" way. ๐ have to change the oil in my car and grab some lunch...
fwiw - this is the same sensor (VL53L0X): https://www.adafruit.com/product/3317
Funny you mention that, i do have one of those still in its "box" !
But i have 1+5 tinyLiDARs too
and if you want some more reading on hw vs. software i2c, there's this on going discussion:
https://github.com/adafruit/Adafruit_CircuitPython_BNO055/issues/9#issuecomment-384137352
@simple pulsar have you checked with an oscilloscope too?
No, only the SQ25
I'm living in the 80s and only have a somewhat old bulky scope
with no capture
Yes, i have seen a few other people have problems with noise which has only shown up on 'scopes
But I think in this case it's unlikely because it works fine on the arduino i checked it with
3.0.0 is available on the Trinket M0 too.
and it has a track record of not working with "basic" i2c implementations ๐ฆ
as @slender iron suggests - for that tinylidar, i'd suspect something with the i2c code (or bus) running on the STM32L
we've gotten the VL53L0X breakout to work with Arduino and CP:
https://github.com/adafruit/Adafruit_VL53L0X
https://github.com/adafruit/Adafruit_CircuitPython_VL53L0X
wry 778, tinyLiDAR command sequences are miniscule, a few chars so 64 limit would be no problem
I could try a high frequency SQ25 analysis again against the Gemma M0 output now I know a bit more about i2c and know that the 9th pulse wasn't missing on Arduino.
I do not expect it to work but I may be able to see and describe the protocol fault now.
<@&356864093652516868> Is it ok if we do the meeting on Tuesday? Becca has the Monday off (Memorial day here in the US) so I'll take it off too.
@slender iron That's fine.
Ok, i'm off now, thanks for your help and ideas
later. goodluck @simple pulsar
@slender iron i'm gone all next week, so i'm null response
that suits me @slender iron ๐
Works for me. I work on Monday but not Tuesday
oh wait, this is CP channel, sry, meant to say None response
Unfortunately, for non-Express boards like the Gemma M0, bitbangio is not baked in:
https://circuitpython.readthedocs.io/en/2.x/shared-bindings/index.html#support-matrix
<@&356864093652516868> Next week's meeting will be on Tuesday instead of the normal Monday due to a US Holiday. It is Tuesday May 29th at 11 am Pacific / 2pm Eastern here on Discord.
Having some timing issues with dropped MIDI bytes received via busio.UART with the stable CPy release and 5/23 3.0 beta. It acts like a baud rate (31250) or framing issue when working with closely-spaced Note-On and Note-Off streams. Tested it on both M0 and M4 hardware. Wondering if anyone else has seen it. Next step will be to confirm baud rate accuracy on the o'scope. I'll submit an issue after that. Not an issue: MIDI output streams may be implemented with the bandwidth-saving Running Status shortcut. Not all vendors use this shortcut, but MIDI input devices are (informally?) expected to support it. #NeverMind ๐ค
hi all, im looking at the pins.c file for the metro m4 revb and there are a bunch of pins undefined. could one add them then and re-burn ? (assuming they were broken out )
You could add them and rebuild, yes, assuming they're broken out.
im making a atsamd51 board for myself , but am missing some info b/c the eagel files aren't on github yet
@idle owl thank you !
Yep!
is there a place i could fine some...? like crystal frequency... (32.687?) flash chip pins ... ?
etc
I don't know on that one
@static zealot metro m4 revb is not the production one
yeah its simply metro_m4_express
It didn't occur to me to ask about that, I thought maybe you had a revb and you were using it. Sorry about that.
@marble hornet images of the board and schematic are here: https://learn.adafruit.com/adafruit-metro-m4-express-featuring-atsamd51/downloads
THANK YOU!
ya, thats the production rev
WHOOP WHOOP !!
@slender iron a long time ago i added a 16Mb flash chip the the devices.h file. its is untested but if i note that in the code is it a good idea to push ?
okay, ill keep it in mind
cool cool
oh snap. leeeekkss: https://blog.adafruit.com/2018/05/25/we-are-making-a-circuitpython-based-gaming-platform-adafruit/
๐
Yeah!
WOOOOOOOOOOOOOAH
@slender iron I think you preempted the surprise. ๐
anyone working on a CP doom port?
@slender iron finally got it pushed: https://github.com/sommersoft/circuitpython/tree/frequency_in
but man oh man...all the activity over the last week+ is going require some de-conflicting... ๐
luckily, it's just the makefile. :phew:
Will the gaming platform be using Deshipu's stage and ugame?
@slender iron oh wow, are you going to use the stage library?
I'm all for making it work with it
hopefully the keys won't require some weird scanning that can't be done in the background
@opaque patrol it will be different hardware but we'll make sure the C helpers help everyone ๐
@stuck elbow its all theoretical at this point but we'll definitely have cycles to spend on improving things
๐ its looking to be awesome. still early days though
sounds like a great thing for async io
it's probably going to be all Arduino initially
plain Python is too slow without the right libraries
nah, I think we're thinking circuitpython
should be possible to port arduboy and gamebuino games to it
and maybe some gameboy emulator
to get some games at the beginning
we'll see
I'm definitely going to look at it
by the way, I managed to work around the additional memory requirements of audioout by baking the bmp files into the .mpy
nice!
but I would really prefer to be able to use a smaller buffer
its possible the memory thing is a bug too since it was redone
512 bytes is a lot
smaller buffers have a higher risk of underflowing
and to be able to pre-allocate it, so that it's immune to fragmentation
it'll be much less of an issue on m4
right
I need to sit down to it properly, I haven't been able to recently because of moving to an new flat
well, we should definitely keep brainstorming. I'll probably have time to dedicate to it post-3.0.0
it's a bit weird how you can stream things directly from flash when it's in .mpy files, but not when it's in data files
that doesn't make sense
some kind of mmap would be awesome
goodnight! have fun!
fyi, I'm reorganizing a bunch of files in ports/atmel-samd
sorry to ask this again but im having trouble with my Trinket M0 and bitmapfont libs
im only getting this error in console Traceback (most recent call last): File "main.py", line 10, in <module> File "/lib/bitmapfont.py", line 28, in init OSError: 2
I'm trying to get text to display on my OLED. im sure im overlooking something simple. maybe you guys know?
do you have the font file on there?
@hearty stratus OSError 2 is "No such file or directory".
yep. and line 28 is the f.open line.
do i have to import font5x8 too?
all my stuff is in lib
maybe it's looking for it there
err. in the root
hmmm data in mpy files!
wondering out loud: can i create an mpy with from a running script and dump data into it.
(thinking about LED animation sequences and performance again)
why does it need to be a mpy file?
mpy-cross
(new to circuitpython)
there are prebuilt binaries same place as the CP firmware:
https://github.com/adafruit/circuitpython/releases/latest
mpy is a py file converted to byte code. this means the same stuff is in there but it is not human readable. it also saves space for running programs in ram. (b/c it does not use full words) ( * this is not a complete explanation *)
^^that. also, it gets around memory issues when trying to import larger .py files
sometimes using mpy versions of large libraries can save you ALOT of memory
@ruby atlas do you mean putting data into an mpy while circuitpython is running? or having a set of boilerplate data that can be placed onto the board (e.g. in /lib)?
dynamically writing a structure to an mpy on flash (if space permits) in the right form to import later.
it's a bit of a crazy idea, probably not the right thing to do.
๐ค hmmm what is available for object serialization in CP?
well, there is an open issue for mpy-cross within circuitpython, but it hasn't been tackled yet.
oh..nvm. it was closed b/c of filesystem reasons (which is where i was going with my questions). https://github.com/adafruit/circuitpython/issues/701
thanks @marble hornet that would probably be what i'll do since i'm already low on space for the M0
and need the BMP280 libs on here as well
@hearty stratus what board are you using ?
trinket m0
ah
@hearty stratus are you running out of storage or memory?
like is the flash drive full?
@hearty stratus
@slender iron is aref required for internal cir-py stuff or could i give it another name and use it as io ? if i don't connect it to 3v3
@marble hornet its needed on the m4 since the microcontroller internal ref is currently broken
okay, thank you ๐ so short to 3v3 ?
yeah, think so
quick q - bit of weirdness on the CCS811 library...shouldn't eco2's property (https://github.com/adafruit/Adafruit_CircuitPython_CCS811/blob/master/adafruit_ccs811.py#L161.) also contain a call to _update_data() since it's populated on L146 (https://github.com/adafruit/Adafruit_CircuitPython_CCS811/blob/master/adafruit_ccs811.py#L146)
@prime flower yup think so
ok, thanks!
thank you!
np!
do the tx/rx led pins on the m4 need to be there for cir-py to function? or could they be redefined for io ?
thanks for all the help either way!
I updated my Crickit's firmware today. It's CircuitPythonesque in the approach.
@ruby atlas thanks for that; didn't even know it existed. ๐ as for why it isn't in circuitpython? dunno. but shouldn't be too hard to implement. might get kind of wonky working with the history though.
ctrl-u just erases what you've typed so far, so it should not affect history.
actually, in most implementations, it erases from the cursor to start of line
That's unix, iirc. gforth leverages libreadline to provide a command line history (I think that's how it does it) but not in a serial terminal. gforth runs on the host PC in an xterm or a regular console terminal.
Big difference.
i've only read the history code in passing. not sure when exactly it "takes note" of typed commands. hence the might. heh, i can't even recall which all files/functions its in off the top of my head...
How many lines are buffered in the history?
Ctrl+A and Ctrl+E work as expected.
Based on that one observation, Ctrl+U should be somewhat straightforward to implement as a keybinding in the CircuitPython REPL.
.. one ..more ..truffle..โโโโโโ(Brazil)
ctrl-e is in there. well, ctrl-e as paste mode is there.
ctrl-i is on the docket to bring back, as well.
I use Ctrl+e to jump to EOL and Ctrl+a to jump to beginning of line.
Right .. the recommended terminal was (or still is) SCREEN.
after like 2 weeks of having it, i'm finally attempting my first build for the Metro M4. and, i'm greeted by a word i least expected...
In file included from ./common-hal/touchio/TouchIn.h:32:0,
from ../../shared-bindings/touchio/TouchIn.h:31,
from common-hal/touchio/TouchIn.c:34:
freetouch/samd21_ptc_component.h:31:10: fatal error: Arduino.h: No such file or directory
#include <Arduino.h>
^~~~~~~~~~~
compilation terminated.
๐
libreadline essentials:
https://tiswww.case.edu/php/chet/readline/rluserman.html#SEC4
haha arduino.h
yeah. skipped a git submodule update after pulling to current master.
I don't know .. I think I built M4 once already.
Usually log builds to disk with /usr/bin/script .. lessee..
Wrote 433152 bytes to build-metro_m4_express/firmware.uf2.
cp bld script $ exit
exit
Script done on Mon 14 May 2018 04:52:15 UTC
Adafruit CircuitPython 3.0.0-alpha.6-73-gce5eae1 on 2018-05-14; Metro M4 Express with samd51j19
I have some really basic questions about working with circuitpython on my metro board. Where should I ask them?
you can go ahead and ask. word of note, though: it tends to slow down around here on the weekends, but people usually read back through once they come back. if you're question(s) doesn't get answered right away, keep checking back.
Alright thanks!
I just set up my board and I'm wondering how I can import external modules such as matplotlib and the likes>
well, unfortunately we don't have the full complement of CPython libraries at our disposal. We try to be as compatible as possible, but we're not 100%. Give this a read; it explains how our libraries work: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries
I see. So how do I know if a particular library is available?
They're separated into two categories. We have the core libraries, listed here: http://circuitpython.readthedocs.io/en/latest/shared-bindings/index.html (touchio isn't in M4 variants atm)
And the additional libraries are in the "bundle". These are for things like sensors, displays, etc. This is a mostly-up-to-date list: http://circuitpython.readthedocs.io/en/latest/docs/drivers.html
for an exact "what's in the bundle", it's easiest to look on the GitHub repo: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/
Thank you! One last question: I was mostly interested in doing some Fourier analysis and I couldn't find any particular ways of doing this so far. Any possible ideas?
someone was working through an FFT issue earlier today. if you scroll up (or use the discord search for "fft"), you should be able to find the discussion.
@marble hornet sorry, was away
i have very little free mem available
also very little storage
next question tho, i have two devices i want to run off I2C. How do I assign a different address to, say, my OLED
nevermind. guess i should have kept trying ๐
does anyone know if the tx/rx led pins on the m4 need to be there for cir-py to function? or could they be redefined for io ?
thanks for all the help either way!
@marble hornet i am confident they are not "required". the only usage i can find is in mphalport.c, and each instance is contained inside #ifdef MICROPY_HW_LED_RX or #ifdef MICROPY_HW_LED_TX. So, if you just don't define either of those in board/[_m4_]/mpconfigport.h you should be fine.
mphalport usage: https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/mphalport.c#L35
LED defines: https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.h#L8
@raven canopy thank you. the feather m0 express doesn't have them, is that the only files that needs to be edited ?
i have another led / firmware question. do you mind?
yeah, if you just omit the definitions in mpconfigport, you'll only need to change the pin assignments. no need to change mphalport.c since it will skip using them.
go ahead.
okay, two.
1 the neopixel on the express boards are rgb, right? but the circuit playground has rgbw neopixles. i would like to use the rgbw on my board. does that need to be set manually.
2 ive looked in the mpconfigport but to no avail. by my eye at least. the other is when you say change the assignment, could i pass none? or do i need to have a pin there
@raven canopy thank you so much
@marble hornet 1) from what I'm seeing, the CPX has RGB, not RGBW. To change to RGBW, at minimum you'll need to update the neopixel module to facilitate the extra W info, as well as any functions that call the module. I didn't look too far into, so you may have to do a fair bit of reading.
- no need to pass
none. just don't define theHW_LEDparts, and if you aren't going to use the pins at all, remove their definition fromboards/nnn/pins.c. the pins are also#ifdefed insamd51_pins.c.
ah, now i get what #ifdef means thank you
you're welcome! C land is a mystic place... ๐
@raven canopy thank you. i hope i get to know C well. the brd file for the cpx has ws2812b pixels on it, maybe it is just the same pinout for the housings ? and so does the m4.
eh, ill just use rgb then
@marble hornet the best that i understand it is that the ws2812b is only a revision update that dropped the pinout from 6 pins to 4, and some other mechanical, etc improvements. the 'b' is not differentiator of RGB vs RGBW.
ah
@meager fog do you use a ferite inductor on the m4 express?
if you don't mind my asking
afaik it's present but not enabled in the firmware
@hearty stratus i2c address - jumpers. MCP23008 port expander (and similarly: PCF8574) is a case in point: it has three pins dedicated to setting the chip's individual i2c address. http://adafru.it/593
The addresses are sent in the data stream (like everything else). It's not like SPI where you need a Chip Select line for each device on the bus.
Generally a class of chip will have a unique i2c base address, and will provide a three-bit variation on that address for the individual instances of use.
This allows the user to leverage a much larger address space for devices that are quite different from one another, functionally, to share in the same i2c bus, cooperatively.
okay yeah @marble hornet @stuck elbow has it right.
RGBW is there (since you aren't at all restricted to the singleton RGB/RGBW LED on the target board).
I just did a quick project yesterday where I turned on the onboard NeoPixel (NPX in my personal parlance) .. in one color, and all the others (on an 8x NPX strip) in the 'opposite' a contrasting color. Just for fun.
simple program for Metro M4 Express, leveraging external NeoPixel array connected to D12 of the M4X.
(delimiters 'please' and 'thank you' implied but unstated, here)
EDIT answered (see below)
$ unzip -t adafruit-circuitpython-bundle-2.2.3-mpy-20180525.zip | egrep \.mpy | wc -l
129
$ unzip -t adafruit-circuitpython-bundle-3.0.0-alpha.2-mpy-20180525.zip | egrep \.mpy | wc -l
129
$ unzip -t adafruit-circuitpython-bundle-py-20180525.zip | egrep \.mpy | wc -l
0
$
$ unzip -t adafruit-circuitpython-bundle-3.0.0-alpha.2-mpy-20180525.zip | egrep \.mpy | sed 3q
Archive: adafruit-circuitpython-bundle-3.0.0-alpha.2-mpy-20180525.zip
testing: lib/adafruit_am2320.mpy OK
testing: lib/adafruit_amg88xx.mpy OK
$
The bundle without versioning (just the date) in its name is to be read as 'bundle-py' to indicate it only has .py and not the (usual, required) .mpy files. It's the source (, Luke).
This has baffled me for months.
Wendy, my head hurts.โโโโThe Shining
"The source will be with you.....always"
could i run my schematic by someone?
for a atsamd51j board ?
i'm going to add the header holes later
Same program as above (scroll back) with some edits. NeoPixels on D12 and the internal pin (40) for Metro M4 Express (M4X as I call itt).
just as an FYI, not sure it needs an issue filed - the shipped main.py doesn't work on metro m0 express on beta 3.0.0b0 with the May 25th lib bundle. MemoryError: memory allocation failed, allocating 1016 bytes
I'm preserving that main.py for future reference.
any idea when it was last edited?
Claims Jan 4th. Dunno if that's right.
Sounds right, I think. I'll see if I have it here somewhere.
I can pop the file someplace. Probably worth filing an issue. BTW, I used this to update: (cd /Volumes/CIRCUITPY; find lib -name \*.mpy) | while read a; do cp $a /Volumes/CIRCUITPY/$a; done; sleep 3; find /Volumes/CIRCUITPY/ -name ._\* | xargs rm
(it has an embedded F111 haha)
I just read your syntax. Nice. I don't use it that way but I think I could.
(cd /Volumes/CIRCUITPY; find lib -name \*.mpy) | while read a; do cp -v $a /Volumes/CIRCUITPY/$a; done; sleep 3; find /Volumes/CIRCUITPY -name ._\* | xargs rm -v is probably more user friendly.
I have a scattered use of my human short term memory so an embedded 'read' there would kill me. Still very useful to know on the occasion where things are highly repetitive and some interactive input is desired.
$ (cd ; find . -name \mai*.py) | while read a; do ls -la $a; done
This didn't do what I thought it did. I can do this. ;)
(cd /Volumes/CIRCUITPY; find lib -name \*.mpy) | xargs -tn 1 -I {} cp -v {} /Volumes/CIRCUITPY/{}; sleep 3; find /Volumes/CIRCUITPY/ -name ._\* -exec rm -v {} \;
cleaner version
there's like a dozen ways to do this ๐
booyah. I don't have a replacement for the actual utterance I use for this. ;)
I had zero clue that read could be used in this way. find has always baffled me
so anyway I can't find a copy of your main.py with such an md5sum.
I'll go post an issue.
I probably have that exact file but can't lay my hands on it.
I want to see what it does. ;)
seems to me that as long as it ships with a working main.py it's 'finished bizz' -- when they upgrade they can worry about why it no longer works, separately. ;)
I bet dollars to donuts that one of the last things they do is make sure that main.py operates in the current context ('as shipped').
The issue helps the advanced newcomer (&c.) to identify and correct the error for their personal use, quickly, and to document its existence.
MemoryError: memory allocation failed, allocating 1016 bytes
After using the attached updater to update the existing libs to the May 25th bundle, I get a memory error.
Adafruit CircuitPython 3.0.0-beta.0-22-g754c36bb3 on 2018-05-26; Adafruit Metro M0 Express with samd21g18
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Traceback (most recent call last):
File "main.py", line 14, in <module>
File "adafr...
The problem is for that newcomer to go down that path where they end up at the issue, read it, and learn what needs doing.
Filing the issue also helps make sure main.py is compatible by the time 3.0.0 RC is out ๐
Well those guys know what they're doing and better yet remember what they did, recently. Youth!
I have to not do lots of things like leave the stove ON at two in the morning and LEAVE that room (kitchen) for any reason at all. every time.
I've found one too many pots boiled dry that way.
I just wanted a cup of tea. Is that so wrong?
Why not add a temperature probe above the stove that has alerts you if it's left on >30 minutes after a certain time or >1h the rest f the time
So. There are .WAV files in that version of the firmware, resident in flashROM filesystem.
Roy, every automation usually requires human input. ;)
โค
digression - skip and avoid the following many lines of digression, led by me.
๐น ๐น ๐น
If you're not all that old yet you'll get to see this first-hand, someday.
โคโโโMy brother remembers very little from years back; it's at the point where he's convinced things that happened only to him happened only to me, because I remember their stories and retell them.
He keeps asking if it was him or me that the story happened to.
yep. or it works poorly.
i have a lot of automation around the house that only half works.
or works half the time
I'm at about 72 percent on using the Android alarm clock effectively.
(mostly the stuff using zigbee and zwave are buggy, wifi stuff is more reliable)
Many times it goes off when I'm in the shower or otherwise unavailable to shut it off.
my watch helps me solve the alarm going off in the shower.
since i can shut the phone's alarm up with the watch
๐น ๐น
โคโโโI have all my (several) android alarms set to dead-man's switch off after about 2 minutes.
Surprisingly, I rarely miss one the first time it goes off.
โคโโIn the Air Force someone's wrist watch alarm went off while we were at Parade Rest (standing perfectly still and unable to move without a breach of protocol).
โคโโLike, 1982 or so. ;)
โคโโI don't think mine ever did that, but at the base theatre, near (but not 'on') the hour, lots of watches would beep during the movie.
Mine of course beeped exactly on the hour (and was the only one that did, by a long shot).
โโI used WWV broadcasts every week to reset it to the correct time.
Sorry this isn't the chatroom. it's #circuitpython-dev haha -- my bad!
/digression
๐น ๐น ๐น
:).
yay it was a quiet day and i finished my arcade wing prototype
eaglez
schemz
@ruby lake sekretly its also a porta-synth with a touchscreen interface
Mostly quiet here too, but I did much less awesome work. ๐
(Also discovered the angel-heart-kitty on the Metro M4 Express)
@meager fog how much big a speaker? ๐ Cool looking wing. Does it pair with the TFT FeatherWing?
Hmmm... I wonder if there's a way to rename the volume name from CIRCUITPY to help make it less confusing when I have... uh.. 6 devices... connected ๐
@ruby atlas its a 'superset' of the TFT featherwing, you can still use any 2.4" featherwing code but now has xtraz
@tough flax i added an AT hacking port!
its at the bottom, you can externally trigger buttons - a great idea ๐
Circuit python LED animation โlabโ is ready for use.
It's become obvious with the bigger strips or arrays that my first step is going to need to be making tuple to byte structure performance good.
How less efficient with memory is CircuitPython than coding with Arduino? I'm getting mem allocation errors when I'm only half-way done converting my bot's original Arduino code to CP.
Pack probably significantly. Have you tried putting some code into libraries and using mpy-cross?
That can reduce the startup overhead. Are your memory errors during runtime, or during compiling?
I was actually thinking about that. Got them during compiling to the CPE+CRICKIT
I'd give mpy-cross a whirl. Does your code need much operating memory for variables?
I have about a dozen static variables just to make coding the servo positions easier. My code is mostly just hundreds of alternating time.sleep and var.angle lines.
You might find it easier to encode that as data and loop over it than to deal with mpy-cross
Hmm, the problem is the servo movement is timed to audio for mouth, head, eye movement. Each conversation has different timing and movement positions.
I don't know what the args to var.angle look like, but you might find a structure like:
steps = ((2.23, "var.angle args"),
(1.33, "second step args"),
)
for wait, var_args in steps:
time.sleep(wait)
var.angle(var_args)
the above approach should result in much more compact bytecode
(doesn't mean it will, but theoretically it would)
but it would also let you move the step data out into an mpy to free space if needed.
the tuples can contain more data than just 2 items. it's just an example.
Basically, it looks like this, where hs and ms are my servos and the variable at the end is the servo angle.
if ss.digital_read(RF2):
time.sleep(.59)
hs.angle = hr
time.sleep(.3)
ss.digital_write(SB1, False)
ms.angle = mh
time.sleep(.31)
ms.angle = mc
ss.digital_write(SB1, True)
time.sleep(.15)
ms.angle = mp
time.sleep(.15)
ms.angle = mh
time.sleep(.5)
ms.angle = mc
time.sleep(.1)
That's just a small part of one 32sec conversation that takes up about 260 lines... and each bot has 4 conversations stored.
I'll try that, though, thanks!
Once you figure out a good way to encode those conversations as data, you'll probably also find them easier to maintain ๐
While I try to figure out how to restructure these and see if that works, is there a way to go back to using Arduino on the Crickit for now? I just tried and I keep getting "avrdude: butterfly_recv(): programmer is not responding" right after CPLAYBOOT mounts while uploading.
@meager fog perfect! Thatโs exactly what I had in mind!
@slender iron @tulip sleet @meager fog I am excited about the Metro M4. I tried to do a Word Clock with a Feather M0 this year and quickly ran out of memory. As a result I converted all my CircuitPython code to Arduino C and then was able to add lots of demo screens. Once I got the Metro M4, I convert the C code back into CircuitPython. I am happy to say, that I still have memory left over. Yeah!. I wished I had the M4 to begin with. Thanks for all your hard work. I look forward to a Feather M4 someday.
I'm glad its working well for you @fading solstice !
kicks self after looking at oddly set register vs expected set register so many times, to FINALLY realize that was causing the problem the whole time ๐คฆ
I don't know if this is by (unfortunate) design or not, but time.monotonic() slows down under pressure.
I run a script to measure RTC accuracy and it slows down the monotonic clock.
This snippet is run on the board through the REPL to give me the moment that the second ticks over:
import time
lt1 = time.localtime()
lt2 = lt1
i = 0
while lt1.tm_sec == lt2.tm_sec:
lt2 = time.localtime()
i += 1
m = time.monotonic()
print("%%s:%%.6f:%%d" %% ( str(tuple(lt2)), m...
@kattni i think you already wrote this code? goes here
https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/power-management
(its a shared page with feather m0 basic but the pinouts are the same)
@ladyada It was part of another project. I cleaned it up. Is this what you're looking for?
import time
import board
import analogio
vbat_voltage = analogio.AnalogIn(board.D9)
def get_voltage(pin):
return (pin.value * 3.3) / 65536 * 2
while True:
battery_voltage = get_voltage(vbat_voltage)
print("VBat voltage: {:.2f}".format(battery_voltage))
time.sleep(1)```
yeah like that but you dont need the while()
yeah HID got h000ge with the new controls. here's code that will work but run out of memory when you play audio, @dhalbert will look into 'freezing' HID into metro m0 to save that memory
Ok I added it to the page. Should be good to go.
Is there a repo that contains the initial CircuitPython images for the various hardware? I couldn't find one, but think that would be a better way to track this than sharing around code files. It would make it easier for people to do PRs and also see how the code evolves over time (eg 2.0 to 3.0 circuitpython)?
https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/downloads
is where the files are now, there's no repo at this time the 3.0 code doesnt fully work either so we only want to place it here where you can read our warnings
Google isn't helping me with this one... Are there any circuitpython profiling guides?
profiling the Python code or the C code?
Yes! ๐
you can call time.monotonic() and print out elapsed times ๐
I have the Jlink gdb setup working as of last night... But didn't go down the path of the Atmel Studio on Windows.
heh, yeah, i was afraid of that.
led-debugging, print-profiling ๐ All fun.
You can also do it with a Saleae, if you're talking about what I think you're talking about.
Though I know that doesn't help you right now
Right now I just want to know what to focus on first when fixing performance of Neopixel and/or Dotstar tuple-to-binary conversion.
If it's even a problem.
(I'm sure it is)
I was looking at the code yesterday, so I probably saw that. But I'll check again.
Read the PR comments: https://github.com/adafruit/Adafruit_CircuitPython_DotStar/pull/24
I haven't had a chance to do the same with NeoPixel yet.
Neopixel also has the C helper.
But yeah, there's lots of optimizations we can do to the python code, even before we start adding more helpers in C.
The C helper exists mostly just to get the timing right. Yes, I think there are things that could be done to the Python code to speed it up, such as pre-fetching indices, not generating garbage, etc. The enumerate to range change made a big difference.
Any idea how to use the optional interrupt pin on the JoyWing Featherwing? I assume it's an interrupt for the built-in seesaw, and therefore uses the seesaw lib. There are two instances of int in there, one of which is a commented out section. The guide says you can use it so you're not polling the buttons constantly, but I have no idea how to use it, as I've only ever used an interrupt pin on the LIS3DH.
There's no example code that uses the interrupt pin for CircuitPython.
not sure that pin will help with CPy, since it's just an indication that some button has been pushed. We'd still have to poll for that pin, since we don't have interrupts.
Hmm. Ok.
Would it get me away from having to use const though?
in that example buttons = ss.digital_read_bulk(button_mask) sets a bitmask. If there are no buttons pressed buttons will be zero, so that's a quick check for any activity.
The code I'm actually using has a bunch of functions in it (I stripped it from the Joy Featherwing library I wrote, not using it with a Feather, so I can't simply use that helper lib I wrote) that cleans up the core of the code, but it still has the const stuff in the helper functions.
you mean like the BUTTON_RIGHT = const(6) consts?
Yeah.
I'm using this code essentially: https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing/blob/master/adafruit_featherwing/joy_featherwing.py
But it's the same thing just rearranged into helper functions.
why don't you want the consts?
To make the code seem less like a driver, I guess.
would you rather get back a tuple of pressed buttons?
Not for any technical reason
you still have to identify all the buttons, and know which bit in the bitmask corresponds to which button
If this code is as simple as it's going to get for what it does, then I'm fine with it. It seemed like it was somehow more complicated than it should be. But I don't understand the board well enough to know that's true or not.
Ah
Ok I'll stick with the altered version of the helper lib I wrote.
It at least makes the code bit simpler.
Actually I just realised the FeatherWing library works as is.
So as long as I don't run into memory issues, my code will be super simple looking.
@tulip sleet Thanks for the help. I would have spent useless time on that trying to figure it out.
I assumed because we used int on LIS3DH that it would work the same way. It does not.
After some testing yesterday, moving the majority of neopixel.py _setitem() to C speeds it up ~5x. (on top of the speed gain from using range() instead of enumerate() in fill(). I haven't even optimized that any - lots of arg passing in the test implementation. (I pushed my prototype code to my forks for now)
i'm starting to think that there is some undocumented errata on SAMD51 TC capture on pin... or my comprehension is that much less than i admit even to myself. ๐
@raven canopy There's always undocumented errata. ๐
I wonder if any project (or book, etc.) ever converges on 0% undocumented errata.
Its a feature, not a bug
all valid points! ๐
@ruby atlas "The Art of Computer Programming" gets close
@ruby atlas y I know one book that fits: A Million Random Digits with 100,000 Normal Deviates
hah
@dhalbert can you try running https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Crickits/gear_tower/sound-motor.py
with a DC motor, see if you can replicate some crashes we saw? no REPL was attached, i think it was just a reboot
@slender iron you got a moment for a M4 question?
sure
i'm seeing weirdness wrt setting a TC up for capture on pin. Working with pin D11 (PA19), which is mapped to TC3, WO1. When setting CAPTEN1, CAPOEN1, and INTENSET.MC1 i am immediately getting INTFLAG.MC0. If i then enable INTENSET.MC0, i get stuck in a loop with nothing coming in on the pin.
I can't find any errata on the subject, and am currently looking at the "IOSET" remarks. Do we deal with that at all?
I haven't played around with capture at all
why are you using the approach of measuring a single period?
missed clarification on my part: IOSET config is with the PINMUX....
why single period? less overhead is the biggest reason, i guess. I could easily pivot to a buffered array. but it's proven quite accurate as a single read.
I was thinking you'd use the event to increment the counter and then use ticks to know how long it too to count a set number of cycles
then you have one interrupt after the count is reached
it'd only be bad for very low frequency signals
like i said before, TC capture already does that in my understanding. it dumps the count period out.
yeah, Dan and i discussed that. it definitely doesn't like 1Hz...
the count is driven by the GCLK
I'm suggesting driving it by the input signal/event
hey all! happy car discount day.... i mean memorial day.
why would we need to measure 1hz? power will be 120 and the light sensor is in khz
we use JLink. not sure if openocd supports it yet
what program ?
jlink comes with software too
i have an edu model that ive used with adalink. but you can upload without another program form segger?
you should be able to use the jlink software with the edu model
https://www.segger.com/products/debug-probes/j-link/tools/j-link-gdb-server/about-j-link-gdb-server/
@raven canopy I'm happy to voice chat about this if you like
use case for 1Hz is definitely small (i'm not too concerned with it). 8KHz is where my current tests start and runs above 1MHz.
And no real need to chat, just yet. I'll probably just abandon the direct pin capture on TC, and use the EIC/EVSYS same as M0. That's already written, so it's not that time consuming. ๐
thank you @slender iron
am i looking for "J-Link Software and Documentation Pack" ?
@raven canopy EIC to cpu interrupt? that will have the same frequency limitations
was just curious if the IOSET config may be causing the weird stuff i'm seeing. the datasheet mentions it once, and doesn't explain it very well. :go_figure:
I don't know what IOSET is
sweet. i'm not alone! ๐
does anyone have experience installing gdbserver on mac ? i'm running high sierra 10.13.4 OR any other way of uploading firmware to a factory fresh atsamd51
any help is MUCH appreciated
https://github.com/adafruit/Adafruit_CircuitPython_MatrixKeypad
hey @kattni this should be ready to rock, please travis & bundlify & anything else we need to do for new libraries
@slender iron Do we want to add consider-using-enumerate to the pylintrc disable? (it suggests consider using enumerate for iteration instead of len and range)
either way is fine with me
@marble hornet I use it on mac and just installed it off of their site
What do you think the problem is? I don't think its a matter of monotonic being incorrect but rather how quickly the loop runs. The slower each iteration runs, the coarser the time it takes to find the seconds boundary.
Monotonic is driven by an internal interrupt based on the SysTick timer. The only way I'd expect it to lose time is if interrupts are disabled for more than a millisecond.
@slender iron Where did you find the link? The file I found was. Gz.
Download the latest SEGGER trial versions, eval packages and user manuals!
Jlink software and doc package -> click for downloads. then it shows a list of OS versions
k, I'm off. night all. talk with you all tomorrow
๐
<@&356864093652516868> Don't forget the meeting is tomorrow here on Discord. 11am Pacific / 2 pm Eastern
night @slender iron
Sleep well @slender iron
@ruby atlas So the question is about range(len(value)). As it stands, pylint complains about it saying "Consider using enumerate instead of iterating with range and len". I can add it to our pylintrc disable command and disable the check if we think that it should be allowed
i personally think we should allow range(...) over enumerate() due to the large performance difference.
I think it's a valid way to do things and I think it can be more readable at times which is a consideration for learn guide code.
but i guess it's context dependent - if it's not a tight loop or there's a lot of time in time.sleep() after such a loop, it may not matter.
I think if people are running into speed issues, they can research it and learn about enumerate from that angle instead of being forced to consider it every time.
do we have an optimizing CP code page?
Not yet, though it's been discussed
Ok I added it to the disable. Thanks for the input ๐
It's not like it's hard to revert that if others disagree ๐
(yay version control!)
can anyone explain to me what 'frambuf' module does ?
im using an OLED with a trinket m0 but even without it, i dont seem to need to import it for it to work
the guide says to get it but not sure why.
@hearty stratus I've done some poking around in the CP repo, and it looks like Framebuf may have been re-implemented. @slender iron would know for certain.
i see
happen to know how to update an OLED any faster?
or is it always just painfully slow?
i have a pressure sensor and when put the readout in a while loop it's very speedy in console. as soon as i display the results on OLED its only ~1sec per loop
I've never used an OLED, so I'm not familiar.
no worries ๐ somebody else might know
do you know if it's the update that is slow, or the drawing of the text on it?
also, which board are you using?
@tannewt I would be happy to add these properies. I will need to order a sgp30 board.
The thing is, monotonic should always have elapsed one second or more, never (much) less. I'm using monotonic to measure the time it takes for one second to elapse on the RTC.
I have now run the same test on a Metro M4 Express, and it doesn't show the same problem.
This is with no sleeping in the loop: +700 loop iterations and ~1.0 second elapsed on monotonic:
+0.005894 secs / 0.000025 days = +234.605899 secs/day (+2715.35 ppm) : 29 May 2018 00:00:02 (56083.937 - 56082.935 = 1.001) ...
@ruby atlas @idle owl I think pylint is off-base or thinks that for loops usually use the value. enumerate() instead of range() only makes sense if you're actually fetching the values:
for i, v in enumerate(l):
print(i,v)
instead of
for i in range(len(l)):
print(i,l[i])
But if you're not using the value, it's a total waste of time:
for i, _ in enumerate(l): # pointlessly fetching the values
l[i] = i*2 # or something like that
@hearty stratus framebuf is turned on in the Express builds (separate SPI flash chip), but not small builds like Trinket M0. Writing text is slow without framebuf because it's writing the character bitmaps out a pixel at a time with Python code.
Hey everyone, quick question. Is the module '''ntptime''' supposed to work in CircuitPython? Importing the module in v3 crashes my ESP8266 feather and the module isn't functional in v2 because CircuitPython doesn't support utime. Thanks!
Go ahead and order one (and other other sensors of interest). I think @brentru may have started the sgp30 work though.
I don't think that's what your code above is doing. I think its measuring the time until the first seconds change from script start up. I don't see where it waits to ensure the first monotonic is captured on a seconds change. Do you have an updated version of the code?
@prime flower did you pick up the issue #622 for sgp30?
I can get this to crash even without doing any motor setting in the main loop, so I think it's just a PDMIn. It randomly stops at some point. I've seen 81 times or a few hundred times go by before it hangs. I'm wiring up a PDM mic with a Metro M0 so I can debug easily.
@fading solstice working on it rn, testing on hardware either later today (unlikely, I just got back to HQ this morning) or tomorrow AM.
..speaking of which I'm going to request a SPG30 rn
@granite vapor not explicitly supported. You could try import time as utime in v2 but it may not provide the functionality you want. When you say "crash" do you mean an error (visible in REPL) or hard crash?
The script might be a bit convoluted since it has evolved over time without getting a cleanup.
Basically what it does is:
- Set the RTC to the same time as the Raspberry Pi
- Wait for the RTC to tick a new second, report/print the struct_time tuple, the monotic value and the number of iterations
- Print the diff between the clock on the Pi and the board, print the diff between the current monotonic and the previous one
There is some dump code in here that I've used when only checking t...
Working through the SGP30 right now.
@tannewt Do we want properties for the baseline sensor readings (would be the same as the call in the example :https://github.com/brentru/Adafruit_CircuitPython_SGP30/blob/master/examples/sgp30_simpletest.py#L27) as well? Naming would be: tvoc, tvoc_base, co2eq, co2eq_Base
@tulip sleet On a freshly-flashed ESP8266 feather with the latest beta of circuitpython, the python statement import ntptime causes a bunch of gibberish to be printed to the REPL and then a restart occurs. The interesting thing in V2 is that ntptime.time() successfully pulls the time from the server, but the settime() function generates the ImportError.
@granite vapor Thanks! Would you mind filing an issue at https://github.com/adafruit/circuitpython/issues?
Adafruit CircuitPython 3.0.0-beta.0 on 2018-05-23; Adafruit CircuitPlayground Express with samd21g18
Using the most recent 3.0 comparable libs.
Tried running the Adafruit Sound Meter demo which resulted in the following error:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Traceback (most recent call last):
File "main.py", line 68,...
frequency changed to sample_rate in 3.0. If you rename that argument, it should work.
I will update the example code.
I'm debugging another problem with PDMIn which causes it to hang: #879.
Just changed the argument to sample_rate. Confirmed that it works now. Thanks!
@slender iron ~30 minutes to weekly meeting, right?
yup!
Excellent.
And on that note .. ๐ต
Instead of freezing in HID why not simplify the code.py? I think the all encompassing example code is overwhelming for beginners. Ideally, it'd be <20 lines total. We could ship other examples (like HID) on the drive in an examples folder instead.
It'd be awesome for the bundle to include examples and be shipped on express boards as well.
ok ill remove HID from the example
Yes please. I'd name them baseline_tvoc and baseline_co2eq though. Thanks!
By the way, does the raw repl from micropython exist in circuit python?
Ah, its possible that the USB code is starving the SysTick interrupt. Try a similar test that doesn't use USB actively while measuring monotonic vs the RTC.
If it does, it should be called a raw-pl
I was wondering if there something like bitio could work with circuitpython. Bitio depends on raw repl.
IT would need a new name, I guess. Circio?
I don't know what it is
That kinda sounds like some anciaent Roman.
Bitio works with the microbit.
It create a library wrapper for micropython functions.
That should work @wraith tiger could be something that could be looked into
IT allows micropython code to run on the computer, but passes off the microbit specific function call to the microbit via usb serial to the raw repl.
I'm text only today.
<@&356864093652516868> meeting in two minutes!
My mechanical keyboard normally annoys people
@fluid helm you can in settings make it push-to-talk so the mic isn't constantly on
Sorry, I won't make today's meeting.
Yeah, the desk sounds were the main culprit.
settings -> voice and video -> push-to-talk
blinka-powered usb-hid discord button?
I have given great monologues, heard by nobody because I wasn't pressing the button.
i always forget to push too
Hello!
On the most recent version of CircuitPython (3.0 beta), the statement import ntptime crashes a freshly-flashed Adafruit ESP8266 feather. A bunch of gibberish gets printed to the REPL and then the device restarts.
On a related note, the V2 ntptime module doesn't work either. ntptime.time() correctly pulls the time from the time server, but ntptime.settime() does not properly set the rtc module, failing at an ImportError (no module named utime in CircuitPython).
...
(prob not going to catch this meeting, have another one that conflicts, but I'll try to come on. if not - next week forssure)
@slender iron sigh I have dad duties to fulfil right now, otherwise I'd be there. Congrats to everyone on all the things in this: https://www.adafruitdaily.com/2018/05/29/circuitpython-3-0-0-beta-available/
hugs to all
๐ค
@plucky flint Thanks!
-> dad taxi stuff ;-)
@plucky flint I hope you're suitably dad-unfashionable while taxiing ๐
Sorry I'm late. Day job meetings are not as fun...
Are they not meeting your requirements for enjoyment?
Hug Report: Customary group hug to all. Keep up the good work. Haven't really been keeping track lately, though
Group hug to the 3.0 team. Continuing to test older projects with the beta version and liking what I see.
Hug for Tony Dโs historical CPy work on the OLED wing and UART code, and to the folks who improved busio. Thanks!
Yay for Perl.
@raven canopy Yes, a great guide!
To @tulip sleet for stepping in and providing more pertinent information to someone where I was more off on a peripheral aspect of what they were trying to do. I don't remember the specifics, just that I was glad Dan was there and more on target. ;)
General kudos to all.
@oDavid, @brentr, @kattni, and @Mike Barela for reviews, insight, and moderation on the Atmel Studio guide. Group-hug-orama for continuous support here and on the forums!
Status update: Last week I was in Seattle, and met up with @slender iron - Much tech was talked, and I now own a Game Boy. I'm also planning on (eventually) making my DigiBadges CP-powered, but that's far-future stuff.
That game store was awesome
A week of โFun with MIDI Synthesizersโ trying to figure out exactly what my MIDI controller keyboard was sending โ and why. Had to dive more deeply into the MIDI protocol than ever before. Created a sniffer with CPy that used a custom MIDI interface Wing PCB to feed the UART pins on a Feather M0 Express. Implementing the MIDI protocol stack in CPy with verbose descriptions was a memory hog, but eventually was able to get the sniffer to fit on a Trinket M0. CPy was sufficiently responsive to a 31.25K baud data stream and didnโt drop a byte -- once I figured out what I was doing. Sniffer code is here: https://github.com/CedarGroveStudios/MIDI_FeatherWing
My Trinket-sized modular stackable interface PCBs should arrive later this week. The plan is to use the โRoverโ boards to build some musical synthesizer projects, upgrade the StringCar to manage LiPo battery power, and significantly reduce the StringCar controller footprint. Hoping that Adafruit gets the Hot Air Rework Station back in stock this week so that I wonโt have to place an order with that faceless Amazon monster. ๐
Impressive
I fixed most issues with ยตGame in CP 3.0 (pull request in review). The last problem still left is the new memory requirement of AudioIO, which makes the existing games not run anymore due to MemoryError. Next, I will try to optimize the ยตGame firmware a bit in terms of free memory and speed โ remove any unused modules and options, play with linker settings, make SPI transfers non-blocking, etc. The ยตGame Turbo (with SAMD51) is now cancelled so I will have more time for software. I also tested the CircuitPython Badge at the Hackaday Belgrade conference, and I'm very happy with how it works โ both the visibility of the display and the power consumption of the whole thing (lasted 3 days on 3รAAA alkaline batteries).
There was a badge on the conf, and they made it run micropython: https://twitter.com/micko_mame/status/1001154959935791106
And Now for Something Completely Different :)
@micropython running at @hackaday badge
Full code and prebuilt binaries available at : https://t.co/uvJfo1dloU
In part โ basically I can't make it any better than Lady Ada will :)
That's great, @fluid helm!
Will do!
Oh yeah, if your looking into product photo's, Sandy from Pimoroni has written this handy thing http://sandyjmacdonald.github.io/2018/01/11/story-of-the-shot-part-I/
to make nice images like this
โคโโPulled into the rabbit hole of writing firmware for the new Crickit (CPX variant) board.
โโHave an operational Forth interpreter for the Crickit.
โโBase is ItsyBitsyM0 Arduino; CPX, Trinket M0 and ItsyBitsyM0 can all be used as a base for this board.
โโThis is of course off-label use of a Crickit; it bypasses the need for a bolt-on CPX for certain low-demand applications.
โโAlso built the canonical firmware for Crickit, and loaded it without difficulty.
โโNOTE: The 3-terminal NeoPixel connector on the Crickit does not require any new software -- it is a passthrough connection and does not operate via i2c. That was in the Guide but is easy to miss.
โโCircuitPython use of Crickit seems easy and intuitive - I expect a short learning curve for newcomers, once the basic concepts are understood.
Nothing to report yet as far as progress, hopefully more next week.
I'm thinking that I may mess with a python vim plugin as an intermediate step, attempting to interact with the microbit via uflash and microFS (and maybe bitio) before messing with the thonny code.
@timber mango I'm impressed with your rabbit hole travels.
Atmel Studio guide is published. Ran a couple more iterations of trying to use the "Project from Makefile"; still hitting toolchain hiccups. Won't be giving it too much attention.
High Frequency PulseIn: SAMD51 TC capture direct from pin isn't going well. Might just use the same method as SAMD21 (events trigger the TC interrupt). After that, I'll tighten up the documentation and push a PR to get it reviewed by professionals: ๐ I still need to research porting to other chipsets, and/or stub them.
ESP8266 GPIO12 .configure: should be a straight forward fix. Just need to carve out some time.
YAFFA-ARM - Yet Another Forth for Arduino. My port of it in this tree (URL provided points to a local copy of the upstream source):
https://github.com/wa1tnr/ainsuForth-gen-exp/tree/master/0-Distribution.d
Runs unmodified on Crickit via the programmer's USB port!
To use: connect as with the REPL and type the ENTER key once. A >> prompt appears. Then (optionally) type words to get a list of the forth vocabulary this software knows about.
Yeah, doesn't fit this case that I saw though... I'll look again.
The current PR for the Learn Guide repo is here: https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/200 This failure list is the most up-to-date. Please let me know if you want to help so I can explain how I'm doing it and make sure we're not duplicating work.
I'd like to talk about the AudioIO buffer, if possible. Would it make sense for me to send a pull request that lets it use a pre-allocated buffer?
Q: any plans to improve text handling for the OLED wing? (and TFT wings?)
I have a topic discussion, what are the next steps to get CircuitPython more exposure in the classroom. Are there plans to have classroom dedicated resources for teachers?
Alright everyone, I've got some things that need doing. I'm going to hop out and get working on them. Enjoy!
Thanks @cunning crypt!
Haha. I was about to type ":sniff: D :sniff: MA"...
Cool, thanks for the answer ๐
@fluid helm I have had the same question before. One reason we created the #classroom channel as a discussion resource.
rotary encoders are huge and I'd like to see them become as common as potentiometers
pound sign a.k.a. hash a.k.a. hashtag a.k.a. octothorpe...
An I2C rotary encoder breakout would be useful.
I'm working on my first learn guide. a micro:bit EduBlocks light up house with neopixel rings
Brilliant!
Thanks everyone! Fantabulous day, to you all! ๐
Great meeting today. Thanks all! Time to get back to fretting MIDI sniffer -- OLED display details.
I better go too and sort CircuitPlayground stuff out for tomorrow, thanks guys ๐
thanks, bye
Good luck, and have fun @fluid helm!
Alright. I'm off too. Gotta pay more bills... ๐
I learned a lot about how target board designers select port pins to offer to the end-user by trying to port the Crickit over to Arduino. The comparative study between the D21 variants Adafruit makes, was instructive.
What time is it in the US? @slender iron
14:51 NYC he's Seattle area so he's 11:51 a.m. PDT
Nearly 3pm on the East Coast
Nearly 8pm here, and it's still boiling
It's been inordinately warm here as well.
30ยฐC here 86ยฐF .. TD (dew point) 18ยฐC 65ยฐF near New York City (Northwest Connecticut 73W 41N)
I didn't take much mathematics in high school .. and later in life most of what I'm interested requires a much higher level understanding of math than I have.
Anyone have/use an @adafruit Audio FX board and know the answer to this question? https://t.co/e31HNryGHk
anyone help on this?
dunno if this is pythn related
They may not know about our Discord.
I tend to just help them discover the answer, interactively; the odds of matching a person who knows the specific problem with the asker are low at any given moment (so forums can help there, if you have time and patience to wait for a reply).
A lot of times the asker wanted a much simpler answer than the answerer has supposed. ;)
BTW, for anyone would like to hear about what bitio is, here's the author at PyCon UK: https://youtu.be/MnjMLWvRV6Q
David Whale | Saturday 15:30 | Room D bitio is a small and simple Python package that enables your BBC micro:bit to become an input and output device for you...
I'd prefer a storyboard I can scan with my eyes in about 3 minutes. ;) Haha
@fluid helm implemented bitio in EduBlocks.
Indeed I have
3:05 pm here on the east coast (NJ).
The thermometer I have outside the window says 96F, but the sun in shining on it so it's reading higher than the air temp.
this page is a little barebones :)
https://learn.adafruit.com/adafruit-crickit-creative-robotic-interactive-construction-kit/circuitpython-code
@kattni please copy over the side2side elements and pix from
https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart
into the crickit BUT KEEP THE SPECIAL UF2! no new screenshots are needed, we'll have the same pix/animations, just a different UF2.
YAFFA-ARM sample session.
https://www.forth.com/starting-forth/
Is a much better introduction to Forth. 'gforth' is recommended for beginners.
>> 1 13 pinMode 1 13 pinWrite 500 delay 0 13 pinWrite
Sets up D13 as OUTPUT, writes a logic 1 to that pin, delays 500 ms, and writes logic 0 to the pin.
In one line, it sets up a port pin, and toggles it on, briefly, in OUTPUT mode. This will flash an attached LED to that port pin.
Generally if you connect an LED thru a 1k resistor to SERVO1 of the Crickit, and try to blink an LED on D13, it will blink (SERVO1 is mapped to D13 on at least two Adafruit M0 target boards, including the ItsyBitsyM0).
Same utterance, in YAFFA-ARM, when compiled against ItsyBitsyM0 (D37 is the onboard LED):
1 37 pinMode 1 37 pinWrite 500 delay 0 37 pinWrite
Now (using pin 37) you don't need an LED on SERVO1 -- you can access the internal (yellow) LED directly!
'bad' target boards in Arduino IDE won't allow an USB upload without entering the blinking mode of the bootloader; whereas 'good' ones will allow a regular upload via Arduino IDE (which is calling bossac at the right moment).
CPX was the first 'good' one I found; then Trinket M0, then ItsyBitsyM0. I think 'Feather' (all tried variants) failed -- I don't remember.
One thing on my list is to look into separating circuitpython runtime from the flash/usb infrastructure. Then put a Scheme runtime in.
w00t.
I would definitely like to try it when you get it going, if you end up doing so.
Same thing could be done with a Forth runtime
Itโs on my list... itโs a long list.
I have like zero follow-through on anything anymore. It's why I dislike stopping halfway, due to exhaustion, hunger, social needs.
I tend to Ahab it to the bitter end, then go to bed.
It wouldn't let me cite Melville. ;)
'Moby Richard' doesn't have the same ring to it.
<@&356864093652516868> Here is the recording from the meeting today. Thanks all! https://youtu.be/uZj2wPK4QSQ
Notes with time codes are available here: https://gist.github.com/tannewt/44d49a98bbe49da42922ce6a044f7626 Join here for the chat all week: http://adafru.it/...
Notes with time codes are available here << first time I have used this facility -- great! @slender iron
we can actually set the merge button to require it I think
its a pretty big stick though
Hmm. Perhaps. But it would otherwise mean me doing this every couple of days to keep up. And we also have people who aren't using PRs. So it wouldn't fail for them, it would fail for the next person. Can it be overridden by anyone if it's required? As in, can certain people still merge on fail. Then we'd sort of have both options.
we could turn off pushing directly (which is a good idea I think) and nag people who fail but merge
Ok. I think that's a good start.
want me to turn off pushing directly?
@slender iron Yes please.
ok, master now requires PR and 1 approval
the lower level of protection only prevents force push
send an email to creative eng about the change to give people a heads up and a reason why we're doing it
Ok thank you
@hearty stratus no tutorial yet; there's just this documentation (and see the caveat): https://circuitpython.readthedocs.io/en/latest/docs/library/framebuf.html. No room for framebuf on trinket and gemma
@slender iron I'm not sure I know what preventing only force push means. People can still commit directly? Or no
I want to make sure my email is accurate.
no because we require a review
๐
@tulip sleet oh no ๐ฆ my project kinda needs that too
i was able to import fine on trinket m0 but never used it
Really late but hug reports and status report for me (My day unexpectedly got really busy):
- Hug to Kattni for helping ensure I had all the hardware I need to tackle the LED animation. Without her help, I wouldn't have had the right bits to be able to GDB some crashes last night!
Status Report: - I managed to wire up a good range of Neopixels and Dotstars, and upgrade all the firmware to 3.0 on a wide range of boards. During that I only noticed one stock main.py that failed to start after lib updates.
- Once I had some larger strips or matrices working, I got FastLed working with it's canned demo on one strip to see what performance could be like... Then started down the benchmarking path. It became apparent right away that two main things make Neopixel and Dotstars slow. The first is the relatively complex function to set a pixel, which was easy to speed up at least 5x with a C helper. I expect I can make things much faster later on. The other area that could use some help is the brightness reduction code. Since neopixels and dotstars are too bright by default, it's going to be a common use case. I expect to have an alpha of helper function(s) for encoding RGB[w] to bytearray elements ready in the next week or two, which can be used to accelerate _set_item. I feel like this is a post-3.0RC item.
@tulip sleet Travis failed on your PR but I don't see your files in the list, it's all old files. Can we trigger a rebuild? Or should I merge over the failed checks.
Both Neopixel and Dotstar take a lot of cycles to update pixels. There's two different things going on that slow down both. The first is that converting from Int or RGB[W] to the bytearray is complex code that makes updating pixels slow. The penalty for more pixels is O(N) (as one would expect).
The second issue is that when brightness<1, extra work is done during .show() - the bytearray is copied and every pixel value recomputed. This probably also causes unnecessary garbage collect...
@idle owl I think I can restart the job
I have done some benchmarking to understand the penalty of using brightness < 1 is significant, especially with larger strips or matrices (the penalty is noticeable even with a single pixel).
When testing 30, 60 and 72 pixel devices, the speedup from using a simple CircuitPython C helper to update the bytearray members was about 5x. Speeding up .fill() could be even more significant, and a helper to do brightness conversions could be equally significantly faster, especially with a preal...
I clicked on "details" in the PR status for travis. That brought me to the travis page where there was a "Restart Job" button on the right side.
I looked, hmm
Maybe it only shows up if you authored the commit.
Checked another PR that's failing and I don't have a button.
what's that other one?
might be privs. I'll see if I see the button.
Ok keen thanks
No
ok, that's some privileges thing. lemme see if I can turn it on for you
In the "More Options" dropdown do you have a "Trigger Build"?
No, it says "Requests"
k, I think Scott has to add you to something. I can't find any management interface.
Ok
its all based on github permissions
Rev E Feather M4:
Numerous changes. New separate VOLTAGE_MONITOR pin (no longer shared with D9).
AREF pins are no longer available as named pins on any pins (per discussion with @ladyada).
Triple-checked the pin assignments from schematic, but second eyes are good. We can wait and test with the protos also.
@ruby atlas Please reference the issues you files on DotStar and NeoPixel in the CircuitPython issue you filed, if you haven't already. Thank you
@idle owl github seems to have linked them. Checking.
Excellent thank you
here's a new fresh linted example! please try it :)
metro 3.0.zip
Works fine for me on Adafruit CircuitPython 3.0.0-beta.0-22-g754c36bb3 on 2018-05-29; Adafruit Metro M0 Express with samd21g18!
Did not test: D2,D3,D4 buttons or audio out :)
I think I know what I want to do for speeding up NeoPixel and DotStar _setitem() - a pixelbuf class that takes over for (most of) the python bytearray management... specifically handling byte ordering and bpp=3/4 (RGB vs RGBW) itself. It would also probably handle .brightness and do the bytearray brightness calculations itself ... or keep two bytearrays around (optional because of memory) - one with brightness applied and one with original values, updated during setitem. A helper should...
I've googled around a bit and haven't found it yet so I'm hoping someone here can help. I've got a Circuit Python Express and somehow I lost all the files on it. I hadn't modified the factory example program yet but I wanted to explore it. Where can I get a copy of that factory example?
Ah, of course. Thanks @tannewt!
Since audioio has been reworked in 3.0, it now allocates two buffers of 512 bytes each when .play() is called on a file: https://github.com/adafruit/circuitpython/blob/master/shared-module/audioio/WaveFile.c#L102-L112
That is problematic for large programs that already use most of memory, because they can fail pretty much randomly at any moment due to memory fragmentation.
In 2.x, the buffers were allocated once, when the AudioInOut object was created:
https://github.com/adafruit/c...
Hmm, actually it's allocated when WaveFile is created, I thought it was in .play() because I create it just before calling .play(). I think the difference from the old code is that previously the buffer was GC-ed when I deleted the old AudioInOut object and created a new one to play a new sound, but with WaveFile, the old object somehow stays around, and i get a MemoryError when I try to create a new one.
In any case, the possibility of sharing the buffers between different WaveFile objects would be helpful.
@slender iron Follow up on your suggestion for SAMD51's Frequency Meter for measuring frequency in. It only applies to measuring clock frequency:
Overview
The Frequency Meter (FREQM) can be used to accurately measure the frequency of a clock by comparing it to a known reference clock.
Unless I'm misunderstanding what you were referring to, or usage. ๐
@raven canopy yeah, its weird it needs it piped into the GCLK first