mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
fix fluctuating bitvalues, fix "send telegram", add solarpump softstart, add DHW temp for 9000i
This commit is contained in:
@@ -675,6 +675,8 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr<const Telegram> telegram) {
|
||||
void Boiler::set_warmwater_temp(const uint8_t temperature) {
|
||||
LOG_INFO(F("Setting boiler warm water temperature to %d C"), temperature);
|
||||
write_command(EMS_TYPE_UBAParameterWW, 2, temperature);
|
||||
// for i9000, see #397
|
||||
write_command(EMS_TYPE_UBAFlags, 3, temperature);
|
||||
}
|
||||
|
||||
// flow temp
|
||||
@@ -846,8 +848,7 @@ void Boiler::console_commands(Shell & shell, unsigned int context) {
|
||||
set_warmwater_mode(1);
|
||||
} else if (arguments[0] == read_flash_string(F_(eco))) {
|
||||
set_warmwater_mode(2);
|
||||
}
|
||||
if (arguments[0] == read_flash_string(F_(intelligent))) {
|
||||
} else if (arguments[0] == read_flash_string(F_(intelligent))) {
|
||||
set_warmwater_mode(3);
|
||||
} else {
|
||||
shell.println(F("Invalid value. Must be hot, eco or intelligent"));
|
||||
|
||||
@@ -181,7 +181,11 @@ void Solar::process_SM100Config(std::shared_ptr<const Telegram> telegram) {
|
||||
* 30 00 FF 09 02 64 1E = 30%
|
||||
*/
|
||||
void Solar::process_SM100Status(std::shared_ptr<const Telegram> telegram) {
|
||||
uint8_t pumpmod = pumpModulation_;
|
||||
telegram->read_value(pumpModulation_, 9);
|
||||
if (pumpmod == 0 && pumpModulation_ == 100) { // mask out boosts
|
||||
pumpModulation_ = 15; // set to minimum,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -427,7 +427,7 @@ void TxService::add(uint8_t operation, uint8_t * data, const uint8_t length) {
|
||||
// EMS 1.0
|
||||
type_id = data[2];
|
||||
message_data = data + 4;
|
||||
message_length = length - 5;
|
||||
message_length = length - 4;
|
||||
} else {
|
||||
// EMS 2.0 / EMS+
|
||||
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 ((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;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
// if the queue is full, make room but removing the last one
|
||||
|
||||
@@ -81,11 +81,12 @@ class Telegram {
|
||||
|
||||
// reads a bit value from a given telegram position
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user