Allow dismissing m117 messages, allow disabling m117 messages

This commit is contained in:
suchmememanyskill
2024-04-05 23:03:48 +02:00
parent 2e5a2dfbeb
commit dce6f70ef9
4 changed files with 15 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ typedef struct _GLOBAL_CONFIG {
bool multi_printer_mode : 1;
bool on_during_print : 1;
bool display_mode : 1; // Driver specifc usage. Currently only used on ESP32-2432S028R to fix the screen on the usb-c model
bool disable_m117_messaging : 1;
};
};

View File

@@ -244,7 +244,11 @@ void fetch_printer_data()
{
printer.print_progress = status["display_status"]["progress"];
const char* message = status["display_status"]["message"];
lv_create_popup_message(message, 10000);
if (!global_config.disable_m117_messaging)
{
lv_create_popup_message(message, 10000);
}
}
if (printer.state == PRINTER_STATE_PRINTING && printer.print_progress > 0)

View File

@@ -96,6 +96,13 @@ static void dualusb_screen_fix_switch(lv_event_t* e){
ESP.restart();
}
static void disable_m117_messaging_switch(lv_event_t* e){
auto state = lv_obj_get_state(lv_event_get_target(e));
bool checked = (state & LV_STATE_CHECKED == LV_STATE_CHECKED);
global_config.disable_m117_messaging = checked;
write_global_config();
}
static void rotate_screen_switch(lv_event_t* e){
auto state = lv_obj_get_state(lv_event_get_target(e));
bool checked = (state & LV_STATE_CHECKED == LV_STATE_CHECKED);
@@ -187,6 +194,7 @@ void settings_section_behaviour(lv_obj_t* panel)
#endif
lv_create_custom_menu_switch("Multi Printer Mode", panel, multi_printer_switch, global_config.multi_printer_mode);
lv_create_custom_menu_switch("Disable M117 Messaging", panel, disable_m117_messaging_switch, global_config.disable_m117_messaging);
lv_create_custom_menu_button("Configure Printer IP", panel, reset_ip_click, "Restart");
}

View File

@@ -260,6 +260,7 @@ void lv_create_popup_message(const char* message, uint16_t timeout_ms)
lv_layout_flex_column(panel, LV_FLEX_ALIGN_CENTER);
lv_obj_align(panel, LV_ALIGN_TOP_RIGHT, -CYD_SCREEN_GAP_PX, CYD_SCREEN_GAP_PX);
lv_obj_add_event_cb(panel, on_timer_destroy, LV_EVENT_DELETE, NULL);
lv_obj_add_event_cb(panel, destroy_event_user_data, LV_EVENT_CLICKED, panel);
lv_obj_set_style_border_color(panel, lv_color_hex(0xFF0000), 0);
lv_obj_t* label = lv_label_create(panel);