mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-04 04:13:00 +02:00
Fix potential freeze.
For unknown reason, button cannot be checked if USB is active, as it is stalled. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -136,6 +136,10 @@ void timeout_start() {
|
|||||||
timeout = board_millis();
|
timeout = board_millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_busy() {
|
||||||
|
return timeout > 0;
|
||||||
|
}
|
||||||
|
|
||||||
void execute_tasks();
|
void execute_tasks();
|
||||||
|
|
||||||
static bool req_button_pending = false;
|
static bool req_button_pending = false;
|
||||||
@@ -310,7 +314,7 @@ int main(void) {
|
|||||||
neug_task();
|
neug_task();
|
||||||
do_flash();
|
do_flash();
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
if (board_millis() > 1000) { // wait 1 second to boot up
|
if (board_millis() > 1000 && !is_busy()) { // wait 1 second to boot up
|
||||||
bool current_button_state = board_button_read();
|
bool current_button_state = board_button_read();
|
||||||
if (current_button_state != button_pressed_state) {
|
if (current_button_state != button_pressed_state) {
|
||||||
if (current_button_state == false) { // unpressed
|
if (current_button_state == false) { // unpressed
|
||||||
|
|||||||
Reference in New Issue
Block a user