#circuitpython-dev

1 messages ยท Page 169 of 1

solar whale
#

ah - it complained about an invalid kewword!

idle owl
#

I figured out a thing!!

#

I need to put 3.0 on a CPX

#

Or rather a new version of it. I have one I bet isn't up to date.

solar whale
#

I'm glad I had some time to play with CPX on 3,0 today -- With Dan's help got audio.play working again. my examples from 2.x all needed to be updated. Even found a bug!

idle owl
#

Are you updating to master?

solar whale
#

yes - but I didn't fix the bug -- just found it ๐Ÿ˜‰

idle owl
#

No, I was going to ask if you could drop me a uf2 ๐Ÿ˜„

solar whale
#

sure - just made a fresh one -- just a sec

idle owl
#

Brilliant, thank you so much

solar whale
#

let me make sure it runs ๐Ÿ˜‰

idle owl
#

woo too late!

#

๐Ÿ˜‰

#

I have a CIRCUITPY drive so good start

raven canopy
#

@solar whale can you drop me a working FrequencyIn that doesn't lock up past 512kHz and clears the registers when I want them to be clear? kthx. ๐Ÿ˜„

solar whale
#

seems to be good!

#

give me 5 ...

raven canopy
#

sweet! hehe

#

i wish i could trust this darn datasheet. i'm tempted to try and cross the DMA threshold, but not sure if it works for capture.

idle owl
#

Well this fixes the 3.0 issue with my additions: ```python
# Define sound sensor/mic:
try:
self._mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA,
sample_rate=16000, bit_depth=16)
except TypeError:
self._mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA,
frequency=16000, bit_depth=16)
self._samples = array.array('H', [0] * 160)
self._mic.record(self._samples, len(self._samples))

#

Does not fix the rest of the problems with the lib.

solar whale
#

@raven canopy someday I hope to get as deeply into thi as you have!

idle owl
#

@raven canopy As do I! seriously.

raven canopy
#

jump on in you two! the waters fine! hehe. C only looks scary. plomise.

idle owl
#

I would but I only know Python, really.

solar whale
#

I'm fine with C -- its the nested and convoluted calling paths that get me lost...

raven canopy
#

as good as you're getting at Python, C won't be too difficult to tackle methinks.

idle owl
#

Thanks... ๐Ÿ˜Š

solar whale
#

and C lint is much more forgiving than pylint ๐Ÿ˜‰

raven canopy
#

@solar whale i feel ya on that. its why things take me so long. "but....why does this need to be done?". ๐Ÿ˜„

idle owl
#

I'm half tempted to make a 3.x compatible version of this lib but that defeats the purpose.

#

Also, wait, does that mean LIS3DH doesn't work with 3.0 regardless?

solar whale
#

not unlees you fix the driver!

idle owl
#

So it would look like this? ```python
try:
import collections
except ImportError:
import ucollections as collections

#

That's what struct looks like.

raven canopy
#

it just needs a try...yep. that's it

solar whale
#

but it does not impre all of collections - wasn't shure how to handle it

idle owl
#

Also means updating the usage of it because they bloody imported it as "from blah import whatever" so I have to update every instance of it too apparently.

#

Here's what's in there now from ucollections import namedtuple

#

So I guess ```python
try:
from collections import namedtuple
except ImportError:
from ucollections import namedtuple

#

?

solar whale
#

looks good to me

idle owl
#

Ok. Man.. This driver and I have history. glares

raven canopy
#

lis3dh, have you met my friend ๐Ÿ”ฅ ?

solar whale
#

made taht change --- ```Adafruit CircuitPython 3.0.0-alpha.6-149-gbe12e07 on 2018-05-19; Adafruit CircuitPlayground Express with samd21g18

import lis3dh_simpletest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "lis3dh_simpletest.py", line 7, in <module>
MemoryError: memory allocation failed, allocating %u bytes

idle owl
#

um

#

that's special

solar whale
#

it worked just deleteing th "u"

raven canopy
#

ohnoes! i thought we (Dan) fixed the %u occurrence...

solar whale
#

wait

idle owl
#

It worked for me

#

went through to failing on touchio

solar whale
#

my bad - I used a .py by mistake -- all good with a .mpy

idle owl
#

need to check it on 2.0 now.

solar whale
#

I had to juggle the sys.path order to move .frozen

#

not for lis3dh, but for express

#

or else it picked up the .frozen lis3dh driver

idle owl
#

I called it lis3dh.py and changed it in express

#

to check it

solar whale
#

ah - clever! -- did you get any audiobusio errors?

#

ord di you fix taht already -

idle owl
#

I changed it.

#

Yeah that's what I checked first. Scroll up

#

it worked for me

#

I'm so turned around trying to test this on 2x and 3x lol

solar whale
#

ah - missed that -- good !

#

does it use audioio?

#

may be some issues there.

idle owl
#

no it's only PDMIn I think

#

Yeah that's all it uses.

#

I created a PR and added you as a reviewer @solar whale . For LIS3DH.

#

Still building travis. Should have linted it. Always forget when it's something simple.

solar whale
#

thanks

idle owl
#

ooh passed.

solar whale
#

ah -- play_file will fail under3.0

idle owl
#

Ok.

solar whale
#

PR looks good - have you tried it under 2.x yet?

idle owl
#

thought so, but now I'm looking at it and I think I have a memory failure. so let me try it by itself. hold on.

solar whale
#

I can trt it as well

#

works for me

idle owl
#

ok good

solar whale
#

do you want me to approve it or do you want other reviews?

idle owl
#

I got it working! Nope go ahead and approve it

#

Making a list of everything that needs to be done now. Since it's turning into a list.

solar whale
#

should I merge it as well?

idle owl
#

Yah might as well. It's necessary for 3.x right? And we were making this change where we find it as we go.

#

I'll do the release.

raven canopy
#

should we re-open the "change ucollections to collections" issue, and add the library list?

idle owl
#

Well it's done now ๐Ÿ˜„

#

I don't think we need to reopen the issue to add it and say it's done.

solar whale
#

cool - my frsit merge!

idle owl
#

Oh nice!

raven canopy
#

how many more need the update?

#

grats @solar whale!

idle owl
#

No idea, @raven canopy

raven canopy
#

ahh. well, like i (think) i said earlier, adabot should put out a list of autodoc fails...

idle owl
#

Oh right.

#

I wasn't sure how it covered this though. It might.

#

Ok so play_file will fail.

solar whale
#

thsi should fix it ``` wav = open(file_name, "rb")
audio = audioio.AudioOut(board.SPEAKER)

    audio.play(wav)
#

I can imprt cpx now

idle owl
#

RuntimeError: Unable to allocate buffers for signed conversion

#

That's not in the lib

#

that's just trying to do it in code.py

solar whale
#

oops -- just a sec

#

missed a step

idle owl
#

ok

solar whale
#

try ``` # Play a specified file.
self._speaker_enable.value = True
data = open(file_name, "rb")
f = audioio.WaveFile(data)
audio = audioio.AudioOut(board.SPEAKER)

    audio.play(f)
solar whale
#

the loud detector ran ' for ahwile " with my updated express - then it hung my baord ๐Ÿ˜ฆ

idle owl
#
import audioio
import audiobusio
import digitalio

speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
speaker_enable.switch_to_output(value=False)

file_name = "eep.wav"

data = open(file_name, "rb")
f = audioio.WaveFile(data)
audio = audioio.AudioOut(board.SPEAKER)

audio.play(f)
print("stopped")
solar whale
#

had to hard reset, but its progress

idle owl
#

Prints "stopped" and does nothing.

#

I'm trying to get this to run simply in code.py before trying to mess with the lib.

solar whale
#

add somethting like ```
print("playing")
a.play(f)
while a.playing:
pass
print("stopped")

#

need to let it ply

#

need to let it play

idle owl
#
f = audioio.WaveFile(data)
audio = audioio.AudioOut(board.SPEAKER)

print("playing")
audio.play(f)
while audio.playing:
    pass
print("stopped")```
#

prints playing and stopped.

#

so it's running...

#

the wav file is there and the laptop plays it

solar whale
#

thsi works for me ```import board
import audioio
import digitalio

Required for CircuitPlayground Express

speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
speaker_enable.switch_to_output(value=True)

data = open("WhoHitMe.wav", "rb")
f = audioio.WaveFile(data)
a = audioio.AudioOut(board.A0)

print("playing")
a.play(f)
while a.playing:
pass
print("stopped")

idle owl
#

ok works for me too

#

working backwards

#

ok

#

ยฏ_(ใƒ„)_/ยฏ

#

It works even with starting with speaker_enable = false, and then enabling and disabling it later

solar whale
#

magic

#

the whole speaker setup on CPX has always puzzled me.

idle owl
#

Ok so ```python
def play_file(self, file_name):
self._speaker_enable.value = True
audio = audioio.AudioOut(board.SPEAKER)
file = audioio.WaveFile(open(file_name, "rb"))

    audio.play(file)
    while audio.playing:
        pass
    self._speaker_enable.value = False
#

I think that should work

solar whale
#

looks OK to me - let me try it.

idle owl
#

I took out touch and the rest works on 3.x!

solar whale
#

hmm - somehting not right - cant import cpx now

#

trying again

idle owl
solar whale
#

can you post the .py? my Filesystem just got corrupted -- need to rebuild

idle owl
#

yes.

#

I'm working in two places with this because I think some things won't work on 2.x that work on 3.x so hopefully that's the right one

#

So glad I held my PR for this back

solar whale
#

hoping a comuter reboot will fix it

#

the sutt in play_file won't work in 2.x

raven canopy
#

Hehe. instead of a Travis & Rosie CI...we need to build a Jerry CI. ๐Ÿ˜„

idle owl
#

Jerry already is CI ๐Ÿ˜„

#

ok.

#

So there needs to be two versions of this file then, apparently.

#

if we intend to freeze it in to both.

#

Wait!

#

No I'm wrong!

solar whale
#

nope - FS i s gone -- ๐Ÿ˜ฆ

idle owl
#

We figure out the error on 2.x and have it say "UPDATE ALREADY"

#

except nicer.

#

And that error would be this: TypeError: function takes 2 positional arguments but 1 were given

