add rounding test

This commit is contained in:
proddy
2021-09-19 11:20:54 +02:00
parent 11590061a3
commit 78b2efd148
2 changed files with 13 additions and 1 deletions

View File

@@ -270,6 +270,17 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) {
char result[100];
Helpers::render_value(result, test_float, 2);
shell.printfln("Float test from %f to %s", test_float, result);
uint16_t temp;
double doub;
temp = 0x0201; // decimal 513
doub = Helpers::round2(temp, 10); // divide by 10
shell.printfln("Round test from x%02X to %d to %f", temp, temp, doub);
doub = Helpers::round2(temp, 10); // divide by 10
shell.printfln("Round test div10 from x%02X to %d to %f", temp, temp, doub);
temp = 0x63;
doub = Helpers::round2(temp, 2); // divide by 2
shell.printfln("Round test div2 from x%02X to %d to %f", temp, temp, doub);
}
if (command == "devices") {

View File

@@ -38,7 +38,8 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "board_profile"
// #define EMSESP_DEBUG_DEFAULT "shower_alert"
// #define EMSESP_DEBUG_DEFAULT "310"
#define EMSESP_DEBUG_DEFAULT "api"
#define EMSESP_DEBUG_DEFAULT "render"
// #define EMSESP_DEBUG_DEFAULT "api"
// #define EMSESP_DEBUG_DEFAULT "crash"
class Test {