#circuitpython-dev
1 messages Β· Page 131 of 1
I chose the wrong dropdown option first time
okay then. magic
Merged and release published.
yeah
Updating the list now.
@idle owl fyi, old CPX mic starts responding with non-zero data in 10 msecs, new one takes 100 msecs at 16kHz. so I'll see about keeping it running all the time or delaying longer
it's not spec'd to do that π
Ahh
Yeah the old one was happy with 160byte buffer for the sound meter
That explains so much
do you think waiting 0.1 seconds before recording is too much?
I don't think so no. In realworld time that's negligible and if it means actually capturing data vs not capturing any, it probably makes sense.
I mean obviously in programming time that's huge. But we're trying to make this work.
i'll look at running all the time vs just waiting. it does explain a lot of the issues. And I am going to look at the filtering code.
How'd you finally figure all of that out?
i instrumented the recording code so it would check for non-zero buffers of data and print out how long it took before one showed up. One really weird thing is that with the old mic, it takes ~10 msecs regardless of the sampling frequency, but the new mic it's roughly proportional to the sampling frequency. This does not make a lot of sense with the old mic, since I'm not sure how it knows how much time has passed unless it has its own internal clock, which seems unlikely (but maybe not).
Wow. Nicely done. And that is really odd.
I mean anything we do for the new one should work with the old one, but not vice versa so it makes sense to code for the new one
i'll get back to you tomw about touch api stuff
Oh I got some more help!
How do you guys paste code into the REPL?
..with all those auto-indents causing a stair-stepping effect (killing proper syntax that was in the original paste-in code from the other -- text-editor-- window)?
@sommersoft I was thinking more of an os.id() than tacking it on to os.uname()
Our general philosophy is to match the regular Python's libraries as much as we can, without enhancing or changing their API's, so that code can be ported more easily. If you can suggest an existing API call that returns a unique ID for the current machine, that would be great, but I'm not sure there is one. There are some ways to get a MAC address but they're not straightforward.
Yeah, uuid (MAC and other unique id's) doesn't really fit this case either, and definitely wouldn't be rec...
A Feather M0 Express would also work.
For the ESP8266, I think writing it as an int to all four positions on a list would work to allow anything that cares about such things to pull it. No, pulling the same thing four times isn't going to give the same results as an actual SN that's four different ints, but it would let the code work at least.
@cunning crypt I missed your comment while writing mine (had to verify the ESP stuff). I think with what @tulip sleet was saying with remaining recursive with Python (and probably MPy), it makes better sense to use microcontroller. We would be adding
to the os API...
Yeah, that makes sense.
The only reason I brought up os was because there was already some board info there, so there's somewhat of a precedent.
hey, i was right there with ya. π
@timber mango mostly I just avoid cut/paste when indentation is involved! You can try βpaste modeβ by entering control-e https://github.com/adafruit/circuitpython/blob/master/docs/reference/repl.rst . I have not used this myself so I canβt comment on it. What board are you using. If it supports a usb file system I find it simplest to just copy a new file over and import it.
@timber mango I ran a quick test of paste mode with some indented code and it worked: note: contol-e to enter then contol-d to exit paste-mode and execute the code. This was for CP2.1.0 but for CP 3.0 the copy/paste buffer is limited to 128 bytes so only a few lines fit anyway.
@Andon-A
I'd prefer it returning the four words as a list.
What do you think your use cases would be for the UID? The basic integer type is 31 bits (including sign bit). Only some CircuitPython impls are going to provide long ints due to code space issues. So just a lis of integers won't always work. Would an array.array('L') work for you?
Hi, I published my code to play RTTTL songs on Trinket M0 and Gemma M0 using pulseio rather than audioio that is only available in Express board.
Best would be to do something like that in Adafruit RTTTL library...
I don't know if I want to put my hands in there.
@timber mango You may want to try the RTTTL thing I just published in previous message. It could drive your Piezo.
@solar whale Thank you. I didn't realize I could import my own file (haven't figured out what that does, but it does something useful). It (ex. 'import main' for the file, main.py) completes without a complaint from REPL, which is encouraging. Doesn't quite do what I thought it might do, but it's (again) providing more capability, than without it. I'm used to interactive programming (forth interpreter, mostly, these days). I'm not used to typing stuff just to get it into an interpreter's vocabulary, but this is embedded, after all. π Some tethered forths use address calls and a very simple kernel resident on the micro.
Will look at the Control E and D thing, thanks! Maybe an ASCII upload would simplify things, there (to keep within the 128 byte boundary of the buffer).
I guess I just wanted to know how people are making do with the limits of this schema -- what tricks and techniques to make the environment most useful.
I found it was helpful to type each line of source code at the REPL prompt, for trying to understand someone else's code (especially, as is often the case, where a change has to be made, such as from dotstar support to NeoPixel support (or to drop support for color LED output, entirely).
Loading main.py doesn't quite replace that, the simple way I do so (Control D to reload). I don't understand why, though between this being a microcontroller environment (and not a desktop PC) and something else (that just slipped my mind) .. well, that it was designed by smart people, let's just say .. I would like to understand it.
Thanks again. -nis
@half sedge I just read up on RTTTL the other day. Probably in response to one of your recents, here. Thank you.
@half sedge It'd be great if you could integrate it into the Adafruit RTTTL library
@slender iron I believe a I raised a few unaswered questions on how to do that... Do you want to not use audioio anymore from RTTTL library? This mean both Express and non Express board would use pulseio.
I'd prefer the ID be bytes because its immutable. Its also very similar to a list of ints which are 0-255 each. Its a sequence so you can do indexing and such.
@half sedge take a look at how simpleio does it. It tries to use audioio but if it throws an exception it falls back to pulseio
@idle owl why do you need a separate API for the threshold stuff?
can't you just to cpx.touch_A1.threshold += 200 directly?
@slender iron No, it doesn't work that way, you have to call the private version of it and it ends up being 18 lines of code including the init required
ah
17 I guess.
This seemed like a much more elegant solution. There if needed, but not built into the touch stuff so it's not in the way.
adding the list of touch pads to alter feels too advanced to me
Hmm that was a lengthy discussion between Dan and I. The issue is that you have to initialise them, and if you have it init all of them at once it means if you use the threshold thing, you can't use those pins for anything else.
So if you wanted to use fruit and a servo, you'd run into a problem if you needed to change the threshold
that way you can choose which pins to alter, and only initialise the ones you're going to use for touch
is why we went that way with it.
Oh and the other issue is, if one of the pins is already in use, threshold will fail completely if it inits all fo them at once vs choosing which ones based on your use case.
@idle owl why do we need the threshold in the first place? is our thresholding code at the start just bad?
@slender iron Once you attach fruit it's way off. Remember I ran into that when I was trying to finish my project? 3 hours, and having to angle all the alligator clips in really weird ways so they didn't interfere with each other. JP ran into the same thing, everything wa activating, nothing was fixing it. Threshold did
could you keep track of the touch pins already used and threshold those only?
@timber mango BTW - I have been a forth user fo many years. It makes an excelleant test environment for early hardware checkout.
not that I know of because they're only init'd when they're called
do you adjust the threshold before actually reading them?
no, the threshold API intiialises them and then gets the touch data
then adds to it
The default right now is +100
JP said it worked best at 800-1500
to give you an idea.
I don't know if it's something about fruit and the CPX or what
but I ran into the same issue.
so I don't think your code is bad, I think it can't handle the number of variables that come up with different uses of cap touch on these boards. Directly touching Gemma must act differently than the CPX fully wired up to a fruitbasket.
etc.
my issue is the complexity of passing in the list of what you'll use
hmm.
instead what you can do is save the threshold value in a separate attribute and add it any time you initialize a touch pin later
and you can also add it to any existing touchins during the call
so add it as a default thing to the current touch stuff? I'm not sure I have any idea how to do what you're suggesting. Which is a me thing not that it can't be done.
could we just adjust it internally always?
internal to the cpx library
I'm surprised the threshold is a fixed amount now
I'd expect it to be a percentage
Yeah. But I don't know if it'll always work for both cases. I seriously think fruit make the threshold need to change. At least in 2 cases I know of. But I can go that route.
both being with and without things attached
if the threshold computation was based ont he first read value it would change if fruit were attached
hmm... what if we make it default to doing all the pins, but if you wanted to use only some, then you could change that list? I have no idea how to do that either but it seems like something that's possible.
I did raw_value printing too and it changes, but the differences are huge.
I don't understand it. The limes I used, I could hover over them from an inch away and set them off
so if they were w/in 2 inches of each other, they'd go off constantly
or something close to that
let me sketch out what I'm thinking
Like would def adjust_touch_threshold(cls, adjustment, pad_names=["touch_A1", "etc"): cause it to default to using that list but then you could edit it in your code if you wanted to like you can with other parameters
ok
didn't test it but thats the idea
ok. I'll test it.
does it make sense?
Kind of? The part I'm unsure about is whether it'll work because of when/how it initialises the pads and calibrates. Because it has to calibrate when they're init'd and Dan explained it to me yesterday but now I'm unsure about it, whether it will init while you're still touching it and then that'll throw everything off because it'll have the raw_value assuming you're not touching it.
yeah, it assumes you start the program when you aren't touching it
TypeError: can't convert 'int' object to str implicitly It's an issue with this line, PyCharm is unhappy with it too: for pad_name in ["_touch_A" + x for x in range(1,8)]:
the first x
TypeError: unsupported types for __iadd__: 'TouchIn', 'int' line 173 in touch_A1.
wait...
π¬
Figuring out errors Me: 4. Needing someone else: a billion. π
you got it π
I can't get it to stop working when increasing the number. I don't know if it's working. The code runs though.
Wait, I think I got it to act differently at least
Yeah I did. It's subtle without fruit in the way, but it's changing.
Just alter it in the same PR? Or should I pull the PR and start over
I'll make a new one.
@idle owl @slender iron maybe we can have a 3-person discussion on this?
(I just opened up discord after doing some other stuff.)
I'm about to head to the farmers market
what are your thoughts on it?
@idle owl same PR is preferred to hold the history of the changes
well... I think a lot of the current complications are due to the touch API being a little "too simple" right now. If you had access to the TouchIn objects implicitly, you could access the threshold directly. Otherwise we're adding duplicate stuff to cpx that's already implemented in TouchIn
thats ok, next time
cpx is meant to be simple though, at some point why not just use touchin?
Maybe JP's code should instead of using only Express
I really like the idea of having this available in cpx in some way.
yeah I do too, but I don't like the user having to know about the threshold
the old threshold was 2x initial. That was too insensitive. Limor suggested the Arduino choice, which was +64 over initial. I made it +100. But what it needs to be varies a lot depending on the application. as the leads get longer and the capacitance increases, the variance between touch/no-touch actually goes down, so a percentage goes the wrong way.
ah interesting
The adjustment JP needed was huge.
I think we really need a constructor argument to TouchIn for it. that way we don't need new version of circuitpython to change it
when the capacitance is high, the touch/no-touch difference can be just a few points diff.
so a threshold_delta argument or some name like that
ok so what does this mean for what we're doing right now. Either we get this in or JP can use the 17 lines of code necessary to do it individually without changing cpx. Both of the API solutions seemed good, one has been tested in situ, the other hasn't yet.
but cpx doesn't have a constructor for the touches.
can you post JP's code
cpx does internally because they are lazy inited
I don't think I have the current version with that stuff at the top
I do not
It's the thing you told me yesterday for calling the "private" function out of cpx in the code.
yeah, so where do you give the new threshold delta? maybe you have tos set it before you use any of the touch_Ax's
I think having an adjust method is ok
or, when you adjust the threshold, it changes it on the existing ones and remembers it for future ones
@tulip sleet thats what my example does
i missed your example, didn't scroll back far enough
So go with that?
there are bugs in it but thats the idea
@idle owl thats my vote
I do believe its inevitable that we need a knob for people to adjust it
It ends up looking in the code like it did in the first place with what I started with before we realised it would init them all and keep them before we wanted it to.
fruit and environment has too much impact to do it well automatically
yeah. Well, this is a code knob.
yup yup
will you be back later
ya, I'll be back in a couple hours
yeah, that looks good to me, don't know what the bug is
no .threshold and no str
kattni found and fixed the bugs
It's fixed already
ah ok
I'll reopen the PR, I already restored the branch, just need to figure out how to get it back locally because I -D'd it from here.
Or I can just start a new one.
if you fetch it'll be available under <remote name>/<branch name>
ok
then you can just check it out
and hten you can checkout -b to create a local version
git's so great. Delete everything everywhere, panic, and then restore it all.
@idle owl btw, I can make the mic run all the time like you proposed. Limor did that too in some other code and it works fine, so no issues on different mic parts
yeah, the clocking is separate from actually having to read anything. I tried it and it works perfectly.
That's exactly what I was thinking/hoping would happen
thats great news @tulip sleet !
And that means soundmeter in the API!
Limor was up until 3am rewriting the arduino PDM code
ok, I'm off. will check in once I'm back
@tulip sleet It worked a bit ago but now I'm getting an error. python def adjust_touch_threshold(self, adjustment): for pad_name in ["_touch_A" + str(x) for x in range(1,8)]: touch_in = getattr(self, pad_name) if touch_in: touch_in.threshold += adjustment self._touch_threshold_adjustment += adjustment Should it be self.adjust_touch_threshold? And be changed in all the touch methods too? Or is something else wrong
Error 'Express' object has no attribute '_touch_threshold_adjustment'
Wait I found it
that was set in line 113 in scott's code
It wasn't added to init
yeah
I have no idea why it worked before
Cups of water work for testing!
It works exactly as it should. Way too sensitive without an adjustment, perfect with adding 600 in my case. And fails at 1000.
pylint passes 10/10, Sphinx builds.
@tulip sleet If you get a chance, can you review it and merge it?
np - it's good to have multiple people thinking about this
Creating a release now.
@tulip sleet How did we get the zips set for the different versions? The only assets I have on that release are the source code zips.
Because we just missed the autobundle creation. It was released an hour ago.
@idle owl @tulip sleet Wow! Great job today! Dizzying π
Oi I was just saying that! Started yesterday at 4pm with this, what a whirlwind
All I did today wa retile a bathroom floor and reinstall a toilet - I feel like such a a slacker π
That's not slacking at all! Well done you!
No leaks - I am thrilled!
nice!
I have been peeking at the discord site throughout the day - It has been amazing to watch.
Now I have to update all my boards!
I'll have to go back and update my first guide at some point. This change was very needed at the end of that.
@idle owl I can release a new bundle if you want it
@slender iron That would probably be great for JP
More consistent
if that's even how he wrote it up, I'm not sure.
@solar whale this is starting to sink in. Very helpful to find:
https://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/repl.html
to suss out some of the rules of the road for the REPL.
ASCII upload worked fine. There's a confirmation prompt in the REPL once Ctrl+E is pressed on a newline:
paste mode; Ctrl-C to cancel, Ctrl-D to finish
The source I uploaded (in minicom, a terminal program similar to the old Procomm) was accepted without incident. Maybe the 128 byte limit is prior to a CR/LF sequence -- seems to reset and accept all lines of a source code document uploaded in this way.
The program ran as expected!
https://github.com/wa1tnr/ainsuForth-CPX_fs-exp
is the port of YAFFA (Yet Another Forth For Arduino) I've been working on. It has primitives to store source code (in ASCII plaintext) on the SPI flashROM of the CPX.
@timber mango What board(s) are you using for CircuitPython?
@tulip sleet @slender iron I recall some discussion about the 128 byte cut/paste line in CP 3.0. Is that likely to be increased? Just curious. I'm not advocating for an increase, but if the 128 limit is to stay, it will severly limit the usefulness of "paste mode" and it probably should be made known.
@solar whale I have all of them. π The entire product line, I think.
Thanks - I'll check the issues.
oh, Scott's back, probably with kale
What's the recommended sequence to power off Feather M0 Express (as when recovering the host PC's USB port for use with another target such as Metro M0 Express)?
@timber mango on what os?
CircuitPython.
host machine os
if you haven't written a file in the past two minutes, just unplug it, otherwise maybe press eject in the nautilus window, or type sync
and then pull the plug
I'm using Nautilus so that's a win for me.
the little triangle in a circle
If I run into problems I'll ask again. Looks like it'd work fine. Thanks.
two minutes might be overkill. 25 seconds might be enough. I don't usually bother to do anything unless I've just written one or more files.
two minutes is true on Windows, so there Eject, or Safe Remove from the taskbar icon
A sync at the command line would flush it or is that unreliable here?
Mac seems to write everything pretty much immediately. sync is fine; sync -f maybe to write all filesytem data out
I found ~ 30 sec to be the needed for gedit - your mileage may vary....
I'm editing using rvim in another terminal.
The target board responds immediately after every :w! in vim.
I mostly avoid editing on the USB files sytem. I edit loaclly and copy. Gives me a backup. But I still wait a few mintes and eject the USB drive before powering off. I also stand on my left foot π
Haha. I hear you. I do that when I put my hand near a live wire in the house. Right foot, though. ;) π
@idle owl I released a new bundle
Thank you!
@timber mango the file data gets written mmediately, but the file metadata (which blocks are used) may be late. CPy triggers a restart on any write. it waits 0.5 secs, but not more.
@slender iron I tested INA219
π please comment on the PR
That's the plan
great!
I've been doing it as I go
Later! Thanks for your help!
no problem!
adios
@dhalbert To be extremely specific, what I intend on doing is making an example for how Python can be modified without the need to recompile. To accomplish this, I wanted to have a way to have the device create a program unique to it, using the device ID. I would prefer a device ID call that returned the same data type and size regardless of MC
Trying to get COM to work with my new Gemma M0, on Windows 7.... In trying to follow with the readme's suggestion to try the keyboard. I have installed the drivers, and it shows up in Device Manager as COM6. Speed is 9600, data bits 8, no parity, 1 stop bit, no flow control... I have used PuTTY before (for SSH), but setting all the serial options doesn't seem to work. Anybody have suggestions?
I think the speed should be 115200.
Looks like that worked, thanks!
Yeah! Great job!
What do you think your use cases would be for the UID? The basic integer type is 31 bits (including sign bit). Only some CircuitPython impls are going to provide long ints due to code space issues. So just a list of integers won't always work.
I'd prefer the ID be bytes because its immutable. Its also very similar to a list of ints which are 0-255 each. Its a sequence so you can do indexing and such.
As far as I can tell through digging in each boards' structures so far, the ESP82...
On Circuit Playground Express, the speaker is connected to A0. But it seems I can not do pulseio on A0. Is there a digital equivalent to A0? I mean another name that would be a digital output connected to that same speaker?
@half sedge you can do digital io on the Ax pins. They will do both analog and digital. You don't have to use a Dx name. e.g. DigitalInOut(board.A3) is fine
Yes @tulip sleet but I am particularly interested in A0, because there is already a buzzer connected... and it seems to refuse A0. Right now I have been playing 10 to 20 xmas tunes on another pin... and I can not support it anymore. π Anyway, it is time to sleep for me now.
May I suggest an update on the following page: https://learn.adafruit.com/circuitpython-basics-analog-inputs-and-outputs/pulse-width-modulation-outputs
"Note that not every board and build of CircuitPython includes PWM support. Currently the Trinket M0, Gemma M0, and other non-express M0 builds do not include PWM output support. Youβll need to use a bigger board like Circuit Playground Express or Metro M0 Express to access PWM outputs."
This is not true and not up to date anymore.
Regards.
@half sedge the speaker is permanently wired via a cap to A0. do you mean you haven't been able to use the speaker? If you want to sleep, get back in touch later, np.
I have not been able to use the build in speaker... I connected a buzzer on other pin. I'll review/retry tomorrow and report if it continue to make sense.
You need to make board.SPEAKER_ENABLE high. make it a digtial out and set it high
that enables the amplifier connected to A0
see for isntance code here: https://learn.adafruit.com/adafruit-circuit-playground-express/playground-drum-machine?view=all#playground-drum-machine
@half sedge fixed the obsolete remarks about PWM not being on every board. Thanks for catching that.
@slender iron Just checking - is there a weekly today?
yup!
Thnaks - talk to you then.
<@&356864093652516868> Our normal weekly meeting is in 2 hours at 11am PT / 2pm ET here on Discord! Talk with you soon!
Taps mic Hello is this thing on?
Hi everyone! Sometime in the near future I'm going to take a look at GitHub and the learn guides and see if there's anything needing drivers or whatnot.
@formal plover Welcome back - brace yourself. There has been a whirlwind of recent activity. No shortage of things to be done, but you will be amazed at what has happend in the past few months.
Thanks @solar whale! Oh I'm sure there has been. Every time I tried "checking in" here I'd miss over 1,000 messages just after a few days
@errant grail from #help-with-projects "If there's a way to adapt your project to CircuitPython, you'll be surfing on the most narley wave in this ocean."
CPX is apparently back in stock.
For now.
Exactly
@raven canopy want to join?
That was a failed experiment. Phone + old concrete building = choppy robot speak on discord.
Join the robot revolution!
will record it so you can listen later if you like too
@jedgarpark noticed this!
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit Trinket M0 with samd21e18
>>>
>>> round(1.0)
0
>>> round(2.0)
0
>>> round(3.0)
0
>>> round(3.2)
0
!?
He's still using 2.1, and the fix is in the newer unreleased version of CircuitPython.
oops - ok thx! whee :)
heya was delayed
All good π
yah!
i did a bunch of work on PDM mic, dan is being awesomely helpful
john park is writing up some guides for Adabox 006 which is CPX based
its already shipped π
too late!
MUAHAHA
(mine arrives today!)
and tested a bunch of drivers that are linted
thank u all! sorry i am a spoiler
thats it π
I think I spoiled it first... oops
(I expected it and am very happy about it)
π
Adabox should have the Spanish Inquisition in it. Nobody would expect that!
lol
I thought a thing was added to accept a list of single character variables, and i is included.
x , y, z ?
is it case sensitive?
why "Run"?
"i had a problem. then i added a submodule. now i have 2 problems" π
can you have travis follow a link? e.g. point it at a gist
tox
i like that we're getting the 90% top issues. tabs/spaces, snakecase, etc
Yeah
chasing the last 10% takes a lot of energy, maye better used for writing libraries & guides
yeah, not blind adherance to picky rules
pylint isn't a ruthless dictator - you can ignore it when you disagree π
https://github.com/openstack-dev/hacking <-- those are extra rules we use
they are not difficult to write
oh nifty
like a curriculum
Ah ok
we can update the learn guide categorization
ok ill ask learn dev to do that today
When you click on Learn, it's in that main list, that's what has been asked for
https://www.adafruit.com/circuitpython landing page, could be improved
I agree. Putting the "Welcome to CP" plus some other introductory Learn guides right above "CP Products" could work well
agree also, do what tony's suggesting on that page
why is MAX7219CNG even there, it doesn't even have a guide for micro/circuitpython
it has a driver
ah, ok
It doesn't show anything on the page for it though. No links to CP drivers.
gotta go to next meeting. l8r!
later!
Enjoy!
tah!
thanks @meager fog !
Well, as much as you can enjoy meetings.
yeah i have to run to meeting now too
later!
thanks @timber lion !
Very cool, @solar whale
import errno
pylint --list-msgs
@tulip sleet I tried to make A0 a digital out... but no success:
'''
This is tested on the CircuitPlayground Express
import board
import pulseio
import time
from digitalio import DigitalInOut, Direction
enable the speaker
spkrenable = DigitalInOut(board.SPEAKER_ENABLE)
spkrenable.direction = Direction.OUTPUT
spkrenable.value = True
Works with board.A1 and fail with board.A0
speaker_pin = board.A0
pwm = pulseio.PWMOut(speaker_pin, variable_frequency=True, duty_cycle=0)
pwm.frequency = 440 # Set frequency
while True:
pwm.duty_cycle = 32767 # 50% duty cycle
time.sleep(1) # Beep take 1 s
pwm.duty_cycle = 0 # Stop playing
time.sleep(1) # Delay 1 s between beep
So as suggested, A0 can not be used with pulseio.PWMOut on Circuit Playground Express.
that is correct you cannot use A0 as PWM, it does not have a timer
but you can use analog out on it
@meager fog I wanted to ask before digging into the datasheet, is it possible to run the samd51 the same way samd21 runs on the trinket m0, with internal oscillator only and synchronizing to the USB clock?
@untold arch maybe you know off the top of your head
if not, I'm happy to search for it
@stuck elbow @meager fog So "my" RTTTL for Trinket M0 (and Gemma M0) can not use the build in buzzer (speaker) on the Circuit Playground Express.
I was suggested to adapt my code for the Adafruit RTTTL library. This make no sense, now.
@half sedge ouch, that is unfortunate indeed
sorry for not realizing this earlier
hmm... I wonder if the SPEAKER_ENABLE pin supports PWM...
and how bad it would be
you would replace the tone() with a sinewave generator
see the waveform library! its similarish
yes you can use USB sync on samd51 - the samd51 has serious clock sync issues in silicon 0
thanks!
i made the mistake of mixing bundle libraries from 2.1 and 3.0beta. My Metro M0 will no longer mount as a drive. i can get to Boot mode, but not to run mode. so i need to wipe the code area of the eprom. i think there is a way to do right?
@fading solstice I'm surprised mixing libraries broke the file systems
@fading solstice I'm surprised mixing libraries broke the file systems
@idle owl I'm ready when you are
me too
@fading solstice I'm surprised mixing libraries broke the file systems
@slender iron Waiting on a callback. I'll give them a few more minutes and if I don't hear, I'll have to deal with them another time.
no worries @idle owl
i was doing some testing for pylint over ds3231. The register library was complaining about no "readinto". So i think i placed a 3.0 version of that library on there. as soon as a did that the board went deaf and blind.
huh, interesting
i just need to wipe the code area and start over with that. i might have to wipe the whole board and put the boot loader on there
yup, sounds like it
ok. using bossac?
thx
@slender iron by the way, is there a chance for the vector versions of Blinka to be published somewhere?
yeah, let me do it now
I wanted to re-do the pcb, but a bit larger, so I can put a battery on it
Eh bugger it. I'm sure they'll call as soon as we start talking. I'll deal with it another day. I knew today would be a bad idea, but I tried anyway.
@slender iron @idle owl Just move DS3231 from remaining to "needs review"
@slender iron if you are not doing Char_LCD is tony d?
@idle owl if you want to try the sound detector, here's a test 2.x CPX build with bug-fixed PDMIn recording. Min sampling frequency is now 16000. No waiting for samples needed: you should see good samples right away.
CPX 2.x with PDMIn bug fixes for mic recording.
@fading solstice I started it but stopped since @timber lion was redoing it. I think he might be done now though.
@tulip sleet I'll give that a try in a bit!
@tulip sleet So it's weird. It seems to be working but it's also giving me all 00s.
It spends the entire time flickering the first two pixels though even when it's quiet in here. But it responds to sound.
I can't get the flickering to stop. Changing the input_floor should fix sensitivity issues, but it's not stopping the flickering.
he released changes, i think i will discuss the pylint output with him.
@slender iron
Ok I printed the magnitude and was able to see that at it's base it's higher than I thought, so I changed the input_floor to a much larger number and it's stopped flickering. Still can't explain the 00s. Because it works right. It was all 00s before and didn't work right.
@timber lion i was going to do the pylinting of Char_LCD. is that all right with you?
@fading solstice Excellent regarding DS3231. I'll review and test it tomorrow.
@idle owl can you drop your code here? I didn't see zeros but I was playing tones into it from a guitar app.
was the buffer full of zeros at the beginning? mic.record(buffer, 160) or whatever?
I don't know
It's working like it's supposed to though. I had to increase the base value because it's so much more sensitive.
Wait... maybe I have the print statement in the wrong place.
There it is!
Yep. Had the print statement in the wrong place.
i'll try and get back to you, but sounds good!
For the record, I'd much rather have issues like this than have people not
file issues that haven't been fixed. So good work everyone!
On Mon, Dec 11, 2017 at 11:08 AM John Edgar Park notifications@github.com
wrote:
I mean no harm. ;)
β
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/issues/476#issuecomment-350825399,
or mute the thread
<https://github.com/notifica...
@fading solstice oh cool yeah totally good with me--i had just wanted to hold earlier because i was committing some big changes to add SPI and I2C backpack support. that's in now so it should be all good. thanks!
@timber lion @slender iron What's going on with neopixel?
what do you mean?
There's a comment thread that stops at some point about enumerate and I didn't want to simply test it and merge it without that being resolved.
got a link?
It's not clear whether the appropriate change was made or what the plan was there.
Yeah sec
oh yeah i wanted to call out switching to enumerate means a base micropython/circuitpython port won't work with the library anymore
since enumerate has to be turned on
IMHO there's nothing gained with enumerate in the library so range is safer to use
but it could go either way, i have no super strong opinion
it's a super easy thing to miss though with a new or slimmed down port
forgetting to turn on enumerate
I'm ok using enumerate because all of our supported ports would work
yeah IMHO it would be best to capture that requirement somewhere like a new starting from scratch port config header
or maybe just add a comment to the current one
are the tests just for atmel-samd?
no
i just wanted to highlight when someone starts from scratch with a new port, like nrf52, good to know turn on enumerate or else neopixels will fail π
this is the test I was referring to: https://github.com/adafruit/circuitpython/blob/master/tests/basics/enumerate.py
we could change it so it won't skip when its not available
yeah can't hurt to have the test for sure
@sommersoft thank you for the hugely informative post! Could you explain how the nvm module fits into your plans? I was thinking the uid would be accessible from microcontroller instead.
The uid is scattered around memory on the SAMDs. The USB code uses it here.
and probably want to give ktown a heads up, it doesn't look like nrf52 port currently has enumerate turned on
kk, I'll sync with him. I'd love to get an nrf52 going on rosie too
I'm working through my email backlog now and will mention it
so yeah @idle owl sounds like we're cool to take neopixel with the enumerate change
Ok thank you.
@idle owl I'm playing music next to it, looks good. I set curve up to 4 to make it be more responsive. I still find it a little weird that the magnitude is only varying 20-50 or so. "Don't Let Me Be Misunderstood" works particularly well π
but folks might want to be warned on nrf52 or maybe other ports it might fail π
@tulip sleet I had to set the base to 20 for it to not be constantly flickering.
@tulip sleet I left that out as a variable in the event we wanted to make it available.
@idle owl I reduced the 255 to 80 in the fscale call to make it more sensitive
and set curve back to 2
Dinner! Bbiab
@tulip sleet Ok so I want to check it on my original CPX because it worked fine as it was on that one and I'm not sure if those values will work
I was testing it with those values on a "KV1".
Oh ok
are you yelling in it or something else?
Music and yelling both. I didn't try it on the KV1 mic yet, my super high values were on the H016etc mic
I'm getting random flickerings up to the 4th NP when not playing music. hmm.
That's why I changed input_floor. The name of which needs to be change to "sensitivity" or something.
I was getting the random flickerings in a silent room.
trying above 20 up to 30...
I just changedt the KV1 to 30 and the flickering stopped.
I have it running on both, with fscale still at 255
input_floor increase low-end sens, decreasing the 255 will light more pixels
have it at 120 now
The pixels seem about right. I can get it to max no problem with it at 255.
yeah, but if you just leave it on the table and talk or play music is it interesting
With the input_floor at 27 on the KV1, and the other one at 20, they seem about the same.
So we might need to expose that variable.
you could read once before the while True loop and set input_floor to the min of that.
Ooh.
that is sort of a calibration (like touch).
also were you using frequency=8000 (was the default) before? 160 is now a shorter sample. could try 320
it won't crash now so any buffer size is fine
right
Omg you're right about lowering the fscale number! That's so fun!
mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, frequency=16000)
volume_sample = bytearray(320)
mic.record(volume_sample, len(volume_sample))
input_floor = max(volume_sample) - min(volume_sample)
I put that at the beginning. Then I forgot to pause the music before restarting, and wondered why it seemed insensitive.
Hmm kind of works on one and not the other
One is super insensitive, and the other one is reading at least 3 pixels at all times, and going up from there.
i see the same thing. the "H016" mike is more erratic or more sensitive or something
Yeah. The H106, if I print input floor at the beginning, it prints 0.
i was just going to say that
Explains why it's reading 4 pixels at all times.
the first buffer is all zeros
The KV1 is 29 for me, which is a little high I think
i put a time.sleep(0.2) before the initial .record and that fixed it. I think I may need to put a delay in the PDMIn constructor to allow the slow mic time to start up. The clock doesn't start running until you create the PDMIn.
Oh
we don't run the clock before the PDMIn is created. That starts it running (since we don't know where to send the clock pulses -- you might be using a differen mic)
I got 19 that time
@tulip sleet
Hi Dan, quick question, are those two functions, min() and max() taking tuples or a list.
The bytearray is throwing me off.
Having fun right now with mu and one of my micro:bits while kibitzing your comm. π
they take anything that's iterable, i think
a-ah. thought so. Thanks eh?
yw! e.g. min((range(20))
So they're not running equally but with the time.sleep they're at least responding.
you mean you have two side-by-side?
Yes
The two I was referring to, the KV1 and the H016 mics. So one from September and one from more recently.
It's consistent on what it's getting as the input floor though, I'll give it that. But the KV1 is too high.
mine are relatively the same. positioning seems important. i pointed the base of the phone a little more toward one than the other and it is showing more
My music is from computer speakers but position changing doesn't seem to alter it...
you could keep a long running average of the max magnitude to adjust the original_max arg (now 120). kind of an agc
I just did - 6 on the input_floor on only the KV1 and they're acting about the same.
input_floor = (max(volume_sample) - min(volume_sample)) - 6```
That's not a viable solution, but I wanted to try it.
mine are about the same: H016 might be more sensitive
hmm.
remember to stop the music when you restart
I've tried both ways just to see if it mattered. The input_floor is a difference and it's coming out with the same number for a given board really consistenly.
19 and 29.
But the 29 is too high.
a fixed 20 might still be ok
and, you know, maybe the point of this code is to make people experiment
Well the plan was for this to go in the API. But I'm leaning towards them being a little different and 20 being a solid solution
cpx.volume_meter or something.
<@&356864093652516868> and everyone else, here is the recording from the meeting today: https://youtu.be/n10D0yZsmkk Thanks to all who joined.
Join here for the chat all week: http://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel for noti...
They both seem happy with 20.
Thanks @slender iron!
... yeah. It's a lot. But it was a combination of wantring there to be something to do with as many of the sensors as possible in the API and it being in the mega demo.
but how do you interrupt it? it won't return
I hadn't gotten that far yet.
I slimmed it all down and got it working was where I stopped because it was failing on different boards until you resolved that issue.
you could have an init call, and then call it once for each trip around the loop
Nice ok
or see how it's done in the mega demo
He switches through modes so it's different
It's calls all the options in a list and you can cycle through them
I know, right? Completely! π
i felt guilty when the pandora ad came on
lol
ok, maybe I should take a break and practice the guitar or somethign
Yeah! I have to head out for a few hours. Well not out-out. Luckily. It's cold.
Practice with the CPX on π
If you can focus with the light show
and therefore support our drivers that use it.
Related to https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/pull/18
Later!
'night!
CPX 3333 still 'In Stock' with no count. π
must have a bunch π
They're made by little elves in a hollow tree
yah, counter doesn't kick in until numbers go lower (i think)
I'm now at the point where simple fatigue is my limiting factor; not so stumped on what to try next. I could go for weeks without asking another question, which is a good place to be, for me.
Wrt CPX development in Circuit Python, that is.
stereo CPX sound meters
As it turned out, the Github repositories for individual drivers was the aha factor.
π
For example,
https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel
has a section 'Usage Example'. That was all I needed.
@timber mango we're gonna start requiring drivers always have an examples folder too
One simple example is so much better than no examples. π Really: just one that works and does a few obvious things.
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases
Is where I found a way to figure out where to look next, for the repos of each driver. Like under 2.1.0 there's a fairly complete list of what's in the bundle.
Still feels like I went to a restaurant and they handed me a wok and a pile of vegetables, though. π Haha.
@tulip sleet
$ cat ./main.py > /media/nisnis/CIRCUITPY/main.py ; sync
exposes the difference (omit 'sync' to see it). rvim writes immediately and the target board knows immediately, whereas using /bin/cat to overwrite takes .. up to like 15 seconds to complete, even though the target responds to the event immediately (but still does not finish loading the python source).
I was waiting a very long time for the target to respond (by executing the new code) until I added 'sync' to the end of that (using cat to overwrite the code resident in SPI flashROM on the CPX target board).
For completeness:
$ > ./thisfile
.. creates a new file 'thisfile' of length zero. It'll also truncate any file without removing it.
I haven't been doing that on the CPX but I'll experiment to see what effects it brings.
LATER: seems harmless to truncate main.py in this manner. Everything behaves as expected (doesn't annoy CircuitPython at the REPL fwict).
what abou just cp instead of cat
Let me try cp.
cp seems to stat faster. If 'stat' is the right verb there. The target didn't wait to run the job.
Yeah, with cp I don't have to wait, the way I do using cat per the above. cp doesn't need a sync.
just finishing up listening to today's call. thanks for the hugs (unnecessary...all i've done so far is read and regurgitate ;D). group hugs back at ya, folks. really good discussion. one of these days i'll figure out how to join in realtime (late lunch?).
Those are hug thoughts. Need another person in the room with you, for the correct version. π
let me have my fantasy!!! lol
Hey, what does it mean to "freeze" a python library into the firmware? I'm trying to understand how this works around the lis3dh malloc problem by removing it from lib/ (thanks, @idle owl for that tip).
It's a little confusing. Seems there are py libs, mpy libs in lib/ I guess, and then there are yet more in the "firmware" somehow.
I think it just means you compile it into something like a bytecode, and that it's expected to be present when called upon (unlike a lib which needs an import).
It might have such strong dependencies that it's too risky to not bind it into the kernel as indelible. Whereas libs would be more plastic; could perhaps be of different versions. Just guessing.
Fascinating stuff.
@timber mango is generally right. frozen libs are byte code that can be run from the internal flash rather than needing to be loaded into ram
@robust coral The new release of the cpx library is designed to prefer the frozen modules so there won't be issues with memory allocation failures if you have the local copies as well. You can load the entire lib folder now. I can't remember if that was your issue or not.
that was it, yes. Thanks
It must have been if I told you to remove lis3dh to fix it
Yeah if you download the latest library bundle you can safely load the entire thing if you want to
I didn't understand what a frozen module was. This is a micropython feature that sounds like it begs more RTFMming.
Ok..so that was part of my fear with that giant post. Info got a little fragmented. I'll see if I can give a clean explanation of where I THINK I am. (Found one mistake from yesterday. I was looking at the SAM_G_51 datasheet. So that info is garbage; I will correct it. SAMD51 uid is identical to SAMD21...just @ different addresses.)
- SAMD21: 128bit (4x 32bit)
uidis stored in Flash (nvm) @ these addresse...
@robust coral the SAMD21G18A (ARM Cortex M0+, branded as the 'M0' line at Adafruit) has 32,768 bytes of RAM, but 256KB of flashROM, all inside one chip (along with the microprocessor core!)
The frozen lib lives in the memory map address space in that 256KB region. It can be executed from that codespace, without copyiing it into RAM. I think I have that right. π
thx
I wasn't sure what versioned releases will work with what, so I rebuilt the master branch of Adafruit_CircuitPython_Bundle and loaded the nightly build adafruit-circuitpython-circuitplayground_express-20171206-3c49f53.uf2 and now everything works as expected.
group hug to @slender iron @idle owl @tulip sleet @timber lion @errant grail @solar whale for a really great discussion of improving documentation and user support in today's CP weekly. Work prevents me from participating much but I'm happy to hear everyone contributing great feedback on an important topic. Keep up the awesome work everyone, I hope I can pitch in soon
Is python hard to learn? Im probably intermediate with java, but that's about it.
@dire token One of the reasons for CircuitPython existing is that Python is one of the easier languages to learn.
Python was designed for people who don't know Python.
@sommersoft Thanks for doing all that research! The USB code does read the values, 4 bits at a time, on this line: https://github.com/adafruit/circuitpython/blob/b31c2ea7480a816bd909f841972f228d09242821/ports/atmel-samd/supervisor/serial.c#L49.
You don't need the nvm module for this. That module is written specifically to provide a small EEPROM-like space to store persistent data. It isn't mean as a general-purpose way of reading flash.
Thanks @cunning crypt. I want to learn it. I'll have to look for some resources.
Oh crap. Wrong server xD
I guess I'll delete it. Sorry lol
don't worry
@tulip sleet nice VU meters! yay!
@idle owl hiya im working on tester for next shipping CPX rev, which will come with cpy 2.2 + your lovely library. im writing up a demo
if you have a demo you like i can add it too π
I as working on Char_LCD and RGB_Display
So, this would be some of my inexperience showing with "foundational" C & MCU programming. After looking back without my biases, I see what you're saying.
uint32_t* addresses[4] = {(uint32_t *) 0x0080A00C, (uint32_t *) 0x0080A040... is assigning pointers the ACTUAL memory, not simply assigning the locations. That's what was tripping me up, since you would never do that in more computer-os based environments (at least for the things I've done). The rest of that routine is just converting ...
does anyone know where readthedocs is setup to generate this page?: http://circuitpython.readthedocs.io/en/2.x/docs/reference/isr_rules.html
at @slender iron's suggestion I would like to remove it but I have no idea how
@tidal kiln somehow that didn't come up in a grep, thanks
i don't think it's explicitly referenced in any rtd config files
cool, i'm not sure for that repo
@tidal kiln is readthedocs itself the best place for RTD config documentation or is there some CP specific info somewhere? I'm happy poking around the code to figure it out but if there is a good reference that would be swell
good question. i'm still learning rtd myself, so don't know all the nuts and bolts.
but i'd think you'd want to look at RTD for it's documentation
@tannewt I was pointed to the ISR doc page and can remove it; should I create a new issue for cleaning up it and similar docs?
@timber mango @slender iron @timber lion @idle owl @solar whale @tulip sleet pylint has a limit on the number of paramters a __init__ can have. if existing code has too many, should i refactor the class have fewer?
@fading solstice In my opinion, that is the type of lint infomation that should be taken "under advisement" Look at the code to see if if there is a better way to implement it but the code should not just be changed to satisfy lint. I'm curious what others think.
this came up a couple of days ago and i think that was the general consensus
@fading solstice can you link to your specific case?
yea, it was discussed a fair amount in the CP weekly yesterday after the updates. Worth listening to
@fading solstice If it seems like it makes sense to have it there, disable pylint with the comment message in the code. The idea is that we want to stick to pylint when we can, fix it when we can't, and acknowledge when we're choosing not to follow it.
@fading solstice what @solar whale said. If the init method really shouldn't have that many then change it, otherwise just disable the check for that line
@timber mango That would be amazing! I'd love to include something!
@pastel panther locaiton for RTD docs depends on what the format will be. how-to guides and projects can go in a learn guide instead
@slender iron maybe I misunderstood the full context of RTD; I was trying to understand the process by which http://circuitpython.readthedocs.io/en/2.x/index.html and other pages on that site were generated. Is RTD used for learn guides as well?
That's kinda what I thought. Is there any documentation of how CP uses RTD or should one just read the RTD docs and look at the code to figure it out? From what I can tell conf.py in the CP root is the main config file
I think I misunderstood your reply. You're saying there could be a learn guide for RTD
@solar whale @slender iron @idle owl @stuck elbow @pastel panther thanks for your input.
@pastel panther you only need to learn sphinx
@pastel panther http://docs.sphinxdocs.com/en/latest/
@pastel panther there could be, but not sure what it would cover, the entire topic is vast. there is this which deals with how it relates to CP:
https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs
I'm running errands this morning but will be around later
yea, I just found that π I'm having a bad google morning it seems
I think rhat's pretty much what I was looking for by my brain wasn't cooperating
sudo think
/kms
Adafruit order was supposed to be here and it is not. I am assuming it's not going to get here today at all. It seems like UPS either nails it or buggers it up completely.
Fedex isn't any better
@slender iron @tulip sleet just noticed this in dmesg when plugging in a Trinket:
[596921.260636] scsi 6:0:0:0: Direct-Access ATMEL MicroPython VFS[ 1.00 PQ: 0 ANSI: 3
maybe that's known and intentional, but just in case that's meta info you want to change.
ubuntu uses it in dialogs also, like when ejecting: "Safe to remove ATMEL MicroPython VFS"
yeah i wouldn't rip initializers apart just to satisfy lint's default rule. sometimes we have a lot of arguments like many different pins for something that communicates in parallel. it's another good case where lint is trying to be too smart imho
well, in a "grown up" program you would then split the class into several smaller classes, for example putting all the pins into one object β but here we have memory saving considerations
but I sometimes think about simply using named tuples in such situations β they have very little overhead
yeah i dunno i'd argue it's not necessary, if you have 8 params just leave them named π
is really much gained by abstracting into another class that just carries the values?
but it's definitely a philosophical / style thing
I used named tuples in the RTC drivers, but that was mostly because the rtc library from micropython used them
oh yeah named tuples in python are great, lightweight struct-like classes are something i've always wanted
i wish named tuples were just part of the core syntax
the declaration syntax sucks a bit, though
they just added data classes to 3.8
which are a bit like named tuples, only not lightweight
oh nifty
ahh slick, i bet all the django and DB folks like that
handy to make classes for all your DB schemas
funny that python is slowly becoming more like C++ π
type hints, data classes, etc.
the DB schemas need their own metaclass magic, though, because they need to intergrate with the database
before we know it there will be a memory.allocate() function or similar π
not C++. no
aren't you supposed to be using the "new" keyword in c++?
malloc is more like C stuff?
c = malloc/free, c++ = new/delete
yeah actually with c++11 and beyond they realized dynamic memory allocation is tricky and really push people to not use it when possible now
they added special auto_ptr types that reference count and new/free automatically
it kinda blew my mind, c++11 is really cool
herb sutter's talks are super cool on learning what the C++ world is up to now: https://www.youtube.com/watch?v=xnqTKD8uD64
http://www.cppcon.org -- Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/CppCon/CppCon2014 -- This ...
they even have a 'foreach' style loop they added to the language π
Circuitpython listed Arduino Zero as a supported board, can it also be installed on the Feather M0 WiFi ATSAMD21 + ATWINC1500 (product ID: 3010)?
so maybe C++ is becoming more like python?
this is why I hate C++ so much β it's such a mix of different languages, everybody picks different "good pats" to somehow cope
yeah we're all kinda converging on similar things maybe π
oh yeah totally i have seen some truly gnarly c++ code bases
but then if your "good parts" are different from the author's, you can't understand a thing
20+ years of language changes, hard to learn stuff, etc. does a real number on the code
yep it can definitely be like javascript
i remember back to the early 2000's when template metaprogramming was all the rage
js is a "make your own language" toolkit
and it was all about how 'smart' you could be with super esoteric template stuff
that was a dark time π
when a 3 or 4 line program could generate pages and pages of errors from the compiler
c++ is more "we included everything, pick the least broken parts and use them"
micopython was such a relief with its relatively plain and simple C code
yep i remember people used to look down on C, but I realize there's a real zen to the simplicity of it
though there are some nasty parts, like the exceptions stuff
Yes, but it will be treated as a Feather M0 Basic. There is no support for the Wifi at this time.
neat (named tuples):
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit Trinket M0 with samd21e18
>>> import ucollections
>>> Point2D = ucollections.namedtuple('Point2D', ('x','y'))
>>> location = Point2D(3.4, -6.7)
>>> print("x={} y={}".format(location.x,location.y))
x=3.4 y=-6.7
>>>
interesting
i've almost used these a few times but wasn't sure if they are considered supported in circuitpython.
oh slick someone ported them, hah cool π
looks like it's a carry over from micropython
yeah they're great for little struct-like 'classes' to carry data around
yep. and pass into __init__ 's, etc.
but there's some memory overhead vs. just using raw values
so always a little trade off of when to use
and it would be another dependency to add to a lib
yah, wish it were in core. another reason i probably didn't use it.
they are in the standard library
in Python
also, I think there is no overhead for the instances -- only for the definition
looks like the perfect use case
ah yeah a thing i like instead
do:
x, y, z = lis3dh.acceleration
oh, in cp there will be overhead, because it doesn't have slots
it will unpack all the values into the 3 variables
even if you only need the z value, nice and compact syntax without a ton of overhead
lis3dh.acceleration[2] is still going to make the same I2C call to read the register, etc. so they're both kinda equivalent
yah. more of a syntax thing. looks odd / wasteful to unpack and then not use.
here's another example (for named tuples), this was originally arduino code and i used a simple struct to represent a button. i was going to use named tuples but went with a dict instead:
https://github.com/caternuson/CircuitPython-Demos/blob/master/SimpleSimon/simple_simon.py#L25
oh nifty, yeah totally a named tuple could simplify it a bit
yeah i dunno why they haven't pulled it into the core syntax.. i'm sure there have been heated debates on it π
i guess it's effectively part of the proper python code, just a standard lib part
er core
here's another use case for single axis access:
# Wait for Circuit Playground to be flipped over (face down)
while cpx.acceleration[2] > 0:
pass # do nothing
ah nifty
actually if you want on the cpx class you could add x, y, z properties
that just read the single access from accelerometer
so it could be
while cpx.z > 0:
yep. i almost put that issue in that repo originally.
just figured it should be done to the underlying driver first
but doesn't have to, since the cpx code could be updated if the lis3dh driver is changed
is this a known thing? or is my windows just awesome like that, turning 256KB into almost 4MB?
We discussed that while we were writing it and I think we decided it was too vague.
sure that was it? doesn't seem vague to me. maybe having it be just x and y and z is a little too terse in terms of variable names?
@raven canopy what the bootloader presents to the system is not a real disk, so some figures might make little sense
@tidal kiln I thought it was anyway. I initially had it written into 3 separate things and was asked to combine them, but I only had it in 3 because I didn't know it could be done with 1. So I thought the discussion was happening around when I had it in 3 things, I think I called them cpx.acceleration_x and that started the discussion. But it wasn't what they wanted anyway so it was changed in the end.
@stuck elbow okie dokie. i figured it may be a matter of forced-fudging or lost-in-translation... thanks
Might have been two separate issues I guess. I could be conflating.
oh, if that was all you had, then i can see the case for wanting a tuple return instead
I had it in 3 but then it could return the tuple I think... eh, maybe I'm misremembering.
@raven canopy I think they had to report some size, and they choose 4MB because that's bigger than any firmware file you would copy onto it, so the operating system won't complain that it doesn't fit
and maybe the use cases weren't thought of at that point?
oh yeah...i vaguely remember that conversation in here. if only i remembered more than i forgot...
I remember there being a discussion about single axis being desirable.
I mean I'm open to discussing it. I think cpx.x etc isn't clear enough so I don't think it should be that if we include it.
I remember a discussion about it previously is all and I don't remember all the details of that discussion. No reason not to discuss it again.
all it would take is this:
@property
def acceleration_x(self):
return self.acceleration[0]
@property
def acceleration_y(self):
return self.acceleration[1]
@property
def acceleration_z(self):
return self.acceleration[2]
I know. I'm just not sure if there was a reason why we didn't do it in the first place.
yah, dunno either. maybe it was more of "it should return a tuple" and not "single axis isn't needed"
and if the lis3dh library is ever changed, you can just change your code to use it
Is it not in lis3dh already? I guess I thought it was.
don't think so, that's why i put in that issue
We'd have to make sure the frozen module gets updated if we want to change that anytime soon. At least if that's how we do it in the cpx library
Probably best for now to not reference it
what i put above would work with the current frozen module
I know, I'm saying in general
for if / when lis3dh driver gets updated?
For if someone decides to update it between now and the time we're shipping the CPX with this library, in case the frozen module didn't get updated or something.
in library Adafruit_CiruitPython_Char_LCD, pylint is complaing about a method called setColor(). Changing the method name is a interface break. This library hasn't been part of the bundle very long, but there is a learn document that reference setColor() method. The best I can do it create a new method called set_color, but do you agree that I should not remove setColor()
It can be changed and removed, but we'd need to update the guide. That's been what we've been doing is changing it to what makes sense in the library, but updating the guides where necessary.
ok, then i will change it. this takes some careful corrdination. do i need to create issue for the doc updates?
Yeah I think that's the best place to start. Then we figure out who can update the guide. @solar whale has been involved in that and might be able to. Make a note to talk to Scott about it to make sure we get it coordinated.
@idle owl hiya! im getting the CPX demo done...
@timber mango Nice!
and was wondering if/why some subobjects are _ and some are not
eg cpx.pixels vs cpx._lis3dh
I only partially get it. _ sets them as private, but they're not really private in the C sense, you can still call them in the code if you include the under but the doc stuff and so on ignores them. the idea is that they're not meant to be used publicly.
And regarding shake_threshold are you saying why isn't it found in the cpx API?
ok i think for the lis3dh maybe not _ is better, for example im using tap detection
https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/master/adafruit_circuitplayground/express.py#L167 is the line that is wrong?
Shouldn't be no. it's like cpx.pixels.brightness.. it's not in the API, but it works to call it out. And I found that sometimes shaking wasn't sensitive enough for shake to work, and I didn't want to include it in cpx.shake so I set a default in lis3dh, but it's accessible if you want to use it, like brightness for neopixel.
I tested it anyway, but maybe it doesn't work now that it's frozen? I don't know. It worked at some point...
I included it in the API documentation instead of including it in the actual method.
I'm creating a build right now.
or trying to. π
@timber mango Finished the last section of the guide I emailed you about - I didn't want to send a third email to tell you.
I see. threshold doesn't work now.
@timber mango Yeah that line is wrong.
It must have been something about my setup when I tested it that made it work without any other changes. We can either add it where it needs to go to work, or we can remove that part of the documentation.
I'll discuss it with Scott and figure out which way we want to go with it. It'll either be included or I'll nix the API doc. I'll let you know what we decide.
kk
@timber mango how's the demo going to work? I have a few ideas for stuff, but if you're already including it, it's silly to duplicate
Nice!
Side note: that wheel isn't r - g - b like the comment says. I have a fixed version, it's just a matter of things around.
not that it really matters, it cycles around eventually regardless π
It threw me when I was trying to replicate the MakeCode demo that CPX ships with right now.
it should swirl and play sounds n stuff
I'm having lib issues π
Oh I know why. oi.
I love it!
Accelerometer reading seems off. It's the same no regardless of movement, even if I move it and then reset so it starts fresh.
reading are updated in if clause that resets pixeln
@idle owl accel worked for me, but not neopixels, did they for you?
Yeah, they did. I have to run for a bit.
right o, tah
cool. because...
just noticed the ads1x15 library isn't in the bundle release zip file.
did i miss a step or something? it has an entry here:
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/master/.gitmodules#L97
@IeiuniumLux it'd be possible to port but its not a focus of ours. Let me know if you are interested in trying to port it and I can give pointers on how our structure is different. Thanks!
@tidal kiln weird, not sure why
@tidal kiln I think it needs a new release
the bundler looks for an init.py file in the folder which was added after the release
yep. wondered if that might it. let me try that.
do i need to do anything with the new meta tags?
__version__ = "0.0.0-auto.0"
nope, those are there for when I'll have the build search and replace them
the __repo__ won't be replaced
Sure, I can give it a try since I have one of the Feather M0 with the ATWINC1500 WiFi module. I'll send send a push request when I have something for you to review.
@IeiuniumLux Awesome! Feel free to send it early to make sure you are on the right track. I'm regularly on our Discord chat too if you have questions. Link to join is: https://adafru.it/discord
New issue would be great!
On Tue, Dec 12, 2017 at 8:24 AM bsiepert notifications@github.com wrote:
@tannewt https://github.com/tannewt I was pointed to the ISR doc page
and can remove it; should I create a new issue for cleaning up it and
similar docs?β
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/issues/439#issuecomment-351103926,
or mute the thread
<https://github...
need another release?
@tidal kiln meh, no rush
yah, rush is too loud for the library π
@slender iron can you clarify what you're wanting for file / folder layout for here:
https://github.com/adafruit/circuitpython/issues/338#issuecomment-349724451
@tidal kiln what are you thinking exactly?
there are two "things" - the bus class and the device class, currently they're in two separate files
could throw all that in one file
or create a subfolder and keep them separate
I'd probably keep them separate but with simple filenames like bus and device
so it ends up from adafruit_onewire.bus import OneWireBus
I am also at a library!
so that'd be a folder named adafruit_onewire containing the files bus.py and device.py ?
@tidal kiln I'm lurking in a presentation so I commented out the sound and neopixels, and now the acceleration works. I know it's unrelated to the sound bits.
@idle owl i got neopixles to work, but i had to change the color definition from a list to a tuple
Ahh. That makes sense. Could be what was messing with the aceleration too.
this:
cpx.pixels[p] = [int(c * ( (10 - (pixeln+p)%10)) / 10.0) for c in color]
i'm i just behind on firmware or something? maybe?
I'm running 2.x built today
i think i was running 2.1
I thought it needed 2.x because I initially thought shake was involved.
@tidal kiln yes to the folder/files you said
cool. thanks @slender iron
pretty close to what i was thinking. but i wasn't making the filenames that simple
π
I think if the folder has adafruit already then the files and classes don't need it
yep. i was leaving in 'onewire' also, but it is also in folder name.
yup, exactly
@slender iron Two things: One - Ladyada would like lis3dh to be made an unprotected member of cpx. If you're ok with it, I'll get it taken care of. Two, shake_threshold doesn't work like I thought it did, my testing must have been wrong or under some other circumstances. Long story short, two options: we give it the default argument and have it be cpx.shake(shake_threshold=30) in the API, so it can be set, or we remove that part of the documentation in the API. I'd like it to be available.
Or obviously we can discuss any of it
shade_threshold as a kwarg is fine with me
ok
Now I'm thinking about what the shade_threshold is..
She's using cpx.lis3dh in the demo the CPX will ship with for tap detection. so right now it's cpx._lis3dh.etc and she'd like it to be exposed.
looks at the demo code
Or, if there's enough time, I figure out getting the hardware tap detection into cpx. I'm game if it's doable.
then we do cpx.tap or whatnot
yeah, I'm not a huge fan of set_click and read_click
any function that starts with get, set, read or write get my attention
@slender iron Ok, early next week. Should be plenty of time. famous last words
what about the question of exposing lis3dh in cpx?
tap detection will eliminate the need. That's what this resolves.
i see, it's lack of a cpx.tap currently that's making her access the lis3dh directly?
yep.
ok. might come up again though. for other things the lis3dh can do. but i think answer is the same - add a cpx.cool_new_feature() function for whatever
agreed π
that's just my 2 cents though
it's all designy decisiony thingys
Which it's great to have you as a part of.
providing tap through cpx means we can change it under the hood later without effecting the demo code
looks like it'd be ok to leave on anyway
I don't follow your second statement
having click detection enabled doesn't conflict with any other functionality so it'd be ok to leave on
ah ok
then you could have cpx.single_tapped and cpx.double_tapped
yeah exactly, something like that was the plan
if we have the tap cleared on read then it should be a function probably
similar to the gamepad module
here is a good issue for anyone wanting to learn circuitpython HW API and seesaw: https://github.com/adafruit/Adafruit_CircuitPython_seesaw/issues/2
Changes:
- New faster filter loop, by @ladyada. New filter coefficients as well.
- Turn on microphone clock when
PDMInobject is created, and run it all the time, so the user code doesn't have to wait for microphone startup, which can be 10ms or even 100ms. - Wait for microphone startup when
PDMInis first created, based on new optional parametermicrophone_startup_msecs. record()returns number of samples actually recorded, so you can see if it's not keeping up.- Fix buf...
closed by mistake. was going to make a cosmetic change but not worth it.
so, if i'm reading all this right....as a windows user, if I want to compile a CPy build then travis would be the easiest way? otherwise it looks like I'm pulling out the rpi and PuTTy or scrambling to get my pre-upgrade components a case for the linux box.
@raven canopy we recommend an Ubuntu VM
though a few folks here have had success with the windows linux environment thingy in win 10
The newest version of the Trinket M0 CPy StringCar controller is now out of the prototype phase. The CircuitPython code and hardware passed all tests, and the PCB (pin-compatible with the original 2015-era controller) is ready to go. Many new features and improved functionality, not to mention groovy sound effects. Now if I could just make it sound like a 1965 Shelby Mustang. π
This isn't needed for this PR.
Why are these still in here?
How about taking taking float seconds to be consistent with time.sleep?
looks great @errant grail
Appreciate the help from the CPy team. Y'all removed some pretty significant learning-curve roadblocks for me. Thanks.
perfect!
@slender iron thanks. didn't even think about VMing.
the learn guide for samd21 micropython has a vagrant file
I was basically just documenting how to do this, but I'll take it out.
That's a good idea. I considered this and then for some reason thought float might not be available, which is wrong: we depend on float
Wanted to stash them somewhere, but I can save them elsewhere.
not done - didn't do float mic time yet
@idle owl reviewing your guide now!
@meager fog thank you!
My apologies in advance if this is not the right place to ask this question. I'm trying to install the latest circuitpython release 2.1.0 on HUZZAH with ESP8266 WiFi (ID: 2821), but I'm getting SAM-BA operation failed error when I run ./bossac
./bossac -e -w -v -R -p /dev/tty.SLAB_USBtoUART adafruit-circuitpython-feather_huzzah-2.1.0.bin
I am starting on pylint of SD
esp does not use bossac, it requires esptool!
mentions esptool, but it doesn't say anything about esp doesn't support bossac
thats because thats the page for the feather m0 π
I tried usbtool, but it doesn't complete the flashing...
esptool.py --port /dev/tty.SLAB_USBtoUART --baud 460800 write_flash --flash_size=detect 0 adafruit-circuitpython-feather_huzzah-2.1.0.bin
esptool.py v2.2
Connecting........_
Detecting chip type... ESP8266
Chip is ESP8266EX
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
A fatal error occurred: Invalid head of packet (b'F')
@fiery drift try this: https://learn.adafruit.com/micropython-basics-how-to-load-micropython-on-a-board/esp8266
@tidal kiln, yes those are the instructions I'm following to flash the HUZZAH with 2.1.0 (adafruit-circuitpython-feather_huzzah-2.1.0.bin)
check the bin file has stuff on it, maybe try again? ESP is finicky π
it's estrange because "esptool.py --port /dev/tty.SLAB_USBtoUART erase_flash" successes
@idle owl ready for some final changes?
it's nice how microbit those small connectors are unique to the board
in micro:bit
as I have MXChip iot devkit what have edgeconnector so small connectors are a little bit different
@meager fog, yes it has stuff on it. I'm getting "A fatal error occurred: Timed out waiting for packet header"
I know it is not the cable because erase_flash works.
@fiery drift try doing another erase and then flash with a lower baud rate
Unfortunately Tony's video shows uploading the MicroPython firmware instead of the CircuitPython. @slender iron, ok let me try that.
@slender iron, hum! Lowing the baud rate to 115200 worked. At least, complete.
esptool.py --port /dev/tty.SLAB_USBtoUART --baud 115200 write_flash --flash_size=detect 0 adafruit-circuitpython-feather_huzzah-2.1.0.bin
esptool.py v2.2
Connecting........_
Detecting chip type... ESP8266
Chip is ESP8266EX
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0040
Compressed 595076 bytes to 387307...
Wrote 595076 bytes (387307 compressed) at 0x00000000 in 34.1 seconds (effective 139.8 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting...
@slender iron, thank you!
@meager fog ready!
@idle owl oh sent mail thx π
Thanks!
its great, nice work!
here'f ine
@Al Bee#3668 great! glad it worked
TYPING
The reason we didn't include the bossac stuff and libraries was because we were trying to keep it as beginner as possible, making it more about getting the person who just got a free trinket with their order through the first 20 minutes of their experience. should I make the bossac install it's own nested page so it's clearer it's not part of the basic install process?
I like that even better
tan, any opinion? π
sounds good to me
it is agreed! :gavel:
excellent. then where makes the most sense to put libraries.
Also I just realised all that stuff on the libs page about running out of space could be added to Troubleshooting.
on the what is page I wouldn't go so far to say circuitpython is "completely compatible" because there are caveats
i like to say "almost-completely compatible"