#

so no more play_file on 2.x basically.

solar whale
#

or detect version and use different API's -- yuk

raven canopy
#

i was about to say that. import os and check the version...

idle owl
#

oh well get all fancy why don't you

raven canopy
#

๐Ÿ˜†

idle owl
#
  File "code.py", line 4, in <module>
  File "/Users/kattni/CPXDev/express.py", line 610, in play_file
RuntimeError: Oops! You need a newer version of CircuitPython (3.0 or greater) to use this feature.```
#

Is what I just made it do.

raven canopy
#

not worth the overhead really if you're already close to import limit...

idle owl
#

how do you check version with os

raven canopy
#

runs to look since he opened his big mouth before looking

idle owl
#

๐Ÿ˜„

raven canopy
#

os.uname

>>> import os
>>> os.uname()
(sysname='samd21', nodename='samd21', release='3.0.0', version='3.0.0-alpha.1-514-g83e3907-dirty on 2018-04-29', machine='Adafruit Feather M0 Express with samd21g18')
idle owl
#

Ok.... so what does that do for me. How do I use that

solar whale
#

i think there is even a simple way - trying to find it.

idle owl
#

Because we did what I just did earlier in this lib

#

for shake and something else.

raven canopy
#

version = os.uname()[2]? trying real quick.

#
>>> os.uname()[2]
'3.0.0'
>>>
idle owl
#

Ok, I see that gets the "release='3.0.0'`

#

oh

#

ok

#
>>> if os.uname()[2] = '2.3.0'
...    print("true")
...
Traceback (most recent call last):
  File "<stdin>", line 1
SyntaxError: invalid syntax```
#

So that doesn't work that easily ๐Ÿ˜„

raven canopy
#

yeah. i was trying a comparison too. and failed.

#

it's the double .

idle owl
#

can you regex it

raven canopy
#

? you're the python expert...

idle owl
#

๐Ÿ˜†

#

no

#

at least not this way.

raven canopy
#
>>> version = os.uname()[2]
>>> version
'3.0.0'
>>> print(int(version[0]) < 2)
False
>>> print(int(version[0]) < 4)
True
>>>
idle owl
#

I say regex, really I'm just putting in a * ๐Ÿ˜„

#

Oh nice

raven canopy
#

python is too modular sometimes... haha

idle owl
#

So let's take this one step further

solar whale
#

import sys

#

sys.implementation

idle owl
#

we're already importing sys so that's a good start

#

oh.

raven canopy
#

even easier!

#

and no extra overhead. nice rescue @solar whale

idle owl
#

So ok let's take this one step further... we've identified the OS. What does that do for me? Do I include both versions of play file and have it skip over one and go to the other or something?

#

That's the part I'm fuzzy on

solar whale
#

I just found that yesterday and took awhile to find it again

raven canopy
#

or you just raise the exception at init and say "UPGRADE SILLY!"

idle owl
#

oh.

#

ok.

#

We really need to get touchio done ๐Ÿ˜„

main meteor
#

I was going to suggest split('.') but sys.implementation is a better approach

solar whale
#

in the code you could test and have an if/else foe each API variant -- messy

idle owl
#

Yeah and this lib is already huge.

#

Mostly I'm thinking we're stuck in a limbo place at the moment. Because of touchio.

raven canopy
#

hey, we try and stay inline with CPython, right? we need a 2to3 module now. ๐Ÿคฃ

solar whale
#

we do have differnt libs arerady -- at leas with the ,mpy

idle owl
#

And this is going to be frozen in, so it can be big.

#

But that's my concern is we'll still freeze it into 2.x, and features will fail.

solar whale
#

so could have a py2x and a py3x for the .py files

raven canopy
#

for the record: THAT WAS A JOKE! please, please, don't make me write that module... ๐Ÿ˜„

idle owl
#

And stop updating the 2.x version. So we're done with it.

solar whale
#

yes - frozen...

idle owl
#

Right.

#

Except for the part where I want the sound stuff I just added for the guide I'm doing that will be due in 2 weeks likely. Unless I figure something else out and put it off.

#

touchio will be done in less time than that, I bet. But still my point stands.

solar whale
#

it wil also be very messy in the idividual repos ....

#

change is bad...

idle owl
#

๐Ÿ˜„

#

But it's happening!

raven canopy
#

Scott started touchio already, right?

idle owl
#

Yes, but then PyCon

raven canopy
#

well, yeah. that.

idle owl
#

at least I think he did

#

he might have only looked into it, not sure how far he got.

#

I remember now thinking he was ok with other people looking at it, so maybe he didn't get so far.

#

At the PyCon sprints I mean.

raven canopy
#

well, when it comes to those datasheets, looking at it is what takes the most time. ๐Ÿ“–

idle owl
#

Yeah.

solar whale
#

This really only impact audio stuff -- so may ahve to just keep compatibility by testing version.

idle owl
#

hmm

solar whale
#

this could be done in C in the audioio code, no?

idle owl
#

no idea.

#

I'm thinking I could check it inside play_file() for now

solar whale
#

maybe not -- there are a lot oc changes in 3.0

idle owl
#

if sys.implementation(whatever):
else whatever:

#

Not sure how long we want to be backwards compatible. But we've already put in a lot that is like with ustruct and so on.

solar whale
#
 if sys.implementation.version[0]==3:
      use 3 stuff
  else
       use 2 stuff
idle owl
#

yeah I can put that inside play_file right?

solar whale
#

I think so.

idle owl
#

about to find out ๐Ÿ˜ƒ

raven canopy
#

should be able to. and there should be a place a C land to find the info. otherwise sys.implementation wouldn't work...

idle owl
#

Memory error.

solar whale
#

@raven canopy I'm sure you can detect the version - but there are some any API changes, I'm not sure it will e so easy to map.

idle owl
#

On this line audio = audioio.AudioOut(board.SPEAKER, open(file_name, "rb"))

solar whale
#

on 3,0 cant have 2 arguments

idle owl
#

that's in the else, I'm testing on 2.x

solar whale
#

ah -- I was hoping it did not check the API if i did not execute

idle owl
#
        # Play a specified file.
        self._speaker_enable.value = True
        if sys.implementation.version[0] == 3:
            audio = audioio.AudioOut(board.SPEAKER)
            file = audioio.WaveFile(open(file_name, "rb"))
            audio.play(file)
        else:
            audio = audioio.AudioOut(board.SPEAKER, open(file_name, "rb"))
            audio.play()
        while audio.playing:
            pass
        self._speaker_enable.value = False```
solar whale
#

memory allocation error -- just too much code

idle owl
#

Doesn't matter if the while is inside the if/else

#

no it just say s"memory error"

#

with no info

raven canopy
#

sys is in py/modsys.c, so should've survived revision. still digging.

idle owl
#

MemoryError

#

ok now it's doing it in 2.x regardless. give me a few minutes here.

#

ok I reverted to the earlier version and it works. it was giving me MemoryError even without any of the 3.x code in it. bleh.

#

the if/else code works on 3.x

#

now testing again on 2.x

#
  File "code.py", line 3, in <module>
  File "/Users/kattni/CPXDev/express.py", line 614, in play_file
MemoryError:```
#

That's with less code because this version of the lib has no touchio in it.

#

๐Ÿ˜–

#

MemoryError isn't memory allocation.

solar whale
#

is the erro on 2.x or 3.x

idle owl
#

2.x

solar whale
#

does using a context manager use more or less memory? with open("filename","rb") as f: -- that way the file gets closed

idle owl
#

Oh!

#

I just added the code to the 2.x version of the lib, with touchio in it, and it worked!

solar whale
#

woohoo!

idle owl
#

I have two working versions

raven canopy
#

break time for me. see ya'll later. and yay!!!!!!!!!!!!!!!

idle owl
#

one with only the loud_sound stuff added

#

later @raven canopy !

#

so it still has touchio in it.

solar whale
#

@raven canopy have fun!

idle owl
#

and it works...

solar whale
#

nice!

idle owl
#

ok I removed touchio and put it back on 2.x and it still works. And it works on 3.x

#

As long as it's using the updated lis3dh

#

(had to go alter that back as well)

#

so it works.

solar whale
#

sounds good.

idle owl
#

so that only leaves touchio. Which will come. And probably won't change. ๐Ÿ˜„

solar whale
#

Not a bad days work! Actually this went much more smoothy than I feared.

idle owl
#

Agreed

#

So I'll put in a PR for this version:

#

And we need to get the frozen version of LIS3DH updated.

solar whale
#

does it need the new lis3dh?
right

idle owl
#

Only for 3.x

solar whale
#

it'll work for both but no need to change 2.x

idle owl
#

So it'll work on 2.x as is, and 3.x with the new version of LIS3DH

#

right

#

Well, it won't work on 3.x until we have touch, but otherwise yes.

solar whale
#

true - so should the PR go in now or wait for touchio

idle owl
#

So my list is PR for this, get LIS3DH refrozen, and this lib refrozen. Which means another 2.x release ๐Ÿ˜ƒ And we're about to do another 3 alpha as well so

#

Depends. It's already frozen into 3.x and not working, so no reason not to update it. Also, the sound_level and loud_sound, I'd like to have for the guide I'm working on.

#

It's up to what Dan wants to do probably

solar whale
#

right, but unless you take out touchio, it won't load in 3.0

idle owl
#

Correct.

#

But it's already frozen in there and doesn't load now.

solar whale
#

true!

idle owl
#

The guide will assume the latest stable version

solar whale
#

OK - I see - makes sense - no harm done.

idle owl
#

That was fun! ๐Ÿ˜†

solar whale
#

It was! Well done!

idle owl
#

Thanks! You too!

solar whale
#

cool ! new play_file works on my 3.0

idle owl
#

nice!

solar whale
#

but loud still locks up my system ๐Ÿ˜ฆ

idle owl
#

hmm.

solar whale
#

works for a few seconds then freezes

idle owl
#

Oh hmm.

solar whale
#

while True:
    print(cpx.sound_level)
    if cpx.loud_sound():
        cpx.pixels.fill((50, 0, 0))
    else:
        cpx.pixels.fill(0)
idle owl
#

Yah I'm getting that.

solar whale
#

I guess I feel better ๐Ÿ˜ฆ

idle owl
#

Why though?... all it's doing is checking levels against a threshold...

#

Oh.

#

That's what's crashing.

#

Sound levels.

#

while True:
    print(cpx.sound_level)``` just crashed.
