diff --git a/CYD-Klipper/boards/esp32-4827S043R-smartdisplay.json b/CYD-Klipper/boards/esp32-4827S043R-smartdisplay.json new file mode 100644 index 0000000..c686baa --- /dev/null +++ b/CYD-Klipper/boards/esp32-4827S043R-smartdisplay.json @@ -0,0 +1,146 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default_16MB.csv", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "'-D ARDUINO_ESP32S3_DEV'", + "'-D BOARD_HAS_PSRAM'", + "'-D ARDUINO_USB_MODE=1'", + "'-D ARDUINO_RUNNING_CORE=1'", + "'-D ARDUINO_EVENT_RUNNING_CORE=1'", + "'-D ARDUINO_USB_CDC_ON_BOOT=0'", + "'-D ESP32_4827S043R'", + "'-D LCD_WIDTH=480'", + "'-D LCD_HEIGHT=272'", + "'-D LVGL_BUFFER_PIXELS=(LCD_WIDTH*LCD_HEIGHT)'", + "'-D LVGL_BUFFER_MALLOC_FLAGS=(MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT)'", + "'-D GPIO_BCKL=2'", + "'-D LCD_ST7262_PAR'", + "'-D ST7262_PANEL_CONFIG_CLK_SRC=LCD_CLK_SRC_PLL160M'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_PCLK_HZ=(8*1000000)'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_H_RES=LCD_WIDTH'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_V_RES=LCD_HEIGHT'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_HSYNC_PULSE_WIDTH=4'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_HSYNC_BACK_PORCH=43'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_HSYNC_FRONT_PORCH=8'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_VSYNC_PULSE_WIDTH=4'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_VSYNC_BACK_PORCH=12'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_VSYNC_FRONT_PORCH=8'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_FLAGS_HSYNC_IDLE_LOW=true'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_FLAGS_VSYNC_IDLE_LOW=true'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_FLAGS_DE_IDLE_HIGH=false'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_FLAGS_PCLK_ACTIVE_NEG=true'", + "'-D ST7262_PANEL_CONFIG_TIMINGS_FLAGS_PCLK_IDLE_HIGH=false'", + "'-D ST7262_PANEL_CONFIG_DATA_WIDTH=16'", + "'-D ST7262_PANEL_CONFIG_SRAM_TRANS_ALIGN=4'", + "'-D ST7262_PANEL_CONFIG_PSRAM_TRANS_ALIGN=64'", + "'-D ST7262_PANEL_CONFIG_HSYNC_GPIO_NUM=39'", + "'-D ST7262_PANEL_CONFIG_VSYNC_GPIO_NUM=41'", + "'-D ST7262_PANEL_CONFIG_DE_GPIO_NUM=40'", + "'-D ST7262_PANEL_CONFIG_PCLK_GPIO_NUM=42'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_R0=8'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_R1=3'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_R2=46'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_R3=9'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_R4=1'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_G0=5'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_G1=6'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_G2=7'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_G3=15'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_G4=16'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_G5=4'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_B0=45'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_B1=48'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_B2=47'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_B3=21'", + "'-D ST7262_PANEL_CONFIG_DATA_GPIO_B4=14'", + "'-D ST7262_PANEL_CONFIG_DISP_GPIO_NUM=GPIO_NUM_NC'", + "'-D ST7262_PANEL_CONFIG_FLAGS_DISP_ACTIVE_LOW=false'", + "'-D ST7262_PANEL_CONFIG_FLAGS_RELAX_ON_IDLE=false'", + "'-D ST7262_PANEL_CONFIG_FLAGS_FB_IN_PSRAM=true'", + "'-D BOARD_HAS_TOUCH'", + "'-D TOUCH_XPT2046_SPI'", + "'-D XPT2046_SPI_HOST=SPI2_HOST'", + "'-D XPT2046_SPI_DMA_CHANNEL=SPI_DMA_CH_AUTO'", + "'-D XPT2046_SPI_BUS_MOSI_IO_NUM=11'", + "'-D XPT2046_SPI_BUS_MISO_IO_NUM=13'", + "'-D XPT2046_SPI_BUS_SCLK_IO_NUM=12'", + "'-D XPT2046_SPI_BUS_QUADWP_IO_NUM=GPIO_NUM_NC'", + "'-D XPT2046_SPI_BUS_QUADHD_IO_NUM=GPIO_NUM_NC'", + "'-D XPT2046_SPI_CONFIG_CS_GPIO_NUM=38'", + "'-D XPT2046_SPI_CONFIG_DC_GPIO_NUM=GPIO_NUM_NC'", + "'-D XPT2046_SPI_CONFIG_SPI_MODE=SPI_MODE0'", + "'-D XPT2046_SPI_CONFIG_PCLK_HZ=2000000'", + "'-D XPT2046_SPI_CONFIG_TRANS_QUEUE_DEPTH=3'", + "'-D XPT2046_SPI_CONFIG_LCD_CMD_BITS=8'", + "'-D XPT2046_SPI_CONFIG_LCD_PARAM_BITS=8'", + "'-D XPT2046_SPI_CONFIG_FLAGS_DC_AS_CMD_PHASE=false'", + "'-D XPT2046_SPI_CONFIG_FLAGS_DC_LOW_ON_DATA=false'", + "'-D XPT2046_SPI_CONFIG_FLAGS_OCTAL_MODE=false'", + "'-D XPT2046_SPI_CONFIG_FLAGS_LSB_FIRST=false'", + "'-D XPT2046_TOUCH_CONFIG_X_MAX=LCD_WIDTH'", + "'-D XPT2046_TOUCH_CONFIG_Y_MAX=LCD_HEIGHT'", + "'-D XPT2046_TOUCH_CONFIG_RST_GPIO_NUM=GPIO_NUM_NC'", + "'-D XPT2046_TOUCH_CONFIG_INT_GPIO_NUM=18'", + "'-D XPT2046_TOUCH_CONFIG_LEVELS_RESET=0'", + "'-D XPT2046_TOUCH_CONFIG_LEVELS_INTERRUPT=0'", + "'-D TOUCH_SWAP_XY=false'", + "'-D TOUCH_SWAP_X=false'", + "'-D TOUCH_SWAP_Y=false'", + "'-D BOARD_HAS_TF'", + "'-D TF_CS=10'", + "'-D TF_SPI_MOSI=11'", + "'-D TF_SPI_SCLK=12'", + "'-D TF_SPI_MISO=13'", + + "'-DCYD_SCREEN_HEIGHT_PX=272'", + "'-DCYD_SCREEN_WIDTH_PX=480'", + "-DROTATION_INVERTED=LV_DISP_ROT_180", + "-DROTATION_NORMAL=LV_DISP_ROT_NONE", + "'-DCYD_SCREEN_GAP_PX=10'", + "'-DCYD_SCREEN_MIN_BUTTON_HEIGHT_PX=35'", + "'-DCYD_SCREEN_MIN_BUTTON_WIDTH_PX=40'", + "'-DCYD_SCREEN_FONT=lv_font_montserrat_16'", + "'-DCYD_SCREEN_FONT_SMALL=lv_font_montserrat_12'", + "'-DCYD_SCREEN_SIDEBAR_SIZE_PX=50'", + "'-DCYD_SCREEN_DRIVER_ESP32_SMARTDISPLAY=1'" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "esp32s3" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "esp32-4827S043R-SD", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://www.aliexpress.com/item/1005004788147691.html", + "vendor": "Sunton" + } \ No newline at end of file diff --git a/CYD-Klipper/platformio.ini b/CYD-Klipper/platformio.ini index fbfd7f4..87de374 100644 --- a/CYD-Klipper/platformio.ini +++ b/CYD-Klipper/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [env] -platform = espressif32 +platform = https://github.com/platformio/platform-espressif32#v6.4.0 board = esp32dev framework = arduino monitor_speed = 115200 @@ -78,5 +78,9 @@ board = esp32-3248S035C-smartdisplay [env:esp32-4827S043C-SD] board = esp32-4827S043C-smartdisplay +[env:esp32-4827S043R-SD] +board = esp32-4827S043C-smartdisplay + [env:esp32-8048S043C-SD] -board = esp32-8048S043C-smartdisplay \ No newline at end of file +board = esp32-8048S043C-smartdisplay + diff --git a/CYD-Klipper/src/conf/global_config.h b/CYD-Klipper/src/conf/global_config.h index 2e7a135..545735d 100644 --- a/CYD-Klipper/src/conf/global_config.h +++ b/CYD-Klipper/src/conf/global_config.h @@ -32,6 +32,8 @@ typedef struct _PRINTER_CONFIG { bool invert_colors : 1; unsigned char remaining_time_calc_mode : 2; unsigned char show_stats_on_progress_panel : 2; + + bool custom_filament_move_macros : 1; }; }; diff --git a/CYD-Klipper/src/core/data_setup.cpp b/CYD-Klipper/src/core/data_setup.cpp index e57bf85..584a6d6 100644 --- a/CYD-Klipper/src/core/data_setup.cpp +++ b/CYD-Klipper/src/core/data_setup.cpp @@ -16,6 +16,7 @@ int klipper_request_consecutive_fail_count = 999; char filename_buff[512] = {0}; SemaphoreHandle_t freezeRenderThreadSemaphore, freezeRequestThreadSemaphore; const long data_update_interval = 780; +unsigned char lock_absolute_relative_mode_swap = 0; void semaphore_init(){ freezeRenderThreadSemaphore = xSemaphoreCreateMutex(); @@ -82,25 +83,29 @@ void move_printer(const char* axis, float amount, bool relative) { char gcode[64]; const char* extra = (amount > 0) ? "+" : ""; + const char* start = ""; + const char* end = ""; bool absolute_coords = printer.absolute_coords; if (absolute_coords && relative) { - send_gcode(true, "G91"); + start = "G91\n"; } else if (!absolute_coords && !relative) { - send_gcode(true, "G90"); + start = "G90\n"; } - sprintf(gcode, "G1 %s%s%.3f F6000", axis, extra, amount); - send_gcode(true, gcode); - if (absolute_coords && relative) { - send_gcode(true, "G90"); + end = "\nG90"; } else if (!absolute_coords && !relative) { - send_gcode(true, "G91"); + end = "\nG91"; } + + sprintf(gcode, "%sG1 %s%s%.3f F6000%s", start, axis, extra, amount, end); + send_gcode(true, gcode); + + lock_absolute_relative_mode_swap = 2; } int last_slicer_time_query = -15000; @@ -192,7 +197,16 @@ void fetch_printer_data() printer.gcode_offset[1] = status["gcode_move"]["homing_origin"][1]; printer.gcode_offset[2] = status["gcode_move"]["homing_origin"][2]; bool absolute_coords = status["gcode_move"]["absolute_coordinates"]; - printer.absolute_coords = absolute_coords == true; + + if (lock_absolute_relative_mode_swap > 0) + { + lock_absolute_relative_mode_swap--; + } + else + { + printer.absolute_coords = absolute_coords == true; + } + printer.speed_mult = status["gcode_move"]["speed_factor"]; printer.extrude_mult = status["gcode_move"]["extrude_factor"]; printer.feedrate_mm_per_s = status["gcode_move"]["speed"]; @@ -212,7 +226,7 @@ void fetch_printer_data() if (status.containsKey("print_stats")) { const char *filename = status["print_stats"]["filename"]; - strcpy(filename_buff, filename); + strcpy(filename_buff, filename == NULL ? "" : filename); printer.print_filename = filename_buff; printer.elapsed_time_s = status["print_stats"]["total_duration"]; printer.printed_time_s = status["print_stats"]["print_duration"]; diff --git a/CYD-Klipper/src/ui/ip_setup.cpp b/CYD-Klipper/src/ui/ip_setup.cpp index 1419972..014734e 100644 --- a/CYD-Klipper/src/ui/ip_setup.cpp +++ b/CYD-Klipper/src/ui/ip_setup.cpp @@ -33,6 +33,20 @@ static const lv_btnmatrix_ctrl_t kb_ctrl[] = { LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, LV_KEYBOARD_CTRL_BTN_FLAGS | 6 }; +static const char * hex_numpad_map[] = { + "1", "2", "3", "f", LV_SYMBOL_BACKSPACE, "\n", + "4", "5", "6", "e", LV_SYMBOL_OK, "\n", + "7", "8", "9", "d", LV_SYMBOL_LEFT, "\n", + "0", "a", "b", "c", LV_SYMBOL_RIGHT, NULL +}; + +static const lv_btnmatrix_ctrl_t hex_numpad_ctrl[] = { + 1, 1, 1, 1, LV_KEYBOARD_CTRL_BTN_FLAGS | 1, + 1, 1, 1, 1, LV_KEYBOARD_CTRL_BTN_FLAGS | 1, + 1, 1, 1, 1, LV_KEYBOARD_CTRL_BTN_FLAGS | 1, + 1, 1, 1, 1, LV_KEYBOARD_CTRL_BTN_FLAGS | 1, +}; + enum connection_status_t { CONNECT_FAIL = 0, CONNECT_OK = 1, @@ -62,6 +76,20 @@ static void keyboard_event_ip_entry(lv_event_t * e) { lv_obj_t * ta = lv_event_get_target(e); lv_obj_t * kb = (lv_obj_t *)lv_event_get_user_data(e); + if ((code == LV_EVENT_FOCUSED || code == LV_EVENT_DEFOCUSED) && ta != NULL) + { + // make sure we alter the keymap before taking actions that might + // destroy the keyboard + if (lv_obj_has_flag(ta, LV_OBJ_FLAG_USER_1)) + { + lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_USER_1); + } + else + { + lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER); + } + } + if(code == LV_EVENT_FOCUSED) { lv_keyboard_set_textarea(kb, ta); lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN); @@ -94,15 +122,6 @@ static void keyboard_event_ip_entry(lv_event_t * e) { { return; } - - if (lv_obj_has_flag(ta, LV_OBJ_FLAG_USER_1)) - { - lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_USER_1); - } - else - { - lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER); - } } static void keyboard_event_auth_entry(lv_event_t * e) { @@ -170,8 +189,8 @@ void show_auth_entry() lv_obj_set_flex_grow(passEntry, 1); lv_keyboard_set_textarea(keyboard, passEntry); - lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_USER_1, kb_map, kb_ctrl); - lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_USER_1); + lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_USER_2, hex_numpad_map, hex_numpad_ctrl); + lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_USER_2); } void show_ip_entry() diff --git a/CYD-Klipper/src/ui/panels/move_panel.cpp b/CYD-Klipper/src/ui/panels/move_panel.cpp index 75652ff..059bbfd 100644 --- a/CYD-Klipper/src/ui/panels/move_panel.cpp +++ b/CYD-Klipper/src/ui/panels/move_panel.cpp @@ -312,19 +312,30 @@ inline void root_panel_steppers_locked(lv_obj_t * root_panel){ inline void root_panel_steppers_unlocked(lv_obj_t * root_panel){ lv_obj_t * panel = lv_create_empty_panel(root_panel); lv_obj_set_size(panel, CYD_SCREEN_PANEL_WIDTH_PX, CYD_SCREEN_PANEL_HEIGHT_PX); - lv_obj_set_style_pad_all(panel, CYD_SCREEN_GAP_PX, 0); lv_layout_flex_column(panel, LV_FLEX_ALIGN_CENTER); lv_obj_t * label = lv_label_create(panel); lv_label_set_text(label, LV_SYMBOL_EYE_CLOSE " Steppers unlocked"); - lv_obj_t * btn = lv_btn_create(panel); + lv_obj_t * btn_row = lv_create_empty_panel(panel); + lv_obj_set_size(btn_row, CYD_SCREEN_PANEL_WIDTH_PX, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX); + lv_layout_flex_row(btn_row, LV_FLEX_ALIGN_CENTER); + + lv_obj_t * btn = lv_btn_create(btn_row); lv_obj_set_height(btn, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX); lv_obj_add_event_cb(btn, home_button_click, LV_EVENT_CLICKED, NULL); label = lv_label_create(btn); lv_label_set_text(label, LV_SYMBOL_HOME "Home Axis"); lv_obj_center(label); + + btn = lv_btn_create(btn_row); + lv_obj_set_height(btn, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX); + lv_obj_add_event_cb(btn, switch_to_stat_panel, LV_EVENT_CLICKED, NULL); + + label = lv_label_create(btn); + lv_label_set_text(label, LV_SYMBOL_SETTINGS "Parameters"); + lv_obj_center(label); } static void root_panel_state_update(lv_event_t * e){ diff --git a/CYD-Klipper/src/ui/panels/settings_panel.cpp b/CYD-Klipper/src/ui/panels/settings_panel.cpp index 5ccc81c..48787a2 100644 --- a/CYD-Klipper/src/ui/panels/settings_panel.cpp +++ b/CYD-Klipper/src/ui/panels/settings_panel.cpp @@ -52,6 +52,13 @@ static void light_mode_switch(lv_event_t * e){ set_color_scheme(); } +static void filament_move_mode_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); + get_current_printer_config()->custom_filament_move_macros = checked; + write_global_config(); +} + static void show_stats_on_progress_panel_dropdown(lv_event_t * e){ auto selected = lv_dropdown_get_selected(lv_event_get_target(e)); get_current_printer_config()->show_stats_on_progress_panel = selected; @@ -147,7 +154,7 @@ static void estimated_time_dropdown(lv_event_t * e){ write_global_config(); } -#define PRINTER_SPECIFIC_SETTING global_config.multi_printer_mode ? LV_SYMBOL_PLUS " Stored per printer" : NULL +#define PRINTER_SPECIFIC_SETTING global_config.multi_printer_mode ? "Stored per printer" : NULL void settings_section_theming(lv_obj_t* panel) { @@ -157,7 +164,7 @@ void settings_section_theming(lv_obj_t* panel) lv_create_custom_menu_dropdown("Theme", panel, theme_dropdown, "Blue\nGreen\nLime\nGrey\nYellow\nOrange\nRed\nPurple", get_current_printer_config()->color_scheme, NULL, PRINTER_SPECIFIC_SETTING); #ifndef CYD_SCREEN_DISABLE_INVERT_COLORS - lv_create_custom_menu_switch("Invert Colors", panel, invert_color_switch, get_current_printer_config()->invert_colors, NULL, (global_config.multi_printer_mode) ? LV_SYMBOL_PLUS " Stored per printer" + lv_create_custom_menu_switch("Invert Colors", panel, invert_color_switch, get_current_printer_config()->invert_colors, NULL, (global_config.multi_printer_mode) ? "Stored per printer" #ifdef CYD_SCREEN_DRIVER_ESP32_2432S028R "\nIntended for the 2.8\" dual USB model screen" : "Intended for the 2.8\" dual USB model screen" #else @@ -196,6 +203,11 @@ void settings_section_behaviour(lv_obj_t* panel) 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"); + + lv_create_custom_menu_switch("Custom Filament Move Macros", panel, filament_move_mode_switch, get_current_printer_config()->custom_filament_move_macros, NULL, + 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"); } void settings_section_device(lv_obj_t* panel) @@ -217,7 +229,12 @@ void settings_section_device(lv_obj_t* panel) lv_create_custom_menu_switch("Screen Color Fix", panel, dualusb_screen_fix_switch, global_config.display_mode, NULL, "ONLY for the 2.8\" dual USB model screen"); #endif +#if defined(CYD_SCREEN_DRIVER_ESP32_SMARTDISPLAY) && !defined(CYD_SCREEN_DISABLE_TOUCH_CALIBRATION) + // TODO: Rotating screen requires different calibration points. +#else lv_create_custom_menu_switch("Rotate Screen", panel, rotate_screen_switch, global_config.rotate_screen); +#endif + lv_create_custom_menu_switch("Auto Update", panel, auto_ota_update_switch, global_config.auto_ota_update); lv_create_custom_menu_label("Version", panel, REPO_VERSION " "); diff --git a/CYD-Klipper/src/ui/panels/temp_panel.cpp b/CYD-Klipper/src/ui/panels/temp_panel.cpp index fc1f57c..5880eaf 100644 --- a/CYD-Klipper/src/ui/panels/temp_panel.cpp +++ b/CYD-Klipper/src/ui/panels/temp_panel.cpp @@ -139,8 +139,15 @@ static void btn_extrude(lv_event_t * e){ return; } - send_gcode(true, "M83"); - send_gcode(true, "G1 E25 F300"); + if (get_current_printer_config()->custom_filament_move_macros) + { + send_gcode(true, "FILAMENT_EXTRUDE"); + } + else + { + send_gcode(true, "M83"); + send_gcode(true, "G1 E25 F300"); + } } static void set_temp_via_preset(lv_event_t * e){ @@ -173,8 +180,15 @@ static void btn_retract(lv_event_t * e){ return; } - send_gcode(true, "M83"); - send_gcode(true, "G1 E-25 F300"); + if (get_current_printer_config()->custom_filament_move_macros) + { + send_gcode(true, "FILAMENT_RETRACT"); + } + else + { + send_gcode(true, "M83"); + send_gcode(true, "G1 E-25 F300"); + } } static void set_chart_range(lv_event_t * e) { diff --git a/Build.md b/Manual_Install.md similarity index 65% rename from Build.md rename to Manual_Install.md index 4d2b2ba..8d3d8a8 100644 --- a/Build.md +++ b/Manual_Install.md @@ -1,29 +1,38 @@ -# Building +# Manual install -## Running a developer build +## Flashing a build via the commandline -On every change made in this repository, [Github Actions](https://github.com/suchmememanyskill/CYD-Klipper/actions) automatically builds the firmware images for various screens. You can run one of these images as follows: +#### Release firmware image + +1. Go to [the releases tab](https://github.com/suchmememanyskill/CYD-Klipper/releases), and download the latest `firmware.zip` release. +2. Open the firmware.zip archive you just downloaded, open the corresponding folder for your screen, then extract `merged_firmware.bin` + +This merged_firmware.bin file is a ready to flash image. Note that flashing this image does wipe your current configuration. + +#### Developer firmware image +On every change made in this repository, [Github Actions](https://github.com/suchmememanyskill/CYD-Klipper/actions) automatically builds the firmware images for various screens. -#### Getting a firmware image 0. Make sure you are logged into github 1. Go to a [Github Actions](https://github.com/suchmememanyskill/CYD-Klipper/actions) build summary, then download the `firmware` Artifact. 2. Open the firmware.zip archive you just downloaded, open the corresponding folder for your screen, then extract `merged_firmware.bin` This merged_firmware.bin file is a ready to flash image. Note that flashing this image does wipe your current configuration. -#### Flashing merged_firmware.bin +### Flashing merged_firmware.bin 1. Download and extract [esptool](https://github.com/espressif/esptool/releases) to a new folder - For windows, download `esptool-v4.7.0-win64.zip` 2. Open a terminal window and navigate to this new folder containing esptool - In windows, you can type cmd and press enter in the address bar in explorer to jump to the folder in cmd ![cmd](readme/cmd.jpg) 3. Move `merged-firmware.bin` into this new folder 4. Connect the display to your computer -5. Execute the command `esptool write_flash 0x0 merged-firmware.bin` +5. Execute the command `esptool write_flash 0x0 merged_firmware.bin` - Don't forget to hold down the boot button on the display -## Building via PlatformIO +## Building & Flashing via PlatformIO -0. Install [Visual Studio Code](https://code.visualstudio.com/) and install the PlatformIO IDE plugin. +0. Install the following tools: + - [Visual Studio Code](https://code.visualstudio.com/) and install the PlatformIO IDE plugin. + - [Git](https://git-scm.com/download/win) 1. Download the source code of CYD-Klipper - This can be done via the `git clone https://github.com/suchmememanyskill/CYD-Klipper` command or via the green `<> Code` button on Github 2. Open the CYD-Klipper folder inside the CYD-Klipper folder in Visual Studio Code @@ -34,4 +43,6 @@ This merged_firmware.bin file is a ready to flash image. Note that flashing this 5. Connect the display to your computer 6. Click 'Upload and Monitor' - This will start compiling the code, and after upload it to the display - - Don't forget to hold the boot button while flashing. The screen will flash when the firmware is attempted to be flashed \ No newline at end of file + - Don't forget to hold the boot button while flashing. The screen will flash when the firmware is attempted to be flashed + +![platformio](readme/platformio.png) \ No newline at end of file diff --git a/ci.py b/ci.py index 8ed1366..b60d48d 100644 --- a/ci.py +++ b/ci.py @@ -7,13 +7,15 @@ CYD_PORTS = [ "esp32-8048S043C-SD", "esp32-2432S024C-SD", "esp32-4827S043C-SD", - "esp32-3248S035C-V" + "esp32-3248S035C-V", + #"esp32-4827S043R-SD", ] BASE_DIR = os.getcwd() def get_manifest(base_path : str, device_name : str): return { "name": f"to {device_name}", + "funding_url": "https://ko-fi.com/suchmememanyskill", "new_install_prompt_erase": True, "builds": [ { diff --git a/readme/platformio.png b/readme/platformio.png new file mode 100644 index 0000000..0c25164 Binary files /dev/null and b/readme/platformio.png differ