#circuitpython-dev

1 messages Β· Page 273 of 1

plucky flint
manic glacierBOT
#

It's probably not the whole story, however, this fixes a crash observed when bulk copying data to an nRF board using dd.

Basically, the call stack looked like this when resetting into safe mode:

    #0 reset_into_safe_mode reason=reason@entry=GC_ALLOC_OUTSIDE_VM
    #1 gc_alloc
..  #4 external_flash_write_block
.. #11 usb_background
   #12 run_background_tasks
   #13 common_hal_neopixel_write
.. #18 start_mp

i.e., during early startup, it is not okay yet to call alloc...

manic glacierBOT
onyx hinge
#

yay I finally got a crash during i2s audio

manic glacierBOT
#

I reproduced a crash using a frequency of 727. ```#0 reset_into_safe_mode (reason=reason@entry=HARD_CRASH)
at ../../supervisor/shared/safe_mode.c:84
#1 0x0004373c in HardFault_Handler () at supervisor/port.c:168
#2 <signal handler called>
#3 i2s_buffer_fill (self=0x20008700) at common-hal/audiobusio/I2SOut.c:143
#4 0x00008000 in ?? ()

Somehow, rather than copying 22 bytes and stopping, the copy runs past the end of memory and hard crashes:
```139             uint16_t *bp...
manic glacierBOT
tulip sleet
#

/ afk for 1.5 hours or so

onyx hinge
#

It's kind of danh to say "good catch" when I wrote the bug in the first place

tulip sleet
#

we try to be nice to each other πŸ™‚

onyx hinge
#

I appreciate it, just basking it for a minute πŸ˜€

onyx hinge
#

I reproduced something similar to the "after done with audio, it crashes some time later" bug. If you don't stop an audio instance, but delete, it, bad things happen because the background task keeps running: ```audio = audiobusio.I2SOut(bit_clock=board.D6, word_select=board.D9, data=board.D10)
audio.play(sine_wave_sample, loop=True)
del audio

#

what SHOULD stop this? Should a "deinit" call happen (common_hal_audiobusio_i2sout_deinit) ?

manic glacierBOT
#

Testing performed: on an nrf52840, ran the following test which crashed reliably before the finaliser change:

import array
import audiobusio
import audiocore
import board
import time

sine_wave = array.array("H", [0] * 24)
audio = audiobusio.I2SOut(bit_clock=board.D6, word_select=board.D9, data=board.D10)
sine_wave_sample = audiocore.RawSample(sine_wave)

audio.play(sine_wave_sample, loop=True)
time.sleep(1)
del audio
time.sleep(1)
import gc
time.sleep(1)
gc.collect()
...
onyx hinge
#

ok, last(?) problem: 8-bit and 16-bit samples don't play at the same rate. hm.

onyx hinge
#

Is it possible that MAX98357A doesn't support 8-bit samples?

#

in 8-bit mode, which is not listed as a supported resolution, BCLK is 16x LRCLK

manic glacierBOT
#

MAX98357A requires samples be 16, 24, or 32 bits. A sample of 8 bits won't work properly; due to a bug they are currently played at double the frequency and sound is produced by the breakout; after fixing the bug the waveform is correct, but no sound is produced.

Besides that, even common 22050Hz and 44100Hz samples are technically out of spec, but do seem to work (only 8, 16, 48, and 96kHz +- 5% sample rates are permitted per the datasheet)

![image](https://user-images.githubusercont...

meager fog
#

@onyx hinge you'd need to padd 8 bit samples?

manic glacierBOT
meager fog
#

I2S tends to be specific about how many clocks you have before an LRCLK

#

its like 16, 24 or 32

onyx hinge
#

@meager fog 8 works on UDA1334 but not MAX98357A

onyx hinge
#

let me look at what samd is doing

meager fog
#

yeah i think thats out of spec...

#

also UDA is discontinued 😦 😦 😦

onyx hinge
#

bummer

#

I thought the theory of i2s was that any number of sample bits could be supported, thanks to the LRC

#

or .. something like that

#
        serctrl |= SERCTRL(DATASIZE_8C);
        clkctrl |= I2S_CLKCTRL_SLOTSIZE_8;
``` superficially it looks like m4 might send out 8 bit data too, I'll have to scope it to verify though
manic glacierBOT
onyx hinge
#

where's an m4 board besides the one I fried on friday? rummages through the piles

meager fog
#

odd ive never used slotsize 8

onyx hinge
#

I guess a CPX will work M0 and M4 are sharing code there

meager fog
#

huh looks like its valid according to the spec

#

but....MAXIM may not permit it

#

😦

onyx hinge
#

yeah I am pretty sure the datasheet excludes 8 bits

#

I'm pretty sure it also excludes 22050 and 44100Hz samples, but those DO work

#

probably affects how the digital filter works or something though

meager fog
#

yah

#

not sure a solution other than adding a "8 pad to 16" option

onyx hinge
#

the main downside is extra memory allocation

#

m0 DOES also use 8 bit samples on the i2s bus

#

if the only i2s dac you can continue stocking has this problem, it indicates that maybe padding to 16 bits should always be done

#

I will file an issue and put it on my basecamp

#

@meager fog does that work for you?

meager fog
#

@onyx hinge yep

manic glacierBOT
#

In theory, I2S works transparently for any number of sample bits. However, for MAX98357A, 8-bit samples are out of spec and appear to produce no audio!

After a discord discussion, we have decided to add padding so that 8 bit samples are extended to 16 bits before being put on the i2s bus.

Since the other I2S DAC, UDA1334 is discontinued, this should either be done all the time, or if it is not much work to do it optionally, it will default to enabled. This gives a better user experien...

onyx hinge
#

meow! time for a break!

plucky flint
#

Umm... is there a meeting today..? I've not seen the usual announcement.

onyx hinge
#

@plucky flint yes , let me dig the link up

slender iron
#

@plucky flint yup!

plucky flint
#

Aha... cool. Thanks. πŸ‘

onyx hinge
#

Here is the notes doc for tomorrow's meeting: https://docs.google.com/document/d/1TuHZGiIFaJoudoecozZjlu0P7LEzi64EXh7w9L7CevE/edit?usp=sharing <@&356864093652516868>

slender iron
#

I forgot to ping with my post over the weekend. sorry!

onyx hinge
#

I swear I saw it but maybe it was the adafruit email...

#

(which is where I found it)

slender iron
#

I did post it. I just forgot the ping

idle owl
#

@onyx hinge Editing a post to add a tagged person or group does not ping them. It will highlight the post, but it does not send a notification. FYI.

onyx hinge
#

@idle owl hm I was hoping that would make it appear in their recent mentions but that does not seem to be the case. I'll not try to get sneaky next time

#

and of course by now that is TODAY'S meeting

manic glacierBOT
#

Now, the error is

Build pirkey_m0 for zh_Latn_pinyin took 11.79s and failed
make: Entering directory '/home/runner/work/circuitpython/circuitpython/ports/atmel-samd'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.

-8 bytes free in flash out of 188160 bytes ( 183.75 kb ).
26000 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).

Too little flash!!!

The main option now is to do as @deshipu suggested and do not...

onyx hinge
#

iayanpahwa has been working hard on this, it's too bad even such a simple change ends up with consequences and trade offs like this.

slender iron
#

that's reality of perpetually adding code to something. at some point it fills up

manic glacierBOT
solar whale
#

@idle owl sorry, I can’t make the meeting today. Group hug!!

idle owl
#

@solar whale Added to notes!

idle owl
#

Be back in a bit.

ivory yew
#

lurking/offline today

onyx hinge
#

@ivory yew πŸ‘‹

errant grail
#

lurking today

plucky flint
#

(semi-lurking... I have to leave in 30 mins to pick up my son from his dojo)

turbid radish
#

We'll look to start soon

#

The other Adafruiters are finishing up

gilded cradle
#

@plucky flint, should I put lurking then or will you be talking?

plucky flint
#

I'll be talking until half past the hour (then I have to leave)

gilded cradle
#

Ah, ok

plucky flint
#

(sorry)

gilded cradle
#

It's all good. I just wanted to mark it correctly in the notes

plucky flint
#

These meetings are always at dad-taxi rush hour πŸ˜‰

river quest
slender iron
#

running a little late because my internet blipped

sterile bronze
#

lurking

plucky flint
#

Cornucopia --- or is it CornucoPya..? πŸ˜‰ (sorry -- again)

tidal kiln
#

** lurking **

turbid radish
bleak tiger
#

lurking

ruby atlas
#

having audio issues, brb.

turbid radish
#

It's all about that bass, that bass

onyx hinge
#

huh no "treble clef" emoji or unicode !?

plucky flint
#

🎼

onyx hinge
#

oh I just don't know what the unicode character is called

#

𝄒 \N{MUSICAL SYMBOL F CLEF} U+1d122 𝄒
π„ž \N{MUSICAL SYMBOL G CLEF} U+1d11e π„ž

plucky flint
#

:tuba: πŸ˜•

manic glacierBOT
onyx hinge
#

nobody remembers radio

river quest
#

CircuitPython 5.0.0 Beta 0 released!
This is release 5.0.0 beta.0. Beta releases are largely feature-complete, but are meant for testing. Use the latest stable 4.x release when first starting with CircuitPython. When you find a bug please check the current known issues and file an issue if something isn't already known. 5.0.0 is the latest major revision of CircuitPython. It features many improvements and enhancements to displayio, including grayscale OLED and e-paper displays, extensive additions and changes to BLE support, support for the STM32F4 and Sony Spresense microcontrollers, and PWM audio support. Downloads are available from circuitpython.org! The site makes it easy to select the correct file and language for your board. The downloads page is here:
https://circuitpython.org/downloads

#
Adafruit Industries - Makers, hackers, artists, designers and engineers!

WIRED Magazine had a β€œOur Favorite 25 WIRED Covers of All Time” feature, so! here are ours (pictured above). Ladyada (no surprise there), Ayah, and most recently – Nimo. WIRED _ha…

plucky flint
#

Yeah... these are all over the UK at the moment.

river quest
#

"it blew people’s minds to see how easy circuitpython is to use."
https://twitter.com/no1089/status/1198081568922722305

@adafruit gave us all Edge Badges running @circuitpython (it blew people’s minds to see how easy circuitpython is to use), with @tannewt there to tell us all about development.

I spent time with my cousin, which was fun! (@dammitcoetzee)

#

Nice post up at Embedded Computing Design:
"...it was especially neat to run into Scott Shawcroft, who was introduced as pretty much being β€œCircuitPython,” the language that’s used to program the Adafruit Edge Badges that we received. These badges are conveniently set up so that when plugged in you can open up the program as a text file and make modifications."
https://www.embedded-computing.com/guest-blogs/hackaday-superconference-2019-an-incredible-collection-of-people-and-tech

The badges were, of course, a huge focus of the conference, with an entire area set up primarily for badge hacking. While I participated only minimally, this, as well as other activities looked like a

turbid radish
#

El grande Blinka

graceful heart
#

late but lurking.

prime flower
#

lurking today

manic glacierBOT
tulip sleet
#

let ntoll go first maybe since he has to leave

#

including status

onyx hinge
plucky flint
#

πŸ‘‹

#

@tulip sleet thanks..! πŸ™‚

idle owl
#

Blinka was the backup recording πŸ™‚

gilded cradle
#

Nice

turbid radish
#

If you're a CircuitPython fan and are not a subscriber to the Adafruit Python on Hardware newsletter,
please consider joining. No spam, your email is never sold, just one newsletter post a week with all the
CircuitPython/MicroPython/Python news, projects, and events.
Subscrive at https://www.adafruitdaily.com/ and click the Python on Microcontrollers Newsletter.

turbid radish
#

Or are you a Twitter fan? Follow @river quest and @CircuitPython for CircuitPython goodness.

onyx hinge
#

[introduce us to your dog!]

turbid radish
#

That is Ruairidh (Rory)

#

English Springer Spaniel

onyx hinge
graceful heart
#

did you design the keyboard model? sounds awesome!

onyx hinge
turbid radish
gilded cradle
#

Literally put the fruit in Bluefruit

ruby atlas
#

does food colouring stain lime skins?

onyx hinge
#
    mp_obj_type_t *type = mp_obj_get_type(self_in);
    return type->subscr(self_in, key_in, MP_OBJ_SENTINEL);
    return type->subscr(self_in, key_in, MP_OBJ_SENTINEL, self_in);
}```
#

subscr implements getitem, setitem, delitem

#

πŸ‘‹ πŸŽ‰

prime flower
#

πŸ‘‹

bleak tiger
#

Hi, I'm having trouble getting bitmap fonts to work on my
tricolor eInk. Is there anyone familiar with the adafruit_bitmap_font library that might be able to help?

slender iron
#

I did it a while back. what is the issue?

bleak tiger
#

My code works using the terminalio font in displayio, as soon as I substitute for the bitmap font the eInk refuses to refresh. (no callbacks or error messages)

#
import board
import displayio
from adafruit_bitmap_font import bitmap_font
#import terminalio
from adafruit_display_text import label
import adafruit_il0398

# Used to ensure the display is free in CircuitPython
displayio.release_displays()

# Define the pins needed for display use on the Metro
spi = board.SPI() # Uses SCK and MOSI
epd_cs = board.D11
epd_dc = board.A5
epd_reset = board.A3
epd_busy = board.A4

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
                                 baudrate=1000000)
