calliope-edu / calliope-mini-flash-app-iOS

Pair your Calliope mini with your iOS device to flash your scripts to it
MIT License
1 stars 5 forks source link

Timing between app and Calliope mini with Just Works pairing #22

Closed joernalraun closed 4 months ago

joernalraun commented 11 months ago

When pairing mode is on "Easy" e.g. Just Works pairing in Beta-MakeCode the app hangs when trying to flash a hex. It works, when Calliope mini is then clicked on reset – or if the transfer within the app is stopped a restarted. So it seems that there is just a timing issue within the connection between both devices (the app tries to send data before the Calliope mini is restarted/in dfu mode).

TAKeanice commented 11 months ago

If I remember correctly there is indeed a fixed delay because the Calliope connects in flash mode before it is able to receive data. We can make this longer and see if it helps.

Amerlander commented 11 months ago

In my tests the pairing itself worked, it is only a small tweak required to make it work:

  1. User starts flashing for the first time.
  2. App aks for a pairing
  3. User presses accept button
  4. Mini shows Check on the display.
  5. Pairing was now sucessfull, but the mini need another restart to start flashing.
  6. The App does not send a "restart to dfu" command to the mini and starts sending the hex data instead
  7. Some bytes arive, but the flashing process stops (when the mini decides to stop showing the checkmark)
  8. The app hangs while showind some % of progress.
  9. To fix, the user has to Cancel the process and initiate the flashing process again - it will work now (unless https://github.com/calliope-edu/calliope-mini-flash-app-iOS/issues/23 is not kicking in and the user has to change the program first)

To fix this it would be enough to just change step 6 and make sure the mini is restarted into dfu mode again before the actuall flashing process starts. If it cant be done programatically a popup could ask the user to restart the mini when he sees a checkmark on the screen and confirm to continue the flashing process.

joernalraun commented 9 months ago

Postponed, because of reverted state of Makecode Bluetooth settings.