#circuitpython-dev

1 messages ยท Page 230 of 1

tulip sleet
#

i should put a pointer to Building CircuitPython guide into the README

manic glacierBOT
manic glacierBOT
marble hornet
#

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?

exotic pumice
#

gif decompression sux

#

I spent like 2 hours translating a c library to python and it returns all zeroes

manic glacierBOT
exotic pumice
#

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

gilded cradle
#

What do you mean by deal with bits between bytes? like b("0xFF80") would just be two bytes.

#

Did you try bitshifting?

main meteor
#

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

gilded cradle
#

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.

exotic pumice
#

so like, the part I'm confused on is the BBB BB

main meteor
#

For example to pull out the value of "B" (which spans two bytes): ```python
b = x[0] << 2 | x[1] >> 6

gilded cradle
#

He's saying that he read those bytes and used shifting and masking to assemble them into the correct numbers

main meteor
#

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.

gilded cradle
#

Good explanation

exotic pumice
#

I have to work out the shift programatically for a variable amount of bits

#

like 2 bits, 5 bits, etc.

gilded cradle
#

Are they always 5 bits?

exotic pumice
#

no, that's what I mean by variable

gilded cradle
#

Ok, but if I remember gifs correctly, you read a byte that tells you how much more to read

exotic pumice
#

I've read in all the data, now I'm working on the decompression

gilded cradle
#

Ah, I see.

main meteor
#

Ah, the LZW code? That's thorny.

exotic pumice
#

yeah

main meteor
#

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.

gilded cradle
#

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.

main meteor
#

Yeah, as long as you keep track of how many bits are left in the variable, that should work.

exotic pumice
#

I like bodger's idea

gilded cradle
#

Yeah, go with whatever makes more sense to you.

exotic pumice
#

I'm kinda taking both your ideas

#

I'll show you when I'm done

gilded cradle
#

Cool

exotic pumice
#

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
gilded cradle
#

It's a little difficult to read, but something like that

exotic pumice
#

it might work

#

I got the right value out of it but could be a fluke

#

bitmath is always hard to read

gilded cradle
#

yeah

main meteor
#

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.

exotic pumice
#

somehow I got 12 in 3 bits ๐Ÿ˜›

#

now that's compression!

gilded cradle
#

lol

manic glacierBOT
exotic pumice
#

I almost got it

gilded cradle
#

Nice!

exotic pumice
#

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

exotic pumice
#

I got it to work for a 10x10 image

#

but not for bigger ones that have multiple blocks before a clear code

#

or something

manic glacierBOT
plucky briar
#

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.

raven canopy
#

@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
plucky briar
#

@raven canopy Thank you, that should work, greatly appriciated!

solar whale
#

@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.

raven canopy
#

@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. ๐Ÿ˜ฆ

solar whale
#

ok -- not a problem -- I was just curious.

raven canopy
#

no worries. i wish it was a dead-of-night cron, but is what it is. ๐Ÿ˜„

solar whale
#

It's best to choose your battles when dealing with Travis ๐Ÿ˜‰

manic glacierBOT
pastel panther
plucky briar
#

@pastel panther That's it, thank you very much!!

pastel panther
#

no problem, glad to help

hazy gust
#

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```
exotic pumice
#

I have a clear code wiping out my table, and then a prev_code referencing into that table, not sure what to do

manic glacierBOT
manic glacierBOT
slender iron
#

<@&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.

manic glacierBOT
manic glacierBOT
#

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...

manic glacierBOT
manic glacierBOT
idle owl
#

@solar whale I'm guessing you tested the magnetometer update you PR'd? (It looks right but I wanted to verify)

solar whale
#

@idle owl yes, I can add a note to the PR.

idle owl
#

If you'd like to, that would be great. But no worries if not. I'll take care of the PR. ๐Ÿ˜ƒ

solar whale
#

Thanks

idle owl
#

Done!

manic glacierBOT
slender iron
marble hornet
#

awesome!

slender iron
#

heh, fail

idle owl
#

Yeah it doesn't render links like that.

raven canopy
#

Lol. Or not..

marble hornet
#

ah well

raven canopy
#

Wait. Missed formatting

errant grail
#

Lurking from the studio again today. Will be back "in voice" next week!

raven canopy
#

Err. Nope. Maybe it has to be in a div? ๐Ÿคท

