Skip to content

Commit

Permalink
auto formatting with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Sep 2, 2023
1 parent 6babdab commit 81842e5
Show file tree
Hide file tree
Showing 25 changed files with 135 additions and 135 deletions.
6 changes: 3 additions & 3 deletions src/analogsensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void AnalogSensor::measure() {
for (auto & sensor : sensors_) {
if (sensor.type() == AnalogType::DIGITAL_IN || sensor.type() == AnalogType::COUNTER || sensor.type() == AnalogType::TIMER
|| sensor.type() == AnalogType::RATE) {
auto old_value = sensor.value(); // remember current value before reading
auto old_value = sensor.value(); // remember current value before reading
auto current_reading = digitalRead(sensor.gpio());
if (sensor.poll_ != current_reading) { // check for pinchange
sensor.polltime_ = uuid::get_uptime(); // remember time of pinchange
Expand All @@ -274,7 +274,7 @@ void AnalogSensor::measure() {
} else if (!sensor.poll_) { // falling edge
if (sensor.type() == AnalogType::COUNTER) {
sensor.set_value(old_value + sensor.factor());
} else if (sensor.type() == AnalogType::RATE) { // dafault uom: Hz (1/sec) with factor 1
} else if (sensor.type() == AnalogType::RATE) { // dafault uom: Hz (1/sec) with factor 1
sensor.set_value(sensor.factor() * 1000 / (sensor.polltime_ - sensor.last_polltime_));
} else if (sensor.type() == AnalogType::TIMER) { // default seconds with factor 1
sensor.set_value(sensor.factor() * (sensor.polltime_ - sensor.last_polltime_) / 1000);
Expand Down Expand Up @@ -685,7 +685,7 @@ bool AnalogSensor::command_info(const char * value, const int8_t id, JsonObject
dataSensor["value"] = sensor.value();
} else if (id == 0) { // output values command
output[sensor.name()] = sensor.value();
} else { // if someone wants gpio numbers
} else { // if someone wants gpio numbers
char gpio_str[9];
snprintf(gpio_str, sizeof(gpio_str), "gpio_%02d", sensor.gpio());
output[gpio_str] = sensor.value();
Expand Down
2 changes: 1 addition & 1 deletion src/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Command {
struct CmdFunction {
uint8_t device_type_; // DeviceType::
uint8_t device_id_;
uint8_t flags_; // mqtt flags for command subscriptions
uint8_t flags_; // mqtt flags for command subscriptions
const char * cmd_;
cmd_function_p cmdfunction_;
cmd_json_function_p cmdfunction_json_;
Expand Down
6 changes: 3 additions & 3 deletions src/devices/boiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class Boiler : public EMSdevice {
uint32_t wwWorkM_; // DHW minutes
int8_t wwHystOn_;
int8_t wwHystOff_;
uint8_t wwTapActivated_; // maintenance-mode to switch DHW off
uint16_t wwMixerTemp_; // mixing temperature
uint16_t wwCylMiddleTemp_; // Cyl middle temperature (TS3)
uint8_t wwTapActivated_; // maintenance-mode to switch DHW off
uint16_t wwMixerTemp_; // mixing temperature
uint16_t wwCylMiddleTemp_; // Cyl middle temperature (TS3)
uint16_t wwSolarTemp_;
uint8_t wwAlternatingOper_; // alternating operation on/off
uint8_t wwAltOpPrioHeat_; // alternating operation, prioritize heat time
Expand Down
4 changes: 2 additions & 2 deletions src/devices/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void Mixer::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> teleg
void Mixer::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, flowTempHc_, 0); // is * 10
has_bitupdate(telegram, pumpStatus_, 2, 0);
has_update(telegram, status_, 11); // temp status
has_update(telegram, status_, 11); // temp status
}

// Mixer IPM - 0x010C
Expand Down Expand Up @@ -220,7 +220,7 @@ void Mixer::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, flowTempHc_, 1); // is * 10
has_bitupdate(telegram, pumpStatus_, 3, 2); // is 0 or 0x64 (100%), check only bit 2
has_update(telegram, flowSetTemp_, 0);
has_update(telegram, status_, 4); // valve status -100 to 100
has_update(telegram, status_, 4); // valve status -100 to 100
}

/*
Expand Down
12 changes: 6 additions & 6 deletions src/devices/solar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,9 @@ void Solar::process_SM100Monitor(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, cylBottomTemp2_, 16); // is *10 - TS5: Temperature sensor 2 cylinder, bottom, or swimming pool
has_update(telegram, heatExchangerTemp_, 20); // is *10 - TS6: Heat exchanger temperature sensor

has_update(telegram, collector2Temp_, 6); // is *10 - TS7: Temperature sensor for collector array 2
has_update(telegram, cylMiddleTemp_, 8); // is *10 - TS14: cylinder middle temperature
has_update(telegram, retHeatAssist_, 10); // is *10 - TS15: return temperature heating assistance
has_update(telegram, collector2Temp_, 6); // is *10 - TS7: Temperature sensor for collector array 2
has_update(telegram, cylMiddleTemp_, 8); // is *10 - TS14: cylinder middle temperature
has_update(telegram, retHeatAssist_, 10); // is *10 - TS15: return temperature heating assistance
}

// SM100wwTemperature - 0x07D6
Expand Down Expand Up @@ -749,8 +749,8 @@ void Solar::process_SM100Monitor2(std::shared_ptr<const Telegram> telegram) {
has_update(telegram->read_value(heatCntFlowTemp_, 0)); // is *10
has_update(telegram->read_value(heatCntRetTemp_, 2)); // is *10
has_update(telegram->read_value(heatCnt_, 12));
has_update(telegram->read_value(swapRetTemp_, 6)); // is *10
has_update(telegram->read_value(swapFlowTemp_, 8)); // is *10
has_update(telegram->read_value(swapRetTemp_, 6)); // is *10
has_update(telegram->read_value(swapFlowTemp_, 8)); // is *10
}

#pragma GCC diagnostic push
Expand Down Expand Up @@ -879,7 +879,7 @@ void Solar::process_ISM1StatusMessage(std::shared_ptr<const Telegram> telegram)
has_update(telegram, collectorTemp_, 4); // Collector Temperature
has_update(telegram, cylBottomTemp_, 6); // Temperature Bottom of Solar Boiler cyl
uint16_t Wh = energyLastHour_ / 10;
telegram->read_value(Wh, 2); // Solar Energy produced in last hour only ushort, is not * 10
telegram->read_value(Wh, 2); // Solar Energy produced in last hour only ushort, is not * 10
if (energyLastHour_ != Wh * 10) {
energyLastHour_ = Wh * 10;
has_update(&energyLastHour_);
Expand Down
6 changes: 3 additions & 3 deletions src/devices/solar.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class Solar : public EMSdevice {
uint32_t energyLastHour_;
uint32_t energyToday_;
uint32_t energyTotal_;
uint32_t pumpWorkTime_; // Total solar pump operating time
uint32_t pump2WorkTime_; // Total solar pump 2 operating time
uint32_t m1WorkTime_; // differential control work time
uint32_t pumpWorkTime_; // Total solar pump operating time
uint32_t pump2WorkTime_; // Total solar pump 2 operating time
uint32_t m1WorkTime_; // differential control work time
uint8_t cylHeated_;
uint8_t collectorShutdown_; // Collector shutdown on/off

Expand Down
58 changes: 29 additions & 29 deletions src/devices/thermostat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ void Thermostat::process_RC20Set_2(std::shared_ptr<const Telegram> telegram) {
return;
}
has_update(telegram, hc->heatingtype, 0);
has_update(telegram, hc->nighttemp, 1); // is * 2,
has_update(telegram, hc->daytemp, 2); // is * 2,
has_update(telegram, hc->nighttemp, 1); // is * 2,
has_update(telegram, hc->daytemp, 2); // is * 2,
has_update(telegram, hc->mode, 3);
has_enumupdate(telegram, hc->program, 11, 1); // 1 .. 9 predefined programs
has_update(telegram, hc->tempautotemp, 13);
Expand Down Expand Up @@ -798,8 +798,8 @@ void Thermostat::process_RC35wwSettings(std::shared_ptr<const Telegram> telegram
has_update(telegram, wwDisinfecting_, 4); // 0-off, 0xFF on
has_update(telegram, wwDisinfectDay_, 5); // 0-6 Day of week, 7 every day
has_update(telegram, wwDisinfectHour_, 6);
has_update(telegram, wwMaxTemp_, 8); // Limiter 60 degrees
has_update(telegram, wwOneTimeKey_, 9); // 0-off, 0xFF on
has_update(telegram, wwMaxTemp_, 8); // Limiter 60 degrees
has_update(telegram, wwOneTimeKey_, 9); // 0-off, 0xFF on
}

// Settings WW 0x3A - RC30
Expand Down Expand Up @@ -951,7 +951,7 @@ void Thermostat::process_RC300Monitor(std::shared_ptr<const Telegram> telegram)
return;
}

has_update(telegram, hc->roomTemp, 0); // is * 10
has_update(telegram, hc->roomTemp, 0); // is * 10
has_bitupdate(telegram, hc->modetype, 10, 1);
has_bitupdate(telegram, hc->mode, 10, 0); // bit 1, mode (auto=1 or manual=0)

Expand Down Expand Up @@ -1013,8 +1013,8 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
}
has_update(hc->tempautotemp, tat);

has_update(telegram, hc->manualtemp, 10); // is * 2
has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2
has_update(telegram, hc->manualtemp, 10); // is * 2
has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2

has_enumupdate(telegram, hc->reducemode, 5, 1); // 1-outdoor temp threshold, 2-room temp threshold, 3-reduced mode
has_update(telegram, hc->reducetemp, 9);
Expand Down Expand Up @@ -1097,7 +1097,7 @@ void Thermostat::process_RC300WWtemp(std::shared_ptr<const Telegram> telegram) {
// RC300WWmode(0x2F5), data: 01 FF 04 00 00 00 08 05 00 08 04 00 00 00 00 00 00 00 00 00 01
void Thermostat::process_RC300WWmode(std::shared_ptr<const Telegram> telegram) {
// circulation pump see: https://github.com/Th3M3/buderus_ems-wiki/blob/master/Einstellungen%20der%20Bedieneinheit%20RC310.md
has_update(telegram, wwCircPump_, 1); // FF=off, 0=on ?
has_update(telegram, wwCircPump_, 1); // FF=off, 0=on ?

has_update(telegram, wwMode_, 2); // 0=off, 1=low, 2=high, 3=auto, 4=own prog
has_update(telegram, wwCircMode_, 3); // 0=off, 1=on, 2=auto, 4=own?
Expand Down Expand Up @@ -1207,11 +1207,11 @@ void Thermostat::process_RC30Set(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, mixingvalves_, 17); // Number of Mixing Valves: (0x00=0, 0x01=1, 0x02=2)
has_update(telegram, brightness_, 18); // Screen brightness 0F=dark F1=light
has_update(telegram, hc->mode, 23);
has_update(telegram, hc->nofrosttemp, 24); // Set Temperature when mode is Off / 10 (e.g.: 0x0F = 7.5 degrees Celsius)
has_update(telegram, heatingpid_, 25); // PID setting 00=1 01=2 02=3
has_update(telegram, preheating_, 26); // Preheating in the clock program: (0x00 = off, 0xFF = on)
has_update(telegram, hc->tempautotemp, 28); // is * 2
has_update(telegram, hc->manualtemp, 29); // manualtemp is * 2
has_update(telegram, hc->nofrosttemp, 24); // Set Temperature when mode is Off / 10 (e.g.: 0x0F = 7.5 degrees Celsius)
has_update(telegram, heatingpid_, 25); // PID setting 00=1 01=2 02=3
has_update(telegram, preheating_, 26); // Preheating in the clock program: (0x00 = off, 0xFF = on)
has_update(telegram, hc->tempautotemp, 28); // is * 2
has_update(telegram, hc->manualtemp, 29); // manualtemp is * 2
}

// type 0x40 (HC1) - for reading the operating mode from the RC30 thermostat (0x10)
Expand Down Expand Up @@ -1274,13 +1274,13 @@ void Thermostat::process_RC35Set(std::shared_ptr<const Telegram> telegram) {
return;
}

has_update(telegram, hc->heatingtype, 0); // 0- off, 1-radiator, 2-convector, 3-floor
has_update(telegram, hc->nighttemp, 1); // is * 2
has_update(telegram, hc->daytemp, 2); // is * 2
has_update(telegram, hc->holidaytemp, 3); // is * 2
has_update(telegram, hc->roominfluence, 4); // is * 1
has_update(telegram, hc->offsettemp, 6); // is * 2
has_update(telegram, hc->mode, 7); // night, day, auto
has_update(telegram, hc->heatingtype, 0); // 0- off, 1-radiator, 2-convector, 3-floor
has_update(telegram, hc->nighttemp, 1); // is * 2
has_update(telegram, hc->daytemp, 2); // is * 2
has_update(telegram, hc->holidaytemp, 3); // is * 2
has_update(telegram, hc->roominfluence, 4); // is * 1
has_update(telegram, hc->offsettemp, 6); // is * 2
has_update(telegram, hc->mode, 7); // night, day, auto

has_update(telegram, hc->wwprio, 21); // 0xFF for on
has_update(telegram, hc->summertemp, 22); // is * 1
Expand All @@ -1291,10 +1291,10 @@ void Thermostat::process_RC35Set(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, hc->control, 26); // 0-off, 1-RC20 (remote), 2-RC35
has_update(telegram, hc->controlmode, 33); // 0-outdoortemp, 1-roomtemp
has_update(telegram, hc->tempautotemp, 37);
has_update(telegram, hc->noreducetemp, 38); // outdoor temperature for no reduce
has_update(telegram, hc->reducetemp, 39); // temperature for off/reduce
has_update(telegram, hc->vacreducetemp, 40); // temperature for off/reduce in vacations
has_update(telegram, hc->vacreducemode, 41); // vacations reduce mode
has_update(telegram, hc->noreducetemp, 38); // outdoor temperature for no reduce
has_update(telegram, hc->reducetemp, 39); // temperature for off/reduce
has_update(telegram, hc->vacreducetemp, 40); // temperature for off/reduce in vacations
has_update(telegram, hc->vacreducemode, 41); // vacations reduce mode
has_update(telegram, hc->minflowtemp, 16);

// RC35 stores values for floorheating in different position
Expand Down Expand Up @@ -1416,7 +1416,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {

bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439
bool junkersclock = model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS;
time_t ttime = mktime(tm_); // thermostat time
time_t ttime = mktime(tm_); // thermostat time
// correct thermostat clock if we have valid ntp time, and could write the command
if (!ivtclock && !junkersclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) {
double difference = difftime(now, ttime);
Expand All @@ -1426,7 +1426,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
}
}
#ifndef EMSESP_STANDALONE
if (!tset_ && tm_->tm_year > 110) { // emsesp clock not set, but thermostat clock
if (!tset_ && tm_->tm_year > 110) { // emsesp clock not set, but thermostat clock
if (ivtclock) {
tm_->tm_isdst = -1; // determine dst
ttime = mktime(tm_); // thermostat time
Expand Down Expand Up @@ -2302,7 +2302,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su
data[7] = tm_->tm_isdst + 2; // set DST and flag for ext. clock
if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
data[6]++; // Junkers use 1-7;
data[6]++; // Junkers use 1-7;
data[7] = 0;
}
} else if (dt.length() == 23) {
Expand Down Expand Up @@ -2500,7 +2500,7 @@ bool Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
if (mode == HeatingCircuit::Mode::AUTO) {
set_mode_value = 0xFF; // special value for auto
} else {
set_mode_value = 0; // everything else, like manual/day etc..
set_mode_value = 0; // everything else, like manual/day etc..
}
break;
case EMSdevice::EMS_DEVICE_FLAG_JUNKERS:
Expand Down Expand Up @@ -3121,7 +3121,7 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co
offset = 0x0A; // manual offset
break;
case HeatingCircuit::Mode::TEMPAUTO:
offset = 0x08; // auto offset
offset = 0x08; // auto offset
if (temperature == -1) {
factor = 1; // to write 0xFF
}
Expand Down
16 changes: 8 additions & 8 deletions src/devices/thermostat.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ class Thermostat : public EMSdevice {
static constexpr uint16_t EMS_TYPE_RCOutdoorTemp = 0xA3; // is an automatic thermostat broadcast, outdoor external temp

// Type offsets
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_curr = 2; // current temp
static constexpr uint8_t EMS_OFFSET_RC10Set_temp = 4; // position of thermostat setpoint temperature
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC10StatusMessage_curr = 2; // current temp
static constexpr uint8_t EMS_OFFSET_RC10Set_temp = 4; // position of thermostat setpoint temperature

static constexpr uint8_t EMS_OFFSET_RC20StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC20StatusMessage_curr = 2; // current temp
Expand All @@ -267,9 +267,9 @@ class Thermostat : public EMSdevice {
static constexpr uint8_t EMS_OFFSET_RC20Set_temp_auto = 28; // position of thermostat setpoint temperature
static constexpr uint8_t EMS_OFFSET_RC20Set_temp_manual = 29; // position of thermostat setpoint temperature

static constexpr uint8_t EMS_OFFSET_RC20_2_Set_mode = 3; // ES72 - see https://github.com/emsesp/EMS-ESP/issues/334
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_night = 1; // ES72
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_day = 2; // ES72
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_mode = 3; // ES72 - see https://github.com/emsesp/EMS-ESP/issues/334
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_night = 1; // ES72
static constexpr uint8_t EMS_OFFSET_RC20_2_Set_temp_day = 2; // ES72

static constexpr uint8_t EMS_OFFSET_RC30StatusMessage_setpoint = 1; // setpoint temp
static constexpr uint8_t EMS_OFFSET_RC30StatusMessage_curr = 2; // current temp
Expand Down Expand Up @@ -308,8 +308,8 @@ class Thermostat : public EMSdevice {
static constexpr uint8_t EMS_OFFSET_RC35Set_temp_summer = 22;
static constexpr uint8_t EMS_OFFSET_RC35Set_temp_nofrost = 23;

static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_setpoint = 10; // setpoint temp
static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_curr = 8; // current temp
static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_setpoint = 10; // setpoint temp
static constexpr uint8_t EMS_OFFSET_EasyStatusMessage_curr = 8; // current temp

static constexpr uint8_t EMS_OFFSET_RCPLUSStatusMessage_mode = 10; // thermostat mode (auto, manual)
static constexpr uint8_t EMS_OFFSET_RCPLUSStatusMessage_setpoint = 3; // setpoint temp
Expand Down
4 changes: 2 additions & 2 deletions src/emsdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ void EMSdevice::add_device_value(uint8_t tag, // to b
// get fullname, getting translation if it exists
const char * const * fullname;
if (Helpers::count_items(name) == 1) {
fullname = nullptr; // no translations available, use empty
fullname = nullptr; // no translations available, use empty
} else {
fullname = &name[1]; // translations start at index 1
}
Expand Down Expand Up @@ -1311,7 +1311,7 @@ void EMSdevice::dump_value_info() {
if (dv.type == DeviceValueType::BOOL) {
snprintf(entityid, sizeof(entityid), "binary_sensor.%s", entity_with_tag); // binary sensor (for booleans)
} else {
snprintf(entityid, sizeof(entityid), "sensor.%s", entity_with_tag); // normal HA sensor
snprintf(entityid, sizeof(entityid), "sensor.%s", entity_with_tag); // normal HA sensor
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/emsdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ class EMSdevice {

std::vector<TelegramFunction> telegram_functions_; // each EMS device has its own set of registered telegram types

std::vector<DeviceValue> devicevalues_; // all the device values
std::vector<DeviceValue> devicevalues_; // all the device values

std::vector<uint16_t> handlers_ignored_;
};
Expand Down
Loading

0 comments on commit 81842e5

Please sign in to comment.