solar whale
#

need more noise ??

tulip sleet
#

(back from being out) another 2.x release is fine, since it fixes the "SD card" bug that was really boot_out.txt

idle owl
#

Hi @tulip sleet ๐Ÿ˜ƒ

tulip sleet
#

did it crash on 2.x or 3.0?

#

hi!

idle owl
#

only on 3.x

tulip sleet
#

did you have the absolute latest build since Scott accepted my PR's today?

idle owl
#

Not sure, do I @solar whale ?

solar whale
#

yes

idle owl
#

Yes ๐Ÿ˜ƒ

#

It's working fine on 2.x as a side note.

tulip sleet
#

hmm, i was hoping not ๐Ÿ˜ƒ

#

what's the version line in boot_out.txt or the REPL?

#

I just want to see the commit

idle owl
#

um... bootout is saying 2.3 on both. let me reload and try to get to the REPL

solar whale
idle owl
#

Adafruit CircuitPython 3.0.0-alpha.6-149-gbe12e07 on 2018-05-19; Adafruit CircuitPlayground Express with samd21g18

solar whale
#

๐Ÿ˜‰

idle owl
#

I was so excited I managed to get to the REPL before it crashed. I pasted anyway ๐Ÿ˜„

solar whale
#

pulled and built at ~1945

tulip sleet
#

darn, thought maybe it was the boot_out.txt fix that would fix it. I will try a

while True:
    print(123.4567)
#

to see if it's print or the sound code

idle owl
#

it's not failing.

#

in the REPL

#

for me.

tulip sleet
#

but it does fail in the repl if you the same thing with cpx.sound_level?

idle owl
#

oh

#

checking

#

lol memory allocation fails.

solar whale
#

just strated in REPL (via paste 9control-e) running happily --- oops just froze

idle owl
#

๐Ÿ˜„

#

oh the print buffer was killing it

#

I just reloaded and it let me import at least

solar whale
#

ran longer than before

idle owl
#

after printing (123.4567)

#

indeed it does

#

run longer

#

Way longer

#

Still going for me

solar whale
#

mine died again after 10 seconds

idle owl
#

There it fcroze

#

Mine ran for nearly two minutes.

solar whale
#

I had my FS corrupted earlier but then I waited for the terminal session to close itself. Now I am dismounting CIRCUITPY when it freezes the doing hard reset - so far so good.

idle owl
#

Oh I keep hitting reset. Probably not the best way to do it.

tulip sleet
#

i'm confused. is it dying at all just printing 123.4567?

idle owl
#

No

#

Well I didn't leave it forever

#

But it didn't for the time I left it

tulip sleet
#

ok, good. no that's fine

solar whale
#

I am going to have to bail and get some sleep -- good luck!

tulip sleet
#

me too

idle owl
#

Have a good one @solar whale! Thanks for all your help!

#

Same to you @tulip sleet ๐Ÿ˜ƒ

tulip sleet
#

g'night!

solar whale
#

my pleasure -- good night!

idle owl
#

Goodnight!

manic glacierBOT
tiny bramble
#

Wondering if anyone can help me with a micropython issue. I am trying to store a file for reading in folder/subfolder/file.text. Everything I try fails to read the subdirectory. I was able to create it with os.mkdir('folder') then another call os.mkdir('folder/subfolder') but every attempt to read/write the contents of subfolder fail with a "OSError: [Errno 2] ENOENT"

#

this all works perfectly if I do: folder/file.txt

marble hornet
#

Can I ask more about sercom

#

Selection

#

?

#

@hellsbreath#6510 have you tried. . dots. Instead of slashes ?

tulip sleet
#

@tiny bramble do you mean CircuitPython or MicroPython? Which board and which version of Python?

#

@marble hornet what's your question

tiny bramble
#

@tulip sleet MicroPython but I am guessing it should be the same for CircuitPython (maybe?). the ESP8266 port v esp8266-20171101-v1.9.3 - Python version 3.4.0

#

@marble hornet Same result using dots vs forward slashes

tulip sleet
#

@tiny bramble
This works for me with CircuitPython 3.0 on the ESP8266:

>>> import os
>>> os.listdir()
['boot.py', 'foo.txt']
>>> os.mkdir('dir1')
>>> os.mkdir('dir1/dira')
>>> f = open('dir1/dira/foo.txt', 'w')
>>> f.close()
>>> os.listdir('dir1/dira')
['foo.txt']
tiny bramble
#

let me run that exact script

#

oh I feel dumb... I was doing os.listdir('folder/subfolder') but it had no contents so it was complaining

#

Thanks Dan!

#

apparently empty results are the same as no path found

#

I was expecting listdir to return [] on the folder/subfolder

tulip sleet
#

hmm, I do:

#
>>> os.mkdir('dir1/dirb')
>>> os.listdir('dir1/dirb')
[]
tiny bramble
#

me too...

#

did something corrupt my other subdirs?

tulip sleet
#

how did you get ENOENT?

#

could you show the exact example?

tiny bramble
#

os.listdir('rooms')
['town', 'wilderness', 'tavern.json']
os.listdir('rooms/town')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 2] ENOENT

#

town and wilderness subdirs were created with mkdir

#

Creating new folders works there

#

this is part of a much larger script so I am trying to isolate where my build script failed

tulip sleet
#

could you try:

>>> os.rmdir('rooms/town')
>>> os.mkdir('rooms/town')
>>> os.listdir('rooms/town')
tiny bramble
#

os.rmdir('rooms/town')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: 20

#

I am guessing it created it as a file

#

let me stat it

tulip sleet
#

yes, I get the same sorts of errors if it's really a file

tiny bramble
#

os.stat('rooms/town')
(32768, 0, 0, 0, 0, 0, 0, 428, 428, 428)

#

boggle

tulip sleet
#

yes, that's a file, not a dir stat

#

hex(32768) = 0x8000

tiny bramble
#

ok

#

Rerunning the whole thing fixed it

#

how strange

raven canopy
#

irony: including a procedure to check if a function is in "lockup territory", then the checking procedure results in a lockup. ๐Ÿค”

#

unrelated to current discussion ๐Ÿ˜„

manic glacierBOT
tiny bramble
#

yay, everything is working

#

Thanks @tulip sleet

tulip sleet
#

Great! You're welcome!

raven canopy
#

is there ANY way we can catch interrupt overflows and SUCCESSFULLY bail? i've tried 3 different ways, and it just causes a non-responsive state anyway. get's hung up in USB write land during mp_raise_SomeException. i'm trying inside the interrupt_handler function...

tulip sleet
#

@raven canopy does it work in 2.x? The USB stack is different there.

raven canopy
#

haven't even tried building this in 2.x. (tbh..i don't want to) ๐Ÿ˜„

tulip sleet
#

Is this FrequencyIn?

raven canopy
#

yessir

tulip sleet
#

what do you mean exactly by interrupt overflows? You mean an interrupt while inside an interrupt handler?

raven canopy
#

but, if we can get this to work, i can also apply it to PulseIn (original issue).

#

well, the problem is we're getting stuck in CircuitPython when the interrupts happen quicker than we can process.

#

i've tried to implement a hardline check to bail. psuedocode:

void frequencyin_interrupt_handler {
    if (tc->COUNTER_value < MAX_FREQUENCY) {
        frequencyin_pause;
        mp_raise_RuntimeException("BAIL!");
    }
}
#

even wrapping the pause with common_hal_mcu_disable_interrupts and re-enable before raising the exception doesn't work...

tulip sleet
#

are there other examples of raising an exception inside an interrupt handler? I wasn't sure that was a good idea?

raven canopy
#

checking the TC error and overflow registers bails to quickly, but even results in the same behaivor.

tulip sleet
#

you could set a flag to raise an exception in the non-interrupt code

raven canopy
#

no, there aren't. and maybe that's why (bad idea). might just be a documentation thing: "doesn't work beyond XkHz".

#

yeah, i also tried something on the python side. didn't work, but i may have tried too close to the curve.

#

i'm still tempted to give DMA a shot. but the SAMD21 datasheet cannot be trusted on some things... ๐Ÿ˜„

tulip sleet
#

an mp_raise (calls nlr_raise) doesn't return. I don't think you want to enter the Python world in the interrupt handler.

raven canopy
#

ahh. no..not that way. tried it like this on the python side:

if (tc.value > 0):
    if (tc.value < 95):
        #bail 
    print(tc.value)
tulip sleet
#

no, but I mean you can't throw an exception inside an interrupt handler. You just want to note the problem, return from the interrupt handler, and in the C code that's running the Python code you'll check for the problem and then throw there. Also once you bail you want to turn off further interrupts until you've had a chance to recover.

raven canopy
#

hmm. so maybe in the frequencyin_get?

tulip sleet
#

all our Python code that uses interrupts is synchronous at the higher level. It's busy-waiting on completion (or failure). We don't do interrupts in Python space. We just use interrupts for convenience at the lower level. So frequencyin_get waits for the frequency measurement to complete, or it sees that an error happened. If there's an error, it will throw the exception, not the interrupt handler. The interrupt handler would just note something bad happened by recording that in a status variable

raven canopy
#

ok...more psuedocode incoming, to make sure i understand what you're saying. ๐Ÿ˜„

#
void frequencyin_interrupt_handler {
    if (tc.CAPTURE < MAX_FREQUECNY) {
        self->overflow = true;
    }
    self->frequency = tc.CAPTURE
}

void frequencyin_get {
    if (self->overflow) {
        frequencyin_pause();
        mp_raise_Expection();
    }
}
tulip sleet
#

it isn't completely true that nothing is asynchronous: e.g., audio playing is in the background, but there's nothing that can go wrong. If there were, we'd probably just give up quietly. But if we need a value, we wait for it. When we do audio recording, we block until the sample is all in memory.

#

yah, something like that, though you may want to shut things down (to prevent further interrupts) in the interrupt routine itself.

#

