@@ -86,13 +86,23 @@ void ChironTFT::Startup() {
86
86
TFTSer.begin (115200 );
87
87
88
88
// wait for the TFT panel to initialise and finish the animation
89
- delay_ms ( 250 );
89
+ safe_delay ( 1000 );
90
90
91
91
// There are different panels for the Chiron with slightly different commands
92
92
// So we need to know what we are working with.
93
-
94
93
// Panel type can be defined otherwise detect it automatically
95
- if (panel_type == AC_panel_unknown) DetectPanelType ();
94
+ switch (panel_type) {
95
+ case AC_panel_new:
96
+ SERIAL_ECHOLNF (AC_msg_new_panel_set);
97
+ break ;
98
+ case AC_panel_standard:
99
+ SERIAL_ECHOLNF (AC_msg_old_panel_set);
100
+ break ;
101
+ default :
102
+ SERIAL_ECHOLNF (AC_msg_auto_panel_detection);
103
+ DetectPanelType ();
104
+ break ;
105
+ }
96
106
97
107
// Signal Board has reset
98
108
SendtoTFTLN (AC_msg_main_board_has_reset);
@@ -358,15 +368,14 @@ bool ChironTFT::ReadTFTCommand() {
358
368
}
359
369
360
370
int8_t ChironTFT::FindToken (char c) {
361
- int8_t pos = 0 ;
362
- do {
371
+ for (int8_t pos = 0 ; pos < command_len; pos++) {
363
372
if (panel_command[pos] == c) {
364
373
#if ACDEBUG(AC_INFO)
365
374
SERIAL_ECHOLNPGM (" Tpos:" , pos, " " , c);
366
375
#endif
367
376
return pos;
368
377
}
369
- } while (++pos < command_len);
378
+ }
370
379
#if ACDEBUG(AC_INFO)
371
380
SERIAL_ECHOLNPGM (" Not found: " , c);
372
381
#endif
@@ -623,18 +632,18 @@ void ChironTFT::PanelAction(uint8_t req) {
623
632
SelectFile ();
624
633
break ;
625
634
626
- case 14 : { // A14 Start Printing
635
+ case 14 : // A14 Start Printing
627
636
// Allows printer to restart the job if we don't want to recover
628
637
if (printer_state == AC_printer_resuming_from_power_outage) {
629
638
injectCommands (F (" M1000 C" )); // Cancel recovery
630
639
printer_state = AC_printer_idle;
631
640
}
632
641
#if ACDebugLevel >= 1
633
- SERIAL_ECHOLNPAIR_F (" Print: " , selectedfile);
642
+ SERIAL_ECHOLNPGM (" Print: " , selectedfile);
634
643
#endif
635
644
printFile (selectedfile);
636
645
SendtoTFTLN (AC_msg_print_from_sd_card);
637
- } break ;
646
+ break ;
638
647
639
648
case 15 : // A15 Resuming from outage
640
649
if (printer_state == AC_printer_resuming_from_power_outage) {
@@ -801,25 +810,22 @@ void ChironTFT::PanelProcess(uint8_t req) {
801
810
}
802
811
} break ;
803
812
804
- case 30 : { // A30 Auto leveling
813
+ case 30 : // A30 Auto leveling
805
814
if (FindToken (' S' ) != -1 ) { // Start probing New panel adds spaces..
806
815
// Ignore request if printing
807
816
if (isPrinting ())
808
817
SendtoTFTLN (AC_msg_probing_not_allowed); // forbid auto leveling
809
818
else {
810
-
811
-
812
819
SendtoTFTLN (AC_msg_start_probing);
813
820
injectCommands (F (" G28\n G29" ));
814
821
printer_state = AC_printer_probing;
815
822
}
816
823
}
817
- else {
824
+ else
818
825
SendtoTFTLN (AC_msg_start_probing); // Just enter levelling menu
819
- }
820
- } break ;
826
+ break ;
821
827
822
- case 31 : { // A31 Adjust all Probe Points
828
+ case 31 : // A31 Adjust all Probe Points
823
829
// The tokens can occur in different places on the new panel so we need to find it.
824
830
825
831
if (FindToken (' C' ) != -1 ) { // Restore and apply original offsets
@@ -907,18 +913,18 @@ void ChironTFT::PanelProcess(uint8_t req) {
907
913
}
908
914
}
909
915
}
910
- } break ;
916
+ break ;
911
917
912
- case 32 : { // A32 clean leveling beep flag
918
+ case 32 : // A32 clean leveling beep flag
913
919
// Ignore request if printing
914
920
// if (isPrinting()) break;
915
921
// injectCommands(F("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
916
922
// TFTSer.println();
917
- } break ;
923
+ break ;
918
924
919
925
// A33 firmware info request see PanelInfo()
920
926
921
- case 34 : { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
927
+ case 34 : // A34 Adjust single mesh point A34 C/S X1 Y1 V123
922
928
if (panel_command[3 ] == ' C' ) { // Restore original offsets
923
929
injectCommands (F (" M501\n M420 S1" ));
924
930
selectedmeshpoint.x = selectedmeshpoint.y = 99 ;
@@ -950,7 +956,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
950
956
}
951
957
}
952
958
}
953
- } break ;
959
+ break ;
954
960
955
961
case 36 : // A36 Auto leveling for new TFT bet that was a typo in the panel code!
956
962
SendtoTFTLN (AC_msg_start_probing);
0 commit comments