|
@@ -526,95 +526,148 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
526
|
526
|
#if ENABLED(CUSTOM_USER_BUTTONS)
|
527
|
527
|
// Handle a custom user button if defined
|
528
|
528
|
const bool printer_not_busy = !printingIsActive();
|
529
|
|
- #define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(BUTTON##N) && defined(BUTTON##N##_HIT_STATE) && defined(BUTTON##N##_GCODE) && defined(BUTTON##N##_DESC))
|
530
|
|
- #define CHECK_CUSTOM_USER_BUTTON(N) do{ \
|
|
529
|
+ const millis_t ms = millis();
|
|
530
|
+ #define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(BUTTON##N) && defined(BUTTON##N##_HIT_STATE) && defined(BUTTON##N##_GCODE))
|
|
531
|
+ #define HAS_BETTER_USER_BUTTON(N) HAS_CUSTOM_USER_BUTTON(N) && defined(BUTTON##N##_DESC)
|
|
532
|
+ #define _CHECK_CUSTOM_USER_BUTTON(N, CODE) do{ \
|
531
|
533
|
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 250UL; \
|
532
|
534
|
static millis_t next_cub_ms_##N; \
|
533
|
535
|
if (BUTTON##N##_HIT_STATE == READ(BUTTON##N##_PIN) \
|
534
|
536
|
&& (ENABLED(BUTTON##N##_WHEN_PRINTING) || printer_not_busy)) { \
|
535
|
|
- const millis_t ms = millis(); \
|
536
|
537
|
if (ELAPSED(ms, next_cub_ms_##N)) { \
|
537
|
538
|
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
|
538
|
|
- if (strlen(BUTTON##N##_DESC)) \
|
539
|
|
- LCD_MESSAGEPGM_P(PSTR(BUTTON##N##_DESC)); \
|
|
539
|
+ CODE; \
|
540
|
540
|
queue.inject_P(PSTR(BUTTON##N##_GCODE)); \
|
541
|
541
|
} \
|
542
|
542
|
} \
|
543
|
543
|
}while(0)
|
544
|
544
|
|
545
|
|
- #if HAS_CUSTOM_USER_BUTTON(1)
|
|
545
|
+ #define CHECK_CUSTOM_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, NOOP)
|
|
546
|
+ #define CHECK_BETTER_USER_BUTTON(N) _CHECK_CUSTOM_USER_BUTTON(N, if (strlen(BUTTON##N##_DESC)) LCD_MESSAGEPGM_P(PSTR(BUTTON##N##_DESC)))
|
|
547
|
+
|
|
548
|
+ #if HAS_BETTER_USER_BUTTON(1)
|
|
549
|
+ CHECK_BETTER_USER_BUTTON(1);
|
|
550
|
+ #elif HAS_CUSTOM_USER_BUTTON(1)
|
546
|
551
|
CHECK_CUSTOM_USER_BUTTON(1);
|
547
|
552
|
#endif
|
548
|
|
- #if HAS_CUSTOM_USER_BUTTON(2)
|
|
553
|
+ #if HAS_BETTER_USER_BUTTON(2)
|
|
554
|
+ CHECK_BETTER_USER_BUTTON(2);
|
|
555
|
+ #elif HAS_CUSTOM_USER_BUTTON(2)
|
549
|
556
|
CHECK_CUSTOM_USER_BUTTON(2);
|
550
|
557
|
#endif
|
551
|
|
- #if HAS_CUSTOM_USER_BUTTON(3)
|
|
558
|
+ #if HAS_BETTER_USER_BUTTON(3)
|
|
559
|
+ CHECK_BETTER_USER_BUTTON(3);
|
|
560
|
+ #elif HAS_CUSTOM_USER_BUTTON(3)
|
552
|
561
|
CHECK_CUSTOM_USER_BUTTON(3);
|
553
|
562
|
#endif
|
554
|
|
- #if HAS_CUSTOM_USER_BUTTON(4)
|
|
563
|
+ #if HAS_BETTER_USER_BUTTON(4)
|
|
564
|
+ CHECK_BETTER_USER_BUTTON(4);
|
|
565
|
+ #elif HAS_CUSTOM_USER_BUTTON(4)
|
555
|
566
|
CHECK_CUSTOM_USER_BUTTON(4);
|
556
|
567
|
#endif
|
557
|
|
- #if HAS_CUSTOM_USER_BUTTON(5)
|
|
568
|
+ #if HAS_BETTER_USER_BUTTON(5)
|
|
569
|
+ CHECK_BETTER_USER_BUTTON(5);
|
|
570
|
+ #elif HAS_CUSTOM_USER_BUTTON(5)
|
558
|
571
|
CHECK_CUSTOM_USER_BUTTON(5);
|
559
|
572
|
#endif
|
560
|
|
- #if HAS_CUSTOM_USER_BUTTON(6)
|
|
573
|
+ #if HAS_BETTER_USER_BUTTON(6)
|
|
574
|
+ CHECK_BETTER_USER_BUTTON(6);
|
|
575
|
+ #elif HAS_CUSTOM_USER_BUTTON(6)
|
561
|
576
|
CHECK_CUSTOM_USER_BUTTON(6);
|
562
|
577
|
#endif
|
563
|
|
- #if HAS_CUSTOM_USER_BUTTON(7)
|
|
578
|
+ #if HAS_BETTER_USER_BUTTON(7)
|
|
579
|
+ CHECK_BETTER_USER_BUTTON(7);
|
|
580
|
+ #elif HAS_CUSTOM_USER_BUTTON(7)
|
564
|
581
|
CHECK_CUSTOM_USER_BUTTON(7);
|
565
|
582
|
#endif
|
566
|
|
- #if HAS_CUSTOM_USER_BUTTON(8)
|
|
583
|
+ #if HAS_BETTER_USER_BUTTON(8)
|
|
584
|
+ CHECK_BETTER_USER_BUTTON(8);
|
|
585
|
+ #elif HAS_CUSTOM_USER_BUTTON(8)
|
567
|
586
|
CHECK_CUSTOM_USER_BUTTON(8);
|
568
|
587
|
#endif
|
569
|
|
- #if HAS_CUSTOM_USER_BUTTON(9)
|
|
588
|
+ #if HAS_BETTER_USER_BUTTON(9)
|
|
589
|
+ CHECK_BETTER_USER_BUTTON(9);
|
|
590
|
+ #elif HAS_CUSTOM_USER_BUTTON(9)
|
570
|
591
|
CHECK_CUSTOM_USER_BUTTON(9);
|
571
|
592
|
#endif
|
572
|
|
- #if HAS_CUSTOM_USER_BUTTON(10)
|
|
593
|
+ #if HAS_BETTER_USER_BUTTON(10)
|
|
594
|
+ CHECK_BETTER_USER_BUTTON(10);
|
|
595
|
+ #elif HAS_CUSTOM_USER_BUTTON(10)
|
573
|
596
|
CHECK_CUSTOM_USER_BUTTON(10);
|
574
|
597
|
#endif
|
575
|
|
- #if HAS_CUSTOM_USER_BUTTON(11)
|
|
598
|
+ #if HAS_BETTER_USER_BUTTON(11)
|
|
599
|
+ CHECK_BETTER_USER_BUTTON(11);
|
|
600
|
+ #elif HAS_CUSTOM_USER_BUTTON(11)
|
576
|
601
|
CHECK_CUSTOM_USER_BUTTON(11);
|
577
|
602
|
#endif
|
578
|
|
- #if HAS_CUSTOM_USER_BUTTON(12)
|
|
603
|
+ #if HAS_BETTER_USER_BUTTON(12)
|
|
604
|
+ CHECK_BETTER_USER_BUTTON(12);
|
|
605
|
+ #elif HAS_CUSTOM_USER_BUTTON(12)
|
579
|
606
|
CHECK_CUSTOM_USER_BUTTON(12);
|
580
|
607
|
#endif
|
581
|
|
- #if HAS_CUSTOM_USER_BUTTON(13)
|
|
608
|
+ #if HAS_BETTER_USER_BUTTON(13)
|
|
609
|
+ CHECK_BETTER_USER_BUTTON(13);
|
|
610
|
+ #elif HAS_CUSTOM_USER_BUTTON(13)
|
582
|
611
|
CHECK_CUSTOM_USER_BUTTON(13);
|
583
|
612
|
#endif
|
584
|
|
- #if HAS_CUSTOM_USER_BUTTON(14)
|
|
613
|
+ #if HAS_BETTER_USER_BUTTON(14)
|
|
614
|
+ CHECK_BETTER_USER_BUTTON(14);
|
|
615
|
+ #elif HAS_CUSTOM_USER_BUTTON(14)
|
585
|
616
|
CHECK_CUSTOM_USER_BUTTON(14);
|
586
|
617
|
#endif
|
587
|
|
- #if HAS_CUSTOM_USER_BUTTON(15)
|
|
618
|
+ #if HAS_BETTER_USER_BUTTON(15)
|
|
619
|
+ CHECK_BETTER_USER_BUTTON(15);
|
|
620
|
+ #elif HAS_CUSTOM_USER_BUTTON(15)
|
588
|
621
|
CHECK_CUSTOM_USER_BUTTON(15);
|
589
|
622
|
#endif
|
590
|
|
- #if HAS_CUSTOM_USER_BUTTON(16)
|
|
623
|
+ #if HAS_BETTER_USER_BUTTON(16)
|
|
624
|
+ CHECK_BETTER_USER_BUTTON(16);
|
|
625
|
+ #elif HAS_CUSTOM_USER_BUTTON(16)
|
591
|
626
|
CHECK_CUSTOM_USER_BUTTON(16);
|
592
|
627
|
#endif
|
593
|
|
- #if HAS_CUSTOM_USER_BUTTON(17)
|
|
628
|
+ #if HAS_BETTER_USER_BUTTON(17)
|
|
629
|
+ CHECK_BETTER_USER_BUTTON(17);
|
|
630
|
+ #elif HAS_CUSTOM_USER_BUTTON(17)
|
594
|
631
|
CHECK_CUSTOM_USER_BUTTON(17);
|
595
|
632
|
#endif
|
596
|
|
- #if HAS_CUSTOM_USER_BUTTON(18)
|
|
633
|
+ #if HAS_BETTER_USER_BUTTON(18)
|
|
634
|
+ CHECK_BETTER_USER_BUTTON(18);
|
|
635
|
+ #elif HAS_CUSTOM_USER_BUTTON(18)
|
597
|
636
|
CHECK_CUSTOM_USER_BUTTON(18);
|
598
|
637
|
#endif
|
599
|
|
- #if HAS_CUSTOM_USER_BUTTON(19)
|
|
638
|
+ #if HAS_BETTER_USER_BUTTON(19)
|
|
639
|
+ CHECK_BETTER_USER_BUTTON(19);
|
|
640
|
+ #elif HAS_CUSTOM_USER_BUTTON(19)
|
600
|
641
|
CHECK_CUSTOM_USER_BUTTON(19);
|
601
|
642
|
#endif
|
602
|
|
- #if HAS_CUSTOM_USER_BUTTON(20)
|
|
643
|
+ #if HAS_BETTER_USER_BUTTON(20)
|
|
644
|
+ CHECK_BETTER_USER_BUTTON(20);
|
|
645
|
+ #elif HAS_CUSTOM_USER_BUTTON(20)
|
603
|
646
|
CHECK_CUSTOM_USER_BUTTON(20);
|
604
|
647
|
#endif
|
605
|
|
- #if HAS_CUSTOM_USER_BUTTON(21)
|
|
648
|
+ #if HAS_BETTER_USER_BUTTON(21)
|
|
649
|
+ CHECK_BETTER_USER_BUTTON(21);
|
|
650
|
+ #elif HAS_CUSTOM_USER_BUTTON(21)
|
606
|
651
|
CHECK_CUSTOM_USER_BUTTON(21);
|
607
|
652
|
#endif
|
608
|
|
- #if HAS_CUSTOM_USER_BUTTON(22)
|
|
653
|
+ #if HAS_BETTER_USER_BUTTON(22)
|
|
654
|
+ CHECK_BETTER_USER_BUTTON(22);
|
|
655
|
+ #elif HAS_CUSTOM_USER_BUTTON(22)
|
609
|
656
|
CHECK_CUSTOM_USER_BUTTON(22);
|
610
|
657
|
#endif
|
611
|
|
- #if HAS_CUSTOM_USER_BUTTON(23)
|
|
658
|
+ #if HAS_BETTER_USER_BUTTON(23)
|
|
659
|
+ CHECK_BETTER_USER_BUTTON(23);
|
|
660
|
+ #elif HAS_CUSTOM_USER_BUTTON(23)
|
612
|
661
|
CHECK_CUSTOM_USER_BUTTON(23);
|
613
|
662
|
#endif
|
614
|
|
- #if HAS_CUSTOM_USER_BUTTON(24)
|
|
663
|
+ #if HAS_BETTER_USER_BUTTON(24)
|
|
664
|
+ CHECK_BETTER_USER_BUTTON(24);
|
|
665
|
+ #elif HAS_CUSTOM_USER_BUTTON(24)
|
615
|
666
|
CHECK_CUSTOM_USER_BUTTON(24);
|
616
|
667
|
#endif
|
617
|
|
- #if HAS_CUSTOM_USER_BUTTON(25)
|
|
668
|
+ #if HAS_BETTER_USER_BUTTON(25)
|
|
669
|
+ CHECK_BETTER_USER_BUTTON(25);
|
|
670
|
+ #elif HAS_CUSTOM_USER_BUTTON(25)
|
618
|
671
|
CHECK_CUSTOM_USER_BUTTON(25);
|
619
|
672
|
#endif
|
620
|
673
|
#endif
|