diff --git a/src/dev/esp32/esp32.cpp b/src/dev/esp32/esp32.cpp
index 2dce3065..1fedba6b 100644
--- a/src/dev/esp32/esp32.cpp
+++ b/src/dev/esp32/esp32.cpp
@@ -16,7 +16,7 @@
#include "esp_adc_cal.h"
#include "hasp_debug.h"
-#include "hasp/hasp_utilities.h"
+// #include "hasp/hasp_utilities.h"
#define BACKLIGHT_CHANNEL 0
diff --git a/src/dev/esp8266/esp8266.cpp b/src/dev/esp8266/esp8266.cpp
index 172a17a1..a428645b 100644
--- a/src/dev/esp8266/esp8266.cpp
+++ b/src/dev/esp8266/esp8266.cpp
@@ -10,7 +10,7 @@
#include "hasp_conf.h"
#include "hasp_debug.h"
-#include "hasp/hasp_utilities.h"
+// #include "hasp/hasp_utilities.h"
#define BACKLIGHT_CHANNEL 0
diff --git a/src/dev/posix/hasp_posix.cpp b/src/dev/posix/hasp_posix.cpp
index 18e84404..41f7bc42 100644
--- a/src/dev/posix/hasp_posix.cpp
+++ b/src/dev/posix/hasp_posix.cpp
@@ -6,7 +6,7 @@
#include "hasp_posix.h"
#include "hasp_conf.h"
-#include "hasp/hasp_utilities.h"
+// #include "hasp/hasp_utilities.h"
#include "hasp_debug.h"
#include "display/monitor.h"
diff --git a/src/dev/stm32f4/stm32f4.cpp b/src/dev/stm32f4/stm32f4.cpp
index f9bb220e..70df3c16 100644
--- a/src/dev/stm32f4/stm32f4.cpp
+++ b/src/dev/stm32f4/stm32f4.cpp
@@ -9,7 +9,7 @@
#include "hasp_conf.h"
#include "hasp_debug.h"
-#include "hasp/hasp_utilities.h"
+// #include "hasp/hasp_utilities.h"
#define BACKLIGHT_CHANNEL 0
diff --git a/src/dev/win32/hasp_win32.cpp b/src/dev/win32/hasp_win32.cpp
index b6389d52..627b454a 100644
--- a/src/dev/win32/hasp_win32.cpp
+++ b/src/dev/win32/hasp_win32.cpp
@@ -9,7 +9,7 @@
#include "hasp_win32.h"
#include "hasp_conf.h"
-#include "hasp/hasp_utilities.h"
+// #include "hasp/hasp_utilities.h"
#include "hasp_debug.h"
#include "display/monitor.h"
diff --git a/src/hasp/hasp_attribute.cpp b/src/hasp/hasp_attribute.cpp
index 7838bccd..e4de0ae7 100644
--- a/src/hasp/hasp_attribute.cpp
+++ b/src/hasp/hasp_attribute.cpp
@@ -735,7 +735,7 @@ static void hasp_local_style_attr(lv_obj_t* obj, const char* attr_p, uint16_t at
// test_prop(attr_hash);
hasp_attribute_get_part_state(obj, attr_p, attr, part, state);
- attr_hash = Utilities::get_sdbm(attr); // attribute name without the index number
+ attr_hash = Parser::get_sdbm(attr); // attribute name without the index number
/* ***** WARNING ****************************************************
* when using hasp_out use attr_p for the original attribute name
@@ -920,7 +920,7 @@ static void hasp_local_style_attr(lv_obj_t* obj, const char* attr_p, uint16_t at
case ATTR_BORDER_SIDE:
return attribute_border_side(obj, part, state, update, attr_p, (lv_border_side_t)var);
case ATTR_BORDER_POST:
- return attribute_border_post(obj, part, state, update, attr_p, Utilities::is_true(payload));
+ return attribute_border_post(obj, part, state, update, attr_p, Parser::is_true(payload));
case ATTR_BORDER_OPA:
return attribute_border_opa(obj, part, state, update, attr_p, (lv_opa_t)var);
case ATTR_BORDER_COLOR: {
@@ -987,7 +987,7 @@ static void hasp_local_style_attr(lv_obj_t* obj, const char* attr_p, uint16_t at
case ATTR_LINE_DASH_GAP:
return attribute_line_dash_gap(obj, part, state, update, attr_p, (lv_style_int_t)var);
case ATTR_LINE_ROUNDED:
- return attribute_line_rounded(obj, part, state, update, attr_p, Utilities::is_true(payload));
+ return attribute_line_rounded(obj, part, state, update, attr_p, Parser::is_true(payload));
case ATTR_LINE_OPA:
return attribute_line_opa(obj, part, state, update, attr_p, (lv_opa_t)var);
case ATTR_LINE_COLOR: {
@@ -1045,7 +1045,7 @@ static void hasp_local_style_attr(lv_obj_t* obj, const char* attr_p, uint16_t at
/* Pattern attributes */
case ATTR_PATTERN_REPEAT:
- return attribute_pattern_repeat(obj, part, state, update, attr_p, Utilities::is_true(payload));
+ return attribute_pattern_repeat(obj, part, state, update, attr_p, Parser::is_true(payload));
case ATTR_PATTERN_OPA:
return attribute_pattern_opa(obj, part, state, update, attr_p, (lv_opa_t)var);
case ATTR_PATTERN_RECOLOR_OPA:
@@ -1093,7 +1093,7 @@ static void hasp_process_arc_attribute(lv_obj_t* obj, const char* attr_p, uint16
case ATTR_ADJUSTABLE:
if(update) {
- bool toggle = Utilities::is_true(payload);
+ bool toggle = Parser::is_true(payload);
lv_arc_set_adjustable(obj, toggle);
lv_obj_set_event_cb(obj, toggle ? slider_event_handler : generic_event_handler);
} else {
@@ -1418,7 +1418,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
char* attr = (char*)attr_p;
if(*attr == '.') attr++; // strip leading '.'
- uint16_t attr_hash = Utilities::get_sdbm(attr);
+ uint16_t attr_hash = Parser::get_sdbm(attr);
// LOG_VERBOSE(TAG_ATTR,"%s => %d", attr, attr_hash);
/* 16-bit Hash Lookup Table */
@@ -1487,13 +1487,12 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
break; // attribute_found
case ATTR_VIS:
- update ? lv_obj_set_hidden(obj, !Utilities::is_true(payload))
+ update ? lv_obj_set_hidden(obj, !Parser::is_true(payload))
: attr_out_int(obj, attr, !lv_obj_get_hidden(obj));
break; // attribute_found
case ATTR_HIDDEN:
- update ? lv_obj_set_hidden(obj, Utilities::is_true(payload))
- : attr_out_int(obj, attr, lv_obj_get_hidden(obj));
+ update ? lv_obj_set_hidden(obj, Parser::is_true(payload)) : attr_out_int(obj, attr, lv_obj_get_hidden(obj));
break; // attribute_found
case ATTR_TXT: // TODO: remove
@@ -1517,7 +1516,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
break; // attribute_found
case ATTR_VAL:
- if(!hasp_process_obj_attribute_val(obj, attr, atoi(payload), Utilities::is_true(payload), update))
+ if(!hasp_process_obj_attribute_val(obj, attr, atoi(payload), Parser::is_true(payload), update))
goto attribute_not_found;
break; // attribute_found
@@ -1535,8 +1534,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
break; // attribute_found
case ATTR_ENABLED:
- update ? lv_obj_set_click(obj, Utilities::is_true(payload))
- : attr_out_int(obj, attr, lv_obj_get_click(obj));
+ update ? lv_obj_set_click(obj, Parser::is_true(payload)) : attr_out_int(obj, attr, lv_obj_get_click(obj));
break; // attribute_found
case ATTR_SRC:
@@ -1624,7 +1622,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
case ATTR_TOGGLE:
if(check_obj_type(obj, LV_HASP_BUTTON)) {
if(update) {
- bool toggle = Utilities::is_true(payload);
+ bool toggle = Parser::is_true(payload);
lv_btn_set_checkable(obj, toggle);
lv_obj_set_event_cb(obj, toggle ? toggle_event_handler : generic_event_handler);
} else {
@@ -1704,13 +1702,15 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p
}
break;
- case ATTR_MAP: // TODO: remove temp MAP, use options instead
+ case ATTR_ONE_CHECK:
if(check_obj_type(obj, LV_HASP_BTNMATRIX)) {
- my_btnmatrix_map_create(obj, payload);
- } else {
- goto attribute_not_found;
+ if(update) {
+ lv_btnmatrix_set_one_check(obj, Parser::is_true(payload));
+ } else {
+ attr_out_int(obj, attr_p, lv_btnmatrix_get_one_check(obj));
+ }
}
- break; // attribute_found
+ break;
case ATTR_DELETE:
if(!lv_obj_get_parent(obj)) {
diff --git a/src/hasp/hasp_attribute.h b/src/hasp/hasp_attribute.h
index c5b093de..5f2effba 100644
--- a/src/hasp/hasp_attribute.h
+++ b/src/hasp/hasp_attribute.h
@@ -316,7 +316,7 @@ _HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t)
#define ATTR_SHOW_SELECTED 56029
// Buttonmatrix
-#define ATTR_MAP 45628
+#define ATTR_ONE_CHECK 45935
/* hasp user data */
#define ATTR_ACTION 42102
diff --git a/src/hasp/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp
index 442152c7..f26e7b72 100644
--- a/src/hasp/hasp_dispatch.cpp
+++ b/src/hasp/hasp_dispatch.cpp
@@ -216,9 +216,9 @@ static void dispatch_gpio(const char* topic, const char* payload)
// val = gpio_get_relay_value(pin);
} else {
topic += 5;
- if(Utilities::is_only_digits(topic)) {
+ if(Parser::is_only_digits(topic)) {
pin = atoi(topic);
- val = Utilities::is_true(payload);
+ val = Parser::is_true(payload);
// gpio_set_relay_value(pin, val);
return;
}
@@ -229,9 +229,9 @@ static void dispatch_gpio(const char* topic, const char* payload)
if(strlen(payload) == 0) {
} else {
topic += 3;
- if(Utilities::is_only_digits(topic)) {
+ if(Parser::is_only_digits(topic)) {
pin = atoi(topic);
- val = Utilities::is_true(payload);
+ val = Parser::is_true(payload);
// gpio_set_led_value(pin, val);
return;
}
@@ -243,9 +243,9 @@ static void dispatch_gpio(const char* topic, const char* payload)
} else {
topic += 3;
- if(Utilities::is_only_digits(topic)) {
+ if(Parser::is_only_digits(topic)) {
pin = atoi(topic);
- val = Utilities::is_true(payload);
+ val = Parser::is_true(payload);
// gpio_set_pwm_value(pin, val);
return;
}
@@ -740,7 +740,7 @@ void dispatch_page(const char*, const char* page)
}
lv_scr_load_anim_t animation = LV_SCR_LOAD_ANIM_NONE;
- if(Utilities::is_only_digits(page)) {
+ if(Parser::is_only_digits(page)) {
uint8_t pageid = atoi(page);
dispatch_set_page(pageid, animation);
} else if(!strcasecmp_P(page, PSTR("prev"))) {
@@ -801,7 +801,7 @@ void dispatch_moodlight(const char* topic, const char* payload)
} else {
if(!json[F("state")].isNull())
- moodlight.power = Utilities::is_true(json[F("state")].as
Free Memory: ");
- Utilities::format_bytes(haspDevice.get_free_heap(), size_buf, sizeof(size_buf));
+ Parser::format_bytes(haspDevice.get_free_heap(), size_buf, sizeof(size_buf));
httpMessage += size_buf;
httpMessage += F("
Memory Fragmentation: ");
httpMessage += String(haspDevice.get_heap_fragmentation());
@@ -575,10 +575,10 @@ void webHandleInfo()
#if ARDUINO_ARCH_ESP32
if(psramFound()) {
httpMessage += F("
Free PSRam: ");
- Utilities::format_bytes(ESP.getFreePsram(), size_buf, sizeof(size_buf));
+ Parser::format_bytes(ESP.getFreePsram(), size_buf, sizeof(size_buf));
httpMessage += size_buf;
httpMessage += F("
PSRam Size: ");
- Utilities::format_bytes(ESP.getPsramSize(), size_buf, sizeof(size_buf));
+ Parser::format_bytes(ESP.getPsramSize(), size_buf, sizeof(size_buf));
httpMessage += size_buf;
}
#endif
@@ -587,10 +587,10 @@ void webHandleInfo()
lv_mem_monitor_t mem_mon;
lv_mem_monitor(&mem_mon);
httpMessage += F("
LVGL Memory: ");
- Utilities::format_bytes(mem_mon.total_size, size_buf, sizeof(size_buf));
+ Parser::format_bytes(mem_mon.total_size, size_buf, sizeof(size_buf));
httpMessage += size_buf;
httpMessage += F("
LVGL Free: ");
- Utilities::format_bytes(mem_mon.free_size, size_buf, sizeof(size_buf));
+ Parser::format_bytes(mem_mon.free_size, size_buf, sizeof(size_buf));
httpMessage += size_buf;
httpMessage += F("
LVGL Fragmentation: ");
httpMessage += mem_mon.frag_pct;
@@ -693,15 +693,15 @@ void webHandleInfo()
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
httpMessage += F("
Flash Chip Size: ");
- Utilities::format_bytes(ESP.getFlashChipSize(), size_buf, sizeof(size_buf));
+ Parser::format_bytes(ESP.getFlashChipSize(), size_buf, sizeof(size_buf));
httpMessage += size_buf;
httpMessage += F("Program Size: ");
- Utilities::format_bytes(ESP.getSketchSize(), size_buf, sizeof(size_buf));
+ Parser::format_bytes(ESP.getSketchSize(), size_buf, sizeof(size_buf));
httpMessage += size_buf;
httpMessage += F("
Free Program Space: ");
- Utilities::format_bytes(ESP.getFreeSketchSpace(), size_buf, sizeof(size_buf));
+ Parser::format_bytes(ESP.getFreeSketchSpace(), size_buf, sizeof(size_buf));
httpMessage += size_buf;
#endif