added ems_getTxDisabled()

This commit is contained in:
Paul
2019-07-26 12:46:11 +02:00
parent 93c51ad270
commit eb3cd7da01
4 changed files with 52 additions and 38 deletions

View File

@@ -106,7 +106,7 @@ static const command_t project_cmds[] PROGMEM = {
{true, "shower_alert <on | off>", "stop hot water to send 3 cold burst warnings after max shower time is exceeded"}, {true, "shower_alert <on | off>", "stop hot water to send 3 cold burst warnings after max shower time is exceeded"},
{true, "publish_time <seconds>", "set frequency for publishing data to MQTT (0=off)"}, {true, "publish_time <seconds>", "set frequency for publishing data to MQTT (0=off)"},
{true, "heating_circuit <1 | 2>", "set the main thermostat HC to work with (if using multiple heating circuits)"}, {true, "heating_circuit <1 | 2>", "set the main thermostat HC to work with (if using multiple heating circuits)"},
{true, "tx_mode <n>", "0=classic ems logic, 1=@kwertie01 ems+ logic, 2=@susisstrolch logic, 3=@philrich logic for Junkers"}, {true, "tx_mode <n>", "changes Tx logic. 0=ems 1.0, 1=ems+, 2=generic (experimental!), 3=HT3"},
{false, "info", "show current captured on the devices"}, {false, "info", "show current captured on the devices"},
{false, "log <n | b | t | r | v>", "set logging mode to none, basic, thermostat only, raw or verbose"}, {false, "log <n | b | t | r | v>", "set logging mode to none, basic, thermostat only, raw or verbose"},
@@ -141,7 +141,7 @@ _EMSESP_Shower EMSESP_Shower;
// logging messages with fixed strings // logging messages with fixed strings
void myDebugLog(const char * s) { void myDebugLog(const char * s) {
if (ems_getLogging() >= EMS_SYS_LOGGING_BASIC) { if (ems_getLogging() != EMS_SYS_LOGGING_NONE) {
myDebug(s); myDebug(s);
} }
} }
@@ -1038,11 +1038,13 @@ void do_systemCheck() {
// force calls to get data from EMS for the types that aren't sent as broadcasts // force calls to get data from EMS for the types that aren't sent as broadcasts
// only if we have a EMS connection // only if we have a EMS connection
void do_regularUpdates() { void do_regularUpdates() {
if (ems_getBusConnected()) { if (ems_getBusConnected() & !ems_getTxDisabled()) {
myDebugLog("Requesting scheduled EMS device data"); myDebugLog("Requesting scheduled EMS device data");
ems_getThermostatValues(); ems_getThermostatValues();
ems_getBoilerValues(); ems_getBoilerValues();
ems_getSolarModuleValues(); ems_getSolarModuleValues();
} else {
myDebugLog("System is either not connect to the EMS bus or listen_mode is enabled");
} }
} }
@@ -1398,7 +1400,6 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) {
} }
if (strcmp(first_cmd, "refresh") == 0) { if (strcmp(first_cmd, "refresh") == 0) {
myDebug_P(PSTR("Fetching data from EMS devices..."));
do_regularUpdates(); do_regularUpdates();
ok = true; ok = true;
} }

View File

