automatic formatting

This commit is contained in:
proddy
2020-09-12 16:47:37 +02:00
parent aca7cce98b
commit 796848f2e4
10 changed files with 25 additions and 13 deletions

View File

@@ -134,7 +134,7 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps)
<Typography variant="h6" color="primary" >
LED Settings
</Typography>
<TextValidator
<TextValidator
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"]}
name="led_gpio"

View File

@@ -8,10 +8,10 @@ export interface EMSESPSettings {
shower_timer: boolean;
shower_alert: boolean;
rx_gpio: number;
tx_gpio : number;
dallas_gpio : number;
tx_gpio: number;
dallas_gpio: number;
dallas_parasite: boolean;
led_gpio : number;
led_gpio: number;
hide_led: boolean;
}

View File

@@ -30,6 +30,12 @@ class DummySettings {
String jwtSecret = "ems-esp";
String ssid = "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){};

View File

@@ -70,7 +70,7 @@ void EMSESPSettingsService::onUpdate() {
// EMSESP::system_.syslog_init(); // changing SysLog will require a restart
EMSESP::init_tx();
System::set_led();
Sensors sensors_; // Dallas sensors
Sensors sensors_; // Dallas sensors
sensors_.start();
}

View File

@@ -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
void Mixing::publish_values() {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
char s[5]; // for formatting strings
char s[5]; // for formatting strings
switch (type_) {
case Type::HC:

View File

@@ -1630,7 +1630,7 @@ void Thermostat::set_temperature(const float temperature, const uint8_t mode, co
break;
default:
case HeatingCircuit::Mode::AUTO:
offset = 0x08; // auto offset
offset = 0x08; // auto offset
validate_typeid = monitor_typeids[hc->hc_num() - 1]; // get setpoint roomtemp back
break;
}
@@ -1678,7 +1678,7 @@ void Thermostat::set_temperature(const float temperature, const uint8_t mode, co
factor = 1;
break;
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
if (model == EMS_DEVICE_FLAG_RC35) {
uint8_t mode_ = hc->get_mode(this->flags());

View File

@@ -486,8 +486,8 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
LOG_NOTICE(pretty_telegram(telegram).c_str());
read_id_ = WATCH_ID_NONE;
} else if (watch() == WATCH_ON) {
if ((watch_id_ == WATCH_ID_NONE) || (telegram->type_id == watch_id_) ||
((watch_id_ < 0x80) && ((telegram->src == watch_id_) || (telegram->dest == watch_id_)))) {
if ((watch_id_ == WATCH_ID_NONE) || (telegram->type_id == watch_id_)
|| ((watch_id_ < 0x80) && ((telegram->src == watch_id_) || (telegram->dest == watch_id_)))) {
LOG_NOTICE(pretty_telegram(telegram).c_str());
}
}

View File

@@ -49,7 +49,10 @@ void Sensors::reload() {
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) {
for (uint8_t i = 0; i < MAX_SENSORS; registered_ha_[i++] = false)

View File

@@ -250,6 +250,8 @@ void System::measure_analog() {
uint16_t a = analogRead(A0);
#elif defined(ESP32)
uint16_t a = analogRead(36);
#else
uint16_t a = 0; // standalone
#endif
static uint32_t sum_ = 0;

View File

@@ -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 (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {
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());
}
}
@@ -583,7 +584,7 @@ uint16_t TxService::post_send_query() {
uint16_t post_typeid = this->get_post_send_query();
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, ...
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