mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
automatic clang formatting
This commit is contained in:
@@ -53,7 +53,8 @@ class Boiler : public EMSdevice {
|
|||||||
|
|
||||||
uint8_t last_boilerState = 0xFF; // remember last state of heating and warm water on/off
|
uint8_t last_boilerState = 0xFF; // remember last state of heating and warm water on/off
|
||||||
uint8_t mqtt_format_; // single, nested or ha
|
uint8_t mqtt_format_; // single, nested or ha
|
||||||
bool changed_ = false;;
|
bool changed_ = false;
|
||||||
|
;
|
||||||
|
|
||||||
static constexpr uint8_t EMS_TYPE_UBAParameterWW = 0x33;
|
static constexpr uint8_t EMS_TYPE_UBAParameterWW = 0x33;
|
||||||
static constexpr uint8_t EMS_TYPE_UBAFunctionTest = 0x1D;
|
static constexpr uint8_t EMS_TYPE_UBAFunctionTest = 0x1D;
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ void Mixing::device_info(JsonArray & root) {
|
|||||||
render_value_json(root, "", F("Current pump modulation"), pumpMod_, F_(percent));
|
render_value_json(root, "", F("Current pump modulation"), pumpMod_, F_(percent));
|
||||||
render_value_json(root, "", F("Current valve status"), status_, nullptr);
|
render_value_json(root, "", F("Current valve status"), status_, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if values have been updated
|
// check to see if values have been updated
|
||||||
@@ -168,8 +167,8 @@ void Mixing::publish_values() {
|
|||||||
// A0 0B FF 00 01 D7 00 00 00 80 00 00 00 00 03 80
|
// A0 0B FF 00 01 D7 00 00 00 80 00 00 00 00 03 80
|
||||||
void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram) {
|
void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram) {
|
||||||
type_ = Type::HC;
|
type_ = Type::HC;
|
||||||
hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is
|
hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is
|
||||||
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
|
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
|
||||||
changed_ |= telegram->read_value(flowSetTemp_, 5);
|
changed_ |= telegram->read_value(flowSetTemp_, 5);
|
||||||
changed_ |= telegram->read_value(pumpMod_, 2);
|
changed_ |= telegram->read_value(pumpMod_, 2);
|
||||||
changed_ |= telegram->read_value(status_, 1); // valve status
|
changed_ |= telegram->read_value(status_, 1); // valve status
|
||||||
@@ -180,8 +179,8 @@ void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> tele
|
|||||||
// A8 00 FF 00 02 31 02 35 00 3C 00 3C 3C 46 02 03 03 00 3C // in 0x29
|
// A8 00 FF 00 02 31 02 35 00 3C 00 3C 3C 46 02 03 03 00 3C // in 0x29
|
||||||
void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) {
|
void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) {
|
||||||
type_ = Type::WWC;
|
type_ = Type::WWC;
|
||||||
hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2.
|
hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2.
|
||||||
changed_ |= telegram->read_value(flowTemp_, 0); // is * 10
|
changed_ |= telegram->read_value(flowTemp_, 0); // is * 10
|
||||||
changed_ |= telegram->read_value(pumpMod_, 2);
|
changed_ |= telegram->read_value(pumpMod_, 2);
|
||||||
changed_ |= telegram->read_value(status_, 11); // temp status
|
changed_ |= telegram->read_value(status_, 11); // temp status
|
||||||
}
|
}
|
||||||
@@ -197,7 +196,7 @@ void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram)
|
|||||||
if (ismixed == 0) {
|
if (ismixed == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ismixed == 2) { // we have a mixed circuit
|
if (ismixed == 2) { // we have a mixed circuit
|
||||||
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
|
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
|
||||||
changed_ |= telegram->read_value(flowSetTemp_, 5);
|
changed_ |= telegram->read_value(flowSetTemp_, 5);
|
||||||
changed_ |= telegram->read_value(status_, 2); // valve status
|
changed_ |= telegram->read_value(status_, 2); // valve status
|
||||||
|
|||||||
@@ -973,8 +973,9 @@ void Thermostat::process_EasyMonitor(std::shared_ptr<const Telegram> telegram) {
|
|||||||
// Settings Parameters - 0xA5 - RC30_1
|
// Settings Parameters - 0xA5 - RC30_1
|
||||||
void Thermostat::process_IBASettings(std::shared_ptr<const Telegram> telegram) {
|
void Thermostat::process_IBASettings(std::shared_ptr<const Telegram> telegram) {
|
||||||
// 22 - display line on RC35
|
// 22 - display line on RC35
|
||||||
changed_ |= telegram->read_value(ibaMainDisplay_,
|
changed_ |=
|
||||||
0); // display on Thermostat: 0 int. temp, 1 int. setpoint, 2 ext. temp., 3 burner temp., 4 ww temp, 5 functioning mode, 6 time, 7 data, 8 smoke temp
|
telegram->read_value(ibaMainDisplay_,
|
||||||
|
0); // display on Thermostat: 0 int. temp, 1 int. setpoint, 2 ext. temp., 3 burner temp., 4 ww temp, 5 functioning mode, 6 time, 7 data, 8 smoke temp
|
||||||
changed_ |= telegram->read_value(ibaLanguage_, 1); // language on Thermostat: 0 german, 1 dutch, 2 french, 3 italian
|
changed_ |= telegram->read_value(ibaLanguage_, 1); // language on Thermostat: 0 german, 1 dutch, 2 french, 3 italian
|
||||||
changed_ |= telegram->read_value(ibaCalIntTemperature_, 2); // offset int. temperature sensor, by * 0.1 Kelvin
|
changed_ |= telegram->read_value(ibaCalIntTemperature_, 2); // offset int. temperature sensor, by * 0.1 Kelvin
|
||||||
changed_ |= telegram->read_value(ibaBuildingType_, 6); // building type: 0 = light, 1 = medium, 2 = heavy
|
changed_ |= telegram->read_value(ibaBuildingType_, 6); // building type: 0 = light, 1 = medium, 2 = heavy
|
||||||
|
|||||||
@@ -305,10 +305,8 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
|||||||
void EMSESP::publish_other_values() {
|
void EMSESP::publish_other_values() {
|
||||||
if (Mqtt::connected()) {
|
if (Mqtt::connected()) {
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::BOILER)
|
if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::BOILER) && (emsdevice->device_type() != EMSdevice::DeviceType::THERMOSTAT)
|
||||||
&& (emsdevice->device_type() != EMSdevice::DeviceType::THERMOSTAT)
|
&& (emsdevice->device_type() != EMSdevice::DeviceType::SOLAR) && (emsdevice->device_type() != EMSdevice::DeviceType::MIXING)) {
|
||||||
&& (emsdevice->device_type() != EMSdevice::DeviceType::SOLAR)
|
|
||||||
&& (emsdevice->device_type() != EMSdevice::DeviceType::MIXING)) {
|
|
||||||
emsdevice->publish_values();
|
emsdevice->publish_values();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ void System::measure_analog() {
|
|||||||
static uint32_t measure_last_ = 0;
|
static uint32_t measure_last_ = 0;
|
||||||
static uint32_t sum_ = 0;
|
static uint32_t sum_ = 0;
|
||||||
|
|
||||||
if (!measure_last_ || (uint32_t)(uuid::get_uptime() - measure_last_) >= 1100) {
|
if (!measure_last_ || (uint32_t)(uuid::get_uptime() - measure_last_) >= SYSTEM_MEASURE_ANALOG_INTERVAL) {
|
||||||
measure_last_ = uuid::get_uptime();
|
measure_last_ = uuid::get_uptime();
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
uint16_t a = analogRead(A0);
|
uint16_t a = analogRead(A0);
|
||||||
@@ -255,7 +255,7 @@ void System::measure_analog() {
|
|||||||
if (!analog_) { // init first time
|
if (!analog_) { // init first time
|
||||||
analog_ = a;
|
analog_ = a;
|
||||||
sum_ = a * 256;
|
sum_ = a * 256;
|
||||||
} else { // simple moving average filter
|
} else { // simple moving average filter
|
||||||
sum_ = sum_ * 255 / 256 + a;
|
sum_ = sum_ * 255 / 256 + a;
|
||||||
analog_ = sum_ / 256;
|
analog_ = sum_ / 256;
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/system.h
11
src/system.h
@@ -68,12 +68,13 @@ class System {
|
|||||||
static uuid::syslog::SyslogService syslog_;
|
static uuid::syslog::SyslogService syslog_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static constexpr uint32_t SYSTEM_CHECK_FREQUENCY = 5000; // check every 5 seconds
|
static constexpr uint32_t SYSTEM_CHECK_FREQUENCY = 5000; // check every 5 seconds
|
||||||
static constexpr uint32_t LED_WARNING_BLINK = 1000; // pulse to show no connection, 1 sec
|
static constexpr uint32_t LED_WARNING_BLINK = 1000; // pulse to show no connection, 1 sec
|
||||||
static constexpr uint32_t LED_WARNING_BLINK_FAST = 100; // flash quickly for boot up sequence
|
static constexpr uint32_t LED_WARNING_BLINK_FAST = 100; // flash quickly for boot up sequence
|
||||||
static constexpr uint32_t SYSTEM_HEARTBEAT_INTERVAL = 60000; // in milliseconds, how often the MQTT heartbeat is sent (1 min)
|
static constexpr uint32_t SYSTEM_HEARTBEAT_INTERVAL = 60000; // in milliseconds, how often the MQTT heartbeat is sent (1 min)
|
||||||
|
static constexpr uint32_t SYSTEM_MEASURE_ANALOG_INTERVAL = 1100;
|
||||||
|
|
||||||
// internal LED
|
// internal LED
|
||||||
static constexpr uint8_t LED_ON = LOW;
|
static constexpr uint8_t LED_ON = LOW;
|
||||||
|
|
||||||
void led_monitor();
|
void led_monitor();
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class Telegram {
|
|||||||
return false; // out of bounds
|
return false; // out of bounds
|
||||||
}
|
}
|
||||||
uint8_t val = value;
|
uint8_t val = value;
|
||||||
value = (uint8_t)(((this->message_data[abs_index]) >> (bit)) & 0x01);
|
value = (uint8_t)(((this->message_data[abs_index]) >> (bit)) & 0x01);
|
||||||
if (val != value) {
|
if (val != value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ class Telegram {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto val = value;
|
auto val = value;
|
||||||
value = 0;
|
value = 0;
|
||||||
for (uint8_t i = 0; i < num_bytes; i++) {
|
for (uint8_t i = 0; i < num_bytes; i++) {
|
||||||
value = (value << 8) + this->message_data[index - this->offset + i]; // shift by byte
|
value = (value << 8) + this->message_data[index - this->offset + i]; // shift by byte
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user