UM Battery: fix compilation error + bad snprintf

This commit is contained in:
Frank 2023-01-02 22:52:37 +01:00 committed by GitHub
parent 983aca515d
commit 4a09e18d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,7 +198,7 @@ class UsermodBattery : public Usermod
// still don't know much about MQTT and/or HA
if (WLED_MQTT_CONNECTED) {
char buf[64]; // buffer for snprintf()
snprintf_P(buf, 63, PSTR("/voltage"), mqttDeviceTopic);
snprintf_P(buf, 63, PSTR("/voltage%s"), mqttDeviceTopic);
mqtt->publish(buf, 0, false, String(voltage).c_str());
}
@ -393,7 +393,7 @@ class UsermodBattery : public Usermod
}
#ifdef ARDUINO_ARCH_ESP32
newBatteryPin = battery[F("pin"] | newBatteryPin;
newBatteryPin = battery[F("pin")] | newBatteryPin;
#endif
// calculateTimeLeftEnabled = battery[F("time-left")] | calculateTimeLeftEnabled;
setMinBatteryVoltage(battery[F("min-Voltage")] | minBatteryVoltage);