stm32/boardctrl: Show first reset-mode state on LEDs when selecting.
Commit 1e297c8898
introduced a bug where the
very first reset-mode state on the LEDs was not shown, because prior to
that commit the first reset-mode state was the same as the initial LED
state (green on, others off) and update_reset_mode() was called after
setting this initial LED state.
This is fixed in this commit by changing the update_reset_mode() loop so
that it displays the current reset mode before doing the delay.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
a72b8443ca
commit
885b246ca9
@ -51,20 +51,21 @@ STATIC uint update_reset_mode(uint reset_mode) {
|
|||||||
// The original method used on the pyboard is appropriate if you have 2
|
// The original method used on the pyboard is appropriate if you have 2
|
||||||
// or more LEDs.
|
// or more LEDs.
|
||||||
#if defined(MICROPY_HW_LED2)
|
#if defined(MICROPY_HW_LED2)
|
||||||
for (uint i = 0; i < 3000; i++) {
|
for (uint i = 0; i < 100; i++) {
|
||||||
if (!switch_get()) {
|
led_state(2, reset_mode & 1);
|
||||||
break;
|
led_state(3, reset_mode & 2);
|
||||||
}
|
led_state(4, reset_mode & 4);
|
||||||
mp_hal_delay_ms(20);
|
for (uint j = 0; j < 30; ++j) {
|
||||||
if (i % 30 == 29) {
|
mp_hal_delay_ms(20);
|
||||||
if (++reset_mode > BOARDCTRL_RESET_MODE_FACTORY_FILESYSTEM) {
|
if (!switch_get()) {
|
||||||
reset_mode = BOARDCTRL_RESET_MODE_NORMAL;
|
goto select_mode;
|
||||||
}
|
}
|
||||||
led_state(2, reset_mode & 1);
|
}
|
||||||
led_state(3, reset_mode & 2);
|
if (++reset_mode > BOARDCTRL_RESET_MODE_FACTORY_FILESYSTEM) {
|
||||||
led_state(4, reset_mode & 4);
|
reset_mode = BOARDCTRL_RESET_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
select_mode:
|
||||||
// flash the selected reset mode
|
// flash the selected reset mode
|
||||||
for (uint i = 0; i < 6; i++) {
|
for (uint i = 0; i < 6; i++) {
|
||||||
led_state(2, 0);
|
led_state(2, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user