Browse Source

🚸 MKS UI extrusion speed/steps config (#22656)

vanilla_fb_2.0.x
DvoraNoob 3 years ago
committed by Scott Lahteine
parent
commit
9f43452fbd
  1. 90
      Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp
  2. 15
      Marlin/src/lcd/extui/mks_ui/draw_ui.cpp
  3. 10
      Marlin/src/lcd/extui/mks_ui/draw_ui.h
  4. 20
      Marlin/src/lcd/extui/mks_ui/wifi_module.cpp
  5. 2
      buildroot/bin/mftest
  6. 32
      buildroot/tests/mks_robin_nano35

90
Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp

@ -89,20 +89,18 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
disp_extru_amount();
break;
case ID_E_STEP:
switch (ABS(uiCfg.extruStep)) {
case 1: uiCfg.extruStep = 5; break;
case 5: uiCfg.extruStep = 10; break;
case 10: uiCfg.extruStep = 1; break;
default: break;
switch (uiCfg.extruStep) {
case uiCfg.eStepMin: uiCfg.extruStep = uiCfg.eStepMed; break;
case uiCfg.eStepMed: uiCfg.extruStep = uiCfg.eStepMax; break;
case uiCfg.eStepMax: uiCfg.extruStep = uiCfg.eStepMin; break;
}
disp_ext_step();
break;
case ID_E_SPEED:
switch (uiCfg.extruSpeed) {
case 1: uiCfg.extruSpeed = 10; break;
case 10: uiCfg.extruSpeed = 20; break;
case 20: uiCfg.extruSpeed = 1; break;
default: break;
case uiCfg.eSpeedL: uiCfg.extruSpeed = uiCfg.eSpeedN; break;
case uiCfg.eSpeedN: uiCfg.extruSpeed = uiCfg.eSpeedH; break;
case uiCfg.eSpeedH: uiCfg.extruSpeed = uiCfg.eSpeedL; break;
}
disp_ext_speed();
break;
@ -155,41 +153,30 @@ void lv_draw_extrusion() {
void disp_ext_type() {
if (uiCfg.extruderIndex == 1) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, extrude_menu.ext2);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
if (gCfgItems.multiple_language) lv_label_set_text(labelType, extrude_menu.ext2);
}
else {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, extrude_menu.ext1);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
if (gCfgItems.multiple_language) lv_label_set_text(labelType, extrude_menu.ext1);
}
if (gCfgItems.multiple_language)
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
void disp_ext_speed() {
if (uiCfg.extruSpeed == 20)
lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_high.bin");
else if (uiCfg.extruSpeed == 1)
lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_slow.bin");
else
lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_normal.bin");
switch (uiCfg.extruSpeed) {
case uiCfg.eSpeedH: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_high.bin"); break;
case uiCfg.eSpeedL: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_slow.bin"); break;
case uiCfg.eSpeedN: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_normal.bin"); break;
}
if (gCfgItems.multiple_language) {
if (uiCfg.extruSpeed == 20) {
lv_label_set_text(labelSpeed, extrude_menu.high);
lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else if (uiCfg.extruSpeed == 1) {
lv_label_set_text(labelSpeed, extrude_menu.low);
lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else {
lv_label_set_text(labelSpeed, extrude_menu.normal);
lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
switch (uiCfg.extruSpeed) {
case uiCfg.eSpeedH: lv_label_set_text(labelSpeed, extrude_menu.high); break;
case uiCfg.eSpeedL: lv_label_set_text(labelSpeed, extrude_menu.low); break;
case uiCfg.eSpeedN: lv_label_set_text(labelSpeed, extrude_menu.normal); break;
}
lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
@ -221,33 +208,28 @@ void disp_extru_amount() {
}
void disp_ext_step() {
if (uiCfg.extruStep == 1)
lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_mm.bin");
else if (uiCfg.extruStep == 5)
lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_mm.bin");
else if (uiCfg.extruStep == 10)
lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_mm.bin");
char buf3[12];
sprintf_P(buf3, PSTR("%dmm"), uiCfg.extruStep);
switch (uiCfg.extruStep) {
case uiCfg.eStepMin: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_mm.bin"); break;
case uiCfg.eStepMed: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_mm.bin"); break;
case uiCfg.eStepMax: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_mm.bin"); break;
}
if (gCfgItems.multiple_language) {
if (uiCfg.extruStep == 1) {
lv_label_set_text(labelStep, extrude_menu.step_1mm);
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else if (uiCfg.extruStep == 5) {
lv_label_set_text(labelStep, extrude_menu.step_5mm);
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
else if (uiCfg.extruStep == 10) {
lv_label_set_text(labelStep, extrude_menu.step_10mm);
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
switch (uiCfg.extruStep) {
case uiCfg.eStepMin: lv_label_set_text(labelStep, buf3); break;
case uiCfg.eStepMed: lv_label_set_text(labelStep, buf3); break;
case uiCfg.eStepMax: lv_label_set_text(labelStep, buf3); break;
}
lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
void lv_clear_extrusion() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
if (TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable))
lv_group_remove_all_objs(g);
lv_obj_del(scr);
}

15
Marlin/src/lcd/extui/mks_ui/draw_ui.cpp

@ -186,10 +186,10 @@ void ui_cfg_init() {
uiCfg.stepHeat = 10;
uiCfg.leveling_first_time = false;
uiCfg.para_ui_page = false;
uiCfg.extruStep = 5;
uiCfg.extruSpeed = 10;
uiCfg.extruStep = uiCfg.eStepMed;
uiCfg.extruSpeed = uiCfg.eSpeedN;
uiCfg.move_dist = 1;
uiCfg.moveSpeed = 3000;
uiCfg.moveSpeed = 1000;
uiCfg.stepPrintSpeed = 10;
uiCfg.command_send = false;
uiCfg.dialogType = 0;
@ -609,9 +609,9 @@ char *creat_title_text() {
gPicturePreviewStart += (uintptr_t)p1 - (uintptr_t)((uint32_t *)(&public_buf[0]));
break;
}
else {
else
gPicturePreviewStart += br;
}
if (br < 400) break;
}
}
@ -623,11 +623,8 @@ char *creat_title_text() {
while (1) {
card.read(public_buf, 400);
for (i = 0; i < 400;) {
for (i = 0; i < 400; i += 2, j++)
bmp_public_buf[j] = ascii2dec_test((char*)&public_buf[i]) << 4 | ascii2dec_test((char*)&public_buf[i + 1]);
i += 2;
j++;
}
if (j >= 400) break;
}
for (i = 0; i < 400; i += 2) {

10
Marlin/src/lcd/extui/mks_ui/draw_ui.h

@ -208,7 +208,7 @@ typedef struct {
uint32_t curFilesize;
} CFG_ITMES;
typedef struct {
typedef struct UI_Config_Struct {
uint8_t curTempType:1,
extruderIndex:3,
stepHeat:4,
@ -228,8 +228,16 @@ typedef struct {
uint8_t wifi_name[32];
uint8_t wifi_key[64];
uint8_t cloud_hostUrl[96];
// Extruder Steps distances (mm)
uint8_t extruStep;
static constexpr uint8_t eStepMin = 1,
eStepMed = 5,
eStepMax = 10;
// Extruder speed (mm/s)
uint8_t extruSpeed;
static constexpr uint8_t eSpeedH = 1,
eSpeedN = 10,
eSpeedL = 20;
uint8_t print_state;
uint8_t stepPrintSpeed;
uint8_t waitEndMoves;

20
Marlin/src/lcd/extui/mks_ui/wifi_module.cpp

@ -1445,16 +1445,12 @@ void utf8_2_unicode(uint8_t *source, uint8_t Len) {
ZERO(FileName_unicode);
while (1) {
for (;;) {
char_byte_num = source[i] & 0xF0;
if (source[i] < 0x80) {
//ASCII --1byte
FileName_unicode[char_i] = source[i];
i += 1;
char_i += 1;
if (source[i] < 0x80) { // ASCII -- 1 byte
FileName_unicode[char_i++] = source[i++];
}
else if (char_byte_num == 0xC0 || char_byte_num == 0xD0) {
//--2byte
else if (char_byte_num == 0xC0 || char_byte_num == 0xD0) { // -- 2 byte
u16_h = (((uint16_t)source[i] << 8) & 0x1F00) >> 2;
u16_l = ((uint16_t)source[i + 1] & 0x003F);
u16_value = (u16_h | u16_l);
@ -1463,8 +1459,7 @@ void utf8_2_unicode(uint8_t *source, uint8_t Len) {
i += 2;
char_i += 2;
}
else if (char_byte_num == 0xE0) {
//--3byte
else if (char_byte_num == 0xE0) { // -- 3 byte
u16_h = (((uint16_t)source[i] << 8) & 0x0F00) << 4;
u16_m = (((uint16_t)source[i + 1] << 8) & 0x3F00) >> 2;
u16_l = ((uint16_t)source[i + 2] & 0x003F);
@ -1474,8 +1469,7 @@ void utf8_2_unicode(uint8_t *source, uint8_t Len) {
i += 3;
char_i += 2;
}
else if (char_byte_num == 0xF0) {
//--4byte
else if (char_byte_num == 0xF0) { // -- 4 byte
i += 4;
//char_i += 3;
}
@ -1510,7 +1504,7 @@ static void file_first_msg_handle(uint8_t * msg, uint16_t msgLen) {
TERN_(SDSUPPORT, card.mount());
}
else if (gCfgItems.fileSysType == FILE_SYS_USB) {
// nothing
}
file_writer.write_index = 0;
lastFragment = -1;

2
buildroot/bin/mftest

@ -133,7 +133,7 @@ lp9|lpc9) TESTENV='LPC1769' ;;
t36) TESTENV='teensy35' ;;
t40) TESTENV='teensy41' ;;
t41) TESTENV='teensy41' ;;
[1-9][1-9]|[1-9]) TESTNUM=$TESTENV ; TESTENV=- ;;
[1-9]|[1-9][0-9]) TESTNUM=$TESTENV ; TESTENV=- ;;
esac
if ((AUTO_BUILD)); then

32
buildroot/tests/mks_robin_nano35

@ -15,15 +15,15 @@ opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO
exec_test $1 $2 "MKS Robin nano v1.2 Emulated DOGM FSMC" "$3"
#
# MKS Robin v2 nano Emulated DOGM SPI
# (Robin v2 nano has no FSMC interface)
# MKS Robin nano v2 Emulated DOGM SPI
# (Robin nano v2 has no FSMC interface)
#
use_example_configs Mks/Robin
opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
opt_disable TFT_INTERFACE_FSMC
opt_enable TFT_INTERFACE_SPI MKS_WIFI_MODULE
opt_add MKS_TEST
exec_test $1 $2 "MKS Robin v2 nano Emulated DOGM SPI, MKS_WIFI_MODULE" "$3"
exec_test $1 $2 "MKS Robin nano v2 Emulated DOGM SPI, MKS_WIFI_MODULE" "$3"
#
# MKS Robin nano v1.2 LVGL FSMC
@ -35,34 +35,34 @@ exec_test $1 $2 "MKS Robin v2 nano Emulated DOGM SPI, MKS_WIFI_MODULE" "$3"
# exec_test $1 $2 "MKS Robin nano v1.2 LVGL FSMC" "$3"
#
# MKS Robin v2 nano LVGL SPI
# (Robin v2 nano has no FSMC interface)
# MKS Robin nano v2 LVGL SPI
# (Robin nano v2 has no FSMC interface)
#
# use_example_configs Mks/Robin
# opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
# opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
# opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320
# exec_test $1 $2 "MKS Robin v2 nano LVGL SPI" "$3"
# exec_test $1 $2 "MKS Robin nano v2 LVGL SPI" "$3"
#
# MKS Robin v2 nano New Color UI 480x320 SPI
# (Robin v2 nano has no FSMC interface)
# MKS Robin nano v2 New Color UI 480x320 SPI
# (Robin nano v2 has no FSMC interface)
#
use_example_configs Mks/Robin
opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
opt_disable TFT_INTERFACE_FSMC TFT_RES_320x240
opt_enable TFT_INTERFACE_SPI TFT_RES_480x320
exec_test $1 $2 "MKS Robin v2 nano New Color UI 480x320 SPI" "$3"
exec_test $1 $2 "MKS Robin nano v2 with New Color UI 480x320 SPI" "$3"
#
# MKS Robin v2 nano LVGL SPI + TMC
# (Robin v2 nano has no FSMC interface)
# MKS Robin nano v2 LVGL SPI + TMC
# (Robin nano v2 has no FSMC interface)
#
# use_example_configs Mks/Robin
# opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209
# opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
# opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320
# exec_test $1 $2 "MKS Robin v2 nano LVGL SPI + TMC" "$3"
use_example_configs Mks/Robin
opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209
opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320
exec_test $1 $2 "MKS Robin nano v2 LVGL SPI + TMC" "$3"
# cleanup
restore_configs

Loading…
Cancel
Save