Make read bulk fan speed read correctly from the array
This commit is contained in:
parent
1671476f41
commit
b858d29ce8
@ -245,9 +245,23 @@ uint8_t route_command(int pos) {
|
|||||||
break;
|
break;
|
||||||
case READ_BULK_FAN_SPEED:
|
case READ_BULK_FAN_SPEED:
|
||||||
if (context.fan == FAN1) {
|
if (context.fan == FAN1) {
|
||||||
return fan1_history[pos];
|
// Validate that pos is valid, if not return 0
|
||||||
|
if (pos >= 512) { return 0; }
|
||||||
|
|
||||||
|
// Calculate the index position
|
||||||
|
int16_t index = fan1_history_index - pos;
|
||||||
|
if (index < 0) { index = 511-pos; }
|
||||||
|
|
||||||
|
return fan1_history[index];
|
||||||
} else if (context.fan == FAN2) {
|
} else if (context.fan == FAN2) {
|
||||||
return fan2_history[pos];
|
// Validate that pos is valid, if not return 0
|
||||||
|
if (pos >= 512) { return 0; }
|
||||||
|
|
||||||
|
// Calculate the index position
|
||||||
|
int16_t index = fan2_history_index - pos;
|
||||||
|
if (index < 0) { index = 511-pos; }
|
||||||
|
|
||||||
|
return fan2_history[index];
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user