mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
auto formatting
This commit is contained in:
@@ -220,11 +220,11 @@ void Shell::loop_normal() {
|
|||||||
line_buffer_.clear();
|
line_buffer_.clear();
|
||||||
cursor_ = 0;
|
cursor_ = 0;
|
||||||
} else if (c == 'C') { // cursor right
|
} else if (c == 'C') { // cursor right
|
||||||
if (cursor_) {
|
if (cursor_) {
|
||||||
cursor_--;
|
cursor_--;
|
||||||
}
|
}
|
||||||
} else if (c == 'D') { // cursor left
|
} else if (c == 'D') { // cursor left
|
||||||
if (cursor_ < line_buffer_.length()) {
|
if (cursor_ < line_buffer_.length()) {
|
||||||
cursor_++;
|
cursor_++;
|
||||||
}
|
}
|
||||||
} else if (c == 'H') { // Home
|
} else if (c == 'H') { // Home
|
||||||
@@ -236,7 +236,7 @@ void Shell::loop_normal() {
|
|||||||
esc_ = 11 + c - 'P';
|
esc_ = 11 + c - 'P';
|
||||||
}
|
}
|
||||||
if (c == '~' || (c >= 'P' && c <= 'Z')) { // function keys with number ESCn~
|
if (c == '~' || (c >= 'P' && c <= 'Z')) { // function keys with number ESCn~
|
||||||
if ((esc_ == 3) && cursor_) { // del
|
if ((esc_ == 3) && cursor_) { // del
|
||||||
cursor_--;
|
cursor_--;
|
||||||
line_buffer_.erase(line_buffer_.length() - cursor_ - 1, 1);
|
line_buffer_.erase(line_buffer_.length() - cursor_ - 1, 1);
|
||||||
} else if (esc_ == 4) { // end
|
} else if (esc_ == 4) { // end
|
||||||
@@ -265,7 +265,7 @@ void Shell::loop_normal() {
|
|||||||
set_command_str(F("call system settings"));
|
set_command_str(F("call system settings"));
|
||||||
} else if (esc_ == 23) { // F11
|
} else if (esc_ == 23) { // F11
|
||||||
line_buffer_ = read_flash_string(F("call send \"0B \""));
|
line_buffer_ = read_flash_string(F("call send \"0B \""));
|
||||||
cursor_ = 1;
|
cursor_ = 1;
|
||||||
} else if (esc_ == 24) { // F12
|
} else if (esc_ == 24) { // F12
|
||||||
set_command_str(F("log debug; watch raw"));
|
set_command_str(F("log debug; watch raw"));
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ void Shell::loop_normal() {
|
|||||||
} else if ((c != '[') && (c != 'O')) { // all other chars except start of sequence
|
} else if ((c != '[') && (c != 'O')) { // all other chars except start of sequence
|
||||||
esc_ = 0;
|
esc_ = 0;
|
||||||
}
|
}
|
||||||
// process normal ascii text
|
// process normal ascii text
|
||||||
} else if (c >= '\x20' && c <= '\x7E') {
|
} else if (c >= '\x20' && c <= '\x7E') {
|
||||||
if (line_buffer_.length() < maximum_command_line_length_) {
|
if (line_buffer_.length() < maximum_command_line_length_) {
|
||||||
line_buffer_.insert(line_buffer_.length() - cursor_, 1, c);
|
line_buffer_.insert(line_buffer_.length() - cursor_, 1, c);
|
||||||
@@ -467,8 +467,8 @@ void Shell::delete_buffer_word(bool display) {
|
|||||||
} else {
|
} else {
|
||||||
if (display) {
|
if (display) {
|
||||||
size_t pos1 = 0;
|
size_t pos1 = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
while (pos1 < line_buffer_.length() - cursor_) {
|
while (pos1 < line_buffer_.length() - cursor_) {
|
||||||
pos = pos1;
|
pos = pos1;
|
||||||
pos1 = line_buffer_.find(' ', pos + 1);
|
pos1 = line_buffer_.find(' ', pos + 1);
|
||||||
}
|
}
|
||||||
@@ -502,7 +502,7 @@ void Shell::process_command() {
|
|||||||
while (!line_buffer_.empty()) {
|
while (!line_buffer_.empty()) {
|
||||||
size_t pos = line_buffer_.find(';');
|
size_t pos = line_buffer_.find(';');
|
||||||
std::string line1;
|
std::string line1;
|
||||||
if (pos < line_buffer_.length()) {
|
if (pos < line_buffer_.length()) {
|
||||||
line1 = line_buffer_.substr(0, pos);
|
line1 = line_buffer_.substr(0, pos);
|
||||||
line_buffer_.erase(0, pos + 1);
|
line_buffer_.erase(0, pos + 1);
|
||||||
} else {
|
} else {
|
||||||
@@ -576,7 +576,7 @@ void Shell::process_password(bool completed) {
|
|||||||
void Shell::invoke_command(const std::string & line) {
|
void Shell::invoke_command(const std::string & line) {
|
||||||
erase_current_line();
|
erase_current_line();
|
||||||
prompt_displayed_ = false;
|
prompt_displayed_ = false;
|
||||||
line_buffer_ = line;
|
line_buffer_ = line;
|
||||||
display_prompt();
|
display_prompt();
|
||||||
process_command();
|
process_command();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ void Boiler::register_mqtt_ha_config_ww() {
|
|||||||
// send stuff to the Web UI
|
// send stuff to the Web UI
|
||||||
void Boiler::device_info_web(JsonArray & root) {
|
void Boiler::device_info_web(JsonArray & root) {
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
// DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
|
||||||
JsonObject json = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values_main(json)) {
|
if (!export_values_main(json)) {
|
||||||
@@ -234,6 +233,7 @@ void Boiler::device_info_web(JsonArray & root) {
|
|||||||
if (!export_values_ww(json)) { // append ww values
|
if (!export_values_ww(json)) { // append ww values
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ww
|
// ww
|
||||||
print_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json);
|
print_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json);
|
print_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json);
|
||||||
@@ -679,13 +679,11 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
|||||||
EMSdevice::show_values(shell); // for showing the header
|
EMSdevice::show_values(shell); // for showing the header
|
||||||
|
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
// DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_LARGE> doc;
|
||||||
JsonObject json = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values_main(json)) {
|
if (!export_values_main(json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
// doc.shrinkToFit();
|
|
||||||
|
|
||||||
print_value_json(shell, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json);
|
print_value_json(shell, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json);
|
||||||
print_value_json(shell, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json);
|
print_value_json(shell, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json);
|
||||||
@@ -1045,9 +1043,9 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr<const Telegram> telegram) {
|
|||||||
if (telegram->message_data[4] & 0x80) { // valid date
|
if (telegram->message_data[4] & 0x80) { // valid date
|
||||||
char code[3];
|
char code[3];
|
||||||
uint16_t codeNo;
|
uint16_t codeNo;
|
||||||
code[0] = telegram->message_data[0];
|
code[0] = telegram->message_data[0];
|
||||||
code[1] = telegram->message_data[1];
|
code[1] = telegram->message_data[1];
|
||||||
code[2] = 0;
|
code[2] = 0;
|
||||||
telegram->read_value(codeNo, 2);
|
telegram->read_value(codeNo, 2);
|
||||||
uint16_t year = (telegram->message_data[4] & 0x7F) + 2000;
|
uint16_t year = (telegram->message_data[4] & 0x7F) + 2000;
|
||||||
uint8_t month = telegram->message_data[5];
|
uint8_t month = telegram->message_data[5];
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ void Switch::publish_values(JsonObject & json, bool force) {
|
|||||||
|
|
||||||
// export values to JSON
|
// export values to JSON
|
||||||
bool Switch::export_values(JsonObject & json) {
|
bool Switch::export_values(JsonObject & json) {
|
||||||
|
|
||||||
if (Helpers::hasValue(flowTemp_)) {
|
if (Helpers::hasValue(flowTemp_)) {
|
||||||
char s[7];
|
char s[7];
|
||||||
json["activated"] = Helpers::render_value(s, activated_, EMS_VALUE_BOOL);
|
json["activated"] = Helpers::render_value(s, activated_, EMS_VALUE_BOOL);
|
||||||
@@ -148,12 +147,12 @@ void Switch::register_mqtt_ha_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// message 0x9B switch on/off
|
// message 0x9B switch on/off
|
||||||
void Switch::process_WM10SetMessage(std::shared_ptr<const Telegram> telegram){
|
void Switch::process_WM10SetMessage(std::shared_ptr<const Telegram> telegram) {
|
||||||
changed_ |= telegram->read_value(activated_, 0);
|
changed_ |= telegram->read_value(activated_, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// message 0x9C holds flowtemp and unknown statusvalue
|
// message 0x9C holds flowtemp and unknown status value
|
||||||
void Switch::process_WM10MonitorMessage(std::shared_ptr<const Telegram> telegram){
|
void Switch::process_WM10MonitorMessage(std::shared_ptr<const Telegram> telegram) {
|
||||||
changed_ |= telegram->read_value(flowTemp_, 0); // is * 10
|
changed_ |= telegram->read_value(flowTemp_, 0); // is * 10
|
||||||
changed_ |= telegram->read_value(status_, 2);
|
changed_ |= telegram->read_value(status_, 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1602,9 +1602,9 @@ void Thermostat::process_RCErrorMessage(std::shared_ptr<const Telegram> telegram
|
|||||||
if (telegram->message_data[4] & 0x80) { // valid date
|
if (telegram->message_data[4] & 0x80) { // valid date
|
||||||
char code[3];
|
char code[3];
|
||||||
uint16_t codeNo;
|
uint16_t codeNo;
|
||||||
code[0] = telegram->message_data[0];
|
code[0] = telegram->message_data[0];
|
||||||
code[1] = telegram->message_data[1];
|
code[1] = telegram->message_data[1];
|
||||||
code[2] = 0;
|
code[2] = 0;
|
||||||
telegram->read_value(codeNo, 2);
|
telegram->read_value(codeNo, 2);
|
||||||
uint16_t year = (telegram->message_data[4] & 0x7F) + 2000;
|
uint16_t year = (telegram->message_data[4] & 0x7F) + 2000;
|
||||||
uint8_t month = telegram->message_data[5];
|
uint8_t month = telegram->message_data[5];
|
||||||
|
|||||||
Reference in New Issue
Block a user