|
@@ -442,7 +442,7 @@ void ChironTFT::SendFileList(int8_t startindex) {
|
442
|
442
|
}
|
443
|
443
|
|
444
|
444
|
void ChironTFT::SelectFile() {
|
445
|
|
- if (panel_type == AC_panel_new) {
|
|
445
|
+ if (panel_type <= AC_panel_new) {
|
446
|
446
|
strncpy(selectedfile, panel_command + 4, command_len - 3);
|
447
|
447
|
selectedfile[command_len - 4] = '\0';
|
448
|
448
|
}
|
|
@@ -465,7 +465,7 @@ void ChironTFT::SelectFile() {
|
465
|
465
|
break;
|
466
|
466
|
default: // enter sub folder
|
467
|
467
|
// for new panel remove the '.GCO' tag that was added to the end of the path
|
468
|
|
- if (panel_type == AC_panel_new)
|
|
468
|
+ if (panel_type <= AC_panel_new)
|
469
|
469
|
selectedfile[strlen(selectedfile) - 4] = '\0';
|
470
|
470
|
filenavigator.changeDIR(selectedfile);
|
471
|
471
|
SendtoTFTLN(AC_msg_sd_file_open_failed);
|
|
@@ -478,8 +478,8 @@ void ChironTFT::ProcessPanelRequest() {
|
478
|
478
|
// Break these up into logical blocks // as its easier to navigate than one huge switch case!
|
479
|
479
|
int8_t tpos = FindToken('A');
|
480
|
480
|
// Panel request are 'A0' - 'A36'
|
481
|
|
- if (tpos != -1) {
|
482
|
|
- const int8_t req = atoi(&panel_command[tpos+1]);
|
|
481
|
+ if (tpos >= 0) {
|
|
482
|
+ const int8_t req = atoi(&panel_command[tpos + 1]);
|
483
|
483
|
|
484
|
484
|
// Information requests A0 - A8 and A33
|
485
|
485
|
if (req <= 8 || req == 33) PanelInfo(req);
|
|
@@ -495,16 +495,18 @@ void ChironTFT::ProcessPanelRequest() {
|
495
|
495
|
// This may be a response to a panel type detection query
|
496
|
496
|
if (panel_type == AC_panel_unknown) {
|
497
|
497
|
tpos = FindToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320'
|
498
|
|
- if (tpos != -1) {
|
499
|
|
- if (panel_command[tpos+1]== 'X' && panel_command[tpos+2]=='Y') {
|
|
498
|
+ if (tpos >= 0) {
|
|
499
|
+ if (panel_command[tpos + 1] == 'X' && panel_command[tpos + 2] =='Y') {
|
500
|
500
|
panel_type = AC_panel_standard;
|
501
|
501
|
SERIAL_ECHOLNF(AC_msg_old_panel_detected);
|
502
|
502
|
}
|
503
|
503
|
}
|
504
|
504
|
else {
|
505
|
|
- tpos = FindToken('['); // new panel will respond to 'J200' with '[0]=0'
|
506
|
|
- if (tpos != -1) {
|
507
|
|
- if (panel_command[tpos+1]== '0' && panel_command[tpos+2]==']') {
|
|
505
|
+ // new panel will respond to 'J200' with '[0]=0'
|
|
506
|
+ // it seems only after a power cycle so detection assumes a new panel
|
|
507
|
+ tpos = FindToken('[');
|
|
508
|
+ if (tpos >= 0) {
|
|
509
|
+ if (panel_command[tpos + 1] == '0' && panel_command[tpos + 2] ==']') {
|
508
|
510
|
panel_type = AC_panel_new;
|
509
|
511
|
SERIAL_ECHOLNF(AC_msg_new_panel_detected);
|
510
|
512
|
}
|
|
@@ -811,7 +813,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
811
|
813
|
} break;
|
812
|
814
|
|
813
|
815
|
case 30: // A30 Auto leveling
|
814
|
|
- if (FindToken('S') != -1) { // Start probing New panel adds spaces..
|
|
816
|
+ if (FindToken('S') >= 0) { // Start probing New panel adds spaces..
|
815
|
817
|
// Ignore request if printing
|
816
|
818
|
if (isPrinting())
|
817
|
819
|
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
|
|
@@ -828,7 +830,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
828
|
830
|
case 31: // A31 Adjust all Probe Points
|
829
|
831
|
// The tokens can occur in different places on the new panel so we need to find it.
|
830
|
832
|
|
831
|
|
- if (FindToken('C') != -1) { // Restore and apply original offsets
|
|
833
|
+ if (FindToken('C') >= 0) { // Restore and apply original offsets
|
832
|
834
|
if (!isPrinting()) {
|
833
|
835
|
injectCommands(F("M501\nM420 S1"));
|
834
|
836
|
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
|
@@ -836,7 +838,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
836
|
838
|
}
|
837
|
839
|
}
|
838
|
840
|
|
839
|
|
- else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state
|
|
841
|
+ else if (FindToken('D') >= 0) { // Save Z Offset tables and restore leveling state
|
840
|
842
|
if (!isPrinting()) {
|
841
|
843
|
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
|
842
|
844
|
injectCommands(F("M500"));
|
|
@@ -845,7 +847,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
845
|
847
|
}
|
846
|
848
|
}
|
847
|
849
|
|
848
|
|
- else if (FindToken('G') != -1) { // Get current offset
|
|
850
|
+ else if (FindToken('G') >= 0) { // Get current offset
|
849
|
851
|
SendtoTFT(F("A31V "));
|
850
|
852
|
// When printing use the live z Offset position
|
851
|
853
|
// we will use babystepping to move the print head
|
|
@@ -859,7 +861,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
|
859
|
861
|
|
860
|
862
|
else {
|
861
|
863
|
int8_t tokenpos = FindToken('S');
|
862
|
|
- if (tokenpos != -1) { // Set offset (adjusts all points by value)
|
|
864
|
+ if (tokenpos >= 0) { // Set offset (adjusts all points by value)
|
863
|
865
|
float Zshift = atof(&panel_command[tokenpos+1]);
|
864
|
866
|
setSoftEndstopState(false); // disable endstops
|
865
|
867
|
// Allow temporary Z position nudging during print
|