From a436c6b5c7a377ac65a6364b2cc5d6363e6fd1e5 Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Sun, 11 Feb 2024 10:33:22 +0100 Subject: [PATCH 1/3] Update readme --- .github/workflows/compile.yaml | 2 +- README.md | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml index 78e3b9e..d79bf3a 100644 --- a/.github/workflows/compile.yaml +++ b/.github/workflows/compile.yaml @@ -57,7 +57,7 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build - if: (github.event_name == 'release' && github.event.action == 'created') || (github.event_name != 'pull_request' && github.ref == 'refs/heads/master') + if: github.event_name == 'release' && github.event.action == 'created' steps: - name: Print GitHub event name run: | diff --git a/README.md b/README.md index 36359ad..704b9ac 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ A ESP32-2432S028R is required to run this project. You can find out where to buy - Extrude/Retract filament - Execute predefined gcode macros - Toggle Moonraker power devices +- OTA updates ### Install @@ -29,7 +30,13 @@ A ESP32-2432S028R is required to run this project. You can find out where to buy On initial install, all data should be wiped. On updates, data should be able to be kept without issues. -There are no 'over the air' updates. Each update has to be applied manually. +When there is an update available, a button in the settings will appear that can be pressed to update. If automatic updates are preferred, there is a toggle in the settings to automatically update. This will right after connecting to wifi update the screen. + +### Donate + +If you found this project helpful, please consider a donation [to my Ko-Fi](https://ko-fi.com/suchmememanyskill). It would help out a lot in the development of this project, due to the need to buy the screens. + +Thank you! ### Screenshots (Quite literally shots of the screen. I'm sorry) From e004456ee9ec98826f25d755bc6a64cbdfc072f0 Mon Sep 17 00:00:00 2001 From: Beebles <102569435+beebls@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:57:29 -0400 Subject: [PATCH 2/3] Update README.md (#95) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 704b9ac..370db57 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ A ESP32-2432S028R is required to run this project. You can find out where to buy ### Install -[There is a web-based installer available. This is only supported on Chrome, Edge or Opera, and only on Desktop.](https://suchmememanyskill.github.io/CYD-Klipper/) +[There is a web-based installer available. This is only supported on Chrome, Edge, Arc or Opera, and only on Desktop.](https://suchmememanyskill.github.io/CYD-Klipper/) On initial install, all data should be wiped. On updates, data should be able to be kept without issues. @@ -54,4 +54,4 @@ Thank you! - [xtouch](https://github.com/xperiments-in/xtouch) - [ESP32-Cheap-Yellow-Display](https://github.com/witnessmenow/ESP32-Cheap-Yellow-Display) - [OperatorB](https://github.com/OperatorB) for the ESP32-3248S035C display driver -- [esp32-smartdisplay](https://github.com/rzeldent/esp32-smartdisplay) \ No newline at end of file +- [esp32-smartdisplay](https://github.com/rzeldent/esp32-smartdisplay) From e2c2a38b201562620dad389a9162a12d248c4b8d Mon Sep 17 00:00:00 2001 From: Sims <38142618+suchmememanyskill@users.noreply.github.com> Date: Fri, 28 Jun 2024 19:11:20 +0200 Subject: [PATCH 3/3] v1.6.4 (#113) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix gcode previews with special chars not loading * Add .gitignore file (#108) * Bulletproof ci.py (#107) * Implement file sorting (implement #89) * Set chip family to ESP32-S3 for specific models (fix #67) * Add files menu to params panel while printing (implement #80) * Update ci.py (#110) Typo fix for ESP32-S3 boards array name --------- Co-authored-by: Sebastian Göls <6608231+Abrynos@users.noreply.github.com> Co-authored-by: Miroslav Zuzelka --- .gitignore | 10 ++++++++ CYD-Klipper/src/conf/global_config.h | 1 + CYD-Klipper/src/core/macros_query.cpp | 7 ++++++ CYD-Klipper/src/ui/gcode_img.cpp | 19 ++++++++------- CYD-Klipper/src/ui/gcode_img.h | 2 +- CYD-Klipper/src/ui/main_ui.cpp | 5 +++- CYD-Klipper/src/ui/nav_buttons.cpp | 24 +++++++++++++++---- CYD-Klipper/src/ui/nav_buttons.h | 23 ++++++++++-------- .../{print_panel.cpp => files_panel.cpp} | 11 ++++----- CYD-Klipper/src/ui/panels/panel.h | 2 +- CYD-Klipper/src/ui/panels/settings_panel.cpp | 9 +++++++ CYD-Klipper/src/ui/panels/stats_panel.cpp | 15 ++++++++++++ ci.py | 13 ++++++++-- 13 files changed, 107 insertions(+), 34 deletions(-) create mode 100644 .gitignore rename CYD-Klipper/src/ui/panels/{print_panel.cpp => files_panel.cpp} (95%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab1e7fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +_site/out/ +_site/OTA.json +_site/esp32-*.json + +pyvenv.cfg +bin/ +out/ +lib +lib64 + diff --git a/CYD-Klipper/src/conf/global_config.h b/CYD-Klipper/src/conf/global_config.h index 545735d..31c16c8 100644 --- a/CYD-Klipper/src/conf/global_config.h +++ b/CYD-Klipper/src/conf/global_config.h @@ -68,6 +68,7 @@ typedef struct _GLOBAL_CONFIG { 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; + bool sort_macros : 1; }; }; diff --git a/CYD-Klipper/src/core/macros_query.cpp b/CYD-Klipper/src/core/macros_query.cpp index c1d5fa8..958b3e7 100644 --- a/CYD-Klipper/src/core/macros_query.cpp +++ b/CYD-Klipper/src/core/macros_query.cpp @@ -45,6 +45,13 @@ MACROSQUERY macros_query(PRINTER_CONFIG * config) } } + if (global_config.sort_macros) + { + std::sort(macros, macros + macros_count, [](const char* a, const char* b) { + return strcmp(a, b) < 0; + }); + } + return {(const char**)macros, (unsigned int)macros_count}; } else { diff --git a/CYD-Klipper/src/ui/gcode_img.cpp b/CYD-Klipper/src/ui/gcode_img.cpp index eb7cbe9..8f20215 100644 --- a/CYD-Klipper/src/ui/gcode_img.cpp +++ b/CYD-Klipper/src/ui/gcode_img.cpp @@ -2,6 +2,7 @@ #include "lvgl.h" #include "ui_utils.h" #include +#include #include #include "../conf/global_config.h" #include "../core/http_client.h" @@ -10,29 +11,27 @@ static unsigned char * data_png = NULL; static char img_filename_path[256] = {0}; static lv_img_dsc_t img_header = {0}; -bool has_128_128_gcode(const char* filename) +bool has_32_32_gcode_img(const char* filename) { if (filename == NULL){ Serial.println("No gcode filename"); return false; } - SETUP_HTTP_CLIENT("/server/files/thumbnails?filename=" + String(filename)); - + SETUP_HTTP_CLIENT("/server/files/thumbnails?filename=" + urlEncode(filename)); int httpCode = 0; try { httpCode = client.GET(); } catch (...){ Serial.println("Exception while fetching gcode img location"); - return {0}; + return false; } if (httpCode == 200) { - String payload = client.getString(); JsonDocument doc; - deserializeJson(doc, payload); + deserializeJson(doc, client.getStream()); auto result = doc["result"].as(); const char* chosen_thumb = NULL; @@ -58,6 +57,10 @@ bool has_128_128_gcode(const char* filename) return true; } } + else + { + Serial.printf("Failed to fetch gcode image data: %d\n", httpCode); + } return false; } @@ -71,7 +74,7 @@ lv_obj_t* draw_gcode_img() return NULL; } - SETUP_HTTP_CLIENT_FULL("/server/files/gcodes/" + String(img_filename_path), false, 2000); + SETUP_HTTP_CLIENT_FULL("/server/files/gcodes/" + urlEncode(img_filename_path), false, 2000); int httpCode = 0; try { @@ -121,7 +124,7 @@ lv_obj_t* show_gcode_img(const char* filename) return NULL; } - if (!has_128_128_gcode(filename)){ + if (!has_32_32_gcode_img(filename)){ Serial.println("No 32x32 gcode img found"); return NULL; } diff --git a/CYD-Klipper/src/ui/gcode_img.h b/CYD-Klipper/src/ui/gcode_img.h index 75f7074..ba591a9 100644 --- a/CYD-Klipper/src/ui/gcode_img.h +++ b/CYD-Klipper/src/ui/gcode_img.h @@ -2,5 +2,5 @@ #include "lvgl.h" lv_obj_t* show_gcode_img(const char* filename); -bool has_128_128_gcode(const char* filename); +bool has_32_32_gcode_img(const char* filename); void clear_img_mem(); \ No newline at end of file diff --git a/CYD-Klipper/src/ui/main_ui.cpp b/CYD-Klipper/src/ui/main_ui.cpp index 4bff2e1..3a081dc 100644 --- a/CYD-Klipper/src/ui/main_ui.cpp +++ b/CYD-Klipper/src/ui/main_ui.cpp @@ -30,8 +30,11 @@ static void on_state_change(void * s, lv_msg_t * m){ else if (printer.state == PRINTER_STATE_ERROR){ nav_buttons_setup(PANEL_ERROR); } + else if (printer.state == PRINTER_STATE_IDLE) { + nav_buttons_setup(PANEL_FILES); + } else { - nav_buttons_setup(PANEL_PRINT); + nav_buttons_setup(PANEL_PROGRESS); } } diff --git a/CYD-Klipper/src/ui/nav_buttons.cpp b/CYD-Klipper/src/ui/nav_buttons.cpp index e2e55ae..d02f5de 100644 --- a/CYD-Klipper/src/ui/nav_buttons.cpp +++ b/CYD-Klipper/src/ui/nav_buttons.cpp @@ -58,7 +58,11 @@ static void update_printer_data_time(lv_event_t * e){ } static void btn_click_files(lv_event_t * e){ - nav_buttons_setup(PANEL_PRINT); + nav_buttons_setup(PANEL_FILES); +} + +static void btn_click_progress(lv_event_t * e){ + nav_buttons_setup(PANEL_PROGRESS); } static void btn_click_move(lv_event_t * e){ @@ -115,7 +119,7 @@ void create_button(const char* icon, const char* name, lv_event_cb_t button_clic lv_obj_add_style(label, &nav_button_text_style, 0); } -void nav_buttons_setup(unsigned char active_panel){ +void nav_buttons_setup(PANEL_TYPE active_panel){ lv_obj_clean(lv_scr_act()); lv_obj_clear_flag(lv_scr_act(), LV_OBJ_FLAG_SCROLLABLE); @@ -134,7 +138,14 @@ void nav_buttons_setup(unsigned char active_panel){ if (printer.state > PRINTER_STATE_ERROR){ // Files/Print - create_button(LV_SYMBOL_COPY, "Idle", btn_click_files, update_printer_data_time, root_panel); + if (printer.state == PRINTER_STATE_IDLE) + { + create_button(LV_SYMBOL_COPY, "Idle", btn_click_files, update_printer_data_time, root_panel); + } + else + { + create_button(LV_SYMBOL_FILE, "Paused", btn_click_progress, update_printer_data_time, root_panel); + } // Move create_button(printer.state == PRINTER_STATE_PRINTING ? LV_SYMBOL_EDIT : LV_SYMBOL_CHARGE, "Z?", btn_click_move, update_printer_data_z_pos, root_panel); @@ -165,8 +176,8 @@ void nav_buttons_setup(unsigned char active_panel){ lv_obj_align(panel, LV_ALIGN_TOP_RIGHT, 0, 0); switch (active_panel){ - case PANEL_PRINT: - print_panel_init(panel); + case PANEL_FILES: + files_panel_init(panel); break; case PANEL_MOVE: move_panel_init(panel); @@ -192,6 +203,9 @@ void nav_buttons_setup(unsigned char active_panel){ case PANEL_CONNECTING: connecting_panel_init(panel); break; + case PANEL_PROGRESS: + progress_panel_init(panel); + break; } lv_msg_send(DATA_PRINTER_DATA, &printer); diff --git a/CYD-Klipper/src/ui/nav_buttons.h b/CYD-Klipper/src/ui/nav_buttons.h index 57f0bcb..f3337a6 100644 --- a/CYD-Klipper/src/ui/nav_buttons.h +++ b/CYD-Klipper/src/ui/nav_buttons.h @@ -1,14 +1,17 @@ #pragma once -#define PANEL_PRINT 0 -#define PANEL_MOVE 1 -#define PANEL_TEMP 2 -#define PANEL_SETTINGS 3 -#define PANEL_MACROS 4 -#define PANEL_STATS 5 -#define PANEL_PRINTER 6 -#define PANEL_ERROR 7 -#define PANEL_CONNECTING 8 +enum PANEL_TYPE { + PANEL_FILES = 0, + PANEL_MOVE = 1, + PANEL_TEMP = 2, + PANEL_SETTINGS = 3, + PANEL_MACROS = 4, + PANEL_STATS = 5, + PANEL_PRINTER = 6, + PANEL_ERROR = 7, + PANEL_CONNECTING = 8, + PANEL_PROGRESS = 9, +}; -void nav_buttons_setup(unsigned char active_panel); +void nav_buttons_setup(PANEL_TYPE active_panel); void nav_style_setup(); \ No newline at end of file diff --git a/CYD-Klipper/src/ui/panels/print_panel.cpp b/CYD-Klipper/src/ui/panels/files_panel.cpp similarity index 95% rename from CYD-Klipper/src/ui/panels/print_panel.cpp rename to CYD-Klipper/src/ui/panels/files_panel.cpp index 5bf267d..0ccbf23 100644 --- a/CYD-Klipper/src/ui/panels/print_panel.cpp +++ b/CYD-Klipper/src/ui/panels/files_panel.cpp @@ -23,6 +23,10 @@ static void btn_print_file(lv_event_t * e){ } static void btn_print_file_verify(lv_event_t * e){ + if (printer.state != PRINTER_STATE_IDLE){ + return; + } + const auto button_size_mult = 1.3f; lv_obj_t * btn = lv_event_get_target(e); @@ -76,12 +80,7 @@ static void btn_print_file_verify(lv_event_t * e){ } } -void print_panel_init(lv_obj_t* panel){ - if (printer.state == PRINTER_STATE_PRINTING || printer.state == PRINTER_STATE_PAUSED){ - progress_panel_init(panel); - return; - } - +void files_panel_init(lv_obj_t* panel){ clear_img_mem(); lv_obj_t * list = lv_list_create(panel); diff --git a/CYD-Klipper/src/ui/panels/panel.h b/CYD-Klipper/src/ui/panels/panel.h index 319fe08..7c3c283 100644 --- a/CYD-Klipper/src/ui/panels/panel.h +++ b/CYD-Klipper/src/ui/panels/panel.h @@ -5,7 +5,7 @@ void settings_panel_init(lv_obj_t* panel); void temp_panel_init(lv_obj_t* panel); -void print_panel_init(lv_obj_t* panel); +void files_panel_init(lv_obj_t* panel); void move_panel_init(lv_obj_t* panel); void progress_panel_init(lv_obj_t* panel); void macros_panel_init(lv_obj_t* panel); diff --git a/CYD-Klipper/src/ui/panels/settings_panel.cpp b/CYD-Klipper/src/ui/panels/settings_panel.cpp index 48787a2..2e88b41 100644 --- a/CYD-Klipper/src/ui/panels/settings_panel.cpp +++ b/CYD-Klipper/src/ui/panels/settings_panel.cpp @@ -110,6 +110,13 @@ static void disable_m117_messaging_switch(lv_event_t* e){ write_global_config(); } +static void sort_macros_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.sort_macros = 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); @@ -208,6 +215,8 @@ void settings_section_behaviour(lv_obj_t* panel) global_config.multi_printer_mode ? "Calls FILAMENT_RETRACT and\nFILAMENT_EXTRUDE in temperature menu\nwhen enabled. Stored per printer." : "Calls FILAMENT_RETRACT and\nFILAMENT_EXTRUDE in temperature menu\nwhen enabled"); + + lv_create_custom_menu_switch("Sort Macros A->Z", panel, sort_macros_switch, global_config.sort_macros); } void settings_section_device(lv_obj_t* panel) diff --git a/CYD-Klipper/src/ui/panels/stats_panel.cpp b/CYD-Klipper/src/ui/panels/stats_panel.cpp index e9d361b..df19e41 100644 --- a/CYD-Klipper/src/ui/panels/stats_panel.cpp +++ b/CYD-Klipper/src/ui/panels/stats_panel.cpp @@ -1,9 +1,14 @@ #include "panel.h" #include "../ui_utils.h" #include "../../core/data_setup.h" +#include "../nav_buttons.h" #include #include +static void swap_to_files_menu(lv_event_t * e) { + nav_buttons_setup(PANEL_FILES); +} + static void set_fan_speed_text(lv_event_t * e) { lv_obj_t * label = lv_event_get_target(e); char data[64]; @@ -248,6 +253,16 @@ void stats_panel_init(lv_obj_t* panel) { lv_obj_set_size(right_panel, panel_width, CYD_SCREEN_PANEL_HEIGHT_PX - CYD_SCREEN_GAP_PX * 2); lv_layout_flex_column(right_panel, LV_FLEX_ALIGN_CENTER); lv_obj_align(right_panel, LV_ALIGN_TOP_RIGHT, -1 * CYD_SCREEN_GAP_PX, CYD_SCREEN_GAP_PX); + + if (printer.state >= PRINTER_STATE_PRINTING){ + lv_obj_t * btn = lv_btn_create(right_panel); + lv_obj_set_size(btn, CYD_SCREEN_PANEL_WIDTH_PX / 2 - CYD_SCREEN_GAP_PX * 3, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX); + lv_obj_add_event_cb(btn, swap_to_files_menu, LV_EVENT_CLICKED, NULL); + + lv_obj_t * label = lv_label_create(btn); + lv_label_set_text(label, "Files"); + lv_obj_align(label, LV_ALIGN_CENTER, 0, 0); + } create_state_button(right_panel, set_fan_speed_text, open_fan_speed_panel); create_state_button(right_panel, set_zoffset_text, open_zoffset_panel); diff --git a/ci.py b/ci.py index b60d48d..c397650 100644 --- a/ci.py +++ b/ci.py @@ -10,6 +10,12 @@ "esp32-3248S035C-V", #"esp32-4827S043R-SD", ] + +ESP_S3_CHIPS = [ + "esp32-8048S043C-SD", + "esp32-4827S043C-SD", +] + BASE_DIR = os.getcwd() def get_manifest(base_path : str, device_name : str): @@ -19,7 +25,7 @@ def get_manifest(base_path : str, device_name : str): "new_install_prompt_erase": True, "builds": [ { - "chipFamily": "ESP32", + "chipFamily": "ESP32-S3" if device_name in ESP_S3_CHIPS else "ESP32", "parts": [ { "path": f"{base_path}/bootloader.bin", @@ -81,7 +87,10 @@ def add_configuration(board : str): add_configuration(port) os.chdir(BASE_DIR) -shutil.copytree("./out", "./_site/out") +out_dir = "./_site/out" +if os.path.exists(out_dir): + shutil.rmtree(out_dir) +shutil.copytree("./out", out_dir) with open("./_site/OTA.json", "w") as f: json.dump({"Configurations": configurations}, f)