Current fan speed now returns the last fan speed measured

This commit is contained in:
Sebastian H. Gabrielli 2024-04-30 11:10:26 +02:00
parent dd53b4dbf2
commit bcd631001b

View File

@ -1,4 +1,5 @@
#include "command-handler.h"
#include "fan_speeeed.h"
// Initialize empty, global command context
volatile command_context_t context = {UNKNOWN_COMMAND, SRC_NONE, FAN_NONE,
@ -235,9 +236,9 @@ uint8_t route_command(int pos) {
break;
case READ_FAN_SPEED:
if (context.fan == FAN1) {
return fan1_history[0];
return fan1_history[fan1_history_index];
} else if (context.fan == FAN2) {
return fan2_history[0];
return fan2_history[fan2_history_index];
} else {
return 0;
}