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
 // M500 - stores paramters in EEPROM
124
 // M500 - stores paramters in EEPROM
125
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
125
 // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
126
 // M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
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
 // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
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
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
129
 // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
130
 // M907 - Set digital trimpot motor current using axis codes.
130
 // M907 - Set digital trimpot motor current using axis codes.
165
   float retract_recover_length=0, retract_recover_feedrate=8*60;
165
   float retract_recover_length=0, retract_recover_feedrate=8*60;
166
 #endif
166
 #endif
167
 
167
 
168
+#ifdef ULTIPANEL
169
+	bool powersupply = true;
170
+#endif
171
+
168
 //===========================================================================
172
 //===========================================================================
169
 //=============================private variables=============================
173
 //=============================private variables=============================
170
 //===========================================================================
174
 //===========================================================================
1140
     #endif //FAN_PIN
1144
     #endif //FAN_PIN
1141
 
1145
 
1142
     #if (PS_ON_PIN > -1)
1146
     #if (PS_ON_PIN > -1)
1143
-      case 80: // M80 - ATX Power On
1147
+      case 80: // M80 - Turn on Power Supply
1144
         SET_OUTPUT(PS_ON_PIN); //GND
1148
         SET_OUTPUT(PS_ON_PIN); //GND
1145
         WRITE(PS_ON_PIN, PS_ON_AWAKE);
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
         break;
1155
         break;
1147
       #endif
1156
       #endif
1148
       
1157
       
1149
-      case 81: // M81 - ATX Power Off
1158
+      case 81: // M81 - Turn off Power Supply
1150
       
1159
       
1151
       #if defined SUICIDE_PIN && SUICIDE_PIN > -1
1160
       #if defined SUICIDE_PIN && SUICIDE_PIN > -1
1152
         st_synchronize();
1161
         st_synchronize();
1155
         SET_OUTPUT(PS_ON_PIN); 
1164
         SET_OUTPUT(PS_ON_PIN); 
1156
         WRITE(PS_ON_PIN, PS_ON_ASLEEP);
1165
         WRITE(PS_ON_PIN, PS_ON_ASLEEP);
1157
       #endif
1166
       #endif
1167
+      #ifdef ULTIPANEL
1168
+        powersupply = false;
1169
+        LCD_MESSAGEPGM(MACHINE_NAME" "MSG_OFF".");
1170
+        lcd_update();
1171
+      #endif
1158
 		break;
1172
 		break;
1159
         
1173
         
1160
     case 82:
1174
     case 82:
