Commit Graph

56 Commits

Author SHA1 Message Date
Yuri D'Elia
e37435b53f Merge remote-tracking branch 'upstream/MK3_3.11.1' into mk311_sync 2022-07-04 16:14:23 +02:00
Alex Voinea
91c71da810 Convert some more suspicious timers to LongTimer 2022-02-17 08:48:29 +01:00
Alex Voinea
4ec8781df2 Fix usb print timer 2022-02-13 22:52:49 +01:00
Alex Voinea
ed8252527c Add a uart RX timeout 2022-02-11 12:49:11 +01:00
Alex Voinea
6ce7792045 Remove "hh" in fmt where it makes no difference 2022-02-02 20:58:21 +01: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
Guðni Már Gilbert
d8723c0eac Use code_value_uint8() in get_command()
The if statement is simplified as the value is never negative
and we can get rid of one variable

Saves 12 bytes of flash memory
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert
ac049c7e3c Use code_value_short() in get_command()
Same code but uses a defined function

Saves 28 bytes of flash memory
2022-01-30 11:39:27 +00:00
Voinea Dragos
a5f1f23fe2 TimeNow && TimeSent 2022-01-30 11:22:43 +00:00
Guðni Már Gilbert
3cfd706fff Remove useless extern in cmdqueue.cpp 2021-07-20 09:12:14 +02:00
Guðni Már Gilbert
16602f4003 change boolean to bool 2021-07-20 08:03:17 +02:00
Yuri D'Elia
23c75da727 Fix Crash/PP recovery position on instructions with comments
PR #2967 altered the way ``sdpos_atomic`` was set, causing issues in the
crashdetect/powerpanic recovery offset if the instruction being
recovered happens to contain a comment.

Previously ``sdpos`` was assumed to be a single byte prior to the last
read character. sdpos+1 would thus position the index to the next
instruction. With gcode-filtering in place, sdpos is left just before
the comment, while the actual read position is at the newline. This
causes to parser to resume in the middle of the comment.

Change the value returned by cardreader::get_sdpos() to always return
the last read position, as everybody expects (!!).

This avoids the +1, and correctly sets the resume position to the next
valid instruction without overhead.
2021-04-19 06:30:37 +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
c1ead75a73 Remove commented debug code
the whole PR is ready for review after successfull tests
2021-02-10 11:18:59 +01:00
D.R.racer
caf58b16b6 Fix handling EOF
+ save ~160B by using local variables
+ rename some of the vars to more descriptive names
+ remove consecutiveEmptyLines handling from cmdqueue
2021-01-29 08:29:51 +01:00
D.R.racer
c3758d350e Fast skipping of large comment blocks
This is an extension/optimization of PR #2956.
It uses the cached 512B block buffer to avoid heavy-weight read() in SdBaseFile.
Even though this principle allowed the AVR to skip ~600KB of data within ~5 seconds,
the impact on code base is huge, especially into well proven and long-term stable
parts like reading a file from the SD card.

The sole purpose of this PR is to show/verify the possibility of the AVR CPU
in relation to adding thumbnails into MK3 G-codes.
Moreover, this PR shall not be merged unless the missing/commented features
are restored - especially file seeking and M84 search.

PFW-1175
2021-01-27 07:03:51 +01:00
D.R.racer
dcc6605809 Workaround for skipping large comment blocks
If there are large blocks of comments in the G-code,
the printer may get shot down by its own watchdog.
Watchdog is generally set to 4s and updated only
in manage_heaters (and some other spots in some specific cases).

So far, the code reading the file and feeding it into Marlin
cycles indefinitely until it finds valid G-code lines and fills up the
command queue.

If the block is large enough, the printer cannot read it completely
within those 4s.

A simple workaround - bail out after some consecutive empty/comment
lines to enable other parts of code do their job (especially
manage_heaters).