time.sleep(1)  # Wait a bit

# Create the display object - the third color is red (0xff0000)
display = adafruit_il0398.IL0398(display_bus, width=300, height=400, rotation=90, seconds_per_frame=20,
                                 highlight_color=0xff0000, busy_pin=epd_busy)

# Create a display group for our screen objects
g = displayio.Group()

# White background
background_bitmap = displayio.Bitmap(300, 400, 1)
palette = displayio.Palette(1)
palette[0] = 0xFFFFFF
t = displayio.TileGrid(background_bitmap, pixel_shader=palette)
g.append(t)
print("white background loaded")

#Create group holding text
text_group = displayio.Group(max_size=10, scale=1, x=0, y=250)
# Set text, font, and color
text_string = "HELLO WORLD"
text_font = bitmap_font.load_font("/Helvetica-Bold-16.bdf")
text_color = 0x000000

# Create the text label
text_area = label.Label(text_font, text=text_string, color=text_color)
#text_area = label.Label(terminalio.FONT, text=text_string, color=text_color)
text_group.append(text_area)

g.append(text_group)
print("text loaded")
# Place the display group on the screen (does not refresh)

display.show(g)

# Show the image on the display
display.refresh()

print("refreshed")

# Do Not refresh the screen more often than every 180 seconds
#   for eInk displays! Rapid refreshes will damage the panel.
while True:
    pass```
slender iron
#

are you waiting the 20 seconds?

bleak tiger
#

whereabouts?

slender iron
#

the screen will wait to refresh every 20 seconds

#

(seconds_per_frame=20 in the constructor)

#

so it won't be an instantaneous change

bleak tiger
#

ok - would that be different if using the terminalio font? that seems to update quickly

slender iron
#

no, it should be the same

bleak tiger
#

testing the bitmap code now, no change on the screen

slender iron
#

it is possible that Label is swallowing an error it shouldn't

#

or if a character isn't found in the font then it won't show anything

bleak tiger
#

I've tried it with two fonts - one I converted in fontforge and the one I downloaded from the tutorial. Same result for both

slender iron
#

hrm

bleak tiger
#

I can also open both fonts using fontforge and they look ok

#

is there a way to force Label to report an error? It just seems to skip over that line

idle owl
manic glacierBOT
slender iron
tulip sleet
#

@idle owl In other guides I just changed 4.0.0-beta.1 or whatever to 5.0.0-beta.0. I didn't try to enhance the requirements sections

idle owl
#

@tulip sleet Ok, then it's fine. That's all I did as well.

#

I made everything vague enough apparently πŸ˜„

bleak tiger
#

thanks @slender iron I'll try that

#

hmm, the problem's not there. it passes through that statement 11 times (for each character I assume) with no issue

slender iron
#

hrm. I don't have the time to look right now but I can try later

#

I want to make an eink notification screen soon anyway

bleak tiger
#

no worries I'll work on the airlift side of the project for now, thanks for the help!

slender iron
#

np, sorry it didn't just work!

manic glacierBOT
#

Hmmm - it looks like I am cutting it too close on codespace. I have re-enabled i2cslave for this board because it is meant to be used as a shitty addon and the spec defines pines to use as i2c communication. That would explain why it fails here but not for trinket_m0.

Any advice/suggestion to quickly reclaim some space?

Build shirtty for zh_Latn_pinyin took 12.66s and failed
make: Entering directory '/home/runner/work/circuitpython/circuitpython/ports/atmel-samd'
Use make V=1, ma...
inland tusk
#

@slender iron During the status updates I mentioned that I was going try to convert a toy keyboard to a midi controller. My inspiration was the following instructable:

https://www.instructables.com/id/Lead-O-Lyzer-a-Midi-Keyboard-Redesigned-in-Arduino/

and the fact that I had an old MIDIMAN keyboard. I want to use a Grand Central
instead of a UNO with CP if possible.

Instructables

Lead-O-Lyzer, a Midi Keyboard Redesigned in Arduino: The Lead-O-Lyzer is a device ive wanted to make for a while. I wanted to make a device that could make musical leads and eventually be used as a midi controller. the pitch can be controlled by a ultrasonic sensor on the sid...

manic glacierBOT
slender iron
#

@inland tusk thanks!

manic glacierBOT
meager fog
#

@onyx hinge when yr around let me know what the next thing yer hackin on

manic glacierBOT
umbral glade
#

anyone here to helpme?

slender iron
#

@ruby atlas you around?

umbral glade
#

imtrying to reverse engineer a canary device i found

#

i just need to know what device i buy

#

to connect to it...

#

like uart moduel

#

module*

#

would this work ?

slender iron
#

what is the canary device? Most devices can speak UART

umbral glade
#

would the "bus pirate" be ok ?

slender iron
#

I'm not sure the bus pirate is very well supported anymore

#

do you know the logic level of the uart bus?

#

3v or 5v are typical

umbral glade
#

can u tell me a device i can order on amazon to talk to it via my linxu box

#

this is 5v

#

is this ok ?
USB 2.0 To TTL UART Module Serial Converter - SODIAL(R)USB 2.0 to TTL UART 6PIN CP2102 Module Serial Converter

lone sandalBOT
slender iron
#

@umbral glade we (those paid by adafruit) generally don't link to amazon when something from adafruit will work. For example, this cable should work: https://www.adafruit.com/product/70

umbral glade
#

id buy from anywhere u guide me to

#

i just trying to get an idea

#

im totally new to this..

slender iron
#

you can choose to buy from amazon but we won't support items not sold by adafruit

#

πŸ‘ welcome!

umbral glade
#

but this box is so interesting ... i want to take it apart and learn

slender iron
#

you may be able to find a broken one to poke at too

#

those are better than ones that are working

umbral glade
#

this box has all kinds of sensors and stuff... but it wont work anymore befcause of some cloud thing... the owner never signed out of his cloud so its not able to be used anymore

slender iron
#

ah

#

I wouldn't be surprised if you could factory reset it somehow

manic glacierBOT
onyx hinge
#

@meager fog analog in dma or i2s audioin maybe?

umbral glade
#

tannewt

#

no factory reset at all

#

i researched the manual

#

they actually made it so its not able to reset and if the cloud user isnt removed .. its basically worthless...

#

but man is it cool

slender iron
#

interesting

slender iron
#

ya, I looked at them already

meager fog
#

@onyx hinge hihi

#

i was thinking...

umbral glade
#

tannewt u think its worth me getting involved with?

meager fog
#

@onyx hinge either audioout (dac/i2s) for stm OR mp3 decode start

#

since i think mp3 is a longer term project, id like to get it started

#

i dont have a good sense of whether it will be easy or hard

onyx hinge
#

@meager fog okay I do have the stm feather coming in my next order.

meager fog
#

kool

#

for that, chat with @ionic elk

slender iron
#

@umbral glade if it's interesting then go ahead. I think you'll find that other electronics can be much simpler and easier to learn than reverse engineering

onyx hinge
#

Who can recommend an MP3 decoder lib to start with?

meager fog
#

me

onyx hinge
#

πŸ‘‚

meager fog
#

which is a hacked up version of the open source realplayer mp3 dec

#

mp3 was under patent until like a year ago

#

so there's not been a lot of dev

#

that library is very old, but is for microcontrollers

#

and does work

onyx hinge
#

I'll have a look

meager fog
#

we sorta wedged it into an arduino library, its not doing DMA

onyx hinge
#

I remember realplayer

meager fog
#

....buffering....

umbral glade
#

.rmvb movies

onyx hinge
#

I think there is some reorganization to do in the audiocore to help facilitate more audio sources

umbral glade
#

the 300mb movie days

meager fog
#

ideally the adafruit_mp3 lib would be refactored so it could be shared between cpy and arduino

#

if not, its ok to copy it in

#

but i think now that mp3 is otu of patent, its a desirable codec

onyx hinge
#

Hey @raven canopy I just remembered there were questions about clipping and overflow on audio mixer months ago. Does that still want my eyes on it?

meager fog
#

oh yeah

#

its in issues

#

if you have clipped wavefiles

#

like they were at MAXINT

onyx hinge
#

I'll toss something in Basecamp about it so I don't forget again

meager fog
#

the mixer would play something staticy

#

its been a year since i put the issue in

#

it may not be valid anymore

#

very old

#

there also may be another mp3 library we could use

meager fog
#

but we sorta ended up with this one

onyx hinge
#

I don't see where to add a new Todo in the Basecamp mobile app, hints?

#

Okay there it is

meager fog
#

k?

umbral glade
#

tannewt can i use ADAFRUIT Industries 954 USB-to-TTL Serial Cable, Raspberry PI

#

?

slender iron
#

it's a good place to start

#

I'm not sure you'll be able to do much with the canary over uart though

umbral glade
#

but the adafruit wire

#

it looked like the connecter was a solid piece

#

how would i connect it

#

wouldnt i need single probe type wires

#

wouldnt i need something like this?

slender iron
#

I'm not sure where you plan on connecting it to on the canary. the pin headers on the cable I linked to can be connected to an adapter cable usually

#

@bleak tiger I'm seeing what you are seeing. the refresh doesn't trigger if I load a custom font (not even use it)

manic glacierBOT
ivory yew
#

pirkey_m0 every time someone sends a PR ^

onyx hinge
#

🀣

#

it's the theme of the week for me

river quest
ivory yew
#

Good lord. Is that the longest one yet?

bleak tiger
#

@slender iron My first bug in CP? I feel I should celebrate! Thanks for looking

plucky flint
#

@river quest cool choice of music. I find, whenever there's anything Python-ish that needs music, it's always tempting (but probably ill advised because it's often NOT the sort of thing to go with the words of pictures on the screen) to use this music: https://www.youtube.com/watch?v=7QfqJwkuCTw #somethingcompletelydifferent

This is the complete, actual version that was used on the show from 1969-1974. Accept no other versions lol. "Liberty Bell" Performed by: Band of the Grenadi...

β–Ά Play video
#

(Although we managed to sneak it into the music module for the micro:bit... there are a number of fun Easter eggs in the version of MicroPython for micro:bit... we wanted to reward folks who poked around and explored) πŸ˜‰

manic glacierBOT
#

CircuitPython throws an error for time.struct_time(time.localtime(946688698)):

>>> import time
>>> time.struct_time(time.localtime(946688698))
Traceback (most recent call last):
  File "", line 2, in 
TypeError: time.struct_time() takes a 9-sequence


CPython is happy:

>>> import time
>>> time.struct_time(time.localtime(946688698))
time.struct_time(tm_year=1999, tm_mon=12, tm_mday=31, tm_hour=17, tm_min=4, tm_sec=58, tm_wday=4, tm_yday=365, tm_isdst=0)
plucky flint
#

Also, if you "view source" in the browser based Python editor, you'll see some ascii art and a letter from myself and Damien explaining how the editor works and where to start finding out more about Python. πŸ˜‰ I think it might still be there on the deployed site -- in any case, my fork of the project still has it: https://raw.githubusercontent.com/ntoll/PythonEditor/master/editor.html (although it's the sort of thing sensible folks tend to delete once they realise it's there). 🐀 πŸ₯š 🐍

manic glacierBOT
#

I ended up with 3 different sets of flags for 5 boards. My gut said this wasn't worth worrying about DRY.

+CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=15
+CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=12
+CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=15
+CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-insns-auto=20
+CFLAGS_BOARD = --param inline-unit-growth=15 --param max-inline-in...

eternal moat
#

I saw this on Twitter, does anyone know what happened? I'm exploring creative coding myself and omg this is pretty exciting! Wanna learn and organise something similar as well! https://twitter.com/isziaui/status/1175706349998661633?s=19

What can you fit into an 8Γ—8 pixel display? Join us to find out: I’m bringing some PewPews to the Creative Coding ZH meetup and will show how to program simple games or demos in MicroPython/CircuitPython. https://t.co/W0IUgZunQM

manic glacierBOT
#

An update: I got everything to work using a 8 MBit flash chip instead on the same board. So there is something wrong with the software for all the 16 MBit chips ... at least with my setup. It doesn't make sense that it would be a hardware issue when I can get multiple other chips to work on the exact same board, literally just swapping out. Thank you everyone for your help with this. I hope we can eventually get the other larger chips working for this board (16MBit is actually the maximum you...

onyx hinge
#

hmm shewt, Adafruit_MP3 is made of C++, or at least files with .cpp extensions..

solar whale
slender iron
#

@eternal moat @stuck elbow created the PewPew and likely knows what this is

manic glacierBOT
#
[adafruit/circuitpython] New branch created: tannewt\-patch\-1
#
stuck elbow
meager fog
#

@onyx hinge i dont think its true cpp

onyx hinge
#

@meager fog yes after further investigation most of it can be understood by the c compiler so that's good.

meager fog
#

@onyx hinge you can also go back to the 'original source'

#

theres a few ports

onyx hinge
#

Yes searching for helix MP3 got me lots of projects using the same foundation, doesn't seem like there is a GitHub if the original though

meager fog
#

snort github - there aint no github in 2002

#

πŸ˜„ πŸ˜„ πŸ˜„

#

etc etc

onyx hinge
#

Some of the asm functions aren't picked up in circuitpython so that's next .. 64bit multiply and 64bit shifts I think

meager fog
#

dont worry about optimization ... yet

onyx hinge
#

Next after that will be too connect to the stub mp3file to the real decoding functions

meager fog
#

@prime grove will do a pass after you have mp3 decoding

#

(dontcha know his middle name is optimization)

prime grove
#

πŸ™‚

onyx hinge
#

@ @prime grove thanks in advance

prime grove
#

my pleasure

meager fog
#

@onyx hinge create some sine wave MP3s

prime grove
#

I'll make it as portable as possible, but I may sneak in some Cortex-M4 intrinsics πŸ™‚

meager fog
#

and dont use VBR

#

they'll be nice n small - you can use those to test freq output

#

can start with very low bitrate

#

i would try to find a decoder that supports VBR if you can

#

and also watch out for id3 tags

onyx hinge
#

I saw there's a test file in the repo, I'll start with that

meager fog
#

some decoders can choke on id3 if it wasnt invented yet

#

you need to fastfwd

onyx hinge
#

Funny but not surprising

prime grove
#

even when I'm targeting ARM/MIPS/whatever, running the code in Xcode instruments allows me to quickly see the hotspots. Once I have that info, I can work on the target platform testing.

meager fog
#

we have some id3 parsing code - either in mp3 or in vs1053 lib

#

anyhow - now that the patent is expired theres a lot more options

prime grove
#

exactly

meager fog
#

im not wedded to helix

#

its Just What Was Available

onyx hinge
#

Next week need audio compression so I can make an MP3 player for my car

meager fog
#

πŸ™‚

prime grove
#

did you take a peek at my monochrome animation code?

meager fog
#

jep - oh and if you want you can also add ogg

onyx hinge
#

Avrcp a2dp whatever the acronym is

idle owl
#

My cat's name is MIPS.

onyx hinge
#

@prime grove not me

meager fog
#

oooo mips is a good cat name

#

i did mips assembly, it was a good platform

#

i did not win the optimization contest tho

#

my code came in second

prime grove
meager fog
#

lost to a group of russians, they were amazin'

onyx hinge
#

My cats were Marie and Pierre (Curie) but sadly they are no longer with us

idle owl
#

Easier to lose to amazing people.

meager fog
#

oki i gotta go to meetings starting now

onyx hinge
#

See you and thanks @meager fog

ruby atlas
#

I remember being excited by the 286 because it was over 1.0 MIPS (the speed, not the instruction set).

idle owl
#

@tulip sleet If I have one CPB talking to another CPB, the only lib I need is the BLE lib right? (and anything else needed, but that's the only BLE related one, correct)

prime grove
#

@onyx hinge do you work for Adafruit?

meager fog
#

word! also btw goal is to be able to play 2 mp3s concurrently thru the mixer - one background and one fore. may not be possible at first - but thats what i'd like. more than 2 is unlikely...

tulip sleet
#

@idle owl if you are using Bluefruit packets, then you need bluefruit_connect too, otherwise, yep, that's the only one

ruby atlas
#

anyone else remember MOD and S3M and the like?

idle owl
#

@tulip sleet Ok there are NeoPixels involved, so I assume I am using Bluefruit packets?

tulip sleet
#

if you are using UARTService, then yes.

ruby atlas
#

Also, I added iterable support to PixelBuf with (literally) 1 additional line of code.

idle owl
#

@tulip sleet Is there another way to do it yet?

tulip sleet
#

not yet, there's an "Addressable Pixel Service" under development, but you can ignore that for now

ruby atlas
#

@tulip sleet sounds like a good use case for pixelbuf subclasses?

ivory yew
#

MIPS is a wonderful name for a cat.

idle owl
#

She lives up to it as well.

#

@tulip sleet Ok, noted and ignored πŸ™‚

tulip sleet
#

@ruby atlas you mean the new service? The service as defined now takes a raw buffer of pixel data, and also knows the protocol you are using (neopixel vs dotstar, etc.). It doesn't know RGB vs RGBW. So I think it would use pixelbuf at the lowest level?? No RGB shuffling, etc.

#

the idea is that the client of the service knows the details of the strip, and the server just sends the data to the specified pin, using a specified protocol. Also it knows the buffer size for storage management, but that's it.

onyx hinge
#

@prime grove I'm contract working for them, yes

#

Since just recently

tulip sleet
#

subject to change!

ruby atlas
#

@tulip sleet Hmmm... The idea of not knowing pixel order server side is interesting. I'm trying to figure out what changes might be needed for that. Also means features like brightness and the like would be changed client side and sent to the server?

#

In theory, though, pixelbuf would be still very useful client side for that.

#

And maybe there's not much to do server side at all.

tulip sleet
#

right, it's the raw data. What I see is there'd be a pixelbuf impl that would live on the blinka side, and its output doesn't go to a pin, it just gets left in a buffer, which then gets transmitted

#

i think we said the same thing

ruby atlas
#

Pseudocode:

class RemoteNeoPixel(NeoPixel):
    def send(self):
        self.send_pixels(self.buf)
tulip sleet
#

we might have another service that's higher level, that reverses the responsibility of the knowledge. The idea here is that the user could physically change the connected pixels (longer strip, etc.) without having to update the server-side firmware. The client (app, blinka code, etc.) would be told instead. Imagine a remote-control lighting installation where it's not so easy to update the code.py or whatever

ruby atlas
#

Indeed. I think pixelbuf + the trimmed down subclassed NeoPixel and Dotstar libraries will be excellent candidates to simplify implementation of the remote pixel control - probably via a mixin (assuming that works - something I should probably test).

#

So I really should hurry up and finish my work!

tulip sleet
#

btw, this service is already being implemented in Arduino. We haven't started on the CPY implementation yet.

ruby atlas
#

Doing the harder work first?

tulip sleet
#

it's more just who has the free time at the moment

#

There are a bunch of other services corresponding to the on-board CPB peripherals. There is a matching phone app under development.

#

also the revised CPy BLE API was not quite ready until very recently

idle owl
#

@tulip sleet I'm sure the answer is yes, but all the examples in the BLE repo are updated for the new API right?

tulip sleet
#

@slender iron I am thinking I will (gratefully) decline the asf4 PR, because it's huge and it's really hard to tell what's changed, and if we did this ourselves we would do it somewhat differently

#

@idle owl the BLE HID is not done; everything else should be OK

idle owl
#

Ok thanks

idle owl
#

@tulip sleet Another question (sorry, it is almost certainly not the last). Working on designing a NeoPixel CPB project where one controls the LEDs on another, including a connected NeoPixel strip. I have the accelerometer changing the colors working. But I want to do animations as well, and cycle through them with the buttons on the controller CPB. I'm not seeing any examples that use the buttons to change the behavior. I don't think I can send the animations as color packets, so I assume I need to send a message over UART from the control CPB that the target CPB will use as a trigger and the animations will be stored on and run from the target. Or something like that? Not sure what to use... do I fake a button packet somehow? Or is there something else I'm missing.

tulip sleet
#

finding an existing example...

idle owl
#

Thank you

tulip sleet
idle owl
#

Brilliant! Thanks!

#

@tulip sleet That's using the app buttons though isn't it?

tulip sleet
#

yes

idle owl
#

I'm talking about using the buttons on the CPB.

tulip sleet
#

so you can just check the on-board buttons in the while ...connected loop

#

before you try to read a packet

idle owl
#

But how does that tell the other CPB that a button event occurred?

tulip sleet
#

oh i see, well, you can SEND a button packet, and it can check for packets being received

idle owl
#

ok, so use the same button packets as the app but send it on button press?

tulip sleet
#

yes, you just need to decide a mapping

#

A = button 1, etc.

idle owl
#

right ok

#

Alright, I'll give it a try

tulip sleet
idle owl
#

ok

manic glacierBOT
idle owl
#

@tulip sleet That code doesn't send packets both ways, but I figured it out! I'm now sending button packets on CPB button presses!

#

πŸŽ‰

tulip sleet
#

yay!

idle owl
#

(For once my emotions match the ridiculous size of that emoji)

#

Another question though: is all of this necessary every time you send a packet? python try: uart_connection[UARTService].write(color_packet.to_bytes()) except OSError: try: uart_connection.disconnect() except: # pylint: disable=bare-except pass uart_connection = None

#

I'm mangling the central/peripheral code accelerometer neopixel example to do this example.

#

Did figure out that the delay in the sending code is necessary, target fails on "Bad checksum" if it receives too much data too quickly it seems.

manic glacierBOT
#

Since extended advertisements are not receivable by peers that don't support this part of Bluetooth 5. I think invisibly switching extended advertising could be confusing ("why isn't the scanner seeing my advertisement?"). There could be a flag permitting extended advertisements, default False.

On the other hand, this is at the _bleio.Adapter level, so presumably the coder knows what they are doing.

I do think any extended advertising provided by adafruit_ble should not be done invi...

idle owl
#

@tulip sleet if that whole section of code is necessary every time a packet is sent, I'll break it out into a function because it's used multiple times.

tulip sleet
#

the idea is just to get out of the loop when uart_connection is None, because a send failed. You could maybe wrap a larger section of code in try-except, or, yes, add a separate routine. This is an example of maybe where we could use a helper function in UARTService. I'm not sure why you're getting checksums but probably because too much data and the buffer is too small. Right now the buffer size can't be specified, which is a regression from the old code.

idle owl
#

I only get bad checksum without a delay in the sending code.

#

@tulip sleet Which do you think is better: wrap the entire code in the try/except or adding a separate function?

tulip sleet
#

If there's a separate function, you need to check its return value, since you need to know if there was a failure, set uart_connection to None, and start advertising again.

idle owl
#

oh hmm ok

tulip sleet
#

So try/except might be less code.

idle owl
#

Alright, thanks

tulip sleet
idle owl
#

oh the code you linked earlier. Ah ok

slender iron
#

@tulip sleet fine with me that we don't merge the asf4 stuff

manic glacierBOT
slender iron
#

@bleak tiger indeed. a bug! I just found it. We were accidentally gcing the start and stop sequence for the eink. oops!

manic glacierBOT
#

I understand, and completely agree with your concerns. :+1: :hugs:

I think that if there is a flag that either switches on or off extended advertising, libraries higher up the stack (such as the one I've been working on) should be able to detect the state of such a flag in order to adjust accordingly.

In any case, this is going to be very very cool and thanks to you both for your efforts in building this so others (like me) get to do fun stuff with wireless communication. :smile:

#

@ntoll Rather than detecting whether extended advertising is on or off, I'm just saying that libraries that include code that might want to use extended advertising should allow that to be turned off. So for instance, it's great if the radio library can use extended advertising, but it would be good to be able to ask the radio library not to use extended advertising, in case one side can't deal with it.

As an example, I have a BT 4.0 dongle plugged into my host computer. I could write a ra...

manic glacierBOT
meager fog
#

@tidal kiln ok im finally getting to the MCP2221

tidal kiln
#

coolio

meager fog
#

@tidal kiln can you do the PR for MCP2221?

#

like so its not in your branch

tidal kiln
#

sure. current state is functional, but i still want to do some more work - add some bounds checks, etc. but just want to make sure current framework is cool before finishing it off.

meager fog
#

np call it a WIP PR ? πŸ™‚

#

i see people doing those

tidal kiln
#

yep. just so you know and don't merge yet if you were going.

#

pr sent.

meager fog
#

totes

tidal kiln
#

wow. it even passed travis.

meager fog
#

theres a way to do WIP PRs

#

i dont kno whow but i see em

#

they are unmergable

tidal kiln
#

interesting. didn't know about that.

meager fog
#

@tidal kiln hid library missing from deps

#

on platformdetect

tidal kiln
tulip sleet
#

"draft" pull requests

meager fog
#

@tidal kiln there and platformdetect, requirements.txt too

tidal kiln
#

was wondering about that. i left it empty for FT232H also.

#

since it's sort of a conditional requirement

meager fog
#

@tidal kiln im on a quest for hidapi.dll

#

@tidal kiln hmm wrong one maybe?

#

self._hid = hid.device()
AttributeError: module 'hid' has no attribute 'device'

#

which python HID library are you using?

tidal kiln
#

nope. i think it's different. one sec...

meager fog
#

ah ok

#

yep now ok

#
['G0', 'G1', 'G2', 'G3', 'I2C', 'SCL', 'SDA', 'SPI', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'ap_board', 'board_id', 'detector', 'pin', 'sys']
>```
tidal kiln
#