1499
     {
1513
     {
1500
         Config_PrintSettings();
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
     #endif
1523
     #endif
1510
     #ifdef FILAMENTCHANGEENABLE
1524
     #ifdef FILAMENTCHANGEENABLE
1511
     case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
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
 	#define MSG_PREHEAT_ABS "Preheat ABS"
50
 	#define MSG_PREHEAT_ABS "Preheat ABS"
51
 	#define MSG_PREHEAT_ABS_SETTINGS "Preheat ABS Conf"
51
 	#define MSG_PREHEAT_ABS_SETTINGS "Preheat ABS Conf"
52
 	#define MSG_COOLDOWN "Cooldown"
52
 	#define MSG_COOLDOWN "Cooldown"
53
+	#define MSG_SWITCH_PS_ON "Switch Power On"
54
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
53
 	#define MSG_EXTRUDE "Extrude"
55
 	#define MSG_EXTRUDE "Extrude"
54
 	#define MSG_RETRACT "Retract"
56
 	#define MSG_RETRACT "Retract"
55
 	#define MSG_MOVE_AXIS "Move Axis"
57
 	#define MSG_MOVE_AXIS "Move Axis"
205
 	#define MSG_PREHEAT_ABS "Rozgrzej ABS"
207
 	#define MSG_PREHEAT_ABS "Rozgrzej ABS"
206
 	#define MSG_PREHEAT_ABS_SETTINGS "Ustawienia roz. ABS"
208
 	#define MSG_PREHEAT_ABS_SETTINGS "Ustawienia roz. ABS"
207
 	#define MSG_COOLDOWN "Chlodzenie"
209
 	#define MSG_COOLDOWN "Chlodzenie"
210
+	#define MSG_SWITCH_PS_ON "Switch Power On"
211
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
208
 	#define MSG_EXTRUDE "Ekstruzja"
212
 	#define MSG_EXTRUDE "Ekstruzja"
209
 	#define MSG_RETRACT "Cofanie"
213
 	#define MSG_RETRACT "Cofanie"
210
 	#define MSG_MOVE_AXIS "Ruch osi"
214
 	#define MSG_MOVE_AXIS "Ruch osi"
360
 #define MSG_PREHEAT_ABS " Prechauffage ABS"
364
 #define MSG_PREHEAT_ABS " Prechauffage ABS"
361
 #define MSG_PREHEAT_ABS_SETTINGS " Regl. prechauffe ABS"
365
 #define MSG_PREHEAT_ABS_SETTINGS " Regl. prechauffe ABS"
362
 #define MSG_COOLDOWN " Refroidissement"
366
 #define MSG_COOLDOWN " Refroidissement"
367
+#define MSG_SWITCH_PS_ON "Allumer alimentation"
368
+#define MSG_SWITCH_PS_OFF "Eteindre alimentation"
363
 #define MSG_EXTRUDE " Extrusion"
369
 #define MSG_EXTRUDE " Extrusion"
364
 #define MSG_RETRACT " Retractation"
370
 #define MSG_RETRACT " Retractation"
365
 #define MSG_PREHEAT_PLA " Prechauffage PLA"
371
 #define MSG_PREHEAT_PLA " Prechauffage PLA"
523
 	#define MSG_PREHEAT_ABS      "Vorwärmen ABS"
529
 	#define MSG_PREHEAT_ABS      "Vorwärmen ABS"
524
 	#define MSG_PREHEAT_ABS_SETTINGS "Vorwärmen ABS Einstellungen"
530
 	#define MSG_PREHEAT_ABS_SETTINGS "Vorwärmen ABS Einstellungen"
525
 	#define MSG_COOLDOWN         "Abkühlen"
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
 	#define MSG_EXTRUDE          "Extrude"
534
 	#define MSG_EXTRUDE          "Extrude"
527
 	#define MSG_RETRACT          "Retract"
535
 	#define MSG_RETRACT          "Retract"
528
 	#define MSG_MOVE_AXIS        "Achsen bewegen"
536
 	#define MSG_MOVE_AXIS        "Achsen bewegen"
675
 #define MSG_AUTO_HOME " Llevar Ejes al Cero"
683
 #define MSG_AUTO_HOME " Llevar Ejes al Cero"
676
 #define MSG_SET_ORIGIN " Establecer Cero"
684
 #define MSG_SET_ORIGIN " Establecer Cero"
677
 #define MSG_COOLDOWN " Enfriar"
685
 #define MSG_COOLDOWN " Enfriar"
686
+#define MSG_SWITCH_PS_ON "Switch Power On"
687
+#define MSG_SWITCH_PS_OFF "Switch Power Off"
678
 #define MSG_EXTRUDE " Extruir"
688
 #define MSG_EXTRUDE " Extruir"
679
 #define MSG_RETRACT " Retraer"
689
 #define MSG_RETRACT " Retraer"
680
 #define MSG_PREHEAT_PLA " Precalentar PLA"
690
 #define MSG_PREHEAT_PLA " Precalentar PLA"
835
 #define MSG_PREHEAT_ABS						" Преднагрев ABS     "
845
 #define MSG_PREHEAT_ABS						" Преднагрев ABS     "
836
 #define MSG_PREHEAT_ABS_SETTINGS			" Настр. преднагр.ABS"
846
 #define MSG_PREHEAT_ABS_SETTINGS			" Настр. преднагр.ABS"
837
 #define MSG_COOLDOWN						" Охлаждение         "
847
 #define MSG_COOLDOWN						" Охлаждение         "
848
+#define MSG_SWITCH_PS_ON					"Switch Power On"
849
+#define MSG_SWITCH_PS_OFF					"Switch Power Off"
838
 #define MSG_EXTRUDE							" Экструзия          "
850
 #define MSG_EXTRUDE							" Экструзия          "
839
 #define MSG_RETRACT							" Откат"
851
 #define MSG_RETRACT							" Откат"
840
 #define MSG_MOVE_AXIS						" Движение по осям  \x7E"
852
 #define MSG_MOVE_AXIS						" Движение по осям  \x7E"
986
 	#define MSG_PREHEAT_ABS          "Preriscalda ABS"
998
 	#define MSG_PREHEAT_ABS          "Preriscalda ABS"
987
 	#define MSG_PREHEAT_ABS_SETTINGS "Preris. ABS Conf"
999
 	#define MSG_PREHEAT_ABS_SETTINGS "Preris. ABS Conf"
988
 	#define MSG_COOLDOWN             "Rafredda"
1000
 	#define MSG_COOLDOWN             "Rafredda"
1001
+	#define MSG_SWITCH_PS_ON         "Switch Power On"
1002
+	#define MSG_SWITCH_PS_OFF        "Switch Power Off"
989
 	#define MSG_EXTRUDE              "Estrudi"
1003
 	#define MSG_EXTRUDE              "Estrudi"
990
 	#define MSG_RETRACT              "Ritrai"
1004
 	#define MSG_RETRACT              "Ritrai"
991
 	#define MSG_MOVE_AXIS            "Muovi Asse"
1005
 	#define MSG_MOVE_AXIS            "Muovi Asse"
1142
 	#define MSG_PREHEAT_ABS " pre-aquecer ABS"
1156
 	#define MSG_PREHEAT_ABS " pre-aquecer ABS"
1143
 	#define MSG_PREHEAT_ABS_SETTINGS " pre-aquecer ABS Setting"
1157
 	#define MSG_PREHEAT_ABS_SETTINGS " pre-aquecer ABS Setting"
1144
 	#define MSG_COOLDOWN " Esfriar"
1158
 	#define MSG_COOLDOWN " Esfriar"
1159
+	#define MSG_SWITCH_PS_ON "Switch Power On"
1160
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
1145
 	#define MSG_EXTRUDE " Extrudar"
1161
 	#define MSG_EXTRUDE " Extrudar"
1146
 	#define MSG_RETRACT " Retrair"
1162
 	#define MSG_RETRACT " Retrair"
1147
 	#define MSG_PREHEAT_PLA " pre-aquecer PLA"
1163
 	#define MSG_PREHEAT_PLA " pre-aquecer PLA"
1308
 	#define MSG_PREHEAT_ABS "Esilammita ABS"
1324
 	#define MSG_PREHEAT_ABS "Esilammita ABS"
1309
 	#define MSG_PREHEAT_ABS_SETTINGS "Esilammita ABS konf"
1325
 	#define MSG_PREHEAT_ABS_SETTINGS "Esilammita ABS konf"
1310
 	#define MSG_COOLDOWN "Jaahdyta"
1326
 	#define MSG_COOLDOWN "Jaahdyta"
1327
+	#define MSG_SWITCH_PS_ON "Switch Power On"
1328
+	#define MSG_SWITCH_PS_OFF "Switch Power Off"
1311
 	#define MSG_EXTRUDE "Pursota"
1329
 	#define MSG_EXTRUDE "Pursota"
1312
 	#define MSG_RETRACT "Veda takaisin"
1330
 	#define MSG_RETRACT "Veda takaisin"
1313
 	#define MSG_MOVE_AXIS "Liikuta akseleita"
1331
 	#define MSG_MOVE_AXIS "Liikuta akseleita"

+ 7
- 0
Marlin/ultralcd.cpp View File

30
 /* Different menus */
30
 /* Different menus */
31
 static void lcd_status_screen();
31
 static void lcd_status_screen();
32
 #ifdef ULTIPANEL
32
 #ifdef ULTIPANEL
33
+extern bool powersupply;
33
 static void lcd_main_menu();
34
 static void lcd_main_menu();
34
 static void lcd_tune_menu();
35
 static void lcd_tune_menu();
35
 static void lcd_prepare_menu();
36
 static void lcd_prepare_menu();
278
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
279
     MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
279
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
280
     MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
280
     MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
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
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
288
     MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
282
     END_MENU();
289
     END_MENU();
283
 }
290
 }

Loading…
Cancel
Save