Skip to content

Commit

Permalink
No longer calling dti_get_motor_temp so many times
Browse files Browse the repository at this point in the history
  • Loading branch information
dnakhooda committed Feb 3, 2025
1 parent 747799f commit 96a1595
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Core/Src/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,20 @@ void vControl(void *params)
set_pump->control = control;

for (;;) {
// Write to fan batt box
write_fan_battbox(control_args->pdu, control->fanBattBoxState);

// Pump debounce
if (dti_get_motor_temp() > MOTOR_TEMP_LIMIT) {
uint16_t motorTemp = dti_get_motor_temp();

if (motorTemp > MOTOR_TEMP_LIMIT) {
set_pump->state = 1;
debounce(dti_get_motor_temp() > MOTOR_TEMP_LIMIT,
&pumpTimer, 10000, &setPumpState, &set_pump);
debounce(motorTemp > MOTOR_TEMP_LIMIT, &pumpTimer,
10000, &setPumpState, &set_pump);
} else {
set_pump->state = 0;
debounce(dti_get_motor_temp() <= MOTOR_TEMP_LIMIT,
&pumpTimer, 10000, &setPumpState, &set_pump);
debounce(motorTemp <= MOTOR_TEMP_LIMIT, &pumpTimer,
10000, &setPumpState, &set_pump);
}

// Write to pumps
write_pump_0(control_args->pdu, control->pumpState0);
write_pump_1(control_args->pdu, control->pumpState1);

Expand Down

0 comments on commit 96a1595

Please sign in to comment.