so far so good

meager fog
#

@tidal kiln ok checked analog in

#

analog out

#

digital out

tidal kiln
#

hmmm. just noticed it shows SPI. πŸ€”

meager fog
#

lol

#

digitalin

tidal kiln
#

that singleton gets created regardless....but...hmmm...should probably look at that a bit more.

meager fog
#

kk well

#

i do want to implement bitbang spi

#
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\busio.py", line 18, in __init__
    self.init(scl, sda, frequency)
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\busio.py", line 28, in init
    self._i2c = I2C()
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\adafruit_blinka\microcontroller\mcp2221\i2c.py", line 7, in __init__
    mcp2221.i2c_configure(baudrate)
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\adafruit_blinka\microcontroller\mcp2221\mcp2221.py", line 124, in i2c_configure
    12000000 // baudrate - 3]))
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\adafruit_blinka\microcontroller\mcp2221\mcp2221.py", line 26, in _hid_xfer
    return self._hid.read(64)
  File "hid.pyx", line 122, in hid.device.read
OSError: read error```
tidal kiln
#

what's connected?

meager fog
#

lps33 sensor

#

i restarted python and now its ok

#

but i had done a lot of nonsenese

#

who knows

#

import time
while True:
... print("I2C addresses found:", [hex(device_address)
... for device_address in i2c.scan()])
... time.sleep(2)
...
I2C addresses found: ['0x5d']
I2C addresses found: ['0x5d']
I2C addresses found: ['0x5d']

#

oh i plugge din an oled and its had same error

#
  File "<stdin>", line 3, in <module>
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\busio.py", line 61, in scan
    return self._i2c.scan()
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\adafruit_blinka\microcontroller\mcp2221\i2c.py", line 10, in scan
    return mcp2221.i2c_scan()
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\adafruit_blinka\microcontroller\mcp2221\mcp2221.py", line 194, in i2c_scan
    self.i2c_writeto(addr, b'\x00')
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\adafruit_blinka\microcontroller\mcp2221\mcp2221.py", line 132, in i2c_writeto
    buffer[start:end])       # user data to be sent
  File "C:\Users\ladyada\Documents\Dropbox (Personal)\micropython\Libraries\Adafruit_Blinka\src\adafruit_blinka\microcontroller\mcp2221\mcp2221.py", line 26, in _hid_xfer
    return self._hid.read(64)
  File "hid.pyx", line 122, in hid.device.read
OSError: read error```
#

