Browse Source

Toggle menu for PSU from LCD pannel

From the prepare menu, accessible when is not printing, you have the
possibility to turn off the PSU when is on et vice versa.
From the host, you can turn off or turn on the PSU then the menu is
updated accordingly.
From the LCD message, the printer status is reported ready or off
respectively when the PSU is on or off.
Nicolas Rossi 12 years ago
parent
commit
86bf911139
3 changed files with 49 additions and 10 deletions
  1. 24
    10
      Marlin/Marlin_main.cpp
  2. 18
    0
      Marlin/language.h
  3. 7
    0
      Marlin/ultralcd.cpp

+ 24
- 10
Marlin/Marlin_main.cpp View File

@@ -124,7 +124,7 @@
124 124
 // M500 - stores paramters in EEPROM
125 125
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
126 126
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
127
-// M503 - print the current settings (from memory not from eeprom)
127
+// M503 - print the current settings (from memory not from eeprom)
128 128
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
129 129
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
130 130
 // M907 - Set digital trimpot motor current using axis codes.
@@ -165,6 +165,10 @@ int fanSpeed=0;
165 165
   float retract_recover_length=0, retract_recover_feedrate=8*60;
166 166
 #endif
167 167
 
168
+#ifdef ULTIPANEL
169
+	bool powersupply = true;
170
+#endif
171
+
168 172
 //===========================================================================
169 173
 //=============================private variables=============================
170 174
 //===========================================================================
@@ -1140,13 +1144,18 @@ void process_commands()
1140 1144
     #endif //FAN_PIN
1141 1145
 
1142 1146
     #if (PS_ON_PIN > -1)
1143
-      case 80: // M80 - ATX Power On
1147
+      case 80: // M80 - Turn on Power Supply
1144 1148
         SET_OUTPUT(PS_ON_PIN); //GND
1145 1149
         WRITE(PS_ON_PIN, PS_ON_AWAKE);
1150
+        #ifdef ULTIPANEL
1151
+          powersupply = true;
1152
+          LCD_MESSAGEPGM(WELCOME_MSG);
1153
+          lcd_update();
1154
+        #endif
1146 1155
         break;
1147 1156
       #endif
1148 1157
       
1149
-      case 81: // M81 - ATX Power Off
1158
+      case 81: // M81 - Turn off Power Supply
1150 1159
       
1151 1160
       #if defined SUICIDE_PIN && SUICIDE_PIN > -1
1152 1161
         st_synchronize();
@@ -1155,6 +1164,11 @@ void process_commands()
1155 1164
         SET_OUTPUT(PS_ON_PIN); 
1156 1165
         WRITE(PS_ON_PIN, PS_ON_ASLEEP);
1157 1166
       #endif
1167
+      #ifdef ULTIPANEL
1168
+        powersupply = false;
1169
+        LCD_MESSAGEPGM(MACHINE_NAME" "MSG_OFF".");
1170
+        lcd_update();
1171
+      #endif
1158 1172
 		break;
1159 1173
         
1160 1174
     case 82:
@@ -1499,13 +1513,13 @@ void process_commands()
1499 1513
     {
1500 1514
         Config_PrintSettings();
1501 1515
     }
1502
-    break;
1503
-    #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
1504
-    case 540:
1505
-    {
1506
-        if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
1507
-    }
1508
-    break;
1516
+    break;
1517
+    #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
1518
+    case 540:
1519
+    {
1520
+        if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
1521
+    }
1522
+    break;
1509 1523
     #endif
1510 1524
     #ifdef FILAMENTCHANGEENABLE
1511 1525
     case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]

+ 18
- 0
Marlin/language.h View File

@@ -50,6 +50,8 @@
50 50
 	#define MSG_PREHEAT_ABS "Preheat ABS"
51 51
 	#define MSG_PREHEAT_ABS_SETTINGS "Preheat ABS Conf"
52 52
 	#define MSG_COOLDOWN "Cooldown"
53
+	#define MSG_SWITCH_PS_ON "Switch Power On"
54
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
53 55
 	#define MSG_EXTRUDE "Extrude"
54 56
 	#define MSG_RETRACT "Retract"
55 57
 	#define MSG_MOVE_AXIS "Move Axis"
@@ -205,6 +207,8 @@
205 207
 	#define MSG_PREHEAT_ABS "Rozgrzej ABS"
206 208
 	#define MSG_PREHEAT_ABS_SETTINGS "Ustawienia roz. ABS"
207 209
 	#define MSG_COOLDOWN "Chlodzenie"
210
+	#define MSG_SWITCH_PS_ON "Switch Power On"
211
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
208 212
 	#define MSG_EXTRUDE "Ekstruzja"
209 213
 	#define MSG_RETRACT "Cofanie"
210 214
 	#define MSG_MOVE_AXIS "Ruch osi"
@@ -360,6 +364,8 @@
360 364
 #define MSG_PREHEAT_ABS " Prechauffage ABS"
361 365
 #define MSG_PREHEAT_ABS_SETTINGS " Regl. prechauffe ABS"
362 366
 #define MSG_COOLDOWN " Refroidissement"
