#circuitpython-dev
1 messages ยท Page 256 of 1
yeah we set to 16bit but return 8bit
two places
thank u
on 'release' can you attach firmware uf2's n bins
theres no formal release method
yep
so weird to not see travis run:
https://github.com/adafruit/seesaw/pull/24
@tidal kiln yeah cause its plain avr-gcc
@slender iron I was wondering, as I work to reduce _pixelbuf footprint, should I have one single QSTR for invalid byteorder strings?
one error message @ruby atlas?
sure
@exotic pumice c interop with all of our existing code
Yeah, that was my idea @slender iron .
I also seem to need to tighten up pypixelbuf and probably should make sure I have board(s) that _pixelbuf doesn't fit to test with.
๐
@meager fog do you know if there is any differences between boards/crickit and boards/crickitHat (in seesaw)
Also I totally must have an off-by-one and/or failure to properly (re)initialize data in my latest push of _pixelbuf because it misbehaves badly with dotstars ๐
so need a UF2 for each? there was only one there previously
there should be two yeah
i think dean didn't think to add both
:/
but if you could, that would be great for the pi users ๐
ok. no worries. i'll build and add.
thanks, can u reply to the thread, as well
they should be able to update the uf2 and be golden
yep. already done.
yep. i tested on HAT and feather crickit.
you rock
Consider me onboard to help as needed with this effort - BLE has been on KMK Firmware's goal list for about as long as the project has existed and we're finally stable enough in the core firmware to dedicate cycles to QoL/creature comfort features. If there's a way I/we can help, holler at us here/Discord/etc. Cheers!
@meager fog finally have the adabox!
@ruby lake yayyyy
thanks again. I'm switching shipping addr to the loading dock at work to prevent this from happening again
lol ok
4.0.2 stable is enough ... I'll try to replicate the problem on the weekend.
Have you been able to re-flash the board since?
I'm not sitting in front of the hardware right now, but there's a read-only connected property on the interface itself, eg:
eth = wiznet.WIZNET5K(spi, board.D10)
while not eth.connected:
print("plug me in!")
time.sleep(1)
You still have to poll it though. Also, connected just tells you if there's a cable to a switch port: you still have t...
This looks just like what we discussed on chat.
yeah you might have to generate a bunch of bindings to all your special types idk
the basic details are here https://doc.rust-lang.org/nomicon/ffi.html
see what happens when you run this on circuitpython I guess lol https://github.com/rust-lang/rust-bindgen
This now builds on all platforms, and is tested to work on the Particle Xenon.
@exotic pumice another potential concern is that circuitpython uses deep magic to do "something like exceptions" through gcc extensions to the C language. Not sure what would be needed to apply that to rust.
@tulip sleet Are there any particular areas that the BLE code needs testing? I'm doing some lighting stuff any plan to use '840s
@pastel panther in a few days, but I'm having to do BLE descriptors more completely in order to do BLE HID, so not yet. You could try stress testing the current examples to see if they crash or get stuck in pathogical cases. But what do you mean by lighting?
I'm wiring up a display case and my office with neopixels and want to build a board to control and power them
you could take the lanyard project as a base and take off from there, controlled by the Bluefruit app. Or you could use the peripheral/client example that's in the tip of Adafruit_CircuitPython_BLE and use '840's for both client and server
you can use the Adafruit_CircuitPython_BluefruitConnect and use the packet types, or just use raw BLE UART and invent your own protocol
Hi! Excited to report my CP library for the SX1280 radio has time-of-flight ranging functionality working! Lib is VERY rough, but it works... I will conform to the CircuitPython_RFM9x notation when I have time. https://github.com/maholli/CircuitPython_SX1280
Oh, and I built an RF9x-footprint compatible breakout for the SX1280:
https://github.com/maholli/sx1280-breakout
On high-resolution displays we can use 2x2 or even 3x3 pixels.
You still have to poll it though. Also, connected just tells you if there's a cable to a switch port:
Ok, great! EthernetManager would take care of that.
When you set up this weekend, could you try checking to see if ifconfig succeeded, without plugging in the ethernet cable? It should cause a hardfault.
Have you been able to re-flash the board since?
Yup - had to run SPIFlash on it first. Adding a UF2 to FEATHERBOOT couldn't recover it.
Arguably, given CircuitPython's...
@lime trellis Sweet, doubly so on "conforming" to the RFM9x notation to keep semtech libs in-line ๐
@lime trellis the time-of-flight ranging can that be used for triangulation? i was thinking for like robots in like a warehouse environment
@upbeat plover Yeah it can!!! there's very little documentation online . The Semtech app note states 0.42m precision
@prime flower it'll be somewhat tough given how different the RF9x chips are
designed to interface as opposed to the SX1280. But I should be able to get it pretty close
@deshipu I'd suggest snagging writeto_then_readfrom from I2CDevice on it's own then. https://github.com/adafruit/Adafruit_CircuitPython_BusDevice/blob/master/adafruit_bus_device/i2c_device.py#L145
I don't want to leave both because it means 1) new code could be added using the old way and 2) existing code with the old way may not be found and updated.
@dhalbert Please weigh in on this PR.
Interesting pypi package related to our use of properties and async: https://async-property.readthedocs.io/en/latest/readme.html
Does this take a while? We may want to call the background task if it does.
Just a couple questions and then it should be good to go.
You've implemented them! Is this accurate now? One change for looped samples would be that it's desirable to stop on the boundary of the sample.
I have been trying to avoid this because I don't have much background in it. :smiley: .
If there are really zero I2C chips that need separate stop control with write-then-read, then it's ok with me in the long run. If not, then leaving it in isn't wrong.
@deshipu, if you can do the attribute check as suggested by @tannewt, then that might be good enough.
If busdevice is too slow, we should consider how to speed it up (make it native?). In the code link above, we could at least check ...
Just a doc fix to be made. The logic looks OK to me.
scale is missing from the arg documentation above.
Thank you for adding this! Just a couple comments on memory allocation.
Instead of allocating an array, please accept a bytearray or array in as an argument so that the buffer can be reused. Reusing the buffer will make it easier to allocate and reduce fragmentation.
All of the related logic is stored in PWMOut: https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/common-hal/pulseio/PWMOut.c#L154
There is no central list of active PWMOuts so you'll need to track it if you plan on dynamically swapping them.
Adding support for TC[0] isn'd likely what you want because it'll drastically reduce the functionality of the PWMOut to 8 bit resolution or very course frequency (since the top can't change much).
@dhalbert this is on master right? Not 4.x. I think I've fixed it in my current work.
right, master. I thought maybe it was due to I2C handling, but I don't remember if that's in 4.x.
@brentru I corrected the terminology here. .hex() is a method because it is a function on an object. Properties are used like variables without parens.
I rest my case.
If we ever come upon a chip that requires an interaction that we don't support, we can always add it.
I think it's related to the changes I made with the oled PR around not sharing group objects between displays. I believe I already found and fixed it with my epaper work.
I'll test it after the epaper PR.
:param int scale: and maybe say it's the pixels that are scaled.
In Trio, we teach beginners that await blah() is a special kind of function call, that you use when calling special functions defined with async def. We don't teach about await obj syntax, bare coroutine objects, the awaitable protocol, or any of that. This means we can't use some clever tricks like async_property, but I think the simplification is worth it. (It also makes it pretty easy for linters to detect when you forgot an await, which is otherwise a really easy and confusing...
But it's not in pixels, it's in time. 2 makes it 2 times larger.
Problem is, CircuitPython already uses properties for all the things that take time that you probably want to be asynchronous, like reading values from sensors or sending data to displays.
I was thinking if scale is 1, one pixel on the display represents one pixel in the buffer. If scale is 2, 2x2 pixels on the display represent one pixel in the buffer. It depends on which pixels you mean. We are making different assumptions. I wasn't sure what scaling the "display" meant, but it means scaling the buffer onto the physical display. If you can think of a clearer way to say this, fine, but no real problem if you just leave it this way.
The only other thing is that the word ...
That's pretty much why I didn't write it โ I can't think of a concise and non-confusing way of putting it. For example "with scale=2 every logical pixel corresponds to four physical pixels" creates more questions than it answers: why four? what is a logical pixel?
I reworded it and fixed the missing argument name, but I think I don't want to spend too much time on this, as this is an internal interface, used only by the Python library that wraps it. I will make sure to explain that functio...
For better English (if you keep the original language):
How much the display should be scaled up
You're going to have to break compatibility to make those async, though, one way or another.
I don't know what's best for your situation; I just wanted to point out some of the options and tradeoffs.
There are some developments which might make this more interesting to approach.
First of this https://github.com/arduino/ArduinoCore-API
So one could try go the way the went with the recent mbed compatibility layer for the nrf52840.
https://github.com/arduino/ArduinoCore-nRF528x-mbedos
the good news is, for some reason -flto seems to work on nrf builds now. the bad news is, it looks like it pushes us over a travis 50-minute limit, so it would mean repartitioning things. Persumably into 10 ~25 minute jobs instead of 5 ~45 minute jobs. I'm still running a few local tests to make sure all the binaries look plausible; I only really tested on a particle xenon
the other bad news is, I don't have any explanation for why it would work when I tried it today, after not working in the pats. That would have been with the older, lesser (52832?) boards, or maybe an older nRF SDK?
.. all the .uf2 files for nrf2 boards seem to have plausible sizes ..
@onyx hinge what is the reason to turn lto on? we ideally wouldn't split into 10 jobs because then the 10 concurrent we already have would be used up
with one build
@slender iron It frees up flash and I think it has a large effect on the efficiency of translate()
On particle_xenon it gains back 60kB of flash (but that device is far from flash-constrained) but adds 12s to the elapsed build time on my local machine
12s isn't that bad but I think that hits each language build
a different structure for "non-lto" targets would let translate be more efficient, such as a structure which can be binary-searched. But as you say, the speed of translate() might not be important to any "real benchmark".
(or we could be mistaken, with translate() called more than we thought)
yup, I'm ok having lto on for everything for consistency but our build time is a pain
If going to >5 jobs in the matrix means you lose the -j2 parallelism in each one .. ugh
am I not finding it, or is this not clearly documented at travis?
I wonder at which point it would make sense to run your own server for CI
sure, lots of work for setting it up, and then some constant work to maintain it
Did this get merged in? I don't see the PR (but I'm not a Git expert)
hum, I have set up so travis-ci.org runs when I push to jepler/circuitpython and I would have sworn the timings were not much different from what travis-ci.com gets for adafruit/circuitpython
@stuck elbow I think we'd switch services and/or pay for more grunt before we run our own
I started testing with azure but ran into difficulty uploading to s3
they would probably want you to use their own storage
so my build did time out, while adafruit's completed with some of the jobs going >50 minutes
@stuck elbow I'm ok using theirs too but lost steaming figuring it out
yeah, this can get complex really fast
but maybe that also means I should just turn off travis-ci.org for my fork and rely on travis-ci.com and pull requests. that'd be the only way to see the real effect on build times by this lto change.
i still want to understand why the pl build takes longer than the rest. i haven't been able to put my finger on it...
I'm looking at this code in WaveFile.c: ``` self->buffer = m_malloc(self->len, false);
if (self->buffer == NULL) {
common_hal_audioio_wavefile_deinit(self);
mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate first buffer"));
}
self->second_buffer = m_malloc(self->len, false);
if (self->second_buffer == NULL) {
common_hal_audioio_wavefile_deinit(self);
mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate second buffer"));
}
Is memory allocated by m_malloc required to be m_free'd? And if so, should `buffer` be m_free'd in the second error handling block, or is it take care of elsewhere?
no, it's garbage-collected
OK
but I do want to change that code to let you specify a pre-allocated buffer
fwiw is there a m_malloc variant which will do the check-and-raise for me?
I think they all raise MemoryError when you run out
I think that's true, in which case the 'if (self->buffer == NULL)' block is dead code
hm is 'if (' the circuitpython style? I know I have been writing 'if(' everywhere. oops.
@lime trellis looks like there are modules on the market https://www.tindie.com/products/NiceRF/long-range-lora-24g-sx1280-lora1280-module/
yeah, it gets it from Python, there is always a space separating keywords
@onyx hinge do you mean = or == ?
@simple pulsar oops, "==" -- will edit
Oh, i scrolled up further and saw actual code too.
yeah that big block is right, it was copypaste
@meager fog very cool! I hadn't seen those. I'll pick a few up to play with. Well at least my layout files are out there in case someone wants to tinker ๐
seems like if the _deinit call is needed, then it needs to be m_malloc_maybe
@lime trellis yeah these are not pin compat for some reason ๐
is this worth filing an issue over? @stuck elbow
@meager fog drop-in compatible with RFM9x modules was a biggie for me.
time to wrap this up, date night technically started at 6PM (11 minutes ago ๐ )
@onyx hinge I'm actually not 100% sure that is a case, I would need to test it...
@stuck elbow I'll leave it in your hands if you're inclined to look into it further
I might give it a stab this weekend, if the stars are right
Ok, so I think I know what I want to replace wait_for_frame and refresh_soon with. I think we want an explicit refresh call that blocks until new pixels have been sent to the display (but not wait on epaper refresh.)
For fast screens it'll have a target_fps kwarg that takes a target frame rate and skips the pixel update if the time since the last frame is more than the gap needed for the frame rate. It'll also have an max_delay that will cause an exception if the time since the l...
do you want to have anything for pausing so that if you have text on top of a bitmap you dont have a few characters appear at a time
Hey folks, did the PIRKey die?
@ladyada You don't need to pause because a refresh will only happen when you call refresh. It won't auto happen at all. (though the terminal/supervisor will call it too)
Nevermind - I updated to 4.1 and it fixed it - thank you!
ohh, wait, so you will have to poke the display for each drawing? how will that work if you draw/change a bitmap like with turtle?
This says it was waiting for CP 3.0.0, but that was ages ago: https://www.adafruit.com/product/3364
yes right now its dead. there's no ETA
Ok, @brisk cairn was looking at designing one & I suggested he take a look at yours...
yes you can grab the design for sure
i will try it soon to see if 4.1 has made it more usable
If you want to send Chris & I a few to test, we can
You'll want to call refresh from time to time and the dirty area will be updated. I don't think it's too common to have code that may run much faster than the display can update.
totally cool - i just wanted to know what to expect - the arduino code's like this too so i'm pretty used to it!
@tough flax ๐
Automated website update for release 4.1.0 by AdaBot.
New boards:
- robohatmm1
Looks like robohatmm1 was added back in.
The good: It gets back about 60kB of flash space and increases performance (pystone) by about +14%
The bad: It adds about 12-16 seconds to each target built
The ugly: This is exactly the same thing tried for #1396 by others, and it's not clear why it seems to be working for me today.
See the commit message for further info.
@meager fog Ready to start the circuitpython port to risc-v!
Looks like there is a punctuation problem on this line, which may be the reason the build failed.
@onyx hinge @meager fog Interesting move on the RISC-V front! I am underqualified, but some searching looks like this one might have the memory & USB port to run CP https://github.com/open-isa-org/open-isa.org/blob/master/Reference Manual and Data Sheet/RV32M1DS_Rev.1.1.pdf
MixerVoice builds again! now to test it... ๐ฌ
test script is still on the board! how lucky is that?
just had to tweak the script for audiocore and huzzah!
Adafruit CircuitPython 4.0.0-alpha.2-1587-g9939d0c4f-dirty on 2019-08-02; Adafruit Metro M4 Express with samd51j19
>>> import mixervoice
Reading file monday1.wav
{'data_size': 187820, 'channels': 2, 'sample_rate': 16000, 'num_samples': 93910}
done!!
playing intro...
starting voices endless-loop...
playing: 2. gain: 0.883587
playing: 3. gain: 0.961244
playing: 2. gain: 0.396811
playing: 3. gain: 0.16575
playing: 2. gain: 0.546836
@raven canopy w00t! thank you so much for polishing it up
๐
$ git submodule update --init --recursive
Submodule path 'lib/tinyusb': checked out '1ee9ef4f2b7c6acfab6c398a4f57ca22036958f7'
Submodule path 'lib/tinyusb/hw/mcu/microchip/samd/asf4': checked out '82fe3aa05bc3b9f4956ee775c748a3885443f66b'
Submodule path 'lib/tinyusb/hw/mcu/nordic/nrfx': checked out '9d68726e41c321f1772c187bd12d82f5b13104f1'
Submodule path 'lib/tinyusb/hw/mcu/nxp/lpcopen': checked out '06b4c2e509147924b66ace90f6be5ebe599af45c'
error: Server does not allow request for unadvertised object 1dabc2df8ed1acaf0c483b58d757ba72e8b42090
Fetched in submodule path 'lib/tinyusb/hw/mcu/st/stm32lib', but it did not contain 1dabc2df8ed1acaf0c483b58d757ba72e8b42090. Direct fetching of that commit failed.
Failed to recurse into submodule path 'lib/tinyusb'
someone forgot to push?
This also allows us to control the size of the buffer. Half of the
buffer will be used for the fist, and half for the second internal
buffer.
Good idea! A few thoughts pre-review:
- The doc should probably say that if a buffer is not passed in, a buffer of 512 bytes (or say that two buffers of 256 bytes) will be used. This will give the user guidance about how big to make the buffer.
- Should one buffer that's split be passed, or two? If two, the smaller of the two will determine the length used. (Or they could be required to be of equal length). The advantage of two buffers is that they might be easier to allocate in the face ...
Good point about documenting the default size, I will add that.
I went for a single buffer mostly because it simplifies the usage, and lets us skip explaining what double buffering is. I'm not worried about memory fragmentation, because it's going to be allocated at the beginning of your program anyways.
By the way, experiments show that a much smaller buffer than 512 seems to be working just fine, so we might want to reconsider the default.
I suppose the optimal buffer size depends on the bit rate.
I suppose the optimal buffer size depends on the bit rate.
And speed of processor, and what other background tasks are happening, so it's probably hard to specify without experimentation.
Travis overall times changed from "4 hrs 11 min 5 sec" (https://travis-ci.com/adafruit/circuitpython/builds/121819759) to "4 hrs 38 min 26 sec" (https://travis-ci.com/adafruit/circuitpython/builds/121828350). In addition, because job #1 is now badly imbalanced, the total wait time increased from 53 min 51 sec to 1 hr 21 min 13 sec.
All the better to have it user-controlled.
I โค waking up in the morning and having the answer to a puzzle be clear.
Comment updated to reflect the current state of the code.
I have resolved this in a way that no longer requires a polling wait.
That seems reasonable, and much less magical, I like it. I would probably rename max_delay to max_lag, to make it clearer.
Thanks @tannewt . I'm having a play with it now. I think it could be doable within the same logic already there but would take a bit of time.
I discovered one issue already with the errors that are sent back when no timers are free.
If you look at my first output in this comment: https://github.com/adafruit/circuitpython/issues/2020#issuecomment-516826913
It says "All timers in use" instead of "All timers for this pin are in use"
I am not sure if this is expected behaviour ...
I'm thinking about submitting a similar pull request as #2032, but for bitmaps. One thing I would like to add there, though, is the possibility of using a bytes object as the buffer (possibly one that is frozen with your library in flash) โ but then the bitmap would need to be read-only, as we can't modify the contents of such a buffer. I think the easiest way to do that would just be to have an internal flag in the Bitmap object that is set when such a buffer is passed to it, and makes i...
I think we will want a ready_for_refresh for EInk so we can decide not to wait three minutes.
yes, ready_for_refresh is a good idea :) just a note that sharp memory displays must be refreshed once a second, or the image disappears. so its sorta the opposite of e-ink.
This work-in-progress still has bugs, but it switches over _pixelbuf to the same string based API as pypixelbuf.
Early feedback would be highly welcome, @dhalbert @tannewt
@onyx hinge I like the pull request number you got there (#2000).
I'm hoping I can get #2345 or maybe #4321 ๐
:ohnoes: MixerVoice has incomplete code for non-__ARM_FEATURE_DSP chips. how in the world will i channel DeanM? #stuffjustgotreal
@raven canopy which chips are those?
according to my travis failures...i'm not sure. I have passes and fails, for both M0 and M4. it may just be a define/linker issue? about to run out for lunch and school shopping. will have to dive in later
hmm. the M4 failures are pointing to "can't find linker file <blah>.ld"
@raven canopy that seems .. unexplained
@slender iron: I'm still trying to fix the SD card issue.. like #13 . Question, what is considered "power On" of the sdcard?
that one actually seems easy. probably part of the merge when bringing the stale branch up to date.
Connect to the card and mount the filesystem.
spi = busio.SPI(board.SD_SCK, board.SD_MOSI, board.SD_MISO)
cs = digitalio.DigitalInOut(board.SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
The reason I ask is say I wanted to power-cycle the card and start the init process over. How would one "cycle power" to the card in CP?
@swift arrow this might not be possible. I don't know which device you have but I looked at the schematic for the "adalogger", and the card is directly powered from the same +3.3v that powers everything else, so without unplugging usb and/or battery I don't think it's possible. https://cdn-learn.adafruit.com/assets/assets/000/029/013/original/adafruit_products_schem.png?1449699903
@onyx hinge I think the error is card related on all boards. The board I am using is the Grand Central.. but the issue #13 I believe is more against the cards
ie some cards work.. but one that doesn't is the Samsung EVO 32 GB
and while trying to debug it, you wish you could cut the power so you knew for sure it was reset..?
kind of.. I wanted to add a routine to @slender iron's lib.. basically where he calls OS error on init.. I wanted to try a power-cycle the card and try a different init sequence.
I think CMD0 for SDcards will be close enough to a power cycle.
CMD0 is worth a try, I don't think physically resetting or disconnecting the supply voltage is possible without modifications to the schematic
@onyx hinge I appreciate you looking at the diag.
happy to
I'm pretty certain the issue is in the init sequence.. so I will keep trying things. Unfortunately different cards need slightly different timings and strings sent to them. My first bug.. and I pick something crazy complex. ๐ I never realized that hardware made to a standard.. could vary so greatly. Probably common knowledge to veterans.
The cause of the build failures is that flash is too full on circuitplayground_express_crickit -- disabling the new feature for that specific board might allow the build to be green. The translations need to be refreshed again (no surprise there) and there are conflict(s) in mpconfigport.h to be resolved which shouldn't be too subtle.
Hi all,
I'm trying to add a custom module that generates Bitcoin addresses to a CircuitPython build. I am building off of the 4.1.x branch.
However, I'm overflowing the available FLASH space by about 44KB
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: build-circuitplayground_express/firmware.elf section `.text' will not fit in region `FLASH'
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 44412 bytes
collect2: error...
youch thats large :) can you use M4 or nRF52 builds only? M0 is super tight fit :/
Look in mpconfigboard.mk for various boards and you'll see things like CIRCUITPY_BLAH = 0 or =1. That will turn that particular module on and off. A list of these settings can be gleaned from circuitpython/py/circuitpy_mpconfig.mk. But yeah, that's pretty large.
You could also remove some frozen modules if you don't use them, in the same file.
@slender iron any starting point you would recommend for a non-express samd51 board? I think you mentioned that your gameboy cartridge uses that? I can't find it in the board definitions.
Thanks for the responses all!!
@dhalbert thank you, I'll look there.
@ladyada I've been interested in trying the Grand Central so I'd like to get an M4 build working. But when I tried to compile for that, I got an error I can't quite figure out:
``
`/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: error: build-grandcentral_m4_express/firmware.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc_nano.a(lib_a-explicit_bzero.o...
I think I have it working
We are using arm-none-eabi 7.3.1, which you can get from https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa, or directly from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads: use the 7-2018-q2-update release. Could you try updating your compiler?
@stuck elbow if you're willing to use Eagle,I can shower you in boards
The scanning works! Here's my code:
import bleio
scanner = bleio.Scanner()
entries = scanner.scan(1)
I have a couple of requests.
- Scan returns a lot of duplicate entries. Would it be possible to only return unique entries? Would this also speed up the scanning?
- Address.address_bytes returns the address reversed. Can it please be swapped? On a side note, it looks like CircuitPython doesn't support reversing strings using [::-1]. It throws NotImplementedError only s...
Hi Dan and Limor, I updated my compiler to the one you've recommended.
After some minor adjustments to code on my end, I was able to compile for the Grand Central (M4) board. Looking forward to testing the build when I get that product ordered.
I'll also play around and see if I can get my build it to fit on an M0 board like the Circuit Playground with those tips on removing default modules.
Thanks for all of your help, that resolves the questions I have!
I put what I found so far in https://github.com/adafruit/Adafruit_CircuitPython_SD/issues/13 .. I don't now python well enough yet to follow the _cmd function.. so I'm not sure how much farther I can take this.
First reported here with all the details: https://forums.adafruit.com/viewtopic.php?f=60&t=147212 Basic summary is that the Feather Express M4 / Adalogger hardware works with other micro SD...
Check out the alpha release of https://github.com/adafruit/Adafruit_CircuitPython_BLE/releases/tag/2.0.0-alpha.0. adafruit_ble.Scanner has support for suppressing duplicates and other features. The bleio functionality is designed to be the minimum necessary, and we're layering Python code on top for end-user use in many cases.
The address bytes are as fetched from the advertisement. It will print in the correct direction, I think. I am trying to imitate the direction used by various BL...
- Can't replicate on ~4.0.0 e00a702ce (which is what was still on my board) ... Ctrl-C breaks out of the loop as expected.
- Ditto a fresh build of 4.0.2 ... I can run your code above w/ no cable attached & it breaks out fine. DHCP discovery is running happily in the background.
- eth.connect works as expected ... it depends on the physical interface, not the network actually being useful.
- when DHCP succeeds, the loops exits as expected and example.com is coming through fine.
In shor...
@tough flax @slender iron @meager fog I have a RV32M1-VEGA board that I would lend to someone who would be willing to try a CP port. Should be able to find the specs on open-isa.org.
@idle owl are you around for monday's meeting? I can't remember if so
@slender iron I am not.
kk, will send out the notes doc now. thanks @idle owl
Thank you!
np ๐
The CircuitPython weekly meeting is here on Discord on Monday at 11am Pacific / 2pm Eastern. All are welcome to join in. The notes doc with more details is here: https://docs.google.com/document/d/123Dv62ODdD-Qt2XteHLP8NQZJPqVKAAH__kZkq4fpaU/edit?usp=sharing <@&356864093652516868>
@pastel panther I was thinking about board definition in CP
Pull request #2032 suggests to add a pre-allocated buffer to WaveFile. However, maybe there's a different route that would be better. Let's see if we can flesh it out.
It appears that in general, while actually DMA'ing the audio data to the DAC, PWM, or I2C destination, there's an unavoidable need for a chunk of audio data in an arrangement that suits the specific hardware implementation. For example, on nrf's PWMAudioOut, it is a number of 32-bit blocks, which may contain 1 or 2 channe...
How about doing the same thing as in #2032 but for your AudioOut implementation, if it needs a buffer, so it can be shared?
What if the sample object can give the AudioOut permission to destroy (vs conserve) the buffer that it gives
I can't think of a use case where you would want it conserved?
meanwhile, sommersoft is over here struggling to wrap his head around inlining multiplication with bit-shifting, signs, and casting. #stay-in-school-kids!
just let the computer figure it out?
i may be overthinking, while definitely overwhelmed, writing an "equally fast" non-DSP-capable version for each of these:
static inline uint32_t mult16signed(uint32_t val, int32_t mul) {
#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1))
int32_t hi, lo;
int32_t bits = 16; // saturate to 16 bits
int32_t shift = 0; // shift is done automatically
asm volatile("smulwb %0, %1, %2" : "=r" (lo) : "r" (mul), "r" (val));
asm volatile("smulwt %0, %1, %2" : "=r" (hi) : "r" (mul), "r" (val));
asm volatile("ssat %0, %1, %2, asr %3" : "=r" (lo) : "I" (bits), "r" (lo), "I" (shift));
asm volatile("ssat %0, %1, %2, asr %3" : "=r" (hi) : "I" (bits), "r" (hi), "I" (shift));
asm volatile("pkhbt %0, %1, %2, lsl #16" : "=r" (val) : "r" (lo), "r" (hi)); // pack
return val;
#else
uint32_t result = 0;
//TODO:
for (int8_t i = 0; i < 2; i++) {
int16_t ai = val >> (sizeof(int16_t) * 8 * i);
}
return result;
#endif
}
's eyes glaze over as he sees assembly
mind you, that is exactly where DeanM left it. it appears that M0+ has a "fast multiply" (1 cycle) thumb instruction, i just can't figure if we have it enabled or not.
and...exactly. ๐
you can't just test it?
i mean, i can. i'm just not sure how to verify it beyond "it compiles". hehe
print the result?
@stuck elbow asked...and answered. ๐
/tmp/ccOqNwwR.s: Assembler messages:
/tmp/ccOqNwwR.s:45159: Error: instruction not supported in Thumb16 mode -- `muls r1,r3,r2'
/tmp/ccOqNwwR.s:45171: Error: instruction not supported in Thumb16 mode -- `muls r3,r3,r2'
thankfully, Dean did finish the non-DSP-ASM addition functions. can probably work those into multipliers...
I just tried CP 5.x master and 4.10 on a gemma M0 and it works OK, but the DotStar LED does not behave normally -- on RESET it flashes wildly (moslty reds) and then on entry to REPL goes to a sort of blue. Can onay else try this on a gemma M0 and see if you see the same .
"jif". i blame the peanut butter brand...
so jemma?
for me, yep.
not for me - gemma
gem or jem?
๐
hehe. language is funny. english is the worst. gem == jem
let's witch to Polish spelling, will be easier, dลผemma
@raven canopy so how would you write gem with a hard g?
ghem?
written, is g. pronounced as a soft g though (j).
๐ค
gemme ;-)
FWIW -- my trinket_m0 behaves normally -- and there is no challenge to the pronunciation.
my gema does do the red/blue blinking while not in repl, but in repl it's blue
like this
looks like mine
RawSample needs it conserved.
but the REPL color is not always the same -- kind of pink this time
I think the REPL color is just whatever it was flashing at the time.
'm getting a headache from looking at it -- I think I'll file and issue...
With the current master 5.0 and with 4.1.0 my gemma_m0 seems to work OK, but the Dotstar LED is behaving oddly on boot and REPL entry.
On boot or reset, it flashes quickly - red, blue, white
on REPL entry it can be different colors - blue, light blue, light red (pink) - it may just be whatever the flashing color stopped at.
I have not tried older version of CP.
The example code is very helpful, thanks! Using the scanner library provides unique entries.
I'm pretty sure the byte order is reversed. I created a simple test that flips the byte order:
from adafruit_ble.scanner import Scanner
from binascii import hexlify
address_types = {
0: 'PUBLIC',
1: 'RANDOM_STATIC',
2: 'RANDOM_PRIVATE_RESOLVABLE',
3: 'RANDOM_PRIVATE_NON_RESOLVABLE'}
scanner = Scanner()
entries = scanner.scan(3) # scan for 3 seconds
for e in ent...
@stuck elbow @raven canopy https://translate.google.com/#view=home&op=translate&sl=it&tl=en&text=gemma
Google's free service instantly translates words, phrases, and web pages between English and over 100 other languages.
makes sense, all european languages use a variation of it: https://en.wiktionary.org/wiki/gemma#Latin
even jewel is a deformed gemma, if you think about it
ah, your google translate link showed me italian
so in Italian it's jewel, but in English it's bud
its both
also, cat's eye
if you just print(e.address), does it print in the right order, for your purposes? Doing print() or str() does reverse the bytes. The address_bytes are taken directly from the advertisement, in the order that they show up in the advertisement.
You're correct, print() and str() return the formatted address in the right order.
I was checking entries for addresses matching a known list and it wasn't obvious to me that I had to use str() with instances of the address class as opposed to address_bytes. Thanks.
Re-accomplishing #254.
@uhrheber I've been working on the CircuitPython support for the nRF24L01(+), and in reference to this previous post: from my understanding of the Enhanced ShockBurst protocol, it is the underlying mechanism that takes whatever info you've give...
@tulip sleet nevermind -- ignore previous (now deleted) posts -- my bad...
I think I may have spotted the issue, but would like some other
eyes to take a look if possible.
Here's what I see:
When playing .wav files, in audio_dma_setup_playback(), we find a free DMA channel (usually
channel 0) and store it in the dma structure. So, whenever we call audio_dma_load_next_block()
we use that stored channel. Now, when using the microphone we call
common_hal_audiobusio_pdmin_record_to_buffer(), which also looks for a free DMA channel
(again, it seems to always ge...
@tulip sleet I tried to set the current_time via BLE with your "pairing" branch of the BLE repo on 5.0 Master. but I get this -- am I missing something? ```Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-alpha.0-128-g347fbb652 on 2019-08-03; Adafruit Feather nRF52840 Express with nRF52840
import time_ble
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "time_ble.py", line 3, in <module>
File "adafruit_ble/current_time_client.py", line 62, in init
NameError: name 'peripheral' is not defined
test code wasfrom adafruit_ble.current_time_client import CurrentTimeClient
cts_client = CurrentTimeClient()
cts_client.start_advertising()
while not cts_client.connected:
pass
cts_client.discover()
cts_client.pair()
print(cts_client.current_local_time)
@solar whale there's a typo there I fixed but didn't push yet (because it's churning for other reasons):
def __init__(self, name=None, tx_power=0):
self._periph = Peripheral(name=name)
self._advertisement = SolicitationAdvertisement(peripheral.name, (self.CTS_UUID,), tx_power=tx_power)
self._current_time_char = self._local_time_char = None
should be
@tulip sleet thanks -- I thought that was it and tried it -- it gets beyond but as you noted then hangs -- no problem -- just wanted to make sure I was on the right path...
Try this commit maybe. The current tip of ble-pairing probably doesn't work. I just pushed it for backup
I'm adding better BLE Descriptor support and the code is in flux
cleans the flux with rubbing alcohol
@tulip sleet --- OK -- I'll do some poking, but did not mean to pressure you -- I can wait until you are ready for testing.
no pressure!
@tulip sleet cool
it was very satisfying ๐
now I need to understand what it all does ๐
CTS is unusual in that the peripheral is acting as a client instead of a server. So there's a special kind of advertisement, then we make a pairing request, and the central (the iPhone) does the connection
pretty slick
Saving an updated main.py is supposed to force a reload and run the new code with any errors reported in the REPL.
What happens is when I save a new main.py, I get an OS error 5 in the REPL. I have to press Ctrl/D in the REPL many (usually over 30) times to get anything to happen. Until it takes off, I get the OS error 5 each time I press Ctrl/D. The OS error 5 is not valid here.
Is this true of any main.py or just this particular one? If the latter, please post the code here. If not, try reformatting the CIRCUITPY filesystem:
import storage
storage.erase_filesystem()
It is true any time I save a new main.py. I am running Raspbian Stretch with the Geany editor. I will try reformatting the CIRCUITPY drive and see if that helps.
This may be due to the geany editor not flushing all the file writes immediately. I haven't tested it or reviewed its source code to see if it does. See https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code#1-use-an-editor-that-writes-out-the-file-completely-when-you-save-it-7-13
I saved all the files from my board and reformatted the storage. That fixed the problem! Thanks for the suggestion.
@umbral dagger hihi ok scott submitted some feedback for the screenshot PR - plz check it out ๐
Lurking today.
lurking
lurking too
Lurking. child taxi and day job...
DRAFT newsletter!
https://github.com/adafruit/circuitpython-weekly-newsletter/blob/gh-pages/_drafts/2019-08-06-draft.md
8/8/2019 is CircuitPython day!
We'll have a show on Weds, and Thurs, and more planned!
Some photos!
https://photos.app.goo.gl/xoAHetFnCj6RQpnz7
That's me holding the hallow wing ๐
Thanks for sending the circuitplaygrounds boards to hack, Phillip ๐
hi folks lurkin just text
Kattni PyOhio keynote video posted!
https://youtu.be/-bBHXimlfPQ
Kattni Rembor https://www.pyohio.org/2019/presentations/126 In trying to learn Python, I stumbled into a passion I had never considered. My path began with l...
I very much want a pyruler
Accelerating Driver Development with CircuitPython
https://pybay.com/speaker/bryan-siepert/
CircuitPython 4.1.0 Released!
https://github.com/adafruit/circuitpython/releases/tag/4.1.0
NEW BOOK! CircuitPython for beginners with Adafruit Circuit Playground Express & Mu in Japanese
https://twitter.com/AoyamaProd/status/1157775643750232064
CircuitPython editing and saving on iOS is here!
https://blog.adafruit.com/2019/07/30/its-now-possible-to-open-edit-and-save-python-code-on-ios-for-embedded-electronics-plugged-in-circuitpython-usb-devices-apple-ios-circuitpython/
CircuitPython sneks its way to Snek!
https://circuitpython.org/board/snekboard/
Snekboard is designed to hook up to Lego Power Functions motors andswitches, allowing you to build robots out of Lego and control themwith CircuitPython or t...
โRISC architecture is gonna change everythingโ
https://youtu.be/RL9yCWv7NS0
Weโre excited for open silicon! If someone is working on a RISC-V microcontroller with built-in USB and a good chunk of RAM please let us know! We're looking forward to writing "CircuitPython snakes its way to RISC-V!"
https://blog.adafruit.com/2019/08/02/risc-architecture-is-gonna-change-everything-adafruit-joins-the-risc-v-foundation-risc_v-riscv-adafruit-adafruit/
added #risc-v topic in Discord, er, RISCord...
"RISC architecture is gonna change everything" .... "Yah, RISC is good."
sign me up
I'm in. Particularly interested in compiling assembler to machine language.
HUG REPORTS FOR ALL!
Kattni Rembor https://www.pyohio.org/2019/presentations/126 In trying to learn Python, I stumbled into a passion I had never considered. My path began with l...
Matt Trentini MicroPython is a fantastic environment for embedded development. But it is an interpreted language; what happens when you hit performance l...
Nina Zakharenko Still debugging your code with print statements? Learn how to level up your ability to troubleshoot complex code situations by using the powe...
E. Dunham In some ways, a browser engine seems to have little in common with a web framework. But both are ambitious software projects, approached by large g...
The cake is a lie.
๐
lurking
welcome @pearl notch !
I'm also in the process of resetting my electronics workspace
(oops meant to hold that until my status updates)
I see a model m!
I fixed an ISSUE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
first one ever for me ๐
working on the pull request for https://github.com/adafruit/Adafruit_CircuitPython_SD/issues/13
First reported here with all the details: https://forums.adafruit.com/viewtopic.php?f=60&t=147212 Basic summary is that the Feather Express M4 / Adalogger hardware works with other micro SD...
someone on Reddit was asking about the volume capability
Please do publish something on that.
Adafruit has a new digital pot just out
seattle "hot" is > 80F
@turbid radish Saw that. It has some audio bias limitations that could confound what I'm doing.
ADSR success!
from the DAC:
Mic not working, status update: Gonna try the MQTT lib tomorrow and see how it goes with local and remote broker. Also did some light painting with circuitplayground last week, and looking for a BLE board to work on ble projects .
@obsidian compass we already have Feather nRF52840 for BLE via Arduino and CircuitPython, and more boards are in the works
@pearl notch I'll publish the AREF trick here in a couple of days: https://github.com/CedarGroveStudios/AD9833_FeatherWing
@tulip sleet sure, I see. Not yet available here locally in India, if I need to import I think I'll wait for the new BLE circuitplayground one ๐
https://www.makerfabs.com/pewpew-standalone.html <-- this is the PewPew Standalone link
she does ๐
@slender iron pull request sent. Wow, my real first fix!! OMG I spent a week on it ๐
to paraphrase someone at pyohio, I'm giving you these review notes because I have a lot of confidence in you and want you to grow as a developer
@gilded cradle
๐
it's about 90
I have even more respect for the CP team after that. You people are AMAZING!!
frozen modules don't get updated without a clean
I've wanted to redesign that yaml for a while now... Using a stricter matrix would make it much more readble/maintainable.
progress is not always forward ๐
sorry -- I have to go AFK -- have great week ๐
for ref:
https://circuitpython.readthedocs.io/en/4.x/shared-bindings/displayio/Shape.html
i don't think i even covered it in guide
you could study how regions were implemented back in 68k macs, they could efficiently represent shapes with gaps
Great being with you all.
Thanks everyone!
Have a great week ahead
Thanks everyone!
graphical? blasphemy!
I could not get Segger Embedded Studio to work...
Is there a reason for the particular day chosen as circuitpython day?
8/8 looks like two snakes
Easy "snek art"
okay ๐
@tidal kiln run a Windows vm and use atmel studio 7?
๐
I found that using a breakpoint file, and source at the start makes line number woes a non-thing.
optimized out ๐ก
Re my status in the voice chat, I can now read the accelerometer values from a connected โhostโ computer running this:
import serial # pyserial
s = serial.Serial('/dev/cu.usbmodem14131', 115_200)
print(s)
for n in range(100):
print([float(s) for s in s.readline().split()])
From there Iโll feed them to the p5.js sketch via Flask.
Great! Do think about whether geany is the problem: if it does only a partial write and you do a hardware reset, the filesystem will get corrupted. It looks like geany uses Gnome file operations, and I don't see that those do something like an fsync. You could do a sync from the shell after a write to make sure the file is completely written.
@raven canopy looks like we're leaking the api key in these errors too ๐ฆ
@slender iron Looking through your EPD displayio work. Do the drivers support both greyscale and color displays? Is this controlled through the parameters passed to the initializer? Would be happy to help you test on some epaper displays i have lying around
ya, it should support both
I don't have a grayscale display to test with. only white/black and white/black/red
I think the params to control it now are third_color and write_color_ram_command
Great
@slender iron maybe i misunderstood but when i said greyscale i meant white/black
kk, just checking ๐
did you see the drivers I pushed already?
lemme find my sample code
epaper test code.py. GitHub Gist: instantly share code, notes, and snippets.
Yes.
what resolution / format is "Triangulo_HSV.bmp"?
Thanks,
ill try to compile and run it
@slender iron ๐ฌ I'll deep dive it tonight. I've noticed the uptick over the past few weeks, but haven't been checking it every day. Just need to narrow down the root, be it GitHub, Travis, or the modules.
@slender iron @tulip sleet in reference to speeding up builds, have we tried using ccache before? It's available on Travis, and at this point in my research (phone) seems compatible with gcc-arm-none-eabi.
@raven canopy I'm deep in fixing the key leaking at least. will have a PR shortly
it's kinda hairy but should work
already revoked the existing key
Not sure what my phone just did there...
@raven canopy ccache looks very interesting, and easy to use
it looks like it should handle all the cases of different compiler options, since it's checking that the command line matches
@slender iron tried compiling for nrf but i see you have only implemented atmel samd support so far. I dont have a samd board on hand so ill continue on it tomorrow when i get hold of one.
it shouldn't be too bad to get working
none of the new code uses anything port specific
may just need a build file tweak
@raven canopy ccache sped up a clean compile of the same board twice from 1:54 to 0:36, but it did not speed up two similar board caches (metro m4 then feather m4). This is probably because the board id is on pretty much every compile command line
right now the same-board compiles are only one language to another, and we already skip make clean on those compiles
we might think about trying to make more compiles board-independent
- Add board definition for Rev A Metro nRF52840 Express proto
- Several
mpconfigboard.hfiles had#define FEATHER52840. This was obsolete and was removed.
welp, still failed but didn't leak the api key: https://travis-ci.com/adafruit/adabot/jobs/222617071
#progress
@slender iron Got it working on an nrf based board with a ssd1673 display. When using an il0373 display the result is a fuzzy display (I am guessing something is wrong with the pixel format). Both displays are black/white.
I completed an accelerometer to p5.js 3D animation demo: https://github.com/dcbriccetti/cpe-to-p5/tree/master
https://www.youtube.com/watch?v=J8c2yRgZiGI
@pearl notch wow ! that was quick
we talked about the sheer number of build artifacts that come from a circuitpython build...
@magic sparrow I like how it starts out simple on the cpx and gets progressively more complicated as you go to the flask and javascript parts of the project
Is there a command to print the amount of free ram?
I am playing with another SD card issue.. https://github.com/adafruit/Adafruit_CircuitPython_SD/issues/11 and I'm wondering if we are running out of memory from a leak
This forum thread provoked this issue: https://forums.adafruit.com/viewtopic.php?f=60&t=141707. The poster had this problem with all the SD cards they tried and I had trouble with the one I...
gc.mem_free
Ok, looks good to me. Thanks!
54cde56 audiopwmio: Add the shared files for this new m... - jepler
7b9d26c WavFile.h: include vfs_fat.h for pyb_file_obj_t... - jepler
2bc704f ports/nrf: factor out routines for allocating, ... - jepler
a183425 ports/nrf: Implement audioio.AudioOut using PWM - jepler
324d312 make translate - jepler
If you edit a comment you made in a github Issue.. Does everyone get notified each time you edit it?
I made some changes to my comment and saved.. then made some more..saved.. then made some more.. about ten times.. Did I just SPAM everyone on the list?
@swift arrow no, only the initial post is sent out. Edits do not get broadcast. No problem!
@tannewt however, that fix was applied only to the master branch. Do you want me to reopen this and create a version to apply to 4.x?
Nope, no deliberate. Just an oversight. Please fix if you can. :-)
Hmmm, short of the usual checks (is your power supply good enough? Is the 'wing seated properly? Does it still do it with the latest release? Can we try over with new hardware?) I'm stumped. One thing you could try is to plug an ethernet cable into a port you can monitor and check that you can see DHCP discovery packets being sent while waiting for ifconfig() to finish, but I'm clutching at straws here.
Looking good here! Just a couple comments. I'm a bit torn about having the constants for every order still but it does give us the ability to change it later.
I'd suggest having D or P for pulse at the start so all characters represent a byte in order. It's weird to have a suffix shift everything.
Why not hang onto the original object? Strings are immutable so it won't change.
@tannewt this is implemented on nrf now, and infrastructure is committed would help a future implementation for atmel_samd. Do you want to hold this issue open?
make stubs generates .pyi files that can be used in editors like VS code to provide helpful hints. The rST docs need to be fixed up so that the stubs include things like valid types.
PR that added stubs: https://github.com/adafruit/circuitpython/pull/1915
Example PR that fixed up some comments: https://github.com/adafruit/circuitpython/pull/1920
tried it again with no hardware reset line attached (because that's possible) and after a soft reset of the board (which happens) but still all working as expected.
nah, I have a feeling most nrf folks will skip straight to 5.x to get all the new ble goodness.
Nope, let's close this. We can always open a new issue when we want it for samd. Thanks ๐
One tricky thing with a looped sample is knowing whether the sample has already been transformed or not.
@jepler I fixed it to see what happens now. Feel free to fix the file through github like I did. I think you have permissions too.
Bitmap already has read_only: https://github.com/adafruit/circuitpython/blob/master/shared-module/displayio/Bitmap.h#L45 It's used for the blinka in the top left already so it should be easy to extend.
displaycore is an interesting idea. It might be worth doing to separate out epaper from mipi support if it ends up too big. Let's revisit that once the epaper PR is closer.
I'll leave it up to @dhalbert
Sounds suspicious @DavePutz ! I think you are right about contention.
-
I think we'll want to use channel 0 for recording and 1 for playback because lower numbers get higher priority. I'm not sure what has to happen for that though.
-
Load next block is loading more of the sound from the filesystem so the sound keeps playing because we can't store it all in memory.
Perhaps @jepler and @deshipu have ideas of how to fix this too.
Is it too late to put something in tomorrowโs newsletter, and is that a good place for my accelerometer to 3D animation demo video and code? If yes and yes, into what section should a short note go?
As tannewt mentioned, I don't think we need string constants for all the possible strings. The usage would just be to pass in a string that gets parsed. It needs to be be validated, but it's just as easy to pass "RGB" as _pixelbuf.RGB. And _pixelbuf isn't meant to be seen anyway, so there would need to be further code to select these in neopixel, etc.
I think @DavePutz is on the right track, if both devices ever try to use the same channel at the same time, something bad will happen. Why isn't the expected protection against this working?
I started looking into this with debugging prints and the first thing I noticed is that dma_disable_channel can be called with an out-of-range channel number if audio_dma_stop is called twice, and it frequently is.
However, this doesn't seem to be leading to this behavior.
Next, I started track...
well that's me up past bed-time
@kattni @rhooper I am taking another look at something very similar to #770 which both of you were involved in.
How the current PWMOut determines if the error says "All Timers for this pin are in use" and "All timers in use" is still not clear in my view.
For some reason the TCCs are treated differently to the TCs under this arrangement. You can have a situation where all the TCC timers are used, but it won't say that. It will just say "All timers in use".
Can we change what it...
It is possible for this routine to expand some inputs, and in fact it does for certan strings in the proposed Korean translation of CircuitPython (#1858). I did not determine what the maximum expansion is -- it's probably modest, like len()/7+2 bytes or something -- so I tried to just make enc[] an adequate over-allocation, and then ensured that all the strings in the proposed ko.po now worked. The worst actual expansion seems to be a string that goes from 65 UTF-8-encoded bytes to 68 compr...
With #2042 in the mix, this DOES build a final .uf2, though 134 characters are missing from the bitmap font. Building circuitplayground_express, there are now 3936 bytes free in flash out of 253440 bytes ( 247.5 kb ).
@pearl notch newsletter is finished already, but thereโs always next week. If you have a suggestion for the newsletter post it here and tag @turbid radish
First of all hi - Iโm Scott (from Scotland) and Iโm a hobbyist and STEM ambassador / Code Club Leader, and i love CircuitPython! I also love Stranger Things, so I pulled this together for CircuitPython day. Uses the precision rtc featherwing and an M4 express. Little bit more work to do on the enclosure cause Iโm getting a bit of bleed between letters, but Iโm super happy about how itโs come together.
I was thinking of building a full sized one using the GE addressable holiday lights, that's cool. It's amusing how the lense flare makes it look almost as if there is a laser beam illuminating it.
Ha, Iโve got a 3 year old so lasers have been banned (for now!) in my house. I do love a laser though....
@agile saffron that's awesome!
Thanks sommersoft!
@agile saffron great job! Was that Stranger Things inspired?
I'm guessing that's what the "I also love Stranger Things" aside was pointing out.
Oh yeah definitely siddacious
Oh derp, missed that :)
I also forgot to say it was a clock in that description, I got too excited ๐
Great newsletter! ๐
@agile saffron As an idea, you might try adapting this code or doing something similar to give it the "communicating from the upside down" feel
https://learn.adafruit.com/circuit-playground-jack-o-lantern/circuitpython-code
Oh cool thanks siddacious Iโll have a look at that tonight!
@idle owl : Just listened to your PyOhio talk. It was really good and inspirational. Awesome job!
and congrats on finding your passion and dream job!
@swift arrow Thank you so much!
I still have to listen to that, been meaning to!
@slender iron Would you accept a PR making the same changes you made for the atmel-samd port to the nrf ParallelBus implementation? This is what was missing yesterday to get the EPaper working on my nrf board
does anyone know anything about sercom usart intflag rxc bit?
@subtle sun we would be happy to see a PR. I have been wanting an excuse to get an e-ink board, being able to help you test it on nrf would qualify right?
basically the rust hal we've got is checking if any data has been received before it does a read but the bit never ends up set
didn't see anything in the errata
the equivalent of this https://github.com/adafruit/ArduinoCore-samd/blob/e80f2f1b495adedf76f599d031fab0409fdf7008/cores/arduino/SERCOM.cpp#L153
does that only work if you're doing interrupts?
Datasheet doesn't seem to state that INTFLAG.RXC depends on the related interrupt actually being enabled
yeah I was looking at that
I think I disabled it when I meant to enable it
there's an intenset there
hang on a sec, is this not contradictory?
writing 1 disables the rxc interrupt, value 1 - interrupt is enabled
they're all like that though
is it talking about reads versus writes?
oh derp that's intenclr
there are registers that you write 1's to to clear stuff, e.g. INTENCLR
jeez I'm not in the right headspace for datasheet reading lol
the screenshot above from the datasheet is from a page that describes other bits that you clear by writing 1's to
yeah I just realized
@subtle sun yup, definitely as @onyx hinge said
@slender iron I opened a PR to your repo.
I mentioned that when trying a B/W IL0373 display (GDEW029T5) the display just fills up with a mix of what seems to be a random pattern of pixels.
I think this is because the driver start sequence configures tri color support
I don't think there is a reason. It sounds like you have an improvement of
the error messages.
On Tue, Aug 6, 2019 at 3:35 AM wallarug notifications@github.com wrote:
@kattni https://github.com/kattni @rhooper https://github.com/rhooper
I am taking another look at something very similar to #770
https://github.com/adafruit/circuitpython/issues/770 which both of you
were involved in.How the current PWMOut determines if the error says "All Timers for this
pin are in use"...
@subtle sun yup, I saw. please make it to the adafruit repo directly. for the driver, feel free to add logic to patch the init sequence if third_color is provided. (Do you think highlight_color is a better name?)
@slender iron My code is based on your branch which you haven't pushed to the adafruit repo yet.
Ill try playing with the driver to try and get it working with this display and then see how this should be solved.
Here is some python code that reproduces reliably for me. Note that I think the use of the Neopixel code may be needed, as in my tests that generated a lot of gc_allocs and gc_frees - possibly related??
import array
import math
import time
import microcontroller
import audiobusio
import board
import gc
from adafruit_circuitplayground.express import cpx
Exponential scaling factor.
Should probably be in range -10 .. 10 to be reasonable.
CURVE = 2
SCALE_EXPONENT = math.pow(10, ...
Does this need to be in a C comment?
@subtle sun ah right! I'll pull it in.
Thanks
No, as it goes to the build log (sys.stderr). I can move it to being in a comment instead if you prefer.
Ah, I missed that. This is fine. Thanks!
@slender iron thanks for TCA merge. i'll take care of version bump, release, issue close, feed the cat, do the dishes, etc.
@tidal kiln thanks!
Worth monitoring #1908 as this also relates to (more fatal) problems that are being attributed to DMA woes.
#1908 has also gone down the path of DMA investigation.
Is there any remotely feasible way to use my swd debugger on a cpx ?
The dots on the back, I thought.
oh I see 'em now
OK, if it comes to that! First, I just want to see if I can reproduce #1908
and then maybe my fix will fix it without trouble
nope, bug still happens with my fixes, drat.
Unfortunately, I still get hard crashes with my earlier debugging and potential fix code.
next guess, which it looks like has solved the problem, but not sure if it's cumulative with other local changes:
@@ -292,6 +296,7 @@ void audio_dma_stop(audio_dma_t* dma) {
audio_dma_disable_channel(dma->dma_channel);
disable_event_channel(dma->event_channel);
}
+ audio_dma_state[dma->dma_channel] = NULL;
MP_STATE_PORT(playing_audio)[dma->dma_channel] = NULL;
dma->dma_channel = AUDIO_DMA_CHANNEL_COUNT;
}
Theory: nothing is clearing ou...
I need to "borrow" some crc makign code from https://github.com/hazelnusse/crc7/blob/master/crc7.cc .. but there is no license. It's for the adafruit_sdcard library. I do not see any license there. If people put stuff on github and make it public.. is that like an understood MIT license?
Sorry total newb here.. How do you handle that kind of thing? I will be converting his c++ code to python.
no license is generally all rights reserved
afaik
but if you make significant changes it might not matter
IANAL
I'm not seeing a way of contacting the author.. hmmm...
thanks!
@pearl notch : the example of a manual volume control for the Feather M4 Express is shown here. It can control the output of the two DACs by changing the DAC reference voltage through the AREF pin. WARNING: remove the trace between 3V and AREF on the Feather board before attaching anything to the AREF pin. Don't connect any voltage to the AREF pin greater than the 3V provided by the Feather or lower than 0V (no negative voltage). Hope to have a full explanation on the repo page later tonight. https://github.com/CedarGroveStudios/AD9833_ADSR
@errant grail Thanks. My interest in ADSR envelopes has so far been with web browser oscillators. Well, I think I played with it on my Commodore 64โs SID chip.
@pearl notch You're welcome. I've been focused on electronic music with Eurorack modules lately. It's pretty easy to find an envelope generator in the module format, but I wanted to brew my own.
@swift arrow if you study the code and then write your original code, the license if the code you studied is not important, IMHO. But if you have any concerns, there are sure to be other implementations to study.
The author gave me permission so I am covered ๐
and I am converting from C++ to Python.. and some slight modifications
I can confirm that your fix takes care of both the original code by c-k-dillard and my repro code above. My only question would be if we could still have a dma channel conflict should someone actually be playing a wav file asynchronously with using the microphone (or is that really not possible)?
@errant grail the adsr trick is really cool, Iโve done a few things to control a modular with pwm on an Arduino but itโs always a bit steppy, this looks like a great solution.
@agile saffron Thanks. Had to wake up my trig skills to smooth the envelope. Good news is that 64-step amplitude resolution seems to be enough.
Bad news is that the AREF voltage can't go below about 0.5v without distorting the signal. Going to try a digital potentiometer or two to see if that works better.
@errant grail When I first read that my brain read "64-bit amplitude resolution" and I thought, "I would hope that's enough!"
Ha! Might take a while to generate that ramp using CircuitPython!
Right? ๐
My first test was 10 steps followed by 32. The artifacts mostly disappeared with 32 so I doubled it.
Nice!!!!
The digital potentiometer I'm planning to use has 256 steps. Plenty to choose from.
Oh yes. That will be good. ๐
As for 64-bit resolution, I could tell a story about my son calling me on a sat phone from <insert far away land> and asking for a "10 digit grid reference" for a particular part of a particular building.... ๐
Yikes.
Obviously can't go into details, but I'm sure you could use your imagination.
Yes, I did. Two or three scenarios.
Let's just say there have been numerous interesting sat phone calls. LOL.
@errant grail yeah, I checked out the datasheet (for samd21, it was handy) and the minimum guaranteed external reference voltage is 1.0, so you're stressing it a bit to go to 0.5 (40.9.4 in http://ww1.microchip.com/downloads/en/DeviceDoc/SAMD21-Family-DataSheet-DS40001882D.pdf)
Microchip Technology Inc. is a leading provider of microcontroller, mixed-signal, analog and Flash-IP solutions, providing low-risk product development, lower total system cost and faster time to market for thousands of diverse customer applications worldwide. Microchip offer...
@DavePutz Yes, my analysis of how the channel->CHCTRLA.bit.ENABLE value work seem to indicate that there's a further risk of accidentally re-using a DMA channel too soon when the playback (or, hypothetically, the recording) are asynchronous.
This includes a fix which directly addresses the original problem, as well as some further fixes for other weirdness I noticed along the way. In particular, while I saw some spurious soft-resets with only the first fix, I believe the change to audio_dma_stop somehow has the side effect of fixing some spurious soft resets I was seeing during testing. Or, at least, they changed from 1 per ~300s to <1 per 30,000s while running the #1908 reproducer.
Testing performed: Ran the reproducer scr...
@tannewt while I based this off master, I would be happy to roll a new request that would go against 4.x.x. Let me know.
@tulip sleet another nit I found in the example for current_local time https://github.com/dhalbert/Adafruit_CircuitPython_BLE/blob/pairing/adafruit_ble/current_time_client.py#L53 should be print(cts_client.current_time) or the proerpty needs to be renamed to current_local_time.
Let's see, 3.3V with 64-bit resolution, that would be 0.000000000000000179 picovolts per step, or 0.179 yoctovolts. Given that the thermal noise for only 50ฮฉ with only 1Hz of bandwidth would be around 900 picovolts (5000000000000000000 times as much), most of those bits would be utterly lost.
@solar whale thanks - I edited the example..current_time is right. It will be in the next PR. Debugging a bunch of changes to bleio at this very minute.
@tulip sleet I tried the example with an Android phone but it failed -- is is only for the IOS app?
i think Android phones may not do CTS. Did you pair but then it did nothing, or did it crash?
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-alpha.0-116-gee518b914 on 2019-08-05; Adafruit Feather nRF52840 Express with nRF52840
>>> import time_ble
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "time_ble.py", line 7, in <module>
File "adafruit_ble/current_time_client.py", line 99, in discover
OSError: Unable to discover service
>>>
``` did not ask for pairing
failed when I connected
no need to send time on it now -- just an FYI
could you post time_ble.py here?
from adafruit_ble.current_time_client import CurrentTimeClient
cts_client = CurrentTimeClient()
cts_client.start_advertising()
while not cts_client.connected:
pass
cts_client.discover()
cts_client.pair()
print(cts_client.current_time)
works fine with IOS -- asks for pairing
Android app was older -- updating...
it looks like the phone responded to the advertisement and connected, but then since it didn't have time, the client didn't know what to do. I should probably have discover return a boolean or throw an exception. The advertisement says "please connect if you have this service", so I don't know why the phone connected.
I have a recent Android tablet and will see what happens
OK - no problem -- BTW updated Android App app to 3.1 - same result
is this the bluefruit app or some toher app?
Adafruit Bluefruit
the bluefruit app doesn't provide the time -- it's provided by the OS. So did you connect to the CIRCUITPY peripheral and then it failed? That would explain it
you don't need to be running the bluefruit app at all
i don't know if android does CTS
it failed when I tried to connect the Bulefruit app... BTW -- Nordic nRF Connect works fine on IOS
on IOS I have to run the app to get the pairing request
the scenario is:
- '840 advertises for a central that provides CTS
- the central (iOS itself) conencts and says, yes, I do that
I run the app, connect then is asks to pair
so, I am not connecting via the app, I am looking in iOS Settings->Bluetooth, in the device list. I start the cts client advertising, and then CIRCUITPYxxxx shows up in the device list. I touch that in Settings->Bluetooth, and then the pairing request shows up, and then it moves into the list of known/connected devices. No other bluetooth app is running
sorry for the confusion. There's a brief view of this in the S&T demo I did a couple of weeks ago
I should put a description of this in the library example docstring
ok - cool! that works too! -- it also works if you start the Bluefruit App or the nRF Connect App
that might be becuase the nRF connect app also does CTS, as a demo. The idea was to access the native service provided by iOS
makes sense!
eventually we might do ANCS (Apple Notification Client Service) so you could see notifications that show up on your iPhone also on the '840. That's the way FitBit, etc. show your texts. But it's a lot more complicated
e.g. homemade apple watch equivalent
(well, hardly equivalent)
cloae enough! I hope I can learn enough to help...
sure, but it did take me a long time fully understand what is going on with BLE. it is complicated and the protocol is not layered in a way that hides the compliations, unfortunately
I need to go back an read/reread Ktowns book -- BTW just tried using the Bluetooth settings s on the Android and it does a bit better ```
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-alpha.0-116-gee518b914 on 2019-08-05; Adafruit Feather nRF52840 Express with nRF52840
import time_ble
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "time_ble.py", line 7, in <module>
File "adafruit_ble/current_time_client.py", line 99, in discover
OSError: Unable to discover service
sm: 1, lv: 2
PAIR_PAIRED
Pairing succeeded, status: 0x0000
so it appears Android does not provide CTS, and I should have discover() return false, and the program should report no CTS is available and not try to pair.
all in good time ๐
i have read the relevant parts of ktown's book several times, and it did not completely sink in until I had to code it. not his fault
For now, it's great to have your work to poke and prod. Thanks!
f-strings are not supported in CP, correct? For some reason, I was thinking that I saw them in some libraries a while back, but using them in my code caused errors. Just making sure I'm not missing something.
@stuck elbow hey, in my PR for circuitpython-stage I have a copy of stage.py because the audioio module for nrf port is named audiopwmio, so it doesn't work without modification
I've updated it anyway now that @onyx hinge's PR for audio on nrf port is merged
@cerulean pawn yeah, I saw your comment, I'm not sure yet how to best handle it, but moving the Audio class out to the ugame.py is one possible option
Thanks @stuck elbow
@cerulean pawn sorry it's taking long to answer, I'm a bit sick recently
no problem @stuck elbow, I added a copy of both the files in circuitpython ni the frozen directory, added your license, i hope that's fine for now, until we have a better solution
thanks
by the way, did you get it working frozen?
there were some problems with that, iirc?
yeah, it's working for me, testing it right now. i had issues but not in circuitpython. the board's LDO couldn't supply enough current to the audio amp
oh, I see
works fine if it is powered directly via usb
yeah, the amp on the ยตGame makes the screen dim a bit :P
but will be a problem if it is powered via battery. since Vbat is not exposed on blip header :/
should've used a DC/DC reg. which can supply more current than what the LDO can
.. oh wait, it's not, frozen is still not working :/ I had connected only speakers and was hearing sounds, so I assumed it was working (had forgotten about this). Screen is blank, so LCD initialization did not happen
@onyx hinge Thanks for finding that! I combed the SAMD51 datasheet until I could comb no more. Never found it .
What a power house ๐ https://hackaday.com/2019/08/07/new-teensy-4-0-blows-away-benchmarks-implements-self-recovery-returns-to-smaller-form/
Time for a Feather with it and CP support? ๐
it being that MCU
Yow, 600MHz for <$20! While the branch prediction could make it vulnerable to Meltdown/Spectre type attacks, I don't envision having partitioned data on a SBC like this, so I doubt it's much of a concern.
There's also variants without flash built in but still with 1MB RAM, that would be interesting cause then you can just use external flash for both CP and the MSD
@main meteor I don't think you have to worry about memory attacks on microcontrollers that have no threading and no memory protection anyways
I mean, in a way they are vulnerable to those attacks by design without any special bugs :)
the real question is, eta for cp on that thing ๐
Sooner if we start porting it ourselves, I guess ๐
@ruby lake I've chatted with paul about it and he's interested. I'm super interested too since it's high speed usb
@main meteor please do!
Hmm, I'll have to dig up an appropriate compiler chain, and I don't think we have a ports directory for NXP iMXRT chips yet.
I suppose I can start with the compiler that's in the Teensyduino add-on.
Hmm, I can't find Teensy 4.0 support in Teensyduino.
@tulip sleet playing with the UART client -- this works OK with the ble_uart_echo_test.py example import time from adafruit_ble.uart_client import UARTClient uart_client = UARTClient() uart_addresses = uart_client.scan() if uart_addresses: uart_client.connect(uart_addresses[0], 5) else: raise RuntimeError("No UART servers found.") while uart_client.connected: message=input("enter message: ") uart_client.write(message) # get echoed response response = uart_client.read(len(message)) print(response) here is a test -- echo server running on a aparkfun nrf52840 mini ```
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-alpha.0-116-gee518b914 on 2019-08-05; Adafruit Feather nRF52840 Express with nRF52840
import ble_uart_client_test
enter message: yay
b'yay'
enter message: it works
b'it works'
enter message: how about a long message - over 20 buytest
b'how about a long message - over 20 buytest'
enter message:
@solar whale thanks for verifying on other than just my own test program ๐
@main meteor @stuck elbow looks standard arm to me. https://github.com/PaulStoffregen/cores/blob/master/teensy4/Makefile
it's cortex-m7
the example in uart_client.py needs some updating ๐
I just pushed a new working version to dhalbert/circuitpython branch ble-pairing along with dhalbert/Adafruit_CircuitPython_BLE branch pairing. I know this works with the RGB test programs
by the way, openmv has micropython running on cortex-m7
OK - thanks -- I'll update
there are some doc updates but maybe not done yet
np
but please do point out doc issues, since it saves me review time ๐
@tulip sleet ok -- updated CP and BLE -- stil works with my uart test ... will try more
and the CTS demos still work!
Hi, when I try to run the circuitpython code below for an i2c of vcnl sensor and crickit robot on feather m0 express it gives me an ''SCL in use" error. Do you have an idea about how can I fix that?
import time
import adafruit_vcnl4010
import board
import busio
from adafruit_crickit import crickit
i2c = busio.I2C(board.SCL, board.SDA)
while not i2c.try_lock():
pass
print("I2C addresses found:", [hex(device_address)
for device_address in i2c....
When you import the crickit library, it sets up the I2C bus:
https://github.com/adafruit/Adafruit_CircuitPython_Crickit/blob/master/adafruit_crickit.py#L382
So when you try to do it again with:
i2c = busio.I2C(board.SCL, board.SDA)
It hits that error since the pins, both SCL and SDA, are in use. It only mentions SCL since that's the first one it tries to use.
Also, you don't need to worry about doing the lock and the scan. So change all this:
i2c = ...
@slender iron I managed to get the IL0373 B/W display working.
It involved a change to start sequence (panel setting command data) and changing the write_black_ram_command to the correct command for the B/W mode.
Can i assume the display is B/W if the user doesn't pass third_color?
Should the default background color be black or / white?
Firstly, thaks for the quick response!
I inverted the code into the way you said, now I am getting the same error
but for SDA.
Error:
Traceback (most recent call last):
File "code.py", line 7, in <module>
ValueError: SDA in use
Code:
import time
import adafruit_vcnl4010
import board
import busio
from adafruit_crickit import crickit
sensor = adafruit_vcnl4010.VCNL4010(board.I2C())
#i2c = busio.I2C(board.SCL, board.SDA)
#while not i2c.try_lock():
pass
#i2c.unlock()
#sensor = adafru...
The Giant Board is 100% funded!
https://www.crowdsupply.com/groboards/giant-board
But is this art? ๐ค
There's an underlying problem that the Crickit library doesn't use board.I2C(). It creates its own I2C object:
That should be fixed. In the meantime you can do this:
i2c = crickit.seesaw.i2c_device.i2c
and then use that i2c object for the VCNL.
oh, yah. good catch. thanks @dhalbert
@deryakitis here you go:
Adafruit CircuitPython 4.0.2 on 2019-06-27; Adafruit Feather M4 Express with samd51j19
>>> import time
>>> import adafruit_vcnl4010
>>> import board
>>> import busio
>>> from adafruit_crickit import crickit
>>> sensor = adafruit_vcnl4010.VCNL4010(crickit.seesaw.i2c_device.i2c)
>>> sensor.ambient_lux
296.0
>>>
@yesnoio I don't have a lot of time until the beginning of September, but I'm interested in helping with this effort.
I'm preeeeeeetty sure it got ripped out of (or at least disabled in) CircuitPython, but MicroPython ships ujson as a C module. YAML is technically a superset of JSON, so if this was implemented as a C core module, you've got something of a start to base off of: http://docs.micropython.org/en/latest/library/ujson.html https://github.com/micropython/micropython/blob/master/extmod/modujson.c
That said.... YAML is a finnicky, (in my opinion overly) flexible beast and trying to port PyYAML ...
@subtle sun ya, I'd assume black/white without third_color or whatever it gets called
OK, Scott. I addressed the issues above. You now pass in an adequately large bytearray. Exceptions raised if it's not a bytearray or if it's not big enough.
if you issue a pull request https://github.com/adafruit/Adafruit_CircuitPython_SD/pull/19 and then make some changes (added dynamic CRC) like a reviewer suggested.. How do I make it so my new "adafruit_sdcard" is the one that is pulled?
The issue is that Samsung EVO 32GB cards require all command codes to have a valid CRC. I used https://github.com/hazelnusse/crc7/blob/master/crc7.cc to calculate all CRC codes and it is now wo...
and how do I make it so my old pull request changes are gone from my branch.. I want to like cancel the changes and use my new file as the changes against the master branch
do I need to destroy my fork of it.. and then refork it and push my changes?
rebase interactively against the master and remove the previous commits, and then push -f
is that doable via the web gui?
I don't think so
doh..
something like git rebase -i HEAD~5 and follow the instructions
you can remove commits, squash the changes into one commit, etc.
I'm totally new to all this.. so I only have the web setup so far
then how do you test it?
I create a fork via the web gui.. then download zip of the lib.. then make changes/ test on my board.. then upload changes to my fork.. and do a pull request
Once I get this change finished.. then I am going to make a linux VM and do my stuff there the "proper way"
@tannewt how to get this to re-try travis ci with the new commits on master for #2042? I re-ran the build after you merged 2042, but it failed in the same way which is unexpected...
@swift arrow just make a clone instead, that is much more comfortable
@swift arrow I use @idle owl's great Learn Guide as a quick ref when doing git things: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
it doesn't cover rebase'ing, but I would argue that's an advanced use so probably not apropos for that guide
@stuck elbow a clone instead of a fork?
a fork and then do a clone of your fork to your local machine
you already have a fork, so just clone it, that guide should help you
@slender iron Iโm pleased to see stuff like this works in CircuitPython: ', '.join(('{:>6.2f}'.format(a) for a in accel_vals))
@pearl notch thank micropython for that!
Ah, noted!
On my ever-growing list of "ugh, one day I will make time for contributing this" stuff, I'd love to add PEP-498 to CircuitPython (or upstream since they've discussed it https://github.com/micropython/micropython/issues/2415) - https://www.python.org/dev/peps/pep-0498/
@pearl notch That'd trim your example even further to ', '.join((f'{a:>6.2f}' for a in accel_vals)). Code golf! ๐
Yeah, f strings would be great. I did discover they arenโt implemented.
Hey, all, Iโd love comments on this accelerometer to LEDs example, before I make a video explaining it. https://github.com/dcbriccetti/Adafruit_CircuitPython_CircuitPlayground/commit/3398b29cb8b844f0f6b4d27b656b8585933001e0
(I force-pushed and modified the link.)
Thanks for poking at this problem! Looks like the non-AudioIO builds are unhappy. Likely you'll need to add an #if check somewhere.
I wouldn't raise this here because it is called outside of the VM potentially which will crash. Could we just rely on the enable check? Another option is an assert but I'm not actually sure that we compile them in at all.
@jepler We'll need to either rebase or merge it in. (I'm sure we'll need to rerun make translate too.) We both should be able to push to the original branch from our local git. If we can't, we can always make a new branch.
I just heard about the new Teensy 4.0 board, and the first thing I thought was "this board needs circuitpython"
I wish I had more specific information , but I am getting repeated Hard Fault crashes to Safe mode on a PyPortal with the current Master.
You are running in safe mode which means something unanticipated happened.
Looks like our core CircuitPython code crashed hard. Whoops!
Please file an issue at https://github.com/adafruit/circuitpython/issues
with the contents of your CIRCUITPY drive and this mess...
just to be sure, I recloned the CP repo and rebuilt sot remove the "dirty" buult -- it was not getting the correct tag for tinyusb. rebuilt and still have same crashes
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
You are running in safe mode which means something unanticipated happened.
Looks like our core CircuitPython code crashed hard. Whoops!
Please file an issue at https://github.com/adafruit/circuitpython/issues
with the contents of y...
here is another way to trigger the Hard fault:
Hard reset:
run slide show:
import os
import board
import busio
import digitalio
import storage
import adafruit_sdcard
from adafruit_slideshow import PlayBackOrder, SlideShow
""" If you want to use an SD card to store the images: """
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = digitalio.DigitalInOut(board.SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/s...
my travis build is failing with..
************* Module adafruit_sdcard
C:484, 8: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
R:459, 4: Method could be a function (no-self-use)
hmmmm
@swift arrow The second one, give it a @staticmethod decorator should fix it up. First one... which version of pylint are you using?
I cleaned it up.. trying again ๐
omg 1 failure..
C:484, 4: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
umm.. looks like 1.9.2
to make my function generic I need it..
for i in range(len(message)):
Wohooooooooooooooooooooo!! it passed this time ๐
@idle owl I need to read your learn guide on contributing and github
Hm I am puzzled by the errors in my pull request ๐ฆ
/tmp/cc0uBCYs.lto.o: In function `run_background_tasks.part.0': <artificial>:(.text.run_background_tasks.part.0+0x68): undefined reference to `audiosample_get_buffer' <artificial>:(.text.run_background_tasks.part.0+0x17e): undefined reference to `audiosample_reset_buffer'
Adding the line audio_dma_state[dma->dma_channel] = NULL; in audio_dma_stop causes this link error in run_background_tasks.
It sort of looks like the guard on the call to audio_dma_background in background.c is not right
+ #if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO
audio_dma_background();
``` seems more like it
@devoh it's advising you to use this https://docs.python.org/3/library/functions.html#enumerate
Oh oops I was scrolled up
testing plan: buildng all satmel-samd boards, making sure audio still works on the cpx I have handy
audio still works so that's good (no surprise there), and all boards building so far
another example is the new Wake Up light demo https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/PyPortal_Wakeup_Light
It runs fine after a hard reset, but crashes to Safe Mode if restarted after after a soft reboot.
@slender iron after your comment on "translations may not have full coverage" on AAE tonight, i immediately thought about writing a translations_coverage.py. should be simple enough. just not sure of its actual usefulness, and where the info would "live".
@onyx hinge question: would it be normal for a wave file downsampled from 16K/16bit signed to 8K/8bit unsigned, to sound...crunchy? according to the actual values, i've got mixer voice working for 8K/8bit correctly (or close). but the audio sounds horrendous.
@raven canopy I would expect it to be "not too bad". There might be a little more static hiss or less clarity, but ... "crunchy" or "crackly" seems like a bug waiting to be found and squashed
๐ฆ that's what i was thinking too. thanks for the second opinion!
another sad point: i'm testing with a piezo ๐
Is jerryn = jerryneedell on github?
yep
hmm -- I get the same behavior with CP 4.1.0
correction to now deleted post... I cannot reproduce this issue with CP 4.1.0
@onyx hinge yup ==
Hi @turbid radish. @tulip sleet says to send you newsletter material. I have a video: https://youtu.be/eNpPLbYx-iA
Thanks in advance.
I walk you through a program that maps Circuit Playground Express acceleration values to colors. x, y, and z acceleration components map to red, green and bl...
Running some diagnostics this looks like a crash due to memory fragmentation. I believe this is due
to having 'import' statements scattered throughout the code. If all imports are placed at the top of the Python script things seem to run OK. i.e.:
import board
import digitalio
import time
from adafruit_debouncer import *
import neopixel
import os
from DiscJockey import *
import pulseio
In addition to helping memory management, this is just good Python programming practice....
ok -- much simpler example
import board
import displayio
import terminalio
from adafruit_display_text import label
display = board.DISPLAY
# Set text, font, and color
text = "HELLO WORLD"
font = terminalio.FONT
color = 0x0000FF
# Create the tet label
text_area = label.Label(font, text="HELLO WORLD", color=0x00FF00)
# Set the location
text_area.x = 100
text_area.y = 80
# Show it
display.show(text_area)
runs ok after hard reset
crashes to hard faul...
@raven canopy it would to have a sort of dashboard for it. I wonder if we need to have a string freeze step for releases though so translators have a chance at 100%
Happy CircuitPython day everyone!
I went ahead and just made the function return early if the argument is out of range.
The linker error that travis found is a little weird, because it concerns an undefined symbol that I didn't undefine or add references to, inside a function that I didn't modify. That said, the fix I found and which is now reflected in this PR is to change one #if-guard, and add a second, that is keyed off the CIRCUITPYTHON_XXX defines for audioio and audiobusio, instead of the rather dubious (but battle-tested!) condition that was formerly there.
I've got a stable release deployed. I cloned the community bundle, then successfully did the git submodule add ... command. Now I'm stuck. the command that @tannewt used in the picture of the last page of the sharing guide doesn't work (not sure where the build-bundle.py is located). Then I tried circuitpython-build-bundles --filename_prefix circuitpython-community-bundle --library_location libraries --library_depth 2 from the bundle's readme, but I get a `Permission denied: 'C:\Users\y...
@plucky flint is the desktop pypercard working ontop of kivy?
that's so cool
Happy CircuitPython day ๐
@marble hornet yes it is ๐
Which means it should work anywhere Kivy does (i.e. on Windows, OSX, Linux, Android and iOS)
nice! i played around with kivy when i was first learning python. i forgot it works on phones. and now cp?
And if it can sync with the efforts already done in CircuitPython for the Choose Your Own Adventure blog post, then I think it's a very helpful tool for folks learning to code (familiarity across platforms etc...)
Nope... not on CP. That's a different display system
Quite... but I like fitting cool stuff into small spaces. No bloat etc... makes you concentrate on the essentials (expressed simply)
All feedback most welcome too..!
Right now it's just a sort of a hack / shim. Needs much more testing and user feedback for it to reach its potential
@plucky flint Heya, checked out the project, looks sweeet. I'm going to play with it and maybe port to PyPortal if I have time...there's a mega pyportal on my desk rn ๐
But Hypercard... that was a stroke of genius remembering that stuff. ๐
Awesome
@prime flower please don't hesitate to shout if you have feedback or suggestions
Oh I will!
Interesting use of Kivvy though, I looked at it when I did a very strange Capstone project in PyQT and was comparing frameworks
That's the spirit. I'd love for folks to be able to run the same (or very similar) code on all sorts of fun devices, with Python being the lingua franca
I've never used Kivy before now... my choice was simply down to the cross platform nature of it.
I've been looking at app framework to see how i can improve mine but have been unable to find documentation for writing hypercard apps, i;m curious about the object location specifiying. know here it is?
Mu is, of course, PyQT. But that only works on desktop systems.
@plucky flint we were actually talking with Kasia after the EP workshops that most people don't really need a programming language, they need an environment that lets you make use of their computers, and we've given hypercard and excel as examples
@marble hornet not sure what you mean
@plucky flint and then the next day you announced pypercard
@timber mango yes... that x 10000
Great minds think alike (or fools seldom differ). ๐
Hahahaha... funny you should mention muds. I'm writing one at the moment (a cleaned up and enhanced version of the one I did for PyWeek) ๐
@plucky flint you know about http://worrydream.com/#!/SeeingSpaces ?
Bret Victor has been provided by the management for your protection.
Also, Minecraft is digital lego. I've seen almost 100 kids reduced to stunned silence when a buddy (Martin O'Hanlon) demonstrated "how to build a house" and called the function 100s of times to instantly build a city. ๐
I know of Bret Victor, but haven't looked into what he's been up to for perhaps 18 months or so
this one is old
it's about augmenting physical making spaces
a debugger for the real world, if you will
Aha... OK. I really liked his talk he did when he role-played an engineer from the late 1960s
Oooh... that's cool
yeah, that was great, so many hidden references
Does the debugger work on politicians..? We could do with such a thing over here in the UK. ๐
that's a solved problem
(The one thing all British people can agree upon right now, is that our politics is broken)
OK... so that ASCII art is rather funky
I'll take a look later... I have a meeting starting in 45 mins and I need to prep for it.
thanks... best wishes to Kasia too..!
thank you
@idle owl just watched your PyOhio keynote - OMG soooooo good! Iโve been coding for a long time, and the imposter syndrome still resonates so strongly for me that I cried while I watched it. THANK YOU for being so open and real about your experiences! Sharing the video with a couple women Iโm mentoring.
@minor plume You're welcome! Thank you so much for sharing your experience! So glad to hear your mentoring. Thank you for sharing the keynote with others!
@idle owl I was invited to be part of a panel discussion about imposter syndrome a few months ago. The day of the panel, my brain weasels were saying โreally, what do YOU have to say about imposter syndrome? Who do you think you are?!?โ ๐๐ข
Brains are ridiculous sometimes.
@minor plume They are ridiculous sometimes, indeed. I understand entirely.
I'm not disagreeing with (non conditional) imports at the top but shouldn't running out of memory give a MemoryError exception?
@marble hornet Let me know how it goes, I'll (or you can) refresh the travis build on the PR and check it out
Adding PyPortal Titano to CircuitPython with SPI display.
This PR clears the tilegrid tiles when a new terminal is created. Fixes old data from appearing when the terminal is initialized, specifically on larger displays.
I think this is copy pasta from a previous board, and should probably be removed. The same comment is in:
pyportal/mpconfigboard.h
itsybitsy_m4_express/mpconfigboard.h
pybadge/mpconfigboard.hpybadge_airlift/mpconfigboard.h
Only saw stray comment. Not worth another push -- I can fix in some other PR.
Thanks for spotting that, resolved in 5a884d
I wondered if this was related to #1913, but since it is only for CP5.0 and so far on PyPortal, I think it may be a different issue. If anyone has a PyPortal with CP 5.0 installed, it would be nice to have a confirmation using the short test in the previous message.
Does anyone know of an example of sending I2C data inside of board_init()? I'd like my boards firmware image to configure an external I2C device before user CPY starts executing, but so far have only gotten to the stage of a compiled UF2 which immediately crashes.
@prime flower tagged it on master but am not sure if that will filter down to the sub? I'm on my phone but am more than willing to help later tonight
Although: if you don't mind refreshing it please do
This keyboard test (and other programs) have run on my PIRKEY_M0 for a long time and also work under CP 4.1.0 but now fail under CP 5.0
Is there a known change needed?
I realize the PIRKEY is not really supported, but I suspect this an issue with HID support in general.
# Simple NEC remote decode-and-type keyboard example
# When used with the Adafruit NEC remote will act like a keyboard and
# type out keypresses.
import adafruit_irremote
from adafruit_hid.keyboard import Ke...
@marble hornet Refreshed, the issue persists
I can't use a terminal on an iPhone but I could share editing access...
If that helps for diagnosis
Sorry - I should have made my comment clearer. MemoryError exceptions are what I was seeing when I was doing the requested testing using the 4.0.1 release. I did not test with the beta version the issue was reported on. The error occurs at line 96, which is the DiskJockey import statement.
hiya <@&356864093652516868> CircuitPython Day stream is under the way on YouTube and Twitch. check #live-broadcast-chat for details and to hang with the rest of the audience!
CircuitPython day - Changing Lives through Open Source, Passion and Mentoring @idle owl @river quest #adafruit @circuitpython #circuitpython-dev #circuitpython-dev https://youtu.be/kgTApb8f2L0
lol that demo, it makes a squawk when it starts. Do you know what that does to someone who has seen lots of things explode on the bench? ๐
@slender iron How serious were you about rust modules in circuitpython? It intrigues me. Is there something simple I can try to build functionality wise so I can try out the logistics?
Giving a friend a first taste
The good news is, he loved it and got to take the CPX home. The bad news is, I can't find my other CPX now ๐ฆ ๐ฆ
I have made some tweaks to circuit python (really just a small pet pev), and have a merge request ready to go for circuit python. Is there any check list of things I should check before I submit?
@cerulean sparrow just my personal checklist: basic adherence to the style of circuitpython code, and depend on the "travis" checks after your push for finding out whether there are problems with the build..
If changes are required, we will work with you on what they are, and you'll have a better idea for next time
@cerulean sparrow thanks for taking the time to make CircuitPython better!
Is there any documentation on the travis checks? I have no experience with it.
@cerulean sparrow basically, travis will build every board and do a few other checks. Within your pull request, it will later say whether travis thought things were OK or not, and if not you can go look at its logs and (with help) interpret what changes are necessary.
Does github do that? or do I need to run that?
so, for instance, I made some changes to audio recently, and travis caught that it adversely affected boards with no audio support at all
it happens automatically. Once you've submitted your pull request, it will appear in a section about "checks".
Here's the general section of a pull request I'm talking about
I've added dithering to the OnDiskBitmap since the display on the PyPortal is only 16bit color you can see banding of 24bit color images. This banding is very visible if there is a gradient in the image. Since memory is so constrained I have applied a perlin noise to the LSB of the bitmap data after is has been read.
It seems like the shifts and masks must be related somehow, but yet the masks are hard-coded.
I've added some review notes and requested some minor changes. Reviews are conversations, so if anything I've suggested is based on a misconception, please correct me. Thanks again for your first pull request, it's great to see new people getting involved with CircuitPython!
By using uint8_t instead of int for the table type, 768 bytes of flash would be saved. Flash space is at a premium on many circuitpython devices.
What if you assigned randb/randg/randr all 0 when "no dither" is selected? This would improve code size, but possibly slow down the !dither case a little bit. Does the slow-down matter?
@cerulean sparrow if you have some comparison images you can attach those on github or share them here, so we can get a better idea of the improvement your change makes. I guess you chose perlin noise because it doesn't have any excess RAM usage, vs traditional dithers like floyd-steinberg which requires at least one row of pixels extra?
Will common_hal_displayio_ondiskbitmap_get_pixel be called on every pixel in order as well, or could there be cases where calls would be done out of order and/or clipped?
Just to comment, the PyBadger library is so much better than doing it by hand like in the other tutorial.
I'll be wearing mine in an exclusive science and tech conference next weekend. (CONCITES in Limon, Costa Rica, in case someone is around)
And to celebrate CircuitPython day (still is in my timezone), I'll be talking a little bit about it in the conference, and it's advantages in the field.
Is this likely an issue with the adafruit_hid library or with something in the core? Since it seems to be related to something in 5.0 I assumed it was due to a change in the core.
Hello again. I can't stress enough, if you would like help implementing any of these suggestions, we want to give you that help here or on the circuitpython discord.
First off, the thing where there are two "Travis CI - Pull Request" is a bit weird, pay attention to the failed one, not the one that still says "Queued - Build Created" 8 hours later. Travis is great, but sometimes things go a little weird.
There are some travis failures, here's a typical one:
Build metro_m0_expres...
@silver tapir That's great to hear! Thanks for letting us know!
After a little more than a year, I am happy to announce that my code has at last made its way into an official uflash (pronounced microflash) release - 1.3.0!
https://pypi.org/project/uflash/
https://github.com/ntoll/uflash
I'm now trying to learn about writing vim plugins in python (something that's been on my mental todo list for a while) with the intention of creating a plugin to simplify working with the microbit from within vim.
@tulip sleet i think i figured out how:```class pho_module():
def __init__(self, file_path):
d = {}
exec(open(file_path, 'r').read(), d)
for key in d:
if type(key) == str:
setattr(self, key, d[key])
del d, file_path
namespace = pho_module('smoopsy.py')
print(dir(namespace))```
once i clean up the html colors i'll formalize this and a few other things and make a tools module
Confirmed that the test above fails using CP 5.0. I'll see if I can get my JLink hooked up to the PyPortal and get some stack(s).
I've looked at this more closely and am worried it won't work for any arbitrary area. I looked at your Python library on top and it's going row by row to output to a bitmap.
Let's embrace that specific scenario and reduce the api down to fill_row where it's given a y and an array of 16bit values that is width long. Also check that the display has a 16 bit colorspace and raise an exception otherwise.
The rows_per_buffer section can all be simplified away because we're only doing one ro...
I would recommend using mp_get_buffer_raise to get the buffer and its size, then you don't need all those functions for accessing the array elements, etc.
<@&356864093652516868> this looks a lot an airlifted metro, any chance circuitpython runs on this? https://store.arduino.cc/usa/nano-33-iot
This small, robust and powerful board has WiFi and Bluetooth connectivity that combined with its low power architecture makes it a practical and cost effective solution for your connected projects.
Arduino Nano
it might technically be possible. SAMD21, with NINAfied ESP32 over SPI. but, it has no external flash, so it would be severely limited on usefulness.
Thanks. Interesting. I missed the missing flash
if you have a Trinket M0 and the AirLift breakout handy, that would be an equivalent to test viability.
looks at desk, sees both. ponders the effects of further task saturation. ๐
:-p
Well, @raven canopy while you're consdering that... ๐
I have a "guidance question" for the group
We have a device based on a Trinket M0 (no, I cannot retarget to a SAMD51 - I wish I could)
We would like the ability for users to edit a config file on the device. Right now, I have a parser for "INI Style" files included in the code
It works.... until it runs out of memory
So if they go beyond basic configurations, it fails and it doesn't fail "pretty". It failed randomly as the GC chooses to run
SO.....
We have a couple options:
- Switch to Arduino & use TinyUSB to read the config file. This is pretty bleeding edge, but should solve the memory issue.
- Switch to a method of config file that doesn't require us to parse so many strings (which is where I think the issue is).
The code just looks for combinations of switch presses (long presses, too) and sends keystrokes & mouse movements.
I am thinking that I will try #2 first (I like the idea that end users could edit their own devices using the devices). I'm thinking about using Python as the "config language"...but it's not easy to think though how to do that.
Any guidance/thoughts would be appreciated.
thanks
@tough flax there is some space to be had in SettingsParser.read(). a quick "trimming" looked like this on a feather m0:
>>> gc.collect()
>>> gc.mem_free()
20528
>>> lines = ["[common]", "1 SPACE", "2 ENTER", ";foo"]
>>> for line in lines:
... parts = line.split(";", 1)
... value = str(parts[0]).strip()
... if (value == ""):
... continue
... if (value[0] == "[" and value[-1] == "]"):
... modeName = value[1:-1]
...
>>> gc.mem_free()
19152
trimmed:
>>> gc.collect()
>>> gc.mem_free()
20528
>>> lines = ["[common]", "1 SPACE", "2 ENTER", ";foo"]
>>> for line in lines:
... if line.split(";", 1)[0].strip():
... if (line.startswith("[") and line.endswith("]")):
... modeName = line.strip("[]")
...
>>> gc.mem_free()
19328
and to show that it still works:
>>> for line in lines:
... if line.split(";", 1)[0].strip():
... if (line.startswith("[") and line.endswith("]")):
... print("original:", line)
... print("stripped:", line.strip("[]"))
...
original: [common]
stripped: common
trimmed version isn't as readable and Pythonic, but desperate times... ๐
Yeah, we can probably shave off 1K or so. I think we're still in a place where the split(), strip() etc are allocating strings everywhere
And you're GC'ing... we can do that after the load I suppose, but with fragmentation, I'd rather never allocate those
could be. i almost compared to regex, but trinket doesn't have it.
Yeah, I thought about JSON, but there's no room
TOML isn't any better vice INI either. ๐ฆ
I think putting it in Python's probably the right answer... but how do you make a Python imported file easy to edit?
I mean for a non-programmer to change w/o blowing things up
just make it a dict (key-pair) and exec/eval it?