add DISABLE_REBOOT

This commit is contained in:
Steven Dan
2026-04-16 21:31:01 +08:00
parent ee4268c37f
commit 32525b01d4

View File

@@ -494,22 +494,28 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
printf("Detected Windows OS (OS_WIN) saved_mode: %d\n", saved_mode);
unsigned flag = (saved_mode <= 1) ? MODE_F1_MUSIC_UAC2 : MODE_F3_F4_FPS_UAC2;
SetRoleSwitchFlag(flag);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
}
else
{
#if F5_MUSIC_UAC1
if (saved_mode >= 2) {
SetRoleSwitchFlag(MODE_F6_F7_FPS_UAC1);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
}
#elif F6_F7_FPS_UAC1
if (saved_mode <= 1) {
SetRoleSwitchFlag(MODE_F5_MUSIC_UAC1);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
}
#endif
}
@@ -865,8 +871,10 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
debug_printf("Set role switch flag: 0x%04X, switching firmware, rebooting...\n", mode_flag);
SetRoleSwitchFlag(mode_flag);
delay_milliseconds(20);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
} else {
debug_printf("Same firmware mode (0x%04X), updating mode and algorithm state without reboot\n", mode_flag);
@@ -1288,8 +1296,10 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
// Reboot: F5 will re-detect OS and route to correct firmware
debug_printf("Mode %d requires firmware switch, rebooting\n", active_mode);
delay_milliseconds(200);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
}
// Local update path (no reboot): update LEDs and DSP algorithm
@@ -1355,8 +1365,10 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
// 出厂恢复默认AI7.1模式mode=3需要F3/F4固件
SetRoleSwitchFlag(MODE_F3_F4_FPS_UAC2);
delay_milliseconds(20);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
} else if (factory_reset_blink_state % 2 == 0) {
// 偶数相:全灭
led_off(&led_ctx, LED_MUSIC);
@@ -1491,8 +1503,10 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
lfs_format_all();
}
delay_milliseconds(500);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
}
}
@@ -2065,8 +2079,10 @@ void button_task(chanend c_hidSendData, chanend cc_mic_level, chanend c_uac_vol,
if (host_os == OS_WIN) {
unsigned flag = (saved_mode <= 1) ? MODE_F1_MUSIC_UAC2 : MODE_F3_F4_FPS_UAC2;
SetRoleSwitchFlag(flag);
#ifndef DISABLE_REBOOT
device_reboot();
while (1);
#endif
}
#endif
break;