mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
add rounding test
This commit is contained in:
@@ -270,6 +270,17 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) {
|
|||||||
char result[100];
|
char result[100];
|
||||||
Helpers::render_value(result, test_float, 2);
|
Helpers::render_value(result, test_float, 2);
|
||||||
shell.printfln("Float test from %f to %s", test_float, result);
|
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") {
|
if (command == "devices") {
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ namespace emsesp {
|
|||||||
// #define EMSESP_DEBUG_DEFAULT "board_profile"
|
// #define EMSESP_DEBUG_DEFAULT "board_profile"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "shower_alert"
|
// #define EMSESP_DEBUG_DEFAULT "shower_alert"
|
||||||
// #define EMSESP_DEBUG_DEFAULT "310"
|
// #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"
|
// #define EMSESP_DEBUG_DEFAULT "crash"
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
|
|||||||
Reference in New Issue
Block a user