5 Commits

Author SHA1 Message Date
suchmememanyskill
63ba4a0abb Fixes from atomique 2025-01-25 13:32:11 +01:00
suchmememanyskill
1954cb000e Silence buzzer 2025-01-18 01:43:59 +01:00
suchmememanyskill
6b39cbaf9d Remove brightness adjustment 2025-01-18 01:41:32 +01:00
suchmememanyskill
ebd618b481 Correct screen rotation 2025-01-18 01:35:20 +01:00
suchmememanyskill
1d7414d0ca :) 2025-01-18 01:04:43 +01:00
15 changed files with 48 additions and 488 deletions

View File

@@ -20,7 +20,7 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
@@ -31,7 +31,7 @@ jobs:
# ~/.platformio/.cache # ~/.platformio/.cache
# key: ${{ runner.os }}-pio-cyd-klipper # key: ${{ runner.os }}-pio-cyd-klipper
- uses: actions/setup-python@v5 - uses: actions/setup-python@v4
with: with:
python-version: '3.9' python-version: '3.9'
@@ -43,13 +43,13 @@ jobs:
python3 ci.py python3 ci.py
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v3
with: with:
name: firmware name: firmware
path: ./out path: ./out
- name: Upload GitHub Page Artifact - name: Upload GitHub Page Artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v2
deploy: deploy:
environment: environment:
@@ -65,5 +65,5 @@ jobs:
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
uses: actions/deploy-pages@v4 uses: actions/deploy-pages@v2

View File

@@ -48,8 +48,7 @@
"stdexcept": "cpp", "stdexcept": "cpp",
"streambuf": "cpp", "streambuf": "cpp",
"cinttypes": "cpp", "cinttypes": "cpp",
"typeinfo": "cpp", "typeinfo": "cpp"
"lv_group.h": "c"
}, },
"cmake.configureOnOpen": false "cmake.configureOnOpen": false
} }

View File

