Skip to content

Commit

Permalink
Merge pull request #12195 from yury-sannikov/openterm-reset
Browse files Browse the repository at this point in the history
OpenTherm: Reset internal state on handshake
  • Loading branch information
arendst authored May 27, 2021
2 parents 108de09 + b06ca68 commit 1736ff0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tasmota/xsns_69_opentherm.ino
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ void sns_ot_start_handshake()

AddLog(LOG_LEVEL_DEBUG, PSTR("[OTH]: perform handshake"));

sns_opentherm_protocol_reset();

sns_ot_master->sendRequestAync(
OpenTherm::buildRequest(OpenThermMessageType::READ_DATA, OpenThermMessageID::SConfigSMemberIDcode, 0));

Expand Down
12 changes: 12 additions & 0 deletions tasmota/xsns_69_opentherm_protocol.ino
Original file line number Diff line number Diff line change
Expand Up @@ -438,4 +438,16 @@ void sns_opentherm_dump_telemetry()
add_coma = true;
}
}

void sns_opentherm_protocol_reset()
{
sns_opentherm_current_command = SNS_OT_COMMANDS_COUNT;
for (int i = 0; i < SNS_OT_COMMANDS_COUNT; ++i)
{
struct OpenThermCommandT *cmd = &sns_opentherm_commands[i];
cmd->m_flags.m_flags = 0;
memset(cmd->m_results, 0, sizeof(OpenThermCommandT::m_results));
}
}

#endif

0 comments on commit 1736ff0

Please sign in to comment.