Conditionals and comments for PS = 0

2.0.x
Scott Lahteine 10 years ago
parent 2faed961ce
commit 8c136a5ab5

@ -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(); *
* This code should ALWAYS be available for EMERGENCY SHUTDOWN!
*/
inline void gcode_M81() {
disable_heater();
st_synchronize();
disable_e0();
disable_e1();
disable_e2();
disable_e3();
finishAndDisableSteppers();
fanSpeed = 0;
delay(1000); // Wait 1 second before switching off
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
st_synchronize(); st_synchronize();
disable_e0(); suicide();
disable_e1(); #elif HAS_POWER_SWITCH
disable_e2(); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
disable_e3(); #endif
finishAndDisableSteppers(); #ifdef ULTIPANEL
fanSpeed = 0; #if HAS_POWER_SWITCH
delay(1000); // Wait 1 second before switching off
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
st_synchronize();
suicide();
#elif HAS_POWER_SWITCH
OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif
#ifdef ULTIPANEL
powersupply = false; powersupply = false;
LCD_MESSAGEPGM(MACHINE_NAME " " MSG_OFF ".");
lcd_update();
#endif #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

@ -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();

Loading…
Cancel
Save