lancaster-university / microbit-dal

http://lancaster-university.github.io/microbit-docs
Other
256 stars 130 forks source link

serial/fibers problem #461

Open mmoskal opened 4 years ago

mmoskal commented 4 years ago

From https://github.com/microsoft/pxt-microbit/issues/2709

The following program blinks nicely until A is pressed. Then the release_fiber() seems to exit.

Joe, this is blocking on MakeCode side.

void onButton(MicroBitEvent e) {
    uBit.serial.send((uint8_t *)" ", 1);
}

void blink() {
    for (;;) {
        uBit.display.image.setPixelValue(0, 0, 255);
        fiber_sleep(100);
        uBit.display.image.setPixelValue(0, 0, 0);
        fiber_sleep(100);
    }
}

int main() {
    uBit.init();
    uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_CLICK, onButton);
    create_fiber(blink);
    release_fiber();
    return 0;
}
finneyj commented 4 years ago

Thanks @mmoskal. I'll check it out today.

finneyj commented 4 years ago

Fixed in https://github.com/lancaster-university/microbit-dal/commit/f96a39036664495c7f934d1688c744f7d51b025b

zfm076 commented 4 years ago

Fixed in f96a390

Hi, I found a problem on the radio.Could you take a look at it for me? Fix: #462