2.0.1
# double_reset [![test](https://github.com/mdvorak/esp-double-reset/actions/workflows/test.yml/badge.svg)](https://github.com/mdvorak/esp-double-reset/actions/workflows/test.yml) Detect double reset, which can be used to place program in special reconfiguration mode, like entering Wi-Fi credentials. ## Usage To reference this library by your project, add it as git submodule, using command ```shell git submodule add https://github.com/mdvorak/esp-double-reset.git components/double_reset ``` or use it as platformio library ```ini [env] lib_deps = https://github.com/mdvorak/esp-double-reset.git#v1.0.2 ``` Note that when used as platformio library, `Kconfig` is not available. Either add [Kconfig](./Kconfig) contents to your `Kconfig.projbuild`, or set `DOUBLE_RESET_DEFAULT_TIMEOUT` manually, via ```ini [env] build_flags = -D DOUBLE_RESET_DEFAULT_TIMEOUT=3000 ``` ### Example ```c #include <double_reset.h> void app_main() { // Initialize NVS esp_err_t ret = nvs_flash_init(); if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { ESP_ERROR_CHECK(nvs_flash_erase()); ret = nvs_flash_init(); } ESP_ERROR_CHECK(ret); // Check double reset // NOTE this should be called as soon as possible, ideally right after nvs init bool reconfigure = false; ESP_ERROR_CHECK(double_reset_start(&reconfigure, 10000)); if (reconfigure) { ESP_LOGI(TAG, "double reset detected!"); } // Setup complete ESP_LOGI(TAG, "started"); } ``` For working example, see [example/main.cpp](example/main.cpp). ## Development Prepare [ESP-IDF development environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#get-started-get-prerequisites) . Configure example application with ``` cd example/ idf.py menuconfig ``` Flash it via (in the example dir) ``` idf.py build flash monitor ``` As an alternative, you can use [PlatformIO](https://docs.platformio.org/en/latest/core/installation.html) to build and flash the example project.
# Changelog ## [2.0.1](https://github.com/mdvorak/esp-double-reset/compare/v2.0.0...v2.0.1) (2024-03-31) ### Bug Fixes * set component name to double-reset ([181d614](https://github.com/mdvorak/esp-double-reset/commit/181d61401463c936f799adf26e18f1e54f52673e)) ## [2.0.0](https://github.com/mdvorak/esp-double-reset/compare/v1.0.2...v2.0.0) (2024-03-31) ### ⚠ BREAKING CHANGES * no longer support <4.4 IDF ### Features * no longer support <4.4 IDF ([83520f6](https://github.com/mdvorak/esp-double-reset/commit/83520f6ad64afd05a9d08c517679fbb5dcc13941)) ### Bug Fixes * :rotating_light: Adjust the format strings to use format specifiers from inttypes.h, for example PRIu32 for uint32_t ([93ee791](https://github.com/mdvorak/esp-double-reset/commit/93ee791f77f261a65024d7928bd8bb74c40dd815)) ### [1.0.2](https://github.com/mdvorak/esp-double-reset/compare/v1.0.1...v1.0.2) (2022-01-22) ### Bug Fixes * updating whole library to new format ([25f6114](https://github.com/mdvorak/esp-double-reset/commit/25f61142298f9eb8c819bad2df10497275ae417c))
2026eddc1a1ec47eca3d0be9aec431bb73f1c999
idf.py add-dependency "mdvorak/double_reset^2.0.1"