From 064ea51863a4d873efef2cf9bfc557233a7057fb Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Tue, 28 Nov 2023 12:40:16 -0700 Subject: 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. --- hw/lumintop/fw3x-lume1/anduril.h | 1 + hw/lumintop/fw3x-lume1/hwdef.c | 10 ++++++---- 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 + -- cgit v1.2.3