hmm ok on restart

#

might have to tell people dont hotplug stuff

tidal kiln
#

there is some I2C engine status available that can be checked, might help

#

you just added a second I2C device and then re-ran scan?

meager fog
#

yah

#

oki

#

i mean its $1.50

#

i dont expect much

#

works tho

#

nice πŸ™‚

tidal kiln
#

hmm. worked interactively:

$ python3
Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> import busio
>>> i2c = busio.I2C(board.SCL, board.SDA)
>>> i2c.scan()
[119]
>>> i2c.scan()
[41, 119]
>>> 
#

and via loop:

>>> import time
>>> while True:
...     print("I2C addresses found:", [hex(device_address) for device_address in i2c.scan()])
...     time.sleep(2)
... 
I2C addresses found: ['0x77']
I2C addresses found: ['0x77']
I2C addresses found: ['0x77']
I2C addresses found: ['0x77']
I2C addresses found: ['0x29', '0x77']
I2C addresses found: ['0x29', '0x77']
I2C addresses found: ['0x29', '0x77']
#

maybe something about the init time for the OLED? got scanned while still coming up?

#

(above was BME280 @ 0x77 and TCS34725 @ 0x29)

manic glacierBOT
meager fog
#

@tidal kiln yah was probably me

#

well, when you feel its ready we can merge

