mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 21:53:24 +00:00
Compare commits
14 Commits
atomique-d
...
v2.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6b5d17f6a | ||
|
|
d8a9b13fe1 | ||
|
|
fbc2964ad8 | ||
|
|
d616ef5a6d | ||
|
|
9bfbb1cb0e | ||
|
|
8d8e36fde9 | ||
|
|
4e3cd69b63 | ||
|
|
3aeb67cfdd | ||
|
|
8f46b9972d | ||
|
|
5756b31744 | ||
|
|
99b70622fe | ||
|
|
b3d405b355 | ||
|
|
9a96f9336f | ||
|
|
5c46764c7c |
10
.github/workflows/compile.yaml
vendored
10
.github/workflows/compile.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
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@v4
|
- uses: actions/setup-python@v5
|
||||||
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@v3
|
uses: actions/upload-artifact@v4
|
||||||
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@v2
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
|
||||||
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@v2
|
uses: actions/deploy-pages@v4
|
||||||
|
|
||||||
127
CYD-Klipper/boards/esp32-2432S022C-vertical.json
Normal file
127
CYD-Klipper/boards/esp32-2432S022C-vertical.json
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
55
CYD-Klipper/boards/esp32-CROWPANEL-35C.json
Normal file
55
CYD-Klipper/boards/esp32-CROWPANEL-35C.json
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino": {
|
||||||
|
"ldscript": "esp32s3_out.ld",
|
||||||
|
"partitions": "default_16MB.csv",
|
||||||
|
"memory_type": "qio_opi"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": [
|
||||||
|
"-DCYD_SCREEN_HEIGHT_PX=320",
|
||||||
|
"-DCYD_SCREEN_WIDTH_PX=480",
|
||||||
|
"-DCYD_SCREEN_GAP_PX=10",
|
||||||
|
"-DCYD_SCREEN_MIN_BUTTON_HEIGHT_PX=45",
|
||||||
|
"-DCYD_SCREEN_MIN_BUTTON_WIDTH_PX=45",
|
||||||
|
"-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_CROWPANEL_35C=1",
|
||||||
|
"-DCYD_SCREEN_DISABLE_TOUCH_CALIBRATION=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-8048S043C-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.elecrow.com/esp-terminal-with-esp32-3-5-inch-parallel-480x320-tft-capacitive-touch-display-rgb-by-chip-ili9488.html",
|
||||||
|
"vendor": "CROWPANEL"
|
||||||
|
}
|
||||||
@@ -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-4827S043C-smartdisplay
|
board = esp32-4827S043R-smartdisplay
|
||||||
|
|
||||||
[env:esp32-8048S043C-SD]
|
[env:esp32-8048S043C-SD]
|
||||||
board = esp32-8048S043C-smartdisplay
|
board = esp32-8048S043C-smartdisplay
|
||||||
@@ -92,6 +92,9 @@ 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 =
|
||||||
@@ -102,3 +105,15 @@ lib_deps =
|
|||||||
plageoj/UrlEncode@^1.0.1
|
plageoj/UrlEncode@^1.0.1
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
WiFiClientSecure
|
WiFiClientSecure
|
||||||
|
|
||||||
|
[env:esp32-CROWPANEL-35C]
|
||||||
|
board = esp32-CROWPANEL-35C
|
||||||
|
lib_deps =
|
||||||
|
SPI
|
||||||
|
https://github.com/suchmememanyskill/lvgl
|
||||||
|
https://github.com/lovyan03/LovyanGFX@1.2.0
|
||||||
|
bblanchon/ArduinoJson@^7.0.0
|
||||||
|
plageoj/UrlEncode@^1.0.1
|
||||||
|
knolleary/PubSubClient@^2.8
|
||||||
|
WiFiClientSecure
|
||||||
|
|
||||||
|
|||||||
183
CYD-Klipper/src/core/device/ESP32-CROWPANEL-35C.cpp
Normal file
183
CYD-Klipper/src/core/device/ESP32-CROWPANEL-35C.cpp
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
// Adapted from https://github.com/OzInFl/Elecrow-3.5-RGB-TFT-SQUARELINE-EXAMPLE
|
||||||
|
|
||||||
|
#ifdef CYD_SCREEN_DRIVER_ESP32_CROWPANEL_35C
|
||||||
|
#include "../screen_driver.h"
|
||||||
|
#include "lvgl.h"
|
||||||
|
#include "../../conf/global_config.h"
|
||||||
|
#include <LovyanGFX.hpp>
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
#ifdef CYD_SCREEN_VERTICAL
|
||||||
|
#error "Vertical screen not supported with the ESP32_CROWPANEL_28R driver"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static lv_disp_draw_buf_t draw_buf;
|
||||||
|
static lv_color_t buf[CYD_SCREEN_HEIGHT_PX * CYD_SCREEN_WIDTH_PX / 10];
|
||||||
|
|
||||||
|
#define BUZZER_PIN 20
|
||||||
|
#define LCD_BL 46
|
||||||
|
#define SDA_FT6236 38
|
||||||
|
#define SCL_FT6236 39
|
||||||
|
#define I2C_TOUCH_ADDR 0x38
|
||||||
|
|
||||||
|
class LGFX : public lgfx::LGFX_Device
|
||||||
|
{
|
||||||
|
lgfx::Panel_ILI9488 _panel_instance;
|
||||||
|
lgfx::Bus_Parallel16 _bus_instance;
|
||||||
|
lgfx::Touch_FT5x06 _touch_instance;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LGFX()
|
||||||
|
{
|
||||||
|
auto bus_cfg = _bus_instance.config();
|
||||||
|
bus_cfg.port = 0;
|
||||||
|
bus_cfg.freq_write = 80000000;
|
||||||
|
bus_cfg.pin_wr = 18;
|
||||||
|
bus_cfg.pin_rd = 48;
|
||||||
|
bus_cfg.pin_rs = 45;
|
||||||
|
bus_cfg.pin_d0 = 47;
|
||||||
|
bus_cfg.pin_d1 = 21;
|
||||||
|
bus_cfg.pin_d2 = 14;
|
||||||
|
bus_cfg.pin_d3 = 13;
|
||||||
|
bus_cfg.pin_d4 = 12;
|
||||||
|
bus_cfg.pin_d5 = 11;
|
||||||
|
bus_cfg.pin_d6 = 10;
|
||||||
|
bus_cfg.pin_d7 = 9;
|
||||||
|
bus_cfg.pin_d8 = 3;
|
||||||
|
bus_cfg.pin_d9 = 8;
|
||||||
|
bus_cfg.pin_d10 = 16;
|
||||||
|
bus_cfg.pin_d11 = 15;
|
||||||
|
bus_cfg.pin_d12 = 7;
|
||||||
|
bus_cfg.pin_d13 = 6;
|
||||||
|
bus_cfg.pin_d14 = 5;
|
||||||
|
bus_cfg.pin_d15 = 4;
|
||||||
|
_bus_instance.config(bus_cfg);
|
||||||
|
_panel_instance.setBus(&_bus_instance);
|
||||||
|
|
||||||
|
auto panel_cfg = _panel_instance.config();
|
||||||
|
panel_cfg.pin_cs = -1;
|
||||||
|
panel_cfg.pin_rst = -1;
|
||||||
|
panel_cfg.pin_busy = -1;
|
||||||
|
panel_cfg.memory_width = 320;
|
||||||
|
panel_cfg.memory_height = 480;
|
||||||
|
panel_cfg.panel_width = 320;
|
||||||
|
panel_cfg.panel_height = 480;
|
||||||
|
panel_cfg.offset_x = 0;
|
||||||
|
panel_cfg.offset_y = 0;
|
||||||
|
panel_cfg.offset_rotation = 0;
|
||||||
|
panel_cfg.dummy_read_pixel = 8;
|
||||||
|
panel_cfg.dummy_read_bits = 1;
|
||||||
|
panel_cfg.readable = true;
|
||||||
|
panel_cfg.invert = global_config.printer_config[global_config.printer_index].invert_colors ? true : false;
|
||||||
|
panel_cfg.rgb_order = false;
|
||||||
|
panel_cfg.dlen_16bit = true;
|
||||||
|
panel_cfg.bus_shared = true;
|
||||||
|
|
||||||
|
_panel_instance.config(panel_cfg);
|
||||||
|
|
||||||
|
auto touch_cfg = _touch_instance.config();
|
||||||
|
touch_cfg.x_min = 0;
|
||||||
|
touch_cfg.x_max = 319;
|
||||||
|
touch_cfg.y_min = 0;
|
||||||
|
touch_cfg.y_max = 479;
|
||||||
|
touch_cfg.pin_int = -1;
|
||||||
|
touch_cfg.bus_shared = false;
|
||||||
|
touch_cfg.offset_rotation = 0;
|
||||||
|
|
||||||
|
touch_cfg.i2c_port = 1;
|
||||||
|
touch_cfg.i2c_addr = 0x38;
|
||||||
|
touch_cfg.pin_sda = 38;
|
||||||
|
touch_cfg.pin_scl = 39;
|
||||||
|
touch_cfg.freq = 400000;
|
||||||
|
|
||||||
|
_touch_instance.config(touch_cfg);
|
||||||
|
_panel_instance.setTouch(&_touch_instance);
|
||||||
|
|
||||||
|
setPanel(&_panel_instance);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LGFX tft;
|
||||||
|
|
||||||
|
void screen_setBrightness(unsigned char brightness)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_invert_display()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void screen_lv_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
|
||||||
|
{
|
||||||
|
uint32_t w = (area->x2 - area->x1 + 1);
|
||||||
|
uint32_t h = (area->y2 - area->y1 + 1);
|
||||||
|
|
||||||
|
tft.startWrite();
|
||||||
|
tft.setAddrWindow(area->x1, area->y1, w, h);
|
||||||
|
tft.writePixels((lgfx::rgb565_t *)&color_p->full, w * h);
|
||||||
|
tft.endWrite();
|
||||||
|
|
||||||
|
lv_disp_flush_ready(disp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void screen_lv_touchRead(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
|
||||||
|
{
|
||||||
|
uint16_t touchX, touchY;
|
||||||
|
|
||||||
|
bool touched = tft.getTouch(&touchX, &touchY);
|
||||||
|
|
||||||
|
if (touchX > CYD_SCREEN_WIDTH_PX || touchY > CYD_SCREEN_HEIGHT_PX)
|
||||||
|
{
|
||||||
|
LOG_LN("Y or y outside of expected parameters..");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data->state = touched ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
|
||||||
|
data->point.x = touchX;
|
||||||
|
data->point.y = touchY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void screen_setup()
|
||||||
|
{
|
||||||
|
pinMode(BUZZER_PIN, OUTPUT);
|
||||||
|
ledcSetup(4, 5000, 8);
|
||||||
|
ledcAttachPin(BUZZER_PIN, 4);
|
||||||
|
|
||||||
|
tft.begin();
|
||||||
|
tft.setRotation(global_config.rotate_screen ? 3 : 1);
|
||||||
|
|
||||||
|
delay(500);
|
||||||
|
|
||||||
|
pinMode(LCD_BL, OUTPUT);
|
||||||
|
digitalWrite(LCD_BL, HIGH);
|
||||||
|
|
||||||
|
/*
|
||||||
|
ledcSetup(0, 5000, 12);
|
||||||
|
ledcAttachPin(LCD_BL, 0);
|
||||||
|
*/
|
||||||
|
|
||||||
|
lv_init();
|
||||||
|
lv_disp_draw_buf_init(&draw_buf, buf, NULL, CYD_SCREEN_WIDTH_PX * CYD_SCREEN_HEIGHT_PX / 10);
|
||||||
|
|
||||||
|
/*Initialize the display*/
|
||||||
|
static lv_disp_drv_t disp_drv;
|
||||||
|
lv_disp_drv_init(&disp_drv);
|
||||||
|
disp_drv.hor_res = CYD_SCREEN_WIDTH_PX;
|
||||||
|
disp_drv.ver_res = CYD_SCREEN_HEIGHT_PX;
|
||||||
|
disp_drv.flush_cb = screen_lv_flush;
|
||||||
|
disp_drv.draw_buf = &draw_buf;
|
||||||
|
lv_disp_drv_register(&disp_drv);
|
||||||
|
|
||||||
|
/*Initialize the (dummy) input device driver*/
|
||||||
|
static lv_indev_drv_t indev_drv;
|
||||||
|
lv_indev_drv_init(&indev_drv);
|
||||||
|
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||||
|
indev_drv.read_cb = screen_lv_touchRead;
|
||||||
|
lv_indev_drv_register(&indev_drv);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -375,6 +375,8 @@ 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);
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -2,9 +2,10 @@
|
|||||||
[](https://ko-fi.com/suchmememanyskill)
|
[](https://ko-fi.com/suchmememanyskill)
|
||||||
|
|
||||||
# CYD-Klipper
|
# CYD-Klipper
|
||||||
An implementation of a wireless Klipper status display on an ESP32 + screen. Uses Moonraker to fetch data.
|
An implementation of a wireless Klipper, Bambu and Octoprint 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!
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -24,6 +25,8 @@ 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
|
||||||
|
|
||||||
@@ -39,6 +42,21 @@ If you found this project helpful, please consider a donation [to my Ko-Fi](http
|
|||||||
|
|
||||||
Thank you!
|
Thank you!
|
||||||
|
|
||||||
|
### Where to buy hardware
|
||||||
|
All links below are affiliate links. Please also check yourself if there is a cheaper version available than the ones below. I have only linked ones that i have personally bought.
|
||||||
|
|
||||||
|
*ESP32-2432S028R (2.8" Resistive, Cheapest)*
|
||||||
|
- [USB C + microB version](https://s.click.aliexpress.com/e/_omjsYBJ)
|
||||||
|
- [Another USB C + microB version](https://s.click.aliexpress.com/e/_olKBkmz)
|
||||||
|
- [microB version](https://s.click.aliexpress.com/e/_oCWhgmN)
|
||||||
|
|
||||||
|
*ESP32-2432S032C (3.2" Capacitive)*
|
||||||
|
- [Only the capacitive version is supported! USB-C](https://s.click.aliexpress.com/e/_okbSGmd)
|
||||||
|
- [IPS version (not that great of a screen), Only the capacitive version is supported! USB-C](https://s.click.aliexpress.com/e/_oFygVwt)
|
||||||
|
|
||||||
|
*ESP32-3248S035C (3.5" Capacitive)*
|
||||||
|
- [microB version](https://s.click.aliexpress.com/e/_oCqygE9)
|
||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
(Quite literally shots of the screen. I'm sorry)
|
(Quite literally shots of the screen. I'm sorry)
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
font-family: 'Roboto', sans-serif;
|
font-family: 'Roboto', sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
TT {
|
TT {
|
||||||
font-family: 'Terminal', monospace;
|
font-family: 'Terminal', monospace;
|
||||||
background-color: #080a0b;
|
background-color: #080a0b;
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,8 @@
|
|||||||
max-width: 750px;
|
max-width: 750px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main > section > :not(:first-child) {
|
.main > section > :not(:first-child),
|
||||||
|
.indent {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,17 @@
|
|||||||
#changelog-body {
|
#changelog-body {
|
||||||
white-space: break-spaces;
|
white-space: break-spaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.where-to-get details summary::marker
|
||||||
|
{
|
||||||
|
content: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
.where-to-get details[open] summary p
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script type="module" src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"></script>
|
<script type="module" src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"></script>
|
||||||
<script src="//code.iconify.design/1/1.0.6/iconify.min.js"></script>
|
<script src="//code.iconify.design/1/1.0.6/iconify.min.js"></script>
|
||||||
@@ -71,7 +83,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 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>
|
<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>
|
||||||
|
|
||||||
<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>
|
||||||
@@ -83,6 +95,34 @@
|
|||||||
<p>If you found this project helpful, please consider a donation to <a href="https://ko-fi.com/suchmememanyskill">my Ko-Fi</a>.<br>It would help out a lot in the development of this project, due to the need to buy the screens.<br>Thank you!</p>
|
<p>If you found this project helpful, please consider a donation to <a href="https://ko-fi.com/suchmememanyskill">my Ko-Fi</a>.<br>It would help out a lot in the development of this project, due to the need to buy the screens.<br>Thank you!</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="where-to-get">
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h3><span class="iconify" data-icon="mdi-shopping" style="color:orange; filter: drop-shadow(0 0 0.75rem orange);"></span> Where to buy hardware</h3>
|
||||||
|
<p class="indent">(Click to expand)</p>
|
||||||
|
</summary>
|
||||||
|
<section class="indent">
|
||||||
|
<p>All links below are affiliate links. Please also check yourself if there is a cheaper version available than the ones below. I have only linked ones that i have personally bought.</p>
|
||||||
|
<i>ESP32-2432S028R (2.8" Resistive, Cheapest)</i>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://s.click.aliexpress.com/e/_omjsYBJ">USB C + microB version</a></li>
|
||||||
|
<li><a href="https://s.click.aliexpress.com/e/_olKBkmz">Another USB C + microB version</a></li>
|
||||||
|
<li><a href="https://s.click.aliexpress.com/e/_oCWhgmN">microB version</a></li>
|
||||||
|
</ul>
|
||||||
|
<i>ESP32-2432S032C (3.2" Capacitive)</i>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://s.click.aliexpress.com/e/_okbSGmd">Only the capacitive version is supported! USB-C</a></li>
|
||||||
|
<li><a href="https://s.click.aliexpress.com/e/_oFygVwt">IPS version (not that great of a screen), Only the capacitive version is supported! USB-C</a></li>
|
||||||
|
</ul>
|
||||||
|
<i>ESP32-3248S035C (3.5" Capacitive)</i>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://s.click.aliexpress.com/e/_oCqygE9">microB version</a></li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="issues">
|
<section class="issues">
|
||||||
<h3><span class="iconify" data-icon="mdi-github" style="color: white; filter: drop-shadow(0 0 0.75rem gray);"></span> Report Issues</h3>
|
<h3><span class="iconify" data-icon="mdi-github" style="color: white; filter: drop-shadow(0 0 0.75rem gray);"></span> Report Issues</h3>
|
||||||
<p>If you experience any issues with this project, or have any feature requests for the project, please report them on the <a href="https://github.com/suchmememanyskill/CYD-Klipper/issues">issues tab on Github</a>.</p>
|
<p>If you experience any issues with this project, or have any feature requests for the project, please report them on the <a href="https://github.com/suchmememanyskill/CYD-Klipper/issues">issues tab on Github</a>.</p>
|
||||||
|
|||||||
7
ci.py
7
ci.py
@@ -11,12 +11,14 @@ CYD_PORTS = [
|
|||||||
"esp32-3248S035C-V",
|
"esp32-3248S035C-V",
|
||||||
#"esp32-4827S043R-SD",
|
#"esp32-4827S043R-SD",
|
||||||
"esp32-CROWPANEL-28R",
|
"esp32-CROWPANEL-28R",
|
||||||
|
"esp32-CROWPANEL-35C",
|
||||||
]
|
]
|
||||||
|
|
||||||
ESP_S3_CHIPS = [
|
ESP_S3_CHIPS = [
|
||||||
"esp32-8048S043C-SD",
|
"esp32-8048S043C-SD",
|
||||||
"esp32-8048S043C-SD-alt",
|
"esp32-8048S043C-SD-alt",
|
||||||
"esp32-4827S043C-SD",
|
"esp32-4827S043C-SD",
|
||||||
|
"esp32-CROWPANEL-35C",
|
||||||
]
|
]
|
||||||
|
|
||||||
BASE_DIR = os.getcwd()
|
BASE_DIR = os.getcwd()
|
||||||
@@ -80,7 +82,10 @@ 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)
|
||||||
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)
|
if (port in ESP_S3_CHIPS):
|
||||||
|
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:
|
||||||
|
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)
|
||||||
|
|
||||||
os.chdir(BASE_DIR)
|
os.chdir(BASE_DIR)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
if [ "$EUID" -eq 0 ]; then
|
||||||
echo "Please do not run as root"
|
read -r -p "Are you sure you want to run this service as root? [y/N] " response
|
||||||
exit
|
response=${response,,} # tolower
|
||||||
|
if ! [[ "$response" =~ ^(yes|y)$ ]]; then
|
||||||
|
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
|
||||||
@@ -15,20 +28,26 @@ 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]" > ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "[Unit]" > $SERVICE_PATH
|
||||||
echo "Description=CYD Klipper serial server" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "Description=CYD Klipper serial server" >> $SERVICE_PATH
|
||||||
echo "After=network.target" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "After=network.target" >> $SERVICE_PATH
|
||||||
echo "" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "" >> $SERVICE_PATH
|
||||||
echo "[Service]" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "[Service]" >> $SERVICE_PATH
|
||||||
echo "ExecStart=$(pwd)/run.sh" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "ExecStart=$(pwd)/run.sh" >> $SERVICE_PATH
|
||||||
echo "WorkingDirectory=$(pwd)" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "WorkingDirectory=$(pwd)" >> $SERVICE_PATH
|
||||||
echo "Restart=always" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "Restart=always" >> $SERVICE_PATH
|
||||||
echo "" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "" >> $SERVICE_PATH
|
||||||
echo "[Install]" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "[Install]" >> $SERVICE_PATH
|
||||||
echo "WantedBy=multi-user.target" >> ~/.config/systemd/user/cyd-klipper-serial.service
|
echo "WantedBy=multi-user.target" >> $SERVICE_PATH
|
||||||
|
|
||||||
# Start the service
|
# Start the service
|
||||||
systemctl --user daemon-reload
|
if [ "$EUID" -eq 0 ]; then
|
||||||
systemctl --user enable cyd-klipper-serial
|
systemctl daemon-reload
|
||||||
systemctl --user start cyd-klipper-serial
|
systemctl enable 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
|
||||||
@@ -1,13 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
if [ "$EUID" -eq 0 ]; then
|
||||||
echo "Please do not run as root"
|
systemctl stop cyd-klipper-serial
|
||||||
exit
|
systemctl disable cyd-klipper-serial
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
systemctl --user stop cyd-klipper-serial
|
rm -rf ./env
|
||||||
systemctl --user disable cyd-klipper-serial
|
|
||||||
|
|
||||||
rm ~/.config/systemd/user/cyd-klipper-serial.service
|
|
||||||
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
Reference in New Issue
Block a user