in your case you are waiting for a value, so you'd just wait until you do the measurement

raven canopy
#

yeah, that's the heart of the problem. keeping the handler from taking total control of the loop by repeatedly firing. obviously have to make the conditional conservative...

#

FrequencyIn MK 134 coming up... ๐Ÿ˜†

tulip sleet
#

i don't know how your code works. Is the interrupt firing on input on a pin, and you're timing the frequency of those interrupts to measure the frequency? Could you also do something like PulseIn at a very high frequency and just look at the bits to measure the freq?

#

e.g. 111 000 111 000 means the freq is 1/3 of the PulseIn freq?

raven canopy
#

it's similar in structure to PulseIn, but using the SAMD's TC capture capability. unfortunately, the SAMD21 requires the EIC.EXINT and EVSYS for capturing from a pin... SAMD51's TC can tap the pin's input directly.

tulip sleet
#

does frequencyin_get busy-wait right now waiting for the result? if you overflow in the interrupt handler, I think you'd want to disable the whole mess by turning off interrupts immediately and shutting down the TC, while you're in the handler. Then set the "uh-oh" flag. frequencyin_get will busy-wait on done or uh-oh.

raven canopy
#

frequencyin_get is "slim":

uint16_t common_hal_pulseio_frequencyin_get_item(pulseio_frequencyin_obj_t* self) {
    return self->frequency;
}
#

let me put up a gist...

tulip sleet
#

so you can call frequencyin_get anytime? Is it up to the Python code to wait sufficiently long for it to get an accurate reading?

#

I thought maybe you would set a sampling period in which to measure the frequency. (I have not been paying attention to this whole thing.)

raven canopy
#

the TC does all that for you.

tulip sleet
#

but suppose you have a really slow-frequency signal? what happens if you call frequencyin_get too early?

raven canopy
#

you could buffer it at the C level, but that's just going to give you a averageable range.

#

well, that's a good test point i didn't think about. let me check real quick (i've been using a feather m0 to gen the signal; 8khz to like 3Mhz).

tulip sleet
#

so how about if the interrupt handler detects overflow, it does the equivalent of pause? That's just a register operation, so it can do that fine. and also sets the overflow flag. Then when the Python code calls frequencyin_get, it clears the overflow flag and throws an overflow exception. The Python code can do a resume later to restart the measurement. The overflow doesn't get noted until frequencyin_get is called.

#

i was thinking about like 1 Hz signals.

raven canopy
#

just started at 8hz...picked it up as soon as it started.

#

the overflow and error intflags actually get turned on pretty early at 8kHz. they're tripped when a capture is detected, but the CCx registers haven't cleared. which works well enough in a real-time environment i would think. but our VM can't keep up...

tulip sleet
#

can we do a voice chat? I'm confused and it would be a lot faster.

raven canopy
#

yeah, let me grab my phone. also, just ran a test starting at 1Hz...it jumps a bit through about 4 or 5 different values.

tulip sleet
#

i thought the overflow was your own creation. didn't realize it was the TC overflow

raven canopy
#

phone and app at the ready..

tulip sleet
#

I'm in CircuitPython chat

raven canopy
#

der... ๐Ÿ˜„

manic glacierBOT
marble hornet
#

@Dan Halbert#1614 , sorry was driving a robot at battlecry, I realised that my project is going to need a lot more memory. And a speed upgrade can't hurt. So I'm switching to the d51. But I will need to choose an spi port and other functionality. My question is:
For each serial com port how do you differentiate between each pin's purpose? And how do you set it ( pin name excluded) ?

manic glacierBOT
timber mango
#

I have some issues getting the adafruit_ssd1306 to work with the Feather express M0 board. I get a value error upon loading the lib. (saving the py file with import adafruit_ssd1306) is this a known issue? How can I solve it?

stuck elbow
#

can you paste the complete error?

timber mango
#
Traceback (most recent call last):
  File "code.py", line 6, in <module>
  File "adafruit_ssd1306.py", line 34, in <module>
ValueError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.
stuck elbow
#

Ah, you have the wrong .mpy file for the version of your circuitpython

timber mango
#

I downloaded the latest version of circuit python earlier today. What can I do?

stuck elbow
#

which one exactly?

timber mango
#

this one

stuck elbow
#

hmm, I see the bundle only for 2.2 and 3.0

idle owl
#

2.2 will work for 2.x

timber mango
#

and this is the bundle that I was using: adafruit-circuitpython-bundle-2.2.3-mpy-20180520 (3)

idle owl
#

Should* work...

timber mango
#

Well computer says no ๐Ÿ˜‰

#

just rebuild it by yourself ๐Ÿ˜ƒ it's super easy ๐Ÿ˜ƒ

stuck elbow
#

you have several options: you can build the .mpy files yourself, or you can downgrade to 2.2

idle owl
#

Also if that's the case, file an issue, because it should work. (Sorry cooking too, so I'm back and forth)

timber mango
#

ok, good idea. I will rebuild. But you also build it May 20th 2018, I tried that one also with no luck.

#

no prob kattni. catch up later. I will report after my rebuild

idle owl
#

Thanks, let us know!

tulip sleet
#

@timber mango I just tried duplicating your setup, with a Feather M0 Express, and the bundle version and CircuitPython version you specified above. I did not get an error.

#

It's possible you might have multiple versions of the library on your CIRCUITPY. Did you ever download the 3.0 bundle by accident?

timber mango
#

I know I tried it in an attempt to fix the problem. But quite sure that I restored the 2.2 version

#

also facing issues building.

#

building from OSX.

tulip sleet
#

line 34 in adafruit_ssd1306.py is an import for adafruit_bus_device. So it may not be the ssd1306 library is that is the wrong version, but the adafruit_bus_device library

timber mango
#

Aha. That is a good clue @tulip sleet

#

So replace that one I will.

tulip sleet
#

don't bother doing all these builds now, you should not need to do that yourself. I'd suggest saving any files of your own that are on CIRCUITPY, and then erasing and reformatting it:

>>> import storage
>>> storage.erase_filesystem()
#

then copy a fresh lib/ directory and your code.py/main.py back onto the drive.

timber mango
#

ok

#

shoot. deleted the filesystem without capturing main.py. Can I restore?

idle owl
#

Not unless you have the file elsewhere or are referring to the demo it shipped with (which is usually available for download).

tulip sleet
#

is it still in your editor?

timber mango
#

no

#

Well with the code.py without the main.py the lib loads fine anyway. Thanks to you!! What is the main.py file for anyway?

tulip sleet
idle owl
#

CircuitPython looks for code.py and main.py, in that order. So if you have both, it will run code.py. main.py is a carryover from other programing languages. code.py we chose because one of our major focuses is beginners and "code.py is where your code lives" makes a lot of sense there.

timber mango
#

Well thank you for explaining @idle owl with your help and the help of @tulip sleet I can continue my journey. Super!

manic glacierBOT
marble hornet
#

@tulip sleet , sorry was driving a robot at battlecry, I realised that my project is going to need a lot more memory. And a speed upgrade can't hurt. So I'm switching to the d51. But I will need to choose an spi port and other functionality. My question is:
For each serial com port how do you differentiate between each pin's purpose? And how do you set it ( pin name excluded) ?

tulip sleet
#

@marble hornet not sure I get the question exactly. You mean how do you decide which pins for which functions? On the Metro M4 using the labelled pins as such (TX, RX, SCL, SDA, and the SPI pins on the 2x3 header) works fine because we set it up so that they work. Otherwise you have to try them all, or look on the datasheet and schematic, or do something like this to enumerate the possibilities: https://learn.adafruit.com/circuitpython-essentials?view=all#wheres-my-uart (example is for UART)

marble hornet
#

Thanks, sounds good

#

Two things

#

I guess I'm curious on how the atSam D seecoms work. And how to say, figure out if a0 it is click line or a0 is data line

#

For example

tulip sleet
manic glacierBOT
slender iron
#

<@&356864093652516868> and everyone else. We'll have our meeting at the regular time (11am Pacific / 2pm Eastern) here on Discord in the CircuitPython voice channel.

idle owl
#

@slender iron If the lib is frozen, how does that affect how it's holding onto those bytes?

slender iron
#

@idle owl those bytes will be in memory but I had forgotten the library is frozen

#

(they are in memory since they are writeable)

idle owl
#

Ok. hmm.

#

I think it's worth having in the lib.

#

But now I'm wondering if I should try to initialise it only when it's used instead. And what that would look like.

slender iron
#

okie, just beware space is precious

idle owl
#

Agreed.

#

Would it be worth trying to initialise it when it's used then? Or does that not really solve the problem. Because at the moment it's taking up that space as soon as you load the lib, right?

slender iron
#

I think so. It depends on where you want to error if you are out of memory

idle owl
#

Ok so I have this in the express class python def sound_setup(self): # Define sound sensor/mic: try: self._mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, sample_rate=16000, bit_depth=16) except TypeError: self._mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, frequency=16000, bit_depth=16) self._samples = array.array('H', [0] * 160) self._mic.record(self._samples, len(self._samples)) and this is what it looks like in the code ```python
from express import cpx

cpx.sound_setup()

