mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-27 16:27:17 +00:00
[Thermostat] Simplify code (#20141)
* [Thermostat] Simplify code Simplify code of PR #20133 * [Thermostat] small code changes - removed unused const - replaced constant value
This commit is contained in:
parent
28c8f8cf47
commit
b4a54ae880
@ -1394,16 +1394,12 @@ void ThermostatGetLocalSensor(uint8_t ctr_output) {
|
|||||||
JsonParserObject root = parser.getRootObject();
|
JsonParserObject root = parser.getRootObject();
|
||||||
if (root) {
|
if (root) {
|
||||||
String sensor_name = THERMOSTAT_SENSOR_NAME;
|
String sensor_name = THERMOSTAT_SENSOR_NAME;
|
||||||
const char* value_c;
|
|
||||||
if ( (THERMOSTAT_SENSOR_NUMBER > 1)
|
if ( (THERMOSTAT_SENSOR_NUMBER > 1)
|
||||||
&&(THERMOSTAT_CONTROLLER_OUTPUTS > 1)
|
&&(THERMOSTAT_CONTROLLER_OUTPUTS > 1)
|
||||||
&&(ctr_output < THERMOSTAT_SENSOR_NUMBER)) {
|
&&(ctr_output < THERMOSTAT_SENSOR_NUMBER)) {
|
||||||
char temp[4];
|
sensor_name.concat(IndexSeparator() + String(ctr_output + 1));
|
||||||
temp[0] = IndexSeparator();
|
|
||||||
snprintf(&temp[1], sizeof(temp)-1, "%u", (ctr_output + 1));
|
|
||||||
sensor_name.concat(temp);
|
|
||||||
}
|
}
|
||||||
JsonParserToken value_token = root[sensor_name].getObject()[PSTR("Temperature")];
|
JsonParserToken value_token = root[sensor_name].getObject()[PSTR(D_JSON_TEMPERATURE)];
|
||||||
if (value_token.isNum()) {
|
if (value_token.isNum()) {
|
||||||
int16_t value = value_token.getFloat() * 10;
|
int16_t value = value_token.getFloat() * 10;
|
||||||
if (Thermostat[ctr_output].status.temp_format == TEMP_FAHRENHEIT) {
|
if (Thermostat[ctr_output].status.temp_format == TEMP_FAHRENHEIT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user