Skip to content

Commit

Permalink
Add delay for scan
Browse files Browse the repository at this point in the history
  • Loading branch information
203Null committed Dec 1, 2024
1 parent 21ee51f commit 52243c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,24 @@ static int selected_boot_partition(const bootloader_state_t *bs) {

esp_rom_gpio_pad_select_gpio(PIN_BUTTON_UF2);
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[PIN_BUTTON_UF2]);
esp_rom_gpio_pad_pullup_only(PIN_BUTTON_UF2);
#ifdef BUTTON_ACTIVE_HIGH
gpio_pad_pulldown(PIN_BUTTON_UF2);
#else
gpio_pad_pullup(PIN_BUTTON_UF2);
#endif
for(volatile uint16_t i = 0; i < 100; i++){} //Add small delay
#ifndef FASTBOOT
uint32_t tm_start = esp_log_early_timestamp();
while (UF2_DETECTION_DELAY_MS > (esp_log_early_timestamp() - tm_start) )
{
#endif
#ifdef BUTTON_ACTIVE_HIGH
if ( gpio_ll_get_level(&GPIO, PIN_BUTTON_UF2) == 1 )
#else
if ( gpio_ll_get_level(&GPIO, PIN_BUTTON_UF2) == 0 )
#endif
{
ESP_LOGI(TAG, "Detect GPIO %d active to enter UF2 bootloader", PIN_BUTTON_UF2);

// run the GPIO detection at least once even if UF2_DETECTION_DELAY_MS is set to zero
uint32_t tm_start = esp_log_early_timestamp();
Expand Down
2 changes: 1 addition & 1 deletion workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"terminal.integrated.shell.windows" : "cmd.exe",
"terminal.integrated.shellArgs.windows" : [
"/k",
"lib\\esp-idf\\export.bat"
"C:\\Espressif\\frameworks\\esp-idf-v4.4\\export.bat"
],
"files.associations": {
"*.mk": "makefile",
Expand Down

0 comments on commit 52243c7

Please sign in to comment.