#

Not worth the energy...

slender iron
turbid radish
#

lurking here also

pastel panther
#

Gotta split, I'll leave some notes in the notes; if someone wants to read them, great. Thanks!

#

๐Ÿคฝ

marble hornet
#

siddacious = (siddacious[0:2], siddacious[3:5])

#

๐Ÿ˜‰

meager fog
#

@umbral dagger ping

umbral dagger
#

@meager fog pong

meager fog
#

can you 'move' the cheetsheet repo

#

and we'll put in the newsletter

#

then u can fork it

#

(to make more changes)

molten sentinel
#

Lurking

umbral dagger
#

yeah

#

I should lurk too...

#

OK.. lurking

slender iron
#

๐Ÿ‘

wraith tiger
#

Iโ€™m lurking too.

turbid radish
#

@umbral dagger , I can move if you cannot

meager fog
#

@turbid radish you cant move it, he owns the repo ๐Ÿ˜ƒ

turbid radish
#

gotcha

#

@gilded cradle blinka_cooking

wraith tiger
#

I missed the stream. Iโ€™ll have to check out the video.

umbral dagger
#

@turbid radish I should be able to fork/PR awesome-circuitpython... watch for it.

meager fog
#

@umbral dagger any luck with moving Cheatsheet? if you cant move to an org, try moving it to me (ladyada)

turbid radish
#

Aw ๐Ÿ˜Š

turbid radish
#

MikeB is good ๐Ÿ˜ƒ

umbral dagger
#

@meager fog @turbid radish PR submitted to awesome-circuitpython to add the cheatsheet in a dir as suggested.

meager fog
#

oooh ok i thought we were going to move the repo

#

but this is fine ๐Ÿ˜ƒ

raven canopy
#
  • @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!
meager fog
#

i was confused

lone sandalBOT
turbid radish
#

It was my understanding it was rto be a subpage of awesome circuitpython

umbral dagger
#

@meager fog no worries... I don't have repo creation perms. This way we can just use the PR approach for updating.

meager fog
#

๐Ÿ‘

#

all good

umbral dagger
#

@turbid radish Add a link in the main awesome file?

solar whale
#

๐Ÿฟ not quite a GroundHog

turbid radish
#

yes - would you like to PR or have me do?

umbral dagger
#

@turbid radish You can... where & how, etc.

turbid radish
#

ok, I'm on it

inland tusk
#

Saturday was groundhog day๐Ÿ˜‹blinka:

inland tusk
#

Jutst want to know if midi-usb has been ncluded in 3.0 or 4.0? I have been using the aws version.

slender iron
#

it should be in 4.0

lone sandalBOT
turbid radish
#

@meager fog - PT informed on Slack for Newsletter

marble hornet
#

brb

turbid radish
#

Yay @idle owl ๐Ÿฆ…

lone sandalBOT
umbral dagger
#

@turbid radish New PR to fix my name

turbid radish
#

merged

#

astels'

marble hornet
#

nice!

raven canopy
#

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:

umbral dagger
#

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.

inland tusk
#

What about wraapper for midi msgs.?

raven canopy
#

kk. Thanks!

errant grail
#

Ladyada has a MIDI library in the works. JP used it recently. Channel mgt is included.

slender iron
idle owl
#

S3 bucket.

marble hornet
#

@raven canopy did you try [This is a link](https://tinyurl.com/ycepjur2)?

inland tusk
#

@idle owl yes that is right

raven canopy
#

@marble hornet unsuccessfully before, and Scott tried earlier which prompted my HTML attempt.

marble hornet
#

ah, try the link tho!

errant grail
#

Thanks everyone! blinka

raven canopy
#

Thanks everyone!

turbid radish
#

Thanks all!

wraith tiger
#

๐Ÿ‘‹

marble hornet
#

me too

raven canopy
#

๐Ÿ‘‹

molten sentinel
#

Thanks !

slender iron
#

thanks @molten sentinel

#

JLinkGDBServer -if SWD -device nRF52840_xxAA

solar whale
marble hornet
#

can we chat about blit later?

slender iron
#

@marble hornet ya, I can hang out

tidal kiln
#

compiled vs. interpretted

slender iron
marble hornet
#

someone walking in, i don;t want to share thier audio, sorry

devout flame
marble hornet
#

got the pointer system working! can;t wait to hook up a touchscreen

#

!

manic glacierBOT
manic glacierBOT
slender iron
#

@idle owl thanks for the merge! I'll do beta.2 once travis gets through that

idle owl
#

@slender iron Sounds good!

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 4\.0\.0\-beta\.2
slender iron
manic glacierBOT
#

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...

slender iron
idle owl
#

find some bytes!

slender iron
#

I'm wondering if that check is correct

raven canopy
#

"Why are the bytes always gone?" - Captain Jack Sparrow

slender iron
#

since if you get it way over the linker fails instead

manic glacierBOT
lone sandalBOT
slender iron
#

it looks correct ๐Ÿ˜ฆ

raven canopy
#

@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?

idle owl
#

@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 ๐Ÿ˜„

raven canopy
#

๐Ÿ‘

#

now to re-construct my "non-pip'd, for local use" version. i really should save it this time. ๐Ÿ˜†

idle owl
#

Oh man.... if I had a dollar for every time I "should have saved it this time"....

raven canopy
#

ikr

idle owl
#

"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......"

#

๐Ÿคฆ

gilded cradle
#

Is that what happened with the DotStar library? JK

slender iron
#

removes the micropython module and now has 2400 bytes

raven canopy
#

oh man. there goes const()... ๐Ÿ˜ฌ ๐Ÿ˜„

slender iron
#

ah, good point

#

walks it back

#

turns off micropython.mem_info

raven canopy
#

haha. i almost suggested terminalio cause i was like "who uses that?". then checked the history...

slender iron
#

we could consider only supporting hallowing for m0 displays

#

mem_info freed up ~1k on its own

raven canopy
#

that's doable. gc.mem_free is still available, right?

raven canopy
#

man, my local library cache was a little behind: 123 Forks Updated; 18 New Forks

celest zenith
#

is it possible to override a frozen library with one in /lib ?

slender iron
#

@raven canopy ya, it is

raven canopy
#

@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>
solar whale
#

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

raven canopy
#

i remember that re-arrangement, but not the final determination. ๐Ÿ˜„

solar whale
celest zenith
#

I made it work with
import newfoo as foo

#

but moving it to / also worked.

manic glacierBOT
manic glacierBOT
tough pier
#

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

manic glacierBOT
slender iron
#

@tough pier is that all you have in code.py?

tough pier
#

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...

slender iron
#

you are likely using it earlier. pins can have multiple names

tough pier
#

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

slender iron
#

did you use the cpx library at all?

tough pier
#

nope, example didn't show that

#

i'm familiar with it.

slender iron
#

are you doing anything else besides the four lines above in the repl?

#

its possible there is a bug

tough pier
#

nope that is it

slender iron
#

what version of circuitpython? what board?

tough pier
#

sorry this should be a simple answer, for a really simple problem... I'll keep reading the docs

slender iron
#

it could also be a bug and not your fault

tough pier
#

could be. do you code? does my code look correct to you?

slender iron
#

ya, those lines should work on their own

tough pier
#

well at least I'm not crazy...

manic glacierBOT
umbral dagger
#

Is there a way in CP to tell whether USB is connected?

#

(as opposed to being powered by battery)

pastel panther
#

not being helpful but yes I believe so, I just don't know how ๐Ÿ˜ฎ

#

I recall someone else was doing it

tough pier
#

@pastel panther what do you do when you get "Pin PA11 in use" or any other pin attached to a built in sensor...

pastel panther
#

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

tough pier
#

In this case I'm calling for ambientLight = AnalogIn(board.LIGHT)

pastel panther
#

as far as I can tell the light sensor is the only thing using that pin

tough pier
#

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?

pastel panther
#

I thikn you need to say ambientLight.value

#

not 100%, I don't use the ADCs a ton

#

I can double check

tough pier
#

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

pastel panther
#

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

tough pier
#

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?

pastel panther
#

not if you're trying to read the light sensor

#

Unfortunately I don't have my CPX handy at the moment

tough pier
#

yup, many times, the very definition of crazy

pastel panther
#

What version of CP are you running?

tough pier
#

3.1.1

pastel panther
#

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

tough pier
#

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)

slender iron
#

don't import cpx

#

it'll use the pin

tough pier
#

ah ha!

slender iron
#

or print(cpx.light) if I remember right

