Skip to content

Commit f19691e

Browse files
committed
Increase ESP flashing timeout by 5s to match GAP8.
When flashing the ESP, we also reboot the GAP8, requiring the same delay. However, since flashing the ESP firmware does not necessarily mean we are flashing the GAP8, we must explicitly check if the ESP is among our targets to apply the timeout correctly. This ensures the GAP8 is never in an incorrect state. This fixes #526. Also adds a missing boot delay in the reset-to-firmware call, originally intended in b7ead19.
1 parent b7ead19 commit f19691e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cflib/bootloader/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def flash(self, filename: str, targets: List[Target], cf=None, enable_console_lo
289289
self.progress_cb('Deck updated! Restarting...', int(100))
290290
if current_index != -1:
291291
PowerSwitch(self.clink).reboot_to_fw()
292-
if any(deck.target == 'bcAI:gap8' for deck in deck_targets):
292+
if any(deck.target in ['bcAI:gap8', 'bcAI:esp'] for deck in deck_targets):
293293
time.sleep(7)
294294
else:
295295
time.sleep(2)
@@ -337,7 +337,7 @@ def flash_full(self, cf: Optional[Crazyflie] = None,
337337

338338
if filename is not None:
339339
self.flash(filename, targets, cf, enable_console_log=enable_console_log)
340-
self.reset_to_firmware()
340+
self.reset_to_firmware(boot_delay=5.0)
341341

342342
def _get_flash_artifacts_from_zip(self, filename):
343343
if not zipfile.is_zipfile(filename):
@@ -604,7 +604,7 @@ def _flash_deck_incrementally(self, artifacts: List[FlashArtifact], targets: Lis
604604
self.progress_cb(f'Updating deck {deck.name}', 0)
605605

606606
# Test and wait for the deck to be started
607-
if any(deck.name == 'bcAI:gap8' for deck in decks.values()):
607+
if any(deck.name in ['bcAI:gap8', 'bcAI:esp'] for deck in decks.values()):
608608
timeout_time = time.time() + 9
609609
else:
610610
timeout_time = time.time() + 4
@@ -634,7 +634,7 @@ def _flash_deck_incrementally(self, artifacts: List[FlashArtifact], targets: Lis
634634
continue
635635

636636
# Wait for bootloader to be ready
637-
if any(deck.name == 'bcAI:gap8' for deck in decks.values()):
637+
if any(deck.name in ['bcAI:gap8', 'bcAI:esp'] for deck in decks.values()):
638638
timeout_time = time.time() + 9
639639
else:
640640
timeout_time = time.time() + 4

0 commit comments

Comments
 (0)