From a2952d781f03a3d90109642418690780a520f0fe Mon Sep 17 00:00:00 2001 From: proddy Date: Fri, 4 Sep 2020 13:49:03 +0200 Subject: [PATCH] fix tests for mqtt --- src/test/test.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/test.cpp b/src/test/test.cpp index 069efc6d4..2b7452c12 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -28,7 +28,7 @@ namespace emsesp { // used with the 'test' command, under su/admin void Test::run_test(uuid::console::Shell & shell, const std::string & command) { if (command == "default") { - run_test(shell, "thermostat"); // add the default test case here + run_test(shell, "mqtt"); // add the default test case here } if (command.empty()) { @@ -587,7 +587,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) { // add a thermostat EMSESP::add_device(0x18, 157, version, EMSdevice::Brand::BOSCH); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355 - // RCPLUSStatusMessage_HC1(0x01A5) + // RCPLUSStatusMessage_HC1(0x01A5) - HC1 uart_telegram({0x98, 0x00, 0xFF, 0x00, 0x01, 0xA5, 0x00, 0xCF, 0x21, 0x2E, 0x00, 0x00, 0x2E, 0x24, 0x03, 0x25, 0x03, 0x03, 0x01, 0x03, 0x25, 0x00, 0xC8, 0x00, 0x00, 0x11, 0x01, 0x03}); uart_telegram("98 00 FF 00 01 A5 00 CF 21 2E 00 00 2E 24 03 25 03 03 01 03 25 00 C8 00 00 11 01 03"); // without CRC @@ -702,7 +702,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) { } // finally dump to console - shell.loop_all(); + EMSESP::loop(); } // simulates a telegram in the Rx queue, but without the CRC which is added automatically @@ -729,6 +729,7 @@ void Test::uart_telegram(const std::vector & rx_data) { } data[i] = EMSESP::rxservice_.calculate_crc(data, i); EMSESP::incoming_telegram(data, i + 1); + EMSESP::rxservice_.loop(); } // takes raw string, assuming it contains the CRC. This is what is output from 'watch raw' @@ -766,6 +767,7 @@ void Test::uart_telegram_withCRC(const char * rx_data) { } EMSESP::incoming_telegram(data, count + 1); + EMSESP::rxservice_.loop(); } // takes raw string, adds CRC to end @@ -805,6 +807,7 @@ void Test::uart_telegram(const char * rx_data) { data[count + 1] = EMSESP::rxservice_.calculate_crc(data, count + 1); // add CRC EMSESP::incoming_telegram(data, count + 2); + EMSESP::rxservice_.loop(); } #pragma GCC diagnostic push