367
+#define MSG_SWITCH_PS_ON "Allumer alimentation"
368
+#define MSG_SWITCH_PS_OFF "Eteindre alimentation"
363 369
 #define MSG_EXTRUDE " Extrusion"
364 370
 #define MSG_RETRACT " Retractation"
365 371
 #define MSG_PREHEAT_PLA " Prechauffage PLA"
@@ -523,6 +529,8 @@
523 529
 	#define MSG_PREHEAT_ABS      "Vorwärmen ABS"
524 530
 	#define MSG_PREHEAT_ABS_SETTINGS "Vorwärmen ABS Einstellungen"
525 531
 	#define MSG_COOLDOWN         "Abkühlen"
532
+	#define MSG_SWITCH_PS_ON     "Switch Power On"
533
+	#define MSG_SWITCH_PS_OFF    "Switch Power Off"
526 534
 	#define MSG_EXTRUDE          "Extrude"
527 535
 	#define MSG_RETRACT          "Retract"
528 536
 	#define MSG_MOVE_AXIS        "Achsen bewegen"
@@ -675,6 +683,8 @@
675 683
 #define MSG_AUTO_HOME " Llevar Ejes al Cero"
676 684
 #define MSG_SET_ORIGIN " Establecer Cero"
677 685
 #define MSG_COOLDOWN " Enfriar"
686
+#define MSG_SWITCH_PS_ON "Switch Power On"
687
+#define MSG_SWITCH_PS_OFF "Switch Power Off"
678 688
 #define MSG_EXTRUDE " Extruir"
679 689
 #define MSG_RETRACT " Retraer"
680 690
 #define MSG_PREHEAT_PLA " Precalentar PLA"
@@ -835,6 +845,8 @@
835 845
 #define MSG_PREHEAT_ABS						" Преднагрев ABS     "
836 846
 #define MSG_PREHEAT_ABS_SETTINGS			" Настр. преднагр.ABS"
837 847
 #define MSG_COOLDOWN						" Охлаждение         "
848
+#define MSG_SWITCH_PS_ON					"Switch Power On"
849
+#define MSG_SWITCH_PS_OFF					"Switch Power Off"
838 850
 #define MSG_EXTRUDE							" Экструзия          "
839 851
 #define MSG_RETRACT							" Откат"
840 852
 #define MSG_MOVE_AXIS						" Движение по осям  \x7E"
@@ -986,6 +998,8 @@
986 998
 	#define MSG_PREHEAT_ABS          "Preriscalda ABS"
987 999
 	#define MSG_PREHEAT_ABS_SETTINGS "Preris. ABS Conf"
988 1000
 	#define MSG_COOLDOWN             "Rafredda"
1001
+	#define MSG_SWITCH_PS_ON         "Switch Power On"
1002
+	#define MSG_SWITCH_PS_OFF        "Switch Power Off"
989 1003
 	#define MSG_EXTRUDE              "Estrudi"
990 1004
 	#define MSG_RETRACT              "Ritrai"
991 1005
 	#define MSG_MOVE_AXIS            "Muovi Asse"
@@ -1142,6 +1156,8 @@
1142 1156
 	#define MSG_PREHEAT_ABS " pre-aquecer ABS"
1143 1157
 	#define MSG_PREHEAT_ABS_SETTINGS " pre-aquecer ABS Setting"
1144 1158
 	#define MSG_COOLDOWN " Esfriar"
1159
+	#define MSG_SWITCH_PS_ON "Switch Power On"
1160
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
1145 1161
 	#define MSG_EXTRUDE " Extrudar"
1146 1162
 	#define MSG_RETRACT " Retrair"
1147 1163
 	#define MSG_PREHEAT_PLA " pre-aquecer PLA"
@@ -1308,6 +1324,8 @@
1308 1324
 	#define MSG_PREHEAT_ABS "Esilammita ABS"
1309 1325
 	#define MSG_PREHEAT_ABS_SETTINGS "Esilammita ABS konf"
1310 1326
 	#define MSG_COOLDOWN "Jaahdyta"
1327
+	#define MSG_SWITCH_PS_ON "Switch Power On"
1328
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
1311 1329
 	#define MSG_EXTRUDE "Pursota"
1312 1330
 	#define MSG_RETRACT "Veda takaisin"
1313 1331
 	#define MSG_MOVE_AXIS "Liikuta akseleita"

+ 7
- 0
Marlin/ultralcd.cpp View File

@@ -30,6 +30,7 @@ char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
30 30
 /* Different menus */
31 31
 static void lcd_status_screen();
32 32
 #ifdef ULTIPANEL
33
+extern bool powersupply;
33 34
 static void lcd_main_menu();
34 35
 static void lcd_tune_menu();
35 36
 static void lcd_prepare_menu();
@@ -278,6 +279,12 @@ static void lcd_prepare_menu()
278 279
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
279 280
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
280 281
     MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
282
+    if (powersupply)
283
+    {
284
+        MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
285
+    }else{
286
+        MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
287
+    }
281 288
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
282 289
     END_MENU();
283 290
 }

Loading…
Cancel
Save