Commit Graph

60 Commits

Author SHA1 Message Date
3d-gussner 45a223a1f9 Remove White spaces 2024-05-20 19:09:03 +02:00
gudnimg 40786a24e0 Rename "cardOK" to "mounted"
Sync the Prusa firmware a little bit with Marlin 2.1
2023-12-09 10:52:26 +00:00
gudnimg d94f263843 Rename initsd() to mount()
Sync the Prusa firmware with Marlin 2.1 a little bit.
2023-12-09 10:50:30 +00:00
gudnimg 42855f9f13 Rename setroot() to cdroot()
This way the name is the same as Marlin 2.1
2023-12-09 10:50:30 +00:00
Juan Francisco Estrada 7130504fcf Apply the reprint_pr_changes_diff2.txt provided by @3d-gussner 2023-11-22 12:18:59 +01:00
Juan Francisco Estrada e8a2d4c7e1 Reprint function integrated on 3.13v 2023-11-22 12:11:39 +01:00
Guðni Már Gilbert 7d86a0d121 Reduce a few magic numbers for FILENAME_LENGTH
flash: 0
RAM: 0
2022-08-26 19:26:26 +03:00
Guðni Már Gilbert d87999a020 workDirDepth can be one byte
We set the max working directory depth to 6 (see MAX_DIR_DEPTH)

Changes save 1 byte of SRAM and 50 bytes of flash
2022-08-26 10:56:02 +02:00
Alex Voinea ae1815dc52 When over the SD limit, continue from the last sorted file
This gives a significant speed boost when just above the sorting limit, while only costing 2 bytes of ram
2022-07-15 15:46:01 +03:00
Alex Voinea c100df7ba3 Remove quicksort, shellsort and add performance benchmark 2022-07-04 18:06:54 +02:00
Guðni Már Gilbert 15b41e7348 Optimise autostart_stilltocheck variable
Make the variable static within the checkautostart function.
When the function is called for the first time autostart_stilltocheck
is set to true and will continue to live after the function is exited.
After it is set to false within checkautostart() it will continue to be
false forever.

Using static this way is more efficient than using a global variable

