@@ -99,7 +99,7 @@ void ChironTFT::Startup() {
99
99
100
100
// Enable leveling and Disable end stops during print
101
101
// as Z home places nozzle above the bed so we need to allow it past the end stops
102
- injectCommands_P (AC_cmnd_enable_leveling);
102
+ injectCommands (AC_cmnd_enable_leveling);
103
103
104
104
// Startup tunes are defined in Tunes.h
105
105
PlayTune (BEEPER_PIN, TERN (AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1 );
@@ -244,15 +244,15 @@ void ChironTFT::StatusChange(const char * const msg) {
244
244
// If probing completes ok save the mesh and park
245
245
// Ignore the custom machine name
246
246
if (strcmp_P (msg + strlen (CUSTOM_MACHINE_NAME), MARLIN_msg_ready) == 0 ) {
247
- injectCommands_P ( PSTR (" M500\n G27" ));
247
+ injectCommands ( F (" M500\n G27" ));
248
248
SendtoTFTLN (AC_msg_probing_complete);
249
249
printer_state = AC_printer_idle;
250
250
msg_matched = true ;
251
251
}
252
252
// If probing fails don't save the mesh raise the probe above the bad point
253
253
if (strcmp_P (msg, MARLIN_msg_probing_failed) == 0 ) {
254
254
PlayTune (BEEPER_PIN, BeepBeepBeeep, 1 );
255
- injectCommands_P ( PSTR (" G1 Z50 F500" ));
255
+ injectCommands ( F (" G1 Z50 F500" ));
256
256
SendtoTFTLN (AC_msg_probing_complete);
257
257
printer_state = AC_printer_idle;
258
258
msg_matched = true ;
@@ -315,19 +315,20 @@ void ChironTFT::PrintComplete() {
315
315
setSoftEndstopState (true ); // enable endstops
316
316
}
317
317
318
- void ChironTFT::SendtoTFT (PGM_P str ) { // A helper to print PROGMEM string to the panel
318
+ void ChironTFT::SendtoTFT (FSTR_P const fstr ) { // A helper to print PROGMEM string to the panel
319
319
#if ACDEBUG(AC_SOME)
320
- SERIAL_ECHOPGM_P (str );
320
+ SERIAL_ECHOF (fstr );
321
321
#endif
322
+ PGM_P str = FTOP (fstr);
322
323
while (const char c = pgm_read_byte (str++)) TFTSer.write (c);
323
324
}
324
325
325
- void ChironTFT::SendtoTFTLN (PGM_P str = nullptr ) {
326
- if (str ) {
326
+ void ChironTFT::SendtoTFTLN (FSTR_P const fstr ) {
327
+ if (fstr ) {
327
328
#if ACDEBUG(AC_SOME)
328
329
SERIAL_ECHOPGM (" > " );
329
330
#endif
330
- SendtoTFT (str );
331
+ SendtoTFT (fstr );
331
332
#if ACDEBUG(AC_SOME)
332
333
SERIAL_EOL ();
333
334
#endif
@@ -426,9 +427,9 @@ void ChironTFT::SendFileList(int8_t startindex) {
426
427
#if ACDEBUG(AC_INFO)
427
428
SERIAL_ECHOLNPGM (" ## SendFileList ## " , startindex);
428
429
#endif
429
- SendtoTFTLN (PSTR (" FN " ));
430
+ SendtoTFTLN (F (" FN " ));
430
431
filenavigator.getFiles (startindex, panel_type, 4 );
431
- SendtoTFTLN (PSTR (" END" ));
432
+ SendtoTFTLN (F (" END" ));
432
433
}
433
434
434
435
void ChironTFT::SelectFile () {
@@ -512,55 +513,55 @@ void ChironTFT::PanelInfo(uint8_t req) {
512
513
// information requests A0-A8 and A33
513
514
switch (req) {
514
515
case 0 : // A0 Get HOTEND Temp
515
- SendtoTFT (PSTR (" A0V " ));
516
+ SendtoTFT (F (" A0V " ));
516
517
TFTSer.println (getActualTemp_celsius (E0 ));
517
518
break ;
518
519
519
520
case 1 : // A1 Get HOTEND Target Temp
520
- SendtoTFT (PSTR (" A1V " ));
521
+ SendtoTFT (F (" A1V " ));
521
522
TFTSer.println (getTargetTemp_celsius (E0 ));
522
523
break ;
523
524
524
525
case 2 : // A2 Get BED Temp
525
- SendtoTFT (PSTR (" A2V " ));
526
+ SendtoTFT (F (" A2V " ));
526
527
TFTSer.println (getActualTemp_celsius (BED));
527
528
break ;
528
529
529
530
case 3 : // A3 Get BED Target Temp
530
- SendtoTFT (PSTR (" A3V " ));
531
+ SendtoTFT (F (" A3V " ));
531
532
TFTSer.println (getTargetTemp_celsius (BED));
532
533
break ;
533
534
534
535
case 4 : // A4 Get FAN Speed
535
- SendtoTFT (PSTR (" A4V " ));
536
+ SendtoTFT (F (" A4V " ));
536
537
TFTSer.println (getActualFan_percent (FAN0));
537
538
break ;
538
539
539
540
case 5 : // A5 Get Current Coordinates
540
- SendtoTFT (PSTR (" A5V X: " ));
541
+ SendtoTFT (F (" A5V X: " ));
541
542
TFTSer.print (getAxisPosition_mm (X));
542
- SendtoTFT (PSTR (" Y: " ));
543
+ SendtoTFT (F (" Y: " ));
543
544
TFTSer.print (getAxisPosition_mm (Y));
544
- SendtoTFT (PSTR (" Z: " ));
545
+ SendtoTFT (F (" Z: " ));
545
546
TFTSer.println (getAxisPosition_mm (Z));
546
547
break ;
547
548
548
549
case 6 : // A6 Get printing progress
549
550
if (isPrintingFromMedia ()) {
550
- SendtoTFT (PSTR (" A6V " ));
551
+ SendtoTFT (F (" A6V " ));
551
552
TFTSer.println (ui8tostr2 (getProgress_percent ()));
552
553
}
553
554
else
554
- SendtoTFTLN (PSTR (" A6V ---" ));
555
+ SendtoTFTLN (F (" A6V ---" ));
555
556
break ;
556
557
557
558
case 7 : { // A7 Get Printing Time
558
559
uint32_t time = getProgress_seconds_elapsed () / 60 ;
559
- SendtoTFT (PSTR (" A7V " ));
560
+ SendtoTFT (F (" A7V " ));
560
561
TFTSer.print (ui8tostr2 (time / 60 ));
561
- SendtoTFT (PSTR (" H " ));
562
+ SendtoTFT (F (" H " ));
562
563
TFTSer.print (ui8tostr2 (time % 60 ));
563
- SendtoTFT (PSTR (" M" ));
564
+ SendtoTFT (F (" M" ));
564
565
#if ACDEBUG(AC_ALL)
565
566
SERIAL_ECHOLNPGM (" Print time " , ui8tostr2 (time / 60 ), " :" , ui8tostr2 (time % 60 ));
566
567
#endif
@@ -575,9 +576,9 @@ void ChironTFT::PanelInfo(uint8_t req) {
575
576
break ;
576
577
577
578
case 33 : // A33 Get firmware info
578
- SendtoTFT (PSTR (" J33 " ));
579
+ SendtoTFT (F (" J33 " ));
579
580
// If there is an error recorded, show that instead of the FW version
580
- if (!GetLastError ()) SendtoTFTLN (PSTR (SHORT_BUILD_VERSION));
581
+ if (!GetLastError ()) SendtoTFTLN (F (SHORT_BUILD_VERSION));
581
582
break ;
582
583
}
583
584
}
@@ -608,7 +609,7 @@ void ChironTFT::PanelAction(uint8_t req) {
608
609
}
609
610
else {
610
611
if (printer_state == AC_printer_resuming_from_power_outage)
611
- injectCommands_P ( PSTR (" M1000 C" )); // Cancel recovery
612
+ injectCommands ( F (" M1000 C" )); // Cancel recovery
612
613
SendtoTFTLN (AC_msg_stop);
613
614
printer_state = AC_printer_idle;
614
615
}
@@ -625,7 +626,7 @@ void ChironTFT::PanelAction(uint8_t req) {
625
626
case 14 : { // A14 Start Printing
626
627
// Allows printer to restart the job if we don't want to recover
627
628
if (printer_state == AC_printer_resuming_from_power_outage) {
628
- injectCommands_P ( PSTR (" M1000 C" )); // Cancel recovery
629
+ injectCommands ( F (" M1000 C" )); // Cancel recovery
629
630
printer_state = AC_printer_idle;
630
631
}
631
632
#if ACDebugLevel >= 1
@@ -638,8 +639,8 @@ void ChironTFT::PanelAction(uint8_t req) {
638
639
case 15 : // A15 Resuming from outage
639
640
if (printer_state == AC_printer_resuming_from_power_outage) {
640
641
// Need to home here to restore the Z position
641
- injectCommands_P (AC_cmnd_power_loss_recovery);
642
- injectCommands_P ( PSTR (" M1000" )); // home and start recovery
642
+ injectCommands (AC_cmnd_power_loss_recovery);
643
+ injectCommands ( F (" M1000" )); // home and start recovery
643
644
}
644
645
break ;
645
646
@@ -675,17 +676,17 @@ void ChironTFT::PanelAction(uint8_t req) {
675
676
if (panel_command[4 ] == ' S' )
676
677
setFeedrate_percent (atoi (&panel_command[5 ]));
677
678
else {
678
- SendtoTFT (PSTR (" A20V " ));
679
+ SendtoTFT (F (" A20V " ));
679
680
TFTSer.println (getFeedrate_percent ());
680
681
}
681
682
break ;
682
683
683
684
case 21 : // A21 Home Axis A21 X
684
685
if (!isPrinting ()) {
685
686
switch ((char )panel_command[4 ]) {
686
- case ' X' : injectCommands_P ( PSTR (" G28X" )); break ;
687
- case ' Y' : injectCommands_P ( PSTR (" G28Y" )); break ;
688
- case ' Z' : injectCommands_P ( PSTR (" G28Z" )); break ;
687
+ case ' X' : injectCommands ( F (" G28X" )); break ;
688
+ case ' Y' : injectCommands ( F (" G28Y" )); break ;
689
+ case ' Z' : injectCommands ( F (" G28Z" )); break ;
689
690
case ' C' : injectCommands_P (G28_STR); break ;
690
691
}
691
692
}
@@ -771,7 +772,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
771
772
pos.y = atoi (&panel_command[FindToken (' Y' )+1 ]);
772
773
pos_z = getMeshPoint (pos);
773
774
774
- SendtoTFT (PSTR (" A29V " ));
775
+ SendtoTFT (F (" A29V " ));
775
776
TFTSer.println (pos_z * 100 );
776
777
if (!isPrinting ()) {
777
778
setSoftEndstopState (true ); // disable endstops
@@ -809,7 +810,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
809
810
810
811
811
812
SendtoTFTLN (AC_msg_start_probing);
812
- injectCommands_P ( PSTR (" G28\n G29" ));
813
+ injectCommands ( F (" G28\n G29" ));
813
814
printer_state = AC_printer_probing;
814
815
}
815
816
}
@@ -823,7 +824,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
823
824
824
825
if (FindToken (' C' ) != -1 ) { // Restore and apply original offsets
825
826
if (!isPrinting ()) {
826
- injectCommands_P ( PSTR (" M501\n M420 S1" ));
827
+ injectCommands ( F (" M501\n M420 S1" ));
827
828
selectedmeshpoint.x = selectedmeshpoint.y = 99 ;
828
829
SERIAL_ECHOLNF (AC_msg_mesh_changes_abandoned);
829
830
}
@@ -832,14 +833,14 @@ void ChironTFT::PanelProcess(uint8_t req) {
832
833
else if (FindToken (' D' ) != -1 ) { // Save Z Offset tables and restore leveling state
833
834
if (!isPrinting ()) {
834
835
setAxisPosition_mm (1.0 ,Z); // Lift nozzle before any further movements are made
835
- injectCommands_P ( PSTR (" M500" ));
836
+ injectCommands ( F (" M500" ));
836
837
SERIAL_ECHOLNF (AC_msg_mesh_changes_saved);
837
838
selectedmeshpoint.x = selectedmeshpoint.y = 99 ;
838
839
}
839
840
}
840
841
841
842
else if (FindToken (' G' ) != -1 ) { // Get current offset
842
- SendtoTFT (PSTR (" A31V " ));
843
+ SendtoTFT (F (" A31V " ));
843
844
// When printing use the live z Offset position
844
845
// we will use babystepping to move the print head
845
846
if (isPrinting ())
@@ -874,7 +875,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
874
875
babystepAxis_steps (steps, Z);
875
876
live_Zoffset += Zshift;
876
877
}
877
- SendtoTFT (PSTR (" A31V " ));
878
+ SendtoTFT (F (" A31V " ));
878
879
TFTSer.println (live_Zoffset);
879
880
}
880
881
else {
@@ -892,7 +893,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
892
893
#endif
893
894
894
895
setZOffset_mm (currZOffset + Zshift);
895
- SendtoTFT (PSTR (" A31V " ));
896
+ SendtoTFT (F (" A31V " ));
896
897
TFTSer.println (getZOffset_mm ());
897
898
898
899
if (isAxisPositionKnown (Z)) {
@@ -911,15 +912,15 @@ void ChironTFT::PanelProcess(uint8_t req) {
911
912
case 32 : { // A32 clean leveling beep flag
912
913
// Ignore request if printing
913
914
// if (isPrinting()) break;
914
- // injectCommands_P(PSTR ("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
915
+ // injectCommands(F ("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
915
916
// TFTSer.println();
916
917
} break ;
917
918
918
919
// A33 firmware info request see PanelInfo()
919
920
920
921
case 34 : { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
921
922
if (panel_command[3 ] == ' C' ) { // Restore original offsets
922
- injectCommands_P ( PSTR (" M501\n M420 S1" ));
923
+ injectCommands ( F (" M501\n M420 S1" ));
923
924
selectedmeshpoint.x = selectedmeshpoint.y = 99 ;
924
925
// printer_state = AC_printer_idle;
925
926
}
0 commit comments