Processor now working as an mqtt broker
This commit is contained in:
@@ -58,6 +58,17 @@ static void event_handler_cb_vote_results_obj8(lv_event_t *e) {
|
||||
}
|
||||
}
|
||||
|
||||
static void event_handler_cb_ibvs_processor_obj10(lv_event_t *e) {
|
||||
lv_event_code_t event = lv_event_get_code(e);
|
||||
if (event == LV_EVENT_VALUE_CHANGED) {
|
||||
lv_obj_t *ta = lv_event_get_target(e);
|
||||
if (tick_value_change_obj != ta) {
|
||||
const char *value = lv_textarea_get_text(ta);
|
||||
set_var_ui_ip(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void create_screen_start() {
|
||||
lv_obj_t *obj = lv_obj_create(0);
|
||||
objects.start = obj;
|
||||
@@ -599,7 +610,7 @@ void create_screen_ibvs_processor() {
|
||||
lv_obj_t *parent_obj = obj;
|
||||
{
|
||||
lv_obj_t *obj = lv_spinner_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 120, 120);
|
||||
lv_obj_set_pos(obj, 211, 120);
|
||||
lv_obj_set_size(obj, 80, 80);
|
||||
lv_spinner_set_anim_params(obj, 1000, 60);
|
||||
}
|
||||
@@ -615,12 +626,46 @@ void create_screen_ibvs_processor() {
|
||||
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_30, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_textarea_create(parent_obj);
|
||||
objects.obj10 = obj;
|
||||
lv_obj_set_pos(obj, 10, 180);
|
||||
lv_obj_set_size(obj, 180, 50);
|
||||
lv_textarea_set_max_length(obj, 128);
|
||||
lv_textarea_set_one_line(obj, false);
|
||||
lv_textarea_set_password_mode(obj, false);
|
||||
lv_obj_add_event_cb(obj, event_handler_cb_ibvs_processor_obj10, LV_EVENT_ALL, 0);
|
||||
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_24, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
{
|
||||
lv_obj_t *obj = lv_textarea_create(parent_obj);
|
||||
lv_obj_set_pos(obj, 10, 136);
|
||||
lv_obj_set_size(obj, 150, 44);
|
||||
lv_textarea_set_max_length(obj, 128);
|
||||
lv_textarea_set_text(obj, "MQTT IP:");
|
||||
lv_textarea_set_one_line(obj, false);
|
||||
lv_textarea_set_password_mode(obj, false);
|
||||
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(obj, &lv_font_montserrat_22, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
tick_screen_ibvs_processor();
|
||||
}
|
||||
|
||||
void tick_screen_ibvs_processor() {
|
||||
{
|
||||
const char *new_val = get_var_ui_ip();
|
||||
const char *cur_val = lv_textarea_get_text(objects.obj10);
|
||||
uint32_t max_length = lv_textarea_get_max_length(objects.obj10);
|
||||
if (strncmp(new_val, cur_val, max_length) != 0) {
|
||||
tick_value_change_obj = objects.obj10;
|
||||
lv_textarea_set_text(objects.obj10, new_val);
|
||||
tick_value_change_obj = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ typedef struct _objects_t {
|
||||
lv_obj_t *obj7;
|
||||
lv_obj_t *obj8;
|
||||
lv_obj_t *obj9;
|
||||
lv_obj_t *obj10;
|
||||
} objects_t;
|
||||
|
||||
extern objects_t objects;
|
||||
|
||||
@@ -23,7 +23,8 @@ enum FlowGlobalVariables {
|
||||
FLOW_GLOBAL_VARIABLE_UI_ITEM3 = 5,
|
||||
FLOW_GLOBAL_VARIABLE_UI_ITEM4 = 6,
|
||||
FLOW_GLOBAL_VARIABLE_UI_ITEM5 = 7,
|
||||
FLOW_GLOBAL_VARIABLE_UI_WINNER = 8
|
||||
FLOW_GLOBAL_VARIABLE_UI_WINNER = 8,
|
||||
FLOW_GLOBAL_VARIABLE_UI_IP = 9
|
||||
};
|
||||
|
||||
// Native global variables
|
||||
@@ -46,6 +47,8 @@ extern const char *get_var_ui_item5();
|
||||
extern void set_var_ui_item5(const char *value);
|
||||
extern const char *get_var_ui_winner();
|
||||
extern void set_var_ui_winner(const char *value);
|
||||
extern const char *get_var_ui_ip();
|
||||
extern void set_var_ui_ip(const char *value);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user