Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seperate backend from frontend, abstract printer implementation #131

Merged
merged 64 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
9a6fce8
In progress
suchmememanyskill Oct 20, 2024
22fc25c
Port more
suchmememanyskill Oct 21, 2024
eed4b3e
Cleanup
suchmememanyskill Oct 22, 2024
2078a15
More work
suchmememanyskill Oct 23, 2024
6a9023e
Implement klipper custom ui panels
suchmememanyskill Oct 24, 2024
337a26b
Start integration
suchmememanyskill Oct 24, 2024
ec7e6f1
Implement fetchdatamin
suchmememanyskill Oct 25, 2024
309a686
More progress
suchmememanyskill Oct 26, 2024
e55c287
Finish all panels
suchmememanyskill Oct 26, 2024
c35b146
Explicit cast to void*
suchmememanyskill Oct 26, 2024
be0bf0f
Printer init
suchmememanyskill Oct 27, 2024
75bb334
Use new image system
suchmememanyskill Oct 27, 2024
6273e10
More
suchmememanyskill Oct 27, 2024
c0e329c
:)
suchmememanyskill Oct 27, 2024
fcdce6c
A
suchmememanyskill Oct 27, 2024
1516b78
A
suchmememanyskill Oct 27, 2024
69d98a9
Fix serial console printer switching
suchmememanyskill Oct 27, 2024
5bb4fd2
Fix virtual definition
suchmememanyskill Oct 27, 2024
d6e788f
Fix some warnings
suchmememanyskill Oct 27, 2024
b99e00d
Fixes
suchmememanyskill Oct 28, 2024
ccc5817
More fixes
suchmememanyskill Oct 28, 2024
572d27d
Update serial comms
suchmememanyskill Oct 28, 2024
b1138d9
Split json parsing from printer impl
suchmememanyskill Oct 28, 2024
4207d82
Basic bambu implementation
suchmememanyskill Oct 29, 2024
650b055
Attempt to fix CI
suchmememanyskill Oct 29, 2024
9a915be
Explicitly define wifi client
suchmememanyskill Oct 29, 2024
2059263
A
suchmememanyskill Oct 29, 2024
1483345
Test
suchmememanyskill Oct 29, 2024
49a1bd6
Try windows compilation
suchmememanyskill Oct 29, 2024
f21b480
Scale numeric input to 75% screen
suchmememanyskill Oct 30, 2024
66e3a67
Fix time in bambu integration
suchmememanyskill Nov 2, 2024
0e57aed
Add bambu file loading
suchmememanyskill Nov 4, 2024
d4ce7a7
Klipper connection over serial
suchmememanyskill Nov 8, 2024
747ff4c
More serial
suchmememanyskill Nov 8, 2024
92b7b68
Get Serial to a functional state
suchmememanyskill Nov 8, 2024
f944482
Gcode images, fixes to serial
suchmememanyskill Nov 9, 2024
bf90803
Remove serial semaphore
suchmememanyskill Nov 9, 2024
17143d2
Allow running wifi-less
suchmememanyskill Nov 9, 2024
e5390e7
Allow accessing device settings from wifi panel
suchmememanyskill Nov 9, 2024
1278105
Serial installer
suchmememanyskill Nov 9, 2024
1b0ca80
Fix bed temp set, start octoprint impl
suchmememanyskill Nov 16, 2024
8521664
Fetch data from octoprint
suchmememanyskill Nov 16, 2024
0c364ec
Lower cpu usage
suchmememanyskill Nov 27, 2024
15dedb7
Octoprint: Add more commands
suchmememanyskill Dec 4, 2024
fcd133e
Better split impl
suchmememanyskill Dec 11, 2024
1578b41
Better better split impl
suchmememanyskill Dec 11, 2024
2fce5a9
Start implementation on file list
suchmememanyskill Dec 11, 2024
96f8695
Continued impl of octoprint
suchmememanyskill Dec 11, 2024
68b68af
Add octoprint panels
suchmememanyskill Dec 14, 2024
2f1b009
Implement missing commands for octoprint
suchmememanyskill Dec 14, 2024
6aa7463
Add min fetcher for octoprint
suchmememanyskill Dec 15, 2024
abbb0b2
We have 3
suchmememanyskill Dec 15, 2024
211fe15
Fix compile errors
suchmememanyskill Dec 15, 2024
b342e58
Install python packages in venv
suchmememanyskill Dec 15, 2024
f4498e9
Make octoprint work after testing
suchmememanyskill Dec 15, 2024
4dd70aa
Add bambu panels
suchmememanyskill Dec 19, 2024
093dd5e
Add fan/speed controls to bambu
suchmememanyskill Dec 21, 2024
161c10a
Start print in bambu integration
suchmememanyskill Dec 21, 2024
4fc16ec
Fan profiles: On to 100%
suchmememanyskill Dec 22, 2024
5ec2ba6
Change some spelling, set timeout on bambu loop
suchmememanyskill Dec 22, 2024
660723d
Fix arduinojson compile
suchmememanyskill Jan 9, 2025
71119e1
Make UI more specific per printer type, hide settings
suchmememanyskill Jan 9, 2025
df61016
Merge branch 'dev' into printer-interface
suchmememanyskill Jan 9, 2025
7b0497c
Fix crowpanel compile
suchmememanyskill Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/compile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio-cyd-klipper
#- uses: actions/cache@v3
# with:
# path: |
# ~/.cache/pip
# ~/.platformio/.cache
# key: ${{ runner.os }}-pio-cyd-klipper

