Skip to content

Commit

Permalink
Merge pull request #87 from suchmememanyskill/dev
Browse files Browse the repository at this point in the history
v1.6.1
  • Loading branch information
suchmememanyskill authored Apr 14, 2024
2 parents 2e3ac7b + 356c78e commit 29dcb47
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CYD-Klipper/src/conf/global_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};

Expand Down
10 changes: 8 additions & 2 deletions CYD-Klipper/src/core/data_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -301,16 +305,18 @@ void fetch_printer_data()
}
else
{
unfreeze_request_thread();
klipper_request_consecutive_fail_count++;

if (klipper_request_consecutive_fail_count == 5)
{
freeze_render_thread();
printer.state = PRINTER_STATE_OFFLINE;
lv_msg_send(DATA_PRINTER_STATE, &printer);
unfreeze_render_thread();
}

Serial.printf("Failed to fetch printer data: %d\n", httpCode);
unfreeze_request_thread();
}
}

Expand Down
8 changes: 8 additions & 0 deletions CYD-Klipper/src/ui/panels/settings_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
}

Expand Down
1 change: 1 addition & 0 deletions CYD-Klipper/src/ui/ui_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 29dcb47

Please sign in to comment.