From 052ee91be57ef812a6cfe98b36189d313bef8a82 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 16 Nov 2020 14:13:35 +0100 Subject: [PATCH] Extending the test framework #611 --- src/console.cpp | 4 ++-- src/test/test.cpp | 34 +++++++++++++++++++++------------- src/test/test.h | 2 +- src/version.h | 2 +- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/console.cpp b/src/console.cpp index ef81ffc88..6de5e153c 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -476,9 +476,9 @@ void Console::load_standard_commands(unsigned int context) { flash_string_vector{F_(name_optional)}, [](Shell & shell, const std::vector & arguments) { if (arguments.size() == 0) { - Test::run_test_shell(shell, "default"); + Test::run_test(shell, "default"); } else { - Test::run_test_shell(shell, arguments.front()); + Test::run_test(shell, arguments.front()); } }); #endif diff --git a/src/test/test.cpp b/src/test/test.cpp index 350f33517..16c4f5abc 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -99,6 +99,25 @@ bool Test::run_test(const char * command, int8_t id) { return true; } + if (strcmp(command, "mixer") == 0) { + EMSESP::logger().info(F("Testing mixer...")); + + // add controller + add_device(0x09, 114); + + add_device(0x28, 160); // MM100, WWC + add_device(0x29, 161); // MM200, WWC + add_device(0x20, 160); // MM100 + + // WWC1 on 0x29 + uart_telegram({0xA9, 0x00, 0xFF, 0x00, 0x02, 0x32, 0x02, 0x6C, 0x00, 0x3C, 0x00, 0x3C, 0x3C, 0x46, 0x02, 0x03, 0x03, 0x00, 0x3C}); + + // WWC2 on 0x28 + uart_telegram({0xA8, 0x00, 0xFF, 0x00, 0x02, 0x31, 0x02, 0x35, 0x00, 0x3C, 0x00, 0x3C, 0x3C, 0x46, 0x02, 0x03, 0x03, 0x00, 0x3C}); + + return true; + } + if (strcmp(command, "boiler") == 0) { EMSESP::logger().info(F("Testing boiler...")); add_device(0x08, 123); // Nefit Trendline @@ -166,7 +185,7 @@ bool Test::run_test(const char * command, int8_t id) { } // used with the 'test' command, under su/admin -void Test::run_test_shell(uuid::console::Shell & shell, const std::string & command) { +void Test::run_test(uuid::console::Shell & shell, const std::string & command) { // switch to su shell.add_flags(CommandFlags::ADMIN); @@ -831,18 +850,7 @@ void Test::run_test_shell(uuid::console::Shell & shell, const std::string & comm EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS); - // add controller - add_device(0x09, 114); - - add_device(0x28, 160); // MM100, WWC - add_device(0x29, 161); // MM200, WWC - add_device(0x20, 160); // MM100 - - // WWC1 on 0x29 - uart_telegram({0xA9, 0x00, 0xFF, 0x00, 0x02, 0x32, 0x02, 0x6C, 0x00, 0x3C, 0x00, 0x3C, 0x3C, 0x46, 0x02, 0x03, 0x03, 0x00, 0x3C}); - - // WWC2 on 0x28 - uart_telegram({0xA8, 0x00, 0xFF, 0x00, 0x02, 0x31, 0x02, 0x35, 0x00, 0x3C, 0x00, 0x3C, 0x3C, 0x46, 0x02, 0x03, 0x03, 0x00, 0x3C}); + run_test("mixer"); // check for error "No telegram type handler found for ID 0x255 (src 0x20)" uart_telegram({0xA0, 0x00, 0xFF, 0x00, 0x01, 0x55, 0x00, 0x1A}); diff --git a/src/test/test.h b/src/test/test.h index 80a10f2c9..be85cf259 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -40,7 +40,7 @@ namespace emsesp { class Test { public: - static void run_test_shell(uuid::console::Shell & shell, const std::string & command); + static void run_test(uuid::console::Shell & shell, const std::string & command); static bool run_test(const char * command, int8_t id = 0); static void dummy_mqtt_commands(const char * message); static void rx_telegram(const std::vector & data); diff --git a/src/version.h b/src/version.h index 94e8574ec..fff06e3dd 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "2.1.1b2" +#define EMSESP_APP_VERSION "2.1.1b3"