mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 05:33:24 +00:00
v1.6.4 (#113)
* 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 <mzuzelka@gmail.com>
This commit is contained in:
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
_site/out/
|
||||||
|
_site/OTA.json
|
||||||
|
_site/esp32-*.json
|
||||||
|
|
||||||
|
pyvenv.cfg
|
||||||
|
bin/
|
||||||
|
out/
|
||||||
|
lib
|
||||||
|
lib64
|
||||||
|
|
||||||
@@ -68,6 +68,7 @@ typedef struct _GLOBAL_CONFIG {
|
|||||||
bool on_during_print : 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 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 disable_m117_messaging : 1;
|
||||||
|
bool sort_macros : 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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};
|
return {(const char**)macros, (unsigned int)macros_count};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "ui_utils.h"
|
#include "ui_utils.h"
|
||||||
#include <Esp.h>
|
#include <Esp.h>
|
||||||
|
#include <UrlEncode.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include "../conf/global_config.h"
|
#include "../conf/global_config.h"
|
||||||
#include "../core/http_client.h"
|
#include "../core/http_client.h"
|
||||||
@@ -10,29 +11,27 @@ static unsigned char * data_png = NULL;
|
|||||||
static char img_filename_path[256] = {0};
|
static char img_filename_path[256] = {0};
|
||||||
static lv_img_dsc_t img_header = {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){
|
if (filename == NULL){
|
||||||
Serial.println("No gcode filename");
|
Serial.println("No gcode filename");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SETUP_HTTP_CLIENT("/server/files/thumbnails?filename=" + String(filename));
|
SETUP_HTTP_CLIENT("/server/files/thumbnails?filename=" + urlEncode(filename));
|
||||||
|
|
||||||
int httpCode = 0;
|
int httpCode = 0;
|
||||||
try {
|
try {
|
||||||
httpCode = client.GET();
|
httpCode = client.GET();
|
||||||
}
|
}
|
||||||
catch (...){
|
catch (...){
|
||||||
Serial.println("Exception while fetching gcode img location");
|
Serial.println("Exception while fetching gcode img location");
|
||||||
return {0};
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpCode == 200)
|
if (httpCode == 200)
|
||||||
{
|
{
|
||||||
String payload = client.getString();
|
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
deserializeJson(doc, payload);
|
deserializeJson(doc, client.getStream());
|
||||||
auto result = doc["result"].as<JsonArray>();
|
auto result = doc["result"].as<JsonArray>();
|
||||||
const char* chosen_thumb = NULL;
|
const char* chosen_thumb = NULL;
|
||||||
|
|
||||||
@@ -58,6 +57,10 @@ bool has_128_128_gcode(const char* filename)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Serial.printf("Failed to fetch gcode image data: %d\n", httpCode);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -71,7 +74,7 @@ lv_obj_t* draw_gcode_img()
|
|||||||
return NULL;
|
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;
|
int httpCode = 0;
|
||||||
try {
|
try {
|
||||||
@@ -121,7 +124,7 @@ lv_obj_t* show_gcode_img(const char* filename)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_128_128_gcode(filename)){
|
if (!has_32_32_gcode_img(filename)){
|
||||||
Serial.println("No 32x32 gcode img found");
|
Serial.println("No 32x32 gcode img found");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
lv_obj_t* show_gcode_img(const char* filename);
|
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();
|
void clear_img_mem();
|
||||||
@@ -30,8 +30,11 @@ static void on_state_change(void * s, lv_msg_t * m){
|
|||||||
else if (printer.state == PRINTER_STATE_ERROR){
|
else if (printer.state == PRINTER_STATE_ERROR){
|
||||||
nav_buttons_setup(PANEL_ERROR);
|
nav_buttons_setup(PANEL_ERROR);
|
||||||
}
|
}
|
||||||
|
else if (printer.state == PRINTER_STATE_IDLE) {
|
||||||
|
nav_buttons_setup(PANEL_FILES);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
nav_buttons_setup(PANEL_PRINT);
|
nav_buttons_setup(PANEL_PROGRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,11 @@ static void update_printer_data_time(lv_event_t * e){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void btn_click_files(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){
|
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);
|
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_clean(lv_scr_act());
|
||||||
lv_obj_clear_flag(lv_scr_act(), LV_OBJ_FLAG_SCROLLABLE);
|
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){
|
if (printer.state > PRINTER_STATE_ERROR){
|
||||||
// Files/Print
|
// Files/Print
|
||||||
|
if (printer.state == PRINTER_STATE_IDLE)
|
||||||
|
{
|
||||||
create_button(LV_SYMBOL_COPY, "Idle", btn_click_files, update_printer_data_time, root_panel);
|
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
|
// 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);
|
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);
|
lv_obj_align(panel, LV_ALIGN_TOP_RIGHT, 0, 0);
|
||||||
|
|
||||||
switch (active_panel){
|
switch (active_panel){
|
||||||
case PANEL_PRINT:
|
case PANEL_FILES:
|
||||||
print_panel_init(panel);
|
files_panel_init(panel);
|
||||||
break;
|
break;
|
||||||
case PANEL_MOVE:
|
case PANEL_MOVE:
|
||||||
move_panel_init(panel);
|
move_panel_init(panel);
|
||||||
@@ -192,6 +203,9 @@ void nav_buttons_setup(unsigned char active_panel){
|
|||||||
case PANEL_CONNECTING:
|
case PANEL_CONNECTING:
|
||||||
connecting_panel_init(panel);
|
connecting_panel_init(panel);
|
||||||
break;
|
break;
|
||||||
|
case PANEL_PROGRESS:
|
||||||
|
progress_panel_init(panel);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_msg_send(DATA_PRINTER_DATA, &printer);
|
lv_msg_send(DATA_PRINTER_DATA, &printer);
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define PANEL_PRINT 0
|
enum PANEL_TYPE {
|
||||||
#define PANEL_MOVE 1
|
PANEL_FILES = 0,
|
||||||
#define PANEL_TEMP 2
|
PANEL_MOVE = 1,
|
||||||
#define PANEL_SETTINGS 3
|
PANEL_TEMP = 2,
|
||||||
#define PANEL_MACROS 4
|
PANEL_SETTINGS = 3,
|
||||||
#define PANEL_STATS 5
|
PANEL_MACROS = 4,
|
||||||
#define PANEL_PRINTER 6
|
PANEL_STATS = 5,
|
||||||
#define PANEL_ERROR 7
|
PANEL_PRINTER = 6,
|
||||||
#define PANEL_CONNECTING 8
|
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();
|
void nav_style_setup();
|
||||||
@@ -23,6 +23,10 @@ static void btn_print_file(lv_event_t * e){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void btn_print_file_verify(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;
|
const auto button_size_mult = 1.3f;
|
||||||
|
|
||||||
lv_obj_t * btn = lv_event_get_target(e);
|
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){
|
void files_panel_init(lv_obj_t* panel){
|
||||||
if (printer.state == PRINTER_STATE_PRINTING || printer.state == PRINTER_STATE_PAUSED){
|
|
||||||
progress_panel_init(panel);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clear_img_mem();
|
clear_img_mem();
|
||||||
|
|
||||||
lv_obj_t * list = lv_list_create(panel);
|
lv_obj_t * list = lv_list_create(panel);
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
void settings_panel_init(lv_obj_t* panel);
|
void settings_panel_init(lv_obj_t* panel);
|
||||||
void temp_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 move_panel_init(lv_obj_t* panel);
|
||||||
void progress_panel_init(lv_obj_t* panel);
|
void progress_panel_init(lv_obj_t* panel);
|
||||||
void macros_panel_init(lv_obj_t* panel);
|
void macros_panel_init(lv_obj_t* panel);
|
||||||
|
|||||||
@@ -110,6 +110,13 @@ static void disable_m117_messaging_switch(lv_event_t* e){
|
|||||||
write_global_config();
|
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){
|
static void rotate_screen_switch(lv_event_t* e){
|
||||||
auto state = lv_obj_get_state(lv_event_get_target(e));
|
auto state = lv_obj_get_state(lv_event_get_target(e));
|
||||||
bool checked = (state & LV_STATE_CHECKED == LV_STATE_CHECKED);
|
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
|
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. Stored per printer."
|
||||||
: "Calls FILAMENT_RETRACT and\nFILAMENT_EXTRUDE in temperature menu\nwhen enabled");
|
: "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)
|
void settings_section_device(lv_obj_t* panel)
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "../ui_utils.h"
|
#include "../ui_utils.h"
|
||||||
#include "../../core/data_setup.h"
|
#include "../../core/data_setup.h"
|
||||||
|
#include "../nav_buttons.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <Esp.h>
|
#include <Esp.h>
|
||||||
|
|
||||||
|
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) {
|
static void set_fan_speed_text(lv_event_t * e) {
|
||||||
lv_obj_t * label = lv_event_get_target(e);
|
lv_obj_t * label = lv_event_get_target(e);
|
||||||
char data[64];
|
char data[64];
|
||||||
@@ -249,6 +254,16 @@ void stats_panel_init(lv_obj_t* panel) {
|
|||||||
lv_layout_flex_column(right_panel, LV_FLEX_ALIGN_CENTER);
|
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);
|
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_fan_speed_text, open_fan_speed_panel);
|
||||||
create_state_button(right_panel, set_zoffset_text, open_zoffset_panel);
|
create_state_button(right_panel, set_zoffset_text, open_zoffset_panel);
|
||||||
create_state_button(right_panel, set_speed_mult_text, open_speed_mult_panel);
|
create_state_button(right_panel, set_speed_mult_text, open_speed_mult_panel);
|
||||||
|
|||||||
13
ci.py
13
ci.py
@@ -10,6 +10,12 @@ CYD_PORTS = [
|
|||||||
"esp32-3248S035C-V",
|
"esp32-3248S035C-V",
|
||||||
#"esp32-4827S043R-SD",
|
#"esp32-4827S043R-SD",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ESP_S3_CHIPS = [
|
||||||
|
"esp32-8048S043C-SD",
|
||||||
|
"esp32-4827S043C-SD",
|
||||||
|
]
|
||||||
|
|
||||||
BASE_DIR = os.getcwd()
|
BASE_DIR = os.getcwd()
|
||||||
|
|
||||||
def get_manifest(base_path : str, device_name : str):
|
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,
|
"new_install_prompt_erase": True,
|
||||||
"builds": [
|
"builds": [
|
||||||
{
|
{
|
||||||
"chipFamily": "ESP32",
|
"chipFamily": "ESP32-S3" if device_name in ESP_S3_CHIPS else "ESP32",
|
||||||
"parts": [
|
"parts": [
|
||||||
{
|
{
|
||||||
"path": f"{base_path}/bootloader.bin",
|
"path": f"{base_path}/bootloader.bin",
|
||||||
@@ -81,7 +87,10 @@ for port in CYD_PORTS:
|
|||||||
add_configuration(port)
|
add_configuration(port)
|
||||||
|
|
||||||
os.chdir(BASE_DIR)
|
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:
|
with open("./_site/OTA.json", "w") as f:
|
||||||
json.dump({"Configurations": configurations}, f)
|
json.dump({"Configurations": configurations}, f)
|
||||||
|
|||||||
Reference in New Issue
Block a user