aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-adc.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-08-23 19:22:22 -0600
committerSelene ToyKeeper2017-08-23 19:22:22 -0600
commit5631564b329d0445fb282e5e387217ba4e4ff191 (patch)
tree008d8aec159c7ada2b2e650d71c4f092bc6679d5 /spaghetti-monster/fsm-adc.h
parentMade Baton a little easier to read: (diff)
downloadanduril-5631564b329d0445fb282e5e387217ba4e4ff191.tar.gz
anduril-5631564b329d0445fb282e5e387217ba4e4ff191.tar.bz2
anduril-5631564b329d0445fb282e5e387217ba4e4ff191.zip
Added thermal regulation to SpaghettiMonster / Baton.
Made some LVP values configurable. Removed high_temperature() / low_temperature() shortcuts for now.
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/fsm-adc.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h
index ac42333..43d52a6 100644
--- a/spaghetti-monster/fsm-adc.h
+++ b/spaghetti-monster/fsm-adc.h
@@ -20,21 +20,54 @@
#ifndef FSM_ADC_H
#define FSM_ADC_H
+
#ifdef USE_LVP
-// volts * 10
-#define VOLTAGE_LOW 30
+// default 5 seconds between low-voltage warning events
+#ifndef VOLTAGE_WARNING_SECONDS
+#define VOLTAGE_WARNING_SECONDS 5
+#endif
+// low-battery threshold in volts * 10
+#ifndef VOLTAGE_LOW
+#define VOLTAGE_LOW 29
+#endif
// MCU sees voltage 0.X volts lower than actual, add X to readings
+#ifndef VOLTAGE_FUDGE_FACTOR
#define VOLTAGE_FUDGE_FACTOR 2
+#endif
volatile uint8_t voltage;
void low_voltage();
#endif
+
+
#ifdef USE_THERMAL_REGULATION
+// default 5 seconds between thermal regulation events
+#ifndef THERMAL_WARNING_SECONDS
+#define THERMAL_WARNING_SECONDS 5
+#endif
+// try to keep temperature below 45 C
+#ifndef DEFAULT_THERM_CEIL
+#define DEFAULT_THERM_CEIL 45
+#endif
+// don't allow user to set ceiling above 70 C
+#ifndef MAX_THERM_CEIL
+#define MAX_THERM_CEIL 70
+#endif
+// Local per-MCU calibration value
+#ifndef THERM_CAL_OFFSET
+#define THERM_CAL_OFFSET 0
+#endif
+// temperature now, in C (ish)
volatile int16_t temperature;
-void low_temperature();
-void high_temperature();
+// temperature in a few seconds, in C (ish) * 4 (13.2 fixed-point)
+volatile int16_t projected_temperature; // Fight the future!
+uint8_t therm_ceil = DEFAULT_THERM_CEIL;
+//void low_temperature();
+//void high_temperature();
#endif
+
inline void ADC_on();
inline void ADC_off();
+
#endif