tidal kiln
#

ok. will probably be next week. sry. lots of turkey related things happening this week.

#

if you have any specifics to take care of, please add to the PR thread.

meager fog
#

totally

#

no rush

#

just letting u know

tidal kiln
#

cool. thanks for testing.

manic glacierBOT
manic glacierBOT
slender iron
#

@ivory yew you around? I'd like your pythonista opinion

#

I'm trying to decide how to handle managing a display, ble connection and ble notifications all at the same time

ivory yew
#

in a meeting but I can check after

slender iron
#

thanks!

ivory yew
#

nit: from adafruit_ble.advertising.standard import SolicitServicesAdvertisement hurts me after years of having "import modules, not members" hammered into me.

#

(it's totally fine, just foreign to me now)

slender iron
#

I think the main thing is I'm trying to track too many things concurrently

ivory yew
#

yeah this logic is a little twisted

slender iron
#

so... how can it be simplified

#

I want to show a single notification on an eink screen

#

unless I'm disconnected from the phone

ivory yew
#

hrm

slender iron
#

if it's been more than ten minutes since a new notification then I want to update the time

ivory yew
#

sometimes I like to work the other direction - not from how to make it work, but how you would like it to look in the end.

slender iron
#

this doesn't work either. I'm not sure what the final bit should look like

#

I really like using iterators to wait for things to happen

#

but that falls over if there is more than one thing to wait for

ivory yew
#

without timeouts, yeah

slender iron
#

right, I could make an iterator that can timeout

ivory yew
#

this is why select and event loops came into prominence.

#

so- instead of waiting for something can you poll?

slender iron
#

I'd rather not because I'd like to actually sleep while I wait

ivory yew
#

ah

slender iron
#

(not supported now but want to add it later)

ivory yew
#

so you're waiting on a notification, what else are you waiting on? The ten minute timer?

slender iron
#

can also wait on a notification to be dismissed if we want to remove it once it's been removed on the phone

ivory yew
#

so let's say waiting on any BLE message?

slender iron
#

may also need to wait to show a new notification if they come quickly because the eink can only be updated so often

ivory yew
#

oof

slender iron
#

πŸ™‚

ivory yew
#

okay

#

this isn't impossible

#

but it's gonna be tricky to make it readable.

slender iron
#

ya...

tulip sleet
#

kibitzing: this is how I got to message queues in that infamous issue

slender iron
#

ya, I realize that's what I'm hitting

ivory yew
#

so let's do some pseudocode-esque stuff here. Is this basically your high-level logic? (I added the idea of queueing the notifications so we don't refresh the screen too quickly):

while True:
    if connected:
        if wait_for_new_notification(timeout=10):
            queue_notification(get_notification())
        
        if screen_ready():
            display_notification_queue()

    elif ten_minutes_have_passed():
        update_time()
slender iron
#

The ten minutes should only happen when connected

tulip sleet
slender iron
#

(the time is fetched from the phone)

#

reads over the issue again

ivory yew
#

@tulip sleet neat. I've done a lot with asyncio so this is pretty neat.

#

ah I see that this thread already attracted the opinions...

slender iron
#

I think this is the first time I've felt like I actually need it

ivory yew
#

I don't think you necessarily need it for this

#

if the waiting for notifications is the only part that's blocking

#

It's also only blocking because you want to have the option of sleeping the device.

slender iron
#

that's true until I want to wait until the "active" notification is dismissed

ivory yew
#

hmm.

slender iron
#

and ya, sleep is a thing too

ivory yew
#

Would you just block and wait for any bluetooth message and go to sleep otherwise?

#

or do you want to be able to be more fine-grained / selective when it comes to what messages can wake the device?

slender iron
#

I'd block python until something hits the characteristic I'm waiting for

ivory yew
#

hrm.

#

I don't think we'll get to a perfect solution with the set of features we have for 5.0

slender iron
#

ya, true

ivory yew
#

polling is definitely the easiest thing to do for now.

#

And NJS and I don't agree on everything, but I do completely agree with him when he says "You're going to have to break compatibility to make those async, though, one way or another."

tulip sleet
#

which is "those", in this case?

ivory yew
#

all of your sync apis that you want to be async

#

like notification_service.get

slender iron
#

ya, I get that

tulip sleet
#

you'd want to ask the iterator/generator "anything pending?" but there's no standard way to do that, I think? Basically you are asking if anything's queued, so underlying, it's a queue or stream, with a next() interface.

ivory yew
#

peek is a good verb for that, but you're basically back to polling at that point.

tulip sleet
#

right

slender iron
#

are there any examples of apis that return different iterators?

ivory yew
#

what do you mean?

slender iron
#

like "get me the next notification that comes in the next ten minutes"

ivory yew
#

you mean like get me the next notification that comes or give me nothing if 10 minutes pass?

slender iron
#

ya

#

which is basically get

tulip sleet
#

so it's blockign?

slender iron
#

actually its more "get me all notifications that come in the next ten minutes and then stop"

ivory yew
#

that's more or less select or asycio.wait(..., return_when=FIRST_COMPLETED).

slender iron
#

as an iterator I can bail early when I find a notification I'm interested in

#

which is how I have scanning working

ivory yew
#

I mean that specific case only has one blocking call so it doesn't necessarily need an iterator.

#

but you can wrap it in an iterator if you want it to work that way

tulip sleet
#

i would say you are doing a blocking queue read (with timeout) using some nice builtin syntax

ivory yew
#
def all_notifications_for_duration(timeout=10):
    start_time = now()
    while True:
        notification = get_notification(timeout=timeout)
        if notification:
            yield notification
        
        time_elapsed = now() - start_time
        if time_elapsed > timeout:
            return
slender iron
#

the timeout to get_notification would shrink

ivory yew
#

?

slender iron
#

but ya, I think that's what I want

