diff --git a/firmware/firmware.ino b/firmware/firmware.ino index 2fe76e9..3e9503c 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -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);