fix: initialize MQTT power meter values to zero
avoid using uninitialized memory.
This commit is contained in:
parent
415c767d1d
commit
5e5a5253f4
@ -8,6 +8,7 @@
|
|||||||
bool PowerMeterMqtt::init()
|
bool PowerMeterMqtt::init()
|
||||||
{
|
{
|
||||||
auto subscribe = [this](PowerMeterMqttValue const& val, float* targetVariable) {
|
auto subscribe = [this](PowerMeterMqttValue const& val, float* targetVariable) {
|
||||||
|
*targetVariable = 0;
|
||||||
char const* topic = val.Topic;
|
char const* topic = val.Topic;
|
||||||
if (strlen(topic) == 0) { return; }
|
if (strlen(topic) == 0) { return; }
|
||||||
MqttSettings.subscribe(topic, 0,
|
MqttSettings.subscribe(topic, 0,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user