beautify output of vcc
This commit is contained in:
@ -152,6 +152,8 @@ void read_thermometer() {
|
|||||||
|
|
||||||
|
|
||||||
uint16_t vcc = ESP.getVcc();
|
uint16_t vcc = ESP.getVcc();
|
||||||
|
uint16_t v1 = vcc / 1000;
|
||||||
|
uint16_t v2 = (vcc - v1 * 1000);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.print(vcc);
|
Serial.print(vcc);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
@ -163,7 +165,7 @@ void read_thermometer() {
|
|||||||
//char topic[128];
|
//char topic[128];
|
||||||
//snprintf(topic, 127, "IoT/espThermometer2/%s/measurement", WiFi.macAddress().c_str());
|
//snprintf(topic, 127, "IoT/espThermometer2/%s/measurement", WiFi.macAddress().c_str());
|
||||||
char payload[128];
|
char payload[128];
|
||||||
snprintf(payload, 127, "%s %d.%d %ld %ld", clientId, t1, t2, vcc, duration);
|
snprintf(payload, 127, "%s %d.%d %d.%d %ld", clientId, t1, t2, v1, v2, duration);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.println(payload);
|
Serial.println(payload);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user