From 482bb8ed71db70433667daeddd38d5397f36b88d Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Wed, 17 Jan 2024 15:18:11 +0300 Subject: [PATCH] Disable ESP32 reset on low voltage --- flix/flix.ino | 1 + flix/util.ino | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/flix/flix.ino b/flix/flix.ino index 18d68a9..fd692b6 100644 --- a/flix/flix.ino +++ b/flix/flix.ino @@ -36,6 +36,7 @@ float motors[4]; // normalized motors thrust in range [-1..1] void setup() { Serial.begin(SERIAL_BAUDRATE); Serial.println("Initializing flix"); + disableBrownOut(); setupLED(); setupMotors(); setLED(true); diff --git a/flix/util.ino b/flix/util.ino index f25c40f..97b9e85 100644 --- a/flix/util.ino +++ b/flix/util.ino @@ -4,6 +4,8 @@ // Utility functions #include "math.h" +#include +#include float mapf(long x, long in_min, long in_max, float out_min, float out_max) { return (float)(x - in_min) * (out_max - out_min) / (float)(in_max - in_min) + out_min; @@ -41,3 +43,8 @@ void printArray(T arr[], int size) { } Serial.println("}"); } + +// Disable reset on low voltage +void disableBrownOut() { + WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); +}