while True:
print(cpx.sound_level)
if cpx.loud_sound():
cpx.pixels.fill((50, 0, 0))
else:
cpx.pixels.fill(0)```

#

Like detect_taps, for tapped, it would be required for using the sound features.

#

wait a minute. @slender iron which line is taking up that memory? python self._samples = array.array('H', [0] * 160) self._mic.record(self._samples, len(self._samples))

slender iron
#

the array.array

idle owl
#

ah ok.

#

I was over thinking it. About to do another commit.

#

Done

idle owl
#

@tulip sleet @solar whale Ok so I can get 2.x to fail exactly the same way that 3.x is failing if I try to use cpx.start_tone/cpx.stop_tone with cpx.sound_level. What's weird is cpx.play_tone works fine with it. And play_tone is literally made up of start_tone/stop_tone. play_tone has a time.sleep() in it, but even adding a time.sleep into my start_tone/stop_tone code still allows it to crash.

#

cpx.play_file works fine.

#

It feels like a memory issue. Both sound_level and start_tone/stop_tone use arrays for samples.

#

Still doesn't explain play_tone working.

ruby atlas
#

Hmmmmm.... Dabbling with colour cycling a little, pondering whether depending on FancyLED means the memory/code will be a problem and whether even a subset of FastLED would be worth porting to a C extension would be needed (still ahead of myself a bit, only have the small dotstars on the Gemma/Trinket to play with so far).

raven canopy
#

@idle owl i feel your desk throwing. kind of reversed though, like my desk should throw me. spent an hour combined fighting a hang because i failed to realize i did this:

return value;
common_hal_mcu_enable_interrupts;
idle owl
#

oi... yes. We could eliminate the desk and I'll throw you? ๐Ÿ˜†

raven canopy
#

๐Ÿ˜†

#

"Then i get to fly around like Ironman. Commander....let's go Ironman."

idle owl
#

๐Ÿ˜ƒ

#

Blergh. Weekend's worth of work may be entirely useless. Figures.

raven canopy
#

offtopic: loved the movie, but the book was soooo much better.

ruby atlas
#

@idle owl negative results are still results.

idle owl
#

@ruby atlas As for your bit, no idea. Definitely worth testing once you have eq.

ruby atlas
#

i'm also worried about performance when dealing with larger strips or matrices ๐Ÿ˜ƒ so might need fastled or C helpers anyhow.

idle owl
#

Right

raven canopy
#

@ruby atlas i think it'll definitely need to be in C land to take advantage of DMA. blinka may not be fast enough to keep up, even though she's awesome.

ruby atlas
#

step 1: make it go. step 2: make it pretty. step 3: make it fast.

#

@raven canopy exactly.

#

but i still want a very pythonic interface ๐Ÿ˜ƒ

idle owl
#

Me too ๐Ÿ˜„

#

I also want a snack. We don't have anything snacky here.

raven canopy
#

@idle owl if the array is giving you fits, can you get by with a smaller array?

idle owl
#

I don't know. Wondering the same thing.

#

Staring at this code.

#

It seems like it's filling up and failing though

#

Like maybe it's not actually clearing anything

raven canopy
#

like progressively growing?

#

ahhh

idle owl
#

And is just making a giant array or something

ruby atlas
#
for color in color_cycle(steps=30):
  dot[0] = color
  dot.show()
```  is my current interface to give me a rainbow with default colour points.
idle owl
#

Because it goes for x-amount of time and fails on 3.0. On 2.0, it makes a strangled tweak sound and then hangs once I try to use start_tone with it.

raven canopy
#

kind of kludgey, but you could use the del(array) and recreate to make sure...

idle owl
#

Except with the sound_level code it's constantly taking one

#

so I'm not sure how to even include that

raven canopy
#

trying to remember...can you pop an array?

idle owl
#

I guess I don't understand why this has never come up before.

#

Or why we haven't managed to crash it like this with anything else

ruby atlas
#

@raven canopy >>> dir([]) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

idle owl
#

it's only with these two things together

#

and only in this way

ruby atlas
#

(not CP, but yup)

