#circuitpython-dev
1 messages ยท Page 230 of 1
That's be great!ย I've got the hardware on the bench, I'll have a PR in
the next few days ...
spi question: do the bytes to be written over spi need tp be buffered in a byte array then be passed to the bus or can they be passed in chunks as being generated, like holding teh clock to send one byte after it has been fetched or calculated?
gif decompression sux
I spent like 2 hours translating a c library to python and it returns all zeroes
I found some really good documentation now, but I'm stuck on how to refer to a bytearray as a bitstream
like, if I need to read 5 bits at a time of a bytearray
I know you use masks and such, but how do I deal with bits between two bytes?
turn the whole thing into a massive integer?
lol
255 byte integer sounds like a bad idea
What do you mean by deal with bits between bytes? like b("0xFF80") would just be two bytes.
Did you try bitshifting?
Yeah, it'll be shifting and masking, similar to how the base64 code uses 6 bits at a time (4 of those in 3 bytes). With 5 bits, it'll end up with 8 5-bit quantities in 5 bytes.
AAAAABBB BBCCCCCD DDDDEEEE EFFFFFGG HHHIIIII
Take a look at the touch_read() function in https://github.com/adafruit/Adafruit_CircuitPython_RA8875/blob/master/adafruit_ra8875/ra8875.py
I had to basically get 2 numbers out of 3 bytes
Mind you that this was my first real attempt at CircuitPython, but hopefully it will give you the idea.
so like, the part I'm confused on is the BBB BB
For example to pull out the value of "B" (which spans two bytes): ```python
b = x[0] << 2 | x[1] >> 6
He's saying that he read those bytes and used shifting and masking to assemble them into the correct numbers
The 3 high bits of B are in the low bits of x[0], so they get shifted left 2 bits to put them in the correct position. Then the 2 low bits of B are in the high bits of x[1], so they get shifted right 6 bits to put them in the correct position. Then those two get or'd together to build the final number.
Good explanation
I have to work out the shift programatically for a variable amount of bits
like 2 bits, 5 bits, etc.
Are they always 5 bits?
no, that's what I mean by variable
Ok, but if I remember gifs correctly, you read a byte that tells you how much more to read
I've read in all the data, now I'm working on the decompression
Ah, I see.
Ah, the LZW code? That's thorny.
yeah
have a look at saving the codestream as bytes here http://giflib.sourceforge.net/whatsinagif/lzw_image_data.html
There are a few ways to slice it, but to start with, you might want to write a generic "fetch 1 bit at a time" routine and use it in a loop to get as many bits as needed.
Well, I have an idea. You could basically read 5 bits (or whatever size), mask those off, then throw the remainder in a variable. On the next set of bits, read the next amount, use what's in the variable, and then replace the variable with the new remainder and so on.
Yeah, as long as you keep track of how many bits are left in the variable, that should work.
I like bodger's idea
Yeah, go with whatever makes more sense to you.
Cool
something like this, not sure if it works yet
def fetch_bits(bytearr, nbits, bit_offset):
byte_offset = bit_offset//8
rem = bit_offset % 8
bits = 0
for i in range(nbits):
bit = bytearr[byte_offset] & 1 << rem
bits = bit | 1 << i
return bits
It's a little difficult to read, but something like that
it might work
I got the right value out of it but could be a fluke
bitmath is always hard to read
yeah
Coming up with good test cases is tricky too, since you can't set one bit to zero and one bit to "1" and one bit to "2" and see if they come out in the right order.
lol
I almost got it
Nice!
I think I got the bit part, now I need to figure out when the code size (number of bits) changes
here's the code, in case it helps anyone else
def fetch_bits(bytearr, nbits, bit_offset):
byte_offset = bit_offset//8
rem = bit_offset % 8
bits = 0
for i in range(nbits):
bit = (bytearr[byte_offset] | (bytearr[byte_offset+1] << 8)) & (1 << (rem + i))
bits |= bit >> rem
return bits
it doesn't appear to be in the docs how to figure out when the code size changes on the decompression end
I got it to work for a 10x10 image
but not for bigger ones that have multiple blocks before a clear code
or something
houston we have a problem.
The german translations aren't displayed properly in the REPL. The encoding is wrong.
Zurรยผckverfolgung (jรยผngste Aufforderung zuletzt) should be Zurรผckverfolgung (jรผngste Aufforderung zuletzt)
hello everyone, new to circuitpython. I'm trying to read just the leading edge of an input, I found in python they talk about reading RISING edge but nothing for circuitpyton and Metro M0 express.
@plucky briar welcome! unfortunately no, edge detection is not available in circuitpython. also, i assume you'd want to use it with an interrupt/callback, which is also not available. the closest you can currently get is using digitalio.DigitalInOut, and poll for state (HIGH/LOW). using a state machine will allow you to detect if it is rising or falling:
import digitialio
import board
pin = digitalio.DigitalInOut(board.D5)
pin_state = pin.value
last_pin_state = pin_state
while True:
pin_state = pin.value
if pin_state and pin_state != last_pin_state:
print("Pin is high, and previously low, so a rising edge occurred.")
if not pin_state and pin_state != last_pin_state:
print("Pin is low, and previously high, so a falling edge occurred.")
last_pin_state = pin_state
@raven canopy Thank you, that should work, greatly appriciated!
@raven canopy adabot used to do an auto release of the Bundle at around 0600 EST -- I see it just ran -- is it on a different schedule or was it manually run.
@solar whale it used to run on Scott's local machine, which probably had 0600 as the cron time. Its now running solely on Travis, but unfortunately Travis only guarantees "at some point in the day" for their daily cron jobs. ๐ฆ
ok -- not a problem -- I was just curious.
no worries. i wish it was a dead-of-night cron, but is what it is. ๐
It's best to choose your battles when dealing with Travis ๐
@plucky briar @raven canopy there is a lib that can do what you want:
https://learn.adafruit.com/debouncer-library-python-circuitpython-buttons-sensors/basic-debouncing
@pastel panther That's it, thank you very much!!
no problem, glad to help
I use fedora and the 'usb' drive gets mounted read only a lot, any tricks there? I usually just remount rw.
[ 8771.160634] FAT-fs (sdb1): Filesystem has been set read-only```
I have a clear code wiping out my table, and then a prev_code referencing into that table, not sure what to do
It can be used generically.
<@&356864093652516868> Here is the notes doc for the meeting tomorrow. https://docs.google.com/document/d/1pN87ZkRxPdJQstl61UOHB1VrDjpBfO9p65Byju1G8C0/edit?usp=sharing Everyone is welcome to join in the CircuitPython voice channel at 11 am Pacific/ 2pm Eastern.
Can you please try it in the latest 4.0.0 Beta? Also, are you putting that in code.py or boot.py?
Scott
I was putting the code in main.py. When I moved it to boot.py, it worked perfectly. I should have thought of that, particularly since I was already using boot.py to control logging. Never gave it a thought!
I did try 4.0.0-beta.1 - works the same as 3.1
Thanks for your help,
Bill
On Feb 4, 2019, at 12:36 AM, Scott Shawcroft notifications@github.com wrote:
Can you please try it in the latest 4.0.0 Beta? Also, are you putting that in code.py or boot.py?
โ
You are r...
@solar whale I'm guessing you tested the magnetometer update you PR'd? (It looks right but I wanted to verify)
@idle owl yes, I can add a note to the PR.
If you'd like to, that would be great. But no worries if not. I'll take care of the PR. ๐
Thanks
Done!
more listy like Groups :)
<@&356864093652516868> Meeting in 15 minutes or so. Notes doc is here: https://docs.google.com/document/d/1pN87ZkRxPdJQstl61UOHB1VrDjpBfO9p65Byju1G8C0/edit?usp=sharing
CircuitPython Weekly February 4th, 2019 Videos are available on YouTube on diode.zone Thanks to @kattni for taking notes! 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 fo...
awesome!
Yeah it doesn't render links like that.
I think you can HTML 'em.
<a href="https://youtu.be/baa5ILZTRkQ>YouTube</a>
<a href="https://diode.zone/videos/watch/cf9edcce-04d4-4ce4-9e95-33ab503fb480">diode.zone</a>
Lol. Or not..
ah well
Wait. Missed formatting
Lurking from the studio again today. Will be back "in voice" next week!
lurking here also
Gotta split, I'll leave some notes in the notes; if someone wants to read them, great. Thanks!
๐คฝ
@umbral dagger ping
@meager fog pong
can you 'move' the cheetsheet repo
and we'll put in the newsletter
then u can fork it
(to make more changes)
Lurking
๐
Iโm lurking too.
@umbral dagger , I can move if you cannot
@turbid radish you cant move it, he owns the repo ๐
I missed the stream. Iโll have to check out the video.
@turbid radish I should be able to fork/PR awesome-circuitpython... watch for it.
@umbral dagger any luck with moving Cheatsheet? if you cant move to an org, try moving it to me (ladyada)
Aw ๐
MikeB is good ๐
@meager fog @turbid radish PR submitted to awesome-circuitpython to add the cheatsheet in a dir as suggested.
- @sajattack for some good discussion on frequency capture, and providing some alternative frequency generating firmware for testing.
- @tannewt for the "Debugging, with tannewt" live stream. Awesome look at your process, and how analyzing the heap can help the debug process.
- @kattni for diving into Datasheet land, and designing Fritzing part(s) and her first breakout board in Eagle! Bravo!
- @jerryn for continuing to be the break-things & replication wizard. It truly is a service to community.
- A couple days late, but I'd like to spring a Group Hug for Grouphug Day. Shadow or not, you all are awesome!
i was confused
It was my understanding it was rto be a subpage of awesome circuitpython
@meager fog no worries... I don't have repo creation perms. This way we can just use the PR approach for updating.
@turbid radish Add a link in the main awesome file?
๐ฟ not quite a GroundHog
yes - would you like to PR or have me do?
@turbid radish You can... where & how, etc.
ok, I'm on it
Saturday was groundhog day๐blinka:
Jutst want to know if midi-usb has been ncluded in 3.0 or 4.0? I have been using the aws version.
it should be in 4.0
@umbral dagger @meager fog Cheat Sheet merged and linked from main guide https://github.com/adafruit/awesome-circuitpython/blob/master/README.md in section Guides
@meager fog - PT informed on Slack for Newsletter
brb
Yay @idle owl ๐ฆ
@turbid radish New PR to fix my name
nice!
Last Week:
- adabot:
- Mitigated a couple intermittent Travis cron failures with the library report. Hopefully. We'll see if they pop back up this week. (And I just realized I didn't gracefully handle one, but may provide insight to the root cause)
- FrequencyIn:
- Changed the polling period to 10ms, which greatly stabilized the event counts. Having thoughts about making this user configurable. Now steadily capturing up to 2MHz with no ill affects on the VM.
- Frequency calculation is still low (2KHz reads as ~1.8xKHz, 4K as ~3.4xKHz, so on). I believe this is due to my poor mathing, and attempts at adjusting for EIC latency.
This Week:
- FrequencyIn
- adabot:
- Work on newline issue for Google Docs transcription
- Maybe circuitpython-build-tools for
adafruit_framebufinclusion of default font.bin. https://github.com/adafruit/Adafruit_CircuitPython_framebuf/issues/11
FYI: I'm working on v2 of my humidity monitor using CP (instead of C), on a Feather M4 and the 1.54" square eInk display.
What about wraapper for midi msgs.?
kk. Thanks!
Ladyada has a MIDI library in the works. JP used it recently. Channel mgt is included.
S3 bucket.
@raven canopy did you try [This is a link](https://tinyurl.com/ycepjur2)?
@idle owl yes that is right
@marble hornet unsuccessfully before, and Scott tried earlier which prompted my HTML attempt.
ah, try the link tho!
Thanks everyone! 
Thanks everyone!
Thanks all!
๐
me too
๐
Thanks !
thanks @molten sentinel
JLinkGDBServer -if SWD -device nRF52840_xxAA
can we chat about blit later?
@marble hornet ya, I can hang out
compiled vs. interpretted
someone walking in, i don;t want to share thier audio, sorry
Thanks for the links! So I think I figured out my problem by finding this issue in github (https://github.com/adafruit/Adafruit_nRF52_Arduino/issues/196). If I double-tap the Reset button everything works as normal again. So, I think there's a definitely a bug in the bootloader.
<@&356864093652516868> Recordings of today's meeting are here: https://youtu.be/7cvmm360FoU https://diode.zone/videos/watch/623b5974-75b2-406d-90c8-0012bbe1d2f6
Notes with time codes are available here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/blob/master/2019/2019-02-04.md Thanks to @kattni ...
Notes with time codes are available here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/blob/master/2019/2019-02-04.md
Thanks to @kattni for taking notes!
Join here for the chat all week: http://adafru.it/discord
The weekly happens normally at 2pm ET/11...
@idle owl thanks for the merge! I'll do beta.2 once travis gets through that
@slender iron Sounds good!
@dhalbert Has done a bunch of work on this with these libraries:
- https://github.com/adafruit/Adafruit_CircuitPython_BLE/
- https://github.com/adafruit/Adafruit_CircuitPython_BluefruitConnect
More will come but this is good for now.
@jerryneedell Is this still an issue?
I don't think this is an issue anymore because 1) we check to make sure the stack hasn't overwritten the heap now and go into safe mode if it does and 2) we can enter safe mode manually by clicking reset when the status neopixel is yellow.
This is going to be hard to reproduce and is likely no longer an issue. Please re-open if it still is an issue.
@notro Is this still an issue?
OK I've got my devices set up running 4.0.0-beta.1-11-g388448215 and it's working for me
with the Metro M4 Express and W5500 Feather Wing.
I did have some trouble when I first plugged it all together, with the Ethernet module on top the power is getting close to its limit and the board repeatedly reset itself until I plugged it into a better USB hub.
An external power supply should help there too.
If the remote server times out you'll get an Input/Output error as you described, thoug...
so close! one build for one board is 28 bytes too big https://travis-ci.com/adafruit/circuitpython/jobs/175270303
find some bytes!
I'm wondering if that check is correct
"Why are the bytes always gone?" - Captain Jack Sparrow
since if you get it way over the linker fails instead
I wasn't able to reproduce this with Beta 2. It handles the backlight natively so it may be related to that.
it looks correct ๐ฆ
@idle owl for the adafruit_framebuf font file thing with circuitpython-build-tools, do you want me to approach it as a one-off, or work it in a way that is more future-proof?
@raven canopy Harrumph. I kind of feel like it's a one-off. Or at least maybe hope it is?
Let's call it a one-off for now. If it comes up again, then I'm wrong and we should have future-proofed it ๐
๐
now to re-construct my "non-pip'd, for local use" version. i really should save it this time. ๐
Oh man.... if I had a dollar for every time I "should have saved it this time"....
ikr
"I won't need this again." "Well that was a fluke, no way I'll need this again." "Ok well, I guess, but seriously NO WAY I'll need it again after this......"
๐คฆ
Is that what happened with the DotStar library? JK
removes the micropython module and now has 2400 bytes
oh man. there goes const()... ๐ฌ ๐
haha. i almost suggested terminalio cause i was like "who uses that?". then checked the history...
we could consider only supporting hallowing for m0 displays
mem_info freed up ~1k on its own
that's doable. gc.mem_free is still available, right?
I cannot reproduce it, so I think it OK to close
no -- tested with partial_xenon at 100000 baud rate -- worked fine -- BTW the default is now 1Mbps
both work
man, my local library cache was a little behind: 123 Forks Updated; 18 New Forks
is it possible to override a frozen library with one in /lib ?
@raven canopy ya, it is
@celest zenith i think you can force it like this:
from <folder_name> import <library>
or maybe it would be like this:
import <folder_name>.<library>
If I am not mistaken, / is read before .frozen, so you can put updated libraries in / and they will override .frozen
/lib is read after .frozen
i remember that re-arrangement, but not the final determination. ๐
Right now weโre not using SPIM3, which is only a workaround. Still to re-test and debug the primary problem.
Ok, I'm moving to 4.x. We don't need it for 4.0.0
Do you want to disable across the port, or only for M0? Granted, I imagine few people utilize the full stack info...
I did the port to minimize inconsistencies. Hopefully the livestream helped show the alternative ways to debug.
hello all, javascripter here but newbie to circuitpython. I just want to return the value of the light sensor. I've done the following:
import board
from analogio import AnalogIn
consoleLighting = AnalogIn(board.LIGHT)
print(consoleLighting.value)
I get Pin 11 in use
no @slender iron I've got a fairly large program that turns real world switches into inputs on P3D (a flight simulator) but I am just trying to understand why that pin is in use, and how to tuen it off...
you are likely using it earlier. pins can have multiple names
no, i'm not using it. its pin a8 and i'm just using the repl to try to return that value
i don't know why circuitpython is so obtuse... at least working with the cpx
did you use the cpx library at all?
are you doing anything else besides the four lines above in the repl?
its possible there is a bug
nope that is it
what version of circuitpython? what board?
sorry this should be a simple answer, for a really simple problem... I'll keep reading the docs
it could also be a bug and not your fault
could be. do you code? does my code look correct to you?
ya, those lines should work on their own
well at least I'm not crazy...
Okay this is an implementation for adafruit/circuitpython#1045 very closely modeled on the atmel-samd port implementation by Scott.
@Tasm-Devil if you check out https://github.com/nickzoic/micropython/tree/circuitpython-nickzoic-1045-nrf-rotaryio you can give it a go! Let me know what you think ...
Is there a way in CP to tell whether USB is connected?
(as opposed to being powered by battery)
not being helpful but yes I believe so, I just don't know how ๐ฎ
I recall someone else was doing it
@pastel panther what do you do when you get "Pin PA11 in use" or any other pin attached to a built in sensor...
look for something that could be using it? As tannewt was alluding to some of the board.PIN_NAME names are duplicate names for the same pin.
looks at CAD files
In this case I'm calling for ambientLight = AnalogIn(board.LIGHT)
as far as I can tell the light sensor is the only thing using that pin
I've also tried PA08
and a8
so when I do "ambientLight = AnalogIn(board.LIGHT)" and then "print(ambientLight)" I should get the value back right?
I thikn you need to say ambientLight.value
not 100%, I don't use the ADCs a ton
I can double check
I've heard there is a way to turn off the built in pins when you are trying to program them yourself. BTW I just tried .value but I still get the same error message
I'm not quite sure what you mean by "turn off the built in pins"
the board.PINNAMEs are just aliases for the actual pin name
It was just a reference I saw in the docs (can't find it again)
thats what I thought. Do I have to set it as an output or something like the digital i/os?
not if you're trying to read the light sensor
have you tried this code?:
https://learn.adafruit.com/adafruit-circuit-playground-express/playground-light-sensor
Make faster and easier than ever with MakeCode, code.org CSD, CircuitPython or Arduino!
Unfortunately I don't have my CPX handy at the moment
yup, many times, the very definition of crazy
What version of CP are you running?
3.1.1
It might be worth giving 4.x a try:
https://github.com/adafruit/circuitpython/releases/download/4.0.0-beta.2/adafruit-circuitpython-circuitplayground_express-en_US-4.0.0-beta.2.uf2
If that doesn't work I can only suggest that there might be a bug; If you can create a Issue here including a full code example that reproduces the bug, that would be helpful so someone can try to reproduce it and dig deeper:
https://github.com/adafruit/circuitpython/issues
that's a uf2 file
I was just looking at 4.0
I think it might be a bug because the code couldn't be simpler. I'm using the repl and it looks like this:
import time
import board
import digitalio
from analogio import AnalogIn
from adafruit_circuitplayground.express import cpx
ambientLight = AnalogIn(board.LIGHT)
while True:
print(ambientLight.value)
time.sleep(0.1)
ah ha!
or print(cpx.light) if I remember right
@slender iron That DID IT!
Thank you. that's what I meant earlier about obtuse... it would think it would be ".value" on any sensor...
OK so I'm not unhappy with this, but there's some configuration issues around the flash:
FLASH_SIZE is maybe going to vary between boards, depending on the device used.
FLASH_PAGE_SIZE may too: it's the minimum erasable block on the flash. On the Feather board I've got here it happens to be 4096, I'm not sure if this is going to be the case across all nRF devices.
CIRCUITPY_INTERNAL_NVM_SIZE is set in other ports to 256, 8192 or 0. Note that 8192 is a multiple of the flash si...
And I probably should have had an error like conflict with cpx or something
But again thank you @slender iron !
np
Yeah, there's no particular reason which makes this specific to nRF.
I'd also say if I was going to rewrite this I'd use a timer or interrupt handler on the falling edge of the pin instead of busy-waiting. The current way is crude but effective :-/, given the microsecond timing involved not all bad but it'd be worth trying to be a little more clever ...
@slender iron another quick question. I tried this now that I've got that value (which is running between 3 & 5) with my lighting. So I tried this:
if ambientLight < 1:
print(ambientLight)
time.sleep(0.1)
else:
print('Too Bright!')
time.sleep(0.1)
But All I ever get is too bright even though I can put my finger over the senor and watch it drop
do I have a syntax error?
try printing out ambientlight all the time and seeing what the value is when your finger is over it
well that's weird. It was moving before, but now its not
it's just steady 6 right now
In the process of looking into #703 / #1500 I noticed that socket.makefile() is missing.
In CPython, this returns a file object wrapping the socket, so normal file handle operations can be used.
In MicroPython it just returns the socket but the socket itself supports file handle operations
In CircuitPython we're going for ...
@tough pier are you doing = ambientLight.value in the loop still?
nope, I've got :
ambientLight = cpx.light
print(ambientLight)
time.sleep(0.1)
and it was working. I have tried powering off cpx, restarting MU, etc...
now it's just stuck at 6 and once after boot, it was just showing 4
where is your loop?
always post all of your code. you can use three backticks around it on each side to format it
``` <code> ```
code
Oh yea definitely, I just didn't paste that because its a given
@umbral dagger supervisor.runtime.serial_available will tell you if the USB is connected to a host. Doesn't work for non-data USB (charging cable), and also doesn't reset when unplugged.
https://circuitpython.readthedocs.io/en/latest/shared-bindings/supervisor/Runtime.html
is it possible to attach more storage to the circuitplayground express in some way?
@raven canopy It should do what I need. Thanks.
@vapid monolith The simple answer is yes it is possible. You could connect an SD Card to the CPX via SPI, but it will use most of the available pads. Also loading the driver fo the SD Card will severely limit the amount of RAM available for your code execution. Here is a link to the SDCard breakout board https://www.adafruit.com/product/254
Thanks @solar whale
You could also attach an FRAM board.
Good suggestion for a small increase in storage -- especially an I2C FRAM which needs fewer pins. I assumed that if the 2Mbye flash was all used then a larger additional storage was needed.
@slender iron I'm about halfway through the VOD of your live stream. Very fascinating!
yay! glad it's interesting @solar basin
I love coding live streams. I like to see how other people solve problems and what tools they use. Using GraphViz to visualize memory is one of the best uses of that tool I've seen lol
๐ I'm happy it no longer crashes
Can you have multiple file objects that refer to the same underlying socket?
Crude but effective is also more portable. We currently don't have a common way of doing timers and interrupts across ports.
We're only targeting the nRF52840 which should simplify the first two. The intention of CIRCUITPY_INTERNAL_NVM_SIZE is to match FLASH_PAGE_SIZE. On the SAMD21 it's 256 and on SAMD51 it's 8192.
Does that simplify things?
I think you want pull up. As is, without external pull-ups, the output values are very sporadic.
Ah, no problem. The hardware I'm using has internal pull up resistors so it works great, but lots don't so it's probably a sensible default.
@gilded cradle I have a mission for you to add to your current awesomeness!
In CPython, it looks like you can call "s.makefile()" multiple times and
get multiple different file objects, but the file objects each have a
buffer so behaviour on reads is somewhat undefined.
In MicroPython, "s.makefile()" exists only for compatibility and just
returns "s". This means that you can call "s.makefile().makefile()"
which is a bit weird.
I'd propose that in CircuitPython we should stick to a more CPython like
convention but maybe have "s.makefile()" always return the same ob...
Crude but effective is also more portable. We currently don't have a> common way of doing timers and interrupts across ports.
Yeah, that's true: I went with the simplest possible approach since I
hadn't really looked at the GPIOTE functionality yet.
It might be worth developing some kind of abstraction though, in the
longer run ...
Oh okay so '832 has a 256 byte page size? I didn't try it on that
platform yet. It certainly removes a potential nasty situation if
CIRCUITPY_INTERNAL_NVM_SIZE is a multiple of FLASH_PAGE_SIZE.
@nickzoic Looks beautiful to me. I'm learning a lot by trying to understand the code. g The time, I learned C++ was very long ago (It's C, i know)
But I don't get this line:
new_state = (new_state << 1) + (new_state ^ nrf_gpio_pin_read(self->pin_b));
I know what it's doing, but I don't know, why you have to AND it on the right side.
Hi @idle owl, what is this mission?
@gilded cradle Hey!
Hi
Ok, so the mission IF YOU CHOOSE TO ACCEPT IT: Every repo you update, please rename the examples to match the design guidelines. It's not something we want to try to go through and do all at once, but it needs to happen, because at the moment the examples bundle is a bit crazy. So! If you do something for a repo, please check the examples and make sure they're named properly.
Could you give me an example? I've been trying to name the example according to my best guess, but now I'm not quite sure if that was correct.
Ok
Every repo should have a libname_simpletest.py file in the examples folder at a minimum. Any other examples included should be prefixed with libname_ so all examples found in any given repo folder start with the library name followed by an underscore.
So for RA8875, you would want at least one example called ra8875_simpletest.py and if you wanted to add more it would be ra8875_font_example.py or something
So if there's an example in the repo already called libname_test.py or something, and that's the only one, change it to libname_simpletest.py and if there are multiple examples, make sure the others start with libname_.
Ah, ok. So for instance in https://github.com/adafruit/Adafruit_CircuitPython_FeatherWing/tree/master/examples I created a featherwing_dotstar_palettetest.py file, but maybe rename it to featherwing_dotstar_palette_example.py
No that's a fine name you gave it already!
You could change it if you think example is more descriptive
but beginning it with featherwing_dotstar is the most important bit there.
Ok, so you want me to clean up other repos?
You don't have to do it all at once. But since you're touching so many repos, if you could check each one that you touch and make sure it's good to go, that would be amazing.
But the goal is to get them all proper.
The Adabot output tracks which repos have issues
Ok, sure. I just wanted to understand what you were asking me before I accepted.
So it's in the Lib tracking issue as well.
Ah ok!
Yeah, I'm thinking if you happen to update a repo, or add something to it, check the examples as you go.
Eventually we'll get to all of them that way and it won't be a huge burden on anyone.
Ok cool. I probably may have anyways, but I'll definitely check for sure.
Thanks!
You're welcome!
Sometimes it will affect Learn guides, but we'll get emails about it and fix those on our end. So don't worry about that part of it.
Luckily the system emails when we break a link by renaming a file. Handy.
Ok, sounds good. I do have a question for you regarding the featherwing library though.
Sure!
I'm trying to extend the dotstar library for the neopixel wing and the extension works great so far, but for RTD, should I create functions and just call super().function_name() or not worry about it?
Just so I can update the examples to reflect that library better
That's stretching my knowledge, actually. How does calling super() affect RTD?
Well, I can either disregard functions that use the same parameters and I think it won't generate any documentation for that function or I can create a function, put a neopixel specific example in there and call super() which would essentially do the same thing functionally.
Oh! So you're making the DotStar FeatherWing lib more into a Addressable RGB FeatherWing Lib?
So it'll work with both?
Without duplicating a bunch of code
Yeah, it works pretty well
Nice!
I just initialize them a little differently
Ok so I would consider figuring out a different name for the lib then, and add NeoPixel specific examples, but not call Super, so it won't generate two sets of docs, it would just be one? So then it would be one set of docs with examples for both wings
or wait
I think I get what you're doing
hold on: example
https://github.com/adafruit/Adafruit_CircuitPython_CharLCD/tree/master/adafruit_character_lcd this has multiple things that use the same base code.
Is what it looks like in RTD
Does that help? Or am I still not understanding the question
(Which is totally possible)
I think so. I'll have to take a closer look when I have a little more time, but it looks like that might be what I'm referring to.
Ok! Let me know if it's not when you do get to it
Ok. I mean that's basically what I figured it would generate. I just didn't know if we should make it appear like 2 separate libraries, have 1 extend the other, or base them each off a common parent?
Right now I have 1 extending the other
But the Char LCD library looks more like 3 libraries based off a common parent
Yeah, so it might not be a great example. If you want to do extending, I'm sure it's a great idea ๐ As long as there's documentation somewhere showing that they both work, like in the examples or docstrings, I'm sure it's fine.
Ok, yeah, I was planning on having an example file for each.
It was the docstrings I was referring to when I asked about using super and all that.
That's me being a smarty-pants. The bit patterns as you rotate the dial
go 00, 01, 11, 10 and if you just translated that to a number it'd be 0,
1, 3, 2. The XOR (^) turns that into 00, 01, 10, 11 by flipping the "B"
bit if the "A" bit is set, so now you've got 0, 1, 2, 3.It compares (mod 4) the old state to the new state, and if it's gone up
by 1 it increments the counter, down by one it decrements the counter
and otherwise it just ignores the event.
There's probably better ways but it wor...
Ok. Well, I would say do whatever you think makes sense and if we need to change it up, we can. You can build Sphinx locally but it's a beast because it expects all of the dependencies to be installed. I have a venv from doing all the PyPI stuff which has every lib installed so it works locally for me. Whatever you decide will be great ๐
Ok, thanks. That helps.
My custom M4/ESP32 board is running quite well on CP. - how do I go about adding it to the official /ports/ section of the repo? PR?
"Sphinx locally...ITS A TRAP!" - Travis-ci.com ๐ญ ๐
@lime trellis which chip runs circuitpython?
looks like the SAMD, with the ESP32 running micropython.
happy to accept a PR but we are no longer supporting circuitpython on the ESP32 officially
@slender iron the adafruit_framebuf font file inclusion for circuitpython-build-tools was merged in, and apparently we missed a release from the last update (folder naming). do you want to look it over and release, or should i go ahead and do it?
go ahead and do it. my brain is deep in displayio atm
๐
@slender iron yeah @raven canopy had it right, only the SAMD is running circuitpython. The ESP32 is on micropython
still allows you access the circuitpython REPL or micropython REPL from terminal, though
@lime trellis i can assist, to a degree, while tannewt is heads down. give me a sec while i finish this release...
@raven canopy awesome, thanks!
Looking at the other boards, if my PR just includes my
- pins.c
- board.c
- mpconfigboard.h
- mpconfigboard.mk
I should be set, yeah?
@lime trellis yep. assuming your port requires no other changes (common-hal, supervisor, etc).
i peeked at your repos, and didn't see a fork of CP. but, it seems you know your way around git/github... ๐
๐ yeah I'll fork now and just drop my boards directory in. Is it going to get fussy with me if I git submodule update --init --recursive ?
is losing steam
@raven canopy should I also do a PR for the uf2-samdx1/boards/?
all good. I hope this is the last bit of displayio core work needed for bit
somehow I got 12 frames of a gif decoded but the 13th frame failed
not sure what's going on there
in my display news
unlucky number 13 I guess
@lime trellis sorry. had a kitchen..."incident". the git submodule update shouldn't cause any trouble. and i doubt you'll need to do a make translate. as for the bootloader, that's a separate thing that i'm not at all in a position to advise one way or another. PR it and find out? ๐
runs out to get food since previous efforts aren't going to work out
@raven canopy ok thanks for the help!
SAMD51 running circuitpython talking to an ESP32 running micropython.
Full board details at: https://github.com/maholli/SAM32
I think Adafruit might appreciate you using a non-Adafruit VID & PID.
Oops! forgot the VID/PID wasn't just in the uf2. Updated mpconfigboard.mk to reflect https://github.com/adafruit/uf2-samdx1/pull/45
Would it make sense to just remove the constructors instead?
So they behave like microcontroller.Processor or supervisor.Runtime?
Ok, if you've been holding out, we need somebody to be star number 1000 on the circuitpython github repo. Be that person!
Yay
Seemed like a good idea ๐
@main meteor congrats!
please send me an email pt@adafruit.com
gonna send ya out a gift for 1,000th star
If my order hasn't gone out yet, you could tuck it in with that.
Yup! I just looked at that yesterday and did exactly that. Feel free to do it for me. I've lumped mine in with a bunch of other changes.
@main meteor oh, this would be something for later - hard to stop orders, etc.
Makes sense, just a thought. I know the order pipeline is pretty, um, pipelined there.
@cpforbes Want to add the message for 28 and then close this issue?
SAMD21 is 256. I don't remember what the '832 is. Yup, they are related to simplify things.
Yup, we can add an abstraction when it'd be useful.
@nickzoic Let me know when you've added the pull up setting.
I think we're standardizing on "BATTERY" for the voltage monitoring pin's name.
I would put this on a different list. This last one takes the longest to run. How about the third on instead? It looks like it's the fastest: https://travis-ci.com/adafruit/circuitpython
opens reviews todo based on emails... @idle owl beats me to them
๐
The M4's are super popular in the store, huh? They seem to be flying off the shelves lol
That Grand Central would look sweet in M4 purple
Oops! I didn't even think about the runtimes when I suggested the last line.
First reported here with all the details: https://forums.adafruit.com/viewtopic.php?f=60&t=147212
Basic summary is that the Feather Express M4 / Adalogger hardware works with other micro SD cards that I have now tried, but the Samsung EVO 32GB card fails to initialize with CircuitPython 3.1.2 and the February 4'2019 libraries. The card is properly initialized if I use the SD Cardinfo sample application in Arduino mode. So the hardware is working fine, but something isn't quite right in t...
I was unable to get the same SD card to initialise on the Grand Central running 4.x.alpha. I attributed it to the size at the time, however I don't have any smaller EVO SD cards to test, so I can't be certain. I was able to get an off-brand 8GB SD card to work successfully.
I should be getting my Grand Central in the next couple hours and I have some 32GB Samsung EVO cards that I could try.
@raven canopy I've got "It's Automatic" stuck in my head now, so thanks for that
there's worse things to have stuck in your head... ๐บ
True, can you call me maybe ? I promise I'm never gonna give you up. If not I'll mmm-bop along to this song on my own
that. was. masterful. bravo! ๐
@solar basin we're still working out production with the grand central...its a tough one to fab
but we'll get there ๐
@tidal kiln wanna try a Quest for me?
@meager fog I have faith ๐
Yeah, I had the same issue on a Grand Central running Beta 2 with the 32GB SD card. I'll have to pull out my collection and try various ones.
@kattni
@makermelissa
Thanks for your comments. I have a Transcend 8GB, Sandisk 4GB and Kingston 2GB that do work properly. Of course, the first card I tried was the new 32GB Samsung that didn't work. :-) I'm glad I found something that works, but it sure would be better if these Samsung cards worked, too.
Note this previous issue with 32GB Samsung EVO cards, which was fixed on M0.
https://github.com/adafruit/circuitpython/issues/245
Probably worth retesting on an M0 to confirm itโs chip-specific.
Ok, I hooked up an SD Card breakout (I don't have the adalogger) to both a Feather M4 Express and a Feather M0 Express and get the following error on both:
OSError: timeout waiting for v2 card
OK @tannewt that's done and works nicely on my hardware with the power wire yanked, whereas it didn't work at all with no pullup power.
(I'm using a little board with a similar encoder to the adafruit one, plus two 10K pullup resistors.)
@slender iron looks nice!
thanks!
@meager fog sry, had an AFK side quest today. what's up?
(weird, the void MP_WEAK common_hal_rtc_get_time declaration seems to be stuffing me up in the nRF port but not the atmel-samd port despite using the same gcc for both ... I suspect something to do with the linker options, will have to investigate further)
@nickzoic Thx for the explanation. It very cool bit manipulation. I like this kinda stuff. :+1:
I'm not asking for this to happen, I am curious: Is there a reason CP doesn;t support the stm line, specifically the pyboard and such>
@marble hornet because adding API support would take a lot of time
shame microchip doesn't make arm chips w/ 1mb ram ๐ข
๐
you could always add stm support ๐
someone is working on adding stm32f4 support to tinyusb
ooh! when I finally run of ram I might ๐
might**will
or fpga it with a separate ram chip depending on the support as the time. thank you for showing me litex!
๐
ee21cc1 Start on rotaryio.IncrementalEncoder adafruit/c... - nickzoic
21eb7e8 GPIOTE handlers for rotaryio.IncrementalEncoder... - nickzoic
95454ec useful output from rotaryio adafruit/circuitpyt... - nickzoic
a7c349b Add quarter-click logic to adafruit/circuitpyth... - nickzoic
b9db977 Change pin mode to pullup for adafruit/circuitp... - nickzoic
(I apologize upfront...I haven't been circuitpythoning for a few months). I have a library i wrote for an early version of cp. i want to create .mpy... i cloned circuitpython and ran "make" within mpy-cross. Sadly, I wasn't able to gleefully just get this done... Traceback (most recent call last): File "../py/makeqstrdata.py", line 21, in <module> import huffman ModuleNotFoundError: No module named 'huffman' Before I bumble about for many hours, i wanted to ask if there were mpy-cross built for the OSs (I use High Sierra)...if not, can you please let me know if it is easy to "fix" this error? Thank you.
welcome back @bronze geyser !
did you git submodule update --init --recursive . in the top level?
@slender iron Thank you. I wasn't really gone...i just got enthralled with Flutter ... i mean...a IDE thingy called Flutter? Gotta try that out...and then...Dart...Dart? hmmm...
๐
@slender iron ah! Righto. I'll give that a twirl... it's coming back to me (yah, right).
@slender iron btw - i wish your HHH on the Eastside was like a breakfast of lunch...
it wouldn't be happy hour then ๐
I'd be happy to attend an earlier event
(pycascades is at UW in a couple weeks)
Hey all, what's the best circuit python board for ADC's? I want something with both a decent resolution and high baud rate. Thanks ๐
@slender iron i mean...isn't Happy overrated when we could all just be hilariously pleased? OK. I'll stop...
"baud rate"? Do you mean sample rate?
Yeah
CircuitPython doesn't support high speed ADC sampling now
All good, thanks
@slender iron Do you have time to vid chat to get me started with register? I think I simply don't get it. Or am missing something obvious here.
sure!
While trying to hack up a third-party DPFP-based version of CircuitPython for the Trinket M0 compatible TI-Python Adapter, because SPFP just doesn't make the cut for math purposes (it can easily yield wrong results for high school level math problems, i.e. the target audience of this thing; all other calculator-based implementations of Python use DPFP, for excellent reason !), I stumbled across a couple shadowing variables, and most of all, several *variables which can be made "static...
if anybody is interested, here is the recording of my fosdem talk about circuitpython and games: https://fosdem.org/2019/schedule/event/python_games_with_micropython/
@stuck elbow thanks for the link! I'll definitely watch it
@stuck elbow oh man, those hand-drawn slides are cool.
nice!
@prime flower thanks
Should this work? >>> from adafruit_bus_device.spi_device import SPIDevice Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name SPIDevice thank you.
@bronze geyser it should, yes. Do you have the bus device library installed?
@raven canopy thank you for the reply. Yes. But they were the originals installed on my Itsy bitsy...i just updated to CP 3.1.2 ... perhaps the libs need to be updated too.
Only need update if major version changed, or fixes. ๐ค
@raven canopy ...oh..bummer...
@raven canopy hokay...turns out the libs on my CIRCUITPY mustabeen bad. When reinstalled...worked. Thank you very much for your reply.
@stuck elbow cool talk. i like how you went into some detail about framebuf stuff.
these adabot cron failures are starting to annoy me...
is it a travis issue?
yeah. there are 4 scripts that run. 1st completes without fail. 2nd one does nothing, and trips the "10 minutes no-output" limit. but....not always.
yeah, travis is super buggy. The rust-lang team is looking for alternatives.
I think AWS CodeBuild might be viable for people who want a managed solution and Jenkins for those that can run their own servers.
maybe no mac support on codebuild though?
does microsoft own travis now?
not that i know of
ok, I wasn't sure if it was part of github
@slender iron I finally got around to wiring up a displayio test app; just wanted to say that even though I knew about the blinka, it was a nice surprise to see it ๐
๐ glad it worked!
I of course forgot to change the pins and was scratching my head for a bit there but I finally figured it out :p
yup, I've been there
I just fixed my standalone circuitpython by realizing I had hard coded the pins
hah, I suppose we're only human ๐คฃ
yup, fixed it today ๐
also the OnDiskBitmap example code works great; I now have a pretty flower on my screen
I take that back, I think I had to change the Sprite to a TileGrid, but otherwise it works great
ya, I haven't removed all of the Sprite mentions yet
@exotic pumice went searching the travis blog to see if i could find any news to explain my issue. came across this post that Travis has been acquired: https://blog.travis-ci.com/2019-01-23-travis-ci-joins-idera-inc
When we started working on a Continuous Integration solution back in 2011, it was hard to imagine what Travis CI would become. Years later, weโre still continuously working to make our community an...
I just ran a test on a Trinket M0 with CircuitPython 2.3.1, 3.1.2 and 4.0.0-beta.2-23-g72f0783b6
(name='circuitpython', version=(2, 3, 1))
1000 20 character lines
Run time = 1.575s
Done
(name='circuitpython', version=(3, 1, 2))
1000 20 character lines
Run time = 2.175s
Done
(name='circuitpython', version=(4, 0, 0))
1000 20 character lines
Run time = 0.554s
Done
Test main.py:
import sys
import time
def a(size, count):
str ...
@raven canopy I don't understand the '''-o $LIB_CHECK_CP_FILE''' ... I mean I get you are saving the log but I don't see that option in python, I mean it worked before, I'm just not familiar with it. The only other thing I can see is that the step it does in typically takes 8-9 minutes. I assume the log shows up to both the file and the terminal. Looking at the prior successful run it seems to go to the terminal. Maybe add a tail of the log file to the command?
Maybe this -o causes output to only display at the end of execution? Maybe just pipe it to the log and tail the log in tandem?
Splitting the script up if possible may work instead.
Thank you @cpforbes! I'll close it. @hchhaya please let me know if you disagree and we can reopen.
From where can I learn circuit Python.
Most of the boards that run CircuitPython have guides to get you started like this one https://learn.adafruit.com/adafruit-circuit-playground-express/what-is-circuitpython
There's also this "getting started" guide: https://learn.adafruit.com/welcome-to-circuitpython
in the guide https://learn.adafruit.com/how-to-program-samd-bootloaders/programming-the-bootloader-with-atmel-studio it suggests using ATMEL studio even on Linux or Mac -- iIs it preferred over using the Jlink tools directly?
seems like a lot of extra work to install Windows in a VM in order to use the JLink
Microchip offers their MPLAB for Mac and Linux, I was hoping that after they acquired Atmel that Studio would get ported too, but alas no such luck.
It does look like MPLAB has beta support for SAM E processors but I don't see SAM D.
@terse kayak the -o is used with argparse in the script for various command line arguments. I'm starting to think that it is a Travis problem, or at least a limitation that I haven't designed for. I appreciate you looking though! I may end up splitting to either a matrix or stage approach on Travis.
@solar whale You can use OpenOCD with the Arduino IDE to flash the bootloader using a jlink, but I was running into issues with it on MacOS.
@prime flower thanks. I was just curious. I thought it could be done with jlink tools directly.
flashing with AS7 yields pretty high repeatability. I'm not sure if you can flash the bootloader from the jlink tools, you need to set a bootloader unlock bit prior to and after flashing
Ok - thanks! Iโll experiment and let you know if I learn anything..
As an AS7 user, I'll just note that it uses the jlink software underneath (jcommander, jflash, etc).
@solar whale I just use the jlink tools directly on my mac
I've used them to load uf2-samd for bare chips, all my custom boards. I think done adafruit boards too
How do you set the fuse bits?
I've never had to, as far as I know.
I just use loadbin in jlink commander mostly. I think I used gdb as well I've or twice (for loading bins). Also for debugging of course
I think thatโs what I have done. Also seem to recall using gdb for fuse bits. Iโll dig into notes. Sounds like there are options.
Ah SAMD51 The SAMD51s bootloader protection can be temporarily disabled through an NVM command rather than a full erase and write of the AUX page. The boot protection will be checked and set by the self updaters. So, if you've used self-updaters but want to load it directly, then you'll need to temporarily turn off the protection. In gdb the command is: set ((Nvmctrl *)0x41004000UL)->CTRLB.reg = (0xA5 << 8) | 0x1a
Found my old notes. Iโll try various methods... need to finish installing windows 10 in Virtual box. May be useful to have anyway.
@main meteor thanks for the support.
I'm really not loving these CP exceptions thrown without any data/message.
I'm getting a TypeError with no message from self.update(zip(parms, args)) from within a method of a subclass of dict. parms and args are tuples. The code works fine verbatim in the REPL (with empty tuples as they are in the case that throws the error).
I have so much to learn -- sorry I can't help. I have no idea what this means from within a method of a subclass of dict. ๐ค
@umbral dagger if i'm not wrong update needs a dict and zip returns a set
which would be a type error
zip actually returns a <class 'zip'>
d.update(zip(('a', 'b'), (1, 2)))```
works as expected
So with no information in the error I have no idea what's happening.
Run dir() on what zip returns?
Just __class__ and __next__
So basically an iterator, I guess
So it seems
What are the contents of the tuples?
They're empty
Here's the full context:
"An environment: a dict of {'var':val} pairs, with an outer Env."
def __init__(self, parms=(), args=(), outer=None):
# Bind parm list to corresponding args, or single parm to list of args
self.outer = outer
if isa(parms, Symbol):
self.update({parms:list(args)})
else:
if len(args) != len(parms):
print('Different lengths')
raise TypeError('expected %s, given %s, ' % (to_string(parms), to_string(args)))
self.update(zip(parms,args))
def find(self, var):
"Find the innermost Env where var appears."
if var in self: return self
elif self.outer is None: raise LookupError(var)
else: return self.outer.find(var)
And it's constructed with Env()
Hmm. I know there are warnings for empty lists as default args; not sure if it applies to all iterables.
No, I mean as a function argument.
def __init__(self, foo=()):
oh...
May only apply to mutables, though. Still looking. Here is one explanation, but they only mention mutables. https://docs.python-guide.org/writing/gotchas/
Hmm.. this is from presumably working code.
Right now we're strict about requiring explicit remount of the filesystem to make it writable. Instead, we can detect when we're mounted by a host and be smarter about who should have write access.
So, if you are off USB you'd be able to read and write the filesystem without any CircuitPython specific code.
If you are off USB and then plug it in:
- If you have a file open for writing, then the filesystem will be read-only to the host.
- If your code isn't running or all open files are...
@umbral dagger is isa defined in your code somewhere? I can't find that function. It does look to be the same as isinstance though.
it's aliased to isinstance
OK, a different project/problem. Uart has had some changes in the latest 4.0: only bytearrays, the timeout is in seconds, and the length parameter has been dropped. Anything else?
I'm getting timeouts and everything looks ok.
@umbral dagger https://github.com/adafruit/circuitpython/issues/1128
Only happens on reset.
AnalogOut(board.D1) works fine on first power-on
but if you reset with RST, or the button, then
Press any key to enter the REPL. Use CTRL-D to reload.soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Traceback (most recent call last):
File "main.py", line 25, in <module>
OSError: [Errno 5] Input/output error
Adafruit CircuitPython 3.0.2 on 2018-09-14; Adafruit Feather M0 Express with samd21g18
>>> from dastels_env_test import Env, Env2
>>> foo = Env()
parms type: <class 'tuple'>; args type: <class 'tuple'>
parms id: 224576; args id: 224576
>>> bar = Env(parms=('a', 'b'), args=(1, 2))
parms type: <class 'tuple'>; args type: <class 'tuple'>
parms id: 536878384; args id: 536878400
>>> foo
{}
>>> bar
{'parms': ('a', 'b'), 'a': 1, 'args': (1, 2), 'b': 2}
>>>
@umbral dagger finally home to give this a shot. I had to change the isa line to if not isinstance(parms, tuple) and added some debug prints. but...works for me on both the above and in CPython.
though, the result in bar is...interesting.
hmm.. parms & args shouldn't be there
yeah. also, i didn't get that with CPython. ๐คท
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
RESTART: C:\Users\somme\Documents\Electronics Projects\CircuitPython\dastels_env_test.py
>>> boo = Env(parms=('a','b'), args=(1,2))
parms type: <class 'tuple'>; args type: <class 'tuple'>
parms id: 1854991057032; args id: 1854991119432
>>> boo
{'a': 1, 'b': 2}
>>>
i think it may be how circuitpython handles object inheritance:
>>> class foobar(dict):
... def __init__(self, parms=(), args=()):
... print(parms, args)
...
...
>>> foo = foobar(parms=('a','b'), args=(1,2))
('a', 'b') (1, 2)
>>> foo
{'parms': ('a', 'b'), 'args': (1, 2)}
>>>
note: this is being run on v3.0.2, so could be due to out-of-date firmware
I'm digging and it seems to be another exception that was getting buried somehow.
It's something written for cpython that I'm porting to CircuitPython
@slender iron I am changing persistence and it's altering the data stream! So it's visibly working!
great!
@slender iron wait, so if I'm working in the high bit, how does it know? if I set width = 2 it knows there's two bytes, but how does it know I want the 7th bit on the high byte? Do I use 16 instead?
ya
ok
well 15
oright
16 would be the first of the third
@umbral dagger this may be related to the dict inheritance. just something to keep an eye on as you port. https://github.com/adafruit/circuitpython/issues/1017
@slender iron crazy cool stuff you got going on with the REPL
thanks!
Is it better for me to invest in the Particle Argon or Adafruit Feather nRF52840 Express?
Primarily for Circuit Python
Hmm that would be helpful
But if we get the bootloader out of the way...where is circuitpython support on the Argon?
Because it of course has a co-processor which makes it more desirable for $3 more.
darn
I did see this guide
Looks fairly straight forward
I can't make any promises we'll keep supporting it
those of us who work for adafruit work primarily on supporting adafruit hardware
we won't break others but won't necessarily fix it either
I understand
@haughty bobcat the argon works well with CP and I have found it to work well with the ESP32 co-processor as it now stands. However, I expect that there will not be a lot of future development for the UART based interface to the ESP32. Future work is targeted at a much more reliable SPI interface that unfortunately cannot be supported by the argon. It is a fun way to use the chips and there may be other ways to work with it but I think there will be better options in the future.
I donโt want to discourage you. It is great fun! I also am having a lot of fun using an argon and xenon in the particle.io environment.
The mesh network is impressive.
Watch this space https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI ๐
FYI, my board has both UART and SPI interface to the ESP32 ๐ https://github.com/maholli/SAM32
@haughty bobcat everything you need to order and build your own on the github ๐
Early sucess
still getting that TypeError huh? ๐
indeed. i never experienced LISP; only heard of it..
Best approach to programming IMO
Soon you'll be able to try it from the comfort of CircutPython.
@slender iron is that any good?
fun so far ๐
i throw my hands up at Travis. restarted yesterdays adabot cron job...passed. ๐คท
@raven canopy I successfully got my ๐ m4 into a soft reboot loop, so ๐
yay computers ๐
hehe. ikr.
i get a hardfault/crash and reboot so hard to get any more details
@meager fog -- yes I do
ok load that bin with esptool as normal
then verify with terminal on esp32 that its loaded
then you need to connect to the following esp32 pins
(so you'll need to look at the schematic -- some of the pins are 'mosi' and 'sda')
ESP Reset - the reset pin
ESP GPIO0 - natch
ESP CS is IO5
ESP MOSI is IO14
ESP SCK is IO18
ESP Busy/Ready is IO33
you dont need RTS/RX/TX
ESP MISO is IO23
then power pins
OK -- looks great -- can I use teh NINA-W102.bin on the esp32?
cool! I wil give it a try later tonight or tomorrow. Thanks!
who wants to learn rust and help me finish my samd51 hal lol? I'm pretty stuck
I don't actually expect anyone to be able to help, just venting
What is a hal lol?
hardware abstraction layer
library for bringing up the device and accessing peripherals
you know where to find it, right?
Yeah, I was looking at it yesterday
cool
hopefully I just missed something simple
it desperately needs fresh eyes
I'd look at the datasheets and the adafruit clock stuff for comparisons
and the required background knowledge
lets head back to gitter
upcoming circuitpython newsletter in draft, add anything as a PR! https://github.com/adafruit/circuitpython-weekly-newsletter/blob/gh-pages/_drafts/2019-02-12-draft.md
I'm going shopping, what should I buy?
I don't have all the toys money lol
some of them
That's the idea lol
you mean adafruit stuff, or are you just looking for life advice?
Adafruit stuff lol
what do you have?
Feather M4 & 2.4" TFT FeatherWing plus a TON of stuff I got a few years ago
Should I upgrade to the 3.5" TFT FeatherWing?
๐คท
I think I'm going to get an Adabox 10
You think so?
no wires is pretty dope
What's that? Other than the BT it's inferior to the M4, isn't it?
get a battery, you're golden
Yeah! I want a crickit
oh snap, 256k sram
@pastel panther you sold me brother
I'm also considering the Particle Mesh boards (in addition to the nRF52 Feather Express)
i'd as @solar whale 's advice about those. I think he has a bunch
apparently the're working on getting the yields up
I think. Said something about mfg being tricky
Yeah, ladyada was telling me that the other day
maybe get a esp32 module? They're working on getting it to work via spi as a wifi helper
oh, if you're going to do any c dev on a m4/m0 get a jlink mini edu
ok, really leaving now
@solar basin "(nrf52840) it's inferior to the M4". Actually, it is an M4 underneath. However, it does run at a lower speed (60MHz, iirc).
I meant the atsamd51
In that sense, yeah, I'd consider it inferior since the BT consumes a bit of architecture.
I'll have a Feather M4 and a Feather nRF52840 so I'll be set either way lol
Yep! That's a solid plan. ๐
@pulsar ferry what's your favorite Adafruit product?
That's like asking "what's your favorite time to eat bacon". ๐
Good point
If I had to narrow it down, farthest I could get is "the Feather Family". Great general size for almost any project, and the standard modularity to boot.
Yeah, I'm loving the format with my M4/TFT FeatherWing
Mine varies depending on what I'm working on. Circuit Playground Express is a recurring favorite. Another popular one is the motor+stepper featherwing. I'm also fond of the Hallowing and the FONA 808. There are also useful things (like micrograbbers and robot arms) that aren't AdaFruit products, but they're available in the store.
Also the ItsyBitsy M4 Express: that's an absurdly capable board, with 2 analog outputs, a 5V logic output, plenty of horsepower to run CircuitPython or demanding Arduino programs, all in a small, breadboardable, cost-effective package.
Hi Adafruit Community!
I have been trying to make a custom CircuitPython package for a new board that I have created based around the M0. I am having issues getting the CIRCUITPY USB drive to show up for CircuitPython when attached to a USB port.
COM port is present and working (can log into CircuitPython and use it).
I am using a flash chip that does not appear to be supported by CircuitPython or I am making a mistake somewhere. It is using the [SST26VF016B](http://ww1.micr...
Wow, the __weak rabbit hole just keeps going deeper. If I keep the void MP_WEAK declarations in, but change either of the error messages, so that they are different, it works correctly, eg:
void MP_WEAK common_hal_rtc_set_time(timeutils_struct_time_t *tm) {
- mp_raise_NotImplementedError(translate("RTC is not supported on this board"));
+ mp_raise_NotImplementedError(translate("RTC is not supported on this board X"));
}
... and suddenly the actual common_hal_rtc_ge...
OK so I should be wrapping all the NVM stuff in the Makefile and elsewhere in #if NRF52840 then?
@meager fog for the ESP32SPI on the feather huzzah esp32 -- how do you connect to GPIO0? It is not on the Header. Did you have to add a wire? I am trying it on on the ESPRESSIF board since it has all the pins broken out.
@meager fog OK -- got some basics working with the ESPRESSIF board simpletest works (except for ping) good start!
Page 23 of the datasheet for that chip says that the 0x9F (9FH) Read JEDEC ID command responds with0xBF, 0x26, and then 0x41. Datasheets for other chips say that the third byte describes the capacity. The datasheet does not say anywhere that the chip responds with 0x15 for anything, which is what you set the capacity to. So try this:
.capacity = 0x41, \
There may be other issues, but that's what I see at first glance.
Thanks @dhalbert . I'll give it a go tomorrow (It's very late down in Oz right now) and report back.
hello all! I'm trying to read 4 temp sensors using circuitpython, currently using arduino and it works.
from adafruit_onewire.bus import OneWireBus
from adafruit_ds18x20 import DS18X20
ow_bus = OneWireBus(board.A0)
Therm1 = DS18X20(ow_bus, 0x28, 0xFF, 0x01, 0xCD, 0x53, 0x14, 0x01, 0x37)
Therm2 = DS18X20(ow_bus, 0x28, 0xFF, 0xED, 0xCA, 0x53, 0x14, 0x01, 0x4A)
Therm3 = DS18X20(ow_bus, 0x28, 0xFF, 0x0B, 0xC2, 0x53, 0x14, 0x01, 0x10)
Therm4 = DS18X20(ow_bus, 0x28, 0xFF, 0x4F, 0x9E, 0x53, 0x14, 0x01, 0x2C)
the code stops here, Therm1 is line 60 with:
Traceback (most recent call last):
File "code.py", line 60, in <module>
TypeError: function takes 3 positional arguments but 10 were given
I want to use the sensor addresses so i make sure i'm reading the correct one
while True:
print('Temperature: {0:0.3f}C'.format(Therm1.temperature))
print('Temperature: {0:0.3f}C'.format(Therm2.temperature))
print('Temperature: {0:0.3f}C'.format(Therm3.temperature))
I'm not sure why you are giving all those numbers to the calls. It should just be the bus object and the sensor address.
Therm1 = DS18X20(ow_bus, <address>)
I just copied it from what I was using for the arduino, I'll try and find the address, Thank you
It looks like the canonical approach is to do something like ```python
sensor_addresses = ow_bus.scan()
sensors = []
for sensor_address in sensor_addresses:
sensors.append(DS18X20(ow_bus, sensor_address))
What I don't know offhand is how the addresses are expressed in CircuitPython, but you could just run something like ```python
print(ow_bus.scan()[0])
Looks like they're byte lists, so if you wanted to use explicit addresses, you could probably do something like ```python
Therm1 = DS18X20(ow_bus, [0x28, 0xFF, 0x01, 0xCD, 0x53, 0x14, 0x01, 0x37])
I was trying to follow the example from https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-circuitpython/circuitpython and in place of ow_bus.scan()[0] us my address.
I will try that now
now I get:
Traceback (most recent call last):
File "code.py", line 60, in <module>
File "adafruit_ds18x20.py", line 48, in init
AttributeError: 'list' object has no attribute 'family_code'
looks at more source code
I was wrong, it's not just a list of bytes, it appears to be a OneWireAddress object
Really guessing here, but maybe something like ```python
from adafruit_onewire.bus import OneWireBus, OneWireAddress
Therm1 = DS18X20(ow_bus, OneWireAddress([0x28, 0xFF, 0x01, 0xCD, 0x53, 0x14, 0x01, 0x37]))
THANK YOU!!!! I made it past that part of the code!! I will try and figure out how to print the temps now.. I may be back
you could do something like:
import board
from adafruit_onewire.bus import OneWireBus
from adafruit_ds18x20 import DS18X20
ow_bus = OneWireBus(board.D5)
ow_addresses = ow_bus.scan()
Therm1 = DS18x20(ow_bus, ow_addresses[0])
Therm2 = DS18x20(ow_bus, ow_addresses[1])
Therm3= DS18x20(ow_bus, ow_addresses[2])
Therm4= DS18x20(ow_bus, ow_addresses[3])
unless you actually know the 64 bit rom code for each sensor
OK -- well - the espressif board works well! I'll go back the Huzzah32 later today and try it.
nice -- I posted some stuff to the PR -- ping is broken...
probably ๐ im doing more intense sockets stuff instead
but lots working well!
ping was a bit of a throwaway function
having a funny issue with connecting after reset -- always takes 2 tries for me -- I'll look deeper into it. not a big problem, but annoying...
ok -- good to know -- so just gpio0 is "optional"
yeah
Great -- Thanks for getting this out for testing
yeah you can go pretty fast with SPI
My dog is desperate for a walk -- back later!
๐ถ
while you're here @meager fog , should I add a pull request to add my patch for a higher speed I2C option to your nRF52 feathers (753Khz), or do you not want to support such a "hack"?
@prime grove PRs are always welcome. I suggest PRing what you have now for early feedback. Don't put more time in until we OK the approach
ok
got it - thanks
@meager fog It is now working on the Huzzah32 with a feather_m4_express -- I did have t o pass a pin for GPIO0 to the code, but I just left it disconncected. It would not accpet None for the pin since it trues to set it as an output. Otherwise working well.
yeah
did you write the code for the ESP32? NINA_W102.bin?
or in either case do you have a link to it?
its compiled from here
thanks!
i commited my minor change
I'm glad we did that CP cheatsheet... it's nice having things in ne place. I'm making use of it today ๐
yes!
@meager fog just for fun -- I cloned the nina-fw repo and did make then make firmware it built an image that seems to work! Is there anything else needed to do? when I do a byte compare of my binary with the one you provided yesterday, they have lots of differences. Was that version with your latest commits? Just curious -- nice to be able to reproduce things...
@umbral dagger mind linking to said cheatsheet? ๐
@solar whale i dont know why it doesnt bytecompare
maybe ESP IDF version change?
:/
i had a lot of trouble compiling it
or I may have a different ESP tootchain commit -- mine is from mircropython
@lime trellis https://github.com/adafruit/awesome-circuitpython/blob/master/cheatsheet/CircuitPython_Cheatsheet.md
seems to work, so I won't worry too much ๐ just want to make sure I did not miss any steps/
@umbral dagger thanks ๐
I โค that cheatsheet
<@&356864093652516868> Here is the notes doc for tomorrow's Weekly. Feel free to add your hug reports and status updates! https://docs.google.com/document/d/1lN3bcPqdNaL3vFCIUMcrCrJkbvyWuIBnvWpR1TqVOOU/edit?usp=sharing
@idle owl are you taking over for tannewt in the meetings?
@marble hornet We're both running the meetings. Typically every other week.
simplified math re-factor, feeding 1MHz in:
>>> for i in range(1000):
... values.append(freq.value)
... time.sleep((freq.capture_period / 1000))
...
>>> min_value = min(values)
>>> max_value = max(values)
>>> min_value
999800
>>> max_value
1067000
>>>
6% max variation is an improvement. still think we can do better. ๐ข โฒ
@slender iron I'm working on a touch screen keyboard, python side, think that the terminal could be run above a certain area and the keyboard could run below it ?
protip y'all: if you update the linux kernel you have to reboot before ttyACM0 will come back. I spent hours trying to reflash the bootloader and that was the only problem
protip #2: if you give advice in a guide to be careful of "auto continue" breakpoint features when dealing with time-sensitive functions...remember it. fought my by-hand math comparison to function results for a week...breakpoint was the sole source of huge variations. ๐
yeah. realized it this morning. desk, meet head. ๐
@exotic pumice from what i remember off the top of my head, the biggest effect is sleep[walking]. may also play into periphs automatically calling for a specific source (GCLK_EIC, for instance).
hmm
setting the ondemand bit makes my whole device lock up, and that's the only difference in my oscctrl and yours
is there another place I should look other than oscctrl for my clock issues?
which clock? DFLL?
yeah
hmm.
actually, there's a chance there's something different in one of the subsections of oscctrl
but not the dfll part
i'm not seeing anything in the latest errata. trying to see if that register is enable-protected, since DFLL is started automatically.
oh nevermind
I must've messed up my diff command or something
1 sec
oh nevermind the nevermind
I was like hang on, DFLLCTRLA is coming up different! (that's where ondemand is)
so yeah
I should probably do homework now since I wasted most of the day on this, let me know if you think of anything
will do! have fun with hw. ๐ช
oh I have 1 more idea to try
I thought maybe setting the gclk divider to 0 would do something because we had to set dfllmul to 0
@exotic pumice from the sheet for DFFLCTRLA (why didn't i go there first):
If On Demand is set, the DFLL will only be running when requested by a peripheral and enabled
(DFLLTRLA. ENABLE=1). If there is no peripheral requesting the DFLLโs clock source, the DFLL will be in
a disabled state.
make sure its called as a source?
I have it unset
you have it set
on second thought, dividing by 0 is never a good thing
disabled here, and nothing happens with DFLL in clock_init since its auto-enabled on reset. https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/asf4_conf/samd51/hpl_oscctrl_config.h#L271
and yeah, please don't implode the earth dividing by zero. ๐ซ
well pycortexmdebug disagrees
