diff options
| author | Selene ToyKeeper | 2023-11-19 01:44:35 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2023-11-19 01:44:35 -0700 |
| commit | 95d931dc167ae01d6af1973ea68496584fe03541 (patch) | |
| tree | 7edbf18fb45cd95f200bed110a94c2a178792c2a /ui | |
| parent | version check: allow hex digits (diff) | |
| download | anduril-95d931dc167ae01d6af1973ea68496584fe03541.tar.gz anduril-95d931dc167ae01d6af1973ea68496584fe03541.tar.bz2 anduril-95d931dc167ae01d6af1973ea68496584fe03541.zip | |
ramp-mode: allow hwdef to adjust gradual tick speed
The gradual tick frequency was written for 8-bit PWM,
but it can be too slow on hardware with more bits.
The hwdef can compensate by using larger steps,
but that makes adjustments more visible...
So this provides an option to increase speed without visibility.
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/anduril/config-default.h | 6 | ||||
| -rw-r--r-- | ui/anduril/ramp-mode.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/ui/anduril/config-default.h b/ui/anduril/config-default.h index 04fc956..cd25b52 100644 --- a/ui/anduril/config-default.h +++ b/ui/anduril/config-default.h @@ -113,6 +113,12 @@ // timer is available in regular ramp mode and candle mode #define USE_SUNSET_TIMER +// optionally make gradual ticks happen faster +// Affects: thermal regulation speed, sunset mode, maybe other features +// (default is calibrated for 8-bit PWM, +// but 10-bit should set this value to 4 instead of 1) +#define GRADUAL_ADJUST_SPEED 1 + ///// What to do when power is connected ///// // factory reset function erases user's runtime configuration in eeprom diff --git a/ui/anduril/ramp-mode.c b/ui/anduril/ramp-mode.c index 9e19025..4c535b4 100644 --- a/ui/anduril/ramp-mode.c +++ b/ui/anduril/ramp-mode.c @@ -287,7 +287,7 @@ uint8_t steady_state(Event event, uint16_t arg) { static uint16_t ticks_since_adjust = 0; ticks_since_adjust++; if (diff) { - uint16_t ticks_per_adjust = 256; + uint16_t ticks_per_adjust = 256 / GRADUAL_ADJUST_SPEED; if (diff < 0) { //diff = -diff; if (actual_level > THERM_FASTER_LEVEL) { |
