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

This commit is contained in:
DvoraNoob 2021-09-01 21:29:20 -03:00 committed by Scott Lahteine
parent 61364906b3
commit 9f43452fbd
6 changed files with 75 additions and 94 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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