diff --git a/lib/MyESP/MyESP.cpp b/lib/MyESP/MyESP.cpp index 9fd14b039..bd50785ab 100644 --- a/lib/MyESP/MyESP.cpp +++ b/lib/MyESP/MyESP.cpp @@ -2195,16 +2195,11 @@ void MyESP::begin(const char * app_hostname, const char * app_name, const char * } _eeprom_setup(); // set up EEPROM for storing crash data, if compiled with -DCRASH - _fs_setup(); // SPIFFS setup, do this first to get values _wifi_setup(); // WIFI setup _ota_setup(); // init OTA _webserver_setup(); // init web server - - // print a welcome message - myDebug_P(PSTR("\n* %s version %s"), _app_name, _app_version); SerialAndTelnet.flush(); - _setSystemCheck(false); // reset system check _heartbeatCheck(true); // force heartbeat } diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index b4c7da1f5..9e8593317 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -1799,6 +1799,10 @@ void showerCheck() { // SETUP // void setup() { + // LA trigger create a small puls to show setup is starting... + INIT_MARKERS(0); + LA_PULSE(50); + // init our own parameters initEMSESP(); diff --git a/src/ems.h b/src/ems.h index 34a0662ba..4c05d12fb 100644 --- a/src/ems.h +++ b/src/ems.h @@ -12,6 +12,47 @@ #include +/* debug helper for logic analyzer + * create marker puls on GPIOx + * ° for Rx, we use GPIO14 + * ° for Tx, we use GPIO12 + */ +#define LOGICANALYZER +#ifdef LOGICANALYZER + #define RX_MARK_PIN 14 + #define TX_MARK_PIN 12 + + #define RX_MARK_MASK (1<> USTXC) & 0xFF) != 0) ; + TX_PULSE(EMSUART_BIT_TIME/2); tmp = ((1 << UCRXRST) | (1 << UCTXRST)); // bit mask USC0(EMSUART_UART) |= (tmp); // set bits USC0(EMSUART_UART) &= ~(tmp); // clear bits @@ -199,17 +201,20 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) { if (EMS_Sys_Status.emsTxMode == 0) { // classic mode logic for (uint8_t i = 0; i < len; i++) { + TX_PULSE(EMSUART_BIT_TIME/4); USF(EMSUART_UART) = buf[i]; } emsuart_tx_brk(); // send } else if (EMS_Sys_Status.emsTxMode == 1) { // With extra tx delay for EMS+ for (uint8_t i = 0; i < len; i++) { + TX_PULSE(EMSUART_BIT_TIME/4); USF(EMSUART_UART) = buf[i]; delayMicroseconds(EMSUART_TX_BRK_WAIT); // https://github.com/proddy/EMS-ESP/issues/23# } emsuart_tx_brk(); // send } else if (EMS_Sys_Status.emsTxMode == 3) { // Junkers logic by @philrich for (uint8_t i = 0; i < len; i++) { + TX_PULSE(EMSUART_BIT_TIME/4); USF(EMSUART_UART) = buf[i]; // just to be safe wait for tx fifo empty (needed?) @@ -237,6 +242,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) { // throw out the telegram... for (uint8_t i = 0; i < len;) { + TX_PULSE(EMSUART_BIT_TIME/4); USF(EMSUART_UART) = buf[i++]; // send each Tx byte // wait for echo from busmaster while ((((USS(EMSUART_UART) >> USRXC) & 0xFF) < i || (USIS(EMSUART_UART) & (1 << UIBD)))) { @@ -249,6 +255,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) { // otherwise we send the final Tx-BRK in the loopback and re=enable Rx-INT. // worst case, we'll see an additional Rx-BRK... if (!(USIS(EMSUART_UART) & (1 << UIBD))) { + TX_PULSE(EMSUART_BIT_TIME/2); // no bus collision - send terminating BRK signal USC0(EMSUART_UART) |= (1 << UCLBE); // enable loopback USC0(EMSUART_UART) |= (1 << UCBRK); // set