|
|
|
@ -5,24 +5,28 @@
|
|
|
|
|
#include "ui.h" |
|
|
|
|
|
|
|
|
|
objects_t objects; |
|
|
|
|
lv_obj_t *tick_value_change_obj; |
|
|
|
|
|
|
|
|
|
static void event_handler_cb_main_button_1(lv_event_t *e) { |
|
|
|
|
static void event_handler_cb_main__obj_button_1(lv_event_t *e) { |
|
|
|
|
lv_event_code_t event = lv_event_get_code(e); |
|
|
|
|
void *flowState = e->user_data; |
|
|
|
|
if (event == LV_EVENT_PRESSED) { |
|
|
|
|
flowPropagateValue(0, 3, 1); |
|
|
|
|
flowPropagateValue(flowState, 3, 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void event_handler_cb_main_button_2(lv_event_t *e) { |
|
|
|
|
static void event_handler_cb_main__obj_button_2(lv_event_t *e) { |
|
|
|
|
lv_event_code_t event = lv_event_get_code(e); |
|
|
|
|
void *flowState = e->user_data; |
|
|
|
|
if (event == LV_EVENT_PRESSED) { |
|
|
|
|
flowPropagateValue(0, 5, 1); |
|
|
|
|
flowPropagateValue(flowState, 5, 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void create_screen_main() { |
|
|
|
|
void *flowState = getFlowState(0, 0); |
|
|
|
|
lv_obj_t *obj = lv_obj_create(0); |
|
|
|
|
objects.main = obj; |
|
|
|
|
objects.Main = obj; |
|
|
|
|
lv_obj_set_pos(obj, 0, 0); |
|
|
|
|
lv_obj_set_size(obj, 800, 480); |
|
|
|
|
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); |
|
|
|
@ -46,17 +50,19 @@ void create_screen_main() {
|
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
lv_obj_t *obj = lv_label_create(parent_obj); |
|
|
|
|
objects.label_1 = obj; |
|
|
|
|
objects._obj_label_0 = obj; |
|
|
|
|
lv_obj_set_pos(obj, 0, 0); |
|
|
|
|
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT); |
|
|
|
|
lv_label_set_text(obj, ""); |
|
|
|
|
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT); |
|
|
|
|
lv_obj_set_style_text_font(obj, &lv_font_montserrat_32, LV_PART_MAIN | LV_STATE_DEFAULT); |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
lv_obj_t *obj = lv_btn_create(parent_obj); |
|
|
|
|
objects._obj_button_1 = obj; |
|
|
|
|
lv_obj_set_pos(obj, 268, 348); |
|
|
|
|
lv_obj_set_size(obj, 100, 40); |
|
|
|
|
lv_obj_add_event_cb(obj, event_handler_cb_main_button_1, LV_EVENT_ALL, 0); |
|
|
|
|
lv_obj_add_event_cb(obj, event_handler_cb_main__obj_button_1, LV_EVENT_ALL, flowState); |
|
|
|
|
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); |
|
|
|
|
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); |
|
|
|
|
{ |
|
|
|
@ -73,9 +79,10 @@ void create_screen_main() {
|
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
lv_obj_t *obj = lv_btn_create(parent_obj); |
|
|
|
|
objects._obj_button_2 = obj; |
|
|
|
|
lv_obj_set_pos(obj, 408, 348); |
|
|
|
|
lv_obj_set_size(obj, 100, 40); |
|
|
|
|
lv_obj_add_event_cb(obj, event_handler_cb_main_button_2, LV_EVENT_ALL, 0); |
|
|
|
|
lv_obj_add_event_cb(obj, event_handler_cb_main__obj_button_2, LV_EVENT_ALL, flowState); |
|
|
|
|
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); |
|
|
|
|
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); |
|
|
|
|
{ |
|
|
|
@ -94,10 +101,15 @@ void create_screen_main() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void tick_screen_main() { |
|
|
|
|
void *flowState = getFlowState(0, 0); |
|
|
|
|
{ |
|
|
|
|
const char *new_val = evalTextProperty(0, 2, 2, "Failed to evaluate Text in Label widget"); |
|
|
|
|
const char *cur_val = lv_label_get_text(objects.label_1); |
|
|
|
|
if (strcmp(new_val, cur_val) != 0) lv_label_set_text(objects.label_1, new_val); |
|
|
|
|
const char *new_val = evalTextProperty(flowState, 2, 2, "Failed to evaluate Text in Label widget"); |
|
|
|
|
const char *cur_val = lv_label_get_text(objects._obj_label_0); |
|
|
|
|
if (strcmp(new_val, cur_val) != 0) { |
|
|
|
|
tick_value_change_obj = objects._obj_label_0; |
|
|
|
|
lv_label_set_text(objects._obj_label_0, new_val); |
|
|
|
|
tick_value_change_obj = NULL; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|