aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-28 12:40:16 -0700
committerSelene ToyKeeper2023-11-28 12:40:16 -0700
commit064ea51863a4d873efef2cf9bfc557233a7057fb (patch)
tree49a9ac86b9ce3598ab7c4c9f15a52447d7dc0c01 /hw
parentfixed incorrect temperature history for a few seconds after waking (diff)
downloadanduril-064ea51863a4d873efef2cf9bfc557233a7057fb.tar.gz
anduril-064ea51863a4d873efef2cf9bfc557233a7057fb.tar.bz2
anduril-064ea51863a4d873efef2cf9bfc557233a7057fb.zip
fixed FW3X thermal regulation
It had no minimum thermal stepdown defined, so it used MAX_7135 by default, which was level 149/150 ... thus virtually no regulation. I also made it easier to switch between internal and external temperature sensors by just commenting out a few lines in the hwdef.h.
Diffstat (limited to 'hw')
-rw-r--r--hw/lumintop/fw3x-lume1/anduril.h1
-rw-r--r--hw/lumintop/fw3x-lume1/hwdef.c10
2 files changed, 7 insertions, 4 deletions
diff --git a/hw/lumintop/fw3x-lume1/anduril.h b/hw/lumintop/fw3x-lume1/anduril.h
index b7dbc82..cd06c6a 100644
--- a/hw/lumintop/fw3x-lume1/anduril.h
+++ b/hw/lumintop/fw3x-lume1/anduril.h
@@ -33,6 +33,7 @@
#define PWM2_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255
#define DEFAULT_LEVEL 56
#define MAX_1x7135 149
+#define MIN_THERM_STEPDOWN 50
#define HALFSPEED_LEVEL 21
#define QUARTERSPEED_LEVEL 11
diff --git a/hw/lumintop/fw3x-lume1/hwdef.c b/hw/lumintop/fw3x-lume1/hwdef.c
index 791a080..306a58c 100644
--- a/hw/lumintop/fw3x-lume1/hwdef.c
+++ b/hw/lumintop/fw3x-lume1/hwdef.c
@@ -83,10 +83,8 @@ bool gradual_tick_main(uint8_t gt) {
// 150/150 is full FET + zero regulated,
// 149/150 is zero FET + full regulated,
// so don't try to gradually adjust between
- if ((RAMP_SIZE == actual_level) || (gt >= RAMP_SIZE-1)) {
- set_level(gt + 1);
- return true;
- }
+ // if target is in the top 2 levels, just let the parent handle it
+ if (gt >= RAMP_SIZE-2) return true;
PWM1_DATATYPE ch1 = PWM1_GET(gt);
@@ -110,6 +108,8 @@ bool gradual_tick_main(uint8_t gt) {
////////// external temperature sensor //////////
+#ifdef ADMUX_THERM_EXTERNAL_SENSOR
+
void hwdef_set_admux_therm() {
// put the ADC in temperature mode
// ADCSRB: [VDEN, VDPD, -, -, ADLAR, ADTS2, ADTS1, ADTS0]
@@ -140,3 +140,5 @@ uint16_t temp_raw2cooked(uint16_t measurement) {
return k6;
}
+#endif
+