#
>>> dir([])
['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
#

@idle owl memory fragmentation problems?

idle owl
#

Ok I just tried this: python while True: if cpx.button_a: print(cpx.sound_level) cpx.start_tone(262) else: cpx.stop_tone()and it crashed after printing one value, so it's not even getting very far into these arrays.

#
code.py output:
86.4737
raven canopy
#

what does start_tone look like? or at least whichever function is manipulating the array.

idle owl
#
    @staticmethod
    def _sine_sample(length):
        tone_volume = (2 ** 15) - 1
        shift = 2 ** 15
        for i in range(length):
            yield int(tone_volume * math.sin(2*math.pi*(i / length)) + shift)

    def _generate_sample(self):
        if self._sample is not None:
            return
        length = 100
        self._sine_wave = array.array("H", Express._sine_sample(length))
        self._sample = audioio.AudioOut(board.SPEAKER, self._sine_wave)```
#

start_tone: python self._speaker_enable.value = True self._generate_sample() # Start playing a tone of the specified frequency (hz). self._sample.frequency = int(len(self._sine_wave) * frequency) if not self._sample.playing: self._sample.play(loop=True)

#

sound_level:python self._samples = array.array('H', [0] * 160) self._mic.record(self._samples, len(self._samples)) return self._normalized_rms(self._samples)

#

Why is one 'H' and one "H"

#

or does that not matter.

raven canopy
#

shouldn't matter. at least in my experience.

idle owl
#

I changed the first one, didn't change the results.

#

Simply to see.

#

Tried making the sound_level array size 20, and it was the same results.

raven canopy
#

and no pop available.. ๐Ÿ˜ฆ

>>> foo = array.array('H', [0] * 160)
>>> dir(foo)
['append', 'extend']
>>>
ruby atlas
#

oh right, array, not list.

idle owl
#

And I think the sine_wave array has to be that size for the sounds to be right.

raven canopy
#

in sound_level you have self._samples vs self._sample. on purpose?

#

actually, it's all "samples" in there, so i assume yes.

idle owl
#

tbh, I had forgotten that there was even a samples being used. And sample carried over from the sound meter code I used to build these functions in the lib

#

Could be any name, it just happened to be those two. They're simply variables.

raven canopy
#

ok, so two unrelated objects. jus checkin...

idle owl
#

yah, totally fair

#

I only noticed it once it started failing

raven canopy
#

brains are difference engines, after all. ๐Ÿ˜„

#

shouldn't this be subracting 1 from the length, since _sine_sample uses it in the for...loop?

self._sine_wave = array.array("H", Express._sine_sample(length))
for i in range(100):
       // loop gets to 100, but the array index ends at 99
solar whale
#

Yikes! Looks like I missed a fun evening! I wonโ€™t be much help tonight. Will try to come up to speed tomorrow.

idle owl
#

@raven canopy I'm not sure. I know we hammered on it for a long time.

raven canopy
#

scratch that...it doesn't access the array.

#

late night code hallucinations...

idle owl
#

That's the current iteration of the whole thing if you want the whole picture.

raven canopy
#

that sample samples thing...nightmareish. not like i haven't been guilty of the same, though. ๐Ÿ˜„

idle owl
#

I had help.

raven canopy
#

i don't see anywhere that would progressively increase the memory. well, other than the values that are contained inside of array.

#

e.g. array('H', [1,2,3]) is smaller than array('H', [1234, 1234, 1234]).

idle owl
#

right.

#

sigh

raven canopy
#

@idle owl you still around?

idle owl
#

Yah

raven canopy
#

k. i'll lead this off with the following: i have zero experience in using generators.

idle owl
#

๐Ÿ˜„

#

(here for a minute anyway)

raven canopy
#

but, is _sine_sample generating a huge-a-normous sine wave? like 100*100?

idle owl
#

um

#

maybe?

raven canopy
#

_generate_sample calls _sine_sample(100), then the for...loop yields... ugh. nvm. i keep having to type this out until i fully understand. ๐Ÿ˜„

idle owl
#

it's been so long and it's late. so I'm fuzzy on both counts

raven canopy
#

wait. its only returning one value, right?

idle owl
#

yeah at a time

#

at least that's how generators work

#

or rephrase

#

how the other generators I've written work

raven canopy
#

i just read that yield acts the same as return....

idle owl
#

so I assume it's a concept

raven canopy
#

so your for..loop runs the first and then exits?

idle owl
#

a generator yields all possible iterations before stopping

#

I'm seriously simply saying the things I know here. I'm not sure I'm even answering your question

#

either way I should really bail and go to bed.

raven canopy
#

ok. later. and i think it's my not understanding...will read some more.

idle owl
#

thanks for helping ๐Ÿ˜ƒ

raven canopy
#

hehe. did i? ๐Ÿ˜‰

idle owl
#

I really appreciate it. My brain is melting out of my ear is the problem at this point

#

well you're looking into it... the more brains on it the better, melty or not

raven canopy
#

fair enough. schlaf schoen.

idle owl
#

danke

raven canopy
#

hey! someone knows german! ๐Ÿ˜„

ruby atlas
#

melty brain is usually a sign a drink or break is needed (or both)

raven canopy
#

or the drink break needs to end... ๐Ÿ˜„

clear pecan
#

Hi folks! where can I find a reference on pin assignments for m0-based boards?

#

I want to try making a 16-button, 2-axis gamepad around an itsy bitsy m0 express, and I'd like to know how to reassign the SERCOM and SWD pins as digital IO

spare storm
#

Hi everyone! Similarly to @clear pecan's question, Does anyone know how to initialize the signal IO pins on the CRICKIT board? Specifically, how do I assign the Signal I/O pins for digital read/write via seesaw?

manic glacierBOT
#

in theory it shouldnt make a difference whether we collect() after each import in a sketch but ive found that "sketch that work but then fail after a while with memerrors dont have failures if we gc.collect after each import" im testing CPX in 3.0.0

we don't import a lot, its not a time sensitive event, and there's a huge memory slush...why not :)

manic glacierBOT
manic glacierBOT
manic glacierBOT
humble mural
#

Good morning everyone. Is there a neomatrix library for CP?

#

We are trying to run text on an Adafruit 8x8 NeoPixel matrix using CP

tulip sleet
#

@compact solstice there are some approaches to this: The framebuf module http://circuitpython.readthedocs.io/en/2.x/docs/library/framebuf.html is inherited from MicroPython and is available on Express boards. It has text support. We have some older guides that are relevant: https://learn.adafruit.com/micropython-hardware-ssd1306-oled-display https://learn.adafruit.com/micropython-displays-drawing-text. There is also an HT16K33 library but it currently only has builtin text support for multisegment (not LED array) text: https://github.com/adafruit/Adafruit_CircuitPython_HT16K33. We would like to have a more integrated solution, but it's still a work in progress.

#

There is not a NeoMatrix CircuitPython library.

manic glacierBOT
manic glacierBOT
#

(I have not been in the loop on this, so @tannewt and @margaret please let me know if you've discussed this already).

mp_obj_new_int_from_uint() will silently truncate the common_hal_precise_time_monotonic() value when it overflows 2^32. 2^32 msecs is about 49.7 days. I could imagine a long-lived sensing program that hits that limit. If the incoming common_hal_precise_time_monotonic() is > 2^32 you could call mp_obj_new_int_from_ull(), which takes a long long (which is 64 bits).
...

#

This gave an error on the nrf build. I think you meant precise_time_module on line 224 here.

 ./mpconfigport.h:275:62: error: 'precise_time_module' undeclared here (not in a function); did you mean 'precise_time'?
     { MP_OBJ_NEW_QSTR (MP_QSTR_precise_time    ), (mp_obj_t)&precise_time_module    }, \
                                                              ^
../../py/objmodule.c:233:5: note: in expansion of macro 'MICROPY_PORT_BUILTIN_MODULES'
     MICROPY_PORT_BUILTIN_MODU...
timber mango
cunning crypt
#

Despite it being less than an hour away, I won't be attending today's CP meeting. We will be clearing out of the hotel room and wandering into Seattle about that time.

humble mural
#

Test

#

@tulip sleet Thanks for the reply . I didn't realize that you replied until a few moment ago. I will go over this now.

#

The deeper I go in CP the more I realize that all of you that work on CP are taking on a monumental task. Thank you all for taking on this work, it truly is remarkable.

timber mango
#

I've used that guide myself -- you need an Adalogger M0 board (or similar) and an SD card. It works!

#

... And I'm back quiet. ;)

manic glacierBOT
idle owl
#

<@&356864093652516868> and anyone else who would like to join us: CircuitPython Weekly meeting in about 10 minutes!

#

For anyone new to the weekly, click on the CircuitPython voice chat on the left side of the Discord chat window to join the audio chat. If you don't have a mic, you can listen in and type out any responses in the chat window, and we'll read them out.

fluid helm
#

I think i may be able to join hopefully @idle owl

idle owl
#

@fluid helm Sounds good!

onyx hinge
#

I'll be listening but as usual I won't be able to talk.

fluid helm
#

I'll probably be the same tonight

heavy pasture
#

@idle owl I've got my mic setup, and everything tests ok

fluid helm
#

ooo Les is on

hollow ingot
#

Oooh generators. My favourite!

fluid helm
#

Hi Les!

hollow ingot
#

Darn it - old messages which hadn't scrolled. @idle owl is generator world still your purgatory or did it all get landed OK?

tidal verge
#

This is my first time on the call. I will be listening to the conversation.

idle owl
#

Welcome, @tidal verge ๐Ÿ˜ƒ

#

@hollow ingot Still fighting with it, not sure it's necessarily the generator causing the issue. I think it's an array issue.

hollow ingot
#

Yay, I can say purgatory. Is there source?

idle owl
onyx hinge
#

hi kattni

raven canopy
#

๐Ÿ‘‹

spare storm
#

Thanks @timber mango !

hollow ingot
#

Hmm @idle owl I'm not seeing any 'yield' what file should I be looking at?

idle owl
#

@hollow ingot sound_level, and start_tone/stop_tone

#

They crash when used together.

tulip sleet
#

@wraith tiger can you mute for now?

idle owl
#

@hollow ingot But weirdly, I can use sound_level and play_tone just fine. and play_tone is literally made up of start_tone/stop_tone

fluid helm
#

Hey @slender iron My mic is playing up

#

Will get it fixed for next week

hollow ingot
fluid helm
#

Cool !

wraith tiger
#

The chatroom's gonna need a bigger couch!

gaunt breach
#

working mic, unable to chat tho. Will mostly be listening. Will chime in over chat if I have anything to add ๐Ÿ˜‰

idle owl
#

@gaunt breach Perfect

tidal kiln
#

all the peeps! ๐Ÿ˜ฒ

wraith tiger
#

I forgot there was no meeting last week. I showed up and went where is everyone - OH! PyCon.

fluid helm
#

Yay! Mechanical Keyboards ๐Ÿ˜„

gaunt breach
#

๐ŸŽ‰

idle owl
#

Yay! Great job everyone!

fluid helm
#

Great stats!

ruby atlas
manic glacierBOT
#

I'd hate to do all this work and end up with something that can't keep precise time indefinitely without needing to use longints. 12.4 days to OverflowError on a non-express board is not a great outcome. 12.4 days until your carefully crafted code becomes markedly slower because it switched to 'long's isn't that hot either.

To that end, I have two general ideas. Option 1, return a preallocated list of two ints, for example [seconds,microseconds] or [seconds,milliseconds]. Now you're goo...

fluid helm
#

Yes, totally agreed. You were amazing @tulip sleet & @idle owl

onyx hinge
#

that's a huge list WoW

hollow ingot
#

Group hug this week. Thanks to all who suggested possible fixes for serial noise on Vanguard board, and had suggestions on Circuitpython startup. Also a hug for Les Pounder. @heavy pasture being on means I'm no longer first alphabetically!

heavy pasture
#

changes name to Ziglesp ;)

hollow ingot
#

Interestingly he's about 20 miles from me geographically!

heavy pasture
#

Here here @tulip sleet

fluid helm
#

My group hug this week is for @plucky flint for the amazing work on Mu and his Education summit talk, truly amazing. Also huge thanks to @tulip sleet , @slender iron & @idle owl for spending time with me and @heavy pasture at PyCon. Also, thanks for the Gemmas, they were amazing ๐Ÿ˜„

timber mango
#

zbigniew

raven canopy
#

Last is MY spot!! ๐Ÿ˜ค

#

๐Ÿ˜Š thanks @solar whale. Just paying it back/forward..

hollow ingot
fluid helm
#

Thanks @idle owl !

#

Yes, @regal canopy was amazing at PyCon. Thank you also!

gaunt breach
#

Thanks to @slender iron, @idle owl, @tulip sleet and everyone I met at the Pycon sprints for being patient with me and helping me get setup in the ecosystem. Also a big thanks for the Gemma's and for the Adabox donated to PyLadies. โค

idle owl
#

Sprint hug report: Roy, Adam, Chris, Margaret, Matt L, Matt W, Karin, Lady Red and anyone else I've missed!

timber mango
#

Hug Report: @solar whale for a friendliness ... (a friendly sort of a friend) and to all the PyCon newcomers -- how awesome to meet you each! @split ocean for Adafruit awesomeness and the mysterious @Dean Miller, who makes things happen.

idle owl
#

Also a hug repot to Wolf for talking so much about CircuitPython at PyCon that I had to keep giving him CircuitPython cards to hand out because he kept handing them all out.

solar whale
#

@timber mango thanks!

tidal verge
#

You can ignore me. This is my first time here and I am listening to the call.

fluid helm
#

Oh yes, very nice to meet you @quick oyster

wraith tiger
#

Nothing specific, just general kudos to Scott, Katni, Dan & the rest of the community.

raven canopy
#

@tannewt, @Dan Halbert, and @ kattni for attending PyCon and spreading the blinka love. Hug to everyone @PyCon that helped with sprints/etc, and have joined the community. Last but not least, extra hug to @Dan Halbert for taking some weekend time to help.

fluid helm
#

Ok, can I go last. I shall get mic sorted hopefully @slender iron

#

Oh I can do normal spot @slender iron , got mic sorted

#

yay!

ruby atlas
#

It was really fun to tweet at PyCon with @gaunt breach 's gemma!

gaunt breach
#

@ruby atlas is that what you borrowed my Gemma for? ๐Ÿ˜†

hollow ingot
#

Finally got the first Youtube video out https://vgkits.org/blog/2018/05/08/introductory-video-tutorial/ (thanks for feedback from those who went out of their way and out of their comfort zone to watch it!).

Finally told twitter about the VGKits Vanguard board and put up some Paypal buttons to buy the Rainbow kit. Tested to prove minimum function on the board in both v2 and v3 of Circuitpython.

Trying to figure out whether to go strong on Circuitpython or Micropython. Currently as per the demo shown in the video everything is dependent on exporting main.py symbols to the REPL shell, and having in-memory continuity between main.py and the REPL. Need to work through this to work out how to spin this up on Circuitpython, or rethink our approach.

Oh and saved my PhD (continuation panel) and rebuilt my laptop which imploded.

This week I'll be figuring out how to keep up with @heavy pasture's prolific blogging and actually putting some content up on VGKits.

Need your ideas what to build which would be the most affordable for educators?

tidal kiln
#

imploded?

errant grail
#

Distracted from the coding side of projects for the last couple of weeks -- was focused on music (composing, building synth circuits) and learning KiCad. First batch of boards came back and were awesome! Sent in six more board designs and anxiously waiting for the post to arrive. Working on robotizing the sound boxes from an ancient cuckoo clock, using CircuitPython of course.

hollow ingot
#

It all began with a little pip

idle owl
#

pip install implode ?

hollow ingot
#

ended up with core dumps from running pretty much every binary on the system, so I bailed and installed the Bionic LTS

#

No idea what broke, but it was bad

heavy pasture
#

Surely pip3 install implode @idle owl ?

idle owl
#

Could be aliased!

heavy pasture
#

LOL

hollow ingot
#

I was exploring screen overlay programs, to reveal keypresses - installing screenkey key-mon and gromit-mpx, then pycairo to achieve X11 transparency, then somewhere along the way messing with config, packages (deleting user site-packages) boom!

onyx hinge
#

jas

#

I've continued working on low-level issues with uzlib and ujson because they're likely to be used in IoT type devices where security is important. The most interesting bug I've discovered while looking for bugs in ujson actually affects regular circuitpython, where a numeric literal with a very large exponent evaluates to the wrong value (including when you write them directly in a .py source, not in json). The number-parsing bugs I found are all fixed in micropython now, but they have a low impact so I'm not planning to pull-request them in circuitpython. As far as uzlib goes, the maintainer has been optimizing some of my changes to have the minimum possible impact on code size. It will take some time to get them all accepted, but things are progressing and I'm confident we'll get to the point of having a uzlib that can be fed untrusted input.

#
18446744073709551615
>>> 1e18446744073709551615
0.1```
fluid helm
#

๐Ÿ‘

raven canopy
#

same here!

errant grail
#

Very cool @fluid helm !

hollow ingot
#

@onyx hinge If there's any interest in a 'pure python' type of JSON parser, which can consume any byte generator, there's a reference implementation at https://github.com/ShrimpingIt/medea

timber mango
#

"It was a fourteen-day week."

fluid helm
#

Hello

#

Had to drop out

#

Food is ready

#

Might make it back

slender iron
#

๐Ÿ‘‹ thanks @fluid helm !

gaunt breach
#

New to the world of Adafruit & CircuitPython, but loving it. ๐ŸŽ‰

  • Will be introducing my coworkers to the Gemma and CircuitPythonExpress today.
  • Possibly do some project work with the boards I have.
  • Some day I will bash through the sphinx code and generate the circuitpython C code into Python stub code... one can dream
#

yep!

#

๐Ÿ‘

timber mango
#

Receiving my first M4 was like being let out of jail, so I'm still on tilt about that. ;)
โคโ€ƒHave not taken a survey of what we can already do in CircuitPython with QSPI flashrom (assumed a lot here) but went right into Ardino for this:
โค
Arduino Forth (YAFFA-ARM) ported to the SAMD51 M4 chip:
โคโ€ƒ*https://github.com/wa1tnr/ainsuForth-gen-exp-m4*

I did a 3.x alpha 6 build -- having tested @tulip sleet 's new CircuitPython Firmware Build Guide (HUG) and it worked -- but I don't remember what MCU it was for. Metro M0 Express or Metro M4 Express (one of the two).

โคโ€ƒWorking on QSPI flash read/write primitives for Arduino and this Forth interpreter (more thinking than working/typing/coding).

โคโ€ƒI did a full memory dump of the M4 to convince myself there's really that much space inside that thing.
โคโ€ƒThere is. ;)

