Commit Graph

16 Commits

Author SHA1 Message Date
Yuri D'Elia
fc10ca3146 Change how "Stopped" is handled internally, do not inhibit motion
Do not inhibit motion when Stopped is set.

We actually do need to move to move away the extruder from the bed, and
setting Stopped breaks it without adding any sort of security (M*
commands, such as M600 could still perform moves and still pass
through, while M104 would still set heaters).

During a hard error the internal queue is cleared (and sd file closed,
if any), so no new "unforeseen" command can be read.

Handle "Stopped" instead as a flag to inhibit serial processing and
automatically switch to "paused for user" state. While in this state
simply drop any input without incrementing the processed gcode line
number, behaving as-if the last command was still being processed.

This allows "Stopped" to correctly handle a printer-initiated paused
state and recover as expected by requesting a resend when resuming.
2022-07-25 17:30:22 +02:00
Guðni Már Gilbert
9bf45773f9 Merge remote-tracking branch 'upstream/MK3' into rebase-testing-ground-v2 2022-01-30 11:43:16 +00:00
Voinea Dragos
a5f1f23fe2 TimeNow && TimeSent 2022-01-30 11:22:43 +00:00
Guðni Már Gilbert
16602f4003 change boolean to bool 2021-07-20 08:03:17 +02:00
Yuri D'Elia
461d3f6749 Remove duplicate function is_buffer_empty()
Use cmd_buffer_empty() instead
2021-02-19 17:06:00 +01:00
D.R.racer
3dc85b319c Marlin_main.cpp hacks
- code_seen("string") -> code_seen_P(PSTR("string")) saved >100B of RAM!
- serial print "." -> '.' saved some code
- extract commonly used string
- SERIAL_PROTOCOLLN("") -> SERIAL_PROTOCOLLN() as no argument is
necessary
2021-01-22 17:15:36 +01:00
Alex Voinea
4abf1f436a Gracefully dump the queue + fixes to fancheck 2020-11-09 21:49:56 +02:00
Marek Bel
52cb37770b Fix repeated power panic restarted print from beginning or jumped at most 65536 B back in file printed from SD card.
As sdpos_atomic was not updated after printer power up and first power panic recovery, it was equal 0. When the first command from SD card was queued its size on SD card was computed as current SD index position minus sdpos_atomic. This was equal to offset from beginning of the file limited to 16 bit storage type. When next power outage occurred earlier then this command was finished and wiped out of queue, this command size (extraordinarily big) was subtracted from sdpos_atomic and saved to EEPROM. This led to up to 65536 B jump back in file printed after next power panic recovery.
2019-08-23 19:30:20 +02:00
Marek Bel
716e6c209c Save 88B FLASH and fix compiler warnings:
sketch/cmdqueue.cpp: In function 'bool cmdqueue_pop_front()':
sketch/cmdqueue.cpp:67:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (++ bufindr; bufindr < sizeof(cmdbuffer) && cmdbuffer[bufindr] == 0; ++ bufindr) ;
                                                        ^
sketch/cmdqueue.cpp: In function 'bool cmdqueue_could_enqueue_back(int, bool)':
sketch/cmdqueue.cpp:170:63: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             endw + CMDBUFFER_RESERVE_FRONT <= sizeof(cmdbuffer) ||
                                                               ^
sketch/cmdqueue.cpp:172:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             (endw <= sizeof(cmdbuffer) && CMDBUFFER_RESERVE_FRONT <= bufindr))
                                      ^
sketch/cmdqueue.cpp:196:63: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             endw + CMDBUFFER_RESERVE_FRONT <= sizeof(cmdbuffer) ||
                                                               ^
sketch/cmdqueue.cpp:198:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             (endw <= sizeof(cmdbuffer) && CMDBUFFER_RESERVE_FRONT <= bufindr))
                                      ^
sketch/cmdqueue.cpp: In function 'void get_command()':
sketch/cmdqueue.cpp:380:10: warning: variable 'rx_buffer_full' set but not used [-Wunused-but-set-variable]
     bool rx_buffer_full = false; //flag that serial rx buffer is full
          ^
sketch/cmdqueue.cpp: In function 'uint16_t cmdqueue_calc_sd_length()':
sketch/cmdqueue.cpp:697:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (++ _bufindr; _bufindr < sizeof(cmdbuffer) && cmdbuffer[_bufindr] == 0; ++ _bufindr) ;
                                                      ^
2018-07-25 21:18:29 +02:00
PavelSindler
aacaf67eaa Crash detection/filament sensor: restore print from stored line number in case that we are printing over USB, retraction fix; debug: cmd queue on LCD 2018-06-05 20:28:41 +02:00
Robert Pelnar
59f3f9d8ec New localization - includes fixed 2018-05-09 16:55:41 +02:00
bubnikv
9e534c1990 Minimize risk of stepper routine interrupt blocking by reorganizing
the routine to move the G-code line length from the command queue
to the planner queue.
2018-01-20 14:37:22 +01:00
PavelSindler
2e68770e62 initial version - messages missing (will not compile) 2017-11-07 16:49:04 +01:00
bubnikv
582a6270b0 Fix of a power panic print stop. 2017-09-21 17:50:39 +02:00
Robert Pelnar
c4e9e624f5 cmd queue and planner - functions for calculating sd position:
cmdqueue_calc_sd_length
planner_calc_sd_length
2017-09-18 19:36:18 +02:00
Robert Pelnar
9105de073c Cmdqueue code in separate files, debug codes for read/write eeprom and ram, PWM amplitude for Y axis stealtchop mode increased to 210. 2017-09-14 16:19:49 +02:00