reworks because of 'tx_mode 2' and protocol issues

° added markers (GIO12, GPIO14) for logic analyzer debugging

° change UART initialisation
  - set RxFIFO full to 1 char, so we can detect active telegram on EMS-Bus
  - set RxTOT to 1 char for the same reason

° in ems_parseTelegram: ignore telegram if  emsRxStatus != EMS_RX_STATUS_IDLE
  because we missed to respond in a timely manner

° ems_tx_buffer is not void anymore, instead we return the Tx status
° extended the emsTxStatus
  - EMS_TX_WTD_TIMEOUT: timeout while waiting for echo of last Tx byte
    out telegram was ignored by the bus master, so the byte wasn't echoed
  - EMS_TX_BRK_DETECT:  BRK detected while sending the telegram
    bus master send us a break because of protocol violation

° add burnStarts, burnWorkMin and heatWorkMin to MQTT boiler message

TODO:
  + take care of ems_tx_buffer return code
  + accept direct telegram in ems_parse_telegram and do a proper acknowledge
  + split the heartbeat in static (version, IP-address) and dynamic (RSS etc)
  + change the hearbeat to a JSON structure so we can easier pick the uptime
This commit is contained in:
Susis Strolch
2019-07-19 13:16:23 +02:00
parent 7743ff5d56
commit 5587b9d267
5 changed files with 151 additions and 90 deletions

View File

@@ -17,7 +17,6 @@
* ° for Rx, we use GPIO14
* ° for Tx, we use GPIO12
*/
#define LOGICANALYZER
#ifdef LOGICANALYZER
#define RX_MARK_PIN 14
#define TX_MARK_PIN 12
@@ -47,10 +46,10 @@
GPIO_L(MARKERS_MASK); \
} while (0)
#else
#define RX_PULSE(pulse)
#define TX_PULSE(pulse)
#define LA_PULSE(pulse)
#define INIT_MARKERS(void)
#define RX_PULSE(pulse) {}
#define TX_PULSE(pulse) {}
#define LA_PULSE(pulse) {}
#define INIT_MARKERS(void) {}
#endif
#define EMS_ID_NONE 0x00 // used as a dest in broadcast messages and empty device IDs
@@ -104,6 +103,7 @@ typedef enum {
} _EMS_RX_STATUS;
typedef enum {
EMS_TX_STATUS_OK,
EMS_TX_STATUS_IDLE, // ready
EMS_TX_STATUS_WAIT, // waiting for response from last Tx
EMS_TX_WTD_TIMEOUT, // watchdog timeout during send