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); +}