diff --git a/README.md b/README.md index 41a6e1f..81c6582 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ A push button is connected to the [ESP32](https://github.com/espressif/arduino-e On the master branch, I'm using [task notifications](https://www.freertos.org/RTOS_Task_Notification_As_Binary_Semaphore.html) from FreeRTOS to unblock a high-priority (relative to [core 1](https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s3/api-guides/performance/speed.html#choosing-application-task-priorities)) task responsible for debouncing in the software, despite the use of interrupts (which are disabled and enabled within that task). Therefore, when the button is not in use, the task remains blocked on a type of semaphore, conserving CPU resources. This allows the idle task to run uninterrupted until the button is pressed, ensuring the watchdog timer is consistently reset. The main thread is more efficient than the one in the V2 branch (which employs [busy wait](https://github.com/TIT8/shelly_esp32_button_espidf/tree/v2?tab=readme-ov-file#why-busy-wait-the-button-status-and-not-polling-it-or-be-notified-by-interrupts) for monitoring button status instead of being notified by interrupts). -In the main task, interrupts are enabled and disabled only on the GPIO pin used and on the core where the task is pinned, akin to a critical section, as outlined in the [official documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html#disabling-interrupts). [^4] +In the main task, interrupts are enabled and disabled only on the GPIO pin used and [on the core](https://github.com/TIT8/shelly_esp32_button_espidf/blob/1ccbeb450f857612228f9be3fbcbf5ec52a6ecf3/src/main.c#L190) where the task is pinned, akin to a critical section, as outlined in the [official documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html#disabling-interrupts). [^4] The code handles the scenario where the button is continuously pressed; after a while, the main thread will enter a blocked state. You can refer to [the relevant part of the firmware](https://github.com/TIT8/shelly_esp32_button_espidf/blob/88ec38896c9c9199dd878153d043701d34ed38f2/src/main.c#L265) for more details.