From 2fd969fa93b78655a31637df34a384fd8f08ca9e Mon Sep 17 00:00:00 2001 From: reaw55 <58457329+reaw55@users.noreply.github.com> Date: Wed, 22 May 2024 01:52:57 +0700 Subject: [PATCH] clean up and update time on startup --- platformio.ini | 2 +- src/main.cpp | 32 ++++---------------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/platformio.ini b/platformio.ini index 78fe175..3dca9d0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,6 +12,6 @@ platform = espressif32 board = wt32-eth01 framework = arduino -lib_deps = siwats/ESPMegaPROR3@^2.5.3 +lib_deps = siwats/ESPMegaPROR3@^2.9.0 monitor_speed = 115200 build_flags = -DCORE_DEBUG_LEVEL=0 diff --git a/src/main.cpp b/src/main.cpp index 5dd25e5..4faf06a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -104,15 +104,6 @@ void mqttSubscribeCallback() void setup() { - // ------------ GPIO 2 Factory Reset Check ------------ - gpio_config_t gpio_2_conf; - gpio_2_conf.intr_type = GPIO_INTR_DISABLE; - gpio_2_conf.mode = GPIO_MODE_INPUT; - gpio_2_conf.pull_up_en = GPIO_PULLUP_ENABLE; - gpio_config(&gpio_2_conf); - // If GPIO 2 is pulled low, clear the FRAM then reboot (Reset the device to factory defaults) - bool clear_fram = !gpio_get_level(GPIO_NUM_2); - // ------------ End GPIO 2 Factory Reset Check ------------ // ------------ Display Pre Initialization Routine ------------ @@ -132,29 +123,14 @@ void setup() // Give flow of control to OS and scheduler espmega.begin(); - - // // ------------ Factory Reset Routine ------------ - // Disable factory reset for now - espmega.inputs.loop(); - + // Set time zone to UTC+7 + espmega.setTimezone("ICT-7"); + // set debounce time to 500 for pin 0-11 for (uint16_t i = 0; i < 12; i++) { espmega.inputs.setDebounceTime(i, 500); - } - - // if (clear_fram) - // { - // Serial.print("boot_state.txt=\"Factory Resetting . . .\""); - // sendStopBytes(); - // for (uint16_t i = 0; i < 32768; i++) - // { - // espmega.fram.write8(i, 0); - // } - // esp_restart(); - // } - // // ------------ End Factory Reset Routine ------------ - + } // ------------ IoT Module Initialization Routine ------------ Serial.print("boot_state.txt=\"IoT Initializing . . .\"");