mirror of https://github.com/arendst/Tasmota.git
Refactor dtostrfd
This commit is contained in:
parent
20704ab700
commit
7249552582
|
@ -780,8 +780,8 @@ const float kSpeedConversionFactor[] = {1, // none
|
|||
#ifdef USE_WEBSERVER
|
||||
// {s} = <tr><th>, {m} = </th><td>, {e} = </td></tr>
|
||||
const char HTTP_SNS_F_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%*_f " D_UNIT_DEGREE "%c{e}";
|
||||
//const char HTTP_SNS_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%s " D_UNIT_DEGREE "%c{e}";
|
||||
|
||||
const char HTTP_SNS_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%s " D_UNIT_DEGREE "%c{e}";
|
||||
const char HTTP_SNS_HUM[] PROGMEM = "{s}%s " D_HUMIDITY "{m}%s " D_UNIT_PERCENT "{e}";
|
||||
const char HTTP_SNS_DEW[] PROGMEM = "{s}%s " D_DEWPOINT "{m}%s " D_UNIT_DEGREE "%c{e}";
|
||||
const char HTTP_SNS_PRESSURE[] PROGMEM = "{s}%s " D_PRESSURE "{m}%s " "%s{e}";
|
||||
|
|
|
@ -88,18 +88,15 @@ void MAX31865_Show(bool Json) {
|
|||
uint8_t report_once = 0;
|
||||
for (uint32_t i = 0; i < MAX_MAX31865S; i++) {
|
||||
if (max31865_pins_used & (1 << i)) {
|
||||
char temperature[33];
|
||||
char resistance[33];
|
||||
|
||||
dtostrfd(MAX31865_Result[i].PtdResistance, Settings.flag2.temperature_resolution, resistance);
|
||||
dtostrfd(MAX31865_Result[i].PtdTemp, Settings.flag2.temperature_resolution, temperature);
|
||||
|
||||
if (Json) {
|
||||
ResponseAppend_P(PSTR(",\"MAX31865%c%d\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_RESISTANCE "\":%s,\"" D_JSON_ERROR "\":%d}"), \
|
||||
IndexSeparator(), i, temperature, resistance, MAX31865_Result[i].ErrorCode);
|
||||
ResponseAppend_P(PSTR(",\"MAX31865%c%d\":{\"" D_JSON_TEMPERATURE "\":%*_f,\"" D_JSON_RESISTANCE "\":%*_f,\"" D_JSON_ERROR "\":%d}"), \
|
||||
IndexSeparator(), i,
|
||||
Settings.flag2.temperature_resolution, &MAX31865_Result[i].PtdTemp,
|
||||
Settings.flag2.temperature_resolution, &MAX31865_Result[i].PtdResistance,
|
||||
MAX31865_Result[i].ErrorCode);
|
||||
if ((0 == TasmotaGlobal.tele_period) && (!report_once)) {
|
||||
#ifdef USE_DOMOTICZ
|
||||
DomoticzSensor(DZ_TEMP, temperature);
|
||||
DomoticzFloatSensor(DZ_TEMP, MAX31865_Result[i].PtdTemp);
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_KNX
|
||||
KnxSensor(KNX_TEMPERATURE, MAX31865_Result[i].PtdTemp);
|
||||
|
@ -110,7 +107,7 @@ void MAX31865_Show(bool Json) {
|
|||
} else {
|
||||
char sensorname[33];
|
||||
sprintf(sensorname, "MAX31865%c%d", IndexSeparator(), i);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, sensorname, temperature, TempUnit());
|
||||
WSContentSend_Temp(sensorname, MAX31865_Result[i].PtdTemp);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -417,10 +417,8 @@ void ChirpShow(bool json)
|
|||
{
|
||||
for (uint32_t i = 0; i < chirp_found_sensors; i++) {
|
||||
if (chirp_sensor[i].version) {
|
||||
// convert double values to string
|
||||
char str_temperature[33];
|
||||
double t_temperature = ((double) chirp_sensor[i].temperature )/10.0;
|
||||
dtostrfd(t_temperature, Settings.flag2.temperature_resolution, str_temperature);
|
||||
float t_temperature = ConvertTemp(((float)chirp_sensor[i].temperature )/10.0);
|
||||
|
||||
char str_light[33];
|
||||
dtostrfd(chirp_sensor[i].light, 0, str_light);
|
||||
char str_version[7];
|
||||
|
@ -435,7 +433,7 @@ void ChirpShow(bool json)
|
|||
if(!chirp_sensor[i].explicitSleep) {
|
||||
ResponseAppend_P(PSTR(",\"%s%u\":{\"" D_JSON_MOISTURE "\":%d"), chirp_name, i, chirp_sensor[i].moisture);
|
||||
if(chirp_sensor[i].temperature!=-1){ // this is the error code -> no temperature
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%s"),str_temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%*_f"), Settings.flag2.temperature_resolution, &t_temperature);
|
||||
}
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_DARKNESS "\":%s}"),str_light);
|
||||
}
|
||||
|
@ -458,7 +456,7 @@ void ChirpShow(bool json)
|
|||
WSContentSend_PD(HTTP_SNS_MOISTURE, "", chirp_sensor[i].moisture);
|
||||
WSContentSend_PD(HTTP_SNS_DARKNESS, str_light);
|
||||
if (chirp_sensor[i].temperature!=-1) { // this is the error code -> no temperature
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, "", str_temperature, TempUnit());
|
||||
WSContentSend_Temp("", t_temperature);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,18 +176,16 @@ void DS1624EverySecond(void)
|
|||
|
||||
void DS1624Show(bool json)
|
||||
{
|
||||
char temperature[33];
|
||||
bool once = true;
|
||||
|
||||
for (uint32_t i = 0; i < DS1624_MAX_SENSORS; i++) {
|
||||
if (!ds1624_sns[i].valid) { continue; }
|
||||
|
||||
dtostrfd(ds1624_sns[i].value, Settings.flag2.temperature_resolution, temperature);
|
||||
if (json) {
|
||||
ResponseAppend_P(JSON_SNS_TEMP, ds1624_sns[i].name, temperature);
|
||||
ResponseAppend_P(JSON_SNS_F_TEMP, ds1624_sns[i].name, Settings.flag2.temperature_resolution, &ds1624_sns[i].value);
|
||||
if ((0 == TasmotaGlobal.tele_period) && once) {
|
||||
#ifdef USE_DOMOTICZ
|
||||
DomoticzSensor(DZ_TEMP, temperature);
|
||||
DomoticzFloatSensor(DZ_TEMP, ds1624_sns[i].value);
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_KNX
|
||||
KnxSensor(KNX_TEMPERATURE, ds1624_sns[i].value);
|
||||
|
@ -196,7 +194,7 @@ void DS1624Show(bool json)
|
|||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, ds1624_sns[i].name, temperature, TempUnit());
|
||||
WSContentSend_Temp(ds1624_sns[i].name, ds1624_sns[i].value);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1738,9 +1738,8 @@ void MINRFShow(bool json)
|
|||
||(hass_mode==2)
|
||||
#endif //USE_HOME_ASSISTANT
|
||||
) {
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(MIBLEsensors[i].temp, Settings.flag2.temperature_resolution, temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%s"), temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%*_f"),
|
||||
Settings.flag2.temperature_resolution, &MIBLEsensors[i].temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1897,9 +1896,7 @@ void MINRFShow(bool json)
|
|||
if (MIBLEsensors[i].type==YEERC) continue;
|
||||
if (MIBLEsensors[i].type==FLORA){
|
||||
if(!isnan(MIBLEsensors[i].temp)){
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(MIBLEsensors[i].temp, Settings.flag2.temperature_resolution, temperature);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, kMINRFDeviceType[MIBLEsensors[i].type-1], temperature, TempUnit());
|
||||
WSContentSend_Temp(kMINRFDeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].temp);
|
||||
}
|
||||
if(MIBLEsensors[i].lux!=0xffffffff){ // this is the error code -> no valid value
|
||||
WSContentSend_PD(HTTP_SNS_ILLUMINANCE, kMINRFDeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].lux);
|
||||
|
|
|
@ -2052,9 +2052,8 @@ void MI32Show(bool json)
|
|||
||(hass_mode!=-1)
|
||||
#endif //USE_HOME_ASSISTANT
|
||||
) {
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(MIBLEsensors[i].temp, Settings.flag2.temperature_resolution, temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%s"), temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%*_f"),
|
||||
Settings.flag2.temperature_resolution, &MIBLEsensors[i].temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2211,9 +2210,7 @@ void MI32Show(bool json)
|
|||
WSContentSend_PD(HTTP_RSSI, kMI32DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].RSSI);
|
||||
if (MIBLEsensors[i].type==FLORA) {
|
||||
if (!isnan(MIBLEsensors[i].temp)) {
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(MIBLEsensors[i].temp, Settings.flag2.temperature_resolution, temperature);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, kMI32DeviceType[MIBLEsensors[i].type-1], temperature, TempUnit());
|
||||
WSContentSend_Temp(kMI32DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].temp);
|
||||
}
|
||||
if (MIBLEsensors[i].moisture!=0xff) {
|
||||
WSContentSend_PD(HTTP_SNS_MOISTURE, kMI32DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].moisture);
|
||||
|
|
|
@ -2361,9 +2361,8 @@ void MI32GetOneSensorJson(int slot, int hidename){
|
|||
||(hass_mode!=-1)
|
||||
#endif //USE_HOME_ASSISTANT
|
||||
) {
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(p->temp, Settings.flag2.temperature_resolution, temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%s"), temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%*_f"),
|
||||
Settings.flag2.temperature_resolution, &p->temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2815,9 +2814,7 @@ void MI32Show(bool json)
|
|||
switch(p->type){
|
||||
case MI_FLORA:{
|
||||
if (!isnan(p->temp)) {
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(p->temp, Settings.flag2.temperature_resolution, temperature);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, typeName, temperature, TempUnit());
|
||||
WSContentSend_Temp(typeName, p->temp);
|
||||
}
|
||||
if (p->moisture!=0xff) {
|
||||
WSContentSend_PD(HTTP_SNS_MOISTURE, typeName, p->moisture);
|
||||
|
|
|
@ -1812,9 +1812,8 @@ void HM10Show(bool json)
|
|||
||(hass_mode!=-1)
|
||||
#endif //USE_HOME_ASSISTANT
|
||||
) {
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(MIBLEsensors[i].temp, Settings.flag2.temperature_resolution, temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%s"), temperature);
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE "\":%*_f"),
|
||||
Settings.flag2.temperature_resolution, &MIBLEsensors[i].temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1967,9 +1966,7 @@ void HM10Show(bool json)
|
|||
WSContentSend_PD(HTTP_HM10_MAC, kHM10DeviceType[MIBLEsensors[i].type-1], D_MAC_ADDRESS, _MAC);
|
||||
if (MIBLEsensors[i].type==FLORA){
|
||||
if(!isnan(MIBLEsensors[i].temp)){
|
||||
char temperature[FLOATSZ];
|
||||
dtostrfd(MIBLEsensors[i].temp, Settings.flag2.temperature_resolution, temperature);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, kHM10DeviceType[MIBLEsensors[i].type-1], temperature, TempUnit());
|
||||
WSContentSend_Temp(kHM10DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].temp);
|
||||
}
|
||||
if(MIBLEsensors[i].lux!=0x00ffffff){ // this is the error code -> no valid value
|
||||
WSContentSend_PD(HTTP_SNS_ILLUMINANCE, kHM10DeviceType[MIBLEsensors[i].type-1], MIBLEsensors[i].lux);
|
||||
|
|
|
@ -75,9 +75,6 @@ void MCP9808EverySecond(void) {
|
|||
|
||||
void MCP9808Show(bool json) {
|
||||
for (uint32_t i = 0; i < mcp9808_cfg.count; i++) {
|
||||
char temperature[33];
|
||||
dtostrfd(mcp9808_sensors[i].temperature, Settings.flag2.temperature_resolution, temperature);
|
||||
|
||||
char sensor_name[11];
|
||||
strlcpy(sensor_name, mcp9808_cfg.types, sizeof(sensor_name));
|
||||
if (mcp9808_cfg.count > 1) {
|
||||
|
@ -85,10 +82,10 @@ void MCP9808Show(bool json) {
|
|||
}
|
||||
|
||||
if (json) {
|
||||
ResponseAppend_P(JSON_SNS_TEMP, sensor_name, temperature);
|
||||
ResponseAppend_P(JSON_SNS_F_TEMP, sensor_name, Settings.flag2.temperature_resolution, &mcp9808_sensors[i].temperature);
|
||||
if ((0 == TasmotaGlobal.tele_period) && (0 == i)) {
|
||||
#ifdef USE_DOMOTICZ
|
||||
DomoticzSensor(DZ_TEMP, temperature);
|
||||
DomoticzFloatSensor(DZ_TEMP, mcp9808_sensors[i].temperature);
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_KNX
|
||||
KnxSensor(KNX_TEMPERATURE, mcp9808_sensors[i].temperature);
|
||||
|
@ -96,7 +93,7 @@ void MCP9808Show(bool json) {
|
|||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, sensor_name, temperature, TempUnit());
|
||||
WSContentSend_Temp(sensor_name, mcp9808_sensors[i].temperature);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,15 +107,14 @@ void HP303B_Show(bool json) {
|
|||
|
||||
float sealevel = ConvertPressureForSeaLevel(hp303b_sensor[i].pressure);
|
||||
|
||||
char str_temperature[33];
|
||||
dtostrfd(hp303b_sensor[i].temperature, Settings.flag2.temperature_resolution, str_temperature);
|
||||
char str_pressure[33];
|
||||
dtostrfd(hp303b_sensor[i].pressure, Settings.flag2.pressure_resolution, str_pressure);
|
||||
char sea_pressure[33];
|
||||
dtostrfd(sealevel, Settings.flag2.pressure_resolution, sea_pressure);
|
||||
|
||||
if (json) {
|
||||
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_PRESSURE "\":%s"), sensor_name, str_temperature, str_pressure);
|
||||
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%*_f,\"" D_JSON_PRESSURE "\":%s"),
|
||||
sensor_name, Settings.flag2.temperature_resolution, &hp303b_sensor[i].temperature, str_pressure);
|
||||
if (Settings.altitude != 0) {
|
||||
ResponseAppend_P(PSTR(",\"" D_JSON_PRESSUREATSEALEVEL "\":%s"), sea_pressure);
|
||||
}
|
||||
|
@ -123,12 +122,12 @@ void HP303B_Show(bool json) {
|
|||
#ifdef USE_DOMOTICZ
|
||||
// Domoticz and knx only support one temp sensor
|
||||
if ((0 == TasmotaGlobal.tele_period) && (0 == i)) {
|
||||
DomoticzSensor(DZ_TEMP, hp303b_sensor[i].temperature);
|
||||
DomoticzFloatSensor(DZ_TEMP, hp303b_sensor[i].temperature);
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, sensor_name, str_temperature, TempUnit());
|
||||
WSContentSend_Temp(sensor_name, hp303b_sensor[i].temperature);
|
||||
WSContentSend_PD(HTTP_SNS_PRESSURE, sensor_name, str_pressure, PressureUnit().c_str());
|
||||
if (Settings.altitude != 0) {
|
||||
WSContentSend_PD(HTTP_SNS_SEAPRESSURE, sensor_name, sea_pressure, PressureUnit().c_str());
|
||||
|
|
|
@ -85,14 +85,11 @@ int LMT01_getPulses(void) {
|
|||
}
|
||||
|
||||
void LMT01_Show(bool Json) {
|
||||
char temp[33];
|
||||
dtostrfd(lmt01_temperature, Settings.flag2.temperature_resolution, temp);
|
||||
|
||||
if (Json) {
|
||||
ResponseAppend_P(JSON_SNS_TEMP, "LMT01", temp);
|
||||
ResponseAppend_P(JSON_SNS_F_TEMP, "LMT01", Settings.flag2.temperature_resolution, &lmt01_temperature);
|
||||
#ifdef USE_DOMOTICZ
|
||||
if (0 == TasmotaGlobal.tele_period) {
|
||||
DomoticzSensor(DZ_TEMP, temp);
|
||||
DomoticzFloatSensor(DZ_TEMP, lmt01_temperature);
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_KNX
|
||||
|
@ -102,7 +99,7 @@ void LMT01_Show(bool Json) {
|
|||
#endif // USE_KNX
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, "LMT01", temp, TempUnit());
|
||||
WSContentSend_Temp("LMT01", lmt01_temperature);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,15 +35,14 @@ struct EZORTD : public EZOStruct {
|
|||
|
||||
virtual void Show(bool json, const char *name)
|
||||
{
|
||||
char str[10];
|
||||
dtostrfd(ConvertTemp(temperature), Settings.flag2.temperature_resolution, str);
|
||||
float temp = ConvertTemp(temperature);
|
||||
|
||||
if (json) {
|
||||
ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s}"), name, str);
|
||||
ResponseAppend_P(JSON_SNS_F_TEMP, name, Settings.flag2.temperature_resolution, &temp);
|
||||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
else {
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, name, str, TempUnit());
|
||||
WSContentSend_Temp(name, temp);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,11 +272,9 @@ void seeSoilEverySecond(void) { // update sensor values and publ
|
|||
#endif // SEESAW_SOIL_PUBLISH
|
||||
|
||||
void seeSoilShow(bool json) {
|
||||
char temperature[FLOATSZ];
|
||||
char sensor_name[sizeof(SeeSoil.name) + 3];
|
||||
|
||||
for (uint32_t i = 0; i < SeeSoil.count; i++) {
|
||||
dtostrfd(SeeSoilSNS[i].temperature, Settings.flag2.temperature_resolution, temperature);
|
||||
seeSoilName(i, sensor_name, sizeof(sensor_name));
|
||||
if (json) {
|
||||
ResponseAppend_P(PSTR(",")); // compose tele json
|
||||
|
@ -296,20 +294,20 @@ void seeSoilShow(bool json) {
|
|||
WSContentSend_PD(HTTP_SNS_ANALOG, sensor_name, 0, SeeSoilSNS[i].capacitance);
|
||||
#endif // SEESAW_SOIL_RAW
|
||||
WSContentSend_PD(HTTP_SNS_MOISTURE, sensor_name, (uint32_t) SeeSoilSNS[i].moisture);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, sensor_name, temperature, TempUnit());
|
||||
WSContentSend_Temp(sensor_name, SeeSoilSNS[i].temperature);
|
||||
#endif // USE_WEBSERVER
|
||||
}
|
||||
} // for each sensor connected
|
||||
}
|
||||
|
||||
void seeSoilJson(int no) { // common json
|
||||
char temperature[FLOATSZ];
|
||||
char sensor_name[sizeof(SeeSoil.name) + 3];
|
||||
|
||||
seeSoilName(no, sensor_name, sizeof(sensor_name));
|
||||
dtostrfd(SeeSoilSNS[no].temperature, Settings.flag2.temperature_resolution, temperature);
|
||||
ResponseAppend_P(PSTR ("\"%s\":{\"" D_JSON_ID "\":\"%02X\",\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_MOISTURE "\":%u}"),
|
||||
sensor_name, SeeSoilSNS[no].address, temperature, (uint32_t) SeeSoilSNS[no].moisture);
|
||||
|
||||
ResponseAppend_P(PSTR ("\"%s\":{\"" D_JSON_ID "\":\"%02X\",\"" D_JSON_TEMPERATURE "\":%*_f,\"" D_JSON_MOISTURE "\":%u}"),
|
||||
sensor_name, SeeSoilSNS[no].address,
|
||||
Settings.flag2.temperature_resolution, &SeeSoilSNS[no].temperature,
|
||||
(uint32_t) SeeSoilSNS[no].moisture);
|
||||
}
|
||||
|
||||
void seeSoilName(int no, char *name, int len) // generates a sensor name
|
||||
|
|
|
@ -866,10 +866,14 @@ void NeoPoolShow(bool json)
|
|||
|
||||
// Temperature
|
||||
if (NeoPoolGetData(MBF_PAR_TEMPERATURE_ACTIVE)) {
|
||||
/*
|
||||
dtostrfd(Settings.flag.temperature_conversion ?
|
||||
(float)NeoPoolGetData(MBF_MEASURE_TEMPERATURE)/10 * 1.8 + 32 :
|
||||
(float)NeoPoolGetData(MBF_MEASURE_TEMPERATURE)/10, Settings.flag2.temperature_resolution, parameter);
|
||||
ResponseAppend_P(PSTR("%s\"" D_TEMPERATURE "\":%s"), delimiter, parameter);
|
||||
*/
|
||||
float temp = ConvertTemp((float)NeoPoolGetData(MBF_MEASURE_TEMPERATURE) / 10);
|
||||
ResponseAppend_P(PSTR("%s\"" D_TEMPERATURE "\":%*_f"), delimiter, Settings.flag2.temperature_resolution, &temp);
|
||||
*delimiter = ',';
|
||||
}
|
||||
|
||||
|
@ -939,8 +943,12 @@ void NeoPoolShow(bool json)
|
|||
|
||||
// Temperature
|
||||
if (NeoPoolGetData(MBF_PAR_TEMPERATURE_ACTIVE)) {
|
||||
/*
|
||||
dtostrfd(Settings.flag.temperature_conversion?(float)NeoPoolGetData(MBF_MEASURE_TEMPERATURE)/10 * 1.8 + 32:(float)NeoPoolGetData(MBF_MEASURE_TEMPERATURE)/10, Settings.flag2.temperature_resolution, parameter);
|
||||
WSContentSend_PD(HTTP_SNS_TEMP, neopool_type, parameter, TempUnit());
|
||||
*/
|
||||
float temp = ConvertTemp((float)NeoPoolGetData(MBF_MEASURE_TEMPERATURE) / 10);
|
||||
WSContentSend_Temp(neopool_type, temp);
|
||||
}
|
||||
|
||||
// pH
|
||||
|
|
Loading…
Reference in New Issue