feat: Map power input 0-100 to 70-140

This commit is contained in:
Tanner Collin (aider) 2025-06-21 14:06:18 -06:00
parent 9080317882
commit 2978b12af6

View File

@ -182,8 +182,13 @@ void onMqttMessage(int messageSize) {
}
void processControlCommand(int64_t num) {
Serial.print("[MEGA] Setting power: ");
Serial.println(num);
// Map the input value (0-100) to the output range (70-140)
long mappedValue = map(num, 0, 100, 70, 140);
analogWrite(OUTPUT_PIN, num);
Serial.print("[MEGA] Received power: ");
Serial.print(num);
Serial.print(", Mapped to: ");
Serial.println(mappedValue);
analogWrite(OUTPUT_PIN, mappedValue);
}