Skip to content

Commit 9ff7357

Browse files
committed
ARMmbed#86 Return reset button to default state after flashing finishes to ignore any long press event
1 parent e4e9b2d commit 9ff7357

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/board/microbitv2/microbitv2.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ static bool automatic_sleep_on = AUTOMATIC_SLEEP_DEFAULT;
128128
static app_power_mode_t interface_power_mode = kAPP_PowerModeVlls0;
129129
// reset button state count
130130
static uint16_t gpio_reset_count = 0;
131+
// button state
132+
static uint8_t reset_pressed = 0;
131133
static bool do_remount = false;
132134

133135
static flashConfig_t gflashConfig = {
@@ -273,9 +275,6 @@ static void prerun_board_config(void)
273275
// Handle the reset button behavior, this function is called in the main task every 30ms
274276
void handle_reset_button()
275277
{
276-
// button state
277-
static uint8_t reset_pressed = 0;
278-
279278
#ifdef DRAG_N_DROP_SUPPORT
280279
if (!flash_intf_target->flash_busy()) //added checking if flashing on target is in progress
281280
#endif
@@ -522,7 +521,9 @@ void board_usb_sof_event(void)
522521

523522
void board_vfs_stream_closed_hook()
524523
{
525-
// Return LED to default ON state
524+
// Return reset button and LED to default state
525+
reset_pressed = 0;
526+
power_led_sleep_state_on = PWR_LED_SLEEP_STATE_DEFAULT;
526527
main_shutdown_state = MAIN_SHUTDOWN_WAITING;
527528

528529
// Clear any pending I2C response

0 commit comments

Comments
 (0)