@@ -1,127 +0,0 @@
{
"build": {
"arduino": {
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": [
"'-D ARDUINO_ESP32_DEV'",
"'-D ESP32_2432S022C'",
"'-D LCD_WIDTH=240'",
"'-D LCD_HEIGHT=320'",
"'-D LVGL_BUFFER_PIXELS=(LCD_WIDTH*LCD_HEIGHT/8)'",
"'-D LVGL_BUFFER_MALLOC_FLAGS=(MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)'",
"'-D GPIO_BCKL=0'",
"'-D LCD_ST7789_I80'",
"'-D ST7789_I80_BUS_CONFIG_CLK_SRC=LCD_CLK_SRC_PLL160M'",
"'-D ST7789_I80_BUS_CONFIG_DC=16'",
"'-D ST7789_I80_BUS_CONFIG_WR=4'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D8=15'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D9=13'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D10=12'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D11=14'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D12=27'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D13=25'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D14=33'",
"'-D ST7789_I80_BUS_CONFIG_DATA_GPIO_D15=32'",
"'-D ST7789_I80_BUS_CONFIG_BUS_WIDTH=8'",
"'-D ST7789_I80_BUS_CONFIG_MAX_TRANSFER_BYTES=(LVGL_BUFFER_PIXELS * sizeof(lv_color_t))'",
"'-D ST7789_I80_BUS_CONFIG_PSRAM_TRANS_ALIGN=64'",
"'-D ST7789_I80_BUS_CONFIG_SRAM_TRANS_ALIGN=4'",
"'-D ST7789_IO_I80_CONFIG_CS_GPIO_NUM=17'",
"'-D ST7789_IO_I80_CONFIG_PCLK_HZ=12000000'",
"'-D ST7789_IO_I80_CONFIG_TRANS_QUEUE_DEPTH=10'",
"'-D ST7789_IO_I80_CONFIG_LCD_CMD_BITS=8'",
"'-D ST7789_IO_I80_CONFIG_LCD_PARAM_BITS=8'",
"'-D ST7789_IO_I80_CONFIG_DC_LEVELS_DC_IDLE_LEVEL=0'",
"'-D ST7789_IO_I80_CONFIG_DC_LEVELS_DC_CMD_LEVEL=0'",
"'-D ST7789_IO_I80_CONFIG_DC_LEVELS_DC_DUMMY_LEVEL=0'",
"'-D ST7789_IO_I80_CONFIG_DC_LEVELS_DC_DATA_LEVEL=1'",
"'-D ST7789_IO_I80_CONFIG_FLAGS_CS_ACTIVE_HIGH=0'",
"'-D ST7789_IO_I80_CONFIG_FLAGS_REVERSE_COLOR_BITS=0'",
"'-D ST7789_IO_I80_CONFIG_FLAGS_SWAP_COLOR_BYTES=0'",
"'-D ST7789_IO_I80_CONFIG_FLAGS_PCLK_ACTIVE_NEG=0'",
"'-D ST7789_IO_I80_CONFIG_FLAGS_PCLK_IDLE_LOW=0'",
"'-D ST7789_DEV_CONFIG_RESET_GPIO_NUM=GPIO_NUM_NC'",
"'-D ST7789_DEV_CONFIG_COLOR_SPACE=ESP_LCD_COLOR_SPACE_RGB'",
"'-D ST7789_DEV_CONFIG_BITS_PER_PIXEL=16'",
"'-D ST7789_DEV_CONFIG_FLAGS_RESET_ACTIVE_HIGH=false'",
"'-D ST7789_DEV_CONFIG_VENDOR_CONFIG=NULL'",
"'-D ST7789_RD_GPIO=2'",
"'-D LCD_SWAP_XY=false'",
"'-D LCD_MIRROR_X=false'",
"'-D LCD_MIRROR_Y=false'",
"'-D BOARD_HAS_TOUCH'",
"'-D TOUCH_CST816S_I2C'",
"'-D CST816S_I2C_HOST=I2C_NUM_0'",
"'-D CST816S_I2C_CONFIG_SDA_IO_NUM=21'",
"'-D CST816S_I2C_CONFIG_SCL_IO_NUM=22'",
"'-D CST816S_I2C_CONFIG_SDA_PULLUP_EN=GPIO_PULLUP_ENABLE'",
"'-D CST816S_I2C_CONFIG_SCL_PULLUP_EN=GPIO_PULLUP_ENABLE'",
"'-D CST816S_I2C_CONFIG_MASTER_CLK_SPEED=400000'",
"'-D CST816S_I2C_CONFIG_CLK_FLAGS=0'",
"'-D CST816S_IO_I2C_CONFIG_DEV_ADDR=ESP_LCD_TOUCH_IO_I2C_CST816S_ADDRESS'",
"'-D CST816S_IO_I2C_CONFIG_CONTROL_PHASE_BYTES=1'",
"'-D CST816S_IO_I2C_CONFIG_DC_BIT_OFFSET=0'",
"'-D CST816S_IO_I2C_CONFIG_LCD_CMD_BITS=8'",
"'-D CST816S_IO_I2C_CONFIG_LCD_PARAM_BITS=0'",
"'-D CST816S_IO_I2C_CONFIG_FLAGS_DC_LOW_ON_DATA=false'",
"'-D CST816S_IO_I2C_CONFIG_FLAGS_DISABLE_CONTROL_PHASE=true'",
"'-D CST816S_TOUCH_CONFIG_X_MAX=LCD_WIDTH'",
"'-D CST816S_TOUCH_CONFIG_Y_MAX=LCD_HEIGHT'",
"'-D CST816S_TOUCH_CONFIG_RST_GPIO_NUM=GPIO_NUM_NC'",
"'-D CST816S_TOUCH_CONFIG_INT_GPIO_NUM=GPIO_NUM_NC'",
"'-D CST816S_TOUCH_CONFIG_LEVELS_RESET=0'",
"'-D CST816S_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=5'",
"'-D TF_SPI_MOSI=23'",
"'-D TF_SPI_SCLK=18'",
"'-D TF_SPI_MISO=19'",
"'-D BOARD_HAS_SPEAK'",
"'-D SPEAK=26'",
"-DCYD_SCREEN_GAP_PX=8",
"-DCYD_SCREEN_MIN_BUTTON_HEIGHT_PX=35",
"-DCYD_SCREEN_MIN_BUTTON_WIDTH_PX=35",
"-DCYD_SCREEN_VERTICAL=1",
"-DCYD_SCREEN_FONT=lv_font_montserrat_14",
"-DCYD_SCREEN_FONT_SMALL=lv_font_montserrat_10",
"-DCYD_SCREEN_SIDEBAR_SIZE_PX=40",
"-DCYD_SCREEN_DRIVER_ESP32_SMARTDISPLAY=1",
"-DCYD_SCREEN_DISABLE_TOUCH_CALIBRATION=1",
"-DCYD_SCREEN_DISABLE_INVERT_COLORS=1"
],
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"mcu": "esp32",
"variant": "esp32"
},
"connectivity": [
"wifi",
"bluetooth",
"ethernet",
"can"
],
"debug": {
"openocd_board": "esp-wroom-32.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "esp32-2432S022C-V",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://www.aliexpress.com/item/1005006284154750.html",
"vendor": "Sunton"
}

View File

@@ -84,7 +84,7 @@ board = esp32-3248S035C-smartdisplay
board = esp32-4827S043C-smartdisplay board = esp32-4827S043C-smartdisplay
[env:esp32-4827S043R-SD] [env:esp32-4827S043R-SD]
board = esp32-4827S043R-smartdisplay board = esp32-4827S043C-smartdisplay
[env:esp32-8048S043C-SD] [env:esp32-8048S043C-SD]
board = esp32-8048S043C-smartdisplay board = esp32-8048S043C-smartdisplay
@@ -92,9 +92,6 @@ board = esp32-8048S043C-smartdisplay
[env:esp32-8048S043C-SD-alt] [env:esp32-8048S043C-SD-alt]
board = esp32-8048S043C-smartdisplay-alt board = esp32-8048S043C-smartdisplay-alt
[env:esp32-2432S022C-SD-V]
board = esp32-2432S022C-vertical
[env:esp32-CROWPANEL-28R] [env:esp32-CROWPANEL-28R]
board = esp32-CROWPANEL-28R board = esp32-CROWPANEL-28R
lib_deps = lib_deps =
@@ -116,4 +113,3 @@ lib_deps =
plageoj/UrlEncode@^1.0.1 plageoj/UrlEncode@^1.0.1
knolleary/PubSubClient@^2.8 knolleary/PubSubClient@^2.8
WiFiClientSecure WiFiClientSecure

View File

@@ -18,8 +18,6 @@ void KlipperPrinter::parse_state(JsonDocument &in)
const char *state = status["webhooks"]["state"]; const char *state = status["webhooks"]["state"];
const char *message = status["webhooks"]["state_message"]; const char *message = status["webhooks"]["state_message"];
if (state != NULL)
{
if (strcmp(state, "ready") == 0 && printer_data.state == PrinterStateError) if (strcmp(state, "ready") == 0 && printer_data.state == PrinterStateError)
{ {
printer_data.state = PrinterStateIdle; printer_data.state = PrinterStateIdle;
@@ -28,7 +26,6 @@ void KlipperPrinter::parse_state(JsonDocument &in)
{ {
printer_data.state = PrinterStateError; printer_data.state = PrinterStateError;
} }
}
if (message != NULL && (printer_data.state_message == NULL || strcmp(printer_data.state_message, message))) if (message != NULL && (printer_data.state_message == NULL || strcmp(printer_data.state_message, message)))
{ {
@@ -59,12 +56,6 @@ void KlipperPrinter::parse_state(JsonDocument &in)
{ {
const char *homed_axis = status["toolhead"]["homed_axes"]; const char *homed_axis = status["toolhead"]["homed_axes"];
printer_data.homed_axis = strcmp(homed_axis, "xyz") == 0; printer_data.homed_axis = strcmp(homed_axis, "xyz") == 0;
for (int i = 0; i < 3; i++)
{
printer_data.position_min[i] = status["toolhead"]["axis_minimum"][i];
printer_data.position_max[i] = status["toolhead"]["axis_maximum"][i];
}
} }
if (status.containsKey("gcode_move")) if (status.containsKey("gcode_move"))

View File

@@ -82,8 +82,6 @@ typedef struct _PrinterData {
float temperatures[10]; float temperatures[10];
float target_temperatures[10]; float target_temperatures[10];
float position[3]; float position[3];
float position_min[3];
float position_max[3];
float elapsed_time_s; float elapsed_time_s;
float printed_time_s; float printed_time_s;
float remaining_time_s; float remaining_time_s;

View File

@@ -375,8 +375,6 @@ void show_ip_entry()
lv_textarea_set_placeholder_text(host_entry, "Printer IP"); lv_textarea_set_placeholder_text(host_entry, "Printer IP");
lv_textarea_set_placeholder_text(port_entry, "Access code"); lv_textarea_set_placeholder_text(port_entry, "Access code");
lv_textarea_set_placeholder_text(auth_entry, "Printer serial number"); lv_textarea_set_placeholder_text(auth_entry, "Printer serial number");
lv_obj_clear_flag(auth_entry, LV_OBJ_FLAG_USER_2);
lv_obj_add_flag(auth_entry, LV_OBJ_FLAG_USER_3);
break; break;
case PrinterType::PrinterTypeOctoprint: case PrinterType::PrinterTypeOctoprint:
lv_obj_clear_flag(auth_entry, LV_OBJ_FLAG_USER_2); lv_obj_clear_flag(auth_entry, LV_OBJ_FLAG_USER_2);

View File

@@ -344,24 +344,18 @@ static void root_panel_state_update(lv_event_t * e){
if (last_homing_state == get_current_printer_data()->homed_axis) if (last_homing_state == get_current_printer_data()->homed_axis)
return; return;
PrinterType printer_type = get_current_printer()->printer_config->printer_type;
bool is_klipper = printer_type == PrinterTypeKlipper || printer_type == PrinterTypeKlipperSerial;
lv_obj_t * panel = lv_event_get_target(e); lv_obj_t * panel = lv_event_get_target(e);
last_homing_state = get_current_printer_data()->homed_axis; last_homing_state = get_current_printer_data()->homed_axis;
lv_obj_clean(panel); lv_obj_clean(panel);
if (get_current_printer_data()->homed_axis && is_klipper) if (get_current_printer_data()->homed_axis)
move_panel_slider_init(panel);
else if (get_current_printer_data()->homed_axis)
root_panel_steppers_locked(panel); root_panel_steppers_locked(panel);
else else
root_panel_steppers_unlocked(panel); root_panel_steppers_unlocked(panel);
} }
void move_panel_init(lv_obj_t* panel) void move_panel_init(lv_obj_t* panel){
{
if (get_current_printer_data()->state == PrinterState::PrinterStatePrinting){ if (get_current_printer_data()->state == PrinterState::PrinterStatePrinting){
stats_panel_init(panel); stats_panel_init(panel);
return; return;

View File

@@ -1,257 +0,0 @@
#include "panel.h"
#include "lvgl.h"
#include "../../core/data_setup.h"
#include "../nav_buttons.h"
#include "../ui_utils.h"
#include "../../core/printer_integration.hpp"
#include "../../core/current_printer.h"
static void line_custom_set(const char * axis, const char *text)
{
float pos = atof(text);
if (pos < 0 || pos > 500)
return;
current_printer_move_printer(axis, pos, false);
}
static void x_line_custom_callback(lv_event_t * e)
{
const char * text = lv_textarea_get_text(lv_event_get_target(e));
line_custom_set("X", text);
}
static void y_line_custom_callback(lv_event_t * e)
{
const char * text = lv_textarea_get_text(lv_event_get_target(e));
line_custom_set("Y", text);
}
static void z_line_custom_callback(lv_event_t * e)
{
const char * text = lv_textarea_get_text(lv_event_get_target(e));
line_custom_set("Z", text);
}
static void x_line_custom(lv_event_t * e)
{
lv_create_keyboard_text_entry(x_line_custom_callback, "Set X position", LV_KEYBOARD_MODE_NUMBER, LV_PCT(75), 6);
}
static void y_line_custom(lv_event_t * e)
{
lv_create_keyboard_text_entry(y_line_custom_callback, "Set Y position", LV_KEYBOARD_MODE_NUMBER, LV_PCT(75), 6);
}
static void z_line_custom(lv_event_t * e)
{
lv_create_keyboard_text_entry(z_line_custom_callback, "Set Z position", LV_KEYBOARD_MODE_NUMBER, LV_PCT(75), 6);
}
static void pos_update(lv_event_t * e, const char* target_template, float target)
{
lv_obj_t* obj = lv_event_get_target(e);
lv_obj_t* slider = (lv_obj_t*)lv_event_get_user_data(e);
if (lv_slider_is_dragged(slider))
{
return;
}
if (lv_obj_check_type(obj, &lv_label_class))
{
char pos_buff[12];
sprintf(pos_buff, target_template, target);
lv_label_set_text(obj, pos_buff);
}
else
{
lv_slider_set_value(obj, target, LV_ANIM_ON);
}
}
static void x_pos_update(lv_event_t * e)
{
pos_update(e, "%.1f " LV_SYMBOL_EDIT, get_current_printer_data()->position[0]);
}
static void y_pos_update(lv_event_t * e)
{
pos_update(e, "%.1f", get_current_printer_data()->position[1]);
}
static void z_pos_update(lv_event_t * e)
{
pos_update(e, "%.2f", get_current_printer_data()->position[2]);
}
static void x_slider_update(lv_event_t * e)
{
current_printer_move_printer("X", lv_slider_get_value(lv_event_get_target(e)), false);
}
static void y_slider_update(lv_event_t * e)
{
current_printer_move_printer("Y", lv_slider_get_value(lv_event_get_target(e)), false);
}
static void z_slider_update(lv_event_t * e)
{
current_printer_move_printer("Z", lv_slider_get_value(lv_event_get_target(e)), false);
}
static void home_button_click(lv_event_t * e)
{
current_printer_execute_feature(PrinterFeatures::PrinterFeatureHome);
}
static void disable_steppers_button_click(lv_event_t * e)
{
current_printer_execute_feature(PrinterFeatures::PrinterFeatureDisableSteppers);
}
static void set_label_slider_position(lv_event_t * e)
{
lv_obj_t* slider = lv_event_get_target(e);
lv_obj_t* label = (lv_obj_t*)lv_event_get_user_data(e);
if (lv_slider_is_dragged(slider))
{
lv_label_set_text_fmt(label, "%d", lv_slider_get_value(slider));
}
}
static void switch_to_params_panel_button_click(lv_event_t * e)
{
lv_obj_t * panel = lv_event_get_target(e);
nav_buttons_setup(PANEL_STATS);
}
static void make_vertical_slider(
lv_obj_t* parent,
const char* axis,
lv_event_cb_t position_change,
lv_event_cb_t on_slider_change,
lv_event_cb_t on_edit,
float min,
float max)
{
lv_obj_t* root = lv_create_empty_panel(parent);
lv_layout_flex_column(root);
lv_obj_set_size(root, CYD_SCREEN_MIN_BUTTON_WIDTH_PX * 1.5, LV_PCT(100));
lv_obj_set_style_pad_column(root, 10, 0);
lv_obj_clear_flag(root, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_t* sub_root = lv_create_empty_panel(root);
lv_layout_flex_column(sub_root);
lv_obj_set_height(sub_root, LV_SIZE_CONTENT);
lv_obj_add_flag(sub_root, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(sub_root, on_edit, LV_EVENT_CLICKED, NULL);
lv_obj_t* top_label = lv_label_create(sub_root);
lv_msg_subsribe_obj(DATA_PRINTER_DATA, top_label, NULL);
lv_obj_t* one_below_label = lv_label_create(sub_root);
lv_label_set_text(one_below_label, LV_SYMBOL_EDIT);
lv_obj_t* two_below_label = lv_label_create(sub_root);
lv_label_set_text_fmt(two_below_label, "%s+", axis);
lv_obj_t* slider = lv_slider_create(root);
lv_obj_set_flex_grow(slider, 1);
lv_obj_set_width(slider, CYD_SCREEN_MIN_BUTTON_WIDTH_PX / 2);
lv_slider_set_range(slider, min, max);
lv_obj_add_event_cb(slider, on_slider_change, LV_EVENT_RELEASED, NULL);
lv_obj_add_event_cb(slider, position_change, LV_EVENT_MSG_RECEIVED, slider);
lv_obj_add_event_cb(slider, set_label_slider_position, LV_EVENT_VALUE_CHANGED, top_label);
lv_msg_subsribe_obj(DATA_PRINTER_DATA, slider, NULL);
lv_obj_t* last_label = lv_label_create(root);
lv_label_set_text_fmt(last_label, "%s-", axis);
lv_obj_add_event_cb(top_label, position_change, LV_EVENT_MSG_RECEIVED, slider);
}
/* TODO: Make vertical button row with +1, +0.1, -0.1, -1, maybe with MAX - 30 */
static void make_horizontal_slider(
lv_obj_t* parent,
const char* axis,
lv_event_cb_t position_change,
lv_event_cb_t on_slider_change,
lv_event_cb_t on_edit,
float min,
float max)
{
lv_obj_t* root = lv_create_empty_panel(parent);
lv_layout_flex_column(root);
lv_obj_set_size(root, LV_PCT(100), LV_SIZE_CONTENT);
lv_obj_t* upper = lv_create_empty_panel(root);
lv_layout_flex_row(upper, LV_FLEX_ALIGN_SPACE_BETWEEN);
lv_obj_set_size(upper, LV_PCT(100), LV_SIZE_CONTENT);
lv_obj_add_flag(upper, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(upper, on_edit, LV_EVENT_CLICKED, NULL);
lv_obj_t* left_label = lv_label_create(upper);
lv_label_set_text_fmt(left_label, "%s-", axis);
lv_obj_t* position_label = lv_label_create(upper);
lv_msg_subsribe_obj(DATA_PRINTER_DATA, position_label, NULL);
lv_obj_t* right_label = lv_label_create(upper);
lv_label_set_text_fmt(right_label, "%s+", axis);
lv_obj_t* slider = lv_slider_create(root);
lv_obj_set_size(slider, LV_PCT(100), CYD_SCREEN_MIN_BUTTON_HEIGHT_PX / 2);
lv_slider_set_range(slider, min, max);
lv_obj_add_event_cb(slider, on_slider_change, LV_EVENT_RELEASED, NULL);
lv_obj_add_event_cb(slider, position_change, LV_EVENT_MSG_RECEIVED, slider);
lv_obj_add_event_cb(slider, set_label_slider_position, LV_EVENT_VALUE_CHANGED, position_label);
lv_msg_subsribe_obj(DATA_PRINTER_DATA, slider, NULL);
lv_obj_set_style_pad_bottom(root, 10, 0);
lv_obj_set_style_pad_bottom(upper, 10, 0);
lv_obj_set_style_pad_column(upper, 10, 0);
lv_obj_add_event_cb(position_label, position_change, LV_EVENT_MSG_RECEIVED, slider);
}
static void create_button(lv_obj_t* parent, lv_event_cb_t on_click, const char* text)
{
lv_obj_t* btn = lv_btn_create(parent);
lv_obj_set_width(btn, LV_PCT(100));
lv_obj_set_flex_grow(btn, 1);
lv_obj_add_event_cb(btn, on_click, LV_EVENT_CLICKED, NULL);
lv_obj_t* label = lv_label_create(btn);
lv_obj_center(label);
lv_label_set_text(label, text);
}
void move_panel_slider_init(lv_obj_t* panel)
{
lv_obj_t * sub_panel = lv_create_empty_panel(panel);
lv_obj_set_size(sub_panel, LV_PCT(100), LV_PCT(100));
lv_layout_flex_row(sub_panel);
lv_obj_t* left = lv_create_empty_panel(sub_panel);
lv_layout_flex_column(left);
lv_obj_set_flex_grow(left, 1);
lv_obj_set_height(left, LV_PCT(100));
float* position_min = get_current_printer_data()->position_min;
float* position_max = get_current_printer_data()->position_max;
make_horizontal_slider(left, "X", x_pos_update, x_slider_update, x_line_custom, position_min[0], position_max[0]);
make_vertical_slider(sub_panel, "Y", y_pos_update, y_slider_update, y_line_custom, position_min[1], position_max[1]);
make_vertical_slider(sub_panel, "Z", z_pos_update, z_slider_update, z_line_custom, position_min[2], position_max[2]);
create_button(left, home_button_click, LV_SYMBOL_HOME " Home XYZ");
create_button(left, disable_steppers_button_click, LV_SYMBOL_EYE_CLOSE " Free Motors");
create_button(left, switch_to_params_panel_button_click, LV_SYMBOL_SETTINGS " Parameters");
lv_obj_set_style_pad_right(left, 10, 0);
lv_obj_set_style_pad_all(sub_panel, 10, 0);
}

View File

@@ -12,6 +12,5 @@ void stats_panel_init(lv_obj_t* panel);
void printer_panel_init(lv_obj_t* panel); void printer_panel_init(lv_obj_t* panel);
void error_panel_init(lv_obj_t* panel); void error_panel_init(lv_obj_t* panel);
void connecting_panel_init(lv_obj_t* panel); void connecting_panel_init(lv_obj_t* panel);
void move_panel_slider_init(lv_obj_t* panel);
void settings_section_device(lv_obj_t* panel); void settings_section_device(lv_obj_t* panel);

View File

@@ -2,10 +2,9 @@
[![Donations](https://img.shields.io/badge/Support%20on-Ko--Fi-red)](https://ko-fi.com/suchmememanyskill) [![Donations](https://img.shields.io/badge/Support%20on-Ko--Fi-red)](https://ko-fi.com/suchmememanyskill)
# CYD-Klipper # CYD-Klipper
An implementation of a wireless Klipper, Bambu and Octoprint status display on an ESP32 + screen. Uses Moonraker to fetch data. An implementation of a wireless Klipper status display on an ESP32 + screen. Uses Moonraker to fetch data.
A simple and cheap solution to use a dedicated screen with Klipper, a 3d printing Firmware. A simple and cheap solution to use a dedicated screen with Klipper, a 3d printing Firmware.
Also now with Bambu Lab and Octoprint printers!
![showcase_image](readme/PXL_20231113_171629383.jpg) ![showcase_image](readme/PXL_20231113_171629383.jpg)
@@ -25,8 +24,6 @@ A ESP32-2432S028R is required to run this project. You can find out where to buy
- Toggle Moonraker power devices - Toggle Moonraker power devices
- OTA updates - OTA updates
- Serial console over USB (115200 8n1, echo off, LF/LF) - Serial console over USB (115200 8n1, echo off, LF/LF)
- Control Klipper, Octoprint and Bambu printers.
- Wired Serial/Usb Klipper connection
### Install ### Install

View File

@@ -71,7 +71,7 @@
<body> <body>
<section class="main"> <section class="main">
<h2>CYD-Klipper <span class="iconify" data-icon="mdi-printer-3d" style="color: #F44;"></span></h2> <h2>CYD-Klipper <span class="iconify" data-icon="mdi-printer-3d" style="color: #F44;"></span></h2>
<p>An implementation of a wireless Klipper, Bambu and Octoprint status display on an ESP32 + screen.<br>Uses Moonraker to fetch data.<br><a href="https://github.com/suchmememanyskill/CYD-Klipper">Source code is available on GitHub</a>.</p> <p>An implementation of a Klipper status display on an ESP32 + screen.<br>Uses Moonraker to fetch data.<br><a href="https://github.com/suchmememanyskill/CYD-Klipper">Source code is available on GitHub</a>.</p>
<section class="changelog"> <section class="changelog">
<h3 id="changelog-header"><span class="iconify" data-icon="mdi-hammer-wrench" style="color: lightgray;"></span> Changelog <span id="changelog-header-version"></span></h3> <h3 id="changelog-header"><span class="iconify" data-icon="mdi-hammer-wrench" style="color: lightgray;"></span> Changelog <span id="changelog-header-version"></span></h3>
@@ -101,7 +101,6 @@
<option value="esp32-8048S043C-SD">ESP32-8048S043 (4.3" 800x480 Capacitive)</option> <option value="esp32-8048S043C-SD">ESP32-8048S043 (4.3" 800x480 Capacitive)</option>
<option value="esp32-8048S043C-SD-alt">ESP32-8048S043 Alt (4.3" 800x480 Capacitive)</option> <option value="esp32-8048S043C-SD-alt">ESP32-8048S043 Alt (4.3" 800x480 Capacitive)</option>
<option value="esp32-CROWPANEL-28R">ESP32-CROWPANEL-28R (2.8" Resistive)</option> <option value="esp32-CROWPANEL-28R">ESP32-CROWPANEL-28R (2.8" Resistive)</option>
<option value="esp32-CROWPANEL-35C">ESP32-CROWPANEL-35C (3.5" Capacitive)</option>
</select> </select>
<span id="install-btn"></span> <span id="install-btn"></span>
</section> </section>

10
ci.py
View File

@@ -34,19 +34,19 @@ def get_manifest(base_path : str, device_name : str):
"parts": [ "parts": [
{ {
"path": f"{base_path}/bootloader.bin", "path": f"{base_path}/bootloader.bin",
"offset": 0 if device_name in ESP_S3_CHIPS else 0x1000 "offset": 4096
}, },
{ {
"path": f"{base_path}/partitions.bin", "path": f"{base_path}/partitions.bin",
"offset": 0x8000 "offset": 32768
}, },
{ {
"path": f"{base_path}/boot_app0.bin", "path": f"{base_path}/boot_app0.bin",
"offset": 0xe000 "offset": 57344
}, },
{ {
"path": f"{base_path}/firmware.bin", "path": f"{base_path}/firmware.bin",
"offset": 0x10000 "offset": 65536
} }
] ]
} }
@@ -83,7 +83,7 @@ for port in CYD_PORTS:
shutil.copy(os.path.join(os.path.expanduser("~"), ".platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin"), f"{port_path}/boot_app0.bin") shutil.copy(os.path.join(os.path.expanduser("~"), ".platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin"), f"{port_path}/boot_app0.bin")
os.chdir(port_path) os.chdir(port_path)
if (port in ESP_S3_CHIPS): if (port in ESP_S3_CHIPS):
subprocess.run(["python3", "-m", "esptool", "--chip", "esp32s3", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "dio", "--flash_freq", "80m", "--flash_size", "16MB", "0x0000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True) subprocess.run(["python3", "-m", "esptool", "--chip", "esp32s3", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "qio", "--flash_freq", "80m", "--flash_size", "16MB", "0x1000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True)
else: else:
subprocess.run(["python3", "-m", "esptool", "--chip", "esp32", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "dio", "--flash_freq", "40m", "--flash_size", "4MB", "0x1000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True) subprocess.run(["python3", "-m", "esptool", "--chip", "esp32", "merge_bin", "-o", "merged_firmware.bin", "--flash_mode", "dio", "--flash_freq", "40m", "--flash_size", "4MB", "0x1000", "bootloader.bin", "0x8000", "partitions.bin", "0xe000", "boot_app0.bin", "0x10000", "firmware.bin"], check=True)

View File

@@ -1,21 +1,8 @@
#!/bin/bash #!/bin/bash
if [ "$EUID" -eq 0 ]; then if [ "$EUID" -eq 0 ]; then
read -r -p "Are you sure you want to run this service as root? [y/N] " response echo "Please do not run as root"
response=${response,,} # tolower
if ! [[ "$response" =~ ^(yes|y)$ ]]; then
exit exit
fi
SERVICE_PATH="/etc/systemd/system/cyd-klipper-serial.service"
else
echo "Are you sure you want to run this service as the current user?"
read -r -p "Make sure this user is logged in at boot! [y/N] " response
response=${response,,} # tolower
if ! [[ "$response" =~ ^(yes|y)$ ]]; then
exit
fi
mkdir -p ~/.config/systemd/user
SERVICE_PATH="$HOME/.config/systemd/user/cyd-klipper-serial.service"
fi fi
set -e set -e
@@ -28,26 +15,20 @@ source ./env/bin/activate
pip3 install -r requirements.txt pip3 install -r requirements.txt
# Create systemd unit file # Create systemd unit file
mkdir -p ~/.config/systemd/user
echo "[Unit]" > $SERVICE_PATH echo "[Unit]" > ~/.config/systemd/user/cyd-klipper-serial.service
echo "Description=CYD Klipper serial server" >> $SERVICE_PATH echo "Description=CYD Klipper serial server" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "After=network.target" >> $SERVICE_PATH echo "After=network.target" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "" >> $SERVICE_PATH echo "" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "[Service]" >> $SERVICE_PATH echo "[Service]" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "ExecStart=$(pwd)/run.sh" >> $SERVICE_PATH echo "ExecStart=$(pwd)/run.sh" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "WorkingDirectory=$(pwd)" >> $SERVICE_PATH echo "WorkingDirectory=$(pwd)" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "Restart=always" >> $SERVICE_PATH echo "Restart=always" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "" >> $SERVICE_PATH echo "" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "[Install]" >> $SERVICE_PATH echo "[Install]" >> ~/.config/systemd/user/cyd-klipper-serial.service
echo "WantedBy=multi-user.target" >> $SERVICE_PATH echo "WantedBy=multi-user.target" >> ~/.config/systemd/user/cyd-klipper-serial.service
# Start the service # Start the service
if [ "$EUID" -eq 0 ]; then systemctl --user daemon-reload
systemctl daemon-reload systemctl --user enable cyd-klipper-serial
systemctl enable cyd-klipper-serial systemctl --user start cyd-klipper-serial
systemctl start cyd-klipper-serial
else
systemctl --user daemon-reload
systemctl --user enable cyd-klipper-serial
systemctl --user start cyd-klipper-serial
fi

View File

@@ -1,21 +1,13 @@
#!/bin/bash #!/bin/bash
set -e
if [ "$EUID" -eq 0 ]; then if [ "$EUID" -eq 0 ]; then
systemctl stop cyd-klipper-serial echo "Please do not run as root"
systemctl disable cyd-klipper-serial exit
rm /etc/systemd/system/cyd-klipper-serial.service
systemctl daemon-reload
else
systemctl --user stop cyd-klipper-serial
systemctl --user disable cyd-klipper-serial
rm ~/.config/systemd/user/cyd-klipper-serial.service
systemctl --user daemon-reload
fi fi
rm -rf ./env systemctl --user stop cyd-klipper-serial
systemctl --user disable cyd-klipper-serial
rm ~/.config/systemd/user/cyd-klipper-serial.service
systemctl --user daemon-reload