ivory yew
#

you mean to avoid running over time?

slender iron
#

correct

#

and then get_notification can sleep

ivory yew
#

more general approach:

def blocking_call_for_duration(func, polling_frequency, deadline):
    start_time = now()
    while True:
        item = func(timeout=polling_frequency)
        if item is not None:
            yield item
        
        time_elapsed = now() - start_time
        if time_elapsed > deadline:
            return
#

this is actually not uncommon for blocking APIs that need to do stuff like retries and similar stuff.

slender iron
#

ah, interesting to use a decorator for it

onyx hinge
#

yay got my stm32f405 into dfu bootloader mode. Is it typical that it takes around a minute to transfer the circuitpython dfu/bin file?

ivory yew
#

In that specific example, retry can be a decorator or a callable.

#

the decorator is just a fancy wrapper around retry_target

slender iron
#

right

#

@onyx hinge it's been a while since I loaded it

ivory yew
#

(I generally design all of my decorator-based APIs like this. They're just syntactic sugar and never bear any implementation)

tulip sleet
#

@onyx hinge yah, it is fairly slow

#

dfu-util has a progress bar; are you using that?

ivory yew
#

but anyways, just wanted to show that the idea of a deadline for a blocking operation isn't unusual.

onyx hinge
#

@tulip sleet thanks for confirmation. sometimes it turns out a tool in debian is outdated or busted. yes, I did get a progress bar to watch

tulip sleet
#

0.9 is the latest but it is years old

ivory yew
#

even across multiple underlying calls to the blocking operation

slender iron
#

@ivory yew totally. now I have to decide on a name πŸ™‚

#

I've spent the last three years getting rid of methods that start with get_

ivory yew
#

in the linked example it abstracts multiple calls to retry a function, in yours it abstracts multiple calls to produce a stream of items.

#

same idea.

#

Okay gotta go cook. Let me know if you wanna bounce anything else off me, @slender iron. I hope I was helpful!

slender iron
#

thanks! I really appreciate your perspective

ivory yew
#

ask me easier stuff next time. πŸ™‚

slender iron
#

haha, sorry

onyx hinge
#

@meager fog I'm glad you said that playing 2 streams is a goal. The Helix MP3 library uses static variables for the state of the decoder, so it will need modification to support more than 1 stream at a time.

#

that may be a change that was done to fit it into arduino, not sure yet

onyx hinge
#

okay that was nbd. next step is understanding approx 90 lines of C++ and writing whatever is equivalent in C for CP. Nothing looks too esoteric, just API calls and buffer manipulation. Tomorrow!

slender iron
#

πŸ‘

rain hinge
#

@ivory yew & @slender iron Thanks for having this conversation in a public forum! I appreciate seeing other's thought processes and approaches. πŸ‘

slender iron
#

@rain hinge no problem!

#

I added a wait_for_new_notifications that yields new notifications and returns on timeout or update of an existing notification

ivory yew
#

@rain hinge I'm always happy to talk API design! I helped design over 40 libraries at Google. ✨

#

@slender iron looking better. Now if we can make connection management easier.

tulip sleet
#

@pastel panther I replied to that RGBW neopixel thread

pastel panther
#

ok

meager fog
#

@onyx hinge all good i expect a few 'false starts' on mp3

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I tried moving the second call to line 141 before the while(True) and the
trace does not appear at all.
If you send me the whole program, I can test.

-Tom

On Tue, Nov 26, 2019 at 3:51 PM DavePutz notifications@github.com wrote:

Investigating. In my testing with the provided code, if just above the
'while(True)' at line 141 an insert of
board.DISPLAY.refresh(minimum_frames_per_second=0)
is done then only one call to refresh each time through the loop is
needed. Still unsure why
...

obsidian compass
onyx hinge
#

@obsidian compass not yet, hope to today. Thanks for pinging me about it

obsidian compass
#

@onyx hinge Thanks πŸ™‚

manic glacierBOT
onyx hinge
manic glacierBOT
onyx hinge
#

@obsidian compass thanks!

obsidian compass
#

Thanks for merging πŸ™‚

simple pulsar
#

For the new CPB, I tested the audio out and it seems to work ok from CircuitPython using the audiocore module. I thought the CPB's chip was DAC-less and it used PWM? https://learn.adafruit.com/adafruit-circuit-playground-bluefruit?view=all#speaker-2-16 says The amplifier is connected to the true analog output AUDIO pin. Which one is correct?

Adafruit Learning System

Circuit Playground Bluefruit: Everything amazing about Circuit Playground, now with the power of Bluetooth!

tulip sleet
#

@idle owl ^^

simple pulsar
#

And while I'm here, what's the replacement for from adafruit_circuitplayground.express import cpx - that currently gives ImportError: no module named 'audioio'. I'll have a rummage in forums for this too. They were a bit slow earlier.

tulip sleet
#

from adafruit_circuitplayground.bluefruit import cpb

#

(this is not released yet)

simple pulsar
#

Thanks! I had a look in the directory but I don't have that. I'm probably a week or so behind...

tulip sleet
#

you can get it from the tip of master in the library repo

#

@simple pulsar I will edit the copy-pasta errors in the guide

#

@idle owl fixing this ...

#

@simple pulsar I'm confused why you don't see output on AUDIO: it should be visible as a PWM signal

simple pulsar
#

Me too, feels like it must be me doing something wrong.

tulip sleet
#

maybe substitute a CPX with the same probe wiring and see if you see a signal

simple pulsar
#

CPX looks fine, CPX looks like a few mV above GND. I'll try my second CPB

tulip sleet
#

are you scoping it?

simple pulsar
#

yes, on a 20MHz analogue scope with intensity cranked up

tulip sleet
#

i am debugging something else atm but will try it out later

simple pulsar
#

@tulip sleet User error on CPB audio!! I had the two CPBs together and was checking the wrong one.

idle owl
#

At least it's sorted!

manic glacierBOT
#

UART fixes and changes:

  • atmel-samd: UART.write() was inadvertently non-blocking, due to my misunderstanding the (poorly documented) ASF4 API. Fixes #2263, I believe.
  • The same timeout value was used for read and write. A write timeout is not very useful, because we don't have flow control. Made timeout apply only to read. Note, for instance, that PySerial has separate read, write, and inter-character timeouts.
  • Added a get/set .timeout property so that the timeout can be chan...
onyx hinge
#

ooh I read an mp3 frame info structure! ```(gdb) p fi
$1 = {bitrate = 40000, nChans = 2, samprate = 44100, bitsPerSample = 16,
outputSamps = 2304, layer = 3, version = 0}

meager fog
#

@onyx hinge 🎡 🎡 🎡

#

nice

manic glacierBOT
simple pulsar
#

Does CPB have coarser granularity for CircuitPython'stime.monotonic() than CPX? I think I'm seeing "lumps" of 0.00390625s (1/256th of a second) on CPB.

onyx hinge
#

@simple pulsar I would have expected 1ms on that board too

solar whale
#

@simple pulsar Are you seeing that granularity all the time -- say after a power cycle. I think the resolution will decrease with time -- but it should start at 1 ms

#
442.452
442.453
442.454
442.455
442.456
442.457
442.458
442.459
442.46
```  this was using ```import time


now = time.monotonic()
while True:
    if time.monotonic() != now :
        print(time.monotonic())
        now=time.monotonic()
``` on a CPB
simple pulsar
#

@solar whale You're right, it's the uptime of the board. I thought time.monotonic() reset with a control-D from REPL but as you comment it's time since power up / reset button pushed.

solar whale
#

yeah -- unfortunaltely is does not reset -- with the code above, it jumps to 10ms after about 1000 seconds ```1004.12
1004.12
1004.12
1004.12
1004.13
1004.13
1004.13
1004.13
1004.13
1004.13
1004.13
1004.13
1004.13
1004.14
1004.14
1004.14
1004.14
1004.14
1004.14
1004.14
1004.14
1004.14
1004.14
1004.15
1004.15
1004.15
1004.15
1004.15
1004.15
1004.15
1004.15
1004.15
1004.15

simple pulsar
#

Since it's a fp precision limitation i would have thought it would always be fractions with multiple 2. Might depend how you're printing it?

solar whale
#

yes -- just using print -- probably takes some liberites

onyx hinge
#

huh -- this crashes my nrf52840 feather. Encountered while working on mp3. ```f = open("test.mp3", "rb")
f.seek(2048)
b = bytearray(2048)
v = memoryview(b)
f.readinto(v[909:])

#

should reproduce on any test file of 4000+ bytes or so?

#
    file=file@entry=0x7ed38 "nrfx/drivers/src/nrfx_qspi.c", 
    line=line@entry=297, 
    func=func@entry=0x7ecc8 <__FUNCTION__.8276> "nrfx_qspi_read", 
    expr=expr@entry=0x7ed88 "nrfx_is_word_aligned(p_rx_buffer)")
solar whale
#

@simple pulsar added in the difference for more clarity ```1424.35 -0.000976563
1424.35 -0.000976563
1424.35 -0.000976563
1424.35 -0.000976563
1424.35 -0.000976563
1424.35 -0.000976563
1424.35 -0.00146484
1424.35 -0.000976563
1424.35 -0.000976563
1424.35 -0.000976563

onyx hinge
#

Yeah that's all due to FP precision. You can use monotonic_ns to get the integer number of nanoseconds as a long integer, which doesn't lose precision like FP numbers

simple pulsar
#

I normally leave that in a comment in the code as a potential enhancement!

#

Does CP format have some limitations here? I'm expecting/hoping for 15592.00390625 to pop out but it's a bit out: ```>>> a = 15592.0 + 1.0/256.0

