8 Commits

Author SHA1 Message Date
Sims
7c564e8ab8 Merge pull request #166 from suchmememanyskill/dev
Hopefully fix webflash for s3
2025-02-09 01:57:02 +01:00
Sims
e6b5d17f6a Merge pull request #164 from suchmememanyskill/dev
v2.1.0
2025-02-01 19:39:18 +01:00
suchmememanyskill
8f46b9972d Add aliexpress links 2025-01-15 22:18:36 +01:00
Sims
5756b31744 Update README.md 2025-01-10 18:15:56 +01:00
suchmememanyskill
99b70622fe Update readme 2025-01-09 23:14:15 +01:00
Sims
b3d405b355 Merge pull request #139 from suchmememanyskill/dev
v2.0.0 - Happy new year!
2025-01-09 23:05:35 +01:00
Sims
9a96f9336f Merge pull request #125 from suchmememanyskill/dev
v1.8.0
2024-08-31 11:49:48 +02:00
Sims
5c46764c7c Merge pull request #122 from suchmememanyskill/dev
v1.7.0
2024-08-02 21:39:42 +02:00
8 changed files with 67 additions and 289 deletions

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

@@ -18,16 +18,13 @@ 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; else if ((strcmp(state, "shutdown") == 0 || strcmp(state, "error") == 0) && printer_data.state != PrinterStateError)
} {
else if ((strcmp(state, "shutdown") == 0 || strcmp(state, "error") == 0) && printer_data.state != PrinterStateError) 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

@@ -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

@@ -42,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)

View File

@@ -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>
@@ -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>
@@ -101,7 +141,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>