#circuitpython-dev
1 messages · Page 167 of 1
OK -and I have verified that what I used to do on Micropython (a long time ago) as far as importing function in main.py does not work under CircuitPython
and it still does work under micropython
import stuff as mystuff
jerryneedell@Ubuntu-Macmini:~/projects/feather_m0_express$ cat stuff.py
def foo():
print("foo")
def bar():
print("bar")
``` on micropython ```MicroPython v1.9.3-240-ga275cb0 on 2018-01-21; ESP32 module with ESP32
Type "help()" for more information.
>>>
>>>
>>> dir()
['uos', '__name__', 'gc', 'bdev', 'mystuff']
>>> mystuff.foo()
foo
>>>
``` on CP ```soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 3.0.0-alpha.6-67-ge4ec672-dirty on 2018-05-09; Adafruit Feather M0 Express with samd21g18
>>> dir()
['__name__']
so I'm not crazy - just have not paid attention to the change.
No I believed you both times. CircuitPython is its own thing and is designed with a specific market in mind.
@hollow ingot so I'm sorry if I led you astray - I was thinking about my Micropython example last time we cahtted.
I always admire strong Design decisions, even when I don't personally agree with 'em.
(Use the Source, Luke)
I am enough of a python neophyte that I often miss the importance of some of the decisions.
I don't actually get why it works the way it does, but I seem to recall asking about this, earlier (maybe late last year?) I didn't realize micropython did it differently.
No worries. It's good to get people's comments anyway as it's a design decision I have to figure out - how to get that functionality over to circuitpython which might be an ideal base for educators.
Also, I've gotten used to it working the way it does work -- my expectation-adjustment period is somewhat behind me. ;)
I have working images already using Micropython so it's by no means desperate.
The work I am doing with vgkits.org is much less aligned with the performance mindset of micropython and more aligned with circuitpython's preference for python conformance and readability.
It's not an issue for me either - that's why I never noticed. When first stated playing with Micropython on an esp8266 I would define several functions and use them once I entered the REPL. More recently, I rarely use main.py at all except for final projects that just run without the REPL. I had not tried the "old way" in a long time.
@hollow ingot It sounds like a great project and I hope it works out.
I once complained to a friend of mine about a design issue, and he said:
If thine eye offend thee, pluck it out /true_story
So it would be nice to unpick it. Did anyone see the demo in the vid - thoughts, feedback?
going to watch it now
I almost never 'watch videos' linked to me.
Video generally slaves you to someone else's idea of how to use time, wisely. Printed matter allows scanning with the human eye, searching on keywords, and so forth.
I don't know how to make efficient use of video resources, especially if I didn't seek them out on a hunt for something quite specific.
@hollow ingot nice! - I wonder if there is any way to get functions defined via as part of the WEBREPL startup.
Dammit lost the message I was writing as I used the name for a mixed drink as a metaphor for a recipe.
dyno bot is a bit prudish.
I don't see a way of achieving the same functionality in circuitpython. Every solution to one part defeats some other part.
You can get that message back from someone with moderator privs.
Not sharing the namespace with main.py is a pretty fundamental one.
I can live with losing the message but it's funny that I had offloaded the thought to digital so fully that I could hardly remember what I'd written after it disappeared.
well - I suppose "import stuff" is not totally unworkable.
True, but then you have to introduce about 6 fundamental concepts or alternatively do the black magic thing of saying just type this and I won't tell you why
oops - I wanted to see if up-arrow would bring it back -- dyno bot alos hates strings of x's
yeah - I was thinking the black magic approach ...
If I recall correctly, doing a "soft reboot" in WEBREPL under CircuitPython drops the connection as well - have you tried that?
Thanks for the feedback on use of video, @timber mango I usually feel the same, but stepped out of my comfort zone to make one. Hopefully it's not too rambling. Is there a better medium which would suit you? Long form blog post?
I now frequently cannot distinguish between having thought to do a routine task and having actually done that task. Those tasks are so routine that I take nothing from them while doing them that sticks in the mind.
@hollow ingot I guess it's the matter of selling the video to the person. I've lately broken my own rule and dropped lots of links with zero explanation as to why I might have done so.
The engine here in discord helps some by trying to sum up why a link is useful, using automatic heuristics.
The old way was to photograph an attractive human being and put them on the face plate of the 'look at this' thing, no matter how incongruous that was. ;)
@@solar whale Micropython soft reset of WebREPL is messy, and never returns without a full reset. Discussing tidyup arrangements with @dpgeorge which might be a future workaround - equivalent to try:catch but for the main.py VM as a whole
I remember the first time I hit control-D in WEBREPL -- uh oh - that was a bad idea 😉
Real Simple: spell everything out. No acronyms - none! Explain yourself.
In a paragraph you can probably double your audience, just as when Stephen W Hawking explained in his book that his publisher told him that every equasion he printed in that book would halve his audience.
I'm too wordy and lose people by agency of that (questionable) habit.
(30 seconds in and having canceled my 'train' video I was watching) I'm an adult and don't need to be entertained with background music (or laugh tracks, for television).
High quality videography is probably the most immediate attractor: good lighting, high resolution, good contrast ratio -- composition -- all that stuff.
You want to watch (SEM**) Adam just because it's the elfing Star Ship Enterprise in his lab -- woo-hoo! Without a soundtrack, he rocks, and he's getting better with every video on his personal presentation (human factors: face, voice, addressing the camera and genuineness of personality).
___ **scanning electron microscope
random pick:
https://www.youtube.com/watch?v=BuJGb0FULmw
I watched this last night for 90 minutes, falling asleep several times, and still riveted:
https://www.youtube.com/watch?v=qghQ5eKGcyE
It's just a train driving through the Norwegian countryside. Fascinating
@hollow ingot sigh - just thought I try some webrepl stuff and discovered it is not even supported on the esp32 😦 I'll get it going an an esp8266 but that was a surprise!
@timber mango You spoke about falling asleep to video. I often put on a Twitch streamer while laying in bed. It's something that's interesting enough for me to casually accept to have on in the background, but not deep enough for me to focus intently on every action and word.
I have fallen asleep so well for the past year, no doubt to this.
If I eat bread during the day I'm very definitely going to bonk surely to sleep, even if sitting up in a chair - around mid-afternoon.
Speaking of which, man I'm now craving a nap...thanks ;-P
I should get a job doing this. Sleep-suggestion dot com
You're getting sleepy. You're getting...sleeee....peeeeey.....popup ad with video
One thing to remember about videography - it should stand up as an audio-only podcast. If it cannot, it's probably lacking something important. Listen to it without the video and see how it holds up.
https://www.youtube.com/watch?v=DDfLBWlBM18
Alright I gave that vid two minutes. The main thing I noticed was insufficient time to pause and reflect -- things happening too quickly (a very common complaint I have of most small video productions that show a lot of edits were made).
I liked the screen (REPL) on the left, and I liked the larger video inset on the right. Too many Adafruit videos make the video inset (the human, the presenter) way too small to be of any utility at all.
I like dividing the screen into three regions: the code, the presenter, and the hardware. I liked their placement.
@hollow ingot boot.py is run once for setup of things like webrepl. It is meant to be user editable but requires a proper reset to take effect.
Our solution for wanting set up variable is a single import that does the heavy lifting
Our best of example of it is the circuitplayground library: https://circuitpython.readthedocs.io/projects/circuitplayground/en/latest/
We also gear towards file based iteration rather than REPL. That allows us to start folks with some code
Yeah I think the philosophy is quite different in that regard. I'll attempt to demonstrate a more REPL-led approach and see where it gets me. I'm going to focus on CTRL+E for people starting with code samples, though that brings in the dreaded CTRL+D to complete. File-iteration works infinitely better on SAMD, anyway, unless i've missed some tooling to make it seamless on ESP8266.
yeah esp8266 doesn't do usb well
damien was considering file transfer over socket that could be a building block for over wifi file saves
https://shrimping.it/blog/wp-content/uploads/demo_sequence.pdf is an old document justifying the philosophy a bit (from when we were doing Arduino stuff).
@slender iron did you get to see the end to end demo in the video at vgkits.org ? It has file upload via Websocket but not triggered 'on save' as per SAMD boards or Pyboard. Unfortunately I suspect what is demoed there is not possible directly in CP as it depends on continuity between boot.py, main.py and REPL (whether wired or wireless) and I gather the VM reset between main and REPL is fundamental to CP. If I can work around this I'd rather use CP I think, given the learning materials and drivers out there, and the focus on educators, though Adafruit_Micropython_Blinka might give some cover.
@hollow ingot I'm busy at pycon so I haven't watched it yet. We could add autoreload after save
- save over websocket
I tend to paste the code in line by line until something breaks, if there's an issue I need to research in the REPL (usually very basic stuff I am unwilling to learn the 'studious' way)
@@slender iron tends to kill the WebREPL due to the reset not clearing out hanging ESP socket resources, sadly. Might make most sense to understand the options next week after you've had a quick view of the demo behaviour, would make more sense of the interdependencies which are built-in to the application scenario and why I'm come unstuck trying to fit it around the CP execution model.
gotta run! will read back later
@timber mango yes REPL paste is exactly the way I work and want to share with learners. Thanks for taking the time to view and feedback on video. Making it dense was conscious, assuming it valued people's time better and that they would pause it. However it's video #0 in a hopefully long series and I have a lot to learn. Will try different ways
Gotta sleep! Thanks and catch you again next week hopefully
Alright keep up the good work. I did like the video, once I watched it. ;)
Praise indeed! Much appreciated :)
"I never saw it but I didn't like it very much" -- my typical response, so yes, it's a better review. ;)
Backreading a bit now that I'm home: ESP8266 USB seems not beginner-friendly since it'd be easy to drag the file over and then remove the device before it's fully transferred. That's why I was thinking WiFi. People sort of expect WiFi to be slow, and it's a little harder to interrupt the transfer. Yes, you can power down the device, but that's generally bad form anyway.
that moment when you realize datasheets aren't perfect, hence plans based upon them can be de-railed (╯°□°)╯︵ ┻━┻
@raven canopy how do you specify an alternate i2c address in circuit python?
(to override the default address)
(this may not be generic; may be library/driver specific .. eccch.)
adafruit_lsm303.mpy
for that breakout, looks hard wired to me:
https://github.com/adafruit/Adafruit_CircuitPython_LSM303/blob/master/adafruit_lsm303.py#L148
yep. and that's the value.
So it just knows?
the line you linked is just a global (like a #define)
the line i linked is where it gets passed in to the I2CDevice
Thanks, I get it now (enough to not go further down that road). not an i2c addressing issue at all, it seems.
for a device where you can change the i2c address, this is typically how it done:
https://github.com/adafruit/Adafruit_CircuitPython_HT16K33/blob/master/adafruit_ht16k33/ht16k33.py#L43
you'd pass it in when creating the object, or if left unspecified, a default value is used
Thanks, that's what I had in mind. ;)
This is the first time I've noticed a sensor package can have two separate i2c addresses, for a single physical package.
yah, there are two, and i guess they can't be changed
so the driver was written to just use those, without anyway of specifying another
I think @umbral dagger had a hand in that and made a good choice for this particular package.
Maybe you can take a quick look at our discussion in #help-with-projects
I'm bonking a little here and will need to take a break. Getting closer but still a mystery.
i don't think they are doing anything fundamentally wrong, the sensor is just sensitive to lots of interference , but i actually haven't used it directly myself
Well it is varying, and not way out of expectation. Correlation is weak but that's filtered by very few data points. ;)
That's the kind of thing I spend several hours, observing, in detail. to get a good feel for it. ;)
@tidal kiln thanks for the input. Very much appreciated!
Speaker: Nicholas Tollervey [The Raspberry Pi Foundation][1] receives feedback about the difficulties beginner programmers encounter when learning Python fro...
@fourfathom Thanks for following the instructions!
It is interesting because we have a different message for when we think we reset due to power failure.
This message usually happens when a code error (like divide by zero or invalid memory access).
Mind trying with a different USB cable? I'm wondering if the USB code is getting funny data and crashing.
I'd love to fix the code issue its hitting but it can be a challenge to reproduce it on our end.
Happy to. I'm running it with the two lines of UART init code back in (my original code from my report) and am seeing crashes, but different, more like a regular power-fail then restart. I am using Putty for my"print" monitoring and it loses connection. When I reconnect the my code is running, but the count indicates that it restart from zero.
I will use a different cable and revert to Mu: the same configuration as in my report.
Probably unrelated, but this is puzzling me. In my main loop, I copy the time.monotonic() value to the variable mono_time. I save the int value of mono_time to new_time, and compare that to the previously saved int current_time, waiting for a new second. At the new second, I print the values of current_time (an int) and mono_time (a float), and a loop counter that tells me how many times the main loop cycles in the previous second.
Look at the results. The float to int conversion seems...
Things like int(7818.999767) == 7819 are due to the limited precision of the 30-bit single-precision floats, and also how the number is formatted for printing. Upstream micropython has improved some formatting, which we haven't merged in yet -- I'm not sure if it fixes this.
This is an instructive online floating-point representation calculator: https://www.h-schmidt.net/FloatConverter/IEEE754.html.
Things like int(7818.999767) == 7819 are due to the limited precision of the 30-bit single-precision floats, and also how the number is formatted for printing. Upstream micropython has improved some formatting, which we haven't merged in yet -- I'm not sure if it fixes this.
This is an instructive online floating-point representation calculator: https://www.h-schmidt.net/FloatConverter/IEEE754.html. Type 7818.999767 into the first field ("You entered"), and you'll see that number is actu...
Is there a way in Discord to filter messages? The github messages are surely useful but it is hard for to catch up on people messages.
Where does one report bugs in Learning System documents? I noticed at https://learn.adafruit.com/micropython-hardware-ili9341-tft-and-featherwing?view=all#bundle-install the link titled "these steps for the Feather M0 express board." is 404'd
@onyx hinge in the left hand nav there are links for "Feedback? Corrections?"
@tidal kiln aha thank you for pointing that out. "Thank you! Our nanites will repair this tutorial soon."
😃
@onyx hinge what bug did you find? is it a color problem ?
@marble hornet no, just a broken link about installing the necessary library.
@marble hornet no specific directions yet, I just wanted to play.
ah, if you need text support i have a very slow but functional bit of code.
at least for 2.2.4
I'll keep that in mind. Thanks!
have fun
Thanks for the floating point info. As I said, it's more of a curiosity than a problem
My overnight test again crashed, but apparently due to a lost USB serial port. When I woke up Mu had lost contact with the Trinket, and Windows Device Manager wasn't showing the com port. My code was still running (or had restarted), since the distinctive LED flash was active.
I suspect the particular USB port on the computer is the problem, and am now retrying it with different port, this time a...
does cir-py have INTERRUPTS?
@marble hornet no, it doesn't. micropython does, however.
I don't think so. They're really hard to implement...
We're thinking about the best way to do asynchronous code, but we want to make it easy to use.
here is micropython's documentation/discussion on them: http://docs.micropython.org/en/latest/pyboard/reference/isr_rules.html#
basically instead of interrupts we want to use the asynchronous capabilities of Python
the async and await keywords, the coroutines, etc.
asynchronous doesn't have to mean parallel
okay... looking up keywords
then i'm at a cross road. i am making a tricorder (from st tng) and i have a bunch of sensors that have interrupt pins. i would like to know if uv spikes too high or if there is noxious gas. is continuously polling all the int pins enough? or should i switch back to arduino ide. (which has gui support for the screen in addition to interrupts but it's harder to code in )
could i overclock the atsamd21? the m4 hardware isn't released yet and im making custom pcbs. plus cir-py has much more memory. @stuck elbow
also above^^^
what is your suggestion
i don't think the SAMD can be overclocked, but i've never looked at it specifically. if polling the interrupt pins isn't quick enough, then reverting back to Arduino would probably be the easiest solution.
@marble hornet you could also add a custom C module to your circuitpython build
@marble hornet I did that when I needed button presses
then you can use all the interrupts and such, and set a flag that then you can check from within your python code
@marble hornet I wrote a "gamepad" module and added it to circuitpython
it checks the pins you pass it for button presses, does debouncing, and buffers the presses for you to check from your code
actually, perhaps you could re-use it for your interrupts...
It's probably useful to try to solve the problem on multiple platforms -- some lessons learned (knowledge gained) will be obvious on one platform, and perhaps more obscure on another.
Yeah, they're all Turing Machines (after a fashion) but the approach can be elliptical, or more direct, depending on platform.
String-handling will often constrain you as to where to go next.
Dear @stuck elbow I'd love to use it, it sounds perfect! Plus I might add physical button too. If your willing to share it id be very thankful!
Thanks!!
I'm really struggling with the CP 3 and my game libraries.
They worked fine two months ago, now gamepad doesn't work at all for some reason and stage crashes after several seconds of updating the display.
That's on M4, on ugame10 the firmware doesn't even get me USB
@stuck elbow may i ask how you rotated the display on the ugame10?
in software i mean
no, I wrote another one, very rudimentary: https://github.com/python-ugame/circuitpython-stage/blob/master/st7735r.py
thanks for the head up!
@stuck elbow I am modifying the bitbanio I2C to accept the timeout keyword argument as it was in extmod -- I also found that I had to add the argument to the busio implementation even though it is not used. Does that seem like a reasonable appproach. Is there a better way?
@solar whale I'm really not sure. I suppose the API should be consistent.
that is what I thought - it is common now so it seemed simplest to include it - I'll put in in that way see what everyone thinks. Do you recommend leaving the default at 255?
if I remember correctly, nodemcu defaulted to 300
The current CP code has it hard-coded it to 255. I'll check Micropython.
Micropython uses 255
yes, because I initially used an 8 bit variable for it
figuring out that the difference between 255 and 300 is small enough
how large to you make it when you are having problems?
no idea, the unit is ms, but it's a bit more, because all the code around it
takes some time to execute
I think the unit is microseconds
ah, us, right, sorry
I have it implemented and it seems to work, that is I can specify a new timeout -- kind of hard to test... I tried using bitbangio on a Mtero_m4 and it is working ok. I'll try an ESP8266 to make sure it works there. Do you know any devices that need longer times. I can try a css811 gas sensor - I had lots of trouble with it in the past. Any suggestions?
not really, personally I implemented the clock stretching when I had problem with the i2c slave on an attiny85
I have modified the bitbangio ic2 to allow accept the keyword argument "timeout" to allow the timeout to be changed from the default value of 255 microseconds. I'll post a PR later today or tomorrow after I do some additional testing. It is not clear this will help this issue, but it seemed like it would be a good thing to implement.
OK - I'll just try a few sensors and see If I can see anything - I think the vl53l0x might also be a good candidate.
too complex :)
but I remember a few sensors did clock stretching while doing the measurement
I think one of the color sensors could do that
good chance for me to test out my collection of sensors.
@stuck elbow does the ugame 10 have more then 2 megs of flash ?
@marble hornet no
okay
technically you could replace the flash chip
and build custom firmware with support of more
i noticed ur files had support for tiles and such
but it's not working on my feather express
that the "stage" library, a sprite and tile engine for the display
yeah, it's not enabled by default, you have to build custom firmware
its running out of memory
try compiling to .mpy
I usually just freeze that library into the firmware, so it doesn't use memory
how can i wipe al the memory on a cir-py device in terminal
b/c my computer thinks it is full yet nothing shows in it
Nope. Kattni wrote a page for this.
in 3.0 there is also a method you can call in storage
ummm
found it in my downloads folder, although thank you
>>> import storage
>>> storage.erase_filesystem()
@stuck elbow is all i need st7735r.py
stage.py
ugame.py ?
or will i need other things ?
@stuck elbow in another matter i am trying to add the st7735r screen rotation to my library. i tried copying
the line into the command and data sending section
"(b'\x36', bytes(((rotation & 0x07) << 5,)), 0)"
without the delay
didnt look in detail, but the version frozen into 3.0.0 alpha 6 has i2cdevice.read_into not readinto
but the info is not sending, i'm getting an error saying: can't convert bytes to int
have you seen this? im a bit new to coding/editing spi libs
Hi, just a quick question. Is it possible to prevent other people from simply downloading the main.py file from the M0 boards? Something akin to the Data Memory Lock Bits in ATmegas?
The smaller boards without SPI flashROM could probably be locked.
I don't know enough about the SPI flashROM chip to speculate.
Boards like the Trinket M0 for example?
Any M0 without an SPI flashROM. Gemma and Trinket come to mind as they are physically small and probably don't have room for an SPI flashROM chip. ;)
Feather M0 Express, Metro M0 Express, Circuit Playground Express all have SPI flashROM.
Metro M4 also has SPI flashROM (and may be branded as 'Express' which seems to be the keyword for branding a target board as including a 2 MB SPI flashROM).
And even there, the SAMD21 or SAMD51 chip itself can be locked I would think.
But the SPI flashROM may remain open to interrogation.
Well sounds like I have some documentation to study then...
Well no protection is absolute I just want to make stuff a tiny bit harder on certain projects than plugging in the USB...
Anyway thanks for the info 😃
nice, thank you for that
Looks like it can be locked down thoroughly.
That's probably the correct chip since it's the right size and the github mentions CircuitPython.
sounds like it might actually work
I wonder how many boards will I damage trying this out 😃
Manufacturers probably need that level of security to remain competitive against copy-cat production houses.
@timber mango that could be the chip manufacturer's profit margin right there. ;)
Seems to me a JTAG (or similar; I have forgotten the name .. SW comes to mind) ..
.. interface would allow recovery of the chip, just not recovery of the seekrit codez.
more of an obscurity approach, but you could mpy-cross your code into bytecode, then call it from code.py/main.py.
@timber mango meh, I bet people would find a way given sufficient funds... every security feature has an expiration date...
@raven canopy that might be a more viable way to go so I could for example update stuff in the future if the customer desires etc...
you could also disable the USB functionality in a personal build of the firmware. it should still run just fine. but to update anything afterwards, you'd have to put on USB-enabled firmware first (just an added step).
note: would need to leave the bootloader USB-enabled
I'm not a big fan of tinkering with the upstream stable versions of stuff... Much easier to debug things when it's as stock as possible... So far the mpy-cross seems to be the way to go...
Or combine all of these to make it ultra-black-ops-like 😄
Speaking of upstream stuff... The Feather nRF52 Bluefruit LE will be running CircuitPython 3.0 once it's released?
I'm not seeing language suggesting the SPI flashROM can be snoop-protected.
that's the plan. but i think the official answer would be along the lines of "it'll be done when it's done". 😄
OTP protection is more along the lines of the seekrit spy cannot overwrite ze program vith vun uff hiss own.
See, the MCU can execute seekrit code without ever exposing it to any bus; whereas SPI flashROM exposes its content, during routine access. It's inherently insecure.
You would need an encrypted connection to the chip!
As far as a massive dump of its content, I cannot say.
@timber mango So it's actually more like a simple write-protection? It makes the filesystem read-only? From what I can google the ATmegas are not foolproof either... You simply set some bits but if you really wanted you could read it and reconstruct the code anyway...
@raven canopy Sounds like a reasonable ETA if you ask me 😄
I was just toying around for the past few days with some IR remotes and CircuitPython boards but the need for LOS makes them a bit cumbersome. And RF stuff is not always safe-to-use on the old continent as the frequencies are quite tightly controlled so something like the nRF52 Feather and a Bluetooth remote would be the best way to go...
Looks to me like the security for this type of chip is focused around controlling carefully when and if the chip may be written to.
Looks like there's a mode that permanently kills a specific register (prevents it from ever being written again, for the lifetime of the device).
Which in turn prevents changing the content of the flashROM. In perpetuity (OTP mode).
what would happen if you freeze the main.py into the firmware and set the security bit?
then just call it from the user end
You could freeze main.py but then you'd have to disable copying CURRENT.UF2 off the BOOT drive. All in all it would be a lot of work to secure any CircuitPython program.
3.0.0-alpha.6 has very old libraries :(, but when HID and Express were added as of #805 (post alpha.6), all the frozen libraries were brought up to date.
... Trout Fishing In America replies .. github .. github .. github ..
A sneaky Pete!
Metro M4 feat. Microchip ATSAMD51 IN STOCK
https://www.adafruit.com/product/3382
46 IN STOCK
.oO( .. I got mine, Jack.)
How do I add the Circuit Python lib to Eclipse? I figured I could just add a module in Python, and then Eclipse would load the new libraries, however I can't figure out how to add the Circuit Python libraries to my install of Python either. I'm new to Python & Circuit Python, I've played with some code on Mu but I would like to try it in Eclipse.
@lethal zephyr I don't understand what software model you had in mind.
I have a limited grasp of the situation; however, in my understanding, things work something like the following:
Circuit Python exists as a virtual machine, in firmware running on a microcontroller...
It reads stored ASCII files from a filesystem residing on flashROM wired to the microcontroller.
It compiles such files, written in the Python language, into bytecode, which it can then execute (inside some kind of virtual machine).
The C++ compiler is used to create Circuit Python firmware, on a host PC.
It outputs a .UF2 compatible file.
mpy-cross compiles bytecode outside of the CircuitPython environment, on a host PC, for use within the CircuitPython environment. In this way, libraries are created, to be stored on the microcontroller-based system in a compacted form.
Sorry, I obviously don't have a good understanding of how it works yet. My main goal is just to get the adafruit python libraries added to Eclipse so I can code within it.
@timber mango you could compile your code to .mpy
@timber mango and if you want to prevent copying, you could freeze it into thefirmware
@lethal zephyr I would encourage you to try 'Mu' which is what amounts to an IDE for CircuitPython, kinda-sorta (not really sure myself; I use vim and a serial terminal to the REPL).
Wild guess is that you might coerce Eclipse into behaving as a python-aware IDE (basically a fancy source code editor).
@timber mango yeah I've been using Mu, I wanted to try something else. Eclipse works with python, but I haven't figured out how to load new libraries. Maybe I'll just do more research on Eclipse. Thanks for the help though.
You're welcome! Let us know what you did and how it worked out.
(I invoked the 'us' as I'm not here that much, lately).
Should we raise an error if there is a closck-stretching timeout? Something is wrong if it times out.
I have not been able to produce any timeouts - I am getting some errors writing to the CCCS81 but that is nothing new :-( I did find it works much better if I lower the I2C frequency from the default 400KHz to 100KHz or even down to 10KHz.
Can anyone suggest a resource here that can help me sort out the syntax needed to get the MicroPython REPL in PyCharm's ESP8266 device location field. The syntax for the value I used was rejected. I'm using Window10, so I've not seen an an example of what the syntax should look like. I was using, "USB\VID_239A&PID_8014&MI_00\7&13351F79&0&0000"
I'm trying to find information on interrupts on my M0 express
I'm thinking they might not be implemented yet... am I wrong?
Is there a map() function in CiruitPython? Say I want to map an input value like mic level and I want to map its max and min values of 100 and 400 to 50 and 100?
I know how to do it in p5.js which is shown here: https://p5js.org/reference/#/p5/map but no clue how to do it in python
p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.
think it's also called linear interpolation?
@novel bridge Interrupt support has not been implemented in CircuitPython. I think it is available in the Arduino environment.
@noble lance yep check out simpleio.mpy
i wish it was a cpy built in but we just hand-implemented 😃
it could be frozen...
ah, a builtin, sorry
@tulip sleet Hey Dan, I must have been living in a cave in the hinterlands. When did you do the Building CircuitPython guide?
Yeah, please raise a TimeoutError. Thanks @jerryneedell !
@meager fog thx!!
There's still 35 ea. Metro M4 Express (Beta) in stock. ;) Not bad.
http://adafru.it/3382
@meager fog is there a chance to see the metro m4's schematic?
or should I just wait patiently?
schem/board art is at https://learn.adafruit.com/adafruit-metro-m4-express-featuring-atsamd51/downloads
@umbral dagger hey by chance have you engineered CAN bus design? or was that someone else, there's no good dox on power requirements 😛
http://www.ti.com/lit/an/sloa101b/sloa101b.pdf may be of some use. @meager fog
I only cooked up a few buttons.
@timber mango it doesnt really cover the power requirements 😃
This is a nice powerpoint (in PDF) for Lurkers wrt CAN bus:
http://kurser.iha.dk/eit/tidrts/powerpoint/canbus-introduction.pdf
@meager fog CAN, wasn’t me.
@candid ravine Building CPy guide is about three weeks old. May expand it in the future; if you have suggestions or corrections feedabck is welcome.
@tulip sleet Looks really good so far Dan. I was without a computer and good Web access for about 3 weeks around that time. Will definitely review it in detail and give you feedback/suggestions if I spot anything. It looks very complete! Thank you!
@slender iron have time for a question about raising exceptions?
@solar whale shoot!
nlr_raise(mp_obj_new_exception_msg(&mp_type_TimeoutError,
"Clock Stretching Timeout."));
``` failes because TimeoutError is not defined -- it works if I use ValueError
but TimeoutError is defined in py/obj.h
@slender iron You mentioned being able to prevent the soft reboot of circuitpython on Linux. Pointers. I've not found anything useful yet.
BTW - I used nlr_raise -- since it is how it is done in SPI.c
in 3.x its moved to supervisor: https://circuitpython.readthedocs.io/en/latest/shared-bindings/supervisor/__init__.html#supervisor.disable_autoreload
@solar whale let me dig. maybe there is a missing definition somewhere
I thought somthing was missing from py/modbuiltins.c but it did not help -- I can't find any examples using mp_type_TimeoutError.
yeah, feels like it could be a #define somewhere
@tulip sleet I couldn't find my bookmark for the eabi compiler in my www browser, and it's not mentioned in your article. Using that compiler was the solution that worked for me, to build CircuitPython on Linux for SAMD21 targets.
You were the one who gave me the link. I can't even think of who it is who provides it. ;)
@timber mango what os are you on, and if linux, which distribution?
Debian -- Debian 8.10
I'll put a ref in the Guide soon.
@slender iron OK, trying that. I have a lengthy test of a hack I did today.
@slender iron ah - so do I need to enable itmpconfigport.h??
looks like it, or just remove the #if
I think we could fix the "more descriptive OSError" issue by uncommenting them
I suppose we need it for all builds sso I'll ermove the IFDEF
@tulip sleet I was thinking we could put a short link together with relevant links for people tomorrow
@slender iron you mean for building circuitpython?
sure, should we just start a Google Doc?
sure
@slender iron it compiles!! will test then submit PR -- thanks
awesome! nice job @solar whale
@solar whale are you using nlr_raise or mp_raise: the latter is "newer"
@slender iron do you have access to create a short url for the doc I shared?
I tried goo.gl but it's defunct
not an adafruit one
I used nlr_raise since taht was the example in SPI.c I can change to mp_raise - -same sytax?
@solar whale not sure off the top of my head
@solar whale look in shared-bindings for lots of examples of mp_raise. I changed a bunch of nlr_raise to mp_raise
I'll try it.
There are mp_raises for specific exceptions, and then also a general one where the exception is an arg
trying to get the repo setup, just tried to run make BOARD=circuitplayground_express. Got some errors... does it need python2 for some of the steps?
@gaunt breach did you run git submodule update --init --recursive after cloning?
@raven canopy, yes. Going through the build guide. I ran that step before getting to the most recent make command
It could be because I've got pyenv in the mix. it really doesn't like supporting more than one version of python
@slender iron https://tinyurl.com/pycon-2018-cpy-sprint
Core C code issues: PWM "Timers in use:" error is not descriptive https://github.com/adafruit/circuitpython/issues/770 Use the heap for FS block cacheing even when VM not active - https://github.com/adafruit/circuitpython/issues/754
that could be. i know that the bootloader requires python2, but can't recall if the firmware build does. let me take a look in a couple places...
built mpy-cross successfully. then failed here with buildin the board
Create build-circuitplayground_express/firmware.bin
Create build-circuitplayground_express/firmware.uf2
python2 ../../tools/uf2/utils/uf2conv.py -b 0x2000 -c -o build-circuitplayground_express/firmware.uf2 build-circuitplayground_express/firmware.bin
pyenv: python2: command not found```
CPX builds require a working mpy-cross to freeze modules into the firmware
so, pretty sure I can't use pyenv with this... if I need both python2 + 3 😅
what linux dist are you using?
mac
@gaunt breach do you have python2 but it's named differently?
yeah..the uf2 is what requires it (not bootloader). remember that now.
when using pyenv, at least the way I have it setup on this work machine, you can't access any python without being in a virtualenv managed by pyenv. And trying to access one outside that env causes it to complain. Will have to workout how to get around that...
@gaunt breach you could make a venv for it
actually, one thing we could ask folks to do is convert that script to python3 😃
@tulip sleet looks like ai'll have to add mp_raise_TimeoutError to py/runtime.c
@slender iron 2to3 should work just fine. i looked it over the last time this came up; really only looked like the print statements needed to be changed.
@raven canopy cool. we'll have a room full of python folks tomorrow 😃
@solar whale you can avoid that by using the general one:
mp_raise_msg(&mp_type_OSError, "I2C operation not supported");
is an example
assuming there's an mp_type_TimeoutErrror
Ah OK - yes the type is defined. Thanks
@slender iron ntoll already has a PR in for python3 and PEP8 updates...since May 2017. https://github.com/Microsoft/uf2/pull/2
haha. well that was quick. 😄
@raven canopy cool! hopefully assigning it will make them see it
@gaunt breach did you get it going?
its easier for me to make the uf2 script python3 compatible than work around breaking my pyenv 😑
agreed, probably much simpler.
year old PRs are bad news
@tulip sleet OK - it compiles (after including py/runtime.h) testing now
<@&356864093652516868> Reminder: No meeting tomorrow since we'll be sprinting at PyCon! Weekly stats are here: https://gist.github.com/tannewt/1d181aa62c7b703c5b6a38ab9f2b8e2f
my favorite 2->3 error
TypeError: can't concat str to bytes
😑
@timber mango I added a "Manual Setup" page to the Building guide with a pointer to the gcc arm toolchain download.
@gaunt breach i would just grab ntoll's update from the PR and paste it into the uf2conv.py on your local. then update the Makefile to use python3.
@raven canopy, I looked at doing that. But there's a variable that isn't imported anywhere, nor defined, which broke things 😦
arrghh!!
also not sure that it resolved all the str/byte stuff either 😖
@slender iron well done on CircuitPython mode=lightning! it even worked, defying the live demo gods...
@solar whale you may be able to remove the nlr #include if it's not used elsewhere. If you feel so inclined, update the other nlr_raise's in that file to the more modern mp_raise
@raven canopy thanks! I've had multiple people say "oh you are the one who did the lightning talk" 😃
@tulip sleet I think I'll try removing the nlr include for I2C.c and get this PR in. If that works, I'll do the others a separate PR since I'll need time to test
@gaunt breach I ran into the same problem using VirtualBox Ubuntu. Ended up installing python 2.7 and 3.5, then set up soft links in /usr/lib: sudo ln --symbolic -T python3.5 python sudo ln --symbolic -T python2.7 python2
@solar whale don't worry about the other uses, there are lots. We can update them gradually
ha! figured out the missing variable (a refactored function that didn't get renamed everywhere) and got it to build using ntoll's changes! 🎉 Now I can keep going through the setup guide 😅
yay!!
@gaunt breach fwiw with cd tools/uf2; git fetch origin refs/pull/2/merge && git reset --hard FETCH_HEAD I do seem to get a proper .uf2 file created even when I switch ports/atmel-samd/Makefile to use python3 when invoking uf2conv. however, some misc changes and bugfixes in the master branch of https://github.com/Microsoft/uf2.git get discarded in the process, and some of them might be important.
@tulip sleet Nice - compiles without py/nlr.h -- nice to clean that up
@candid ravine @gaunt breach not considering the pyenv thing, it should suffice to have the packages python and python3 installed on Ubuntu 16.04. python3 is installed out of the box I think, but python (which is python 2) is not in all versions of Ubuntu.
and another pin, for @tulip sleet
@cunning trail hahah thanks!!
@tulip sleet I couldn't find the (gcc-arm-none-eabi) mention/update, but I did see a (very) recent timestamp. Is there a latency between authoring changes and their being put onto the server?
@timber mango oops, I left the page in draft mode; now published. Try refreshing. There may still be a slight delay
if i just want to compile all the C code to python... not put it in a bin/uf2, is there a make command for that somewhere?
@tulip sleet That did the trick -- thanks!
@gaunt breach you could just hack this line in the Makefile:
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
@tulip sleet AFAIR, yes, python3 was installed as standard and I don't think Tony D forced it in the vagrantfile from his guide. I'll go back and look. I'm pretty sure I installed python (python2) separately.
Implemented the keyword "timeout" for bitbangio I2C clock-stretching ( based on code in extmod/machine_i2c.c) --- also added the keyword to busio to keep the API consistent, but it is ignored for busio.
If a timeout occurs a TimeoutError Exception is thrown.
@candid ravine yah, so you just need to do sudo apt install python because python3 is already installed. The vagrant guide is pretty old and I want to bring it up to date sooner or later.
@gaunt breach do you want to use that C code from python locally? there isn't a way to use it with CPython but you can run micropython locally (its ports/unix)
@slender iron I'm going down the rabbit hole for odd reasons. Basically, I'm setup in Pycharm, and I will do everything in my power to bend Pycharm to my will... which in this case, means compiling the C code, into Python, so Pycharm will be able to do cool IDE things like auto-complete, etc
@tulip sleet Definitely, that's why I was asking about when you had written the new Build CP guide. It looked "fresh" 😉
@gaunt breach you may have better luck stripping the module info from the rst comments in shared-bindings
I'm not sure what format they use to read the info about modules
lines that start with //| are rst
@slender iron Just watched the lightning talk. Well done!
I know with js, you can specify docs for the IDE to read/parse. I haven't seen that with Python... it seems to read off of pip packages in the env, or source python files. 🤷
hopefully the author of the plug in will come tomorrow 😃
has anyone done rst -> python?
@tulip sleet OK, that was a surprise, I didn't remember this correctly. Tony did install python3 explicitly in his Vagrantfile. That's not to say that it wasn't already installed though. sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system gcc-mingw-w64
i think that vagrant is built off of 14.04??
@tulip sleet At any rate, I'm glad that you wrote the new guide!
Yes, I tweaked it to use Xerial
in 16.04 a lot less is necessary, build-essential covers most
Good to know!
I added a pointer to the new guide on the Building page of the old guide
There you go, being helpful again 😀
Is circuitpython/ports/atmel-samd/boards/metro_m4_express_revb appropriate for the new targets that say BETA on them?
@timber mango No. revb is an old alpha board we sent to some folks. The pin mappings are different. We will remove it sooner or later. Just use metro_m4_express
the beta board is rev F
great! appreciated. I would have intuited it oppositely. EDIT: rev F. Got it.
@timber mango thanks, will read all those things - i found a maxim app note that had a 100mA switch cap converter and if its good enough for maxim its good enough for me 😃
@meager fog In my reading I saw 95 mA during a bus failure mentioned, so that sounds ballparky to me as well.
this pump can do 250mA peak, which is the highest number is aw anywhere
https://www.maximintegrated.com/en/app-notes/index.mvp/id/4643 in this one
quoat The transceiver will limit the short-circuit current to IO(SC) = 95mA. To avoid risking a breakdown of the supply voltage, it is better to dimension the charge-pump output current for this case.
@candid ravine glad to hear someone else is running the vagrant successfully in xenial.
'night all - gonna wind down to get enough sleep for the sprint
l8r!
night all!
Good night! Bedtime here as well.
@slender iron @idle owl @tulip sleet PyCon sprints... I'm (currently) in room 21 (its the one with a large poster of a bee by the front door). Come find me when you're set up. 😃
@plucky flint Ok keen, will do!
I’m back in CircuitPython headspace! Yay!
@idle owl UK timezones FTW! 😉
@plucky flint I'm probably 20 minutes out. Mind putting us on the board and starting to collect people in a room?
how was pycon so far?
Really good! Lots of circuitpython interest
probably because of the gemma :)
Yup!
Just saw this (no email, not sure why, sorry) ... I'll see if I can reproduce.
Ok all, we're sprinting in 26B!
@microbuilder #813 provides a workaround - Ithaves been meager in to master so the nrf52 does boot to REPL now -- the long term fix is still in progress.
I'm going to take a swing at this one.
Make python detection more robust and allow setting PYTHON2 and PYTHON3 variables during make.
@tuupola I put in a pull request to the CCS811 library and it was accepted. I didn't see any problems with the SGP30 library.
@slender iron here is the repo for the led animation colors: https://github.com/apatt/led_animation
@slender iron i also updated https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/issues/20 with the repo
awesome! I forked it to https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation
Hello!
hi @ruby atlas !
I'm going to take a look at this.
hiya im around today for another 2 hours or so, if there's sprints Q
w.r.t. hardware - will try to poke my cyber-face in here, @ me here or on github
@meager fog Thanks!
@meager fog we have a couple folks pylinting the learn guide code. We'll make sure to check the learn guides for copies of the code too
ok cool i personally like how the arduino travis works, it runs on everything every commit and uses .skip files to not do some dirs
mostly cause i think people will forget to commit a pylint config file
@meager fog kk, we'll have one central one then
My new learning guide is live. All code in CP 3 running on Metro M4 Express.
ptal!
Let me know if you want to sort these or format the guide links in a different way.
@meager fog I'm in the middle of a long-running test right now, I'll check it out after that (slow test so it'll be a good comparison).
I handwired an SOIC32 to DIP adapter for a 128K static ram and am running it through various write/verify passes.
Hey @meager fog is there a CircuitPython meetup here tonight? Or will it resume next Monday
@fluid helm The Weekly will resume next week 😃
Cool
@fluid helm I saw your talk. Good job.
Oh thanks. It was great fun
This is a little outside my comfort zone (which is great!) but I'm reading through the C code. My first intuition is that when the listdir function has to infer the directory, it's not recognizing it as the root directory in the way it would when you explicitly provide it with the root directory (via getcwd()).
ptal!
This deep links to specific CircuitPython getting started guides along with example code used by the guides.
Fix for Issue #770 - Provide a better error message when timers are still available. Rather than saying "Al timers in use" when timers are still available, say "All timers for this pin are in use"
@tannewt the link to the sample code isn't deep enough, let me send a fixup
…ctions
- moving Makefile to parent folder. This resolves some of the weird path/build issues
- remove trace references to cpydiff and original file (no longer used anywhere)
- converting SOURCEDIR to a changeable variable, passed through all sphinx-build calls
- adding path to conf.py, in case it moves again
- making
-vdefault with VERBOSE - making
-Edefault with FORCE - creating BASEOPTS to store all the dirs, paths, and settings, passing them to sphinx-build in one long cha...
I'm going to have a look at this.
@raven canopy Yep, xenial has worked very well. Given what Dan said, I will go back to the Vagrantfile and trim out what was required for Ubuntu 14.04 but is no longer required in 16.04
@idle owl i have a pull request for you: https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/26
those illustrations are sweet
@stuck elbow rad - would you be able to add this the newsletter?
I can try, what was the link to it again?
thanks!
hmmm unsure why the build failed on my PR... when it was non-code changes... 🤔 maybe @slender iron can take a peek and tell me what I'm missing... 🤷
import ucollections
should be
`import collections'
instead, as a UX improvement.
µcollections ;-)
@tannewt , could you please have a look?
@stuck elbow Did you pick up the HID throwing an error on 2.x issue?
thanks @slender iron! looks like travis was happy after you poked it 😄
@stuck elbow We have someone here working on it, so I wanted to find out.
@idle owl I'm not sure what you mean, but I never did anything with USB on CircuitPython
@stuck elbow We have an outstanding issue about making it throw an error on HID with GamePad or something like that if you're running 2.x. Scott thought you were the only person who might have picked up the issue.
So I thought I would check.
no, I didn't pick it up
Ok
I'm still struggling to get the µGame code to run on recent versions of CP 3.0 — there is something very weird going on
I will probably ask for help after the PyCon
Ok, it's no problem, I just wanted to make sure you weren't doubling up on something.
We'll be around!
For several common errnos, include a human-friendly string in the exception string. For now, only enable this on boards with external SPI flash, because pulling the uerrno module in eats up an extra 1kb of flash.
Likewise, this only adds error strings for common exceptions to avoid using flash unnecessarily - others will just show up as the EXXX string, but meaningful descriptions can be added later if needed.
Tested with a Feather M0 Express REPL:
Adafruit CircuitPython 3.0.0...
it is inspiring to see all the activity going on today
hug reports to everyone who has been sprinting
Put a pull request on the TCCS34725 RGB Sensor https://github.com/adafruit/Adafruit_CircuitPython_TCS34725/pulls
Here is a new link to the doc: https://docs.google.com/document/d/1JMDw3YGbY_KHBnQbtvo9A5EqLSOM46SGlMpnAe-gOvg/edit?usp=sharing
Create a new document and edit with others at the same time -- from your computer, phone or tablet. Get stuff done with or without an internet connection. Use Docs to edit Word files. Free from Google.
🎊 fixed my pylint issues
@slender iron pull reqeust https://github.com/adafruit/Adafruit_CircuitPython_Register/pull/14
anyone else sprinting want to go on a ☕ run...? 😅
Feeling like such an old fogey - watching the sprint is absolutely terrifying 😉 Thanks to all participating and cranking out code.
The Unix build runs the test - one test is showing unexpected output. May just need to modify the test, or handle that case.
https://travis-ci.org/adafruit/circuitpython/jobs/378877220
### Expected
b"<class 'int'>\n[Errno ] EIO\n9999\n"
### Actual
b"<class 'int'>\n[Errno error\n9999\n"
FAIL basics/errno1.py
The original Blinka is very nice, but a bit hard to draw fast, so I tried to make a "chibi" version that would be suitable for quick sketches and comic strips.
To reproduce and test:
Adafruit CircuitPython 3.0.0-alpha.6-75-ga0954b9e1-dirty on 2018-05-14; Adafruit Gemma M0 with samd21e18
>>> import microcontroller, pulseio, board
>>>
>>> pwm1 = pulseio.PWMOut(microcontroller.pin.PA14, duty_cycle=1, frequency=500, variable_frequency=True)
>>> pwm2 = pulseio.PWMOut(microcontroller.pin.PA18, duty_cycle=1, frequency=500, variable_frequency=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: All time...
Once I revive Rosie I can see if its still an issue there.
This PR is a WIP to soft reboot from code. It adds a new exception ReloadException (needs a better name) that will eventually also be used by the autoreload code. It also renames the global reload_next_character to reload_requested.
https://github.com/adafruit/circuitpython/issues/519
I'm pretty much just going off of shared-bindings/time/.
Does busio native I2C do clock stretching automatically or have its own register for timeouts?
beers are with you
I could not find any treatment of clock stretching so I assumed it was handled internally by the hardware. The spec does not call for a timeout. There is no limit. By implementing one in bitbangio we are adding a “feature”.
@slender iron @idle owl dinner!?!?!? 😃
omg it was pull request CENTRAL here today
indeed it was. i had sprint-envy... 😄
i sprinted too, just on crickit stuff 😃
@median aurora just curious whether your work in progress code is available for the touchscreen https://github.com/adafruit/circuitpython/issues/581
as for the performance of the LCD .. should I expect clearing (filling) the screen to take over a half second?
so, short story, there is a speedup available for screen clearing. move the lock of the spi device up into fill_rectangle. speedup of approximately 5x..
but no idea if that works on "most screens"..
also it sort of breaks the layering, hm
Hi, I'm having some issues getting my Metro M0 to run CircuitPython again. I dragged the .uf2 file and it restarted, but Mu doesn't see it
Any thoughts?
Oh nm! I found the awesome list above and figured it out!
The test did need to be updated; I've done so. The test was checking the output of:
str(OSError(uerrno.EIO))
Previously it would return something like '[Errno 5] EIO', but because the "5" is platform specific, the test was checking only the first 7 characters ([Errno ) and the last 5 (] EIO).
We deliberately changed the message to '[Errno 5] Input/output error' and so looking at only the last 5 was no longer correct. The test is now updated to look for everything after ...
Hi folks! what stage is the Gamepad HID library at? How usable is it?
I'm wondering if it's feasible to make a game controller using an itsy bitsy m0 express as the brains
hm, I think lighting killed one of my RPis
@clear pecan Please give it a try. In all of our testing it worked but we didn't have a bunch of use cases to test it with
@onyx hinge the first release for the stmpe610 is https://github.com/adafruit/Adafruit_CircuitPython_STMPE610 that is the current status.
Hi, I'm having problems running my Neopixel code, I used the one in the Circuit Python Essentials tutorial to try and run my NeoPixel Ring, but it's not working and the connections are correct
What do you mean exactly by "not working"?
@solar whale thanks for the link
@jepler#1088 let me know if I can help test any changes.
Or if there is something you want me to implement
@jepler#1088 a half second to clear is typical of what I see on an M0.
It’s a bit faster on an nRF52832
@onyx hinge that display is in fact capable of displaying animations in real time
the problems is, you have to drive it differently than that library does to achieve that
I'm thinking about making a "text mode" library, that would be limited to displaying text and box characters, but would be very fast
the main improvement I found so far was reorganizing to reduce the number of 'with spi' statements
I should look at what @stuck elbow has been doing
well, drop the spi device library in the first place
that will give you a huge improvement
also, set a higher spi clock speed
you can also skip toggling the cs pin if you only have one device on the spi bus
and generally not toggle cs if you do several operations in a row
If I understand correctly, that touchscreen is on the same spi bus, but still yes, to switch CS just once for all graphics activity "per frame" makes sense
I assumed that was the main difference the 'with spi' reorganization made in fact, but maybe there are other inefficiencies in that spi library
'with spi' also re-configures the bus for the particular speed and polarity every time
also, function calls are relatively costly, especially with inheritance and all that
and 'with' statement also setups a try-except trap
all that makes perfect sense
the most efficient way of updating that display is to first create all the data for a particular fragment of the screen you want to update in a buffer, and then send it all in one go
this works very well with "tiled" things, like text mode
because you can update whole lines
@stuck elbow If I am reading the I2C documentation correctly, Hardware implemented I2C does not have any "time" on clock stretching. there is not limit on how long a slave can hold the SCL.. I'm just curious why we have implemented one for bitbang I2C. I like having a timeout, but if the HW I2C does not have it, why should bitbang?
which is essentially what the rectangle fill does, except that it is limited to sending 512 bytes at a time
but that seems like a matter of practicality
@solar whale well, it avoids the problem of a stuck bus
agreed -- but only for bitbang -- I guess thats a good thing.
I think the hw i2c also attempts to reset the bus to a known good state at the transmission start
I remember some discussion about it
ah -- that may well be. I'll read more -- I have no objection to the timeout,. Just trying to understand it all.
but not sure if i2c.writeto() can timeout
@idle owl recently had some real problems with I2C hanging with an am2320 sensor - that was HW I2c.
the issue is caused by the mp_hal_stdout_tx_str() is called before serial_init() is invoked due to CIRCUITPYTHON_BOOT_OUTPUT_FILE. The fix is skip output to serial if it is not inited.
the i2c spec is lacking in that regard, the smbus spec fixed that
the issue is caused by the mp_hal_stdout_tx_str() is called before serial_init() is invoked due to CIRCUITPYTHON_BOOT_OUTPUT_FILE. The fix is skip output to serial if it is not inited.
https://github.com/microbuilder/circuitpython/commit/53593d1315e589416c78d23cfe7d021d6d1443e8
@stuck elbow thanks for the clarification
thanks - I've been wading through it.. Much more to study.
4.2.2 Time-out feature
SMBus has a time-out feature which resets devices if a communication takes too long.
This explains the minimum clock frequency of 10 kHz to prevent locking up the bus. I 2 C
can be a ‘DC’ bus, meaning that a slave device stretches the master clock when
performing some routine while the master is accessing it. This notifies the master that the
slave is busy but does not want to lose the communication. The slave device will allow
continuation after its task is complete. There is no limit in the I 2 C-bus protocol as to how
long this delay can be, whereas for a SMBus system, it would be limited to 35 ms.
SMBus protocol just assumes that if something takes too long, then it means that there is
a problem on the bus and that all devices must reset in order to clear this mode. Slave
devices are not then allowed to hold the clock LOW too long.
That explains o lot of the "note" I have been seeing about minimun clock rates.... thanks
we also have some default we could use for the timeout in there
you mean 35ms?
yeah
@deshipu note this in the I2C spec https://www.nxp.com/docs/en/user-guide/UM10204.pdf
SMBus has a time-out feature which resets devices if a communication takes too long.
This explains the minimum clock frequency of 10 kHz to prevent locking up the bus. I 2 C
can be a ‘DC’ bus, meaning that a slave device stretches the master clock when
performing some routine while the master is accessing it. This notifies the master that the
slave is busy but does not want to...
@tidal kiln mind taking a look at this? https://forums.adafruit.com/viewtopic.php?f=60&t=135541
This PR is related to issue #184.
What version of gcc are we supposed to have on OSX to be able to build circuitpython? I'm getting
cc1: error: -Werror=lto-type-mismatch: no option -Wlto-type-mismatch
cc1: error: -Werror=lto-type-mismatch: no option -Wlto-type-mismatch
make: *** [build-gemma_m0/genhdr/qstr.i.last] Error 1
with
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
@undone scaffold I think it has to be > gcc 6 but the latest is best -- if you are using homebrew follow these instructions https://learn.adafruit.com/building-circuitpython/macos
yeah, currently updating brew + reinstalling the gcc arm toolchain on the 🐌 conference wifi. i'll check if it's >6 when it finishes
Mine shows 7.2.1
It just finished (brew update then brew cask reinstall gcc-arm-embedded) but still have
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I was just running make BOARD=gemma_m0 based on https://learn.adafruit.com/building-circuitpython/build-circuitpython. arm-none-.... returns
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)
that looks good!
Is there a flag I should be setting to tell it to use that compiler?
I don't know what version of arm-none-eabi-gcc I had before I updated again just now
I'll try again
also, not sure if this is supposed to be working, but a thing that looks like it's trying to upload builds from travis can't connect https://travis-ci.org/adafruit/circuitpython/jobs/379236050#L1032
If you just updated - try opeing a new terminal session to refresh your environment. how are you building -- should be just make BOARD=gemma_m0 clean ; make BOARD=gemma_m0
oh i didn't clean between trying again
i just ran make BOARD=gemma_m0 again in circuitpython/ports/atmel-samd
trying again 🔄
also after cloning, didi you run git submodule update --init --recursive
yes
i ran all the steps but I missed brew update, but it looks like it worked this time
thanks!
rosie-ci uploads are also not happening on other branches https://travis-ci.org/adafruit/circuitpython/jobs/379235614#L2305
not sure about the rosie stuff - I don't see any attempt to do that.
it says "Uploading to https://rosie-ci.ngrok.io/upload/54293397c5736e7e571a933c92dccf375d529b2b" but then it can't connect to rosie-ci.ngrok.io
https://github.com/adafruit/rosie-ci#how-it-works i think it's trying to do this?
IIRC, tannewt's physical Rosie setup has been down. Not sure if that is the cause of the Travis fail, though. I have ignored rosie-related messages tbh.
Oh, that'd probably do it
lol I was hoping I could be lazy and just download the binaries travis made instead of building it myself
There is a nightly build on an AWS..
I meant the build from my PR
Ohh.
ah - I build locally without travis so I don't see that -- only invoke travis when I push to my github repo.
@slender iron responded to forum post. decided to also move it.
We could deal with the 1970 epoch on all platforms if we don't mind losing accuracy as time goes on by allowing floats. This is similar to what time.monotonic() is currently doing by returning a float uptime. The larger the value, the less precise it'll be. :/ Currently that appears to put the resolution at a little over two minutes.
>>> now = 1526400902.0523624
>>> now
1.5264e+09
>>> '%0.9f' % now
'1526401042.938232421'
(that was on my M4 with 3.0.0-a6)
Whenev...
@solar whale Vindication! (Kidding.) I'll ping you when I'm home again for more details about the AM2320 sensor issues you had.
Not to get your hopes up _ I did not reproduce the problem you had, butI think I see how it can occur if the sensor is misbehaving. I'll look at it more and we can chat when you have time.
Perfect. I had new problems at the end so you having any issues at all is still vindicating.
@stuck elbow: I used the tutorial on the essentials page for CircuitPython,, and my ring won't run oddly enough
@jagged crown that's very unfortunate, but chances are that there is some mistake somewhere, can you tell us what you did exactly so that we can see it and possibly correct it? Can you make a photo of your setup?
Physical Connnections: Red to 5V, Black to GND, and Yellow (Data In) to Pin 13
The only change I did to the code was have the pixel pin to 13, and number of pixels from 8 to 12.
`# CircuitPython demo - NeoPixel
import time
import board
import neopixel
pixel_pin = 13
num_pixels = 12
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
while True:
pixels.fill(RED)
pixels.show()
time.sleep(1) # Increase or decrease to change the speed of the solid color change.
pixels.fill(GREEN)
pixels.show()
time.sleep(1)
pixels.fill(BLUE)
pixels.show
time.sleep(1)
color_chase(RED, 0.1) # Increase the number to slow down the color chase
color_chase(YELLOW, 0.1)
color_chase(GREEN, 0.1)
color_chase(CYAN, 0.1)
color_chase(BLUE, 0.1)
color_chase(PURPLE, 0.1)
rainbow_cycle(0) # Increase the number to slow down the rainbow
`
can you change it and use a different pin?
I don't know if updating the library was a bad idea....
I tried 8 and 5, and nothing....
pin 13 has a LED on it, that migth interefere...
the ring does work though, I've used with my other Arduino boards
Trinket_m0 has very limited flash, making it difficult to add features to circuitpython. One place we can save flash is by not defining all the pins in samd21_pins.c and microcontroller/init.c
you can always go back to the previous version
Before the above commit:
-36 bytes free in flash out of 188416 bytes ( 184.0 kb ).
4092 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).
After:
548 bytes free in flash out of 188416 bytes ( 184.0 kb ).
4092 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).
@jagged crown try pixels = neopixel.NeoPixel(board.A1, num_pixels, brightness=0.3, auto_write=False) Something I realized when I couldn't get servos to work and I dunno if something in Circuit Python that the normal digital pin number is not used.. Substitute the board.A1 or what you are using in there and the external neopixels should work. Good luck.
ah, I totally missed that
This isn't as convenient as we thought it would be because it'd require the file system readability to be switched.
Adafruit CircuitPython 3.0.0-alpha.6-86-g1b4e064-dirty on 2018-05-15; Adafruit Gemma M0 with samd21e18
>>>
>>> import precise_time
>>> import time
>>> time.monotonic();precise_time.monotonic()
49.099
49100
>>> time.monotonic();precise_time.monotonic()
52.188
52189
>>> time.monotonic();precise_time.monotonic()
54.439
54440
>>> time.monotonic();precise_time.monotonic()
57.65
57651
>>> time.monotonic();precise_time.monotonic()
67.481
67482
>>> time.monotonic();precise_ti...
@stuck elbow I think some of the older guides or ones that have been updated had examples( I was following gemma guide?) where the plain digital pin number was used. It must have changed as Circuit Python matured. I don't recall that there were any error or notifications with the mismatch.
Thanks to Scott
This should support I2C on
- Gemma M0
- Circuitplayground Express
I'll try and add support for more boards from the SAMD21x18 Pinout
Just curious what functionality this is adding? Isn't I2C already supported on these boards?
This should probably be "No default I2C bus" so that it's clear what the error relates to.
Manually tested build at f1ea5d3 precise_time.sleep on gemma_m0 board
Is the frequency always fixed at 400000? If so, is this what is wanted? Can this be overridden somehow?
Travis builds are failing with
E: Package 'gcc-multilib' has no installation candidate
The command "sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system" failed and exited with 100 during .
Seems like a flake? Can someone 🔄 those?
@cunning trail it might have been MicroPython guides
if there is no error, that's a bug — we should fix that
The new common-hal routines need to be implemented (or dummied up) for the esp8266 and nrf52 builds as well.
It can't be over-ridden. What do you recommend? I'm still around for sprints tomorrow.
I followed what @tannewt recommended.
I think you can set your own fequency when you explicitly create the i2c object.
This is going to be great!
I'd be surprised if there was a way to notify the end-user, short of validating their input for a rather wide variety of cases.
It just takes experience to know not to call it by the D number, but to use the A number, for that.
wrt
pixels = neopixel.NeoPixel(board.A1, num_pixels, brightness=0.3, auto_write=False)
If you type neopixel.NeoPixel(board[TAB] and it shows a completion, and you use that completion, but it does not do what you thought it would do, either (as the authorative Programmer) remove it from the list of tab completions, or inform the user (through social means) not to do that. ;) IMO, of course.
you throw a runtime error
If it's convenient. Can you really test for this easily?
sure, you can check the type of the object passed
in fact, you actually must do it
so I'm surprised it didn't throw an exception
Interesting! More than I know about it.
#837 mostly fixes this, though I still want to take a look and see if we can improve the situation for Gemma's and other boards with little flash...
ah - so this is an alternative to the way we do it now? I'm just trying to understand what is being done, not objecting to it...
The idea is to default to the board's standard I2C pins when they haven't been specified.
@stuck elbow I received my uGame 10 yesterday, and successfully used the embedded main.py to check buttons, buzzer and screen. all with Mu 1.0b15 ! Great!
awesome
let me know if you have any problems with the games
I need to finish the menu for selecting games — then you can have multiple games on it at once
OK - thanks for clarifying - so if you omit SCL/SDA it will trigger this. Will it still accept the full set of keyword arguments in the current API? Sorry if I am just confused.
It gives you a board.I2C that is an instance of the default I2C bus for the board, which you can then pass to your drivers. If you need to change the pins or frequency, construct your own I2C object instead.
Could you please explain in the pull request message what this patch actually does? This would let us avoid confusion like the one in the recent comments.
There will now a bit more flash available on gemma_m0 and trinket_m0 once my PR is merged, if that'll help?
OK - that make sense - Thanks for explaining it.
BTW - I think this will have a conflict with PR #829 but we can work that out
I just now saw all the responses, which confirmed what I just did. When I look through other examples, I did see some call the GPIO Pins with the D for Digital or A for Analog
I wonder though, why have the onboard NeoPixel tied to A1? I mean it's also labelled as "40" on the board....could it be D40?
All I did to modify the code was change
pixel_pin=board.A1
to
pixel_pin=board.D6 and it worked!
And I tested changing the 6 to other pin numbers, and as the code on the essential guide promises, the NeoPixel Library works for all 13 GPIO Pins!
That's great that you got it working! Regarding pin assignments, the pin names are arbitrary. For example, on Circuit Playground Express each pin is labeled A#, and they all have digital capabilities. I'm coming to this conversation late. What board are you using?
Its one of the Metro Express Boards
I think it's the M4, but I forget the chip's number
what text do you get when you start the repl?
So ignore where I was going with it.
it should tell you the board name and the version of circuitpython
Found the correct board name, it's the M0 with the ATSAMD21G18 chip. Gotcha
I was wondering about something, can CircuitPython read user input?
like from the keyboard?
result = input("Enter something:")
yes
give input a try. the phrase in () is used as a prompt. whatever they type in gets returned in result
😬 that feeling when you start the first build of a new module
🤞 i actually know how to read datasheets. haha
hehe. yeah.
build #1 had silly "duh" errors.
build #2...."why do i even attempt this stuff?" lol
"builds character" 😉
Good luck @raven canopy 💤 here
thanks @solar whale. #2 was actually just cascading "duh" errors too. night! 💤
current master fails building esp8266
GEN build/genhdr/qstr.i.last
QSTR updated
GEN build/genhdr/qstrdefs.generated.h
../../py/moduerrno.c: In function 'mp_errno_to_str':
../../py/moduerrno.c:106:18: error: 'EPERM' undeclared (first use in this function)
case EPERM: return MP_QSTR_Permission_space_denied;
^
../../py/moduerrno.c:106:18: note: each undeclared identifier is reported only once for each function it appears in
../../py/moduerrno.c:107...
This appears to be related to PR #837 will dig into it later.
If anyone has suggestions regarding this forum post, please jump in: https://forums.adafruit.com/viewtopic.php?f=57&t=135592
@deshipu yes, I've updated the PR message
@solar whale my read of it is that they need to do a filesystem erase
but they can't get to bootloader? and I'm trying to find out if the can get to REPL - if so storage.erase_filesystem() should work
double tap can be tricky sometimes
could try getting to the bootloader from circuitpython rather than double tap
Is that available in 2.3.1?
I think so
Ok - I have to go to a meeting - will check later once I find out if they have REPL on that board. Hard to coach double tapping via the forum 😉
@solar whale thanks. I subscribed too so I can chime in
@solar whale sounds like they have additional hardware attached (featherwing adalogger), have them remove all that and anything else so it's just a feather m0 express and a USB cable, so no possible hardware interference weirdness, then try to get into bootloader with that as a sanity check
@tidal kiln goos point - I think they already took the adaloger off, but it's been hard to get a clear picture...
you are much more patient on the forums than I am 😉
maybe ask for a photo also
@tidal kiln would you mind stepping in?
already lots of posters. you can proxy if you want.
ok -- will see how the poster responds to Dans suggestions.
@ruby atlas Excellent
So let's talk about LED animations! My original thought came out of teaching someone MakeCode. MakeCode has built in animations called things like "comet" and "theatrechase" that you can call with one line, something like animation.comet(speed) or some such. For us to do that is a lot of code in CircuitPython. So I was thinking we could create a library with these animations included, where you can import the lib as animation or something, and then call it with a single line of code.
We wanted to keep it separate from NeoPixel because we also have DotStars. So that way we could use it on either type of LED.
Yeah! Fully love that idea - i've been thinking about how to make animations accessible to newbies. In addition to canned animations like comet or chases, i'd also love to have a colour loop generator helper - that could generate one pixel or many pixels.
Oooh keen
We also wanted to include color variables so people can use red or blue instead of the tuple.
how would you make the animation lib aware of the neopixel or dotstar hardware?
In my ideal world, you'd say animation.colorloop([RED, GREEN, PINK, BLUE]) and it would work out a smooth cycle for you.
@tidal kiln I think that'd be another abstraction that consumes from the loop generator.
@tidal kiln I think you'd still import NeoPixel into your code and then you'd provide the animation.foo to pixel
pass it in when creating?
hmm
Yeah not sure. Maybe we would do setup in the animation library to have it be standalone
probably. i think once we build some building blocks, we'll start to refactor to make it simpler to use.
I need to get myself a few neopixels.
That was the only tweaky thing about calling it LED_Animations was that we also wanted to have color variables in it to use with pixel so hmm.
Oh you should have mentioned! I wish I'd known. I think I had one ring left.
Or not lol
in pseudocode, i foresee doing something like, for a single dotstar:
pixels[0] = pixel
time.sleep(0.1)```
So you have a Gemma, which has one DotStar on it, so you can at least test with one LED.
yep!
Keen 😃
ideally we'd have an easier way to setup timing and pixel assignment so that users can easily check inputs every cycle.
or? (thinking out loud)
strip = neopixel.NeoPixel(blah blah)
comet = animation.Comet(strip, other stuff?)
comet.go(color, speed, etc)
Just call the animation.colorloop
Yeah! Generators for the win there.
I like it @tidal kiln
but i think having the colorloop generator accessible w/o having it do other stuff will make it more generic.
but have helpers like your pseudocode @tidal kiln
Ok yeah!
i'm thinking very simple / blocking
Hmm. So maybe we have both options, because people love rainbows, and non-blocking rainbows are great.
Yep!
so animation.generators.comet(), animation.generators.loop(), etc.
If we can make it non-blocking in the background and have setup be super simple, then we've nailed both situations
which then get used by the easy to use interfaces in animation.Comet() etc.
If you'd like to see the MakeCode examples, there's a simulator in MakeCode that shows a Circuit Playground Express and you can call each animation and it will play out on the simulated board on the left side. It won't help you with coding it because all you ever see is the simple setup even if you check the javascript backend. But it might give you some ideas.
I have some of this stuff done up in CircuitPython already spread over a few projects.
Including a rainbow generator.
That'd be a wonderful starting point. I doubt i'll get to work on this on the planes, but I might try 😃
😃 Excellent!
Did you have some links to the rainbow generator code or other things you think i should look at?
Yep! Give me just a minute and I can link you to a couple of pieces of code.
Yay, my μgame finally arrived
Native ASF I2C has clock stretching that's count based. I'm not sure what the time in practice is.
@solar whale @slender iron @tulip sleet @tidal kiln I would keep in the back of my mind, damage from a soldering iron (or other physical trauma to the target) as well as Operating System issues on the host PC.
I have trouble believing that rewriting the bootloader is going to solve this. ;)
@timber mango my guess is that its the filesystem too. (not the bootloader)
@timber mango good points, and another reason why photos are so useful. (i also doubt it's the bootloader)
Yeah photos on the cheap (and available immediately) are still new enough to me that I don't think of leveraging them. They can help lots.
The only thing I'm confused about is how an OS issue would be target (stamp) specific -- lets one target board access the boot volume, but will not allow another (seemingly identical) target to do so.
I don't know enough to suggest that as a possibility.
EDIT: then there's this:
Grice argued that interpreting the meaning of utterances is only possible because listeners implicitly assume that speakers intend their utterances to be responsive to the surrounding discourse, relevant, and (for the most part) truthful.
from
http://cogweb.ucla.edu/Debate/CEP_Gould.html
Not directly applicable here, but I don't know another quick reference that asks us to consider the source of the facts and look for omission of important details.
Also it's a fun article in its own right. ;) /did_I_back_away_far_enough?
@ruby atlas Ok. So here's some random color modes for one project: https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/LED_Trampoline/LED_Trampoline.py
Here's code that uses a rainbow generator:
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Hacking_Ikea_Lamps_With_CPX/CPX_Spoka_Motion_Lamp.py
The first one has the cycle_sequence() written differently and is a better version of it. We had to add that because there's no itertools so it's basically a helper function taking the place of itertools so the generators can continue indefinitely instead of stopping at the end of the iteration.
The sparkle_code() was initially also written as a generator, but ended up requiring lambda to work and it got too complicated for the guide. Turns out it worked so quickly that it didn't matter, it was basically impossible to humanly-provide it input that was faster than it was occurring, so it didn't need a generator anyway.
@ruby atlas
That has a sort of rainbow comet in it, it's done a little strangely, but it works. There might be a better way to do that one.
The "comet" on MakeCode is an LED of some color with a tail that gets progressively dimmer, if I remember correctly.
Theatre_chase looks a lot like the "chase_mode" in the LED Trampoline code I linked earlier. Except that code starts at both ends and meets in the middle instead of chasing from one end to the other, which is probably easier to code, and makes more sense for the lib.
There's a "sparkle" in MakeCode as well that's a single color that randomly sparkles around the strip of LEDs, not as fancy or as involved as the sparkle_code() in the LED trampoline code.
Thanks for all the links! I'll grab all that code before the flight.
Nice!
d6c2694 add timeout keyword to I2C - for bitbangio - i... - jerryneedell
aa93097 revise to use mp_raise_msg insead of nlr_rais... - jerryneedell
d9f1b1f remove #include py/nlr.h from I2C.c - jerryneedell
9a2cda7 Reformat the error message - tannewt
99e34e3 Merge pull request #829 from jerryneedell/jerry... - tannewt
@slender iron I updated the pylintrc that we plan to use with the Learn System repo. I included a majority of what Craig suggested. I left out anything he said could/should be refactored, including things he said he didn't have the eq to test etc. The last thing Dylan wanted looked at was the script they wrote for checking files for the circuitpython.skip tag that Ladyada asked be ignored. Can you take a look at the PR? https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/164 If the script is solid, then I think it's ready to be merged, as long as we're ready to do it.
(Dylan was the one who put in the PR)
BBC Micro:bit micropython obligatory first program.
Nice!
@idle owl looking now. how different is it from the library pylint
I left every other disable that was already in there in tact. So it has more in it than the other one did. It now also includes too-many-instance-attributes,len-as-condition,too-few-public-methods,anomalous-backslash-in-string,no-else-return,simplifiable-if-statement,too-many-arguments,duplicate-code,no-name-in-module,no-member, and has on the end: --msg-template='{path} {line}: {msg} ({symbol})' */*.py which apparently makes it better list the file names that it's finding (this was from Craig: "For an unknown reason some pylint errors weren't listed next to the correct file that they were in. I've modified the pylint output so that you can see the path to the file that has the problem."
The things I added were determined by Craig to be pylint not able to deal with CircuitPython issues, or disabling a couple of things that could be refactored but are actually easier to read for beginners if we disable the pylint error.
I left out some of this suggestions if he said that it could be refactored but he didn't have time to test it, or didn't have the eq to test it.
Because we can do testing as we start in on this.
I did not remove any of the library pylint disables.
it looks good to me
Ok. Good to merge then?
yup, good to me
Excellent
any idea where craig is at on fixes?
OK simple fix:
jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/circuitpython_jerryn/ports/esp8266$ git diff
diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h
index 616e987..907a4cb 100644
--- a/ports/esp8266/mpconfigport.h
+++ b/ports/esp8266/mpconfigport.h
@@ -28,7 +28,7 @@
#define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_MODULE_WEAK_LINKS (1)
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
-#define MICROPY_USE_INTERNAL_ERRNO (1)
+#define ...
Nope, other than what's in the commits.
@idle owl I was reading back... For your proposal of neopixel/dotstar animation library for Circuit Python, might I suggest you first take a look into the available functions in the FASTLED neopixel library - arduino. A lot of the basic and more advanced animation functions you usually want are there. Some are based on high level math (interpolation ,gamma correction, etc. for smooth transitions, fade, color palettes, etc.)which they tried to bake into the library. There is a FASTLED community that is developing it and may be worthwhile to tap into it.
@cunning trail Thanks for the suggestion! I think we already have an iteration of FastLED for CircuitPython. Looking at it, we have some helper functions anyway, as a part of FancyLED. I'm looking at our guide for it now, and there's mention of what about all the cool noise and wave functions and other features of FastLED, and the response is not implemented yet, but may be added in the future. Might still be worth looking into. Thanks!
@ruby atlas There's also this: https://learn.adafruit.com/fancyled-library-for-circuitpython/overview, the code for the lib is stored here: https://github.com/adafruit/Adafruit_CircuitPython_FancyLED/tree/master/adafruit_fancyled I think we're going for something a little simpler with our lib, but it might still be worth looking at.
set #define MICROPY_USE_INTERNAL_ERRNO (0) in mpconfigport for ESP8266 to fix compile error
needed after PR #837
@slender iron Thanks for looking at the PR. I'm really excited about having that now 😃
me too!
It's about to be Breakin' 2: Learning Guide Repo and it's going to be brilliant 😄
Hey @slender iron , sorry to not search this up, but is there any demo circtuipython code for a circuit playground express?
@harsh plume definitely, https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-playground
yess, thank you
I finally found a nice integreation for us to try oje of thes eout in a students art project.
one of htese out*
These failures are due to PR #829 there needs to be dummy argument for the timeout.It is ignored for busio, but needed for bitbangio.
SGP30 is missing properties all together. They should be added.
can someone with a GPS test this please? https://github.com/adafruit/Adafruit_CircuitPython_GPS/pull/6
I've got one somewhere here.
@knotty cypress I canceled your travis build to free up jobs for @ruby atlas 's PR that frees up space
ok
With the GPS already having a fix/solution, gps_simpletest.py reports correct time, lat/long and altitude with that patch applied. 3.0.0.Alpha 6.
You got to the same place I did, @timber mango. Thanks!
You're very welcome, @idle owl. I already had the hardware setup (feather M0 Express).
I did not try it without a fix and I'm not sure what we're testing for. ;)(
I replaced the old .mpy with the new one after using mpy-cross on it.
You're welcome! Love the GPS. -`ღ´
@idle owl + 💯 for obscure movie reference!!! 😄
womp womp. @ruby atlas
@raven canopy Thanks 😄
567f3e3 Initial implementation of supervisor.reload() - rhooper
6989126 Rename reload_next_character to reload_requeste... - rhooper
92b1cb5 move reload exception to reload.c - rhooper
06b6a10 switch autoreload to reloadexception - rhooper
3fd9900 disable pins on trinket_m0 so that we can free ... - rhooper
@knotty cypress I just merged @ruby atlas 's awesome change
ill pull it in
Fixed by @rhooper in #838. Thank you!
@hathach Thank you for the fix. Please make a pull request with the change and we'll merge it in.
@slender iron got a moment to help me understand .subscr in an mp_obj_type? keep getting build fails for "incorrect pointer"...
sure!
sweet. getting the vagrant spinning to grab exact error. here is what i have at the shared-bindings level:
STATIC mp_obj_t frequencyin_subscr(mp_obj_t self_in) {
pulseio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in);
raise_error_if_deinited(common_hal_pulseio_frequencyin_deinited(self));
return MP_OBJ_NEW_SMALL_INT(common_hal_pulseio_frequencyin_get_item(self));
}
const mp_obj_type_t pulseio_frequencyin_type = {
{ &mp_type_type },
.name = MP_QSTR_frequencyin,
.make_new = pulseio_frequencyin_make_new,
.subscr = frequencyin_subscr,
.locals_dict = (mp_obj_dict_t*)&pulseio_frequencyin_locals_dict,
};
note: i haven't pushed to my fork yet. i can if that's simpler for you to see the whole picture...
my guess is that the function signature doesn't match the type
why are you adding it? do you need frequencyin[0]?
I'd rather just disable these APIs on non-express boards when we don't support long ints. This has been implemented but with a 2000 epoch. Can someone please change it to 1970 and remove the APIs in non-express builds?
@notro is that ok with you?
hi y'all. huge thanks to all who helped me - @idle owl , @tulip sleet , @tidal kiln with my servo and pot code - i used it last weekend with no problems. i am still working to add a visual graph of servo speed and position, based on pot values and have been playing with some of @umbral dagger 's dotstar files, but keep getting memory allocation errors. can anyone be of assistance?
@covert birch Make a local copy of the dotstarlib and rip out what you don't need starting with the font/text stuff.
ok, i'll try that. thx @umbral dagger
@covert birch It's pretty memory intensive
are you using a .mpy version of the library?
@covert birch Life will be unicorns and rainbows once everyone has M4 boards.
i got the dots example to work with my servo and pot code, but anything else gets that error
Articles about PyCon are starting to come up on lwn. I'm a subscriber, so if you'd like me to share a "subscriber link" for any of the articles covering the event, just ask. (a subscriber link lets the recipient read the article even when it's still marked with "[$]" for subscriber-only content) Articles like this one: https://lwn.net/SubscriberLink/754163/f312492d8e30bb0f/
At the 2018 Python Language Summit, Carl Shapiro described some of
the experiments that he and others at Instagram did to look at ways to
improve the
performance of the CPython interpreter.
The talk was somewhat academic in tone and built on wha...
@umbral dagger , this isn't really the best time for me to spend on this project, but i wanted to go forward while it was fresh to me since i was able to use it last weekend, but i have no use for it for the time being - do you suggest i wait for m4 to come out so i won't be so consumed with troubleshooting? my main concern is having to restart my circuitpy learning curve
@covert birch What capabilities of the dotstar wing do you need? What can you remove from the lib? To @tidal kiln 's point, you can pre byte compile it to squeeze out a bit more space. When I worked on the game, I got rid of the font other than digits. I probably (forget now) stripped out other stuff I didn't need.
@covert birch It's an interesting exercise in optimization 😃
I don't know what the time frame is for M4 boards. A few beta Metros are in the wild, and Feathers are being worked on (from the Leeks a few days ago).
@tidal kiln no, not .mpy but .py. @umbral dagger well, i'd love to make this work with my feather mo so i don't have to keep buying new stuff. i had this thing originally set up on arduino and moved to feather to learn a little about circuitpy and to see if i could get better control of the servo and finer detail for the graph. what i had in mind for the dotstar is to have sort of a bar graph to reflect the speed and direction of the servo, so i was attracted to the animation example, but perhaps there is a better way. so far in modifying the lib file, i've removed the font references. it loaded ok, but changes to my code didn't work
You can probably just use the shifting stuff if you want a scolling graph like the plotterin Mu.
@umbral dagger that's what i was thinking too, tho i have no idea how to make that work yet - i was just trying to get the lib to load without mem errors first. is it possible that the colors of the dot star be mapped to the pot value?
along with the servo
btw, the lib is working and i got the circle shift code pasted into my servo and pot code and it loaded fine
so, now i just need to adjust the image of the circle and get the shifting to correspond to the pot value...
@covert birch Adafruit has been putting out Metro M4 Express boards in small batches about once a week. They've been available for more than 12 hours at a time before they get sold out, so if you check every day, 12 hours apart, you won't miss out on an opportunity to get one (and only one; they're one to a customer at the moment). http://adafru.it/3382
thanks @timber mango , but i got the streamlined lib to work on my feather mo, so i am going to keep working on this for now, as long as it is capable
Yeah, I think comments may count as occupied memory in .py (but not in .mpy?)
i did delete all the header comments thinking that may be the case
it was at least 10-15 lines
M4 has six times the SRAM that M0 has, for working memory.
wow, that is impressive. i can always update my board later i suppose
It's also got a faster system clock. When I blinked my D13 LED I didn't immediately understand why it didn't blink visually. Was too fast!
haha that's great
show and tell-time
yep
I can't wait to get home and put in an order for a variety of things! 😃
😄
Half way there.... Next flight isn't long from now.
Nice!
I did a little experimenting earlier, - tried to avoid reinventing the wheel by using adafruit_fancyled palette_lookup and just couldn't find an intuitive way to get great looking smooth colour cycles using it as a basis... So I'll probably end up reinventing the wheel somewhat for the color cycling stuff i hope to work on.
having more than one library to do something is ok with me. that way we find the easiest way
We can also discuss it when you're home, because we've done up some tricks to make things more smooth in different situations.
😃 dabbling with Animating RGB(W) LEDs reminds me a lot of some of the very first things I spent months fiddling with as a kid - drawing random art using gwbasic
nice 😃
(sadly that was in 4 brightness levels on an amber monitor)
Well now you can have it live up to all your childhood dreams 😄