feat: Map 0 control input to 0 output
This commit is contained in:
parent
c0931edc6c
commit
ba65844029
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user