Saves 6 bytes of flash and 1 byte of SRAM
2022-04-09 11:10:55 +00:00
Alex Voinea 858984ef35 SD sorting entries instead of positions 2022-02-04 10:47:56 +01:00
Guðni Már Gilbert c0e7e17fc3 Fix type of nrFiles 2022-01-30 13:07:09 +00:00
Guðni Már Gilbert a1abd094dd Convert autostart_atmillis to ShortTimer
Saves 34 bytes of flash and 1 byte of SRAM
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert 7535fa3a44 Remove unused variable
Saves 2 bytes of SRAM
2022-01-30 11:22:45 +00:00
Alex Voinea 30d9faef9d
Minor fixes to SD presence handling (#3139)
* Remove forgotten function protorypes

* Fix code indentation

* Fix double sorting if SD card is inserted during setup()

* Correctly handle SD removal during sorting
2021-06-21 07:30:47 +02:00
D.R.racer 7011014abb Save 16 bytes - pass ls_param by value to functions
... as ls_param is a 1-byte structure it is more conservative to pass it
to functions by value than by a pointer
2021-04-20 06:50:37 +02:00
Voinea Dragos 2129bcf315 M20 T 2021-04-19 14:48:50 +03: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
Alex Voinea 28f21c8630
Fix bubblesort sorting speed. ShellSort is probably broken 2021-02-26 19:17:14 +02:00
Alex Voinea 1c1ff722c0
Move sort_order to stack during ::presort 2021-02-10 18:16:26 +02:00
Alex Voinea b4de57c365
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2021-02-10 17:08:28 +02:00
DRracer 7aa4595211
Merge branch 'MK3' into thumbnails2 2021-02-10 12:15:57 +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
Alex Voinea a830d5b6b7
getfilename_next 2021-02-09 20:31:02 +02:00
Alex Voinea 8d1c5cbb27
Fix position table offset 2021-02-09 20:29:06 +02:00
Alex Voinea d2a7c62b50
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2021-02-09 16:17:43 +02:00
Alex Voinea c739aa9003 M23 full path support. 2021-02-07 21:51:44 +02:00
Voinea Dragos 52f7a71dce More fixes that were extracted from #2405 2021-02-06 14:59:11 +02:00
Alex Voinea 84d043d41b Fix WorkDirDepth limit (for good this time) 2021-02-04 17:52:42 +02:00
Alex Voinea d25b4a6bc9 Remove dead code (SDSORT_GCODE) 2021-02-03 19:18:13 +02:00
Alex Voinea e52e68d4c1 Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2021-02-03 18:30:36 +02:00
Alex Voinea 4c977cc335 Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2021-02-03 18:28:18 +02:00
Alex Voinea 5c9d202871 Change MAX_DIR_DEPTH from 10 to 6
You can't run M23 with so many directories as the length of the command will exceed the maximum allowed by cmdqueue
2021-02-02 19:08:19 +02:00
Alex Voinea b6d56bc0f4 Change M27 argument from L to P as that makes more sense (path vs LFN)) 2021-02-01 14:54:37 +02:00
Voinea Dragos 6b6205d2f6 M27 refactoring and M27 L initial implementation 2021-01-31 15:06:20 +02:00
D.R.racer 7279de7403 Separate reading G-code files and writing to a file
- extract common strings
- cleanup openFileWrite and openFileReadFilteredGcode formatting a bit
Alltogether - code size 400B down
2021-01-28 09:37:58 +01:00
D.R.racer d275fe0e83 Extract gcode filter from SdBaseFile into SdFile + optimization
- Start saving instructions as the whole PR was >1KB long.
- It turned out the compiler was unable to understand the core skipping
cycle and an ASM version had to be used.
- Add seekSet aware of the G-code filter
2021-01-27 09:33:28 +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
Voinea Dragos ced3d9fa77 "M20 L" support. Print long filenames 2021-01-22 11:13:44 +02:00
Alex Voinea 4670c42aeb
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2020-03-26 18:17:26 +02:00
DRracer f234ef2104 Use combined creation/modification file time stamps for sorting 2020-02-14 09:09:15 +01:00
Alex Voinea f0f7db57ea
Fist attempt at "saved position SD menu" 2019-12-17 00:45:25 +02:00
Yuri D'Elia dbe2ed4150 Fix pause/resume when using M25/M601
Remove the conflicting and mostly useless card.paused flag (the printing
is either paused, or not) and switch to isPrintPaused only which
accounts for both cases (SD/USB) correctly.

Fix M27/getStatus to show the current real status of the SD print.

Synchronize the queue on M601, as required to precisely pause the print
at the correct instruction.

Alias M25 to M601, which when combined with PR #1899 fixes issue #1614.

Guard against incorrect usage in M601, M602 and M603.
2019-11-28 17:37:58 +01:00
Paul Bransford 720ea49fa3 Merge branch 'MK3' into MK3-fix-sdcard-sorting 2019-08-08 19:48:50 -04:00
MRprusa3d a408f90659 recovery from "Stop()" 2019-05-18 21:28:59 +02:00
Paul Bransford 863c7158b2 use modification times for sdcard sort 2019-04-16 06:24:47 -04:00
Marek Bel 2e719c7885 Fix stack corruption for folder name longer than 12 characters. Save 260B of flash memory. Move duplicate code to separate method. Fix compiler warnings: sketch/cardreader.cpp:448:25: warning: ordered comparison of pointer with integer zero [-Wextra]
sketch/cardreader.cpp:453:22: warning: ordered comparison of pointer with integer zero [-Wextra]
2018-08-07 12:52:51 +02:00
Petr Ledvina baddf38dbc Make card filename `const`
Fixes warning in filename_wldsd
2018-07-17 17:55:05 +02:00
3d-gussner d8706be8de Fixed forgotten comment 2018-05-30 13:39:24 +02:00