#circuitpython-dev
1 messages ยท Page 160 of 1
i almost @'d you Dan... ๐
@lusty tangle Try putting a time.sleep(1) before you do mouse = Mouse(). I had one support issue where the CPy code was faster than the host computer in terms of them negotiating the USB HID devices
you'll need to import time if you aren't doing that already
@tulip sleet you are a genius! That fixed it. Thank you!! @raven canopy
verified on my end too. there is that OS Error that was popping up. thanks @tulip sleet!
Thank you everyone. Have a great evening!
i guess i'll just :q!
you too @lusty tangle. And I think that is a candidate for a doc update...
@tulip sleet does that affect all 3 instances, or just mouse?
updating doc
Might be too much to ask, but any idea why makecode didn't work?
It's all three. The original issue was here: https://forums.adafruit.com/viewtopic.php?f=52&t=125560#p629406 Also is here: https://forums.adafruit.com/viewtopic.php?f=52&t=130143
what is your OS, @lusty tangle
Windows 10
thanks - I'll open an issue about this. We can put a retry in the Python code in the library, or check for device existence in the C code, or something like that. I put time.sleep(1) in this example and some others: https://learn.adafruit.com/adafruit-circuit-playground-express?view=all#circuitpython-hid-keyboard
@lusty tangle is PhunkMaster your github id too, or is that a different person with the same username?
That is me as well
ok, good, issue opened here: https://github.com/adafruit/Adafruit_CircuitPython_HID/issues/13
On some hosts (reported on a Windows 10 machine), main.py can start before the HID devices are ready on the host side. Examples:
https://forums.adafruit.com/viewtopic.php?f=52&t=125560#p629406
...
First time I've ever helped to find a bug! Yay!
thanks very much - it wasn't clear to me how common this was. It definitely doesn't happen for everyone, but I'm not sure when it does - we should retry
Glad to be of assistance, and I thank everyone that chimed in here tonight for helping me.
I need to get some sleep, I'll check back this weekend to chat about why makecode didn't work for this project.
@tulip sleet I've updated the README and examples for now. I won't update the API docs; no logical place to put it.
Now the feather is ejecting as soon as it mounts. Running 3.0 and an iteration of my earlier code.
I have to head out, I'll post the code tomorrow, I managed to grab it quickly. It doesn't look like the code is running anymore. Also I had the purple status LED while the code was running. It's not currently and the LED is green. I am still able to screen into it.
That's why I don't think the code is running anymore.
@lusty tangle could you post your previous failing code in the issue: https://github.com/adafruit/Adafruit_CircuitPython_HID/issues/13? Based on the library code, it's not clear to me why it's failing on m = Mouse(), but it might be failing on the first attempt to move the mouse. I'd like to try to reproduce this. Or @raven canopy, if you have failing code, could you post it? I think I know how to fix it easily but want to double-check.
@tulip sleet I updated the issue with my failing code.
thanks!
No problem!
what are the things needed to add support to a playground express for extra neopixels?
just hardware, software-wise it's the same as what's driving the neopixels on the board
do you already have the extra neopixels?
yeah, i just wasn't sure what to modify to get the extra ones working
also - you can't really "extend" the existing pixels, you basically just add another strand to one of the pads, and then you'd talk to it separately
what are the xtra ones you have?
i've got 4 individual ones and a 12 ring
do you know the product numbers for them? (since we have a lot of flavors, RGB, RGBW, etc)
PRODUCT ID: 1260
PRODUCT ID: 1643
looks like both are RGB
do you want to hook them all up, or just some of them
mainly a hardware thing on how to go about it
i'll be hooking them all up, and i'm not quite sure how
well, for now i'll just be trying to hook one or two up to see if i can get it working
this covers some of the details:
https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-neopixel
toward the bottom it shows how to add external neopixels
It takes a surprising length of time to update that 128x32 OLED over I2C, 60-80ms. Is that likely to be due to using bitbangio.SPI, or is it inherent in I2C? Perhaps I simply need to modify my expectations.
My Python code is a fill(), 5 text() calls that show about 30 characters in all, and show().
@onyx hinge it maybe could be optimized some, but i think that's about it. the i2c speed can be a bottle neck. but still, that's ~12FPS. not horrible.
oh wait. you said SPI.
which is it?
correct
"To make it as cross-platform compatible as possible, we use only I2C to control the display. This is not as fast as SPI but it uses only two pins"
i guess now it's me being uncertain what i need to put in to make the extra pixels usable
like
the code i need is probably in what you sent and i'm just
not realizing it
i don't think it has a good code example, but the main key is just specifying the pin when you create the neopixel object:
neopixel_ring = neopixel.NeoPixel(board.A2, 12)
alright! thanks, there's a lot of things that are simple but wouldn't really occur to me
how do you plan to wire them in? i think that'll be the trickier part, esp. if you don't plan to solder.
i've got a handful of clips
this is just to test for now
do i just kinda
attach clips to clips to keep the power going through to multiple pixels?
for those individual flora pixels?
yeah
for power, yes, so all the - are attached together, and all the + are attached together
alright
for data, it's like a daisy chain, so you'll come out of the CPX pin and into the first pixels in pin, then that pixels out pin goes to the next pixels in pin, etc
the little arrows show the data flow, it's like a pipe
alright
i tried testing it out and
it doesn't seem to recognize the IR remote anymore
what's the ir remote?
the mini one
"ImportError: no module named 'adafruit_irremote'"
it was working fine before so?
it's acting like the module library isn't there anymore. did you delete things? or do any re-installing of stuff on the CPX?
check if the file is there: CIRCUITPY/lib/adafruit_irremote.mpy
your CIRCUITPY folder is blank / empty?
that's fine. it should. and then you can look at whats on it.
hmmm. yah. somehow things got deleted.
fun
what's in the boot_out file?
"Adafruit CircuitPython 2.2.4 on 2018-03-07; Adafruit CircuitPlayground Express with samd21g18"
easier. just need to drag the files back over on to the drive.
the CPX is an Express board, so you can just copy the whole lib folder over
yeah
are your clips alligator clips, or something else?
yeah, alligator clips
might be tough to get a good reliable connection on the ring with those
it was meant more for a solder connection
yeah
but what's your code look like?
again, im just trying to test this all before getting it properly made
readjusted the lips
now i've got 2 lights and a bit more blindness
pixels is your ring?
no, that's the on board
i'm not quite sure what to do to get both going on the same things
also i should probably start wearing sunglasses
that has been known to be done by people working with neopixels ๐
what pads on the CPX do you have the ring connected to?
like all the files are missing in CIRCUITPY ?
yep
weird. what were you doing when it happened?
no sure what could be doing that.
how much of an effect do magnets have
because there are some in my laptop for whatever reason
wouldn't expect those to be an issue
just wanted to make sure
if they were strong enough to be a problem, your laptop woldn't be happy either
alright
at one point the neopixels on the express flashed red and i'm not sure what i did to have that happen
it might have been your code, since you said pixels is the onboard ones, and you're using that
i can show you how, but i'm concerned about why your files keep disappearing
yah. not sure.
try using just a single one of the flora ones
alligator clips go on those much easier
here's the basics of using the two different neopixel strands:
import board
import neopixel
onboard_pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2)
offboard_pixels = neopixel.NeoPixel(board.A2, 1, brightness=0.2)
onboard_pixels.fill((0,0,255))
offboard_pixels.fill((0,255,0))
@unreal ginkgo are you pressing the reset button?
no
hrm, not sure why the filesystem is changing then
seems to mostly work with 3 pixels
i'd check to see if it worked with 4 but
i must have forgotten a clip at home
now i've got how to do the basics of setting these up, i'll try and get the ring set up laterrrrrrrrrrrrr
forgot that i only had 12 cords
well i can always use 2 individuals and the sewing to ring adapter
well, i'll get this done later, i've gotten a ton of work done in the past hour and it feels great
good job @unreal ginkgo !
I don't think we'll get to zero, we'll just hover around it. Thanks for getting us close! I'll close this and we can do more Adabot driven stuff in new issues as needed.
@stuck elbow the uGame Turbo looks awesome! One correction from the Microcontroller log is that the SAMD51 is 120mhz, not 48.
I'm still a bit afraid of all those passives necessary for it
have you looked at my 3.x audio work yet?
no, I've been a bit busy with the e-paper stuff
how many passives? the inductor?
oooh nice!
I think it'd be possible to do audio mixing in C code
this weekend there is the hackaday unconference, so probably I will look next week
nice!
multi-channel sound!
and mp3 shouldn't be too hard to add for the 51
yeah, I have stereo output working already
so I could do music on one channel and sound effects on the other
I think so. I haven't tried it from two different sources but it shouldn't be hard to fix if it doesn't work
I think this is going to be the perfect device for games in Python
yeah totally
the samd51 chips already came โ the ones with 256MB RAM
I was up late last night brainstorming ways of programming a gameboy with circuitpython
basically using the gameboy cpu to talk to the peripherals
yeah, cartridge would be the way to go
Does anyone know how to flush the file you're writing data to with datalogging to an SD card?
i think there's a flush function
Wait, no what I was asked to do was specifically this: "after each data log 'flush' the file by closing it"
And I'm unsure what that means
so am i
Fair enough. I'll ask instead then
what does "each data log" mean though?
I am trying to communicate from a CPX to an ESP8266 feather via UART. I have the CPX TX/RX connected to the RX/TX pins of the ESP8266. Every thing works great as long as I have a USB data cable connected to the ESP8266, but if I remove that cable, and power the ESP8266 any other way, then the RX line to the ESP 8266 does not work. I still receive data at the CPX via TX, but the ESP8266 does not receiver anything. On the Feather there is a 1K resistor between USB_RX and RX. Do I need to do something with RX to make this work??
i guess i could read that as "when you're done logging, close the file"
which makes sense
@solar whale GNDs connected between the boards?
Well it makes me feel better about things, so there's that part of it, @solar whale
@tidal kiln thanks!
@idle owl it good practice to close you file after each write - then reopen it - that wa it is "safe" between writes.
Oooh that sounds right, how do I do that?
I almost pinged you but then thought maybe what you had done with SD card stuff wasn't this
Thank you
what's the time between writes?
3 seconds
some good examples of using flush here: https://learn.adafruit.com/cpu-temperature-logging-with-circuit-python?view=all
or you can do fp.close() and re-open it every time.
i'd just let the context manager do that
Ok next question, I have \n in there but it's not doing a new line
is the idea to make sure data doesn't get lost if something happens in the logging loop?
@idle owl post that line of code
how do you know it is not doing a newline?
I looked at the log file
and it's all on one line
426.221.426.221.426.221.326.221.326.221.326.221.426.221.326.221.326.221.326.221.326.221.326.222.226.321.326.221.326.221.326.221.426.221.326.221.426.121.326.221.326.221.326.221.426.221.426.221.426.221.426.221.426.321.426.321.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.326.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.221.426.222.226.321.426.321.426.321.426.421.426.421.426.321.426.321.426.321.426.321.326.321.426.321.426.321.426.321.426.321.426.321.426.322.126.421.226.422.529.122.628.922.528.622.528.322.527.822.427.322.426.822.426.422.326.122.325.922.325.722.225.622.225.522.225.422.125.423.425.523.725.6etc.
can you post the line that is writing it out
sdc.write("{}\n".format(humidity))
the flush example above should be OK - and the context manager will close the file
two? where's the other one coming from?
can you post a bigger code snippet
same sensor different line
yes
it's supposed to log 3 pieces when this is done
but I'm unsure about the output of data number 3 and haven't written it to the card yet
f.write("{},{},{}\n".format(x,y,z)) <-- what i've done
temperature = am2320.temperature
humidity = am2320.relative_humidity
print("Temperature:", temperature)
sdc.write("{}\n".format(temperature))
print("Humidity:", humidity)
sdc.write("{}\n".format(humidity))
sdc.flush()
time.sleep(3)```
if that's the right way to use flush anyway
I just now put it in there.
can you upload one of the log.txt files
for the record, It worked right with the original example code as per what you're about to see if you look at this file, then I screwed it up somewhere along the line.
you are opening for append - fi there is old stuff at the start of the file - it will still be there - have you deleted the file before testing a new version?
no I hadn't done that
worked...worked differently....didn't work ๐ฆ
yes.
yah delete it and make a fresh one
also, just do the writes with one line (see above)
@tidal kiln Luckily my ground was connected to a "NC" pin on the feather -- that was driving me nuts
ha. glad it was that simple. the 'ole north carolina pin.
I have my esp8266 set up so it looks for an input via UART with a feed name and value then sends it to adafriut.io -- Now I can ust the CPX or any board to send sensor values to my adafruit io.
ha. seems to be a recurring theme with your current bug fixes.
Right?
It did that I2C thing again, I unplugged and replugged and it went back to working
@solar whale neat. so like a serial to internet bridge.
yes - very simple - but seems to be working
@idle owl next time the i2c stops working, try hooking up the saleasesaes and see what it's doing
@idle owl when I2C stops workig - does it not even recover with a soft (control-D) reboot?
the adalogger is SPI, correct? do you have pullups on the AM2320 i2c lines?
The RTC is I2C
when I had that running as well, it would lose that address as well
and yes I do
hmm - althought I expect the RTC also has pullups on it - what size resistors on the am2320
why?
yes. feather wing also has 10k's
ah - yes - I remember tryin that!
but with the featherwing plugged in I think the extra pullups are not needed but wont hurt, correct @tidal kiln ?
generally correct, they act in parallel so reduce the over all pull up, would just need to keep that in mind
doubt thats whats happening though
@idle owl would it be usful to try another i2c temp/hum sensor to see if the hangups are only due to the am2320?
what board are you using. I can try to replicate this if you would like. - I have the parts
(its a feather m0 express)
photos are up there in the scroll back somewhere yesterday-ish
ah - saw them flash by - I'll give it a try.
The RTC is also I2C, different sensor, and stopped working, or are you thinking it stopped all I2C because the AM2320 was connected at all?
just a thought - that the am2320 was doing something nasty
^^ could be, or getting in a foul state, thus the suggestion to use the saleae
another test would be to actually power cycle and not just press reset
yup - good idea - I do have an am2320 connected to am m0_express with the adalogger featherwing running.
@idle owl if you want me to run you code, I'll be happy to
is there some action that triggers the i2c hangup?
Nope
It was random
I used I2C scan last night to test my soldering, and it worked
er night before last
then yesterday started writing code for it
2.24 or 3.0
and then it lost I2C
2.2.4
so I sat on I2C scan for a while, but it didn't get fixed until I unplugged it completely and plugged it back in.
Then randomly happened again later yesterday
Same routine fixed it
I have 3.0 on this systems
Hasn't happened again since.
but it just happend a few minutes ago?
no, I was referencing that it happened again last night
ah - misunderstood -- I'm logging some data on mine now - so far so good.
Thanks for testing!
np - fun to do...
the flush statement seems to be working - at least it does not cause any problems ๐
@solar whale saw your recent post... reminds me of the guy that jumped out of a 10 story build. As he passed each floor he said "well, so far so good".
It's not the fall. -- its the landing....;-)
I have to run out for a bit -- I'll leave it logging for awhile @idle owl ( don't think I'll fill my 4Gbyte card) Let me know if there is anything special you want tested.
hi any rtttl people and @slender iron have a question from a person in the forums about running rtttl on CPX. I was able to get it working very faintly on a piezo connected to A0, but all other pins return ValueError: Invalid pin Any thoughts on using this library on CPX?
make sure its the latest rtttl
2.2.3 rtttl or 3.0.0 alpha or either? Or neither?
2.1.1 of the library
the bundle?
ah, yes, I see that now. Yes, that's what I'm trying with.
what should it do on a CPX? Not onboard speaker right, only a piezo?
on board speaker will be a sine wave instead of square
and you need to enable the amp
I'm getting this error Traceback (most recent call last): File "main.py", line 4, in <module> File "adafruit_rtttl.py", line 179, in play File "adafruit_rtttl.py", line 134, in _play_to_pin KeyboardInterrupt: soft reboot
running this code:
import board
adafruit_rtttl.play(board.A0, "Bond:d=4,o=5,b=320:c,8d,8d,d,2d,c,c,c,c,8d#,8d#,2d#,d,d,d,c,8d,8d,d,2d,c,c,c,c,8d#,8d#,d#,2d#,d,c#,c,c6,1b.,g,f,1g.")```
i didn't see amp enable on the docs, I'll check them again
# enable the speaker
spkrenable = DigitalInOut(board.SPEAKER_ENABLE)
spkrenable.direction = Direction.OUTPUT
spkrenable.value = True
My I2C just failed again. @solar whale let me know when you're back if your code is still running.
@idle owl I stopped it after about 10 min- I'll restart and let it run for longer
sorry - need to do another test - logging now.
thanks @tulip sleet and @slender iron and @idle owl I have it working now.
@solar whale When it fails, does it tell you that there's nothing at I2C address 5c if you do ctrl+d in the serial output?
It has not failed for me
I'll update the Spy Music guide to include this option (it was originally written for Gemma M0) and maybe we can add the example on the rtttl docs too.
yes - no errors for me yet
@idle owl FYI this is what I am running ```import time
import board
import busio
import adafruit_am2320
import adafruit_sdcard
import digitalio
import storage
can also use board.SDA and board.SCL for neater looking code!
i2c = busio.I2C(board.SCL, board.SDA)
am2320 = adafruit_am2320.AM2320(i2c)
Connect to the card and mount the filesystem.
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(board.D5)
sdcard = adafruit_sdcard.SDCard(spi, cs)
sdc = storage.VfsFat(sdcard)
storage.mount(sdc, "/sd_card")
while True:
try:
with open("/sd_card/log.txt", "a") as sdc:
temperature = am2320.temperature
humidity = am2320.relative_humidity
print("Temperature:", temperature)
print("Humidity:", humidity)
sdc.write("{},{}\n".format(temperature,humidity))
sdc.flush()
time.sleep(3)
except OSError:
print("OSError reported")
# These sensors are a bit flakey, its ok if the readings fail
pass
except RuntimeError:
print("RunTime reported")
pass
time.sleep(2)
Here's my most recent I think: https://gist.github.com/kattni/643ff9dccfdac325f89a0d8b93ef8c3d
combo of am2320_simpletest and sd logger...
remarkably similar ๐
not surprising since I stole your logging code...
@slender iron I don't know the procedure for updating ReadTheDocs, but here's the CPX exampe of Frosty if you want to include it: import board from digitalio import DigitalInOut, Direction import adafruit_rtttl spkrenable = DigitalInOut(board.SPEAKER_ENABLE) spkrenable.direction = Direction.OUTPUT spkrenable.value = True adafruit_rtttl.play(board.A0, "Snowman:d=8,o=5,b=200:2g,4e.,f,4g,2c6,b,c6,4d6,4c6,4b,a,2g.,b,c6,4d6,4c6,4b,a,a,g,4c6,4e.,g,a,4g,4f,4e,4d,2c.,4c,4a,4a,4c6,4c6,4b,4a,4g,4e,4f,4a,4g,4f,2e.,4e,4d,4d,4g,4g,4b,4b,4d6,d6,b,4d6,4c6,4b,4a,4g,4p,2g") print("ending...")
@split ocean do you have a particular page you want to put it on?
@idle owl I switched to running your code now -- (only change is D5 instead of D10)
cool, I'll update that page, thanks
hi hi @here we started an "awesome list" for circuitpython here... this was what i did on the train today as a start - https://github.com/adafruit/awesome-circuitpython
feel free to do pull requests, updates, and more - we'll add this to the newsletter this weekend too - http://www.adafruitdaily.com
why is this lsm303 being such a pain in the butt... i can't figure out how to get a normal functioning compass on this thing... is my math that bad? LOL
heading = (math.atan2(mag_y, mag_x) * (180 / math.pi))
@river quest Awesome list.
sweet! i'm heading straight for the art pack ๐
i'll keep adding more to it, this was train ride github stuff to get us started
@river quest would pull requests be appropriate?
@stuck elbow please do!
i put this in.. Contributing
Contributions and suggestions are always welcome! Please make pull requests to modify Awesome CircuitPython.
I didn't get to that part yet, thanks
I swear my LSM303 is bugged or something...
that's possible but unlikely
@feral saffron do the values for mag_y and max_x seem to be OK?
@tidal kiln what do you mean by ok? What values should I expect?
like if you point due north, do you get 0,1 and then point due west get 1,0? not sure about exact values w.r.t. orientation.
so mag heading should be based on X and Y
yup
so point X roughly North and what do you get formag_x and mag_y
~2.1
for both?
2.5 for x , - 2.2 for y
if i point X towards north, and then point Y towards north
according the diagram on the board
which one are those values for? X towards north, or Y towards north?
2.5 for x while X is pointing towards north
-2.2 for y while Y is pointing towards north
but what are both values for both orientations?
X pointing north, mag_x = 2.5 mag_y = ?
Y pointing north, mag_x = ? mag_y = -2.2
ah, i see. one sec. i'm getting some crazy differences each time i check this... not sure why
i'll get that for you in one sec
are you getting fluctuating readings with it held in one orientation?
something could be interfering
y -> N : mag_x = -1, mag_y = -1.45```
weird. no change in y.
it doesn't change while stationary, but i'm not getting consistent results at all
also same results with the lsm9ds0
i bought the lsm303 hoping i had a bad lsm9ds0
didn't know that was a bad word ๐
i'm losing my mind over this
realize it's basically a magnet sensor, so will sense any magnetic fields
maybe try different locations to see if you can get better readings
i'm not working near an MRI... lol
it doesn't take much
wouldn't the sensor in my phone also be thrown off?
i'm using that to get the correct heading
that's probably been very much calibrated for it's integration into the phone
hmm, i can't really test it outside from 10 ft from my pc (no output device)
and may be using other sensors like the accelerometer to compensate
i've tried accelerometer compensation code too lol
you can try different locations even within reach of a USB cable and see if you tell any difference
that's really weird how y isn't changing much
sure
z -> north mag_z = 1, x -3.2
frustration level 110% , i'm done for the day lol thanks for your help @tidal kiln
ok. good luck. sry couldn't help more.
nothing wrong with your compass math, so just keep playing around looking at the raw readings to see if you can figure anything out
@tidal kiln i did test its mins and maxes in all directions and discovered that it does do pretty good with all directions spherically ... not sure why its not giving me a true heading though =/
ahaaaaaaaa
everything is working perfectly
okay not perfectly but good enough for me
only thing that is off is the bike light rainbow function doesn't fully fill the ring but i'm fine with that
as in a few lights are off ?
nah, the lights are on
it just doesn't fully makes the thing go the entire way around the ring
but you wont really be able to tell with how it'll be set up so i dont mind
actually
in cp do you set a count like you do in Arduino?
not sure but
it's a mix of
do i want to have all of them light up
or do i not want to have to readjust all the timing
alternatively i can just copypaste the entire code
actually, can i just kinda
hm
put a handful of these codes into a separate file and just use it remotely?
some of the definition stuff
@unreal ginkgo the rainbow one from here?
https://learn.adafruit.com/circuit-playground-bike-light/the-all-of-them-circuitpython
yep
you're trying to get that to work on your external ring?
@feral saffron using your phone is probably not the same thing. Cell Phones have GPS, and use precise data to determine North, etc. Magnetic declination (due to the fact that the magnetic north pole is somewhere in eastern Canada and not as the true N pole) varies all over the planet. In NYC it's about 13 degrees East. In California its about 14-15 degrees West, i.e., in the other direction. Add an app called GPS Status to your phone. if it shows exactly what the phone is showing now, then you are using GPS for direction and not magnetic north.
"for p in range(10):
pixels[p] = RAINBOW_COLORS[color]
neopixel_ring[p] = RAINBOW_COLORS[color]"
i could do a seperate line to set up the pixels for the ring
but that would also require redoing the timing for the lights
this is for your 12 pixel ring?
that code is sort of hardwired for only 10 pixels
yeah i dont mind that
since it was meant to use the ring of pixels on the board
yeah
yeah i'm fine with it only lighting up 10 of the 16 pixels on that
i've got all of them lit up when running
and honestly it only changes the color of every other pixel, it's just the timing and order thing that i used it for
ah cool - sounds like you've got things wired so all the pixels are working?
in a way, yeah
my grandfather had a thing of wire strippers and i had the sewable pixel to ring adapter so i checked if everything was working
and yeah, it all seemed to be okay
a simple way to test is to just use the fill function, and see if they all light up the same color
a majority of my code is that function
it was simply getting it to work with the other 2 things that i was testing
and they seemed to work
tomorrow i'll start trying to figure out the sound
@solar whale Around?
hm, I'm having trouble getting the esp8266 huzza build to work. I built the toolchain as described in README.md, and cpy2 reaches the linker stage but encounters an error: xtensa-lx106-elf-ld: build/firmware.elf section `.text' will not fit in region `iram1_0_seg' xtensa-lx106-elf-ld: region `iram1_0_seg' overflowed by 60640 bytes Makefile:246: recipe for target 'build/firmware.elf' failed
gcc version 4.8.5 (crosstool-NG crosstool-ng-1.22.0-60-g37b07f6f) is this the expected version for the xtensa toolchain or did I take a time machine?
there is some version skew between the toolchain and circuitpython, because there were prototypes in esp8266/etshal.h which didn't match the SDK leading to errors. Those could be resolved by simply deleting the declaration in etshal.h.
a similar error (number of bytes of overflow differ) building master branch ๐
micropython 's own master branch does build, hm.
aha! pull request incoming
One commit is from micropython/micropython#1254, see that issue for more background info.
With these changes, I am able to build and run on a fresh SDK from today.
One commit is from micropython/micropython#1254, see that issue for more background info.
With these changes, I am able to build and run on a fresh SDK from today.
One commit is from micropython/micropython#1254, see that issue for more background info.
With these changes, I am able to build and run on a fresh SDK from today.
phew, that's better.
@idle owl sorry - was out - my logger is still running...
@onyx hinge Is this a new SDK - I have been building ESP8266 regularly but have not updated SDK recently.
I just noticed this.
It stopped an hour ago.
Temperature: 22.0
Humidity: 25.8
VBat voltage: 3.84946
Traceback (most recent call last):
File "code.py", line 54, in <module>
File "code.py", line 36, in <module>
File "adafruit_pcf8523.py", line 121, in datetime
File "adafruit_register/i2c_bcd_datetime.py", line 79, in __get__
File "adafruit_bus_device/i2c_device.py", line 110, in __exit__
KeyboardInterrupt:
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 17, in <module>
File "adafruit_pcf8523.py", line 103, in __init__
File "adafruit_bus_device/i2c_device.py", line 68, in __init__
File "adafruit_bus_device/i2c_device.py", line 66, in __init__
ValueError: No I2C device at address: 68```
It will just hang with printing out the info
and then if you ctrl+D or ctrl+C it, it will give you the failure.
68 is the RTC address.
which is I2C
OK - I'll try it - RTC stuff was not in the version from before.
Correct
It wasn't working until we imported it in a certain order and threw in extra gc.collect() so....
the SD card lib and the RTC lib fail memory allocation if loaded together otherwise.
The code ran last time from 20:11 to 20:53 before it stopped reading I2C.
I get memory allocation error
no - 3.0
Yeah... doesn't make much sense because the memory stuff is better in 3.0, but there it is.
Can you load it on 2.2.4 for me? Or will that not work
>>>
>>>
>>> import am2320_rtc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "am2320_rtc.py", line 6, in <module>
File "adafruit_am2320.py", line 80, in <module>
MemoryError: memory allocation failed, allocating 136 byte
>>>
I can do it tomorrow morning.
Ok
๐
Goodnight!
@solar whale yes I built an SDK fresh tonight (the first ESP8266 SDK I built)
@solar whale but based on the commit in micropython the breaking update occurred some time ago
ummmm something's quite weird
'0xc3bfc3bf'```
@onyx hinge Iโll compare it to my build environment tomorrow. I just built master yesterday with no issues.
@solar whale I'm not sure what version numbers are useful for me to report about the ESP8266 SDK, I have the gcc version number that I gave above but this is not a gcc version problem
>>> struct.unpack('!I', b'\xff\xff\xff\xff') (4294967295,)
OK that's better.
some kind of bytes vs strings problem I guess
ESP8266_NONOS_SDK-2.1.0-18-g61248df
Just to check, I just do
cd ports/esp8266
make clean
make
Of course after git submodule update โinit โrecursive
@solar whale sure, but the problem (if I'm not on a wild goose chase) is related to a change in the ESP8266 SDK, which you'd get by (re)building within esp-open-sdk...
which most normal people would do once in a very blue moon
@solar whale I appreciate it. If you are a github user, comments on the PRs might be more useful than here, just because I'm less likely to miss them. Otherwise, no worries, I'll read here or in a direct message.
Thatโs fine. Iโll comment on PR.
great!
@onyx hinge did you build SDK as here: https://github.com/pfalcon/esp-open-sdk
Just want to use same SDK
Also did you use STANDALONE = y ?
@solar whale yes
well, I understood the docs to imply that STANDALONE=Y was the default
in a quick-look at the commits in the PRs, appears those updates were most likely the KRACK fixes based on time-frame. if that's the case, i'll definitely vote for an update...
deeper dive; nope, not KRACK related. ๐
progress for the evening: built and using own circuitpython for ESP8266 (no particular reason). WIFI, NTP, and OLED working to show accurate time (minutes, seconds, and hundredths), including compensating for the awful accuracy of time.monotonic(), with an error of around 9250ppm (13 minutes/day!)
goodnight all
goodnight @onyx hinge ๐
I tested updating the SDK in my Vagrant Ubuntu system (did not want to go to my main development system, yet). I replicated the issue reported then installed #742 and the build succeeded. Nice!
One concern: applying #742 requires updating the SDK. At least on my non-updated system - tieh #742 installed it fails with:
./../py/../extmod/machine_i2c.c: In function 'mp_hal_i2c_delay':
../../py/../extmod/machine_i2c.c:43:5: error: implicit declaration of function 'ets_delay_us' [-Werror=...
@onyx hinge see notes in github PR - I saw some difference in the failure reported but your PR fixes it. Note: building esp8266 fails with the PR if the SDK has not been updated.
@solar whale thanks for checking things out. Looks like something will have to be done about ets_delay_us. Any idea how I can get old versions of the SDK for local testing?
@onyx hinge I think you can get older version from the github repo for the SDK https://github.com/pfalcon/esp-open-sdk
requires some git magic...
@onyx hinge I think you can just do a git checkout <commit> using the <commit> hash for a commit listed by git log
@idle owl its been running for 90 minutes so far.... I'll be out for a few hours - will let it run.
@solar whale I was overlooking the obvious -- I'll give that a try.
This PR adds an rtc module and hooks it up to the time module. It also adds rtc support to ports/atmel-samd.
I haven't looked into how it affects/breaks other ports.
This is the ASF4 change: 0001-Add-hal_calendar.patch
I used start.atmel.com to find the right incantations.
Comments are welcome, so I can get this into shape for inclusion.
Testing
I was suprised that there was no unittest module in C...
okee dokee @here wrapping up the newsletter this week for CircuitPython (http://www.adafruitdaily.com) ....
LEEKS ... ItsyBitsy M4 Express, it runs CircuitPython โ FAST โ ! CORTEX M4 with 192k of RAM and 512k flash @ 120 Mhz.
the @ almost gave me a heart attack
What's with the ping?
Is that 3d printed?
(in progress, still tinkering)
i love it!
it's the blinka puppet and a cardboard 3
https://www.adafruitdaily.com/ "Python for microcontrollers"
@agile plover the puppet... about a year
But it turned out to be amazing!
for the history of the universe it did not exist, 1 year was not long at all
(and worth a universe to get here)
@river quest do you guys provide samples for makers to test?
sample of puppets?
Samples of your products.
we could send out socks
oh
if someone does code, etc. we sometimes will send products
for example, we've sent a few circuitpython boards out to folks
i would love to test your products
we generally do not need testers for products, we more often are looking for folks who are working on code that would make them better, for example, circuitpython related code, etc.
i would really love to see how your sensors compare to others
that sounds like a review, not a test
we're mostly looking for folks doing code for our new platforms, etc.
m4, circuitpython, etc
i do some arduino coding
i could improve on the arduino code which comes with your products also
@river quest
i'm about to go draw some pictures of snakes
(circuitpython, etc, etc)
that's kinda my job
i am on the clock
boss lady needs this done
snakes ain't gonna draw themselves'
@river quest so do you mind sending some products for testing
i can suggest improvements, etc
@agile plover stick around here and watch the channel, we often post up what we are looking for, it's mostly circuitpython related to manage expectations
more so with this being the #circuitpython-dev channel
what about your arduino products?
keeping it on brand and focused ๐
the arduino compatible products you have?
currently, now, on a one-snake-track-mind
thems' the slithering orders
check out https://www.adafruit.com/circuitpython
Adafruit Industries, Unique & fun DIY electronics and kits : - Tools Gift Certificates Arduino Cables Sensors LEDs Books Breakout Boards Power EL Wire/Tape/Panel Components & Parts LCDs & Displays Wearables Prototyping Raspberry Pi Wireless Youn...
i know some python, so i could possibly do some testing on those products
@river quest Hmm, i could possibly test them if you don't mind.
tune in to the channel here for the circuitpython development and needs/issues
looking for code contributors and more usually, so stick around!
ok, do you have anything currently?
the core dev team is here during the week, most of the world is not awake yet
tune in!
ahh, ok, what time is it for you there?
11am ET, NYC
adafruit scam
oh, ok.
textmate, scam?
@river quest dig the blinka shoot!
thanks @raven canopy the plan is do one for each major release
we'll do one for 2, 1 too to catch up
we're starting with 3
haha. "forge your own path". ๐
I did. looked through the dropbox.
added some more art over the weekend too
limor was speaking in DC so did some mobile work
@river quest Do you also offer 3d print samples?
@agile plover we're not a 3d printing service co'
@river quest oh.
I'm ok if this requires updating the SDK. I've been bad about keeping it up to date but would like to be better.
Thank you @notro! I'm pretty busy this weekend but will get back to you tomorrow evening or Monday.
@idle owl still running after 4 hours. I think it is OK - at least on my setup under 3.0
I verified that this did work OK on my development system (Ubuntu 16.04)- I pulled the current master - attempted build of esp8266 which failed. Updated to latest SDK - fixed my path since I moved the sdk ;-) and rebuilt esp8266 without any problem. Loaded to board and it seems to work fine!
Hello, CircuitPython! Is there anyone here familiar with the HT16K33 library in CPy?
@sleek nova it's a little slow in here right now, but put your question up anyway. someone may come along and read it. i am "familiar" with the library in that I've read/dissected it. no actual use outside of the Trellis board (which uses the same chip).
Thanks, @raven canopy This is what I have going on: I am trying to wire up a 7x7 array of arcade buttons, and I want to control the LEDs in them via the HT16K33 chip. I am having a hard time figuring out how to do this. I am importing the library ht16k33.matrix, and then creating an object: '''ledMatrix = adafruit_ht16k33.matrix.Matrix8x8'''
I am not sure if I should be using Matrix8x8 or if there is a better way to access each LED, and I am also not sure how to set an LED on or off using Matrix8x8. ('set_pixel' and 'set_led' raise 'undefined attribute' errors)
And I apologize if I am misusing any terminology here -- I am pretty new to all of this.
do you have a gist or other posting of your code?
'set_pixel' should be 'pixel', so change line 10 to: ledMatrix.pixel(1,1,1).
man. Markdown was giving me fits.. ๐
were you originally using the Arduino library? i think i remember seeing 'set_' naming in those versions...
I was looking through a bunch of github repositories to find the code. Trying again now...
Hmm... Now it is not kicking out any errors in the REPL, but it is also not lighting any LEDs...
And apparently one of my pieces of code before worked (my daughter just walked up and said, "Why is that one light on?") I have been through so many iterations, that I don't know what it was!
hehe. it happens. even with version control, i still mangle things up.
@sleek nova have you wired the LEDs to the ht16k33 same way as the driver expects?
I think it is fair to say I have no idea. Right now I have a 2x2 matrix wired, with my neutrals (columns) pinned to C0 and C1 and my positives (rows) pinned to A0 and A1.
the library has hw specific drivers, like matrix and segment, that each derive from the base ht16k33 class. they then do what's needed specific to the hardware (segment or matrix) to set the ht16k33 appropriately.
We're in business! I can light stuff up now!
it all comes down to a call to _pixel like here:
https://github.com/adafruit/Adafruit_CircuitPython_HT16K33/blob/master/adafruit_ht16k33/matrix.py#L55
the 8x8 matrices are wired like this:
https://learn.adafruit.com/adafruit-led-backpack/downloads#8x8-0-dot-8-led-backpack
Thanks, @tidal kiln . I big part of the issue I was having is that I don't have dedicated hw for this, but am creating my own array. I think I am figuring it out now, though. Time to see if I can build up to my 7x7!
looks like you are more or less doing the same thing with your 2x2
Right. That was to test to see if I could write to it, and then scale up from there.
cool. if you wire like 8x8 schematic, then you can use the Matrix8x8 class from the library
otherwise you could just make your own little driver for your display, and have it derive from ht16k33 like the other ones do
you'd just need to write your own equivalent to the pixel function
Thanks for you help, @tidal kiln and @raven canopy ! I really appreciate it!
you're welcome. glad it's working for you. also, to check driver usage for circuitpython, this is probably the easiest place (other than reading repos): https://circuitpython.readthedocs.io/en/latest/docs/drivers.html
also, the various Adafruit Learn Guides tagged CircuitPython...
@solar whale That's good and bad. Means there's something on my end, but if it's still logging for you, it means the project at least works.
I really didn't want to solder up another one. It did not go well.
mine is on a breadboard...still not clear why yours is intermittent.
Correct
but if the am2320 does do something nasty, it may be that only a power cycle can clear it. There is no other way to reset it.
Yeah, Dan suggested running one feather with the Adalogger and another one with the AM2320 and see which one fails.
evidently if one of them pulls up, it can hose the bus?
iirc.
So yeah.
or try using a bme280 in the place of the am2320 - easier to wire up....
It's for a guide, so AM2320 is what we're using.
ah - I guess that would not help ๐
I was just loading it as am2320_rtc.py and then using import am2320_rtc but it could not load. renaming to main.py worked
It is really nice to see the RTC working and logging. I had never been able to do that before.
Took a lot of fiddling ๐
I am hoping we can eventually pare down the rtc code to provide a subset of features. datetime has a lot in it.
Alarm code takes up a lot. But Scott's wary of two libs for the same thing.
or just wait for m4's
For this sort of project, perhaps. The guide won't wait though, so I'm in a bit of a precarious position with this project.
Neat. I just loaded 3.0 on this one, just to see if it would run, and didn't unplug it between, and the I2C is still failing. So that's nifty. It's so HW hosed that all of that didn't fix it. Power cycling now.
Sounds like the I2C bus is getting pulled by something - I would suspect the am2320
I tried taking out the analog battery read, but it really didn't help
3.0 is giving me a memory allocation failure.
hmm.
fails on the vfs line, which is what it was doing before.
it did sometimes for me but usually works.
eh we're doing it on 2.2.4 probably anyway. For now. so if that's how it runs for me, then that works
putting it back now. It was entirely for curiosity.
Hope it still runs ๐
good luck!
Good afternoon!
Iโve got some other stuff done so I have time to work on my express
Iโve got the lights working so
I guess now I confuse myself with sound
Not a clue what Iโm doing!
@unreal ginkgo looks like you have all the pieces for plenty of confusion!! Have fun.
I donโt have a clue how to set any of this up honestly
this is the place to start: https://learn.adafruit.com/adafruit-circuit-playground-express
Alright!
@idle owl is the guide specifically fpr the am2320 with the adalogger/rtc?
Have to run - good luck @idle owl
Hello can someone please give me a summary of what circuitpython is i have seen this but never looked into it
i uh
uh
is there a way i can test the amplifier without soldering
I have no clue whatโs going on in this but yes you can test almost anything without soldering you just need some alligator clips
i have those
i'm not quite sure how to hook this all up i guess
i guess my biggest concern right now is to how to hook things on
there's not much
space to put on clips
that and there's a lot of places to hook things up and no clue what i'm trying to hook up to the playground express
Does this look right?
HOT OFF THE PRESS
Sensor graphing with plotter. CircuitPython + Mu + LIGHT https://youtu.be/8zCRmguw-_c
Visit the Adafruit shop online - http://www.adafruit.com Adafruit on Instagram: https://www.instagram.com/adafruit ----------------------------------------- ...
@solar whale For when you're back: Yes the project is about datalogging and then getting the data into a spreadsheet and making a graph.
total time was 15 mins to write the code, show it, upload it and post it here
will add the code to github later for learn guide stuff
@idle owl quick scanned the scroll back - r u still trying to get it to work?
@tidal kiln It fails after a period of time. I haven't done the real troubleshooting yet. It's working right now and it works if I power cycle it after it stops working. I haven't run the logger and the sensor separately yet, I haven't setup the saleae, I haven't done any of that yet. So at the moment the fact that it's still being weird needs to be further investigated by me
@deft bay dark theme = the bestest. ๐ and, that's a glaring example of the "quick iteration time" espoused around these parts.
@unreal ginkgo you may get lucky with those connections. will be flaky at best. for breakouts+header pins, solder is the obvious choice. you could also try the screw+wire+nut sandwich approach, if you have screws small enough.
loop-n-twist is another approach, but that's pretty much identical to your current connections. like KittenCanaveral spoke about previously, wouldn't want you "wasting" the expensive conductive thread. do you have any other conductive wire available? (old cables make for great expendable stuff; as long as you can strip the wires)
dont think so
i have the sewable pixel to ring connector but that seems
really ify
i have no idea if that would work or not
it's still wires with a safer connection but
idunno
i have no idea how many connections i even need on this to the playground
How dangerous is this.
This doesnโt seem right but I wonโt plug anything in to the playground yet
Anyone?
@timber mango for question about what cp is:
https://learn.adafruit.com/welcome-to-circuitpython/what-is-circuitpython
Thanks @tidal kiln
@unreal ginkgo that's a somewhat specialized amp that expects an I2S audio input, which is a digital format. you can't really use it like that. take a look here for info on audio out with the CPX:
https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-audio-out
as a start, you can just use the built in amp and speaker
Alright, just wondering
Thank you
So can I kinda just
Hook up the speaker to the playground directly and have better output?
I
I donโt know
I wasnโt sure if it could naturally play fancy normal audio files
Maybe the files just too long to normally play
the speaker on the CPX uses the same output, so you could just start by using that
Alright
that link shows how to play basic tones and audio files
if it doesn't work for the built in speaker, then you'd want to figure that out first
A mash of a Trinket M0 now with SPI Flash and the same charge circuit in feather m0 express
well i guess my problem is now
how do i get the file i need small enough to fit on the express
okay that worked
it
it works
quality is
something
but i got it to play
now my next problem is
how to get it to play and flash lights at the same time
it's loud enough
but wow
that audio quality is going to bother me
Fixed a report length bug for HID reports with Report IDs. This did not bother Linux but failed on Windows and MacOS.
gen_usb_descriptor.py:
Added a helper class for creating and using StringDescriptors.
Adjusted descriptor values to match known working examples (e.g., wireless keyboards/mice, Arduino Leonardo). Reordered interfaces. Previously the order was:
| Interface | Function | Endpoints |
|---|---|---|
| 0 | CDC comm | 1 |
| 1 | CDC data | 2 (bidirec... |
i hope i can actually get this to do both at once
if i take out the while a.playing it kinda just starts and then just crashes
update, trying to do both at once just forces it into safe mode
@tannewt This now works on Linux/MacOS/Windows. @ladyada will be testing. Note that the /dev/cu.usbmodem<xxx> name may have changed. On my Mac it is now /dev/cu.usbmodem413.
@unreal ginkgo have you tried compiling into a .mpy file ?
Iโd like to know how to do that to store the def stuff
Had to move CDC back to Interface 0 because the Windows 7 driver .inf file expects all CDC's to be on Interface 0. We could change but it would be a compatibility headache.
@unreal ginkgo not sure what you mean by "store the def stuff"
put the define stuff somewhere else to save space i guess
im new to all this so i dont know if that's how it works or not
Using a .mpy can prevent memory problems on import, because it will save the compilation stuff. It's also possible to freeze python code into the flash, but that's done when the firmware (the .uf2) is built. We only do that for Circuit Playground Express right now, to have on-board libraries for the on-board sensors. But that's more complicated and you need to be comfortable building CircuitPython from scratch.
i uh
alright i guess
i'm probably running low on space for code honestly
idunno
i'm at 247 lines right now
hey guys, i donno if i can get an answer for my question but here it is:
anyone here know about android studio ? if yes, i want to know how to make a new version for an existed project (same package) ? bcz in case something went wrong i can go to the older version.
@unreal ginkgo You can play audio files that will fit in CIRCUITPY - they don't have to fit in RAM.
Yeah
Right now my problem is getting the audio files to play and have the lights on the playground flash at the same time without crashing
@unreal ginkgo ladyada herself reported this bug. If you can show us a test case that would be great. https://github.com/adafruit/circuitpython/issues/522
can you post the code here or in that issue above?
just click the "+" to the left and upload the file, if that's ok with you.
Alright
it's a bit messy
@unreal ginkgo Thanks, I'll trim it down by experiment to the minimum crash-inducing case.
there's a few other audio files i needed to get in there
@here Finishing up the Metro M4 tester https://youtu.be/wW0IWWUa5ns @river quest #adafruit #DeskOfLadyada
Multistreaming with https://restream.io/ Visit the Adafruit shop online - http://www.adafruit.com Join the Adafruit Discord http://adafru.it/discord --------...
but for now it's more of
okay the other audio files i need, i need to figure out which are which first, so that'll come after i've gotten this main one working
@unreal ginkgo @tulip sleet Once I get wave playback going in 3.x I'll make sure it doesn't have that same bug.
alright
@slender iron do you think it's fixable in 2.x easily?
I've started creating a repo here: https://github.com/mikepschneider/CircuitPython_nonblocking_timer. Will update when there's something useful there to check out.
METRO M4 !!!!!! YAY YAY YAY
Reverse the primary and second SERCOMs for PA08 and PA09 on Trinket M0. Fixes #699 (@ladyada note).
ooh I just noticed samd51 has a true rng
I did a little research on this. It may be an issue finding report descriptors that will work on all the major platforms. Paul Stoffregen has implemented touchscreen HID support for Teensy. The report descriptor he developed I think appears to work on Windows and Mac without external drivers; it may not work on Linux (or at least Raspbian). Some background here and in other forum posts: https://forum.pjrc.com/threads/32331-USB-HID-Touchscreen-support-needed
@onyx hinge you can access it through os.urandom the random module uses it as a seed
fca9c66 added Status submodule to shared-bindings/super... - sommersoft
9ee4d13 added Status submodule to ports/atmel-samd/comm... - sommersoft
5de8df7 added Status submodule to ports/nrf/common-hal/... - sommersoft
60d6ccc changed spaced supervisor/Status.c line to tabbed - sommersoft
c1c3a79 atmel-samd: changed Status to Runtime; institut... - sommersoft
Not-much-of-an-update, update.
After much reading, and comparing to 2.x/ASF3, I'm not exactly any closer. I may have gotten somewhat closer, since I have determined that the previously mentioned calls to EIC_Handler are actually being called during common_hal_pulseio_pulsein_construct and not during the resume call. After seeing that, I started playing around with two things:
pulsein_set_config- I turned off the disabling/enabling of the EIC to set the config. I know that ...
phew. weekly GitHub Novel completed... ๐
It might be on by default or done by ASF4.
Please make this a property. See this for an example: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/digitalio/DigitalInOut.c#L223
Other drivers have this as a property as well: https://github.com/adafruit/Adafruit_CircuitPython_DS3231/blob/master/adafruit_ds3231.py#L111
I have had the problem before where I enable an interrupt without clearing its previous state. We should also make sure we turn the interrupt off while we configure things.
Sorry, I don't have more to offer. It sounds like you are on the right track so I haven't taken a look at it. Thanks!
I have had the problem before where I enable an interrupt without clearing its previous state. We should also make sure we turn the interrupt off while we configure things.
Untangling the NVIC and EIC interaction has been most of this week's work. If I'm understanding it correctly, things are occuring as they should.
Rats. I was looking for uses of i in the loop and missed that, and I should have tested it anyway.
We could store the MUX choice in the pin table. There are some 7-bit fields that could be 4 bits, and a MUX flag only needs one bit to distinguish between MUX_C and MUX_D. Or I could just write some some special-case code. Or we could forget this for now and just document it.
im 100% ok with documenting it and moving on
I have a concern about timekeeping in CircuitPython. My project is to build a device that continuously shows the accurate seconds and fraction-of-seconds, using a local NTP server as the source of the accurate time. So a main sub-problem is computing that e.g., monotonic time 1234.567 is actually NTP time ....:54.321. I have an implementation that works pretty well, but the worry is that after the device has been up for some time, it will begin to work less well due to the extremely limited precision of floating point arithmetic in CP. Specifically, if I understand FP in CP correctly, after about a half day of uptime for the device, the monotonic value's precision has declined to 15.625ms (based on a 22-bit mantissa), and it will only get worse as the device is up longer.
but there's no API in Python3 that does this, they all operate in double-precision floating point in python3
Making the device reboot twice a day might be just fine, as it will quickly sync up to NTP time again, but I wish there were a way to get the monotonic time in two parts, such as seconds and microseconds
maybe it would be in keeping with the CP philosophy to relegate this other time API to microcontroller module or something..
<@&356864093652516868> Meeting in just over an hour here on Discord. Sorry for the late reminder! http://everytimezone.com/#2018-4-9,360,b8jj
@slender iron it doesn't handle sub-second precision timing, does it?
(my use case is a bit weird because I actually don't care about any interval longer than a minute...!)
(but I want to run forever)
ah, no it doesn't
what are you measuring? pulseio.PulseIn can measure pulses better
@slender iron a friend of mine is into mechanical watches. He wants a gizmo that displays the accurate time that he can hold his watch next to and visually tell whether it's gained or lost time since it was set. The time intervals he's interested in are in the second to subsecond range.
there's not a pulse to measure, the human eye is involved.
I'd trust a laptop more than circuitpython
e.g., "that watch I wore today lost a half a second over 8 hours"
in 3.x at least we don't have the external crystal working so the 48mhz isn't super precise
I agree with that, but with NTP I can assess any systematic error in the local clock and correct for it
e.g., I determine that monotonic() runs 225ppm fast compared to NTP
or rather, the software does it dynamically
Maybe other computers don't suck, but in my usual desktop OS the display of seconds is disabled in the onscreen clock by default, and when you enable it it is awful. Sometimes seconds are skipped entirely. (xfce on debian) so trying to assess a difference of .5s between two devices is not happening.
๐
hi @plucky flint !
hey hey...
@onyx hinge ah, that works too
Who's going to be at PyCon (in just under a month)..?
@tulip sleet, @idle owl and I
Yep!
Cool... it'll be ace to catch up ๐
@idle owl this? https://circuitpython.readthedocs.io/en/latest/docs/drivers.html
@plucky flint yes! totally!
@onyx hinge also many boards don't have a crystal clock, so they are already inaccurate to begin with. And in 3.0 we haven't yet added crystal clocks to the boards that have them
you can measure the error but it will probably drift, be temperature dependent, etc.
like @l8gravely I want a monotonic time source which doesn't lose precision. In my project, I want to show the seconds and fractions of seconds based on NTP time, but it starts to lose precision as the monotonic() value gets large.
For me, directly exposing common_hal_time_monotonic(), possibly via the microcontroller module, seems like a good first step. I'm not sure whether exposing it as a 64-bit value (restricting it to devices with support for longs) is better, or exposing it ...
It's too late for me to decide to go to pycon this year, but if I stick around the CP community I'll sure be tempted next year!
@tulip sleet agreed about the drift and temperature dependence. As long as changes are slow, the NTP algorithm corrects for them properly.
in 3.0 we have turned on long ints, so it will be much easier to deal with large tick values. we hope to leave that on for all ports, but we haven't finished enough stuff yet to know whether we have room on the non-express boards
https://www.ietf.org/rfc/rfc5905.txt down at 11.3. Clock Discipline Algorithm describes the real algorithm. I did something much simpler in order to save implementation space, and as I cap my polling interval at 60s the amount of drift that can occur even with a really poorly disciplined local clock is quite small.
whyyyyyyy does MICROPY_OBJ_REPR_D only store 31-bit ints? Not that you'd want to enable it on samd hardware anyway...
@onyx hinge our current representation is 31 too. it needs that last bit to indicate its an int ๐
@slender iron REPR_D is the one which is 64 bits big
Fixes #577.
Note that storage.erase_filesystem() does a microcontroller.reset() after reformatting. This is necessary to get the host computer synced up with the filesystem, including both contents and mountpoint name.
The main use of this is to be called from the REPL, since if the filesystem is damaged, it's not likely one can write a file to call this anyway.
I purposely chose a long name to make it less likely to be used casually.
#577 discusses adding `storage.format(...)...
@onyx hinge ah, now I understand your confusion ๐
@slender iron the diagram in mpconfig.h shows about 16 spare bits in the int representation. Maybe too many things became too complicated, trying to support 31- and 47-bit short ints...
ยฏ_(ใ)_/ยฏ
@slender iron while I've got you on the line, are crashes involving @micropython.viper and similar for optimizing(?) functions of interest to CP or only to MP?
@onyx hinge we don't promote it so upstream is fine. we'll get them when we update micropython
@slender iron 10-4.
Hey, back to your time discussion. As I understand it... NTP is derived from WWV or WWVH radio signals, the national standard that is generated from an atomic clock at the US Naval Observatory in DC. Any local implementation (e.g., a crystal, or other known oscillator) won't be as accurate in the long run. But ya gotta get the signal off the radio. I'm not sure what frequencies they (wwv & wwvh) are at but is used to be 2.5, 5, 10, 15, 20... MHz. OBTW, wwv is in Colorado, and wwvh is in Hawaii.
@languid sage indeed, a "stratum 1" NTP server gets its time from some other reference. These include WWVB, GPS, and others. figure 12 of the earlier-linked RFC gives a list. I happen to have a "stratum 1" NTP server in my home which uses GPS as a reference, the sadly-discontinued Laureline GPS. (It has a GPS receiver, a temperature-compensated oscillator, ARM microcontroller, and ethernet interface) There are other similar professional devices, but they are priced way above the $100ish that the Laureline sold for!
Yea, I understand. HP used to sell a lab-grade nuc clock for many K$. most of us never need that. In fact I haven't worn a watch since my retirement, a dozen years ago.
We all (OK, slight generalizing going on) have pocketwatches now. They just have built in web browsers and can also take phone calls.
ooh the laureline design files are online. ugh, altium.
<@&356864093652516868> Meeting starting in two minutes!
Viennese Percussionist Martin Breinschmid with his version of the "Typewriter" Live at the BASF concert hall Ludwigshafen,Germany 2008,Strauร Festival Orches...
here!
welcome!
(text only)
no mic,
but group hugs to everyone helping me with questions about circuitpython and helping me find existing issues about the problems I'm hitting
that means you @slender iron
๐ ๐
@tulip sleet just pulled master and PR 747 - tried to build trinket M0 - got this ```jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/circuitpython_master/ports/atmel-samd$ make BOARD=trinket_m0
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
install -d build-trinket_m0
python3 tools/gen_usb_descriptor.py
--manufacturer "Adafruit Industries LLC"
--product "Trinket M0"
--vid 0x239A
--pid 0x801F
--output_c_file build-trinket_m0/autogen_usb_descriptor.c
--output_h_file build-trinket_m0/genhdr/autogen_usb_descriptor.h
usage: gen_usb_descriptor.py [-h] [--manufacturer MANUFACTURER]
[--product PRODUCT] [--vid VID] [--pid PID]
[--serial_number_length SERIAL_NUMBER_LENGTH]
--output_c_file OUTPUT_C_FILE --output_h_file
OUTPUT_H_FILE
gen_usb_descriptor.py: error: argument --output_h_file: can't open 'build-trinket_m0/genhdr/autogen_usb_descriptor.h': [Errno 2] No such file or directory: 'build-trinket_m0/genhdr/autogen_usb_descriptor.h'
Makefile:391: recipe for target 'autogen_usb_descriptor.intermediate' failed
make: *** [autogen_usb_descriptor.intermediate] Error 2
@solar whale first guess without looking at anything, you may need to run a "submodule update" to get some changes to the gen_usb_descriptor.py
I think that's just git submodule update --recursive
I did the submoduel update
oh, hm
i forgot I need to do a mkdir for the <board>/gendhr directory. Just create that manually.
@tannewt and @Dan Halbert for the constructive feedback on my long-lived PRs. And again, @kattni for churning out guides and code like a tornado. Group hugs beyond that!
@meager fog any hug reports?
@solar whale @tulip sleet has it
@solar whale not sure why you are seeing it and not me, but I'll experiment.
@solar whale if you do a clean first, the qstr generation will create the directory.
@slender iron hey back
yep great work from dan on getting HID working on m4, kattni+noe+pedro on the trampoline guide, pt for working on the Awesome List for circuitPython
just do make clean BOARD=trinket_m0, then make BOARD=trinket_m0
I did that
hmm, the qstr generation creates the directory.
back in master now - not pr747 -- same problem
same problem for metro_m4_express_revb
@solar whale what is python3 --version
python3 --version
oops
jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/circuitpython_master/ports/atmel-samd$ python3 --version
Python 3.5.2
make clean BOARD=trinket_m0; mkdir -p build-trinket_m0/genhdr; make BOARD=trinket_m0 for now as a workaround
that works!
I'll try it with pr747 and see if I can wipe a FS
This last week, I got up to speed on building for ESP8266, and submitted a PR for that. I am still working on getting all the fuzzing bug reports from 2-3 weeks ago filed. I did two simple projects, one to help with "intermediate frequency alignment" of radio receivers (generating some analog signals and controlling an AD9850), and one to show accurate time from on the OLED feather wing. Neither is up on github yet; I may be asking for help to turn the NTP stuff into a library for CircuitPython though.
+Grammar
@solar whale @onyx hinge aha: the make works for me because I'm doing make -j4 BOARD=trinket_m0 (in an alias). -j4 parallelizes the make. The qstr generation runs in parallel with that python script, and creates the genhdr directory before the python script gets to it.
@tulip sleet for me, make clean ; make -j1 autogen_usb_descriptor.immediate reproduces the make issue consistently. otherwise it may depend on your -j settings and when you last did a 'make clean'.
@dhalbert this fixes the issue we've just been discussing on discord
Still working PulseIn; reached the limits of debug I think. Saleae should be delivered Thursday, so that will help. Might pick up an "easy" 3.x issue in the meantime, or focus on some writing/documentation.
@meager fog any status update?
PS
cool! worked great on a Trinket_m0!
Analog is the big thumb sticks..
On Linux, any USB HID joystick works without a driver.
Are we going to have the speed for this? That's a lot of button data to process and send...
My speed question is related to catching simultaneous events (stick + button)...
Hehe. I didn't mean it like that๐
On itsybitsy_mo_express, it works, BUT - I have to press the reset button after erasing the FS to get it to boot. After erasing the FS it tries to reboot, but hangs with a blue dotstar.
DotStar isn't affected by that issue, is it?
I wanted to try itsybitsy since we don't have an "eraser" for it.
# Move the mouse while holding down the left button. (click-drag).
m.press(Mouse.LEFT_BUTTON)
m.move(x=50, y=20)
m.release_all() # or m.release(Mouse.LEFT_BUTTON)```
weird - this time it worked....
@meager fog we're wrapping up. anything else?
kbd.send(Keycode.A) is the same as kbd.press(Keycode.A); kbd.release_all(). <--- this is new as of this morning in the library
hmm - tried itsybitsy again it it worked properly (auto rebooted).
Later awesome peoples!!
Thanks!
@meager fog np, just wrapped it up though everyone is still here
cool cool ๐
[typing sounds]
Multistreaming with https://restream.io/ Visit the Adafruit shop online - http://www.adafruit.com Join the Adafruit Discord http://adafru.it/discord --------...
some Metro M4 LEEEEKZ for the curious ๐
@onyx hinge thanks for the quick fix to the make -- works fine
@tulip sleet thanks. that's it. with a makecode uf2 on it goes straight into bootloader.
CircuitPython generates the horizontal sweep and sends a varying frequency signal into the radio receiver (from AD9850). The scope in X-Y mode shows the frequency response of the amplifier. You turn an internal adjustment to center the peak of the response. (note that the scope's "X" is vertical in the video)
human foot shown for scale
showing time from GPS+NTP. The last second of each minute inverts the screen. Some weird jello artifacting from my phone's video stablization mode.
Now it is back to failing regularly on my itsybitsy m0 espress.
that silkscreen on the m4 beta with mosfet is very sweet. made me tear up a little even.
nevermind - false alarm on the itsybitys - it is working . I got my branches confused...
@tidal kiln agreed.
@onyx hinge @tulip sleet I oull the new makefile update into master then pulled pr_747 to build for itsybitys but now I get the same erros with the genhdr dir missing - the workaroud takes care of it, but should it be working now?
@solar whale that should have worked, and not require to manually 'mkdir' as a workaround.
.. grumble
ii works in master, just not if I then add pr_747
what git command do you use to "add pr_747"?
