|
@@ -241,6 +241,9 @@ void MarlinUI::draw_status_screen() {
|
241
|
241
|
#ifdef ITEM_CHAMBER
|
242
|
242
|
case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break;
|
243
|
243
|
#endif
|
|
244
|
+ #ifdef ITEM_COOLER
|
|
245
|
+ case ITEM_COOLER: draw_heater_status(x, y, H_COOLER); break;
|
|
246
|
+ #endif
|
244
|
247
|
#ifdef ITEM_FAN
|
245
|
248
|
case ITEM_FAN: draw_fan_status(x, y, blink); break;
|
246
|
249
|
#endif
|
|
@@ -278,6 +281,7 @@ void MarlinUI::draw_status_screen() {
|
278
|
281
|
offset -= tft_string.width();
|
279
|
282
|
}
|
280
|
283
|
tft.add_text(301 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
284
|
+ TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24));
|
281
|
285
|
|
282
|
286
|
// feed rate
|
283
|
287
|
tft.canvas(70, 136, 80, 32);
|
|
@@ -354,16 +358,16 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const val
|
354
|
358
|
menu_line(line - 1);
|
355
|
359
|
|
356
|
360
|
tft_string.set(X_LBL);
|
357
|
|
- tft.add_text(52, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
361
|
+ tft.add_text(TFT_WIDTH / 2 - 120, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
358
|
362
|
tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.x)));
|
359
|
363
|
tft_string.trim();
|
360
|
|
- tft.add_text(144 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
|
364
|
+ tft.add_text(TFT_WIDTH / 2 - 16 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
361
|
365
|
|
362
|
366
|
tft_string.set(Y_LBL);
|
363
|
|
- tft.add_text(176, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
367
|
+ tft.add_text(TFT_WIDTH / 2 + 16, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
364
|
368
|
tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.y)));
|
365
|
369
|
tft_string.trim();
|
366
|
|
- tft.add_text(268 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
|
370
|
+ tft.add_text(TFT_WIDTH / 2 + 120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
367
|
371
|
}
|
368
|
372
|
#endif
|
369
|
373
|
|
|
@@ -393,9 +397,9 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const val
|
393
|
397
|
|
394
|
398
|
void TFT::draw_edit_screen_buttons() {
|
395
|
399
|
#if ENABLED(TOUCH_SCREEN)
|
396
|
|
- add_control(32, 176, DECREASE, imgDecrease);
|
397
|
|
- add_control(224, 176, INCREASE, imgIncrease);
|
398
|
|
- add_control(128, 176, CLICK, imgConfirm);
|
|
400
|
+ add_control(32, TFT_HEIGHT - 64, DECREASE, imgDecrease);
|
|
401
|
+ add_control(224, TFT_HEIGHT - 64, INCREASE, imgIncrease);
|
|
402
|
+ add_control(128, TFT_HEIGHT - 64, CLICK, imgConfirm);
|
399
|
403
|
#endif
|
400
|
404
|
}
|
401
|
405
|
|
|
@@ -424,8 +428,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
424
|
428
|
tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
425
|
429
|
}
|
426
|
430
|
#if ENABLED(TOUCH_SCREEN)
|
427
|
|
- add_control(48, 176, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
|
428
|
|
- add_control(208, 176, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
|
|
431
|
+ add_control(48, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
|
|
432
|
+ add_control(208, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
|
429
|
433
|
#endif
|
430
|
434
|
}
|
431
|
435
|
|
|
@@ -435,7 +439,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
435
|
439
|
#if ENABLED(TOUCH_SCREEN)
|
436
|
440
|
touch.clear();
|
437
|
441
|
draw_menu_navigation = false;
|
438
|
|
- touch.add_control(RESUME_CONTINUE , 0, 0, 320, 240);
|
|
442
|
+ touch.add_control(RESUME_CONTINUE , 0, 0, TFT_WIDTH, TFT_HEIGHT);
|
439
|
443
|
#endif
|
440
|
444
|
|
441
|
445
|
menu_line(row);
|
|
@@ -477,7 +481,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
477
|
481
|
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
|
478
|
482
|
lpos = pos.asLogical();
|
479
|
483
|
|
480
|
|
- tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2 - 32, 96, 32);
|
|
484
|
+ tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 96, MENU_ITEM_HEIGHT);
|
481
|
485
|
tft.set_background(COLOR_BACKGROUND);
|
482
|
486
|
tft_string.set(X_LBL);
|
483
|
487
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
@@ -485,7 +489,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
485
|
489
|
tft_string.trim();
|
486
|
490
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
487
|
491
|
|
488
|
|
- tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2, 96, 32);
|
|
492
|
+ tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 96, MENU_ITEM_HEIGHT);
|
489
|
493
|
tft.set_background(COLOR_BACKGROUND);
|
490
|
494
|
tft_string.set(Y_LBL);
|
491
|
495
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
@@ -493,7 +497,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
493
|
497
|
tft_string.trim();
|
494
|
498
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
495
|
499
|
|
496
|
|
- tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - 32) / 2 + 32, 96, 32);
|
|
500
|
+ tft.canvas(216, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 + MENU_ITEM_HEIGHT, 96, MENU_ITEM_HEIGHT);
|
497
|
501
|
tft.set_background(COLOR_BACKGROUND);
|
498
|
502
|
tft_string.set(Z_LBL);
|
499
|
503
|
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
|
@@ -502,13 +506,13 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
502
|
506
|
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
503
|
507
|
|
504
|
508
|
constexpr uint8_t w = (TFT_WIDTH) / 10;
|
505
|
|
- tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - w) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 1, w, 32);
|
|
509
|
+ tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - w) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 1, w, MENU_ITEM_HEIGHT);
|
506
|
510
|
tft.set_background(COLOR_BACKGROUND);
|
507
|
511
|
tft_string.set(ui8tostr3rj(x_plot));
|
508
|
512
|
tft_string.trim();
|
509
|
513
|
tft.add_text(tft_string.center(w), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
510
|
514
|
|
511
|
|
- tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET, GRID_OFFSET_Y + (GRID_HEIGHT - 27) / 2, w, 32);
|
|
515
|
+ tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET, GRID_OFFSET_Y + (GRID_HEIGHT - 27) / 2, w, MENU_ITEM_HEIGHT);
|
512
|
516
|
tft.set_background(COLOR_BACKGROUND);
|
513
|
517
|
tft_string.set(ui8tostr3rj(y_plot));
|
514
|
518
|
tft_string.trim();
|
|
@@ -527,7 +531,376 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
527
|
531
|
}
|
528
|
532
|
#endif // AUTO_BED_LEVELING_UBL
|
529
|
533
|
|
|
534
|
+#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
535
|
+ #include "../../feature/babystep.h"
|
|
536
|
+#endif
|
|
537
|
+
|
|
538
|
+#if HAS_BED_PROBE
|
|
539
|
+ #include "../../module/probe.h"
|
|
540
|
+#endif
|
|
541
|
+
|
|
542
|
+#define Z_SELECTION_Z 1
|
|
543
|
+#define Z_SELECTION_Z_PROBE -1
|
|
544
|
+
|
|
545
|
+struct MotionAxisState {
|
|
546
|
+ xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos;
|
|
547
|
+ float currentStepSize = 10.0;
|
|
548
|
+ int z_selection = Z_SELECTION_Z;
|
|
549
|
+ uint8_t e_selection = 0;
|
|
550
|
+ bool blocked = false;
|
|
551
|
+ char message[32];
|
|
552
|
+};
|
|
553
|
+
|
|
554
|
+MotionAxisState motionAxisState;
|
|
555
|
+
|
|
556
|
+#define E_BTN_COLOR COLOR_YELLOW
|
|
557
|
+#define X_BTN_COLOR COLOR_CORAL_RED
|
|
558
|
+#define Y_BTN_COLOR COLOR_VIVID_GREEN
|
|
559
|
+#define Z_BTN_COLOR COLOR_LIGHT_BLUE
|
|
560
|
+
|
|
561
|
+#define BTN_WIDTH 48
|
|
562
|
+#define BTN_HEIGHT 39
|
|
563
|
+#define X_MARGIN 15
|
|
564
|
+#define Y_MARGIN 11
|
|
565
|
+
|
|
566
|
+static void quick_feedback() {
|
|
567
|
+ #if HAS_CHIRP
|
|
568
|
+ ui.chirp(); // Buzz and wait. Is the delay needed for buttons to settle?
|
|
569
|
+ #if BOTH(HAS_LCD_MENU, USE_BEEPER)
|
|
570
|
+ for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); }
|
|
571
|
+ #elif HAS_LCD_MENU
|
|
572
|
+ delay(10);
|
|
573
|
+ #endif
|
|
574
|
+ #endif
|
|
575
|
+}
|
|
576
|
+
|
|
577
|
+#define CUR_STEP_VALUE_WIDTH 38
|
|
578
|
+static void drawCurStepValue() {
|
|
579
|
+ tft_string.set((uint8_t *)ftostr52sp(motionAxisState.currentStepSize));
|
|
580
|
+ tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, 20);
|
|
581
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
582
|
+ tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
|
|
583
|
+ tft.queue.sync();
|
|
584
|
+ tft_string.set("mm");
|
|
585
|
+ tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y + 20, CUR_STEP_VALUE_WIDTH, 20);
|
|
586
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
587
|
+ tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
|
|
588
|
+}
|
|
589
|
+
|
|
590
|
+static void drawCurZSelection() {
|
|
591
|
+ tft_string.set("Z");
|
|
592
|
+ tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 20);
|
|
593
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
594
|
+ tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
|
595
|
+ tft.queue.sync();
|
|
596
|
+ tft_string.set("Offset");
|
|
597
|
+ tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 20);
|
|
598
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
599
|
+ if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
|
600
|
+ tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
|
601
|
+ }
|
|
602
|
+}
|
|
603
|
+
|
|
604
|
+static void drawCurESelection() {
|
|
605
|
+ tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
|
606
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
607
|
+ tft_string.set("E");
|
|
608
|
+ tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
|
609
|
+ tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
|
610
|
+}
|
|
611
|
+
|
|
612
|
+static void drawMessage(const char *msg) {
|
|
613
|
+ tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 29, (TFT_WIDTH / 2) - (BTN_WIDTH / 2) - X_MARGIN, 20);
|
|
614
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
615
|
+ tft.add_text(0, 0, COLOR_YELLOW, msg);
|
|
616
|
+}
|
|
617
|
+
|
|
618
|
+static void drawAxisValue(const AxisEnum axis) {
|
|
619
|
+ const float value = (
|
|
620
|
+ TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
|
|
621
|
+ ui.manual_move.axis_value(axis)
|
|
622
|
+ );
|
|
623
|
+ xy_int_t pos;
|
|
624
|
+ uint16_t color;
|
|
625
|
+ switch (axis) {
|
|
626
|
+ case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
|
|
627
|
+ case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
|
|
628
|
+ case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
|
|
629
|
+ case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
|
|
630
|
+ default: return;
|
|
631
|
+ }
|
|
632
|
+ tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, 20);
|
|
633
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
634
|
+ tft_string.set(ftostr52sp(value));
|
|
635
|
+ tft.add_text(0, 0, color, tft_string);
|
|
636
|
+}
|
|
637
|
+
|
|
638
|
+static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|
639
|
+ quick_feedback();
|
|
640
|
+
|
|
641
|
+ if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
|
642
|
+ drawMessage("Too cold");
|
|
643
|
+ return;
|
|
644
|
+ }
|
|
645
|
+
|
|
646
|
+ const float diff = motionAxisState.currentStepSize * direction;
|
|
647
|
+
|
|
648
|
+ if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
|
649
|
+ #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
|
650
|
+ const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
|
|
651
|
+ const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
|
|
652
|
+ const float bsDiff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
|
|
653
|
+ new_probe_offset = probe.offset.z + bsDiff,
|
|
654
|
+ new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
|
|
655
|
+ , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
|
|
656
|
+ , new_probe_offset
|
|
657
|
+ );
|
|
658
|
+ if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
|
|
659
|
+ babystep.add_steps(Z_AXIS, babystep_increment);
|
|
660
|
+ if (do_probe)
|
|
661
|
+ probe.offset.z = new_offs;
|
|
662
|
+ else
|
|
663
|
+ TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
|
|
664
|
+ drawMessage(""); // clear the error
|
|
665
|
+ drawAxisValue(axis);
|
|
666
|
+ }
|
|
667
|
+ else {
|
|
668
|
+ drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
|
669
|
+ }
|
|
670
|
+ #elif HAS_BED_PROBE
|
|
671
|
+ // only change probe.offset.z
|
|
672
|
+ probe.offset.z += diff;
|
|
673
|
+ if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
|
|
674
|
+ current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
|
|
675
|
+ drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
|
676
|
+ }
|
|
677
|
+ else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
|
|
678
|
+ current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
|
|
679
|
+ drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
|
680
|
+ }
|
|
681
|
+ else {
|
|
682
|
+ drawMessage(""); // clear the error
|
|
683
|
+ }
|
|
684
|
+ drawAxisValue(axis);
|
|
685
|
+ #endif
|
|
686
|
+ return;
|
|
687
|
+ }
|
|
688
|
+
|
|
689
|
+ if (!ui.manual_move.processing) {
|
|
690
|
+ // Get motion limit from software endstops, if any
|
|
691
|
+ float min, max;
|
|
692
|
+ soft_endstop.get_manual_axis_limits(axis, min, max);
|
|
693
|
+
|
|
694
|
+ // Delta limits XY based on the current offset from center
|
|
695
|
+ // This assumes the center is 0,0
|
|
696
|
+ #if ENABLED(DELTA)
|
|
697
|
+ if (axis != Z_AXIS && axis != E_AXIS) {
|
|
698
|
+ max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
|
|
699
|
+ min = -max;
|
|
700
|
+ }
|
|
701
|
+ #endif
|
|
702
|
+
|
|
703
|
+ // Get the new position
|
|
704
|
+ const bool limited = ui.manual_move.apply_diff(axis, diff, min, max);
|
|
705
|
+ #if IS_KINEMATIC
|
|
706
|
+ UNUSED(limited);
|
|
707
|
+ #else
|
|
708
|
+ PGM_P const msg = limited ? GET_TEXT(MSG_LCD_SOFT_ENDSTOPS) : NUL_STR;
|
|
709
|
+ drawMessage(msg);
|
|
710
|
+ #endif
|
|
711
|
+
|
|
712
|
+ ui.manual_move.soon(axis
|
|
713
|
+ #if MULTI_MANUAL
|
|
714
|
+ , motionAxisState.e_selection
|
|
715
|
+ #endif
|
|
716
|
+ );
|
|
717
|
+ }
|
|
718
|
+
|
|
719
|
+ drawAxisValue(axis);
|
|
720
|
+}
|
|
721
|
+
|
|
722
|
+static void e_plus() { moveAxis(E_AXIS, 1); }
|
|
723
|
+static void e_minus() { moveAxis(E_AXIS, -1); }
|
|
724
|
+static void x_minus() { moveAxis(X_AXIS, -1); }
|
|
725
|
+static void x_plus() { moveAxis(X_AXIS, 1); }
|
|
726
|
+static void y_plus() { moveAxis(Y_AXIS, 1); }
|
|
727
|
+static void y_minus() { moveAxis(Y_AXIS, -1); }
|
|
728
|
+static void z_plus() { moveAxis(Z_AXIS, 1); }
|
|
729
|
+static void z_minus() { moveAxis(Z_AXIS, -1); }
|
|
730
|
+
|
|
731
|
+#if ENABLED(TOUCH_SCREEN)
|
|
732
|
+ static void e_select() {
|
|
733
|
+ motionAxisState.e_selection++;
|
|
734
|
+ if (motionAxisState.e_selection >= EXTRUDERS) {
|
|
735
|
+ motionAxisState.e_selection = 0;
|
|
736
|
+ }
|
|
737
|
+
|
|
738
|
+ quick_feedback();
|
|
739
|
+ drawCurESelection();
|
|
740
|
+ drawAxisValue(E_AXIS);
|
|
741
|
+ }
|
|
742
|
+
|
|
743
|
+ static void do_home() {
|
|
744
|
+ quick_feedback();
|
|
745
|
+ drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
|
|
746
|
+ queue.inject_P(G28_STR);
|
|
747
|
+ // Disable touch until home is done
|
|
748
|
+ TERN_(HAS_TFT_XPT2046, touch.disable());
|
|
749
|
+ drawAxisValue(E_AXIS);
|
|
750
|
+ drawAxisValue(X_AXIS);
|
|
751
|
+ drawAxisValue(Y_AXIS);
|
|
752
|
+ drawAxisValue(Z_AXIS);
|
|
753
|
+ }
|
|
754
|
+
|
|
755
|
+ static void step_size() {
|
|
756
|
+ motionAxisState.currentStepSize = motionAxisState.currentStepSize / 10.0;
|
|
757
|
+ if (motionAxisState.currentStepSize < 0.0015) motionAxisState.currentStepSize = 10.0;
|
|
758
|
+ quick_feedback();
|
|
759
|
+ drawCurStepValue();
|
|
760
|
+ }
|
|
761
|
+#endif
|
|
762
|
+
|
|
763
|
+#if HAS_BED_PROBE
|
|
764
|
+ static void z_select() {
|
|
765
|
+ motionAxisState.z_selection *= -1;
|
|
766
|
+ quick_feedback();
|
|
767
|
+ drawCurZSelection();
|
|
768
|
+ drawAxisValue(Z_AXIS);
|
|
769
|
+ }
|
|
770
|
+#endif
|
|
771
|
+
|
|
772
|
+static void disable_steppers() {
|
|
773
|
+ quick_feedback();
|
|
774
|
+ queue.inject_P(PSTR("M84"));
|
|
775
|
+}
|
|
776
|
+
|
|
777
|
+static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
|
|
778
|
+ uint16_t width = Images[imgBtn39Rounded].width;
|
|
779
|
+ uint16_t height = Images[imgBtn39Rounded].height;
|
|
780
|
+
|
|
781
|
+ if (!enabled) bgColor = COLOR_CONTROL_DISABLED;
|
|
782
|
+
|
|
783
|
+ tft.canvas(x, y, width, height);
|
|
784
|
+ tft.set_background(COLOR_BACKGROUND);
|
|
785
|
+ tft.add_image(0, 0, imgBtn39Rounded, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
|
|
786
|
+
|
|
787
|
+ // TODO: Make an add_text() taking a font arg
|
|
788
|
+ if (label) {
|
|
789
|
+ tft_string.set(label);
|
|
790
|
+ tft_string.trim();
|
|
791
|
+ tft.add_text(tft_string.center(width), height / 2 - tft_string.font_height() / 2, bgColor, tft_string);
|
|
792
|
+ }
|
|
793
|
+ else {
|
|
794
|
+ tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
|
|
795
|
+ }
|
|
796
|
+
|
|
797
|
+ TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
|
|
798
|
+}
|
530
|
799
|
void MarlinUI::move_axis_screen() {
|
|
800
|
+ // Reset
|
|
801
|
+ defer_status_screen(true);
|
|
802
|
+ motionAxisState.blocked = false;
|
|
803
|
+ TERN_(HAS_TFT_XPT2046, touch.enable());
|
|
804
|
+
|
|
805
|
+ ui.clear_lcd();
|
|
806
|
+
|
|
807
|
+ TERN_(TOUCH_SCREEN, touch.clear());
|
|
808
|
+
|
|
809
|
+ const bool busy = printingIsActive();
|
|
810
|
+
|
|
811
|
+ // Babysteps during printing? Select babystep for Z probe offset
|
|
812
|
+ if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET))
|
|
813
|
+ motionAxisState.z_selection = Z_SELECTION_Z_PROBE;
|
|
814
|
+
|
|
815
|
+ // ROW 1 -> E- Y- CurY Z+
|
|
816
|
+ int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
|
|
817
|
+
|
|
818
|
+ drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
|
|
819
|
+
|
|
820
|
+ spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
|
821
|
+ x += BTN_WIDTH + spacing;
|
|
822
|
+ uint16_t yplus_x = x;
|
|
823
|
+ drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
|
|
824
|
+
|
|
825
|
+ // Cur Y
|
|
826
|
+ x += BTN_WIDTH;
|
|
827
|
+ motionAxisState.yValuePos.x = x + 2;
|
|
828
|
+ motionAxisState.yValuePos.y = y;
|
|
829
|
+ drawAxisValue(Y_AXIS);
|
|
830
|
+
|
|
831
|
+ x += spacing;
|
|
832
|
+ drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
833
|
+
|
|
834
|
+ // ROW 2 -> "Ex" X- HOME X+ "Z"
|
|
835
|
+ y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
|
836
|
+ x = X_MARGIN;
|
|
837
|
+ spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4;
|
|
838
|
+
|
|
839
|
+ motionAxisState.eNamePos.x = x;
|
|
840
|
+ motionAxisState.eNamePos.y = y;
|
|
841
|
+ drawCurESelection();
|
|
842
|
+ TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
|
|
843
|
+
|
|
844
|
+ x += BTN_WIDTH + spacing;
|
|
845
|
+ drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
|
|
846
|
+
|
|
847
|
+ x += BTN_WIDTH + spacing; //imgHome is 64x64
|
|
848
|
+ TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
|
|
849
|
+
|
|
850
|
+ x += BTN_WIDTH + spacing;
|
|
851
|
+ uint16_t xplus_x = x;
|
|
852
|
+ drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
|
|
853
|
+
|
|
854
|
+ x += BTN_WIDTH + spacing;
|
|
855
|
+ motionAxisState.zTypePos.x = x;
|
|
856
|
+ motionAxisState.zTypePos.y = y;
|
|
857
|
+ drawCurZSelection();
|
|
858
|
+ #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
|
|
859
|
+ if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
|
|
860
|
+ #endif
|
|
861
|
+
|
|
862
|
+ // ROW 3 -> E- CurX Y- Z-
|
|
863
|
+ y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
|
|
864
|
+ x = X_MARGIN;
|
|
865
|
+ spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
|
|
866
|
+
|
|
867
|
+ drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
|
|
868
|
+
|
|
869
|
+ // Cur E
|
|
870
|
+ motionAxisState.eValuePos.x = x;
|
|
871
|
+ motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
|
|
872
|
+ drawAxisValue(E_AXIS);
|
|
873
|
+
|
|
874
|
+ // Cur X
|
|
875
|
+ motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
|
|
876
|
+ motionAxisState.xValuePos.y = y - 10;
|
|
877
|
+ drawAxisValue(X_AXIS);
|
|
878
|
+
|
|
879
|
+ x += BTN_WIDTH + spacing;
|
|
880
|
+ drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
|
|
881
|
+
|
|
882
|
+ x += BTN_WIDTH + spacing;
|
|
883
|
+ drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
|
|
884
|
+
|
|
885
|
+ // Cur Z
|
|
886
|
+ motionAxisState.zValuePos.x = x;
|
|
887
|
+ motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
|
|
888
|
+ drawAxisValue(Z_AXIS);
|
|
889
|
+
|
|
890
|
+ // ROW 4 -> step_size disable steppers back
|
|
891
|
+ y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT; //
|
|
892
|
+ x = xplus_x - CUR_STEP_VALUE_WIDTH - 10;
|
|
893
|
+ motionAxisState.stepValuePos.x = yplus_x + BTN_WIDTH - CUR_STEP_VALUE_WIDTH;
|
|
894
|
+ motionAxisState.stepValuePos.y = TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT;
|
|
895
|
+ if (!busy) {
|
|
896
|
+ drawCurStepValue();
|
|
897
|
+ TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
|
|
898
|
+ }
|
|
899
|
+
|
|
900
|
+ // aligned with x+
|
|
901
|
+ drawBtn(xplus_x, y, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
|
|
902
|
+
|
|
903
|
+ TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
|
531
|
904
|
}
|
532
|
905
|
|
533
|
906
|
#endif // HAS_UI_320x240
|