mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
automatic formatting
This commit is contained in:
@@ -134,7 +134,7 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps)
|
|||||||
<Typography variant="h6" color="primary" >
|
<Typography variant="h6" color="primary" >
|
||||||
LED Settings
|
LED Settings
|
||||||
</Typography>
|
</Typography>
|
||||||
<TextValidator
|
<TextValidator
|
||||||
validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:40']}
|
validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:40']}
|
||||||
errorMessages={['LED GPIO is required', "Must be a number", "Must be 0 or higher", "Max value is 255"]}
|
errorMessages={['LED GPIO is required', "Must be a number", "Must be 0 or higher", "Max value is 255"]}
|
||||||
name="led_gpio"
|
name="led_gpio"
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ export interface EMSESPSettings {
|
|||||||
shower_timer: boolean;
|
shower_timer: boolean;
|
||||||
shower_alert: boolean;
|
shower_alert: boolean;
|
||||||
rx_gpio: number;
|
rx_gpio: number;
|
||||||
tx_gpio : number;
|
tx_gpio: number;
|
||||||
dallas_gpio : number;
|
dallas_gpio: number;
|
||||||
dallas_parasite: boolean;
|
dallas_parasite: boolean;
|
||||||
led_gpio : number;
|
led_gpio: number;
|
||||||
hide_led: boolean;
|
hide_led: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,12 @@ class DummySettings {
|
|||||||
String jwtSecret = "ems-esp";
|
String jwtSecret = "ems-esp";
|
||||||
String ssid = "ems-esp";
|
String ssid = "ems-esp";
|
||||||
String password = "ems-esp";
|
String password = "ems-esp";
|
||||||
|
uint16_t publish_time_boiler;
|
||||||
|
uint16_t publish_time_thermostat;
|
||||||
|
uint16_t publish_time_solar;
|
||||||
|
uint16_t publish_time_mixing;
|
||||||
|
uint16_t publish_time_other;
|
||||||
|
uint16_t publish_time_sensor;
|
||||||
|
|
||||||
static void read(DummySettings & settings, JsonObject & root){};
|
static void read(DummySettings & settings, JsonObject & root){};
|
||||||
static void read(DummySettings & settings){};
|
static void read(DummySettings & settings){};
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void EMSESPSettingsService::onUpdate() {
|
|||||||
// EMSESP::system_.syslog_init(); // changing SysLog will require a restart
|
// EMSESP::system_.syslog_init(); // changing SysLog will require a restart
|
||||||
EMSESP::init_tx();
|
EMSESP::init_tx();
|
||||||
System::set_led();
|
System::set_led();
|
||||||
Sensors sensors_; // Dallas sensors
|
Sensors sensors_; // Dallas sensors
|
||||||
sensors_.start();
|
sensors_.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void Mixing::show_values(uuid::console::Shell & shell) {
|
|||||||
// ideally we should group up all the mixing units together into a nested JSON but for now we'll send them individually
|
// ideally we should group up all the mixing units together into a nested JSON but for now we'll send them individually
|
||||||
void Mixing::publish_values() {
|
void Mixing::publish_values() {
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
|
||||||
char s[5]; // for formatting strings
|
char s[5]; // for formatting strings
|
||||||
|
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case Type::HC:
|
case Type::HC:
|
||||||
|
|||||||
@@ -1630,7 +1630,7 @@ void Thermostat::set_temperature(const float temperature, const uint8_t mode, co
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case HeatingCircuit::Mode::AUTO:
|
case HeatingCircuit::Mode::AUTO:
|
||||||
offset = 0x08; // auto offset
|
offset = 0x08; // auto offset
|
||||||
validate_typeid = monitor_typeids[hc->hc_num() - 1]; // get setpoint roomtemp back
|
validate_typeid = monitor_typeids[hc->hc_num() - 1]; // get setpoint roomtemp back
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1678,7 +1678,7 @@ void Thermostat::set_temperature(const float temperature, const uint8_t mode, co
|
|||||||
factor = 1;
|
factor = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case HeatingCircuit::Mode::AUTO: // automatic selection, if no type is defined, we use the standard code
|
case HeatingCircuit::Mode::AUTO: // automatic selection, if no type is defined, we use the standard code
|
||||||
validate_typeid = monitor_typeids[hc->hc_num() - 1]; //get setpoint roomtemp back
|
validate_typeid = monitor_typeids[hc->hc_num() - 1]; //get setpoint roomtemp back
|
||||||
if (model == EMS_DEVICE_FLAG_RC35) {
|
if (model == EMS_DEVICE_FLAG_RC35) {
|
||||||
uint8_t mode_ = hc->get_mode(this->flags());
|
uint8_t mode_ = hc->get_mode(this->flags());
|
||||||
|
|||||||
@@ -486,8 +486,8 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
LOG_NOTICE(pretty_telegram(telegram).c_str());
|
LOG_NOTICE(pretty_telegram(telegram).c_str());
|
||||||
read_id_ = WATCH_ID_NONE;
|
read_id_ = WATCH_ID_NONE;
|
||||||
} else if (watch() == WATCH_ON) {
|
} else if (watch() == WATCH_ON) {
|
||||||
if ((watch_id_ == WATCH_ID_NONE) || (telegram->type_id == watch_id_) ||
|
if ((watch_id_ == WATCH_ID_NONE) || (telegram->type_id == watch_id_)
|
||||||
((watch_id_ < 0x80) && ((telegram->src == watch_id_) || (telegram->dest == watch_id_)))) {
|
|| ((watch_id_ < 0x80) && ((telegram->src == watch_id_) || (telegram->dest == watch_id_)))) {
|
||||||
LOG_NOTICE(pretty_telegram(telegram).c_str());
|
LOG_NOTICE(pretty_telegram(telegram).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ void Sensors::reload() {
|
|||||||
mqtt_format_ = settings.mqtt_format; // single, nested or ha
|
mqtt_format_ = settings.mqtt_format; // single, nested or ha
|
||||||
});
|
});
|
||||||
|
|
||||||
EMSESP::emsespSettingsService.read([&](EMSESPSettings & settings) { dallas_gpio_ = settings.dallas_gpio; parasite_ = settings.dallas_parasite; });
|
EMSESP::emsespSettingsService.read([&](EMSESPSettings & settings) {
|
||||||
|
dallas_gpio_ = settings.dallas_gpio;
|
||||||
|
parasite_ = settings.dallas_parasite;
|
||||||
|
});
|
||||||
|
|
||||||
if (mqtt_format_ == MQTT_format::HA) {
|
if (mqtt_format_ == MQTT_format::HA) {
|
||||||
for (uint8_t i = 0; i < MAX_SENSORS; registered_ha_[i++] = false)
|
for (uint8_t i = 0; i < MAX_SENSORS; registered_ha_[i++] = false)
|
||||||
|
|||||||
@@ -250,6 +250,8 @@ void System::measure_analog() {
|
|||||||
uint16_t a = analogRead(A0);
|
uint16_t a = analogRead(A0);
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
uint16_t a = analogRead(36);
|
uint16_t a = analogRead(36);
|
||||||
|
#else
|
||||||
|
uint16_t a = 0; // standalone
|
||||||
#endif
|
#endif
|
||||||
static uint32_t sum_ = 0;
|
static uint32_t sum_ = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,8 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
// if we're watching and "raw" print out actual telegram as bytes to the console
|
// if we're watching and "raw" print out actual telegram as bytes to the console
|
||||||
if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {
|
if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {
|
||||||
uint16_t trace_watch_id = EMSESP::watch_id();
|
uint16_t trace_watch_id = EMSESP::watch_id();
|
||||||
if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id) || ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) {
|
if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id)
|
||||||
|
|| ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) {
|
||||||
LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
|
LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -583,7 +584,7 @@ uint16_t TxService::post_send_query() {
|
|||||||
uint16_t post_typeid = this->get_post_send_query();
|
uint16_t post_typeid = this->get_post_send_query();
|
||||||
|
|
||||||
if (post_typeid) {
|
if (post_typeid) {
|
||||||
uint8_t dest = (this->telegram_last_->dest & 0x7F);
|
uint8_t dest = (this->telegram_last_->dest & 0x7F);
|
||||||
// when set a value with large offset before and validate on same type, we have to add offset 0, 26, 52, ...
|
// when set a value with large offset before and validate on same type, we have to add offset 0, 26, 52, ...
|
||||||
uint8_t offset = (this->telegram_last_->type_id == post_typeid) ? ((this->telegram_last_->offset / 26) * 26) : 0;
|
uint8_t offset = (this->telegram_last_->type_id == post_typeid) ? ((this->telegram_last_->offset / 26) * 26) : 0;
|
||||||
uint8_t message_data[1] = {EMS_MAX_TELEGRAM_LENGTH}; // request all data, 32 bytes
|
uint8_t message_data[1] = {EMS_MAX_TELEGRAM_LENGTH}; // request all data, 32 bytes
|
||||||
|
|||||||
Reference in New Issue
Block a user