From a375cb5a6e26fd09eeea9deef18516a5f93e2423 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 25 Aug 2026 22:43:25 +0300 Subject: [PATCH] New method of disabling brownout --- flix/power.ino | 9 ++------- gazebo/{soc/soc.h => esp_private/brownout.h} | 2 +- gazebo/soc/rtc_cntl_reg.h | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) rename gazebo/{soc/soc.h => esp_private/brownout.h} (69%) delete mode 100644 gazebo/soc/rtc_cntl_reg.h diff --git a/flix/power.ino b/flix/power.ino index 906bc09..95d8126 100644 --- a/flix/power.ino +++ b/flix/power.ino @@ -3,10 +3,7 @@ // Power management -#ifndef CONFIG_IDF_TARGET_ESP32S31 -#include -#include -#endif +#include "esp_private/brownout.h" #include "filter.h" #include "util.h" @@ -16,9 +13,7 @@ int voltagePin = -1; float voltageScale = 2; void setupPower() { -#ifndef CONFIG_IDF_TARGET_ESP32S31 - REG_CLR_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ENA); // disable reset on low voltage -#endif + esp_brownout_disable(); // disable reset on low voltage if (digitalPinToAnalogChannel(voltagePin) == -1) voltagePin = -1; // test ADC pin } diff --git a/gazebo/soc/soc.h b/gazebo/esp_private/brownout.h similarity index 69% rename from gazebo/soc/soc.h rename to gazebo/esp_private/brownout.h index f9817f6..4748340 100644 --- a/gazebo/soc/soc.h +++ b/gazebo/esp_private/brownout.h @@ -1,3 +1,3 @@ // Dummy file to make it possible to compile simulator with Flix' util.h -#define REG_CLR_BIT(_r, _b) {} +void esp_brownout_disable() {}; diff --git a/gazebo/soc/rtc_cntl_reg.h b/gazebo/soc/rtc_cntl_reg.h deleted file mode 100644 index b41211d..0000000 --- a/gazebo/soc/rtc_cntl_reg.h +++ /dev/null @@ -1 +0,0 @@ -// Dummy file to make it possible to compile simulator with Flix' util.h