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() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
print("Initializing flix\n");
|
print("Initializing flix\n");
|
||||||
disableBrownOut();
|
|
||||||
setupParameters();
|
setupParameters();
|
||||||
|
setupPower();
|
||||||
setupLED();
|
setupLED();
|
||||||
setLED(true);
|
setLED(true);
|
||||||
setupMotors();
|
setupMotors();
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
// Power management
|
// Power management
|
||||||
|
|
||||||
|
#include <soc/soc.h>
|
||||||
|
#include <soc/rtc_cntl_reg.h>
|
||||||
#include "lpf.h"
|
#include "lpf.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@@ -11,6 +13,11 @@ LowPassFilter<float> voltageFilter(0.2);
|
|||||||
int voltagePin = -1;
|
int voltagePin = -1;
|
||||||
float voltageScale = 2;
|
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() {
|
void readVoltage() {
|
||||||
if (voltagePin < 0) return;
|
if (voltagePin < 0) return;
|
||||||
static Rate rate(10);
|
static Rate rate(10);
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <soc/soc.h>
|
|
||||||
#include <soc/rtc_cntl_reg.h>
|
|
||||||
|
|
||||||
const float ONE_G = 9.80665;
|
const float ONE_G = 9.80665;
|
||||||
extern float t;
|
extern float t;
|
||||||
@@ -35,11 +33,6 @@ float wrapAngle(float angle) {
|
|||||||
return 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
|
// Trim and split string by spaces
|
||||||
void splitString(String& str, String& token0, String& token1, String& token2) {
|
void splitString(String& str, String& token0, String& token1, String& token2) {
|
||||||
str.trim();
|
str.trim();
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// Dummy file to make it possible to compile simulator with Flix' util.h
|
// 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) {}
|
#define REG_CLR_BIT(_r, _b) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user