#circuitpython-dev
1 messages Β· Page 130 of 1
So I am almost finished with my thermometer, but ran into an issue with the Adafruit MCP 9808. It has been getting colder here and temperatures below 0 C do not have a negative sign when I poll my sensor.
Here is a look at some data that should continue down but does not:
Data trend of MCP9808
Data
Sorry for putting that data twice.
This is how I read the sesnor: with busio.I2C(SCL, SDA) as i2c: #read the current temperature t = adafruit_mcp9808.MCP9808(i2c) tempf= fahrenheit(t.temperature) tempc= t.temperature
Is there another value ( 1, -1) that I should be pulling from the sensor?
@unique turret I think there is an erro in the CP code for this ```def temperature(self):
"""Temperature in celsius. Read-only."""
self.buf[0] = 0x05
with self.i2c_device as i2c:
i2c.write(self.buf, end=1, stop=False)
i2c.readinto(self.buf, start=1)
# Clear flags from the value
self.buf[1] = self.buf[1] & 0x1f
if self.buf[1] & 0x10 == 0x10:
self.buf[1] = self.buf[1] & 0x0f
return 256 - (self.buf[1] * 16 + self.buf[2] / 16.0)
else:
return self.buf[1] * 16 + self.buf[2] / 16.0
@solar whale i'm looking too, what do you see?
I think it should be; ```def temperature(self):
"""Temperature in celsius. Read-only."""
self.buf[0] = 0x05
with self.i2c_device as i2c:
i2c.write(self.buf, end=1, stop=False)
i2c.readinto(self.buf, start=1)
# Clear flags from the value
self.buf[1] = self.buf[1] & 0x1f
if self.buf[1] & 0x10 == 0x10:
return (self.buf[1] * 16 + self.buf[2] / 16.0) - 256
else:
return self.buf[1] * 16 + self.buf[2] / 16.0```
compare to C++ lib ``` float temp = t & 0x0FFF;
temp /= 16.0;
if (t & 0x1000) temp -= 256;
return temp;```
hmmm. datasheet:
if ((UpperByte & 0x10) == 0x10) { //TA < 0Β°C
UpperByte = UpperByte & 0x0F; //Clear SIGN
Temperature = 256 - (UpperByte x 16 + LowerByte / 16);
} else { //TA > 0Β°C
Temperature = (UpperByte x 16 + LowerByte / 16);
}
sorry - my suggestion is not right, but still the code is missing something. thinking...
@solar whale i agree though, the CP and C++ code look different, also thinking...
regular python version (basically same as C++):
https://github.com/adafruit/Adafruit_Python_MCP9808/blob/master/Adafruit_MCP9808/MCP9808.py#L78
right - I can't make sense of the data sheet.
when the sensor goes negative it should read 0x1fff( 13 bit 2's complimnet) if you strip of the sign bit you get 0xfff and and then divide by 16 to make an 8 bit value 0xff 0r 255 which shoul dbe interprted as 255 - 256 = -1 -- the data sheet says it is 256 - 255 which is 1 but that is wrong.
@solar whale If subtracting 256 results in the correct temperature, then that is the correct order
Occam's razor π
Thank you all for troubleshooting this issue!
if you look at the box in the upper right of the datasheet page I think I see the problem they don't strip the sigh bit off the upper bit in that algorithm so ther is an extra 256 that is not being subtracted in the code.
I think the datasheet code example is just wrong.
so I think this would work ``` def temperature(self):
"""Temperature in celsius. Read-only."""
self.buf[0] = 0x05
with self.i2c_device as i2c:
i2c.write(self.buf, end=1, stop=False)
i2c.readinto(self.buf, start=1)
# Clear flags from the value
self.buf[1] = self.buf[1] & 0x1f
if self.buf[1] & 0x10 == 0x10:
return (self.buf[1] * 16 + self.buf[2] / 16.0) - 256
else:
return self.buf[1] * 16 + self.buf[2] / 16.0``` I can test it tonight.
sorry not right
mixed my fixes.
this is what I meant ```def temperature(self):
"""Temperature in celsius. Read-only."""
self.buf[0] = 0x05
with self.i2c_device as i2c:
i2c.write(self.buf, end=1, stop=False)
i2c.readinto(self.buf, start=1)
# Clear flags from the value
self.buf[1] = self.buf[1] & 0x1f
if self.buf[1] & 0x10 == 0x10:
return 256 - (self.buf[1] * 16 + self.buf[2] / 16.0)
else:
return self.buf[1] * 16 + self.buf[2] / 16.0```
leave the msb in place.
@unique turret could you test?
@tidal kiln I will test this in about 30 mins.
Should I comment out the mcp9808 library in my code? And paste this into my code as a replacement?
change is only one line
you can edit your adafruit_mcp9808.py file and comment out this line:
https://github.com/adafruit/Adafruit_CircuitPython_MCP9808/blob/master/adafruit_mcp9808.py#L98
sry. line 98 (fixed)
I think my suggestioin is flawed because it reuslt in an 8bit (2's compliment value) that is 255 is -1 but the return type is is not really an 8 bit sighned value. It's hrd to know what python is doing with types! . I think the case like the C++ is the way to go - strip the MSB then subtract 256
"""Temperature in celsius. Read-only."""
self.buf[0] = 0x05
with self.i2c_device as i2c:
i2c.write(self.buf, end=1, stop=False)
i2c.readinto(self.buf, start=1)
# Clear flags from the value
self.buf[1] = self.buf[1] & 0x1f
if self.buf[1] & 0x10 == 0x10:
self.buf[1] = self.buf[1] & 0x0f
return (self.buf[1] * 16 + self.buf[2] / 16.0) - 256
else:
return self.buf[1] * 16 + self.buf[2] / 16.0```
so just change line 99 to moke it subtract 256 rather than subtract from 256.
sorry for all the false starts....
I just plugged in my circuit playground express and typed in help("modules") in the repl, The list seems to include more items than I remember
I don't remember seeing anything in "examples/" before
now I have examples/click, examples/spinner and examples/spinner_advanced...
@opaque patrol is this a new build of CP - what version - are you importing anything when you start up?
I might have a newer version of the libraries
but the libraries should not show up in help("modules")
right, it still shows the version number as 2.1.0, would that be different if I had put a newer uf2 file on? I could have and just forgotten
Anyway, the reason I was looking....Is there a builtin map() function?
ReadtheDocs implies that it should be there but I can't check.
found it, or at least something in simpleio named map_range()
When I open CIRCUITPY/lib/adafruit_mcp9808.mpy it looks like gibberish in Atom. @tidal kiln
@unique turret edit .py
k
do you have that? or only the .mpy?
I just got the py from github that you linked, should I also make the change @solar whale suggested in line 99?
Currently I only commented 88
98
@unique turret I think only the change in line 99 is needed. - leave 98 in
So far so good, I am going to take it outside to test below zero
glad it's winter π
Yup, that change on line 99 fixed it π
'''2017-12-7 11:40:49, 34.3625,1.3125
2017-12-7 11:41:06, 32.5625,0.3125
2017-12-7 11:41:19, 31.775,-0.125
2017-12-7 11:41:32, 30.2,-1.0
2017-12-7 11:42:16, 29.4125,-1.4375
2017-12-7 11:42:34, 29.3,-1.5
2017-12-7 11:42:49, 28.175,-2.125
2017-12-7 11:43:02, 27.3875,-2.5625
2017-12-7 11:43:18, 26.825,-2.875
2017-12-7 11:43:27, 26.375,-3.125
2017-12-7 11:43:38, 25.8125,-3.4375
2017-12-7 11:44:07, 24.6875,-4.0625
2017-12-7 11:44:46, 23.3375,-4.8125
2017-12-7 11:45:03, 23.45,-4.75
2017-12-7 11:46:38, 28.5125,-1.9375'''
yay! good sleuthing @solar whale
Glad it worked - how do you want to handle getting it fixed in the repo.
create issue, then fork and pr the fix, referencing the issue
Do you want me to do it - or @unique turret would like to do it.
I can't do it until this evening. happyh to do it then or happy to have either of you take care of it.
I have never edited on GitHub, but it would be a good thing to learn
I will investigate how to do it.
this would be a good first one to try
πΊ
@unique turret do you have a github account?
@unique turret Nice job finding this error, reoporting, fixing and testing it. It will be a good first issue and pull request. The nice thing about the way it works is there are pleny of peolple watching and reviewing the changes. I would not be surprized to see some discussion regarding the proposed change.
@silver hill native iOS support for external drives is limited to camera-esque applications. Apparently a third-party application can use an external drive in certain ways, but the only ones I see are special USB drives that come with their own apps.
We're looking at Bluetooth in the long run for connecting from iOS.
I do have a github account
cool. step one, add a new issue:
https://github.com/adafruit/Adafruit_CircuitPython_MCP9808/issues
step two, fork the repo into your github account
(use "Fork" button in upper right of repo main page)
step three, make changes to the code in the fork you just created
there are many ways to this, but since the change is simple and this is your first go, i'd suggest just editing the code directly on github, there's a little pencil icon
you "save" the changes by "committing" them, should be a button for this once you start editing
Yay, my first commit! π
step four, make a pull request to have your changes added to the original repo
look for "New pull request" button on the main page of your repo, near top, leftish
and there it is
now for the waiting.....will anyone ever look at the PR and merge it?
If you don't mind, I will add a note explaingin the change a bit.
Of course @solar whale
@unique turret thanks for the contribution!
@unique turret Great job!
This community has given me SO much help with this project, it is the least I can do. Hugs for all of you!
@timber lion I added you to a number of lint reviews. I'm not picking on you. Its just that you've been really busy lately and I'm starting with repos that have been updated most recently.
anyone have trouble getting circuit playground express to mount on a recent macbook pro? I have tried a number of cables with no luck
@ornate nimbus I develop on a macbook pro. What version of CircuitPython are you running?
@slender iron I am not running it yet, I am just starting and I have this new CPE, but I can't get it to mount to load circuitpython... I have tried a usbC to microB as well as a usbc to female usbA adapter to a usbA to microB
If it's new, it's single tap, yeah.
it should show as CPLAYBOOT
it does mount on this windows10 box I have sitting here as well
but not on the mac
what version of mac osx do you have?
high sierra?
thats what I have too and it works ok
Did you try rebooting?
no, but I certainly can π
ok, brb
@slender iron yeah what's the ask of lint reviews? i'm fine to see them integrated if the code changes are tested and guides updated
API breaking changes are good too as long as guides are updated is my take
most of the changes are minimal and don't change the api
and ideally called out explicitly in the release notes for the library
@timber lion I don't have all of the hardware so it'd be great if you'd test it as needed. Most of the changes (whitespace and renames) don't need it though IMO
hrm that's a tricky assumption, i don't have the cycles right now to go back and test everything
@ornate nimbus Are you using a hub? Did you try plugging it in directly? Do other things work with the cables you're using or does your PC have USBC as well, so you know for sure they're good cables? I'm reaching here, it should be working, so I'm suggesting whateved I can think of.
we can keep these pulls open perhaps but really if i were you i'd order the hardware and test
or start with libs that you have hardware for
@timber lion well take a look at changes and let me know which need testing
my take, anything that modifies code since a typo can break it all
but there are static analysis checks that might work
the linter is checking some of that yeah
or you could check the lib imports and you can create an instance
but most initializers look for the hardware so could be tricky
yeah, just to make sure it imports
@idle owl I have tried a usbC to microB as well as a usbc to female usbA adapter to a usbA to microB cables... all direct connect to usbC on macbook pro
Hmph.
@ornate nimbus are you looking in finder to see if it mounts?
did you try different usb ports?
take a look in your dmesg for any usb related messages please
its possible you have a driver thats interacting with it badly
it's also good if you test on the hardware you can get new guide pics etc and update them as you go
@timber lion most of the APIs are identical so ntohing in the guide will change
the sea level thing was the only thing so far I've changed
and @solar whale is helping get that fixed up
hrm what about tweaking the lint rules
they appear to aggressive and are squashing style decisions
in what way?
i explicitly added the extra space to make it a little more readable π
so they vertically line up
yeah, I'm pretty impartial about it so I went with the default. I'm not sure all of those defines are that useful anyway
or in the example i put the import digitalio next to the usage so it's obvious when someone switches to spi they need to uncomment and import it.. i like to keep all that in one visible logical spot: https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS0/pull/1/commits/55e83de46cc816f32577988661b5254ecea37fb4#diff-2cefebc19f75524f0bde0ae532a1792bL341
oh i missed it on that example π
but yeah i'd put the import down in the usage even though that's not what pep8 says
so what i could do is review the changes later and add comments where i think it's too aggressive
and we could iterate on that
@slender iron not sure if that's helpful... that a dmesg right after resetting CPE
but i probably won't have time until friday, i want to finish some other stuff
@timber lion I think consistency is king here and the linter can give us that
@ornate nimbus do you have a micron related driver installed?
also why is time pulled out separately from busio and board in module import orders (i.e. with newline) ?
i kind of think of busio and board as core circuitpython modules like core python modules time etc
you can't 'remove' busio, board etc
pylint has builtins separate from third party imports
pylint isn't smart enough to know busio is built in since its made for CPython
right why i don't think we should trust all pylint's assumptions out of the box
I didn't π
@slender iron not that I am aware, I do some searching and see if a file search shows anything
totally, i like linting and want to add it too
I disabled and tweaked a few things
but yeah i'll review the changes and add a few comments, IMHO it's worth watching the hettinger beyond pep8 too.. we should deviate where it makes sense
I've watched it and do π
like in some of the hairy bit manipulation code i go beyond 80 char line length
because adding \ and breaking apart makes it harder to read
vertical alignment etc i like to keep too
and pep8 is pretty silent on that unfortunately
pylints default is 100
ah nice
yeah i'll add comments to the pulls tomorrow so we can iterate a bit more
we'll see how much time i have, for these accels i might be able to set them back up
I'm burning through them so the sooner the better
but IMHO i'd order parts and test as you go too to make it faster
@slender iron I can't find anything... I guess I'll try some more googling that dmesg doesn't mean much to me
sure but I have to balance this with other work
like i said best to start with parts you have and order those you don't
I think I'm faster doing the changes all at once and then testing as needed. That way others can help test too. Thats why I'm PRing all the changes rather than committing directly
@ornate nimbus it looks related to: https://github.com/kasbert/OS-X-SAT-SMART-Driver
curious why the addition of None values here too? https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS0/pull/1/commits/55e83de46cc816f32577988661b5254ecea37fb4#diff-2cefebc19f75524f0bde0ae532a1792bR145
the setting call will set it explicitly
so i left it out to save space
sure it's fast to change the code but these are pretty big functional changes to the code and need to be tested is my take
pylint expects to see them explicitly done in __init__
@slender iron @timber lion - I "think" I updated the BME280 guide - text and screenshots now use same code as in the example.
hrm gotcha, i dunno is pylint helping us there though?
@timber lion I don't think they all will need to be and will test those that need it later.
it's no different from pulling in any other code changing PR is my take
@timber lion I like that it means all attributes are plainly visible in __init__
@slender iron yes, I see those, maybe they are old cruft idk... do you have them on your high sierra install?
i guess i'm trying to see what's gained by pulling in untested code changes to all the libs?
@ornate nimbus I just see the USBMSC Identifier (non-unique): 0x239a 0x18 0x4201 message in my dmesg
@timber lion I'm not. right now I'm only making the PRs
@slender iron /System/Library/Extensions/SATSMARTDriver.kext
/System/Library/Extensions/SATSMARTLib.plugin
/Library/Extensions/SATSMARTDriver.kext
/Library/Extensions/SATSMARTLib.plugin
do you have those files?
nope
ok cool, I wonder what installed them, I'll try moving them out and restarting
yeah totally cool to do them as PRs, i guess just if you need me to test them it's not going to happen today/tomorrow.. let's keep them around until they can be validated
sounds good @timber lion
@tulip sleet I think iOS is able to see the Trinket M0 as a serial device, though the only evidence is that it does not throw an error like when I connect my PL2303 cable (sad about that). What I donβt know is how to access the serial port; the only program I have doesnβt recognize it as valid. Iβm poking at Pythonista to see whether it can talk to the serial device.
@slender iron looks like Samsung SSD T5 drive may have installed it
@ornate nimbus that seems related
@slender iron joy, that was it, thanks for your help!
@ornate nimbus Nice!
no problem @ornate nimbus !
its good for us to know
first time we've seen something like that on Mac OSX
@slender iron so specifically, it is the drivers that Samsung T3 drives install, though I assume other external samsung drives install them also
good to know!
@timber lion I'm adding the constant whitespace back. I can disable the whitespace check for that block.
@fading solstice I'll file an issue for the lint stuff with a big long check list
@slender iron @timber lion apologies; I did not read discord until just now. I'll stop approving the library merges (though I might still comment).
@tulip sleet you can approve after they are tested
or if you don't feel they need testing
the ones with just renames seemed obvious, but Tony's right that there could be typos. I don't own most of these sensors. I have a bunch of humidity sensors, and lots of htk1633 stuff. I can test the htk1633 one.
between all of us we can sort it out
I'm going through and updating the libraries to our new build process and to turn on lint. Here is the process:
- Copy
.pylintrcfrom the cookiecutter repo into the new repo. - Add this to
.gitignore
.env
build*
bundles
- Copy .travis.yml from cookiecutter into the repo overwriting the old version.
- Update lines 1 and 3 of the
scriptsection of.travis.ymlto reflect the driver name. - Add this to all modules in the driver with the correct repo url below the ...
Have a good one
thanks! I'll be back later
Ok see you later then
Watching ask an eng (I always watch them off-live, I teach a class at that time)
Oh, I love the mosfet caracter... now I'm just wondering what would be a cool name for the 555 π