a
15592.0
for dp in range(1, 20+1):
... print(("{0:." + str(dp) + "f}").format(a))
...
...
...
15592.0
15592.00
15592.004
15592.0038
15592.00382
15592.003822
15592.0038223
15592.00382233
15592.003822327
15592.0038223267
15592.00382232666
15592.003822326660
15592.0038223266602
15592.00382232666016
15592.003822326660156
15592.0038223266601563
15592.00382232666015625
15592.003822326660156250
15592.0038223266601562500
15592.00382232666015625000
b = 15592.0 + 2.0/256.0
c = b - a
c
0.00390625
print("0:.10f".format(c))
0:.10f
print("{0:.10f}".format(c))
0.0039062500

manic glacierBOT
#

Create a file test.bin on your filesystem of 4096 bytes, and execute this e.g., in the repl:

f = open("test.bin", "rb")
f.seek(2048)
b = bytearray(2048)
v = memoryview(b)
f.readinto(v[909:])

circuitpython will crash. The underlying cause seems to be that a non-aligned buffer is sent to nrfx_qspi_read, which is not supported and triggers an assertion:

#1  0x00052fc0 in nrfx_qspi_read (p_rx_buffer=p_rx_buffer@entry=0x20008cdd, 
    rx_buffer_length=rx_buffer_length@e...
solar whale
#

@simple pulsar it may be that 15592.0 is not actually stored as 15592.0

#

nevermind ---

#

It depends on the starting value

onyx hinge
#

@simple pulsar Yeah, it has 2 fewer mantissa bits than 32-bit IEEE floats

solar whale
#
>>> for dp in range(1, 20+1):
...     print(("{0:." + str(dp) + "f}").format(a))
...     
...     
... 
0.0
0.00
0.004
0.0039
0.00391
0.003906
0.0039063
0.00390625
0.003906250
0.0039062500
0.00390625000
0.003906250000
0.0039062500000
0.00390625000000
0.003906250000000
0.0039062500000000
0.00390625000000000
0.003906250000000000
0.0039062500000000000
0.00390625000000000000
>>> 
onyx hinge
#

(and a whole lot fewer than the double precision numbers that desktop python3 uses)

solar whale
#
>>> for dp in range(1, 20+1):
...     print(("{0:." + str(dp) + "f}").format(a))
...
...
...
100.0
100.00
100.004
100.0039
100.00390
100.003898
100.0038981
100.00389814
100.003898144
100.0038981438
100.00389814377
100.003898143768
100.0038981437683
100.00389814376831
100.003898143768311
100.0038981437683105
100.00389814376831055
100.003898143768310547
100.0038981437683105469
100.00389814376831054688
tulip sleet
simple pulsar
#

@onyx hinge - if precision was the issue here, wouldn't the calculation of c fail to result in 0.00390625

#
'9.00390625000000000000'
>>> "{0:.20f}".format(10.00390625)
'10.00390648841857910156'
onyx hinge
#

By the looks of it, there must be other limitations when it comes to formatting the numbers too.

#

(100+1/256) is exactly representable in CP's floating point, but as you show it's not being formatted accurately.

#
'100.00389814376831054688'
>>> "{0:.20f}".format(100 + 1/256 - 100)
'0.00390625000000000000'
#

I'm sure these trade-offs were consciously made in micropython as a compromise between size, speed, and the perceived necessary accuracy

manic glacierBOT
onyx hinge
#
True
``` As far as CP is concerned, the shown number is "equal to" the calculated number
#

ikr

simple pulsar
#

@onyx hinge true, but that's a different issue to format works

#

Right, i should get back to my real programming task now. Thanks for the help @solar whale @onyx hinge @tulip sleet

onyx hinge
#

formatting FP numbers accurately and quickly is still a matter of academic research; doing it in tiny code and data size is not an aspect I've seen anybody cover. fascinating topic, for the right kind of person.

simple pulsar
solar whale
#

@simple pulsar good luck!

tulip sleet
#

@simple pulsar 0TT

onyx hinge
ivory yew
#

When I interviewed for Khan Academy I wrote a Mandlebrot and Julia renderer in their little web Processing environment. That was fun.

onyx hinge
#

yay! having papered over the nrf assertion failure (in a way that will never fly 😦 ) I heard an mp3!!!!

#

:triumphquit:

idle owl
#

πŸŽ‰ πŸ‘‹

ivory yew
#

Rad

prime flower
#

@ivory yew I'm excited to try out the .native decorator on CircuitPython_RSA and TinyLoRa next week

#

has been slowly reading through commits

ivory yew
#

It has a lot of caveats.

#

& doesn't always like the code you give it.

#

But it can speed up loops and such a lot.

#

For Sol I'm doing some profiling with CPython and then applying it to just specific hotspots.

prime flower
#

I am curious - how are you profiling circuitpython code? Timing specific parts of the code, or are you doing something else?

ivory yew
#

I'm not profiling on the device. Profiling on desktop w/ CPython and the normal profiling tools.

#

@prime flower for that code you should just considering using viper or asm_thumb.

prime flower
#

interesting - i was reading the micropython docs about viper, will take a look at this epaper driver.

#

thanks for the suggestion, this is some "old" code that I'd like to optimize

manic glacierBOT
#

@brentru I don't think they are the same problem.
The issue I am reporting is that the Wiznet 5500 has no on-board long term memory for a MAC address, so if you don't give it one after boot, it makes up a random number for the MAC, and causes an IP address change every time you reboot. The Arduino API has a function to assign/force a MAC address. The CP API does not.
As far as I know, it is stable as long as power is still applied, so should not cause this issue. I didn't go beyond discov...

#

@brentru I don't think they are the same problem.
The issue I am reporting is that the Wiznet 5500 has no on-board long term memory for a MAC address, so if you don't give it one after boot, it makes up a random number for the MAC, and causes an IP address change every time you reboot. The Arduino API has a function to assign/force a MAC address. The CP API does not.
As far as I know, it is stable as long as power is still applied, so should not cause this issue. I didn't go beyond discover...

meager fog
#

@onyx hinge ooh grabby hands - gimme something to try when ya can πŸ™‚

manic glacierBOT
#

If you can think of how to make instance_subscr smarter, i'd love to know your thoughts. Ultimately it does that when the base is native and has a subscr (see mp_obj_class_lookup ~ line 168) lookup->dest[0] = MP_OBJ_SENTINEL;

I guess we could make it look up and call the native subscr method itself, but then all of the assertions mp_obj_subscr could throw need reimplementing.

onyx hinge
#

@meager fog it's 0/10 ready for inclusion you understand ... this is a firmware file for feather nrf52840

#

this is my testing program, for an i2s dac (uda1334) on pins 6,9,10

#

got to go, guests coming at the top of the hour!

manic glacierBOT
#

On Thu, 28 Nov 2019, at 10:54, Graham wrote:

@nickzoic https://github.com/nickzoic Thanks for the pointer about RMII on ESP32. I have read about some people doing that. In my case, I just switched to BBB for my application, which seems to have a well behaved network interface.

No worries: it's a bit of a fringe application but maybe handy for someone.
My feeling is if you've got wired ethernet, you've probably got wired power (at least PoE) and therefore you probably can get away with a...

marble hornet
#

hey, i'm making a new board def and i'm confused on how to figure out whet parts of a sercom are for what parts of i2c or spi

#

I looked in the datasheet and it does a great job of describing what and how a sercom works but not the specific hardware connections for it.

#

to the point i;ve read

tulip sleet
#

a sercom has "pads", and only certain pads can be used for certain functions. There's a big table in the front of the data sheet that says which pads can be connected to which pins

manic glacierBOT
indigo wedge
solar whale
onyx hinge
#

@solar whale hm, I wonder if I did something else bad at the same time and don't realize it now.

formal plover
#

Welp. Finally got back into my discord account... Two kids later haha. Hope everyone has been well! @slender iron @idle owl @solar whale

solar whale
#

@formal plover Welcome back and congratulations on the expanded family!! Happy Thanksgiving!

formal plover
#

Thank you @solar whale! Happy Thanksgiving to you as well!

ivory yew
#

@indigo wedge that looks so rad. I'm really excited for those processors. πŸ™‚

stuck elbow
#

I'm still waiting for that giant board feather

manic glacierBOT
manic glacierBOT
#

Files created with os.open have an incorrect mtime. The code below verifies that the time is set correctly (output now), then creates a file and prints the mtime, which is always in Dec 2016, regardless of the current time.
Hardware: nrf52840 particle Xenon with CircuitPython 5.0 beta.

import os
import time

def current_time(lt = time.localtime()):
    return "{:2d}-{:02d}-{:02d} {:2d}:{:02d}:{:02d}".format(lt.tm_year, lt.tm_mon, lt.tm_mday, lt.tm_hour, lt.tm_min, l...
indigo wedge
manic glacierBOT
manic glacierBOT
obsidian compass
#

Happy thanksgiving from India to all the amazing circuitpython community members πŸ˜ƒ

manic glacierBOT
manic glacierBOT
#

Hi. Thanks for helping make CircuitPython better! In this case, though, I think the documentation is correct even though it looks unusual.

Here's how the C code defines the way that TileGrid's constructor needs to be used:

    static const mp_arg_t allowed_args[] = {
        { MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ },
        { MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
        { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} },
```...
onyx hinge
#

eek each mp3 decoder takes ~45kB RAM

#

free memory decreases by 44640 bytes when I create one

#

but I can actually play two mp3s through an audiomixer on nRF

slender iron
#

hi @formal plover! thanks for dropping by! I hope all is well

formal plover
#

@slender iron All is well indeed! Hope same for you! Looks like I have some updating to do on my Circuit Python boards. Pretty sure we were testing 2.0 hahaha.

#

Wow how the time flys.

slender iron
#

πŸ˜„ We just keep rolling.

formal plover
#