Tested on MK404, previous FW fails with 600KB of comment lines at the
beginning, this patch survives. The printer even draws some update
on its status screen before starting a real print.
2021-01-27 07:03:51 +01:00
Alex Voinea
0c305ee5f5 Fix warning 2020-11-09 21:49:56 +02:00
Alex Voinea
4abf1f436a Gracefully dump the queue + fixes to fancheck 2020-11-09 21:49:56 +02:00
Alex Voinea
fdbbc7d62a Terminate last line from the SD card even if it doesn't have a \n 2020-11-09 21:49:56 +02:00
Alex Voinea
e7f2577233
Fix kill messages 2019-11-29 22:49:22 +02:00
Yuri D'Elia
404802b5e6 Clear "sdprinting" state only when all SD moves are complete
Ensure card.printingHasFinished sees all the planned moves before
clearing sdprinting. To do that, we need to ensure all SD commands
exited the command queue.
2019-11-28 15:57:20 +01:00
Marek Bel
3eb36ca194 Fix cmdqueue_dump_to_serial.
Header was historically made bigger to contain size of the command on SD card, but those debug functions wasn't updated.
2019-08-23 16:48:30 +02:00
Marek Bel
cbb92860d0 Use first letter capital camel case for enum class members. 2019-06-12 18:54:32 +02:00
DRracer
c7e1e73880 another almost 200B down by proper usage of smaller data types and enum
classes
2019-06-12 15:41:55 +02:00
Ondrej Tuma
b7fe43bf68 Deleted bad cols/rows definitions for translation. 2019-05-07 12:52:23 +02:00
PavelSindler
6ad5c07e6d comments 2019-02-21 14:28:05 +01:00
PavelSindler
1e729048dc cmdqueue_reset fix 2019-02-21 00:14:49 +01:00
Robert Pelnar
eea755496b Conditional translation for SYSTEM_TIMER_2 because we want to have posibility to switch between old/new implementation.
Timing functions (millis, micros and delay) replaced in whole source, defined in Marlin.h.
This commit enables original implementation (SYSTEM_TIMER_2 undefined)
Verified with passed complete wizard process.
2019-01-27 22:48:51 +01:00
PavelSindler
c1773c1aa4
Merge pull request #1356 from PavelSindler/MK3_for_merging
process serial line during pause
2018-11-22 23:07:07 +01:00
PavelSindler
85b23d1db6 process serial line during pause 2018-11-22 21:41:22 +01:00
Robert Pelnar
7426efac9b Lang - text "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)" removed from dictionary 2018-11-22 18:36:38 +01:00
Robert Pelnar
1568b94e87 Lang - text "No Checksum with line number, Last Line: " removed from dictionary 2018-11-22 18:09:07 +01:00
Robert Pelnar
fdf9734161 Lang - text "checksum mismatch, Last Line: " removed from dictionary 2018-11-22 17:59:43 +01:00
Robert Pelnar
46fba48173 Lang - text "enqueing \"" removed from dictionary 2018-11-22 17:38:52 +01: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
a575c028bf resend request sends OK 2018-07-16 19:20:39 +02:00
PavelSindler
88a19432b7 whitespace 2018-06-19 17:48:31 +02:00
PavelSindler
1e60390545 dont process data from serial line if print is saved (crash detection and filament detection) 2018-06-19 16:51:22 +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
2cf20c8c99 New ML support - migration - fix_source_1.sh script (replace 'MSG_xx' with '_T(MSG_xx)')
+ output + fixed source
2018-05-23 16:37:08 +02:00
Robert Pelnar
bd587faab9 New ML support - migration - replaced source, removed original ML support files (backup) 2018-05-22 03:20:03 +02:00
PavelSindler
863fe1f054 show message that printer is not connected to monitoring on printer start 2018-03-14 15:35:39 +01:00
bubnikv
17a8e2db01 Documented the interrupt blocking by a main thread by its maximum time.
Added a debug output to serial line on stepper timer overflow.
2018-01-20 14:58:30 +01:00
PavelSindler
1d3f6e8be5 flush rx buffer in case that it was full 2018-01-15 12:18:21 +01:00
Robert Pelnar
e3c006dbe9 Serial communication uses port0 or port1, not both, removed some suspected code.
build 141
2017-12-29 00:06:47 +01:00
PavelSindler
e8477b525c initial version of M110 fix (port from MK2) 2017-12-22 22:34:57 +01:00
PavelSindler
7114772784 whitespace 2017-12-22 19:23:11 +01:00
PavelSindler
3aca1271ed serial resend request always contains OK 2017-12-22 18:54:55 +01:00
PavelSindler
2e68770e62 initial version - messages missing (will not compile) 2017-11-07 16:49:04 +01:00