tough pier
#

@slender iron That DID IT!

tough pier
#

Thank you. that's what I meant earlier about obtuse... it would think it would be ".value" on any sensor...

manic glacierBOT
#

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...

tough pier
#

And I probably should have had an error like conflict with cpx or something

#

But again thank you @slender iron !

slender iron
#

np

manic glacierBOT
tough pier
#

@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?

slender iron
#

try printing out ambientlight all the time and seeing what the value is when your finger is over it

tough pier
#

well that's weird. It was moving before, but now its not

#

it's just steady 6 right now

manic glacierBOT
#

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 ...

slender iron
#

@tough pier are you doing = ambientLight.value in the loop still?

tough pier
#

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

slender iron
#

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

tough pier
#

Oh yea definitely, I just didn't paste that because its a given

raven canopy
vapid monolith
#

is it possible to attach more storage to the circuitplayground express in some way?

umbral dagger
#

@raven canopy It should do what I need. Thanks.

solar whale
#

@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

manic glacierBOT
vapid monolith
#

Thanks @solar whale

main meteor
#

You could also attach an FRAM board.

solar whale
#

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.

solar basin
#

@slender iron I'm about halfway through the VOD of your live stream. Very fascinating!

slender iron
#

yay! glad it's interesting @solar basin

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

slender iron
#

๐Ÿ˜ƒ I'm happy it no longer crashes

lone sandalBOT
manic glacierBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
idle owl
#

@gilded cradle I have a mission for you to add to your current awesomeness!

manic glacierBOT
#

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...

manic glacierBOT
lone sandalBOT
gilded cradle
#

Hi @idle owl, what is this mission?

idle owl
#

@gilded cradle Hey!

gilded cradle
#

Hi

idle owl
#

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.

gilded cradle
#

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.

idle owl
#

Ooh! Yes!

#

I wrote up the explanation on the CP Lib tracking issue, hold on

gilded cradle
#

Ok

idle owl
#

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_.

gilded cradle
idle owl
#

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.

gilded cradle
#

Ok, so you want me to clean up other repos?

idle owl
#

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

gilded cradle
#

Ok, sure. I just wanted to understand what you were asking me before I accepted.

idle owl
#

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.

gilded cradle
#

Ok cool. I probably may have anyways, but I'll definitely check for sure.

idle owl
#

Thanks!

gilded cradle
#

You're welcome!

idle owl
#

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.

gilded cradle
#

Ok, sounds good. I do have a question for you regarding the featherwing library though.

idle owl
#

Sure!

gilded cradle
#

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

idle owl
#

That's stretching my knowledge, actually. How does calling super() affect RTD?

gilded cradle
#

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.

idle owl
#

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

gilded cradle
#

Yeah, it works pretty well

idle owl
#

Nice!

gilded cradle
#

I just initialize them a little differently

idle owl
#

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

#

Is what it looks like in RTD

#

Does that help? Or am I still not understanding the question

#

(Which is totally possible)

gilded cradle
#

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.

idle owl
#

Ok! Let me know if it's not when you do get to it

gilded cradle
#

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

idle owl
#

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.

gilded cradle
#

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.

manic glacierBOT
#

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...

idle owl
#

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 ๐Ÿ˜ƒ

gilded cradle
#

Ok, thanks. That helps.

lime trellis
#

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?

lone sandalBOT
raven canopy
#

"Sphinx locally...ITS A TRAP!" - Travis-ci.com ๐Ÿญ ๐Ÿ˜„

slender iron
#

@lime trellis which chip runs circuitpython?

raven canopy
#

looks like the SAMD, with the ESP32 running micropython.

slender iron
#

happy to accept a PR but we are no longer supporting circuitpython on the ESP32 officially

raven canopy
#

@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?

slender iron
#

go ahead and do it. my brain is deep in displayio atm

raven canopy
#

๐Ÿ‘

lime trellis
#

@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

raven canopy
#

@lime trellis i can assist, to a degree, while tannewt is heads down. give me a sec while i finish this release...

lime trellis
#

@raven canopy awesome, thanks!
Looking at the other boards, if my PR just includes my

  1. pins.c
  2. board.c
  3. mpconfigboard.h
  4. mpconfigboard.mk
    I should be set, yeah?
raven canopy
#

@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... ๐Ÿ˜„

