Skip to content

Commit

Permalink
Fixed typ-o in MQTT topic for temperature and moved voltage bootup ch…
Browse files Browse the repository at this point in the history
…eck into compiler option SELF_POWERED
  • Loading branch information
gskjold committed Apr 10, 2020
1 parent 5e33a15 commit 3984073
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/AmsToMqttBridge.ino
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ void setup() {
debugI("Voltage: %.2fV", vcc);
}

#if SELF_POWERED
if (vcc > 2.5 && vcc < 3.25) { // Only sleep if voltage is realistic and too low
if(Debug.isActive(RemoteDebug::INFO)) {
debugI("Votltage is too low, sleeping");
Serial.flush();
}
ESP.deepSleep(10000000); //Deep sleep to allow output cap to charge up
}
#endif

#if HAS_RGB_LED
// Initialize RGB LED pins
Expand Down Expand Up @@ -705,7 +707,7 @@ void sendSystemStatusToMqtt() {
}
mqtt.publish(config.getMqttPublishTopic() + "/rssi", String(hw.getWifiRssi()));
if(temperature != DEVICE_DISCONNECTED_C) {
mqtt.publish(config.getMqttPublishTopic() + "/vcc", String(temperature, 2));
mqtt.publish(config.getMqttPublishTopic() + "/temperature", String(temperature, 2));
}
}

Expand Down

0 comments on commit 3984073

Please sign in to comment.