Refactor module logging

This commit is contained in:
Theo Arends 2021-01-25 16:25:17 +01:00
parent 72e4d8f0d2
commit 129c26c695
2 changed files with 23 additions and 2 deletions

View File

@ -484,6 +484,8 @@ void StartWebserver(int type, IPAddress ipweb)
#else
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"),
NetworkHostname(), (Mdns.begun) ? PSTR(".local") : "", ipweb.toString().c_str());
// AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %_I"),
// NetworkHostname(), (Mdns.begun) ? PSTR(".local") : "", (uint32_t)ipweb);
#endif // LWIP_IPV6 = 1
TasmotaGlobal.rules_flag.http_init = 1;
}
@ -1587,12 +1589,12 @@ void ModuleSaveSettings(void)
} else {
if (ValidGPIO(i, template_gp.io[i])) {
Settings.my_gp.io[i] = WebGetGpioArg(i);
gpios += F(", "); gpios += String(i); gpios += F(" "); gpios += String(Settings.my_gp.io[i]);
gpios += F(", IO"); gpios += String(i); gpios += F(" "); gpios += String(Settings.my_gp.io[i]);
}
}
}
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str());
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str());
}
/*-------------------------------------------------------------------------------------------*/

View File

@ -397,6 +397,25 @@ void DomoticzSensor(uint8_t idx, uint32_t value) {
DomoticzSensor(idx, data);
}
void DomoticzFloatSensor(uint8_t idx, float value) {
uint32_t resolution = 1;
/*
switch (idx) {
case DZ_TEMP: resolution = Settings.flag2.temperature_resolution; break;
case DZ_POWER_ENERGY: resolution = Settings.flag2.wattage_resolution; break;
case DZ_VOLTAGE: resolution = Settings.flag2.voltage_resolution; break;
case DZ_CURRENT: resolution = Settings.flag2.current_resolution; break;
}
*/
if (DZ_TEMP == idx) { resolution = Settings.flag2.temperature_resolution; }
else if (DZ_POWER_ENERGY == idx) { resolution = Settings.flag2.wattage_resolution; }
else if (DZ_VOLTAGE == idx) { resolution = Settings.flag2.voltage_resolution; }
else if (DZ_CURRENT == idx) { resolution = Settings.flag2.current_resolution; }
char data[FLOATSZ];
dtostrfd(value, resolution, data);
DomoticzSensor(idx, data);
}
//void DomoticzTempHumPressureSensor(float temp, float hum, float baro = -1);
void DomoticzTempHumPressureSensor(float temp, float hum, float baro) {
char temperature[FLOATSZ];