lime trellis
#

๐Ÿ˜ƒ 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 ?

slender iron
#

is losing steam

lime trellis
#

@raven canopy should I also do a PR for the uf2-samdx1/boards/?

slender iron
#

all good. I hope this is the last bit of displayio core work needed for bit

exotic pumice
#

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

raven canopy
#

@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

lime trellis
#

@raven canopy ok thanks for the help!

manic glacierBOT
manic glacierBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
lone sandalBOT
gilded cradle
#

Ok, if you've been holding out, we need somebody to be star number 1000 on the circuitpython github repo. Be that person!

meager fog
#

๐Ÿ˜ƒ

#

do it now!

manic glacierBOT
gilded cradle
#

Yay

main meteor
#

Seemed like a good idea ๐Ÿ˜ƒ

meager fog
#

amazing

#

thnaks uoo

manic glacierBOT
river quest
#

@main meteor congrats!

#

gonna send ya out a gift for 1,000th star

main meteor
#

If my order hasn't gone out yet, you could tuck it in with that.

manic glacierBOT
river quest
#

@main meteor oh, this would be something for later - hard to stop orders, etc.

main meteor
#

Makes sense, just a thought. I know the order pipeline is pretty, um, pipelined there.

river quest
#

back when i shipped all orders it was easier ๐Ÿ˜ƒ

#

that was 7 years ago or so now

manic glacierBOT
slender iron
#

opens reviews todo based on emails... @idle owl beats me to them

idle owl
#

๐Ÿ˜„

solar basin
#

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

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

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...

pastel panther
#

@raven canopy I've got "It's Automatic" stuck in my head now, so thanks for that

raven canopy
#

there's worse things to have stuck in your head... ๐Ÿ•บ

pastel panther
#

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

raven canopy
#

that. was. masterful. bravo! ๐Ÿ‘

meager fog
#

@solar basin we're still working out production with the grand central...its a tough one to fab

#

but we'll get there ๐Ÿ˜ƒ

lone sandalBOT
meager fog
#

@tidal kiln wanna try a Quest for me?

solar basin
#

@meager fog I have faith ๐Ÿ˜ƒ

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
marble hornet
#

@slender iron looks nice!

slender iron
#

thanks!

lone sandalBOT
tidal kiln
#

@meager fog sry, had an AFK side quest today. what's up?

marble hornet
#

@river quest ^^^^^^

manic glacierBOT
lone sandalBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
manic glacierBOT
marble hornet
#

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>

slender iron
#

@marble hornet because adding API support would take a lot of time

marble hornet
#

shame microchip doesn't make arm chips w/ 1mb ram ๐Ÿ˜ข

slender iron
#

๐Ÿ˜ƒ

#

you could always add stm support ๐Ÿ˜‰

#

someone is working on adding stm32f4 support to tinyusb

marble hornet
#

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!

slender iron
#

๐Ÿ‘

manic glacierBOT
#

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

bronze geyser
#