That you do!

#

?membercount

digital shoreBOT
#
Members

15231

Humans

15227

Bots

4

formal plover
#

There were 806 members right before I went in my sabbatical. Dang that's impressive

manic glacierBOT
#

Hi! This is not mergeable yet, but it's to a point where it's worth starting a discussion about it.

Technical things to resolve before draft status can be taken off:

Testing performed: On a nRF52840 with I2S DAC on pins 6/9/10, play the "test.mp3" file using this code.py:

import audiocore
import audiobusio
import board
...
manic glacierBOT
#

When writing to CIRCUITPYTHON, especially with dd, a reset-to-safe-mode event can occur. When it does, the stack looks like this:

Breakpoint 1, reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM)
    at ../../supervisor/shared/safe_mode.c:84
84	void __attribute__((noinline,)) reset_into_safe_mode(safe_mode_t reason) {
(gdb) where
#0  reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM)
    at ../../supervisor/shared/safe_mode.c:84
#1  0x00027e26 in gc_alloc (...
#

@rdagger Unfortunately, it's a hardware limitation that MAX98357A doesn't support 8-bit samples like the one in mi-destruct.zip. We might address this in software in the future (#2323), but for now it is not going to work.

A tool like audacity can convert wave files, though obviously the flash storage usage is higher for 16 bits.

I'm going to close this up for now, but please feel free to open fresh issues if there are problems I haven't covered yet. Thanks for working with us on this!

river quest
#

There is a Python Educators live chat at our friend's server at 1pm ET (in 30 mins-ish) here is the link! https://discord.gg/AnvwG3

manic glacierBOT
manic glacierBOT
#

Ran some more diagnostics. From the source code in shared-bindings/displayio/Display.c I see: "If the call has taken too long since the last refresh call for the given target frame rate, then the refresh returns False immediately without updating the screen to hopefully help getting caught up." In the original test code checking the return from the call to board.DISPLAY.refresh() in the while loop I see that it returns True for the first call and False for every subsequent call (hence no dis...

manic glacierBOT
manic glacierBOT
timber remnant
#

Thanks for the help with this, DavePutz! My latest badge code on Github can now read the microphone, the light sensor, or a show a software-generated sawtooth. https://github.com/tomacorp/edgemicscope

meager fog
#

@onyx hinge thats OK - its meant for M4, bit STM + nrf only - you couldn't run it on an m0 anyways

onyx hinge
#

@meager fog you mean the memory usage? Good to know

meager fog
#

@onyx hinge yep - we try to optimize later but for now - 2 at a time is max expected - one background one foreground πŸ™‚

manic glacierBOT
manic glacierBOT
tough flax
#

I folks, Happy Thanksgiving - I hope @river quest has a very Black Friday

#

I have project that I'm planning on doing this evening & I thought I'd ask if anyone else had done it already.

We need a repository of built CP UF2 images that have support for the XBox Adaptive controller. Thanks to @tulip sleet, that's much simpler now - we just modify a config file and have it build without other HID profiles and then replace the gamepad.mpy file with a version with different limits and button counts.

So, what I was planning on doing was making a new GitHub repository for the binaries, and then write a script that checks to see if CP had a new release - if so, it would check out that release, modify the config file, build for each of the boards we're supporting (Trinket, Itsy, CPB, CPX, Feather M4, Feather NRF52840, others as we add more guides) and then copy them to our new repository. Then checkin with a comment of "sync with CP version 5.xxxxx".

Is there a simpler solution to this?

onyx hinge
#

@tough flax It sounds like you can automate some of those steps for sure. In circuitpython https://github.com/adafruit/adabot helps with things like making new bundle releases when individual libraries get tags, which is similar in spirit to what you want to do.

#

you can "git merge" to combine the files from circuitpython with your modified files, and then use travis-ci or github actions to do the building; this can even create downloadable files at your github project's page

#

it can all take time to set up, for sure!

tough flax
#

So.. I think my challenge will be which is easier...

#
  1. Use tools I know (Linux, Shell, Make, git command line) on an AWS server I have running to check, checkout, build, and push to GIT
#

or

#
  1. Learn to use Adabot + Travis CI to do this
#

And do I need a server to running Travis? Or is that in the Git infrastructure?

onyx hinge
#

travis-ci and gitlab actions are both things that can be used at no cost by open source projects

#

they also have paid tiers if you have private repositories, want more/faster builds, etc.

#

adafruit is using them at the paid level I believe

tough flax
#

Hmmmm where are your travis skills (0-10), @onyx hinge?

onyx hinge
#

depending how you look at them, they are just shell scripts wrapped in inconvenient ".yml" files

#

oh, probably a solid "4" at least

tough flax
#

And you'd use it for this?

onyx hinge
#

I tend to think it's good to automate these things, for a lot of reasons.

tough flax
#

Right: I will automate it one way or the other

onyx hinge
#

you should at least take a look at how CP is currently using github for this. start at .github/workflows/build.yml in a copy of the source.

tough flax
#

Ok

onyx hinge
#

(slightly outdated version here)

    - name: mpy-cross
      run: make -C mpy-cross -j2
    - name: build
      run: python3 -u build_release_files.py
...
    - name: Upload to S3
      run: aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1
#

At this level, it's just giving a sequence of commands to run, and a name for each one. if you know shell scripting, you can convert it to this

raven canopy
#

And to note, both Travis and GitHub Actions have cron-like scheduling. Travis' can't guarantee a time of day though. Actions is basically cron.

#

@tough flax

onyx hinge
#

@raven canopy for a project doing it for the first time, do you think travis or github actions are the right way to go?

raven canopy
#

I would say yes. Having the "release artifacts" integrated with GitHub means you don't have to implement that elsewhere. Not that AWS S3, or the like, integration is too difficult.

tough flax
#

Ok, another choice, @onyx hinge & @raven canopy ...

I think the right choice here is to setup a repository that just has the builds w/appropriate Readme files... That way, it's separate from the CP repo & does one thing well - holds the XAC builds. However, another option is to fork CP and just have it sync w/CP before each build.

Opinions on those?

onyx hinge
#

either is possible. my way of thinking would be to take advantage of "git merge", but -- if you have a totally different .github directory, then merges will trip you up instead of helping. Maybe you make CP a submodule of your own repo?

raven canopy
#

I'm sure Dan has suggested it, but why not just make board defs in the CP repo?

#

But, to @onyx hinge's point, having CP as a submodule and scripting the builds with your config is probably doable.

tough flax
#

So, this isn't a new board def... it's a flag for ALL the board defs.

#

So, it would essentially double the build time on CP

simple pulsar
#

Is anyone aware of Bluetooth issues with reading the last message sent if the connection has been closed by the program ending on the sender side? I think I'm seeing a problem there but I need to craft a smaller example to reproduce it

meager fog
#

@onyx hinge hihi ok finally ready to test

#

nrf52840 feather soldered up πŸ™‚

onyx hinge
#

@meager fog OK I happen to be around

meager fog
#

hmm did actions not run successfullyu

#

im lookin for the artifacts

onyx hinge
#

oh no!

meager fog
#

maybe cause its a draft?

#

if you can toss me a uf2

#

it will save me 15 min

onyx hinge
#

let me build it real quick

meager fog
#

npnp

#

its not easy for me to build due to my weird setup

#

but i can if i have to

onyx hinge
#

it SHOULD work with pwm but .. I didn't test it

#

hmm on a CPB it makes noise but it is absoulte not intelligible 😦 that's with PWM

meager fog
#

hhuh

onyx hinge
#

way too slow & lots of high pitched hiss

#

let me make sure that build I sent to you works on my setup with i2s or whether I mucked something up

meager fog
#

@onyx hinge erk how do you copy an mp3 over?

#

it crashes cause its too large?

onyx hinge
meager fog
#

ooh ok

#

πŸ‘

#

yah i was def hitting that

onyx hinge
#

I only copied the test.mp3 file and didn't encounter the problem then

meager fog
#

yah

#

audio plays!

#

haven't tried 2 at once

onyx hinge
#

OK, for pwm audio on nrf, looks like it is a two channels bug

#

i.e., I didn't (adequately) test stereo

meager fog
#

playing a fairly long song

onyx hinge
#

at least that is why it doesn't play at the right rate. I don't think it would explain the high pitched noise.

#

song length shouldn't affect proper functioning .. fingers crossed

meager fog
#

thats just under 2MB, stereo 128kb

#

plays great

onyx hinge
#

yayayay

#

kk tossed the stereo pwm bug in basecamp so it stays on my list

meager fog
#

.play() doesnt 'seek(0)'

#

but i think you know that

onyx hinge
#

yeah looping doesn't work, that would be another aspect of the same bug I bet

#

I was using the uda i2s, I didn't test with max

meager fog
#

npnp

#

can always close-reopen πŸ™‚

onyx hinge
#

I'll get it fixed for sure. looping needs to work

meager fog
#

shorter demo

#
import audiobusio
import board
import time
import gc

gc.collect(); mf0 = gc.mem_free()
file = open("test.mp3", "rb")
mp3 = audiocore.MP3File(file)
gc.collect(); mf1 = gc.mem_free()
print(mp3, mf0 - mf1)

audio = audiobusio.I2SOut(board.D6, board.D9, board.D10)

audio.play(mp3)
while audio.playing:
    time.sleep(1)
audio.stop()
print("stopped")
#

not worried about it at all

#

works surpringly well

#

64mhz is not fast!

#

the fact u can play 2 at a time is surprsing

onyx hinge
#

this looks close, should I make stm32 audio my next thing? I have the feather.

meager fog
#

yah

onyx hinge
#

sweet

meager fog
#

stm32 has dac, but no i2s yet

#

dac isn't DMA's i think

#

not sure where that stands