Closed jessegreenberg closed 1 week ago
I was not able to reproduce this today. Here is what I tried. For each of them, I tried adding/removing programs, and tried changing strings and components and resending the project while programs were still active in the camera.
1) Reading the microbit button press and having it control the project. Tried adding/removing programs, and changing/resending the project from Creator. 2) Writing to microbit LEDs. Tried adding/removing programs, and changing/resending the project from Creator. 3) Reading a UART value. Tried adding/removing programs and resending the project from Creator while the program was still active. 4) Writing with UART. Tried adding/removing programs and resending the project from Creator while the program was still active.
I trust the multilink listener removal and think it is probably related to the BLE characteristic listener not being removed correctly. This is done like this on onProgramRemoved:
phet.paperLand.console.log( 'Removing a BLE component' );
phet.paperLand.boardBluetoothServers.removeCharacteristicListener(
'{{SERVICE_ID}}',
'{{CHARACTERISTIC_ID}}',
scratchpad.characteristicListener
).catch( error => {
phet.paperLand.console.error( error );
} );
If we hit that error, it may indicate what is causing this. We can try to put a breakpoint there. The error should only happen if the device no longer has the service/service characteristic available. But maybe the error is happening more often.
Also, removing the characteristic listener is asynchronous, which might be causing problems.
I am not sure if this is still a problem, @brettfiedler have you encountered this again?
I haven't found this again, though there have been other compounding troubleshooting. Closing, but will re-open if I or others discover it.
It seems like after new a paper is removed, listeners related to BLE components are not cleared. See microcontroller-ble-demos/microbit-ratio-game. @brettfiedler FYI.