Add blor command + bug fixes

This commit is contained in:
Alexey Pavlov 2021-12-12 08:59:52 +03:00
parent 1ecf690cb4
commit 45aeaede9a
2 changed files with 9 additions and 11 deletions

View File

@ -16,8 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define USE_OPENTHERM
#ifdef USE_OPENTHERM
#define XSNS_69 69

View File

@ -16,8 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define USE_OPENTHERM
#ifdef USE_OPENTHERM
#include "OpenTherm.h"
@ -33,6 +31,7 @@ typedef union {
uint8_t notSupported : 1; // If set, boiler does not support this command
uint8_t supported : 1; // Set if at least one response were successfull
uint8_t retryCount : 2; // Retry counter before notSupported flag being set
uint8_t manual : 1; // Only manual call
};
} OpenThermParamFlags;
@ -247,7 +246,7 @@ OpenThermCommand sns_opentherm_commands[] = {
{// Boiler Lock-out Reset command
.m_command_name = "BLOR",
.m_command_code = (uint8_t)OpenThermMessageID::Command,
.m_flags = {.notSupported = 1},
.m_flags = {.manual = 1},
.m_results = {{.m_u8 = 0}, {.m_u8 = 0}},
.m_ot_make_request = sns_opentherm_send_blor,
.m_ot_parse_response = sns_opentherm_parse_generic_u16,
@ -443,21 +442,21 @@ void sns_opentherm_tele_oem_diag(struct OpenThermCommandT *self)
/////////////////////////////////// Boiler Boiler Lock-out Reset //////////////////////////////////////////////////
unsigned long sns_opentherm_send_blor(struct OpenThermCommandT *self, struct OT_BOILER_STATUS_T *status)
{
AddLog(LOG_LEVEL_ERROR, PSTR("[OTH]: Boiler Boiler Lock-out Reset"));
AddLog(LOG_LEVEL_ERROR, PSTR("[OTH]: Call Boiler Lock-out Reset"));
self->m_flags.notSupported = true; // Disable future calls of this command
unsigned int data = 1; //1 : “BLOR”= Boiler Lock-out Reset command
return OpenTherm::buildRequest(OpenThermMessageType::WRITE_DATA, OpenThermMessageID::Command, data);
data <<= 8;
return OpenTherm::buildRequest(OpenThermMessageType::OPTH_WRITE_DATA, OpenThermMessageID::Command, data);
}
bool sns_opentherm_call_blor()
{
/*
OpenThermCommandT *cmd = &sns_opentherm_commands[sns_opentherm_current_command-1];
OpenThermCommandT *cmd = &sns_opentherm_commands[(sizeof(sns_opentherm_commands) / sizeof(OpenThermCommand))-1];
if (strcmp(cmd->m_command_name, "BLOR")) return false;
cmd->m_flags.notSupported = false;
return true;
*/
}
/////////////////////////////////// Generic Single Float /////////////////////////////////////////////////
@ -597,7 +596,8 @@ void sns_opentherm_protocol_reset()
for (int i = 0; i < SNS_OT_COMMANDS_COUNT; ++i)
{
struct OpenThermCommandT *cmd = &sns_opentherm_commands[i];
cmd->m_flags.m_flags = 0;
cmd->m_flags.notSupported = cmd->m_flags.manual;
cmd->m_flags.retryCount = 0;
memset(cmd->m_results, 0, sizeof(OpenThermCommandT::m_results));
}
}