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

@ -124,7 +124,7 @@
// M500 - stores paramters in EEPROM // M500 - stores paramters in EEPROM
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). // M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. // M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
// M503 - print the current settings (from memory not from eeprom) // M503 - print the current settings (from memory not from eeprom)
// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) // M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] // M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
// M907 - Set digital trimpot motor current using axis codes. // M907 - Set digital trimpot motor current using axis codes.
@ -165,6 +165,10 @@ int fanSpeed=0;
float retract_recover_length=0, retract_recover_feedrate=8*60; float retract_recover_length=0, retract_recover_feedrate=8*60;
#endif #endif
#ifdef ULTIPANEL
bool powersupply = true;
#endif
//=========================================================================== //===========================================================================
//=============================private variables============================= //=============================private variables=============================
//=========================================================================== //===========================================================================
@ -1140,13 +1144,18 @@ void process_commands()
#endif //FAN_PIN #endif //FAN_PIN
#if (PS_ON_PIN > -1) #if (PS_ON_PIN > -1)
case 80: // M80 - ATX Power On case 80: // M80 - Turn on Power Supply
SET_OUTPUT(PS_ON_PIN); //GND SET_OUTPUT(PS_ON_PIN); //GND
WRITE(PS_ON_PIN, PS_ON_AWAKE); WRITE(PS_ON_PIN, PS_ON_AWAKE);
#ifdef ULTIPANEL
powersupply = true;
LCD_MESSAGEPGM(WELCOME_MSG);
lcd_update();
#endif
break; break;
#endif #endif
case 81: // M81 - ATX Power Off case 81: // M81 - Turn off Power Supply
#if defined SUICIDE_PIN && SUICIDE_PIN > -1 #if defined SUICIDE_PIN && SUICIDE_PIN > -1
st_synchronize(); st_synchronize();
@ -1154,6 +1163,11 @@ void process_commands()
#elif (PS_ON_PIN > -1) #elif (PS_ON_PIN > -1)
SET_OUTPUT(PS_ON_PIN); SET_OUTPUT(PS_ON_PIN);
WRITE(PS_ON_PIN, PS_ON_ASLEEP); WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif
#ifdef ULTIPANEL
powersupply = false;
LCD_MESSAGEPGM(MACHINE_NAME" "MSG_OFF".");
lcd_update();
#endif #endif
break; break;
@ -1499,13 +1513,13 @@ void process_commands()
{ {
Config_PrintSettings(); Config_PrintSettings();
} }
break; break;
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
case 540: case 540:
{ {
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0; if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
} }
break; break;
#endif #endif
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]

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

@ -30,6 +30,7 @@ char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
/* Different menus */ /* Different menus */
static void lcd_status_screen(); static void lcd_status_screen();
#ifdef ULTIPANEL #ifdef ULTIPANEL
extern bool powersupply;
static void lcd_main_menu(); static void lcd_main_menu();
static void lcd_tune_menu(); static void lcd_tune_menu();
static void lcd_prepare_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_PLA, lcd_preheat_pla);
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs); MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs);
MENU_ITEM(gcode, MSG_COOLDOWN, PSTR("M104 S0\nM140 S0")); 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); MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
END_MENU(); END_MENU();
} }

Loading…
Cancel
Save