ruby atlas
#

We're going to have to be careful not to forget about M0 as M4 takes over!

onyx hinge
#

nah we're going to have to make noise until we get trinket m4

manic glacierBOT
ruby atlas
#

Other than helping bisect the bug Dan fixed over the weekend and the work I did at the sprints, I have been and will continue to be exploring LED colours and existing code samples and libraries like FancyLED and FastLED as well asl tons of code samples on the adafruit site, for arduino, in preparation to write higher order animation methods (specificall generators) to help with LED animations. The goal is to to make it dead simple to animate LEDs. This has led me down the path of reading up on RGB light perception and gamma and the like. I have some hardware arriving tomorrow that will help me with animating more than just single dotstars - such as strips, matrices and rings. I expect to be able to drive a number of different devices shortly with acceptable looking colour cycles. Time permitting, i'll follow on with a bunch of other common patterns like comet, which will help stucture the library to be easy to extend. I expect to run into performance challenges, and will eventually have to start to move some code into C, but will delay doing so until I run into problems where I need to free up cycles or memory.

raven canopy
#

@solar whale won't let us forget M0. No worries. ๐Ÿ˜„

heavy pasture
#

Woo hoo micro:bit ๐Ÿ˜ƒ

#

Thonny ๐Ÿ˜ƒ

hollow ingot
#

Thonny is pretty darn good

fluid helm
#

Im back!

#

yay!

heavy pasture
#

Thonny is great, slowly stepping through code is great

hollow ingot
#

Stepping is a bit confusing for someone used to a debugger, though - the nesting levels.

#

They claim it makes more sense for learners, which may be true.

heavy pasture
#

Good luck @wraith tiger I'll be interested to hear how you go with this!

raven canopy
#

There's an issue on the repo from ladyada for breakpoints too.

wraith tiger
hollow ingot
#

A python debugging channel would be extraordinary for Circuitpython and transformative for learning, for just the same reasons that Thonny is good.

raven canopy
#

Atmel Studio debugging guide has had some reviews and edits from suggestions.

High Frequency PulseIn: SAMD21 framework is done, and "working". Still trying to figure how to fail gracefully (can maybe apply to PulseIn too). May end up attempting DMA to maybe help alleviate endless interrupt loop. SAMD51 will start after that, and most likely be quicker since I don't have to mess with EVSYS and EIC.

hollow ingot
#

My use of the REPL is pretty-much a way to get a poor-mans debugger.

wraith tiger
#

I worked with JuPyter/iPython in a class and missed the ability to step through code.

onyx hinge
#

sometimes I want a terminal-mode editor built into circuitpython, just run it in the terminal window

wraith tiger
#

I had to doa lot of if debug print()

gaunt breach
#

too many videos...

raven canopy
#

The 3 hour ones are rough... ๐Ÿ˜ด

ruby atlas
wraith tiger
hollow ingot
heavy pasture
hollow ingot
#

Then you could get good error messages when you want, and opt out if you want.

errant grail
#

Thanks everyone!

gaunt breach
#

๐Ÿ‘‹ thanks!

raven canopy
#

Thanks everyone!!! Have a great day/week! blinka ๐Ÿ“ ๐Ÿ“

hollow ingot
#

Bye all, thanks.

timber mango
#

Now you can say what's really on your mind. ;)

wraith tiger
#

๐Ÿ‘‹

timber mango
#

I use the REPL for tab-completion as a shortcut to refering to proper documentation.
That gets folded back into the local copy of the code stored on the host PC.

wraith tiger
#

CTRL-D is EOF

#

At least in terminals...

onyx hinge
#

it's like a "python -i" mode, so that it can drop into the repl in case of exception or when the main program exits

heavy pasture
#

Right everyone I'm off to eat a steak ๐Ÿ˜ƒ Great chatting, laters!

idle owl
#

Later @heavy pasture

raven canopy
#

Gotta run myself. Later taters!

timber mango
#