- uses: actions/setup-python@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ out/
lib
lib64

__pycache__/
37 changes: 36 additions & 1 deletion CYD-Klipper/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,42 @@
"cstddef": "cpp",
"functional": "cpp",
"*.tcc": "cpp",
"cmath": "cpp"
"cmath": "cpp",
"system_error": "cpp",
"random": "cpp",
"optional": "cpp",
"limits": "cpp",
"memory": "cpp",
"new": "cpp",
"type_traits": "cpp",
"atomic": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cstdarg": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"exception": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"tuple": "cpp",
"utility": "cpp",
"fstream": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
},
"cmake.configureOnOpen": false
}
18 changes: 12 additions & 6 deletions CYD-Klipper/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
; https://docs.platformio.org/page/projectconf.html

[env]
platform = https://github.com/platformio/platform-espressif32#v6.4.0
platform = espressif32@6.4.0
board = esp32dev
framework = arduino
monitor_speed = 115200
debug_build_flags = -Os
lib_deps =
https://github.com/suchmememanyskill/esp32-smartdisplay#9c1d737
bblanchon/ArduinoJson@^7.0.0
plageoj/UrlEncode@^1.0.1
erriez/ErriezCRC32 @ ^1.0.1
knolleary/PubSubClient@^2.8
WiFiClientSecure
monitor_filters = esp32_exception_decoder
build_flags =
-DLV_CONF_PATH="../../../../src/conf/lv_conf.h"
Expand All @@ -33,7 +35,8 @@ lib_deps =
https://github.com/PaulStoffregen/XPT2046_Touchscreen.git
bblanchon/ArduinoJson@^7.0.0
plageoj/UrlEncode@^1.0.1
erriez/ErriezCRC32 @ ^1.0.1
knolleary/PubSubClient@^2.8
WiFiClientSecure

[env:esp32-3248S035C]
board = esp32-3248S035C
Expand All @@ -44,7 +47,8 @@ lib_deps =
https://github.com/OperatorB/gt911-arduino-fixed-reset.git
bblanchon/ArduinoJson@^7.0.0
plageoj/UrlEncode@^1.0.1
erriez/ErriezCRC32 @ ^1.0.1
knolleary/PubSubClient@^2.8
WiFiClientSecure

[env:esp32-3248S035C-V]
board = esp32-3248S035C-vertical
Expand All @@ -55,7 +59,8 @@ lib_deps =
https://github.com/OperatorB/gt911-arduino-fixed-reset.git
bblanchon/ArduinoJson@^7.0.0
plageoj/UrlEncode@^1.0.1
erriez/ErriezCRC32 @ ^1.0.1
knolleary/PubSubClient@^2.8
WiFiClientSecure

[env:esp32-2432S024C-SD]
board = esp32-2432S024C-smartdisplay
Expand Down Expand Up @@ -95,4 +100,5 @@ lib_deps =
https://github.com/Bodmer/TFT_eSPI.git
bblanchon/ArduinoJson@^7.0.0
plageoj/UrlEncode@^1.0.1
erriez/ErriezCRC32 @ ^1.0.1
knolleary/PubSubClient@^2.8
WiFiClientSecure
87 changes: 75 additions & 12 deletions CYD-Klipper/src/conf/global_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#include "global_config.h"
#include "lvgl.h"