(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.

manic glacierBOT
slender iron
#

welcome back @bronze geyser !

#

did you git submodule update --init --recursive . in the top level?

bronze geyser
#

@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
#

๐Ÿ˜„

bronze geyser
#

@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...

slender iron
#

it wouldn't be happy hour then ๐Ÿ˜ƒ

#

I'd be happy to attend an earlier event

#

(pycascades is at UW in a couple weeks)

steady pivot
#

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 ๐Ÿ‘Œ

bronze geyser
#

@slender iron i mean...isn't Happy overrated when we could all just be hilariously pleased? OK. I'll stop...

main meteor
#

"baud rate"? Do you mean sample rate?

steady pivot
#

Yeah

slender iron
#

CircuitPython doesn't support high speed ADC sampling now

steady pivot
#

All good, thanks

slender iron
idle owl
#

@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.

slender iron
#

sure!

manic glacierBOT
#

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...

manic glacierBOT
stuck elbow
lone sandalBOT
manic glacierBOT
slender iron
#

@stuck elbow thanks for the link! I'll definitely watch it

prime flower
#

@stuck elbow oh man, those hand-drawn slides are cool.

lone sandalBOT
slender iron
#

lookin

#

merged

idle owl
#

nice!

stuck elbow
#

@prime flower thanks

bronze geyser
#

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.

raven canopy
#

@bronze geyser it should, yes. Do you have the bus device library installed?

bronze geyser
#

@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.

raven canopy
#

Only need update if major version changed, or fixes. ๐Ÿค”

bronze geyser
#

@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.

manic glacierBOT
tidal kiln
#

@stuck elbow cool talk. i like how you went into some detail about framebuf stuff.

raven canopy
#

these adabot cron failures are starting to annoy me...

exotic pumice
#

is it a travis issue?

raven canopy
#

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.

exotic pumice
#

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?

raven canopy
#

not that i know of

exotic pumice
#

ok, I wasn't sure if it was part of github

pastel panther
#

@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 ๐Ÿ˜ƒ

slender iron
#

๐Ÿ˜ƒ glad it worked!

pastel panther
#

I of course forgot to change the pins and was scratching my head for a bit there but I finally figured it out :p

slender iron
#

yup, I've been there

#

I just fixed my standalone circuitpython by realizing I had hard coded the pins

pastel panther
#

hah, I suppose we're only human ๐Ÿคฃ

slender iron
#

yup, fixed it today ๐Ÿ˜ƒ

pastel panther
#

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

slender iron
#

ya, I haven't removed all of the Sprite mentions yet

raven canopy
manic glacierBOT
#

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 ...
lone sandalBOT
lone sandalBOT
lone sandalBOT
terse kayak
#

@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.

tawny oasis
#

From where can I learn circuit Python.

main meteor
solar whale
#

seems like a lot of extra work to install Windows in a VM in order to use the JLink

main meteor
#

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.

raven canopy
#

@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.

prime flower
#

@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.

solar whale
#

@prime flower thanks. I was just curious. I thought it could be done with jlink tools directly.

prime flower
#

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

solar whale
#

Ok - thanks! Iโ€™ll experiment and let you know if I learn anything..

raven canopy
#

As an AS7 user, I'll just note that it uses the jlink software underneath (jcommander, jflash, etc).

pastel panther
#

@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

solar whale
#

How do you set the fuse bits?

pastel panther
#

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

solar whale
#

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.

tawny oasis
#

@main meteor thanks for the support.

umbral dagger
#

I'm really not loving these CP exceptions thrown without any data/message.

solar whale
#

We all know CP is exceptional ๐Ÿ˜‰

#

what board/code are you getting them

umbral dagger
#

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).

solar whale
#

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. ๐Ÿค”

marble hornet
#

@umbral dagger if i'm not wrong update needs a dict and zip returns a set

#

which would be a type error

umbral dagger
#

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.

main meteor
#

Run dir() on what zip returns?

umbral dagger
#

Just __class__ and __next__

main meteor
#

So basically an iterator, I guess

umbral dagger
#

So it seems

raven canopy
#

What are the contents of the tuples?

umbral dagger
#

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()

raven canopy
#

Hmm. I know there are warnings for empty lists as default args; not sure if it applies to all iterables.

umbral dagger
#
>>> d.update(zip((), ()))
>>> d
{}
#

works fine

raven canopy
#

No, I mean as a function argument.

def __init__(self, foo=()):
umbral dagger
#

oh...

raven canopy
umbral dagger
#

Hmm.. this is from presumably working code.

manic glacierBOT
#

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...
raven canopy
#

@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.

umbral dagger
#

it's aliased to isinstance

umbral dagger
#

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.

meager fog
manic glacierBOT
#

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
raven canopy
#
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.

umbral dagger
#

hmm.. parms & args shouldn't be there

raven canopy
#

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

umbral dagger
#

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

idle owl
#

@slender iron I am changing persistence and it's altering the data stream! So it's visibly working!

slender iron
#

great!

idle owl
#

@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?

slender iron
#

ya

idle owl
#

ok

slender iron
#

well 15

idle owl
#

oright

slender iron
#

16 would be the first of the third

raven canopy
solar basin
#

@slender iron crazy cool stuff you got going on with the REPL

slender iron
#

thanks!

haughty bobcat
#

Is it better for me to invest in the Particle Argon or Adafruit Feather nRF52840 Express?

#

Primarily for Circuit Python

slender iron
#

the express

#

it comes with the bootloader

haughty bobcat
#

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.

slender iron
#

ah I had forgotten about that

#

we won't officially support it though

haughty bobcat
#

darn

#

I did see this guide

