aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-events.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-10-29 13:05:38 -0600
committerSelene ToyKeeper2023-10-29 13:05:38 -0600
commitbcaf2686d9f0570dfbc508ddcac95ee55d501f48 (patch)
tree801ccd6ec9d94d0144e1a200fb5bd610cdcd4e7e /spaghetti-monster/fsm-events.c
parentfixed blf-lt1-t1616, after testing on actual hardware (diff)
downloadanduril-bcaf2686d9f0570dfbc508ddcac95ee55d501f48.tar.gz
anduril-bcaf2686d9f0570dfbc508ddcac95ee55d501f48.tar.bz2
anduril-bcaf2686d9f0570dfbc508ddcac95ee55d501f48.zip
converted noctigon-dm11-boost to use PWM+DSM, and recalibrated timing for delays + smooth steps
Anduril has gradually gotten faster over the years, apparently, so it needed longer delays to get accurate-ish timing for beacon and other modes. Adding DSM also changes the timing perceptibly, so I made it possible to calibrate the delay fudge factor on a per-build basis.
Diffstat (limited to '')
-rw-r--r--spaghetti-monster/fsm-events.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c
index ffa93d1..6987ae2 100644
--- a/spaghetti-monster/fsm-events.c
+++ b/spaghetti-monster/fsm-events.c
@@ -127,7 +127,7 @@ uint8_t nice_delay_ms(uint16_t ms) {
uint8_t level = actual_level; // volatile, avoid repeat access
if (level < QUARTERSPEED_LEVEL) {
clock_prescale_set(clock_div_4);
- _delay_loop_2(BOGOMIPS*90/100/4);
+ _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100/4);
}
//else if (level < HALFSPEED_LEVEL) {
// clock_prescale_set(clock_div_2);
@@ -135,7 +135,7 @@ uint8_t nice_delay_ms(uint16_t ms) {
//}
else {
clock_prescale_set(clock_div_1);
- _delay_loop_2(BOGOMIPS*90/100);
+ _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100);
}
// restore regular clock speed
clock_prescale_set(clock_div_1);
@@ -143,13 +143,13 @@ uint8_t nice_delay_ms(uint16_t ms) {
// underclock MCU to save power
clock_prescale_set(clock_div_4);
// wait
- _delay_loop_2(BOGOMIPS*90/100/4);
+ _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100/4);
// restore regular clock speed
clock_prescale_set(clock_div_1);
#endif // ifdef USE_RAMPING
#else
// wait
- _delay_loop_2(BOGOMIPS*90/100);
+ _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100);
#endif // ifdef USE_DYNAMIC_UNDERCLOCKING
// run pending system processes while we wait