Skip to content

Commit 32c1b1e

Browse files
committed
Only wait longer for restart if AI-deck is attached, reduce wait time
Since nrf-firmware will now only delay boot if AI-deck is attached, and boot times have been reduced
1 parent c654a1b commit 32c1b1e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

cflib/bootloader/__init__.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@ def flash(self, filename: str, targets: List[Target], cf=None, enable_console_lo
278278
# Reset to firmware mode
279279
self.reset_to_firmware()
280280
self.close()
281-
time.sleep(12)
281+
282+
if any(deck.target == 'bcAI:gap8' for deck in deck_targets):
283+
time.sleep(7)
284+
else:
285+
time.sleep(2)
282286

283287
# Flash all decks and reboot after each deck
284288
current_index = 0
@@ -289,7 +293,10 @@ def flash(self, filename: str, targets: List[Target], cf=None, enable_console_lo
289293
self.progress_cb('Deck updated! Restarting...', int(100))
290294
if current_index != -1:
291295
PowerSwitch(self.clink).reboot_to_fw()
292-
time.sleep(12)
296+
if any(deck.target == 'bcAI:gap8' for deck in deck_targets):
297+
time.sleep(7)
298+
else:
299+
time.sleep(2)
293300

294301
# Put the crazyflie back in Bootloader mode to exit the function in the same state we entered it
295302
self.start_bootloader(warm_boot=True, cf=cf)
@@ -601,7 +608,10 @@ def _flash_deck_incrementally(self, artifacts: List[FlashArtifact], targets: Lis
601608
self.progress_cb(f'Updating deck {deck.name}', 0)
602609

603610
# Test and wait for the deck to be started
604-
timeout_time = time.time() + 12
611+
if any(deck.name == 'bcAI:gap8' for deck in decks.values()):
612+
timeout_time = time.time() + 9
613+
else:
614+
timeout_time = time.time() + 4
605615
while not deck.is_started:
606616
if time.time() > timeout_time:
607617
raise RuntimeError(f'Deck {deck.name} did not start')
@@ -628,7 +638,10 @@ def _flash_deck_incrementally(self, artifacts: List[FlashArtifact], targets: Lis
628638
continue
629639

630640
# Wait for bootloader to be ready
631-
timeout_time = time.time() + 12
641+
if any(deck.name == 'bcAI:gap8' for deck in decks.values()):
642+
timeout_time = time.time() + 9
643+
else:
644+
timeout_time = time.time() + 4
632645
while not deck.is_bootloader_active:
633646
if time.time() > timeout_time:
634647
raise RuntimeError(f'Deck {deck.name} did not enter bootloader mode')

0 commit comments

Comments
 (0)