Browse Source

Code cleanup: Move texts to messages.c/h

leptun 4 years ago
parent
commit
61c7479579
5 changed files with 12 additions and 6 deletions
  1. 1 1
      Firmware/Marlin_main.cpp
  2. 3 0
      Firmware/messages.c
  3. 3 0
      Firmware/messages.h
  4. 2 2
      Firmware/temperature.cpp
  5. 3 3
      Firmware/ultralcd.cpp

+ 1 - 1
Firmware/Marlin_main.cpp

@@ -619,7 +619,7 @@ void crashdet_cancel()
 	if (saved_printing_type == PRINTING_TYPE_SD) {
 		lcd_print_stop();
 	}else if(saved_printing_type == PRINTING_TYPE_USB){
-		SERIAL_ECHOLNPGM("// action:cancel"); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI
+		SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI
 		SERIAL_PROTOCOLLNRPGM(MSG_OK);
 	}
 }

+ 3 - 0
Firmware/messages.c

@@ -131,3 +131,6 @@ const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix th
 const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; ////
 const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; ////
 const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; ////
+const char MSG_OCTOPRINT_CANCEL[] PROGMEM_N1 = "// action:cancel"; ////
+const char MSG_FANCHECK_EXTRUDER[] PROGMEM_N1 = "Err: EXTR. FAN ERROR"; ////c=20
+const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err: PRINT FAN ERROR"; ////c=20

+ 3 - 0
Firmware/messages.h

@@ -132,6 +132,9 @@ extern const char MSG_EJECT_FILAMENT[];
 extern const char MSG_CUT_FILAMENT[];
 extern const char MSG_OCTOPRINT_PAUSED[];
 extern const char MSG_OCTOPRINT_RESUMED[];
+extern const char MSG_OCTOPRINT_CANCEL[];
+extern const char MSG_FANCHECK_EXTRUDER[];
+extern const char MSG_FANCHECK_PRINT[];
 
 #if defined(__cplusplus)
 }

+ 2 - 2
Firmware/temperature.cpp

@@ -547,10 +547,10 @@ void fanSpeedError(unsigned char _fan) {
 	}
 	switch (_fan) {
 	case 0:	// extracting the same code from case 0 and case 1 into a function saves 72B
-		fanSpeedErrorBeep(PSTR("Extruder fan speed is lower than expected"), PSTR("Err: EXTR. FAN ERROR") );
+		fanSpeedErrorBeep(PSTR("Extruder fan speed is lower than expected"), MSG_FANCHECK_EXTRUDER);
 		break;
 	case 1:
-		fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") );
+		fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), MSG_FANCHECK_PRINT);
 		break;
 	}
     // SERIAL_PROTOCOLLNRPGM(MSG_OK); //This ok messes things up with octoprint.

+ 3 - 3
Firmware/ultralcd.cpp

@@ -6339,13 +6339,13 @@ static void fan_error_selftest()
     manage_heater();
 #ifdef TACH_0
     if (fan_speed[0] <= 20) { //extruder fan error
-        LCD_ALERTMESSAGERPGM(PSTR("Err: EXTR. FAN ERROR"));
+        LCD_ALERTMESSAGERPGM(MSG_FANCHECK_EXTRUDER);
         return;
     }
 #endif
 #ifdef TACH_1
     if (fan_speed[1] <= 20) { //print fan error
-        LCD_ALERTMESSAGERPGM(PSTR("Err: PRINT FAN ERROR"));
+        LCD_ALERTMESSAGERPGM(MSG_FANCHECK_PRINT);
         return;
     }
 #endif
@@ -6883,7 +6883,7 @@ void lcd_print_stop()
 //-//
      if(!card.sdprinting)
           {
-          SERIAL_ECHOLNPGM("// action:cancel");   // for Octoprint
+          SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL);   // for Octoprint
           }
 	saved_printing = false;
     saved_printing_type = PRINTING_TYPE_NONE;