fix fluctuating bitvalues, fix "send telegram", add solarpump softstart, add DHW temp for 9000i

This commit is contained in:
MichaelDvP
2020-06-23 13:15:56 +02:00
parent 1e97ced1a7
commit 1c73af88d2
4 changed files with 22 additions and 5 deletions

View File

@@ -675,6 +675,8 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr<const Telegram> telegram) {
void Boiler::set_warmwater_temp(const uint8_t temperature) { void Boiler::set_warmwater_temp(const uint8_t temperature) {
LOG_INFO(F("Setting boiler warm water temperature to %d C"), temperature); LOG_INFO(F("Setting boiler warm water temperature to %d C"), temperature);
write_command(EMS_TYPE_UBAParameterWW, 2, temperature); write_command(EMS_TYPE_UBAParameterWW, 2, temperature);
// for i9000, see #397
write_command(EMS_TYPE_UBAFlags, 3, temperature);
} }
// flow temp // flow temp
@@ -846,8 +848,7 @@ void Boiler::console_commands(Shell & shell, unsigned int context) {
set_warmwater_mode(1); set_warmwater_mode(1);
} else if (arguments[0] == read_flash_string(F_(eco))) { } else if (arguments[0] == read_flash_string(F_(eco))) {
set_warmwater_mode(2); set_warmwater_mode(2);
} } else if (arguments[0] == read_flash_string(F_(intelligent))) {
if (arguments[0] == read_flash_string(F_(intelligent))) {
set_warmwater_mode(3); set_warmwater_mode(3);
} else { } else {
shell.println(F("Invalid value. Must be hot, eco or intelligent")); shell.println(F("Invalid value. Must be hot, eco or intelligent"));

View File

@@ -181,7 +181,11 @@ void Solar::process_SM100Config(std::shared_ptr<const Telegram> telegram) {
* 30 00 FF 09 02 64 1E = 30% * 30 00 FF 09 02 64 1E = 30%
*/ */
void Solar::process_SM100Status(std::shared_ptr<const Telegram> telegram) { void Solar::process_SM100Status(std::shared_ptr<const Telegram> telegram) {
uint8_t pumpmod = pumpModulation_;
telegram->read_value(pumpModulation_, 9); telegram->read_value(pumpModulation_, 9);
if (pumpmod == 0 && pumpModulation_ == 100) { // mask out boosts
pumpModulation_ = 15; // set to minimum,
}
} }
/* /*

View File

@@ -427,7 +427,7 @@ void TxService::add(uint8_t operation, uint8_t * data, const uint8_t length) {
// EMS 1.0 // EMS 1.0
type_id = data[2]; type_id = data[2];
message_data = data + 4; message_data = data + 4;
message_length = length - 5; message_length = length - 4;
} else { } else {
// EMS 2.0 / EMS+ // EMS 2.0 / EMS+
uint8_t shift = 0; // default when data[2] is 0xFF uint8_t shift = 0; // default when data[2] is 0xFF
@@ -442,9 +442,20 @@ void TxService::add(uint8_t operation, uint8_t * data, const uint8_t length) {
// if we don't have a type_id or empty data block, exit // if we don't have a type_id or empty data block, exit
if ((type_id == 0) || (message_length == 0)) { if ((type_id == 0) || (message_length == 0)) {
#ifdef EMSESP_DEBUG
LOG_DEBUG(F("[DEBUG] Tx telegram type %d failed, length %d"), type_id, message_length);
#endif
return; return;
} }
if (operation == Telegram::Operation::TX_RAW) {
if (dest & 0x80) {
operation = Telegram::Operation::TX_READ;
} else {
operation = Telegram::Operation::TX_WRITE;
}
}
auto telegram = std::make_shared<Telegram>(operation, src, dest, type_id, offset, message_data, message_length); // operation is TX_WRITE or TX_READ auto telegram = std::make_shared<Telegram>(operation, src, dest, type_id, offset, message_data, message_length); // operation is TX_WRITE or TX_READ
// if the queue is full, make room but removing the last one // if the queue is full, make room but removing the last one

View File

@@ -81,11 +81,12 @@ class Telegram {
// reads a bit value from a given telegram position // reads a bit value from a given telegram position
void read_bitvalue(uint8_t & value, const uint8_t index, const uint8_t bit) const { void read_bitvalue(uint8_t & value, const uint8_t index, const uint8_t bit) const {
if ((index - offset) >= message_length) { uint8_t abs_index = (index - offset);
if(abs_index >= message_length) {
return; // out of bounds return; // out of bounds
} }
value = (uint8_t)(((message_data[index - offset]) >> (bit)) & 0x01); value = (uint8_t)(((message_data[abs_index]) >> (bit)) & 0x01);
} }
// read values from a telegram. We always store the value, regardless if its garbage // read values from a telegram. We always store the value, regardless if its garbage