Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Extending the test framework #611
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Nov 16, 2020
1 parent 1307a2e commit 052ee91
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ void Console::load_standard_commands(unsigned int context) {
flash_string_vector{F_(name_optional)},
[](Shell & shell, const std::vector<std::string> & 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
Expand Down
34 changes: 21 additions & 13 deletions src/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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});
Expand Down
2 changes: 1 addition & 1 deletion src/test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t> & data);
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define EMSESP_APP_VERSION "2.1.1b2"
#define EMSESP_APP_VERSION "2.1.1b3"

0 comments on commit 052ee91

Please sign in to comment.