yeah whitespace for the constants makes sense I think and is worth disabling or working around with pylint @slender iron the big use for it is looking up both ways the name and value of registers. you do it a lot when working on a library, like when debugging you get back hex values and need to quickly see what register it was easy. easy to do with 2 nice columns.. harder when it gets squished in. all the arduino libraries we wrote do it this way too so i think it's good to be consistent.
ok sounds good @timber lion its easy enough to have pylint ignore the section
if it can disable or add libraries to the core that would be awesome too for pylint
it's annoying if it forces us to break up time and such into a new set of libs
i like following pep8 there, first block is the built ins, second are external libraries, third are user libraries
it's worth stepping back to ask if pylint is helping in some cases.. you don't want to write code that passes a machine's check
you want to write human readable code π
I think its ok to split circuitpython builtins from CPython built ins
I have thought about that. I'm happy to incorporate your feedback though
it's ok but I think breaks from python conventions only to make a tool check not fail
which is a big anti pattern IMHO
what breaks python convention?
core libs broken apart into different import sections
Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.
Imports should be grouped in the following order:
standard library imports
related third party imports
local application/library specific imports
You should put a blank line between each group of imports.
i'm not so strict to say it always have to be that way
but breaking into 4 blocks just for pylint's happiness doesn't seem worth it IMHO
I don't know how you got to four blocks
standard cpython libraries go before others
time
circuitpython libs
third party libs
user libs
I don't usually separate the last three
yeah and busio, board, etc. are standard _circuit_python libraries π
I think its good to separate CPython libs from circuitpython ones
and thats what pylint cares about
but this isn't cpython code is my point, cpython tools are going to run into weird issues
it
ack
it's a pedantic point i know and i'm will to go for adding the line
but the precident to trust pylint first without good justification is what i don't want to set
i'm not implying that though? sorry if so.. perhaps the pull should indicate why changes were made?
all i see are the code changes so i'm teasing out the motivation for them
I evaluated the warnings of pylint and agreed with them
alright cool so my natural inclination was to wonder why a change was added that might go against convention
there is more discussion here but its wrt the pylint defaults https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/6
we discussed and can decide it's not worth the pain of fighting pylint's knowledge of libraries
i'm cool to make the decision π
but yeah that would be good to add to the discussion there so if folks in the future wonder or want to change back, can point to it to say 'here's the convention'
4 blocks:
standard python
circuitpython core
third party libs
user libs
I don't think that will work because pylint doesn't enforce that
if its not enforced by pylint, it won't happen
i wouldn't say that's always the case
we can have a convention and enforce it ourselves right?
Background on the lint configs is available here: https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/6
it would be awesome if pylint did it
I think automation is the only reliable way to enforce conventions
i think it's an ideal but it's not perfect, like the issues we're running into
and should lack of automation block a convention we want?
we name libraries adafruit_circuitpython_xxx etc. and don't have automatic checks for it for example
is learn.adafruit.com down for anyone else?
I think its ok to have higher level things we're working on but I don't expect them to be perfectly executed until there are automated checks
sure, i think we both agree here
so my thought is lets keep pylint happy but call out our convention is 4 blocks:
core python (to make pyline not complain)
core circuitpython
third party libs
user libs
I don't really understand the difference between third party libs and user libs
could you add a section to the design guide with examples?
ah user libs are what you have locally
like if you're importing from a lib you don't have installed
it's not super common
and not in any of our examples
is it normal to just have boot_out.txt on the CIRCUITPY volume after installing "adafruit-circuitpython-circuitplayground_express-2.1.0.uf2" ?
but if you have a big project with submodules internally, that's where they go typically
so for most things we'll still see 3 blocks
@ornate nimbus Yes
but for something super advanced, it might go to 4
@ornate nimbus That's the basic CircuitPython install before you add any libraries or code
ok, now I just put the /libs on it
Nice!
@timber lion sounds good, please add it to the design guide
cool which design guide? π
we have two guides on the learning system and RTD stuff.. not sure is there one spot in particular that covers pylint right now?
this is what I'm thinking: https://github.com/adafruit/circuitpython/blob/master/docs/design_guide.rst
let's toss it in there IMHO so it's clear to people writing code what to expect from the tool output
perfect
it doesn't mention lint yet though
yeah i can start a new 'Conventions' section that links to pep8 and then can have a little list of our own stuff
HI! Sorry if this is the wrong area, but I recently got a trinket with my last adafruit order, and it has made me curious about circuit python and what I could do with it. I have messed around with Raspberry Pi a lot, but never arduino.
@rustic forge sounds perfect!
Sweet π
Have you looked at the Learn Guide yet for your Trinket?
Yep! That's how I ended up here.
Ok nice!
I know some python, but admittedly I am very much a beginner
That's great! We all started there. You're in a good place!
Ok, so there are a bunch of projects in the Learn system that use CircuitPython and more are getting added all the time.
System is down right now or I'd link you to the right search.
Ok cool...yeah I thought there were sample projects etc, but I couldnt find them in that learn section for the trinket.
I can try to answer a few general questions for you though. Did you have any projects in mind?
Ah yeah, there's a CircuitPython section that has them
A lot of the projects work on multiple boards, so they might not be under a specific board section
Ah ok I see
@idle owl looks like learn's back
@tidal kiln Thank you!
@lethal plaza https://learn.adafruit.com/category/circuitpython
That includes projects, sensors, drivers, everything, but it should give you some ideas.
thanks!
For sure!
i guess i dont have anything specific in mind quite yet
id love to just do something fun and simple to start
Got ya. Well hopefully that gives you some ideas!
looks like there is a lot to look through there
@lethal plaza have you blinked an LED yet?
no not yet but i read that in the guide
Hey gang! Just grabbed my first Trinket M0 - how tiny and cute!
pylint?
yup
Been there!
My code would be absolute spaghetti if it weren't for pylint.
π
@opaque thicket is this your first time trying CircuitPython? sounds like you've got a background with python
Yeah - first time with CircuitPython - I'm a comp.sci/comp.E major, but haven't touched microcontrollers since graduation back in 2010.
nice! I graduated in '09
Nice! Note to self: things have gotten much easier. lol
It's so true
I've noticed, though, that my weakness is always initialization.
If I can get the REPL up and running and commit code, then we're off to the races. But until then, I'm just scouring ladyada's intro article.
what OS are you on?
Win10
Ok, cool - just tossed on PuTTY, and I've just figured out that COM4's my port.
Alright! Got it!
Can you pass the microcontroller something like raw_input via REPL?
yeah, its input() in python3
Oh man! I bet if you could, you could treat the trinket like a portable keepass!
WEIRD!
This is awesome
I think someone did that. I don't remember who though.
Nice!
Gotcha - I'll have to poke around with it.
anybody know why char LCD data lines numbering starts at 4?
No idea!
I'll start by changing the indents from 2 to 4 spaces....
Nope. Something to do with 4 rows? Guessing.
Β―_(γ)_/Β―
@slender iron For Windows 7 are the adafruit drivers required to for the board to connect in the first place or are they required specifically for the serial connection
@slender iron I wrote a char LCD driver a while ago: can you give me a code line number to look at?
really? I see @prime flower fingerprints on it
@idle owl need it for the serial connection, and it may get the wrong driver installed if you don't install the drivers first.
@slender iron I wrote a different one, for a different driver chip
@tulip sleet So install them before connecting the board in the first place? Or after installing CircuitPython and before connecting to the repl
Trying to figure out where it goes in this guide since it's in multiple places in the other guides.
I'm trying to be good and not break APIs but the background color function takes RGB 0-100 not 0-255
@slender iron If APIs need to be broken, we can fix what we need to.
@yes, install first. Might be ok if it was plugged in first, but there might be a stray 3rd-party driver that takes precedence by accident
Ok
yeah, the nice thing is we're doing it pretty early
Exactly
So I was originally running into some trouble saving to main.py, and in my trials, I've now got an LED that blinks in this sequence: Green-White-Blue-Blue-Blue-Blue-Blue. Does this have a hard-coded meaning?
Yep!
CircuitPython RGB Status Light
@slender iron it has to do with the pin numbering on the LCD datasheet. The LCDs can operate in 8-bit or 4-bit parallel mode. For 4-bit you use those pins.
Oh that's clever!
@tulip sleet thanks!
4-space indents in circuitPython?
yeah, thats the python standard
Yep
the repl will be lenient
So I've got to think about this a little bit - the REPLs on the chip, too - right? So the chip's not just got my code, it's got my code, the REPL, my libs, and python.exe in some form?
So python's typical interpretations, say, error handling, then gets handed not just to the REPL for plain-English, but it also gets encoded as an output to the LED?
yeah, there is a "supervisor" that manages running the python vm and it manages the LED when no code is running
That's really slick!
This is really cool - just for the architecture!
π
Meaning - the coolness could stand on the architecture alone - not the only cool reason..
just saying the credit goes to micropython and us circuitpython devs
@tulip sleet now I want to rename this library
π
@slender iron which lib?
@slender iron FYI I'm making big changes to that module right now so i'd hold off
oh yeah?
i'm adding char backpack support which uses a MCP23008 and SPI device like the arduino library
it's a workitem ladyada wants to add to the lib
it's going to be a somewhat big change to the lib
@tulip sleet what chip did you add support for?
but right now i would honestly leave the lib the same, it's following the arduino library
which supports 3 different products
is there a lot to share between them?
raw parallel LCDs, and I2C/SPI backpack driver LCDs
yes the interface is the same for users
but the setup differs if wiring in parallels vs. using a backpack
internally it will use different subclasses
i would suggest looking at the arduino lib
it also helps answer stuff like why d4 (that's how the parallel bus starts for those devices)
I did PCF8574, which is a different I2C converter. It's used in all the cheap $3 serial backpacks (not the AF one): https://github.com/dhalbert/CircuitPython_LCD
yeah this is for this device: https://learn.adafruit.com/i2c-spi-lcd-backpack/overview
ah, so the underlying transport changes but the protocol doesn't
which actually has both a I2C interface and SPI interface chip, it's kinda complicated
for the most part yeah transport changes
I told brentr about my lib, but he had already started on his. we started from different places. I removed a bunch of little-used functionality to make it fit in CPy, and I still need to make it a frozen module to fit with my other code
yeah, the basic parallel commands are just packaged up as SPI or I2C.
why not have the IO expanders present DigitalInOut equivalent classes and then pass them into the library just like native pins?
Imagine my confusion when I wrote 9 lines of code and confused the error code colors blue and cyan...
so it needs to override for faster sending of 4 bits in parallel
but for basic backlight on/off sure
ok
and just to clarify even in the arduino code it notes being too slow to send bit on/off commands for each parallel line
need to read/write the GPIO reg all at once
but yes i plan to make it look like DigitalInOut
I'll commit what I have and send you a link @timber lion
click the plus sign or drag a file
this is an example of the interface so far, nested digitalinout class in my mcp23008 class https://pastebin.com/8t4pG0Bx
is what you have changing the API though? be careful we don't want to break guides and usage etc
If things need to be updated, we'll update them.
ah hrm i'd say lets change the API after i push in these changes
i'm not attached to its naming convention etc
it's a holdover from arduino and the pi library
@timber lion https://github.com/tannewt/Adafruit_CircuitPython_CharLCD/commit/3a73e11805ae1533f75d905390f2ed14a00adf00
why wait? doesn't that risk adding more example code that uses it?
this needs to be updated too: https://learn.adafruit.com/character-lcds/character-vs-graphical-lcds?view=all#circuitpython-code
grab new pics etc. if we want to pull in now
won't that need to be with your rework anyway?
i wasn't planning to change the api
and parallel usage is the same
this guide is being updated: https://learn.adafruit.com/i2c-spi-lcd-backpack/overview
@timber lion, you might want to take a look at the API I worked up: it came from an RPi library that was kind of messy, and I tried to rationalize it. Didn't care about being compatible with other stuff.
@timber lion I'll move on for now so its up to you. I think changing the API earlier is better
i'd say lets hold on this one, i'll put my change in today or tomorrow
and then re-lint, change API, updated guides after
yeah that makes the most sense
@timber lion could we remove the device prefixes from the constants since they are namespaced in Python? AMG88xx_IHYSL = 0x0C -> _IHYSL
we could, they're there because it helped with porting
yeah, I'm just suggesting a rename
@slender iron What are the units for the baud rate of the serial connection?
baud
oh. I was thinking it was Hz or something.
115,200 bits per second and 1 bit per baud π
Its how many bits per second
Or rather kb/s
Yeah
Thanks!
All good
I was looking it up in specific reference to the serial connection and not getting a clear answer in return.
Yeah, I learned it from people calling it 115200 baud
I should have remembered from baud modems, now that I'm giving it broader scope of thought. Oops.
Its all good, we all have weird questions sometimes
Here's my weird question - what're y'all building right now?
A Learn guide π
Ooh man! Hats off for documentation!
Although on my side list is a few little Circuit Playground Express projects to use in a CircuitPython presentation I'm giving in January. Definitely a couple of things involving blinky lights.
I'm doing a quadcopter from scratch
Very nice!
At least all electronics anyways
midicv unit in cp
What's the CV in MIDI?
control voltage for analog oscillators, filters etc
Ooh nice!
at the moment I have one pitch CV and one "gate" which is a signal that goes high to trigger an envelope generator, etc
That sounds like a fun project! Makes me think of saving up cash for a Roland GAIA many years ago.
Question: are there plans to add a Circuit Python tag to the learn guide section? I know the the Playground kind of started it all, but since you guys are all in on CPy...just a thought. (a selfish one at that; i'm diving into my trinket m0 for the first time :D)
There is a CircuitPython tag, found in two places.
If you click on Microcontrollers, you'll find a CircuitPython category under it. As well, if you click on Programming, you'll find a Micropython/CircuitPython category under that. Most of what you're looking for will be under the first one.
Hopefully that helps π
It does help. I guess that was more of my question. Having CPy as a top level choice. You'd think that my keyboard has cooties and I don't want to type in the search bar. haha π·
It's definitely worth consideration. Feedback helps all of this evolve.
well, now that I know the shortercut, it's not that bad. and I get how hard it is to design "ease of access", especially with adafruit's awesomeness of having a store front, learning guides, blog, forum, github, readthedocs, so on, and so on. I got dizzy just typing that...
dont forget adafruit.io
π Seriously, we appreciate the feedback. All of that only goes so far if we're the only ones looking at it. The more we hear from others who use it, the better we can make it.
see! it just keeps going!
Adafruit is amazing in the fact that it supports everything so well
Makes it easier when I am doing designs and see you already have boards and I can see what you guys have done, and look at the docs. Its really amazing.
@idle owl and that is what makes this community so great. i generally don't hold my tongue too much, but around here (with regards to "you guys could do this or that") I hold it since A) its already awesome, and B) I don't want to add more work to the already heavy workload of keeping the current awesomeness awesome.
Totally agree! The thing that sets you guys way above any other company is the documentation! It's hard enough just grabbing some PCB and knowing what to do with it. You guys provide the leverage to change us from simply saying "Oh ... nice." to "I'm swapping my TV-B-Gone's power to a LiPo source, so I can recharge via solar."
@raven canopy We need your feedback though! We really appreciate you thinking we're awesome, but the community is a huge part of that. That's the basis for open source. The more amazing people involved, the better any project becomes.
@idle owl noted and agreed. I am looking at ways to contribute, just need to find the proper angle of attack...
@raven canopy That's great! There are many, so I'm sure you can find one that you'll be into!
kind of the problem. I'm into all of them! π
@raven canopy Been there!
I wish I could code like this at work - as in, have a discord chat open, and just shoot the bull with anybody who wants to talk shop.
@opaque thicket Its great. Although, I'm just a freelance engineer working in college.
@sage apex Nice! Which program are you in?
Applied Electronics Engineering, gonna transfer colleges to do plain EE
Very cool! EE was the hardest bit for me - hats off for taking the jump!
Thanks, I really love what I do. I've learned a lot so getting a degree is more in the math side than anything
Totally! I love circuits, but I DO_NOT miss doing circuit analysis.
Same here, I had to do digital electronics in HS and that circuit analysis was something. And then making large projects using XORs and stuff.
Ooh man! Digital design with the NAND gates and Karnaugh maps? Now that was my jam!
- minus the D-flip flops, perhaps. Made sense at the time, but now...

π
I will start with MAX7219
I am updating MAX7219 with class __init__(8 parameters). pylint says "Too many arguments (8/5) (too-many-arguments)" Is there a reccomended way to restructure a class __init__ method with too many parameters?
*arg / **kwargs?
really, pylint would be happy with that?
i don't see any issues with that initializer
something is up with pylint IMHO
changing it to just *args, **kwargs and manually parsing them out would be odd
and break the documentation tools
there is an explicit limit of 5
i think it's a case of pylint again being too aggressive IMHO
yeah. i was kind of asking / suggesting. not sure myself.
yeah you can add this around it too it looks like: https://stackoverflow.com/a/816549
i will try that
@timber lion i like that solution over restructing it.
yeah, there's nothing wrong with the initializer, since half the args are keyword args
good to hear
it should distinguish between keyword and non-keyword args. There's an interesting other error which makes more sense:
Too many positional arguments for %s call Used when a function call passes too many positional arguments.```
so if you called that initializer without using keyword args, it could complain
I replied back to an email from @fading solstice with the suggestion of making it python def __init__(self, w, h, spi, cs, *, baudrate=8000000, polarity=0, phase=0):
that will force baudrate, polarity and phase to always be kwargs and never positional
@tulip sleet I chatted with damien last night and he pointed out gc.c and vm.c get compiled with -O3 for speed but we could probably save space by changing it to -Os
that's an API breaking change though be careful
clever. i will try to remember that one
if someone is calling it as
MAX7219(100, 100, spi, cs, 500000)
right now
it would suddenly fail with that change since baud rate is now only keyword args
@timber lion I'm aware of that
it's cool to make the change but just be careful to call it out
π
it might be worth just pulling baud rate out and baking it in to the driver though
that's what i generally do, look up the max baud rate in the DS and use that
it will fall back down to the fastest available near it
and for software spi.. well you get what you get π
polarity and phase too i don't think a user ever wants to change those
since it's going to be fixed for thedevice
that sounds good to me
There are two derived classes that people will call, BDCDigits and Matrices.
Neither of these use the baudrate, polarity, or phase
ah nifty cool so yeah less dependency on what users are using right now, not as big a deal to change the API
w00t!
so use scott's approach of remove the extra paramters?
my approach doesn't remove any of them, I agree with @timber lion that they can be removed if they are never changed
@slender iron i can try changing the optimizations there and see the size change. I was thinking of compiling the PDMIn with -O3 to see if it would be faster, but didn't have a handle on how to set the flags easily -- I see now in py.mk how to do it.
I was testing pylint with (a, b, c, *, d=1, e=2) style but was trying to get beyond some other complaints it had. Never got that far.
I thought maybe I had the Python syntax wrong
never got my test program score above 0
@tulip sleet the -O3 thing isn't urgent. just something to keep in our back pocket
@tulip sleet what other errors did you hit with pylint?
I was just writing a test program and it was complaining about all my variable and class names and docstrings, etc. I had vars a1, a2, a3, etc.
π if its a script then take a look at how travis does examples
there are a couple things it turns off
tnx - I just installed pylint3 fresh and didn't configure anything. And it complained my test program was foo.py (foo not allowed)
lol, yeah foo is blacklisted
yeah - no shortcuts allowed!!
just got 2 CPX's with new mic's and am trying things out.
excellent!
@tulip sleet Excellent!
@idle owl I am seeing same issue as you: samples are all zeros even at 32k. Waiting for some code and data sheet from Limor.
@tulip sleet Yep! That's a good place to start. We did a lot guessing with the timing, that's how I came to the code I sent you.
What is the state of the art with regard to DTFM? external decode IC still required?
I used to do that with a Z80
@slender iron The HD44780 char LCD driver chip can run in 4bit or 8-bit modes. However, that chip is leveraged by another manufacturer to bring out a complete LCD module (not just the 44780 chip). The character LCD manufacturer chooses to create a 4-bit external interface to the LCD module (since that is one of the two options provided for by Hitachi's design of the HD44780 LCD driver chip).
The datasheet for 44780 is very specific on this:
The four low-order bidirectional tristate data bus pins (DB0 to DB3) are used for data transfer and receive between the MPU and the HD44780U. These pins are not used during 4-bit operation.
DB4-DB7 are used for the 4-bit interface (which is the usual interface presented for character LCD's).
Since DB7 can be used as a busy flag (and no other DB pin has this distinction) that is probably why the high-order nybble was chosen over the low-order nybble, when presenting only four pins to the external interface. Just a guess, there.
ref. https://cdn-shop.adafruit.com/datasheets/HD44780.pdf
ref. https://www.adafruit.com/product/198
As the HD44780 was presented to me as the industry standard for character LCD's, I would prefer that any unification of disparate chip drivers take this into consideration. There are a lot of people who already know how to work with HD44780.
I didn't even realize there were options available that were not HD44780-oriented, in character LCD modules.
@hollow tartan There are software decoders. Paul Stofffregen has written an audio library for Teensy that can do it, and also has an 8-bit impl for AVR: https://github.com/PaulStoffregen/AVR_DTMF
I found this one: https://github.com/jacobrosenthal/Goertzel
@timber mango sounds like all of them are HD44780 but may use an intermediary IC to reduce the number of pins
I wish it wouldn't say I was typing. I was. π
@hollow tartan I read about that one on the Arduino forums. I'd look at Paul's library first - he is very good (he runs https://pjrc.com).
@slender iron From what I can tell, 100% of current offerings (anything but a 'discontinued') in the char LCD category at AF has the 14-pin (minimum) electrical interface, including all 8 pins (DB0-DB7).
I was completely mistaken to think the secondary manufacturer would not have brought out all 8 data bus lines -- they do, and that is universal (explains pins 1-14 of these modules, which are consistent everywhere).
π
@slender iron hi - where did you get the sinc filter table and implementation in PDMIn?
i spent most of the afternoon figuring what makes it run faster and what doesn't. Loop unrolling is effective. Some other things like trying to eliminate if statements in the loop make little or no difference.
Are you referring to trying to make it listen for data sooner?
@tulip sleet I got it from @meager fog
@idle owl, no just making the filtering computation run faster. At this point I don't care whether the data is right or not. I can't sample fast enough right now to be reliable - need to improve that.
@slender iron tnx - I have an email in to her for code for the new mic. She mentioned she had some. That may be the same. The filter output doesn't really look right, but I'm not sure the input data is right either. If I play a tone while recording it doesn't get recorded even though the data is non-zero.
Ah I see
@idle owl did you ever successfully record speech or similar and play it back?
@tulip sleet No I came to the conclusion it wasn't possible, so I had stopped trying.
Not a hard conclusion, just my own experience
@slender iron maybe same question for you. I know you got it working, but right now the output data is close to 0x7fff all the time with some variances, when there's input data.
was that 1.0 or 2.0?
@slender iron how do I pull in an unmerged PR to my local repo? I have just benn copy/pasting the files, but is there a way to get git to geve me the files in the PR -- trying to test some of the updates.
2.0
and was that with the breakout mic or the CPX mic?
I don't think that 1.0 supported it
CPX but the older one
@solar whale let me find instructions
yeah, just tested that, and doesn't really seem to be recording good data, but I'll try harder
the jist is that the pr is just somebody's branch
thanks
Ooh I'll want that too
np
hey @idle owl do you think this would be a decent project to start learning with? https://learn.adafruit.com/circuitpython-basics-analog-inputs-and-outputs
@lethal plaza If you're interested in it, yeah! That's more what it's about. Tony's videos are great, so that should help a lot to have with the guide.
definitely interesting and seems like a good plce to start π
Then go for it!
@slender iron I googled the filter constants but they're unique in that sequence, so her code is original π
π
@lethal plaza Best practice is to have a resistor (at least 2200 ohms) inline with an LED when you connect it to a microcontroller port pin. That limits the current flowing through the LED.
There are good reasons to require an external resistor (it's possible to drive an LED without any resistor, but that's an advanced technique involving a duty cycle so as not to burn out the LED junction in a puff of (probably not blue) smoke).
Yeah you can way overdrive an LED so long as you keep the pulse brief. It fools the human eye into thinking it's a lot brighter than it is.
2200ohms sounds crazy! I am used to resistance in audio applications so usually a lot lower haha
300 Hz is generally fast enough of a refresh for an LED array, to not notice a flicker in the corner of the eye. Put a rotating fan blade in front of various devices that do flicker on and off (such as a flourescent bulb at 60 Hz) and you can see the refresh better (esp. old Mac computers which refresh around 50 Hz).
If you represent multiple digits on several 7-segment LED modules, you can 'paint' one digit at a time, but you must video-blank the entire array, between paintings -- or weird ghost segments at varying brightnesses will appear (at least to the human eye).
yeah i think you're losing me now lol
Well if you do the math on a 6-digit, 7-segment display -- how many LED's is that?
i dont know, and im not sure why we are talking about it lol I was just asking @idle owl if that beginner I/O project was a good beginner thing to start with
Fair enough. π
thank you though, when I get deeper into I am sure I will need that help
@slender iron for the library update to ccs811 and bus_device do you want/need then tested unde 2x and 3.0 or is 2.x all that is needed. Also is it necessary to test on esp8266 as well.
It's fine. I tend to do 'that' and worry later if the person had any interest. My friends and family get this every day, from me. Every once in a while: someone asks a follow-up. Not often, though. π
@solar whale I don't think it needs to be tested on multiple versions of circuitpython
so whichever you have access to will work
OK - I see what I can do. the git pull worked great - cleaner than cut/paste
great! thanks for the help
I'm gonna go for a walk before the sun disappears on me. I'll be back in 30 or so
See you soon!
enjoy - first snow here tomorrow!!
We're due for 3" in NW Connecticut by 7pm Saturday.
Winter Storm Watch here in NH - could be 6+ -- we'll see
in eastern MA: 3-5" after 11am, then 2-4" overnight Saturday night
I love reading the NWS forecast discussion.
I haven't even looked. I just know we're supposed to get snow here in MI.
Sounds great for the east coast skiiers. We need some snow out west so my local mountain can open. They can't find a water source to make snow
_reads AFDALY fairly often.
@unique turret Oi
Just gotta SMILE at Pirate, Monkey, Robot, Ninja
back
wb
max31855 wins for not having any lint errors already!
@slender iron I updated ccs811,bus_device and register and am able to access ccs811 on CP 2.x - Hopefully taht counts for the ccs811 and the I2C, register and i2c side of bus_device -- I try somthing on SPI in a bit.. Is tat the teting you need. If so, I will add some notes to the PR's.
@solar whale Are you running Linux?
yes
PYLINT:
pulses.append(pulse_in.popleft())
pulse_in.resume()
Get " Do not use len(SEQUENCE) as condition value (len-as-condition)
Anyone know why that is a bad thing?
This comes from Adafruit_CircuitPython_DHT
@fading solstice maybe because the length of pulse in is changing?
an empty list in python is False
so while pulse_in: is equivalent
yes, pylint like that!
@slender iron this is kind of late but I finally got around to testing your hacked Hyper terminal app with a circuit playground express and BlueFruit 32u4 board and it worked flawlessly running on El Capitan. Great work!
I'm gonna try to mess around with it when I have some free time
@slender iron what are you looking to be done?
get it rebranded and test the failure cases π
not sure who maintains individual tutorials/pages on learn.adafruit, but https://learn.adafruit.com/adafruit-circuit-playground-express?view=all#random-numbers
lists the module as urandom
and it seems to be random now
so someone should -u that π
I would recommend removing the split window functionality, I tested it and it was trying to create multiple panes to the same COM port which caused it issues

bye all! have a great weekend
Later @slender iron, you too!
@slender iron Later...
@solar whale What's the basic text editor in Ubuntu? The Notepad/TextEdit equivilent.
nano, vi, emacs
@idle owl gedit
lots of option - nano is basic - but it is Terninal based - mayn ise Emacs, or gedit, - mu can be used .....
gedit
Awesome thanks π
beware - it can have "delay" issues.....
Yeah, so can Notepad... I'm going to suggest downloading something else, but for someone just getting started, they might not be able to download anything, or don't want to yet.
So they need to know what to start with.
Unde Ubuntu - if you double-click on a file in the File manager - it uses gedit
excellent, thank you
asking for preferred editor uder linux is a dangerous thing π wars have been faught ...
Almost as bad as asking curly brace placement with c++
I have noticed python explicitly doesn't use anything that caused style wars with c++
don't ask about tabs vs spaces....
And don't mix tabs and spaces, painful lesson with "Object has no attribute" errors...
wow! here is a cryptic error - I forgot to hook up the CS pin when testing a BME280 under SPI on a Metro_m0_Express - CP 2.1.0 - error reported ```>>> import bme280_spi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bme280_spi.py", line 12, in <module>
File "adafruit_bme280.py", line 247, in init
File "adafruit_bme280.py", line 78, in init
TypeError: can't convert function to int
Oi
I'd call that counter intuitive
hmmm
looks like it's trying to give you an error, but failing when converting the value it got into something useful
ah!
id is a function
@stuck elbow that would have been a useful error message
hmm - I wonder if @slender iron knows -- he does now...
@solar whale File an issue on the driver for him with the info
or fix it and make a pull request π
@stuck elbow should it be entered as an issue ? woould you do it sionce you know the detatils.
@stuck elbow It's harder to fix it and make the PR when it's already waiting in a PR state...
@solar whale I can help you with it
ok
so when you go to https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/master/adafruit_bme280.py#L78 you can see a pencil icon at the top
click it
(you need to be logged in in github)
got it
now scroll down to the offending line, and replace
raise RuntimeError('Failed to find BME280! Chip ID 0x%x' % id)
with
raise RuntimeError('Failed to find BME280! Chip ID 0x%x' % chip_id)
underneath, you have a "propose change" form
Oh nice!
I think the title could be something like "fix a typo for chip_id" and in the description you can say "The id variable was renamed to chip_id but not everywhere. This fixed that."
or something along those lines
then click "propose the change"
I'm completely wrong then. Apparently it's easier to edit it in PR form. π
@idle owl for simple fixes like that, yes
it's worse when you need to change multiple files
Good to know, thank you.
@stuck elbow thanks! - PR entered
@solar whale thank you!
hmm, I can't see it
I think you need to send it now to the original repository
look for a "make a pull request" button
now I can test pulling the PR an testing it..
yay ```>>> import bme280_spi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bme280_spi.py", line 12, in <module>
File "adafruit_bme280.py", line 247, in init
File "adafruit_bme280.py", line 78, in init
RuntimeError: Failed to find BME280! Chip ID 0xff
nice!
that is a much more informative error message!
yeah, errors in error handling are confusing
"There was an error, but while we tried to display it, a following error was encountered: no error."
@stuck elbow thanks for the help and walkthrough of a simple PR.
no problem, thanks for finding and fixing a bug
Great job all!
group hug!

Finally! Couldn't get my own code to work with the DotStar Featherwing. Lost the code that didn't work at some point so I can't compare it, but I finally have something working!
Backed up the code this time.
yay!
I'm starting to become irrationally excited by blinking LEDs 
I... understand. Completely.
"There's always room for blinky."
What's wrong with this command line:
~/dev/samd11$ JLinkGDBServer -if SWD -defvice ATSAMD11C14
π
-defvice or -device?
winner winner, chicken dinner!
Now if I had just actuall read the error it returned I could have saved myself several hours of hair pulling and re-wiring
haha. been there too many times.
@fading solstice heyyy
How can i help?
@meager fog I've been doing some m4/'51 stuff; How far did you get before you noticed the reset pullup issue?
sorry i just got back from a walk
@pastel panther not until after we made our first PCB π
same here!
@fading solstice no help needed just FYI so we dont doubleup
k
i did BMP280, now Si021
k
Looking to jump into contributing on this one. But, as this would be my first on this MASSIVE project, I have a couple questions.
-
Which branch would be the best to reference & fork? I know the updates since asf4 have changed a few things, so don't want to start on outdated footing. I'm assuming
master, but we all know what happens when I assume. -
Are we looking at SAMD21 only, or for all ports?
In some preliminary research, I found the reference that @tannewt mentioned for Ser...
i am help scott iwth adding pylint to everything. I ran into an interesting pylint complaint in SSD1306.
@fading solstice I'm around for a bit if you need help
@slender iron Should the M4 version of uf2 from your fork be compatible with the '51G with some tweaks?
si7021 is missing an example, added
@pastel panther yeah, just make sure the chip variant stuff is set correctly
then I can load the elf with gdb, right?
There is a framebuf that is initialized a derived class's __init__ but is also used by the __init__ of the base class (probable the wrong terms). Anyway pylint does not like the base case referencing the framebuf (Instance of 'SSD1306' has no 'framebuf' member (no-member))
@meager fog Good to know. I've got a bunch I planned to do as well.
my fix is to create a method in the base class to return the framebuf from the derived class.
Ok. I always check the PR before I move forward anyway. So that works well
I added AdaFruit_CircuitPython_DHT to list and then converted it.
@slender iron did you see my comments on framebuf?
@fading solstice yeah, let me look at the lib
ok thanks
@fading solstice I'd probably just add self.framebuf = None to the base class
It needs to be created before the base class is initialized. because the base class uses in init_display()
can't just add it here https://github.com/adafruit/Adafruit_CircuitPython_SSD1306/blob/master/adafruit_ssd1306/ssd1306.py#L33 ?
sorry, by then the devired class have created framebuf and its ready to use. maybe we should pass it into the base class initializer as a parameter
Thanks for looking at this! microcontroller would be a good place to put a read-only attribute, returned as bytes, probably. Work on the master branch. Weβd want SAMD21 and β51. If ESP8266 and nRF have a similar uid, they should be supported too
ok did Si7021
@meager fog I think I asked you about qspi on the '51 previously and you mentioned something about not being able to do normal SPI on the QSPI pins? Do I remember correctly?
And you didn't like that because it means you can't use the same pins for qspi or normal spi?
yah means we have to take a leap
I ended up just putting both on my board. Other than the speed and XIP support are there other functional differences between QSPI and SPI?
QSPI is much faster - SPI is limited to 12mhz, qspi probably can go faster, check DS π
Yea, it can go way fast and even clock on rising and falling edges apparently. DDR I guess? I'll let you know how it turns out
yes!
LIS3DH tested.
thx @idle owl im doing the BME680
before you do a release
theres a typo in travis.yml
Ah ok
ok np
Is there Circuit Python driver for:
- ST7565 Graphic LCD http://adafru.it/250 ?
- Rotary Encoder http://adafru.it/377 ? (direct read)
- GPS Featherwing http://adafru.it/3133 ?
- Piezo buzzer http://adafru.it/1739 ? (simple beep lib maybe, or knock capability to 'listen')
This graphical display looks great, costs less! The dark gray pixels are visible in daylight, and there's also a full RGB LED backlight, which you can control with PWM to make any color ...
This rotary encoder is the best of the best, its a high quality 24-pulse encoder, with detents and a nice feel. It is panel mountable for placement in a box, or you can plug it into a ...
Give your Feather a sense of place, with an Ultimate GPS FeatherWing. In 2013 we designed the Ultimate GPS module to satisfy all your GPS desires - and now we have brought its power and ...
@meager fog Latest on this one was 1.0.0. Should I give it 1.1 or up to 2.0? Never sure with version numbers.
I have all that in a single project (built already and working in Arduino on Feather M0 Express). Figured I could test the hardware for Circuit Python (pylint recent pushes).
I also have a working monochrome char LCD similar to http://adafru.it/181 wired and tested for 4-bit parallel (again, for Arduino) as well as the 8x NeoPixel strip http://adafru.it/1426 (also Arduino-tested).
Standard HD44780 LCDs are useful for creating standalone projects.16 characters wide, 2 rowsWhite text on blue backgroundConnection port is 0.1" pitch, single row for easy breadboarding ...
@idle owl bump to 2.0.0
@meager fog Thank you!
https://learn.adafruit.com/adafruit-ultimate-gps-featherwing/circuitpython-library#datalogging-example is the GPS library
for a piezo, you can just use the simpleio tone library https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino/circuitpython-pwm#pwm-output-with-variable-frequency
but there is not one for ST75 LCD yet, nor rotary encoders
Okay that's what I needed to know -- the missing holes (tho the pointers to the ones that have something are also helpful!)
You want them to track pretty closely to the Arduino libs, right?
kinda
theres some python difference, e.g. we use setters/getters as properties
and the naming conventions use snake_case
theres' char lcd and neopixel drivres for sue
sure
Are there any ISR's used?
ISRs are not exposed π¦
Thank you. I appreciate it, as if I can bite off more than I can chew I may learn something.
woot!
but its not a library, and you have to poll it - but it does work
I'm really thinking iic or SPI for the rotary on an 'outboard' trinket M0 since they're inexpensive now.
good luck π
Thanks for your time!
π
pylint question SET_CONTRAST = const(0x81) SET_ENTIRE_ON = const(0xa4) SET_NORM_INV = const(0xa6) SET_DISP = const(0xae) SET_MEM_ADDR = const(0x20) SET_COL_ADDR = const(0x21) SET_PAGE_ADDR = const(0x22) SET_DISP_START_LINE = const(0x40) SET_SEG_REMAP = const(0xa0) SET_MUX_RATIO = const(0xa8) SET_COM_OUT_DIR = const(0xc0) SET_DISP_OFFSET = const(0xd3) SET_COM_PIN_CFG = const(0xda) SET_DISP_CLK_DIV = const(0xd5) SET_PRECHARGE = const(0xd9) SET_VCOM_DESEL = const(0xdb) SET_CHARGE_PUMP = const(0x8d)
pylint does not like thing lined up. (bad-whitespace)
I believe they've been doing whatever it takes to ignore those sections. ```python
Register addresses:
pylint: disable=bad-whitespace
REG_OUTADC1_L = const(0x08)
REG_WHOAMI = const(0x0F)
REG_TEMPCFG = const(0x1F)
REG_CTRL1 = const(0x20)
REG_CTRL3 = const(0x22)
REG_CTRL4 = const(0x23)
REG_CTRL5 = const(0x24)
REG_OUT_X_L = const(0x28)
REG_CLICKCFG = const(0x38)
REG_CLICKSRC = const(0x39)
REG_CLICKTHS = const(0x3A)
REG_TIMELIMIT = const(0x3B)
REG_TIMELATENCY = const(0x3C)
REG_TIMEWINDOW = const(0x3D)
Register value constants:
RANGE_16_G = const(0b11) # +/- 16g
RANGE_8_G = const(0b10) # +/- 8g
RANGE_4_G = const(0b01) # +/- 4g
RANGE_2_G = const(0b00) # +/- 2g (default value)
DATARATE_400_HZ = const(0b0111) # 400Hz
DATARATE_200_HZ = const(0b0110) # 200Hz
DATARATE_100_HZ = const(0b0101) # 100Hz
DATARATE_50_HZ = const(0b0100) # 50Hz
DATARATE_25_HZ = const(0b0011) # 25Hz
DATARATE_10_HZ = const(0b0010) # 10 Hz
DATARATE_1_HZ = const(0b0001) # 1 Hz
DATARATE_POWERDOWN = const(0)
DATARATE_LOWPOWER_1K6HZ = const(0b1000)
DATARATE_LOWPOWER_5KHZ = const(0b1001)
pylint: enable=bad-whitespace```
You are correct though, it is not the pythonic way to do it.
that was what i did. so i am happy now
Ok excellent
ya srsly - how can you not love lined up consts???
There's only no love when my linter is complaining π
i finished SSD1306 and created a PR. Do i need to do something to the Issue 47r. Like move it to that pending section?
do you want a reviewer?
i love reviewers!
ok have it reviewed before pullin'
i also finsihed DHT and MAX7219
I won't have SSD1306 or MAX7219 until Tuesday.
DHT wasn't on the list when I ordered, so I won't have one of those to help there.
BTW pylint found a bug in SSD1306! In the SPI side of things, a method was calling a methed that had been renamed. pylint told me about it!
Nice!
I tested MAX7219, so we should be good
Then I'll review it
DHT, I tested with a DHT11 and a DHT22. so we should be good with that one too
Ok. I'll look through both and review
SSD1306, I tested with a i2c device, but do not have an SPI device
@fading solstice I fixed the typo in travis.yml. I'll merge your PR if that's good with you
For MAX7219.
oooops, sorry
Not a problem at all
i must be using the wrong cookiecutter
It's in a bunch of them, that's the only reason I knew. Ok merging. Would you like me to do the release?
yes, please
Excellent
i am fixing in DHT and SSD1306
you knowe what i also did GPS and tested that. i will fix in there too
Outdated critical Guide:
$ git clone https://github.com/adafruit/atmel-samd-micropython-vagrant.git
Seems to require an extra
$ vagrant box update
to follow Tony's guide:
https://learn.adafruit.com/micropython-for-samd21/build-firmware
which was
Last updated on 2017-01-05 at 05.27.29 PM
RESOLVED
Where the machine tells you to run vagrant ssh you want to say 'vagrant halt' instead, and then 'vagrant box update'.
From there, erase what you have done, with:
$ rm -rf ./atmel-samd-micropython-vagrant
.. at the appropriate directory level (will need to 'cd ..' probably).
Reiterate the entire guide. This time, the machine will find the update already in place.
It's stored external to what the Guide covers (your Linux box retains it from the last time you updated it, independently of vagrant).
old text follows
BENEFIT
==> default: Successfully added box 'ubuntu/trusty64' (v20171205.0.1) for 'virtualbox'!
is the result when doing the
$ vagrant box update
whilst otherwise following this guide.
I did not issue
$ vagrant halt
and maybe should have. Seems to be correct, however .. following a 'vagrant halt' with a 'vagrant box update' looks like the right thing happened, anyway.
To be more certain, I ran
$ vagrant provision
manually, as the very next step, on top of this changed environment (and had not once used 'vagrant ssh' anywhere, up to this point).
I think I got this. Testing (if true, only the guide needs a casual mention of the fix; the Vagrantfile in particular seems to require no new changes).
EDIT:
Seems good now. See above blathering for the eggsplanation. Vagrantfile (and everything github) is already up-to-date.
The Guide, however, can stand a refresh to include information about overcoming a legacy installation. People will try this once, then try again, months later, and become reconfused. ;)
Basically
a) my Debian box retains the last time I updated with 'vagrant box update' (it retains a new seed version of Ubuntu, which the 'yellow prompt' reminds is available)
b) it appears necessary to do everything up to and including 'vagrant box update' each time a fresh (and recent) install is required
c) .. and then one may well wish to start over, from the beginning of the Guide (erasing the Vagrantfile, and everything cloned from github, completely outside of virtualbox/vagrant).
d) Since the host system now has the correct Ubuntu version held on-file, the next time through it does the right thing. When it prompts to 'vagrant ssh' you may finally do so, confident you have the most recent environment:
``Exhibit
Finished provisioning! Use the 'vagrant ssh' command to enter VM. CircuitPython source is in the /home/vagrant/source/circuitpython folder.``
anybody want to review this?
@slender iron Reviewed and approved the first one but I don't have merge access.
I may have lost changes by ladyada and katni. changed your comment for this issue to added a PRs ready for review category. Also tried to reinstate PRs Complete category.
@idle owl udpated DHT, GPS, and SSD1306
@fading solstice Do you think we should wait to test SPI with SSD1306? It's a short part of the file and reading through it says it's good to go, but I figured I'd ask.
@fading solstice DHT says it still has conflicts with .travis.yml and I evidently don't have write access to it so I can't merge it. So that one's still there. GPS is reviewed, merged and released.
I didn't know I was building the alpha for 3.0.0 ;)
``Adafruit CircuitPython 3.0.0-alpha.1-13-gb31c2ea on 2017-12-10; Adafruit Feather M0 Express with samd21g18
``
Personally, I'd prefer it returning the four words as a list.
I would also say that microcontroller would be a decent spot to put such a function return, but os does already return some board and microcontroller information, IE os.uname()
I agree that the outside call would be best in os.uname().
As I've gotten further into this, the first hurdle is getting NVM functions (read at least) working. I didn't realize it wasn't working yet...know before you go! haha. It seems that that the few people who were interested in the NVM to this point, wanted the EEPROM simulator...and have been mostly unsuccessful.
@idle owl I fixed the conflicts in DHT. I can not be sure about SSD1306 SPI. It had bugs before I even started on it. it would be good to test it at some point. I can order an SPI board and test it, if that would help
I'm not sure what is needed to test it, I might already have it. What SPI board are you talking about needing?
OLED display 128x64 pixel using SPI comms. I have a I2C comms board
Right, I knew that part, but I was confused about it needing another board for SPI to work
os.uname() returns this:
Returns information identifying the current operating system. The return value is an object with five attributes:
sysname - operating system name
nodename - name of machine on network (implementation-defined)
release - operating system release
version - operating system version
machine - hardware identifier
Regular CPython returns something like:
`posix.uname_result(sysname='Linux', nodename='salmonx', release='4.10.0-42-generic', version...
I thought you just need to use a different wiring setup for SPI to work
different board. i am going to check to see if adafruit still sells it.
Ahh ok
It seems that that the few people who were interested in the NVM to this point, wanted the EEPROM simulator...and have been mostly unsuccessful.
It's implemented only on the Express boards right now due to space considerations.
Most of the SPI stuff I've looked at simply needed different wiring. I might not have ordered what I needed to test it anyway if that display needs a comms board to work. Needed to look closer apparently.
https://www.adafruit.com/product/326 appears to support both
https://www.adafruit.com/product/938 is what I ordered
https://www.adafruit.com/product/661 sujpport SPI only
326
At least the product desc says it supports both as well
th938 works both ways
Ok that's why I was confused. I didn't realise there was one that didn't.
yea, i have a board (not adafruit) that is i2c only
Can you give me write access to DHT? Or do you just want me to post a review to it and you'll merge it.
Looking through it now
I cannot merge it or give you rights to merge. how did that happen?
I have no idea. I commented and approved the changes, but I can't see how that would alter any of that...
Github says "Only those with write access to this repository can merge pull requests."
i guess we need someone with real powers like scott
Owait, we're trying to merge it to the main lib. Scott needed to give us access to that I think.
Yeah.
He must not have added write access to that one.
@slender iron When you're around, you need to add CircuitPython Librarians to Adafruit_CircuitPython_DHT. Thanks!
@idle owl @fading solstice added cpy librarians as a team collaborator to that lib
Thanks @tulip sleet !
Thanks
too tired to do actual work
I'm still not seeing the option to merge...