#circuitpython-dev

1 messages ยท Page 98 of 1

manic glacierBOT
manic glacierBOT
manic glacierBOT
tough flax
#

Thatnks @slender iron

slender iron
#

np @tough flax

manic glacierBOT
#
[adafruit/circuitpython] New branch created: asf4
timber mango
#

And success! (on a new thing I hadn't posted about here before...)
I wanted to do some sort of fire crackling sound, combined with an led fire effect... on the CPX, using the built in speaker, no external board, etc. No luck in finding code to generate the pink-ish noise.... BUT..... I just got background sound as a wav playing, on a loop, with fire crackles, and the led effects (not fire yet) running at the same time.

#

so one 268k wav file for now... improvable, and likely can do much better... but it works.

#

in circuitpython, btw, if that wasn't clear.

#

my CPX is sitting here, leds spinnings and crackling quietly.

slender iron
#

awesome! @timber mango !

timber mango
scenic timber
#

does anyone know if you can connect a 8266 feather huzzah to a wireless network with coperate security (needs username and password)? I tried last year with micropython, just wondering if anything has changed since?

slender iron
#

awesome @timber mango it does need love for the more complicated bits

#

I mostly just wanted to release what I had done already

timber mango
#

I'm still working on the test script (I got distracted by the fire crackle, I was dreaming about the project I want to use that for...) but I'll rewrite to use that library, so it'll be useful both ways.

slender iron
#

๐Ÿ‘

timber mango
#

is there a Gamma8 array in a library yet? Would be nice to not have to cut/paste it into my own code, since it's pretty static.

#

@slender iron getting error with the new express.py:

#

File "libraries/drivers/circuitplayground/adafruit_circuitplayground/express.py", line 187, in <module>
File "libraries/drivers/circuitplayground/adafruit_circuitplayground/express.py", line 23, in init
AttributeError: type object 'DigitalInOut' has no attribute 'module'

#

I blew away my entire /lib and replaced with the new one, so this isn't a code version issue.

#

error is underscore underscore module on last line.

#

it's the "sphinx.ext.autodoc" stuff, so I'm gonna comment it out for now, and move on, but that's a bug.

#

grabbed a fresh copy of express.py, deleted express.mpy, edited out that line and return, and all is well now.

prime flower
timber mango
#

No comment. Oh wait, lots of comments ๐Ÿ˜ƒ

prime flower
#

๐Ÿ˜ƒ

timber mango
#

Ok, except for the above issue, the express library works so far, I used all of the exposed things, replacing working code done the more manual way(s).
Still done otherwise: touchpads, speaker, i2c. Unimplemented by me (or express lib) yet: IR, accel, sound sensor

timber mango
#

Filed bug on github for the above @slender iron

slender iron
#

Thanks for the bug @timber mango ! I'll fix it tomorrow. Too bad Rosie isn't going to find it automatically. ๐Ÿ˜ƒ

timber mango
#

@slender iron Happy to help... As you implement other bits, just let me know and I'll use them ASAP.
Is the plan to implement similar libraries for Gemma M0 and other pythonic boards (with less onboard items obviously)?
Given the library name, seems limiting... I'd prefer something that would work generically so that the same could work on any stock board regardless of it's specific pin differences. (Granted a lack of sensors on the other boards, but some items do translate, and having a standard circuit object in general could be useful. Maybe with a handling of stray calls with an generated error message? "Sorry, no button_a on this board" etc)

timber mango
#

@slender iron ^ thoughts on above? Looks like there will be an adafruit cpx express library (and then an adafruit gemma M0 library, a Feather M0 library, etc... ) and while it makes it easy for us to build a program to run for the CPX, it seems like it makes it harder for someone who wants to run it on their Feather to port over (remove all of the circuit.whatever refs and replace with feather versions?), versus letting me write board agnostic code, and having it just 'work' for all types of boards.

#

or is 'circuit' going to always be the name of the object passed?

slender iron
#

I think we definitely could. Most boards don't have as much built in

#

I've tried to share pin names in board to enable the cross board stuff

timber mango
#

right, I was comparing to board, which is more like what I'm thinking of...

slender iron
#

for example, most boards have SCL and SDA pins in board for i2c

timber mango
#

good example, or touchpads.

slender iron
#

the circuit playground feels like a special case to me

#

because it has so much built in and its designed for absolute beginners

timber mango
#

I think of CPX as the 'loaded' version...

#

you might design using it, and then build something permanent using a gemma or a feather, etc...

#

or Trinket, or the new boards or... ๐Ÿ˜ƒ

slender iron
#

yup yup

timber mango
#

but if I'm using circuit.whatever, I guess I'm worried about having to rewrite for another board, instead of being able to just solder on a few wires, add a sensor board and a pixel strand to a Gemma M0, and NOT have to massively rewrite my program, but just add a custompins.h that defines my 'addons' to the board.

#

(so to speak... import customized, where I define my strand and sensor pinouts)

slender iron
#

if you are worried about it then don't use circuit

timber mango
#

yeah, it's a tradeoff. I see the value...

slender iron
#

๐Ÿ˜ƒ

timber mango
#

the code is literally half the lines...

#

and then I said to myself... Ok, now write this 'tester' for your Gemma (ie flash pixel, do touchpads,... not much more)... and realized the negative, that it's so CPX specific with this.

#

unrelated, but reasking, since you'd know the answer: is there a Gamma8 array in a library yet? Would be nice to not have to cut/paste it into my own code, since it's pretty static.

slender iron
#

i don't know what Gamma8 is

timber mango
#

seems like a good contrib library... "pixeloptimizations"

#

????

#

Gamma correction for leds... visually fixes color/brightness... it's literally just a single array lookup... you give it 0-255, and it comes back with value to correct for human eye.

#

one sec, I'll find example code on adafruit

#

so that one array never changes, it's actually a formula, but why recompute it? just save array, and use it. perfect use case for library function. Really, it should be a pixel function... enableGamma8 is true? rewrite all RGB values to correct values.

slender iron
#

sounds like it could be a good fit for the color library I've been wanting to do

timber mango
#

perfect place for it. HSV<->RGB convertor, gamma correction...

slender iron
#

yup, want to start one?

timber mango
#

here's how I'm using it now in my circuitpython code....
define array
gamma8 = [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, (etc....)

then when I go to set a pixel:
circuit.pixels[(color_count + cycler) % 10] = (gamma8[red], gamma8[green], gamma8[blue] )

#

red,green,blue are int 0-255 of course.

#

unsure, it's unchanging, is a tuple better than array, memory/speed wise?

#

um, list... (I came from php world, still convert python in my head)

slender iron
#

bytearray is probably best

timber mango
#

it's a lookup table, thinking immutable is better, should never have to change it. if it's a byte b, then b[red] will return a number. Reading on bytes: "bytes objects are sequences of integers (akin to a tuple)" so that makes sense to me.

#

gonna try it.

#

I need a good way to compare speed of code... hmm...

slender iron
#

I've gotta run. thanks for the help @timber mango

timber mango
#

I rewrote test for CPX circuitpython:

#

import time

def performanceTest():
millis = time.monotonic
count = 0
millis2 = time.monotonic() + 10
while ( millis() < millis2 ):
count += 1
print("Count: ", count)

performanceTest()

#

it's indeed much faster to put Test into a function, and not run as main
on the order (count goes from 33-35k to 47-48k.... that's a major loop improvement... runs 30% faster)

timber mango
#

wow, reversed the test (get time, count to 50k, get time elapsed) and it's even more apparent:
import time
def performanceTest():
millis1 = time.monotonic()
count = 0
while ( count < 50000 ):
count += 1
millis2 = time.monotonic()
print("Count: ", count, " in ", millis2 - millis1)
performanceTest()
(comment the def and test() lines, and fix indents to run the second (slower!) way. 4+ seconds, versus 10 seconds.

#

it really shows you that code structure matters a lot...

slender iron
#

fyi @timber mango monotonic returns floating point seconds not milliseconds

timber mango
#

I know, I just didn't change variable names, but I did convert 10000ms to 10 seconds.

#

btw, @slender iron played with using list, tuple, byte options for the gamma8 lookup last night, didn't seem to make any difference in speed (I did a loop thru 7 colors, and timed the whole loop, ran it repeatedly, and while I saw some variations, they all took about the same time, regardless of which sort I indexed.

slender iron
#

ah interesting!

timber mango
#

ie gamma = [0,x,xx] (list) - gamma = (0,x,xx) (tuple) and gamma = byte(0,x,xx) all performed about the same when calling x=gamma[2]

slender iron
#

yup yup

timber mango
#

I was surprised... I thought I saw tuples being faster at first, but not really.

#

I may try it again, and see if I can isolate (take led code out, just purely test the speed difference among the 3 (well, 4, bytearray too)

slender iron
#

I think they are all similar under the hood

timber mango
#

btw, it would be nice to have millis/etc work in circuitpython time... make it comparable to micropython time functions.

#

I was surprised no equiv existed.

slender iron
#

yeah, I haven't gona back and done all of the core modules

#

time doesn't have millis because CPython doesn't have it

#

I'd rather be compatible with CPython than MicroPython

#

we could add it in a different module though

timber mango
slender iron
#

yeah, I mean to have that

#

I just haven't migrated all of the built in modules to shared-bindings

manic glacierBOT
timber mango
#

Ok, finally got a chance to pull out a Gemma (I got a few) and play with python... and I want to light up a few neopixels...

#

And I'm confused by getting pin busy errors.

#

Assuming I want to hook up a strand to A0 pad, I did:

#

pixels = neopixel.NeoPixel(A0, 5)

#

error:
Traceback (most recent call last):
File "main.py", line 31, in <module>
File "/flash/lib/neopixel.py", line 10, in init
ValueError: Pin PA02 in use

#

What do I need to do first?

slender iron
#

@timber mango are you doing anything else in the code?

timber mango
#

Nope... it's really bare bones...

#

One sec...

#

from board import *
import neopixel
import time

while True:
RED = (10,0,0)
pixels = neopixel.NeoPixel(A0, 5)
for i in range(2):
pixels[i] = RED
time.sleep(2)
for i in range(len(pixels)):
pixels[i] = (0,0,0)

#

I don't have the pixels plugged in (yet), would that cause it?

#

(clearly not in use ๐Ÿ˜ƒ )

slender iron
#

do the pixels = neopixel line outside of the while True loop

timber mango
#

Oh, duh

slender iron
#

๐Ÿ˜„

timber mango
#

ack, silly mistake, cut and paste and didn't notice I left it in the loop.

slender iron
#

np

#

thats what a second set of eyes is good for

timber mango
#

and it works... was missing pixels.write() at the end. ๐Ÿ˜ƒ

slender iron
#

the newer NeoPixel library writes automatically by default

manic glacierBOT
timber mango
#

^ yeah, that's why I realized I was missing the write. ๐Ÿ˜ƒ

#

My strand test worked, now I need to work on a good port of the flame effect, haven't seen one yet.

#

I was having my brain work overtime on idea that while interesting, aren't likely to be built (soft/hardware0 soon (if ever), but as I pondered them, some morphed into doable things... Likely I'll do an Extra Credit with one of them soon.

#

Project can be done with CPX or Gemma (advantages to either, so...)

timber mango
#

ok, after a bunch (more) googling on fire2012, and other visualizers, and finding code from TonyD (written in micropython) I think a base library of functions (like gamma, hsv2rgb and so on) make sense... basically reducing the amount of 'core' functionality anyone would have reinvent or want, to play with circuitpython led effects.
I'll try and put together a base library when I sit down again with this stuff...

manic glacierBOT
manic glacierBOT
sick creek
#

@tulip sleet when you commend that issue or you can write it to superuser link that go upvote the issue in feedback hub if they have win insiders in they business

fringe trench
#

I have been programming in Python since 2003. Where would you suggest an experienced Python developer look first to get started in CircuitPython?

#

Some of the intros I've seen were for people starting in Python, and I'm looking more for what things I need to pay attention to on an M0 that I'd never worry about on a server.

tawny creek
#

@fringe trench which dev board do ya have to play with ๐Ÿ˜ƒ

fringe trench
#

I have 2 Gemmas, 2 Circuit Python Expresses, I think I have at least one Feather HUZZAH (Adabox 003 and 004), and a Feather M0.

#

I'm between coding gigs at the moment, so I have the time to start playing with all the stuff I had the money to buy earlier. ๐Ÿ˜ƒ

slender iron
#

@fringe trench circuitplayground expresses are a great place to start

#

the thing you won't be used to hitting compared to servers is the OutOfMemory error

#

32k ram is not a lot

fringe trench
#

Yeah. So not importing the world just cuz

#

@slender iron so there's probably something in the learn section about getting circuitpython onto the CPX?

#

Also, hey, are you guys hiring Python developers? Because I'm looking for a gig. ๐Ÿ˜ƒ

#

(Figured it was worth a shot)

timber mango
#

Putting circuit python on CPX is easy, literally drag uf2 onto it... And it helps to unzip libraries onto the python drive that shows up.

#

There is a learn guide, yes

slender iron
#

@fringe trench its the same process as the feather m0 express

fringe trench
#

OK, I will start there. Thank you!

slender iron
#

and yes maybe, we have paid folks for writing drivers

#

so take a look at circuitpython and perhaps make a driver or find or fix bugs

fringe trench
#

@slender iron If I get to the point where I understand enough to write good low-level drivers, I'll be pleased. I mostly write backend glue code, so libraries include Twisted, SQLAlchemy, Requests, redis, etc.

slender iron
#

Its all learnable for sure

#

adafruit basically hires from their community

#

so start contributing to our open source stuff and keep in touch ๐Ÿ˜ƒ

#

I got hired after being on show and tell a bunch

fringe trench
#

heh. Well, I guess I could start by pointing people at my github and my stackoverflow. If you see this gravatar, it's me.

slender iron
#

ok awesome ๐Ÿ˜ƒ

timber mango
#

ok, wrote a simple new neopixel class, to allow splitting/changing the order of a strand...

#

TonyD's chainer inspired me, and I found a perfect demo for it, using the CPX, turn the 10 pixels into 2 strands of 5, and make then face in same direction. (so both 0's are next to usb)

#

hmmm... found a 'bug' but not sure if it's worth fixing it or not... probably will ๐Ÿ˜ƒ

manic glacierBOT
timber mango
#

rewriting my neopixel distorter (that's what I'm calling it, since it does so much), to use/follow the latest neopixel.py routines, so it should be transparent....

timber mango
#

and running out of memory. I think I can make this a neopixel subclass, but I'm not sure. I'll discuss tomorrow (today?) later.

timber mango
#

had problems with building mpy, until I recalled that I needed to use 1.0.0 circuitpython, and not master checkout... then it worked.

#

CircuitPython takes up the lion's share of available memory, but provides a lot of tools in exchange. Interpreting on-device is a rather handy feature, especially during development.

#

yeah, it's a tradeoff... as usual.

timber mango
#

Ok, rewrote my 'distorter' as a subclass (and also did Tony's chainer as one), and have renamed it neopixelninja (as in Fruit Ninja, cause it lets you slice colorful strands up anyway you want). Decided against combining Chain and Ninja as it would complicate things, and this way, folks can still use both if want, but code is much cleaner. (So you can't Ninja 2+ strands at once, but if you chain them into one, then you can slice any pixels you wish of them all)

#

The CPX layout really is a good use case, so I include it as example code.

timber mango
#

remapping.

manic glacierBOT
#

Did some experimentation about how much stack we could give up, to increase the heap size. I used my project https://github.com/dhalbert/SwitchBox as a "typical" piece of code. It could not be loaded from .py or run without running out of heap. Adding 4k to the heap worked, and still left about 1k of unused stack when running.

I wish I had more examples, since it's possible other "typical" code needs more stack. But we can tune this. Let's see how it does with the test suite.

timber mango
#

So I ported Fire2012 to circuitpython, and it works, but it slows down considerably as the pixel strand length increases, most of the slow down is the last step, which I believe is due to the actual pixel write. I even turned off autowrite, and it's still too slow on long strands.
# Step 4. Map from heat cells to LED colors
for j in range(0, self.n):
color = heatmap[self.heat[j]]
if self.reverse:
pixelnumber = (self.n - 1) - j
else:
pixelnumber = j
self.pixelobj[pixelnumber] = color
This section was taking more than 1/10th of a second for 50 pixels.

#

significantly too slow to be visually pleasing...

#

reverse is false, and I improved the heatmapping by going from 16 values and doing math and integer to 256 values, and making sure it's int alrady in heat[j]
Which leads me to think that the real problem is the pixel setting itself.

meager fog
#

@timber mango are you using neopixels or dotstars?

timber mango
#

Neopixel, @meager fog ... with a CPX board.

meager fog
#

one thing i added to the neopixel library is brightness auto-calc on write

#

you may want to try taking that out too

#

it may be slowing you down ๐Ÿ˜ƒ

timber mango
#

I'll try that... I've been writing subclasses for Neopixel.py, so I'm familiar with that bit of code.

meager fog
#

you may not want to subclass

#

(s'worth a shot ๐Ÿ˜ƒ

timber mango
#

Oh, I understand, I think in those cases I'm still using that main class code that hits the brightness. Ill try it in the morning, and mpy a fresh copy.

#

From a few videos, it looks like TonyD is finding the same problem, that porting arduino code to circuit python is just too slow to run as bytecode...

#

Not surprisingly, C is gonna be faster.

timber mango
#

so the brightness didn't matter, and I ran some numbers, and 50 pixels is roughly twice as slow as 25... (in fact, all of the cell operations double in time... but the others are on the order of 1/100th of a second, so it's clear what's slowest.)

#

[if you comment out the line self.pixelobj[pixelnumber] = color, you'll see it's the crux of the timing issue.]

#

Time to see if Dotstars work better, need a strand of those though.

slender iron
#

@timber mango thanks for the sample code! I'll take a look in the next few days. I just changed the neopixel library and may have made it slower

timber mango
#

Thanks @slender iron . Fire2012 works, the speed is the only (major) concern. I'll continue working on the pattern porting I'm doing, hopeful that a) the neopixel stuff can be sped up b) dotstars will be faster, c) newer boards will solve the issue with more speed, even if current boards will require Arduino/C code to use for led effects. I'm genericizing the code (building on TonyD's signal class, creating helper libraries for animation, color, etc, so hopefully useful all around.

untold knot
#

is the filesystem on the Gemma M0 read only? I tried to write to a file but get OSError: 30 when trying to open the file for writing with f = open('data.txt', 'w')

#

f = open('data.txt') works but then I cant write my info

slender iron
#

@untold knot yes by default. The 2.0 work in master allows you to switch it so it's read only over USB instead

#

@timber mango yup the m4s should be much snappier. I'll take a look though and see if there is anything obvious

untold knot
#

@slender iron so If i understand correctly that in the next version I will be able to then write files? Im trying to make a simple temp & humidity monitor that writes the data to a file for charting later

slender iron
#

yup @untold knot

#

it'll also have sd card support

#

I'm going to try to release an alpha in the next few days

royal ridge
#

Go Go Gadget @slender iron

slender iron
#

๐Ÿ˜ƒ

untold knot
#

@slender iron awesome. Ill keep an eye out for it

slender iron
#

cool cool

solar whale
#

@slender iron Just curious if you are planning to release a 2.0 compatible lib bundle as well. that is update the .mpy files . Or should we plan to create .mpys ourselves as needed. Not tryin to add to your wrkload ๐Ÿ˜‰ Just curious about how to proceed..

slender iron
#

yeah, I'll probably post a link to an unofficial one with the alpha

solar whale
#

great - thanks

slender iron
#

all of the library releases will have 1.x compatible until 2.x is stable

solar whale
#

make sense

#

ladyada did update the Arduino IDE - Gemma M0 now suppoerted!

#

of course CircuitPython support is excellent ๐Ÿ˜‰

slender iron
#

yay!

manic glacierBOT
scenic timber
#

@timber mango @slender iron I found longer neopixel strands to be very slow in micropython as well last christmas..

timber mango
#

Good to know. Hopefully somebody will find a solution for this. Granted, circuit/micropython isn't going to beat C, but it should still at least not bog down this badly on this single task of pushing bytes out to the strand.

scenic timber
#

I found after like 50 pixels or so it slowed down..

#

wonder if the dma stuff will help that..

timber mango
#

it looks to me like a very linear failure... 50 is 2x slow as 25, so 75 would be 3x as slow, etc...

#

yeah, that seriously affects pins you can use, though, so I hope it's not the only solution.

royal ridge
#

Part of that is just the way neopixel signaling works. With single-wire data transmission, you don't have nearly enough wiggle room in how you send things, so you have to be watching the clock as you pump out the 1s and 0s.

timber mango
#

@royal ridge yup, and python isn't up to that task?

royal ridge
#

it's not so much python as it is just neopixels

scenic timber
#

but if it is working fine on the same board in arduino.....

timber mango
#

Yeah, but stock neopixel code using standard libraries on C, same board don't show the problem.

#

Exactly, @scenic timber

#

at some point, you can't say "neopixels are too slow" when other code runs on the same board fine. It's the OS/etc at that point.

royal ridge
#

Eh, true enough. any interpreted language is going to have more stuff to do under the hood. a compiled language (like C) has fewer layers to go through, so it can run a bit tighter

timber mango
#

I am looking at porting the various FastLED example animations... and if they just won't run under python, it'd be good to know now... 20 pixels is a far cry from running 40 or 50...

#

and that's the problem, this isn't about "don't run 64", it's about slowing down much quicker.

slender iron
#

The actual transmit code is in C so Python isn't the problem. There is a delay after the transmit that we could try to reduce

#

DMAing it would make it faster as well

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#
[adafruit/circuitpython] New tag created: 2\.0\.0\-beta\.1
solar whale
#

@slender iron Congratualtions on the 2.0.0 beta release. Amazing amount of work. Looking forward to testing it.

slender iron
#

thanks @solar whale! most of the work isn't mine ๐Ÿ˜ƒ

#

I can't wait to hear what you think

solar whale
#

Even better - it takes a villiage ๐Ÿ˜‰

slender iron
#

yup yup ๐Ÿ˜ƒ

#

3.0 will be even bigger

solar whale
#

is the "beta" libray bundle the same as the master branch but just compiled with the 2.0.0 circuitpython ?

#

I ask because I only see the master on github.

slender iron
#

yes

#

I checked out master, cd circuitpython, git checkout origin/master and then build as normal using python3 build-bundle.py

solar whale
#

Great! thanks for the clarification.

slender iron
#

np ๐Ÿ˜ƒ

#

I added the sdcard library too so it'd be in there

solar whale
#

Yup - I see that.

manic glacierBOT
solar whale
#

@slender iron Cool! so far - all my test projects run - "out of the box" on 2.0.0 - tested 14segment display - mpr121 - and a crude test of the vl53lox sensor. also can turn on/off the neopixel! This is all on a M0 express. Looks like I can move to 2.0.0 - next to try playing with the Circuitplayground Express... great start!

solar whale
#

@slender iron loaded 2.0.0 beta onto CircuitPlayground Express and rana few basic tests. Accelerometer, audio playback and a slightly modified version of the spinner_advanced. All work without any changes. Now I need to try something new in 2.0.0 - I have to break something ๐Ÿ˜‰

manic glacierBOT
untold knot
#

In the new version 2.0 how would I use that for storing some data? or is it for sd cards only?

#

I meant the flash

manic glacierBOT
slender iron
#

@Stuff With Kirby#8486 it applies to the flash as well. The new storage module has the method to switch it to read-only over USB. @prime ingot hooked up a switch to their board so they coudl control which mode it started up in

manic glacierBOT
#

No problem! I'm happy to have API discussed.

One tricky point is that its not possible to put properties at the top level in a module. They must be on an object. So, microcontroller.die_temperature would have to be a function call or wrapped in an object. Having it wrapped in an object can be nice because it can be passed around then like any other temperature sensor (they all should have a temperature property).

manic glacierBOT
prime ingot
#

Also, @slender iron -- update on that sleep functionality -- we were able to make a Feather M0 Express go into a deeper sleep, in Circuitpython! For now, we're just implementing a version of the Adafruit Sleepydog code. It's implemented in our fork, here: https://github.com/edgecollective/circuitpython The only trouble is -- we're not able to wake the board back up ๐Ÿ˜ƒ We began to realize that we might need to be more thoughtful about how Circuitpython handles / uses interrupts. Now we're thinking that we might need to use built-in Circuitpython functionality to temporarily disable interrupts before calling the sleep code, then re-enable them after waking up. If this is an issue of general interest, would it be useful for us to ask a (better worded than this) question about the issue on the forum, so that the answer (regarding how Circuitpython handles interrupts -- if that's the problem) is available to the general public? Thanks for all your help!

timber mango
#

@prime ingot Could a CPX version of logger use the built in switch instead of the resistor?

prime ingot
#

@timber mango -- Ah -- that sounds much more elegant! If the CPX switch state (high, low) is something you can query via Circuitpython code (I'd assume so), then: yes, indeed.

timber mango
#

yes, you can, so that's worth coding into a CPX version (obviously configurable if someone wanted to use switch for something else (but if you needed 2 switches anyway, I'd argue the built in (tiny) switch make more sense as 'log/writeaccess')

prime ingot
#

@timber mango -- Definitely. I was going to write up a guide using the Feather M0 Express, but you've convinced me that a CPX-based guide would be easier for folks to follow (no additional hardware / soldering needed). Will order one of those boards now ๐Ÿ˜ƒ

timber mango
#

it's a sweet board, given the number of things on it, it's really perfect for (most) prototyping. (needs more pins out is really it's one weakness, at which point Feather makes more sense)

prime ingot
#

@timber mango -- wow, just seeing the specs now -- you're right, it's got all the bells and whistles! Thanks for pointing it out.

solar whale
#

Just to clarify my understanding - If I were to remount the Flash as "read-only" via REPL or a script, can I always remount it "read/write" via the REPL later. That is can I always remount a read-only FS as read-write via the REPL?

untold knot
#

@prime ingot thanks! Ill look at it later

manic glacierBOT
slender iron
#

@prime ingot thats awesome news about sleeping! There are definitely tricky things about it. Is it using the ASF sleep manager?

#

@solar whale the short answer is no. the filesystem must be remounted during boot before the USB comes up

solar whale
#

@slender iron good to know! At least I am used to erasing and reloading the flash!

slender iron
#

@solar whale you can use ampy then to load a different boot.py

solar whale
#

Ok. My mistake. That makes sense. Thanks for ampy reminder.

slender iron
#

np

prime ingot
#

@slender iron -- Thanks! And yes -- the ASF sleep manager is being used -- which in the end was really just us following the Adafruit Sleepydog library code, and converting it to C. ๐Ÿ˜ƒ Seems to work nicely to put the board to sleep, but alas it stays asleep and isn't interrupted out of it. Our next thought to get things working (sleeping + waking up) was to try adding a "disable_interrupts" call before our sleep code kicks in, as well as an "enable_interrupts" after it is finished ...

slender iron
#

@prime ingot Ok, I've never looked at the sleep stuff in depth. I believe the RTC is important in waking it up though.

prime ingot
#

@slender iron -- I'm not yet sure, but I think the "watchdog timer" is capable of sleeping for a set amount of time and then waking up on its own, without using the RTC as an alarm? I believe this is what the "Sleepydog" library does -- and it seemed like the simplest approach to get some sleep functionality. But then, I think you're right that one can get even lower-power sleep modes if one instead relies on the RTC to throw an interrupt to kick the board out of sleep mode. So that would be preferable. Do you happen to know if there's any SAMD21 RTC code yet working? Maybe I'll start in on trying to port the RTCZero library into Circuitpython as a first step ...

slender iron
#

I don't know of any internal RTC code because we have no backup battery to make it worthwhile long term

prime ingot
#

@slender iron Ah -- good point. For a datalogger, what I imagine is: use the internal RTC as a way to achieve low-power sleep -- but always simply use it in "set the time to arbitrary time X, and set alarm to wake up at X + 30 seconds) -- so no worries about keeping track of time when power is cut. Then, for accurate timekeeping between power cycles, I'd imagine using an external RTC like the DS3231, with its own backup battery ...

#

(but, admittedly, I'm hyper-focused on the low-power datalogger use-case ...)

limber tulip
#

I installed adafruit-circuitpython-feather_huzzah-2.0.0-beta.1

#

however it isn't exactly working...

#

It looks like the WDT keeps firing. Here is sample output

#

chksum 0x24
csum 0x24
l๏ฟฝ๏ฟฝ|๏ฟฝ๏ฟฝrrnb๏ฟฝ๏ฟฝl๏ฟฝb๏ฟฝlb์Œœ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝb๏ฟฝlrlll๏ฟฝ๏ฟฝ|๏ฟฝ๏ฟฝrrnb๏ฟฝ๏ฟฝll๏ฟฝ๏ฟฝb๏ฟฝb์Œœ๏ฟฝ๏ฟฝb๏ฟฝ๏ฟฝlrl๏ฟฝl๏ฟฝ๏ฟฝ|๏ฟฝ๏ฟฝrrnb๏ฟฝ๏ฟฝl๏ฟฝ๏ฟฝb๏ฟฝb์Œœ๏ฟฝ๏ฟฝ๏ฟฝb๏ฟฝlbl๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝn๏ฟฝr๏ฟฝ๏ฟฝn|๏ฟฝllll๏ฟฝ๏ฟฝr๏ฟฝl๏ฟฝl๏ฟฝl๏ฟฝ๏ฟฝr๏ฟฝl๏ฟฝl๏ฟฝl๏ฟฝ๏ฟฝr๏ฟฝl๏ฟฝ๏ฟฝ๏ฟฝllrl๏ฟฝ๏ฟฝrl๏ฟฝ๏ฟฝ๏ฟฝb๏ฟฝ๏ฟฝb๏ฟฝbbr๏ฟฝrb๏ฟฝ๏ฟฝn๏ฟฝnn๏ฟฝl๏ฟฝ๏ฟฝl๏ฟฝl๏ฟฝ๏ฟฝll๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝl๏ฟฝn๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝbll๏ฟฝrp๏ฟฝ๏ฟฝ๏ฟฝbl๏ฟฝbrlrlr๏ฟฝn๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝn๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝb๏ฟฝ๏ฟฝ๏ฟฝl๏ฟฝl๏ฟฝl๏ฟฝ๏ฟฝrlbl๏ฟฝ๏ฟฝln๏ฟฝprl๏ฟฝl๏ฟฝ๏ฟฝ#4 ets_task(40100164, 3, 3fff82a0, 4)
boot.py output:

Press any key to enter the REPL. Use CTRL-D to soft reset.

Adafruit CircuitPython 2.0.0-beta.1 on 2017-08-07; ESP module with ESP8266

ets Jan 8 2013,rst cause:4, boot mode:(3,7)

wdt reset

#

I never get the chance to enter more than a few characters at the python prompt. This is on a Feather HUZZAH.

#

Any advice?

slender iron
#

@prime ingot Yeah, thats just why we haven't done it yet

#

@limber tulip please start with 1.0.0

limber tulip
#

ok

slender iron
#

@limber tulip the esp8266 can also be finnicky

#

if 1.0.0 doesn't help then its worth doing an erase and flash again

prime ingot
#

@slender iron -- Makes sense! Thanks -- I'll dig in and see if I can make some ASF RTC goodness happen ...

slender iron
#

@prime ingot excellent! keep me posted on how it goes

prime ingot
#

๐Ÿ‘

limber tulip
#

Thanks @slender iron I erased the flash and flashed 1.0 and can at least get hello world to work. Now time to figure out how to load code, use some libraries etc ๐Ÿ˜ƒ

slender iron
#

perfect @limber tulip !

limber tulip
#

Any chance the Huzzah will be mountable as a USB device in the future (e.g. for file copy/edit)?

slender iron
#

@limber tulip nope

#

the hardware doesn't support it

limber tulip
#

figrued something like that, kind of a shame. Do the boards under designed for CP all support mounting? E.g. Feather M0 Express?

#

referring to the github page

timber mango
#

I believe they do, by design with the added SPI flash, right?

slender iron
#

@limber tulip its the M0's that have built in USB support

#

the Gemma M0 will also show up as a drive but its a very small drive ๐Ÿ˜ƒ

limber tulip
#

I like the challenge of small blinka But first I need to get something a bit more familiar to work.

#

I looked around the MP/CP forum but didn't see a direct answer, is there an adafruit.io library?

#

Looks like at the moment none of the 'designed for CP' boards have builtin Wifi, right?

slender iron
#

micropython does have umqtt which could be used with it

timber mango
#

Yeah, wifi is really what I miss most. ๐Ÿ˜ƒ

slender iron
#

I was hoping to get Rosie CI released by tomorrow but my raspberry pi SD card died

#

๐Ÿ˜ฆ

timber mango
#

causing non-continuous integration. ๐Ÿ˜ƒ

slender iron
#

good for testing the instructions setup

#

I probably should have backed up my config file....

manic glacierBOT
solar whale
#

@prime ingot I was able to adapt your circuitpython-flash-logger to use the slide switch on the CPX. I did find that I had to enable the internal Pull-UP on the pin (SLIDE_SWITCH aka D7). Still playing with it, but so far it seems to be working. Thanks for the example.

#

@slender iron I am a bit confused by the setting for "readonly" in storage.remount it appears that setting readonly=False allows the CircuitPython code to write to the FS and setting it to True allows the USB to wirte to it. Is this correct? I thought it was the other way around.

slender iron
#

yeah, I believe I made it from the perspective of the python code

solar whale
#

OK - no problem - so the default for mount is to make it CP writeable.

slender iron
#

yes I believe so

solar whale
#

OK make sense - if you are going to mount it from CP then you probably want the USB to leave it alone!

#

So far, I have not run into any issues with 2.0.0 running my 1.0.0 code. I'll try sticking with 2.0.0 for awhile. So far, the only new feature I have tried is this logger test. I hope to try an SD card soon.

solar whale
#

@slender iron Just a heads up - not much info, but I have managed to do something - twice - that has resulted in the test data (wirtten to to data.txt) getting written over boot.py in the data-logger test on my CPX. I'm not sure how it happened and I can't reproduce it reliabley. I just wanted to let you know and I'll see if I can find a reproducible method. It may be due to the many resets I have been doing while changing the switch postion to enable/disable FS writes.

slender iron
#

no issues is great @solar whale !

#

hopefully we can keep it that way

timber mango
#

yeah, I'll do some 2.0.0 usage, testing tonight... had actual work today ๐Ÿ˜ƒ

slender iron
#

thanks @timber mango !

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
timber mango
#

Ok, so I used circuitpython on Gemma M0 for my dotstar test (I got a strand of white only cheap, color are in coming soon)... And I'm seeing the same sort of 'large numbers of pixels' issue with Dotstar library: When I told it I had 10 pixels, and lit up 1 at a time, turning off the previous and .show() looping, it was slow but acceptable (certainly not fast, with no delay timing added, it was countable...) When I told it the strand was 150 (when I said 10, #11 lit up (N+1 seems to get lit due to catching 'end of line' signal?, figuring setting to 150 was quick test of that, the 'pixel at a time' loop CRAWLED along, visibly slower. Something on the bitbanging of both neopixels and dotstars is very slow, more so the longer the strand.

scenic timber
#

have you tried the DMA stuff on the neopixels?

#

would be interested to hear the difference

timber mango
#

This is all within circuitpython though... Just a normal Arduino sketch should be much faster.

scenic timber
#

I thought someone got some prelim DMA in circuitpython going? Maybe I am mistaken

timber mango
scenic timber
#

yeah guess i my mind invented it..

timber mango
#

So it looks whatever pushes the pixel buffer out to the pins has a problem with size, it's just not fast enough, and you don't notice it at small values for N.

scenic timber
#

Yeah I ran into the same thing following TonyD's christmas wreath last year trying a 4m strand on a christmas tree. I had to remove all sleeps and such just to get a decent speed going it was still really slow but it was fast enough for the animations I was trying.

timber mango
#

link?

scenic timber
#

I believe it was this

timber mango
#

(will try it later)

#

and what board were you using?

scenic timber
#

feather huzzah 8266

timber mango
scenic timber
#

Yep the guide was written from that video series.

#

I tried porting a bunch of different animations from arduino.

#

in the end it worked fairly well but again could not get the speed up.

timber mango
#

with circuitpython?

#

or micropython?

#

Cause the speed he's getting on 200+ pixels, I know that's not possible on circuitpython.

#

(at this point)

#

it's slow, but, now it's WAY slower.

scenic timber
#

I was using mico circuit did not exist at the time.

timber mango
#

Thanks for pointing to that, @scenic timber It really helps to narrow down that it's not micropython universally. He's getting way more responsiveness from 240 pixels than I could from 60 now.

scenic timber
#

i would think they would behave the same as it is a fork.

#

interesting

timber mango
#

yes, but it's been changed, so at some point, something got tweaked (maybe/likely for the SAMD stuff), and it's got a bug.

#

and that dotstar acts as sluggish might point to something outside of either library, maybe.

#

@slender iron want me to file a github issue on this?

scenic timber
#

can you still do micropython code in circuit?

#

might be an interesting test

timber mango
#

I don't think so...

scenic timber
#

try loading up one of TonyD's samples

slender iron
#

@timber mango I don't think its a bug

timber mango
#

CMFly: on a different board mayb.

slender iron
#

the show methods block as they transmit data and the more pixels you have the longer it takes

scenic timber
#

it's just a .py file don't need a different board..

timber mango
#

@slender iron so why was Tony getting better performance on 240 pixel under micropython? The board he was using?

#

he's doing animation and changing 240 pixels faster than my simple loop can do 50-60.

slender iron
#

are you computing all of the pixels and then calling show?

timber mango
#

I can do something trivial, and it'll still be too slow. I literally saw the problem earlier, doing 2 dotstar pixels (set X to lit, set X-1 to off, show) and watched it slow down like molasses when I changed pixel strip from 10 to 150.

#

so it's all in the show dumping to the strand.

slender iron
#

thats because its transmitting 150 pixels worth of data

#

versus 10

timber mango
#

right, agreed.

#

but Tony's video above, he's pushing 240 pixel faster than I seem to be able to push 60.

scenic timber
#

can you get it to just dump 1 pixel?

timber mango
#

and CMFly is saying that he tried Tony's micrpython stuff on circuit and despite removing all delays, never saw the speed Tony got in the video, both of them using 4 meters.

#

so something's different.

scenic timber
#

I think I was using more pixels.

slender iron
#

for the neopixel did you set auto_write=False?

timber mango
#

Yes.

#

I tried both ways.

scenic timber
#

Tond was using 30 pixels/m I was using 60/m

slender iron
#

hes also on esp8266 are you?

timber mango
slender iron
#

try auto_write=False

#

it could be a positional arg vs kwarg thing

timber mango
#

np = neopixel.NeoPixel(A0, 25, 3, 1, False)

#

that's not correct?

slender iron
#

that should work

timber mango
#

that example shows has timing, and it's all fast, until it hits the show, which bogs down quickly as N increases... but by the time N is 60, it's dog slow.

#

no way can it do more and be useful.

slender iron
#

it should be linear with the number of pixels

timber mango
#

it is, clearly.

slender iron
#

then thats not a bug

timber mango
#

no, I think you misunderstood what I think got broken...

#

I don't think it's a neopixel library bug anymore. I'm questioning if something about pushing data out on the pin is getting slowed down somewhere.

#

(cause I see the same issue with Dotstar, so....)

slender iron
#

well their implementations are very different

#

neopixel is in C and dotstar is bitbang python

timber mango
#

then shouldn't the neopixel C be reasonable fast to push the bits?

scenic timber
#

@slender iron if neopixel is in C why is it so much slower in micro/circuit than in arduino?

timber mango
#

^ what he said.

slender iron
#

its usually all of the math needed to compute the pixel values

#

not the transmit itself

timber mango
#

so if we push all red, and it's still slow?

scenic timber
#

ok the math might make sense I didn't do a more basic test..

timber mango
#

I'll do an example, strip all of the firecode, and make it merely push red pixels, and it'll still bog down far too early at 40-50, I'll bet.

slender iron
#

yeah, there could be a bug in how long we think it is

#

a saleae or oscilloscope can be used to measure how long it takes too

scenic timber
#

@slender iron your getting past my skill and hardware level ๐Ÿ˜ƒ

timber mango
#

my timing says the math portions were faster, and if I comment out the show line, even that loop is fast, the entire delay is the show. (which should be just 'take buffer, push out to pin')

slender iron
#

@timber mango do you have timings for each number of pixels?

timber mango
#

and yes, I agree, it's a linear speed delay, 50 is twice as long as 25... but 50 is too damn slow.

#

I started timing it, I can get you data.

slender iron
#

there should be a fixed overhead plus a per pixel timing

#

neopixel protocol is fixed timing so we can't shorten it

scenic timber
#

we should be able to write a simple test to get timings.

timber mango
#

I'll replace all firecode in my example with Push Red, Push Green, no math otherwise?

#

so we can see speed timings on 10,20,30,40,50, 60,70, etc pixels?

slender iron
#

sure, the pixel values shouldn't matter

timber mango
#

I won't use .fill() cause that messes with autowrite... so purely "for i in range (0,X): pixels(i)=(10,0,0)" is math free.

slender iron
#

you can call the neopixel write directly if you want to measure that

#

there is a neopixel_write module

timber mango
#

yeah, I'll try that too.

#

any differences in 2.0.0 worth trying it there?

slender iron
#

not in neopixel_write

timber mango
#

or should I just try it all there.

slender iron
#

the vm may have changed with the update to 1.9.1

scenic timber
#

(this still all blows my mind that there is an os/vm running on there interrupting my code...)

slender iron
#

its running your code ๐Ÿ˜ƒ

timber mango
#

I'll try both. Should I try both CPX and Gemma? So we remove board from equation too? (grin)

#

And I've got a feather I haven't played with yet.

scenic timber
#

start with one then scope creep later ๐Ÿ˜‰

timber mango
#

hahahah

manic glacierBOT
manic glacierBOT
scarlet mulch
#

^^^The bot sold me out lol^^^

prime flower
#

๐Ÿ˜ƒ

scenic timber
#

lol

scarlet mulch
#

Really cool project you are all working on ๐Ÿ‘

slender iron
#

๐Ÿ˜ƒ thanks @scarlet mulch

timber mango
#

damn, Gemma M0 data (started there, since I had it hooked up) has me confused now. Gonna run script on CPX to compare before I share.

scarlet mulch
#

@slender iron so is the core of this all written in c and you guys are adding different functionality in python

#

?

slender iron
#

@scarlet mulch mostly C but drivers are in python

#

I work in C mostly

scarlet mulch
#

@slender iron NICE! I C++ my C is alright I know no python though. Thats crazy that the drivers are written in python. How is that even possible?

slender iron
#

all the fast timing sensitive stuff is in C

scarlet mulch
#

Very nice that makes senses, how long have you been working on circuit python?

slender iron
#

since august last year. its based on micropython thats a few years old though

scarlet mulch
#

Right on bout to make a year if you didnt already ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘
Does it only run on adafruit boards?

slender iron
#

mostly

#

arduino zero is supported somehwat

#

anything with esp8266 or m0 will mostly work though

timber mango
#
#

I'll post the test code in a gist, gimme a sec...

#

I may rewrite it to run multiple times and take high/low/avg... cause these results don't make sense.

slender iron
#

I'm gonna have to look tomorrow. I've wrapped up for today

timber mango
#

No worries, I'll prep it for you to look tomorrow.

slender iron
#

ok thanks!

timber mango
#

but tl;dr: all over the place.

scarlet mulch
#

Lol you guys are awesome love the collab

slender iron
#

the usb stuff will cause it to fluctuate

timber mango
#

I'll setup averages, that'll smooth it out, maybe.

slender iron
#

I'd expect auto write to be much slower since its doing show each assignment

timber mango
#

but I'm seeing it pushing 100 as fast as 50, which shouldn't be the case, we agreed.

slender iron
#

ya

scarlet mulch
#

@slender iron thanks for all the question answering. Have a goodnight everybody ๐Ÿ‘

timber mango
#

night...

slender iron
#

np, you too @scarlet mulch

timber mango
#

@slender iron I'll package this up for you to review. Gist of code, plus a spreadsheet of results. (gonna now include 10 trials of each 10-step)

#

have a nice night!

slender iron
#

k, good night!

prime ingot
#

@solar whale -- Great to hear about the CPX experiments! And good to know about the pull-up. Very interested to hear any further news on reliability, esp. re: the corruption of boot.py you mentioned. Thanks for your intrepid exploration!

river quest
timber mango
#

^ Snakes! Snakes on a plane! A horizontal plane!

digital charm
#

Hey guys, I have a generic ESP8266 devkit (NodeMCU), should I use the HUZZHA binary?

slender iron
#

@digital charm you can try it just beware the pins in board will be different

timber mango
#

@slender iron didn't put together stuff from last night cause I found my results confusing and wanted to bounce off you first...

slender iron
#

i'm free for a while now @timber mango

timber mango
#

perfect, I have a 1pm call, and one task I need to tackle before that, but I can do 5-10 minutes now

#

(look at sheet 2, please)

#

let's look the 'red' data (pushing just red led, varying pixel length, and autowrite)

#

6 values, 3 (low, average, high) for pixelobj[i] = red, and then 3 values for pixelobj.show()

#

that's what's confusing me.

#

it's very clear that if I turn autowrite ON, that it takes longer to set...

#

which makes sense, it writes the entire buffer after every pixel.

#

but, and this is my question: why is the show part, almost unchanging?

#

writeredaverage, regardless of autowrite on or off, regardless of pixel length... is about the same.

#

so whether I'm pushing 50 or 100 pixels from the buffer to the pin, it's taking about the same time?

slender iron
#

what column is that?

timber mango
#

writeredavg

slender iron
#

you may be hitting the precision limits of float

#

thats why its exactly the same

timber mango
#

that's literally the difference of time.monotonic before and after pixelobj.show()

#

so it's just that fast.

slender iron
#

I'd say about that fast

timber mango
#

interesting....

#

but repeated 50 or 100 times, it's adding up to seriously slowdown.

slender iron
#

if you want to get into more timing detail I'd suggest using a scope or saleae

timber mango
#

yeah, I'll continue to test. I just got an 8x32 dotstar panel, too.

slender iron
#

nice!

#

using a saleae or scope is nice because you can set pins high and low in teh C code to measure the duration of a particular section

timber mango
#

yeah, I was gonna try using neopixel_write as well next.

slender iron
#

๐Ÿ‘

timber mango
#

My test code needs another revision, I thought of some ways to play with it. This afternoon, aftr a work phone call at 1pm.

#

Ok, see ya later!

slender iron
#

sounds good! I'll be around mos tof th eday up through the live shows

digital charm
#

when I load either circuitpython or micropython onto my esp8266 I get a constant stream of serial text that is garbled at 9600 and 115200

#

sorry if this isn't the correct group, let me know and I'll ask in general

slender iron
#

the bootloader outputs debug at a weird baud rate

#

*python will output at 115200 once its going

digital charm
#

do I need to erase my flash before flashing the bin?

slender iron
#

yes, its recommended

digital charm
#

ah ok, so I should do that using nodemcu fw that is working ok

slender iron
digital charm
#

ok I've been using the GUI nodemcu flasher, I'll switch to esptool.py

slender iron
#

ah, I haven't tried that

digital charm
#

my previous question, is the Huzzah build appropriate for nodemcu devkit?

#

just a generic esp8266 dev board so I'm assuming yes?

slender iron
#

it should mostly work

#

theres a board module with pin naming that will be wrong but it should run

digital charm
#

thanks for your help, much apprech

slender iron
#

np

digital charm
#

what's the buzz about esp32 and circuit python?

#

is it being ported?

slender iron
digital charm
#

esptool worked much better! thanks!

slender iron
#

๐Ÿ‘

digital charm
#

ok so far micropython is working better for me
tried circuitpython and it's resetting my board, I think because the led is tied to the reset pin, the machine api is more manual

#

I tried using the upstream machine api and I didn't have access to some basic things

#

I'm sure if I grab a feather everything would just work

manic glacierBOT
manic glacierBOT
timber mango
#

@digital charm if you get circuit python running on a nodemcu board, and figure out the pin differences, submit the changes, those boards are so cheap I've thought about buying a bunch and putting circuitpython on it would be more incentive.

royal ridge
#

I has a nodemcu board

solar whale
#

@slender iron @digital charm FYI -I was able to deploy 2.0.0-beta-1.1 to a feather ESP8266 and access REPL.

manic glacierBOT
solar whale
#

WIFI and WebREPL also work on the ESP8266 Feather with 2.0.0-beta-1.1

timber mango
#

Wifi works?? Nice.

#

I think I understand the issue way better. thanks to @slender iron for his help in understanding it.

#

Going to take anothr crack at Fire2012 now, and see if I can improve it.

solar whale
#

So far the only WiFi testing I ahve done is to configure WebREBPL but it was able to obtain an IP address and I can connnect to it via the WebREPL Client. Good start!

#

@slender iron ran into an issue on ESP8266 - ampy ls command fails - it appears to be tryig to import uos which is not present. ampy get and ampy put work OK.

#

basic web client test works ok on ESP8266 with 2.0.0-beta-1.1

slender iron
#

@solar whale please file an issue on AMPY for me

solar whale
#

@slender iron just did ๐Ÿ˜‰

slender iron
#

perfect ๐Ÿ˜ƒ

solar whale
#

at least put works!

slender iron
#

๐Ÿ˜ƒ

timber mango
#

Ok, @slender iron , does it make sense if I pass a pixelobject to a class, and explicitly turn off auto_write, and then write to it, that it could take a 1/3 of a second to just do that (no lights happen)?

#

have to confirm, but that is what looks like problem might be..

slender iron
#

post the code please

timber mango
#

gonna strip everything else and isolate that now.

slender iron
#

kk

timber mango
#

Ok, that'll print the time of the set pixel loop, but it never lights, but it take serious time anyway.

#

and if you comment out the pixel set, the loop is quick again.

slender iron
#

what board are you running it on?

timber mango
#

CPX

slender iron
#

k

#

and the latest bundle libraries?

timber mango
#

should be. I can go grab and copy it in again.

#

And I can try this on 2.0.0 too.

#

I'm glad I finally isolated this.

slender iron
#

just asking. I'll try it now before show and tell

timber mango
#

my other test code was so much faster... I figured I'd just made a silly mistake somewhere.

#

installed bundle rc5 (I was on rc4 I think). Same results.

slender iron
#

kk

#

@timber mango I get about ~0.13

#

that what you see?

timber mango
#

way higher...

#

Timing total: 0.2929688
Timing total: 0.2421875
Timing total: 0.203125
Timing total: 0.1796875
Timing total: 0.3125
Timing total: 0.296875
Timing total: 0.3164063
Timing total: 0.3046875
Timing total: 0.34375
Timing total: 0.3828125
Timing total: 0.2929688
Timing total: 0.3398438
Timing total: 0.34375
Timing total: 0.34375
Timing total: 0.2929688
Timing total: 0.3398438
Timing total: 0.3710938
Timing total: 0.2851563
Timing total: 0.3320313
Timing total: 0.3671875
Timing total: 0.328125
Timing total: 0.3203125
Timing total: 0.3632813
Timing total: 0.3242188
Timing total: 0.3242188
Timing total: 0.3320313
Timing total: 0.3476563

#

How big a strand do you have on it?

#

I have a 144 hooked up but set to 100 pixels.

#

but as I said, shouldn't be doing any writes, it's all turned off, and no show is used during the loop.

slender iron
#

I don't have anything hooked up. it should actually know if they are there

timber mango
#

the original object is set to auto_write False, and so is my object right before the loop.

slender iron
#
  • shouldn't
tulip sleet
#
      for j in range(0, self.n):
            pixelnumber = j
            self.pixelobj[j] = (30,0,0)
#

That's going to construct (30,0,0) 100 times. Maybe move that out of the loop?

#

Or I think it might. Not sure what the compiler will do.

timber mango
#

it's going to set the pixel at j to red, IF it was written to the strand.

#

that's the goal of it, Dan: put Red into 100 spots in pixelobj's buffer to go to strand.

tulip sleet
#

I just mean do red = (30,0,0) outside the loop, then do self.pixelobj[j] =red

#

inside the loop

timber mango
#

Ah, let me try it.

tulip sleet
#

@slender iron do you know if it builds the tuple every time through the loop

slender iron
#

yeah probably

timber mango
#

moved (30,0,0) to red, and results are still:
Timing total: 0.24292
Timing total: 0.250977
Timing total: 0.265137
Timing total: 0.228027
Timing total: 0.246094
etc...

#

updated gist, btw

tulip sleet
#

@timber mango So saved some time (0.24 mostly instead of 0.32), but it looks like the self.pixelobj[j] = red is still fairly slow. Just curious if you comment that out temporarily to see whether the time goes way down (it should).

timber mango
#

It does, yes.

slender iron
#
Timing total: 0.109375
Timing total: 0.1083984
Timing total: 0.1103516
Timing total: 0.1103516
Timing total: 0.1103516
Timing total: 0.1103516
Timing total: 0.1113281
Timing total: 0.109375
Timing total: 0.1113281
Timing total: 0.1103516
timber mango
#

Timing total: 0.00537109
Timing total: 0.00488281
Timing total: 0.00488281
Timing total: 0.00634766
Timing total: 0.00585938
Timing total: 0.00585938
Timing total: 0.00488281
Timing total: 0.00488281

slender iron
#

thats what I get with it

timber mango
#

^ with commented out.

tulip sleet
#

@slender iron are you using 1.0.0 or 2.0.0?

slender iron
#

1.0.0

timber mango
#

when not commented out:
Timing total: 0.225098
Timing total: 0.203125
Timing total: 0.224121
Timing total: 0.225098
Timing total: 0.236816
Timing total: 0.200195
.2+ second to do a 'non writing set'?

tulip sleet
#

After the show I'll try this.

slender iron
#

kk

tulip sleet
#

I am getting 0.125ish with self.pixelobj.auto_write = False; 0.26-0.27ish with = True. No strand actually connected. So this matches @slender iron's timing, and not yours. @timber mango What's the host computer and what is the USB connection you're using (USB2, USB3, hub?).

timber mango
#

it's Macbook Air, no hub.

#

I should try it without a strand hooked up too.

tulip sleet
timber mango
#

No boot.py, and I've wiped everything (I'm getting similar results with both 1.0.0 and 2.0.0, and I replaced entire /lib with correct versions.

tulip sleet
#

Yeah, just try disconnecting the strand.

timber mango
#

in fact, by reflashing, and all of the connect/disconnect, it's certainly been a clean setup including resaving main.py

tulip sleet
#

The strand is all dark, right?

timber mango
#

yes, all dark.

tulip sleet
#

But, still, you're powering the little processors in each NeoPixel, so try disconnecting. Maybe it's a power sag if it's all being powered from the USB port. You could try interposing a USB hub.

timber mango
#

ok, gonna try no strand.

slender iron
#

good idea about power @tulip sleet

timber mango
#

Timing total: 0.1811523
Timing total: 0.1806641
Timing total: 0.1811523
Timing total: 0.1811523
Timing total: 0.1811523
Timing total: 0.1806641
Timing total: 0.1806641
Timing total: 0.1821289
Timing total: 0.1821289
Timing total: 0.1811523
Timing total: 0.2368164
Timing total: 0.2602539
Timing total: 0.1806641
Timing total: 0.1816406
Timing total: 0.25
Timing total: 0.2314453
Timing total: 0.1816406

Better, but not quite ....

#

so power could be a factor, strand attachment/drain...

slender iron
#

yeah, thats super weird

#

did you compile circuitpython yourself?

tulip sleet
#

@slender iron Do you think there's anything weird with the USB-derived clock?? Can't imagine it would work if it were messed up. @timber mango Do try interposing a USB hub if you have one.

slender iron
#

I considered it but time.monotonic is based on it too

#

so if it was actually the clock then time.monotonic would appear correct but actually be off

timber mango
#

I can dig out a hub, find one in the unused pile... ๐Ÿ˜ƒ

cunning merlin
#

COOL!! Model railroading & Arduino!!! Great combo

#

Goodnight!

timber mango
#

wrong chat room ๐Ÿ˜ƒ

hallow mirage
#

ahah

timber mango
#

Ok, powered hub, into Mac, plug the CPX in... (on 1.0.0 again). And it's still .2 seconds.

#

Timing total: 0.2380066
Timing total: 0.2390137
Timing total: 0.2310181
Timing total: 0.2180176
Timing total: 0.2229919
Timing total: 0.2399902
Timing total: 0.2250061
Timing total: 0.2359924

#

I did some lower numbers too. I wonder what the variation range is...

tulip sleet
#

@timber mango This is a rev G board? Look on the back at the bottom. Should be G in circle.

timber mango
#

yes, rev G

#

I have a few CPX, I can try another...

tulip sleet
#

The variation might be the garbage collector running during some trials.

#

Yes, definitely try another. This is weird. So the 0.23 is with auto_write = False?

timber mango
#

dafruit CircuitPython 1.0.0 on 2017-07-19; Adafruit CircuitPlayground 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:
Timing total: 0.2410278
Timing total: 0.2050171
Timing total: 0.2520142
Timing total: 0.2589722
Timing total: 0.2700195
Timing total: 0.2620239
Timing total: 0.2609863

And yes, auto_write = False, and no strand attached.

tulip sleet
#

Last thing to try is another microUSB cable. But it would have to be weirdly defective.

slender iron
#

yeah, thats pretty wild

timber mango
#

Ok, gimme a few to prep new board And I can change USB too, if you want...

#

different board, using same powered hub setup:
Adafruit CircuitPython 1.0.0 on 2017-07-19; Adafruit CircuitPlayground 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:
Timing total: 0.2010193
Timing total: 0.256012
Timing total: 0.2509766
Timing total: 0.2569885
Timing total: 0.2630005
Timing total: 0.2720032
Timing total: 0.2689819

#

(fresh 1.0.0 install, fresh rc5 bundle)

#

I'll try a new usb cable now.

slender iron
#

my mind is boggled. gotta make dinner now

timber mango
#

new (good quality) cable, no change... values average .25 or so...

#

with no strand attached.

#

I'm gonna try changing the strand value.

tulip sleet
#

Can you just double-check the code.py/main.py file? Open it directly with a fresh text editor and make sure that assignment = False. Those values look like my True values.

timber mango
#

False confirmed.

#

I just had interesting error happen:

#

Adafruit CircuitPython 1.0.0 on 2017-07-19; Adafruit CircuitPlayground 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:
Timing total: 0.1449585
Timing total: 0.1449585
Timing total: 0.1450195
Timing total: 0.1459961
Timing total: 0.1449585
Timing total: 0.1450195
Timing total: 0.1450195
Timing total: 0.1449585
Timing total: 0.1450195
Timing total: 0.1459961
Timing total: 0.1459961
Timing total: 1.362976
Timing total: 0.1900024
Timing total: 0.1879883
Traceback (most recent call last):
File "main.py", line 33, in <module>
File "main.py", line 30, in run
File "main.py", line 30, in run
File "main.py", line 17, in update
File "libraries/drivers/neopixel/neopixel.py", line 136, in setitem
File "libraries/drivers/neopixel/neopixel.py", line 121, in _set_item
KeyboardInterrupt:
soft reboot ( this is a glitch, I did do anything....)

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Timing total: 0.2650146
Timing total: 0.25
Timing total: 0.2230225
Timing total: 0.2600098
Timing total: 0.2700195
Timing total: 0.2739868
Timing total: 0.2609863
Timing total: 0.2689209
Timing total: 0.2249756
Timing total: 0.2310791

#

should say 'didn't' do anything above

tulip sleet
#

Are you using screen to do a serial connection to the board, or something else?

timber mango
#

screen. I was wondering if baud rate was an issue (I wasn't always giving it the 115200, it still works) so I did it explictly... and watch these values:

#

soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Timing total: 0.1349945
Timing total: 0.1329956
Timing total: 0.1310043
Timing total: 0.1319962
Timing total: 0.1310043
Timing total: 0.1319962
Timing total: 0.1310043
Timing total: 0.1309967
Timing total: 0.1310043
Timing total: 0.1309967
Timing total: 0.1320038
Timing total: 0.1320038
Timing total: 0.1319962
Timing total: 0.1320038
Timing total: 0.1319962
Timing total: 0.1320038
Timing total: 0.1309967
Timing total: 0.1319962
Timing total: 0.1320038
Timing total: 0.1320038
Timing total: 0.1320038
Timing total: 0.1320038
Timing total: 0.1329956
Timing total: 0.1320038
Timing total: 0.1430054
Timing total: 0.1450043
Timing total: 0.1970062
Timing total: 0.2149963
Timing total: 0.1620026
Timing total: 0.1329956
Timing total: 0.1330109
Timing total: 0.1329956
Timing total: 0.1329956
Timing total: 0.1320038
Timing total: 0.1329956
Timing total: 0.1329956
Timing total: 0.1330109
Timing total: 0.1340027
Timing total: 0.1329956
Timing total: 0.1329956
Timing total: 0.1340027
Timing total: 0.1329956
Timing total: 0.1330109
Timing total: 0.1329956
Timing total: 0.1329956
Timing total: 0.1340027
Timing total: 0.1340027
Timing total: 0.1340027
Timing total: 0.1399994
Timing total: 0.1499939
Timing total: 0.147995
Timing total: 0.1419983
Timing total: 0.1340027
Timing total: 0.1340027

#

Timing total: 0.1350098
Timing total: 0.1340027
Timing total: 0.1399994
Timing total: 0.2000122
Timing total: 0.1349945
Timing total: 0.1349945
Timing total: 0.1349945
Timing total: 0.1349945
Timing total: 0.1459961
Timing total: 0.1719971
Timing total: 0.230011
Timing total: 0.2369995
Timing total: 0.2030029
Timing total: 0.2259979
Timing total: 0.2100067
Timing total: 0.2310028
Timing total: 0.2339935
Timing total: 0.2299957
Timing total: 0.253006
Timing total: 0.2379913
Timing total: 0.2389984
Timing total: 0.2110138
Timing total: 0.2200012
Timing total: 0.2019958
Traceback (most recent call last):
File "main.py", line 33, in <module>
File "main.py", line 30, in run
File "main.py", line 30, in run
File "main.py", line 17, in update
File "libraries/drivers/neopixel/neopixel.py", line 126, in setitem
KeyboardInterrupt:

#

it was 14.... then it went back to .20+

tulip sleet
#

I have an old Macbook Air here. I'll try that. I was using Windows. What's the device to use with screen? I forget -- I don't use a Mac very much.

timber mango
#

slash dev/tty.usbmodem (something...)

#

my numbers are all over, some as low as .13, some as high as .30

#

and higher... .35 is common in some runs.

tulip sleet
#

OK, I am getting similarly weird timing! I am moving the SAME board back and forth between the Macbook Air and Windows, and the timing is more random and higher on the Air!

timber mango
#

ok, confimed, size of the strand in the pixel matters [edit, IGNORE ME HERE. OOPS]

#

put in 20, goes fast, put in 100, slower, put in 200, slower yet.

#

with NO strand, and supposedly, no writes. (buffer size will change, of course)

tulip sleet
#

Makes sense: you are going around the loop <strand-length> times

timber mango
#

No, that timing is per pixel[i] set.

#

so it's a single set.

#

with no write.

#

so it's just supposed to set buf value for i to the right value.

tulip sleet
#
        for j in range(0, self.n):
            pixelnumber = j
            self.pixelobj[j] = red
        stoptime = time.monotonic()```
timber mango
#

Oh, never mind.

#

Duh, I rewrote things a few times ๐Ÿ˜ƒ

tulip sleet
#

self.n is strand length, right? So the j loop executes strand-length times.

timber mango
#

it used to do what I said, I changed it.

tulip sleet
#

I'm going to boot up Linux and try this. Dual boot machine so I'll be back in few minutes.

timber mango
#

you're right, back to 100, for consistency.

tulip sleet
#

On Linux, the timings are 0.125-0.127, as on Windows. My Macbook Air is (13-inch, late 2010), running 10.12.5 (Sierra). What's yours ("About this Mac?")?

timber mango
#

10.10.5 mid 2011

#

Linux /Windows are same hardware, right?

tulip sleet
#

Both pretty old. So you're not crazy, and it's the Mac. WHY, I don't know. Perhaps some USB weirdness. @slender iron is using a much newer Mac

#

Yes, same machine. I have two disks and boot from one or the other. I didn't even unplug the CPX>

timber mango
#

Hmmm... let's see what else I can hook up too.. I have linux server in basement... I can plug this CPX in there.

tulip sleet
#

A lot of my life with Adafruit has been debugging USB problems. I think this is another one! Maybe there's a different serial program to try on the Mac.

timber mango
#

sudo scren /dev/ttyACM0

#

.27-ish values.

tulip sleet
#

OK, I got it. I have USB2 and USB3 ports on this Linux/Windows machine. The consitent

#

low numbers are on USB3. The higher .21 -.25 number are on USB2. Our old Airs have USB2. Your Linux server probably does too. Scott's newer machine is almost certainly USB3. Scott and I will have to look at this more.

#

I don't know why you see even .3 on your USB2, but there may be some delay going on somewhere.

#

But I see .3 on my Air as well. Maybe it's just because it's old and slow.

timber mango
#

good, so I'm not crazy. whew.

tulip sleet
#

I guess I have to say "we'll get back to you". I'll write up an issue.

timber mango
#

๐Ÿ˜‰

tulip sleet
#

Good night and thanks for your perseverance. It was very helpful!

solar whale
#

@slender iron I have created my branch and merged the changes for the CCS811 library, but github will not allow me to execute git push origin. Permission denied...

#

I created a branch called jerryn then tried git push origin jerryn, but was denied.

tulip sleet
#

@solar whale Scott went to dinner. Did he mean to give you write permission to that repo. You know about pull requests, right?

solar whale
#

I am trying my first pull request so I may have done something wrong. not sure if I have permission - He asked me to do the pull. I cloned the repo, created branch jerryn - made changes, merged changes then I think the next thing to to is the push of the branch, correct? then I can do the pull request, right?

tulip sleet
#

You fork the repo on github, then clone your fork, so you have jerryn/name_of_repo. Then create a branch, make your changes, and push to your fork. From there you can then see a button that says "Create pull request". You'll do that, and it will show up in the upstream repo.

#

That is, the pull request will show up. Upstream will take a look, and merge it in if it looks ok.

solar whale
#

OK - I'll try that - still shaky with git...

tulip sleet
#

I'll try to find you an online recipe that explains things.

prime flower
#

...ok we are so doing a video on doing "contributing to circuitpython" tomorrow

timber mango
#

nice, when, @prime flower ?

#

now that I know I'm not crazy, I can get back to working on the helpers I was planning (and started)

prime flower
#

whenever I get in tomorrow, I'll set up a demo git repo and show all these commands. I was planing on the DHT22 but I'm running against timing issues as expected,

prime flower
#

I think I'll touch on doing this exact thing considering I've had a lot of experience doing things wrong, as tannewt knows

#

@tulip sleet thx 4 links, i bookmarked

solar whale
#

Thnaks - first step of fork rather than cloning master was a big one! Makes sense

prime flower
#

@solar whale scott got me in the habbit of renaming my remotes

#

so you can do "git push adafruit"

tulip sleet
prime flower
#

ugh and rebasing is an useful topic, but should also be discussed...I think we'll have 2 vidz: "contributing to circuitpython" and then "converting arduino libaries to circuitpython libraries"

scenic timber
#

@timber mango great work on the test code for the slow pixels ๐Ÿ˜ƒ

prime flower
#

...adafruit sponsored facebook ads keep hitting me

tulip sleet
#

Github has a new feature of doing rebasing during the pull request merge. There's a setting in the repo that does that. I found it for Scott. So the poor pull requester doesn't necessarily have to do a rebase or squash or whatever.

timber mango
#

thanks @scenic timber hard time knowing there was a problem, and not being able to pinpoint it... and it's something usb hardware like usb2 vs 3, that's why it's "I don't see a problem" so often.

prime flower
#

huh...cool. is there any way to do that from the terminal @tulip sleet ?

scenic timber
#

@timber mango i am using an old mac too.. dang usb...

tulip sleet
#

It's a setting in the upstream repo to do the squashing automatically. Do you want to do the rebase before the pull request? You can do "git rebase" or "git rebase -i". But you have to know what you're doing. I've found it very annoying. At my current job we rarely rebase - it's not worth it and we don't care about extra junk in the commit logs.

solar whale
#

@tulip sleet cool - I think I did it - Pull request submitted to Adafruit_CircuitPython_CCS881. it was a trivial change, but good practice!

tulip sleet
#

@solar whale Congrats! It took me a few times to get it right too. After the pull request is taken you can delete your branch; Github makes it really obvious how to do that. Also don't forget to sync your fork from upstream after the pull request, and later if there are any further changes. The digitalocean tutorial above explains that, I believe. It takes a while to get the hang of the workflow.

prime flower
solar whale
#

@tulip sleet Thanks for the links. and tips.

#

@prime flower the learning system has been a great resource,, thanks!

manic glacierBOT
#

This code https://gist.github.com/sethcohn/0d2493dc2b854bd5584fe09fc0cd8509 shows timing differences when the USB port is attached to different USB ports (major differences USB2 vs. USB3, minor differences on various USB2 ports).

Dell 7010, has USB2 and USB3 ports:
USB2: typically 0.25 secs per loop iteration
USB3: typically 0.125-0.127 secs per loop iteration
(using Tera Term on Windows, screen on Linux)

USB2, old Mac Airs (2010, 2011):
May start out with 0.1x, but rises to 0.24 ...

manic glacierBOT
#

like the title says, it would help to have a way to detect if the device is connected only on an usb power source or actually is accessed as a mass storage device

this way i could write myself a boot.py that could wait around 5seconds before actually calling my main.py
if the device is connected as mass storage, i would prevent causing damage to the internal writing system but if the device is not connected as mass storage i would disable the mass storage interace after 5 seconds and allo...

#

No worries! I think it's a super common thing that will come up and don
from discord came up with the switch idea which is a good one!
On Thu, Aug 10, 2017 at 12:26 AM mindforger notifications@github.com
wrote:

oh shit i did not know that, sorry :(

yeah i did that with the jumper but i thought it could be made easier that
way :)

โ€”
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
<https://github.com/adafruit/circuitpython/is...

sick creek
#

@slender iron can we use ROSIE?

slender iron
#

@sick creek I'll make the repo public today though I won't turn it on in CircuitPython master until I fix all of the tests

timber mango
#

@timber mango you may be able to get rid of the repl loop entirely to speed up execution of your neopixel code. Treat the USB cable as hostile... As a noisy wire. Essentially remove it. Instead rely on a quiet power supply entirely independent of a host PC. Abandon any form of character-based timing reporting. Instead use an oscilloscope. These are just my own ideas and are not to be taken as authoritative.
And I'm back quiet.

royal ridge
#

Is there a way to get at the MCU registers from within circuitry?

#

Er. Circuitpy .. Stoopid autocorrect

timber mango
#

@timber mango while true, it makes debugging and development harder. Solvable by knowing it's an issue first. Which we do now.

slender iron
#

@royal ridge not currently. What are you interested in doing?

manic glacierBOT
royal ridge
#

@slender iron I was thinking about mindforger's thing. Unless circuitpy is bypassing the native USB bits, it there's a register that shows the current USB state on a protocol level, which with a dumb charger stays as disconnected...

slender iron
#

before the peripheral is initialized?

royal ridge
#

That part I'm not completely sure of.

#

I've just been thinking about it since I saw that when I woke up this morning, haven't had a chance to check anything really

slender iron
#

yup yup, we could change the hardware so that it can measure the voltage coming from the usb plug

timber mango
#

๐Ÿš

manic glacierBOT
#
[adafruit/circuitpython] New branch created: break\_extra\_test
manic glacierBOT
manic glacierBOT
manic glacierBOT
timber mango
#

Ok, I converted a nifty candle flame routine as a classed object... Works well, giving it as many pixels as I'd like (each flickers like a flame, independently....
Doesn't work (for me) as the 'fire' I want to see, though, so back to drawing board. But I'll be sharing this as one of many classes that I'm writing up.

slender iron
#

sounds awesome @timber mango

scenic timber
#

@timber mango is the speed issue fixed?

slender iron
#

@scenic timber no but they determined its USB port dependent

scenic timber
#

So in theory it will be fast(er) if it was just a usb power source and not a computer port?

slender iron
#

yeah

#

or battery

scenic timber
#

cool cool. Pretty sure I always had it hooked to my computer... Ordered a CPX should get it soon then I can start playing without having to dig out my christmas decorations...

timber mango
#

Hopefully, a fix will happen eventually, if we can figure out why it happens.

slender iron
#

I'm not sure it can be fixed if its a matter of how much the usb host talks to the board

scenic timber
#

interesting issue. I guess knowing that you can unplug the usb to test helps

#

it's a little concerning when your pixels slow to a crawl when you increase the count

#

@timber mango have you tried your animations on a regular power source and not the usb port?

timber mango
#

Not for the stuff I'm doing right now, since at 10 pixels, the CPX is fine. On the other hand, when I hook up my 256pixel Dotstar panel or my 144 strip of Neopixels,....

#

but right now, I'm working on a simple project (figuring it's an ExtraCredit one), to just do a nifty flame animation on the CPX

#

the candle stuff I mentioned above was today's work on it, and it works great.... but it's a candle (flickering), and not a flame pit.

scenic timber
#

should post a video clip or gif or something ๐Ÿ˜ƒ

#

or code for people with a cpx i guess..

slender iron
#

@scenic timber neopixels are always slower the longer the strip is unless you use a DMA library

#

because the data is transmitted serially

scenic timber
#

@slender iron I know I am trying to figure out why the speed in arduino was so much faster is all.

timber mango
#

yeah, DMA access for circuitpython would be nice.

slender iron
#

@scenic timber its compiled ๐Ÿ˜ƒ

scenic timber
#

but is the slow part the math or the telling the pixels to light?

timber mango
#

lighting...

#

it's literally pushing data out the pin.

slender iron
#

no, the lighting is only slow due to the usb interrupts surrounding it

#

that is fixed for neopixels

#

dotstars can be clocked faster

timber mango
#

I didn't find my dotstar any faster (in my test last night...)

#

but I don't have much to go on yet... I'll play more.

slender iron
#

dotstars is slow now because its bitbanged

#

it can be DMAed super fast though

#

neopixels have a fixed timing which limits how fast they can be updated

scenic timber
#

so it's the math that is slow?

slender iron
#

between circuitpython and arduino yes definitely

scenic timber
#

so could I just manually write out all the transitions and it should at that point run at the same speed?

#

just wondering if I should program smarter or if the hardware will always get in my way...

#

sounds like I can program around it.

slender iron
#

we can improve the dotstar library

#

I'm skeptical we have things to improve in circuitpython though generally

#

it will never be as fast as arduino on the same hardware

scenic timber
#

yeah thats expected.

#

will the samd51's help?

slender iron
#

yes definitely

#

the math side of things for sure since it has a faster clock speed and floating point support

scenic timber
#

was tempted to wait for those but impatience got the better of me..

slender iron
#

๐Ÿ˜ƒ arduino will be even faster on the 51s

scenic timber
#

lol true.

#

really I want to teach my nieces to program and circuitpython just seems like the right place to start. I just need to learn first ๐Ÿ˜ƒ

slender iron
#

well I hope it works well for that! thats my priority over speed for sure

timber mango
#

yeah, I realize C is always going to be faster (and I'm loading some sketches into the arduino IDE and running them to see what they do on CPX. I know enough C to hack at it. And I'm enjoying spending my time getting back up to speed on Python, and rewriting the routines into better things (like Animation classes), figuring that it only helps others in the long run, if some good examples exist, and basic code is there for the tweaking of newbies.

slender iron
#

@timber mango definitely, good examples and quick iteration time are super important

timber mango
#

@slender iron What's the pin numbers on Gemma M0?

slender iron
#

not sure what you mean

timber mango
#

I'm using sketch that I need the numbers... PA05 and PA04 aren't working... It expects a number.

slender iron
#

in arduino? I have no idea

timber mango
#

for led and clock pin...

#

yeah, in arduino.

slender iron
#

did you try the numbers based on the silk screen?

timber mango
#

?

slender iron
#

D0 = 0

timber mango
#

ah, that's what I wondering.

tulip sleet
#

It's supposed to be the same as on the original Gemma.

#

So you could use examples from those tutorials.

timber mango
#

bingo that worked... it's 0 and 2 instead of D0 D2

manic glacierBOT
timber mango
#

now it says missing bootloader for Gemma M0... samd21_sam_ba.bin

#

so off I go to find it.

#

(trying to load up a arduino dotstar sketch)

slender iron
#

you should be able to ignore that warning

timber mango
#

ok, good to know.

#

hmmm, not working still though.

#

back to drawing board.

manic glacierBOT
timber mango
#

oh well, compiled and loaded but didn't work. Calling it a night.

timber mango
#

and of course didn't give up, and got neopixel version working at least. Now I'll hit the sack

manic glacierBOT
manic glacierBOT
sharp tangle
tidal kiln
#

@slender iron well done!

tulip sleet
#

@slender iron Great interview, Scott!

prime flower
#

what a good read!!! hopefully this will get more people over here, keep growing the python

fast wharf
slender iron
#

Thanks @sharp tangle @tidal kiln @tulip sleet @prime flower and @fast wharf

prime flower
#

@prime ingot o/ scott told me you're working on using the internal RTC for, like, sleepydog-like operation. do you have any code written yet? I'm very interested in this as well

royal ridge
#

Silly, tangientally-related-to-circuit-python question: would the u2f bootloader work on the other M0 feathers?

slender iron
#

@royal ridge yup, there might be some slight tweaks needed but generally yes

royal ridge
#

kk

manic glacierBOT
slender iron
#

I think the plan is to switch all boards to it at some point now that we've had time to find bugs with it.

manic glacierBOT
slender iron
pastel panther
#

Does anyone know if there is design criteria for what makes for a good CircuitPython board? Obv. a SAMD21 is a good starting point, but anything else? I'd like to give making a custom board a go. Would something like a Feather m0 express be a good starting point?

slender iron
#

@pastel panther yup, the external SPI flash helps a lot

pastel panther
#

More== better? Or is the 2MB plenty?

#

I guess it probably depends on the application.

slender iron
#

2MB is plenty now

#

thats what the code is set to support currently

#

the PSB layout doesn't need to change with size which is nice

#

PCB

#

just the code

pastel panther
#

How trivial would it be to fork and update/expand the code to support larger sizes?

slender iron
#

pretty easy

pastel panther
#

perfect

slender iron
#

๐Ÿ˜ƒ

pastel panther
#

I'd love to contribute once I get a compatible board though it might take me a minute to dust off my c/c++ skills

#

"skills"

slender iron
#

you should pick up a metro m0 express then ๐Ÿ˜ƒ

pastel panther
#

Any benefits over the feather?

slender iron
#

for dev its got a SWD header

pastel panther
#

ah

slender iron
#

a dev feather would be cool though

pastel panther
#

Maybe I can whip up a board this weekend

slender iron
#

๐Ÿ˜ƒ the files for the metro and feather expresses are available to start with

pastel panther
#

Yea, I've been pillaging the feather git repo

slender iron
#

are you hoping for a different form factor or just to learn more?

pastel panther
#

both

#

rather I don't have a current need for a different form factor, but I'm enjoying making boards and and developing that skill set.

slender iron
#

yup totally

#

using eagle and osh park?

pastel panther
#

indeed. I reflowed my first design two nights ago and it was amazing

slender iron
#

what did you use to do it?

pastel panther
#

I may have bitten off a bit much though as I have to figure out how to program it using the isp header I put on the board

slender iron
#

I was considering getting something to do reflow here

pastel panther
#

my old toaster oven

slender iron
#

did you do it by eye?

pastel panther
#

yup, using the good ole' mk1 eyeball

slender iron
#

nice!

#

well I'd recommend ditching the 32u4 for an M0

#

but thats my bias

pastel panther
#

I have no idea it it worked but at least I know the voltage reg works

slender iron
#

yup yup

pastel panther
#

I'm def headed that direction but I'm also trying to not spend my whole paycheck on setting up my lab

slender iron
#

M0s are cheaper than 32u4 I think

pastel panther
#

good to know

pastel panther
#

jeez, you're right

slender iron
#

๐Ÿ˜ƒ

#

and way more of everything

#

plus I know how to use it ๐Ÿ˜›

pastel panther
#

totally. I'm still trying to 'earn' the hardware on a attiny85 but I'd be lying if I wasn't drooling at the m0

#

It will probably be handy for some upcoming projects though.

slender iron
#

earn it?

pastel panther
#

Use it to it's full potential?

slender iron
#

ah

#

circuitpython makes it easy to leverage the m0

pastel panther
#

My first board was a basic motor controller that definitely didn't need a m0 ;P

#

yea, I dig the accessibility that it provides. I think it will do a good job of broadening 'market' for embedded dev

#

Anyhoots, back to the salt mine

#

thanks for your help

slender iron
#

np cheers @pastel panther

manic glacierBOT
river quest
#

ok added make story to title of chat for now, z00m!

manic glacierBOT
scenic timber
#

Why is what I'm typing getting deleted?

#

f i t t i n g example

slender iron
#

we just turned on automod

scenic timber
#

apparently that is a bad word?

slender iron
#

guess how I came up with it

#

let me look

scenic timber
#

seems to be

#

it is very weird to see your message for a second before it disappears..

#

good interview ๐Ÿ˜ƒ

slender iron
#

fitting example

#

hrm

#

?thankyou

digital shoreBOT
#

You're welcome @slender iron.

scenic timber
#

I'm sorry I will stop prefix swearing...

slender iron
#

๐Ÿ˜ƒ

timber mango
#

What? Neopixel animation is slower on CircuitPython than on Arduino? No way!!! ๐Ÿ˜‰

alpine nimbus
#

a little while ago i was watching some adafruit video that showed someone editing circuit python code on a Gemma M0 but now I can't find it. Anyone know what I'm talking about? I tried skimming through the last couple ask an engineers and now I don't see it.

timber mango
#

It's probably Tony D

alpine nimbus
#

i haven't seen any of his videos in a while. I think it was Limor or Noe

#

i'll look at that though. thanks

#

the one i'm thinking of was just a quick demo

timber mango
#

Hmmm... then it was Noe's recent Gemma pendant.

#

oh wait, that's not the long one...

#

one sec.

manic glacierBOT
alpine nimbus
#

Yes, that's the one, thanks! (beginning at 16:30)

#

i have a friend who is a python programmer and not much electronics experience. She wants to do a project with her daughter so this sounds perfect.

timber mango
#

agreed.