Commit Graph

253 Commits

Author SHA1 Message Date
Yuri D'Elia
f8de274db3 Split fan checks out of temperature.cpp 2022-07-18 17:53:27 +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
Alex Voinea
50f4981a06 Remove forgotten SNMM code in M600 2022-02-24 14:02:49 +01:00
Alex Voinea
536395eabf
Merge pull request #3413 from leptun/MK3_fix_timer_polling
Make some timers LongTimer
2022-02-17 09:00:13 +01:00
Alex Voinea
91c71da810 Convert some more suspicious timers to LongTimer 2022-02-17 08:48:29 +01:00
Alex Voinea
a6331d22c8 Remove ancient SNMM code in the MK3 branch 2022-02-15 15:58:33 +01:00
Alex Voinea
4ec8781df2 Fix usb print timer 2022-02-13 22:52:49 +01:00
Alex Voinea
42b91a83cd Merge branch 'MK3' into MK3_3.12_Optimizations 2022-02-10 10:36:31 +01:00
Guðni Már Gilbert
ff00988303 Revert "Replace hardcoded values and optimise strings"
This reverts commit e62bc4686f.
2022-02-06 11:09:45 +01:00
Alex Voinea
d06e74dd6f Fix Welcome message and language flashing 2022-02-05 23:44:24 +01:00
Guðni Már Gilbert
e62bc4686f Replace hardcoded values and optimise strings
This commit saves 64 bytes of flash memory on my end
2022-02-05 18:28:17 +00: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
802b8860c8 Convert mmu_last_finda_response to ShortTimer
Saves 48 bytes of Flash, 1 byte of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert
1cd9ecb2c7 Convert mmu_last_request and mmu_last_response to ShortTimer
Saves 180 bytes of flash and 2 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
6afc87d3c8 Reduce unnecessary LCD CGRAM writes 2021-07-30 23:53:57 +00: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
Yuri D'Elia
d727a949dd Silence explicit case-fallthru 2021-06-21 06:52:52 +02:00
Yuri D'Elia
449510392d Untangle a bit some recursive include mess 2021-06-12 15:09:03 +02:00
3d-gussner
466de83ae0 Remove white spaces in messags which saves ~62bytes 2021-04-26 07:22:22 +02:00
3d-gussner
0d48a32e87 Define #MSG_RESUME_NOZZLE_TEMP c=20 r=4 2021-03-31 06:41:17 +02:00
3d-gussner
99893d5066 Define #MSG_MMU_CONNECTED c=18 2021-03-30 18:11:22 +02:00
3d-gussner
77a7a92a42 Define MSG_MMU_LOAD_FAILED c=20 2021-03-30 18:08:13 +02:00
3d-gussner
db07d55c29 Define #MSG_MMU_FIX_ISSUE c=20 r=4 2021-03-30 09:11:19 +02:00
3d-gussner
1b8ca77b0c Define #MSG_MMU_CUTTING_FIL c=18 2021-03-30 09:01:58 +02:00
3d-gussner
4dc99d970d Update "MMU needs user attention." c= r= values 2021-03-19 16:17:26 +01:00
3d-gussner
6a267e5a9a Update "Press the knob to resume nozzle temperature." c= r= values 2021-03-19 15:30:13 +01:00
3d-gussner
ba73d14511 Update "Fix the issue and then press button on MMU unit." c= r= values 2021-03-19 15:13:56 +01:00
D.R.racer
3ccd1b2b2b Refactor lcd_set_cursor + lcd_puts_P -> lcd_puts_at_P
saves considerable amount of flash
2021-01-22 18:34:47 +01:00
Voinea Dragos
da21916473 Change printf_P without format arguments and NL to puts_P only 2021-01-22 18:56:05 +02:00
D.R.racer
c710253cca Code cleanup and size reduction and RAM optimization
Replase single character strings with single characters when calling
lcd_print
2021-01-22 17:11:51 +01:00
Alex Voinea
4abf1f436a Gracefully dump the queue + fixes to fancheck 2020-11-09 21:49:56 +02:00
Alex Voinea
c3abd4ffe6
Remove io_atmega2560.h and some more macros 2020-09-11 17:43:38 +03:00
DRracer
eb44ee0f57
Code size optimization: 2KB down (#2687)
* Combine repeated calls into functions with much less parameters -> 2KB
down.

* Save some bytes by removing unnecessary 1-character strings: "x" -> 'x'
used in SERIAL_xxx printing macros.
This is also saves some CPU cycles

* Fix compilation for MK25S and MK3

* Copy surrounding indentation

* Fix compilation for a rare HW setup

* rename mesh_planXX_buffer_line back to mesh_plan_buffer_line

* Remove active_extruder from remaining plan_buffer_line_destinationXYZE
calls and one more fix of indentation
2020-06-01 17:51:28 +02:00
3d-gussner
deff8dcfde
MK3 3 9 0 missing translations (#2646)
* Add and update missing translations
- updated in Firmware/ files the missing `c=xx` column and `r=yy` rows.
- added missing translations to lang/lang_en*.txt

Everyone is developing and adding messages to serial and especially to LCD  PLEASE add `//// c=xx` or `//// c=xx r=yy` comments.
Preparing translations files without that information is a pain in the ... and takes way more time for somebody else
to review to code as it would take you.

* No need to have `MSG_abcde` again in comments `////` in `messages.c`

* German translation

* Missed a space

* Use the same format as somewhere else

* French translation.
I am not a native French speaking person, so please excuse my mistakes I may have done.

* Spanish translation.
I am not a native Spanish speaking person, so please excuse my mistakes I may have done.

* CZ translation

* Fix typos

* Another fix
It is
Dimmwert and not Dim Wert

* Fix issues reported by `lang-check.py`

* Add "difficult" messages containing `%`

* Updated MSG and German translation

* removed a translation as it breaks the language selection

* No need to wait until any-key is pressed

* No need to wait any-key is pressed

* Fixed two LF issues

* Updated PO files
ready to be send to translators

* Add missing italian translations

* Improve some existing italian translations

* More italian fixes

* More italian fixes

* Add exceptions in editorconfig for po files to avoid recoding

* Fix typo
Thanks @DRracer for pointing out

* Italian translation by @wavexx

* Update po/new/*.po files

* Update after merging MK3 branch

* Update French translation and some c=xx comments

Big thanks to @awenelo @carlin57 for helping with the french translations and their comments.

* Update po files after French translation

* Fixed most `lang-check.py` reported translation errors for Czech and German.
Two Czech have to be reviewed as these are too long.
One German is correct as it is shown in c=20 r=2 but is 1 char longer than this to split the message.
One German translation seams to be to long but have to review the actual max length

* Fix `lang-check.py` Spanish translation errors
There have been quite lot TOO long messages,

Can't imagine that nobody every complained about that.

* Fix `lang-check.py` Italian translations errors

* Update not_tran and not_used files after fixing several translations

* Some more error fixes and update of `po` files

* Polish translation

* Czech updated

* Fix typo

* no need to translate `\x00` if it is the same

* Polish: Runouts->Koniec

* Polish: Runouts->Konce f ... hopefully the last change

* Added MK2.5/s auto power mode to eeprom doxygen

* Final updates.

- Compiled all versions with multi-languages
- Compiled all versions with EN_ONLY
- updated all /lang/po/Firmware*.* files

* Add crlf attributes for po files

As done for editorconfig, this similarly forces git to handle
po files consistently in DOS format.

* Further improvent of IT translations

* Updated translation
Added cleanup to PF-build.sh

* remove lang/not_tran* and lang/not_used mistakenly added into the PR

Co-authored-by: DRracer <drracer@seznam.cz>
Co-authored-by: Yuri D'Elia <wavexx@thregr.org>
Co-authored-by: D.R.racer <drracer@drracer.eu>
2020-05-12 22:23:40 +02:00
DRracer
5106831ba2
Merge pull request #2526 from leptun/MK3_decouple_XYZE_relative_mode
Mk3 decouple XYZE relative modes
2020-03-26 18:58:20 +01:00
Alex Voinea
5fcf18718f
Decouple XYZ relative from E relative. 2020-03-05 11:22:35 +02:00
vintagepc
34f43d7389
Update mmu.cpp
Fix runout if filament is unknown
2020-02-05 21:41:31 -05:00
DRracer
7230b99448
Merge pull request #2393 from wavexx/sync_before_resume
Sync before resume
2020-01-15 12:49:56 +01:00
DRracer
4c74866864
Merge pull request #1933 from prusa3d/enable_cutter
Enable MMU cutter.
2020-01-09 13:47:44 +01:00
Yuri D'Elia
57be14fca6 Complete all pending moves before restoring a saved print 2019-12-30 13:30:06 +01:00
DRracer
44288bfe90
Merge pull request #2309 from leptun/MK3_fix_MMU_pause_time
Fix MMU needs user attention Statistics error
2019-12-15 11:04:57 +01:00
Yuri D'Elia
6ecff003b7 Fix M600 insertion by the filament sensor
Remove incorrect usage of stop_and_save_print combined with the
fsensor_recovert internal instruction which would result in a
broken sequence of events and/or broken stack.

Re-use the now safe stop/recover functions in the same spot
(fsensor_checkpoint_stream) to effectively cut a hole in the current
gcode stream to insert an M600 instruction, which removes all
recursive behavior without the need of extra state variables.
2019-11-28 17:13:37 +01:00
DRracer
8fae50ec79
Merge pull request #2315 from mkbel/finda
PFW-1047: Show FINDA state as N/A if last received response is older than 1s.
2019-11-15 12:53:01 +01:00
DRracer
21dd8eadd1
Merge pull request #2188 from mkbel/cut_last_try
Use MMU cutter only as last resort.
2019-11-08 16:49:28 +01:00
leptun
459385708e Fix MMU needs user attention Statistics error 2019-11-02 13:15:13 +02:00
Marek Bel
76c39ce689 Show FINDA state as N/A if last received response is older than 1s. 2019-10-31 17:45:22 +01:00
Yuri D'Elia
50231b76da Improved handling of unknown Z position
- Introduce raise_z_above to move Z carefully when the current position
  is potentially unknown, using stallguard
- Use raise_z_above for:
  * filament loading/unloading clearance
  * extruder spacing when preheating (to avoid buildplate marks on PEI)
  * before homing to avoid damaging the build plate and to avoid
    repeated Z moves as well

Since raise_z_above is conditional, it will only raise when needed.

Calling raise_z_above when the extruder position is unknown and already
at maximum travel is safe and will prevent further vertical moves.
2019-10-22 15:49:10 +02:00
Marek Bel
3a541488b2 Rename extr_unload_() to mmu_unload_filament() and move it to ultralcd.cpp as it is menu. 2019-09-12 18:40:02 +02:00