Implement safe, non-conflicting loopback boot method with BOOT button exit and automatic 120s timeout reset

This commit is contained in:
Adolfo Reyna
2026-06-17 23:07:58 -04:00
parent 95ee2fc036
commit d5f2abf2b8
2 changed files with 31 additions and 0 deletions
+20
View File
@@ -93,7 +93,27 @@ def main():
display.show()
print("Ready: Press and hold key/screen to record...")
start_wait = time.ticks_ms()
while not is_talk_trigger_active():
if buttons.boot.is_pressed() or time.ticks_diff(time.ticks_ms(), start_wait) > 120000:
print("Exit condition met. Deleting flag and resetting...")
if display:
display.clear(0)
if board_config.BOARD_TYPE == 'WAVESHARE_RLCD':
display.text("Exiting test...", 15, 60, 1)
display.text("Rebooting to normal...", 15, 80, 1)
else:
display.text("Exiting test...", 10, 50, 1)
display.text("Rebooting to normal...", 10, 70, 1)
display.show()
time.sleep(1)
try:
import os
os.remove("run_loopback.txt")
except:
pass
import machine
machine.reset()
time.sleep_ms(30)
print("Recording started! Speak into the microphone...")