Typos, version string

This commit is contained in:
MichaelDvP
2020-06-01 14:12:29 +02:00
parent 19abeb7456
commit ba08fb65ef
8 changed files with 16 additions and 12 deletions

View File

@@ -235,7 +235,7 @@ void Console::load_standard_commands(unsigned int context) {
} }
// trace logic // trace logic
if (level == uuid::log::Level::TRACE) { if (level == uuid::log::Level::TRACE || level == uuid::log::Level::DEBUG) {
watch_id = LOG_TRACE_WATCH_NONE; // no watch ID set watch_id = LOG_TRACE_WATCH_NONE; // no watch ID set
if (arguments.size() > 1) { if (arguments.size() > 1) {
// next argument is raw or full // next argument is raw or full
@@ -243,6 +243,8 @@ void Console::load_standard_commands(unsigned int context) {
emsesp::EMSESP::trace_raw(true); emsesp::EMSESP::trace_raw(true);
} else if (arguments[1] == read_flash_string(F_(full))) { } else if (arguments[1] == read_flash_string(F_(full))) {
emsesp::EMSESP::trace_raw(false); emsesp::EMSESP::trace_raw(false);
} else {
emsesp::EMSESP::trace_watch_id(Helpers::hextoint(arguments[1].c_str()));
} }
// get the watch_id if its set // get the watch_id if its set

View File

@@ -228,7 +228,7 @@ std::string EMSdevice::telegram_type_name(std::shared_ptr<const Telegram> telegr
} }
for (const auto & tf : telegram_functions_) { for (const auto & tf : telegram_functions_) {
if (tf.telegram_type_id_ == (telegram->type_id && ((telegram->type_id & 0xF0) != 0xF0))) { if ((tf.telegram_type_id_ == telegram->type_id) && ((telegram->type_id & 0x0F0) != 0xF0)) {
return uuid::read_flash_string(tf.telegram_type_name_); return uuid::read_flash_string(tf.telegram_type_name_);
} }
} }

View File

@@ -247,6 +247,7 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
// get the type name, any match will do // get the type name, any match will do
if (type_name.empty()) { if (type_name.empty()) {
type_name = emsdevice->telegram_type_name(telegram); type_name = emsdevice->telegram_type_name(telegram);
} }
} }
} }
@@ -362,14 +363,12 @@ void EMSESP::process_version(std::shared_ptr<const Telegram> telegram) {
uint8_t product_id = telegram->message_data[offset]; // product ID uint8_t product_id = telegram->message_data[offset]; // product ID
// get version as XX.XX // get version as XX.XX
char buf[6] = {0},
buf1[6] = {0};
std::string version(5, '\0'); std::string version(5, '\0');
snprintf_P(&version[0], snprintf_P(&version[0],
version.capacity() + 1, version.capacity() + 1,
PSTR("%s.%s"), PSTR("%02d.%02d"),
Helpers::smallitoa(buf, telegram->message_data[offset + 1]), telegram->message_data[offset + 1],
Helpers::smallitoa(buf1, telegram->message_data[offset + 2])); telegram->message_data[offset + 2]);
// some devices store the protocol type (HT3, Buderus) in the last byte // some devices store the protocol type (HT3, Buderus) in the last byte
uint8_t brand; uint8_t brand;
@@ -569,6 +568,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
//LOG_TRACE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); //LOG_TRACE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
uint8_t first_value = data[0]; uint8_t first_value = data[0];
if (((first_value & 0x7F) == txservice_.ems_bus_id()) && (length > 1)) { if (((first_value & 0x7F) == txservice_.ems_bus_id()) && (length > 1)) {
rxservice_.add(data, length); // just for logging
return; // it's an echo return; // it's an echo
} }

View File

@@ -279,6 +279,8 @@ uint32_t Helpers::hextoint(const char * hex) {
byte = byte - 'a' + 10; byte = byte - 'a' + 10;
else if (byte >= 'A' && byte <= 'F') else if (byte >= 'A' && byte <= 'F')
byte = byte - 'A' + 10; byte = byte - 'A' + 10;
else
return 0; // error
// shift 4 to make space for new digit, and add the 4 bits of the new digit // shift 4 to make space for new digit, and add the 4 bits of the new digit
val = (val << 4) | (byte & 0xF); val = (val << 4) | (byte & 0xF);
} }

View File

@@ -726,7 +726,7 @@ void Mqtt::console_commands(Shell & shell, unsigned int context) {
} }
reconnect(); reconnect();
}); });
EMSESPShell::commands->add_command(ShellContext::MQTT, EMSESPShell::commands->add_command(ShellContext::MQTT,
CommandFlags::ADMIN, CommandFlags::ADMIN,
flash_string_vector{F_(set), F_(port)}, flash_string_vector{F_(set), F_(port)},

View File

@@ -277,7 +277,7 @@ void Sensors::publish_values() {
if (mqtt_format_ == Settings::MQTT_format::CUSTOM) { if (mqtt_format_ == Settings::MQTT_format::CUSTOM) {
char s[5]; char s[5];
doc[device.to_string()] = Helpers::render_value(s, device.temperature_c_, 2); doc[device.to_string()] = Helpers::render_value(s, device.temperature_c_, 2);
} else { } else {
char sensorID[10]; // sensor{1-n} char sensorID[10]; // sensor{1-n}
strlcpy(sensorID, "sensor", 10); strlcpy(sensorID, "sensor", 10);
char s[5]; char s[5];

View File

@@ -470,8 +470,8 @@ void Thermostat::publish_values() {
// go through all the heating circuits // go through all the heating circuits
for (const auto & hc : heating_circuits_) { for (const auto & hc : heating_circuits_) {
// if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) { // if ((hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) || (hc->curr_roomTemp == EMS_VALUE_SHORT_NOTSET)) {
if (hc->heatingtype == 0) { if (hc->setpoint_roomTemp == EMS_VALUE_SHORT_NOTSET) {
break; // skip this HC break; // skip this HC
} }
has_data = true; has_data = true;

View File

@@ -63,7 +63,7 @@ void IRAM_ATTR EMSuart::emsuart_rx_intr_handler(void * para) {
if (length < EMS_MAXBUFFERSIZE) { if (length < EMS_MAXBUFFERSIZE) {
rxbuf[length++] = rx; rxbuf[length++] = rx;
} else { } else {
drop_next_rx = true; // we have a overflow drop_next_rx = true; // we have a overflow
} }
} }
if ((!drop_next_rx) && ((length == 2) || (length > 4))) { if ((!drop_next_rx) && ((length == 2) || (length > 4))) {