feat: Map 0 control input to 0 output

This commit is contained in:
Tanner Collin (aider) 2025-06-21 14:12:43 -06:00
parent c0931edc6c
commit ba65844029

View File

@ -182,8 +182,13 @@ void onMqttMessage(int messageSize) {
}
void processControlCommand(int64_t num) {
// Map the input value (0-100) to the output range (60-140)
long mappedValue = map(num, 0, 100, 60, 140);
long mappedValue;
if (num == 0) {
mappedValue = 0; // Special case: 0 maps to 0
} else {
// Map the input value (0-100) to the output range (60-140)
mappedValue = map(num, 0, 100, 60, 140);
}
Serial.print("[MEGA] Received power: ");
Serial.print(num);