microbit-foundation / micropython-microbit-v2

Temporary home for MicroPython for micro:bit v2 as we stablise it before pushing upstream
MIT License
44 stars 25 forks source link

This recording programme panics with CODAL error 030 #191

Closed microbit-carlos closed 5 months ago

microbit-carlos commented 5 months ago

Using the latest version (at the time of writing) of the recording & playback branch: https://github.com/microbit-foundation/micropython-microbit-v2/commit/0b06914c71c18533da90df85230ac198578669bf Hex: https://github.com/microbit-foundation/micropython-microbit-v2/actions/runs/8416237764?pr=163

Takes less than 9min:

from microbit import *
import radio

PACKET_SIZE = 128

def radio_sender():
    my_audio = audio.AudioFrame(duration=4000)
    while True:
        microphone.record_into(my_audio)
        audio_mv = memoryview(my_audio)
        for i in range(0, len(audio_mv), PACKET_SIZE):
            radio.send_bytes(audio_mv[i:i+PACKET_SIZE])

def main():
    radio.on()
    radio.config(length=PACKET_SIZE, queue=64)

    display.show("S")
    radio_sender()

if __name__ == "__main__":
    main()

CODAL panic error 030 is a DEVICE_HEAP_ERROR. It could be an issue from the CODAL side, but it'd be good to try to confirm that first.

microbit-carlos commented 5 months ago

I saw this issue multiple times yesterday with that programme, but today I'm struggling to reproduce. I'll see if any of the modifications I might have done introduce this issue again, but if I can't find the right combination I'll close this issue.

microbit-carlos commented 5 months ago

I haven't been able to replicate this, so I'll close for now. I can always open it again if I do see it in the future and have an exact copy of the programme.