(that's aloha in our limited emoji vocabulary)

slender iron
tidal kiln
timber mango
#

Yeah I overwrite main.py constantly. ; Generally by copying from the host PC to the target, at the host PC command line (bash shell).

#
 $ cd /media/nis/CIRCUITPY
 $ cp -p /home/nis/Project/main.py .  ; sleep 45 ; sync ; sleep 1 ; sync
solar whale
#

Sorry I have to mis the rest of this dicsussion -- good stuff -- off for awhile.

timber mango
#

@slender iron (from 'the weeds' in audio only) That explains a lot I wasn't aware of.

#

Well I gotta have that extra RAM (6x!) so I'm interested in working with M4 as it is found. ;)

hollow ingot
#

Taraa

timber mango
#

see you!

#

disappears back into the woodwork

lethal abyss
#

@stuck elbow I tried the bouncing ball example and it went good. I now try to understand how to use vacuum-invaders. Once you get the .mpy file, how to start it? I'm not familiar with the process to transform .py to .mpy

idle owl
#

Whee, slammed it into safe mode this time. ๐Ÿ˜‘

manic glacierBOT
#

I have a use case which may be relevant to this, depending on the breadth of functionality in a boot.py explicitly-coded python supervisor.

If the python-implemented supervisor was explicit in boot.py and oversaw the policy decision of dropping the VM after main.py and giving a fresh VM to the REPL, tweaking boot.py would enable alternative VM management strategies to be employed. Importantly no circuitpython-compatible fork would be needed to achieve this, since it happens in 'user...

hollow ingot
#

@lethal abyss can you point me to the bouncing ball example? .mpy files are run just like .py files, except they don't need to be 'compiled' before running, which saves memory. To create a .mpy file, I use the mpy-cross utility which can be built by running 'make' within a git-checked-out or downloaded-unzipped copy of the https://github.com/adafruit/circuitpython/tree/master/mpy-cross folder. I don't know if there is an easier way provided by other circuitpython tools. Calling mpy-cross mysource.py causes a mysource.mpy to be made.

#

@lethal abyss If you ever explore 'frozen modules' then the mpy-cross utility is effectively run automatically on source files in the modules folder to turn your .py files into .mpy files which are mapped in flash memory not stored to the filesystem and loaded in RAM. However, I don't know if you are forced into building your own circuitpython images or not at this stage, and frozen modules are avoidable hassle if you're not forced to use them by memory limitations. They are the last resort if you can't fit stuff into memory otherwise.

timber mango
gaunt breach
#

couldn't get my Gemma working. swapped usb cords, tried with the battery pack. nada. Then I remembered "wait, the Gemma has a built-in on/off switch..." looks at switch OFF ๐Ÿ˜‘ :head_desk: ๐Ÿ˜…

idle owl
#

Scott kept trying to unplug his to turn it off. I had to remind him there was a switch at all. ๐Ÿ˜„

#

Even better to confuse: the switch on the CPX is a toggle input, not power. ๐Ÿ˜ƒ

#

I have it working. It means the sound_level and loud_sound will not do anything if start_tone is playing and hasn't found it's matching stop_tone yet. Still works with play_tone. It makes a clicking noise if you try to use loud_sound/start_tone at the same time because it's blocking it. I can document that.

slender iron
idle owl
#

Thanks for doing the notes and video @slender iron!

slender iron
#

no problem @idle owl !

idle owl
#

@slender iron I managed to crash it into safemode earlier multiple times with trying to do the sound_level and playing at the same time. I'll still file an issue on that. But I did get the lib into a working state so I'm going to update the PR. We can use this version for freezing into 2.x - Dan said we're unlikely to fix this audio issue in 2.x, so I don't see why we can't have this version of the lib frozen into 2.x and then an updated version eventually frozen into 3.x.

slender iron
#

issues for safe mode crashes would be good

idle owl
#

yah

spare storm
#

Cool, thanks again @timber mango!

weary spindle
#

@tulip sleet question on building circuitpython : your Building Circuit Python document is excellent ( thank you very much ) i have one question in regards to supporting other SAMD21 variants ... i need to work with the SAMD21J18 ( note the J and not G ) following your guide i have been able to build circuit python for boards like the feather_m0_adalogger or basic on windows without a problem. But for the board i have i need to change the device to the J18 vs G18. And when i try to do that I get build errors in regards to the number of parameters for macro's TC and PIN and there is also the Endian multiple referece due to the samd21j18.h file and its definition. The endian issue can be fixed but i am not sure where to start in understanding why the macro's are incorrect. I understand Adafruit does not have any boards with the J18, so maybe no one has tried this. I just wanted to know if i should expect to be able to switch the device to the J18 and be able to properly build. One should be able to just switch the device reference in the files for the basic or adalogger to samd21j18 and see the issue. I did not try to add addtional pins that are available on the J18 at this point. .... i am using the latest master branch ... A long time ago i asked a similar question but was taken off the project and never did figure this out, but now i am back on the project again, so starting over with the latest master branch. If you have any suggestions that would be very much appreciated. Ken

lethal abyss
stuck elbow
#

@lethal abyss just import it in your main.py

#

@lethal abyss there is an example main.py in the repo

#

basically copy all the files except for game.py to the board

lethal abyss
#

@stuck elbow oh... I tried the import but was from the REPL. I understand my mistake

stuck elbow
#

should work from repl too, I think

#

unless you get a memory errror

split ocean
#

thanks much @timber mango !

#

@hollow ingot just watched your intro video, very nicely done!

river quest
idle owl
#

@solar whale I cancelled the PR, separated out the 3.0 updates and resubmitted. The sound stuff isn't going to happen right now. The lib still won't work without touchio being removed and the updated version of LIS3DH, but it's ready.

manic glacierBOT
idle owl
#

@solar whale Thanks for all your help this weekend, and sorry for what turned out to be a rabbit-hole.

solar whale
#

@idle owl no problem. It was fun to participate. Rabbit holes can be very educational spaces!

raven canopy
#

@weary spindle while the samd21j header file is in the repo's ASF4 folder, it could possibly be quite an undertaking setting up the PMUX and periphs. could you put up a gist of the exact errors you're getting? might help us help you pinpoint a way forward.

tidal kiln
#

@solar whale remind me again where the i2c bitbang updates are included. are they in latest release, or do i need to compile from head?

idle owl
#

@raven canopy You need to remind me of these things ๐Ÿ˜„

#

Starting to look at it now.

solar whale
#

@tidal kiln youโ€™ll need to compile the current master

raven canopy
#

@idle owl isn't that what i just did? albeit passive aggressively? ๐Ÿ˜†

#

and you got plenty going on. that guide is in no hurry...

tidal kiln
#

cool. will give me an excuse to finally update my setup so i can build again.

solar whale
#

@tidal kiln good to get up to date, but let me know if you just want a .uf2

idle owl
#

@solar whale I feel like some of the memory errors would have gone away with the libs frozen, but eh. I guess it's not worth fighting with right now.

#

Plus I don't remember how to build with updated frozen libs. Or know whether I even remember how to build 2.x.

solar whale
#

@idle owl hard to say. But probably best to wait before going to full battle mode on it๐Ÿ˜

idle owl
#

Yeah exactly.

tidal kiln
#

@solar whale make BOARD=feather_huzzah ?

solar whale
#

To build 2x checkout 2.x branch and do git submodule update step. Also re-make mpy-cross

#

@tidal kiln in ports/esp8266. Just make clean then make

tidal kiln
#

things moved? 2.x vs. master?

solar whale
#

@tidal kiln just realized there is no .uf2 ! Just a .bin

tidal kiln
#

in 2.x branch there's no ports/esp8266

solar whale
#

Yes 2x has no ports top lever folder

#

Are you doing 2xor 3.0 . New bitbang is only in 3

tidal kiln
#

yah, after new bitbang. wondering why you said to checkout the 2x branch?

solar whale
#

That was for @idle owl

idle owl
#

Yah me.

solar whale
#

Sorry

idle owl
#

I guess I was on the right track there at least.

tidal kiln
#

ha! np. perfect how the discussion was so similar. ๐Ÿ˜‹

solar whale
#

I was clearly looking at her when I typed that ๐Ÿ˜‰

tidal kiln
#

huh. realizing i've never actually built for esp8266. looks like i need some tool chainery i don't currently have...

raven canopy
#

yep. and it takes a minute, or 30+....

idle owl
#

@raven canopy This review is long but it's not because there's a lot to it, it's because it's turning into a conversation with you with myself. What with it being one sided over here. ๐Ÿ˜„

raven canopy
#

๐Ÿ˜† i knew if anyone would get EVERY single snark, it would be you...

tidal kiln
raven canopy
#

@tidal kiln yep. building esp-open-sdk seriously does take like 30 minutes.

tidal kiln
#

hmmm. so....how 'bout that .bin?

raven canopy
#

lol

idle owl
#

All about that .bin. No .uf2. (sorry.)

raven canopy
#

if i didn't have a ton of local work sunk in right now, i'd build you one. (windows woes make updating treacherous)

solar whale
#

@tidal kiln sure . Just a minute

tidal kiln
#

thanks. i'll still launch a build. what option should i do for STANDALONE ?

solar whale
raven canopy
#

@tidal kiln STANDALONE=y, but it default to yes iirc.

solar whale
#

if you are rebuilding the SDK the STANDALONE=y

#

yes - should be default

tidal kiln
#

yep. looks like.

#

ok. make hamsters are spinning. while they're at it, will try that .bin file. thanks @solar whale

solar whale
#

no problem -- good luck!

idle owl
#

blergh.

#

Just putting that out there.

tidal kiln
#

yanny?

raven canopy
#

i don't know. i think i might have heard laurel...

idle owl
#

oi to both of you

solar whale
#

My daughter's name is Laurel -- this has been fun ๐Ÿ˜‰

ruby atlas
#

i kinda want to make a hamster wheel CPU utilization meter.

raven canopy
#

"I have made an animated circle in Terminal. You are welcome, humans." ๐Ÿ˜„

ruby atlas
#

but suspect it would be too noisy.

idle owl
#

@solar whale oh no! lol ๐Ÿ˜„

raven canopy
#

i read a really good technical article on the whole deal. was on slashdot, i think.

solar whale
#

@tidal kiln check the build version on that . bin ```
Adafruit CircuitPython 3.0.0-alpha.6-149-gbe12e07 on 2018-05-21; ESP module with ESP8266

idle owl
#

If something exists on the internet, there's a technical article about it. Right?

ruby atlas
#

or fakenews

raven canopy
#

i sure hope so! otherwise...why?

solar whale
tidal kiln
#

@solar whale the only thing different in my banner text is date. 2018-05-19

raven canopy
#

note-to-self: if you want to debug a chip, it helps to connect it to the debugger. ๐Ÿคฆ

solar whale
#

Don't know if you are using a Linux system (may also work on MAc) but I love the esp8266 make PORT=/dev/ttyUSB0 deploy

#

@tidal kiln -- you're good then

ruby atlas
#

This color LED rabbit hole is very deep

solar whale
#

Yikes - I just thoughtthey were pretty lights ...

tidal kiln
#

@ruby atlas nice find. i've never seen that.

ruby atlas
#

I've been aware of human perceptual sensitivity discrepancies, but also knew that RGB(W) spectrum from LEDs varies by product (and even by batch). Combine that with, say, wanting Red and Orange and Yellow at the same luminance, you've got a lot of fun things to juggle.

#

And with playing with simple colour loops that don't adjust for these, it's really obvious to my eyes right now.

solar whale
#

@tidal kiln to cahnge the deafult timeout for bitbang clock-stretch i2c_bus = bitbangio.I2C(SCL, SDA, timeout = 5000) will give 5 ms timeout. My guess it it won't help.... rather try slowing the clock -- frequency=100000 fo 100KHz - default is 400KHz

tidal kiln
ruby atlas
#

If anything, the gamma table made things worse without total (perceptual) luminance adjustment.

idle owl
#

Those eyes are nothing short of creepy.

#

I kind of want one in my front window.

ruby atlas
#

I want one before Oct 31

#

๐Ÿ˜ƒ

#

I've also been wondering how big a neopixel driven "TV" I could build with 3d printed diffusers.

#

(or dotstar)

tidal kiln
#

@solar whale which version of the bundle lib(s) should i work with?

solar whale
#

I'd go with latest, but I don't think it matters much - no changes there for this.

tidal kiln
#

ooo. toolchains built.

raven canopy
#

time to figure out din din. don't break anything without me! ๐Ÿ˜„

tidal kiln
#

@solar whale is default timeout same as previous? i.e. if i don't specify it, it behaves as before?

solar whale
#

@tidal kiln correct - default is 255microsec -as before

wraith tiger
#

Someone should make an Eye of Sauron version of the giant eyeball.

tidal kiln
manic glacierBOT
solar whale
#

@tidal kiln not surprized -- and since it is < 255 microse, the timeout change won't help.. tryl the lower frequency

tidal kiln
#

tried both

solar whale
#

rats. sorry. not much I can offer.

tidal kiln
#

specifically, tried with these:

i2c = busio.I2C(board.SCL, board.SDA)
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
i2c = busio.I2C(board.SCL, board.SDA, timeout=1000)
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000, timeout=1000)
solar whale
#

try slowing it down to 10000

tidal kiln
#

๐ŸŽ‰ works!

solar whale
#

woohoo!

tidal kiln
#

i did nothing with timeout

#

so must've been a bus freq issue instead

solar whale
#

prbably no need

#

yup -- taht is waht I saw with CCS811 as well

#

not sure how 10Khz will impact performance -- you can try raising it until it breaks.

tidal kiln
#

cool. let me try the actual bno055 library now. i was just testing by creating an I2CDevice...

solar whale
#

Good luck - fingers crossed - this is a popular sensor!

tidal kiln
#

no luck with the lib ๐Ÿ˜ฆ

#

it doesn't error out, but return values are, it appears, all 0

weary spindle
#

@raven canopy here is an example of the build error when trying to build for SAMD21J18

             ^```
```samd21_pins.c:502:17: error: macro "PIN" requires 8 arguments, but only 6 given SERCOM(5, 3)),
                 ^```
I will dig deeper into this.  Just was wondering if the experts could point me in the right direction, or had seen something like this before
solar whale
#

@tidal kiln I took a quicklook at the data sheet and it did not have a minimum I2C speed so I was hopeful...

tulip sleet
#

@weary spindle I only have a minute but I think it there are just some typos for PB22 and PB23 in those files. We changed the macros but forgot to change those. You can probably drop the third arg to TC. On line 502 there is an extra paren by mistake.

tidal kiln
#

@solar whale the clock trace should be at the set frequency, correct? (or close to it)

solar whale
#

That's what I would expect

#

But I am hardly an I2C expert

tidal kiln
#

rising edge to rising edge?

#

i'm only getting ~100kHz at default setting

solar whale
#

checking code