#

Looks fairly straight forward

slender iron
#

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

haughty bobcat
#

I understand

solar whale
#

@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.

haughty bobcat
#

Ah

#

Yeah I think Iโ€™m going to wait

solar whale
#

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.

lime trellis
#

@haughty bobcat everything you need to order and build your own on the github ๐Ÿ˜ƒ

manic glacierBOT
umbral dagger
raven canopy
#

still getting that TypeError huh? ๐Ÿ˜„

umbral dagger
#

I have things working now

#

Python3 -> Circuitpythons has some gotchas.

raven canopy
#

indeed. i never experienced LISP; only heard of it..

umbral dagger
#

Best approach to programming IMO

#

Soon you'll be able to try it from the comfort of CircutPython.

manic glacierBOT
solar basin
#

@slender iron is that any good?

slender iron
#

fun so far ๐Ÿ˜ƒ

manic glacierBOT
raven canopy
#

i throw my hands up at Travis. restarted yesterdays adabot cron job...passed. ๐Ÿคท

pastel panther
#

@raven canopy I successfully got my ๐Ÿš† m4 into a soft reboot loop, so ๐ŸŽ‰

#

yay computers ๐Ÿ™„

raven canopy
#

hehe. ikr.

manic glacierBOT
meager fog
#

@solar whale hiya i can help get ESPSPI running

#

if you have a huzzah ESP32

solar whale
#

@meager fog -- yes I do

meager fog
#

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

solar whale
#

OK -- looks great -- can I use teh NINA-W102.bin on the esp32?

meager fog
#

yes

#

load that directly to addr 0x0

#

its full and compelte with certs

solar whale
#

cool! I wil give it a try later tonight or tomorrow. Thanks!

exotic pumice
#

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

stuck elbow
#

What is a hal lol?

exotic pumice
#

hardware abstraction layer

#

library for bringing up the device and accessing peripherals

solar basin
#

@exotic pumice I'm willing to help

#

I already know rust

exotic pumice
#

you know where to find it, right?

solar basin
#

Yeah, I was looking at it yesterday

exotic pumice
#

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

river quest
solar basin
#

I'm going shopping, what should I buy?

pastel panther
#

all the toys

#

all of them

solar basin
#

I don't have all the toys money lol

pastel panther
#

some of them

solar basin
#

That's the idea lol

pastel panther
#

you mean adafruit stuff, or are you just looking for life advice?

solar basin
#

Adafruit stuff lol

pastel panther
#

what do you have?

solar basin
#

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?

pastel panther
#

๐Ÿคท

solar basin
#

I think I'm going to get an Adabox 10

pastel panther
#

I'd buy a feather nrf52840 for that money

#

(the tft)

solar basin
#

You think so?

pastel panther
#

no wires is pretty dope

solar basin
#

What's that? Other than the BT it's inferior to the M4, isn't it?

pastel panther
#

get a battery, you're golden

solar basin
#

ah I got ya

#

I have a 2500mah

pastel panther
#

it's pretty comparable

#

a crickit is also a bucket of fun

#

gotta run, ttyl

solar basin
#

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)

pastel panther
#

i'd as @solar whale 's advice about those. I think he has a bunch

solar basin
#

I love their platform, even if it is C/C++

#

I'm just sad I can't get a Grand Central

pastel panther
#

apparently the're working on getting the yields up

#

I think. Said something about mfg being tricky

solar basin
#

Yeah, ladyada was telling me that the other day

pastel panther
#

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
#

The Particle Kit I'm getting has a SWD thing in it

#

But good call

raven canopy
#

@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).

solar basin
#

I meant the atsamd51

raven canopy
#

In that sense, yeah, I'd consider it inferior since the BT consumes a bit of architecture.

solar basin
#

I'll have a Feather M4 and a Feather nRF52840 so I'll be set either way lol

raven canopy
#

Yep! That's a solid plan. ๐Ÿ˜

solar basin
#

@pulsar ferry what's your favorite Adafruit product?

raven canopy
#

That's like asking "what's your favorite time to eat bacon". ๐Ÿ˜‚

solar basin
#

Good point

raven canopy
#

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.

solar basin
#

Yeah, I'm loving the format with my M4/TFT FeatherWing

main meteor
#

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.

main meteor
#

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.

manic glacierBOT
#

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...