@@ -18,42 +18,54 @@
* ° for Tx, we use GPIO12 * ° for Tx, we use GPIO12
*/ */
#ifdef LOGICANALYZER #ifdef LOGICANALYZER
#define RX_MARK_PIN 14 #define RX_MARK_PIN 14
#define TX_MARK_PIN 12 #define TX_MARK_PIN 12
#define RX_MARK_MASK (1<<RX_MARK_PIN) #define RX_MARK_MASK (1 << RX_MARK_PIN)
#define TX_MARK_MASK (1<<TX_MARK_PIN) #define TX_MARK_MASK (1 << TX_MARK_PIN)
#define MARKERS_MASK (RX_MARK_PIN|TX_MARK_PIN) #define MARKERS_MASK (RX_MARK_PIN | TX_MARK_PIN)
#define GPIO_H(mask) (GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, (mask))) #define GPIO_H(mask) (GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, (mask)))
#define GPIO_L(mask) (GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, (mask))) #define GPIO_L(mask) (GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, (mask)))
#define RX_PULSE(pulse) do { GPIO_H(RX_MARK_MASK); \ #define RX_PULSE(pulse) \
delayMicroseconds(pulse); \ do { \
GPIO_L(RX_MARK_MASK); \ GPIO_H(RX_MARK_MASK); \
} while (0) delayMicroseconds(pulse); \
#define TX_PULSE(pulse) do { GPIO_H(TX_MARK_MASK); \ GPIO_L(RX_MARK_MASK); \
delayMicroseconds(pulse); \ } while (0)
GPIO_L(TX_MARK_MASK); \ #define TX_PULSE(pulse) \
} while (0) do { \
#define LA_PULSE(pulse) do { GPIO_H(MARKERS_MASK); \ GPIO_H(TX_MARK_MASK); \
delayMicroseconds(pulse); \ delayMicroseconds(pulse); \
GPIO_L(MARKERS_MASK); \ GPIO_L(TX_MARK_MASK); \
} while (0) } while (0)
#define LA_PULSE(pulse) \
do { \
GPIO_H(MARKERS_MASK); \
delayMicroseconds(pulse); \
GPIO_L(MARKERS_MASK); \
} while (0)
#define INIT_MARKERS(void) do { pinMode(RX_MARK_PIN, OUTPUT);\ #define INIT_MARKERS(void) \
pinMode(TX_MARK_PIN, OUTPUT);\ do { \
GPIO_L(MARKERS_MASK); \ pinMode(RX_MARK_PIN, OUTPUT); \
} while (0) pinMode(TX_MARK_PIN, OUTPUT); \
GPIO_L(MARKERS_MASK); \
} while (0)
#else #else
#define RX_PULSE(pulse) {} #define RX_PULSE(pulse) \
#define TX_PULSE(pulse) {} {}
#define LA_PULSE(pulse) {} #define TX_PULSE(pulse) \
#define INIT_MARKERS(void) {} {}
#define RX_MARK_MASK #define LA_PULSE(pulse) \
#define TX_MARK_MASK {}
#define GPIO_H(mask) #define INIT_MARKERS(void) \
#define GPIO_L(mask) {}
#define RX_MARK_MASK
#define TX_MARK_MASK
#define GPIO_H(mask)
#define GPIO_L(mask)
#endif #endif
#define EMS_ID_NONE 0x00 // used as a dest in broadcast messages and empty device IDs #define EMS_ID_NONE 0x00 // used as a dest in broadcast messages and empty device IDs
@@ -405,6 +417,7 @@ void ems_setEmsRefreshed(bool b);
void ems_setWarmWaterModeComfort(uint8_t comfort); void ems_setWarmWaterModeComfort(uint8_t comfort);
void ems_setModels(); void ems_setModels();
void ems_setTxDisabled(bool b); void ems_setTxDisabled(bool b);
bool ems_getTxDisabled();
uint8_t ems_getTxMode(); uint8_t ems_getTxMode();
char * ems_getThermostatDescription(char * buffer); char * ems_getThermostatDescription(char * buffer);

View File

@@ -66,7 +66,7 @@
#define EMS_TYPE_RC10Set 0xB0 // for setting values like temp and mode #define EMS_TYPE_RC10Set 0xB0 // for setting values like temp and mode
#define EMS_OFFSET_RC10Set_temp 4 // position of thermostat setpoint temperature #define EMS_OFFSET_RC10Set_temp 4 // position of thermostat setpoint temperature
#define EMS_OFFSET_RC10StatusMessage_setpoint 1 // setpoint temp #define EMS_OFFSET_RC10StatusMessage_setpoint 1 // setpoint temp
#define EMS_OFFSET_RC10StatusMessage_curr 3 // current temp #define EMS_OFFSET_RC10StatusMessage_curr 2 // current temp
// RC20 specific // RC20 specific
#define EMS_TYPE_RC20StatusMessage 0x91 // is an automatic thermostat broadcast giving us temps #define EMS_TYPE_RC20StatusMessage 0x91 // is an automatic thermostat broadcast giving us temps

View File

@@ -15,7 +15,7 @@
#define EMSUART_BAUD 9600 // uart baud rate for the EMS circuit #define EMSUART_BAUD 9600 // uart baud rate for the EMS circuit
#define EMS_MAXBUFFERS 5 // buffers for circular filling to avoid collisions #define EMS_MAXBUFFERS 5 // buffers for circular filling to avoid collisions
#define EMS_MAXBUFFERSIZE 32 // max size of the buffer. packets are max 32 bytes to support EMS 1.0 #define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus 1 for BRK
#define EMSUART_BIT_TIME 104 // bit time @9600 baud #define EMSUART_BIT_TIME 104 // bit time @9600 baud