Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/BlueSCSI_platform_RP2MCU/BlueSCSI_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,6 @@ static void usb_input_poll()
mass_storage_reboot_keyed = true;
basic_reboot_keyed = uf2_reboot_keyed = false;
logmsg("Boot into mass storage requested, press 'y' to engage or any key to clear");
*scratch0 = REBOOT_INTO_MASS_STORAGE_MAGIC_NUM;
break;
case 'B':
case 'b':
Expand Down Expand Up @@ -1509,7 +1508,18 @@ static void usb_input_poll()
// A watchdog reset drops the supply on some boards (Ultra Wide
// reports HAD_POR afterwards), wiping the scratch0 magic.
// SYSRESETREQ keeps the watchdog block powered so it survives.
platform_delay_ms_with_usb(200);
// Arm only once confirmed. Setting it on 'm' outlived
// "Cleared reboot setting" and any later reset booted into
// mass storage.
*scratch0 = REBOOT_INTO_MASS_STORAGE_MAGIC_NUM;
// platform_delay_ms_with_usb() only runs tud_task(); usb_log_poll()
// is what moves the log into the CDC FIFO, so pump both or the
// message above never reaches the console before the reset.
for (int i = 0; i < 20; i++)
{
usb_log_poll();
platform_delay_ms_with_usb(10);
}
scb_hw->aircr = 0x05FA0004;
while (1);
}
Expand Down