manic glacierBOT
solar whale
#

@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.

solar whale
#

@meager fog OK -- got some basics working with the ESPRESSIF board simpletest works (except for ping) good start!

manic glacierBOT
manic glacierBOT
#

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.

plucky briar
#

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))

main meteor
#

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>)
plucky briar
#

I just copied it from what I was using for the arduino, I'll try and find the address, Thank you

main meteor
#

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])

plucky briar
#

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'

main meteor
#

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]))

plucky briar
#

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

tidal kiln
#

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

meager fog
#

@solar whale oh you dont really need gpio0

#

hihi

solar whale
#

OK -- well - the espressif board works well! I'll go back the Huzzah32 later today and try it.

meager fog
#

thanx ๐Ÿ˜ƒ

#

yeah you just need the SPI pins really - and reset

solar whale
#

nice -- I posted some stuff to the PR -- ping is broken...

meager fog
#

probably ๐Ÿ˜ƒ im doing more intense sockets stuff instead

solar whale
#

but lots working well!

meager fog
#

ping was a bit of a throwaway function

solar whale
#

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...

meager fog
#

i noticed sometimes it takes time or two tries

#

but is very fast besides

solar whale
#

yes it is!

#

do you need the ready pin?

meager fog
#

absolutely

#

it is required

solar whale
#

ok -- good to know -- so just gpio0 is "optional"

meager fog
#

yeah

solar whale
#

Great -- Thanks for getting this out for testing

meager fog
#

yeah you can go pretty fast with SPI

solar whale
#

My dog is desperate for a walk -- back later!

meager fog
#

๐Ÿถ

prime grove
#

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"?

slender iron
#

@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

prime grove
#

ok

meager fog
#

@prime grove what tannewt said ๐Ÿ˜ƒ ^

#

i was ๐Ÿต

prime grove
#

got it - thanks

solar whale
#

@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.

meager fog
#

yeah

solar whale
#

did you write the code for the ESP32? NINA_W102.bin?

#

or in either case do you have a link to it?

meager fog
#

its compiled from here

solar whale
#

thanks!

meager fog
#

i commited my minor change

umbral dagger
#

I'm glad we did that CP cheatsheet... it's nice having things in ne place. I'm making use of it today ๐Ÿ˜ƒ

meager fog
#

yes!

solar whale
#

@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...

manic glacierBOT
lime trellis
#

@umbral dagger mind linking to said cheatsheet? ๐Ÿ˜ƒ

meager fog
#

@solar whale i dont know why it doesnt bytecompare

#

maybe ESP IDF version change?

#

:/

#

i had a lot of trouble compiling it

solar whale
#

or I may have a different ESP tootchain commit -- mine is from mircropython

umbral dagger
solar whale
#

seems to work, so I won't worry too much ๐Ÿ˜‰ just want to make sure I did not miss any steps/

lime trellis
#

@umbral dagger thanks ๐Ÿ˜ƒ

manic glacierBOT
manic glacierBOT
pastel panther
#

I โค that cheatsheet

idle owl
marble hornet
#

@idle owl are you taking over for tannewt in the meetings?

idle owl
#

@marble hornet We're both running the meetings. Typically every other week.

manic glacierBOT
exotic pumice
#

does anyone have the value of an unlocked nvmuserrow?

#

for samd51

raven canopy
#

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. ๐Ÿ”ข โฒ

marble hornet
#

@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 ?

exotic pumice
#

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

raven canopy
#

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. ๐Ÿ˜„

exotic pumice
#

ouch

#

how important is the ondemand bit?

raven canopy
#

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).

exotic pumice
#

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?

raven canopy
#

which clock? DFLL?

exotic pumice
#

yeah

raven canopy
#

hmm.

exotic pumice
#

actually, there's a chance there's something different in one of the subsections of oscctrl

#

but not the dfll part

raven canopy
#

i'm not seeing anything in the latest errata. trying to see if that register is enable-protected, since DFLL is started automatically.

exotic pumice
#

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

raven canopy
#

will do! have fun with hw. ๐Ÿ˜ช

exotic pumice
#

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

raven canopy
#

@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?

exotic pumice
#

I have it unset

#

you have it set

#

on second thought, dividing by 0 is never a good thing

raven canopy
exotic pumice
#

well pycortexmdebug disagrees