Commit Graph

141 Commits

Author SHA1 Message Date
3d-gussner
129b646c58 Fix MSG_ c=
Add MSG_ to messages.c/h
2022-09-14 11:33:24 +02:00
3d-gussner
ee6821eb0e Add missing MSG_ c= r= 2022-09-14 11:33:24 +02:00
Alex Voinea
7d597eb8b0 Move farm mode to separate file 2022-08-30 13:57:43 +02: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
Yuri D'Elia
3a1914f2fb Simplify printingHasFinished
Unswitch the call to file.close().

Do not call quickStop(): motion has already completed due to
st_synchronize.
2022-08-06 23:29:34 +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
a96e60c241 Do not call lcd_update after presorting 2022-07-15 15:45:34 +03:00
Alex Voinea
e79e15b12f Use the sd cache for positions even when not sorting 2022-07-04 18:06:54 +02:00
Alex Voinea
d9d3d68217 Remove postponed sorting of elements
Now that the position is a uint16_t instead of uint32_t, it is simpler to just sort the positions in place without using the uint8_t indices. Also, this approach is considerably lighter on the stack usage and it also removes a delay after the sorting happens
2022-07-04 18:06:54 +02:00
Alex Voinea
c100df7ba3 Remove quicksort, shellsort and add performance benchmark 2022-07-04 18:06:54 +02:00
Alex Voinea
490754a0f0 Fix build 2022-07-04 18:05:49 +02:00
espr14
02ca9496e8 File: use insert sort 2022-07-04 18:05:49 +02:00
Yuri D'Elia
e37435b53f Merge remote-tracking branch 'upstream/MK3_3.11.1' into mk311_sync 2022-07-04 16:14:23 +02:00
Yuri D'Elia
0d7680dbf7
New PO-based language translation support (#3471)
* lang: Add a PO language extractor with FW metadata support

Implement a straight-to-po language extractor which supports our custom
language requirements:

- _i/_I/ISTR for text string definitions
- _T for catalog translations (with back-reference support)
- //// EOL comments with:
  - MSG_ catalog entry name identifiers
  - c=X r=Y annotations for screen dimensioning checks
- Crude support for commented lines

All source locations are correctly referenced in the PO, with the
metadata colleted in the comment for further processing.

Several checks are implemented already during extraction:

- Correct catalog name assignment (no duplicates)
- Metadata checks for each entry

Further checks will be implemented by directly checking the translated PO file.

Requires "polib" and "regex" python modules.

* lang: Adapt lang-check to work directly on PO/POT files

* lang: Allow lang-extract to generate stable (pre-sorted) output directly

* lang: Further extend lang-extract consistency/error checking

- Do not parse inside preprocessor conditionals
- Distinguish between references and definitions
- Warn about missing references and definitions

* lang: lang-extract: warn about incorrect PROGMEM assignments

Check that ISTR is used along with PROGMEM_I1 in an attempt to spot
useless translated catalogs.

* lang: lang-extract: Improved handling of same-line translations

Correctly reference metadata on same-line translations.

* lang: lang-extract: Handle _O as a cat-ref

https://github.com/prusa3d/Prusa-Firmware/pull/3434

* lang: lang-extract: Warn about unused catalog definitions

* lang: lang-extract: Allow propagating translation comments via //

The definition:

    code //// definition [// comment]

will check [definition] as before, but blindly accumulate // comment.
The comment is then re-appended back into the PO files for translators
with the form:

    definition
    comment
    comment...

* lang: Fix incorrect display definitions

* lang: lang-extract: Check source encoding/charmap

* lang: Translate the degree symbol

* lang: Unbreak/cleanup DEBUG_SEC_LANG

* lang: Improve meaning of comment

* lang: Split charset conversions into an aux lib for future use

* lang: Implement lang-map.py to extract the translation symbol map

- Extracts the translatable symbol map for further use
- Computes a stable "language signature" from the map itself
- Optionally patches the binary update the symbols

* lang: Check for translation recoding problems

* lang: Implement a transliteration map to post-process translations

TRANS_CHARS is now used to replace unavailable symbols to the source
encoding, only while producing the language catalog.

* lang: Handle/check character replacements in lang-check

Filter the translation through TRANS_CHARS, so that the preview and
length check are performed correctly for expanding replacements such as
'ß' to 'ss'.

* lang: Implement lang-build.py to generate the final language catalog

* Cleanup .gitignore

* lang: Drop txt language files

* lang: Remove outdated translation scripts and obsolete docs

* lang: Update build scripts for new infrastructure

* lang: [no] Integrate accents from po/new/no.po

We now support accents natively

* lang: Remove redundant directory po/new/

* lang: Fix encoding of LCD characters in PO files

* lang: [hr] Fix wrapping in MSG_CRASH_DET_ONLY_IN_NORMAL

* lang: Sort and reformat PO files for further massaging

* lang: Switch to developer (dot) comments for PO metadata

* lang: Allow the IGNORE annotation to skip extraction

* lang: Fix missing/broken language metadata in sources

* lang: Add update-pot.sh and regenerate po/Firmware.pot

* lang: Add update-po.sh and refresh all PO files

* lang: Add summary documentation about the new translation workflow

* Add more ignored files

* CI: Add new required dependencies to travis

* lang: lang-build: Improve warning message

"referenced" was really meaning that data is being duplicated.

* lang: Respect the language order as defined in config.sh

This correctly splits normal and community-made entries during language
selection.

* lang: More typos in the documentation

* lang: Check for the maximum size of each language

Each table needs to fit within LANG_SIZE_RESERVED

* lang: Properly align _SEC_LANG to page boundaries

... instead of relying on _SEC_LANG_TABLE to calculate the offset

* lang: Build support for dual-language hex files

Detect the printer type by checking the current variant type.

On printers with no xflash (MK2*), generate one hex file for each
additional language file by patching the built-in secondary language
table during the build process

* lang: Mention lang-patchsec.py

* lang: Use color() instead of tput for clarity

* lang: Allow disabling terminal colors with NO_COLOR/TERM=dumb

* lang: Consistent use of redirection in config.sh

* lang: Stricter variant-type check for xflash support

* lang: Output size stats when building double-language hex files

* lang: Respect NO_COLOR in lang-check.py

* lang: Check for repeated/incorrect annotations

Catch errors such as "c=1 c=2"

* lang: Correct MSG_SLIGHT_SKEW/MSG_SEVERE_SKEW annotations

* lang: [it] Improve MSG_*_SKEW translation

* lang: Use INTLHEX instead of OUTHEX_P/S for configuration

We already have OUTHEX which is the compiled firmware.

Use INTLHEX for the final internationalized firmware, which is less
confusing. Also, assume it being a prefix for all generated hex
files, which reduces the number of variables set.

* lang: Move lang_map to lib.io for further use

* lang: lang-check: Accept a firmware map file to suppress unused string warnings

* lang: Use the map file to reduce useless warnings during fw-build

* lang: lang-check: Also suppress unused empty annotations

* lang: Fix MSG_MOVE_CARRIAGE_TO_THE_TOP_Z annotation

Refresh pot file

* lang: lang-check: Do not warn about same-word translations by default

Do not warn when one-word translations such as "No" result in "No" also
in other languages, since this is common in latin languages.

Allow to re-enable the warning with --warn-same

* lang: lang-build: Handle same-source/translation efficiently

* lang: [it] Explicitly add On/Off/Reset/Wizard to suppress warnings

Instead of displaying a warning, supress the warning and explicitly
translate each entry using english (which is the common/acceptable
word in these cases).

* lang: [it] Suppress more warnings

* lang: lang-check: Add intermediate "suggest" warning category

Warnings in the "suggest" category as shown as [S] as based on pure
speculation from the checking tool, such as the translation being
significantly shorter than the original.

As a result, they can be suppressed with --no-suggest

* lang: Return translation status from lang-check

- 0 if the translation only contains suggestions
- 1 if the translation contains warnings or errors

Check for the exit status in fw-build.sh, but do nothing at the moment
except printing a non-fatal error.

* lang: Remove "trim_trailing_whitespace=false" for po files

PO files got cleaned up/rewritten. We can now ensure they stay
consistent.

* lang: [sv] Re-integrate changes from 70c73cb

* lang: [no] Reintegrate changes from @pkg2000
2022-06-16 15:03:30 +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
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
a1abd094dd Convert autostart_atmillis to ShortTimer
Saves 34 bytes of flash and 1 byte of SRAM
2022-01-30 11:39:24 +00:00
Voinea Dragos
9684806e00 Change arduino IO to fastio where possible 2022-01-30 11:22:43 +00:00
Guðni Már Gilbert
be79e3791f Fixes #3262
Make sure to call lcd_timeoutToStatus.start() when the SD card is inserted
into the printer after it was removed beforehand.

(cherry picked from commit 6795843f153aa064f087f80990419a946cdfe857)
2021-11-18 19:23:21 +00:00
Voinea Dragos
ecce6f865f write_command() no line number handling 2021-06-25 08:12:30 +02:00
DRracer
6188870c2e
Merge pull request #3157 from wavexx/improve_d2
Add extra debugging functions & crash analysis
2021-06-22 07:37:30 +02: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
Yuri D'Elia
449510392d Untangle a bit some recursive include mess 2021-06-12 15:09:03 +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
Voinea Dragos
b16e1e5235 Invert size and LFN in M20 L output 2021-04-19 13:54:43 +03:00
Voinea Dragos
6d7d8c7c75 Do not show hidden/system dirs with M20 L 2021-04-19 13:31:30 +03:00
Alex Voinea
28f21c8630
Fix bubblesort sorting speed. ShellSort is probably broken 2021-02-26 19:17:14 +02:00
Alex Voinea
c63f92ae52
Invert shellSort logic 2021-02-26 08:57:49 +02:00
Alex Voinea
8821439878
Cardreader progressbar code 2021-02-25 20:25:32 +02:00
Alex Voinea
54b2edbc8c
Update debugging code 2021-02-25 19:26:01 +02:00
Alex Voinea
1c1ff722c0
Move sort_order to stack during ::presort 2021-02-10 18:16:26 +02:00
Alex Voinea
8397dae386
Remove comment 2021-02-10 18:15:18 +02:00
Alex Voinea
b4de57c365
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2021-02-10 17:08:28 +02:00
Alex Voinea
a95d497289
Remove commented out code and deprecated comments 2021-02-10 13:45:30 +02:00
Alex Voinea
8a068d4d36
Remove redundant position=0 in ::presort 2021-02-10 13:44:39 +02:00
Alex Voinea
b72ce00183
Reduce reserved space on stack for LONG_FILENAME_LENGTH by 1 in presort
LONG_FILENAME_LENGTH already includes a +1 for the \0 string termination
2021-02-10 13:43:46 +02:00
D.R.racer
7ad922e87b Report fname instead of name
looks like being omitted in MK3 upstream fixes
2021-02-10 12:38:04 +01:00
D.R.racer
8d39880abf Fix compilation against latest MK3 branch 2021-02-10 12:23:02 +01: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
4fcbf95db6
apply RAII principle on the lsDive recursion limiter 2021-02-09 15:00:46 +02:00
Alex Voinea
c739aa9003 M23 full path support. 2021-02-07 21:51:44 +02:00
Alex Voinea
f5cde38a7c Remove duplicit debug line 2021-02-06 21:06:37 +02:00
Voinea Dragos
52f7a71dce More fixes that were extracted from #2405 2021-02-06 14:59:11 +02:00