GLOBAL_CONFIG global_config = {0};
TEMPORARY_CONFIG temporary_config = {0};
GlobalConfig global_config = {0};
TemporaryConfig temporary_config = {0};

COLOR_DEF color_defs[] = {
ColorDefinition color_defs[] = {
{LV_PALETTE_BLUE, 0, LV_PALETTE_RED},
{LV_PALETTE_GREEN, 0, LV_PALETTE_PURPLE},
{LV_PALETTE_LIME, -2, LV_PALETTE_PURPLE},
Expand All @@ -30,7 +30,7 @@ void verify_version()
if (!preferences.begin("global_config", false))
return;

GLOBAL_CONFIG config = {0};
GlobalConfig config = {0};
preferences.getBytes("global_config", &config, sizeof(config));
LOG_F(("Config version: %d\n", config.version))
if (config.version != CONFIG_VERSION) {
Expand All @@ -41,16 +41,16 @@ void verify_version()
preferences.end();
}

PRINTER_CONFIG* get_current_printer_config()
PrinterConfiguration* get_current_printer_config()
{
return &global_config.printer_config[global_config.printer_index];
}

int get_printer_config_count()
int global_config_get_printer_config_count()
{
int count = 0;
for (int i = 0; i < PRINTER_CONFIG_COUNT; i++) {
if (global_config.printer_config[i].ip_configured)
if (global_config.printer_config[i].setup_complete)
count++;
}
return count;
Expand All @@ -59,19 +59,82 @@ int get_printer_config_count()
int get_printer_config_free_index()
{
for (int i = 0; i < PRINTER_CONFIG_COUNT; i++) {
if (!global_config.printer_config[i].ip_configured)
if (!global_config.printer_config[i].setup_complete)
return i;
}
return -1;
}

void global_config_add_new_printer()
{
int free_index = get_printer_config_free_index();
if (free_index <= -1)
{
LOG_LN("No available slot for new printer");
return;
}

PrinterConfiguration* old_config = &global_config.printer_config[global_config.printer_index];
PrinterConfiguration* new_config = &global_config.printer_config[free_index];

new_config->raw = old_config->raw;
new_config->setup_complete = false;
new_config->ip_configured = false;
new_config->auth_configured = false;
new_config->printer_type = PrinterType::PrinterTypeNone;

new_config->printer_name[0] = 0;
new_config->printer_host[0] = 0;
new_config->printer_auth[0] = 0;
new_config->klipper_port = 0;

new_config->color_scheme = old_config->color_scheme;

// TODO: Replace with memcpy
for (int i = 0; i < 3; i++){
new_config->hotend_presets[i] = old_config->hotend_presets[i];
new_config->bed_presets[i] = old_config->bed_presets[i];
}

for (int i = 0; i < 3; i++){
new_config->printer_move_x_steps[i] = old_config->printer_move_x_steps[i];
new_config->printer_move_y_steps[i] = old_config->printer_move_y_steps[i];
new_config->printer_move_z_steps[i] = old_config->printer_move_z_steps[i];
}

global_config_set_printer(free_index);
ESP.restart();
}

void global_config_set_printer(int idx)
{
if (idx < 0 || idx >= PRINTER_CONFIG_COUNT || global_config.printer_index == idx)
return;

global_config.printer_index = idx;
write_global_config();
}

void global_config_delete_printer(int idx)
{
if (global_config.printer_index == idx)
{
return;
}

PrinterConfiguration* config = &global_config.printer_config[idx];
config->setup_complete = false;
write_global_config();
ESP.restart();
}

void set_printer_config_index(int index)
{
if (index < 0 || index >= PRINTER_CONFIG_COUNT)
return;

PRINTER_CONFIG* old_config = &global_config.printer_config[global_config.printer_index];
PRINTER_CONFIG* new_config = &global_config.printer_config[index];
PrinterConfiguration* old_config = &global_config.printer_config[global_config.printer_index];
PrinterConfiguration* new_config = &global_config.printer_config[index];

global_config.printer_index = index;

Expand All @@ -81,8 +144,8 @@ void set_printer_config_index(int index)
new_config->auth_configured = false;

new_config->printer_name[0] = 0;
new_config->klipper_host[0] = 0;
new_config->klipper_auth[0] = 0;
new_config->printer_host[0] = 0;
new_config->printer_auth[0] = 0;
new_config->klipper_port = 0;

new_config->color_scheme = old_config->color_scheme;
Expand Down
Loading