Skip to content

Commit

Permalink
merge (#1)
Browse files Browse the repository at this point in the history
* 修复不填写mqtt led快闪的问题

* 更改保存电量时间为一小时,避免频繁写入flash

qlwz#16 (comment)

---------

Co-authored-by: 情留メ蚊子 <[email protected]>
Co-authored-by: gitercn <[email protected]>
  • Loading branch information
3 people authored Mar 15, 2023
1 parent bfa5020 commit 52c2195
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/esp_framework/src/Led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void Led::loop()
}
}
#ifndef DISABLE_MQTT
else if (!Mqtt::mqttClient.connected())
else if (globalConfig.mqtt.port != 0 && !Mqtt::mqttClient.connected())
{
if (Led::ledType != 1)
{
Expand Down
6 changes: 3 additions & 3 deletions src/DC1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void DC1::init()

bool DC1::moduleLed()
{
if (WiFi.status() == WL_CONNECTED && Mqtt::mqttClient.connected())
if (WiFi.status() == WL_CONNECTED && (globalConfig.mqtt.port ==0 || Mqtt::mqttClient.connected()))
{
if (config.wifi_led == 0)
{
Expand Down Expand Up @@ -658,7 +658,7 @@ void DC1::energyUpdate()
{
energyUpdateToday();
}
if (perSecond % 301 == 0 && cse7766->Energy.kWhtoday > 0)
if (perSecond % 3600 == 0 && cse7766->Energy.kWhtoday > 0)
{
energySync();
Config::saveConfig();
Expand Down Expand Up @@ -943,4 +943,4 @@ void DC1::reportPower()
powerStatTopic[strlen(powerStatTopic) - 1] = ch + 49; // 48 + 1 + ch
Mqtt::publish(powerStatTopic, bitRead(lastState, ch) ? "on" : "off", globalConfig.mqtt.retain);
}
}
}

0 comments on commit 52c2195

Please sign in to comment.