mirror of
https://github.com/okalachev/flix.git
synced 2026-06-28 05:56:44 +00:00
Move disabling brown-out code to power subsystem
This commit is contained in:
+1
-1
@@ -18,8 +18,8 @@ extern float motors[4];
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
print("Initializing flix\n");
|
||||
disableBrownOut();
|
||||
setupParameters();
|
||||
setupPower();
|
||||
setupLED();
|
||||
setLED(true);
|
||||
setupMotors();
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
// Power management
|
||||
|
||||
#include <soc/soc.h>
|
||||
#include <soc/rtc_cntl_reg.h>
|
||||
#include "lpf.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -11,6 +13,11 @@ LowPassFilter<float> voltageFilter(0.2);
|
||||
int voltagePin = -1;
|
||||
float voltageScale = 2;
|
||||
|
||||
void setupPower() {
|
||||
// Disable reset on low voltage
|
||||
REG_CLR_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ENA);
|
||||
}
|
||||
|
||||
void readVoltage() {
|
||||
if (voltagePin < 0) return;
|
||||
static Rate rate(10);
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <math.h>
|
||||
#include <soc/soc.h>
|
||||
#include <soc/rtc_cntl_reg.h>
|
||||
|
||||
const float ONE_G = 9.80665;
|
||||
extern float t;
|
||||
@@ -35,11 +33,6 @@ float wrapAngle(float angle) {
|
||||
return angle;
|
||||
}
|
||||
|
||||
// Disable reset on low voltage
|
||||
void disableBrownOut() {
|
||||
REG_CLR_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ENA);
|
||||
}
|
||||
|
||||
// Trim and split string by spaces
|
||||
void splitString(String& str, String& token0, String& token1, String& token2) {
|
||||
str.trim();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Dummy file to make it possible to compile simulator with Flix' util.h
|
||||
|
||||
#define WRITE_PERI_REG(addr, val) {}
|
||||
#define REG_CLR_BIT(_r, _b) {}
|
||||
|
||||
Reference in New Issue
Block a user