Commit 31f1256c authored by MagoKimbra's avatar MagoKimbra

Fix Nextion SD

parent b78d629a
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
* M3 - Put S<value> in laser beam control * M3 - Put S<value> in laser beam control
* M4 - Turn on laser beam * M4 - Turn on laser beam
* M5 - Turn off laser beam * M5 - Turn off laser beam
* M11 - Start printer for pause mode
* M17 - Enable/Power all stepper motors * M17 - Enable/Power all stepper motors
* M18 - Disable all stepper motors; same as M84 * M18 - Disable all stepper motors; same as M84
* M20 - List SD card * M20 - List SD card
...@@ -433,7 +434,7 @@ unsigned long printer_usage_seconds; ...@@ -433,7 +434,7 @@ unsigned long printer_usage_seconds;
#if HAS(FILRUNOUT) #if HAS(FILRUNOUT)
static bool filrunoutEnqueued = false; static bool filrunoutEnqueued = false;
bool filrunoutActive = false; bool printing = false;
#endif #endif
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
...@@ -4336,6 +4337,22 @@ inline void gcode_G92() { ...@@ -4336,6 +4337,22 @@ inline void gcode_G92() {
} }
#endif //LASERBEAM #endif //LASERBEAM
#if HAS(FILRUNOUT)
/**
* M11: Start printing
*/
inline void gcode_M11() {
printing = true;
filrunoutEnqueued = false;
ECHO_LM(DB, "Start Printing, pause pin active.");
ECHO_S(RESUME);
ECHO_E;
#if HAS(POWER_CONSUMPTION_SENSOR)
startpower = power_consumption_hour;
#endif
}
#endif
/** /**
* M17: Enable power on all stepper motors * M17: Enable power on all stepper motors
*/ */
...@@ -6326,7 +6343,6 @@ inline void gcode_M503() { ...@@ -6326,7 +6343,6 @@ inline void gcode_M503() {
* X[position] - Move to this X position, with Y * X[position] - Move to this X position, with Y
* Y[position] - Move to this Y position, with X * Y[position] - Move to this Y position, with X
* L[distance] - Retract distance for removal (manual reload) * L[distance] - Retract distance for removal (manual reload)
* S[0-1] - Deactivate Filament runout - Active Filament runout
* *
* Default values are used for omitted arguments. * Default values are used for omitted arguments.
* *
...@@ -6338,26 +6354,6 @@ inline void gcode_M503() { ...@@ -6338,26 +6354,6 @@ inline void gcode_M503() {
return; return;
} }
#if HAS(FILRUNOUT)
if (code_seen('S')) {
if (code_value() == 1) {
filrunoutActive = true;
filrunoutEnqueued = false;
ECHO_LM(DB, "Filament runout activated.");
ECHO_S(RESUME);
ECHO_E;
#if HAS(POWER_CONSUMPTION_SENSOR)
startpower = power_consumption_hour;
#endif
} else {
filrunoutActive = false;
filrunoutEnqueued = false;
ECHO_LM(DB, "Filament runout deactivated.");
}
return;
}
#endif
float lastpos[NUM_AXIS], fr60 = feedrate / 60; float lastpos[NUM_AXIS], fr60 = feedrate / 60;
filament_changing = true; filament_changing = true;
...@@ -7123,6 +7119,11 @@ void process_next_command() { ...@@ -7123,6 +7119,11 @@ void process_next_command() {
gcode_M5(); break; gcode_M5(); break;
#endif //LASERBEAM #endif //LASERBEAM
#if HAS(FILRUNOUT)
case 11: //M11 - Start printing
gcode_M11(); break;
#endif
case 17: //M17 - Enable/Power all stepper motors case 17: //M17 - Enable/Power all stepper motors
gcode_M17(); break; gcode_M17(); break;
...@@ -7978,7 +7979,7 @@ void idle(bool ignore_stepper_queue/*=false*/) { ...@@ -7978,7 +7979,7 @@ void idle(bool ignore_stepper_queue/*=false*/) {
void manage_inactivity(bool ignore_stepper_queue/*=false*/) { void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
#if HAS(FILRUNOUT) #if HAS(FILRUNOUT)
if ((filrunoutActive || IS_SD_PRINTING) && (READ(FILRUNOUT_PIN) ^ FILRUNOUT_PIN_INVERTING)) if ((printing || IS_SD_PRINTING ) && (READ(FILRUNOUT_PIN) ^ FILRUNOUT_PIN_INVERTING))
filrunout(); filrunout();
#endif #endif
......
...@@ -455,22 +455,24 @@ ...@@ -455,22 +455,24 @@
enqueuecommands_P(PSTR("G90")); enqueuecommands_P(PSTR("G90"));
} }
void PlayPausePopCallback(void *ptr) { #if ENABLED(SDSUPPORT)
if (card.cardOK && card.isFileOpen()) { void PlayPausePopCallback(void *ptr) {
if (card.sdprinting) if (card.cardOK && card.isFileOpen()) {
card.pauseSDPrint(); if (card.sdprinting)
else card.pauseSDPrint();
card.startFileprint(); else
card.startFileprint();
}
} }
}
void StopPopCallback(void *ptr) { void StopPopCallback(void *ptr) {
quickStop(); quickStop();
card.sdprinting = false; card.sdprinting = false;
card.closeFile(); card.closeFile();
autotempShutdown(); autotempShutdown();
lcd_setstatus(MSG_PRINT_ABORTED, true); lcd_setstatus(MSG_PRINT_ABORTED, true);
} }
#endif
void lcd_init() { void lcd_init() {
delay(1000); delay(1000);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
*302 BOARD_MINIRAMBO - Mini Rambo *302 BOARD_MINIRAMBO - Mini Rambo
* *
* 4 BOARD_DUEMILANOVE_328P - Duemilanove w/ ATMega328P pin assignment * 4 BOARD_DUEMILANOVE_328P - Duemilanove w/ ATMega328P pin assignment
* 40 BOARD_MKS_BASE Arduino Mega2560 with RAMPS v1.4 pin assignments * 40 BOARD_MKS_BASE Arduino Mega2560 with RAMPS v1.4 pin assignments
*401 BOARD_RADDS - Radds Arduino DUE *401 BOARD_RADDS - Radds Arduino DUE
*403 BOARD_RAMPS_FD_V1 - Ramps FD version 1 *403 BOARD_RAMPS_FD_V1 - Ramps FD version 1
*404 BOARD_RAMPS_FD_V2 - Ramps FD version 2 *404 BOARD_RAMPS_FD_V2 - Ramps FD version 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment