Conditionals and comments for PS = 0

This commit is contained in:
Scott Lahteine 2015-03-30 16:50:05 -07:00
parent 2faed961ce
commit 8c136a5ab5
2 changed files with 44 additions and 39 deletions

View file

@ -272,7 +272,7 @@ int fanSpeed = 0;
#endif // FWRETRACT #endif // FWRETRACT
#ifdef ULTIPANEL #if defined(ULTIPANEL) && HAS_POWER_SWITCH
bool powersupply = bool powersupply =
#ifdef PS_DEFAULT_OFF #ifdef PS_DEFAULT_OFF
false false
@ -517,7 +517,7 @@ void setup_powerhold()
OUT_WRITE(SUICIDE_PIN, HIGH); OUT_WRITE(SUICIDE_PIN, HIGH);
#endif #endif
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
#if defined(PS_DEFAULT_OFF) #ifdef PS_DEFAULT_OFF
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#else #else
OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
@ -3313,33 +3313,38 @@ inline void gcode_M140() {
#endif #endif
} }
/** #endif // HAS_POWER_SWITCH
* M81: Turn off Power Supply
*/ /**
inline void gcode_M81() { * M81: Turn off Power, including Power Supply, if there is one.
disable_heater(); *
st_synchronize(); * This code should ALWAYS be available for EMERGENCY SHUTDOWN!
disable_e0(); */
disable_e1(); inline void gcode_M81() {
disable_e2(); disable_heater();
disable_e3(); st_synchronize();
finishAndDisableSteppers(); disable_e0();
fanSpeed = 0; disable_e1();
delay(1000); // Wait 1 second before switching off disable_e2();
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 disable_e3();
st_synchronize(); finishAndDisableSteppers();
suicide(); fanSpeed = 0;
#elif HAS_POWER_SWITCH delay(1000); // Wait 1 second before switching off
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP); #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
#endif st_synchronize();
#ifdef ULTIPANEL suicide();
powersupply = false; #elif HAS_POWER_SWITCH
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF "."); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
lcd_update(); #endif
#endif #ifdef ULTIPANEL
} #if HAS_POWER_SWITCH
powersupply = false;
#endif
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
lcd_update();
#endif
}
#endif // PS_ON_PIN
/** /**
* M82: Set E codes absolute (default) * M82: Set E codes absolute (default)
@ -4874,15 +4879,15 @@ void process_commands() {
#endif //HEATER_2_PIN #endif //HEATER_2_PIN
#endif //BARICUDA #endif //BARICUDA
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
case 80: // M80 - Turn on Power Supply case 80: // M80 - Turn on Power Supply
gcode_M80(); gcode_M80();
break; break;
#endif // PS_ON_PIN #endif // HAS_POWER_SWITCH
case 81: // M81 - Turn off Power Supply case 81: // M81 - Turn off Power, including Power Supply, if possible
gcode_M81(); gcode_M81();
break; break;
@ -5859,19 +5864,17 @@ void kill()
disable_e2(); disable_e2();
disable_e3(); disable_e3();
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if HAS_POWER_SWITCH
pinMode(PS_ON_PIN,INPUT); pinMode(PS_ON_PIN, INPUT);
#endif #endif
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
LCD_ALERTMESSAGEPGM(MSG_KILLED); LCD_ALERTMESSAGEPGM(MSG_KILLED);
// FMC small patch to update the LCD before ending // FMC small patch to update the LCD before ending
sei(); // enable interrupts sei(); // enable interrupts
for ( int i=5; i--; lcd_update()) for (int i = 5; i--; lcd_update()) delay(200); // Wait a short time
{
delay(200);
}
cli(); // disable interrupts cli(); // disable interrupts
suicide(); suicide();
while(1) { /* Intentionally left empty */ } // Wait for reset while(1) { /* Intentionally left empty */ } // Wait for reset

View file

@ -44,7 +44,9 @@ static void lcd_status_screen();
#ifdef ULTIPANEL #ifdef ULTIPANEL
extern bool powersupply; #if HAS_POWER_SWITCH
extern bool powersupply;
#endif
static float manual_feedrate[] = MANUAL_FEEDRATE; static float manual_feedrate[] = MANUAL_FEEDRATE;
static void lcd_main_menu(); static void lcd_main_menu();
static void lcd_tune_menu(); static void lcd_tune_menu();