add DISABLE_REBOOT
This commit is contained in:
@@ -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);
|
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;
|
unsigned flag = (saved_mode <= 1) ? MODE_F1_MUSIC_UAC2 : MODE_F3_F4_FPS_UAC2;
|
||||||
SetRoleSwitchFlag(flag);
|
SetRoleSwitchFlag(flag);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if F5_MUSIC_UAC1
|
#if F5_MUSIC_UAC1
|
||||||
if (saved_mode >= 2) {
|
if (saved_mode >= 2) {
|
||||||
SetRoleSwitchFlag(MODE_F6_F7_FPS_UAC1);
|
SetRoleSwitchFlag(MODE_F6_F7_FPS_UAC1);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#elif F6_F7_FPS_UAC1
|
#elif F6_F7_FPS_UAC1
|
||||||
if (saved_mode <= 1) {
|
if (saved_mode <= 1) {
|
||||||
SetRoleSwitchFlag(MODE_F5_MUSIC_UAC1);
|
SetRoleSwitchFlag(MODE_F5_MUSIC_UAC1);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#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);
|
debug_printf("Set role switch flag: 0x%04X, switching firmware, rebooting...\n", mode_flag);
|
||||||
SetRoleSwitchFlag(mode_flag);
|
SetRoleSwitchFlag(mode_flag);
|
||||||
delay_milliseconds(20);
|
delay_milliseconds(20);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
debug_printf("Same firmware mode (0x%04X), updating mode and algorithm state without reboot\n", mode_flag);
|
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
|
// Reboot: F5 will re-detect OS and route to correct firmware
|
||||||
debug_printf("Mode %d requires firmware switch, rebooting\n", active_mode);
|
debug_printf("Mode %d requires firmware switch, rebooting\n", active_mode);
|
||||||
delay_milliseconds(200);
|
delay_milliseconds(200);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local update path (no reboot): update LEDs and DSP algorithm
|
// 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固件
|
// 出厂恢复默认AI7.1模式(mode=3),需要F3/F4固件
|
||||||
SetRoleSwitchFlag(MODE_F3_F4_FPS_UAC2);
|
SetRoleSwitchFlag(MODE_F3_F4_FPS_UAC2);
|
||||||
delay_milliseconds(20);
|
delay_milliseconds(20);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
|
#endif
|
||||||
} else if (factory_reset_blink_state % 2 == 0) {
|
} else if (factory_reset_blink_state % 2 == 0) {
|
||||||
// 偶数相:全灭
|
// 偶数相:全灭
|
||||||
led_off(&led_ctx, LED_MUSIC);
|
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();
|
lfs_format_all();
|
||||||
}
|
}
|
||||||
delay_milliseconds(500);
|
delay_milliseconds(500);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
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) {
|
if (host_os == OS_WIN) {
|
||||||
unsigned flag = (saved_mode <= 1) ? MODE_F1_MUSIC_UAC2 : MODE_F3_F4_FPS_UAC2;
|
unsigned flag = (saved_mode <= 1) ? MODE_F1_MUSIC_UAC2 : MODE_F3_F4_FPS_UAC2;
|
||||||
SetRoleSwitchFlag(flag);
|
SetRoleSwitchFlag(flag);
|
||||||
|
#ifndef DISABLE_REBOOT
|
||||||
device_reboot();
|
device_reboot();
|
||||||
while (1);
|
while (1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user