txDelay change from bool to int

This commit is contained in:
proddy
2019-05-22 00:01:59 +02:00
parent f9c5cb9dca
commit 03d9e6547f
3 changed files with 13 additions and 20 deletions

View File

@@ -106,7 +106,7 @@ command_t project_cmds[] = {
{true, "shower_alert <on | off>", "send a warning of cold water after shower time is exceeded"},
{true, "publish_wait <seconds>", "set frequency for publishing to MQTT"},
{true, "heating_circuit <1 | 2>", "set the thermostat HC to work with if using multiple heating circuits"},
{true, "tx_delay <on | off>", "turn on if Tx not working on newer boilers"},
{true, "tx_delay <n>", "0=normal, 1=ems+, 2=new logic"},
{false, "info", "show data captured on the EMS bus"},
{false, "log <n | b | t | r | v>", "set logging mode to none, basic, thermostat only, raw or verbose"},
@@ -342,7 +342,7 @@ void showInfo() {
myDebug_P(PSTR(" Rx: Poll=%d ms, # Rx telegrams read=%d, # CRC errors=%d"), ems_getPollFrequency(), EMS_Sys_Status.emsRxPgks, EMS_Sys_Status.emxCrcErr);
if (ems_getTxCapable()) {
myDebug_P(PSTR(" Tx: available, Tx delay is %s, # Tx telegrams sent=%d"), (ems_getTxDelay() ? "on" : "off"), EMS_Sys_Status.emsTxPkgs);
myDebug_P(PSTR(" Tx: available, Tx delay is %d, # Tx telegrams sent=%d"), ems_getTxDelay(), EMS_Sys_Status.emsTxPkgs);
} else {
myDebug_P(PSTR(" Tx: no signal"));
}
@@ -1182,15 +1182,8 @@ bool SettingsCallback(MYESP_FSACTION action, uint8_t wc, const char * setting, c
// tx delay
if ((strcmp(setting, "tx_delay") == 0) && (wc == 2)) {
if (strcmp(value, "on") == 0) {
ems_setTxDelay(true);
ems_setTxDelay(atoi(value));
ok = true;
} else if (strcmp(value, "off") == 0) {
ems_setTxDelay(false);
ok = true;
} else {
myDebug_P(PSTR("Error. Usage: set tx_delay <on | off>"));
}
}
}
@@ -1218,7 +1211,7 @@ bool SettingsCallback(MYESP_FSACTION action, uint8_t wc, const char * setting, c
myDebug_P(PSTR(" shower_timer=%s"), EMSESP_Status.shower_timer ? "on" : "off");
myDebug_P(PSTR(" shower_alert=%s"), EMSESP_Status.shower_alert ? "on" : "off");
myDebug_P(PSTR(" publish_wait=%d"), EMSESP_Status.publish_wait);
myDebug_P(PSTR(" tx_delay=%s"), ems_getTxDelay() ? "on" : "off");
myDebug_P(PSTR(" tx_delay=%d"), ems_getTxDelay());
}
return ok;

View File

@@ -220,7 +220,7 @@ void ems_init() {
EMS_Sys_Status.emsTxDisabled = false;
EMS_Sys_Status.emsPollFrequency = 0;
EMS_Sys_Status.txRetryCount = 0;
EMS_Sys_Status.emsTxDelay = false;
EMS_Sys_Status.emsTxDelay = 0;
// thermostat
EMS_Thermostat.setpoint_roomTemp = EMS_VALUE_SHORT_NOTSET;
@@ -329,12 +329,12 @@ bool ems_getPoll() {
return EMS_Sys_Status.emsPollEnabled;
}
void ems_setTxDelay(bool b) {
EMS_Sys_Status.emsTxDelay = b;
myDebug_P(PSTR("EMS Tx delay is %s"), EMS_Sys_Status.emsTxDelay ? "enabled" : "disabled");
void ems_setTxDelay(uint8_t delay) {
EMS_Sys_Status.emsTxDelay = delay;
myDebug_P(PSTR("EMS Tx delay is %d"), EMS_Sys_Status.emsTxDelay);
}
bool ems_getTxDelay() {
uint8_t ems_getTxDelay() {
return EMS_Sys_Status.emsTxDelay;
}

View File

@@ -94,7 +94,7 @@ typedef struct {
bool emsTxCapable; // able to send via Tx
bool emsTxDisabled; // true to prevent all Tx
uint8_t txRetryCount; // # times the last Tx was re-sent
bool emsTxDelay; // if true, slows down the Tx transmit
uint8_t emsTxDelay; // handles Tx logic
} _EMS_Sys_Status;
// The Tx send package
@@ -301,7 +301,7 @@ void ems_setFlowTemp(uint8_t temperature);
void ems_setWarmWaterActivated(bool activated);
void ems_setWarmTapWaterActivated(bool activated);
void ems_setPoll(bool b);
void ems_setTxDelay(bool b);
void ems_setTxDelay(uint8_t delay);
void ems_setLogging(_EMS_SYS_LOGGING loglevel);
void ems_setEmsRefreshed(bool b);
void ems_setWarmWaterModeComfort(uint8_t comfort);
@@ -316,7 +316,7 @@ bool ems_getPoll();
bool ems_getTxEnabled();
bool ems_getThermostatEnabled();
bool ems_getBoilerEnabled();
bool ems_getTxDelay();
uint8_t ems_getTxDelay();
bool ems_getBusConnected();
_EMS_SYS_LOGGING ems_getLogging();
bool ems_getEmsRefreshed();