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.
master
Nicolas Rossi 12 years ago
parent de3dec7215
commit 86bf911139

@ -165,6 +165,10 @@ int fanSpeed=0;
float retract_recover_length=0, retract_recover_feedrate=8*60;
#endif
#ifdef ULTIPANEL
bool powersupply = true;
#endif
//===========================================================================
//=============================private variables=============================
//===========================================================================
@ -1140,13 +1144,18 @@ void process_commands()
#endif //FAN_PIN
#if (PS_ON_PIN > -1)
case 80: // M80 - ATX Power On
case 80: // M80 - Turn on Power Supply
SET_OUTPUT(PS_ON_PIN); //GND
WRITE(PS_ON_PIN, PS_ON_AWAKE);
#ifdef ULTIPANEL
powersupply = true;
LCD_MESSAGEPGM(WELCOME_MSG);
lcd_update();
#endif
break;
#endif
case 81: // M81 - ATX Power Off
case 81: // M81 - Turn off Power Supply
#if defined SUICIDE_PIN && SUICIDE_PIN > -1
st_synchronize();
@ -1154,6 +1163,11 @@ void process_commands()
#elif (PS_ON_PIN > -1)
SET_OUTPUT(PS_ON_PIN);
WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif
#ifdef ULTIPANEL
powersupply = false;
LCD_MESSAGEPGM(MACHINE_NAME" "MSG_OFF".");
lcd_update();
#endif
break;

@ -50,6 +50,8 @@
#define MSG_PREHEAT_ABS "Preheat ABS"
#define MSG_PREHEAT_ABS_SETTINGS "Preheat ABS Conf"
#define MSG_COOLDOWN "Cooldown"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE "Extrude"
#define MSG_RETRACT "Retract"
#define MSG_MOVE_AXIS "Move Axis"
@ -205,6 +207,8 @@
#define MSG_PREHEAT_ABS "Rozgrzej ABS"
#define MSG_PREHEAT_ABS_SETTINGS "Ustawienia roz. ABS"
#define MSG_COOLDOWN "Chlodzenie"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE "Ekstruzja"
#define MSG_RETRACT "Cofanie"
#define MSG_MOVE_AXIS "Ruch osi"
@ -360,6 +364,8 @@
#define MSG_PREHEAT_ABS " Prechauffage ABS"
#define MSG_PREHEAT_ABS_SETTINGS " Regl. prechauffe ABS"
#define MSG_COOLDOWN " Refroidissement"
#define MSG_SWITCH_PS_ON "Allumer alimentation"
#define MSG_SWITCH_PS_OFF "Eteindre alimentation"
#define MSG_EXTRUDE " Extrusion"
#define MSG_RETRACT " Retractation"
#define MSG_PREHEAT_PLA " Prechauffage PLA"
@ -523,6 +529,8 @@
#define MSG_PREHEAT_ABS "Vorwärmen ABS"
#define MSG_PREHEAT_ABS_SETTINGS "Vorwärmen ABS Einstellungen"
#define MSG_COOLDOWN "Abkühlen"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE "Extrude"
#define MSG_RETRACT "Retract"
#define MSG_MOVE_AXIS "Achsen bewegen"
@ -675,6 +683,8 @@
#define MSG_AUTO_HOME " Llevar Ejes al Cero"
#define MSG_SET_ORIGIN " Establecer Cero"
#define MSG_COOLDOWN " Enfriar"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE " Extruir"
#define MSG_RETRACT " Retraer"
#define MSG_PREHEAT_PLA " Precalentar PLA"
@ -835,6 +845,8 @@
#define MSG_PREHEAT_ABS " Преднагрев ABS "
#define MSG_PREHEAT_ABS_SETTINGS " Настр. преднагр.ABS"
#define MSG_COOLDOWN " Охлаждение "
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE " Экструзия "
#define MSG_RETRACT " Откат"
#define MSG_MOVE_AXIS " Движение по осям \x7E"
@ -986,6 +998,8 @@
#define MSG_PREHEAT_ABS "Preriscalda ABS"
#define MSG_PREHEAT_ABS_SETTINGS "Preris. ABS Conf"
#define MSG_COOLDOWN "Rafredda"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE "Estrudi"
#define MSG_RETRACT "Ritrai"
#define MSG_MOVE_AXIS "Muovi Asse"
@ -1142,6 +1156,8 @@
#define MSG_PREHEAT_ABS " pre-aquecer ABS"
#define MSG_PREHEAT_ABS_SETTINGS " pre-aquecer ABS Setting"
#define MSG_COOLDOWN " Esfriar"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE " Extrudar"
#define MSG_RETRACT " Retrair"
#define MSG_PREHEAT_PLA " pre-aquecer PLA"
@ -1308,6 +1324,8 @@
#define MSG_PREHEAT_ABS "Esilammita ABS"
#define MSG_PREHEAT_ABS_SETTINGS "Esilammita ABS konf"
#define MSG_COOLDOWN "Jaahdyta"
#define MSG_SWITCH_PS_ON "Switch Power On"
#define MSG_SWITCH_PS_OFF "Switch Power Off"
#define MSG_EXTRUDE "Pursota"
#define MSG_RETRACT "Veda takaisin"
#define MSG_MOVE_AXIS "Liikuta akseleita"

@ -30,6 +30,7 @@ char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
/* Different menus */
static void lcd_status_screen();
#ifdef ULTIPANEL
extern bool powersupply;
static void lcd_main_menu();
static void lcd_tune_menu();
static void lcd_prepare_menu();
@ -278,6 +279,12 @@ static void lcd_prepare_menu()
MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla);
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0"));
if (powersupply)
{
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
}else{
MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
}
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
END_MENU();
}

Loading…
Cancel
Save