Compare commits

...

4314 Commits

Author SHA1 Message Date
3d-gussner f3e0dfd481
Merge pull request #4858 from 3d-gussner/MK3_build_tags
Add `t` and `c` build
2025-08-19 08:52:51 +02:00
3d-gussner 7731024edb
Merge pull request #4859 from 3d-gussner/MK3_Fix_M256
Fix M256 S mode
2025-04-22 22:03:53 +02:00
3d-gussner f915455dae Fix M256 S parameter 2025-04-22 18:42:22 +02:00
3d-gussner 295142a010 Fix semantic versioning 2025-04-16 07:31:41 +02:00
3d-gussner 242bc9d7a8 Prepare also draft releases when `t` or `c` tags are created 2025-04-16 07:20:29 +02:00
3d-gussner 88730dca2a Update github action to build `t` test (Alpha, Beta, RC) and `c` community tags 2025-04-16 06:51:17 +02:00
3d-gussner 66797abf84 Add `c`ommunity tag 2025-04-16 06:08:48 +02:00
3d-gussner 26ed278d02
Merge pull request #4763 from sarusani/RemoveLoadMenuOnAutoload
Remove lcd_menu_AutoLoadFilament
2025-03-10 08:17:12 +01:00
3d-gussner 6c6476cc6c
Merge pull request #4851 from 3d-gussner/MK3_LCD_Brightness
Add M256 [ B | D | S | T ]
2025-02-28 20:00:33 +01:00
3d-gussner a7682997f4 Optimisation, thanks @gudnimg 2025-02-28 07:56:51 +01:00
3d-gussner 34450f52a8 Add M256
- Removed hardcoded values and added
  - LCD_BACKLIGHT_LEVEL_HIGH 130
  - LCD_BACKLIGHT_LEVEL_LOW 50
  - LCD_BACKLIGHT_FORCE_ON 30
  - LCD_BACKLIGHT_TIMEOUT 15
2025-02-26 13:35:29 +01:00
3d-gussner a29c246af1
Merge pull request #4846 from 3d-gussner/MK3_M300_duration_set_4s_limit
M300 set 3.5s duration limit
2025-02-13 10:52:28 +01:00
sarusani 29907639ae Remove lcd_menu_AutoLoadFilament 2025-02-12 11:42:55 +01:00
3d-gussner c40af0c896 M300 set 3.5s duration limit 2025-02-11 17:59:50 +01:00
3d-gussner 9fb034a985
Merge pull request #4847 from 3d-gussner/MK3_action_cache_v4
Change actions/cache to v4
2025-02-11 17:57:34 +01:00
3d-gussner 1965743ba2 Change actions/cache to v4 2025-02-11 17:31:28 +01:00
3d-gussner c798754ec2
Merge pull request #4845 from 3d-gussner/MK3_workflow_atrifacts_v4
Update upload-atrifacts to version 4 as 3 is deprecated
2025-02-11 16:55:27 +01:00
sarusani e80c9fa315 Align MIN_Z raise for unload & load
Align values for load and unload to prevent movement between unload & load operations.
2025-02-11 06:03:43 +01:00
Anna Snoeijs 1a0e0a804f Added description on how to install dependencies on Fedora based distributions 2025-02-11 06:00:32 +01:00
3d-gussner c21dc36507 Update upload-atrifacts to version 4 as 3 is deprecated 2025-02-11 05:55:58 +01:00
3d-gussner e10c8d9c5a Fix rebase issue fix 2024-12-30 13:58:58 +01:00
3d-gussner 477d7ae5ef Add multiscreen message with `Cont.|Cancel`
Remove `Continue?` from some mesages to save "translation space" and replace multiscreen from `Yes|No` to `Cont.|Cancel`
Remove `Print canceled.` from check messages to save again "translation sapce" and after confirming the message the Status Line shows that it has been stopped.

fix rebase issue
2024-12-30 13:58:58 +01:00
3d-gussner ee4d8bb5e5 Fix lcd_status_message_level 2024-12-30 13:57:58 +01:00
3d-gussner 80cb13003e Show filename after SD print finished 2024-12-30 13:57:58 +01:00
gudnimg 901f63e90f remove incomplete dual stepper configuration
If either Y_DUAL_STEPPER_DRIVERS or Z_DUAL_STEPPER_DRIVERS is defined
the compilation will fail with an error message. This configuration will likely
never be fully implemented unless someone from the community steps up.
2024-12-30 13:57:08 +01:00
3d-gussner 3ea620c27a Eject translations in German and Dutch not shorten as it fits now the multiple choice. 2024-12-24 07:52:50 +01:00
3d-gussner a704b99d81 Fix multiple choice
Fixes #4819
2024-12-24 07:52:50 +01:00
gudnimg d3f95592c1 Convert uart2.c to a C++ file 2024-11-27 09:16:41 +01:00
gudnimg 6b01929382 Trim empty lines 2024-11-27 09:16:41 +01:00
gudnimg 4a0973941f Mark uart2_putchar and uart2_getchar as static 2024-11-27 09:16:41 +01:00
gudnimg 51e81217dd Remove unhelpful comments and constants 2024-11-27 09:16:41 +01:00
gudnimg 18bda84876 remove unused function uart2_rx_str_P 2024-11-27 09:16:41 +01:00
3d-gussner b7e3216944
Merge pull request #4811 from 3d-gussner/MK3_new_1st_layer_cal
Optimze and new first layer calibration
2024-11-27 09:10:04 +01:00
3d-gussner b67554eb01 Switch back from `%g` to `.4f`
Set short length so the square is printed in the middle of the bed
Both purge lines with and without MMU end at X=202.5 to get the square in the middle of the bed
2024-11-20 12:10:33 +01:00
Alexandra Voinea 7a47bf30be Fix end of meander overextrusion with new pattern 2024-11-20 09:28:21 +01:00
Alexandra Voinea 24ce71eded Optimize meander moves 2024-11-20 09:11:18 +01:00
Alexandra Voinea 519724b53d Ensure all meander moves are done using relative mode
Without this the first vertical move of the new meander would be slightly longer than expected due to using absolute moves from a negative Y starting position
2024-11-20 08:57:36 +01:00
Alexandra Voinea 81d124affd Minor nitpicks 2024-11-20 08:52:12 +01:00
Alexandra Voinea 13d12c0ffa Get rid of float casts 2024-11-20 08:38:19 +01:00
gudnimg e84ade3542 optimisation: combine a few functions calls into one
Change in memory:
Flash: -34 bytes
SRAM: 0 bytes
2024-11-19 19:50:12 +01:00
Alex Voinea 658df9d04d Extract G91 to messages.h/cpp 2024-11-18 10:12:05 +01:00
Alex Voinea 1319af8a12 Ensure that a correct feedrate is used at all times 2024-11-18 10:09:10 +01:00
Alex Voinea 44f9b953c5 remove unused step parameter in lay1cal sqaure 2024-11-18 09:51:02 +01:00
gudnimg 0b5afa3092 Unload the filament at parked position
We don't want to unload while the nozzle is still smudged against the bed.
2024-11-18 09:45:51 +01:00
gudnimg a0278b2844 Fix an issue where MMU unloads filament while its cooling down
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2024-11-18 09:45:51 +01:00
3d-gussner d1470d8abc New first layer calibration
- changed to relative mode to save buffer and code size
- added NEW_FIRST_LAYER_CAL to perform 1st layer cal from front to back
2024-11-14 14:45:25 +01:00
3d-gussner d8d058a63b
Add Set parameter in M78 Statistics gcode (#4809)
* Add Set Statistics

* EEPROM_FILAMENTUSED is in centimeter and not meter
Fix few things

* Fix typo
2024-11-14 08:20:39 +01:00
3d-gussner 0fb17b1643
Merge pull request #4805 from 3d-gussner/MK3_Fix_MMU
Remove hardcoded MMU tool count
2024-11-10 11:56:55 +01:00
3d-gussner cdb6635eac Remove hardcoded MMU tool count
- Preload to MMU -> All
- Loading Test -> All
- SpoolJoin
2024-10-29 15:50:01 +01:00
3d-gussner ef3527eb0f
Merge pull request #4782 from 3d-gussner/MK3_3141_po
Update po files
2024-09-24 16:45:16 +02:00
3d-gussner 21084af026 Update po files 2024-09-24 16:37:43 +02:00
3d-gussner 24bfa8db59
Merge pull request #4780 from leptun/MBL_relax_tight_thresholds
Further relax the MBL tight threshold
2024-09-24 13:47:02 +02:00
Alex Voinea f12683f3ff Further relax the MBL tight threshold 2024-09-24 10:33:23 +02:00
3d-gussner aa4de7ae7e
Merge pull request #4773 from 3d-gussner/MK3_fix_unload
PFW-1561 Fix MMU unload issue
2024-09-23 07:39:18 +02:00
3d-gussner 402b9ed93a Add `#ifdef FANCHECK` thanks @gudnimg 2024-09-23 07:00:17 +02:00
3d-gussner 65a26e882b Enable Tune menu during fan check issues, user can then disable the fan check if needed.
Send //action:cancel when LCD Stop print is selected.
2024-09-18 16:09:46 +02:00
3d-gussner 29c920c801 Fix MMU unload issue after a fan check issue has been solved 2024-09-18 16:09:46 +02:00
3d-gussner ab5c7ac6c6
Merge pull request #4772 from gudnimg/FW-1562
PFW-1562 Fix an issue where safety timer is not handled correctly in `mFilamentPrompt` menu
2024-09-17 16:30:37 +02:00
gudnimg de092b35d5 PFW-1562 Fix an issue where safety timer is not handled correctly in mFilamentPrompt menu 2024-09-15 10:28:10 +00:00
3d-gussner 5aa67489da
Merge pull request #4768 from 3d-gussner/MK3_3141_test_prep
Prepare FW 3.14.1 for testing
2024-09-04 09:54:21 +02:00
3d-gussner 7d3032c001 Bump up version to FW3.14.1-RC1-8225 2024-09-04 09:33:47 +02:00
3d-gussner 2c621e025a Update pot and po files 2024-09-04 09:32:30 +02:00
3d-gussner 6ea47967da
Merge pull request #4765 from leptun/MBL_fixes
Region MBL fixes
2024-09-04 07:42:48 +02:00
3d-gussner 4e9e20c67f
Merge pull request #4766 from gudnimg/remove-sm4_line_xyze_ui
Remove sm4 line xyze UI
2024-09-03 15:22:56 +02:00
3d-gussner 2fed2f00f7
Update Czech translation
Thanks to @DRracer
2024-09-03 13:27:53 +02:00
3d-gussner 1c0a59f7c9
Update Hungarian translation
Thanks to @AttilaSVK
2024-09-03 11:47:14 +02:00
3d-gussner 3facdb4576 Add new message and translations 2024-09-03 09:34:18 +02:00
Alex Voinea cb502ee7bc Update MSG_MBL_FAILED translations
Thanks @3d-gussner
2024-09-03 09:28:16 +02:00
Alex Voinea b614b9c43d Do not prompt for steel sheet on bed during XYZ calibration
Thanks @3d-gussner
2024-09-03 09:28:16 +02:00
Alex Voinea b58d2ecccb Prompt user for Z calibration after failed MBL with yes-no screen 2024-09-03 09:28:15 +02:00
Alex Voinea 357b68cf76 Ask for steel sheet on bed during Z calibration 2024-09-03 09:28:15 +02:00
Alex Voinea d2119c24e1 Prompt Z calibration when 7x7 MBL is enabled 2024-09-03 09:28:15 +02:00
Alex Voinea 8196e48684 Reduce number of Z realignments before Z calibration is requested 2024-09-03 09:28:15 +02:00
Alex Voinea d8e3c2b481 Relax 3x3 MBL threshold 2024-09-03 09:28:15 +02:00
3d-gussner 83c43fba02
Merge pull request #4767 from gudnimg/linearity-correction-opt-v2
optimisation: Simplify saving linearity correction
2024-09-02 11:18:44 +02:00
Guðni Már Gilbert b3a682d330 Always re-init the TMC drivers after leaving linearity correction menu
Change in memory:
Flash: -22 bytes
SRAM: 0 bytes
2024-09-01 22:14:25 +00:00
gudnimg 312f79c5f5 optimisation: Simplify saving linearity correction
Keep in mind that the EEPROM addresses are in descending order. This means we
can't use eeprom_read_block() or eeprom_update_block()

Address --> Axis
3831 --> X-axis
3830 --> Y-axis
3829 --> Z-axis
3828 --> E-axis

Change in memory:
Flash: -118 bytes
SRAM: 0 bytes
2024-09-01 12:34:00 +00:00
Guðni Már Gilbert aa8569600c Fix build and make sm4 a C++ file 2024-09-01 12:12:24 +00:00
Guðni Már Gilbert a2d45e5d11 cleanup: remove unused global sm4_cpu_time 2024-09-01 12:11:56 +00:00
Guðni Már Gilbert f115adf894 cleanup: remove unused function sm4_get_dir 2024-09-01 12:11:56 +00:00
Guðni Már Gilbert 5a5c68f563 cleanup: remove unused function sm4_get_dir_bits 2024-09-01 12:11:56 +00:00
Guðni Már Gilbert 7d3c416d04 cleanup: remove unused function sm4_line_xyze_ui
No change in code size. Reason for removing this function
is just to reduce lines of code that is maintained.
2024-09-01 12:11:22 +00:00
3d-gussner 6c99a4463e
Merge pull request #4755 from sarusani/AddLoadIfAutoloadDisabled
Add "load filament" if autoload is disabled
2024-08-30 17:11:37 +02:00
sarusani a259482b6b Add load option if autoload is disabled 2024-08-30 14:48:45 +02:00
3d-gussner 923f926223
Merge pull request #4749 from gudnimg/remove-auto-bed-leveling
Remove legacy Auto Bed Leveling code
2024-08-30 10:44:50 +02:00
3d-gussner d3c326de99
Merge pull request #4727 from gudnimg/improve-missing-filament
PFW-1559 Add filament presence check at start of print
2024-08-30 10:44:05 +02:00
Guðni Már Gilbert af6fbb13de
Merge pull request #8 from 3d-gussner/MK3_fix_PR4727
Fix LCD output and add translations
2024-08-30 08:35:27 +00:00
3d-gussner 56de4bf53b Update Community translation list
- Croatian, Swedish and Norwegian are inactive since the last few translation review requests have not been done
2024-08-30 08:14:23 +02:00
3d-gussner b9b32b0d9f Update Slovak translation
Thanks to @ingbrzy @shatter136
2024-08-28 12:07:20 +02:00
3d-gussner 6af6b402cc Update Czech and Italian translations
Thanks to @DRRacer and @wavexx
2024-08-28 11:29:28 +02:00
3d-gussner 1a717986c1 Update Hungarian translation
Thanks to @AttilaSVK
2024-08-27 07:11:32 +02:00
3d-gussner 6fa80045b5 Another Dutch translation fix 2024-08-26 14:15:31 +02:00
3d-gussner ff9a476121 Update Dutch translation
Thanks to @stelgenhof
2024-08-26 14:13:28 +02:00
3d-gussner e90b536c9b Update Romainian translations
Thanks to @petrubecheru and @Hauzman
2024-08-26 13:46:23 +02:00
3d-gussner b353f1f008 Add missing translations
Used `trans -b :cs+de+es+fr+hr+hu+it+nl+no+pl+ro+sk+sv "<text>"` to translate
Looked at pre-translated text to reuse as much as possible.
2024-08-26 10:02:56 +02:00
3d-gussner c1360d7bfb Fix LCD output
Configuration->HW Setup->Checks showed `a`

MSG_FILAMENT `Filament` can only be 8 chars long and only ES and IT had `Filemanto` as translation.
But as ES the `o` in `Filamento` was overwritten by `[Estricto]` I removed the MSG_FILAMENT to be translated.
Saves few bytes.
2024-08-26 09:20:05 +02:00
gudnimg f7e3195d78 Remove CUSTOM_M_CODES define 2024-08-24 16:33:00 +00:00
Guðni Már Gilbert 2b1c49dae2 Remove legacy Auto Bed Leveling code
The goal is to clean up the project
2024-08-24 07:11:38 +00:00
Guðni Már Gilbert f5fe658728 fixup after rebase 2024-08-24 07:10:24 +00:00
Guðni Már Gilbert 5e66e71a48 Check if MMU is enabled by reading EEPROM 2024-08-24 07:10:24 +00:00
gudnimg 4ed5b36199 Use a fresh EEPROM cell for the new value 2024-08-24 07:10:24 +00:00
gudnimg 40d3830e6d Simplify filament_presence_check usage
Pull all checks needed into the function such that the caller
only needs to check the return value

Also added description for the filament_presence_check function
2024-08-24 07:10:23 +00:00
gudnimg 75c980c4e7 optimisation: deduplicate more code
Change in memory:
Flash: -54 bytes
SRAM: 0 bytes
2024-08-24 07:10:23 +00:00
Guðni Már Gilbert b7caf36207 optimisation: deduplicate printer check toggle menus
This saves ~100B of flash
2024-08-24 07:10:23 +00:00
Guðni Már Gilbert bf72ecc3f9 Add filament presence check at start of print
A new menu setting is added to configure how strict the check should be.

- None: No check is performed
- Warning (default): The user is warned about missing and is prompted to continue with Yes/No. If No is selected, the print is aborted. If no user input is given (e.g. from host printing) then the warning will expire in 30 seconds and assume the Yes option was selected
- Strict: If the filament is not detected when a print is started, it is immediately canceled.

The check is currently performed on G-codes: M24 and M75. Starting a SD print and Host print respectively.
2024-08-24 07:10:23 +00:00
3d-gussner 055f601ad3
Merge pull request #4751 from sarusani/FilamentRunoutActions
Send host actions on filament runout
2024-08-23 15:13:08 +02:00
3d-gussner 96d6192be5
Merge pull request #4760 from 3d-gussner/MK3_New_github_issue_templates
New GitHub issue templates
2024-08-23 14:52:02 +02:00
3d-gussner d3cec58a7a
Merge pull request #4761 from 3d-gussner/MK3_MMU303
Update MMU version to 3.0.3
2024-08-23 14:40:41 +02:00
3d-gussner 8fe73a0dc2 Update to MMU FW 3.0.3 2024-08-23 14:31:49 +02:00
3d-gussner c27fb616e0
Merge pull request #4737 from sarusani/ReplaceSetReadyMenuEntry
Allow to replace Set Ready menu entry
2024-08-23 14:30:44 +02:00
3d-gussner 7d66cd1ca0
Merge pull request #4758 from sarusani/CheckFSBeforeNozzleChange
Abort nozzle change if filament is loaded
2024-08-23 11:18:28 +02:00
sarusani a2022471ce Send host actions on filament runout 2024-08-23 10:44:38 +02:00
sarusani a9e7f387e8 Replace Set Ready menu entry
Replace "Set Ready"/"Set nor Ready" menu entry with "Print from host" entry.
Use "action:start" instead of "action:ready"
2024-08-23 10:24:01 +02:00
sarusani 64d9f201da Exit Nozzle Change if filament is loaded
Abort Nozzle change if fsensor is enabled and filament is present.
2024-08-23 10:12:01 +02:00
3d-gussner 2f7715a0b0
Merge pull request #4759 from Panayiotis-git/MK3_M600_Filament_name
PFW-1204: M600 - Show filament name at the Insert filament prompt
2024-08-22 16:26:58 +02:00
3d-gussner 0e84d0bb41 Update some text 2024-08-22 14:45:15 +02:00
Panayiotis-git 815b68678d M600 - Show filament name at the Insert filament prompt 2024-08-21 20:56:13 +03:00
3d-gussner f64f2bbe68
Merge pull request #4747 from gudnimg/minor-fixes-for-future-tests
Fix compiler warning and add missing includes in unit test environment
2024-08-20 11:14:06 +02:00
3d-gussner e2e6999887
Merge pull request #4753 from gudnimg/remove-HEATER_BED_DUTY_CYCLE_DIVIDER
Remove dead configuration `HEATER_BED_DUTY_CYCLE_DIVIDER`
2024-08-19 08:47:22 +02:00
Guðni Már Gilbert 3da141b3a7 Remove dead configuration HEATER_BED_DUTY_CYCLE_DIVIDER
Setting HEATER_BED_DUTY_CYCLE_DIVIDER has no effect on the firmware
2024-08-15 17:58:07 +00:00
3d-gussner 21fc1ddf00
Merge pull request #4750 from sarusani/LessZAxisMovementOnManualFilamentUnload
Lower MIN_Z_FOR_UNLOAD
2024-08-14 13:03:32 +02:00
sarusani d3f2dce430 Lower MIN_Z_FOR_UNLOAD
Sync value with Buddy firmware
2024-08-14 12:09:41 +02:00
3d-gussner 2f9dafcf97 Fix even more syntax 2024-08-14 11:16:49 +02:00
3d-gussner dad1e4081e Fix more syntax issues 2024-08-14 11:08:47 +02:00
3d-gussner be6c85cf0c Fix syntax 2024-08-14 11:04:39 +02:00
3d-gussner 8b2074e808 New github issue templates 2024-08-14 10:40:31 +02:00
Guðni Már Gilbert 80f27618c9 Marlin: drop lcd.h include
Only include it where needed
2024-08-13 23:40:18 +00:00
Guðni Már Gilbert 41245b2a59 Marlin: drop mmu2.h include
We should only be including it where needed
2024-08-13 23:26:09 +00:00
Guðni Már Gilbert 835caa0230 mesh_bed_calibration: drop Marlin.h include 2024-08-13 23:23:21 +00:00
Guðni Már Gilbert 0153eb05a1 util: add stdio.h include for sprintf_P 2024-08-09 14:57:07 +00:00
Guðni Már Gilbert a1fcb8564e util: reorder includes alphabetically
Place system includes on top
2024-08-09 14:57:07 +00:00
gudnimg f628c5f912 util: should include avr/eeprom.h
The file is calling eeprom_read_byte and should include avr/eeprom.h
2024-08-09 14:57:07 +00:00
gudnimg 9ae8beacc6 eeprom: add missing include stddef.h
Fixes compiler warning in test environment:

Prusa-Firmware/Firmware/eeprom.h:712:51: error: ‘size_t’ has not been declared
712 | bool eeprom_is_initialized_block(const void *__p, size_t __n);
      |
2024-08-09 14:57:07 +00:00
gudnimg ad1e3cb12a Configuration: missing stdint.h include
The following error is raised in unit testing environment:

Prusa-Firmware/Firmware/Configuration.h:16:14: error: ‘uint16_t’ does not name a type
   16 | extern const uint16_t _nPrinterType;
2024-08-09 14:57:07 +00:00
gudnimg 10d156b28c tests: Fix a compiler warning in tests -fpermissive
Prusa-Firmware/tests/../Firmware/util.h:114:25: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
  114 |         pStrEnd = strchr(this->ptr, '"');
      |                   ~~~~~~^~~~~~~~~~~~~~~~
      |                         |
      |                         const char*
2024-08-09 14:57:07 +00:00
3d-gussner 428091b7c7
Merge pull request #4736 from gudnimg/cleanup_recursion_hack
Remove recursion workaround in Nozzle Change
2024-08-08 11:17:28 +02:00
3d-gussner 80148a862d
Merge pull request #4744 from 3d-gussner/MK3_Update_Stale_bot
Update Stale bot message
2024-08-07 06:48:43 +02:00
3d-gussner bf19b34e11
Merge pull request #4746 from gudnimg/fix-broken-unit-tests-pipeline
tests: test_run_all target must depend on tests executable
2024-08-06 14:58:47 +02:00
gudnimg 0a60eb435c tests: test_run_all target must depend on tests executable
Otherwise the tests and Catch2 isn't built
2024-08-06 10:29:44 +00:00
3d-gussner ebbd58c6e2
Merge pull request #4733 from gudnimg/upgrade-ninja
Upgrade ninja from 1.10.2 to 1.12.1
2024-08-06 06:19:06 +02:00
3d-gussner ed3867ab09
Merge pull request #4745 from gudnimg/readme_update
Update Python version in README
2024-08-06 06:11:21 +02:00
Guðni Már Gilbert b2c17960df Update Python version in README
Python 3.6 and 3.7 are EOL
2024-08-05 17:16:10 +00:00
3d-gussner decebab9d4 Update Stale bot message 2024-08-05 09:36:27 +02:00
Guðni Már Gilbert c795b3956c
Merge pull request #4741 from gudnimg/cleanup_followup_gudni
PR 4739 follow-up (two things were missed)
2024-08-03 20:11:59 +00:00
gudnimg efc4cc4996 Remove unused enum MeshLevelingState 2024-08-03 16:48:08 +00:00
gudnimg 15670f21bd lcd_pick_babystep() doesn't exist anywhere 2024-08-03 16:32:41 +00:00
gudnimg 371c040e8a EEPROM_BABYSTEP_Z0 is no longer used anywhere in the code base 2024-08-03 16:32:20 +00:00
Guðni Már Gilbert 25a11bb7d7 Forbid LcdUpdateDisabler to call lcd_update()
The fixes a scenario where:

lcd_status_screen() calls lcd_commands() upon exiting
lcd_show_fullscreen_message_and_wait_P(_T(MSG_NOZZLE_CNG_READ_HELP));
and so not allowing the user to leave the screen since it will keep being rendered endlessly.

This change only affects lcd_show_fullscreen_message_and_wait_P
2024-08-03 15:43:08 +00:00
Guðni Már Gilbert f96cc2f400 cleanup recursion workaround in nozzle change
This fix is no longer needed today.

LCD knob clicks / and rotation, take care of updating lcd_draw_update.

The real bug was likely lcd_show_multiscreen_message_yes_no_and_wait_P calling lcd_update(), this is fixed now since.
2024-08-03 15:43:08 +00:00
Guðni Már Gilbert 48f7cd5270 Upgrade ninja from 1.10.2 to 1.12.1
The update brings better support for Windows :)

Changelogs:
* https://github.com/ninja-build/ninja/releases/tag/v1.12.1
* https://github.com/ninja-build/ninja/releases/tag/v1.12.0
* https://github.com/ninja-build/ninja/releases/tag/v1.11.1
* https://github.com/ninja-build/ninja/releases/tag/v1.11.0
2024-08-03 15:38:02 +00:00
Guðni Már Gilbert a926675c35 bootstrap: fix DeprecationWarning
DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.

See:
https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
2024-08-03 15:38:02 +00:00
Guðni Már Gilbert ff16bfd8fa
Merge pull request #4739 from gudnimg/prune-disabled-code
Remove a bit of unused code which is disabled at compile time
2024-08-03 10:34:40 +00:00
Guðni Már Gilbert 23f92b24b8
Merge pull request #4735 from gudnimg/cleanup-dead-variable
Remove commented variable `load_filament_time`
2024-08-02 16:10:17 +00:00
Guðni Már Gilbert 04a7175cc7 Remove LARGE_FLASH preprocessor symbol
It's not very useful as is ... probably remnant from Marlin 1
2024-07-31 12:06:35 +00:00
Guðni Már Gilbert 81f1ec4975 Remove unused messages 2024-07-31 11:57:49 +00:00
Guðni Már Gilbert 0d45228dbd Remove commented lcd_update_enable(true) 2024-07-31 11:15:39 +00:00
gudnimg 396a8ca4f9 Remove VT100 code 2024-07-31 10:35:18 +00:00
gudnimg eb7969441a Remove Servo..h/cpp 2024-07-31 10:31:05 +00:00
gudnimg 2cbbdbacd5 Remove a bit of unused code which is disabled at compile time
Some of these have been used > 6 years and don't compile anymore.

Reason to want this removed is just to reduce the code we maintain
2024-07-31 09:53:45 +00:00
Guðni Már Gilbert 3f650a24aa
Merge pull request #4738 from sarusani/OptimzeEnum
Add type to enum
2024-07-30 20:01:17 +00:00
sarusani d485e4fb0b Add type to save 50B
Saves 50bytes
2024-07-30 15:15:05 +02:00
Guðni Már Gilbert bb1bb4d717 Remove commented variable load_filament_time 2024-07-28 17:41:23 +00:00
3d-gussner 5119e47419
Merge pull request #4728 from gudnimg/fix-mFilamentPrompt-timeout
Fix regression introduced in 3.13.0 where `mFilamentPrompt` menu times out after 30 seconds
2024-07-26 15:33:12 +02:00
gudnimg 8382815110 Fix inconsistent indendation in mFilamentPrompt() 2024-07-26 11:55:32 +00:00
gudnimg faa01b5a5f Fix an issue where mFilamentPrompt menu times out
Fixes a regression introduced in 3.13.0 here: a7e9ccfb57 (diff-5fbfdca43c192573e31d8e78d255c510fb6e213b118cf38173277ec2a2163880R7462)

Before 3.13.0, the menu never timed out until the safety timer turned off the heaters
After 3.13.0, the menu times out after 30 seconds.

The commit restores pre-3.13.0 behavior
2024-07-26 11:52:20 +00:00
3d-gussner cea5f70974
Merge pull request #4710 from Tirpitz93/fix-dev-and-dirty-cmake
Fix String substitution when `DEV` flavour is built dirty
2024-07-25 08:46:28 +02:00
3d-gussner 3722a17e5a
Merge pull request #4647 from gudnimg/mmu-sync-april
MMU maintenance: Sync with 32-bit FW a little bit
2024-07-24 10:02:24 +02:00
gudnimg 4dc9fd4972 MMU: revert fallthrough in LogicStep 2024-07-23 15:55:47 +00:00
3d-gussner 3cb722403b
Merge pull request #4717 from gudnimg/fix-unconsumed-button-press
Fix an issue in manual fan check where prior knob clicks are not consumed
2024-07-16 08:57:30 +02:00
gudnimg a7004cd067 Fix an issue in manual fan check where prior knob clicks are not consumed 2024-07-15 13:52:30 +00:00
3d-gussner 39c8c4f560
Merge pull request #4659 from 3d-gussner/MK3_build_script
PFW-1460 Update build scripts
2024-07-12 08:36:32 +02:00
3d-gussner 62a1c1478d
Merge pull request #4708 from 3d-gussner/MK3_Cmake_workaround_wildcard_issue_non_Linux
Cmake workaround wildcard issue non linux system
2024-07-12 08:35:34 +02:00
3d-gussner 2ed3ee8410
Merge pull request #4280 from sarusani/DelayZAxisonAutoload
Delay Z-Axis on Autoload
2024-07-11 09:00:50 +02:00
lselter 695ba5d5db Fix String substitution when `DEV` flavour is built with a dirty local version both instances of -D were replaced with commit count 2024-07-09 15:44:40 +01:00
3d-gussner f687fe3e2e Fix MK2.5/S builds on Windows 2024-07-09 16:07:02 +02:00
3d-gussner d769fcc094 Workaround for Windows/Mac wildcard issue
Only zip MK2.5/S and E3DREVO on Linux
2024-07-09 15:43:52 +02:00
gudnimg 99e306f4a3 MMU: minor formatting sync 2024-07-06 17:24:40 +00:00
gudnimg d548bb68fd MMU: revert WaitForHotendTargetTempBeep(); position in code
The 8-bit FW uses a different Fullscreen UI which doesn't show the current temperature. So, for now, keep calling WaitForHotendTargetTempBeep  before showing the full-screen message.
2024-07-06 16:55:32 +00:00
Guðni Már Gilbert 09f1d85e9c MMU: Revert changes to execute_extruder_sequence loop
The previous for-loop is more memory efficient and saves 20 bytes of Flash
2024-07-06 16:55:32 +00:00
Guðni Már Gilbert 61b4270129 MMU: allow inlining UInt16ToHex
Saves 22 bytes of Flash
2024-07-06 16:55:32 +00:00
Guðni Már Gilbert 592fc56bfc MMU: Sync code with 32-bit
The changes in this commit are mainly formatting

But there are some changes like adding a new function planner_draining()
2024-07-06 16:55:32 +00:00
sarusani 5efae44eb7 Delay Z-Axis on Autoload
Delay z-axis movement when the operators hand is close to the printhead.
2024-07-05 16:12:07 +02:00
3d-gussner 72ffc28952 Add build.py 2024-07-05 09:06:22 +02:00
3d-gussner e405e9140c
Merge pull request #4687 from 3d-gussner/MK3_Replace_hard_coded_values_1
Replace hardcoded values
2024-07-05 07:54:07 +02:00
3d-gussner bc48d34a2f Replace hradecoded XYZ Z correction value with Z_MAX_POS_XYZ_CALIBRATION_CORRECTION 2024-07-04 10:12:38 +02:00
3d-gussner 152b290d1d
Merge pull request #4689 from 3d-gussner/MK3_PFW-964
PFW-964: Skip filament unload/load after Shipping factory reset
2024-07-03 13:20:49 +02:00
3d-gussner 3c7ae1e9fc
Merge pull request #4690 from 3d-gussner/MK3_Documentation
Update doxygen documentation remove white spaces
2024-05-30 14:43:29 +02:00
3d-gussner ac63fafc33
Merge pull request #4696 from 3d-gussner/MK3_Fix_cmake_MK25S_build
Fix cmake build of MK2.5 and MK25S
2024-05-30 14:42:13 +02:00
3d-gussner db64997687 Add `${FW_LANG_PATCH}.bin` to DEPENDS 2024-05-30 08:21:51 +02:00
3d-gussner 827c3025a4 Fix cmake build of MK2.5 and MK25S 2024-05-29 18:01:53 +02:00
3d-gussner 45a223a1f9 Remove White spaces 2024-05-20 19:09:03 +02:00
3d-gussner e110153ee2 Cleanup doxgen documentation and white spaces 2024-05-20 18:35:09 +02:00
3d-gussner 9a56f1e4c1 Skip filament unload/load after Shipping factory reset
when MMU is enabled. With MMU enabled no filament should be
loaded while idle.
2024-05-16 12:48:49 +02:00
3d-gussner eaeb722adb
Merge pull request #4681 from gudnimg/add-workaround-for-tune-button
MMU: Add workaround for broken Tune button
2024-05-06 12:50:41 +02:00
Guðni Már Gilbert 6f915ee401 MMU: Add workaround for broken Tune button
If the MMU is processing a command, the Tune button can't be executed.

Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2024-05-04 00:22:17 +00:00
3d-gussner abdee5b7f3
Merge pull request #4679 from 3d-gussner/MK3_Crash_detect_raise_z
Replace hard coded crash z lift value with Pause Z lift value.
2024-05-03 08:08:48 +02:00
3d-gussner 08d26fdee2 Replace hard coded crash z lift value with Z lift value.
With `M125 Z<value>` you can set the Z lift value via gcode as requested.
Fixes #3419
2024-05-02 11:37:13 +02:00
gudnimg 28502a2b6e optimisation: remove 1 more call to __divsf3
Changing (feedrate * feedmultiply) / 6000.f
to (feedrate * feedmultiply) * (1.f / 6000.f)

Replaces the call to __divsf3 with __mulsf3 which is better

No change in memory
2024-04-23 09:18:45 +02:00
Guðni Már Gilbert 2c46e1b344 optimisation: remove 3 calls to __divsf3
Change in memory:
Flash: -34 bytes
SRAM: 0 bytes
2024-04-23 09:18:45 +02:00
3d-gussner d22245b482
Merge pull request #4658 from 3d-gussner/MK3_PFW-762_Ambient_shutdown_80C
PFW-762 ambient shutdown at 80 C
2024-04-19 15:06:03 +02:00
3d-gussner e8d55486fe
Merge pull request #4661 from gudnimg/PFW-1557
PFW-1557 MMU: Improve unload handling when print is aborted
2024-04-15 15:13:09 +02:00
3d-gussner 6e40fe05fc
Merge pull request #4657 from 3d-gussner/MK3_PP_ACCEL_JERK
Add max acceleration mm per s2, feedrates and jerk save and restor du…
2024-04-15 15:11:57 +02:00
3d-gussner 34591f0465
Merge pull request #4663 from 3d-gussner/MK3_Fix_Autoreport
Fix Autoreport
2024-04-15 15:06:12 +02:00
3d-gussner 51b119a3ec Fix Autoreport broken in 3957dc91aa 2024-04-15 12:09:43 +02:00
3d-gussner 1292a82f70 Fix typos 2024-04-15 07:45:36 +02:00
3d-gussner f50e754f26 Use of `eeprom_update_block_notify` and `eeprom_read_block` reduces the flash usage a lot.
Thanks to @gudnimg
2024-04-15 07:45:36 +02:00
3d-gussner 5c0e014215 Add max acceleration mm per s2, feedrates and jerk save and restor during power panic
Thanks to @wavexx in #2456
2024-04-15 07:45:36 +02:00
gudnimg 16dfcfeb9a MMU: Improve unload handling when print is aborted
- Don't allow re-heating the nozzle or the MMU to unload the filament if the print was aborted by a temperature error
- Allow MMU to unload filament if there is no temperature error, and there is no fan error when Fan check is enabled
- When Fan check is disabled, the MMU may unload if there is no temperature error

Change in memory:
Flash: +14 bytes
SRAM: 0 bytes

PFW-1557
2024-04-14 12:07:56 +00:00
3d-gussner 52ac95f082
Merge pull request #4600 from sarusani/ChangeRevoNozzleChangeMenu
Adjust Nozzle Change Menu For Quick Change Nozzles
2024-04-11 19:19:01 +02:00
3d-gussner 361ce65e5c
Merge pull request #4644 from sarusani/AddEjectToFilamentLoadMSG
Add Eject Option To Filament Load Message
2024-04-11 19:18:42 +02:00
3d-gussner 36282aae1b Change Ambient board thermistor safety shutdown to 80 C 2024-04-10 17:56:26 +02:00
3d-gussner 5b96ff6d37
Merge pull request #4656 from 3d-gussner/MK3_PP_EXT_MINTEMP
Add Extrude mintemp save and restore during power panic
2024-04-09 18:44:47 +02:00
sarusani bc04f16906 Adjust Nozzle Change Menu For Quick Change Nozzles
- Show warning if extruder temp is > 40 degrees
- Use fan to speed up cooldown
- Show confirmation msg
- Show nozzle diameter setting after nozzle change
2024-04-09 16:12:46 +02:00
sarusani bd935db31e Add Eject Option To Filament Load Message 2024-04-09 15:50:17 +02:00
3d-gussner e5d504b855 Add Extrude mintemp save and restore during power panic
Thanks to @wavexx in #3008
2024-04-09 09:34:24 +02:00
3d-gussner 02822c59ad
Merge pull request #4591 from gudnimg/cleanup_cancel_heatup
Remove redundant ` cancel_heatup` assignment
2024-04-09 08:17:09 +02:00
3d-gussner fbbcdd0808
Merge pull request #4613 from gudnimg/optimise-axis_ustep_resolution
optimisation: initialise `axis_ustep_resolution` in EEPROM
2024-04-08 16:13:52 +02:00
Guðni Már Gilbert 022eaa1820
Merge pull request #4645 from gudnimg/full-screen-code-duplicate
ultralcd: merge two functions into one as cleanup
2024-04-06 13:50:48 +00:00
3d-gussner ed9d7f3ac1 ultralcd: merge two functions into one
lcd_show_fullscreen_message_yes_no_and_wait_P and lcd_show_multiscreen_message_yes_no_and_wait_P
are the same function. Let's drop one of them so we only have one symbol for the function.

No change in memory

Fix rebase
2024-04-05 19:33:15 +02:00
3d-gussner a4a7b09fe7
Merge pull request #4651 from 3d-gussner/MK3_Fix_Insert_filament_fr_hu
Fix issue Insert filament ... message in French and Hungarian
2024-04-04 09:20:48 +02:00
3d-gussner c515038e7d
Merge pull request #4650 from 3d-gussner/MK3_LCD_Menu_cleanup
LCD_Menu_cleanup
2024-04-04 09:19:50 +02:00
3d-gussner feebac54fc Fix issue #4424
Fix rebase
2024-04-04 09:08:44 +02:00
3d-gussner b3a410abdc Fix #3361 2024-04-04 09:04:48 +02:00
3d-gussner 3fa03ec1fb
Merge pull request #4565 from 3d-gussner/MK3_All_translations_in_messages
Move all _i(" to messages.cpp/.h
2024-04-04 09:03:30 +02:00
3d-gussner a93cd93756 Move `MK3 firmware detected on MK3S printer` and `MK3S firmware detected on MK3 printer` to `messages.cpp/.h`
Update pot and po files
2024-04-04 08:58:46 +02:00
3d-gussner 97584d571e Update all `_i("` to `messages.cpp/.h`
Update `lang/po/*.po*` files
2024-04-04 08:23:40 +02:00
3d-gussner af03662c8f
Merge pull request #4602 from 3d-gussner/MK3_M913
Enable M913
2024-04-04 07:30:06 +02:00
3d-gussner 0c9bf5d435
Merge pull request #4635 from 3d-gussner/MK3_PP_improvements
Power Panic and LCD menu
2024-03-28 06:59:07 +01:00
3d-gussner 8d1be264e5 Thanks to @gudnimg pointing out duplicate if statements that are covered by the top-level if statement. 2024-03-27 17:44:50 +01:00
3d-gussner 9e8aadd8af Revert split if statements
Kept few as these get too long
2024-03-27 10:15:07 +01:00
3d-gussner 5f26d5f7da Fix MK2.5 builds
- removed `reset_uvlo` as `#ifdef UVLO_SUPPORT` everywhere for MK2.5 is a huge change.
2024-03-27 09:42:59 +01:00
3d-gussner 1ac69247d7 Fix and improve PowerPanic
- No wait for heatup during host print recovery
- No extra Z lift when power panic happens during paused print
  - added an extra EEPROM value
  - fixed `EEPROM_LAST_ITEM`
  - changed EEPROM version to 3.14.0
- Added `reset_uvlo` function
2024-03-27 09:09:55 +01:00
3d-gussner 52275322a2 Remove redundant check 2024-03-20 08:41:29 +01:00
Alex Voinea b6e2a8875b M913 report rescaled currents 2024-03-15 12:47:18 +01:00
3d-gussner 2df8a18fde Fix MK2.5/S builds 2024-03-15 12:47:18 +01:00
3d-gussner 82d102d740 Enable M913 2024-03-15 12:47:18 +01:00
3d-gussner 9f8115639a LCD menu
- Hide menus during recovering
- Un-/Load filament with FSensor active only show Load OR Unload depending on FS sate
- Host
  - Reprint only shown when M79 timer is active
  - Resume only shown when M79 timer active
- Stop print always shown when printing, paused and recovering
2024-03-13 17:43:00 +01:00
3d-gussner a04063f966 Fix DEBUG_UVLO_AUTOMATIC_RECOVER 2024-03-13 17:43:00 +01:00
3d-gussner e2823c3c35 Reset EEPROM_UVLO after recovering
Undo PP Z lift
2024-03-13 17:43:00 +01:00
3d-gussner 9e52b78285 Add ubs_timer.start to PRUSA uvlo
Cleanup format
2024-03-13 17:43:00 +01:00
3d-gussner 15ea2784c3 Fix another saved_printing_type issue 2024-03-13 17:43:00 +01:00
3d-gussner 4e032f6f11 Change to saved_printing_type fixes few issues during power panic recovery 2024-03-13 17:43:00 +01:00
3d-gussner fc157d1f6c Fix missing eeprom_update_byte for debuging 2024-03-13 17:43:00 +01:00
3d-gussner 5b7c583dba Fix `print_saved_in_ram` to be true for both SD and host prints 2024-03-13 17:43:00 +01:00
3d-gussner 9ec5639d29 Rename `sd_print_saved_in_ram` to `print_saved_in_ram` as it saves sd and host prints 2024-03-13 17:43:00 +01:00
3d-gussner 112d3c672c Update debug_printer_states 2024-03-13 17:43:00 +01:00
3d-gussner 16aa2e7834 Hide LCD menu "Reprint" during power panic recovery 2024-03-13 17:43:00 +01:00
3d-gussner 886d610524 Cancle power recovery correctly using cancel_saved_printing(); 2024-03-13 17:43:00 +01:00
3d-gussner 95c6ea5889 Fix to correct EEPROM address 2024-03-13 17:42:59 +01:00
3d-gussner 47235bbf62 Power panic recover lift by 20 Z_PAUSE_LIFT only once
by setting PENDING_RECOVERY_RETRY
Also the default saved_printing_type after a reboot is now PRINT_TYPE_NONE
2024-03-13 17:42:59 +01:00
3d-gussner 88b77ecce2 Add bool printer_recovering 2024-03-13 17:42:59 +01:00
3d-gussner 517900c3fe Add DEBUG_PRINTER_STATES 2024-03-13 17:42:59 +01:00
3d-gussner 4235f784b9
Merge pull request #4622 from prusa3d/vintagepc/automatic-releases
Auto-create releases when a build is tagged.
2024-03-13 16:27:16 +01:00
3d-gussner 9df3846ffa
Remove white space 2024-03-13 16:23:51 +01:00
VintagePC 18c7c8c55b Quotes, perhaps 2024-03-12 18:55:38 -04:00
vintagepc 2ad76e225b
Update build.yml
Use ${{ github.workspace }} instead
2024-03-12 07:40:34 -04:00
VintagePC 50ba83219f Try fixing paths 2024-03-11 19:02:24 -04:00
vintagepc 84259de765
Update build.yml
Fix bug in run specifiers
2024-03-11 08:31:19 -04:00
3d-gussner b43ee3bf3d
Merge pull request #4628 from 3d-gussner/MK3_Stale_action_V9
Update stale action to v9 as Node.js 16 are deprecated.
2024-03-08 13:01:54 +01:00
3d-gussner ad35740092 Update stale action to v9 as Node.js 16 are deprecated. 2024-03-08 10:49:12 +01:00
VintagePC 361627d91d Use simplified filenames without hash/build counter 2024-03-04 18:51:11 -05:00
3d-gussner 1619db5b62
Merge pull request #4625 from 3d-gussner/MK3_MMU302
Bump up MMU FW version to 3.0.2
2024-03-04 14:06:18 +01:00
D.R.racer 4bca4021c6 Bump up MMU FW version to 3.0.2
.
2024-03-04 11:55:54 +01:00
VintagePC c0284497e3 Facilitate automatic release uploads of artifacts 2024-03-01 20:00:27 -05:00
3d-gussner 2d9dbecd5d
Merge pull request #4619 from 3d-gussner/MK3_DEBUG_EEPROM_CHANGES
Add DEBUG_EEPROM_CHANGES

I gonna merge this and maybe @gudnimg can improve it later. Need this for 3.14.0 PowerPanic debugging
2024-02-27 16:16:32 +01:00
3d-gussner f9bdb8b8aa Add DEBUG_EEPROM_CHANGES 2024-02-27 08:56:18 +01:00
3d-gussner c7b5fd59ed
Merge pull request #4617 from leptun/cherrypick_xyzcal_use_stallguard_during_z_cal
Cherrypick xyzcal use stallguard during z cal
2024-02-26 10:27:45 +01:00
Alex Voinea af64d446bf Fix MK2.5 build 2024-02-26 10:14:01 +01:00
Alex Voinea aededa34bb Properly check for Z crashes while lowering/raising Z for Z calibration 2024-02-26 10:13:56 +01:00
Alex Voinea 326019a8bf Use stallguard during Z calibration after XYZ calibration 2024-02-26 10:13:51 +01:00
Alex Voinea 692f062fee Add tmc currents debug 2024-02-26 10:13:45 +01:00
Guðni Már Gilbert 0a727d8573 optimisation: initialise axis_ustep_resolution in EEPROM
When the cs variable is loaded into RAM, cs.axis_ustep_resolution will always have some value and none of the 0xff values.

Change in memory:
Flash: -40 bytes
SRAM: 0 bytes
2024-02-24 15:46:32 +00:00
3d-gussner 665692b73e
Merge pull request #4614 from gudnimg/sudo-apt-update
CI: Add sudo apt-get update
2024-02-24 16:44:02 +01:00
Guðni Már Gilbert 704003295a CI: Add sudo apt-get update
See: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/customizing-github-hosted-runners#installing-software-on-ubuntu-runners

> Note: Always run sudo apt-get update before installing a package. In case the apt index is stale, this command fetches and re-indexes any available packages, which helps prevent package installation failures.
2024-02-24 15:29:21 +00:00
3d-gussner c5a036d817
Merge pull request #4601 from leptun/MK3_TMC_restore_currents_post_home
Mk3 TMC restore currents post home
2024-02-19 17:08:24 +01:00
Alex Voinea ccb956eae4
Restore custom currents after homing end 2024-02-19 15:33:06 +01:00
Alex Voinea e6a4856196
Restore default XY currents after homing 2024-02-19 15:32:22 +01:00
3d-gussner f80fb4c17c
Merge pull request #4594 from 3d-gussner/MK3_Action_fix
Update action as v3 is deprecated
2024-02-13 20:08:25 +01:00
3d-gussner f9671d40c7 Update action as v3 is deprecated 2024-02-13 08:32:54 +01:00
3d-gussner dc3b3387ed
Merge pull request #4593 from 3d-gussner/MK3_Fix_Stop_print_for_host_prints
Fix Stop print to send host action when host print is active
2024-02-05 10:39:49 +01:00
3d-gussner 8e26a95630
Merge pull request #4590 from gudnimg/PFW-1552-v2
PFW-1552 Fix a regression introduced in f022567
2024-02-05 08:54:52 +01:00
3d-gussner 727a82bb3d Fix Stop print to send host action when host print is active 2024-02-05 08:14:10 +01:00
gudnimg 020239687a Remove redundant cancel_heatup assignment
cancel_heatup is set to false inside wait_for_heater()
there is no need to do it before the function call

Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2024-02-04 12:15:58 +00:00
gudnimg 794251884a PFW-1552 Fix a regression introduced in f022567
Aborting the print while the nozzle and bed are still heating up
to their target temperatures should disable the heaters immediately.
2024-02-04 12:06:14 +00:00
3d-gussner c999c2948e
Merge pull request #4586 from leptun/fix_3x3_mbl
Fix 3x3 mbl condition
2024-02-03 12:57:16 +01:00
Alex Voinea bacb0b1b07
Fix 3x3 mbl condition 2024-02-02 14:45:30 +01:00
3d-gussner 6682237c7a
Merge pull request #4582 from gudnimg/PFW-1552
PFW-1552 and PFW-1544: Fix issue with MMU unload when a print is stopped with a cold nozzle
2024-02-01 06:22:49 +01:00
3d-gussner 6714d4df3f
Merge pull request #4547 from 3d-gussner/MK3_PL_Fixes
Fix few PrusaLink/PrusaConnect reported issue
2024-01-29 13:08:26 +01:00
3d-gussner e7ef3d6db5 Fix nitpicking 2024-01-29 13:07:48 +01:00
3d-gussner 52ba1b534d Add HOST power panic auto recovery option
Change `PRINT_TYPE_USB` to `PRINT_TYPE_HOST`

Fix more rebase issues

Fix rebase issue again
2024-01-29 13:07:48 +01:00
3d-gussner ffeda98894 Add power panic recovery to active state
Fix M79 send only recovery action when power panic recovery is pending

Fix rebase issues
2024-01-29 13:07:48 +01:00
3d-gussner d1b88e1684 Don't show `Print from SD` when host print is paused 2024-01-29 13:07:48 +01:00
3d-gussner c9aba688e3 Saving few bytes by removing spaces in `//action:` host commands. Thanks to @sarusani pointing out inconsistent documentation.
Renaming `MSG_OCTOPRINT_*` to `MSG_HOST_ACTION_*` as it is used also with PrusaLink and other host printing solutions

Fix rebase issues
2024-01-29 13:07:48 +01:00
3d-gussner fda30f82c8 Don't show `Set Ready`when not idle 2024-01-29 13:07:48 +01:00
3d-gussner e5c5720d03
Merge pull request #4583 from gudnimg/PFW-1553
PFW-1553 fix regression where SD card file is not closed when stopping paused print
2024-01-29 09:48:55 +01:00
gudnimg abcb1017f3 PFW-1553 fix regression where SD card file is not closed when stopping paused print
When a print is paused, card.sdprinting is set to false. Instead we can check
if the SD card has been mounted and try to close the file.

The closefile() method will check internally whether or not the file is open.
2024-01-27 15:21:08 +00:00
gudnimg f022567239 PFW-1522 Fix an issue where MMU unloads while nozzle is cold if print is stopped
In the case of a Fan Error, the print is paused. If the nozzle is allowed to cool for a while before the print is stopped via the LCD, then the MMU will try to unload with a cold nozzle.

This can happen with ANY recoverable thermal errors.

In this commit I attempt to fix all scenarios. Including PFW-1544 where the nozzle is cooling down when the print has finished normally.

PFW-1544
PFW-1552

Change in memory:
Flash: +74 bytes
SRAM: 0 bytes
2024-01-27 11:54:54 +00:00
gudnimg c0b76dd5cf cleanup: move st_synchronize under the if statement
If the if statement is not true, then the st_synchronize call is not useful

The raise_z call above the if statement does not need it since it always calls st_synchronize (blocking move)

No change in memory
2024-01-27 10:47:23 +00:00
3d-gussner 8fa97cffda
Merge pull request #4576 from 3d-gussner/MK3_Improve_Versioning_and_Dump
PFW-1307: Add commit number and hash to `M115`
2024-01-23 15:57:23 +01:00
3d-gussner 3957dc91aa Add commit number and hash to `M115`
Don't show UUID only if defined
2024-01-22 16:31:23 +01:00
3d-gussner b80965731f
Merge pull request #4421 from gudnimg/sd-card-mount-opt
cleanup: Don't set root directory if SD card fails to mount + 3 renames
2024-01-22 09:11:19 +01:00
3d-gussner 02b91dc2cb
Merge pull request #4563 from 3d-gussner/MK3_Quick_nozzle_change_menu
Add nozzle diameter change to main menu for REVO builds
2024-01-19 14:26:18 +01:00
3d-gussner b56330819c
Merge pull request #4573 from 3d-gussner/MK3_Improve_build
Improve cmake build
2024-01-19 14:23:17 +01:00
3d-gussner 902c2f71c9 New hex file naming 2024-01-19 14:21:47 +01:00
3d-gussner a21647e0a7
Merge pull request #4574 from 3d-gussner/MK3_Remove_travis
Remove Travis checks
2024-01-19 14:12:27 +01:00
3d-gussner 8e91fb978b Remove Travis checks
Github actions work well and no need for additional travis check.
2024-01-19 08:28:35 +01:00
3d-gussner 6da1ec924b
Merge pull request #4567 from 3d-gussner/MK3_M850_show_active_sheet
M850 shows active sheet
2024-01-15 08:56:04 +01:00
3d-gussner 339a10eb81
Merge pull request #4556 from gudnimg/usb-timer-fix
Restart USB timer during long moves
2024-01-12 14:41:51 +01:00
3d-gussner 98889cafbf
Merge pull request #4560 from gudnimg/fix-print-paused
Fix pause indicator when print job timer is not used
2024-01-12 14:41:33 +01:00
3d-gussner f3e5444d47 M850 shows active sheet
Prevent sheet being active if not initialized
2024-01-12 13:41:55 +01:00
3d-gussner 13fb11889e Minor cosmetic changes voted by community 2024-01-12 07:20:33 +01:00
gudnimg adf2ecabc1 Fix pause indicator when print job timer is not used
Fixes #4554

Change in memory:
Flash: +50 bytes
SRAM: +1 byte
2024-01-11 19:30:30 +00:00
3d-gussner d5a5835059 Add nozzle change to main menu when QUICK_NOZZLE_CHANGE is defined
Add Nozzle diameter to Info screen when printer inactive and QUICK_NOZZLE_CHANGE defined
Solves #4488
2024-01-11 07:36:51 +01:00
3d-gussner 8d50d29776
Merge pull request #4553 from sarusani/shutdownHostLCDEntry
Add Shutdown host to LCD Menu
2024-01-11 07:33:16 +01:00
3d-gussner 6424703d2b
Merge pull request #4562 from 3d-gussner/MK3_Fix_Tune_Auto_home_layer_shift
PFW-1551: Fix Pause->Tune->Auto Home layer shift
2024-01-11 07:31:30 +01:00
3d-gussner f18fc2bbce Fix Pause->Tune->Auto Home layer shift 2024-01-09 11:07:29 +01:00
3d-gussner d6250592b2
Merge pull request #4559 from 3d-gussner/MK3_PFW-849_Selftest
PFW-849 Unify Selftest messages
2024-01-08 08:25:23 +01:00
sarusani 2199ef8bc4 Add translations 2024-01-06 09:40:51 +01:00
Guðni Már Gilbert ae31c0ec31 optimisation: used expired() instead of elapsed()
If the timer is expired, then the timer is stopped. This is OK since
we are starting the timer again anyway

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2024-01-06 00:23:19 +00:00
gudnimg 09952db139 Restart USB timer during long moves
When long moves are planned and executed the USB timer can expire.

In PrusaSlicer 2.7.1 the Toolchange command (T0, T1, etc.) is sent while the USB timer is expired. This will trigger
a manual MMU unload in the firmware. Not only does this trigger a loud beep from the buzzer, but this will also significantly increase print time.

The issue only affects host prints. SD card printing does not have this issue.

Fixes #4551

The fix in this commit is the following:
If there are blocks queued while printing via host AND the USB timer is halfway expired WHILE executing a move. Then simply restart the timer to keep it alive.

Change in memory:
Flash: +62 bytes
SRAM: 0 bytes
2024-01-06 00:23:19 +00:00
sarusani 59093107fd Add #ifdef HOST_SHUTDOWN 2024-01-06 00:45:06 +01:00
sarusani 49f9d7abdc Add Shutdown host to LCD Menu
Add "Shutdown host" entry to LCD menu if printer is not active and host is connected.
2024-01-06 00:45:06 +01:00
3d-gussner db044163f9 Unify Selftest messages 2024-01-04 11:18:07 +01:00
3d-gussner ba027dd41e
Merge pull request #4552 from gudnimg/reprint-opt
reprint: reduce duplicate code
2024-01-03 14:45:57 +01:00
gudnimg 9bd043c83b Move restore_file_from_sd out of power panic file
This function is not specific to power panic. Some printer models
do not have power panic enabled.

This change fixes a build failure

No change in memory
2023-12-30 12:19:51 +00:00
gudnimg ceec54f026 reprint: reduce duplicate code
restore_file_from_sd function now supports any
filename extension. If a print was finished (to allow reprinting) then the
EEPROM filename and extension should always be valid.

Change in memory:
Flash: -312 bytes
SRAM: 0 bytes
2023-12-30 12:06:46 +00:00
3d-gussner 45d70b195d
Merge pull request #4405 from gudnimg/mmu-response-fix
MMU: always wait for a request's expected response
2023-12-22 16:34:27 +01:00
3d-gussner 8aa344ea38
Merge pull request #4545 from 3d-gussner/MK3_Fix_M850
Fix M850 output and documentation
2023-12-19 17:26:16 +01:00
3d-gussner c9ea5fa746 Fix M850 output and documentation 2023-12-19 15:34:16 +01:00
3d-gussner 15a3fb998c
Merge pull request #4541 from sarusani/actionReadyOpt
Remove leading M118 from "action:ready" & "action:not_ready"
2023-12-19 15:02:09 +01:00
3d-gussner b894fcc11c
Merge pull request #4534 from sarusani/oozePrevention
Prevent oozing after filament load
2023-12-19 15:01:50 +01:00
sarusani 2c4474b1dd Remove leading "M118" 2023-12-16 12:51:17 +01:00
sarusani e5d6d72d23 Add #ifdef 2023-12-15 14:09:46 +01:00
sarusani 1407f29362 Prevent oozing after filament load
Retract 10mm of filament after loading
2023-12-14 14:20:46 +01:00
gudnimg c384524877 mmu: always wait for a request's expected response
If a planned request is activated when the current status is finished
then the firmware must wait for the response when the request
is expecting it

An example is a register read or a register write.

manage_response not return unless the register has been read or
written. And we must see the response to know if an error should be
reported.

Step to reproduce issue:
1. Fail selector homing
2. Select 'Tune' item
3. Observe issue. In this situation you can see the value
for the previous register read is shown. Which is 0. This very timing dependent and does not always happen.
4. Repeat step 2 until the issue appears. It may take a few times.
2023-12-10 12:54:18 +00: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
gudnimg e0eb8b8a24 optimisation: if SD card fails to mount, do not set root directory
I noticed this on Marlin 2.1 side, it should apply here as well.
2023-12-09 10:50:30 +00:00
3d-gussner 3c64874e20
Merge pull request #4530 from 3d-gussner/MK3_fixc_cmake_t_tags
Fix cmake with tags starting with `t`
2023-12-05 17:19:57 +01:00
3d-gussner 1868839dc6 Fix cmake with tags starting with `t` 2023-12-05 15:42:47 +01:00
3d-gussner bc9e47c13e
Merge pull request #4529 from 3d-gussner/MK3_3140B1_bump_up_version
Bump up version to 3.14.0-BETA1
2023-12-05 15:22:15 +01:00
3d-gussner 69b35d37c3 Bump up version 2023-12-05 14:53:56 +01:00
3d-gussner aa92375e62
Merge pull request #4523 from 3d-gussner/MK3_Improve_PP_Crash
Improve Host Power Panic and Crash
2023-12-05 14:49:33 +01:00
3d-gussner 91d11a2d99
Merge pull request #4528 from 3d-gussner/MK3_Norwegian_reprint
Update translations
2023-12-05 14:31:31 +01:00
3d-gussner dd5f2e1196 Reprint Norwegian translation update 2023-12-05 08:37:24 +01:00
3d-gussner 18daa5a62e
Merge pull request #2423 from Panayiotis-git/MK3_M600_Issue-2415
LCD option to unload new filament on M600 (issue #2415)
2023-12-04 17:03:38 +01:00
3d-gussner 2b18921035
Merge pull request #4524 from sarusani/cleanupLCDMenu
Cleanup LCD menu
2023-12-04 17:03:03 +01:00
3d-gussner 4684c3bc44
Merge pull request #4527 from prusa3d/vintagepc/update-stale-message
Update stale message
2023-12-04 16:30:51 +01:00
vintagepc 0546566fc7
Update stale message 2023-12-04 07:19:58 -05:00
sarusani e2aafc882c Fix MSG_PRINT_PAUSED
MSG_PRINT_PAUSED used the lang declaration MSG_PAUSE_PRINT instead of MSG_PRINT_PAUSED
2023-12-03 10:16:16 +01:00
sarusani 60e311d74f Change reprint MENU_ITEM_SUBMENU_P to MENU_ITEM_FUNCTION_P
There's no submenu -> don't show arrow
2023-12-03 08:46:48 +01:00
sarusani 4d9e084cf7 Rename lcd_reprint_usb_print to lcd_send_action_start
Sending action start can not only be used for reprints
2023-12-03 08:44:54 +01:00
sarusani d267140ee6 Rename reprint_from_eeprom to lcd_reprint_from_eeprom
It sets the lcd_return_to_status() at the end, so naming should be consistent witch the other functions
2023-12-03 08:43:16 +01:00
Panayiotis-git 3da4407e4f Repeat the M600 unload/load filament sequence - Fix translations 2023-12-01 21:13:24 +02:00
Panayiotis-git 8ceda27cda Provide option to repeat the M600 unload/load filament sequence 2023-12-01 21:12:31 +02:00
3d-gussner 47b298782f Set YES as default in Crash Resume message 2023-12-01 17:43:29 +01:00
3d-gussner d36ea24c02 After reset or low bed temp recover HOST print as the HOST has to decide what to do
Only during SD print and a Reset + Low Bed temp the user has to confirm on LCD
2023-12-01 17:43:29 +01:00
3d-gussner 4bc6bc3f90 Improve USb power panic 2023-12-01 17:43:29 +01:00
3d-gussner 4dfc484265
Merge pull request #4207 from gudnimg/crashdet_cancel-fixup
`crashdet_cancel()` doesnt cleanup all variables when USB printing
2023-12-01 17:41:33 +01:00
gudnimg 4d9dc11510 power panic: pause the print, and wait for M79
"PRUSA uvlo" is the last g-code to be processed after the power panic
recovery. For host prints, we want to finish processing all these
g-codes and put the print in a paused state.

Currently I am using lcd_pause_print() but this may be simplified
later.

A new PrinterState is introduced PowerPanicWaitingForHost to
differentiate this paused state from the typical paused state.
In this new paused state the printer is waiting for the host to boot up
and send M79.

Once M79 is seen a new action is sent "// action:uvlo_recovery_ready"

It is up to the host software to then resume the print correctly. All
the needed information to resume the print is in EEPROM and can
be read by using the D3 g-code.

Change in memory:
Flash: +82 bytes
SRAM: 0 bytes
2023-12-01 16:16:39 +01:00
gudnimg 02c5da198d Enable EEPROM_UVLO flag for host prints
Change in memory:
Flash: -30 bytes
SRAM: 0 bytes
2023-12-01 16:16:39 +01:00
gudnimg ce24d917e6 power panic: Only send M24 for SD prints
For host prints, we don't want to send M24.

Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2023-12-01 16:16:39 +01:00
gudnimg 67c7ad1c99 power panic: improve file position recovery
- Only queue M26 for SD prints
- Add M110 to set gcode_LastN for host prints
- Remove one debug log to save resource (52 bytes)

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-12-01 16:16:39 +01:00
gudnimg 665c01804c power panic: remove redundant lcd_setstatuspgm
If recover_print was never called, then there should be
no need to call lcd_setstatuspgm(MSG_WELCOME) since
the status line was not modified by the power panic feature.

Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-12-01 16:16:39 +01:00
gudnimg e2d0e9a2ee power panic: remove redundant lcd update calls
lcd_show_fullscreen_message_yes_no_and_wait_P will
enable LCD update upon exit.

Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2023-12-01 16:16:39 +01:00
3d-gussner 02a5228f5e
Merge pull request #4520 from 3d-gussner/MK3_Reprint_OP
Change Reprint action message to comply with OctoPrint actions
2023-12-01 09:06:32 +01:00
3d-gussner 096a1c9fe0 Change Reprint action message to comply to OctoPrint actions 2023-11-30 15:08:48 +01:00
3d-gussner b37e39fdd9
Merge pull request #4427 from gudnimg/minor-stepper-opt
optimisation: stepper: make `dda_isteps_t` an array
2023-11-29 08:54:38 +01:00
3d-gussner 3216ef863a
Merge pull request #4149 from gudnimg/tone-opt
use `uint16_t` instead of `uint32_t` when writing to OCR4C register
2023-11-29 08:26:54 +01:00
3d-gussner ff42510a5c
Merge pull request #4512 from jamesdehart/fix-spelling-temperature
Fix Spelling: temperature.cpp

@jamesdehart Thanks for the PR even a small community PR like this is very appreciated 🤗
2023-11-28 08:54:15 +01:00
3d-gussner ba004d2fa8
Merge pull request #4514 from DRracer/current-tool
MMU2: Report current tool onto the serial
2023-11-27 17:13:49 +01:00
D.R.racer 67d7be2b2d MMU2: Report current tool onto the serial
PFW-1546
2023-11-27 13:16:13 +01:00
D.R.racer 0462b7289a MMU2: enlarge the Idler's SG_thrs range in Tune menu
Based on experience of mibehaving MMU2S units, a broader range seems to help more people in getting their unit to home properly.

Related to issue #4285
2023-11-27 08:57:28 +01:00
James DeHart e2a60be029
Fix Spelling: temperature.cpp
While running the temperature calibration. I happen to notice the `estimate` was spelled `estimat`.
2023-11-25 15:28:18 -07:00
3d-gussner 9f9bb12eeb
Merge pull request #4419 from gudnimg/reduce-stack-m600-opt
M600: reduce stack usage
2023-11-24 05:39:26 +01:00
3d-gussner 7749cdec20
Merge pull request #4510 from 3d-gussner/MK3_Reprint
PFW-1536: Reprint function implemented for MK3S/MK3S+
2023-11-24 05:37:48 +01:00
3d-gussner d9d42a0678 Use of PrinterState for Reprint menu 2023-11-23 06:47:04 +01:00
Guðni Már Gilbert e1e0b0afa1 Refactor code which resets crash detection setting
Add function crashdet_use_eeprom_setting

Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
2023-11-22 21:19:43 +00:00
Guðni Már Gilbert 30d0da4698 Close SD file in print_stop instead of UnconditionalStop()
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-11-22 21:19:17 +00:00
Guðni Már Gilbert 3ad40f0206 crashdet_cancel doesnt cleanup all variables when using Octoprint
I would think that this should behave similarly as when stopping
the print via the LCD.

Changed UnconditionalSto()p to not close the SD card file
if we're using Octoprint. Then there shouldnt be any file open.

Some of the variables which were not reset:

isPrintPaused
pause_time
saved_start_position
saved_printing_type

Bed heater may be left on?

Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
2023-11-22 21:19:17 +00:00
Juan Francisco Estrada 0b4af3b97f Fix: Reprint menu does not appear during the heating 2023-11-22 12:20:13 +01:00
Juan Francisco Estrada 73436e9351 Fixed Reprint from USB and from SD, some debug is needed 2023-11-22 12:20:00 +01:00
Juan Francisco Estrada ec1c215681 Updates to translations of "Reprint" to Slovak and Romanian languages 2023-11-22 12:19:10 +01: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 f48c9e0d4f Fix execution of update-po.py 2023-11-22 12:18:45 +01:00
Juan Francisco Estrada 242fdc863b Execution of lang/update-pot.py and lang/update-po.py 2023-11-22 12:16:38 +01:00
Juan Francisco Estrada ce135a0976 Added support for reprint and streamed GCODE 2023-11-22 12:14:08 +01:00
Juan Francisco Estrada 532a5b3e2f - Serial message --> /// action:reprint done
- Yes/no question --> Need to fix the bug related with the filename print --> if (lcd_show_fullscreen_message_yes_no_and_wait_P(altfilename, false, LCD_LEFT_BUTTON_CHOICE)==LCD_LEFT_BUTTON_CHOICE)
2023-11-22 12:14:00 +01:00
Juan Francisco Estrada 004169034a Remove some MYSERIAL calls 2023-11-22 12:13:24 +01:00
Juan Francisco Estrada ae5fbce6e7 Remove MYSERIAL.println code (debug purpose) and old commented code 2023-11-22 12:13:16 +01:00
Juan Francisco Estrada a52d5430aa Change to enquecommandf_P and enquecommand_P 2023-11-22 12:13:01 +01:00
Juan Francisco Estrada 7a6cfda34f Fix SV translation length of MSG_REPRINT 2023-11-22 12:12:50 +01:00
Juan Francisco Estrada cb92fd5002 Fix the length of the PL translation of MSG_REPRINT 2023-11-22 12:12:21 +01:00
Juan Francisco Estrada e8a2d4c7e1 Reprint function integrated on 3.13v 2023-11-22 12:11:39 +01:00
3d-gussner 8615a8dad5
Merge pull request #4429 from 3d-gussner/MK3_PFW-1525_Printer_Ready
PFW-1525 Add `Set Ready`menu
2023-11-22 08:52:39 +01:00
3d-gussner 02459edcb6 Rebase fix
Add documentation
Whitespace
2023-11-22 08:21:52 +01:00
3d-gussner d394645b69 Whitespace 2023-11-22 07:59:18 +01:00
3d-gussner af79ac0714 Add `SetPrinterState(PrinterState::Idle);` after `lcd_commands_type = LcdCommands::Idle;` 2023-11-22 07:58:17 +01:00
3d-gussner d5d77ee243 Cleanup documentation 2023-11-22 07:58:17 +01:00
3d-gussner 880d2f28bd LCD menu only sends `// action:ready` or `// action:not_ready` via serial
Host has to send back state with `M72 S1|0` to keep printer and host in sync
Changed LCD menu messages to `Set ready` and `Set not ready`
Updated translations
2023-11-22 07:58:17 +01:00
3d-gussner 516ae1b952 Update state 2023-11-22 07:58:17 +01:00
3d-gussner dfcaa330fa Fix cmake build 2023-11-22 07:58:17 +01:00
3d-gussner d3b98f30a7 Show Set Ready LCD menu only when M79 timer is running. 2023-11-22 07:58:17 +01:00
3d-gussner 514607318e Add printer_state.cpp/.h 2023-11-22 07:58:17 +01:00
3d-gussner d276695ce7 Set Ready 2023-11-22 07:58:13 +01:00
3d-gussner bbae8dd956
Merge pull request #4493 from gudnimg/print-job-timer-marlin
PFW-1206: Implement Marlin's print job timer and add M75-M78
2023-11-22 07:44:09 +01:00
Guðni Már Gilbert 134e892d8e Fix build failure
Another isPrintPaused was added by rebase
2023-11-21 18:40:28 +00:00
gudnimg 60cb089e96 Show statistics menu for USB/Serial prints
Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2023-11-21 18:38:40 +00:00
gudnimg 331ceaf044 M77: Save statistics when timer is stopped
For remote hosts, when the timer is stopped, then also save the statistics.

Slightly refactored save_statistics function by removing the parameters.
The function parameters are always the same.

Change in memory:
Flash: -40 bytes
SRAM: 0 bytes
2023-11-21 18:38:40 +00:00
gudnimg a2e6cda37e Fix build failure 2023-11-21 18:38:40 +00:00
gudnimg a6de11059f PFW-1206 Add M75-M78
Change in memory:
Flash: +240 bytes
SRAM: 0 bytes
2023-11-21 18:38:40 +00:00
gudnimg 423f98ff6e Implement Marlin's print job timer
I changed the code a bit so it would compile
in Prusa Firmware.

The paused duration is no longer included in the
print time statistics.

Change in memory:
Flash: -122 bytes
SRAM: 0 bytes
2023-11-21 18:38:40 +00:00
3d-gussner c5a885dba3
Merge pull request #4507 from 3d-gussner/MK3_Fix_File_incomplete
Raise `END_FILE_SECTION`
2023-11-20 11:34:48 +01:00
3d-gussner 8b3373b9dc Raise `END_FILE_SECTION` from 20000 to 30720 to prevent false positive `File incomplete. Continue Anyway?` messages. 2023-11-20 11:23:36 +01:00
3d-gussner d3b4bfb685
Merge pull request #4399 from 3d-gussner/MK3_M125
Add M125
2023-11-20 09:46:01 +01:00
3d-gussner 96094dc548 Don't pause with `S`et values
Update documentation
2023-11-20 07:30:07 +01:00
Guðni Már Gilbert 0d60a82c56 Don't reset pause_position on every M125
Change in memory:
Flash: -76 bytes
SRAM: 0 bytes
2023-11-20 07:30:06 +01:00
Guðni Már Gilbert 4a4c015ad8 M125: make pause_position static 2023-11-20 07:30:06 +01:00
Guðni Már Gilbert 2e12133716 M125: Code size optimisation
Change in memory:
Flash: -66 bytes
SRAM: -12 bytes
2023-11-20 07:30:06 +01:00
3d-gussner 498d99b84b Code size improvments 2023-11-20 07:30:06 +01:00
3d-gussner 4dc87acf20 Fix issues
Check printer limits
Fix crash when pausing / paused
2023-11-20 07:30:06 +01:00
3d-gussner 43692b416b Fix float
Thanks to @gudnimg for pointing out
2023-11-20 07:30:06 +01:00
3d-gussner af054923a7 Add M125 2023-11-20 07:30:06 +01:00
3d-gussner 9fd478c9c2
Merge pull request #4173 from gudnimg/disable-heaters-gudni
optimisation: use `disable_heater()` in more places
2023-11-20 07:01:05 +01:00
3d-gussner b39b83ecbf
Merge pull request #4457 from 3d-gussner/MK3_PrinterName
PFW-1184:Basic Printer name in EEPROM
2023-11-20 06:59:38 +01:00
3d-gussner 53c419f52d Basic Printer name in EEPROM
- Output with M115 works
- ToDo
  - LCD screen
  - M550 gcode
  - Detect length of EEPROM CUSTOM_MENDLE_NAME
2023-11-18 10:14:07 +01:00
gudnimg cf0e0f3718 M600: use partial backup in RAM
To handle power panic in M600 we started saving
relevant data at the start of M600 gcode.

We are currently also saving the same data within
gcode_M600 which is saved on the stack. I propose
we just use the data already saved in SRAM to reduce
stack usage.

Change in memory:
Flash: -64 bytes
SRAM: 0 bytes
2023-11-17 19:25:56 +00:00
Guðni Már Gilbert 7e0df7f9d3
Merge pull request #4502 from gudnimg/gcode_reset_stepper_timeout
MMU: Remove gcode_reset_stepper_timeout
2023-11-17 09:27:49 +00:00
3d-gussner f42d7e4ea0
Merge pull request #4495 from gudnimg/eeprom-table-cleanup
EEPROM: Formatting cleanup
2023-11-16 17:04:08 +01:00
Guðni Már Gilbert e758b146be MMU: Remove gcode_reset_stepper_timeout
This function was removed on the 32-bit side.
On the 8-bit the function was empty so it is safe
remove it.
2023-11-16 14:30:29 +00:00
Guðni Már Gilbert 4922bcd7b1
Merge pull request #4408 from gudnimg/PR2390
PFW-1097 M600: Fix filament change behavior when print is paused
2023-11-16 07:37:42 +00:00
Guðni Már Gilbert 400722ec67
Merge pull request #4461 from gudnimg/lcd-opt-message
optimisation: simplify two LCD messages
2023-11-16 07:37:09 +00:00
D.R.racer 38104063d4 M702: fix documentation link 2023-11-15 09:14:44 +01:00
3d-gussner e74abb102a
Merge pull request #4494 from gudnimg/issue3122
Fix #3122
2023-11-12 17:42:10 +01:00
gudnimg 842d029f7e Replace unused EEPROM entry names with placeholders
_EEPROM_FREE_NRx_ make it a bit more clear this entry is free.
2023-11-12 16:21:34 +00:00
Guðni Már Gilbert 1e6460c344
Merge pull request #4479 from gudnimg/PFW-1523-2
PFW-1523 Add the `S` parameter to `M79`
2023-11-12 16:19:31 +00:00
gudnimg 077aa0a2b8 Minor wording changes 2023-11-12 16:09:15 +00:00
gudnimg 1fc1998874 EEPROM: Formatting cleanup
Mark unused bytes consistently

Add "Power Panic" into the Feature column for relevant bytes

Change "MMU2/s" to "MMU"
2023-11-12 14:39:52 +00:00
gudnimg ddbadf4874 Fix #3122
If the feedrate multiplier is changed while the print is paused
update the saved feedrate multiplier in RAM
2023-11-12 12:38:05 +00:00
Guðni Már Gilbert 53d7943a2c
Merge pull request #4474 from 3d-gussner/M709_v2
Add en- and disable MMU to M709
2023-11-12 09:35:43 +00:00
gudnimg 4e6b649865 PFW-1523 Only overwrite name if not SD printing 2023-11-11 16:56:14 +00:00
gudnimg af465da9e2 Add a comment 2023-11-11 16:53:56 +00:00
gudnimg 45880c252b Fix filament change behavior when print is paused
Reimplementing PR 2390
https://github.com/prusa3d/Prusa-Firmware/pull/2390
from @wavexx
2023-11-11 16:51:35 +00:00
3d-gussner 342d8e92ab Update doxygen M709 2023-11-11 12:20:58 +01:00
3d-gussner 0016b77827 Updated MMU serial status message
- Shown during bootup
- Shown on LCD menue MMU [ON|OFF]
- Shown using `M709`
- Shown when `Disable`d with MMU ERROR FW UPDATE NEEDED
2023-11-11 12:18:34 +01:00
3d-gussner e3392a763a Update doxygen for M709 2023-11-11 12:18:34 +01:00
3d-gussner b11c0024d1 Update requested changes 2023-11-11 12:18:34 +01:00
3d-gussner 69cb7add26 Add en- and disable MMU to M709
Add X42 to erase the MMU eeprom
2023-11-11 12:18:34 +01:00
3d-gussner a76e1290e8
Merge pull request #4437 from gudnimg/filename-powerpanic
PFW-1294: Don't attempt to find SD file when recovering USB print
2023-11-11 12:03:41 +01:00
gudnimg bcc7a16e1c PFW-1523 Trim trailing whitespace in util.h 2023-11-07 07:27:26 +00:00
gudnimg 890bfab946 PFW-1523 Update M79 description 2023-11-07 07:27:21 +00:00
gudnimg dc280b0d9e power panic: support any valid DOS 8.3 extension
When a SD file is selected to print
save the DOS 8.3 extension into EEPROM.

After a power outage, the correct file extension is then
selected instead of always assuming it's ".gco"

This allows users to recover ".g" files.

Change in memory:
Flash: +104 bytes
SRAM: 0 bytes
2023-11-05 16:46:54 +00:00
gudnimg 4c52d92d16 power panic: read whole directory name block from EEPROM
There is no need to read one byte at a time. We can simply
read the whole block in one go. This saves some flash memory.

Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
2023-11-05 16:46:54 +00:00
gudnimg 21d0130626 power panic: simplify recovering SD filename
We can just read the whole EEPROM block since short filenames
are always null terminated. strcat_P will then apply the file extension
at the correct position.

Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2023-11-05 16:46:54 +00:00
Guðni Már Gilbert dec5e2c1b4 Refactor menu_action_sdfile 2023-11-05 16:46:54 +00:00
Guðni Már Gilbert 82cece95aa power panic: read EEPROM_FILENAME until \0 is seen
Also removed debug logs
2023-11-05 16:46:14 +00:00
Guðni Már Gilbert 977792961c power panic: only send M23 for SD prints
If the saved printing type was USB, then EEPROM_FILENAME
does not contain anything. The firmware should also
not be trying to open a file on a SD card which is maybe
not even mounted.

Change in memory:
Flash: +12 bytes
SRAM: 0 bytes
2023-11-05 16:46:13 +00:00
gudnimg 469f002179 optimisation: simplify two LCD messages
There is no need to restrict how often the message is rendered.
It was being restricted to render every 1 second. We don't do
this for most of the static menus. So I propose this 1 second period
be removed.

Tested on MK3S+

Change in memory:
Flash: -168 bytes
SRAM: -8 bytes
2023-11-05 12:57:28 +00:00
gudnimg ed376009aa PFW-1523 Force inline unquoted_string constructor
Saves 36 bytes of flash
2023-11-04 20:57:31 +00:00
gudnimg 20a2216623 PFW-1523 Implement S parameter for M79
Change in memory:
Flash: +112 bytes
SRAM: +3 bytes
2023-11-04 20:38:50 +00:00
gudnimg cdb559040c PFW-1523 Refactor parsing quoted strings
My plan is to re-use this function in M79
in a later commit. The firmware doesn't
have a dedicated parser like Marlin 2.1
so this is my attempt to not duplicate the parsing of a quoted string in G-codes

Change in memory (MK3S+ Multilang):
Flash: -50 bytes
SRAM: 0 bytes
2023-11-04 17:45:14 +00:00
3d-gussner fca93b00e9
Merge pull request #4471 from gudnimg/issue-4470
MMU: Set PAUSED_FOR_USER state on MMU error screen
2023-10-31 08:36:53 +01:00
3d-gussner 3ffe7bf406
Merge pull request #4460 from gudnimg/PFW-1523
PFW-1523 Add a new timer for Prusa Link
2023-10-30 11:23:46 +01:00
3d-gussner 6be5cb3732
Merge pull request #4472 from gudnimg/mmu-menu-regression
Fix regression in MMU enable menu
2023-10-30 08:59:15 +01:00
gudnimg 8fcfdf31c4 PFW-1523 Implement M79 timer for PrusaLink
The idea is to have the host ping the printer periodically with a M79 to
enable certain features/UI. Using the usb_timer is not a good solution
for this as it depends on seeing a 'G' character

The LCD code, or whatever code is implementing the new functionality
will need to include host.h and check whether M79_timer_get_status()
returns 0 (timer not running) or 1 (timer is running).

I created a new file for the code host.cpp which we can use to expand
host related functionality and not clutter Marlin_main.cpp further.

Change in memory:
Flash: +104 bytes
SRAM: +5 bytes
2023-10-29 16:33:45 +00:00
gudnimg 645b11e643 Fix regression in MMU enable menu
Fixes a regression introduced in https://github.com/prusa3d/Prusa-Firmware/pull/4454
2023-10-29 16:17:03 +00:00
gudnimg 287e340117 MMU: Set PAUSED_FOR_USER state on MMU error screen
Setting this state notifies PrusaLink/PrusaConnect
that the printer is waiting for user input (attention).

Change in memory:
Flash: +12 bytes
SRAM: 0 bytes
2023-10-28 19:31:32 +00:00
Guðni Már Gilbert 3b10c6130e
Merge pull request #4466 from gudnimg/eeprom-optimisations
Optimise EEPROM access in a few places by reading/writing larger blocks
2023-10-27 21:12:13 +00:00
Guðni Már Gilbert 3297429ca7 TM: Optimise EEPROM read and writes 2023-10-25 17:37:04 +00:00
Guðni Már Gilbert e207945154 MBL: optimise EEPROM read/writes 2023-10-25 17:36:15 +00:00
Guðni Már Gilbert e7f56118d1
Merge pull request #4454 from gudnimg/mmu-sync
MMU: Backport code changes from 32-bit firmware
2023-10-23 06:31:06 +00:00
Guðni Már Gilbert 82e0124cb4 mmu: remove isErrorScreenRunning()
No change in memory
2023-10-19 18:32:42 +00:00
Guðni Már Gilbert d56f2bc57e mmu: remove obsolete EEPROM comments 2023-10-19 18:32:42 +00:00
Guðni Már Gilbert 62b90fde28 mmu: remove ResetOnExit
No change in memory
2023-10-19 18:32:42 +00:00
Guðni Már Gilbert 7b9e707709 mmu: add ResetCommunicationTimeoutAttempts
Adding __attribute__((noinline)) saves 14 bytes of flash

Change in memory:
Flash: +34 bytes
SRAM: 0 bytes
2023-10-19 18:32:42 +00:00
Guðni Már Gilbert ef33db9a71 mmu: add DisableMMUInSettings
power_on should not be modifying
EEPROM_MMU_ENABLED. The code is never
executed unless it's already been set.

Only disable EEPROM_MMU_ENABLED through Buttons::DisableMMU

Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
2023-10-19 18:32:42 +00:00
Guðni Már Gilbert cd3372dc92 mmu: formatting 2023-10-19 18:32:41 +00:00
Guðni Már Gilbert 12a3051c50 mmu: Add CheckErrorScreenUserInput
Due to differences in 8-bit FW I had to implement two new get functions

* GetCommandInProgress
* GetLastErrorCode
2023-10-19 18:32:41 +00:00
3d-gussner 7bc7e7a7e8
Merge pull request #4448 from sarusani/nl_typo
Fix typo in Firmware_nl.po
2023-10-19 17:10:19 +02:00
3d-gussner abd8a43cfc
Merge pull request #4456 from leptun/update_diacritics
Update enabled diacritics
2023-10-19 17:08:53 +02:00
Alex Voinea 1528294450 Update enabled diacritics 2023-10-19 13:07:49 +02:00
3d-gussner 1f608dffcf
Merge pull request #4441 from 3d-gussner/MK3_French
PFW-1445: Update and shorten French
2023-10-19 09:04:20 +02:00
3d-gussner 5c416a1e47
Merge pull request #4452 from 3d-gussner/MK3_fix_cmake_3
PFW-1460 Part1: Fix PF-build.sh with new cmake
2023-10-19 09:03:32 +02:00
3d-gussner cd8daa88a3 Few more changes 2023-10-18 19:27:45 +02:00
3d-gussner 1f1743d7ad Not needed anymore thanks to @vintagepc 2023-10-18 18:02:56 +02:00
3d-gussner af13d0746e Updates by @ErwanAliasr1 2023-10-18 17:35:03 +02:00
3d-gussner fe9a8cf8ac Fix PF-build.sh with new cmake
Same as MK3_3.13.2 branch
2023-10-17 15:36:54 +02:00
3d-gussner 323f9aaf6c
Merge pull request #4440 from 3d-gussner/MK3_Spanish
Update Spanish diacritics
2023-10-17 15:15:36 +02:00
3d-gussner a5dbf4926d Few more changes 2023-10-17 10:29:56 +02:00
3d-gussner 0b999f1cc2 Thanks to @Ilovemyhous for the review
Changed all self test to selftest as this term is used in the help articles
2023-10-17 09:13:51 +02:00
3d-gussner c681dada5d Few more changes 2023-10-16 21:31:29 +02:00
3d-gussner fa056ceb43
Merge pull request #4449 from gudnimg/PFW-1542-v3
PFW-1542 Don't allow starting SD print if there is a thermal or fan error
2023-10-16 15:37:31 +02:00
Guðni Már Gilbert baba1e78c7 use uint16_t when writing to Timer/Counter4
Using uint16_t instead of uint32_t reduces code size
and probably is quicker to execute

OCR4C register is 2 bytes on ATmega2560
It's 1 byte on ATmega32u4 and ATmega16u4

Change in memory:
Flash: -80 bytes
SRAM: 0 bytes
2023-10-15 16:50:43 +00:00
gudnimg 20a434dbac PFW-1542 Reset status line message on EFCE_OK
If the error is really resolved, I'd prefer to see

"Prusa i3 MK3S OK" instead of "Err:HOTEND FAN ERROR"
2023-10-15 12:26:44 +00:00
gudnimg 466e562360 PFW-1542 Don't allow starting SD print if there is a fan error
Apply same conditions as on "Resume print" feature.
Starting a SD print should not be possible if there is an active hardware error
2023-10-15 12:17:36 +00:00
sarusani baedd025d3 Fix typo 2023-10-14 23:00:56 +02:00
3d-gussner 6ef9e8d39c More updates 2023-10-14 15:02:44 +02:00
3d-gussner 07b7842212
Updates by @misan
Some minor changes for better fit on LCD
2023-10-14 12:57:06 +02:00
3d-gussner 63b628d722
Merge pull request #4396 from 3d-gussner/MK3_PFW-1538_M420
PFW-1538: Add M420
2023-10-13 14:27:34 +02:00
3d-gussner 3d7892f678
Merge pull request #4411 from arekm/arekm-pl-update
Polish translation update.
@arekm  Bardzo dziękuję za ten 🇵🇱 pull request
2023-10-13 08:50:21 +02:00
3d-gussner 47f5066fa4
Merge pull request #4442 from 3d-gussner/MK3_Italian
Update Italian
Reviewed by two users
2023-10-13 08:48:06 +02:00
3d-gussner 0b5cf404a6
Merge pull request #4432 from gudnimg/fix-compiler-warning-sha
Fix `FW_COMMIT_HASH` compiler warning
2023-10-11 17:40:17 +02:00
3d-gussner eb2cacc7de Update French
- Shorten messages
- Diacritics
2023-10-11 13:08:17 +02:00
3d-gussner a90086b28f
Merge pull request #4439 from leptun/update_charset
Add `’` and `Ê` to charset
2023-10-11 13:07:12 +02:00
3d-gussner 9148bed5b6 Update Italian 2023-10-11 13:00:45 +02:00
3d-gussner 512d7684b0 Update Spanish dicaritics 2023-10-11 12:56:11 +02:00
Alex Voinea b040538535
Add `’Ê` to charset 2023-10-11 12:31:23 +02:00
Guðni Már Gilbert fe893f8289 Fix git_describe_working_tree failing
The command
/usr/bin/git describe --abbrev=0 --dirty=-D --broken=-B

Was returning error code 128 and no output.

In the workflow file, specifying fetch-depth = 0, will make sure
to fetch all branches and tags. This seems to fix the issue.
2023-10-08 14:38:42 +00:00
Guðni Már Gilbert 69e06bac84 Use FW_COMMIT_HASH_UNKNOWN in CMakeLists.txt 2023-10-08 12:59:09 +00:00
Guðni Már Gilbert f6737d2fca optimisation: make dda_isteps_t an array
This way we can loop through it with a for-loop
and save some code size
2023-10-07 22:18:01 +00:00
Guðni Már Gilbert 6aae8f04df Fix two python commands on Windows 2023-10-07 21:29:24 +00:00
Guðni Már Gilbert 415c0c79d1 Fix FW_COMMIT_HASH compiler warning
On my end, the default length for the abbreviated commit hash is 9 characters.
This won't fit into uint32_t (4 bytes).

Instead change FW_COMMIT_HASH into a string
and create preprocessor symbol for the string length
such that it's known at compile time.

If the string should be longer or shorter
then only FW_COMMIT_HASH_LENGTH needs to be configured on the CMake side
2023-10-07 21:01:28 +00:00
3d-gussner fab47e63bf
Merge pull request #4426 from 3d-gussner/MK3_pr-size_details
More pr-size details
2023-10-06 11:15:54 +02:00
3d-gussner 23503624d0
Merge pull request #4407 from gudnimg/minor-opt-temp-gudni
optimisation: make `alert_automaton_mintemp` constructor `constexpr`
2023-10-06 09:05:24 +02:00
3d-gussner 2027a54873
Merge pull request #4420 from gudnimg/PFW-1543
PFW-1543 Save print type in EEPROM
2023-10-06 09:04:30 +02:00
3d-gussner 9aca81dc7c
Merge pull request #4381 from vintagepc/misc-cmake-fixes
Refine CMake version handling based on tags
2023-10-05 16:00:55 +02:00
3d-gussner de73edc5a3 More pr-size details 2023-10-05 09:53:18 +02:00
Guðni Már Gilbert b89c62bd50 PFW-1543 Replace ffh 255 with ^ 2023-10-04 20:57:05 +00:00
3d-gussner 8b9b63c35b
Merge pull request #4418 from gudnimg/PFW-1542-v2
PFW-1542 Handle fan error sooner when waiting for heating to complete
2023-10-03 10:16:49 +02:00
Arkadiusz Miśkiewicz 37af110846
One dot too much. 2023-10-03 08:23:16 +02:00
Arkadiusz Miśkiewicz cc020ede35
Solve issues found by vscode spell checking. 2023-10-03 08:23:16 +02:00
Arkadiusz Miśkiewicz ea28584142
More improvements. Dots at the end like in original. More unification. 2023-10-03 08:23:16 +02:00
Arkadiusz Miśkiewicz fab62367b7
Shorter sentences. Regular spaces. 2023-10-03 08:23:16 +02:00
Arkadiusz Miśkiewicz e8c95c3fe4
Polish translation update.
druk - jako proces
wydruk - jako produkt
wyładuj (zamiast rozładuj)
kanał (nie slot)
katalog (nie folder)
podręcznik (nie instrukcja)
firmware (krótsze; nie oprogramowanie układowe)
bazowanie (nie zerowanie bo zerowanie może wiele rzeczy oznaczać)
nieudane (zamiast nie powiódł się bo krótsze)
2023-10-03 08:23:16 +02:00
Alex Voinea 9606c4f00b Add font unpacking documentation 2023-10-03 08:19:48 +02:00
3d-gussner c479848497 Update German 2023-10-03 08:19:48 +02:00
D.R.racer c8ee7bc7c2 Add diacritics to CZ translations 2023-10-03 08:19:48 +02:00
Alex Voinea d53ba0eba2 Fix wrong character sent when potentially unused slot is replaced 2023-10-03 08:19:48 +02:00
Alex Voinea 7e88e49b4e Fix tilde in message 2023-10-03 08:19:48 +02:00
Alex Voinea 32cee8b529 Move custom character type to lcd.cpp 2023-10-03 08:19:48 +02:00
Alex Voinea c2c01a9a86 Use beta symbol as fallback of `ß` 2023-10-03 08:19:48 +02:00
vintagepc b45a5842ca Update Firmware_nl.po
Missing diacritic :)
2023-10-03 08:19:48 +02:00
Alex Voinea 3e15a24be7 Fix sheet rename resetting characters to blank 2023-10-03 08:19:48 +02:00
Alex Voinea 8a39f53e26 Prevent out of bounds custom character font data 2023-10-03 08:19:48 +02:00
Alex Voinea 9dbbb12a13 Fix frame start for non-menu screens 2023-10-03 08:19:48 +02:00
Alex Voinea 8e25e1b164 Allow all diacritics in the sheet name 2023-10-03 08:19:48 +02:00
Alex Voinea d5074129f5 Fix MMU error message character 2023-10-03 08:19:48 +02:00
Alex Voinea 6703640c56 Optimize `lcd_print_custom()` 2023-10-03 08:19:48 +02:00
Alex Voinea e4ad14a9fb Update README.md 2023-10-03 08:19:48 +02:00
Alex Voinea 9fbdbb3c7b Fix charset conversion 2023-10-03 08:19:48 +02:00
Alex Voinea f093d431c8 Add rewrite for a-caron 2023-10-03 08:19:48 +02:00
Alex Voinea fcaa9c8de6 Update `ăĂñ` 2023-10-03 08:19:48 +02:00
Alex Voinea 4d0513007f Update RO po files 2023-10-03 08:19:48 +02:00
Alex Voinea 9ee71b2942 Update `ø` 2023-10-03 08:19:48 +02:00
Alex Voinea dd32f7be3c bootapp cleanup 2023-10-03 08:19:48 +02:00
Alex Voinea 5466bfb500 Cleanup uartout declaration 2023-10-03 08:19:48 +02:00
Alex Voinea 90dbaa8c51 Update `đûůű` 2023-10-03 08:19:48 +02:00
Alex Voinea 927b27615e Update `ď` 2023-10-03 08:19:48 +02:00
Alex Voinea d8b75f425f Remove unused fonts 2023-10-03 08:19:48 +02:00
Alex Voinea 3817893199 Implement the rest of the diacritics 2023-10-03 08:19:48 +02:00
Alex Voinea 5ea2b881d5 Yet another workaround for the language update 2023-10-03 08:19:48 +02:00
Alex Voinea 3305227bbc Implement all a-based diacritics 2023-10-03 08:19:48 +02:00
Alex Voinea 6707570c6c Update diacritic alignment 2023-10-03 08:19:48 +02:00
Alex Voinea c0875f37f2 Implement 'á' 2023-10-03 08:19:48 +02:00
Alex Voinea a267d80fe2 Fix legacy build 2023-10-03 08:19:48 +02:00
Alex Voinea 10e6087d6b Update language scripts to use the font 2023-10-03 08:19:48 +02:00
Alex Voinea e6d7a4e432 Add t-cedilla to TRANS_CHARS
Thanks @petrubecheru
2023-10-03 08:19:48 +02:00
Alex Voinea 09c85796a6 No need to mask the CGRAM data before sending 2023-10-03 08:19:48 +02:00
ingbrzy 4a24990c75 typos in Firmware_sk.po 2023-10-03 08:19:48 +02:00
ingbrzy 1faf919c63 Update Firmware_sk.po with diacritics 2023-10-03 08:19:48 +02:00
Alex Voinea 245a2852ac Font table compression 2023-10-03 08:19:48 +02:00
Alex Voinea 64e31fd7f4 Add s-cedilla to TRANS_CHARS
Thanks @petrubecheru
2023-10-03 08:19:48 +02:00
Alex Voinea 1c637f8082 Fix "🔃Refresh" translation 2023-10-03 08:19:48 +02:00
Alex Voinea 1c260f94a0 Expand list of custom characters 2023-10-03 08:19:48 +02:00
Alex Voinea 6d5e645c1f Regen font table and include ID in comment 2023-10-03 08:19:48 +02:00
Alex Voinea c1ec8d97e6 Remove TR font 2023-10-03 08:19:48 +02:00
Alex Voinea 81103602f0 Change μ to µ
stupid unicode...
2023-10-03 08:19:48 +02:00
Alex Voinea 6367172177 Change ↡ to 2023-10-03 08:19:48 +02:00
Alex Voinea 4957544fcf Change 🗘 to 🔃 2023-10-03 08:19:48 +02:00
Alex Voinea c514774a54 Generate the font from Prusa.lcd 2023-10-03 08:19:48 +02:00
Alex Voinea 8e18c83d51 Update debug messages 2023-10-03 08:19:48 +02:00
Alex Voinea 4736a1624f First working implementation
Fix cherry-pick conflict
2023-10-03 08:19:48 +02:00
Alex Voinea e9f74b2678 Remove unnecessary lcd_home() calls 2023-10-03 08:19:48 +02:00
Alex Voinea 580b27e394 Use lcd_home() wherever possible
Fix cherry-pick conflict
2023-10-03 08:19:48 +02:00
Alex Voinea c7f9a46c86 Cleanup around invalidating the custom characters 2023-10-03 08:19:48 +02:00
Alex Voinea 60494b20e8 lcd_print_custom(): limit searching to lcd_custom_index 2023-10-03 08:19:48 +02:00
Alex Voinea 7e0ab44d09 Refactor the lcd_print_custom() method 2023-10-03 08:19:48 +02:00
Alex Voinea 90222747f2 lcd_set_cursor_column() also updates lcd_ddram_address 2023-10-03 08:19:48 +02:00
3d-gussner f392fae996 Fix cherry-pick conflict 2 2023-10-03 08:19:48 +02:00
Alex Voinea 100a8e3b33 Dynamic characters initial
Fix more hardcoded characters

Finally optimize the lcd printf with custom characters

FontGen.py script

Add arguments and action

Fix build

Fix conflicts
2023-10-03 08:19:48 +02:00
gudnimg 3eaca29b0b PFW-1543 Move printing types into enum
Also add power panic namespace
2023-10-01 12:57:25 +00:00
gudnimg fcd61a378d power panic: save print type in EEPROM
The printer should know whether it is recovering a SD print
or a USB print

PFW-1543
2023-10-01 12:44:49 +00:00
gudnimg 0139cf6dde MMU: Fix printing uint8_t value onto serial
uint8_t values don't print correctly. Cast to 2-byte integer is required.
2023-09-30 14:06:38 +00:00
gudnimg e621d3445e PFW-1542 Handle fan error sooner when waiting for heating to complete
While waiting for the nozzle to reach a certain temperature, a fan error
should disable the hotend heater. If printing, it will simply pause the print.

Previously the printer would wait for the nozzle to heat up before pausing the print
and turning off the hotend heater.

We rely on LcdCommands::LongPause and must return to the top level loop to process it.
Waiting in the while loop e.g. in M190 does not make sense.
2023-09-30 14:01:09 +00:00
3d-gussner c97143fc2d
Merge pull request #4403 from gudnimg/PFW-1542
PFW-1542 Fix an issue where print can't be stopped under specific circumstances
2023-09-25 10:43:18 +02:00
gudnimg ae494b04de optimisation: make constructor constexpr
Minor optimisation I found. It doesn't save much but this change
should be harmless :)

Change in memory:
Flash: -30 bytes
SRAM: 0 bytes
2023-09-24 11:41:18 +00:00
VintagePC 52de576e0a change where FW_VERSION_FULL is defined so it's less messy 2023-09-23 13:10:04 -04:00
gudnimg 016db6a6e8 Hide menus more consistently when the printer is busy
lcd_calibration_menu: Remove redundant if (!isPrintPaused). The menu
is never called unless this condition is true.

eeprom_switch_to_next_sheet: Don't show this menu if the printer
is busy doing work!

Do not allow these menus to run while a print is paused or
when we're recovering a print:

- Preload to MMU
- Load to Nozzle
- Unload filament
- Eject from MMU
- Cut filament
- Autoload filament
- Settings
- Calibration
2023-09-23 15:42:03 +00:00
gudnimg 06d34b4398 Fix an issue where print can't be stopped under specific circumstances
There is a bug where if the printer is recovering a print, it run a
blocking loop to restore the extruder and bed temperatures.
But if a Fan error is triggered in this loop, then the user can't
abort the print via LCD.

If the fan error resolves on its own the 'Resume print' menu will
appear in a few seconds. But if not, then the user can't resume the print
(which is normal). But with the bug above the user can't abort the print either!

The problem is essentially isPrintPaused variable is cleared too early.
We should wait until the print is completely restored first.

Steps to reproduce:
1. Start a print
2. Pause the print
3. Wait for extruder temperature to fall at lest 180°C
4. Click 'Resume' print
5. While heating, stop the hotend fan and wait for a few seconds until an error is raised
6. Observe issue => 'Stop print' menu item is gone!

PFW-1542
2023-09-23 14:18:52 +00:00
vintagepc 4b66485f46
Fix leading v 2023-09-22 21:48:22 -04:00
VintagePC 98ae24caad Improve handling for http urls 2023-09-22 18:18:13 -04:00
VintagePC f4ec19d3c7 Add debugging 2023-09-22 18:08:59 -04:00
VintagePC 20540cc61b Set repository, if possible. 2023-09-22 17:57:41 -04:00
VintagePC b81a440b7c Do full fetch for versioning information 2023-09-22 17:31:33 -04:00
VintagePC a6d1985742 -Clear project timestamp if git was not used/found
-Add git as a runner tool for versioning
2023-09-22 17:22:05 -04:00
VintagePC a5aab6afd9 Fix PROJECT_VERSION_FULL if git is not available 2023-09-22 17:13:13 -04:00
VintagePC 949539dfc9 Merge remote-tracking branch 'upstream/MK3' into vintagepc/more-cmake-fixes 2023-09-22 16:42:06 -04:00
3d-gussner f8c64de505
Merge pull request #4390 from sarusani/mbl_mag_comp
MBL: Add magnet compensation parameter
2023-09-22 14:57:09 +02:00
3d-gussner c92c0fda38
Merge pull request #4398 from gudnimg/minor-opt-offset
optimisation: Remove unused Z offset
2023-09-22 14:56:26 +02:00
3d-gussner 1b6bdb787b
Merge pull request #4394 from vintagepc/MK3
Build firmware using Actions
2023-09-22 14:07:24 +02:00
VintagePC 2a2932e66d Reduce message duplication 2023-09-21 19:32:32 -04:00
VintagePC 605cc5d83a Actually enable annotations via ENV 2023-09-21 18:46:43 -04:00
VintagePC f7fbdadae7 Test annotations for language checks 2023-09-21 18:44:43 -04:00
VintagePC 6ceb750999 Fix missing toolchain 2023-09-20 19:13:12 -04:00
VintagePC 5ddac5cb6c - Make size share cache
- Add tests step
- Add lang-check step
2023-09-20 19:05:46 -04:00
Guðni Már Gilbert e323490659 optimisation: Remove unused Z offset
Frees up some SRAM

Change in memory:
Flash: 0 bytes
SRAM: -4 bytes
2023-09-19 23:37:38 +00:00
3d-gussner 1996f977e1
Merge branch 'MK3' into mbl_mag_comp 2023-09-18 15:55:42 +02:00
3d-gussner 8bd71b7bf0
Merge pull request #4391 from sarusani/mbl_default_to_eeprom
MBL: Default to EEPROM values
2023-09-18 15:52:38 +02:00
3d-gussner 039202f34b Fix typo 2023-09-18 15:48:36 +02:00
3d-gussner 0877585bd1 Add M420
Same as G81
2023-09-18 15:45:13 +02:00
D.R.racer 0f1cb4f407 Fixup from review 2023-09-18 10:51:32 +02:00
gudnimg 4134bf4f40 8-bit proposed changes
The status line code is not nice, but we need to work around it
so the status line rendering works correctly

This commit mostly reapplies the code
from 3.13.2

Also fixes compiler warnings
2023-09-18 10:51:32 +02:00
D.R.racer ea01012026 Unify MMU operations' workflow 2023-09-18 10:51:32 +02:00
D.R.racer a02ff0651c Return try-load reporting to serial 2023-09-18 10:51:32 +02:00
D.R.racer 59e49c80f9 Sync MK3<->MK4 MMU2 Tune, Buttons, PowerPanic hooks refactoring 2023-09-18 10:51:32 +02:00
D.R.racer 9b48ab729a Sync MK3<->MK4 MMU2 TryLoadUnloadReporter 2023-09-18 10:51:32 +02:00
D.R.racer 7db7250773 Sync MK3<->MK4 MMU2 mmu2_mk4.cpp formatting 2023-09-18 10:51:32 +02:00
D.R.racer be5523187b Sync MK3<->MK4 MMU2 mmu2_mk4.h 2023-09-18 10:51:32 +02:00
D.R.racer 075858c9fa Sync MK3<->MK4 MMU2 reporting 2023-09-18 10:51:32 +02:00
D.R.racer 5235fe2480 Sync MK3<->MK4 MMU2 marlin macros 2023-09-18 10:51:32 +02:00
D.R.racer b4b0bba11c Sync MK3<->MK4 MMU2 marlin interface 2023-09-18 10:51:32 +02:00
D.R.racer eb7a73e748 Sync MK3<->MK4 MMU2 log 2023-09-18 10:51:32 +02:00
D.R.racer fd9f4ffb9e Sync MK3<->MK4 MMU2 progress converter 2023-09-18 10:51:32 +02:00
D.R.racer ec4740fe53 Clean-up ProgressCodes and ErrorCodes parameters throughout the code 2023-09-18 10:51:32 +02:00
D.R.racer 717281cd87 Sync MK3<->MK4 MMU2 crc 2023-09-18 10:51:32 +02:00
D.R.racer f235976f26 Sync MK3<->MK4 MMU2 protocol logic 2023-09-18 10:51:32 +02:00
VintagePC 8c9b754b3f Add actions workflow for firmware build 2023-09-16 20:40:28 -04:00
Guðni Már Gilbert 6187b7eecf optimisation: use disable_heater() in more places
Change in memory:
Flash: -84 bytes
SRAM: 0 bytes
2023-09-16 14:26:09 +00:00
sarusani 84d353793d Fix typos 2023-09-16 12:38:14 +02:00
sarusani e4a10e5fab Move code_seen back into if statement
Same memory usage, but prettier to look at. :)
2023-09-15 14:11:27 +02:00
sarusani 56a79f88ef Optimise memory usage 2023-09-15 14:11:27 +02:00
sarusani 2951bc8af0 Default to eeprom values
Use eeprom values if provided parameters are out of bounds.
2023-09-15 14:11:27 +02:00
3d-gussner 9e794a47a4
Merge pull request #4386 from 3d-gussner/MK3_mbl_print_area_translations
🚧  Add new MBL message for #4183 and translation
2023-09-15 09:00:38 +02:00
3d-gussner adf2cd6afc Thanks to everyone for the translation updates.
@ingbrzy @leptun @petrubecheru @Hauzman @AttilaSVK @sarusani @Painkiller56 @vintagepc @stelgenhof
@wavexx @OS-kar @trondkla @arekm

I had to remove the French translation as it exceeds the limt. Only 53 bytes are free.
2023-09-15 08:40:45 +02:00
sarusani 21c57a1222 Add parameter for magnet compensation
allow to enable/disable magnet compensation when 7x7 is in use.
2023-09-14 21:02:56 +02:00
3d-gussner f193251977
Merge pull request #4389 from sarusani/mbl_rename_param_whitespace
Cleanup: whitespace in nProbeRetryCount var
2023-09-14 10:46:06 +02:00
sarusani 2863c9bc01 Cleanup: whitespace in nProbeRetryCount var 2023-09-14 09:43:26 +02:00
3d-gussner 5f605012eb
Merge pull request #4388 from prusa3d/vintagepc/tmc-mode-query
Add Q parameter to M91[4/5]
2023-09-14 09:13:55 +02:00
3d-gussner b652bee808
Merge pull request #4387 from sarusani/MBL_retries
MBL: Rename repeat param from R to C to avoid overlap
2023-09-14 08:42:54 +02:00
VintagePC 70d83fe4ee Add Q parameter to query current mode. 2023-09-13 16:52:11 -04:00
sarusani a9c8bb7dbf Code cleanup: rename params 2023-09-13 18:31:45 +02:00
sarusani d3bb6e5ca5 Rename MBL repeat param 2023-09-13 17:37:39 +02:00
3d-gussner 292c1acf29
Merge pull request #4385 from sarusani/cleanup_variants_mesh_def
Remove obsolete mesh definitions
2023-09-13 16:31:40 +02:00
D.R.racer 4c930594fc Update CZ translation 2023-09-13 14:39:56 +02:00
3d-gussner ca27841d67 Add new MBL message for #4183 and translate these messages 2023-09-13 11:14:16 +02:00
sarusani dc129e0934 Remove obsolete mesh definitions
Clean up mesh definitions that where made obsolete by #4183
2023-09-13 10:49:52 +02:00
3d-gussner 2e70697fa7
Merge pull request #4183 from leptun/mbl_print_area
MBL print area
2023-09-13 10:28:08 +02:00
3d-gussner 0aa380b931
Merge pull request #4206 from gudnimg/sd-card-menu-opt
optimisation: `menu_item == menu_line` is always true in `menu_item_sddir()` and `menu_item_sdfile()`
2023-09-13 07:49:43 +02:00
3d-gussner 73118dd4e2
Merge pull request #2474 from vintagepc/#2161-tune-x-y-rehome
Add X-Y home to tune menu if print is paused
2023-09-13 07:49:23 +02:00
3d-gussner f5d48cd029
Merge pull request #4342 from gudnimg/optimsation_timer_class
optimisation: Timer constructor can be `constexpr`
2023-09-13 07:48:43 +02:00
3d-gussner 9781e15eff
Merge pull request #4172 from gudnimg/statistics-menu-first-layer
Allow `Statistics` menu while running 1st Layer cal
2023-09-13 07:48:32 +02:00
vintagepc b7daac3b70 Direct home instead of G28 2023-09-12 18:41:14 -04:00
vintagepc b75e3b5233 facepalm commit
... I somehow managed to lose a bracket. DERP.
2023-09-12 18:33:27 -04:00
vintagepc ebc6663210 Add auto-home to tune menu 2023-09-12 18:33:27 -04:00
Guðni Már Gilbert ff6fd8cf4b Allow statistiscs menu while running 1st Layer cal
There is no problem with opening the menu during first layer
calibration. Removing this condition simplifies the code a little bit.

Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2023-09-12 20:26:43 +02:00
3d-gussner 74f724b228
Merge pull request #4174 from gudnimg/check_all_heaters
optimisation: use `CHECK_ALL_HEATERS` in more places
2023-09-12 16:31:45 +02:00
3d-gussner 019126778d
Merge pull request #1790 from jiri-jirus/MK3
y-axis self-test hack cleanup
2023-09-12 16:31:34 +02:00
3d-gussner 5050fd768b
Merge pull request #4150 from gudnimg/psu-delta-typo
Fix a typo in `PSU_Delta` define
2023-09-12 16:28:32 +02:00
3d-gussner f5259ee611
Merge pull request #4316 from gudnimg/fix-VERBOSE_CHECK_HIT_ENDSTOPS
Fix and optimise VERBOSE_CHECK_HIT_ENDSTOPS
2023-09-12 10:55:25 +02:00
3d-gussner ffbb720d34
Merge pull request #4365 from gudnimg/sync-with-32-bit
Explicitly use `Buttons` namespace
2023-09-12 10:53:21 +02:00
VintagePC 2b5e2dc9fe fix commit number handling 2023-09-11 18:53:20 -04:00
VintagePC f1ab89183d improve handling of invalid COMMIT_DSC 2023-09-11 18:24:52 -04:00
VintagePC 251e4ff370 Add default-off option to enforce config.h checks 2023-09-11 18:07:00 -04:00
3d-gussner c84985ec3e
Merge pull request #4328 from dawidpieper/m850_addselection
M850 add possibility to set sheet as active
2023-09-11 13:02:04 +02:00
VintagePC d8f7642058 Fix comment 2023-09-09 13:25:00 -04:00
VintagePC 2485c36391 Add dev status handling 2023-09-09 13:19:11 -04:00
VintagePC ab299e36d1 Use commit number as version tweak value 2023-09-07 19:38:07 -04:00
VintagePC 916d02824e Initial round of changes to address some cmake features 2023-09-07 18:46:47 -04:00
3d-gussner 7cdd175cb8
Merge pull request #4366 from prusa3d/vintagepc/rebase_pr3665
Rebases PR3665 onto latest MK3
2023-09-06 08:53:17 +02:00
VintagePC 3673b68356 Fix rebase fallout 2023-09-04 08:40:51 -04:00
Yuri D'Elia 334bfe4d29 build: Set all version data based on git tags
Drop the ALPHA/BETA/custom version handling. Set the version string and
firmware date based on the current tree description which has all the
required details.

Allow to override the repository information via cmake.

Use a truncated commit hash to set the internal commit number for
compatibility.

Rebase and fix issues
2023-09-04 08:35:15 -04:00
Yuri D'Elia 80594880cd cmake: Simplify version handling based on git tags
- Use the HEAD commit hash as the default suffix
- Use the output of "describe" as the full version string
- Use the HEAD commit time as SOURCE_DATE_EPOCH
2023-09-04 08:35:15 -04:00
Yuri D'Elia 2e1eb4f84a cmake: Update GetGitRevisionDescription module 2023-09-04 08:35:15 -04:00
3d-gussner c180bc85ff
Merge pull request #4363 from 3d-gussner/MK3_Fix_Cal_menu_shown
Fix Calibration menu shown during resuming
2023-09-04 06:21:11 +02:00
gudnimg e0269d6f6a Explicitly using Buttons namespace
This change sync the code a little bit with the 32-bit FW

No change in memory
2023-09-03 12:41:39 +00:00
3d-gussner 77a4b99f5e Fix Calibration menu shown during resuming 2023-09-01 16:18:57 +02:00
3d-gussner 4c53163068
Merge pull request #4357 from DRracer/z-stall-xyz-workaround
Force-move-Z after searching for XY calibration points
2023-08-31 08:21:43 +02:00
3d-gussner a28779b08f
Merge pull request #4355 from wavexx/lang_hardcode
lang: Do not hardcode python executable name
2023-08-31 08:19:14 +02:00
3d-gussner 4a4eacd8fd
Merge pull request #4356 from wavexx/lang_warning
lang/mmu: Translate MMU menu strings within caller
2023-08-31 08:18:58 +02:00
D.R.racer abdfe07f3f Force-move-Z after searching for XY calibration points
Bogus StallGuard readings may prevent the Z from moving at this spot which will result in other nasty behaviour.
2023-08-31 07:48:28 +02:00
Yuri D'Elia 2bfd56cd30 lang/mmu: Translate MMU menu strings within caller
This fixes the undefined _T(label) reference, at the expense of a few
extra bytes.

I would argue this is worth the cost for the ability to check
translation references for the future. The warning happens because
`lang-check` cannot check a reference which is not _directly_ a catalog
entry.

We could introduce a method to suppress this warning (either a new macro
or some ///IGNORE comment), but that would mean that the additional
translation check is completely bypassed, defeating the purpose.
2023-08-30 18:54:57 +02:00
Yuri D'Elia 105a6b9438 lang: Do not hardcode python executable name
Use sys.executable instead to ensure the executable used by "env" is
kept.
2023-08-30 18:51:25 +02:00
3d-gussner 9e09e5014c
Merge pull request #4347 from prusa3d/Adjust-stale-workflow
Update stale.yml
2023-08-25 15:11:30 +02:00
vintagepc 43b97275bc
Update stale.yml 2023-08-25 09:00:39 -04:00
3d-gussner d84e3a9cf3
Merge pull request #4343 from 3d-gussner/MK3_3131_Translations
Update Version and Translations for 3.13.1
2023-08-22 06:46:51 +02:00
3d-gussner 47775e158b Reuse messages 2023-08-21 19:00:22 +02:00
3d-gussner aefa02c1a4 Fix German 2023-08-21 17:59:16 +02:00
3d-gussner 0bbec5626c Update and fix translations 2023-08-21 16:28:36 +02:00
Guðni Már Gilbert 5bf9bf7507 optimisation: reduce code size in MMU filament menus
Change in memory:
Flash: -156 bytes
SRAM: 0 bytes
2023-08-21 07:29:43 +02:00
Guðni Már Gilbert 1881c5f086 Fix filament actions not cleared properly
We can't clear eFilamentAction in every case in mFilamentItem()

mFilamentItem() can trigger a call to M701 and M702 e.g. for Autoloading
and eFilamentAction must be cleared by the gcode to prevent
the user from triggering another Autoload (which will crashe the FW)

The same applies to submenus. Now the MMU submenus clear eFilamentAction
only when the action is done.

For MMU Unload Filament item, eFilamentAction is only cleared after
the unload_filament() call is done running. This fixes an issue where
the menu item can be selected again while the first unload is still
running.
2023-08-21 07:29:43 +02:00
sarusani c4c26050d3 Fix screen update after PFW-1531 2023-08-21 06:36:25 +02:00
sarusani 6c0f80e680 Add static_assert check for TEMP_HYSTERESIS 2023-08-21 06:35:32 +02:00
sarusani 0d097d5a62 Fix TEMP_HYSTERESIS calculation 2023-08-21 06:35:32 +02:00
Guðni Már Gilbert 7c7d6b1671 Fix issue with Tune item appearing on MMU FW UPDATE screen 2023-08-21 06:33:14 +02:00
Guðni Már Gilbert a89e06a54e optimisation: Timer constructor can be constexpr
Change in memory:
Flash: -206 bytes
SRAM: -16 bytes
2023-08-20 19:39:38 +00:00
Guðni Már Gilbert cabc44194a optimisation: menu_item == menu_line is always true
The if statement is checked in lcd_sdcard_menu()

so checking it again these functions is
redundant since it's always going to be true.

Tested on MK3S+

Change in memory:
Flash: -22 bytes
SRAM: 0 bytes
2023-08-20 08:19:01 +00:00
Yuri D'Elia 2a71e681db cmake: Cache CUSTOM_COMPILE_OPTIONS
This allows persisting custom flags across builds, as intended.
2023-08-18 14:30:10 +02:00
D.R.racer 94eb4d8f0a Update NO translation 2023-08-18 14:27:39 +02:00
D.R.racer cfbe74b960 Update PL translation 2023-08-18 14:27:39 +02:00
D.R.racer d2ce4cfb88 Update HR, HU, RO, SK translations 2023-08-18 14:27:39 +02:00
D.R.racer fb8bf8bf58 Improve CS, SK translations 2023-08-18 14:27:39 +02:00
3d-gussner 5209715c11 Update po files and translate new messages 2023-08-18 14:27:39 +02:00
Guðni Már Gilbert 60534738d3 PFW-1522 Don't increment failure statistic on filament change 2023-08-18 14:27:39 +02:00
Guðni Már Gilbert e6f05e7856 PFW-1522 Fix firmware getting stuck on ejecting
If slot is unknown, the printer will always get a rejected command
error from the MMU.

Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-08-18 14:27:39 +02:00
Guðni Már Gilbert c7360055ae PFW-1522 Make Load the default button choice
No change in memory
2023-08-18 14:27:39 +02:00
Guðni Már Gilbert 814169a213 PFW-1522 Update screen description
Change in memory:
Flash: +32 bytes
SRAM: 0 bytes
2023-08-18 14:27:39 +02:00
Guðni Már Gilbert fc18f4c5d7 PFW-1522 Implement filament change screen
Change in memory:
Flash: +116 bytes
SRAM: +1 byte
2023-08-18 14:27:39 +02:00
Alex Voinea ede4cc5d30
Update error messages 2023-08-17 08:02:47 +02:00
Alex Voinea 45823e7336
Make the G80 Z threshold tighter 2023-08-17 08:02:47 +02:00
Alex Voinea f5f09f147c
Add a limit to how many times G80 can fail
Flash: +80
SRAM: +1
2023-08-17 07:53:39 +02:00
Alex Voinea 7740a81edb
Do not store a global mbl_z_probe_nr
flash: -6
sram: 0? (somehow)
2023-08-17 07:53:39 +02:00
Alex Voinea a984b2e609
G80 `O` parameter
a
2023-08-17 07:53:39 +02:00
Alex Voinea a15f536ff4
Combine BED_X/Y() and mbl::get_x/y()
flash: -112
2023-08-17 07:52:55 +02:00
Alex Voinea aba0450615
mbl.get_z() optimizations
Those constrains on t and s were useless.

flash: -294
2023-08-17 07:52:55 +02:00
Alex Voinea dd1bde74dc
Fix Z calibration points 2023-08-17 07:52:55 +02:00
Alex Voinea 42c27cabde
Remove unused code 2023-08-17 07:52:55 +02:00
Guðni Már Gilbert a9d0cc5e56
optimisation: Move divison into constexpr
Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2023-08-17 07:52:55 +02:00
Guðni Már Gilbert 6b12be42d9
optimisation: Make BED_X and BED_Y into functions
Previously these preprocessor macros were always being inlined.
By making these into a function we can control the inlining
more directly.

The number of points on the mesh is also now constant. This means
'n' can now be float at compile time. This removes one uint8_t to float
conversion.

Change in memory:
Flash: -208 bytes
SRAM: 0 bytes
2023-08-17 07:52:55 +02:00
Alex Voinea 3ccf2d60c0
Make bed correction matrix const 2023-08-17 07:52:55 +02:00
Alex Voinea be3465cf18
optimize lambda expression capture
flash: -10
2023-08-17 07:52:55 +02:00
Alex Voinea 2d0b96fe6a
Bed correction code optimization
flash: -44
2023-08-17 07:52:55 +02:00
Alex Voinea 5b8c65e342
Minor magnet elimination optimization
flash: -4B
2023-08-17 07:52:55 +02:00
Alex Voinea 67945579de
G80 minor optimization 2023-08-17 07:52:55 +02:00
Alex Voinea a5c20a1c6e
Do not plan a Z move if no move is actually performed 2023-08-17 07:52:55 +02:00
Alex Voinea de98551691
Extract hardcoded value 2023-08-17 07:52:55 +02:00
Alex Voinea 40db9c9258
Fix eeprom mesh offset 2023-08-17 07:52:55 +02:00
Alex Voinea a7d3dd720b
Fix eeprom mesh interpolation 2023-08-17 07:52:55 +02:00
Alex Voinea 36d8de0727
G80 general fixes
Use interpolated eeprom mesh for skewed Z detection
Use the interpolated eeprom mesh for raising Z for the next point
Fix LCD countdown during MBL
2023-08-17 07:52:55 +02:00
Alex Voinea b234560b22
MBL print function optimization 2023-08-17 07:52:55 +02:00
Alex Voinea f94bc72235
Optimize G80 bed correction argument parsing 2023-08-17 07:52:55 +02:00
Alex Voinea 90c21425c6
Optimize is_bed_z_jitter_data_valid() 2023-08-17 07:52:55 +02:00
Alex Voinea 6c97907507
A bit more cleanup 2023-08-17 07:52:55 +02:00
Alex Voinea 6af5f5e2a2
Some code cleanup around homing_feedrate 2023-08-17 07:52:55 +02:00
Alex Voinea 83879fd10c
Cleanup magnet compensation code 2023-08-17 07:52:55 +02:00
Alex Voinea 46710c4b4e
G80 code cleanup 2023-08-17 07:52:55 +02:00
Alex Voinea 07b9447ee1
Fix correction nMeasPoints 2023-08-17 07:51:15 +02:00
Alex Voinea fbfc6bf4a5
MBL remove MBL_BILINEAR 2023-08-17 07:51:15 +02:00
Alex Voinea 8edfff39e4
MBL code cleanup 2023-08-17 07:51:15 +02:00
Alex Voinea a4ef72b1fc
Use mesh from eeprom during print area MBL 2023-08-17 07:51:15 +02:00
Alex Voinea 7b9f2086f4
MBL print area initial implementation 2023-08-17 07:51:15 +02:00
Alex Voinea 11e1806e0c
Gcode documentation 2023-08-17 07:51:15 +02:00
Yuri D'Elia cfc8ffe8a3 cmake: Set source epoch from the HEAD commit
Allow to set the source epoch of the build with
PROJECT_VERSION_TIMESTAMP.

When unset fetch the commit timestamp of the current HEAD automatically
instead of leaving the source as 0. This fixes the firmware DATE
information in the support menu.
2023-08-17 07:46:47 +02:00
Guðni Már Gilbert c4f48a6606 MMU: Disable FINDA runout during Homing and MBL
If for some reason a user added a extrusion move in the firmware. Prevent FINDA runout
from triggering.

Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2023-08-17 07:43:59 +02:00
Guðni Már Gilbert 61ec6b8ae7 G80: Don't unretract unless retracting first
temp_compensation_start() is only called when
PINDA_THERMISTOR is not defined.
Additionally make sure the retraction or unretraction cannot happen
twice in case MBL fails.

For MK3S users with MMU this extrusion move could
cause a FINDA runout event.

Change in memory:
Flash: -130 bytes
SRAM: 0 bytes
2023-08-17 07:43:59 +02:00
dawidpieper 14306e59c8 Try immediate EEPROM writes for flash size optimization 2023-08-16 20:36:24 +02:00
dawidpieper 1dada5ba81 Revert optimizations of bIsActive 2023-08-16 20:18:16 +02:00
dawidpieper 91cb01b12f Code optimization 2023-08-16 20:08:53 +02:00
dawidpieper b2f6b77cf3 Add separators between blocks 2023-08-16 19:46:57 +02:00
dawidpieper 58014156a0 Fix code formatting 2023-08-16 19:18:33 +02:00
Guðni Már Gilbert 0e469c054f Fix disappearing menu items when Filament Action completes
An example is when Unloading filament with MMU.

After the unload completes successfully, some menu items disappeared.
Because mFilamentBack() was not called

Change in memory:
Flash: -56 bytes
SRAM: 0 bytes
2023-08-16 08:22:03 +02:00
Guðni Már Gilbert 1bf33bd1aa Fix a bug where Load filament menu disappears
Kudos to @3d-gussner for finding the issue

Steps to reproduce:
1. reset printer
2. select Load filament
3. go back to main
4. LCD menu is very limited
5. To get all menus back select 6. Preheat
7. back to main

This commit is my proposed fix.

When eFilamentAction is equal to
FilamentAction::Load we must reset it to FilamentAction::None
when the Back button in Load Filament is selected

Change in memory:
Flash: -26 bytes
SRAM: 0 bytes
2023-08-16 08:22:03 +02:00
dawidpieper 11d8c157f6 M850 add possibility to set sheet as active 2023-08-15 22:19:55 +02:00
Guðni Már Gilbert 3766aadd99 PFW-1530 rename isErrorScreenSleeping to TuneMenuEntered 2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 92b3a2443e PFW-1530 Remove typedef keyword 2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 03ed675732 PFW-1530 cleanup: remove redundant uint8_t cast 2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 5d9ccc59b7 PFW-1530 fixup 2023-08-14 09:34:55 +02:00
Guðni Már Gilbert f0a48b11f7 PFW-1530 Refactor the menu to be non-blocking
The UI works much smoother now

Saves ~60 bytes of flash
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert efd85110a3 PFW-1530 minor optimisation
Don't inline WriteRegister

Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 1cda696e14 PFW-1530 Add Tune to Selector screen and more
- Rename "Idler" to "Sensitivity"
- Implement ReadRegisterInner() as a way to read register in blocking contexts such as manage_response()
This allows us to show the current EEPROM value on the printer's LCD
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 9e4fd08031 mmu2: cleanup: use Register enum 2023-08-14 09:34:55 +02:00
Guðni Már Gilbert d0f18b6fbc PFW-1530 Minor optimisation
Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert 5f60eaff85 PFW-1530 Initial prototype
Add a 'Tune' option to HOMING_IDLER_FAILED error

This will open a menu which allows
the user to change the stallguard threshold
from the MMU error screen

Change in memory:
Flash: +334 bytes
SRAM: +1 byte
2023-08-14 09:34:55 +02:00
Guðni Már Gilbert d545469e32 Fix and optimise VERBOSE_CHECK_HIT_ENDSTOPS 2023-08-13 13:44:40 +00:00
3d-gussner c708456184
Merge pull request #4161 from gudnimg/simplify-tcodes-code
MMU: Simplify `T?` processing
2023-08-11 14:31:57 +02:00
D.R.racer 09ab354d7a Update PO/POT files accordingly 2023-08-11 11:09:53 +02:00
D.R.racer d2991ce1e0 Increase required MMU FW version to 3.0.1 2023-08-11 11:09:53 +02:00
Alex Voinea ef63b57dfd Remove unimplemented M407 from list of gcodes 2023-08-11 09:02:11 +02:00
3d-gussner 500a6558a5 Rebase, fix and update doxygen 2023-08-11 09:02:11 +02:00
Michael Greene f449b06bb2 reprocess patch so I don't have 1200 lines of whitespace changes to review 2023-08-11 09:02:11 +02:00
vintagepc b432f6c5b9
Merge pull request #4321 from prusa3d/Modify-stale-settings
Update stale.yml
2023-08-10 07:55:05 -04:00
vintagepc a39eb92583
Update stale.yml
Reverse processing order
Update version to fix node warning
2023-08-10 07:25:21 -04:00
vintagepc c93685ba5b Update stale.yml 2023-08-07 14:55:11 +02:00
vintagepc c276467e51
Merge pull request #2327 from vintagepc/2089-fix-sheet-rename-cursor
#2089 fix sheet rename cursor
2023-08-05 12:38:53 -04:00
VintagePC ea5bcc5eea Implement #2089 2023-08-05 12:19:51 -04:00
Guðni Már Gilbert 503c01aa57 tmc2130: write chopper config and powerdown setting first
I noticed this is how the order is in 3.13.0 and before.
I want to keep it exactly the same.

This somehow saves 2 bytes of flash. Probably compiler magic.

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-08-05 10:41:21 +02:00
Guðni Már Gilbert 02332018ec tmc2130: Fix bug with vSense bit and current values
If vSense changes at runtime due to Run current
being changed. Then we must always shift the Hold current
correctly. Whether the vSense is changing 1 -> 0 or 0 ->1

Change in memory (with TMC2130_SERVICE_CODES_M910_M918):
Flash: +76 bytes
SRAM: 0 bytes
2023-08-05 10:41:21 +02:00
gudnimg a1a3194985 tmc2130: Fix wrong values report by M913 when Hold > Run
The firmware will ensure that the Hold current can never
exceed the Run current. In this scenario we must update
the global current array so that M913 reflects the register settings.

Added a echo to serial when this truncation happens

Change in memory:
Flash: +54 bytes
SRAM: 0 bytes
2023-08-05 10:41:21 +02:00
Guðni Már Gilbert ec921eb53b MMU: Add enum class for register map
No change in memory
2023-08-05 10:36:00 +02:00
Yuri D'Elia cf0116ea74
Merge pull request #4315 from wavexx/pr_size_table
CI/pr-size: Generate a markdown table
2023-08-04 19:29:13 +02:00
Yuri D'Elia 8083cb4c2c CI/pr-size: Generate a markdown table 2023-08-04 19:17:38 +02:00
Guðni Már Gilbert 95d8711469 PFW-1531 Fix #4300
No change in memory
2023-08-04 17:02:03 +00:00
3d-gussner 035da6d061
Merge pull request #4313 from wavexx/pr_size_target
CI: Automatically calculate PR "cost"
2023-08-04 18:42:53 +02:00
Yuri D'Elia b9381d5278 CI/pr-size: Use pull_request_target to get write permission
- Build and use pr-size from the base branch
- Compare against the PR in a second step
2023-08-04 18:13:07 +02:00
Yuri D'Elia 18dc28b148 CI/pr-size: Build MULTILANG variants 2023-08-04 17:49:18 +02:00
vintagepc c8347b7e8f Initial stale issue workflow 2023-08-04 14:28:15 +02:00
3d-gussner b1da06859c
Merge pull request #3494 from wavexx/lcd_temperature_jumping
Jump to PLA temps in LCD temperature settings when starting from zero
2023-08-02 14:21:53 +02:00
3d-gussner 491d4d2a20
Merge pull request #4080 from gudnimg/PFW-1504-v2
PFW-1504 fix conflicting UI issues
2023-08-02 12:59:27 +02:00
3d-gussner 2ab9cbcd83
Merge pull request #923 from cwei/patch-1
Fix upper limit for x
2023-08-02 12:05:38 +02:00
3d-gussner ce013b35c9
Merge pull request #4298 from wavexx/lcd_tm_cal_fix
TM: Fix TM calibration from the Calibration menu
2023-08-01 16:34:00 +02:00
Yuri D'Elia 719db8f537 Optimize menu editing by reducing template duplication
Avoid instantiating multiple copies of menu_item_edit_P/_menu_edit_P:
perform type switching at runtime.
2023-08-01 12:41:38 +02:00
Yuri D'Elia baacc0ec53 TM: Fix TM calibration from the Calibration menu
After dece5d268f, running the thermal
model itself switches the printer to "active", preventing a calibration
run from the LCD to start.

Explicitly allow LcdCommands::ThermalModel in this case.
2023-08-01 11:54:10 +02:00
Yuri D'Elia 92202249d9 Make temperature jumping configurable in the variant file
Use this new feature in the Settings -> Temperature menus.
2023-07-31 16:04:33 +02:00
Yuri D'Elia 5ad21550c7 Jump to PLA temps in LCD settings when starting from zero
Allow the LCD menu update function to preset an initial value during the
first encoder increase from the minimal (usually zero) value.

This is useful to jump to a more sensible initial value when turning on
an heater which is currently disabled. The user is still allowed to
decrease the value after the jump, so there's no functional restriction.
2023-07-31 16:04:16 +02:00
3d-gussner 1030a3ab1d
Merge pull request #4283 from gudnimg/power-panic-fix-m600
m600: power panic: unset isPartialBackupAvailable on M600 exit
2023-07-31 12:10:06 +02:00
Guðni Már Gilbert a96ee9da62 m600: power panic: unset isPartialBackupAvailable on M600 exit
If no power panic occurred during M600 we should
clear isPartialBackupAvailable to let the power panic
code know to not use the partial backup. We want the
partial backup ONLY when the extruder is parked after a print is saved.

Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-07-27 16:55:08 +00:00
Guðni Már Gilbert 7e025894d1 Echo the result onto serial
Example:
MMU2:1111111111111110011
1 means filament present (solid block)
0 means otherwise (dash)

Change in memory:
Flash: +94 bytes
SRAM: 0 bytes
2023-07-27 16:44:34 +00:00
Guðni Már Gilbert 20c6a448fa PFW-1504 Don't clear Status line on Deinit
Status line code should decide what to render next

Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2023-07-27 16:44:34 +00:00
Guðni Már Gilbert 940e626f3a Previously we called cleared the LCD, no need to change that
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-07-27 16:44:34 +00:00
Guðni Már Gilbert 28f6cebfd2 PFW-1504 Cleanup
Only set cursor with lcd_status_message_idx where the variable
is used.

No change in memory
2023-07-27 16:44:34 +00:00
Guðni Már Gilbert 63775dfabb PFW-1504 fix conflicting UI issues
Proposal to fix some of the issues with the initial implementation
it is safer to use the status line code to print the message so
there aren't any conflicts in the LCD cursor position.

Allow inserting a byte into any position in the LCD status message

Also, add a variable to control from which index in the array
should the message start printing. This is very useful for progress
bars and messages which continually update. I think we can save some
memory by applying this to Mesh Bed Leveling later.

Change in memory:
Flash: +106 bytes
SRAM: +1 byte
2023-07-27 16:44:34 +00:00
3d-gussner 320997a1f5
Merge pull request #3859 from wavexx/simplify_variant_names
Simplify variant names
2023-07-27 15:44:58 +02:00
3d-gussner 07d7bfa8a4
Merge pull request #4053 from vintagepc/2477-redux
#2477 Improved M-code control for stealth mode/normal mode
2023-07-27 15:44:22 +02:00
vintagepc a2eafc587a
Merge branch 'MK3' into 2477-redux 2023-07-26 12:34:38 -04:00
3d-gussner 8d66a2864f Simplify REVO variants 2023-07-26 16:46:17 +02:00
Yuri D'Elia caf3f2dec6 README: Update example target name 2023-07-26 16:42:13 +02:00
Yuri D'Elia c093bac4bc build: Update variant names in the legacy build system
Fix rebase conflicts
2023-07-26 16:42:02 +02:00
Yuri D'Elia a73fdec4ef cmake: Remove prefix/suffix exceptions
Now handled by having shorter variant names
2023-07-26 16:40:26 +02:00
Yuri D'Elia cb8f68192a build: Simplify variant names
- Remove nozzle size and heater type
- Also remove board type from MK3/MK3S
2023-07-26 16:40:26 +02:00
3d-gussner ce141a2fa1
Merge pull request #3564 from wavexx/fil_loading_state
Filament loading state fixes
2023-07-26 16:38:29 +02:00
3d-gussner cc84e326fe
Merge pull request #4224 from 3d-gussner/MK3_Rename_Thermal_model
Rename temp model to thermal model
2023-07-26 16:37:48 +02:00
3d-gussner 897d05d268 Fix @wavexx complains 2023-07-26 09:33:16 +02:00
3d-gussner 6feab85252 Rebase update REVO and solve @wavexx comments 2023-07-25 17:24:02 +02:00
3d-gussner 8ae0e1952e Rename `temp_model.h` to `thermal_model.h`
`/temp_model` to `/thermal_model`
`Temperature_model` to `Thermal_model`
minor format in eeprom.h
2023-07-25 17:13:07 +02:00
3d-gussner 940b18e0b2 Format `eeprom.h` doxygen documentation 2023-07-25 17:13:07 +02:00
3d-gussner a6b209d36d Rename `Temperature Model` to `Thermal Model`
`Temperature model` to `Thermal model`
`temperature model` to `thermal model`
2023-07-25 17:13:07 +02:00
3d-gussner 78ed427166 Rename `TempModel` to `ThermalModel` 2023-07-25 17:13:07 +02:00
3d-gussner 600a7a0316 Rename `Temp Model` to `Thermal Model` 2023-07-25 17:13:07 +02:00
3d-gussner 44ae8033eb Rename upper case `TEMP_MODEL` to `THERMAL_MODEL` 2023-07-25 17:13:07 +02:00
3d-gussner dac07d11ba Rename lower case `temp_model` to `thermal_model` 2023-07-25 17:13:07 +02:00
Guðni Már Gilbert 780f2db3d1 fixup 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert c647e4cfa4 fix build 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert f40defd2a9 Rename minsegmenttime --> min_segment_time_us
Also fixed wrong unit in Configuration prinout (M500)
should be us and not ms

Also used %lu format for uint32_t instead of %.2f
2023-07-25 17:10:44 +02:00
Guðni Már Gilbert 842dcc6560 Remove MAX_E_STEPS_PER_UNIT and MIN_E_STEPS_PER_UNIT
These constants are not used anywhere so there is no need to rename them
I propose they be removed as cleanup
2023-07-25 17:10:44 +02:00
Guðni Már Gilbert ec896df62a Remove commented DEFAULT_AXIS_STEPS_PER_UNIT
They serve no function at this point
2023-07-25 17:10:44 +02:00
Guðni Már Gilbert 6c95d340c1 Remove dead code axis_travel_steps_per_sqr_second 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert a8c75090b2 Change unsigned long to uint32_t 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert 8689a28776 Rename max_acceleration_units_per_sq_second to max_acceleration_mm_per_s2 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert 21faa52aab Rename axis_steps_per_unit to axis_steps_per_mm 2023-07-25 17:10:44 +02:00
Guðni Már Gilbert ff1cd2bfb2 dcodes: fix build when DEBUG_DCODES is enabled 2023-07-25 15:02:49 +00:00
Guðni Már Gilbert 5b8813bf18 tmc2130: fix octoprint error 2023-07-25 15:02:49 +00:00
Guðni Már Gilbert fa6aae60db optimisation: use SERIAL_PROTOCOLLN
Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2023-07-25 15:02:49 +00:00
Guðni Már Gilbert 9d15a4e63b optimisation: reduce code size in M916, M917, M918
Change in memory:
Flash: -148 bytes
SRAM: 0 bytes
2023-07-25 15:02:49 +00:00
Guðni Már Gilbert c090868fa2 optimisation: reduce code size in M907
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-07-25 15:02:49 +00:00
Guðni Már Gilbert 53c8bfa928 cleanup: remove unused variable
No change in memory
2023-07-25 15:02:49 +00:00
Guðni Már Gilbert 7029af05fa optimisation: reduce code size in pid_extruder()
Author: leptun

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-07-25 15:02:49 +00:00
Guðni Már Gilbert 6623d45af9 optimisation: Tighter LCD timing
Author: leptun

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-07-25 15:02:49 +00:00
Guðni Már Gilbert 5288d615f8 optimisation: lcd avoid streams
Author: leptun

Change in memory:
Flash: -124 bytes
SRAM: 0 bytes
2023-07-25 15:02:49 +00:00
Yuri D'Elia 3485c20464 Improve FilamentAction comments 2023-07-25 14:30:20 +00:00
Yuri D'Elia 074b5d380f Consistently replace loading_flag with eFilamentAction
Remove loading_flag and check for eFilamentAction instead which already
flags both load/unload (in addition to mmu actions).

Correctly transition from AutoLoad to Load as soon as the operation
cannot be cancelled anymore as opposed to resetting it.
2023-07-25 14:30:20 +00:00
Yuri D'Elia 05b536947b Refuse to start a SD print until filament loading is complete
Do not blidnly clear the loading_flag, check for it!

Just disallowing the SD menu while loading is being performed is not
sufficient, since the menu can be entered also by inserting card while
loading is taking place.

This is also nicer in behavior, as we allow to navigate the SD card
while loading.
2023-07-25 14:28:46 +00:00
Yuri D'Elia e3fd6a4902 Do not allow filament actions while an existing one is taking place 2023-07-25 14:28:45 +00:00
Yuri D'Elia 170dddfd71 Set/clear loading_flag also during unload 2023-07-25 14:28:13 +00:00
Yuri D'Elia dece5d268f Consider any lcd_custom_command to be "ACTIVE"
All custom commands are transitory and eventually switch back to Idle
state by themselves.

It doesn't make any sense to explicitly check for Layer1Cal: any
non-idle state is active by design.

Fix this check in the main menu. This is probably incomplete (Layer1Cal
is incorrectly used in several other places).
2023-07-25 14:27:00 +00:00
Guðni Már Gilbert 5d880919f8 Align comment 2023-07-25 09:00:47 +02:00
Guðni Már Gilbert d5f4f6700d Optimise the acceleration limit checks
Kudos goes to Marlin FW

Change in memory:
Flash: -314 bytes
SRAM: 0 bytes
2023-07-25 09:00:47 +02:00
Guðni Már Gilbert 1984091c10 Rename axis_steps_per_sqr_second to max_acceleration_steps_per_s2 2023-07-25 09:00:47 +02:00
Guðni Már Gilbert c067318427 cleanup language menu
Change in memory:
Flash: -50 bytes
SRAM: 0 bytes
2023-07-25 08:58:52 +02:00
Guðni Már Gilbert 0ab10a9df6 tmc2130: chopconf: add comments to structure 2023-07-25 08:56:43 +02:00
Guðni Már Gilbert ed13d008d9 tmc2130: minor code cleanup
Using tmc2130_wr() instead makes the code a bit more
aligned and easier to read IMO

No change in memory
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert 3819f7a473 tmc2130: Refactor code for setting/changing currents
- Always re-calculate the Vsense flag when the currents are changed
- Make sure Hold current is not larger than Run current
- Added SetCurrents() function from MMU FW
- Added MotorCurrents structure from MMU FW
- Various code size optimisations e.g. in power panic

Change in memory:
Flash: -10 bytes
SRAM: +4 bytes
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert a87faba2bd tmc2130: pull TMC2130_CNSTOFF_E outside tmc2130_setup_chopper
We can probably improve tmc2130_chopper_config further by adding
a constructor.

No change in memory
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert 664d4e2bbe tmc2130: chopconf: Add constructor to ChopConfU
Removed redundant initialisations which the constructor now takes care of

Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert bb8ebbb5e3 tmc2130: chopconf: simplify intpol config
Pull the preprocessor code outside tmc2130_setup_chopper

No change in memory
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert 2d2ab6e889 tmc2130: chopconf: simplify dedge code
move dedge preprocessing out of tmc2130_setup_chopper

We can use default_dedge_bit to initialise
the dedge bit in the chopconf constuctor later

No change in memory
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert 3842a5c98c optimisation: correctly reset registers in tmc2130_home_exit
Previously Z-axis would not be reset to
TMC2130_GCONF_DYNAMIC_SGSENS
in tmc2130_home_exit() when
TMC2130_STEALTH_Z is defined

Pulled configuration code into one common function
this ensures the registers are set correctly like in tmc2130_init()

Change in memory:
Flash: -206 bytes
SRAM: 0 bytes
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert 60f1c2095f optimise tmc2130_setup_chopper further
Reduce code duplication

Change in memory:
Flash: -50 bytes
SRAM: 0 bytes
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert ae1a7898dc optimisation: use union in for TMC2130 PWMCONF
Simplify writing the value to PWMCONF by
gathering all the bits into one dword.

Change in memory:
Flash: -128 bytes
SRAM: 0 bytes
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert 06100e366c optimisation: use union in tmc2130_setup_chopper
An idea from the MMU FW

Change in memory:
Flash: -278 bytes
SRAM: 0 bytes
2023-07-25 08:56:43 +02:00
Guðni Már Gilbert 6aff3c761b XYZCal: reduce code size in go_manhattan
The variable always takes a value of subtraction
between two int16_t values. It will also fit into int16_t

Change in memory:
Flash: -50 bytes:
SRAM: 0 bytes
2023-07-24 08:15:03 +02:00
Guðni Már Gilbert 5cfdceb184 Remove redundant lcd_draw_update assignment
When scrolling through menu items, the rotation event on the knob
takes care of updating the LCD by setting lcd_draw_update.
The menu code doesn't need to do it as well.

Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-07-24 08:13:36 +02:00
Yuri D'Elia 1fea4a7335 catch2: Fix build with gcc13
Cherrypick of catch2 commit 52066dbc2a53f4c3ab2a418d03f93200a8245451 to
fix the build with gcc 13 without a full update.
2023-07-24 08:07:28 +02:00
Guðni Már Gilbert 57d780ccf9 PFW-1519 Hide Preload to MMU menu item if filament is detected
This is by far the simplest solution to prevent the user from sending
a Load command to the MMU when the FINDA or Filament sensor
is detecting a filament. This may even happen if the sensors are poorly positioned.

Either way a Load in this scenario will make the MMU seem to hang as the
state machine will reject the command.

We could add a full screen message to let the use know
but it would require some memory resources.

For now, just hide the menu item.

Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2023-07-24 08:05:50 +02:00
Addio d4733664a8
Fixed printer_smodel_check for MK3/S and possible older MMU machines (#4265)
Fixed printer_smodel_check for non MMU machines
Commit 136ef96 broke the compatibility check for MK3S without MMU.

May have fixed bug for older MMU machines.
Only comparing up to the length of the value from the g-code, would return equal on older MMU machines trying to run g-code sliced without the MMU.
Unfortunately if that is a feature, it will cause the different printer warning.
2023-07-21 16:02:32 +02:00
D.R.racer 43c823987c MMU version 3.0.0
PFW-1529
2023-07-20 12:44:29 +02:00
D.R.racer d67fc84b73 Relink MSG_DESC_INSPECT_FINDA in PO files 2023-07-20 12:32:30 +02:00
D.R.racer ffb6a2ae0c Generalize description of MMU MCU power errors
as requested in Prusa-Error-Codes PR#97

There will be more separate sources of MCU power errors in the future and reporting each of them separately doesn't make much sense
- especially when the only thing a user can do about it is to check the connectors.

So based on this, the error title has changed a bit (we are not using the full text description in 8bit FW)

Also, update perform the related changes in PO files + add (machine generated) translations.
2023-07-20 12:32:30 +02:00
Guðni Már Gilbert 03e7ff1983 power panic: optimise incrementing EEPROM statistics
Change in memory:
Flash: -26 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 2cd5ab2349 power panic: add readable flags and optimise ISR(INT4_vect)
Add more readable names for the EEPROM_UVLO values

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 4dc5d97ca9 power panic: remove unused EEPROM_UVLO_Z_MICROSTEPS
It isn't very helpful IMO to have unused code during power panic
it just complicates things.

Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert d5125c6b1e power panic: refactor log output on recovery
Use M114 to print coordinates for all axis. We save
a lot of memory by reusing the M114 code

Change in memory:
Flash: -184 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 005f9f0d24 power panic: Fix an error in saved position
planner_abort_hard() calls planner_reset_position() which
will set current_position vector to the machine position.
We want to save this position when there is no position already saved
(i.e. when there is no partial back-up or a saved print in RAM)

When a power outage comes, the printer is in the middle of a gcode move.
And at the moment a gcode is executed by the planner, the planner will update
current_position vector to the final destination vector. This means current_position
vector is invalidated during a power outage and so we must check what the
actual machine position is instead and save it.

This was working correctly before, this commit only fixes the regression
in my pull request.

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 5ee7ba84e3 fix build 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert fa843a4a9b power panic: implement partial back up in RAM
A partial backup is needed in scenarios where the extruder may be
parked after a print is saved. For example during a blocking wait for the user in M600
Or during a MMU error screen.

A sudden power panic at this point would previously save the parked position
into EEPROM. When the print is recovered it would print in mid air.
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 10ed195531 power panic: use saved position consistently
1) current_position[Z_AXIS] is not always correct. saved_pos[Z_AXIS]
    should always represent the correct resume position for the Z-axis
2) Use the saved position to fetch the Z-offset value from
    the mesh bed leveling grid. In case the extruder is parked during
    power panic, the previous code may extract the wrong mesh
    bed leveling offset (due to extruder being located at different
    X and Y axis coordinates)
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 392c46c7ad power panic: pull INT4 string into PROGMEM
Change in memory:
Flash: -4 bytes
SRAM 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 6d902d6437 power panic: store saved_fan_speed in EEPROM
fanSpeed may have an outdated value
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 44bedcd941 power panic: cleanup: remove commented code 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 62a3d179f0 optimisation: read/write EEPROM_UVLO_SAVED_START_POSITION block
I verified via printf that sizeof(saved_start_position) = 16 (i.e. 4 float values)
We simply want to write 16 bytes to address
EEPROM_UVLO_SAVED_START_POSITION

Change in memory:
Flash: -160 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 6ccd12c7e8 power panic: re-use saved_pos
This allows us to restore the position of all axis saved in RAM

If the extruder had been parked to the side for example
due to filament runout. Then the original position (before parking)
should now be restored

Change in memory:
Flash: +40 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 97c27525d4 power panic: re-use saved_extruder_relative_mode
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert a2ac513794 power panic: re-use target temps from RAM
If a print has been saved to RAM such as during a filament runout,
do not overwrite these saved values if a sudden
power panic appears.

Additionally, change the saved types to be the same as power panic when saving to RAM:
- Bed target temperature is uint8_t (0 to 255) instead of float
- Extruder target temperature is uint16_t instead of float

Doing this change allows us to re-use the same global variables and
avoid creating local variables during power panic.

Change in memory:
Flash: -246 bytes
SRAM: -5 bytes
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert b65c500f25 power panic: Add comments about conserving power 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert a45e432030 power panic: Re-use code to save feedrate, segment index, and start position
Saves ~80B of Flash
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 67403603ed power panic: Re-use saving print file state
This also adds the Gcode position into EEPROM
for Octoprint/PrusaLink prints.
Though the recovery part doesn't support that yet.
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 2902fcaa71 power panic: Add two functions
These functions should be able to be re-used during a power panic

- save_print_file_state
- restore_print_file_state

No functional change at the moment.
2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 526a1dcc63 power panic: Move code into a separate file 2023-07-18 11:29:03 +02:00
Guðni Már Gilbert 065d81ba57 Remove redundant st_synchronize
It's taken care of by the tool_change function

Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-07-14 15:06:38 +00:00
Guðni Már Gilbert 64c7202986 Simplify processing T? Tcode
tool_change calls load_filament_to_nozzle if it
sees T?, we should utilise this.

Change in memory:
Flash: -60 bytes
SRAM: 0 bytes
2023-07-14 15:06:38 +00:00
Guðni Már Gilbert 5295bfa040 Remove dead macro timer02_set_pwm0
It looks like it was removed here
https://github.com/prusa3d/Prusa-Firmware/pull/1979
4 years ago

No change in memory
2023-07-14 14:28:14 +02:00
Guðni Már Gilbert b6572066f4 optimisation: compare uint16_t against uint16_t
We're assigning step_rate with the 16-bit value of final_rate
I would expect the comparison to be 16-bit also then.

Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
2023-07-13 11:11:45 +02:00
RoboMagus 2d461572dd Fix command parameters offset 2023-07-13 11:05:29 +02:00
RoboMagus 4450dbe4dd Update serial echo macro to print from PGM 2023-07-13 11:05:29 +02:00
RoboMagus d9e6dd4efe Update usage comment 2023-07-13 11:05:29 +02:00
RoboMagus 5baa74a425 Add M118 Gcode support 2023-07-13 11:05:29 +02:00
3d-gussner 7f95c54305 Move `Language update` to first row 2023-07-13 10:08:09 +02:00
Guðni Már Gilbert 6784c6919b cleanup: remove TMC2130 ifdef in lcd_selfcheck_axis
This function is no longer included in the firmware
when using TMC2130

Also removed commented code
2023-07-13 10:06:21 +02:00
Guðni Már Gilbert 70ae3353ce MMU: Disable E-motor after Try-load-unload
The filament is never in the nozzle at this point so there
should be no oozing.

When a single material MMU print, I can hear audible noise
from the motor after executing Tx code. After some timeout
(while the heaters still heating up) I can hear the firmware
disable the E-motor. But we can safely disable it immediately
after the try-load-unload sequence.

Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-07-13 10:04:20 +02:00
Guðni Már Gilbert 06c42bf85f MMU: Remove a call to Enable_E0
The planner enables the E-motor automatically
No need to do it manually

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-07-13 10:04:20 +02:00
Guðni Már Gilbert 4abdb0225d PFW-1527 FILAMENT_EJECTED should not increment fail statistic
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-07-13 10:01:27 +02:00
Guðni Már Gilbert 434386e6cc Log event when planner is aborted
It may be useful to see if any moves are lost

Change in memory:
Flash: +32 bytes
SRAM: 0 bytes
2023-07-13 10:00:16 +02:00
Guðni Már Gilbert f13d657c7e Remove Marlin.h include in backlight.h
Also removed it from sound.cpp, only include what is really required
2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 749360db0f Remove mesh bed leveling include 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 34ef9665cd Remove two ultralcd includes 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 9cc9af14bd Remove unnecessary la10compat include 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert b0ff5f45f3 Cleanup language.h includes
Remove a few redundant language.h includes

Also remove language.h include from cmdqueue.h to prevent including language.h unnecessarily

Fix missing message.h includes in a few files
2023-07-13 09:57:52 +02:00
Guðni Már Gilbert ee074eb548 Remove eeprom.h include in SpoolJoin header 2023-07-13 09:57:52 +02:00
Guðni Már Gilbert 37a73e91c6 Remove MMU2 include in stepper.cpp
Nothing is used from the MMU class in this file
2023-07-13 09:57:52 +02:00
Alex Voinea e91ee4a5db Change uint8_t* cast to long* 2023-07-13 09:54:33 +02:00
Alex Voinea 8149853fc9 Optimize `st_set_position()` for speed and size
flash: -186
SRAM: 0
time: x0.45
2023-07-13 09:54:33 +02:00
Guðni Már Gilbert ef4efc22c3 PFW-1528 Intercept register 0x14
This commit syncs the 8-bit firmware with the 32-bit

Change in memory:
Flash: +56 bytes
SRAM: 0 bytes
2023-07-13 08:00:11 +02:00
3d-gussner 079e4c9112
Merge pull request #4254 from 3d-gussner/MK3_UPDATE_DOXYGEN_PO
Update doxygen and po files
2023-06-29 10:38:12 +02:00
3d-gussner 9421785190 Update doxygen and po files 2023-06-29 08:23:13 +02:00
3d-gussner 7c7cbe62ca
Merge pull request #4251 from 3d-gussner/MK3_REVO_HF_60W_MMU3
Update REVO HF 60W to MMU3
2023-06-29 06:38:44 +02:00
3d-gussner 3ddd691f44 Update REVO HF 60W to MMU3 2023-06-28 17:15:14 +02:00
3d-gussner b872b59bd9
Merge pull request #4246 from 3d-gussner/MK3_REVO_HF_60W
Add REVO High Flow 60W variant
2023-06-28 09:14:45 +02:00
3d-gussner 10e2357cc5 Change MMU2 to MMU3 2023-06-27 11:41:09 +02:00
3d-gussner 136ef9696d Do not check MMU version with `M862.3` for MK3|MK3S 2023-06-27 11:41:09 +02:00
3d-gussner 5f9cece2da Update REVO TM warning a error values 2023-06-26 10:32:13 +02:00
3d-gussner bc9ea48779
Merge pull request #4241 from 3d-gussner/MK3_Community_made
Add Arc, MeatPack and REVO
2023-06-21 17:55:41 +02:00
3d-gussner 1f740f622c Add Arc, MeatPack and REVO 2023-06-21 08:43:17 +02:00
3d-gussner b5bd9ebc63
MK3 sync Prusa-Error-Codes (#4238)
* Sync PEC `FINDA_DIDNT_GO_OFF` to `FINDA_FILAMENT_STUCK`

* Sync PEC `FSENSOR_DIDNT_GO_OFF` to `FSENSOR_FILAMENT_STUCK`

* Sync PEC `PULLEY_STALLED` to `PULLEY_CANNOT_MOVE`

* Sync PEC `SELECTOR_CANNOT_MOVE` update text

* Sync PEC `IDLER_CANNOT_MOVE` update text

* Sync PEC `PULLEY_WARNING_TMC_TOO_HOT` to `WARNING_TMC_PULLEY_TOO_HOT`

* Snyc PEC `RestartMMU` to `ResetMMU`
Also related text

* Sync PEC `SELECTOR_WARNING_TMC_TOO_HOT` to `WARNING_TMC_SELECTOR_TOO_HOT`

* Sync PEC `IDLER_WARNING_TMC_TOO_HOT` to `WARNING_TMC_IDLER_TOO_HOT`

* Sync PEC `PULLEY_TMC_OVERHEAT_ERROR` to `TMC_PULLEY_OVERHEAT_ERROR`

* Sync PEC `SELECTOR_TMC_OVERHEAT_ERROR` to `TMC_SELECTOR_OVERHEAT_ERROR`

* Sync PEC `IDLER_TMC_OVERHEAT_ERROR` to `TMC_IDLER_OVERHEAT_ERROR`

* Sync PEC `PULLEY_TMC_DRIVER_ERROR` to `TMC_PULLEY_DRIVER_ERROR`
Also releated text

* Sync PEC `SELECTOR_TMC_DRIVER_ERROR` to `TMC_SELECTOR_DRIVER_ERROR`
Also related text

* Sync PEC `IDLER_TMC_DRIVER_ERROR` to `TMC_IDLER_DRIVER_ERROR`
Also related text

* Sync PEC `PULLEY_TMC_DRIVER_RESET` to `TMC_PULLEY_DRIVER_RESET`

* Sync PEC `SELECTOR_TMC_DRIVER_RESET` to `TMC_SELECTOR_DRIVER_RESET`

* Sync PEC `IDLER_TMC_DRIVER_RESET` to `TMC_IDLER_DRIVER_RESET`

* Sync PEC `PULLEY_TMC_UNDERVOLTAGE_ERROR` to `TMC_PULLEY_UNDERVOLTAGE_ERROR`

* Sync PEC `SELECTOR_TMC_UNDERVOLTAGE_ERROR` to `TMC_SELECTOR_UNDERVOLTAGE_ERROR`

* Sync PEC `IDLER_TMC_UNDERVOLTAGE_ERROR` to `TMC_IDLER_UNDERVOLTAGE_ERROR`

* Sync PEC `PULLEY_TMC_DRIVER_SHORTED` to `TMC_PULLEY_DRIVER_SHORTED`
Also related text

* Sync PEC `SELECTOR_TMC_DRIVER_SHORTED` to `TMC_SELECTOR_DRIVER_SHORTED`
Also related text

* Sync PEC `IDLER_TMC_DRIVER_SHORTED` to `TMC_IDLER_DRIVER_SHORTED`
Also related text

* Sync PEC `PULLEY_SELFTEST_FAILED` to `MMU_PULLEY_SELFTEST_FAILED`
Also related text

* Sync PEC `SELECTOR_SELFTEST_FAILED` to `MMU_SELECTOR_SELFTEST_FAILED`
Also releated text

* Sync PEC `IDLER_SELFTEST_FAILED` to `MMU_IDLER_SELFTEST_FAILED`
Also related text

* Sync PEC fix MMU_MMU
Update MMU MCU UNDERPOWER

* Sync PEC `FIL_ALREADY_LOADED` to `FILAMENT_ALREADY_LOADED`
Also related text

* Add Prusa Error Codes check script

* Remove `:` at FINDA and FSENSOR as it is in other tiles

* Sync
FSENSOR_DIDNT_TRIGGER
MSG_DESC_SELECTOR_CANNOT_MOVE
MSG_DESC_IDLER_CANNOT_MOVE
MSG_DESC_FW_UPDATE_NEEDED
FILAMENT_ALREADY_LOADED

* Add MMU UNKOWN_ERROR PEC
2023-06-21 07:34:17 +02:00
3d-gussner ded448dfd0
Merge pull request #4233 from 3d-gussner/MK3_max_overshoot_pid_autotune
Add max_overshoot_pi_autotune value
2023-06-16 15:18:52 +02:00
3d-gussner a2308aea8b Update E3DREVO High Flow 60W 2023-06-15 15:26:12 +02:00
3d-gussner bf8fd7ed90 Add max_overshoot_pi_autotune value
Prepare for REVO 60W
2023-06-07 12:50:56 +02:00
Guðni Már Gilbert 02859a37c8 optimisation: use CHECK_ALL_HEATERS in more places
Change in memory:
Flash: -162 bytes
SRAM: 0 bytes
2023-05-31 20:39:38 +00:00
3d-gussner b0a72f42f1
Fix build nr. 2023-05-30 15:54:53 +02:00
3d-gussner 8652c77c33
Merge pull request #4225 from 3d-gussner/MK3_3130RC1_pre-release
FW3.13.0-RC1 Pre-release PR
2023-05-30 08:57:11 +02:00
3d-gussner 3da1ae1344 Change new hotend variants 2023-05-29 10:22:17 +02:00
3d-gussner 8078c8eff2 Fix format and bump up build number 2023-05-26 11:06:39 +02:00
3d-gussner cea2a07045 Bump up build number 2023-05-26 08:17:02 +02:00
3d-gussner 0d5f515854 Manual fix for ... firmware detected on ... printer 2023-05-26 08:17:02 +02:00
3d-gussner 2c741103fd Update po files 2023-05-26 08:17:02 +02:00
3d-gussner 56dd8f09e7 Fix too long message `MSG_BABYSTEPPING_Z`from c=15 to c=13
Had to remove `:` and update NL translation to fit
2023-05-26 08:17:02 +02:00
3d-gussner 9ac5436fad
Merge pull request #4226 from 3d-gussner/MK3_REVO
Add E3D Revo variant
2023-05-26 08:16:01 +02:00
3d-gussner 6ce2026ab7 Rename README in variants folder 2023-05-26 07:36:39 +02:00
3d-gussner 02f7c7efc0 Add README_variants 2023-05-26 07:34:06 +02:00
3d-gussner 7b0ec5b759 Add REVO to lagacy build 2023-05-25 09:59:18 +02:00
3d-gussner 38d801a4c5 Add E3D REVO variant
Thanks to E3D and the community providing data
2023-05-25 09:46:16 +02:00
3d-gussner 3c678122f6
Merge pull request #4222 from 3d-gussner/PFW1520-pofiles
PFW-1520: Add new message `Preload to MMU` to po files
2023-05-24 06:57:48 +02:00
3d-gussner 135247c3b7
Merge pull request #4214 from 3d-gussner/MK3_Fix_MMU_IRsensor
Fix IRsensor with MMU
2023-05-24 06:57:05 +02:00
3d-gussner d9eadd39b0 Thanks to @Janys 2023-05-23 17:18:34 +02:00
3d-gussner 9b4c8e9c9d Thanks to @gudnimg 2023-05-23 10:39:05 +02:00
3d-gussner f43451f80b Update `MSG_EJECT_FILAMENT` and `MSG_CUT_FILAMENT` to `c=16`
Had to shorten SK translation
2023-05-23 09:50:27 +02:00
3d-gussner a37bcbfd8c Fix `Load filament` to c=16 2023-05-23 09:45:07 +02:00
3d-gussner 5553e45ad3 Thanks to @wavexx and @SNDR0 2023-05-23 09:40:41 +02:00
3d-gussner a36b6755af Thanks to @trfunk 2023-05-23 09:40:41 +02:00
3d-gussner 53e1dad772 Thanks to @stelgenhof 2023-05-23 09:40:41 +02:00
3d-gussner 212abfba9e Thanks to @AttilaSVK 2023-05-23 09:40:41 +02:00
3d-gussner 1ccc05d321 Thanks to @shatter136 2023-05-23 09:40:41 +02:00
3d-gussner 96614297e7 Thanks to @arekam 2023-05-23 09:40:41 +02:00
3d-gussner c7e382f6ba Add new message `Preload to MMU` to po files
Inital translation
2023-05-23 09:40:41 +02:00
3d-gussner d4beab95d5
Merge pull request #4208 from gudnimg/load_to_nozzle_fix
MMU: Fix 0°C target temperature when loading to nozzle
2023-05-23 08:54:26 +02:00
Guðni Már Gilbert 7dc370a7e1 Move ISR7 code to fancheck.cpp 2023-05-23 07:43:40 +02:00
Guðni Már Gilbert 963bd508a4 Fix MK25 compiler warning
warning: 't_fan_rising_edge' defined but not used [-Wunused-variable]
2023-05-23 07:43:40 +02:00
Guðni Már Gilbert 467158eb49 MMU: Fix 0°C target temperature when loading to nozzle
bFilamentAction variable is never reset, even after
disabling the heaters.

Steps to reproduce:
1. Boot-up printer
2. Select Load to Nozzle.
3. Select PLA (215°C) target
4. Select Filament 1
5. Wait for load to be successful
6. Go to Preheat submenu and select Cooldown (last menu item)
7. Observe target temperature on the status screen is now 0°C
8. Select Load to Nozzle again.
9. Select Filament 2.
* Expected behavior target temperature IS NOT 0°C
* Actual behavior target temperature IS 0°C

Change in memory:
Flash: -26 bytes
SRAM: 0 bytes
2023-05-22 22:00:00 +00:00
Guðni Már Gilbert 02676fc888 Limit scope of is_mmu_error_monitor_active
Move the variable to mmu2_reporting

Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-05-22 08:04:22 +02:00
Guðni Már Gilbert 1f9fc4ef3f MMU: add UnloadInner and CutFilamentInner
Sync with the 32-bit side.
The ReportingRAII does not handle recursion.

Fixes an issue with the multiple calls to
BeginReport() and EndReport()

Change in memory:
Flash: +14 bytes
SRAM: 0 bytes
2023-05-22 08:00:42 +02:00
Guðni Már Gilbert 9d5453a41e PFW-1520 Rename Load Filament menu to Preload to MMU
Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
2023-05-22 07:53:26 +02:00
Guðni Már Gilbert 2391698419 errorCode should reflect the state of the MMU
If the protocol reports and error and give errorCode
a value. When the error is resolved, errorCode is not reset to OK.

If the MMU is not in an error state I would expect errorCode to reflect that.

This fixes MMUCurrentErrorCode()

Change in memory:
Flash: +12 bytes
SRAM: 0 bytes
2023-05-22 07:53:12 +02:00
3d-gussner d20dc8256a
Merge pull request #4204 from gudnimg/ReportingRAII-opt
optimisation: always inline `ReportingRAII`
2023-05-19 19:44:41 +02:00
3d-gussner 91a23e27e1 Fix IRsensor with MMU
saves 38bytes
2023-05-19 13:35:28 +02:00
3d-gussner d8ec526e67
Merge pull request #4200 from leptun/fix_stepper_inactivity_timeout
Fix stepper inactivity timeout
2023-05-15 10:34:39 +02:00
Guðni Már Gilbert 90322a7181 optimisation: always inline ReportingRAII
Tested on MK3S+ using the LCD.

Change in memory:
Flash: -80 bytes
SRAM: 0 bytes
2023-05-13 18:07:13 +00:00
Alex Voinea 0612a38885
Fix stepper inactivity timeout 2023-05-13 08:18:39 +02:00
3d-gussner 162f8b4cc8
Merge pull request #4180 from gudnimg/menu_draw_P-fix
Fix regression in `menu_draw_P`
2023-05-10 07:30:02 +02:00
3d-gussner 0c453b53cd
Merge pull request #4193 from gudnimg/unload-sequence-improvements
Fix unload sequence for users without MMU
2023-05-10 07:29:16 +02:00
Guðni Már Gilbert 3c79e77220 Create define for two hardcoded values 2023-05-08 19:50:51 +00:00
Guðni Már Gilbert e24c2200f1 Set FILAMENTCHANGE_FINALRETRACT instead of hardcoded 0 2023-05-08 19:33:42 +00:00
3d-gussner 8d1abf772d
Merge pull request #4192 from gudnimg/PFW-1506
PFW-1506 Load to nozzle: Fix too short purge distance
2023-05-08 13:14:47 +02:00
3d-gussner 719d1704c2
Merge pull request #4188 from leptun/fix_missing_live_adjust_z_settings
Always allow Live Adjust Z in Settings
2023-05-08 12:57:08 +02:00
Guðni Már Gilbert d781dae35b Combine two moves since they have the same feedrate
Change in memory:
Flash: -60 bytes
SRAM: 0 bytes
2023-05-06 15:24:54 +00:00
Guðni Már Gilbert 71180ac284 Cleanup M600 init
Instead of removing FILAMENTCHANGE_FINALRETRACT
just set it to 0

No change in memory
2023-05-06 15:24:54 +00:00
Guðni Már Gilbert 8556336185 Fix unload sequence for users without MMU
Restores 3.12 sequence which was working well before.

M600 "L" parameter now works like M702 "U" parameter.

Removed a lot of the unused parameters which were copied
from Marlin 2.

Change in memory:
Flash: +96 bytes
2023-05-06 15:24:54 +00:00
VintagePC e336e2ad08 Fix merge conflict/resync 2023-05-06 11:22:31 -04:00
Guðni Már Gilbert dd9df36375 Load to nozzle: Fix too short purge distance
PFW-1506

Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-05-06 13:19:57 +00:00
Guðni Már Gilbert 462535ef7f Restore 3.12 live Z-adjust menu behavior
Code size increases  a bit but keep in mind the PR
that broke the behavior "saved" 182 bytes:
https://github.com/prusa3d/Prusa-Firmware/pull/4063
So I think this code size increase is OK

Change in memory:
Flash: +84 bytes
SRAM: 0 bytes
2023-05-06 12:08:06 +00:00
Alex Voinea 1d87789641 Always allow Live Adjust Z in Settings 2023-05-05 19:19:11 +00:00
Guðni Már Gilbert 570b360413 Fix menu_draw_P for negative values
The new code did not take into account the minus sign.

The template for menu_draw_P is removed since there is no benefit in
uint8_t version of this function since the value
is converted to two bytes anyway by lcd_printf_P.

Change in memory:
Flash: -92 bytes
SRAM: 0 bytes
2023-05-05 17:24:14 +00:00
3d-gussner bf6c0919e1
Merge pull request #4166 from gudnimg/gudnimg-patch-1
M701/M702: Set default Z value to 0
2023-05-05 12:38:37 +02:00
3d-gussner 12d9070c03
Merge pull request #4181 from gudnimg/status-screen-feedrate
optimisation: only check feedrate if knob is rotated
2023-05-05 12:37:46 +02:00
3d-gussner fd2184801f
Merge pull request #4168 from gudnimg/next_feedrate_remove
Cleanup: Remove `next_feedrate` from global scope
2023-05-05 12:36:04 +02:00
3d-gussner 427e88a406
Merge pull request #4175 from gudnimg/remove-LoadFilament
cleanup: Remove unused `LcdCommands` state `LoadFilament`
2023-05-05 12:34:49 +02:00
3d-gussner bdd958fe5e
Merge pull request #4157 from leptun/menu_optimizations
Menu optimizations
2023-05-05 11:51:12 +02:00
3d-gussner 649f08f69f
Merge pull request #4178 from gudnimg/m600-dead-code
M600: remove dead code
2023-05-05 11:50:01 +02:00
3d-gussner e3a57c9947
Merge pull request #4169 from 3d-gussner/MK3_TMcal_mid
Move nozzle to center during Thermal model cal.
2023-05-05 11:48:41 +02:00
3d-gussner 39c3e8a530
Merge pull request #4184 from gudnimg/feedrate-fix-3_13
Fix regression where time remaining can overflow on status screen
2023-05-05 11:45:58 +02:00
Guðni Már Gilbert fc15f5a6ef Select correct MMU slot in lcd_wizard_load
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-05-02 22:38:54 +00:00
Guðni Már Gilbert 9cf1f7871e Minor fix to M701 when MMU slot is out of range
If MMU slot is outside of range, then we rather the printer
not do anything. Currently it would accidentally assume
the MMU is disabled. This may have undesireable results.

No change in memory
2023-05-02 22:32:18 +00:00
Guðni Már Gilbert 5b75886a55 Fix regression where feedrate can overflow on status screen
If the remaining print time is more than 10.9 hours at 100%
then increasing the feedrate multiplier
to 101% or more will yield an unrealistic time due to overflow occuring.

Change in memory:
Flash +2 bytes
SRAM: 0 bytes
2023-05-01 12:48:21 +00:00
Guðni Már Gilbert b3f52f95c7 optimisation: only check feedrate if knob is rotated
Guard the feedmultiply code with
lcd_encoder.

if lcd_encoder = 0, then there is no need to check if
feedmultiply should be updated.

Also set lcd_encoder to zero in one line to consume the rotation event.

Change in memory:
Flash: -40 bytes
SRAM: 0 bytes
2023-04-30 23:31:16 +00:00
Guðni Már Gilbert 92e5747469 M600: remove dead code
The if statement doesn't do anything useful
so I propose it be removed before 3.13 release

Change in memory:
Flash: -30 bytes
SRAM: 0 bytes
2023-04-29 23:43:27 +00:00
Guðni Már Gilbert 26369ac540 Restore old M701/M702 behavior
If the new Z parameter is not given,
assume that the old Z-lift behavior is desired.

Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
2023-04-29 16:22:28 +00:00
Guðni Már Gilbert 0b34c6a695 cleanup: Remove unused LcdCommands state
This may help the compiler generate smaller code

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-04-29 10:24:04 +00:00
Guðni Már Gilbert d7127c44f1
Merge branch 'prusa3d:MK3' into gudnimg-patch-1 2023-04-28 19:10:56 +00:00
3d-gussner e11555392e Save some bytes.
Thanks to @leptun
2023-04-26 09:18:47 +02:00
3d-gussner 686f92b243 Move nozzle to center during Thermal model cal. 2023-04-25 20:41:17 +02:00
Guðni Már Gilbert 228250f050 Cleanup: Remove next_feedrate from global scope
No change in memory
2023-04-24 21:33:07 +00:00
Alex Voinea a354aad762
Merge pull request #4167 from leptun/lcd_encoder_improvements
Lcd encoder improvements
2023-04-24 15:58:54 +02:00
3d-gussner 3692a24e44
Merge pull request #4165 from leptun/binary.h
Remove last <binary.h> dependencies
2023-04-24 14:51:36 +02:00
Alex Voinea e662ef276e
Deduplicate temperature settings
Flash: -52B
SRAM: 0B
2023-04-24 11:56:53 +02:00
Alex Voinea c83646743f
Deduplicate MMU settings
Flash: -58B
SRAM: 0B
2023-04-24 11:56:53 +02:00
Alex Voinea 4a2a89cb74
Remove stupid comments from older bad code 2023-04-24 11:56:53 +02:00
Alex Voinea 67f0fe0fce
Remove AUTOTEMP menu items
They are commented out and broken anyway
2023-04-24 11:56:53 +02:00
Alex Voinea c339711025
Make the encrot table balanced
It won't change much. It is not possible to determine in which direction the encoder spun when two steps are made, so just use + or - 2.
2023-04-24 11:56:25 +02:00
Alex Voinea 32e68c33b4
lcd encoder: use lookup table
Also handle the scenario where the encoder moves two steps in a single lcd_buttons_update cycle.

Flash: -46B
SRAM: 0B
2023-04-24 11:56:13 +02:00
Alex Voinea ea101f49d4
`lcd_buttons` is actually `lcd_click_trigger`
Flash: -4B
SRAM: 0B
2023-04-24 11:56:04 +02:00
Alex Voinea dd16cf4525
Remove Binary.h include 2023-04-24 11:52:25 +02:00
Guðni Már Gilbert 78614f5670
M701/M702: Set default Z value to 0
Set default Z value to 0 to maintain backwards compatibility with older gcodes.
2023-04-24 09:09:43 +00:00
Alex Voinea 17e085040c
Add missing line to custom character
Shouldn't make a difference since the array is already defined as 8B long, but I just found it weird and surprising when I noticed only 7 lines were defined
2023-04-24 10:44:48 +02:00
Alex Voinea 548ed0eb31
Convert <binary.h> to native binary literals 2023-04-24 10:42:09 +02:00
Guðni Már Gilbert 5b7266fdf1
Don't render message when printer is idle
Guard the lcd_display_message_fullscreen_P call by blocks_queued(). If there are no planned moves, there is no need to render this message, it creates a weird LCD draw noticable by the user.

Change in memory:
Flash: +10 bytes
SRAM: 0 bytes
2023-04-23 12:25:10 +02:00
Guðni Már Gilbert 9de2cbfe8e
Fix an issue with crash_mode_switch toggling
Proposed changes
2023-04-23 12:25:10 +02:00
Alex Voinea 9272545deb
Dead code cleanup 2023-04-23 12:25:10 +02:00
Alex Voinea 02a0f6a35a
Correctly utilize the menu stack in the Mode select message
Flash: -34B
SRAM: 0B
2023-04-23 12:25:10 +02:00
Alex Voinea 6390b3b69b
Remove duplicate separator string
Flash: -14B
SRAM: 0B
2023-04-23 12:25:10 +02:00
Alex Voinea eb8ac250cc
Merge pull request #4163 from gudnimg/tx-fix
Fix issue where Tx gcode doesnt reset custom_message_type
2023-04-23 12:15:11 +02:00
Guðni Már Gilbert 62991c8e67 Fix issue where Tx gcode doesnt reset custom_message_type
We need to call BeginReport and EndReport
otherwise the SD filename is not shown when printing

This only affects single material MMU gcodes

Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-04-23 09:52:11 +00:00
Alex Voinea ae75d9bb0e
Merge pull request #4162 from leptun/fix_lcd_encoder_diff
Fix `lcd_encoder_diff` getting out of sync with the knob hard steps
2023-04-23 11:31:45 +02:00
Alex Voinea 5778e39687
Resync `lcd_encoder_diff` when clicking
Flash: +4B
SRAM: 0B
2023-04-23 10:07:52 +02:00
Alex Voinea c037e6dfba
Use atomic block for accessing lcd_encoder_diff
There was still the possibility of lcd_encoder_diff being updated from the ISR while the new enc_diff was being computed.

Flash: +8B
SRAM: 0B
2023-04-23 09:58:56 +02:00
Alex Voinea 1f181a949a
Fix `lcd_encoder_diff` getting out of sync with the knob hard steps
Flash: +18B
SRAM: 0B
2023-04-23 09:48:09 +02:00
Alex Voinea ee8b95b556
Merge pull request #4158 from gudnimg/remove-dead-code-gudni-e1e2
Cleanup: remove unused extruder macros
2023-04-23 09:26:26 +02:00
Alex Voinea 9662bb11d4
Merge pull request #4144 from gudnimg/double-feedback-bugs
Double feedback bugs
2023-04-23 09:14:01 +02:00
Guðni Már Gilbert 3509791943 Drop sound feedback in lcd_v2_calibration
Drop the sound feedback in lcd_v2_calibration
when switching to lcd_generic_preheat_menu

If a single filament setup (no MMU) has filament loaded, it will jump
immediately to lcd_generic_preheat_menu
this created double feedback.

Let's just drop the feedback since the transition
between menus is very fast.

Change in memory:
Flash: -8 bytes
2023-04-22 15:28:27 +00:00
Guðni Már Gilbert b15beb25cc Remove INVERT_E1_DIR and INVERT_E2_DIR from config
I think these should be removed from the configuration files
as these definitions don't do anything.
2023-04-22 15:15:21 +00:00
Guðni Már Gilbert 0cf0d40a2e Remove checkAllHotends() 2023-04-22 15:15:21 +00:00
Guðni Már Gilbert c7f0ee13be Missed these macros disable_e1/2 2023-04-22 15:15:21 +00:00
Guðni Már Gilbert 25522d3d68 Remove unused Autofan extruder configs 2023-04-22 15:15:21 +00:00
Guðni Már Gilbert c14332bfb2 Combine two ifdefs 2023-04-22 15:15:21 +00:00
Guðni Már Gilbert 327b5b230b Remove soft_pwm_1 and soft_pwm_2 2023-04-22 15:15:21 +00:00
Guðni Már Gilbert fcabcd2804 Remove TEMP_SENSOR_1 and TEMP_SENSOR_2
Hopefully I didn't miss anything
2023-04-22 15:15:21 +00:00
Guðni Már Gilbert f539b40611 Remove more EXTRUDERS > 1 code 2023-04-22 15:15:21 +00:00
Guðni Már Gilbert 4935191335 Cleanup remove unused macros
enable_e1
enable_e2
disable_e1
disable_e2

The firmware doesn't support multiple extruders

No change in memory
2023-04-22 15:15:21 +00:00
Guðni Már Gilbert 7889d54cfd
Merge pull request #4160 from gudnimg/cleanup-tcode-description
Rewrite the Tcodes description
2023-04-22 14:43:33 +00:00
Guðni Már Gilbert 76a76de7ea Rewrite the Tcodes description
The old description had typos and was a bit confusing for new users

The new text is a suggestion from David Buzek at Prusa Research
2023-04-22 14:27:01 +00:00
Guðni Már Gilbert 51da6065c8
Merge pull request #4159 from gudnimg/cleanup-gudni-comments
Remove random `//-//` comments
2023-04-22 13:53:13 +00:00
Guðni Már Gilbert b8f8348e77
Fix double feedback in Z-offset menu 2023-04-22 15:53:06 +02:00
Guðni Már Gilbert b6e228d5a5
Fix double feedback in First Layer Calibration
For MMU users: This happens when the user
selects a filament to load from 1 to 5

For non-MMU: this happens when clicking
the knob within 2 seconds.

Additionally fixed the code indendation
it was a mix of spaces and tabs
2023-04-22 15:53:06 +02:00
Guðni Már Gilbert ccabf1fa31 Remove random //-// comments 2023-04-22 13:39:08 +00:00
Alex Voinea e516d8a0c4
Merge pull request #4156 from leptun/lcd_status_screen_block
Fix `M0` click not consumed
2023-04-22 15:01:16 +02:00
Guðni Már Gilbert 4ce3fa53a1 Optimise M0/M1 code size
Replace two bool variables with one.

It's not obvious but (!hasP && !hasS) is equal to
!(hasP || hasS)

Note: expiration_time_set = hasP || hasS
Truth table:
|--------------------------------------------------|
| hasP| hasS| (!hasP && !hasS)|  !(hasP || hasS) |
|------|-----|--------------------|-----------------|
|   0    |  0   |               1            |            1           |
|   0    |  1   |               0            |            0           |
|   1    |  0   |               0            |            0           |
|   1    |  1   |               0            |            0           |
|--------------------------------------------------|

Change in memory:
Flash: -36 bytes
SRAM: 0 bytes
2023-04-21 17:42:55 +00:00
3d-gussner 360f234b98
Merge pull request #4146 from gudnimg/fan-check-opt
Reduce code size in fan check selftest
2023-04-21 14:24:04 +02:00
3d-gussner 7ee1640792
Merge pull request #4143 from gudnimg/improve-lcd-update
Fix lcd_update() FW crashes
2023-04-21 14:23:16 +02:00
Alex Voinea 91b913e997
Fix `M0` click not consumed
Fix the need to click the knob twice to dismiss `M0`.

Flash: -54B
SRAM: -2B
2023-04-21 12:59:40 +02:00
Guðni Már Gilbert 2ad916a2c3 Fix manual fan check menu
lcd_encoder was not being updated
we need to call manage_inactivity

Tested on MK3S+

Change in memory:
Flash: +6 bytes
SRAM: 0 bytes
2023-04-19 15:41:36 +00:00
Guðni Már Gilbert 18c389543b Fix lcd_update() FW crashes
Change in memory:
Flash: +10 bytes
SRAM: 0 bytes
2023-04-19 15:41:36 +00:00
3d-gussner 20e73e3c4f
Merge pull request #4067 from scottmudge/MK3_3.12-meatpack-pr
Add support for g-code compression/packing over serial connection (MeatPack)
2023-04-19 09:20:07 +02:00
Alex Voinea 2dcaae80d5
Merge pull request #4027 from gudnimg/minor-optimisation-gudni
Many minor optimisations for 3.13/3.14
2023-04-17 21:27:48 +02:00
Alex Voinea ea97ca7920
Use `EXTRUDERS` instead of hardcoded value in string 2023-04-17 21:12:59 +02:00
Alex Voinea b67063f14a
Remove empty lines 2023-04-17 21:10:20 +02:00
Guðni Már Gilbert 43d41ddd2b cleanup: static variables in Marlin_main.cpp 2023-04-16 23:23:31 +00:00
Guðni Már Gilbert 4b54cd1f30 Remove unused LoadingToNozzleRAII
The variable is not used anywhere.

Change in memory:
Flash: -14 bytes
SRAM: -1 byte
2023-04-16 17:23:28 +00:00
Guðni Már Gilbert 01df65882f cleanup: remove commented code 2023-04-16 15:25:43 +00:00
Alex Voinea f6135f2ed1 Enable Analog IR sensor again 2023-04-16 13:58:18 +00:00
Guðni Már Gilbert f5b9d2ac2e cleanup: Remove unused Developer define 2023-04-16 13:13:16 +00:00
Guðni Már Gilbert 2ed4a75894 cleanup: remove unused settings 2023-04-16 13:13:16 +00:00
Guðni Már Gilbert 559e1bb21a Remove unused MMU configs
- MMU_IDLER_SENSOR_ATTEMPTS_NR
- MMU_REQUIRED_FW_BUILDNR

These are no longer used
2023-04-16 13:13:16 +00:00
Guðni Már Gilbert ea095543b3 Fix a typo in PSU_Delta define
It's case sensitive: "PSU_delta" --> "PSU_Delta"
2023-04-15 18:44:23 +00:00
Guðni Már Gilbert 9b6e1babcb many more lcd_putc_at optimisations
Changes in
lcd_implementation_drawmenu_sdfile
and
lcd_implementation_drawmenu_sddirectory
seem to save the most.

Change in memory:
Flash: -72 bytes
SRAM: 0 bytes
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert dea7f2b26c Resolve PR review
Initialise EEPROM_CHECK_MODE always
But if farm mode is detected, update the Check mode to Strict

Initialise EEPROM_NOZZLE_DIAMETER on farm mode.
When opening the menus this value is set automatically to
_Diameter_400 anyway so this should be fine.

No change in memory on Multilang build
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert 9f66eceb29 optimisation: belt test new values
use lcd_print instead of lcd_printf_P
to print the number only

Tested on MK3S+

Change in memory:
Flash: -34 bytes
SRAM: 0 bytes
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert 87e40f1cee optimisation: lcd_putc_at in belt test
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert 583c46a63f Simplify two fan_check_error checks
There are only 3 possible values. No need to check for two of them
to rule of the last value. Instead simply check for the last value only.

Change in memory:
Flash: -16 bytes
SRAM: 0 bytes
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert b67c359129 Move fan_state to fancheck.cpp and make it static
No change in memory
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert ebdcfbec50 cleanup: tmc2130: make variables static where applicable
No change in memory
2023-04-15 13:45:10 +00:00
Guðni Már Gilbert 7c23d8b00c cleanup: make cancel_heatup static in Marlin_main 2023-04-15 13:45:10 +00:00
Alex Voinea d148c08991 Remove dead code from get_coordinates() 2023-04-15 13:45:10 +00:00
Alex Voinea c7de1b1416 optimize get_coordinates() axis mask 2023-04-15 13:45:10 +00:00
Alex Voinea ea7b395852 Remove useless parantheses
Found these a few months ago when I was trying some other optimization. Don't want to make a PR just for this, so I'll just slide it here in this existing PR.
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert d175dba669 optimisation: use expired_cont is specific places
!variable.running() || variable.expired()
is equal to
variable.expired_cont()

The latter required less flash memory

Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 00ffab8f62 optimisation: combine if statements in Sensors menu
FINDA status is always 0 or 1

Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 7ff514621c cleanup: remove unused global variable 2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 69b4696114 use lcd_puts_P instead of lcd_printf_P
Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 66bb9bcfe4 optimisation: lcd_temp_cal_show_result
result is boolean so always update the EEPROM

Change in memory:
Flash: -20 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert bd796a2cb3 optimisation: more lcd_putc_at
Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 70dadc4202 M115: Extruder count is always 1
Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 62cbc829f6 optimisation: use new eeprom methods in check_printer_version()
Change in memory:
Flash: -48 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert cd8a22d6b3 optimisation: utils: don't initialise global variables
They will be set by fCheckModeInit() by reading from EEPROM

Change in memory:
Flash: -2 bytes
SRAM: -1 byte
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 7a8dfdae53 optimisation: use new EEPROM init method for fCheckModeInit
Change in memory:
Flash: -90 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 6aafbe69a8 cleanup: remove unused function declaration 2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 6e02a082e2 cleanup: make heating_status_counter static
Change in memory:
Flash: 0 bytes
SRAM: 0 bytes
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert ab934f8ba5 optimisation: make clock_interval static and 1 byte
Change in memory:
Flash: -16 bytes
SRAM: -1 byte
2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 66e629ba74 cleanup: remove unused variable FSensorStateMenu 2023-04-15 13:45:09 +00:00
Guðni Már Gilbert 3cd97a5e8f optimsation: draw cursor and set position with one function
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-04-15 13:45:08 +00:00
Guðni Már Gilbert 2120d17912 optimisation: simplify T-code response for single material
Extruder is always 0

Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2023-04-15 13:45:08 +00:00
Guðni Már Gilbert 420f745bed optimisation: mmu: combine if statements
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-04-15 13:45:08 +00:00
Guðni Már Gilbert 4d90ecbcc4 cleanup: remove ctype include
We don't use any function from this header

No change in code size
2023-04-15 13:45:08 +00:00
Guðni Már Gilbert 3dda8b5c00 optimise fan check selftest code
Tested on MK3S+

Change in memory:
Flash: -174 bytes
SRAM: 0 bytes
2023-04-15 11:11:16 +00:00
Guðni Már Gilbert d6c81dab62 Fix manual fan check menu
lcd_encoder was not being updated
we need to call manage_inactivity

Tested on MK3S+

Change in memory:
Flash: +6 bytes
SRAM: 0 bytes
2023-04-15 10:59:58 +00:00
Guðni Már Gilbert 95acdba5fa Fix lcd_update() FW crashes
Change in memory:
Flash: +10 bytes
SRAM: 0 bytes
2023-04-14 21:31:12 +00:00
Alex Voinea 8241be273b
Merge pull request #4123 from gudnimg/improve-mmu-status
Minor UI fixes for MMU status line during toolchange
2023-04-14 10:46:29 +02:00
Guðni Már Gilbert f34c1ffeac
Fix an issue where visualisation is overwritten by SD file name
We should let EndReport set the custom message type state to Status
This will ensure the SD file name is shown correctly AFTER we've shown
the visualisation

Currently the visualisation is cut off in the middle by ReportProgressHook

Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-04-14 09:32:41 +02:00
Guðni Már Gilbert 4b3dc65598
Don't always set MSG_WELCOME at end of toolchange
This should only be set when NOT printing

Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-04-14 09:32:41 +02:00
3d-gussner c15ea67379
Merge pull request #4119 from leptun/kill_reset
Postponed kill() message with softReset
2023-04-14 08:51:02 +02:00
Alex Voinea 41b8279805
Fix eeprom table addresses 2023-04-13 11:34:18 +02:00
Alex Voinea af4a3f3328
Reorder eeprom reads
Saves 4B of flash
2023-04-13 11:15:17 +02:00
Alex Voinea f333d36e47
Use a different location as a kill message pending flag
The old implementation would fail if the message was in progmem at address 0xffff or 0x0000 (both unlikely). It would also fail if the eeprom was initialized to some other random value, which could have been dangerous when displayed as a full screen message.
2023-04-13 10:57:00 +02:00
Alex Voinea 4b65d49512
Move kill check earlier during startup 2023-04-13 10:57:00 +02:00
Alex Voinea 2aca89d6dc
Update eeprom documentation 2023-04-13 10:57:00 +02:00
Alex Voinea f388d8abb6
postponed kill() message with softReset 2023-04-13 10:57:00 +02:00
Alex Voinea 82343184e7
Merge pull request #4036 from gudnimg/optimise-mmu-silent-mode
optimisation: MMU silent mode toggling & init
2023-04-13 10:54:21 +02:00
Alex Voinea 193bce7f20
Merge pull request #4037 from gudnimg/optimisation-tmc2130-stuff
Optimisation: Disable M351 when using TMC2130 and code related to it
2023-04-13 10:54:08 +02:00
Scott Mudge 3cd125c566
MeatPack gcode compression support 2023-04-13 10:50:15 +02:00
3d-gussner 3b9d1b8980
Merge pull request #4138 from gudnimg/menu-fixes-gudni
Fix broken editing menu
2023-04-13 10:16:19 +02:00
Alex Voinea e4bedf0523
Merge pull request #4133 from gudnimg/xyzcal-opt
Reduce XYZ cal code size
2023-04-12 21:35:58 +02:00
Alex Voinea 6c6f98fb03
Merge pull request #4134 from gudnimg/tmc2130_home_exit-opt
tmc2130: simplify parsing axis mask
2023-04-12 21:35:46 +02:00
Alex Voinea c16e7733e9
Merge pull request #4141 from gudnimg/double-feedback-xyz-cal-menu
menu: Fix an issue with feedback double triggering in XYZ cal menu on knob click
2023-04-12 21:29:24 +02:00
Guðni Már Gilbert d08302bf0c Remove colon character from translation 2023-04-12 17:37:57 +00:00
Guðni Már Gilbert 225999b79d Remove redundant colon characters
The Edit menu already applies a colon to the label string
no need to render it twice.

Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-04-12 17:37:57 +00:00
Guðni Már Gilbert b91941f354 Fix broken editing menu
- currentValue must be initialised when entering the menu
- Consume lcd_encoder value when editing an item

Change in memory:
Flash: +40 bytes
SRAM: 0 bytes
2023-04-12 17:37:56 +00:00
Guðni Már Gilbert 53e3193252 Fix bug with uint8_t not shown correctly on LCD
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-04-12 17:37:23 +00:00
Alex Voinea 7e18e88cbe
Merge pull request #4137 from leptun/optimization_menu_click_return 2023-04-12 19:29:15 +02:00
Guðni Már Gilbert 2fc810289a Fix an issue with feedback double triggering in XYZ cal menu
The feedback is produced due to the user clicking the knob

the menu_goto call should therefore not trigger additional feedback when
switching between menus.

No change in memory
2023-04-12 16:46:33 +00:00
Alex Voinea d688f6ec6f
Menu item code: optimize return 2023-04-10 15:29:58 +02:00
Guðni Már Gilbert b735c3d040
optimisation: extract common code into SETTINGS_FANS_CHECK
Implement it as a function instead of preprocessor macro
this allows us to control inlining

Change in memory:
Flash: -34 bytes
SRAM: 0 bytes
2023-04-10 13:24:39 +02:00
Alex Voinea 9a1eb7b239
Prevent rendering of the remaining menu items if the menu is clicked
Also prevent clicking
2023-04-10 13:02:22 +02:00
Alex Voinea d3d201730e
Do not return early if the menu item is clicked
Just let the menu draw till the end even if an item is clicked. The worst this can do is waste some clock cycles

flash: -1222B
ram: 0B
2023-04-10 13:02:22 +02:00
Alex Voinea bfdef3af9f
Fix menu items optimizations when extracting to functions.
Properly increment menu_item when the menu item is clicked so that you don't get multiple menu items clicked if in view (when the menu code is deduplicated to functions)
2023-04-10 13:02:22 +02:00
Alex Voinea 339c080b19
tmc2130: optimize mask when iterating over axes
Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
2023-04-09 17:49:28 +02:00
Guðni Már Gilbert c4b4cbfc7b Make the function static 2023-04-09 13:40:10 +00:00
Alex Voinea afd4f1d5bc
Iterate over axis bits 2023-04-09 15:17:01 +02:00
Guðni Már Gilbert 4e31bb94ef tmc2130: simplify parsing axis mask
There is no need to check if every axis bit with each for-loop
iteration. We just need to check if a given axit bit is set.

Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-04-09 13:12:22 +00:00
Guðni Már Gilbert e70344dc94 Reduce XYZ cal code size
Change in memory:
Flash: -120 bytes
SRAM: 0 bytes
2023-04-09 12:23:42 +00:00
Guðni Már Gilbert 902780a929
Disable M351 when using TMC2130 and code related to it
Change in memory (MK3S+ multilang build)
Flash: -250 bytes
SRAM: 0 bytes
2023-04-07 21:07:26 +02:00
Alex Voinea e88c92a8dc
Merge pull request #4132 from leptun/fix_autoload_filament_prompt 2023-04-07 13:21:47 +02:00
Alex Voinea 449e83c7ff
Fix filament autoloading 2023-04-07 10:36:44 +02:00
Alex Voinea 72fbf3546d
Merge pull request #4131 from leptun/fix_toggle_menu_items_rendering
Fix toggle menu items rendering
2023-04-07 09:51:01 +02:00
Alex Voinea 2a3e4cac75
Fix toggle menu items rendering 2023-04-07 09:35:31 +02:00
Alex Voinea 75d0c87d57
Merge pull request #4130 from leptun/fix_sd_menu_click
SD menu do not consume click in _scrolling state
2023-04-07 09:28:15 +02:00
Alex Voinea 49096f14c3
SD menu do not consume click in _scrolling state 2023-04-07 09:11:49 +02:00
Alex Voinea ddb5a6e7b1
Merge pull request #4127 from leptun/fix_menu_choice_encoder_rotation
Fix knob rotation
2023-04-07 00:14:42 +02:00
Alex Voinea 10ba758bf7
Fix menu encoder rotation 2023-04-06 21:35:30 +02:00
Alex Voinea 373fab883d Fix fsensor runout conditions
And also reorder autoload and runout conditions
2023-04-06 10:37:29 +02:00
D.R.racer dfe6ea6470 Fixup after rebase 2023-04-06 07:44:16 +02:00
D.R.racer c16db4e607 Remove lcd_encoder clamp check
as proposed by @leptun
2023-04-06 07:44:16 +02:00
Guðni Már Gilbert 6d2a66c1e8 match menu_goto's encoder type to lcd_encoder type
Change in memory:
Flash: -20 bytes
SRAM: 0 bytes
2023-04-06 07:44:16 +02:00
Guðni Már Gilbert 4ca7f8ce2d cleanup: drop lcd_encoder in _menu_edit_P
Taken from PR 3985 by adding currentValue infrastructure

Change in memory:
Flash: 0 bytes
SRAM: 0 bytes
2023-04-06 07:44:16 +02:00
Guðni Már Gilbert 062ea1cf25 optimisation: make lcd_encoder two bytes (int16_t)
lcd_encoder was int32_t (4 bytes) because of the menu code
when editing through the menus, the menus only accept
int16_t so it doesnt make sense to use int32_t.

Change in memory:
Flash: -892 bytes
SRAM: -2 bytes
2023-04-06 07:44:16 +02:00
Guðni Már Gilbert c754c8dd5f Remove menu code in favor of simplicity
This change needs to be approved of course due to it affecting UI

The affect UI is only one menu
lcd_settings_linearity_correction_menu

I doubt many users are using this menu except very advanced users.

I propose we delete the variant of menu_draw_P which was used for
uint8_t but renders them as floats.
Instead treat
uint8_t same as int16_t i.e. just render integers.

Keeping it simple :) Solve our fanSpeed problem.

Change in memory:
Flash: -140 bytes
SRAM: -2 bytes
2023-04-06 06:05:59 +02:00
Guðni Már Gilbert 876ea6c228 Change block buffer fan speed to one byte
It's only assigned to variables which are uint8_t

Change in memory:
Flash: -10 bytes
SRAM: -16 bytes
2023-04-06 06:05:59 +02:00
Guðni Már Gilbert 2ced00f21c Convert fanSpeed and saved_fan_speed to uint8_t
These variables only range from 0 to 255

For the menus we currently need to convert fanSpeed to int16_t.

Change in memory:
Flash: -160 bytes
SRAM: -2 bytes
2023-04-06 06:05:59 +02:00
Guðni Már Gilbert 76a8c80ef0 Fix issue with size being wrong at runtime
Change in memory:
Flash: +40 bytes
SRAM: 0 bytes
2023-04-05 17:52:48 +02:00
Guðni Már Gilbert 7ad137e570 Add preheat_cmd into PROGMEM
Change in memory:
Flash: -30 bytes
SRAM: 0 bytes
2023-04-05 17:52:48 +02:00
Guðni Már Gilbert 5ef00fb78a Reduce code size in first layer calibration
Pull out common enqueuing loop into one function

Change in memory:
Flash: -70 bytes
SRAM: 0 bytes
2023-04-05 17:52:48 +02:00
Guðni Már Gilbert 5b04812017 Eliminate subtraction in print time statistic
Change in memory:
Flash: -20 bytes
SRAM: 0 bytes
2023-04-05 11:16:54 +02:00
Guðni Már Gilbert ee39cb4e90 remove one global variable 2023-04-05 11:16:54 +02:00
Guðni Már Gilbert 768319f1e7 optimisation: cleanup print statistics
Change in memory:
Flash: -104 bytes
SRAM: 0 bytes
2023-04-05 11:16:54 +02:00
Guðni Már Gilbert b9717b03e7 Make bFilament variables static and move to top of file 2023-04-05 11:16:14 +02:00
Guðni Már Gilbert 68d902c4e1 Take FilamentAction as parameter
Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
2023-04-05 11:16:14 +02:00
Guðni Már Gilbert 210bbe9764 Remove dead code 2023-04-05 11:16:14 +02:00
Guðni Már Gilbert 301b2e4384 Optimisation: Move filAutoLoad to ultralcd
We can reuse preheat_or_continue() function

Change in memory:
Flash: -22 bytes
SRAM: 0 bytes
2023-04-05 11:16:14 +02:00
Alex Voinea 1b9379b328 PSU_DELTA alternative 2023-04-05 11:12:17 +02:00
Guðni Már Gilbert ffc34edf4c Pull in changes from PR 4080
Additionally make lcd_encoder_bits static
since it's not used outside the ISR context
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert a7e9ccfb57 Major refactoring
Fixes all the issues I've found so far.

Roughly 60B of flash saved. Need to double check that later.
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert d89e6de040 Update lcd_encoder in lcd_update
This fixes the spurious feedback when rotating the knob
because lcd_update is called much often than the interval
at which the lcd rendering is updated

Change in memory
Flash: -88 bytes
SRAM: -9 bytes
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert 67c206ea5c Remove menu_back_if_clicked_fb
Since feedback is always produced on knob click
we can use menu_back_if_clicked instead

Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert 0cac7612db optimisation: Always make sound when knob is clicked or rotated
This commit adds the ability for firmware to make sounds when the
knob is clicked or rotated, when LCD updates are disabled.

The improvement here is the sound is being made with one line of code
whether or not LCD updates are enabled or disabled.

Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2023-04-05 10:30:59 +02:00
Guðni Már Gilbert 7de725f840 G80: Change 'correction' data type to int8_t
Valid values range from -100 to 100. Storing this value as four bytes
(int32_t) is not efficient.

Instead we can store G80 user input temporarily as int32_t and check
if the value is within the allowed range. If it is, then we convert the
int32_t (4 bytes) to int8_t (1 byte).

Change in memory:
Flash: -78 bytes
SRAM: 0 bytes
2023-04-05 10:13:27 +02:00
Guðni Már Gilbert 956efde822 G80: Re-implement optimisation from user espr14
Original Pull Request:
https://github.com/prusa3d/Prusa-Firmware/pull/3061

Change in memory:
Flash: -292 bytes
SRAM: 0 bytes
2023-04-05 10:13:27 +02:00
D.R.racer 7f921b4071 Limit some of the float formatting to fit 30 bytes buffer in enquecommandf_P 2023-04-05 09:10:39 +02:00
Guðni Már Gilbert b9ce7637df Rename enquecommandf() into enquecommandf_P() 2023-04-05 09:10:39 +02:00
Guðni Már Gilbert 7e119f733f Implement variant of enquecommand which accepts format string
This eliminates many local buffers

Change in memory:
Flash: -450 bytes
SRAM: 0 bytes
2023-04-05 09:10:39 +02:00
Guðni Már Gilbert 687c14808a optimisation: MMU silent mode toggling & init
Change in memory:
Flash: -16 bytes
SRAM: -2 bytes
2023-04-04 17:07:55 +00:00
3d-gussner 4cf46893fc Revert "Fix a few ambiguous overloaded calls"
This reverts commit b7c42e83cf.
2023-04-04 16:12:41 +02:00
Guðni Már Gilbert 46852e9941 M862: determine decimal through math rather than checking for null byte/pointer.
This way doesn't add any more flash memory.
Calculating the string length or checking for a null byte
will end up increasing flash consumption overall.
2023-04-04 15:22:21 +02:00
Guðni Már Gilbert 478627b6bc Simplify parsing M862
This gets rid of float conversion.
We just need to check the 6th character when M862 is detected. This
character gives us the digit after the dot.

Change in memory:
Flash: -20 bytes
SRAM: 0 bytes
2023-04-04 15:22:21 +02:00
Guðni Már Gilbert b9fecab239 Reduce calls to __divsf3 when calculating feedrate
For non-time critical code it is more effcient to call a function
rather inlining each division operation.

Change in memory:
Flash: -122 bytes
SRAM: 0 bytes
2023-04-04 15:16:56 +02:00
Guðni Már Gilbert 65750b9a4c accel is uint32_t, drop float in comparsion
Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2023-04-04 15:11:29 +02:00
Guðni Már Gilbert c0e21563e7 planner: optimise acceleration limits
Rename acceleration_st to acceleration_steps_per_s2 to be same as Marlin 2

Store the accelerator in local variable accel
while we are performing the limit checks.

When limit checks are done we can assign
the block it's acceleration. Especially
block->acceleration_steps_per_s2 is now only written to once, instead of direcly in the limit checks.

Change in memory:
Flash: -118 bytes
SRAM: 0 bytes
2023-04-04 15:11:29 +02:00
3d-gussner a1234b3670
Merge pull request #4122 from leptun/mmu2_fix_ptfe_check_distance
Fix MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH for MMU2
2023-04-04 15:04:58 +02:00
Guðni Már Gilbert b7c42e83cf Fix a few ambiguous overloaded calls
Noticed this when exploring another optimisation

By specification exactly which overloaded function to use
we save some memory

Seems to have something to do with doing arithmetic in the function argument

Change in memory:
Flash: -156 bytes
SRAM: 0 bytes
2023-04-04 15:03:48 +02:00
3d-gussner 3b049a1b91
Merge pull request #4111 from gudnimg/E-cool-gudni
Fix clicking noise during Toolchange when E-cool mode is enabled
2023-04-04 15:03:37 +02:00
3d-gussner eb3421f0f2
Merge pull request #4021 from gudnimg/cleanup_crashdet_detected
cleanup: remove unnecessary LCD update in `crashdet_detected()`
2023-04-04 14:58:30 +02:00
3d-gussner 91ad87b5a7
Merge pull request #4096 from gudnimg/msg-btn-more-translation
Remove `MSG_BTN_MORE` from translation list
2023-04-04 14:57:30 +02:00
Guðni Már Gilbert 3e4592b7fd Don't duplicate silent mode menu
Create a common function for the menu

This saves a lot of memory and 50 lines of code!

Change in memory:
Flash: -110 bytes
SRAM: 0 bytes
2023-04-04 14:47:45 +02:00
Alex Voinea ebf8b16df5
Fix MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH for MMU2 2023-04-02 11:35:17 +02:00
3d-gussner 26f547bb47
Merge pull request #4113 from gudnimg/G28W-opt
Re-use `G28 W` string from PROGMEM
2023-03-29 08:31:15 +02:00
Guðni Már Gilbert 5be4504fea Re-use G28 W string in PROGMEM
Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2023-03-27 18:14:28 +00:00
Guðni Már Gilbert 138654e207 Add comment
Note we cannot use too long extrusions
2023-03-26 09:16:07 +00:00
Guðni Már Gilbert 4342217159 Add comment about planner_aborted = false 2023-03-26 09:00:34 +00:00
Guðni Már Gilbert 6bdc3c5cfb Improve MMU toolchange when E-cool mode is enabled
Currently we are queuing many small 2 mm E-moves until the filament
sensor triggers. We do this because we never abort any queued moves,
so making small 2 mm moves ensures we do not move the E-motor more than
2 mm past the filament sensor.

Unfortunately, when E-cool mode is enabled, the E-motor will create
audible clicking sounds (similar one hears during jam or a loose grub
screw). A workaround for this is to queue one or more very long moves.
Where very long is something of the order of hundreds of millimeters. I
have it set to 350 mm but it's just a random constant really. Keep in
mind the firmware will block too large E-moves, if I recall correctly
it was anything above > 450 mm (see PREVENT_LENGTHY_EXTRUDE)

In order to use very long moves, we must somehow stop the E-motor from
moving once the filament sensor triggers. In other words, throw away
what's left of the current E-motor move. For this simple purpose we can
use planner_abort_hard() but we must set planner_aborted to false
afterwards because the code architecture does not allow the main loop()
to run until the Toolchange command is done processing.

Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
2023-03-26 08:57:59 +00:00
3d-gussner 6dbf35f6e6
Merge pull request #4062 from gudnimg/cleanup_move_planned
remove duplicate function in planner
2023-03-24 14:06:19 +01:00
3d-gussner 34ec1ff190
Merge pull request #4098 from gudnimg/PFW-1515
PFW-1515 Fix an issue with Thermal Anomaly message
2023-03-24 14:04:21 +01:00
3d-gussner 6959b372ec
Merge pull request #4063 from gudnimg/PFW-1503
PFW-1503 Improve live Z babystep menu handling
2023-03-24 14:01:15 +01:00
3d-gussner 7bbd561f00
Merge pull request #4104 from 3d-gussner/MK3130RC1_Hungarian
Update Hungarian translation.
2023-03-24 14:00:20 +01:00
3d-gussner b9103a113c
Merge pull request #4102 from 3d-gussner/MK3_fix_Hbed_MMULoadingTest
Fix HBed on Load for MMU Loading test
2023-03-24 13:59:58 +01:00
3d-gussner 4feacfe822
Merge pull request #4093 from gudnimg/Restore-default-M701-M702-Z-lift
Restore previous Z-lift in M701/M702 + other PROGMEM optimisations
2023-03-24 13:59:47 +01:00
3d-gussner fd0e4ee605
Merge pull request #4090 from gudnimg/PFW-1509
PFW-1509 Fix an issue with unload when nozzle is cold
2023-03-24 13:59:35 +01:00
3d-gussner 86ae64ea59 Update Hungarian translation. Credits to @AttilaSVK 2023-03-22 18:03:18 +01:00
3d-gussner 7e0bf88431 Use `G28 W` only 2023-03-22 12:30:16 +01:00
3d-gussner 5536873eca Fix HBed on Load for MMU Loading test 2023-03-22 09:50:59 +01:00
Guðni Már Gilbert c5fc1168ed PFW-1515 Fix an issue with Thermal Anomaly message
Issue introduced with PFW-1504

Change in memory:
Flash: +40 bytes
SRAM: 0 bytes
2023-03-20 20:35:49 +00:00
Guðni Már Gilbert 178c1f4aa6 Header cleanup 2023-03-20 13:57:20 +00:00
Guðni Már Gilbert 0dbae6b609 Remove MSG_BTN_MORE from translation files 2023-03-19 16:52:40 +00:00
Guðni Már Gilbert e2b58d8724 Don't translate the more button 2023-03-19 16:50:42 +00:00
Guðni Már Gilbert 5643d16c01 cleanup: remove redundant lcd_update in cashdet_detected
There is no need to repeat:
lcd_update_enable(true);
lcd_update(2);

Also lcd_clear() is redundant because lcd_update(2) will clear the LCD

Change in memory:
Flash: -16 bytes
SRAM: 0 bytes
2023-03-18 19:52:08 +00:00
Guðni Már Gilbert bc27b71729 Pull one common G1 gcode into PROGMEM
Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
2023-03-18 17:37:27 +00:00
Guðni Már Gilbert f296b3f826 G21 is not implemented, don't queue it
It's just a single 'break', will likely not be implemented

Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-03-18 17:23:01 +00:00
Guðni Már Gilbert 6edd8b0719 Add M220 into PROGMEM
Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2023-03-18 17:09:43 +00:00
Guðni Már Gilbert 00515a975d Add M107 into PROGMEM
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-03-18 17:05:35 +00:00
Guðni Már Gilbert 5ade1716bf Add M500 into PROGMEM
Change in memory:
Flash: -6 bytes
SRAM: 0 bytes
2023-03-18 17:01:59 +00:00
Guðni Már Gilbert 733bc874fb Move G28W0 to messages
No change in memory
2023-03-18 16:48:30 +00:00
Guðni Már Gilbert 466a6a8fc3 Add M600 into PROGMEM
Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2023-03-18 16:33:13 +00:00
Guðni Már Gilbert 129cc18cbf Add M23 %s into PROGMEM
Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2023-03-18 16:18:05 +00:00
Guðni Már Gilbert 7c0ead7bc2 Add M24 into PROGMEM
Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2023-03-18 16:15:10 +00:00
Guðni Már Gilbert 5f8fc64a32 Restore previous Z-lift in M701/M702
Previously when the firmware called M701/M702 manually
there was no Z lift. But after we added support for the Z
parameter we set the default to 50mm.

Change strings "M701" to "M701 Z0" and "M702" to "M702 Z0"
to restore the previous behavior from before 3.13.

Also pulled the gcodes into PROGMEM in message.cpp
along with M83 and M84 to save memory.

Change in memory:
Flash: -34 bytes
SRAM: 0 bytes
2023-03-18 15:34:47 +00:00
Guðni Már Gilbert 942021cb2b PFW-1503 Fix an issue where the menu is dismissed in First layer calibraiton
When the extruder lifts up after completing the Purge line,
 the baby stepping is not allowed for a short time. This dismisses
 the menu. We don't want this behavior, so only apply the Z-axis requirement
 when printing.

 Change in memory:
 Flash: +8 bytes
 SRAM: 0 bytes
2023-03-18 12:47:40 +00:00
Guðni Már Gilbert e40d8ebbcc Implement printJobOngoing()
This makes the if statments a little bit more readable

Change in memory:
Flash: -88 bytes
SRAM: 0 bytes
2023-03-18 12:18:43 +00:00
Guðni Már Gilbert 561d8599d2 PFW-1503 drop {} for consistency 2023-03-18 11:56:06 +00:00
Guðni Már Gilbert 59314a41c1 PFW-1503 only allow babystepping on the first couple of layers
Change in memory:
Flash: +28 bytes
SRAM: 0 bytes
2023-03-18 11:56:06 +00:00
Guðni Már Gilbert 09d918ce5d PFW-1503 Change BABYSTEP_ALLOWED to babystep_allowed
I initially started with a preprocessor macro
called  BABYSTEP_ALLOWED, but now it is a function.
It more common to use lower case for function names
2023-03-18 11:56:06 +00:00
Guðni Már Gilbert bb614f669d PFW-1503 Add additional check
Add lcd_commands_type == LcdCommands::Layer1Cal
just in case blocks_queued() is 0 for one instant between
lcd_command steps

Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2023-03-18 11:56:06 +00:00
Guðni Már Gilbert bc2366cd8d PFW-1503 Improve live Z babystep menu handling
Fixes an issue with running first layer calibration twice in a row.

Improvements:
Now the Z baby step menu closes automatically when first layer calibration is done.
No need to wait for a timeout or close the menu manually by setting a variable

If the baby stepping menu is open, and suddenly
the printer enters a state where baby stepping
is not allowed.
The printer will save the last value before closing the menu.

When LcdCommands != Idle, don't dismiss
the Z baby step menu. This saves 20B

Change in memory:
Flash: -130 bytes
SRAM: 0 bytes
2023-03-18 11:56:05 +00:00
Guðni Már Gilbert 5c010a3aaa PFW-1509 Fix an issue with unload when nozzle is cold
Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-03-18 10:43:23 +00:00
DRracer 16ec3e376f
Merge pull request #4086 from 3d-gussner/MK3_3130RC1_bumpup
Bump up commit number
2023-03-15 08:12:59 +01:00
3d-gussner c3235386a1 Bump up commit number 2023-03-15 07:52:01 +01:00
3d-gussner 3243dfed26
Merge pull request #4085 from 3d-gussner/MK3_PFW-1445_pre-release
Revert MSG_BTN_MORE non-translated
2023-03-15 07:48:03 +01:00
3d-gussner 8b49d241d2 revert BTN_MORE non-translated 2023-03-15 07:03:41 +01:00
3d-gussner 35eed189f9
Merge pull request #4082 from 3d-gussner/MK3_PFW-1445_pre-release
PFW-1445: Shorten and updated translations
2023-03-14 15:48:43 +01:00
3d-gussner 00309f42c3 Bump up fw version
6508 from t3.13.0-BETA1
+50 commits
+1 for this commit
+1 for merge
2023-03-14 15:18:13 +01:00
D.R.racer 3fe2f25c9f Disable reading MMU register 0x21
It has proven to be too unreliable and may confuse end users.
2023-03-14 15:12:50 +01:00
D.R.racer b837c11840 Disable reading MMU register 0x21
It has proven to be too unreliable and may confuse end users.
2023-03-14 14:16:41 +01:00
3d-gussner 68b4a8a6cb Last minute changes need a revert of the fw bump up 2023-03-14 11:22:43 +01:00
3d-gussner 731ea14bd8 Fix Swedish translation
Thanks to @jmd73
2023-03-14 11:21:46 +01:00
3d-gussner e87e1630e2 Bump up version
t3.13.0-BETA1 commit nr 6508
+46 commits between
+1 commit for this PR
+1 commit for the merge
=6556
2023-03-14 09:09:38 +01:00
3d-gussner ce1c059ade update pot and po files 2023-03-14 09:04:07 +01:00
3d-gussner e951a106d6 Messages fit to pages 2023-03-14 08:56:46 +01:00
3d-gussner 3db8233e4d Consistant wording `Tuit` 2023-03-14 08:32:35 +01:00
3d-gussner 8604c93ccc Shorten messages as users will contact support anyway 2023-03-14 08:32:16 +01:00
3d-gussner 4c5948d048 Update Solvak translation
Thanks to @ingbrzy
2023-03-14 08:32:01 +01:00
3d-gussner a5146bc2e3 Fix 2 Swedish 2023-03-14 08:31:46 +01:00
3d-gussner b2cf8fb874 Fix Swedish
Thanks @Painkiller56 for review
2023-03-14 08:31:34 +01:00
3d-gussner 616cf61583 Revert 2023-03-14 08:31:21 +01:00
3d-gussner 0cd807faf1 Fix Firmware_cs.po 2023-03-14 08:30:55 +01:00
3d-gussner 79a2bbf86b Translate missing messages part y 2023-03-14 08:30:41 +01:00
3d-gussner 5582fbf71e Translate missing messages part x 2023-03-14 08:30:27 +01:00
3d-gussner 22e70faa71 Remove `MMU2` and `MMU unit` messages
Saves 26byte of flash
Saves -368 byte in trasnlations
2023-03-14 08:30:15 +01:00
3d-gussner 7676df88a4 Rename forgotten `MMU2` message to `MMU` 2023-03-14 08:30:03 +01:00
3d-gussner 61f89246e8 Fix build too long translation 2023-03-14 08:27:45 +01:00
3d-gussner 588985b7f1 more missing translations 2023-03-14 08:27:25 +01:00
3d-gussner 235c4ae943 Do not `MSG_BTN_MORE` translate 2023-03-14 08:26:39 +01:00
3d-gussner b9a20d0678 Update translations part 2 2023-03-14 08:25:44 +01:00
3d-gussner 97a969c495 Add missing translations
Part 1
2023-03-14 08:25:22 +01:00
3d-gussner 9721a87ef2 Raname `MMU2` message to `MMU` as everywhere 2023-03-14 08:24:50 +01:00
3d-gussner 03778226ca Remove `Select Extruder:` message
Post fix PR4064 for update.po*.py scripts
2023-03-14 08:24:12 +01:00
3d-gussner 93598ef00d Change some messages to be max three rows instead of two
Yes|No are now located at the 4th row and so messages can
use three rows. This should allow improvement in some translations.
2023-03-14 08:23:40 +01:00
3d-gussner 1ea85f0453 Shorten translations 2023-03-14 08:21:48 +01:00
Guðni Már Gilbert ebf94c572f PFW-1504 Minor optimisation
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 42878341af PFW-1504 More correct solution to the pixel count issue
The fact that the relationship between
machine position and pixel index is not linear
means we cannot simply rely on comparing
the previous position to the next machine position. i.e derivative of E_AXIS
Because around the max amplitude of the triangle wave
the slope will suddenly change sign and will create a deadzone
which has width 2*mm_per_pixel.
For MMU2S this is ~10mm (or two pixels).

Instead we should split the moves.
And only plan the 2nd move once we're
at the top of the triangle wave. That way we don't really care about the position delta.

Now we just calculate the current y(x)
position relative to current position and divide by mm_per_pixel.
If there is a delta measured with unit 'pixel' then that means
 its time to render the next pixel.

 This solution seems to work well so far on my end.

 Change in memory:
 Flash: +2 bytes
 SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert b5e323e67c PFW-1504 rename length_step_mm to mm_per_pixel
Its more descriptive
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 9865d4a38a PFW-1504 Add precision error
This fixes an issue where sometimes
not all 20 pixels are rendered.

It is better to render 1 too many pixels (sometimes), rather than rendering too few.

Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert f2157c6f1d Fixup
We're always setting the cursor position when rendering now

Saves 8 bytes of flash
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert c518bfdb73 PFW-1504 Set cursor position each time to be safe
Change in memory:
Flash: +18 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 59e1ac0396 PFW-1504 implement stepper_get_machine_position_E_mm()
This function should be used when reading the current machine
position while a move is ongoing

No change in memory
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 690d83a94a fixup 2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 9145c8f59f PFW-1504 too much?
I'm not happy with the current solution, I think we can improve it
by using the fact that this is a triangle wave. Need to think about it.
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 73c76579af PFW-1504 Add init for progress bar
In case we are running a retry, the firmware
should clear the old rendering before
starting on a new one

Change in memory:
Flash: +6 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert 51f1aa14a5 PFW-1504 Update last position as quickly as possible
0.1mm extrusion may happen while updating the LCD

No change in memory
2023-03-13 06:47:08 +01:00
Guðni Már Gilbert bbfc4b9f78 PFW-1504 initial commit
Change in memory:
Flash: +162 bytes
SRAM: 0 bytes
2023-03-13 06:47:08 +01:00
3d-gussner 04d440a9c8
Fix AutoLoad filament menu not shown when FSensor is [Off] (#4072)
Fix AutoLoad filament menu not shown when FSensor if [Off]
2023-03-10 14:23:56 +01:00
3d-gussner ce78ac19ff
Merge pull request #4071 from 3d-gussner/MK3_Fix_M706_LCD_stuck
Fix M706 lcd message stuck
2023-03-10 07:57:01 +01:00
3d-gussner ba41b2bb0b Fix M706 lcd message stuck 2023-03-09 07:00:40 +01:00
DRracer e787111922
Add MMU error code: MCU_UNDERVOLTAGE_VCC (#4069)
+ read bandgap voltage periodically
+ correct wording of ERR_ELECTRICAL_MCU_UNDERVOLTAGE_VCC (as requested in Prusa-Error-Codes PR#81)
2023-03-08 15:42:25 +01:00
Guðni Már Gilbert a20a7232a8 Change "Extruder N" to "Filament N"
Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
2023-03-06 10:26:12 +01:00
Guðni Már Gilbert 0b261ad4de remove duplicate function in planner
moves_planned() should be used instead

No change in memory
2023-03-03 21:11:16 +00:00
3d-gussner 03280c48d5
Merge pull request #4059 from gudnimg/planner-opt-subtraction
planner: calculate step difference once
2023-03-03 14:42:47 +01:00
3d-gussner 474d489c39
Merge pull request #4033 from gudnimg/improve-preheat-target
preheat: improve target temperature threshold
2023-03-03 14:41:58 +01:00
D.R.racer bc818636b0 Increase MMU FW version to 2.1.8
in relation to MMU-218
2023-03-02 19:58:00 +01:00
Guðni Már Gilbert d487254806 planner: calculate step difference once
Change in memory:
Flash:-158 bytes
SRAM: 0 bytes
2023-03-01 22:28:08 +00:00
vintagepc 13f7ba81ff Cleanup, share more M914/5/FORCE code 2023-02-25 15:49:15 -05:00
vintagepc 7214584723 Fixed conflict with force_z, added P flags 2023-02-25 15:24:59 -05:00
vintagepc 487c7d63e1 Partial 2023-02-25 15:02:26 -05:00
vintagepc 6dfbdd3735 Enable M914/5, Show in settings if overloaded 2023-02-25 14:49:40 -05:00
DRracer 93580ce471
Merge pull request #4051 from 3d-gussner/MK3_3130_B1
Bump up FW version and build number
2023-02-24 16:57:30 +01:00
3d-gussner 051054b0db Bump up FW version and build number 2023-02-24 16:42:36 +01:00
3d-gussner cdca628556
Merge pull request #4050 from DRracer/mmu-eeprom-reset
Introduce MMU EEPROM reset feature
2023-02-24 15:43:49 +01:00
D.R.racer 303a67cd6f Introduce MMU EEPROM reset feature
This new feature requires MMU FW v 2.1.7 (which brings some more small changes)
2023-02-24 15:26:07 +01:00
3d-gussner 31bfbb4ed0
Merge pull request #4023 from DRracer/rename-eject-mmu
PFW-1497 Change Eject filament -> Eject from MMU
2023-02-23 10:48:35 +01:00
3d-gussner afc866e756
Merge pull request #4010 from gudnimg/improve-backlight-control
backlight: always allow backlight to dim/wake
2023-02-21 10:00:03 +01:00
3d-gussner e6c3130ef3
Update SK po file
Thanks to @ingbrzy see https://github.com/prusa3d/Prusa-Firmware/pull/4023#issuecomment-1436084153
2023-02-21 07:24:21 +01:00
3d-gussner 22b43c2f2b
Merge pull request #4043 from 3d-gussner/MK3_Fix_fil_loaded_timeout
MK3: Set `Is filament loaded? Yes|No` default to `No` without a timeout.
2023-02-21 07:18:54 +01:00
Guðni Már Gilbert 8a926fad10 backlight: set rotation flag when certain amount of pulses are detected
We don't want to trigger a backlight wakeup randomly, for example
due to background noise.
2023-02-20 18:26:43 +00:00
3d-gussner 792a39c416
Merge pull request #3754 from gudnimg/languages-gudni
Update language script to run on Windows
2023-02-20 19:10:50 +01:00
gudnimg 940f5b7214 Add executable permission for update-po.py and update-pot.py on Linux 2023-02-20 17:53:41 +00:00
3d-gussner 36c6b323c4 Set `Is filament loaded? Yes|No` default to `No` without a timeout. 2023-02-20 16:31:23 +01:00
3d-gussner 791b9b4d39
Merge pull request #4028 from DRracer/pr3322-updated
Merge duplicate strings in cmdqueue.cpp
2023-02-20 13:51:09 +01:00
Guðni Már Gilbert 496b52b819 preheat: sync temperature threshold in M600 and Wizard
* M600 used 1°C threshold, which may increase the waiting time a bit
* Wizard used 3°C

Sync both to use TEMP_HYSTERESIS for consistancy

No change in memory footprint
2023-02-19 13:23:31 +00:00
Guðni Már Gilbert 6ad126ef0b optimisation: preheat menu always uses integers for target temperature
Let's drop the float comparison since it not needed

Change in memory:
Flash : -16 bytes
SRAM: 0 bytes
2023-02-19 13:21:30 +00:00
Guðni Már Gilbert 319fec47f0 preheat: improve target temperature threshold
Use 5°C threshold to be consistant with other parts
of the firmware.

Relying on 95% of the target temperature creates
a dependency on the temperature:

PLA: Target = 215°C, threshold = 10.75°C
PETG: Target = 230°C, threshold = 11.5°C
ABS: Target = 255°C, threshold  = 12.75°C
ASA: Target =260°C, threshold = 13.0°C
PC: Target = 275°C, threshold  = 13.75°C

My proposal is we instead use a constant
TEMP_HYSTERESIS = 5, which is consistent with
M109, and behavior when restoring print from RAM
and some of the MMU code (like unload function)

Change in memory:
Flash: +2 bytes
SRAM: 0 bytes
2023-02-19 12:59:58 +00:00
D.R.racer 1283c2c216 Reformat to fit to 4 lines 2023-02-18 21:15:55 +01:00
Snakzi 82d9819af3 Fix grammatical errors 2023-02-18 21:15:55 +01:00
Guðni Már Gilbert db878c9996 backlight: always allow backlight to dim/wake
This commit adds the ability for the firmware to dim and wake the
backlight when LCD updates are disabled. Such as in the MMU error screen
or when rendering full screen messages which typically
disable the LCD updates to prevent the status screen from rendering.

Fixes #2777

Change in memory:
Flash: -26 bytes
SRAM: +1 byte
2023-02-18 17:08:35 +00:00
D.R.racer fe71fa77a6 Update NO translation 2023-02-18 17:40:09 +01:00
D.R.racer 6f066db443 Update HU translation 2023-02-18 17:39:30 +01:00
D.R.racer 5cd60636f9 Add missing translations + shorten to 16 chars 2023-02-18 17:39:30 +01:00
D.R.racer ec1ae321b3 ES translation 2023-02-18 17:39:30 +01:00
D.R.racer 98e7c15928 Change Eject filament -> Eject from MMU
PFW-1497
2023-02-18 17:39:30 +01:00
Guðni Már Gilbert 05662a5c0a optimsation: reduce code size in LCD rendering
Change in memory (MK3S+ Multilang):
Flash: -62 bytes
SRAM: -6 bytes
2023-02-18 16:32:08 +01:00
Guðni Már Gilbert 074057c110 Fix an issue where LCD freezes during loading test
It may be useful to view the Sensors menu
while the toolchange loading test is taking
place. For example to see if the reading is flickering

The firmware needs to call lcd_update(0) to update the screen rendering.

Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-02-18 13:16:40 +01:00
Guðni Már Gilbert 555e766296 optimisation: only update mm when i > 0
Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2023-02-18 12:39:44 +01:00
Guðni Már Gilbert e41b6d106d optimisation: use more string from PROGMEM
Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2023-02-18 12:39:44 +01:00
Guðni Már Gilbert 9f4a7adb9a optimisation: extract common M861 code
Change in memory:
Flash: -128 bytes
SRAM: 0 bytes
2023-02-18 12:39:44 +01:00
D.R.racer ee23d6c62a Merge duplicate strings in cmdqueue.cpp
Original idea from @GilesBathgate, PR #3322 . This is just a rework on top of current MK3 branch.
2023-02-18 11:37:48 +01:00
Guðni Már Gilbert 526e02a041 Fix an issue with using --file argument
The following command did not work in the lang folder:
python .\update-po.py --file ./po/Firmware_cs.po

To resolve this we just extract the filename from
the path and use the constant PO_DIR to make
sure the path is always the same.
2023-02-18 10:30:18 +00:00
Guðni Már Gilbert b6ef8ea32c Add a backup of po files 2023-02-18 10:13:34 +00:00
gudnimg 280a904799 ubuntu: subprocess does not allow extended glob
It's my understanding that we cannot use extended globbing
on Linux because
of the way I am invoking the lang-extract
script.  the python script is not run through bash/shell.

We would need to perhaps use Shell = True in check_call() but
then the all the input arguments needs to be one string.

This commit was tested on Ubuntu 22.04.1 LTS
2023-02-18 09:53:57 +00:00
Guðni Már Gilbert 327254d091 Expand glob in update-pot on Windows only 2023-02-18 09:53:57 +00:00
Guðni Már Gilbert 62c87a1fe5 Adjust module docstring 2023-02-18 09:53:57 +00:00
Guðni Már Gilbert b14f3780d4 Add mutually exclusive arguments --file and --all
Only one of these arguments must be supplied, or argparse raises an error.
2023-02-18 09:53:57 +00:00
Guðni Már Gilbert 4a93288353 Update README 2023-02-18 09:53:57 +00:00
Guðni Már Gilbert d90859e6a6 Add requirements.txt 2023-02-18 09:53:57 +00:00
Guðni Már Gilbert 7966633c1a Allow languages to be updated from any directory
Now these commands will work:
python .\lang\update-po.py
python .\lang\update-pot.py

When current working directory is
.\Prusa-Firmware\

Previously, you'd need to call the
script within the lang folder.
2023-02-18 09:53:56 +00:00
Guðni Már Gilbert 53ced0cb21 languages: Add new script update-pot.py 2023-02-18 09:53:56 +00:00
Guðni Már Gilbert 65d7605623 languages: update lang-extract.py
Fix an issue where it does not run on Windows.
When the input argument is regex, we must first search for the files
using said regex pattern and then creating a list of files.
When opening the files, the encoding needs to be utf-8.
2023-02-18 09:53:56 +00:00
Guðni Már Gilbert 12123d6d52 languages: create new script update_po.py
The script should do the same work as when one run update_po.sh
The Python script can be run on Windows too.
2023-02-18 09:53:56 +00:00
3d-gussner 3381bf2f7e
Merge pull request #2201 from vintagepc/2091_2153_sheet_Mcode
Add M850 code for setting sheet label and offsets
2023-02-17 15:12:22 +01:00
Yuri D'Elia 1b3fa8bfe9 TM: Move headers to support the legacy build system 2023-02-17 15:01:59 +01:00
Yuri D'Elia a8f219259a TM: Split default model parameters into a separate header
Preparation to support multiple default model parameter sets
2023-02-17 15:01:59 +01:00
Yuri D'Elia d1ff728e4f TM: future-proofing for incompatible model upgrades
Introduce a model version. This is initialized at "1" and doesn't
require any upgrade/downgrade checks since it's currently
retro-compatible.
2023-02-17 15:01:59 +01:00
Yuri D'Elia 9bd03cedb9 TM: Fix UV identity 2023-02-17 15:01:59 +01:00
Yuri D'Elia ddf5147f9f TM: Optimize temp_model_set_lag
Save about 20 bytes by rewriting the sample count check
2023-02-17 15:01:59 +01:00
Yuri D'Elia b676d395e3 TM: Handle L/TEMP_MODEL_LAG 2023-02-17 15:01:59 +01:00
Yuri D'Elia 0bf6a5bc4b TM: Handle UV (PTC loss)
Model UV as power-invariant, so that scaling P doesn't change the
intercept location (that is, the zero point remains at the same
temperature even for more powerful heaters).

NOTE: It's not clear to me whether this is generally true (couldn't
find a datasheet from the same heater in diffent power variants
showing the efficiency loss)
2023-02-17 15:01:59 +01:00
Yuri D'Elia ba96c8d457 TM: Handle D/TEMP_MODEL_fS 2023-02-17 15:01:59 +01:00
Yuri D'Elia eb88b720ac TM: Handle UVDL set/load/report/upgrade
- Expose TEMP_MODEL_fS and TEMP_MODEL_LAG as D and L respectively,
  initializing the default values based on the previous hard-coded
  values.
- Always round L to the effective sample lag to future-proof model
  upgrades or changes (the stored value _is_ the effective value).
- Introduce UV as a new linear term for PTC heaters, defaulting
  to an identity for model backward-compatibility.
2023-02-17 15:01:59 +01:00
Yuri D'Elia 38b1e64687 TM: Allocate new eeprom parameters for PTC handling 2023-02-17 15:01:59 +01:00
vintagepc 235ce62cd3
Update Marlin_main.cpp
Remove more stale code
2023-02-17 08:58:17 -05:00
vintagepc 032d5ebe5b
Update Marlin_main.cpp
Fix use of removed function
2023-02-17 08:31:27 -05:00
Guðni Már Gilbert d0e0b51497 Optimisation: lcd_commands "M702 C" should be "M702"
Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2023-02-17 14:30:20 +01:00
Giles Bathgate 952b1af60b Consistent use of noinline attribute 2023-02-17 14:30:20 +01:00
Giles Bathgate 754b2d03c3 Remove extraneous line added during merge conflict resolution 2023-02-17 14:30:20 +01:00
Giles Bathgate 25f9728e09 Add noinline attribute to count_e 2023-02-17 14:30:20 +01:00
Giles Bathgate 620b19bbab Roll up lay1cal_square loops 2023-02-17 14:30:20 +01:00
Giles Bathgate f92d2279d5 Re-use duplicated strings 2023-02-17 14:30:20 +01:00
Giles Bathgate 8129a14f19 Move layer calibration finish commands into first_layer_cal.cpp 2023-02-17 14:30:20 +01:00
Giles Bathgate 39160bc4ae Free up some progmem 2023-02-17 14:30:20 +01:00
Giles Bathgate 568eec5ee0 Implement first layer cal with calculated extrusion widths 2023-02-17 14:30:20 +01:00
vintagepc 20eef890a6
Merge branch 'MK3' into 2091_2153_sheet_Mcode 2023-02-17 08:24:49 -05:00
D.R.racer 9b64d122dc Disable MMU2S by default
On printers without the MMU no error screen should occur and no attempts of communication with the MMU should be performed -> EEPROM_MMU_ENABLED should default to 0.

PFW-1418
2023-02-17 12:53:07 +01:00
Guðni Már Gilbert 6745b2c766 Shorten Reset MMU button to fit LCD
Button strings are limited to 8 characters
2023-02-13 07:08:54 +01:00
Guðni Már Gilbert b63f5433df Don't show Pause/Stop menus while processing T-codes
PFW-1449

Change in memory:
Flash: +18 bytes
SRAM: +1 bytes
2023-02-12 15:58:07 +01:00
Guðni Már Gilbert 504099bd6c optimisation: reduce code size in rendering cursor
Change in memory:
Flash: -62 bytes
SRAM: 0 bytes
2023-02-11 19:06:14 +01:00
Guðni Már Gilbert c51aa10087 optimisation: spooljoin: use new eeprom init method
Change in memory:
Flash: -40 bytes
SRAM: -1 byte
2023-02-11 15:58:07 +01:00
Guðni Már Gilbert 982b1bb4bd optimisation: backlight: use new eeprom_init function
Change in memory:
Flash: -56 bytes
SRAM: 0 bytes
2023-02-11 15:56:46 +01:00
Guðni Már Gilbert c2a952cee5 optimisation: sound: use new eeprom_init function
Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
2023-02-11 15:56:46 +01:00
Guðni Már Gilbert 8794ab2f71 respect Once sound mode
Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-02-11 15:54:33 +01:00
Guðni Már Gilbert 96fc90c80b Revert a change in the MMU error screen logic
We can pull this code into a common function in a separate PR
2023-02-11 15:54:33 +01:00
Guðni Már Gilbert 5b4bc8bcdb Tune louder beeps to match previous M600 behavior 2023-02-11 15:54:33 +01:00
Guðni Már Gilbert b4f9f6d0b5 fixup: make sure to start the timer
Change in memory:
Flash: +10 bytes
SRAM: 0 bytes
2023-02-11 15:54:33 +01:00
Guðni Már Gilbert 8db2fbc97f Improve sound handling for MMU error screen
Change in memory:
Flash: -174 bytes
SRAM: +4 bytes
2023-02-11 15:54:33 +01:00
Guðni Már Gilbert e34faee389 optimisation: don't inline Sound_MakeCustom
Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
2023-02-11 12:42:47 +01:00
Guðni Már Gilbert 7799853a05 optimisation: remove duplicate code
Sound_MakeCustom should play the sound
if critical = true OR the sound is not Silent

Change in memory:
Flash: -16 bytes
SRAM:  0 bytes
2023-02-11 12:42:47 +01:00
D.R.racer c826ae989f Remove Done button on FINDA-related MMU error screens
Follows the requirements from Prusa-Error-Codes yaml definition.
Saves a fwe bytes as well as the button switch() statement got simplified.

PFW-1494
2023-02-10 14:38:18 +01:00
3d-gussner 8b1b632164 Fix copy/paste typo thanks to @gudnimg 2023-02-10 14:35:36 +01:00
3d-gussner 4f8dbb19fd Fix `M862.x` LCD messages
As the new menue adds a Yes/No option the messages
need to be limited to c=20 r=3
Updated/shortened all translations
2023-02-10 14:35:36 +01:00
3d-gussner b02e8d9961 Fix First layer cal being stored without confirming with knob 2023-02-10 14:34:16 +01:00
RoboMagus c3cfc86094 Fix #3977 2023-02-10 14:27:04 +01:00
Yuri D'Elia d403d58b19 TM: Do not emit an "error:" on the serial for recoverable errors
Use "echo:" for thermal model error reporting to avoid octoprint
automatically sending a M112 kill.

Keep using "error:" instead for other thermal errors (MAXTEMP/etc).

This should allow resuming a thermal mode pause with the default
octoprint settings.
2023-02-10 14:24:50 +01:00
Guðni Már Gilbert ea7e717204 Cleanup: Remove various dead code 2023-02-10 08:17:36 +01:00
3d-gussner 5552bdcb32
Merge pull request #3998 from 3d-gussner/MK3_Thermal_model
PFW-1479: Change Temp model to Thermal model
2023-02-08 18:31:34 +01:00
3d-gussner ca978080c4 Change to Thermal model
Add prusa.io/tm-cal link
and update all TM related translations
2023-02-08 15:36:59 +01:00
D.R.racer 26126906ef Hardcode expected MMU FW version into the error message v2
This is an 80% solution to PFW-1488 which should be somewhat compatible with the existing languages/translations infrastructure.
I don't see a point in extending the infrastructure a great deal to support some compile-time replacement in order to patch just MSG_DESC_FW_UPDATE_NEEDED.

Related PR: https://github.com/prusa3d/Prusa-Firmware/pull/3993
2023-02-08 10:50:33 +01:00
Guðni Már Gilbert 99761bdff7 optimisation: re-use adjust_bed_reset()
Move the code into eeprom.cpp since we're only working with EEPROM

Change in memory:
Flash: -42 bytes
SRAM: 0 bytes
2023-02-08 08:01:55 +01:00
D.R.racer 3ddc2cf86d Add ResetMMU and DisableMMU buttons to specific error screens
- MMU not responding/Communication error: add DisableMMU
- MMU FW update needed: add ResetMMU

Flash: +8B
RAM: +0B
2023-02-08 06:48:11 +01:00
D.R.racer 296b0414af Optimize execute_extruder_sequence
Save 64B by refactoring of execute_extruder_sequence.
2023-02-08 06:47:50 +01:00
Guðni Már Gilbert e34ed479ef PFW-831 Add single buzzer beep when an MMU error screen is shown for the first time
If the user has the sound settings set to 'Silent' then this beep should be silent

Change in memory:
Flash: +4 bytes
SRAM: 0 bytes
2023-02-06 08:35:08 +01:00
Guðni Már Gilbert b28aa6f42a PFW-1471 Rename 'Toolchange count' to 'Material changes'
Added the string to our message so it can be translated

Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2023-02-06 08:33:40 +01:00
D.R.racer ba34661b62 Fixup after rebase onto MK3 2023-02-01 08:28:23 +01:00
Guðni Már Gilbert d66e2b66c2 Cleanup: use setTargetHotend consistently for one extruder
Main changes:
* setAllTargetHotends() is removed
* setTargetHotendSafe() is removed
* Extruder parameter on setTargetHotend() is dropped

Change in memory:
Flash: -192 bytes
SRAM: 0 bytes
2023-02-01 08:28:23 +01:00
D.R.racer ed80defc2c Shorten the Try-Load-Unload sequence
... and allow easier future tweking in case of need
Also, save ~30B of code by returning the previous E-motor position.
2023-02-01 06:38:19 +01:00
Guðni Már Gilbert e597be2cb5 PFW-1381 Optimise initialisation
Change in memory:
Flash: -2 bytes
SRAM: -1 byte
2023-01-31 10:02:15 +01:00
Guðni Már Gilbert a35e7d543f Fix bug with button choice on MMU error screen isn't reset
PFW-1381
2023-01-31 10:02:15 +01:00
D.R.racer d2f3835b2c Fixup after review 2023-01-31 09:35:22 +01:00
Guðni Már Gilbert 8720602b0e Fix an issue with corrupt serial messages 2023-01-31 09:35:22 +01:00
D.R.racer 43ae2c78e5 Fix cmake build 2023-01-31 09:35:22 +01:00
D.R.racer 528abcb8d8 clang-format 2023-01-31 09:35:22 +01:00
D.R.racer 0555376502 Refactor mmu2.cpp and related interfaces
The general idea is to keep platform specific implementation away from the MMU state machines as much as we can.
That would enable unit testing the top level MMU state machine and integration into other project as well (if needed).
2023-01-31 09:35:22 +01:00
Yuri D'Elia 51374965e4
Merge pull request #3968 from gudnimg/cmake-echo-windows
Fix an issue with using echo on Windows
2023-01-28 21:12:42 +01:00
Guðni Már Gilbert f9b779e274 Remove echo in report_size function
The output is separate by two lines anyway.
2023-01-28 18:53:31 +00:00
Guðni Már Gilbert 15932123db cmake: add target name to memory usage info 2023-01-28 18:35:06 +00:00
Yuri D'Elia 1142e05e45
Merge pull request #3967 from wavexx/pr_sizes
CI: Add a workflow to calculate PR flash/ram cost
2023-01-28 17:46:14 +01:00
Guðni Már Gilbert d0c3d3c5fd Fix an issue with using echo on Windows
Use built-in echo command in cmake instead to
ensure behavior is the same between different platforms
2023-01-28 16:43:00 +00:00
Yuri D'Elia cb93c42ca4 CI: Add a workflow to calculate PR flash/ram cost 2023-01-28 17:18:36 +01:00
Yuri D'Elia e39f2d132e TM: Check for PC parameters more carefully 2023-01-27 14:57:59 +01:00
3d-gussner 216b935488 Minor typo 2023-01-26 12:20:43 +01:00
3d-gussner 05cd50e2ef Update M214 description with link to RepRap wiki 2023-01-26 12:20:43 +01:00
Guðni Már Gilbert da63d73585 optimisation: don't print floats with lcd_print()
Change in memory:
Flash: -442 bytes
SRAM: 0 bytes
2023-01-25 18:21:22 +00:00
Guðni Már Gilbert a5f7f1d735 optimisation: change index from uint32_t to uint8_t
Change in memory:
Flash: -152 bytes
SRAM: 0 bytes
2023-01-25 18:21:22 +00:00
Guðni Már Gilbert 8c4cd11ae0 Cleanup: remove code_value_float()
The function adds a bit of overhead compared to code_value()

I suspect this function is a relic of the past.

Change in memory:
Flash: -82 bytes
SRAM: 0 bytes
2023-01-25 16:51:10 +00:00
Guðni Már Gilbert 17e6f1b75e optimisation: remove conv2str.cpp
Change in memory:
Flash: -288 bytes
SRAM: -8 bytes
2023-01-25 06:28:00 +00:00
Guðni Már Gilbert 79a10868fe cleanup: FILWIDTH_PIN doesn't exist
raw_filwidth_value variable is never used
2023-01-24 19:41:45 +00:00
3d-gussner 7b163cf464
Merge pull request #3936 from wavexx/tm_cal_htemp
TM: Do not restrict autotune temperature
2023-01-24 14:20:55 +01:00
3d-gussner fab4165f4a
Merge pull request #3920 from wavexx/selftest_ok_alert
wizard: Do no set "Self test OK" as an alert message
2023-01-24 14:16:44 +01:00
3d-gussner 1f54dfd0b2
Merge pull request #3941 from wavexx/tm_wizard_nowarn
wizard: Disable TM warnings during calibration
2023-01-24 14:15:04 +01:00
3d-gussner b04b3f649b
Merge pull request #3943 from wavexx/tml_decode
tml_decode: Fix two typos
2023-01-24 07:52:57 +01:00
Yuri D'Elia b3245cb702 tml_decode: Fix two typos 2023-01-23 21:07:48 +01:00
Alex Voinea 53fb4c3e3f Move altfan eeprom initialization to extruder_altfan_detect()
flash: -16B
RAM: 0B
2023-01-23 19:47:03 +00:00
Guðni Már Gilbert 7245c76094 Fix an issue where Altfan Override setting in EEPROM is not respected at boot-up 2023-01-23 19:47:03 +00:00
Yuri D'Elia f7b807e3cc tools: Add a TML trace decoder for temperature model debugging
Add `tml_decode` to decode a TML trace from a serial log file into a
parsable tab-separated table.

`tml_decode` also doubles a simple no-frills plotting utility.

Restructure the README for better readability.
2023-01-23 17:40:58 +01:00
Yuri D'Elia c9f3a4cfce wizard: Disable TM warnings during calibration
During calibration model warnings are possible/normal. This is
apparently leading some into thinking the hotend might be faulty
and abort the calibration with a hard reset.

Disable warnings/beeps during calibration.

Rely on the error threshold only.
2023-01-23 16:52:27 +01:00
Yuri D'Elia 679208b29e TM: Do not restrict autotune temperature
Fix a wrong type that prevents running TM autotune at temps >127
2023-01-20 19:18:19 +01:00
Guðni Már Gilbert 39f9979655 optimisation: Combine if statement in M600
Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
2023-01-18 09:44:27 +01:00
D.R.racer 6298722f9a Disable E-motor before the MMU starts doing something
It may seem counterintuitive to disable the E-motor, but it gets enabled in the planner whenever the E-motor is to move.
The idea behind disbling the E-motor when it won't be needed for some time is to save power and lower the heat of the motor.
Therefore it is especially important to disable the motor before the printer pauses a print due to some MMU error screen.
2023-01-18 09:42:57 +01:00
Alex Voinea 3767dd299a
Merge pull request #3929 from leptun/MK3_disable_M47 2023-01-18 09:31:22 +02:00
Alex Voinea 0c352ac2d1 Disable M47 if TMC2130 drivers are used
flash: -126B
RAM: 0B
2023-01-17 20:37:27 +01:00
Guðni Már Gilbert d83c0f6c40 Fix an issue with indexing PROGMEM pointer
Using array index 'pointer[index]' doesn't work properly.
Instead using "pointer + index" works fine.

No change in memory footprint
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert 9416310f7e optimisation: move row_offsets into PROGMEM
Change in memory:
Flash: -42 bytes
SRAM: -4 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert eeb5f3d50c optimisation: refactor menu_draw_P()
Add a way to only change the LCD column

Change in memory:
Flash: -90 bytes
SRAM: 0 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert 730bb3708e Fix an issue with menu_draw_item_puts_P
Change in memory:
Flash: +16 bytes
SRAM: 0 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert 4f4153175c Refactor menu_draw_toggle_puts_P
The refactoring drops the local buffer lineStr

Change in memory:
Flash: -106 bytes
SRAM: 0 bytes
2023-01-16 12:36:57 +01:00
Guðni Már Gilbert cc08b938b7 Optimisations: implement lcd_print_pad_P()
Used lcd_print_pad_P is some obvious places. We can probably use
this function in more places to further save flash memory

Change in memory:
Flash: -268 bytes
SRAM: 0 bytes
2023-01-16 12:36:57 +01:00
Yuri D'Elia 16a89b9215 wizard: Return to status after calibration 2023-01-16 11:38:56 +01:00
D.R.racer 472f84e46a Avoid FullScreenMsg "Eject/Cut Filament" when called inside a toolchange
CutFilament and EjectFilament got a flag: enable/disable FullScreenMsg
2023-01-16 09:25:04 +01:00
D.R.racer 48ce22d41f Fix blank LCD while err. Load to Extr. Failed
Because this error is not an MMU error but a printer one, the existing infrastructure has been bent to support such a scenario.
During testing it turned out, that some machines fail to draw the error screen due to previous internal states.
This PR resets the internal states so that the conditions for drawing the error screen are met.
2023-01-16 09:25:04 +01:00
Yuri D'Elia 4f177f0b38 TM: Fan measuring state reset unification
Add resetFanCheck() to reset the fan measuring state as it's needed in
several places and save some flash space.
2023-01-16 08:43:36 +01:00
Yuri D'Elia 7529652dca TM: Restore extruder autofan state when stopping/resuming
During thermal errors all fans are set to full speed.

When the print is resumed or stopped *and* the thermal error is gone,
also restore the autofan state.

Fixes #3893
2023-01-16 08:43:36 +01:00
Yuri D'Elia 204df90d6d TM: Set the cal status bit when running `M310 A` directly
Running `M310 A` should set the TM calibration bit status if the
autotune procedure was successful.

Partially addresses #3891 and #3890, since running `M310 A F0` should
*still* count as valid calibration data and is not something that can be
replicated by using the LCD (which enforces self-test).
2023-01-16 07:32:57 +01:00
Yuri D'Elia 12f5bd3648 wizard: Do not complain about missing calibration if model is disabled
This fixes #3891 without having to set the calibration bit, meaning
that if the model is later re-enabled without a real calibration, a
prompt is shown as expected.
2023-01-16 07:31:33 +01:00
3d-gussner 2d34535977 Move Z to top during Nozzle change 2023-01-16 07:27:53 +01:00
D.R.racer 58bed7e388 MMU: Make sound after the hotend reaches temp, not while waiting 2023-01-16 07:19:11 +01:00
Guðni Már Gilbert 5582114628 optimisation: re-use delay_keep_alive() in a few places
Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
2023-01-15 19:21:55 +01:00
Yuri D'Elia 9e0e0f5942 wizard: Do no set "Self test OK" as an alert message
Alert messages are intended to persist above "info" messages, thus
preventing further calibration status updates to be shown (such as
thermal model calibration).

Just set the message as a regular status message.

Fixes #3892
2023-01-15 18:25:15 +01:00
Guðni Már Gilbert d3aa40a575 Fix blank LCD issue 2023-01-14 13:51:10 +01:00
Guðni Már Gilbert 76d1f28c14 optimisation: serialecho_temperatures should print a constant extruder number
Change in memory:
Flash: -18 bytes
SRAM: 0 bytes
2023-01-14 11:22:03 +00:00
Guðni Már Gilbert 62fc19b361 optimisation: combine a few serial logs since extruder is now constant 2023-01-14 11:22:03 +00:00
Guðni Már Gilbert 858e80e806 optimisation: M109 doesn't have a T parameter.
In 8-bit firmware the tool is always 0.

Change in memory:
Flash: -146 bytes
SRAM: 0 bytes
2023-01-14 11:22:03 +00:00
Guðni Már Gilbert ff49c6a0bf optimisation: M104 doesn't have a T parameter
Change in memory:
Flash: -120 bytes
SRAM: 0 bytes
2023-01-14 11:22:03 +00:00
Guðni Már Gilbert 44660f668a optimisation: M105 doesn't have a T parameter
Remove parameter from gcode_M105() extruder is always 0.

Change in memory:
Flash: -64 bytes
SRAM: 0 bytes
2023-01-14 11:22:03 +00:00
Guðni Már Gilbert 11f56bf900 Fix building multilang firmware on Windows 2023-01-14 09:20:55 +00:00
Guðni Már Gilbert fa0a522b7d optimisation: re-use serialecho_temperatures()
Change in memory:
Flash: -82 bytes
SRAM: 0 bytes
2023-01-10 07:22:35 +01:00
Guðni Már Gilbert f1cd388370 Shorter code 2023-01-06 19:33:32 +01:00
Guðni Már Gilbert 8c79bab503 optimisation: there is only one extruder when planning a line
Change in memory:
Flash: -50 bytes
SRAM: -3 bytes
2023-01-06 19:33:32 +01:00
Guðni Már Gilbert 534c2e2664 Cleanup: Remove M218
It was only enabled when multiple extruders are enabled

The firmware doesn't support it
and even if the M218 gcode could be used, the code does not compile
2023-01-06 19:30:05 +01:00
Yuri D'Elia 0482cca212
Merge pull request #3883 from wavexx/readme_build_type
README: Set the build type in instructions
2023-01-04 13:30:51 +01:00
Yuri D'Elia 78d5d18426 README: Set the build type in instructions
Instruct to build in Release mode by default.
2023-01-04 12:50:46 +01:00
Yuri D'Elia 96a7383f19
Merge pull request #3869 from wavexx/m300_s0
Make M300 S0 pause like Marlin
2023-01-02 19:23:58 +01:00
3d-gussner 4b9c11624b
Merge pull request #3877 from 3d-gussner/MK3_Update_Cal_documention
MK3: Update calibration status v2 documentation
2023-01-02 15:42:46 +01:00
3d-gussner ba3ee0b4c6 Fix few values 2023-01-02 15:11:01 +01:00
3d-gussner 20634a3852 Update calibration status v2 documentation 2023-01-02 15:11:01 +01:00
D.R.racer 3d9dd08c16 Change MMU error links to a new url
PFW-1473
2023-01-02 12:43:08 +01:00
Yuri D'Elia 7a6d588d97 TM: Mark more internal functions as static 2023-01-02 10:52:07 +01:00
Yuri D'Elia 50209815ea TM: Also clear the status flags when disabling the model
Disabling the model during a warn/error condition will also stop
updating the warning/error flag, keeping the printer in an error state.

Clear all flags as well when changing model settings.
2023-01-02 10:52:07 +01:00
Yuri D'Elia 543b333007 Remove extra delay after critical sound
This delay doesn't exist for the tone generator, so remove it from the
pure version as well.
2022-12-31 01:13:45 +01:00
Yuri D'Elia e45adb4cee Make M300 S0 pause like Marlin
Follow Marlin's behavior and simply insert a delay for the requested
duration when using M300 S0.

When S is not specified, use the default tone instead.

Fixes #3856
2022-12-31 01:13:45 +01:00
Guðni Már Gilbert 9cbf0a28cc
Fix an issue on multilang builds where first two charactes are not rendered (#3781) 2022-12-30 15:18:48 +01:00
D.R.racer 85d27e6e5e Address 3 different start scenarios 1st lay cal + MMU
This PR tries to address the 3 different startup scenarios for 1st layer calibration with the MMU:

- 1st lay cal started with correct filament already loaded in the nozzle - we should continue, but skip the first 58mm (first 2 g-codes in the hard coded sequence) of purge line extrusion
- 1st lay cal started with other filament already loaded in the nozzle - we should unload and then issue a toolchange with no extra unload
- 1st lay cal started without loaded filament - we should just do a toolchange with no extra unload

PFW-1457
2022-12-30 15:04:45 +01:00
D.R.racer 52a3beb931 Cut & Eject: avoid preheat if no filament loaded
and add fullscreen messages for Cut & Eject (messages intentionally reused to save space)
2022-12-30 14:23:44 +01:00
D.R.racer 43f3865d7c Tune UI CutFilament & EjectFilament 2022-12-30 14:23:44 +01:00
D.R.racer ec1d12d929 Introduce FILAMENT_EJECTED + tune Eject operation + inc. MMU ver. 2.1.6 2022-12-30 14:23:44 +01:00
D.R.racer 58ff0efb30 Silence nodiscard attribute at one spot
... where it is really irrelevant
2022-12-30 14:23:44 +01:00
D.R.racer ce7ab1d73c Fixup: build MK25/MK3 (non-S) 2022-12-30 14:23:44 +01:00
D.R.racer ebbf2378ed Update MMU error texts
as per https://github.com/prusa3d/Prusa-Error-Codes/pull/71
2022-12-30 14:23:44 +01:00
D.R.racer 5e103cc24e Fixup: restoring temp. while Load2ExtrFailed 2022-12-30 14:23:44 +01:00
D.R.racer d4f0f363cd Fixes from tests
- introduce Cut Filament
- limit retries try-unload
- fix waiting in "Load to extruder failed" error screen
- add LOAD_TO_EXTRUDER_FAILED error definition
2022-12-30 14:23:44 +01:00
D.R.racer a30ea1c5ab Rename error: Load to Extruder Failed
as per request from the Content team
2022-12-30 14:23:44 +01:00
D.R.racer 0a3517e8b2 Show an error screen when try-unload fails to push filament into nozzle
This is a prototype implementation of having the ability to show an MMU error screen even for printer's errors (during an MMU operation).
Also, the retry count of unloads after failed load the extruder tube is now limited to ~3 attempts.

Technically, since this very error is not an MMU's one (MMU is just fine at this stage) but a printer's one I tried to hack the existing error-reporting infrastructure to handle such a case.
The original idea of this approach was suggested by @vintagePC
2022-12-30 14:23:44 +01:00
D.R.racer b2b7990cfc Allow tweaking try-unload feedrates
It looks like MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE can get much higher that the original 20mm/s.
50mm/s is the default now, can be tweaked further.
2022-12-30 14:23:44 +01:00
Yuri D'Elia c5d2aedfe4 wizard: Ask about the sheet before doing Z calibration
Ask to install the sheet immediately after removing the test print.
This makes further messages less confusing.
2022-12-30 14:14:01 +01:00
Yuri D'Elia 66071c0b5b wizard: Resume the wizard for missing calibrations during upgrades
Instead of checking for explicit versions, resume the wizard if some
(new) wizard is missing.

This handles both the old SELFTEST check, the new thermal model
and any future check in the same fashion.
2022-12-30 14:14:01 +01:00
Yuri D'Elia 2a1511f7b1 Read version data from progmem in eeprom_fw_version_older_than 2022-12-30 14:14:01 +01:00
Yuri D'Elia dd99b1ab32 wizard: Disable temperature model during hotend testing
This avoids confusing error messages if the hotend is defective and
caught by selftest itself.

Rearrange Stopped state checks (saves 2 bytes)
2022-12-30 14:14:01 +01:00
Yuri D'Elia 8fa0a22b8d wizard: Allow partial resuming after reset
Update the eeprom FW version as soon as migration is complete, to avoid
resetting the CALIBRATION_V2 variable at each reset.

Do not implicitly reset the calibration steps for WizState::Run: do this
only for the menu action.
2022-12-30 14:14:01 +01:00
Yuri D'Elia 414972c876 Unbreak build with !PINDA_THERMISTOR 2022-12-30 14:14:01 +01:00
Yuri D'Elia 7828788e5c Handle CALIBRATION_STATUS_TEMP_MODEL 2022-12-30 14:14:01 +01:00
Yuri D'Elia 2a13ce4c62 Handle CALIBRATION_STATUS_SELFTEST 2022-12-30 14:14:01 +01:00
Yuri D'Elia b8c1f34e31 Handle CALIBRATION_STATUS_{Z,XYZ} 2022-12-30 14:14:01 +01:00
Yuri D'Elia b41ece175b Handle CALIBRATION_STATUS_LIVE_ADJUST 2022-12-30 14:14:01 +01:00
Yuri D'Elia 5ec627c12c wizard: Rewrite the fw upgrade check logic
- Handle the conversion from the V1 calibration status to the V2 bitmap
  for all past FW versions.
- Allow to run the wizard in "Restore" mode (for example during upgrade
  or service prep) to complete any missing steps.
- Fix service prep to use the above feature by clearing the appropriate
  calibration bits.
- Remove exceptions for FW 3.2.0.4 which can now be handled cleanly.
2022-12-30 14:14:01 +01:00
Yuri D'Elia 22c0e15047 wizard: Rewrite the wizard handling loop
Simplify status tracking:

- S::Restore to continue to the next logical wizard item
- S::Finish for a successful failure
- S::Failed to exit while showing a failure
2022-12-30 14:14:01 +01:00
Yuri D'Elia a712546269 wizard: Remove unused wizard stages
Remove PreheatPla/IsPla, as we currently always explicitly ask for the
material type.
2022-12-30 14:14:01 +01:00
Yuri D'Elia da6e56a17e Simplify altfan override initialization 2022-12-30 14:14:01 +01:00
Yuri D'Elia 9a018230ce Replace calibration state with a new calibration bitmap
- Move calibration status/declarations to util.h
- Allows to query the status of each step independently without assuming
  any order
- Allows to extend the calibration with new steps transparently
2022-12-30 14:14:01 +01:00
Yuri D'Elia 2552fee4c7 eeprom: Fix EEPROM_HEAT_BED_ON_LOAD_FILAMENT debug offset in docs 2022-12-30 14:14:01 +01:00
Yuri D'Elia 0e2c2d9eea Simplify FW eeprom version checks
- Generalize force_selftest_if_fw_version() so we can check when upgrading
  between arbitrary FW versions.
- Do not call update_current_firmware_version_to_eeprom() prematurely
  when forcing self-test (if a reset happens before self-test completes,
  the check would be incorrectly skipped on the next run).
2022-12-30 14:14:01 +01:00
Yuri D'Elia 74609009ca Fix M117 string offset 2022-12-30 14:06:48 +01:00
Yuri D'Elia 9105573ac9 Handle/strip leading whitespace in gcode stream 2022-12-30 14:06:48 +01:00
Yuri D'Elia a4d427adf2 De-specialize M0/M1/M117
Since we no longer scan for the first command these exceptions can be
removed.
2022-12-30 14:06:48 +01:00
Yuri D'Elia bb1e438f00 Do not scan for GMTD commands
Expect these to be always at the start of the line.
2022-12-30 14:06:48 +01:00
Yuri D'Elia f46be49f7d Tighten parsing of M0/M1/M117/PRUSA
Expect these to be always at the start of the command (which is now
stripped of the extra line number), reducing the number of corner cases
due to these not following the g-code spec.
2022-12-30 14:06:48 +01:00
Yuri D'Elia 7c896a87a4 Remove '*' (checksum) handling in process_commands
The checksum is already removed from the command queue so there's no
need to reprocess it in the main loop.
2022-12-30 14:06:48 +01:00
Yuri D'Elia 6651f5ce8b Strip the line number from the command queue
This increases the number of commands that can be queued and at the same
time it avoids a considerable amount of rescanning in a critical path.
2022-12-30 14:06:48 +01:00
Guðni Már Gilbert 797513d3c5 Remove T parameter from M221
Fixes #3852
2022-12-30 13:07:56 +01:00
Guðni Már Gilbert 4219beed71 Remove initial cursor setting
The cursor position is controlled by
the for-loop

Change in memory:
Flash: -8 bytes
SRAM: 0 bytes
2022-12-30 12:57:07 +01:00
Guðni Már Gilbert 1186b36bfa Remove whitespace at start of new row 2022-12-30 12:57:07 +01:00
Guðni Már Gilbert 7529eaec44 Remove duplicate code
msg_next is NULL, then the end of the message has been reached.

Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2022-12-30 12:57:07 +01:00
Guðni Már Gilbert 5037d1edbc delay_keep_alive calls manage_heater and manage_inactivity
No need to call them again, the for-loop is very quick

Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2022-12-30 12:57:07 +01:00
Guðni Már Gilbert 1a9b7d79e6 Don't handle whitespace in a special way
Instead of reading and checking if a character is a whitespace
just print it out onto the LCD. This makes the code a bit less
complex. Whether there is a whitespace character, we always end
up reading from program space, so I doubt this has much performance
impact.

Change in memory:
Flash: -38 bytes
SRAM: 0 bytes
2022-12-30 12:57:07 +01:00
Alex Voinea 7925df6aa0 Default check action is continuing 2022-12-30 12:49:57 +01:00
Alex Voinea 96707aadcb Fix timeout making UI freeze 2022-12-30 12:49:57 +01:00
Guðni Már Gilbert 92cf8da45e Remove unused defines 2022-12-30 12:49:57 +01:00
Guðni Már Gilbert df65212449 Add yes-no choice to M862 warning
Fixes #3421

Change in memory:
Flash: -98 bytes
SRAM: 0 bytes
2022-12-30 12:49:57 +01:00
Yuri D'Elia 54704cb928
Merge pull request #3842 from wavexx/readme_updates
README: Document the new build system
2022-12-29 13:34:45 +01:00
Yuri D'Elia 732be51b24
Merge pull request #3858 from wavexx/consistent_targets
cmake: Consistent target names
2022-12-29 13:33:12 +01:00
Yuri D'Elia 4258ecef36 README: Fix formatting 2022-12-29 12:56:16 +01:00
Yuri D'Elia 4ff9324377 README: Update target names 2022-12-29 12:55:57 +01:00
Yuri D'Elia abf7fbf99b cmake: Consistent target names
- Use ALL_MULTILANG and VARIANT_MULTILANG instead of VARIANT_Multilang
- Use ALL_ENGLISH and VARIANT_ENGLISH instead of VARIANT_En-only
- Rename the intermediate VARIANT_Multilang_* targets to VARIANT_lang_*
  to avoid confusion
2022-12-29 12:47:21 +01:00
Guðni Már Gilbert cc3d36c78f Replace labs with fabs
Both degHotend and degTargetHotend return a float
In this case it is better to use fabs()

Change in memory:
Flash: -14 bytes
SRAM: 0 bytes
2022-12-29 08:54:50 +01:00
Guðni Már Gilbert 4207910db9
Merge pull request #3851 from gudnimg/cleanup-gudni
Minor header cleanup in Marlin_main.cpp
2022-12-27 18:21:51 +00:00
Guðni Már Gilbert 03511a5a7c Remove redundant ultralcd includes in Marlin_main
This also removes two definitions
- ULTRALCD
- LCD_USE_I2C_BUZZER
Neither of them are defined anywhere
2022-12-27 12:03:56 +00:00
Guðni Már Gilbert 9757502abc Remove pins_arduino.h include
This header is already included with Arduino.h which
is included in Marlin.h header.
2022-12-27 12:03:14 +00:00
Guðni Már Gilbert 72857c902c drop conv2str dependency in Marlin_main 2022-12-27 11:59:22 +00:00
Alex Voinea fea608c8c4 A few more meassuring typos 2022-12-22 12:54:42 +01:00
Yuri D'Elia b3790f4094 Typo: meassure -> measure 2022-12-22 12:54:42 +01:00
Yuri D'Elia 52941b1111 Rename xyzcal_meassure_center back to xyzcal_meassure_enter
Keep the enter/leave pairs
2022-12-22 12:54:42 +01:00
Yuri D'Elia 515a625180 Typo: hysterezis -> hysteresis 2022-12-22 12:54:42 +01:00
Alex Voinea 8414c272bf
Merge pull request #3787 from gudnimg/PFW-1439
PFW-1448 Fix underextrusion + compensate load to nozzle extruder sequence for Extra Loading Distance
2022-12-22 11:07:28 +01:00
3d-gussner 775cabb31e
Merge pull request #3847 from 3d-gussner/MK3_Clear_TM_error
MK3: Add translations for `Clear TM error` message
2022-12-20 16:40:28 +01:00
3d-gussner 9098206afb Add translations for `Clear TM error` message 2022-12-20 15:25:15 +01:00
3d-gussner 9ca7760c2e
Merge pull request #3830 from 3d-gussner/MK3_XYZ_cal_fix
MK3: XYZ cal change message and add LCD ouput
2022-12-20 14:16:49 +01:00
3d-gussner 0bcb4ab59d
Merge pull request #3822 from wavexx/tm_partial_lock
MK3: TM: Prevent lockout on invalid model values
2022-12-20 14:13:56 +01:00
3d-gussner 7fef570d1b Change xyz cal message `up to 24 min.` instead `approx. 12 min.` 2022-12-20 10:30:53 +01:00
Guðni Már Gilbert 355b670cd4 Remove SWSPI which is not used/implemented 2022-12-20 10:10:45 +01:00
Alex Voinea 2b38080c7e
Merge pull request #3833 from leptun/MK3_fix_MK2.5_softReset 2022-12-20 10:02:14 +01:00
3d-gussner ea6450f072 Add LCD output during xyz calibration 2022-12-20 08:36:19 +01:00
3d-gussner 65f5b9e53d
Merge pull request #3818 from wavexx/tm_default_state
TM: Provide full defaults for model data and enable it by default
2022-12-20 07:08:25 +01:00
Alex Voinea 62ea78d46e Handle configurable distance past gears 2022-12-19 23:49:12 +01:00
Alex Voinea 70356b71df Handle filament sensor position that is not 0 2022-12-19 23:41:43 +01:00
Guðni Már Gilbert c72ae8a2f3 PFW-1439 Remove parameters from execute_load_to_nozzle_sequence 2022-12-19 21:12:12 +00:00
Guðni Már Gilbert 6ee5f08505 PFW-1439 Compensate load to nozzle extruder sequence for Extra Loading Distance
The Extra Loading Distance is configurable by the user.
We need to compensate the hardcoded sequence
such that it does not extrude too much or
too little. Currently the firmware
extrudes too little.
2022-12-19 21:12:11 +00:00
Alex Voinea 97ddcc66bb
Merge pull request #3839 from leptun/MMU2_split_variant_config
MMU2 split variant config
2022-12-19 20:31:01 +01:00
Yuri D'Elia c0f96e062b TM: Force initialization after reset 2022-12-19 18:08:01 +01:00
Yuri D'Elia d12dfed096 README: Drop outdated README_cz for now 2022-12-18 18:40:17 +01:00
Yuri D'Elia a455ea6c8a Add back the old Arduino instructions 2022-12-18 18:19:41 +01:00
Yuri D'Elia 764544b6dd Add some initial disclaimer when using Arduino 2022-12-18 17:46:50 +01:00
Guðni Már Gilbert 192a8c83c7 Remove Arduino IDE and PF-builds for WSL 2022-12-18 16:14:39 +00:00
Guðni Már Gilbert edb3d2d98b Add a bit more info about selecting a kit 2022-12-18 16:05:11 +00:00
Guðni Már Gilbert ccd20e79ad Initial commit for Windows VScode 2022-12-18 15:46:07 +00:00
Yuri D'Elia e6b28d7bac
Merge pull request #3841 from wavexx/build_cache
build: Use the cached path for the build environment
2022-12-18 16:45:38 +01:00
Alex Voinea ba0f051f72 Revert accidental removal of check 2022-12-18 15:55:48 +01:00
Yuri D'Elia 1fd41293ee README: Typo 2022-12-18 15:37:24 +01:00
Yuri D'Elia 2d26465db9 README: Document the new build system 2022-12-18 15:26:03 +01:00
Guðni Már Gilbert b66d6d354f
Merge pull request #3837 from gudnimg/PFW-1457
PFW-1457 Do not unload at start of First Layer Cal
2022-12-18 13:25:34 +00:00
Yuri D'Elia c5cb8f77e6 build: Add a deprecation warning in build.sh 2022-12-18 14:23:32 +01:00
Guðni Már Gilbert ccf5d7c7e4
Merge pull request #3840 from prusa3d/revert-3838-PFW-1458
Revert "PFW-1458 Reduce MMU loading test length"
2022-12-18 13:15:27 +00:00
Yuri D'Elia d7964d923f build: Use the cached path for the build environment 2022-12-18 14:10:48 +01:00
Guðni Már Gilbert 2b79f9ba8e
Revert "PFW-1458 Reduce MMU loading test length" 2022-12-18 12:36:03 +00:00
Guðni Már Gilbert 4c32e8b403 PFW-1457 make CHECK_FSENSOR into a function 2022-12-18 12:23:20 +00:00
Guðni Már Gilbert 0ac349b7fa
Merge pull request #3838 from gudnimg/PFW-1458
PFW-1458 Reduce MMU loading test length
2022-12-18 11:03:31 +00:00
Alex Voinea 5c1c6d9f3b Adjust MMU2 specific distances 2022-12-18 10:30:43 +01:00
Alex Voinea 8623d9ff55 Split the mmu2 config into MMU2 and MMU2S 2022-12-18 09:58:20 +01:00
Guðni Már Gilbert 7283dbc2f8 PFW-1458 Reduce loading test length
The issue is very apparent with a cold extruder. For example when starting a single color print with the MMU. I can hear grinding in the extruder gears at the very end of the sequence. This means the sequence is too long and we are
likely pushing the filament too far into the extruder.

The purpose of the test is to check if the filament is actually
present in the PTFE tube. My proposal is we reduce the length
of the test to only cover the *length* of the PTFE tube.
This will also reduce printing time a little bit.
2022-12-18 06:04:59 +00:00
Guðni Már Gilbert fee68b0f0d PFW-1457 Do not unload at start of First Layer Cal
Fixes issue where First Layer Cal. triggers an unload before any
filament is loaded

The purpose of this if() statement is to handle the case where
a user or developer is sending T-codes to the printer directly
via Serial. Such as when one first sends T0 and then T4.
And unload must be triggered in-between, we can do this automatically
if FINDA detect filament.

Change in memory:
Flash: -10 bytes
SRAM: 0 bytes
2022-12-18 05:51:21 +00:00
Yuri D'Elia dba3428ef2 Improve MSG_ACK_ERROR message 2022-12-17 20:25:47 +01:00
Yuri D'Elia b98e394eea
Merge pull request #3835 from wavexx/pf_build_fixes
PF-build: improve storage and caching of dependencies
2022-12-17 19:52:46 +01:00
Yuri D'Elia 80c7790e87 Also prevent longpress when Stopped 2022-12-17 17:30:44 +01:00
Yuri D'Elia 271523ad45 TM: Disallow preheat/filament actions when stopped
Require acknowledgement first
2022-12-17 17:00:33 +01:00
Yuri D'Elia f8290f25cd TM: Allow to resume without a running print
If there is no running print, and the printer is Stopped, add a new
"Acknowledge error" menu entry to unlock the printer.

This simply calls lcd_print_stop(), which is identical in behavior to a
thermal error with a running print.
2022-12-17 16:48:39 +01:00
Yuri D'Elia 0972ef70d0 Use menu_set_block() in ThermalStop()
Set a menu block for fatal thermal errors instead of abusing
lcd_return_to_status() to kick the user out of the menus.

This now allows a thermal model error to be recoverable through menu
access.
2022-12-17 16:42:22 +01:00
Yuri D'Elia 8d719efa79 Do not show/call LCD status updates when unchanged
This mostly prevents useless serial noise
2022-12-17 16:35:26 +01:00
Yuri D'Elia 365f845c99 TM: correctly mark repeated anomalies 2022-12-17 16:33:42 +01:00
Yuri D'Elia 6e2f016655 TM: Clear the Stopped state when stopping the current print
We allow resuming from the LCD via start print and resume print,
it makes sense to clear the error on stop too.

For this reason distinguish whether the action is performed
automatically or manually (ie: interactively).

The error is only cleared when the command is run interactively.
2022-12-17 16:11:31 +01:00
Yuri D'Elia 119dc10b8f Rename print_stop() to lcd_print_stop_finish() for clarity 2022-12-17 16:03:03 +01:00
Yuri D'Elia 83d3732481 CI: Also cache PF-build dependencies 2022-12-17 15:05:43 +01:00
Yuri D'Elia b26c6af8e3 PF-build: cleanup whitespace 2022-12-17 15:05:43 +01:00
Yuri D'Elia b30ccbebaa PF-build: improve storage of dependencies
Use an unversioned root to store dependencies, so that they can be cached more easily.

Do not re-download archives if the build environment has already been set up.
2022-12-17 15:05:43 +01:00
Yuri D'Elia 5594408aac PF-build: Check for the correct python version in PF-build
We only use/support python3. Most distributions no longer ship an
unversioned "python" executable, so this check fails and recommends
broken behavior.
2022-12-17 15:05:38 +01:00
Yuri D'Elia 4dfedc62e3
Merge pull request #3834 from wavexx/travis_cache
CI: Cache dependencies
2022-12-17 15:01:07 +01:00
Yuri D'Elia 165b57399a CI: Cache dependencies
Attempt to cache dependencies with the travis cache. This avoids
redownloading avr-gcc for each stage of the pipeline.

This /might/ improve the download failures we're seeing recently,
although the travis cache is also networked.
2022-12-17 14:08:15 +01:00
Alex Voinea c5d406d12f Fix interrupts not enabled during setup() 2022-12-16 16:46:08 +01:00
Guðni Már Gilbert eb8ec9f8b9 If an old firmware is detected, make sure the protocol is actually stopped
The printer shouldn't continue endlessly asking for a version if an old MMU is detected.
Also if the protocol is supposed to be turned off, it
shouldn't be sending S0 queries.
2022-12-16 16:23:19 +01:00
Yuri D'Elia 9f3f0baa47 mmu: Use strncpy when possible
Since tmp is always null-terminated we can save some time compared to a
memcpy call.
2022-12-16 16:21:59 +01:00
Yuri D'Elia b3b9778341 mmu: Silence repeated S0 requests
Update "S0" CRC on replies so that the message is properly silenced.
2022-12-16 16:21:59 +01:00
Yuri D'Elia 78cf51274f mmu: Embed the newline in MMU2_ECHO_MSG/MMU2_ERROR_MSG
This allows to redefine both macros to silence debugging messages, since
we can't redefine the base SERIAL_ECHO.
2022-12-16 16:21:59 +01:00
Yuri D'Elia 5f2f6dde13 array<>::size should return constexpr expression
This allows to size buffers at compile time (matches c++11 behavior).
2022-12-16 16:21:59 +01:00
Guðni Már Gilbert 2e7c237a17 Cleanup: remove automatic parameter from unload_filament()
In M600 and M702, the Z-lift is taken care of outside this function
so it makes no sense to have a Z-lift within unload_filament()

Only exception to this is in the wizard, there I moved the Z-lift to
happen before we start heating the nozzle.

Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
2022-12-16 16:20:09 +01:00
3d-gussner 090c72367d Minor Fix for PR2235
Shorten message to c=12 as some translation of `Yes/No` are 4 chars long
2022-12-16 16:10:15 +01:00
3d-gussner 9428064a9e Remove unused community translations 2022-12-16 16:06:31 +01:00
Alex Voinea d43a7da20d fix watchdog not getting disabled on user app boot 2022-12-16 16:01:29 +01:00
3d-gussner 100dc2934b Shorten French translation 2022-12-16 15:59:37 +01:00
3d-gussner 74545e2133 Fix `µ` character shown on translations 2022-12-16 15:59:37 +01:00
Yuri D'Elia c05ac535be TM: reset fan measuring state when changing speed
Ensure that fan checks are reset and use the new speed at each step of
the calibration.

This also gives extra time to the fan to ramp-up from a cold start,
when a fancheck could previously start right *after* the speed change.

Should fix #3791
2022-12-16 15:30:30 +01:00
Alex Voinea d80e32fa31 retrigger build 2022-12-16 12:55:30 +01:00
Alex Voinea 3f6089f2c1 More documentation for pins file 2022-12-16 12:29:59 +01:00
Alex Voinea e8c8945650 Disable the watchdog early in the program 2022-12-16 12:25:44 +01:00
Alex Voinea 451f601697 Fix MK2.5 softReset() 2022-12-16 12:10:47 +01:00
Yuri D'Elia 001876a807 Parenthesize IS_SD_PRINTING defensively 2022-12-15 08:13:38 +01:00
Yuri D'Elia 3066fd1db3 Replace two expressions with cmd_head 2022-12-15 08:13:02 +01:00
Yuri D'Elia a588a5f695 Allow M310 to bypass the Stopped state for recovery
Since M310 cannot change the heaters, allowing M310 S0 (and changing
parameters) allows to recover a usb-controlled printer which has been
locked-out due to bad model settings.
2022-12-14 13:47:11 +01:00
Yuri D'Elia c7865a83f2 Keep a pointer past the line number in cmdqueue
This allows to skip line numbers transparently and perform faster
checks on the actual command to process.
2022-12-14 13:47:11 +01:00
Yuri D'Elia 5c4ec5dd4f TM: Do not lockout the menus on thermal errors
This prevents the ability to run gcode from the SD card.

In a thermal error with faulty values, and without serial access, this
is the only way to process an M310 instruction and recover.
2022-12-13 18:38:26 +01:00
Yuri D'Elia 36575a4f83 Restore the previous model state when performing a nozzle change
Do not force-enable the model if it was previously disabled.
2022-12-12 20:17:56 +01:00
Yuri D'Elia c5ec77a1ce wizard: Allow finishing the calibration through menus
If the wizard is interrupted during model calibration, allow the
menu to mark "temperature model" calibration as complete.
2022-12-12 18:25:17 +01:00
Yuri D'Elia 0c042440ee eeprom: Document new calibration state 2022-12-12 18:25:17 +01:00
Yuri D'Elia 118b39da39 wizard: Rework the thermal model calibration logic
- Correctly sequence the enqueued commands in order to check for the
  real calibration result.
- Perform autocalibration with self-check enabled.
- Only save/continue the wizard if autocalibration succeeds.
2022-12-12 18:25:07 +01:00
Yuri D'Elia 38d893589f selftest: Handle thermal errors in lcd_selfcheck_check_heater
- Simplify lcd_selfcheck_check_heater loop
- Check for/abort on Stopped (indicating a thermal failure).
2022-12-12 18:24:58 +01:00
Yuri D'Elia 4e7c830661 Remove M999 remnants
This was already removed in fc10ca3146
but got reinstated by mistake in the mmu2 merge.

Also remove another incorrect Stopped usage.
2022-12-12 17:52:48 +01:00
Yuri D'Elia 249be543fc TM: Restore all original values if autotune fails
- Ensures repeated autotune attempts with self-check can't succeed due
  to different starting conditions.
- Allows for a simpler workflow during selftest and wizard if autotune
  fails.
2022-12-12 17:52:48 +01:00
Yuri D'Elia 2051809e2f TM: Store only the last autotune result state
- Remove tm::valid and temp_model_valid as it's a duplicate of the
  calibrated() state.
- Add temp_model_autotune_result() for future use.
2022-12-12 17:52:48 +01:00
Yuri D'Elia 324e501b18 TM: Set default resistance levels for MK3/MK3S
Provide average calibrated values for all fan levels for MK3/MK3S
variants and enable the model by default.

This ensures the calibration step is not skipped unless explicitly
disabled.

Force-clear fan values during autotune to restore the previous
calibration behavior, as fan resistance levels can be too big and
prevent the autotune-with-selfcheck to fail.
2022-12-12 17:52:48 +01:00
Yuri D'Elia 877c0bd35c Fix potential buffer overflow in LCD messages 2022-12-12 17:52:48 +01:00
Yuri D'Elia e2f1bfe506 TM: Remove unnecessary display comments
Favor code readability
2022-12-12 17:52:48 +01:00
Yuri D'Elia 4d87f65b68
Merge pull request #3443 from gudnimg/m109-turn-off-fan
Turn off print fan while resuming print from RAM
2022-12-12 15:20:20 +01:00
Yuri D'Elia d84e497007
Merge pull request #3805 from 3d-gussner/MK3_Fix_M862.4_strict
MK3: Fix `M862.4` with [strict] mode
2022-12-12 12:38:15 +01:00
Yuri D'Elia b4a061e70a
Merge pull request #3779 from gudnimg/fix_lcd_wizard_load_mmu
Don't show full screen message meant for single color setup
2022-12-10 11:27:48 +01:00
Guðni Már Gilbert 613ea290f5 Add a comment 2022-12-10 10:04:17 +00:00
Guðni Már Gilbert 9ed46df97f Don't show full screen message meant for single color setup
load_filament_to_nozzle will show a more precise full screen message when an MMU is used.
2022-12-10 10:00:58 +00:00
Guðni Már Gilbert 70451b6bd3 Turn off print fan while restoring print from RAM 2022-12-10 09:53:43 +00:00
3d-gussner 40cc6dcb6d
Merge pull request #3783 from leptun/enable_PRUSA_SN_all_variants
Allow "PRUSA SN" to print the SN in eeprom on all variants
2022-12-09 14:51:57 +01:00
3d-gussner 5d80e544ea
Merge pull request #3796 from Hauzman/MK3_Romanian_translation
Update Ro Translation
2022-12-09 14:48:14 +01:00
Guðni Már Gilbert 1e39012953
Merge pull request #3793 from gudnimg/PFW-1453
PFW-1453 Stop Print: Don't unload if FINDA is not triggered
2022-12-09 12:54:16 +00:00
Hauzman 19b6590095 Update Ro Translation 2022-12-09 11:00:34 +01:00
Yuri D'Elia 68c5cdce1c
Merge pull request #3780 from gudnimg/stop-print-optimisations
optimisation: Improve Stop Print menu
2022-12-08 19:41:52 +01:00
3d-gussner 25b5e00652
Merge pull request #86 from wavexx/simple_checks
Simplify firmware/gcode version comparisons
2022-12-08 19:04:59 +01:00
Yuri D'Elia a8b8085d22
Merge pull request #3811 from wavexx/build_drop_unused_option
cmake: Remove unused SECONDARY_LANGUAGES option
2022-12-08 18:51:53 +01:00
3d-gussner 92f2281b1a
Merge pull request #2335 from Panayiotis-git/MK3_NoBedHeating_onLoadUnload
@Panayiotis-git Thanks a lot!

Finally after 3 years 21 days your PR gets merged 🦕
2022-12-08 18:45:12 +01:00
Yuri D'Elia 5160e214ae
Merge branch 'MK3' into build_drop_unused_option 2022-12-08 18:32:32 +01:00
Yuri D'Elia a266ff3cdb
Merge pull request #3812 from wavexx/cmake_no_warning
cmake: Remove usage warning
2022-12-08 18:30:04 +01:00
Yuri D'Elia bfc44251c6 cmake: Remove usage warning
The cmake build system is effectively on-par (and a lot better in most
areas) compared to the old build system.

There's no need to warn developers anymore.
2022-12-08 13:41:51 +01:00
Yuri D'Elia 0cedb92ac6 Simplify firmware/gcode version comparisons 2022-12-07 18:59:29 +01:00
Yuri D'Elia 138725325a cmake: Remove unused SECONDARY_LANGUAGES option
The option SECONDARY_LANGUAGES is no longer being used.

cmake always allows en/multilang for all selected variants
by using the appropriate target now (ALL_ENGLISH).
2022-12-07 16:00:32 +01:00
3d-gussner 96e4881da5
Merge pull request #3794 from gudnimg/fix-m862-q
Fix undefined pointer in `M862.2 Q` and `M862.3 Q`
2022-12-07 13:04:45 +01:00
3d-gussner 72dc06c892
Merge pull request #3800 from 3d-gussner/MK3_Nozzle_change_community_translations
Update Nozzle change community translations
2022-12-06 16:01:27 +01:00
3d-gussner 96736c9dd1
Update lang/po/Firmware_no.po
Co-authored-by: OS-kar <104255741+OS-kar@users.noreply.github.com>
2022-12-06 14:39:59 +01:00
3d-gussner 6f5a67491c Fix `M862.4` with [strict] mode
Max 8 falvor versions
2022-12-06 13:18:52 +01:00
3d-gussner ac4185704d
Merge pull request #3801 from 3d-gussner/MK3_FARM_Nozzle_change_menu
Add Nozzle change menu to FARM mode under Settings

Approved by FARM team
2022-12-06 10:57:16 +01:00
3d-gussner 1df4871a8b Update Swedish translation 2022-12-06 09:21:13 +01:00
3d-gussner 1c9a3a6b25 Add Nozzle change menu to FARM mode under Settings 2022-12-05 18:22:18 +01:00
3d-gussner edecd6187d Update Nozzle change community translations 2022-12-05 18:10:25 +01:00
Guðni Már Gilbert a8fe71df8c PFW-1453 Stop Print: Don't unload if FINDA is not triggered 2022-12-05 16:45:57 +01:00
Alex Voinea 52965bd05d Avoid using global variables
Flash: -68B
RAM: -4B
2022-12-05 16:43:51 +01:00
Guðni Már Gilbert 4c27d057b8 Don't inline fSetMmuMode
Saves 8 bytes of flash
2022-12-05 16:43:51 +01:00
Guðni Már Gilbert 074b62361f Fix #3788
fSetMmuMode needs to be called
in order for the commands to work:
M862.2 Q
M862.3 Q
2022-12-05 16:43:51 +01:00
3d-gussner c42553dca6
Merge pull request #3799 from 3d-gussner/MK3_Shorten_French
Shorten French translation and fix build for other PRs
2022-12-05 15:15:28 +01:00
3d-gussner b516567b74 Shorten French translation 2022-12-05 12:18:46 +01:00
Panayiotis-git c75c81ce4f Do not heat the bed, on load/unload
If during a paused print, the preheat is canceled, keep the bed target temperature
Display bed temperatures only if bed is also heated
Remove not needed variables nTargetOld and nTargetBedOld from the mFilamentItem function
Define new Setting "HeatBedOnLoad" [Yes/No]
2022-12-04 19:26:34 +02:00
Guðni Már Gilbert c87fe63112
Merge pull request #3797 from gudnimg/PFW-1454
PFW-1454 Send button to MMU on MMU SELFTEST FAILED screen
2022-12-04 16:51:14 +00:00
Guðni Már Gilbert fb530ce543 PFW-1454 Send button to MMU on MMU SELFTEST FAILED screen
Fixes an issue where the button on the MMU error screen doesn't do anything
when MMU SELFTEST FAILED is rendered
2022-12-04 11:04:00 +00:00
Guðni Már Gilbert 6d62fb0d65
Merge pull request #3784 from DRracer/opt01
Optimize rendering MMU Error sensor line
2022-12-02 17:12:05 +00:00
Jakub Dolezal 3e976e04ca
Merge pull request #3777 from 3d-gussner/PFW-1431
PFW-1431: Add "PA Preheat"
2022-12-02 13:34:18 +01:00
3d-gussner 54ef2a6c28
Merge pull request #3769 from 3d-gussner/MK3_Temp_model_cal_wizard
PFW-1434: MK3 Temp model calibration during wizard
2022-11-30 15:33:38 +01:00
3d-gussner 1bbcdb0c0d
Merge pull request #3774 from 3d-gussner/MK3_Nozzle_change
PFW-1435 Nozzle change menu
2022-11-30 15:32:18 +01:00
3d-gussner 0a6388cc56 Update internal translations
Fix G28 W
2022-11-30 15:01:24 +01:00
Alex Voinea 500131d51d fullscreen message: use \n to force the next word on the next line
Useful for printing short URLs since those contain punctuation characters, which get treated at the end of a word under usual circumstances
2022-11-30 10:17:28 +01:00
3d-gussner e64f34c9ab Updated community languages
Thanks to @ingbrzy @shatter136 @Hauzman
2022-11-30 07:59:27 +01:00
3d-gussner 8f44d1102c Add PA preheat menu 2022-11-30 06:42:32 +01:00
Guðni Már Gilbert 23613c7eb1 optimisation: Stop print menu
There is no need to manually track the cursor position.
We can use the menu API:
MENU_BEGIN()
...
// menu items in between here
...
MENU_END()

Change in memory:
Flash: -116 bytes
SRAM: 0 bytes
2022-11-26 10:18:47 +00:00
D.R.racer a666c0f6f4 Optimize rendering MMU Error sensor line
CPUFLASH: -32B
2022-11-25 13:30:53 +01:00
Alex Voinea 83c9e946e4 Fix recursion 2022-11-24 16:15:51 +01:00
3d-gussner 4f3c188017 Update internal translations
Fix typo
2022-11-24 10:53:04 +01:00
D.R.racer fea1520dfb Fix & optimize FW version parsing and checking
PFW-1433
2022-11-23 13:34:13 +01:00
3d-gussner 32673e1681 Nozzle change menu 2022-11-23 11:39:26 +01:00
D.R.racer 2317e1379f Update CS translation 2022-11-22 08:35:27 +01:00
3d-gussner 2cd42f8433 Fix typo
Add Norwegian translations thanks to @OS-kar
2022-11-22 08:26:20 +01:00
Guðni Már Gilbert c8157919b1 PFW-1440 Fix issue where cooldown timer is not set after a faile retry 2022-11-21 12:54:53 +01:00
Guðni Már Gilbert 37ac33bc32 Fix compiler warning 2022-11-21 12:54:53 +01:00
D.R.racer fe6e3ca2b1 Unload first before retrying
Should free the filament if accidentally held by the fsensor.
2022-11-20 19:23:07 +01:00
D.R.racer 5639620041 Avoid watchdog while doing VerifyFilamentEnteredPTFE 2022-11-20 17:27:36 +01:00
D.R.racer 84d9eee61d Resume hotend temperature if parked + MMU restarted
PFW-1355
2022-11-20 17:27:36 +01:00
Guðni Már Gilbert 01c1f4a8dd Load test: Monitor unload as well 2022-11-20 17:27:36 +01:00
Guðni Már Gilbert 5c8ea4c90a fixup 2022-11-20 17:27:36 +01:00
Guðni Már Gilbert 327f0edb17 VerifyFilamentEnteredPTFE must take into account the Extra Loading Distance 2022-11-20 17:27:36 +01:00
Guðni Már Gilbert c9d9ba0b1a Add a bracket around subtraction, just in case 2022-11-20 17:27:36 +01:00
Guðni Már Gilbert ef51b5778d Fix VerifyFilamentEnteredPTFE
Test should push filament first and then retract.
2022-11-20 17:27:36 +01:00
D.R.racer aaebaf163f Cleanup MSG_MMU_POWER_FAILS 2022-11-20 17:27:36 +01:00
D.R.racer a17153f877 Make TMC mask more readable 2022-11-20 17:27:36 +01:00
Guðni Már Gilbert f1ed2fc5c7 Fix issue where tool_change_extruder is not reset after retry 2022-11-20 17:27:36 +01:00
D.R.racer 541cd3ae94 Remove debug messages of Interrupted state 2022-11-20 17:27:36 +01:00
Guðni Már Gilbert 46f4f2658d PFW-1432 Reduce LOC
If verification test fails, increment load fail statistic
2022-11-20 17:27:36 +01:00
Guðni Már Gilbert 03235c8aab PFW-1432 restore toolchange load testing 2022-11-20 17:27:36 +01:00
D.R.racer adb24cd410 Increment errors in ReportError 2022-11-20 17:27:36 +01:00
D.R.racer 4eaabbf092 Revive MMU stats + LCD screens 2022-11-20 17:27:36 +01:00
D.R.racer fe11b7a247 Tune Interrupted state based on unit tests
Now finally the printer can restart ToolChange if MMU restarted.
2022-11-20 17:27:36 +01:00
D.R.racer ffbd95b482 Unify naming convention (index->slot)
in all top level MMU-related functions
2022-11-20 17:27:36 +01:00
D.R.racer e414413b2e Refactor ToolChange+LoadToNozzle
Add basic infrastructure for handling of repeated commands until they finish correctly.
2022-11-20 17:27:36 +01:00
D.R.racer 10a9e0f0a0 Recover from MMU restart while performing a command
PFW-1427
2022-11-20 17:27:36 +01:00
Guðni Már Gilbert b8ae9e997b
Merge pull request #3771 from gudnimg/toolchange-counter-fix
Fix bug where toolchange counter is not rendered
2022-11-20 15:52:54 +00:00
Guðni Már Gilbert 603faddd25 Fix bug where toolchange counter is not rendered 2022-11-20 15:42:29 +00:00
Guðni Már Gilbert 5dc539cda5 fixup 2022-11-20 13:12:01 +01:00
Guðni Már Gilbert 62810c5a7c optimisation: lcdui_print_extruder
Simplify the rendering to cover more scenarios:
"[nr.]>?"
"?>?"
Both of these indicate there is a bug in the firmware.
Currently these are not handled and result in the status screen being corrupted.
This is because we are trying to write a 3 digit number
where there is not space on the LCD for it.

Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
2022-11-20 13:12:01 +01:00
3d-gussner 281a217549 Update Temp Model messages
Deepl translate cs,de,es,fr,it,nl,pl
2022-11-20 10:49:46 +01:00
3d-gussner f2f54da5b0 Unhack selftest hack during wizard 2022-11-20 10:48:49 +01:00
Guðni Már Gilbert 439fb4ad4a
Merge pull request #3768 from gudnimg/cleanup-lcd_adjust_z
cleanup: remove dead code `lcd_adjust_z()`
2022-11-19 23:16:26 +00:00
Guðni Már Gilbert d592586d94 cleanup: remove dead code lcd_adjust_z()
It's only used when MESH_BED_LEVELING is not defined. According to
the configuration files, all printers supported use MESH_BED_LEVELING.
So I think we are safe in removing this dead code.
2022-11-19 22:19:48 +00:00
Guðni Már Gilbert 411d1da3c8
Merge pull request #3763 from gudnimg/optimisation-float-conversions
optimisation: TCodes accepts `uint8_t` not `float`
2022-11-18 19:52:22 +00:00
Alex Voinea 58775b8b55 Change unsigned long to uint32_t 2022-11-18 14:50:07 +01:00
Alex Voinea bda134a01e Save a bit of RAM from CS
Do not store EEPROM_VERSION in ram

flash: -6
RAM: -2
2022-11-18 14:50:07 +01:00
Alex Voinea ef83fefce1 More optimization 2022-11-18 14:50:07 +01:00
Alex Voinea 8f4ac82273 eeprom_init_default also returns the read/default value 2022-11-18 14:50:07 +01:00
Alex Voinea b317786110 More configuration store savings
flash: -94B
RAM: 0B
2022-11-18 14:50:07 +01:00
Alex Voinea b551bdae76 Some more CS improvements
flash: -2B
RAM: 0B
2022-11-18 14:50:07 +01:00
Alex Voinea 5305dbd299 Sheet name initialization improvements
The code looks better, but it takes a bit more flash. I prefer it like this
flash: +20B
ram: 0B
2022-11-18 14:50:07 +01:00
Alex Voinea bba5385a61 Move string to progmem
flash: -84B
RAM: -4B
2022-11-18 14:50:07 +01:00
Alex Voinea 6edc71d0ae Remove deprecated configs 2022-11-18 14:50:07 +01:00
Alex Voinea dcc48c0052 Remove eeprom _int8t functions
flash: -48B
RAM: -4B
2022-11-18 14:50:07 +01:00
Alex Voinea af60cd7d79 Optimize EEPROM_writeData and EEPROM_readData
flash: -162B
RAM: -4B
2022-11-18 14:50:07 +01:00
Alex Voinea 771f833a44 Implement eeprom dword functions 2022-11-18 14:50:07 +01:00
Alex Voinea ca943cceec Split the increment function into increment and add
No size difference since the compiler did a good job optimizing the inc argument (always 1 before).
2022-11-18 14:50:07 +01:00
D.R.racer 455c29e78b Optimize EEPROM usage/functions 2022-11-18 14:50:07 +01:00
D.R.racer 414d3f1c12 Display Welcome message after MMU progress report ends
Should make the status line look cleaner when the printer is not printing.
2022-11-18 14:09:48 +01:00
Guðni Már Gilbert c86c961d4e M600: Fix bug where fan is not turned off
The firmware saves the current fanspeed before parking,
and the fanspeed is restored after unparking. The problem is the fan
was never actually paused.

Fixes #3670
2022-11-18 11:18:29 +01:00
Alex Voinea b147fcee77 XYZ calibration fixes 2022-11-18 00:18:42 +01:00
Alex Voinea 384a6d1989 Fix wizard serial messages 2022-11-17 23:03:03 +01:00
3d-gussner 30ec4e8b53 Inital Temp Model cal wizard 2022-11-17 15:19:35 +01:00
Guðni Már Gilbert 2096accc5f Remove unused gcode level check code
This code was introduced with v3.8.0 but was always disabled.
I propose the code be removed since it has not been enabled
for 3 years since its introduction.
2022-11-17 08:05:27 +01:00
D.R.racer 21e779c1c1 Update POT/PO files
Translations of INSPECT_FINDA are to be done yet.
2022-11-17 07:58:11 +01:00
D.R.racer 6059398004 Introduce MMU Error: INSPECT_FINDA (FINDA_FLICKERS) 2022-11-17 07:58:11 +01:00
Alex Voinea 29882b625b Remove LcdCommands::FarmModeConfirm 2022-11-17 05:46:33 +01:00
Guðni Már Gilbert e11ef11a64 PFW-1425 Rename "Load to Extruder" to "Loading Test" 2022-11-16 06:00:15 +01:00
Guðni Már Gilbert 7b43f322de PFW-1425 Move Reset MMU setting 2022-11-15 17:32:27 +01:00
Guðni Már Gilbert b4920d7fa8 PFW-1425 use mmu2.Enabled instead of EEPROM read 2022-11-15 17:32:27 +01:00
Guðni Már Gilbert 3f4ac254ab PFW-1425 Move MMU settings under a common if statement
We only need to check if the MMU is enabled once,
no need to do it in every submenu.
This way we save little bit of flash memory.

Change in memory:
Flash: -24 bytes
SRAM: 0 bytes
2022-11-15 17:32:27 +01:00
Guðni Már Gilbert 8f3f071fd4 PFW-1425 Move Load to Extruder menu to Settings menu
No change in memory footprint
2022-11-15 17:32:27 +01:00
Guðni Már Gilbert 5239f1c176 cleanup: remove old extern for mmu_print_saved 2022-11-15 09:44:02 +01:00
Guðni Már Gilbert 4f58812478 optimise lcd_sdcard_menu with lcd_print_pad
Change in memory:
Flash: -46 bytes
SRAM: 0 bytes
2022-11-13 09:29:37 +01:00
Guðni Már Gilbert 184e19dd60 further optimise lcdui_print_status_line
We can use lcd_print_pad to determine
whether the end of the file name was reached

lcd_print_pad now returns the last character pointed to.
If the end of the string was reached, it will be the null delimeter which
evaluates to "false" in an if statment (same as NULL).
Else "true" means the end of the string was not reached.

Change in memory:
Flash: -42 bytes
SRAM: 0 bytes
2022-11-13 09:29:37 +01:00
Guðni Már Gilbert 0af7ef0201 optimisation: reduce code size in showing file name being printed
Change in memory:
Flash: -52 bytes
SRAM: 0 bytes
2022-11-13 09:29:37 +01:00
Alex Voinea a2bbc4f585
Merge pull request #3745 from leptun/MK2.5_XYZ_Cal_fixes
MK2.5 XYZ calibration fixes
2022-11-12 21:48:16 +01:00
Guðni Már Gilbert 006fe110cc Don't raise MMU error screen until retry is done
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2022-11-12 18:47:10 +01:00
VintagePC 68bd7f9b19 Fix excessive flash usage. 2022-11-12 18:47:10 +01:00
VintagePC ecef69012a Fix PFW-1364 & possible comms timeout during reheat 2022-11-12 18:47:10 +01:00
Guðni Már Gilbert 509813f60b optimsation: TCodes accepts uint8_t not float
Change in memory:
Flash: -20 bytes
SRAM: 0 bytes
2022-11-12 16:50:45 +00:00
Alex Voinea 661b3a83ff MK2.5: fix swapped yes/no messaged for Z manual alignment 2022-11-10 22:20:46 +01:00
Alex Voinea 1cdc2e712b MK2.5: unblock planner after plan_abort_hard() 2022-11-10 22:20:01 +01:00
3d-gussner fd832f9ccf
Merge pull request #3737 from gudnimg/fix-longpress-inactivity-timeout
Fix long-press LCD inactivity timeout
2022-11-08 14:10:57 +01:00
Guðni Már Gilbert 76a164e651 fixup 2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 08460bd403 PFW-1397 Drop ON_MENU_ENTER
Using _menu_data_t turns out to save *just* a little bit more flash. So for now just use it.
2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 390f69a82f PFW-1397 Fix: ON_MENU_ENTER was always run 2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 59a452ac27 PFW-1397 minor comment tweaks 2022-11-08 13:49:40 +01:00
Guðni Már Gilbert f160f5594d PFW-1397 cleanup statistics menu
Change in memory:
Flash: -18 bytes
SRAM: -1 byte
2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 82bd9db1d6 PFW-1397 Implement ON_MENU_ENTER to simplify code
ON_MENU_ENTER runs code within the brackets only once
after a new menu is entered.

For the tool change menu, this allows us to display the data and
read from EEPROM only once.
2022-11-08 13:49:40 +01:00
Guðni Már Gilbert a896dfd4e0 PFW-1397 To reserve EEPROM write cycles, only update toolchange counter when a print finishes or is stopped 2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 3120bf0aa2 PFW-1397 Implement new function increment_tool_change_counter()
Reduces flash consumption by 44 bytes
2022-11-08 13:49:40 +01:00
Guðni Már Gilbert fcfb868167 PFW-1397 Add a temporary menu item to show the statistic
The location of the menu has not been decided. Currently I placed it where convenient.
2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 5a60a85467 PFW-1397 Increment toolchange statistic 2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 0af7d28074 PFW-1397 Allocate EEPROM memory for toolchange counter 2022-11-08 13:49:40 +01:00
Guðni Már Gilbert 7fe22e8f79 Fix long-press LCD inactivity timeout
Fixes #3715

When a long-press is triggered, the LCD inactivity timer
needs to be restarted. This is done with lcd_timeoutToStatus.start()

This also fixes situations where a long-press is triggered, and the timer
times out immediately (because it was not reset properly)

Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2022-11-06 13:43:14 +00:00
DRracer 30b8629c6f
Merge pull request #3732 from 3d-gussner/MK3.13.0-ALPHA1
Bump up build number from 6052 to 6054
2022-11-04 14:05:44 +01:00
3d-gussner 853adbf411 Bump up build number
+1 for commit
+1 for merge
2022-11-04 11:16:07 +01:00
3d-gussner 2b29455587
Merge pull request #3731 from 3d-gussner/MK3_3.13.0-ALPHA1
Bump up Revision to ALPHA1 6051
2022-11-04 10:57:35 +01:00
3d-gussner 7c009cadb8 Bump up Revision to ALPHA1 6051
Temporary fix for MSG_BTN_MORE
pre-release pot and po update
2022-11-04 10:21:39 +01:00
DRracer 7b20f8c6f3
Merge pull request #3717 from 3d-gussner/MK3_Temp_Model_menu
Add Menu `Calibration -> Temp. model cal`
2022-11-03 12:12:55 +01:00
3d-gussner 38a8cb8af3 Fix typos and Upper case at beginning 2022-11-03 12:10:44 +01:00
3d-gussner ccdfc337a5 Norwegian translation
All credit to @OS-kar for the new translations

Add replacement for `Ø`
Update List of Community made translations
2022-11-03 12:10:44 +01:00
3d-gussner 1e0909d50c Disable `Error:` messages for MMU2 errors 2022-11-03 12:09:03 +01:00
3d-gussner 8543942acb Fix Z-leveling 2022-11-03 06:22:57 +01:00
3d-gussner fd6da0e766 Fix typo
Add lcd_setatatus_serial to output lcd status message and serial at the same time
2022-11-02 10:09:32 +01:00
Guðni Már Gilbert 7bc7f21fa5 mmu: move RetryIfPossible outside the error screen
This fixes issue where 'retryAttempts=3' may be spammed in the logs

Change in memory:
Flash: 0 bytes
SRAM: 0 bytes
2022-11-01 06:22:39 +01:00
3d-gussner 1a35bf506a
Merge pull request #3716 from 3d-gussner/MK3_translations
WIP PFW-1412: Update translations
2022-10-28 05:45:18 +02:00
3d-gussner ab10a65a40 Update Swedish translation
All credit to @Painkiller56
2022-10-26 17:21:00 +02:00
3d-gussner 1bb1446934 Fix few Czech translations 2022-10-26 17:20:34 +02:00
3d-gussner 2ac2cd2255 Fix MK25/S builds 2022-10-26 14:27:22 +02:00
3d-gussner 072b3f8300 Temp Model cal. menu 2022-10-26 13:34:27 +02:00
3d-gussner 81ae10c001 Update Swedish translation part 1
All credit to @Painkiller56
2022-10-25 12:09:13 +02:00
3d-gussner c2b60ba0e6 Update Swedish and Norgwegian 2022-10-25 10:34:13 +02:00
3d-gussner f4a2c1c794 Update translations
Fix button msg
Update Dutch `F. jam detect`
2022-10-25 10:29:35 +02:00
Guðni Már Gilbert c852d501ee
Merge pull request #3714 from gudnimg/optimise-factory-reset-stats
Optimisation: use `failstats_reset_print()` in `factory_reset_stats()`
2022-10-23 10:10:44 +00:00
Guðni Már Gilbert 45c72d48ed optimisation: use failstats_reset_print in factory_reset_stats
Change in memory:
Flash: -56 bytes
SRAM: 0 bytes
2022-10-23 09:58:56 +00:00
Yuri D'Elia 46a6aea750
Merge pull request #3712 from wavexx/catch2_v3
build: Update to Catch2 v3.1.1
2022-10-22 17:03:39 +02:00
Yuri D'Elia f4918622f0 build: Update tests for Catch2 v3 2022-10-22 16:33:28 +02:00
Yuri D'Elia ae17cef676 Update Catch2 v3.1.1
Re-initialize subrepo
2022-10-22 16:10:41 +02:00
Alex Voinea edc5d013dd
Merge pull request #3698 from leptun/farm_presort_cache
Farm mode: cache filenames in the presort function
2022-10-21 15:43:49 +02:00
3d-gussner 0c458a8740
Merge pull request #3696 from Hauzman/MK3_Romanian_translation
Mk3 Romanian translation
2022-10-21 08:51:49 +02:00
3d-gussner 42c8628516
Merge pull request #3684 from AttilaSVK/MK3
Updated Hungarian translation for MK3
2022-10-21 07:10:37 +02:00
3d-gussner d66007f188
Merge pull request #3689 from 3d-gussner/MK3_cmake_boards106
Update cmake Arduino_boards to 1.0.6
2022-10-19 17:20:36 +02:00
3d-gussner 26e2a8a9dc
Merge pull request #3706 from 3d-gussner/MK3_Croatian_rebase
Update Croatian translation
2022-10-19 17:20:24 +02:00
3d-gussner edb430af08
Merge pull request #3687 from wavexx/lang_diff_instructions
lang: Add git diff filter instructions for po files
2022-10-19 17:20:02 +02:00
3d-gussner a9828a1761 Update Croatian translation
All credits to @prime1910
2022-10-19 09:38:53 +02:00
Hauzman 2bafa30df0
Update Firmware_ro.po 2022-10-19 10:07:45 +03:00
3d-gussner d76d01a4f6
Merge pull request #3693 from 3d-gussner/MK3_diacritics
Update diacritics
2022-10-19 08:52:41 +02:00
3d-gussner b792d47350
Merge pull request #3694 from 3d-gussner/MK3_Hotend_fan
PFW-1415: Rename `Extruder fan` to `Hotend fan`
2022-10-19 08:47:15 +02:00
3d-gussner c0c6c815a4
Merge pull request #3699 from 3d-gussner/MK3_Sheet_NylonPA
PFW-1409: Rename Sheets
2022-10-19 06:48:26 +02:00
Hauzman 17bb9f6f43 Fix msgstr "" and long translations 2022-10-18 23:01:34 +03:00
Alex Voinea b485992c9e If in farm mode, force the sorting direction to be reversed
So in an ideal scenario, the newest file is first. This of course breaks as soon as a file is deleted/renamed/moved, but it should at least be fixed now compared to before where the direction could be influenced by a disabled setting
2022-10-18 17:29:31 +02:00
Alex Voinea 798f215f88 Refactor SD menu settings 2022-10-18 17:24:35 +02:00
3d-gussner eaaf1d6872 Rename Sheets
- `Satin 1` to `Satin  `
- `Satin 2` to `NylonPA`
2022-10-18 10:20:01 +02:00
Alex Voinea e18bfce597 Farm mode: cache filenames in the presort function 2022-10-17 20:17:28 +02:00
Hauzman 5908abcf6c Fix typo 2022-10-17 18:55:07 +03:00
3d-gussner e83728f72c Change fan RPM display to 5 digits
All credits to @ WarrenSchultz for initial PR https://github.com/prusa3d/Prusa-Firmware/pull/3656
2022-10-17 15:41:05 +02:00
3d-gussner f2fe9a51ee rename `Extruder fan` to `Hotend fan` 2022-10-17 13:49:18 +02:00
3d-gussner 655bf1db92 Update diacritics 2022-10-17 10:11:33 +02:00
Hauzman 42edaab279
Merge pull request #2 from Hauzman/MK3_Romanian
Mk3 romanian
2022-10-16 14:28:40 +03:00
Hauzman 146ee3032e Final Corretions 2022-10-16 14:22:19 +03:00
Hauzman 7f5211b917 final correction 2022-10-15 14:40:23 +03:00
Hauzman 0957c72c36
Merge pull request #1 from Hauzman/MK3_Romanian
Mk3 romanian
2022-10-15 13:58:12 +03:00
3d-gussner e8bb19b3ea
Merge pull request #3688 from wavexx/lang_it_update
lang: IT: Partial update
2022-10-14 12:28:28 +02:00
Yuri D'Elia 990f585312
Merge pull request #3686 from wavexx/lang_checks
Add targets for language checking
2022-10-14 10:43:45 +02:00
3d-gussner 66c3519b3b Update cmake Arduino_boards to 1.0.6 2022-10-14 06:07:50 +02:00
Yuri D'Elia d6e79706d2 lang: IT: Partial update
Update new italian translation strings, excluding most of the MMU
related changes.
2022-10-13 23:13:50 +02:00
Yuri D'Elia 2a0f0bcd19 lang: Add git diff filter instructions for po files 2022-10-13 23:09:55 +02:00
Alex Voinea b846b9b70d
Merge pull request #3685 from gudnimg/sd_menu_optimisation
Optimisation: Reduce code size in rendering SD file names and folders
2022-10-13 21:13:35 +02:00
Yuri D'Elia 9bfe480320 CI: Ignore lang-check errors in lang stage 2022-10-13 20:48:46 +02:00
Yuri D'Elia c0b194795c CI: Add a new stage to check languages 2022-10-13 20:48:46 +02:00
Yuri D'Elia 688542602d cmake: Add targets for language checking
Add the following macro targets to check translations:

- check_lang: check all languages for all variants
- check_lang_[variant]: check all languages for [variant]
- check_lang_[lang]: check all variants against [lang]
- check_lang_[variant]_[lang]: check a single variant/language

For example:

- ninja check_lang: check *everything*
- ninja check_de: check German in all variants
- ninja check_MK3S-EINSy10a: check all languages in the MK3S
- ninja check_MK3S-EINSy10a_de: check German in the MK3S
2022-10-13 20:24:19 +02:00
Yuri D'Elia 468f4f8c57 cmake: Always check po files for errors during build 2022-10-13 20:20:47 +02:00
Yuri D'Elia 3f9e61e338 lang: Add --errors-only to suppress all warnings/suggestions 2022-10-13 20:20:09 +02:00
Yuri D'Elia 222054f516 lang: Handle empty translations wrt --no-warning
Do not emit empty translation warnings if --no-warning has been
specified.

We have a special handler for this case already (--warn-empty).
2022-10-13 20:05:39 +02:00
Guðni Már Gilbert 2682b64a09 Optimisation: Reduce code size in rendering SD file names and folders
Change in memory:
Flash: -88 bytes
SRAM: 0 bytes
2022-10-12 20:19:21 +00:00
Yuri D'Elia f399e56677
Merge pull request #3683 from wavexx/cmake_tc
cmake: Toolchain tweaks
2022-10-12 12:38:49 +02:00
AttilaSVK 18b82f73c9
Updated Hungarian translation for MK3_3.12 2022-10-12 11:20:29 +02:00
Yuri D'Elia 73fbcfa47d build: Switch vscode to AvrGcc 2022-10-12 11:13:28 +02:00
Yuri D'Elia 788b89a997 build: Switch travis to AvrGcc 2022-10-12 11:13:12 +02:00
Yuri D'Elia 036a04938d cmake: Introduce AvrGcc/AnyAvrGcc toolchains, replacing LocalAvrGcc
- AvrGcc: use avr-gcc from dependencies
- AnyAvrGcc: use system's avr-gcc for testing
2022-10-12 11:07:45 +02:00
Yuri D'Elia 7b0362302e bootstrap: Minor tweaks 2022-10-12 10:49:09 +02:00
Yuri D'Elia 7b7b7167fb bootstrap: Use gcc 7.3.0 from microchip 2022-10-12 10:48:39 +02:00
D.R.racer 2c695f14be Increase required MMU version to 2.1.4.x 2022-10-12 07:45:13 +02:00
D.R.racer 6eab0dda59 Add parentheses - be more explicit in error codes' masking and comparison 2022-10-11 15:51:01 +02:00
D.R.racer 0aeb74e5b1 Intercept M708 A0xb: set ExtraLoadDistance on the printer side too 2022-10-11 15:51:01 +02:00
D.R.racer b0466ae20f Add infrastructure for MMU parametrization after comm start
For now, only the Extra loading distance is being sent, but the infrastructure can be easily extended for other registers as well.
2022-10-11 15:51:01 +02:00
D.R.racer c7e4c9ce99 Allow backwards compatibility with legacy MMU g-codes
This piece just changes the default extra load length on the MK3 side.
The same needs to be done on the MMU side but:
- the MMU exposes its register for this (so we can change the extra load distance by writing into the register via G-code)
- the printer shall probably set this value on its own after line up of MMU communication
2022-10-11 15:51:01 +02:00
D.R.racer 013ce588a5 Support reading/polling multiple registers
In Idle and Command mode it is now possible to specify a list of registers which shall be periodically read from the MMU.
To keep the code and RAM size down registers are intentionally separated into 8bit and 16bit sets.
Adding a register into the set is just a matter of parametrization, there is no need to change the state machines anymore.
2022-10-11 15:51:01 +02:00
D.R.racer ebb79351a7 Add preliminary support for MMU_SELFTEST_FAILED error messages 2022-10-11 15:51:01 +02:00
3d-gussner d5ca47d1a6
Merge pull request #3646 from gudnimg/fix-mmu-buttons-v2
PFW-1403 Fix issue where physical MMU buttons do not dismiss error screen
2022-10-11 13:42:39 +02:00
Guðni Már Gilbert 8882d8f2c8 Only move XY when position is known
I had a crash when producing an error screen and printer was unhomed.
Extruder was located at the far right side, and immediately crashed when attempting to park.
2022-10-11 07:16:52 +02:00
Guðni Már Gilbert 9f3361577e
Merge pull request #3643 from gudnimg/PFW-1358
PFW-1358 More button utilizes text and an empty character on the right
2022-10-10 18:02:22 +00:00
Guðni Már Gilbert 98cfc37017
Merge pull request #3674 from gudnimg/mmu-first-lay-cal-purge-line
MMU: Sync first layer purge line with PrusaSlicer generated output
2022-10-10 17:59:18 +00:00
Guðni Már Gilbert 213f0e8c71 PFW-1358 Update second_col description
Value is no longer hardcoded
2022-10-10 17:48:56 +00:00
Yuri D'Elia 07da5b2768
Merge pull request #3680 from wavexx/cmake_repro_build
cmake: Improved reproducibility rules
2022-10-10 19:36:09 +02:00
Alex Voinea 4f9022cea1
Merge pull request #3654 from leptun/fix_miniRambo_SD_init
Enable MISO pullup during SD CMD0
2022-10-10 15:09:09 +02:00
Yuri D'Elia 8a00179528 cmake: Improved reproducibility rules
Rewrite cmake rules for reproducibility and move them inside a separate
module.

The new rules are cleaner and can operate on multi-directory projects
transparently.
2022-10-10 14:19:03 +02:00
Alex Voinea eb43d712df Enable MISO pullup during SD CMD0
Fix typo
2022-10-10 09:43:50 +02:00
Guðni Már Gilbert ccf0c0a09f
Merge pull request #3675 from gudnimg/pad-mmu-status-messages
Fix issue where MMU status messages are not padded
2022-10-09 10:49:55 +00:00
Guðni Már Gilbert 1c6345a85b Fix issue where MMU status messages were not padded
Also combined common cases to reduce code size
2022-10-09 10:37:33 +00:00
Guðni Már Gilbert 76dc51d2f0 Sync first layer purge line with PrusaSlicer generated output
If you generate a multicolor gcode file with PrusaSlicer, the purge
line gcode will look like this.

This reduces clicking sounds from the extruder, filament extrusion is reduced by 6mm.
2022-10-09 10:03:54 +00:00
Guðni Már Gilbert 047a8d7593
Merge pull request #3671 from gudnimg/cmake-ninja-setting
Specify CMake generator in vscode settings
2022-10-08 11:12:55 +00:00
Guðni Már Gilbert d483531606 PFW-1358 update c values 2022-10-08 09:40:43 +00:00
Guðni Már Gilbert 00ccdcd467 PFW-1358 change MSG_BTN_MORE from I1 to N1 2022-10-08 09:25:06 +00:00
Guðni Már Gilbert ee6c1e77ca PFW-1358 Remove MSG_BTN_MORE from po files 2022-10-08 09:24:21 +00:00
Guðni Már Gilbert fb2f54f7b8 Specify CMake generator in vscode settings 2022-10-08 09:17:53 +00:00
Guðni Már Gilbert d6e0f47739 PFW-1403 Rename ReportErrorSource to ErrorSource for shorter code 2022-10-08 08:51:32 +00:00
Guðni Már Gilbert 33690b927a PFW-1403 Fix issue where physical MMU buttons do not dismiss error screen 2022-10-08 08:51:32 +00:00
Guðni Már Gilbert 8f0de44d84 PFW-1358 Move 'More' button to the corner of the screen
Make 'More' button position consistent with 3-button screen.
2022-10-08 08:50:40 +00:00
Guðni Már Gilbert 7264391c5f PFW-1358 Fix and optimise button choice positions 2022-10-08 08:50:40 +00:00
Guðni Már Gilbert 9046fb3d44 PFW-1358 Adjust positions of button choices 2022-10-08 08:50:39 +00:00
Guðni Már Gilbert 06427087c0 PFW-1358 Change "More" button to single character 2022-10-08 08:50:39 +00:00
Alex Voinea d96392d875
Merge pull request #3431 from TojikCZ/MK3_eeprom_doc
Fill the doc for the EEPROM value at 0x0DA1 - active_sheet
2022-10-07 12:17:37 +02:00
Tomáš Jozífek 233174cf86 Fill the doc for the EEPROM value at 0x0DA1 - active_sheet 2022-10-07 11:59:57 +02:00
3d-gussner 64f01d603d
Merge pull request #3663 from 3d-gussner/MK3_PADDED_SIZE
Add padded size for individual languages
2022-10-07 08:31:22 +02:00
3d-gussner 2067cddc46
Merge pull request #3631 from 3d-gussner/MK3_fix_eeprom_documentation_part1
MK3 fix eeprom doxygen documentation
2022-10-06 15:29:15 +02:00
Alex Voinea 629fc9d0f1
Merge pull request #3638 from wavexx/tm_cal_click
TM: Consume LCD click after calibration
2022-10-06 14:29:40 +02:00
3d-gussner bab83704a1 Fix Typo 0X0 to 0x0 2022-10-06 13:23:16 +02:00
3d-gussner 0a7a6faa25
Merge pull request #3632 from Hauzman/MK3
Update MMU RO Language
2022-10-06 11:52:32 +02:00
3d-gussner 9aaa7ca4bc
Merge pull request #3626 from ingbrzy/MK3
Update Firmware_sk.po
2022-10-06 10:55:31 +02:00
3d-gussner dd389d018b Add padded size for individual languages 2022-10-06 10:49:36 +02:00
3d-gussner 27261f2f93
Merge pull request #3661 from wavexx/cmake_testing3
CI: Update travis to build/test with cmake
2022-10-06 09:39:39 +02:00
Yuri D'Elia cf576e98bf cleanup: Remove obsolete test.sh
Replaced by cmake tests
2022-10-05 23:31:07 +02:00
Yuri D'Elia 82ded37916 CI: Switch to a minimal image 2022-10-05 22:57:08 +02:00
Yuri D'Elia b9247df206 CI: Update travis to build/test with cmake
Include the new cmake-based build in travis.
Split the build into 3 stages: cmake, legacy and tests.

cmake: new cmake-based build (*all* variants, including english only)
legacy: old build.sh based build (using arduino-builder)
tests: cmake tests (not terribly useful at the moment)
2022-10-05 21:42:43 +02:00
Guðni Már Gilbert effd5aa5f9
Merge pull request #3660 from gudnimg/cmake-build-type
Set CMake build type to Release when using kit
2022-10-05 18:08:06 +00:00
Guðni Már Gilbert d73f1fa28d Set CMake build type to Release when using kit 2022-10-05 18:00:01 +00:00
Yuri D'Elia bfaed2768c
Merge pull request #3652 from wavexx/cmake_build_v2
cmake build improvements v2
2022-10-05 14:20:28 +02:00
Yuri D'Elia 896008cee4 cmake: Remove unneeded additional include path 2022-10-05 11:10:05 +02:00
Yuri D'Elia d867da201f cmake: Define FW_VARIANT instead of copying Configuration_prusa 2022-10-05 01:26:30 +02:00
Yuri D'Elia 1d3ee1caba build: Add Configuration_var.h as a configuration wrapper
Instead of including Configuration_prusa.h directly, include
Configuration_var which then includes the proper variant file though a
preprocessor macro.

This allows to keep the existing build system intact, but also redefine
at compile time the final header without having to make copies on the
file system.
2022-10-05 01:26:26 +02:00
Yuri D'Elia 5237365ff7 cmake: Fix existing comment 2022-10-04 22:55:33 +02:00
Yuri D'Elia 007d90bc75 cmake: Normalize incoming dependency paths 2022-10-04 12:38:40 +02:00
Yuri D'Elia 2ae376d633 build: Size optimization
Explicitly force-noinline xyzcal_scan_pixels_32x32_Zhop to match the
previous LTO build behavior.
2022-10-04 12:13:09 +02:00
3d-gussner 19477690c9
Merge pull request #3650 from 3d-gussner/MK3_Arduino_Boards_106
Update PF-build.sh to use Arduino_boards 1.6.0 which is same as devel…
2022-10-04 08:08:03 +02:00
Yuri D'Elia c479e002d4 cmake: Hard-link final hex files to reduce space overhead
cmake 3.19 introduced support for hardlinks, so use them instead of
making a copy.
2022-10-04 01:13:14 +02:00
Yuri D'Elia 0dbf08b8db cmake: Cleanup the final dual-language hex
List the file as a byproduct of the rule for correct cleanup.
2022-10-04 00:18:14 +02:00
Yuri D'Elia 96a2c9cb4a cmake: Improve a few comments 2022-10-03 23:57:00 +02:00
Yuri D'Elia 75377f3081 cmake: Use/include Buddy formatting rules for consistency 2022-10-03 23:54:24 +02:00
Yuri D'Elia 0b23ab8e09 cmake: Fix/uniform non-xflash builds 2022-10-03 23:53:05 +02:00
Yuri D'Elia 9d716e9d69 cmake: Move a few variables closer to usage 2022-10-03 23:53:05 +02:00
Yuri D'Elia 3ec54d355e cmake: Correctly patch binary during multi-language builds
lang-map.py expects to use the BIN file as an input-output argument.
The resulting BIN file contains an updated _PRI_LANG_SIGNATURE symbol.
2022-10-03 23:53:05 +02:00
Yuri D'Elia ac1fca4a6a cmake: Generate .hex files only where needed
This avoids generating useless intermediate .hex files during
multi-language builds.
2022-10-03 23:53:05 +02:00
Yuri D'Elia 8188117c4f
Merge pull request #3653 from wavexx/more_warnings
cleanup: Fix more spourious missing return warnings
2022-10-03 21:59:20 +02:00
Yuri D'Elia 5ed6bd7f8b cleanup: Fix more spourious missing return warnings
Rewrite to use a temporary and get rid of the warning.
The generated asm is *unchanged*.
2022-10-03 21:54:08 +02:00
Yuri D'Elia ac84dd1457 cmake: Update the variant configuration correctly when changed 2022-10-03 20:55:27 +02:00
Yuri D'Elia 7d9dc1007c cmake: Cleanup XFLASH multi-language rules 2022-10-03 19:51:41 +02:00
Yuri D'Elia 7e56a8255b cmake: Define all targets, but only build ALL_MULTILANG by default
ALL_ENGLISH is mostly intended for debugging purposes
2022-10-03 17:51:31 +02:00
Yuri D'Elia 63605f4c86 cmake: Reformat to fix tab/space mixture 2022-10-03 17:40:48 +02:00
3d-gussner 1ff2d93702 Remove gawk 2022-10-03 16:40:04 +02:00
3d-gussner b5bcedfecb Update PF-build.sh to use Arduino_boards 1.6.0 which is same as devel 1.0.5-2 2022-10-03 16:27:29 +02:00
3d-gussner 992845198d
Merge pull request #3648 from wavexx/more_cleanups
cleanup: Expand tabs to fixup suspicious indentation warnings
2022-10-03 11:53:42 +02:00
3d-gussner 57c4716b8f
Merge pull request #3647 from wavexx/cmake-build
cmake build improvements
2022-10-03 11:53:18 +02:00
Yuri D'Elia 0ac4130b7d cmake: Correctly split/gc sections while linking
Repeat the flags while linking for LTO
2022-10-02 20:44:02 +02:00
Yuri D'Elia 4cc6695195 cleanup: Expand tabs to fixup suspicious indentation warnings 2022-10-02 20:42:36 +02:00
Yuri D'Elia 4412881439 cmake: Generate correct inline source listings in asm output
Manually provide a source path prefix to objdump
2022-10-02 20:32:32 +02:00
Yuri D'Elia a8e85bd146 cmake: Work-around gcc 7 not supporting SOURCE_DATE_EPOCH 2022-10-02 20:32:32 +02:00
Yuri D'Elia cdd822269a cmake: Only make the target reproducible 2022-10-02 20:32:32 +02:00
Yuri D'Elia 1d520f9165 cmake: Make builds fully reproducible by default
- Work-around SOURCE flags being reset for each project when setting the
  random-seed property by calling a support function.
- Likewise, set correct flags for reproducibility when creating archives.
- Strip source prefix paths from debug info

This should set the EPOCH using the last git commit date when available,
but it's not currently implemented. Just set the EPOCH to be 0 for now.
2022-10-02 20:32:32 +02:00
Yuri D'Elia 655b403c14 cmake: Uniform target compile/link flags 2022-10-02 20:32:32 +02:00
Yuri D'Elia 9288462b59 cmake: Tighten ignores 2022-10-02 20:32:32 +02:00
Yuri D'Elia 530702d1c9 cmake: Allow to configure/restrict the variant to be built
This introduces FW_VARIANTS as a configurable option, defaulting to the
full list of variants.
2022-10-02 20:32:32 +02:00
Yuri D'Elia b3add22885 cmake: Move tests and CMakefiles to tests/ 2022-10-02 20:32:32 +02:00
Yuri D'Elia 7f1bd0f046 cmake: Update Catch2 2022-10-02 20:32:32 +02:00
Yuri D'Elia fea4c64056 cmake: Remove obsolete tests 2022-10-02 20:32:32 +02:00
Yuri D'Elia 47f89bb418 cmake: Do not set PROJECT_VERSION in PARENT_SCOPE 2022-10-02 20:32:32 +02:00
vintagepc d8c9c4450f
Merge pull request #3641 from vintagepc/build-with-cmake
Build the firmware with cmake
2022-10-02 13:05:32 -04:00
Hauzman b0aeca8042 Fix typo 2022-09-30 22:30:07 +03:00
Yuri D'Elia 0ffd33c142
Merge pull request #3639 from wavexx/cleanup_warnings
Cleanup warnings
2022-09-30 15:19:42 +02:00
Yuri D'Elia c7b6b9a99b cleanup: Suppress unused argument warnings 2022-09-30 15:08:11 +02:00
VintagePC c522330433 Merge remote-tracking branch 'upstream/MK3' into build-with-cmake 2022-09-30 09:04:35 -04:00
Yuri D'Elia 49f96213a4 Also consume longpress in lcd_consume_click() 2022-09-30 14:29:37 +02:00
Yuri D'Elia b95d508574 cleanup: Remove implicit fallthrough in CRC validation 2022-09-30 12:55:47 +02:00
Yuri D'Elia 71be6b19d4 cleanup: Remove return value from MMU2Serial::write()
Removes a missing return warning.

Looks like we don't handle overflow at the moment and in all surrounding
code, so let's remove the return value for now.
2022-09-30 12:55:47 +02:00
Yuri D'Elia 6cfe000ac9 cleanup: Reorder members to match initialization order 2022-09-30 12:55:47 +02:00
Yuri D'Elia 398a4bf403 cleanup: Do not return const values from functions
This generates a warning under -Wextra, since in most cases a const
value doesn't prevent buggy code (as copies are allowed) while
preventing some optimizations (such as move operations) to take place.
2022-09-30 12:55:47 +02:00
Yuri D'Elia d6af13dfc1 cleanup: Supress missing return warnings
Rewrite the function with a temporary to avoid the spourious no-return
warning.

The generated code is *unchanged*.
2022-09-30 12:31:07 +02:00
Yuri D'Elia 31ea48246a TM: Consume LCD click after calibration
Consume any pending LCD click after the temperature model calibration.
Since we're already in the status menu, the usual consume action is not
done automatically here.
2022-09-30 12:24:54 +02:00
Hauzman d2e2ecc736
Fix typo, update missing translation 2022-09-30 09:51:51 +03:00
3d-gussner 9f6d3e2c10
Merge pull request #3633 from 3d-gussner/MK3_BETA_message
Remove BETA Warnings
2022-09-29 17:20:29 +02:00
3d-gussner 74e15ac233 Rename EN_ONLY to EN_FARM
remove DEBUG/DEVEL/ALPHA/BETA lcd warning
2022-09-29 16:39:02 +02:00
3d-gussner 346dfbdbb3 Fix MSG_SPOOL_JOIN 2022-09-29 10:54:46 +02:00
3d-gussner c7b500af1e BETA firmware message only in English
Rephrase BETA firmware message to fit on two screens
ALPHA message same as DEVEL
Fix ALPHA DEVEL message
2022-09-29 10:48:16 +02:00
Hauzman 64dbf596f4 Update MMU RO Language
Co-Authored-By: Alex Voinea <voinea.dragos.alexandru@gmail.com>
2022-09-28 21:19:49 +03:00
3d-gussner 1a8f18318c Add Temp Model eeprom documentation 2022-09-28 18:15:23 +02:00
3d-gussner 302e4b679c replace tab with spaces 2022-09-28 17:37:46 +02:00
ingbrzy b44ffc77ee
typo 2022-09-27 10:16:31 +02:00
ingbrzy 1db249ec1a
typo SK 2022-09-26 18:31:03 +02:00
Yuri D'Elia 4434d120c8
Merge pull request #3628 from wavexx/lcd_pad_fix
lcd_print_pad: do not overflow len when truncating the string
2022-09-26 11:58:00 +02:00
Yuri D'Elia 709d07310a lcd_print_pad: do not overflow len when truncating the string 2022-09-26 11:26:10 +02:00
ingbrzy 92359a9160
Update Firmware_sk.po 2022-09-26 10:15:25 +02:00
VintagePC 4a3b07f832 Fix include path 2022-09-25 10:55:23 -04:00
DRracer d15246adde
Merge pull request #3607 from prusa3d/MK3_MMU2_fix1
MK3S/+: support for new MMU2S
2022-09-23 15:02:56 +02:00
Alex Voinea 97cd0c5f08
Merge pull request #3622 from leptun/MK3_MMU2_fix2
Mk3 mmu2 fix2
2022-09-23 15:01:38 +02:00
Alex Voinea 7fb53899dc Merge branch 'MK3' into MK3_MMU2_fix1 2022-09-23 14:55:23 +02:00
Yuri D'Elia 3fe5311b82
Merge pull request #3620 from wavexx/warn_message_behavior
Improve warning behavior during thermal anomaly
2022-09-23 14:48:23 +02:00
Yuri D'Elia 26b091d50e Remove unneeded lcd_finishstatus() 2022-09-23 11:54:16 +02:00
Yuri D'Elia 80c06bda55 Improve warning behavior during thermal anomaly
The current code forces any warning to return the user to the status
screen in order to show the message.

Thermal anomaly warnings can repeat at very short intervals, making menu
navigation (to pause/tune the print) impossible.

We now check if the message to be displayed is the same and only force a
kickback for new messages.

This partially reverts https://github.com/prusa3d/Prusa-Firmware/pull/3600
since we need the string to be null terminated for ease of comparison.

We pad the status line at display time instead using the new
lcd_print_pad() function which achieves the same effect.
2022-09-22 16:12:35 +02:00
Tom Mittendorf 24b638b5d4 fixed undefined behaviour when left shifting a negative number 2022-09-21 16:21:19 +02:00
Yuri D'Elia a08984d94e
Merge pull request #3618 from wavexx/fix_startup
Do not hang during startup
2022-09-21 16:17:53 +02:00
Yuri D'Elia 9a9aadca87 Do not hang during startup
In ultralcd_init() do not use lcd_setstatuspgm() to initialize the
welcome message.

The internal call to lcd_finishstatus() requires the serial to be
already available. Split the function into lcd_padstatus() to pre-pad
the string and save some space.
2022-09-21 16:12:16 +02:00
DRracer f7d4095479
Merge branch 'MK3' into MK3_MMU2_fix1 2022-09-21 15:18:44 +02:00
Yuri D'Elia 86944d9ff6
Merge pull request #3616 from leptun/optimize_prusa_commands
Move strings to progmem
2022-09-21 15:07:58 +02:00
Alex Voinea 2cdd3ba364 Move strings to progmem 2022-09-21 14:53:54 +02:00
Yuri D'Elia 16d1ef8510
Merge pull request #3560 from leptun/splash_version
Show firmware version on splash screen
2022-09-21 14:47:41 +02:00
Yuri D'Elia a1213d6a6e
Merge pull request #3600 from gudnimg/init-lcd-status
Fix initialization of LCD status line message
2022-09-21 14:46:10 +02:00
Yuri D'Elia ca9a28eff2
Merge pull request #3612 from wavexx/tm_update_r0
Temperature model: update R0 estimate
2022-09-21 14:46:03 +02:00
Yuri D'Elia bccdab4c22
Merge pull request #3615 from wavexx/line_cnt_reset_fix
Do not reset line on serial commands without N
2022-09-21 14:45:46 +02:00
Yuri D'Elia 9f1f396c18
Merge pull request #3609 from wavexx/set_313_version
Update current FW version
2022-09-21 14:43:55 +02:00
3d-gussner 183e21aa0b
Merge pull request #3599 from 3d-gussner/MK3_MMU2_messages
PFW-1339 - Update MMU2 translations
2022-09-21 10:27:01 +02:00
Yuri D'Elia 129df6dd4a Do not reset line on serial commands without N
Fix regression introduced in fc10ca3146.

Accept incoming serial commands without line numbers (assumed to be
injected by the host), but do not reset the last line count when doing
so.
2022-09-21 10:19:16 +02:00
Yuri D'Elia 1c4e9463ec Temperature model: update R0 estimate
Update the default R0 estimate thanks to a larger dataset.
This improves the error margin during self-check.
2022-09-20 16:57:54 +02:00
Guðni Már Gilbert eb7de5149b Don't inline the function
Change in memory:
Flash: -44 bytes
SRAM: 0 bytes
2022-09-20 06:34:24 +02:00
Guðni Már Gilbert c8a8484ca7 Remove atomic_update parameter
Change in memory:
Flash: +24 bytes
SRAM: -0 byte
2022-09-20 06:34:24 +02:00
Guðni Már Gilbert 76fb4610ea Optimisation: Remove duplicated code in cmdqueue_could_enqueue_back()
Code is 28 lines shorter :)

Change in memory:
Flash: -42 bytes
SRAM: 0 bytes
2022-09-20 06:34:24 +02:00
Yuri D'Elia 156b5e5b99 Update current FW version 2022-09-19 18:15:39 +02:00
Alex Voinea 6a470791d3 Allow sending uint16_t values to registers 2022-09-19 15:13:37 +02:00
3d-gussner 0d00da6364 Consistent use of Idler = Spannrol and Pulley = Riemschijf in Dutch
Thanks to @vintagepc
2022-09-19 08:20:31 +02:00
3d-gussner 770fdcd83b Fix typo, thanks to @gudnimg 2022-09-19 08:02:40 +02:00
Guðni Már Gilbert 28b0ef1acb PFW-1369 Use same ramming sequence as default settings in Slicer 2022-09-19 07:23:03 +02:00
3d-gussner 82f29634c4 Forgot one Dutch translation 2022-09-17 18:10:02 +02:00
3d-gussner 075a80e264 Add missing text
Finish Dutch translation
2022-09-17 17:38:45 +02:00
3d-gussner 068f4763e2 Update translatable strings to match our extraction macros
Update pot and po files
2022-09-17 16:53:30 +02:00
3d-gussner ae8d1eb546 Dutch translation part 1 2022-09-17 16:36:09 +02:00
3d-gussner d9df8eed79 update pot and po files 2022-09-17 16:36:09 +02:00
3d-gussner 47d7ea5dfd Add MSG_LOAD_ALL and replace it a two loactions -10bytes flash 2022-09-17 16:36:09 +02:00
Guðni Már Gilbert 25a7dc8397 Fix: Filament Already Loaded only has two buttons 2022-09-17 16:36:09 +02:00
Guðni Már Gilbert 15a8c8fe37 Fix: Unload Manually did not send any button to the MMU 2022-09-17 16:36:09 +02:00
Guðni Már Gilbert 9b4a621275 Fix: Fsensor errors only have one reset button 2022-09-17 16:36:09 +02:00
Guðni Már Gilbert 037d51b049 Fix: Filament Already Loaded only has two buttons 2022-09-17 12:21:42 +02:00
Guðni Már Gilbert 3b60b894da Fix: Unload Manually did not send any button to the MMU 2022-09-17 12:21:42 +02:00
Guðni Már Gilbert e7b7d97f11 Fix: Fsensor errors only have one reset button 2022-09-17 12:21:42 +02:00
Guðni Már Gilbert be7c1d55c8 Remove redundant for-loop
Now that lcd_status_message is now initialised correctly at boot-up,
this for-loop is no longer required. Now lcd_status_message is
only set in lcd_updatestatus() which always calls lcd_finishstatus()

lcd_finishstatus() makes sure the message does not exceed 20 characters

Saves 34 bytes of flash
2022-09-17 09:13:07 +00:00
Guðni Már Gilbert 4d6d267aef Don't initialise lcd status message in definition
static variables are automatically zero initialised. Now that the
status line message is initialised in ultralcd_init(), we don't
need to set the variable in global scope.

Saves 22 bytes of flash and 1 byte of SRAM
2022-09-17 08:57:30 +00:00
Guðni Már Gilbert f1e127ace4 Initialise status line message in setup()
Fixes #3581
2022-09-17 08:53:36 +00:00
3d-gussner 404c622301 Finish German translation
increase 2nd langusge size to 0x3500 13567bytes to fit mmu2 translations 🤞
2022-09-17 10:35:30 +02:00
3d-gussner ec22e5faeb Shorten message to 20 chars
add 01234567890123456789 ruler
2022-09-17 10:34:24 +02:00
3d-gussner 6e8a1d88f2 Add current size of translation if it fails
disable translation suggestions by default during build, as we have lot of identical translated messages as the origin.
2022-09-17 10:32:24 +02:00
3d-gussner 539cdbfeea Lower MSG_ rows 2022-09-17 08:48:56 +02:00
3d-gussner 4bbae51912 Add --shorter check 2022-09-17 08:48:27 +02:00
3d-gussner 78fdf33f67 Update Firmware.pot and Firmware_de.po
Started German translation Part 1
Updated c= r= for German translations being longer than 8 rows
2022-09-16 20:42:50 +02:00
3d-gussner 8480c1cb7a Added //#define FARM_CONNECT_MESSAGE 2022-09-16 19:33:22 +02:00
3d-gussner 88b58cdcd5 Update messages missing c= r=
Change MMU2 KEEPALIVE_STATE to IN_PROCESS
2022-09-16 19:24:11 +02:00
3d-gussner f4f09e4062 update mmu2 messages c= r= values 2022-09-16 19:18:23 +02:00
3d-gussner 0f8d84082a Update button menu documentation as there are 1/2/3 options 2022-09-16 19:11:11 +02:00
3d-gussner 9d959f5d12 Prepare progress messages for translation
Remove duplicate messages
2022-09-16 19:08:06 +02:00
3d-gussner 89a03c1f0d MMU2/lang: Update translatable strings to match our extraction macros 2022-09-16 19:02:04 +02:00
3d-gussner 50b6044703 Use origin message on serial 2022-09-16 18:17:50 +02:00
3d-gussner 3f6b05cc35 Remove PAT9125 stats as these aren't different to IR stats 2022-09-16 18:04:21 +02:00
3d-gussner 2ba863d8a5 Reuse MSG_IR_0x_OR_..
fix lowercase
remove todos
2022-09-16 17:23:38 +02:00
3d-gussner edad625cf7 RIP Bondtech long live the Extruder 2022-09-16 16:31:27 +02:00
3d-gussner 37cde856e9 Rename Auto_deplete to Spool_join
Fix some missing MSG_ c= r=
2022-09-16 16:25:47 +02:00
3d-gussner 62b03066d3 Updated update-pot.sh to search also `Firmware/mmu2` resources 2022-09-16 16:21:33 +02:00
3d-gussner ca9b34c4a2 Add double down arrow to be processed correctly 2022-09-16 16:18:25 +02:00
3d-gussner d8f40f1864
Merge pull request #3597 from DRracer/mk3-mmu-thermal2
Save some space due to shorter MMU error texts
2022-09-16 13:46:05 +02:00
D.R.racer f18493f361 Save some space due to shorter MMU error texts
applies https://github.com/prusa3d/Prusa-Error-Codes/pull/62
2022-09-16 12:12:08 +02:00
3d-gussner 9c639182d3
Merge pull request #3596 from DRracer/mk3-mmu-thermal2
Fixup MK3_MMU2 branch after rebase onto MK3
2022-09-16 11:51:52 +02:00
D.R.racer 2d98cae8bd Fixup MK3_MMU2 branch after rebase onto MK3 2022-09-16 11:08:03 +02:00
Guðni Már Gilbert 16713aa25a Optimisation: scopeState is already set by SendReadRegister
Saves 2 bytes of flash
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert e9f5a95d4b PFW-1362 Make sure FINDA runout is impossible with MMU disabled
Since mmu_loop() is called in the main loop() function
when the MMU is disabled, we need to utilise the
MMU protocol layer to prevent FINDA runout from happening
if MMU is disabled.

We also need to keep in mind we probably can't trigger
a FINDA runout in the middle of a Q0 query.
So my solution now is to wait for the "Finished" state
and check if the FINDA is off during printing.

When "Finished" state appears, the FINDA value should be up
to date.
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 94119744ad PFW-1362 Change isSpoolJoinEnabled to return bool 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 65a0036dbe PFW-1362 Optimise debug message
Saves 20 bytes of flash :)
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 998ed87f25 PFW-1362 Use PROGMEM messages
The main purpose of these two messages is just to see if SpoolJoin is enabled or not.
"On" and "Off" are descriptive enough.

Saves 16 bytes of flash
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 63b4abb66d PFW-1362 SpoolJoin needs to known what the previous slot was 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 1010f23959 Fix an issue where findaPressed is never set
This caused instant FINDA runout when the print starts. Now fixed :)
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert b292a5bf4e PFW-1362 temporarily don't use SpoolJoin in Tcodes
I think in the current implementation, this will cause more harm than good.
But we can improve SpoolJoin later
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 7dcfc1484e PFW-1362 temporary debug messages 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 8610636906 PFW-1362 Add a log when FINDA filament runout is triggered 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert c5bb34f226 PFW-1362 Show if SpoolJoin is enabled or disabled at bootup 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert fb27a7d72b PFW-1362 Remove "NA" EEPROM status 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 166ecbc7d8 PFW-1362 Fsensor is not required for Spooljoin
Since the Fsensor is not required to use SpoolJoin,
it makes little sense to me that we need the fsensor
to "enable" SpoolJoin
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert d51026d8f7 PFW-1362 Rename settings for consistency 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 7c95f87867 PFW-1362 Fsensor status is not required for SpoolJoin 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 428f4a87ed Remove unused CMake tests 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 715af8fcc2 Rename files to SpoolJoin 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert afc67332c7 PFW-1362 Initial commit 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 2276217cbb Optimisation: Remove forceMenuExpire variable
During first layer calibration we have the live Z baby step menu
on the LCD and the user can tune their Z offset live.

Once the first layer calibration is done, we want to exit the menu
immediately. For this purpose it is much more efficient to
call lcd_return_to_status(). There is no visual difference
on the LCD for the user.

Change in memory footprint:
Flash: -34 bytes
SRAM: -1 byte
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert e39d1458a1 Fix lost changes during rebase 2022-09-16 10:23:47 +02:00
3d-gussner fae420f1e2 Fix MMU_ALWAYS_CUT enabled in variants 2022-09-16 10:23:47 +02:00
3d-gussner 8e9a49082b Set Cutter OFF if 0xff 2022-09-16 10:23:47 +02:00
3d-gussner b3ec36228d Update doxygen documentation for M704-M709 2022-09-16 10:23:47 +02:00
D.R.racer 2e7258d7a8 Include fix protocol from MMU PR#199 2022-09-16 10:23:47 +02:00
D.R.racer 4d3a5433ad Implement read/write registers for M707/M708 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 04a1a67b05 PFW-1386 Address TODO
We want to move the Z-axis after the XY move is done.

raise_z cannot be used here because it relies
on current_position[] for all axis.

It is actually 10 bytes cheaper to use the previous method
because syncing current_position with lastpos is surprisingly expensive
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 27ff01cf91 Shorter code
Change in memory:
Flash: 0 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert db1b0ea9ac Optimisation: Set lastpos using memcpy directly
Verified the change by running the M600 gcode. All axis move as expected.

Change in memory:
Flash: -64 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert f984072eab Remove unused #define 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert f49b88c1a1 Optimisation: lcd_commands "M702 C" should be "M702"
Change in memory:
Flash: -2 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 0c1052b0da Optimisation: mmu_M600_load_filament
Don't render full screen for Loading Filament X
this is already done in load_filament_to_nozzle
so no need to do it twice

Change in memory:
Flash: -54 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert bf9ba3c003 Optimisation: setTargetedHotend serial message
Change in memory:
Flash: -130 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 635ae2bf20 M600: Small optimisation in if statements
Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert f297131792 M600: lcd_change_fil_state does not need to be global
Refactor lcd_alright() to save flash

Change in memory:
Flash: -98 bytes
SRAM: -1 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 2216ba9fbf M600: Ask for which slot to use when loading
This fixes an issue where the assumed slot to use is unknown and
the printer will hang on loading filament 100.

Another good thing is this is an old user feature request which
we have in our 3.12 milestone.

Change in memory:
Flash: +14 bytes
SRAM: -1 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 3e86bbb93f M600: Don't unload if filament is unknown
Change in memory:
Flash: +8 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 05bf5de518 Fix calibrate_z_auto crashing Z-axis
Steps to reproduce:
1. Run M45 Z after booting the printer up

Change in memory:
Flash: -4 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 03b8a6e464 Use raise_z in more places
Change in memory:
Flash: -474 bytes
SRAM: 0 bytes
2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 4758ac3f1b PFW-1399 Don't show cut filament menu if setting is not enabled 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 55d2eaf8c0 M706: Only cut filament if the setting is enabled 2022-09-16 10:23:47 +02:00
Guðni Már Gilbert 66994d010d Fix a few cases where rebase overwrote stuff 2022-09-16 10:23:47 +02:00
D.R.racer 0537908d8c Fixup 2 2022-09-16 10:23:47 +02:00
D.R.racer 37b50477cd Fixup after rebase onto MK3 2022-09-16 10:23:47 +02:00
D.R.racer 18423685b6 Cleanup ExpectsResponse usage 2022-09-16 10:22:39 +02:00
D.R.racer d5377c1781 Remove extra "scopeState = ScopeState::FINDAReqSent"
saves ~20B in total
2022-09-16 10:22:39 +02:00
D.R.racer e205d0ee2f Autoretry Idle scope: transf. into Finished, should stay in Processing 2022-09-16 10:22:39 +02:00
D.R.racer 78cbea08e6 Fix pgm_read* usage 2022-09-16 10:22:39 +02:00
D.R.racer 6c0d3b0b78 Optimize MMU protocol logic 2022-09-16 10:22:39 +02:00
D.R.racer 05ad1dc2f6 Refactoring of protocol logic to lower RAM consumption
Should also place the statistics request to the right spot in the state machine.
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert dfddf3eaa5 Initial commit for MMU statistics 2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 2616df66af PFW-1386 st_get_position_mm() is more accurate when using endstops (not homed printer)
If the endstops kick in, then st_get_position_mm shows the actual travel distance. current_position[Z-AXIS] does not get updated correctly thus we cannot use it when unhomed.

current_position[Z-AXIS] is later set to Z_MAX_POS,
we cannot use that either to calculate the travel distance
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert f409426bdc PFW-1386 Refactor raise_z
Removed the "plan" parameter.
We were incorrectly returning from the function if the printer was homed,
but plan = false. This would leave current_position with an incorrect value

If the printer is homed => finish the move and return the travel distance

If the printer is not homed => rely on end stop to prevent damage,
return travel distance even if the endstop stopped the move.
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 4a1479b5bc PFW-1386 Clamp Z-axis when homed 2022-09-16 10:22:39 +02:00
Guðni Már Gilbert fa6e30389a PFW-1386 Add a TODO
When recovering the Z-axis in M600, we'd like the Z move to
happen after the XY move.
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 0a90c7ffda PFW-1386 Use Marlin 2 unload sequence for single material
The current unload sequence does not give good results.
The Marlin 2 sequence looks good on my end. This can be later
used to improve M600

Added all the constants from Marlin 2
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert ff91b4670d PFW-1386 Use same code for Z-lift in M600 as in M701/M702
This reduces flash usage by 128 bytes!
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 099c3a1f1f PFW-1386 fixup 2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 38952f1f33 PFW-1386 Optimisation: st_synchronize is not needed after raise_z_above
Saves 16 bytes of flash
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 214b6a9220 PFW-1386 M701, M702: Move Z-axis using relative position
* Created a new function raise_z() which will move the Z axis by some
X millimeters. If plan = false, the function will return the
actual travel distance since the move is blocking.
* raise_z_above() is refactored to call raise_z()

Now the M701 and M702 will move the Z-axis relatively, and also
when done, revert the Z axis position when done.
This is a similar behavior as in Marlin 2.
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 217b537961 PFW-1386 Remove old debug message to save space
Saves 34 bytes of flash
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert bb0bbfb45f PFW-1386 Minor correction to M707 and M708 useage example 2022-09-16 10:22:39 +02:00
Guðni Már Gilbert d78c575399 PFW-1386 Address should accept hexidecimal values
Now these are equal:
M707 A255 C1
M707 A0xFF C1

Both address inputs are interpreted as FF
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert ba7dae5c79 PFW-1386 I don't see a reason for these lines
So I'm removing them
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 3192a95e78 PFW-1386 Optimise default value assign z_target 2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 20c865c2d4 PFW-1386 Implement 'U' parameter for M702
Similar to 'L' in M701, this does not apply to the MMU
The U parameter controls how much mm the extruder will unload
Default value is 80mm
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 7e9166976f PFW-1386 Implement 'L' parameter for M701
It is only used when the MMU is disabled. With the MMU we use a defined ramming sequence.

When the MMU is disabled I borrowed the usages from Marlin 2.
The L parameter only defines the length for the "fast" load length.
Default value is 70mm, same as M600
2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 94dd4aec73 PFW-1386 M701 now loads to nozzle with MMU 2022-09-16 10:22:39 +02:00
Guðni Már Gilbert 8462b38446 PFW-1386 Create a common function for M704 to M706
Saves 36 bytes of flash
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert d6564d3617 PFW-1386 if automatic = false, raising Z-axis is done via gcode 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 32ec1587b9 PFW-1386 Implement changes to M702 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 9b0d89213b PFW-1386 Raising Z-axis during M701 is now done via Gcode
If the Z-parameter is not issued, then default behavior will raise
the Z-axis by MIN_Z_FOR_LOAD
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 5bb36546b4 PFW-1386 Implement changes to M701 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert fb087fc535 PFW-1386 Add M707 and M708
WriteRegister and ReadRegister function will create new compiler
warnings due to unused parameters, we can ignore it for now.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 3664d29b21 PFW-1386 Add M709 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert de0539b630 PFW-1386 Implement M704, M705, and M706 2022-09-16 10:22:38 +02:00
D.R.racer 70532333dc Optimize filament sensor implementation
- remove virtual methods (we only have one fsensor implementation at a time)
- comment out some of the debugging texts
- remove volatile and replace them with proper synchronized access to relevant variables
2022-09-16 10:22:38 +02:00
D.R.racer 2662e09f1e Another message remove from RAM 2022-09-16 10:22:38 +02:00
D.R.racer 0e036b9d8a Save some more RAM in protocol_logic 2022-09-16 10:22:38 +02:00
D.R.racer 022aa53b2d Remove active_extruder completely
we only use 1 extruder + saves ~800B
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 0889109760 Fix corrupted chars in "Engaging Idler" message 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert bac3168ca4 Optimise power_on and power_off
eeprom_update_byte only updates the EEPROM if the value is different

Saves 40 bytes of flash memory
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 0d64cfa2e5 extruder variable should be one byte
Saves 1 byte of SRAM and 132 bytes of flash
2022-09-16 10:22:38 +02:00
D.R.racer 87a4f58e66 PFW-1363 Change MMU Error parking position 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 703c463a49 Optimize unload
Toolchange during print is now much quieter.
Excessive E-motor movement during print is now gone
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 47e57646ea Optimize load
Don't start moving the E-motor immediately

Instead of starting the E-motor move when the load to extruder starts,
we can start when we are loading to the fsensor. At that stage
the MMU has changed from a fast load to a slow load.
2022-09-16 10:22:38 +02:00
D.R.racer 2f0ceabce5 Upgrade protocol to v2.1 - read/write registers + CRC 2022-09-16 10:22:38 +02:00
D.R.racer f18721bee3 Fix unintentional typo 2022-09-16 10:22:38 +02:00
D.R.racer 6d6f9583ea Initialize retryAttempts in constructor 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 485ed4a213 Fix issue where logs show two corrupted chars
Issue only appears when LANG_MODE = 1
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 938fac4058 Remove old comment, button is acknowledged now 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert f717aa161c Remove TODO in ActivatePlannedRequest 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert b9d9308f9f Support 3x Retry in Idle state machine 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert ab32769487 Send button from current state machine 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 4f30cf0ba3 Add missing ProtocolError 2022-09-16 10:22:38 +02:00
Alex Voinea bc85a41059 Fix xflash flashing 2022-09-16 10:22:38 +02:00
D.R.racer 53e2d68183 Retry up to 6x in case of incorrect MMU FW version
Because it looks like the communication drop outs are caused by some electrical issues and we can loose even a byte from the version response, which is deadly for future operation.
2022-09-16 10:22:38 +02:00
D.R.racer 6e5fcb5838 Tune a few MMU progress codes' texts to fit on the LCD 2022-09-16 10:22:38 +02:00
D.R.racer 14b2befb7d Switch from Start Seq into Idle immediately + disable FS autoload on MMU 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 400fec5d9f Reset CustomMsg when Command in progress is None
When a Progress report is started, we set the CustomMsg to MMUProgress.

But there was an issue where, once the reported "Progress" action was done.
We did not reset the CustomMsg to Status. So if we are printing from the
SD card, the file name is not displayed on the LCD.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 5b184d885c Add LCD_BUTTON_TIMEOUT to enum 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert e59651a279 Remove description in header file
The description are more detailed in the ultralcd.cpp file

No need to document the function in two places :)
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 2fc8b50f11 Fix lcd_show_multiscreen_message_yes_no_and_wait_P after rebase 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert be3f9376ba Add missing break 2022-09-16 10:22:38 +02:00
D.R.racer 09cb9c6ecd Fixup after rebase + discussion 2022-09-16 10:22:38 +02:00
D.R.racer 1d2acb5bd6 Bump MMU FW version to 2.0.19 to match/enforce the necessary compatibility level 2022-09-16 10:22:38 +02:00
D.R.racer fa176c69db Fix protocol error recovery
Communication timeout and Protocol Errors are now distinguished.
In case of a Protocol Error, the printer waits for heartBeatTimeout to allow filling up the input UART buffer (we expect the MMU still produces some bytes).
Once the timeout elapsed, the input UART buffer is cleared and a new Start Sequence is initiated.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 6bf2aebf04 Fix typo 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 80c640deb9 PFW-1373
Fix the unload procedure when the user has paused a print
then stopped the print after the temperature has reached below 175°C
Now the E-motor will move as expected
2022-09-16 10:22:38 +02:00
VintagePC ba52430e1d Magic numbers are bad... 2022-09-16 10:22:38 +02:00
VintagePC 69c39e2281 An attempt at fixing the retry. Discussion needed. 2022-09-16 10:22:38 +02:00
D.R.racer c412f062c8 Perform 3xRetry automatically
This is a draft PR showing the potential 3x retry implementation on the printer's side.
It is much less code and looks more reliable than the same functionality in the MMU FW.

Still, more work needs to be done:
- [ ] Button is sent to the MMU even before returning from the parking position
- [ ] Then the button is sent again
- [ ] Then the printer runs out of retryAttempts

We need to find a better spot to check for "automatic" retry and issuing of the buttons
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 999320f671 Limit build number to uint8_t (#49)
Currently the MMU only sends one byte so there is no need
in storing the version with two bytes
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 6b7a018f9b PFW-1354 Fix slow button processing (#37)
* Fix MK3S buttons being processed too slowly

After a button is selected on the MK3S MMU error screen, we need to process it before asking for another MMU Query.

Because the MMU Query will make the Error screen return and overwrite the status screen

* Add back CheckUserInput for ButtonPushed event
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert d420b20bd9 Add a missing break
I don't see any difference in behaviour but this should be more correct
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 3520020b24 * Correct the unload length on the MK3S side
* Pull all numbers into global constants
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 6eb2767dd2 PFW-1334 Distinguish between a retry unload and U0 unload
U0 unload uses the ramming sequence, while the retry unload does not because the MMU starts unloading much sooner
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 9a52bb5d04 Add MMU2_UNLOAD_TO_FINDA_FEED_RATE 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 59d19a8330 PFW-1334 Move E-motor on FSENSOR error retry 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert b8432e6bf2 Partial fix for PFW-1334
When a FSENSOR error happens, the first step for the MK3S should be to stop any loading by stopping the E-motor.

From this point, the buttons should determine what the MK3S does next.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 2aa6cfc1ab Optimise mmu_cut_filament_menu (#40)
preheat_or_continue should be used here to reduce copying code
2022-09-16 10:22:38 +02:00
VintagePC 8eb054e789 Fix trying to use serial before it's intiialized 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert ace5130d9f PFW-1375 MMU error reported by MK3S does not appear on LCD 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 7d3a50450d PFW-1340 Hide Done button for two errors
* FSENSOR_DIDNT_TRIGGER
* FSENSOR_DIDNT_GO_OFF

The Done button does not Move the E-motor because it
expects the user to have manually resolved the problem

Also if the filament is in the gears, we cannot pull the filament out.
In this case the Retry button is more suited as it will unload the filament.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 4dd689ba9a Fix PFW-1357 (#35)
lcd_encoder_diff would be set to 0 if lcd_update_enable(true)
is called outside ReportErrorHookMonitor
This would put enc_dif out of sync with lcd_encoder_diff and could cause false rotation triggering
2022-09-16 10:22:38 +02:00
vintagepc d7d6885765 PFW-1351 Cooldown timeout (#33)
* PFW-1351 WIP

* Fix bug with cooldown timing due to bad bitfield.

* Use default safety timer value for timeout
2022-09-16 10:22:38 +02:00
D.R.racer d1b216da0d Disable fsensor newVolt debug reporting 2022-09-16 10:22:38 +02:00
D.R.racer f94c2cba46 Fix rendering temp. + toolchange on MMU error screen 2022-09-16 10:22:38 +02:00
D.R.racer a004273e8f Avoid drawing MMU Error screen while MMU moves manually 2022-09-16 10:22:38 +02:00
D.R.racer 98adcbaff2 Bump required MMU FW version to 2.0.18 2022-09-16 10:22:38 +02:00
D.R.racer dab26fe50b Report detected MMU version in the Support menu
It was just subtly broken, all the functionality had already been implemented.
2022-09-16 10:22:38 +02:00
D.R.racer 121d43f896 Add a Try-Load-to-Bondtech operation
PFW-1347
2022-09-16 10:22:38 +02:00
VintagePC 0e96169bb3 remove logspam 2022-09-16 10:22:38 +02:00
VintagePC 4ea53ad4bf fix bug I introduced 2022-09-16 10:22:38 +02:00
VintagePC c07a5f396d Fix button enum 2022-09-16 10:22:38 +02:00
VintagePC d9676eff25 Fixed buged temperature resume. 2022-09-16 10:22:38 +02:00
VintagePC f9bedc3c94 Button handling WIP 2022-09-16 10:22:38 +02:00
VintagePC 9a20c85a5d First pass, improving the error recovery. 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 1e391f303c PFW-1344 Fullscreen message Loading Filament
When loading a filament through the LCD,
show a full screen message:

Loading Filament N

Where N can range from 0 to 5.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 8aa16a6429 Write documentation for lcdui_print_extruder 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 8fd1653b84 PFW-1343 initial commit 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert ed04c24ba0 Implement 'Filament not loaded' option for M600 with MMU 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert caf98936e3 Minor cleanup 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert b9c23cd6b8 Add Unloading message to LCD
Also made mmu_M600_load_filament static to limit its scope
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert d5cdb412ba Introduce a way to read the previous tool used 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 2d02877686 Disable automatic in M600 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert e39bc3f12d During Tx, temporarily allow cold extrusion
This prevents a FSENSOR DIDNT TRIGGER error
and allows the bondtech gears to grab the filament.
2022-09-16 10:22:38 +02:00
D.R.racer 45a5e719a2 Disable filRunout when MMU.Enabled()
It turned out the runout is caused by the ramming sequence in the G-code, which is interpreted before the actual MMU command gets into processing.
The frequency of these errors/runouts differed one machine from another and was really hard to track down.
Therefore - once the MMU is enabled (active and running) we'll disable filament runout handling caused by the printer's filament sensor.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert a1881b4a07 Disable filament runout when MMU is unloading 2022-09-16 10:22:38 +02:00
VintagePC 762080ab1a Fix some partking and recovery bugs 2022-09-16 10:22:38 +02:00
D.R.racer 8b6941d493 Temporarily disable runout
There are still printers which suffer from spurious runouts for no reason.
For testing purposes, runout will be disabled until the real cause is found.
2022-09-16 10:22:38 +02:00
D.R.racer 01f926f074 Fix build MK25S 2022-09-16 10:22:38 +02:00
VintagePC f155c7664d Add missing CheckUserInput calls, fix bad array entry for FW_update 2022-09-16 10:22:38 +02:00
VintagePC e8088b0161 Allow reset if the EEPROM is set to "on" 2022-09-16 10:22:38 +02:00
VintagePC 888a37450b Fix wrong return 2022-09-16 10:22:38 +02:00
VintagePC 73c486cc2f - Fix DisableMMU button on FW incompat
5823c14
- Implement eeprom var, fix reset
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 204b43dce4 PFW-1336
The following situation is now fixed, steps:
1. Load filament through LCD
2. Load to nozzle through LCD
3. Before filament reaches Fsensor => turn off the printer
4. Wait a few seconds and then turn the printer on again
5. Start a print through the SD card
6. Printer will unload and then re-load the filament

Previously in step 6, the printer would start a print without any
filament loaded.
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 46184a9447 Update printer name if M862.3 is called but not M862.2 2022-09-16 10:22:38 +02:00
D.R.racer 236098dbca Make init MMU error screens send buttons (Idle mode) 2022-09-16 10:22:38 +02:00
D.R.racer b880559ba7 Reset MMU upon start + fix reporting its start errors 2022-09-16 10:22:38 +02:00
D.R.racer 1ff7459743 Re-enable filament runout + add debug msgs
Needs a fix on the MMU side (report FeedToBondtech::DisengageIdler)
2022-09-16 10:22:38 +02:00
D.R.racer b6b265e371 Hack around old MMU FW's msgs 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert c1134e7e68 Cleanup: Remove an old comment 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert bd932b3b10 Cleanup: Fix two compiler warnings 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert cfc56af95c Cleanup: fix parameter comments 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 268c96334b Cleanup: Pull out PrusaErrorCodeIndex
Saves 8 bytes of flash
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert d49e858cf7 PFW-1323 Fix MMU error screen doesn't disappear when error resolved on the MMU 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 7b91e73c8b Fix issue where error screen updates too slowly in manage_response 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 98d07e6a09 Call lcd_set_custom_characters_nextpage 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 5ced30d8ca Cleanup: Add comments and reduce code size slightly 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert 352a22c22e Cleanup: Remove unused callback
Remove unused callback in lcd_show_multiscreen_message_with_choices_and_wait_P
2022-09-16 10:22:38 +02:00
Guðni Már Gilbert ecb4d08049 PFW-1318 Rewrite the implementation to be non-blocking 2022-09-16 10:22:38 +02:00
Guðni Már Gilbert dc87bbae11 Fix compile error 2022-09-16 10:22:38 +02:00
D.R.racer 0e75a03c8c Reuse FSensor runout blocking impl. throughout the whole FW 2022-09-16 10:22:38 +02:00
D.R.racer eed816d9de Fix build 2022-09-16 10:22:38 +02:00
D.R.racer d7270e0b80 Fix lang build 2022-09-16 10:22:38 +02:00
D.R.racer f04d83fc4c Update printer's type (MMU/non-MMU) at runtime
+ reformat utils.cpp
2022-09-16 10:22:38 +02:00
D.R.racer 5082da78d2 Convert button on LCD into button for MMU
- Dependent on current MMU error being processed
- Includes rename of LEFT_BUTTON_CHOICE -> LCD_LEFT_BUTTON_CHOICE (and right, middle as well) to avoid confusion with MMU buttons' ordering
2022-09-16 10:22:38 +02:00
D.R.racer a0e9a302b8 Suppress communication drop-out < 8s (MMU in bootloader)
PFW-1327
2022-09-16 10:22:38 +02:00
D.R.racer ba8332cd3e Fix MK25 build 2022-09-16 10:22:38 +02:00
D.R.racer d628525a94 Fix build MK25S 2022-09-16 10:22:38 +02:00
D.R.racer f3f2086f29 Fix compilation MK3 2022-09-16 10:22:38 +02:00
D.R.racer 0bd3dfdcf7 This starts to print ;)
Temporarily disabled filament runout as this breaks ToolChange operation
yet for unknown reason.
2022-09-16 10:22:38 +02:00
D.R.racer 456ddbb538 Handle the new MMU states (slow load to fsensor) 2022-09-16 10:22:38 +02:00
D.R.racer 5f9ca6a6f3 Reorder errors list according to Prusa-Error-Codes #61 2022-09-16 10:22:37 +02:00
D.R.racer 8a92865969 Update MK3S to match MMU PR#168
- new progress and error codes
- remove #error from mmu2_power.cpp as it makes no sense
- remove temporary error translation code
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 33650c6e56 Remove redundant call to lcd_update_enable 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert f1803357b0 Fix default selection after changes in PFW-1312
The Yes and No are reverted. Before PFW-132 Yes is 1 and No is 0
Now they are Yes is 0, and No is 1
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 45edc69cc4 Add back menu it confirm if extrusion has correct color after loading to nozzle via LCD
I've added the call to this message via the menu function to ensure it
only appears when interacting with the LCD
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 1c26875e0e PFW-1318 Implement callback to render status line
To render the thermometer and degree symbols
the CGRAM table will instead swap out
the feedrate and clock symbol when
lcd_set_custom_characters_nextpage()
is called.
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 452f39dc4b fixup 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 3b0fba14ac Remove unused parameter nlines to simplify things
This allows us to remove one overload
of lcd_display_message_fullscreen_P
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert e817a2d321 Don't block OnMMUProgressMsg while waiting for fsensor to trigger 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 0aa3a5855e Add TODO to prompt user if extruder is extruding correct color 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 1c25041134 Add the load to nozzle sequence once the MK3S takes control and MMU has disengaged idler.
Also removed ProgressCode::FeedingToNozzle from switch-case since it is not used for this purpose at the moment.
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 3e77f9f3a1 Reduce grinding when loading to the fsensor
- We need to take into account additional 35mm move by the MMU.
- While the fsensor is not triggered, reduce the extruder movement each step from 20mm to 5mm. This should help reduce the variance in the filaments position before we run the final load to nozzle sequence.
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 450ce0fc64 Improve load to nozzle sequence
- Fixed a bug where the feed rate was 60x higher than intended
- Adjusted the sequence via trial and error. The sequence where the filament has not exited the nozzle is 35mm shorter than the previous implementation
- I reduced the feed rate slightly (by 1mm/s) on the fast load sequence
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 50cd6e77cc Initial commit for loading filament to the nozzle 2022-09-16 10:22:37 +02:00
D.R.racer 87ed42ba9b Fix FW update needed button order 2022-09-16 10:22:37 +02:00
D.R.racer 108f439bb7 Make sure the MMU error title never overflows on the LCD 2022-09-16 10:22:37 +02:00
D.R.racer 68b007c759 Fix compile-time conversion MMU2 ErrorCode -> Prusa-Error-Code
and hide some of the implementation details into mmu2_error_converter.cpp
which makes the code in mmu_reporting.cpp much easier to read.
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 138a0d21c7 Change default selection parameter from bool to uint8_t
This allows us make any of the three button choices the default selection
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 89e2bc4d6b Change name of variable 'yes' to be more descriptive 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert c1ec80817c Update the error menu after merging new changes
Will test this tomorrow
2022-09-16 10:22:37 +02:00
D.R.racer c28354bf92 Update error codes + constexpr FindErrorIndex
Beware - requires avr-gcc 7.3!
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 6e1cf7e98c Fixup 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 031c588802 Make all choice menus return consistent values
Such that left = 0, middle = 1, and right = 2
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 37bfd8ecd1 Checkpoint
- combined lcd_show_three_choices_prompt_P and lcd_show_two_choices_prompt_P into one function called lcd_show_choices_prompt_P
- Removed third_col parameter
- Added an enum to make the button selection result more readable
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 8dbb883971 Add helper macros to parse nibbles
Also made the button operations and nibbles constant since they should not be modified.
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert e6a3fa5e40 Remove unused includes after I moved the MMU error screen 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 83fefe10c1 Checkpoint:
- Rename lcd_show_multiscreen_message_two_choices_and_wait_P to lcd_show_multiscreen_message_with_choices_and_wait_P

- Move MMU error screen from ReportError() to ReportErrorHook()

- Fix the menu selection to work for menus with either two choices or three choices

- The buttons shown on the MMU error menu are now determined by the definition of btnOperation[]
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 96ff291f59 Implement PFW-1312 in MMU code 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 734e176445 Don't disable LCD updates in menu_item_function_P 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert ffe8c7c31a Update lcd_show_multiscreen_message_two_choices_and_wait_P
to support 3 choices
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 39df6440ce Allow LCD to be updated in manage_response loop
Also removed one TODO which David mentioned is not needed anymore
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 74ea9a7e43 Remove class LcdUpdateDisabler
Calling lcd_update_enable directly gives us more control

This also save a bit of flash memory
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 1ba314d95b Print the MMU progress into status screen 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 15fbb93a8c add that downwards facing >> character 2022-09-16 10:22:37 +02:00
Guðni Már Gilbert b59c9da9ee Move extruder when loading filament to fsensor
When the fsensor see filament, stop the extruder
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 96540d6e2d Fix return value of WhereIsFilament()
getFilamentPresent returns the state of the IO pin of the sensor.
So we should use AT_FSENSOR instead of IN_NOZZLE
since the fsensor does not know if the filament is actually in the nozzle.
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert 11290c1123 Add a read function for mmu_print_saved
and remove the old extern value which is not used anymore

I had to remove "MMU2::" from mmu2_protocol_logic.cpp, otherwise the build failed.
2022-09-16 10:22:37 +02:00
Guðni Már Gilbert dcebad21c8 Add missing spaces to ErrorCode messages
Such that:
MMU2:E=32766ErrorTitleTextDescription
Becomes:
MMU2:E=32766 ErrorTitle TextDescription

Also simplified the process of combining ErrorTitle and TextDescription
into the msg buffer by using snprintf. This is saver since we only
use dstSize in one place instead of two.
2022-09-16 10:21:53 +02:00
Guðni Már Gilbert 6fab95f145 Fix PROGMEM read in ErrorCode message
This could cause the printer to crash. The Serial Stream would show
a garbled string.

Also included in this commit:
* The buffer size is increased from 64 bytes to 192 bytes.  We need to
take into account the length of the ErrorTitle and ErrorDescription.
* Fix overwrite in ErrorCode message buffer.
2022-09-16 10:21:53 +02:00
Guðni Már Gilbert 52f7fb8c51 Add missing space in ProgressCode message
Such that:
MMU2:P=123EngageIdler
Becomes:
MMU2:P=123 EngageIdler
2022-09-16 10:21:53 +02:00
Guðni Már Gilbert 2142cb0849 Fix overwrite in ProgressCode message buffer
When snprintf() if called we need to read the return value to see how
many bytes were written. Then when we call strncpy_P() through
TranslateProgress(), we need to tell the code to start writing
at byte 'len', or &msg[len]. Also we need to update the byte size
which strncpy_P() is allowed to write (64 - len).
2022-09-16 10:21:53 +02:00
Guðni Már Gilbert 4b71466526 Fix PROGMEM read in ProgressCode message
This could cause the printer to crash. The Serial Stream would show
a garbled string and the same corruption would appear on the Status
Screen's status line.
2022-09-16 10:21:53 +02:00
Guðni Már Gilbert d6044387d9 Fix crash in manage_response
The watchdog needs to be kicked in the for(;;) loop.
This is usually done by calling manage_heater before
manage_inactivity.
2022-09-16 10:21:53 +02:00
Alex Voinea c0a6d1343a Increase RX buffer size 2022-09-16 10:21:53 +02:00
Alex Voinea c201a5791a Implement MMU hw reset 2022-09-16 10:21:53 +02:00
Alex Voinea cc177ec5ad Remove old mmu.cpp 2022-09-16 10:21:53 +02:00
D.R.racer b27f690556 Add ProgressCodes -> text converter 2022-09-16 10:21:53 +02:00
D.R.racer 9140ebba55 Add MMU FW version variables
hardcoded for now, but API ready
2022-09-16 10:21:53 +02:00
D.R.racer 22287fec5d Add original M600 MMU handling
seems to be almost unrelated to MMU function at all,
so returning it almost intact.
2022-09-16 10:21:53 +02:00
D.R.racer 87d9f9aba7 Introduce MMU errors + their texts 2022-09-16 10:21:53 +02:00
Alex Voinea 74fad4f8f6 Implement fsensor raii event suppression 2022-09-16 10:21:53 +02:00
D.R.racer 1211ad9360 Report state of fsensor into the MMU code 2022-09-16 10:21:53 +02:00
D.R.racer 825eed97d4 Fix build after rebase 2022-09-16 10:21:53 +02:00
D.R.racer 4fa4b3b2fc Refactor Tx/Tc/T? commands 2022-09-16 10:21:53 +02:00
D.R.racer 4732859a98 Avoid exposing internal variables of fsensor
makes the code a bit shorter as well, because the compiler can be sure
that the variables are not accessed from the outside of the
fsensor.cpp compilation unit.
2022-09-16 10:21:53 +02:00
D.R.racer db0374896f Implement mmu2 serial interface 2022-09-16 10:21:53 +02:00
D.R.racer 208e620660 Return ir_sensor_detected + related functionality 2022-09-16 10:21:53 +02:00
D.R.racer 5870bbc524 Prune most of TODO from mmu2.cpp
+ refactor sound.h for better readability
2022-09-16 10:21:53 +02:00
D.R.racer 2e293e90a0 MMU2 interface overhaul
First port of the new MMU2-printer interface into 8bit FW.
2022-09-16 10:21:53 +02:00
Alex Voinea c27e4623c5 Fix build (??) 2022-09-16 10:20:32 +02:00
Alex Voinea 329745368e Improve PAT9125 UI implementation 2022-09-16 10:20:32 +02:00
Alex Voinea 340bc87110 Checkpoint: jam detection 2022-09-16 10:20:32 +02:00
Alex Voinea 65b2881b06 PAT9125 first prototype 2022-09-16 10:17:33 +02:00
Alex Voinea c5c4c21124 Update Sensor info menu documentation 2022-09-16 10:17:04 +02:00
Alex Voinea bdfd3305cb Cleanup pat9125.h 2022-09-16 10:17:04 +02:00
Alex Voinea c46b97ec2d Add base code for PAT9125_sensor 2022-09-16 10:17:04 +02:00
Alex Voinea 90b78616b7 Fix reinit on error 2022-09-16 10:17:04 +02:00
Alex Voinea fba6d44f33 fsensor event blanking 2022-09-16 10:17:04 +02:00
Alex Voinea 52b44ad178 fsensor add deinit 2022-09-16 10:17:04 +02:00
Alex Voinea ea23e6d924 Fix MK2 build? 2022-09-16 10:17:04 +02:00
Alex Voinea bbe1b1145e Correct ifdefs for all IR sensor types 2022-09-16 10:17:04 +02:00
Alex Voinea a256370c39 Remove original marlin fsensor code 2022-09-16 10:17:04 +02:00
Alex Voinea f9ff929bbe Enable fsensor when preparing for shipping 2022-09-16 10:17:04 +02:00
Alex Voinea d2bfe422f1 Separate runout and enabled settings 2022-09-16 10:17:04 +02:00
Alex Voinea b741707c0e Fsensor error state 2022-09-16 10:17:04 +02:00
Alex Voinea cfe8444fe3 Revert menu hack 2022-09-16 10:17:04 +02:00
Alex Voinea 5484882758 Checkpoint after a lot of removal 2022-09-16 10:17:04 +02:00
Alex Voinea 8fae5e708e Remove unused fsensor variables 2022-09-16 10:09:20 +02:00
Alex Voinea fc49ba115a Move more IR sensor analog stuff to Filament_sensor.h 2022-09-16 10:09:20 +02:00
Alex Voinea b52022f6c6 More dead code removal 2022-09-16 10:08:39 +02:00
Alex Voinea 241c4cc86c Remove dead code 2022-09-16 10:08:39 +02:00
Alex Voinea 6663f719f6 Remove old fsensor_init() 2022-09-16 10:08:39 +02:00
Alex Voinea 43db24e4fe IR_sensor_analog voltage readings 2022-09-16 10:08:39 +02:00
Alex Voinea 7224b5c2b6 Remove OQ and add fancy autoload interaction 2022-09-16 10:08:39 +02:00
Alex Voinea d84e6bda63 Remove old fsensor init 2022-09-16 10:07:49 +02:00
Alex Voinea 338f1f7615 IR volt debugging 2022-09-16 10:07:49 +02:00
Alex Voinea f03922f7cf Fix repeated autoload menu 2022-09-16 10:07:49 +02:00
Alex Voinea 45e43137a5 Filament sensor refactoring initial 2022-09-16 10:07:49 +02:00
Alex Voinea ce0d8f2f12 Correct sensor orientation for old pat9125 init 2022-09-16 10:06:26 +02:00
Alex Voinea 4f08caaa2b Shorter TWI timeout 2022-09-16 10:06:26 +02:00
Alex Voinea 47e610a2c6 Add disable() to swi2c as well 2022-09-16 10:06:26 +02:00
Alex Voinea abbf2a3927 twi safe init 2022-09-16 10:06:26 +02:00
Alex Voinea 28c527fece Use _check instead of register read for probe() 2022-09-16 10:06:26 +02:00
Alex Voinea 54b98c4e63 swi2c safe init 2022-09-16 10:06:26 +02:00
Alex Voinea 8b9bb23652 Unflip the hardcoded flip of the Y axis 2022-09-16 10:06:26 +02:00
Alex Voinea f4dbf424e4 Use PAT9125 new init sequence 2022-09-16 10:06:26 +02:00
3d-gussner 3dc4f20803 Upadte pot and po again 2022-09-14 11:33:24 +02:00
3d-gussner d706ebb556 Update forgotten MSG_ c= 2022-09-14 11:33:24 +02:00
3d-gussner 6e3be50389 Clean up 2022-09-14 11:33:24 +02:00
3d-gussner f65e8ae5dd Add MSG_ALWAYS 2022-09-14 11:33:24 +02:00
3d-gussner 8136e82400 Update pot and po files 2022-09-14 11:33:24 +02:00
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
3d-gussner 270a1086ab No translation needed 2022-09-14 11:33:24 +02:00
3d-gussner 114b46201c Fix lang-check.py 2022-09-14 11:33:24 +02:00
3d-gussner 0a68de0bbe Update MSG c=xx
Mark unused strings as `_n`
2022-09-14 11:33:24 +02:00
3d-gussner fd2d62dcd4 Set reserved space back after cherry-pick 2022-09-14 11:33:24 +02:00
3d-gussner 83315d0494 Update config.h translation documentation and move language to group2
Update fw-build.sh
 - Output used space of each translation (easier to troubleshoot)
 - Read config.h max size per translation
 - output variant .map files (easier to troubleshoot and finding missing/unused messages)
2022-09-14 11:33:24 +02:00
3d-gussner 0580eaada9 Add backup for po/Firmware.pot 2022-09-14 11:33:24 +02:00
Yuri D'Elia 35c3e3ce68 Remove MSG_M117_V2_CALIBRATION
This message is never actually shown on the LCD (it's immediately
overwritten by other content). It also include g-code in a translatable
string, which is not a good idea. It's also otherwise identical to
MSG_V2_CALIBRATION, which we should have used.

Just remove it and save some space in the process.
2022-09-14 11:33:24 +02:00
Yuri D'Elia 0572b1c648 lang: Improve invalid row/column count checks 2022-09-14 11:33:24 +02:00
Yuri D'Elia 671cd70af7 lang: Do not check/build obsolete translation entries 2022-09-14 11:33:24 +02:00
Yuri D'Elia c7354bdfe8 lang: Fix usage of new non-translated strings
Fix cherry-pick
2022-09-14 11:33:24 +02:00
Yuri D'Elia 7a80252556 lang: Add support for raw catalog references with _R
_R marks a raw catalog entry as Referenced (= used) for cases where the
catalog pointers are handled at a lower level.
2022-09-14 11:33:24 +02:00
Yuri D'Elia 05093fbf49 lang: Add inline documentation for the various language macros 2022-09-14 11:33:24 +02:00
Yuri D'Elia 8f021a505a lang: Correctly include last element in map file
__loc_pri_end is inclusive and needs to be accounted for in
get_lang_symbols().

This was incorrectly excluding the last translatable string from the map
file.
2022-09-14 11:33:24 +02:00
Alex Voinea 510f13b24a Make the diag pins open collector with pullup.
Solves random crash detected on startup
2022-09-14 07:39:47 +02:00
Alex Voinea bb57d99c35 Remove the crashDetection software counters and use sfilt 2022-09-14 07:39:47 +02:00
D.R.racer 996f9943a1 Extract PRINTER_ACTIVE into a noinline function
Having the original PRINTER_ACTIVE macro copied at multiple spots doesn't make sense.
Refactoring it into a non-inline function saved ~400 bytes of code.
It should be safe in terms of performance, all occurrences are at non-time critical spots.
2022-09-14 07:31:39 +02:00
Yuri D'Elia 16d666302b Allow choice positioning. Balance Yes/No messages.
Add an additional parameter to control the position of second choice
prompt position (while defaulting to the old).

This allows Yes/No prompts to be equally spaced.
2022-09-14 07:30:57 +02:00
Yuri D'Elia b41fb8a13a Unify fullscreen/multiscreen/yes-no prompt message handling
Modify lcd_show_multiscreen_message_two_choices_and_wait_P to also
handle single-screen or empty (no-clear) prompts, making other functions
redundant. Saves 76 bytes.

Change existing functions to simply call
lcd_show_multiscreen_message_two_choices_and_wait_P with the correct
arguments.

This changes the prompt of existing Yes/No messages: the previous prompt
would use the last two lines of the LCD, while the new prompt is using
just the last line of the LCD instead.

Translation do not require updates, since the Yes/No translation was
already the same in both implementations.
2022-09-14 07:30:57 +02:00
Alex Voinea 4491c64835 Allow "PRUSA SN" to print the SN in eeprom on all variants 2022-09-08 16:40:38 +02:00
Yuri D'Elia d78506a8ea TM: Rename D70 I to D70 S for consistency with M310 S 2022-09-02 15:59:29 +02:00
Yuri D'Elia 9dbee61b74 TM: Remove an unnecessary fabsf call
Ironically gcc was stripping that one for us already.
2022-09-02 15:59:29 +02:00
Yuri D'Elia 81238fbb15 Move MSG_PAUSED_THERMAL_ERROR outside TEMP_MODEL
MSG_PAUSED_THERMAL_ERROR is not specific to model-checking and can be
used also on MK25* variants.
2022-09-02 15:59:29 +02:00
Yuri D'Elia b48c698562 TM: Update default C/R0 estimates for MK3/MK3S variants 2022-09-02 15:59:29 +02:00
Yuri D'Elia 10c524fdb3 TM: Add M310 [F] parameter to enable autotune self-test 2022-09-02 15:59:29 +02:00
Yuri D'Elia 9b9ce1733c TM: Allow to keep model checking enabled during autotuning
Allow running the model checking during autotuning, with the only
exception being the parameter estimation stage where we alter the same
value which is used by the checker (done to conserve memory/code).

With previous changes the model checker will disable/enable itself when
passing through an unavailable R vector entry, allowing to start the
calibration by checking only the stages where the part fan is disabled.

The C/R0 values should be stable enough to provide a fail-safe mechanism
for printers of the same variant right from the factory.
2022-09-02 15:59:29 +02:00
Yuri D'Elia ff459a6427 TM: Handle dynamic parameter changing
Instead of assuming the model state is always valid, allow NAN values to
pass-through the various check/estimation stages.

This allows running the model checker with incomplete parameters (for
example, missing entries in the R vector) and resume automatically.
2022-09-02 15:59:29 +02:00
Yuri D'Elia 54e5702f30 TM: Move initial R0 initialization closer to usage 2022-09-02 15:59:29 +02:00
Yuri D'Elia 9b5ef75b68 Correctly translate thermal model LCD messages 2022-09-02 15:59:29 +02:00
Yuri D'Elia 331de988f7 TM: Avoid an useless float promotion 2022-09-02 15:59:29 +02:00
3d-gussner 66b97683bb Update build.sh and travis to build EN_ONLY
Change FARM_MODE
- Active only on EINSYs in EN_ONLY
- Active on miniRAMBo in all languages
2022-08-30 13:57:43 +02:00
Alex Voinea f5840e1b02 Fix minirambo build 2022-08-30 13:57:43 +02:00
Alex Voinea d1c545fdd6 Disable farm mode in config file 2022-08-30 13:57:43 +02:00
Alex Voinea ec84c22865 Remove unused define 2022-08-30 13:57:43 +02:00
Alex Voinea 2959cc0b64 Do not compile farm lcd_commands 2022-08-30 13:57:43 +02:00
Alex Voinea 2b4c2127e6 Make lcd function static 2022-08-30 13:57:43 +02:00
Alex Voinea 3537024ba2 Remove forgotten config in MK2_minirambo_1.0a 2022-08-30 13:57:43 +02:00
Alex Voinea 8033b65a02 Isolate farm preheat config 2022-08-30 13:57:43 +02:00
Alex Voinea 435ee66bdd Move all farm configuration to header 2022-08-30 13:57:43 +02:00
Alex Voinea d049d09623 Isolate FARM_DEFAULT_SAFETYTIMER_TIME_ms 2022-08-30 13:57:43 +02:00
Alex Voinea 39eb728d54 More farm optimizations
Kudos @gudnimg
2022-08-30 13:57:43 +02:00
Alex Voinea d1c30c338f Fix farmless mode 2022-08-30 13:57:43 +02:00
Alex Voinea bef7b086e3 Isolate the entire farm and statistics code 2022-08-30 13:57:43 +02:00
Alex Voinea 7d597eb8b0 Move farm mode to separate file 2022-08-30 13:57:43 +02:00
Alex Voinea 4e7d686b83
Merge pull request #3574 from leptun/extra_optimizations
More optimizations for 3.12 to fit
2022-08-29 19:25:46 +03:00
Alex Voinea aa2cd4b89c
Merge pull request #3576 from leptun/fix_save_bed_temperature
Save target bed temperature, not current temperature
2022-08-28 17:47:50 +03:00
Alex Voinea 692f51c51e Save target bed temperature, not current temperature 2022-08-28 11:21:17 +03:00
Guðni Már Gilbert 37c9dcbe53 Optimise calculations to use hypot() where possible
flash: -122
RAM: 0

It is defined: hypot(x,y) = sqrtf(x*x + y*y)
2022-08-26 19:36:28 +03:00
Alex Voinea 7d72f0ee2e better lcd printing for IP address
flash: -46
RAM: 0
2022-08-26 19:33:53 +03:00
Guðni Már Gilbert 4e798c9ed1 Remove unused variable maxlimit_status
flash: 0
RAM: -1
2022-08-26 19:29:32 +03:00
Guðni Már Gilbert 7711969e57 ftostr12ns: change xx from long to int
flash: -44
RAM: 0

Largest expected number is 999 after the multiplication by 100.

I measured the execution time drops from ~170us to ~73us.
2022-08-26 19:28:36 +03:00
Guðni Már Gilbert 88e0e33fb2 Use set_destination_to_current instead of memcpy
flash: -14
RAM: 0
2022-08-26 19:27:16 +03: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 22582e560e Remove one redundant st_synchronize() call
flash: -4
RAM: 0

st_synchronize() is called just before leaving gcode_G28() so we don't need to call it again just after leaving gcode_G28()
2022-08-26 19:25:07 +03:00
Guðni Már Gilbert 89fc9f7a62 Optimise lcd_menu_show_sensors_state()
flash: -22
RAM: 0

menu_lcd_lcdupdate_func() takes care of starting lcd_timeoutToStatus if the knob is clicked.

When the knob is clicked we only want to back out of the menu.
This changes makes the menus slightly more conistant behind the scenes.
2022-08-26 19:22:23 +03:00
Guðni Már Gilbert c2340d3648 lcd_babystep_z should not start lcd_timeoutToStatus
flash: -8
RAM: 0

When the menu is entered and left the function
menu_lcd_lcdupdate_func() takes care of resetting the timer.

Currently the firmware will reset the timer twice when the lcd_babystep_z menu is entered. This commit fixes that.
2022-08-26 19:20:22 +03:00
Guðni Már Gilbert 74d6aead2f Optimise if statements in lcd_tune_menu
flash: -10
RAM: 0

I am basically combining two if statements if(SilentModeMenu == SILENT_MODE_NORMAL)
2022-08-26 19:17:07 +03:00
Alex Voinea 25350dfbbc Remove unused variable bFilamentFirstRun
flash: 0
RAM: -1
2022-08-26 19:14:40 +03:00
Alex Voinea 4ded6f195e Move string to progmem
flash: -52
RAM: -6
2022-08-26 18:59:53 +03:00
Alex Voinea 2b2b499063
Merge pull request #3573 from gudnimg/ifdef_M851
Don't include M851 in build if Auto Bed Leveling is not enabled
2022-08-26 18:59:09 +03:00
Guðni Már Gilbert f7ae3039f8 Don't include M851 in build if Auto Bed Leveling is not enabled
The variable cs.zprobe_zoffset is not used unless
auto bed leveling is enabled
2022-08-26 15:35:28 +00: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 c7762386df
Merge pull request #3565 from wavexx/m115_respect_settings
Do not prompt on M115 if FW version check has been disabled
2022-08-25 19:43:12 +03:00
Yuri D'Elia 06e3c1946c
Merge pull request #3570 from wavexx/tm_report_fan_speed
Report correct fan speeds in M155 during calibration
2022-08-25 18:33:03 +02:00
Yuri D'Elia cf1edc85c3 Set a few function attributes to conserve space 2022-08-25 16:50:06 +02:00
Yuri D'Elia 7c8539a9f9 Report correct fan speeds in M155 during calibration 2022-08-25 16:15:51 +02:00
DRracer 2f07e383d6
Merge pull request #3566 from leptun/fix_multi_segment_pause_resume
Fix multi segment pause-resume
2022-08-24 19:36:50 +02:00
Alex Voinea 78534f3b48 Start at the first segment, not the last segment 2022-08-24 20:19:26 +03:00
Alex Voinea 671519caf3 Optimize by hand since the lto is still stooopit
saves ~100B
2022-08-24 20:19:26 +03:00
Alex Voinea b27c8b50e0 Fix power panic handling 2022-08-24 20:19:26 +03:00
Alex Voinea 05bd1ba57f Multi-segment pause resume initial 2022-08-24 20:19:26 +03:00
DRracer 2e677ea3ee
Merge pull request #3569 from leptun/fix_card_removed
Fix "Card removed" on startup
2022-08-24 19:17:24 +02:00
DRracer 0933fdb6fe
Merge pull request #3552 from wavexx/temp_model_check
Thermal Model protection
2022-08-24 19:16:48 +02:00
Alex Voinea ef8be4dfca Fix "Card removed" on startup 2022-08-24 20:10:09 +03:00
Alex Voinea f2f136e014 Use timer3 instead of timer5 on miniRambo 2022-08-24 10:18:45 +03:00
Yuri D'Elia 7907e14cbf Resync planner position upon exiting xyzcal
Split the planner sync code out of planner_abort_hard() so that we can
independently resync the planner position from the counters.

This is needed in xyzcal as we directly modify the stepper counters
(bypassing both planner and stepper).

Call this new function instead of planner_abort_hard() when leaving, so
that motion can resume in the middle of the gcode_M45 instruction.
2022-08-23 17:25:24 +02:00
Yuri D'Elia 35708a61fe No longer disable temperature management in xyzcal
We already disable the heaters upon entering, and the new temperature
isr doesn't perform any direct movement until we return to the main
loop.

This allows us to remove direct control of the soft_pwm interrupt from
the header, which is dangerous.
2022-08-23 17:19:23 +02:00
Yuri D'Elia 7cd888cd0a Update documentation of ThermalStop() 2022-08-21 15:22:46 +02:00
Yuri D'Elia b672be90b2 Do not overwrite saved values if TM error occurs while paused 2022-08-21 14:53:42 +02:00
Yuri D'Elia d8d085287e Re-enable bed temperature automatically for transitory errors 2022-08-21 14:49:12 +02:00
Yuri D'Elia 30dccb3252 Switch to ATOMIC sections instead of cli/sei/CRITICAL_SECTION 2022-08-21 14:49:12 +02:00
Yuri D'Elia ee12cbd58e Do not prompt on M115 if FW version check has been disabled
As done for M862.4, do now show an upgrade prompt if FW version check as
been disabled in the Settings -> HW Setup -> Checks menu.
2022-08-20 16:55:32 +02:00
DRracer 3ebd8b88a4
Merge pull request #3486 from gudnimg/gudni-optimisation
Flash optimizations in loop() and status screen menu
2022-08-19 17:21:17 +02:00
DRracer 0a8d2a3224
Merge pull request #3456 from wavexx/filament_load_consistency
Cleanup: use more constants in M701
2022-08-19 17:14:54 +02:00
DRracer 84888507e3
Merge pull request #3557 from wavexx/fix_g28_code_value
G28: check for X/Y/Z parameters before calling code_value_long
2022-08-19 17:12:07 +02:00
DRracer 2a0989c440
Merge pull request #3551 from wavexx/eof_crash_reentry
Prevent re-entry in EOF command processing
2022-08-19 17:07:21 +02:00
Alex Voinea 81ec94db64 Show firmware version on splash screen 2022-08-15 16:18:17 +03:00
Yuri D'Elia 06d19b472a G28: check for X/Y/Z parameters before calling code_value_long
Fixes #3555, thanks to @toombaumarkt
2022-08-07 00:36:54 +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
Yuri D'Elia 4f22de2333 Do *not* shorten the current command in printer_smodel_check
printer_smodel_check was incorrectly substituting the final " with a
null in the command to simplify the model string comparison, but in
doing so was also corrupting the next pop from the cmdqueue.

We can modify the current strchr_pointer as long as we *don't* change
it's length. This can cause an incorrect extra read from the queue,
resulting in the last command to be completely ignored.
2022-08-06 23:15:46 +02:00
Yuri D'Elia 68c04ca2f6 Switch a few pointers that don't manipute strings to const 2022-08-06 23:08:03 +02:00
Yuri D'Elia a533ba3574 Reset sdpos_atomic when starting a new SD print
Fix an incorrect SD offset on the first G-Code command when the second
SD print is started.
2022-08-06 22:16:50 +02:00
VintagePC 598991dc69 - Fake-gen some folders to organize targets
- Support building both en and multilang together
2022-08-06 12:24:30 -04:00
VintagePC 04ea371936 Set source files explicitly for reproducible build 2022-08-06 10:57:03 -04:00
VintagePC ea920536cb Add version info to filenames 2022-08-05 21:03:41 -04:00
VintagePC 1e7e9aa391 fix typo 2022-08-05 17:45:48 -04:00
VintagePC 5f12c7f10b * Synchronize flags with arduino
* Use cmake -E cat for merge
* Set AR/ranlib to GCC flavour
2022-08-05 16:54:07 -04:00
vintagepc 7ddeb84486
Merge pull request #8 from 3d-gussner/build-with-cmake
Update Windows MAC download urls
2022-08-05 16:47:02 -04:00
3d-gussner 9e52798224 Update Windows MAC download urls
Add python dependencies for translations
2022-08-05 16:23:35 +02:00
3d-gussner 8cbe69e285 Update RepRap documentation 2022-08-02 17:56:53 +02:00
3d-gussner e60bb935e5 Remove test.sh from travis build 2022-08-02 07:38:53 +02:00
3d-gussner 9633f34e89
Merge pull request #3544 from 3d-gussner/MK3_Fix_po_for-MK25s
Sync PF-build.sh and MK404-build.sh with MK3_3.11.1 branch
2022-07-29 16:13:59 +02:00
Yuri D'Elia c0b5fea525 Prevent re-entry in EOF command processing
cmdqueue will run commands when EOF is reached without returning to the
main loop, which is already incorrect.

However, since it needs to ensure the queue is empty, an st_synchronize
call can result in a re-entrant call to get_command, which will
reprocess EOF again. Even if we removed st_synchronize, another command
could be picked by an unsuspecting manage_inactivity() somewhere else.

Short-circuit EOF processing by closing the file early and checking for
the file state early in get_command.

This should fix #3549
2022-07-29 15:55:54 +02:00
VintagePC ca0d6caddf Be explicit on languages 2022-07-28 18:16:15 -04:00
VintagePC 25ee23ca76 clean indentation 2022-07-28 08:11:11 -04:00
VintagePC fa1be17b7c cmake lang control 2022-07-28 08:07:08 -04:00
VintagePC f453403ea9 bugfix 2022-07-27 22:25:40 -04:00
VintagePC 8a4b395aec no-xflash case, add convenience target to build absolutely everything. 2022-07-27 20:24:12 -04:00
VintagePC 5bc936d4f5 Remove helper file, fix lang ordering, check sizes 2022-07-27 19:40:11 -04:00
VintagePC 9001d98061 Get version/dir from bootstrap, add pyelftools 2022-07-27 17:58:58 -04:00
vintagepc d4a46a09c6
Merge pull request #7 from 3d-gussner/build-with-cmake
Update bootstrap
2022-07-27 17:21:36 -04:00
3d-gussner e187538973 Update bootstrap 2022-07-27 15:01:07 +02:00
Guðni Már Gilbert ca8d47a6da If lcd_draw_update is set outside lcd_status_screen
then render the sceen without delay

This adds only 10 bytes of flash
2022-07-27 11:55:08 +00:00
VintagePC 739ccdf804 remove invalid command 2022-07-27 07:22:42 -04:00
Guðni Már Gilbert f6fd91a235 Optimise lcd_status_screen
Saves 20 bytes of flash
2022-07-27 11:14:18 +00:00
Guðni Már Gilbert 33a0a58810 Optimise manage_inactivity call in loop()
Saves 12 bytes of flash
2022-07-27 11:14:17 +00:00
VintagePC f03e3c40ee WIP/proof-of-concept 2022-07-26 19:33:09 -04:00
Yuri D'Elia c5c2557c5e Improve M310 documentation 2022-07-25 17:30:22 +02:00
Yuri D'Elia 41abe1689c Block LCD during temperature model autocalibration 2022-07-25 17:30:22 +02:00
Yuri D'Elia 79161f829e Remove last_alert_sent_to_lcd and simplify mintemp alert automaton
Thanks to LCD message priorities this not needed anymore and it's just
overhead.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 374b829fb6 Generalize menu_block_entering_on_serious_errors for menu lockout
Call this variable menu_block_mask instead. We don't need to know the
exact reason of why we're locking the menu.

We will be able to reuse this to prevent menu entry during more
activities in a cleaner way than testing for each condition as it's
currently done for both menu entry and longpress.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 49a288e6cf Restore the "MINTEMP * fixed" message
Set the LCD messages with the correct priority
2022-07-25 17:30:22 +02:00
Yuri D'Elia 4ca0012077 Prevent longpress if a serious error is set 2022-07-25 17:30:22 +02:00
Yuri D'Elia cb3fec5cac Improve M310 documentation 2022-07-25 17:30:22 +02:00
Yuri D'Elia e77a5345a2 Do not show "THERMAL ANOMALY" with "M310 B0"
This allows us to use "M310 B0 W0.01" as a way to report the current
error continuosly on the serial without 1) more code and 2) without
preventing regular usage.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 19df196e1f Better differentiation between pause/paused resume/resumed states
Use OCTOPRINT_ASK_* for the present form of actions. In these cases the
host will perform the pausing manouvers for us.

Use OCTOPRINT_* instead for the past tense forms when we are in charge.

Also always emit the action, whether we are or not sd-printing. This is
due to the new Stopped handling behaving correctly in either case.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 39ad53ab11 Simplify fan checks now that lcd pause works correctly 2022-07-25 17:30:22 +02:00
Yuri D'Elia 1eb7871bab Also save fan speeds during a thermal error pause
Similarly to temperatures, the fan speed is overwritten and needs to be
restored appropriately.
2022-07-25 17:30:22 +02:00
Yuri D'Elia c98e133ae2 Never stop spinning the extruder fan on thermal failures 2022-07-25 17:30:22 +02:00
Yuri D'Elia eccfcd7424 Save/restore temperatures during a thermal pause
Re-used saved_* vars (as normally used during the paused state) to
backup the original values when a thermal error occurs.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 63dab63f2e uvlo: Never wait for bed temperature when recovering
If the user accepted to resume, do not wait for bed temperature when
recovering. This only adds a pointless delay when recovering a short
pause and doesn't really improve the recovery quality after a long
pause.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 8f02262bbd Save/restore bed temperature during pause
This will be needed during a thermal error pause that disables the bed
as an additional safety precaution.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 9ef80226c9 Rename argument of ThermalStop for clarity 2022-07-25 17:30:22 +02:00
Yuri D'Elia b9fc73c4c3 TM: Pause the print and allow recovery from a thermal error
Do not allow resuming until all thermal and fan errors are clear.

Call the appropriate resume function when resuming a printing depending
on the saved_print state (is saved_print is available, then we always
need to resume from the saved state even when printing via usb).

Clear the Stopped state when resuming, so that commands can be accepted
again.
2022-07-25 17:30:22 +02:00
Yuri D'Elia f454d1ecf2 TM autotune: fix off-by-one in fan power levels 2022-07-25 17:30:22 +02:00
Yuri D'Elia 5dc0d5f7fa TM autotune: fail if value is outside of the boundaries
Ensure we never fall into the boundary values provided by the min/max
limits.

Save/restore the initial guess value, so that a convergence failure
restores the initial model state.
2022-07-25 17:30:22 +02:00
Yuri D'Elia d1864011f4 Handle pause/stop in the main loop, again
Force processing of the pause and stop "parking" commands _after_ the
main loop completes.

This was/is currently done in lcd_commands, which is a poor place to
continue processing, since it can be called already within an aborted
command. This requires checking for planner_aborted before any action
can be performed.
2022-07-25 17:30:22 +02:00
Yuri D'Elia f835537e88 Exclude TempErrorSource::ambient for boards without a thermistor 2022-07-25 17:30:22 +02:00
Yuri D'Elia 5965572e88 Enforce full-loop handling of aborted commands
After calling planner_abort_hard() no motion command can be
scheduled until we return to the main loop since the call can
potentially be scheduled inside a nested process_command call.

Despite previous fixes, bugs keep creeping in due to nested calls not
being obvious to detect at all.

Stop allowing motion _completely_ for the entire processing loop by
default. That is, instead of aborting the current plan_buffer_line call,
abort the entire command until we can actually schedule motion safely
again.

This benefits handling of pretty much all g/m-codes, since this flag
(now "planner_aborted" for clarity) becomes a general "command aborted"
call.

This also now ensures that the flag prevents _any_ new block (including
blocks partially planned while servicing an interrupt) are scheduled
after planner_abort_hard is called.

There are only two exceptions where it's safe to resume in this context:

- Within uvlo_, where we never return to the main processing loop
- When we're intentionally scheduling a new process_command loop for a
  MK3 filament recheck (which is *bad*)

Handle those two cases as exceptions.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 48c7c9d464 Exclude M310 if TEMP_MODEL is not enabled 2022-07-25 17:30:22 +02:00
Yuri D'Elia 142db85bbb Pause: only move to park position when homed
This can happen is pause is issued before homing.
2022-07-25 17:30:22 +02:00
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
Yuri D'Elia b3ca70a007 Show thermal warnings using the new LCD_MESSAGE_INFO priority
Add a new LCD_MESSAGE_INFO priority which can be overridden by regular
status updates, but only if a certain amount of time has passed.

Assign a time stamp to all message updates, so that the time since the
last update can be determined. Also switch the message type to Status,
so that the message always becomes visibile.

Always show status or info messages when printing via SD if the message
is recent enough.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 8d9d367d6b Implement Timer::expired_cont()
Returns true if the timer is not running, effectively allowing to check
if a certain set time in the future has passed.
2022-07-25 17:30:22 +02:00
Yuri D'Elia dc2d596f40 Do not allow lcd_updatestatus to be called directly
Enfoce the usage of lcd_setalertstatuspgm and lcd_setstatus so what we
consistently have alert severities properly set.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 6751586db6 Cleanup original thermal error handlers.
Remove useless repeated calls to disable heaters and turn on the fans,
since this is done at a higher level.

Avoid repeating messages on the serial. Do it just once.

Make a critical alert sound unconditionally.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 50c71924a2 Include fan measurements when estimating resistance 2022-07-25 17:30:22 +02:00
Yuri D'Elia 92bc7554b6 Enable the model last, if set
We need all the values to be set before we can attempt to enable the
model.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 49048fdcd6 Add temperature model configuration for MK3 2022-07-25 17:30:22 +02:00
Yuri D'Elia ea0840dee9 Refuse to run TM calibration if the printer is not idle 2022-07-25 17:30:22 +02:00
Yuri D'Elia 9c971b1b89 Add a note about resetting waiting_inside_plan_buffer_line_print_aborted 2022-07-25 17:30:22 +02:00
Yuri D'Elia 0680c0b428 Refresh the lcd periodically during calibration 2022-07-25 17:30:22 +02:00
Yuri D'Elia 47d2e9e61c Handle failures during calibration
Break out of the autotuning if a thermal error condition is detected and
attempt to restore a safe initial state irregardless of the error
handlers.

Also error out if the estimation fails to converge.
2022-07-25 17:30:22 +02:00
Yuri D'Elia cc96a47e7f Implement temperature model autotuning
Calibrate C/R values via univariate minimization using golden section.
This is done in several passes:

- Bootstrap C by setting an initial high R value
- Calibrate R at the requested working temperature
- Cooldown
- Refine C to the final value
- Estimate R losses for a subset of fan speeds
- Interpolate remaining values to speed-up the process

This results in robust values which are tailored to the current
filtering constants, and avoid having to sample for an extended
time to reach the required resolution.

The refining pass could avoid cooldown if the recording buffer was at
least twice as large, so that we could record both the heating and the
steady-state, saving _considerable_ time.
2022-07-25 17:30:22 +02:00
Yuri D'Elia ec74b88ebc Correct pre-warning to just warning 2022-07-25 17:30:22 +02:00
Yuri D'Elia 14622bc577 Actually disable the temperature manager in TempMgrGuard 2022-07-25 17:30:22 +02:00
Yuri D'Elia 8620059067 Allow to disable the model warning beeping
Mostly useful for debugging
2022-07-25 17:30:22 +02:00
Yuri D'Elia 6832ec7648 Allow to save/restore temperature model settings
This currently bypasses the ConfigurationStore, which doesn't fit the
malin model nicely.

temp_model is using it's own private copy directly.

But maybe we should change this in the future.
2022-07-25 17:30:22 +02:00
Yuri D'Elia b0b2ff5f9e Rewrite/modularize the model checker
- Allow all parameters to be changed at runtime through M310
- Move the model prototypes into a separate temp_model.h header
- Allow the checked to be enabled/disabled at runtime
- Introduce a warning threshold
2022-07-25 17:30:22 +02:00
Yuri D'Elia fabf511b97 Add the ability to log continuously
TEMP_MODEL_LOGGING enables D70 to record precisely each cycle of the
temperature regulation for offline model simulation
2022-07-25 17:30:22 +02:00
Yuri D'Elia 690affe5a2 Further enhance thermal error priorities
When triggering a thermal error, allow higher-priority errors to
override the initial error source.

This allows a fatal error such as maxtemp to trigger to a full stop even
if thermal runaway has already been triggered.

Reorder error types according to their priority.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 8220d0196b Lock onto the first error source until cleared
Do not overwrite the error source if the error flag is already set.

As checks are performed in priority order, this ensures min/maxtemp
user-level handlers are triggered even if the thermal model can detect
an issue in the same cycle.

This restores MAXTEMP handling, which was simply shadowed.
2022-07-25 17:30:22 +02:00
Yuri D'Elia f82048977a Start PWM timers _after_ initializing min/maxtemp ranges
This would otherwise cause check_temp_raw() to operate on unitialized
values and trigger failures too early.
2022-07-25 17:30:22 +02:00
Yuri D'Elia f1d88ebd40 Protect pid_tuning_finished behind temperature.cpp
Setting pid_tuning_finished can result in the heaters stuck to full
power. As a result, we need to ensure that when PID management is
disabled, heaters are also.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 442b2e16de Set pid_tuning_finished globally to true
Use pid_tuning_finished as a flag to prevent automatic PID management.
As a result, set the default start-up state to true and adjust the
dependent code accordingly.
2022-07-25 17:30:22 +02:00
Yuri D'Elia 92418e9d1b Do not perform PID management while autotune is running 2022-07-25 17:30:22 +02:00
Yuri D'Elia c15d599f71 Convert two PID_autotune strings to PROGMEM 2022-07-25 17:30:22 +02:00
Yuri D'Elia 0c1c350a93 Simplify one expression 2022-07-25 17:30:22 +02:00
Yuri D'Elia 70093fc9dc Allow to redefine basic model constants 2022-07-25 17:30:22 +02:00
Yuri D'Elia a15f2807d9 Allow to continue printing with TEMP_MODEL_CHECK_WARN_ONLY for debugging 2022-07-25 17:30:22 +02:00
Yuri D'Elia 929843e295 Switch two divisions to faster multiplications 2022-07-25 17:30:22 +02:00
Yuri D'Elia bc53bd5305 Make the error threshold be sample-rate invariant 2022-07-25 17:30:22 +02:00
Yuri D'Elia 3eda8b61ee Include the model checker with hard-coded constants 2022-07-25 17:30:22 +02:00
Yuri D'Elia 61575995e0 Isolate temp runaway checks from PID management 2022-07-25 17:30:22 +02:00
Yuri D'Elia 026733e75f Improve comments 2022-07-25 17:30:22 +02:00
Yuri D'Elia 283d5566f1 Limit the rate manage_heater() as it did previously
Avoid running the user-level error handlers too fast.
2022-07-25 17:30:22 +02:00
Yuri D'Elia de77a47906 Correct handling of preheat/runaway errors
As for min/maxtemp, flag the error in the isr, then handle it in the
user code calling the original handler.
2022-07-25 17:30:22 +02:00
Yuri D'Elia bd9a6acd59 Correct handling of min/maxtemp
- Flag the error condition from the temp_mgr_isr
- Handle the error state from the user code

Currently only handles min/maxtemp and relays the error to the original
handler (which is a poor fit for the current design).
2022-07-25 17:30:22 +02:00
Yuri D'Elia 4a0203d691 Isolate oTimer4minTempHeater/Bed into check_min_temp 2022-07-25 17:30:22 +02:00
Yuri D'Elia 7659844012 Reimplement disable_heater to take immediate effect
Split off setIsrTargetTemperatures and temp_mgr_pid() so that we can
propagate the target temperatures instantaneously down the pid/pwm chain
during emergencies.

This reduces the amount of code in disable_heater() itself, making it
a bit more maintenable.

The bed still isn't disabled on-the-spot yet, due to the heatbed_pwm
automaton. To be improved later.
2022-07-25 17:30:22 +02:00
Yuri D'Elia e070bc6455 Remove obsolete and commented variables 2022-07-25 17:30:22 +02:00
Yuri D'Elia ccaecc87aa Reduce code duplication in setTargetHotendSafe 2022-07-25 17:30:22 +02:00
Yuri D'Elia 7d82cd641e Rename ADC callback 2022-07-25 17:30:22 +02:00
Yuri D'Elia bcd8496113 Introduce a new set of temperature values for the PID regulation
*_temperature_raw: buffer for the ADC ISR (read by temp ISR)
*_temperature_isr: latest temperatures for PID regulation (copied from
  _raw values)
*_temperature: latest temperature for user code

The flow:
  - ADC ISR (async)
    - perform oversampling
    - call ADC callback: copy to _raw (async)
  - temp ISR (timer)
    - convert to C (_isr values)
  - user code (async)
      - check temp_meas_ready
      - call updateTemperature()
        - copy from _isr to current
        - syncronize target temperatures

This removes PINDA value averaging (if needed, should be re-implemented
by averaging in user code where needed)
2022-07-25 17:30:22 +02:00
Yuri D'Elia c1051e046c Remove private declaration 2022-07-25 17:30:22 +02:00
Yuri D'Elia 65cf8e541a Isolate current/target temperature in pid_heater/bed functions 2022-07-25 17:30:22 +02:00
Yuri D'Elia 0933f01a7f temperature: Do not expose check_min/max_temp 2022-07-25 17:30:22 +02:00
Yuri D'Elia 9e826afee9 Switch regulation interval to 270ms 2022-07-25 17:30:22 +02:00
Yuri D'Elia c6d0494cbc Split temperature management into it's own ISR
Use a new low-priority "temp_mgr_isr" running at constant rate for
temperature management.

This is done so that the temperatures are sampled at a constant
independent interval *and* with reduced jitter. Likewise for actual
PID management.

This will require further adjustment for the min/max/runaway display,
which cannot be done directly into this function anymore (the code will
need to disable heaters but flag for display to be handled in
manage_heaters).
2022-07-25 17:30:21 +02:00
Yuri D'Elia 2ca16a06cd Rename tp_init to soft_pwm_init for consistency 2022-07-25 17:30:21 +02:00
Yuri D'Elia b56d31b5b3 Improve comment 2022-07-25 17:30:21 +02:00
Yuri D'Elia 38b3e53f67 Syntax/comment cleanup 2022-07-25 17:30:21 +02:00
Yuri D'Elia 932fcbb33f Simplify soft_pwm_isr even further
Isolate the PWM management into soft_pwm_core
2022-07-25 17:30:21 +02:00
Yuri D'Elia dfd8fee712 Isolate babystep to a separate function 2022-07-25 17:30:21 +02:00
Yuri D'Elia bd28007312 Rename check_fans>readFanTach manageFans>checkFans 2022-07-25 17:30:21 +02:00
Yuri D'Elia 383319dbac Rename temperature_isr to soft_pwm_isr 2022-07-25 17:30:21 +02:00
Yuri D'Elia 16b9acf8bc Decouple temperature ISR from ADC readings
Read from ADC as fast as possible using the ADC interrupt to get
more accurate instantaneous readings.

Decouple the temperature_isr from the adc reading interval, so that
the two can run independently for future use.
2022-07-25 17:30:21 +02:00
Yuri D'Elia e87188e7e3 Ensure ADC and thermistor tables use the same oversampling
The current code assumes that values are directly comparable
2022-07-25 17:30:21 +02:00
Yuri D'Elia 2535d072c4 Do not recursively enter temperature_isr
Disable the interrupt source instead, which avoids the added latency of
reentering the isr in the first place.
2022-07-25 17:30:21 +02:00
Yuri D'Elia 82e221e3c7 Remove ADC pullup checks
Setting pullups on the ADC should trigger the model-based check, making
this redundant and wasteful.

Keep the DEBUG_PULLUP_CRASH menu so that we can verify this behavior in
the future.
2022-07-25 17:30:21 +02:00
Yuri D'Elia 306f77ccbd Disable IR_SENSOR due to the injected ADC read for now
This is already reimplemented in the newer fsensor implementation
2022-07-25 17:30:21 +02:00
Yuri D'Elia 13163e9fbf Move millis_nc to system_timer.h 2022-07-18 17:53:27 +02:00
Yuri D'Elia f8de274db3 Split fan checks out of temperature.cpp 2022-07-18 17:53:27 +02:00
Alex Voinea 8e72470afc
Merge pull request #3435 from leptun/MK3_variant_hotend_name
Use correct filament type in variant files
2022-07-15 15:57:53 +03:00
Alex Voinea 46a9cf6239
Merge pull request #3529 from leptun/sd_menu_fixes
SD menu fixes
2022-07-15 15:55:26 +03:00
Alex Voinea 510c874619 Fix scrolling timing issue when the menu is rendering very slowly 2022-07-15 15:46:01 +03:00
Alex Voinea 8bb451129d Remove compiler bug workaround
These lines had to be done like that because gcc 5.4.0 would throw a segmentation fault when linking. With gcc 7.3.0, this is no longer an issue
2022-07-15 15:46:01 +03: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 3a5bc0462a Do not call lcd_update recursively when running presort with many files 2022-07-15 15:45:34 +03:00
Alex Voinea 3c579bf738 Fix fullscreen message lcd_update handling 2022-07-15 15:45:34 +03:00
Alex Voinea 2059e40596
Merge pull request #3054 from espr14/insert_sort
File: use insert sort
2022-07-15 15:44:04 +03:00
Alex Voinea 49fb27bb28
Merge pull request #3504 from gudnimg/gudni_printer_smodel_check
Simplify `printer_smodel_check()`
2022-07-12 21:53:23 +03:00
Alex Voinea 39dfa96167
Merge pull request #3542 from wavexx/default_beep_freq_2
M300: do not set a default frequency if S is not set
2022-07-12 20:39:31 +03:00
3d-gussner 15bac09594 Fix typo 2022-07-12 11:24:35 +02:00
Alex Voinea 3ed3f87db6 Prevent beeps when P is 0 2022-07-12 09:57:56 +03:00
3d-gussner 3a77ef3ce7 Sync PF-build.sh and MK404-build.sh with MK3_3.11.1 branch 2022-07-12 08:48:22 +02:00
Yuri D'Elia 2a9869ce2d M300: do not set a default frequency if S is not set
Fallback to use the default HIGH value if a frequency has not been
specified.

This makes the tone of "M300" and "M300 P<x>" identical as a result.

Supersedes #3339
2022-07-11 15:18:56 +02:00
3d-gussner 1db9735654
Merge pull request #3520 from 3d-gussner/MK3_build_v108
Use PF-build-env 1.0.8
2022-07-05 17:21:04 +02:00
Alex Voinea 56bc2f1a0c
Merge pull request #3495 from wavexx/extrude_min_temp
Replace EXTRUDE_MINTEMP with the configurable extrude_min_temp
2022-07-05 12:02:26 +02:00
Alex Voinea 9466945532
Merge pull request #3461 from wavexx/fan_selfcheck_test
Fix/optimize fan selftest
2022-07-05 11:32:57 +02:00
Alex Voinea 19b494a554 Make the fan thresholds configurable 2022-07-05 09:02:47 +02:00
3d-gussner 4903270ffa Use PF-build-env 1.0.8 2022-07-04 20:46:46 +02:00
Yuri D'Elia a8244dc2bd
Merge pull request #3455 from wavexx/stop_raise_higher
Stop raise higher
2022-07-04 20:05:23 +02:00
3d-gussner 6271f17340
Merge pull request #3442 from gudnimg/fix-M701-doc
Add documentation for M701, M203, M201 parameters
2022-07-04 18:51:31 +02:00
Alex Voinea 253b14def1 Clamp Z movements to machine limits 2022-07-04 18:26:14 +02:00
Yuri D'Elia 44fce0696b Make the stop raising distance configurable (Z_CANCEL_LIFT) 2022-07-04 18:21:59 +02:00
Yuri D'Elia 2c41857cb5 Raise Z 5cm after stopping
Check if Z axis has been homed and, if so, raise Z at least 5cm after
stopping so that the steel sheet can be comfortably removed.
2022-07-04 18:21:59 +02:00
Alex Voinea 61b8dbbab5 Disable sorting speedtest 2022-07-04 18:06:54 +02: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 cac2b9ae40 Implement timer elapsed function
also fix build
2022-07-04 18:05:49 +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
Alex Voinea 65e19f6b0b
Merge pull request #3530 from wavexx/py_no_ex_dataerr
tools: Do not use os.EX_DATAERR due to unavailability on windows
2022-07-04 17:52:21 +02:00
Alex Voinea e435ef4bab Fix one more EX_DATAERR after sync with 3.11.1 2022-07-04 17:48:11 +02:00
Yuri D'Elia e68ded37fe tools: Do not use os.EX_DATAERR due to unavailability on windows
Just return a plain exit code...
2022-07-04 17:45:11 +02:00
Yuri D'Elia 0e7f2b33cf
Merge pull request #3531 from wavexx/mk311_sync
Synchronize MK3 with MK3_3.11.1
2022-07-04 17:23:14 +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
Alex Voinea 3ff2b04801 M701 Alias T for E parameter 2022-07-04 15:01:41 +02:00
Alex Voinea fd702c8a21
Merge pull request #3527 from gudnimg/fix-cmdbuffer-debug-crash
Fix a crash during file check when `CMDBUFFER_DEBUG` is defined
2022-07-04 12:02:51 +02:00
Alex Voinea 7c108c9420
Merge pull request #3528 from leptun/fix_some_gcc7.3.0_warnings
Fix gnu++17 register warning
2022-07-04 10:17:30 +02:00
Alex Voinea d5fc2a28f2
Merge pull request #3014 from Panayiotis-git/MK3_ButtonLongPress_Fix
Ignore button long-press event, if not allowed
2022-07-04 09:46:08 +02:00
Alex Voinea 29159a5bf3
Merge pull request #3475 from gudnimg/custom_message_m601
Make M117 message persistent on LCD when used with M601 or G4
2022-07-04 09:42:23 +02:00
Alex Voinea 61151251ff
Merge pull request #3485 from wavexx/ambient_raw_temps
Fix AMBIENT_RAW_*_TEMP define names
2022-07-04 09:38:05 +02:00
Alex Voinea 1fa87da2d0 Fix gnu++17 register warning 2022-07-04 09:35:17 +02:00
Panayiotis-git 87e45056c3 Ignore button long press if not allowed 2022-07-03 22:01:47 +03:00
Guðni Már Gilbert b64377b9de Fix a crash during file check when CMDBUFFER_DEBUG is defined
The file check is so slow that we need to kick the watchdog to prevent a "crash"
2022-07-02 16:54:05 +00:00
3d-gussner e63af1a1e5
Merge pull request #3434 from leptun/MK3_lang_get_original_string
_O() macro
2022-07-01 16:41:35 +02:00
Alex Voinea dc812dabb2 _O() macro
Ability to get the english (original) variant of a translated message. Helpful for serial messages where translations must be prohibited for compatibility.
2022-07-01 16:01:51 +02:00
3d-gussner d4d5294964 Revert "Fix Mk2.5/S zip after change PO-based language translation support"
This reverts commit 7162b224a7.

Revert direct push to prusa3d MK3_3.11.1
2022-07-01 08:29:52 +02:00
3d-gussner 7162b224a7 Fix Mk2.5/S zip after change PO-based language translation support
Limit atmegaMK404 boards mem to 8,16,32
2022-07-01 08:26:56 +02:00
3d-gussner 96b9048229
Merge pull request #3519 from wavexx/xflash_errors
Correctly show XFLASH initialization errors
2022-06-30 08:16:32 +02:00
Yuri D'Elia af9daecf5b Correctly show XFLASH initialization errors
Remove the first serial message, which cannot be displayed since serial
is not available yet.

Move both the serial message and display after
serial/temperature/planner is setup, so that we can use
lcd_show_fullscreen_message_and_wait_P properly.
2022-06-29 11:44:53 +02:00
3d-gussner f3adb781a1
Merge pull request #3457 from wavexx/remove_runout_support
Cleanup: remove unused FILAMENT_RUNOUT_SUPPORT define
2022-06-29 08:16:31 +02:00
3d-gussner 4d8222cc1f
Merge pull request #3516 from wavexx/unbreak_elm_qdirstat
Include missing "re" module for elf_mem_map
2022-06-24 13:40:58 +02:00
Yuri D'Elia 88f05cc1f1 Include missing "re" module for elf_mem_map
"re" is required by the --qdirstat flag, and has been incorrectly
removed.
2022-06-23 14:20:07 +02:00
3d-gussner 0af88574fb Update to Arduino_boards version 1.0.5-1 2022-06-20 17:04:58 +02:00
3d-gussner 81a8418dd6 C++17 Arduino_boards version 1.0.5-1 2022-06-20 17:02:30 +02:00
3d-gussner a01c19cade Change backup suffix from `~` to `.bak` 2022-06-20 17:00:42 +02:00
3d-gussner f10981099d
Merge pull request #3500 from 3d-gussner/gnu++17
GNU++17 Arduino_boards version 1.0.5-1
2022-06-20 14:24:10 +02:00
3d-gussner 881e2964e0 Update to Arduino_boards version 1.0.5-1 2022-06-20 11:16:11 +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
3d-gussner 880853650d
Version changed (3.11.1-RC1 build 4987) 2022-06-13 12:03:48 +02:00
3d-gussner 38081f0a30
Merge pull request #3505 from 3d-gussner/MK3_3.11.1_Pre-release
Pre-release FW3.11.1
2022-05-24 16:27:15 +02:00
3d-gussner 53046ffeee Update diacritics in Swedish and Norwegian `Firmware_xx.po` files 2022-05-24 09:06:46 +02:00
3d-gussner 44eb9d4ff9 Updated Norwegian files 2022-05-24 08:27:12 +02:00
3d-gussner d3df8389ef Merge branch 'MK3_3.11.1_Pre-release' of https://github.com/3d-gussner/Prusa-Firmware into MK3_3.11.1_Pre-release 2022-05-24 08:15:04 +02:00
3d-gussner 70c73cbf6b Pre-release po file update 2022-05-24 08:14:24 +02:00
DRracer 75521dca2e
Merge pull request #3509 from prusa3d/MK3_3.11.1-Activate_Norwegian
Activate Norwegian community translation
2022-05-24 08:11:17 +02:00
DRracer aa59d9b5eb
Merge pull request #3508 from 3d-gussner/MK3_3.11.1_Norwegian
Update Norwegian community translation PFW-1296 (fixed)
2022-05-24 08:06:03 +02:00
3d-gussner 1a4bbb4918
Activate Norwegian community translation 2022-05-24 07:51:05 +02:00
3d-gussner 3ae4b6d329 Merge remote-tracking branch 'pkg2000/MK3_3.11.0' into HEAD
Fix merge issues and POEdit double `\\` to `\`
Update `lang_en_no.txt`
Enable Norwegian translation in `config.h`

Tested on MK404 MK3S
2022-05-24 07:28:10 +02:00
3d-gussner 4cd5777380 Pre-release po file update 2022-05-23 19:51:35 +02:00
Guðni Már Gilbert 65d500f2ed Simplify printer_smodel_check
Saves 140 bytes of flash and 4 bytes of SRAM
2022-05-22 17:57:47 +00:00
3d-gussner dc66a773f1 C++17 Arduino_boards version 1.0.5-1 2022-05-19 09:24:21 +02:00
Yuri D'Elia d53eb69150 Manually cast to int when comparing against extrude_min_temp
Avoid the automatic conversion to float to improve code size.
2022-05-12 12:20:54 +02:00
Yuri D'Elia a8c48cdaef
Merge pull request #3493 from wavexx/unused_notice
Add notices about Sheet::bed_temp and Sheet::pinda_temp being unused
2022-05-11 21:41:13 +02:00
Yuri D'Elia ea46402e4d Replace EXTRUDE_MINTEMP with the configurable extrude_min_temp
Everywhere MINTEMP is checked, use the configurable value set by M302,
not an hardcoded value.

EXTRUDE_MINTEMP is now used only as the initial default value.

Reduce the precision of extrude_min_temp to an integer to reduce the
generated code size (constant folding did in fact do the same previously
anyway). Having tenths of degrees is not necessary for this feature.
2022-05-11 20:07:38 +02:00
Yuri D'Elia 64f646a8a4 Add notices about Sheet::bed_temp and Sheet::pinda_temp being unused
There is a potential for 2*8 bytes of extra sparse eeprom space, plus a
few bytes saved if we remove the update calls, so add a notice that
these values are currently only written-to, but never actually used.
2022-05-11 11:15:36 +02:00
Alex Voinea 37e1c11099
Merge pull request #2657 from FormerLurker/MK3
Add arc interpolation features (G2/G3) and M214 command for controlling settings
2022-05-02 11:05:51 +03:00
Alex Voinea 7515db1ef0 Adjust comments 2022-05-02 10:02:00 +02:00
3d-gussner 554bb02ac1
Merge pull request #3487 from wavexx/mk404_build_gcc
Accept any gcc version to build MK404
2022-05-02 08:04:54 +02:00
Yuri D'Elia 4a10dfa68f Accept any gcc version to build MK404
Restricting the MK404 build to gcc-7 is not a good idea, since gcc-7 is
already not available in several newer distributions.

Just pick the current gcc version.

Current gcc 10 versions build MK404 correctly.
2022-04-30 23:17:33 +02:00
Alex Voinea 0b23ccdee9 Abort arc on planner hard stop 2022-04-29 20:38:48 +02:00
Yuri D'Elia 5b3441b2bd Fix AMBIENT_RAW_*_TEMP define names
The max/min temperature check were incorrectly using
HEATER_AMBIENT_RAW_*_TEMP (non-existing) instead of the correct
AMBIENT_RAW_*_TEMP (this is not a heater afterall).

This doesn't change the current behavior, since the check defaulted to
the correct path for the MK3+ configuration anyway.
2022-04-29 16:54:39 +02:00
FormerLurker bb33c76d2b Fix and simplify M214 data types and default config initialization. 2022-04-28 14:36:51 +02:00
FormerLurker 02b0307307 Code Cleanup 2022-04-28 14:36:51 +02:00
FormerLurker 623c029bfa Code cleanup to reduce program storage 2022-04-28 14:36:51 +02:00
FormerLurker acc234b0c5 Fix config store load (was missing n_arc_correction). 2022-04-28 14:36:51 +02:00
FormerLurker 3880777691 Fix invalid bool compare. 2022-04-28 14:36:51 +02:00
FormerLurker 6fc8155cbe Add n_arc_correction and enhanced small angle sin/cos approximation. 2022-04-28 14:36:51 +02:00
FormerLurker 58d9916d54 Make suggested corrections. 2022-04-28 14:36:51 +02:00
FormerLurker 4aa5a75301 Enhance arc interpolation and add M214 for controlling arc interpolation settings. 2022-04-28 14:36:51 +02:00
Jakub Dolezal f893d93d63
Merge pull request #3472 from 3d-gussner/PFW-1306_help_prusa3d_com
PFW-1306 help.prusa3d.com
2022-04-26 10:38:33 +02:00
Alex Voinea e3f48ead9f
Merge pull request #3440 from gudnimg/optimise-checkFanSpeed
Optimise `checkFanSpeed()` Flash use
2022-04-21 14:04:23 +02:00
Alex Voinea d860d61513
Merge pull request #3459 from gudnimg/remove_pid_add_extrusion_rate
Remove unused setting `PID_ADD_EXTRUSION_RATE`
2022-04-21 14:01:50 +02:00
Alex Voinea d4d8149c9b
Merge pull request #3438 from leptun/MK3_reset_acceleration_rates_on_steps_per_mm_change
Reset acceleration rates when changing microstepping resolution
2022-04-21 13:59:55 +02:00
Alex Voinea a4887b542f
Merge pull request #3467 from gudnimg/autostart_stilltocheck-optimisation
Optimise `autostart_stilltocheck` variable
2022-04-21 13:57:02 +02:00
Alex Voinea 453e2f102a
Merge pull request #3474 from leptun/MK3_xflash_upload_screen
XFlash upload message
2022-04-21 13:52:47 +02:00
pkg2000 a319e32c7e Update no.po
hah, can you believe it. In Extruder info, nozzle fan is the extruder fan..
2022-04-20 17:30:02 +02:00
pkg2000 137e607fef Update no.po
Mistake in naming of FAN with capitol within Extruder info, under Support. Fixed here.
2022-04-20 16:38:55 +02:00
pkg2000 8cc89c7207 Update no.po
Sorry. last one. Unified fan names
2022-04-20 14:02:19 +02:00
pkg2000 859f6215a9 Update no.po
Changes based on @trondkla feedback. exceptions to his suggestions have been discussed and agreed upon (most were due to char. count and linebreak limitations.) Vocabulary/wording ready. now just need to test how everything render on the screen.
2022-04-20 13:57:56 +02:00
Guðni Már Gilbert bf38241afe Make M117 message persistent when using G4 command
This is also supported in Marlin 2 FW

Fixes #1443
Fixes #2970
2022-04-18 17:07:34 +00:00
Guðni Már Gilbert 727060ddd8 Replace CustomMsg::MsgUpdate with CustomMsg::M117
MsgUpdate was only used with M117, renaming the message type to M117 may be more descriptive for current use case.
2022-04-17 15:01:48 +00:00
Guðni Már Gilbert c77b768fdd Make M117 custom message persistant if print is paused
If M117 is called before M601 then we would like the custom message to
be visible on the LCD screen until the print is resumed.

Change in memory: +10 bytes of flash

Fixes #3316
2022-04-17 14:00:41 +00:00
Alex Voinea b5f6bbb2c3 XFlash upload message 2022-04-15 12:37:51 +02:00
3d-gussner 312f3070c2 Use/show `help.prusa3d.com` instead of `howto.prusa3d.com` 2022-04-13 13:33:26 +02:00
3d-gussner e58495ef39
Merge pull request #3466 from prusa3d/MK3_3.10.2
PFW-1303: Reset pullups on ADC
2022-04-13 13:15:52 +02:00
Yuri D'Elia 765fbd3e92 Fix argument of lcd_selftest_fan_auto to be uint8_t 2022-04-11 17:42:31 +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 b52597f1b2
Merge branch 'MK3_3.11.1' into MK3_3.10.2 2022-04-07 14:05:34 +02:00
D.R.racer 6b6e06695f Version changed (3.11.0 build 4955) 2022-04-07 09:38:13 +02:00
DRracer b1bb1d9d05
Merge pull request #3462 from 3d-gussner/MK3_3.11.0_Fix_Typo_Slovak
Fix typo in Slovak
2022-04-07 07:16:38 +02:00
pkg2000 b03acf0d03 Update no.po
Changed printfan (printvifte) to Nozzle fan (dysevifte).
Wizard (Veileder) reference improved in longer text.
Cleaned up linebreaks
Bed level correct -> Planecorrection (Plankorreksjon).
few minor typos fixed and found

Warning: Gt desktop or Poedit keeps adding an extra \ , when using \x0a (Linebreak)
2022-04-06 16:47:26 +02:00
3d-gussner 14f07963ac Fix typo in Slovak thanks to Prusa test team 2022-04-05 15:07:45 +02:00
Yuri D'Elia 859aa4d283 Reuse M123 during fan selftest to report RPM
M123 reports both fan speeds nicely in RPM, as well as the requested PWM
for each so that we don't need to show the test "number" to distinguish
between the two in the serial output.
2022-04-04 23:29:52 +02:00
Yuri D'Elia 7671ff37a9 Fix/optimize fan selftest
Rewrite the part of the fan selftest to use a shared path between hotend
and print fan.

Remove the useless 10 seconds spin-up delay for the print fan. Reduce it
to 5 seconds.

Properly wait for readings after spin-up, so that RPMs are more
reliable. Also tune the print fan threshold to a more reasonable
default. Both, in conjunction, now avoid the "swapped fan" check that
was incorrectly triggered in almost every case.
2022-04-04 21:36:02 +02:00
pkg2000 d00b20ee62 Update no.po
More fixes.
2022-03-31 17:22:23 +02:00
pkg2000 c2e56f6a4a Update no.po
Some new updates and fixes.
2022-03-31 17:12:51 +02:00
Guðni Már Gilbert c62c412cc3 Remove unused setting PID_ADD_EXTRUSION_RATE
Even if the setting was turned on, it doesn't do anything useful.
2022-03-30 19:03:41 +01:00
Yuri D'Elia 1949802bea Cleanup: remove unused FILAMENT_RUNOUT_SUPPORT define
FILAMENT_RUNOUT_SUPPORT has never been supported in the MK3 branch, and
contains a ton of horrible and unmaintained code that doesn't even
compile anymore.

Since this code is currently polluting a sizable block inside the G0/G1
code block, simply get rid of it.
2022-03-30 12:49:08 +02:00
Yuri D'Elia d724eb1f92 Cleanup hardcoded values to constants in M701 2022-03-30 12:33:46 +02:00
Yuri D'Elia 6317a6147d Use a consistent distance/feedrate for the [auto]load sequence 2022-03-30 11:38:25 +02:00
Yuri D'Elia 9bb8797b60 update_eeprom: Read correctly both old/new address prefix sizes
Be less strict in the address size. Support both the legacy 2 and the
new 3 byte address in the output.
2022-03-30 09:36:46 +00:00
3d-gussner b3532749ff
Merge pull request #3451 from 3d-gussner/MK3_Translation_Maintainers
Update: Swedish active
2022-03-24 10:56:16 +01:00
3d-gussner c71637107c Swedish active
Norwegian added but inactive
2022-03-24 05:34:54 +01:00
DRracer 509c13a9c1
Merge pull request #3446 from 3d-gussner/MK3_3.11.0_Swedish2
PFW-1295: Final changes to Swedish for FW3.11.0
2022-03-23 10:32:47 +01:00
3d-gussner 4752b2b479 Disable Norwegian 2022-03-23 10:18:16 +01:00
3d-gussner d2a542b554 Update from from [commit](a05287cb2f) 2022-03-20 18:41:27 +01:00
3d-gussner b244cedd7f Add Swedish ` pa ` to ` på ` conversion
Update po files
2022-03-18 15:45:39 +01:00
3d-gussner 9a3f412aad Forgot saving one file 2022-03-17 18:33:53 +01:00
3d-gussner 8bd3b473c4 Last fixes in Swedish 2022-03-17 18:26:45 +01:00
DRracer 09c53408af
Merge pull request #3426 from 3d-gussner/MK3_3.11.0_Improve_languages2
PFW-1297: Improve languages part 2
2022-03-17 13:20:11 +01:00
3d-gussner bf20d18711 Fix French check 2022-03-16 11:55:51 +01:00
3d-gussner 92e733fdcb Update po files 2022-03-16 11:37:24 +01:00
3d-gussner 3954c44bc9 update all languages files 2022-03-16 09:24:06 +01:00
3d-gussner 19b4c333c0 Improve lang import and cleanup 2022-03-16 09:23:34 +01:00
3d-gussner 85a5986e9e Update `////MSG...` for `lang-add.sh` 2022-03-16 09:01:14 +01:00
3d-gussner 7a64210043 Check if translation isn't equal to origin
Removed identical translations/origin all lang files incl. po files,
which saves some xflash space
2022-03-14 13:29:21 +01:00
Guðni Már Gilbert 7f751ae6ac Add M201 paramters to documentation
Also fixed the reprap link for M201
2022-03-13 15:53:51 +00:00
Guðni Már Gilbert 8e2d44987f Document M203 parameters 2022-03-13 15:49:38 +00:00
Guðni Már Gilbert 935458beca Add 'E' parameter to M701 documentation
Remove missing 'U' parameter in M702
2022-03-13 12:04:26 +00:00
3d-gussner 12b184cf68 Add missing `MSG_SHEET_OFFSET` to translations 2022-03-12 12:34:08 +01:00
3d-gussner 61695eebcc Add `\x04Refresh` translations 2022-03-12 11:55:25 +01:00
3d-gussner 3aab3b7148 Delete old translations
- `Current`
- `Used during print`
- `Error - static memory has been overwritten`
2022-03-12 11:23:45 +01:00
3d-gussner 7c55cf801b Fix additional merge issues
Update lang-??port.sh scripts
2022-03-12 10:51:26 +01:00
3d-gussner 764a1fd411 Merge remote-tracking branch 'upstream/MK3_3.11.0' into MK3_3.11.0_Improve_languages2
Fix Swedish merge issues
2022-03-12 09:44:00 +01:00
3d-gussner 7265174a93 Update lang-??port.sh documentation 2022-03-12 08:58:24 +01:00
3d-gussner 08332a8942
Merge pull request #3349 from 3d-gussner/MK3_3.11.0_Swedish
Swedish / Svenska / Sverige community translation
2022-03-12 08:55:30 +01:00
3d-gussner 00ec8bb01c Update all po files 2022-03-12 08:48:15 +01:00
3d-gussner 3e6c4ac6fd Fix Norgwegian merge issues
Update lang-??port.sh scripts for Norwegian
2022-03-12 08:46:46 +01:00
3d-gussner ce5a9613ce Merge remote-tracking branch 'upstream/MK3_3.11.0' into MK3_3.11.0_Improve_languages2
Fix merge
2022-03-11 17:26:52 +01:00
3d-gussner e9e84d4390 Merge branch 'MK3_3.11.0_Improve_languages2' of https://github.com/3d-gussner/Prusa-Firmware into MK3_3.11.0_Improve_languages2 2022-03-11 16:50:23 +01:00
3d-gussner 626e5b43eb Fix part 2 of `\04Refresh` and `Sheet...` 2022-03-11 15:37:57 +01:00
3d-gussner 1f4da80609 Fix `\0x Refresh` and `Sheet..` messages being added correctly 2022-03-11 15:35:30 +01:00
3d-gussner 18859a3609
Merge pull request #3427 from pkg2000/MK3_3.11.0
Norwegian
2022-03-11 15:14:31 +01:00
3d-gussner b4492067a4
Merge branch 'MK3_3.11.0' into MK3_3.11.0_Swedish 2022-03-10 14:59:46 +01:00
3d-gussner 94f9a97344 Merge latest `sv.po` from https://github.com/prusa3d/Prusa-Firmware/pull/3353
create `lang_en_sv.txt` with `./lang-import.sh sv`
update `Firmware_sv.po` with `./lang-export.sh sv`
2022-03-10 14:49:05 +01:00
pkg2000 a4050b3e26 Update no.po
removed some identical strings
2022-03-10 14:44:30 +01:00
3d-gussner f0a498abb1 Replace 'åÅ' with 'aA' 2022-03-09 06:37:15 +01:00
3d-gussner d6de893ac5 Fix SN compile warnings for MK2.5/S 2022-03-07 18:45:45 +01:00
3d-gussner 5c0a443b4f Fix Norwegian after rebase 2022-03-07 11:47:53 +01:00
3d-gussner f9f76520d9 Temp. cal. -> PINDA cal.
01234567890123456789
 Temp. cal.   [Off] old
 PINDA cal.   [Off] new

Temp. cal.  1/6     old
PINDA cal.    1/6   new

MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE

Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED

Update status line during PINDA cal.

Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`

Tried to update translations

Updated po files
2022-03-07 11:47:53 +01:00
3d-gussner c1e971c2ad Change `Choose extruder` to `Select extruder` for consistant wording 2022-03-07 11:47:53 +01:00
3d-gussner 45cd904520 Remove duplicate `Extruder fan:`
Create MSG in messages to reuse it
Remove `Nozzle FAN`
Change Support -> Extruder info -> fan speeds
2022-03-07 11:47:53 +01:00
3d-gussner bcd2b6f8bf Remove `Choose filament` as it is a duplicate of `Select filament` 2022-03-07 11:47:53 +01:00
3d-gussner 879803daa9 Temp. cal. -> PINDA cal.
01234567890123456789
 Temp. cal.   [Off] old
 PINDA cal.   [Off] new

Temp. cal.  1/6     old
PINDA cal.    1/6   new

MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE

Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED

Update status line during PINDA cal.

Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`

Tried to update translations

Updated po files
2022-03-07 11:47:52 +01:00
3d-gussner 7939142922 Change `Choose extruder` to `Select extruder` for consistant wording 2022-03-07 11:47:52 +01:00
3d-gussner 81d8c72cc4 Remove duplicate `Extruder fan:`
Create MSG in messages to reuse it
Remove `Nozzle FAN`
Change Support -> Extruder info -> fan speeds
2022-03-07 11:47:52 +01:00
3d-gussner 4a73cad3fd Remove `Choose filament` as it is a duplicate of `Select filament` 2022-03-07 11:47:52 +01:00
3d-gussner 6822b65e9c FW Crash messages will not be translated 2022-03-07 11:47:52 +01:00
3d-gussner ab48e9880e
Merge pull request #3215 from wavexx/lang_add_improvements
PFW-1297: lang-add.sh improvements
2022-03-07 11:47:11 +01:00
Guðni Már Gilbert d42ef4784c Optimise checkFanSpeed()
Changes save 28 bytes of flash
2022-03-06 12:54:24 +00:00
pkg2000 53bbd36cf3 Update no.po
And we try again before final audit.
2022-03-04 13:21:06 +01:00
pkg2000 ff9e79202e Update no.po
Last push (?) before second party audit/approval
2022-03-04 12:16:04 +01:00
3d-gussner 851f72b059
Merge pull request #3389 from leptun/MK3_SN_GET_only_on_Einsy
Allow SN get only on the Einsy
2022-03-04 08:16:01 +01:00
3d-gussner 0889b3f49e
Merge pull request #3390 from leptun/MK3_fake_SN
Fix Octoprint connect because of SN GET on blank einsy boards
2022-03-04 08:15:48 +01:00
3d-gussner e10e196982
Merge pull request #3350 from leptun/MK3_fix_SN_crash2
Add a uart RX timeout
2022-03-04 08:15:17 +01:00
Alex Voinea 159c4cf8ae Reset acceleration rates when changing microstepping resolution 2022-03-03 22:25:48 +01:00
Alex Voinea 0896442335 Use correct filament type in variant files 2022-03-02 12:02:17 +01:00
Alex Voinea 56cb8cbc63
Merge pull request #3432 from leptun/MK3_3.12_Optimizations_PR3
memory and flash optimizations for 3.12 PR3
2022-02-28 13:16:41 +02:00
Guðni Már Gilbert 4a02ff3de8 Change SERIAL_PROTOCOL to SERIAL_PROTOCOLPGM in a few lines
Saves 12 bytes of SRAM but increases flash use by 12 bytes.
2022-02-28 11:37:13 +01:00
Alex Voinea 97c371e5e8 Make the "ln" functions no-inline.
Save 348B of flash
2022-02-27 20:58:56 +01:00
Guðni Már Gilbert af36f654d1 Optimise a few uses of SERIAL_PROTOCOLLN
Saves 34 bytes of flash memory and reduces code by 8 lines.
2022-02-27 20:58:50 +01:00
Alex Voinea bb56c35b87 Optimise PINDA cal status Serial print
"PINDA cal status:" is always printed no matter what cal_status is so we can pull that out of the conditional statment.

cal_status is also a boolean, lets just print it directly. Its a simpler code.

Saves 32 bytes of flash and 22 bytes of SRAM

Change serial messages to PGM
2022-02-27 20:58:46 +01:00
Guðni Már Gilbert efde923e57 Purge ftostr3
Saves 54 bytes of Flash and 2 bytes of SRAM
2022-02-27 20:58:39 +01:00
Alex Voinea 8e85242c8f Temperature selection is int16_t. Use sprintf for PID start command.
Saves 90B of flash and 2B of ram
2022-02-27 20:57:24 +01:00
Guðni Már Gilbert 6d98e99356 Use sprintf_P for M301 instead of ftostr32
Also fixed indentation of if statement

Saves 248 bytes of flash
2022-02-27 20:57:24 +01:00
Guðni Már Gilbert 0e6ff38b61 Optimise strcpy calls to use strcpy_P
Saves 24 bytes of SRAM
2022-02-27 20:57:24 +01:00
Guðni Már Gilbert 3ab57086b1 Remove one call to dtostrf
I could not see any difference in the functionality when testing this locally

Changes save 818 bytes of flash memory
(I suspect this is due to dtostrf no longer being called in the firmware for MK3S?)
2022-02-27 20:57:24 +01:00
Alex Voinea 6e15df6a4e
Merge pull request #3430 from leptun/MK3_MK2_obsolete
Make the MK2 variants obsolete in the MK3 branch
2022-02-25 13:04:39 +02:00
Alex Voinea 0c716d21fe
Merge pull request #3377 from leptun/MK3_fix_lang_reserved_area
Fix lang reserved area alignment
2022-02-25 12:36:33 +02:00
Alex Voinea a617025d85 Move MK2 variants to obsolete 2022-02-25 11:14:55 +01:00
Alex Voinea aba0088b4b Remove MK2 builds from travis build 2022-02-25 11:14:25 +01:00
Alex Voinea ce7cccab80
Merge pull request #3417 from leptun/MK3_temperature_busy_messages
Print busy messages while waiting for heaters
2022-02-25 12:03:23 +02:00
Alex Voinea e0877db707
Merge pull request #3428 from leptun/MK3_remove_forgotten_SNMM_code
Remove forgotten SNMM code in M600
2022-02-24 17:04:34 +02:00
3d-gussner 3ee62d01ad
Merge pull request #3422 from 3d-gussner/MK3_build_IDE1819_AB105
PFW-1298: Use PF-build-env 1.0.7
2022-02-24 15:57:41 +01:00
pkg2000 97b6356476 Update no.po
Fixed strings that did not fit.
2022-02-24 14:23:03 +01:00
Alex Voinea 50f4981a06 Remove forgotten SNMM code in M600 2022-02-24 14:02:49 +01:00
3d-gussner 3f3915304e Limit atmegaMK404 boards mem to 8,16,32 2022-02-24 11:42:23 +01:00
3d-gussner 98fa74a0d7 Change to Arduino IDE 1.8.19 and Arduino boards 1.0.5
Fix DEV_STATUS to set correctly on RC/BETA/ALPHA/DEVEL
Fix atmegaMK404 Board mem and flash modifications
2022-02-24 10:44:37 +01:00
3d-gussner 0c6d41eda7 Switch to prusa3d url 2022-02-24 09:09:15 +01:00
pkg2000 bb2a64387c Update no.po
Removed fuzzy ("needs work" in POedit) and (probably most) identical strings.
2022-02-23 16:48:57 +01:00
pkg2000 11ff93b78e Update no.po
Almost all filled out. Some missing strings/words, no proofreading or checking done yet.
2022-02-23 15:51:43 +01:00
3d-gussner f33e5f1770 Fix Norwegian after rebase 2022-02-23 14:52:55 +01:00
3d-gussner 41902315bd Merge branch 'MK3_3.11.0_Improve_languages2' of https://github.com/3d-gussner/Prusa-Firmware into MK3_3.11.0_Improve_languages2 2022-02-23 14:41:59 +01:00
3d-gussner 9dd7540566 Temp. cal. -> PINDA cal.
01234567890123456789
 Temp. cal.   [Off] old
 PINDA cal.   [Off] new

Temp. cal.  1/6     old
PINDA cal.    1/6   new

MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE

Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED

Update status line during PINDA cal.

Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`

Tried to update translations

Updated po files
2022-02-23 14:41:43 +01:00
3d-gussner 22e51e1de7 Change `Choose extruder` to `Select extruder` for consistant wording 2022-02-23 14:41:43 +01:00
3d-gussner 484827f43f Remove duplicate `Extruder fan:`
Create MSG in messages to reuse it
Remove `Nozzle FAN`
Change Support -> Extruder info -> fan speeds
2022-02-23 14:41:42 +01:00
3d-gussner dfa936aa09 Remove `Choose filament` as it is a duplicate of `Select filament` 2022-02-23 14:41:42 +01:00
3d-gussner 571e6fabfa FW Crash messages will not be translated 2022-02-23 14:41:42 +01:00
3d-gussner 93d2a8ef70 Temp. cal. -> PINDA cal.
01234567890123456789
 Temp. cal.   [Off] old
 PINDA cal.   [Off] new

Temp. cal.  1/6     old
PINDA cal.    1/6   new

MSG_TEMP_CALIBRATION -> MSG_PINDA_CALIBRATION
MSG_TEMP_CALIBRATION_DONE -> MSG_PINDA_CALIBRATION_DONE

Updated text
- MSG_PINDA_CALIBRATION_DONE
- MSG_PINDA_CAL_FAILED

Update status line during PINDA cal.

Changed PINDA cal. from submenu to function
- Deleted `lcd_pinda_calibration_menu()`
- Deleted `#MSG_CALIBRATE_PINDA c=17`

Tried to update translations

Updated po files
2022-02-23 14:38:57 +01:00
pkg2000 dee2061d73 Added 1 line
ftw longer text required?
2022-02-23 12:00:39 +01:00
pkg2000 3da07d34f3 Norwegian
Part 1
2022-02-23 11:46:07 +01:00
3d-gussner 9d2f3acd13
Merge pull request #3425 from 3d-gussner/MK3_3.11.0_Norwegian
PFW-1296: Add Norwegian basis
2022-02-23 09:32:12 +01:00
3d-gussner f5d4ba972b Change `Choose extruder` to `Select extruder` for consistant wording 2022-02-23 07:52:53 +01:00
3d-gussner 3ddbea14bb Remove duplicate `Extruder fan:`
Create MSG in messages to reuse it
Remove `Nozzle FAN`
Change Support -> Extruder info -> fan speeds
2022-02-23 06:52:25 +01:00
3d-gussner a51f799e73 Replace `åÅ` with `aA` 2022-02-23 06:38:45 +01:00
3d-gussner e0b18b279d Remove `Choose filament` as it is a duplicate of `Select filament` 2022-02-22 14:06:19 +01:00
3d-gussner 4934e6caf1 FW Crash messages will not be translated 2022-02-22 12:36:33 +01:00
3d-gussner a33340c176 Typo 2022-02-22 12:18:54 +01:00
3d-gussner 715f466fda Add Norwegian 2022-02-22 11:56:01 +01:00
3d-gussner 436b6f206a Activate Swedish community translation 2022-02-22 06:59:23 +01:00
3d-gussner 087b545e0f Add Swedish to use `äöüß` 2022-02-22 06:58:37 +01:00
3d-gussner 913cc502b9 Fix merge issues
Fix `\x0a`
Update po files
2022-02-22 06:57:03 +01:00
3d-gussner 153f412012
Merge pull request #82 from pkg2000/Swedish
Swedish
2022-02-21 17:21:24 +01:00
3d-gussner 90734c9eff
Merge branch 'MK3_3.11.0_Swedish' into Swedish 2022-02-21 17:20:37 +01:00
3d-gussner ea6ec78553 Use PF-build-env 1.0.7
- Based on Arduino IDE 1.8.19
- with Arduino_boards 1.0.5
2022-02-21 12:06:02 +01:00
3d-gussner 09e052ebca
Merge pull request #3420 from gudnimg/fix-finda-timer
Fix FINDA timer
2022-02-21 09:57:12 +01:00
Guðni Már Gilbert 227b6b4b03 Fix FINDA timer
We want to set the FINDA state IF the timer has not expired.
It is helpful to see why by looking at the commit which broke
this 802b8860c8

Without this fix my FINDA sensor just shows N/A. But after this commit is works perfectly.
2022-02-20 12:28:40 +00:00
Alex Voinea 0cc364ff7a Print busy messages while waiting for heaters 2022-02-17 17:53:02 +01:00
Alex Voinea b654217a5b
Merge pull request #3416 from leptun/MK3_MMU2_capability_line
Add MMU2 capability line
2022-02-17 17:44:39 +01:00
3d-gussner 8eff9e35da
Merge pull request #3400 from 3d-gussner/MK3_Translation_Maintainers
Update Maintainers
2022-02-17 17:34:04 +01:00
Alex Voinea e98bb086cc
Merge pull request #3414 from leptun/MK3_xflash_partitioning
xflash partitioning
2022-02-17 17:10:10 +01:00
Alex Voinea 5499ce5931 Add MMU2 capability line 2022-02-17 17:05:17 +01:00
Alex Voinea ae19f1bc0d
Merge pull request #3415 from leptun/MK3_fix_crashDetected_translation
Fix crash detected message translation
2022-02-17 16:01:26 +01:00
Alex Voinea 28a3458634 Fix crash detected message translation 2022-02-17 13:05:01 +01:00
D.R.racer c5999888e6 Version changed (3.11.0-RC1 build 4864) 2022-02-17 10:16:52 +01:00
DRracer 159c9c34bd
Merge pull request #3089 from wavexx/show_axes_during_crash
Show affected axes in crash detection messages
2022-02-17 09:52:19 +01:00
Alex Voinea 52b464688f Make layout static regardless of what is enabled 2022-02-17 09:34:09 +01:00
Alex Voinea eae6b4e911
Merge pull request #3412 from leptun/MK3_TWI_timeout
Hardware TWI timeout
2022-02-17 09:26:47 +01:00
Alex Voinea 1e0f414d41 Make twi timer local to the wait function 2022-02-17 09:22:18 +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 0172cbdf8b Extra TWI disable code. Not used yet. 2022-02-17 00:05:31 +01:00
Alex Voinea 6351d29d70 TWI timeout 2022-02-17 00:05:09 +01:00
Alex Voinea 94eb60eade
Merge pull request #3408 from leptun/MK3_remove_SNMM
Remove ancient SNMM code in the MK3 branch
2022-02-16 18:37:05 +01:00
Yuri D'Elia b9ca45fea1 lang-add: add a *crude* metadata extractor 2022-02-16 17:24:05 +01:00
Yuri D'Elia a07b7291b4 lang-add: handle duplicate translations and empty files 2022-02-16 17:24:05 +01:00
Yuri D'Elia 679730c9ed lang-add: avoid repetition for supported languages 2022-02-16 17:24:03 +01:00
Yuri D'Elia 5b6a057037 Reduce duplication and code size 2022-02-16 16:45:06 +01:00
Yuri D'Elia 35a67ad51f Fix typo 2022-02-16 16:23:31 +01:00
Yuri D'Elia 3a00054c55 Show the axes invoved during crash detection
Explicitly show which axes are affected on the status line when a crash
has been detected.

When the crash recovery prompt is triggered, also show all axes which
have been affected during the detection interval (currently X, Y, or
both).

The timer detection has been simplified to match the MK3 optical
filament timeout handling, which makes more sense: a crash immediately
following a crash recovery prompt will trigger the prompt again. The
timer needs to properly expire in order to reset the crash count.

This helps crash detection tuning (and help users reporting issues with
crash detection) without having to monitor the serial line.

This currently abuses the MSG_CRASH_DETECTED message by prepending the
[X][Y] labels to the message, which is ok in english but might not
translate that well for all languages.
2022-02-16 15:47:28 +01:00
Yuri D'Elia 9b6fca9214 Introduce lcd_show_yes_no_and_wait for future use
Split off yes/no lcd handling from
lcd_show_fullscreen_message_yes_no_and_wait_P into a separate function
in order to allow generic requests where the text prompt can change.
2022-02-16 14:17:56 +01:00
pkg2000 73c0837856
Changed "ae" to "ä" and "oe" to "ö"
Changed "ae" to "ä" and "oe" to "ö"
2022-02-16 11:59:12 +01:00
Alex Voinea 26f31743f7 Fix crashDet timer overflow handling 2022-02-16 10:06:07 +01:00
Alex Voinea 91797214b0 Update Eject and Cut to use for loop for menu items
Saves 134B of flash
2022-02-15 23:37:55 +01:00
Alex Voinea 2ec530c282 Do not hardcode the factory reset menu item count 2022-02-15 15:58:33 +01:00
Alex Voinea a6331d22c8 Remove ancient SNMM code in the MK3 branch 2022-02-15 15:58:33 +01:00
Alex Voinea f97808e19a
Merge pull request #3403 from leptun/MK3_fix_usb_timer
Fix usb printing timer
2022-02-15 15:44:44 +01:00
Alex Voinea 775c460dc5
Merge branch 'MK3' into MK3_fix_usb_timer 2022-02-15 10:36:57 +01:00
DRracer 7016a1241a
Merge pull request #3407 from leptun/MK3_3.10.2_disable_pullup_crash_test
Disable pullup crash test
2022-02-15 10:33:21 +01:00
DRracer 9aa0b250ff
Merge pull request #3405 from wavexx/fixup_suspicious_indentation
Fixup suspicious indentation in lcd_show_sensors_state
2022-02-15 10:31:20 +01:00
DRracer 8a1e9ea38e
Merge pull request #3397 from leptun/MK3_reset_time_remaining_on_stop
Fix time remaining not reset on stop print
2022-02-15 10:30:09 +01:00
DRracer 2d9a154541
Merge pull request #3247 from gudnimg/remove-ifdef-gudni
Remove unused ifdef `MK1BP` and `MAX_SILENT_FEEDRATE`
2022-02-15 10:27:21 +01:00
DRracer e641d6e1e1
Merge pull request #1263 from metacollin/calfix
Make the simple 4 axis stepper control respect the axis inversion settings in Configuration_prusa.h
2022-02-15 09:26:42 +01:00
Alex Voinea a1711f727e Disable pullup crash test 2022-02-15 09:07:18 +01:00
Alex Voinea 73406f53e9
Merge pull request #3393 from gudnimg/add-menu-back-arrow-to-preheat-menu
Add menu back arrow to the Preheat menu
2022-02-15 08:49:07 +01:00
DRracer 58d1f0c61e
Merge pull request #3206 from gudnimg/remove-eeprom-func
Remove four functions `EEPROM_read`, `EEPROM_save`, `EEPROM_read_B`, `EEPROM_save_B`
2022-02-15 08:48:09 +01:00
Yuri D'Elia 40881f52ad Prettify lcd_show_sensors_state() v2
Allow to show the full precision of Xd/Yd by rearranging the layout
2022-02-14 23:30:08 +01:00
Yuri D'Elia 0c63e0e8df Prettify MK3 sensor-info screen 2022-02-14 18:07:54 +01:00
Yuri D'Elia d89f4e9952 Fix indentation in the MK3 sensor information screen 2022-02-14 17:59:47 +01:00
Alex Voinea 8d0f4b766a Change fake SN as requested 2022-02-14 10:14:08 +01:00
3d-gussner 1bba7815fc
MK3_3.11.0_Lang fixes (#3404)
* Replace non-block space with space
Fix of some editors create non-block spaces which cause issues.

* Replace non-block space with space
Fix single language run without config.sh OK

* Update Slovak po files

* revert delete of lang/po/Firmware_sk.po

* Fix typos
Unix format for md files
2022-02-14 08:39:03 +01:00
3d-gussner 13d4c077b6
Activate Slovak 2022-02-14 08:13:11 +01:00
3d-gussner f1ff5907f4
Merge pull request #3386 from ingbrzy/MK3_3.11.0
Add SK language translation
2022-02-14 07:32:04 +01:00
Alex Voinea 4ec8781df2 Fix usb print timer 2022-02-13 22:52:49 +01:00
Alex Voinea 4f49f085b0
Merge pull request #3399 from leptun/MK3_3.11_PF-build.sh_Restoring_delay
PF-build.sh fix delay for the "Restoring" after failure when using "-o0"
2022-02-13 10:56:33 +01:00
3d-gussner 29a2ee998a Added Slovak Maintainers 2022-02-13 10:50:44 +01:00
Alex Voinea 7c9369ede6 PF-build.sh fix delay for the "Restoring" after failure when using "-o0"
Also update PF-build.sh revision
2022-02-13 09:52:04 +01:00
Alex Voinea 5ae45d583f Fix time remaining not reset on stop print 2022-02-13 08:52:27 +01:00
ingbrzy 592af52802
typo 2022-02-13 08:27:20 +01:00
ingbrzy 8db5ad1044
this letter doesn't exist in SK alphabet 2022-02-13 08:23:35 +01:00
ingbrzy 2eb32ac2c6 Typo 2022-02-13 08:11:21 +01:00
ingbrzy d9cd5324e7 Typos after review 2022-02-13 07:45:45 +01:00
Alex Voinea 480c30221e
Merge branch 'MK3_3.11.0' into MK3_3.11.0 2022-02-12 23:01:02 +01:00
Guðni Már Gilbert bd3a835516 Optimise preheat menu's MENU_ITEM_BACK_P
Saves 10 bytes of flash memory
2022-02-12 14:17:11 +00:00
Guðni Már Gilbert 70ee06144e Add menu back arrow to the Perheat menu
All other menus have this arrow on the back button.
2022-02-12 12:48:39 +00:00
Alex Voinea 7e90047bba Use eeprom_update_block instead of a for loop
Saves 32B
2022-02-12 09:41:07 +01:00
ingbrzy e36d5ebe1c Update .po files 2022-02-12 05:46:42 +01:00
ingbrzy 2a65086f75 Update .po files 2022-02-12 05:37:00 +01:00
Guðni Már Gilbert 4672b6444c
Merge branch 'MK3' into remove-eeprom-func 2022-02-11 19:32:11 +00:00
Alex Voinea ea39a245af
Merge pull request #3388 from leptun/MK3_fix_broken_progmem_string
Fix PRUSA commands
2022-02-11 15:46:30 +01:00
3d-gussner 1940cdca30
Merge pull request #3391 from 3d-gussner/MK3_3.11.0_python3
Change to python3
2022-02-11 15:13:38 +01:00
3d-gussner 8e73bb030e Change to python3
Bump up version
2022-02-11 15:04:35 +01:00
Alex Voinea 3031f68d31 Fix Octoprint connect because of SN GET on blank einsy boards 2022-02-11 14:21:06 +01:00
ingbrzy 65e99c62de
add SK letters replacement 2022-02-11 14:18:03 +01:00
ingbrzy 5b45553f38
add community SK 2022-02-11 13:31:43 +01:00
Alex Voinea 6689581364 Allow SN get only on the Einsy 2022-02-11 13:11:13 +01:00
Alex Voinea 489e4fd35c Fix PRUSA commands 2022-02-11 13:04:27 +01:00
ingbrzy c9f17b30e6
typo 2022-02-11 12:50:28 +01:00
ingbrzy 9f093ee404
typo 2022-02-11 12:49:41 +01:00
Alex Voinea ed8252527c Add a uart RX timeout 2022-02-11 12:49:11 +01:00
ingbrzy 54e4966f2c
typos 2022-02-11 12:48:38 +01:00
ingbrzy 79aa067a8a Update SK .po files 2022-02-10 21:20:06 +01:00
ingbrzy 0ac7874d27 Add SK .po files 2022-02-10 21:01:16 +01:00
Alex Voinea 426ab24c36 Let's not talk about this 2022-02-10 20:19:52 +01:00
Alex Voinea bf45d4dcd1 Make the compiler align the lang reserved area to the spm page boundary 2022-02-10 20:19:52 +01:00
Alex Voinea e358cb2b78 Fix DEBUG_SEC_LANG 2022-02-10 20:19:52 +01:00
ingbrzy 834cc24e6c Add SK language 2022-02-10 19:01:04 +01:00
Alex Voinea e1ebc82654
Merge pull request #3365 from leptun/MK3_3.12_Optimizations
memory and flash optimizations for 3.12 PR2
2022-02-10 16:47:20 +01:00
Alex Voinea 882a73b867 VERBOSE_CHECK_HIT_ENDSTOPS 2022-02-10 16:42:02 +01:00
Alex Voinea 18dde3fb61 Faster code when endstops/probe are not enabled 2022-02-10 16:24:52 +01:00
3d-gussner 42ac9c0ec3
Merge pull request #3382 from 3d-gussner/MK3_3.11.0_Fix_PF-build
Update PF-build.sh for MK2.5/S community languages and build-server fixes
2022-02-10 14:23:11 +01:00
Alex Voinea 42b91a83cd Merge branch 'MK3' into MK3_3.12_Optimizations 2022-02-10 10:36:31 +01:00
Alex Voinea dee8da61f6 Optimize endstop flags even more 2022-02-10 10:35:25 +01:00
Alex Voinea 380377db0f Add static assert 2022-02-10 09:47:37 +01:00
Alex Voinea 060581962c Fix sizeof array look 2022-02-10 09:33:55 +01:00
3d-gussner 35cee44df1 Add SRCDIR for compatibility with build server 2022-02-10 08:27:04 +01:00
Alex Voinea e35b21569d
Merge pull request #3005 from wavexx/remove_mres_limits
Allow all microstep resolutions for all axes
2022-02-09 13:48:51 +01:00
Alex Voinea 6aaf784975
Merge pull request #3251 from gudnimg/farm-mode-setup-gudni
Optimize `farm_mode` initialisation in `setup()`
2022-02-09 13:48:12 +01:00
Alex Voinea 916212b597 Add ALLOW_ALL_MRES as requested in PR 2022-02-09 10:28:45 +01:00
3d-gussner db7b41e294 Add community language firmware files for MK2.5/S
Add selection of language in MK404 for MK2.5/S
2022-02-09 09:41:11 +01:00
Guðni Már Gilbert c4f1023924 Add back second call to prusa_statistics(8) when farm_mode is enabled.
Adds 18 bytes of flash
2022-02-09 07:30:50 +00:00
Guðni Már Gilbert caf496e996 Optimise FanCheck initialisation when farm mode is on
Saves 12 bytes of flash memory (Arduino IDE 1.8.19)
2022-02-09 07:26:34 +00:00
Alex Voinea 1342db3532
Merge pull request #3257 from gudnimg/lcd-optimisation-gudni
Remove redundant operations on LCD CGRAM
2022-02-09 08:09:48 +01:00
Alex Voinea aab094ff4f
Merge pull request #3292 from gudnimg/fix-pinda-thermistor-build-fail
Fix build error if `PINDA_THERMISTOR` is not defined
2022-02-09 07:54:42 +01:00
3d-gussner e6703125ec
Merge pull request #3268 from gudnimg/lcd_button_update_gudni
Remove one call to `lcd_timeoutToStatus.start`
2022-02-09 07:37:36 +01:00
Alex Voinea 0b7aa31b2a Fix MUL24x24R24 comment 2022-02-09 00:26:46 +01:00
Alex Voinea 23098a7492
Merge pull request #3380 from 3d-gussner/MK3_Translation_Maintainers
Update Community translation
2022-02-08 18:36:27 +01:00
Alex Voinea 9ef0acba5d
Merge pull request #3381 from 3d-gussner/MK3_improve_translations
Pre-release updates and some fixes
2022-02-08 17:50:16 +01:00
3d-gussner 00036bcfcc Update all po files 2022-02-08 14:48:16 +01:00
3d-gussner 752eef0876 Enable to clean non active languages 2022-02-08 14:43:15 +01:00
3d-gussner 048117c3cb Fix MSG in cz and hu as these have been different to other lang_en*.txt files 2022-02-08 14:41:35 +01:00
DRracer 8cf969eb1d
Merge pull request #3370 from leptun/MK3_3.10.2_crash_on_thermistor_pullup
Crash if pullups get enabled on the thermistor inputs
2022-02-08 11:55:49 +01:00
Alex Voinea 5c0d2767a8 Move the test to the experimental menu
.
2022-02-08 11:18:09 +01:00
Alex Voinea fb1c8ee0a3 Change the pullup test 2022-02-08 10:53:47 +01:00
3d-gussner dd72b079ea Better translation in German for Bed level correct 2022-02-08 10:43:57 +01:00
3d-gussner a4b605ba16 The `Bed level correct` menu is under `Calibration` so `BACK` is correct 2022-02-08 10:38:04 +01:00
3d-gussner d80cef5443 Change [um] to [μm]
Including lang-im/export.sh to convert HD44780 to UTF-8 and vice versa
2022-02-08 10:18:27 +01:00
3d-gussner 881db2e747 Change `MSG_YES` to max. 4 chars
Hungarian YES is 4 letters long
2022-02-08 08:50:24 +01:00
3d-gussner e7d7068840 Change `MSG_WIZARD_DONE` rows to 3 2022-02-08 08:46:07 +01:00
3d-gussner d046619470 Update Community translation
Added Hugarian Co-Maintainer
Added Croatian Mainteners
Set Swedish to inactive, waiting for review
2022-02-08 08:19:17 +01:00
Alex Voinea 234add3c58 Merge branch 'MK3' into lcd-optimisation-gudni 2022-02-08 00:14:59 +01:00
Guðni Már Gilbert 121324d20b Revert "Remove one space from Support -> Temperatures menu"
This reverts commit 158877e736.
2022-02-08 00:09:09 +01:00
3d-gussner 8d0af30aa7 Update doxygen documentation 2022-02-07 19:41:14 +01:00
3d-gussner 709cdf5131
Merge pull request #3379 from Prime1910/MK3_3.11.0
Croatian translation Fix
2022-02-07 19:26:54 +01:00
Alex Voinea 2b18357fef
Merge pull request #3375 from leptun/MK3_arduino_1.8.13
Fix arduino 1.8.13 warnings
2022-02-07 17:27:13 +01:00
Alex Voinea 9c3c47ea29
Merge pull request #3253 from gudnimg/sd-sub-dir-fix
Fix edge case when SD card is inserted while user is inside the 'No SD card' submenu
2022-02-07 17:09:14 +01:00
3d-gussner 75d6942d81
Merge pull request #2836 from wavexx/remove_jerk_limits
Remove hard-coded X/Y jerk limits
2022-02-07 17:04:49 +01:00
3d-gussner 0d4d386991
Merge pull request #3228 from gudnimg/remove-mmu_lcd
Remove a few redundant lines from ultralcd code
2022-02-07 17:04:34 +01:00
3d-gussner 4cea7daac9
Merge pull request #3327 from gudnimg/remove-temp-stat-leds-gudni
Remove `TEMP_STAT_LEDS` from firmware
2022-02-07 17:04:24 +01:00
Alex Voinea c06ec9d05b Add pullup error test to define 2022-02-07 13:56:46 +01:00
Alex Voinea 5d29c4fab2 Fix build for real this time 2022-02-07 13:49:56 +01:00
Alex Voinea b3a53f6436
Fix build 2022-02-07 14:41:56 +02:00
3d-gussner db79ae9d5e Forgot #ifdef DEBUG_PULLUP_CRASH 2022-02-07 13:31:55 +01:00
3d-gussner 0b8ecfbf7c Add Test Pullup Crash menu 2022-02-07 13:28:48 +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 670214a30b Fix indentation 2022-02-06 11:01:35 +01:00
Guðni Már Gilbert c6ecc0dfc9
Merge branch 'prusa3d:MK3' into lcd-optimisation-gudni 2022-02-06 09:54:58 +00:00
Guðni Már Gilbert c2bad473dc Optimise _menu_edit_P
If the first if statement is true, then we don't need to check the next if statement.

Saves 64 bytes of flash memory
2022-02-06 09:01:16 +00:00
Alex Voinea 70cb30208c Also change MUL24x24R24 to the new format and fix rounding 2022-02-06 01:11:22 +01:00
Alex Voinea d06e74dd6f Fix Welcome message and language flashing 2022-02-05 23:44:24 +01:00
Guðni Már Gilbert a22a7ea9d7 Change LCD_STR_UPLEVEL to LCD_STR_UPLEVEL[0] for consistency
Saves 4 bytes of flash and 2 bytes of SRAM (Arduino IDE 1.8.19)
2022-02-05 19:58:31 +00:00
Guðni Már Gilbert d5b666d260 Add LCD_STR_SOLID_BLOCK to represent \xFF 2022-02-05 19:53:42 +00:00
Guðni Már Gilbert 976c8c4902 Change message from .c to .cpp
The allows us to include lcd.h and replace hardcoded value with define LCD_STR_REFRESH

Also deleted a #define for bool which does not seem to be used.
2022-02-05 18:57:18 +00: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
Guðni Már Gilbert 19dc05597d Fix identation in PR
Also combined the if statements that check farm_mode
If farm_mode is 0xFF then we can skip the next if statment.

No change in memory footprint
2022-02-05 11:24:04 +00:00
Prime1910 a3930cbff6 some words changed 2022-02-04 09:38:38 -08:00
Alex Voinea 274f198188 Fix typo from long ago 2022-02-04 16:28:49 +01:00
Alex Voinea 58867f6c06 Fix arduino 1.8.13 warnings 2022-02-04 15:53:49 +01:00
Alex Voinea f068c3258f Pack endstop flags 2022-02-04 15:24:43 +01:00
Alex Voinea 21a0b53647 remove firstrun 2022-02-04 13:27:43 +01:00
Alex Voinea 858984ef35 SD sorting entries instead of positions 2022-02-04 10:47:56 +01:00
DRracer 1dd2e237a0
Merge pull request #3368 from D05S/MK3_3.11.0
Czech translation fix
2022-02-03 16:53:23 +01:00
Dominik Sauer 4302fccca8 Update cs.po 2022-02-03 13:47:14 +01:00
SauerDominik 6167813f07 Update lang_en_cz.txt 2022-02-03 09:46:12 +01:00
DRracer 546eafae8b
Merge pull request #3342 from 3d-gussner/MK3_improve_translations
Improve language scripts
2022-02-03 08:21:38 +01:00
3d-gussner 9e8ed08092 Add new line at end of file 2022-02-03 08:08:28 +01:00
3d-gussner fc94322a10 Fix typo 2022-02-03 08:07:07 +01:00
3d-gussner 37662afdd1 Add LF 2022-02-03 08:05:49 +01:00
3d-gussner 22b3fbfe09 Deactivate translations haven't been merged or translated yet 2022-02-03 07:05:59 +01:00
3d-gussner 1e5421906f Revert "Delete as it has been merged in https://github.com/prusa3d/Prusa-Firmware/pull/3355"
This reverts commit 9993026202.

Affraid it will delete it when merged to MK3 branch
2022-02-03 06:55:50 +01:00
3d-gussner 9993026202
Delete as it has been merged in https://github.com/prusa3d/Prusa-Firmware/pull/3355 2022-02-03 06:53:20 +01:00
3d-gussner 103c6e8819
Merge pull request #3372 from Prime1910/MK3_3.11.0
Croatian translation
2022-02-03 06:45:02 +01:00
Prime1910 eb04c5861d shorten words corrected - croatitan translation 2022-02-02 15:10:19 -08:00
Prime1910 75118d540f Croatian translation small changes 2022-02-02 14:50:33 -08:00
Prime1910 0f7dcdf885 Some small changes in translation 2022-02-02 14:35:56 -08:00
Prime1910 f3a817ae45 Croatian translation of "spinning" corected 2022-02-02 14:25:20 -08:00
Prime1910 cc4601f3fe Croatian translation file changed 2022-02-02 14:17:53 -08:00
Prime1910 82dba06602 Croatian translation updated 2022-02-02 14:16:32 -08:00
Guðni Már Gilbert 1f3640ab26 Merge branch 'MK3_3.12_Optimizations' of https://github.com/leptun/Prusa-Firmware into MK3_3.12_Optimizations 2022-02-02 20:49:41 +00:00
Guðni Már Gilbert 43bf33e791 Optimise usage of code_value()
code_value() is float but in some cases we can save memory when the expected output is only 1 or 2 bytes.

Changes save 182 bytes of flash memory on my end.
2022-02-02 20:48:36 +00:00
Alex Voinea f25bddce35 Simplify GETPC() 2022-02-02 21:06:58 +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 146b008186 Remove redundant variable farm_status
It is unused and status_number variable can be used instead.
2022-02-02 18:37:55 +00:00
Guðni Már Gilbert 459570ab66 Change prusa_stat_printerstatus parameter to uint8_t
Also changes status_number global variable to uint8_t

Changes save 80 bytes of flash and 1 byte of SRAM (Arduino IDE 1.8.19)
2022-02-02 18:35:52 +00:00
3d-gussner f2fdbb3485 Merge branch 'MK3_improve_translations' of https://github.com/3d-gussner/Prusa-Firmware into MK3_improve_translations 2022-02-02 17:24:18 +01:00
3d-gussner ce6b92052c Update replace Czech non aA-zZ characters 2022-02-02 17:23:31 +01:00
3d-gussner fbe33ed28f Add POEdit `.mo`and MAC generated `.DS_Store` 2022-02-02 17:23:31 +01:00
3d-gussner f290039dff Add Hungarian replacement
Fix changed chars.
2022-02-02 17:23:31 +01:00
3d-gussner c3347dd2cb Improve language scripts
- Add German `äöüß` support
- Add/improve checks
  - Check for syntax errors
  - Output for translators
- gitignore more temporary files
2022-02-02 17:23:31 +01:00
3d-gussner 256c3f453b PF-build.sh:
- Add sort of variants. Request from @leptun
- Add Arduino IDE 1.8.19 as an option
- Allow upper and lower case. Request from @TojikCZ

MK404-build.sh:
- Allow upper and lower case. Request by @TojikCZ
- Add update option to release OR devel
2022-02-02 17:23:31 +01:00
3d-gussner 92ec7d3d24 Add some documentation
WIP
2022-02-02 17:23:31 +01:00
3d-gussner a7839a6cc6 Test Travis with focal Ubuntu20.04 LTS 2022-02-02 17:23:31 +01:00
3d-gussner 1abd2be96d Syntax check `lang_en.txt`
Display correct line having issues
2022-02-02 17:23:31 +01:00
3d-gussner 86235259a3 Add syntax checks 2022-02-02 17:23:31 +01:00
3d-gussner 2a4e90bd93 Update replace Czech non aA-zZ characters 2022-02-02 17:22:17 +01:00
D05S 183eaf80ec Created and updated files from new po 2022-02-02 15:05:25 +01:00
D05S 058c75f3ec Delete mac files 2022-02-02 14:51:02 +01:00
D05S 0f76c05a36 test 2022-02-02 14:46:48 +01:00
D05S 45c121c7a4 \x0a edit
\\x0a to \x0a
2022-02-02 14:16:01 +01:00
D05S d19fa38afe Update cs.po
memory optimization
2022-02-02 12:29:17 +01:00
3d-gussner cbae08991c Add POEdit `.mo`and MAC generated `.DS_Store` 2022-02-02 08:49:35 +01:00
3d-gussner 3b82333fcb
Merge pull request #3344 from AttilaSVK/MK3_3.11.0
New translation - Hungarian
2022-02-02 08:15:53 +01:00
Guðni Már Gilbert e525bcb7f5 Optimise lcd_selftest_screen input parameters and return type
* _progress_scale is max 3 so it can be uint8_t
* _progress is max 6 so it can be uint8_t
* Change _delay type to uint16_t to be explicit

Changes save 102 bytes of flash memory (Arduino IDE 1.8.19)
2022-02-01 18:57:43 +00:00
Guðni Már Gilbert 8681d84c44 Merge branch 'MK3_3.12_Optimizations' of https://github.com/leptun/Prusa-Firmware into MK3_3.12_Optimizations 2022-02-01 18:37:57 +00:00
Guðni Már Gilbert 53dfcf9d6f Optimise if-statments in world2machine_clamp
Only one of the statements can be true: tmpx < X_MIN_POS or tmpx > X_MAX_POS.
So we can be a little bit smarter here and skip the second if statement if the first was true.

This saves 6 bytes of flash memory and potential some clock cycles
2022-02-01 18:37:41 +00:00
Alex Voinea aec2db7683 Optimize MUL8x16R8 2022-02-01 18:12:13 +01:00
Prime1910 9e36c80963 Updated po files 2022-02-01 07:05:53 -08:00
Prime1910 77cba57eb6 Removed identical translations 2022-02-01 06:59:38 -08:00
Prime1910 0928d28def Created Croatian lang file from po file 2022-02-01 06:46:43 -08:00
Alex Voinea b7806bf25f Crash if pullups get enabled on the thermistor inputs 2022-02-01 12:34:07 +01:00
D05S 67a470e0ab Czech translation fix
translated missing parts
2022-02-01 06:55:45 +01:00
Guðni Már Gilbert c0e7e17fc3 Fix type of nrFiles 2022-01-30 13:07:09 +00:00
Alex Voinea 1523194d3b Fix build (merge conflict) 2022-01-30 13:18:07 +01:00
Alex Voinea 67e6361ff1 Fix temperature runaway variable types (merge conflict) 2022-01-30 13:16:05 +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
Alex Voinea 0f5312f927 Merge pull request #8 from gudnimg/remove-unused-var-gudni
Remove unused variables
Shrink integer types where possible
2022-01-30 11:39:29 +00:00
Alex Voinea aae562e480 Fix G81 for loop 2022-01-30 11:39:29 +00:00
Guðni Már Gilbert c081e1a5ae Loop index can be unsigned
Saves 4 bytes of flash memory
2022-01-30 11:39:29 +00:00
Guðni Már Gilbert 49693a9fb3 Remove undefined function
No change in memory footprint.
2022-01-30 11:39:29 +00:00
Alex Voinea d69b8daa72 Merge pull request #7 from gudnimg/gudni-PR2
Save some memory by using memset and inlined memcpy
2022-01-30 11:39:28 +00:00
Guðni Már Gilbert c705d4aa10 Change set_z() parameters to uin8_t
Saves 24 bytes of flash
2022-01-30 11:39:28 +00:00
Guðni Már Gilbert 581188ce2c Fix an issue found in code review
Unfortunately this increases flash usages by 212 bytes (same usage as in current release) It seems it is most memory effcient to use int16_t (int). int8_t requires more memory.
2022-01-30 11:39:28 +00:00
Guðni Már Gilbert f8847edca6 Remove one unused variable
Saves 1 byte of SRAM

The variable is only assigned a value but is never used.
2022-01-30 11:39:28 +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
Guðni Már Gilbert 052ecc3782 G81: Change for loop variables x and y to uint8_t
Saves 198 bytes of flash, that's crazy
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert 7787f17139 Smaller code in G28
Replace two blocks of code with already defined functions.

Change saves 100 bytes of flash memory and 11 lines of code.
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert b835f31904 Remove variable move_menu_scale
The variable is just set to 1.0 and is never modified, I also
removed the function lcd_move_menu_1mm()

Changes save 96 bytes of flash memory and 4 bytes of SRAM
2022-01-30 11:39:27 +00:00
Guðni Már Gilbert a940c364c9 Create enum class for heating_status variable 2022-01-30 11:39:27 +00:00
Guðni Már Gilbert 2013295f94 Change farm_timer to uint8_t
Remove extern declaration of farm_timer and farm_status as they
are only used in one file.

Saves 26 bytes of flash
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert a687173e02 Change custom_message_state_old and custom_message_state to uint8_t
I see max value as 7*7+10 = 59

Saves 100 byte of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert 60c9640602 Change heating_status_counter to uint8_t
It has a max value of 14

Saves 28 bytes of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert 22f23dff36 Change heating_status to uint8_t
Saves 66 byte of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert 2d614a8d41 Change usb_printing_counter to uint8_t
It is assigned max value of 10

Saves 26 byte of flash and 1 byte of SRAM
2022-01-30 11:39:26 +00:00
Guðni Már Gilbert aa0a86bf13 Remove internal Prusa command 'Beat'
It doesn't seem to do anything.

Saves 22 bytes of flash
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert 42778cae83 Remove unused kicktime timer
The variable is only set and never actually used

Saves 8 bytes of flash and 4  bytes of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert ef8083a148 crashDetTimer can be ShortTimer
Expired value is less than 65535

Saves 8 bytes of flash and 2 bytes of SRAM
2022-01-30 11:39:25 +00:00
Guðni Már Gilbert 6a9bab02f7 Convert display_time to ShortTimer
Saves 24 bytes of flash, 1 byte of SRAM
2022-01-30 11:39:25 +00: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 37fd9d1b11 Convert NcTime to ShortTimer
The variable is only used in ultralcd.cpp so I made it static there
and deleted it from Marlin_main.cpp

Saves 24 bytes of flash and 1 byte of SRAM
2022-01-30 11:39:25 +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 762a5db125 Convert previous_millis_cmd to LongTimer
Saves 196 bytes of Flash but adds 1 byte of SRAM
2022-01-30 11:39:24 +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
Guðni Már Gilbert 66782e9c9d setTargetHotend expect an uint8_t, not int for second parameter
also change _usb_timer to ShortTimer

Saves 28 bytes of Flash and 1 byte of SRAM
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert 77cce1fc05 Replace three lines by one function call which does the same thing
Saves 42 bytes of flash memory
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert a26651e7aa Change return types of two functions uint8_t
These functions aren't used but they should return the appropriate type.
2022-01-30 11:39:24 +00:00
Guðni Már Gilbert 800f44509d Change row_offsets[] to uint8_t
Saves 10 bytes of flash, and 4 bytes of SRAM
2022-01-30 11:39:24 +00:00
Alex Voinea cdd7ea30f4 Fix LUT loop 2022-01-30 11:39:23 +00:00
Guðni Már Gilbert 58213814cf Replace for-loop with memcpy
Saves 22 bytes of flash memory
2022-01-30 11:39:23 +00:00
Guðni Már Gilbert 52aa5a5f00 Use inlined function set_destination_to_current() in more places
Saves 70 bytes of flash memory
2022-01-30 11:39:23 +00:00
Guðni Már Gilbert a8d16d2949 Use memset to zero previous_speed array
Saves 150 bytes of flash memory
2022-01-30 11:39:23 +00:00
Alex Voinea fb10b4398e Merge pull request #6 from gudnimg/gudni-PR1
Purged some `int`s for `uint8_t` when using the axis enum
2022-01-30 11:30:25 +00:00
3d-gussner 14f309819d Add Hungarian replacement
Fix changed chars.
2022-01-30 12:26:54 +01:00
Guðni Már Gilbert f81db56793 temp_runaway_check() parameter _heater_id should be uint8_t
Saves 58 bytes of flash
2022-01-30 11:22:45 +00:00
Guðni Már Gilbert 261f311825 Change two arrays from int to uint8_t
__preheat_counter has max value of 16
__preheat_errors has max value of 5

Saves 58 bytes of flash memory and 4 bytes of SRAM
2022-01-30 11:22:45 +00:00
Guðni Már Gilbert 7535fa3a44 Remove unused variable
Saves 2 bytes of SRAM
2022-01-30 11:22:45 +00:00
Voinea Dragos 623762bd50 Fix build 2022-01-30 11:22:44 +00:00
Voinea Dragos 42a5f7dc20 Fix M226 2022-01-30 11:22:44 +00:00
Voinea Dragos 4aae88afdf M42 optimization 2022-01-30 11:22:44 +00:00
Voinea Dragos a5cd99a917 Disable unimplemented PID_ADD_EXTRUSION_RATE 2022-01-30 11:22:44 +00:00
Voinea Dragos 9951e3da52 Sound enums as uint8_t 2022-01-30 11:22:44 +00:00
Voinea Dragos 6dd59985ee Disable PRUSA M28 2022-01-30 11:22:44 +00:00
Voinea Dragos f22b9260ae Fix build 2022-01-30 11:22:44 +00:00
Voinea Dragos 9abae2fd97 Remove maxlimit_status 2022-01-30 11:22:43 +00:00
Voinea Dragos 9684806e00 Change arduino IO to fastio where possible 2022-01-30 11:22:43 +00:00
Voinea Dragos 42c393764f Adjust temperature runaway extruder count 2022-01-30 11:22:43 +00:00
Voinea Dragos 78362419da nIRsensorLastTime 2022-01-30 11:22:43 +00:00
Voinea Dragos a5f1f23fe2 TimeNow && TimeSent 2022-01-30 11:22:43 +00:00
Voinea Dragos f64c6c2a39 Remove unused Stepper.cpp variables 2022-01-30 11:22:43 +00:00
Voinea Dragos 9d1e54e685 Tmc2130 use ShortTimer instead of custom timer implementation 2022-01-30 11:22:43 +00:00
Voinea Dragos d8a14842c5 Remove unused `skip_debug_msg` flag 2022-01-30 11:22:43 +00:00
3d-gussner 4d27b623ea Improve language scripts
- Add German `äöüß` support
- Add/improve checks
  - Check for syntax errors
  - Output for translators
- gitignore more temporary files
2022-01-30 11:39:58 +01:00
3d-gussner f922f4d1fa PF-build.sh:
- Add sort of variants. Request from @leptun
- Add Arduino IDE 1.8.19 as an option
- Allow upper and lower case. Request from @TojikCZ

MK404-build.sh:
- Allow upper and lower case. Request by @TojikCZ
- Add update option to release OR devel
2022-01-30 11:01:19 +01:00
3d-gussner 60aa996ba7
Fix typo (#3356)
Fixed `community` typo
2022-01-21 16:28:19 +02:00
3d-gussner 6a6376cb40
Merge pull request #3070 from 3d-gussner/MK3_Community_issue_template
MK3 community issue template and List of Community made translations
2022-01-21 15:08:16 +01:00
DRracer 5c463dce29
Merge pull request #3355 from 3d-gussner/MK3_Travis_focal
Change Travis to Ubuntu 20.04 LTS (focal)
2022-01-21 12:34:05 +01:00
3d-gussner 025a9e2461
Add space
Thanks @wavexx
2022-01-21 08:15:54 +01:00
DRracer adac011e17
Merge pull request #3354 from leptun/MK3-vscode
Ignore .vscode dir
2022-01-21 07:41:34 +01:00
3d-gussner a795fda7b5 Trying to push travis build 2022-01-21 07:40:04 +01:00
3d-gussner f924fb9ade Change Travis to Ubuntu 20.04 LTS (focal) 2022-01-21 05:55:43 +01:00
Alex Voinea 38ef656ffd Ignore .vscode dir 2022-01-20 14:59:39 +01:00
AttilaSVK 0b8e65bd6c Updated Hungarian translation files
updated lang/lang_en_hu.txt and lang/po/Firmware_hu.po with files generated by lang-import.sh and lang-export.sh
2022-01-18 13:56:43 +01:00
AttilaSVK bbf23d4473 Update hu.po
Corrected a string based on where it appears on the display (Main, corrected to Főmenü, meaning Main Menu)
2022-01-18 10:38:56 +01:00
AttilaSVK 3936da7529 Update hu.po
Revised some translations based on the output from lang-check.py
2022-01-18 10:38:56 +01:00
AttilaSVK 311aa2a4c6 Update hu.po
Reduced long strings
2022-01-18 10:38:56 +01:00
AttilaSVK 9308593f5e Update hu.po
Corrected two ...(one character) to ...(three characters) and removed an accidental accent to maintain ASCII compatibility
2022-01-18 10:38:56 +01:00
AttilaSVK a28631638f New translation
Added Hungarian language
2022-01-18 10:38:56 +01:00
3d-gussner 2d01cb37ef Replace ` ?` with `?`
No need for additional space before the question mark.
2022-01-18 09:21:18 +01:00
3d-gussner 84cba7f769 Fixed Swedish po files
created `lang_en_sv.txt`
Deleted vs files

Compiled and tested the firmware with Swedish. Can't read everything but it looks good.
2022-01-18 08:20:02 +01:00
Bernt Ahlbäck 68cf57272c Swedish translation 2022-01-18 07:55:21 +01:00
Bernt Ahlbäck 2568ca66f2 Updated swedish lang
Looks bad as you dont support international languages (åäö).
2022-01-18 07:55:21 +01:00
Bernt Ahlbäck 7ab715c2dd Added swedich language 2022-01-18 07:55:21 +01:00
Bernt Ahlbäck 036bc38b82 Added swedich language 2022-01-18 07:55:21 +01:00
3d-gussner 978b9d5eeb
Add Hungarian and Swedish maintainers 2022-01-18 07:39:03 +01:00
3d-gussner 81657678f7
Fix Typo 2022-01-18 07:34:00 +01:00
Alex Voinea 44ea34bb72
Merge pull request #3346 from QuantumRoboticsFTC/MK3_3.11_RO
3.11 Translation - Romanian
2022-01-17 16:31:49 +01:00
Alex Voinea f59fe20393 Fix resized translation limits 2022-01-17 16:23:31 +01:00
Alex Voinea 365bd003f9 Update ro PO files 2022-01-17 16:21:59 +01:00
Alex Voinea 4f8be42555 Use um instead of the special character until it is implemented upstream 2022-01-17 16:21:59 +01:00
Hauzman 1a6b668ede Fix typos 2022-01-17 16:21:59 +01:00
Hauzman f9a591052c Fix typos
I have tested on my MK3S+ because the MK404 stops working when I select the language.
Posible to be future improvemen

Co-Authored-By: Alex Voinea <voinea.dragos.alexandru@gmail.com>
2022-01-17 16:21:59 +01:00
Alex Voinea 625fa3ea50 Fix layout for a few translations 2022-01-17 16:21:59 +01:00
Alex Voinea a49ef30477 Change Reglare->Optiuni 2022-01-17 16:21:59 +01:00
Alex Voinea e3712a72e6 Fix typos 2022-01-17 16:21:59 +01:00
Alex Voinea f50eaf4762 More language optimization 2022-01-17 16:21:59 +01:00
Alex Voinea e1e0dac635 Quick fixes 2022-01-17 16:21:59 +01:00
crackerOil 5096073507 Romanian language translation 2022-01-17 16:21:59 +01:00
Alex Voinea 4d348fa953 Initial Romanian translation 2022-01-17 16:21:59 +01:00
Alex Voinea 5d601e5ba0
Merge pull request #3348 from QuantumRoboticsFTC/MK3_fix_lang_c_limits
Fix the c limit for a few translations
2022-01-17 16:19:34 +01:00
3d-gussner 113b5ea905
Add MK404 2022-01-17 16:17:29 +01:00
Alex Voinea 669f15a269 Make "Filament sensor" translations shorter for ES and FR 2022-01-17 16:11:52 +01:00
Alex Voinea aeec7236ee
Update Community_made_translations.md 2022-01-17 17:09:48 +02:00
Alex Voinea c09b732522 Reserve xflash space for the mmu update files 2022-01-17 12:03:12 +01:00
Alex Voinea b72c027924 XFLASH layout explained 2022-01-17 11:46:14 +01:00
Alex Voinea 93b1a6b736 "Unload filament" c adjustment 2022-01-16 11:19:24 +01:00
Alex Voinea 7442057aba "Filament sensor" c adjustment 2022-01-16 11:13:52 +01:00
Alex Voinea 1d491e772b
Expand maximum language count (#3345)
* Expand maximum language count
2022-01-13 16:01:36 +02:00
3d-gussner 255e05d6b9 Add some documentation
WIP
2022-01-11 13:18:48 +01:00
3d-gussner 0ac5cff5d3 Test Travis with focal Ubuntu20.04 LTS 2022-01-10 10:34:22 +01:00
3d-gussner db4859ce9a Syntax check `lang_en.txt`
Display correct line having issues
2022-01-10 09:52:43 +01:00
3d-gussner 687746a80a Add syntax checks 2022-01-07 14:52:13 +01:00
DRracer eb25e5f0da
Merge pull request #3337 from 3d-gussner/MK3_3.11.0
Add Lithuanian
2022-01-04 07:34:33 +01:00
3d-gussner 1544a79b4e Add Lithuanian 2022-01-03 15:00:45 +01:00
DRracer 931e88022b
Merge pull request #3336 from 3d-gussner/MK3_3.11.0
Prepare for more Community languages
2022-01-03 13:57:17 +01:00
3d-gussner 6dd7681f6b Cleanup outdated code 2022-01-03 12:19:58 +01:00
3d-gussner 9aebf23d41 Merge branch 'MK3_3.10.1-languages' of https://github.com/3d-gussner/Prusa-Firmware into MK3_3.10.1-languages 2022-01-03 11:25:32 +01:00
3d-gussner 54d7e9331b Add Croatian 2022-01-03 11:25:15 +01:00
3d-gussner 75dc5bd410 Add Luxembourgish 2022-01-03 11:25:15 +01:00
3d-gussner 8911161f6b Add Hungarian
Fix typo
2022-01-03 11:25:15 +01:00
3d-gussner 7083529990 Add Slovanian 2022-01-03 11:25:15 +01:00
3d-gussner f8a0d3ad7b Add Danish 2022-01-03 11:25:15 +01:00
3d-gussner 5bce397fab Add Swedish 2022-01-03 11:25:15 +01:00
3d-gussner ba54dc3d35 Update po files after fixing lang-export and lang-import 2022-01-03 11:25:15 +01:00
3d-gussner 7fea716391 Disable use of lang-community script 2022-01-03 11:25:15 +01:00
3d-gussner 20494f7260 Update lang scripts using for loop for languages 2022-01-03 11:25:15 +01:00
3d-gussner fda665f9de Fix some minor issues 2022-01-03 11:25:15 +01:00
3d-gussner e02dd42765 Prepare for lot of community languages
The firmware is limited to how many languages can be stored in the xflash.
We will need to compile multiple language groups
2022-01-03 11:25:15 +01:00
3d-gussner b57fd94f05 Add counter
replace two double quotes to `\x00`
remove CR
2022-01-03 11:25:15 +01:00
3d-gussner 7b0872be64 Add missing MSG 2022-01-03 11:25:15 +01:00
3d-gussner 8708b1d413 Fix missing last translation
In FW3.10.1 there are 351 translations in the `lang_en.txt` but only 350 have been exported the `po` files missing the last one.
2022-01-03 11:25:15 +01:00
3d-gussner d59c08192b Prepare to use one config file for all languages 2022-01-03 11:25:15 +01:00
3d-gussner ecc8898b58 Change default Arduino path to by PF-build.sh created one 2022-01-03 11:25:15 +01:00
Guðni Már Gilbert 63c6373f8d Remove TEMP_STAT_LEDS from firmware
This isn't used by MK3 printers.
It seems to be leftover code from Marlin
2021-12-25 09:41:50 +00:00
3d-gussner 363a89c235 Add Croatian 2021-12-21 15:36:34 +01:00
3d-gussner 253d04438d Add Luxembourgish 2021-12-21 15:32:54 +01:00
3d-gussner 17301872cf Add Hungarian
Fix typo
2021-12-21 15:28:33 +01:00
3d-gussner 4d664cedf4 Add Slovanian 2021-12-21 15:24:06 +01:00
3d-gussner 3e5452ef21 Add Danish 2021-12-21 15:15:23 +01:00
3d-gussner 66439f6ad0 Add Swedish 2021-12-21 14:33:35 +01:00
3d-gussner a1e2ca32e4 Update po files after fixing lang-export and lang-import 2021-12-21 14:31:04 +01:00
3d-gussner 21b11b90d5 Disable use of lang-community script 2021-12-21 14:25:48 +01:00
3d-gussner 2e776de9a9 Update lang scripts using for loop for languages 2021-12-21 14:15:51 +01:00
3d-gussner e3e0ff0524 Fix some minor issues 2021-12-20 17:36:29 +01:00
3d-gussner 026f2ccae2 Prepare for lot of community languages
The firmware is limited to how many languages can be stored in the xflash.
We will need to compile multiple language groups
2021-12-20 17:32:35 +01:00
3d-gussner d2af15a35e Add counter
replace two double quotes to `\x00`
remove CR
2021-12-17 16:13:14 +01:00
3d-gussner a0e7bc8ebc Add missing MSG 2021-12-17 16:04:19 +01:00
3d-gussner 29e863e425 Fix missing last translation
In FW3.10.1 there are 351 translations in the `lang_en.txt` but only 350 have been exported the `po` files missing the last one.
2021-12-17 15:33:27 +01:00
3d-gussner ba0e14f898 Prepare to use one config file for all languages 2021-12-17 15:24:52 +01:00
3d-gussner d66927b0e0 Change default Arduino path to by PF-build.sh created one 2021-12-17 15:23:00 +01:00
DRracer 0be90dc5d1
Merge pull request #3320 from prusa3d/MK3_3.10.1
Merge MK3_3.10.1 into MK3 after release
2021-12-17 14:02:13 +01:00
D.R.racer caca7bb9b8 Version changed (3.10.1 build 4697) 2021-12-16 12:14:02 +01:00
DRracer 86b48ebe04
Merge pull request #3318 from 3d-gussner/MK3_3.10.1_prepare_release
MK3 3.10.1 prepare release
2021-12-16 12:01:49 +01:00
3d-gussner add4872292 Update po files before release 2021-12-16 11:52:35 +01:00
3d-gussner 1c1e69e555 Update FW crash message 2021-12-16 11:23:44 +01:00
DRracer 752e9d5544
Merge pull request #3317 from 3d-gussner/MK3_3.10.1_RepRap_documentation
MK3 3.10.1 Update RepRap documentation for D20 - D23
2021-12-16 10:09:59 +01:00
3d-gussner 785d94ab3a Add links to RepRap Gcode wiki for new Dcodes D20-D23 2021-12-16 09:32:38 +01:00
DRracer 1a7a313cbf
Merge pull request #3311 from wavexx/temp_runaway_fixes
Ensure THERMAL RUNAWAY / temperature errors stay on-screen
2021-12-14 06:53:27 +01:00
Yuri D'Elia 3849f9785a Make cancel_heatup also abort cooldown in M190
This matches the expected behavior, as already implemented in
wait_for_heater().
2021-12-10 01:51:43 +01:00
Yuri D'Elia 320835a1b7 Do not cancel wait-for-temperature loops in disable_heaters()
Partially revert previous change: cancelling a single loop would often
advance the gcode stream to the next wait-for loop if executed at the
beginning of an SD print, implicitly turning off the flag again.

Cancel the loop directly in UnconditionalStop() which stops the command
queue as well in an atomic way, handling this correctly.
2021-12-10 01:46:20 +01:00
Yuri D'Elia 32d8d892f5 Actually call UnconditionalStop() in Stop()->lcd_print_stop()
Remove incorrect check introduced during development.
2021-12-10 01:43:59 +01:00
Yuri D'Elia 83693bf4cc Remove useless assignment in lcd_cooldown
The current filament action will be aborted by lcd_return_to_status()
2021-12-07 19:27:18 +01:00
Yuri D'Elia 78f856c8d6 Do not unconditionally overwrite the status message in check_file()
No function should touch the status message directly without checking
the message severity level first. Replace the strcpy_P with
lcd_setstatuspgm().
2021-12-07 19:27:18 +01:00
Yuri D'Elia 7ff117d0c4 temp_runaway_stop: remove spourious space in error message 2021-12-07 19:27:18 +01:00
Yuri D'Elia 36a7b5ca56 Avoid redundant checks in lcd_setalertstatus* 2021-12-07 19:27:18 +01:00
Yuri D'Elia a3915b57b9 Improve temp_runaway_stop robustness
Remove most of the duplicated code inside temp_runaway_stop(),
making it identical to the other temperature handlers.

Move the lower-level functions required to stop the entirety of the
machine into UnconditionalStop(). Reuse this function inside
lcd_print_stop().

Set the LCD alert message before calling Stop(), as done in other safety
handlers, so that the error is visible while the printer is stopping.

This also avoids other temporary status messages to appear before
the real issue is shown and/or STEALING the first CRITICAL alert
level before we do.
2021-12-07 19:25:34 +01:00
Yuri D'Elia 57abffda1b Update temperature-related error message to use LCD_STATUS_CRITICAL 2021-12-07 11:09:58 +01:00
Yuri D'Elia fb025bba05 Introduce severity levels for alert messages
Use the internal lcd_status_message_level for multiple severity levels
of alert messages.

This is needed to distinguish between non-critical alerts (such as FAN
ERROR) from critical ones (any heater issue). During a failure
scenario, a critical error MUST NOT be overridden by a lower-level one.

As such LCD_STATUS_CRITICAL is currently used for all heater-related
errors that result in a safety full-stop.
2021-12-07 11:06:08 +01:00
DRracer a7dfe4b523
Merge pull request #3305 from gudnimg/sd-card-lcdtimer-fix-gudni-v2
Fix issue when the SD card is inserted and the file menu may sometimes close immediately due to a timeout
2021-11-19 07:23:21 +01:00
DRracer 3228f9d03c
Merge pull request #3304 from gudnimg/gudni-fix-compile-issue-v2
Fix build error when `TMC2130_SERVICE_CODES_M910_M918` is enabled
2021-11-19 07:21:38 +01: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 6795843f15)
2021-11-18 19:23:21 +00:00
Guðni Már Gilbert 13732f162b Fix build error when TMC2130_SERVICE_CODES_M910_M918 is enabled
(cherry picked from commit 6ed4b79cc6)
2021-11-18 19:19:56 +00:00
Guðni Már Gilbert 6887f844d3
Merge branch 'prusa3d:MK3' into fix-pinda-thermistor-build-fail 2021-11-18 19:15:15 +00:00
DRracer bb9ba95bfc
Merge pull request #3303 from Panayiotis-git/MK3_3.10.1
Print temperatures only if filament loading is still active
2021-11-18 11:59:05 +01:00
Panayiotis-git f8410d8f3c Print temperatures only if filament loading is still active 2021-11-18 11:46:36 +02:00
DRracer 98d4e6972a
Merge pull request #3271 from dweekly/patch-1
Fix typos & small grammar changes
2021-11-18 08:50:04 +01:00
DRracer 13f0f4d85a
Merge pull request #3291 from EV3R4/typo-m84-docs
Typo: M84 docs
2021-11-18 08:46:25 +01:00
DRracer e9fe7607a7
Merge pull request #3082 from awenelo/fix-bug-template
Keep consistent formatting for issue template
2021-11-18 08:43:14 +01:00
Guðni Már Gilbert 05e0c1e1d3 Fix build error if PINDA_THERMISTOR is not defined
temp_cal_active variable is not defined in this scope
2021-10-12 21:52:19 +00:00
EV3R4 eff9cd9f21 Typo: M84 docs 2021-09-27 19:34:53 +02:00
David E. Weekly b37e289a8f
Fix typos & small grammar changes
Applied some gentle love to make this read better to a native English speaker. No meaningful change in content.
2021-08-22 12:25:50 -07:00
Guðni Már Gilbert cf8a16baa1 Remove one call to lcd_timeoutToStatus.start
Saves 8 bytes of Flash memory

This call is redundant and when moving between menus
it gets called multiple times which results in waste
of clock cycles.

lcd_timeoutToStatus.start() is called from menu_lcd_lcdupdate_func()
which is enough.
2021-08-21 14:34:02 +00:00
Guðni Már Gilbert e6a7abf2c1 Change temp_runaway_timer from float to uint32_t
Saves 32 bytes of flash

Also change temp_runaway_error_counter from int to
uint16_t to be specific
2021-08-06 15:08:46 +00:00
Guðni Már Gilbert db1e5a203b Change temp_runaway_status from float to uint8_t and its enum
Saves 90 bytes of flash, and 12 bytes of SRAM
2021-08-06 15:03:35 +00:00
Guðni Már Gilbert b716c208d7 Various optimisation to change int to uint8_t
This commit saves 174 bytes of flash memory
2021-08-03 22:42:01 +00:00
Guðni Már Gilbert 8d7d1698ee Remove unused global variable 'chunkHead'
No change in memory on my end, but it is one less 'int' :)
2021-08-03 21:48:26 +00:00
Guðni Már Gilbert 1946c58d21 1. Remove redundant variable 'inters'
2. 'gh' variable can be 1 byte instead of 2

This saves 26 bytes of flash memory
2021-08-03 21:46:11 +00:00
Guðni Már Gilbert 05ed5b9668 Improve lcd_selftest_screen_step() parameter types
Saves 62 bytes of flash memory
2021-08-03 21:35:28 +00:00
Guðni Már Gilbert a54a133968 Use memset instead of nested for-loop to zero a 2d array
Saves 26 bytes of flash memory and removes two 'int' types
2021-08-02 19:20:51 +00:00
Guðni Már Gilbert 2554d21925 Use uint8_t when using axis enum
Saves 76 bytes of flash memory
2021-08-02 12:20:10 +00:00
DRracer 3bf5d937a8
Merge pull request #3192 from 3d-gussner/PFW-1271_PF-buildv20
PFW-1271 PF-build v2.0.0
2021-08-02 08:55:57 +02:00
DRracer fd6dbba06f
Merge branch 'MK3_3.10.1' into PFW-1271_PF-buildv20 2021-08-02 08:51:51 +02:00
3d-gussner da910fe861 Switch to arduino_boards v1.0.4 2021-08-02 08:34:35 +02:00
Guðni Már Gilbert 158877e736 Remove one space from Support -> Temperatures menu
Saves 2 bytes of flash memory
2021-08-01 11:20:29 +00:00
Guðni Már Gilbert da2c802440 Add two defines and use LCD_STR_DEGREE with consistency
This saves 12 bytes of flash and 2 bytes of SRAM
2021-08-01 11:10:03 +00:00
Guðni Már Gilbert 6afc87d3c8 Reduce unnecessary LCD CGRAM writes 2021-07-30 23:53:57 +00:00
Yuri D'Elia 4f40380474 tools: document functions in utils.gdb 2021-07-30 06:38:12 +02:00
Yuri D'Elia 1b22aac9fc tools: add xfimg2dump 2021-07-30 06:38:12 +02:00
Yuri D'Elia a697d00647 tools: add __pycache__ to gitignore 2021-07-30 06:38:12 +02:00
Yuri D'Elia c79b1dcbfa tools: add dump_crash to recover XFLASH crash dumps 2021-07-30 06:38:12 +02:00
Yuri D'Elia 8455c8e585 tools: Add/fix documentation 2021-07-30 06:38:12 +02:00
Yuri D'Elia 43b9a2d3df dump: do not hard-code constants 2021-07-30 06:38:12 +02:00
Yuri D'Elia 11a6ac2f4f dump parsing: refuse to continue on incomplete D23 dumps
We should try harder to handle incomplete D21/D23 dumps in the future,
but until D21 handled too, bail in D23 as well.
2021-07-30 06:38:12 +02:00
Yuri D'Elia 500515eb0a Add GDB utility functions to load/inspect binary dumps 2021-07-30 06:38:12 +02:00
Yuri D'Elia 06eab4ac11 Handle XFLASH (D21) and serial (D23) dumps in elf_mem_map, add dump2bin
- Uniformly parse D2/D21/D23 dump types.
- Add dump2bin to parse/convert a dump into metadata and binary.
- Move the parsing into it's own module in order to be shared.
2021-07-30 06:38:12 +02:00
Yuri D'Elia 9f40fa6834 elf_mem_map: parse D23 output directly 2021-07-30 06:38:12 +02:00
Yuri D'Elia 8ec4104840 elf_mem_map: do not output registers in qdirstat output 2021-07-30 06:38:12 +02:00
Yuri D'Elia d98e1b1cd9 elf_mem_map: uniquify file names in qdirstat output 2021-07-30 06:38:12 +02:00
Yuri D'Elia 9917689fdf tools: update documentation for elf_mem_map 2021-07-30 06:38:12 +02:00
Yuri D'Elia 9958c449e3 elf_mem_map: remove DWARF version except in help
Fix version to DWARF3, which is what we actually support.
2021-07-30 06:38:12 +02:00
Yuri D'Elia 54e24036a8 elf_mem_map: add qdirstat output for space visualization 2021-07-30 06:38:12 +02:00
Yuri D'Elia 676b925c5f elf_mem_map: cleanup 2021-07-30 06:38:12 +02:00
Yuri D'Elia 7bdee552ce elf_mem_map: add declaration position in --map 2021-07-30 06:38:12 +02:00
Yuri D'Elia d1720cba51 elf_mem_map: reduce some duplication 2021-07-30 06:38:12 +02:00
Yuri D'Elia c875aef49c elf_mem_map: increase width again to fit new output 2021-07-30 06:38:12 +02:00
Yuri D'Elia 71ef94da2e elf_mem_map: improve alignment of arrays 2021-07-30 06:38:12 +02:00
Yuri D'Elia cb4f5cff9f elf_mem_map: improve display of array-of-strings 2021-07-30 06:38:12 +02:00
Yuri D'Elia 776b82a6db elf_mem_map: expand member arrays 2021-07-30 06:38:12 +02:00
Yuri D'Elia 29513a369d elf_mem_map: allow to customize the name column's width 2021-07-30 06:38:12 +02:00
Yuri D'Elia 7f76f62af9 elf_mem_map: fix uleb128 decoding (fixes incorrect member offsets) 2021-07-30 06:38:12 +02:00
Yuri D'Elia a5635997b2 elf_mem_map: allow to annotate overlapping regions for clarity 2021-07-30 06:38:12 +02:00
Yuri D'Elia 1d82d2da64 get_elf_map: do not reprocess members twice 2021-07-30 06:38:12 +02:00
Yuri D'Elia 615e8575bb elf_mem_map: decode structs 2021-07-30 06:38:12 +02:00
Yuri D'Elia 9ddb5991f2 elf_mem_map: allow to disable gap dumps 2021-07-30 06:38:12 +02:00
Yuri D'Elia bb8d171f34 elf_mem_map: decode integers with correct endianness 2021-07-30 06:38:12 +02:00
Yuri D'Elia 1181e78484 elf_mem_map: handle all pointer types correctly 2021-07-30 06:38:12 +02:00
Yuri D'Elia c311266a83 elf_mem_map: handle abstract locations 2021-07-30 06:38:12 +02:00
Yuri D'Elia 2718dbb42c elf_mem_map: array n-dimensional expansion 2021-07-30 06:38:12 +02:00
Yuri D'Elia 29b8c89ec2 elf_mem_map: decode arrays (first dimension) 2021-07-30 06:38:12 +02:00
Yuri D'Elia 1de3fa51c9 elf_mem_map: decode doubles correctly 2021-07-30 06:38:12 +02:00
Yuri D'Elia 40b737e33d elf_mem_map: switch to a named tuple for extensibility 2021-07-30 06:38:12 +02:00
Yuri D'Elia f2192dc5e6 elf_mem_dump: fix unknown address 2021-07-30 06:38:12 +02:00
Yuri D'Elia c321ba4821 elf_mem_map: also dump gaps between known regions 2021-07-30 06:38:12 +02:00
Yuri D'Elia 4c6339ac46 elf_mem_map: decode correctly void pointers 2021-07-30 06:38:12 +02:00
Yuri D'Elia 1095b26570 Add several low-level debugging tools 2021-07-30 06:38:12 +02:00
3d-gussner e779803261 Add/fix few functions
Check MK404 for latest stable release instead of dev branch
2021-07-29 10:57:05 +02:00
Guðni Már Gilbert b1972fdcee Fixes https://github.com/prusa3d/Prusa-Firmware/issues/3252 2021-07-28 16:47:47 +00:00
Guðni Már Gilbert 8af9f78822 Optimize farm_mode init in setup()
This saves 28 bytes of flash memory
2021-07-26 16:37:09 +00:00
Guðni Már Gilbert 21226214a7 Remove MAX_SILENT_FEEDRATE
It was last used on MK2 in 3rd July 2017.
I suspect this code was simply forgotten.
2021-07-21 14:06:23 +00:00
Guðni Már Gilbert 25408d14da Remove unused #ifdef MK1BP
MK1BP is never defined anywhere
2021-07-21 06:27:44 +00:00
Guðni Már Gilbert 13477c65c6 Remove two functions EEPROM_read_B() and EEPROM_save_B()
This resolves #3218
2021-07-20 17:04:17 +00:00
Guðni Már Gilbert 400f673fe0 Remove redundant extern variable lcd_encoder from menu.cpp
This extern variable is included from lcd.h
2021-07-20 09:12:14 +02:00
Guðni Már Gilbert d087973e00 Remove redundant extern variable is_usb_printing from tmc2130.cpp
This extern variable is included from Marlin.h
2021-07-20 09:12:14 +02:00
Guðni Már Gilbert 6aee17b4ca lcd_change_fil_state has two extern's in Marlin.h, only one needed. 2021-07-20 09:12:14 +02: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 31c8e4bc4c * Remove redundant externs already included with temperature.h
* Add ifdefs in Dcodes.cpp when using extern variables
2021-07-20 09:12:14 +02:00
Guðni Már Gilbert eb9c8c8c20 Improve mc_arc() parameters
- Make the mc_arc() function declaration consistent with the definition
- isclockwise is supposed to be bool type, given how it is used.
2021-07-20 09:03:50 +02:00
Guðni Már Gilbert 538ce06bf0 Remove unused function lcd_choose_color() 2021-07-20 08:55:49 +02:00
Guðni Már Gilbert bbe62b136a Remove unused Sound_Save() function declaration 2021-07-20 08:51:57 +02:00
Yuri D'Elia d04ea859fb Consolidate "Unknown X-Code" to save 16 bytes 2021-07-20 08:19:19 +02:00
Yuri D'Elia 47b1e6ccef Remove spourious trailing whitespace in errors 2021-07-20 08:19:19 +02:00
Yuri D'Elia 1888c783cb Print an error on unknown D-codes
This follows the same convention of M/G codes, so that the user knowns
that the D-code has been either handled or ignored.
2021-07-20 08:19:19 +02:00
Guðni Már Gilbert d853c19a21 Use fabs() instead of abs() when using floats
This saves 514 bytes of flash memory
2021-07-20 08:16:18 +02:00
Yuri D'Elia 31b913cddb Correct the C implementation for MultiU16X8toH16
The comment behind the ASM MultiU16X8toH16 was misleading.
It actually computes ((a<<8)*b)>>16, or (a*b)>>8.

Correct the comment and C reference implementation accordingly.
2021-07-20 08:10:36 +02:00
Guðni Már Gilbert 710852a1f2 Change nrFiles from int16_t to uint16_t 2021-07-20 08:10:07 +02:00
Guðni Már Gilbert 16602f4003 change boolean to bool 2021-07-20 08:03:17 +02:00
3d-gussner 3d871a3aa6 Merge remote-tracking branch 'upstream/MK3' into PFW-1271_PF-buildv20 2021-07-17 19:10:51 +02:00
3d-gussner ffb7412637 Fix fresh build 2021-07-17 19:06:58 +02:00
D.R.racer 4580b8a78c Version changed (3.10.1 build 4587) 2021-07-16 07:37:11 +02:00
Guðni Már Gilbert 153de8e1db Remove redundant lines 2021-07-10 17:01:13 +00:00
Guðni Már Gilbert 47b8462c38 Remove two functions EEPROM_read() and EEPROM_save() 2021-07-02 20:10:47 +00:00
Yuri D'Elia 1279a6cf4b Correctly read FW_VERSION_NR array from progmem
In PR #3093 the progmem array FW_VERSION_NR was introduced to store the
version components, however the code didn't read it properly using the
pgm_read_* functions, making version comparisons fail.

Fix the existing/unused is_provided_version_newer() and reuse it in
show_upgrade_dialog_if_version_newer().

Similarly also read/update correctly the version in the eeprom.
2021-06-28 06:36:26 +02:00
Yuri D'Elia 56e531d40a Improve/fix D23 for M2.5/S printers
- Move D23 into it's own function inside Dcodes
- Correctly include a break in the switch statement
- Show the dumper status (enabled/disabled) after toggling
- Allow to generate an immediate dump via g-code using D23 E for
  symmetry with D20 E
2021-06-25 08:46:55 +02:00
Yuri D'Elia 380e34d481 Include "Dcodes.h" after "Marlin.h" for configuration
This is needed in order to get the function prototypes right according
to the actual enabled configuration.
2021-06-25 08:46:55 +02:00
Voinea Dragos ecce6f865f write_command() no line number handling 2021-06-25 08:12:30 +02:00
Yuri D'Elia 53fcd6fc8f Work-around GCC LTO codegen bug in process_commands()
When building with GCC 4.9.2 (bundled with PF-build-env-1.0.6.*), -Os
and LTO enabled, PID_autotune gets automatically inlined into
process_commands().

Sadly, due to the massive size of process_commands(), it results in
codegen bug doing a partial stack overwrite in process_commands()
itself, manifesting as random behavior depending on the timing of
interrupts and the codepath taken inside the merged function.

Mark the function as noinline and add a note about the affected compiler
version in order to be checked again in the future.
2021-06-24 07:39:28 +02:00
3d-gussner 9fd9ce34a9 MK404 is only supported on Linux at this moment. 2021-06-24 07:29:54 +02:00
3d-gussner 36f2b5375f Merge remote-tracking branch 'upstream/MK3' into PFW-1271_PF-buildv20
merge latest changes and fix isses
2021-06-24 05:53:43 +02:00
3d-gussner 17d7fdf333 Fix MK404 user interaction not to show if compiling 'All' variants 2021-06-24 05:50:20 +02:00
3d-gussner 9f9203b280 Change atmega404 board flash argument to y
Use newer version of MK404-build.sh instead start the program
Added _RAM-<value> and _FLASH-<value> as OUTPUT_FILE_SUFFIX if someone builds an atmega404 firmware
Added some logic if IDE 1.8.13 is used
Added some logic if Arduino_boards 1.0.4 is used
Fixed typo
Restore original `Configuration.h` and `config.h` in case of cannceled script or failed compiling during next start of this script.
use function
Improve MK404 usage
2021-06-23 20:14:30 +02:00
Yuri D'Elia 66ee9a295f Remove useless function EEPROM_read_st 2021-06-22 19:08:20 +02:00
Yuri D'Elia 8d11ad9d2d xfdump: correctly erase all sectors in xfdump_erase 2021-06-22 19:07:49 +02:00
DRracer 8ff9b184c2
Merge pull request #3093 from DRracer/version-shave
Remove FW version parsing
2021-06-22 10:27:42 +02:00
3d-gussner 2b29e52d53 Defined OUTPUT_FILENAME in one location
Added _RAM-<value> and _FLASH-<value> as OUTPUT_FILE_SUFFIX if someone builds an atmega404 firmware
Added some logic if IDE 1.8.13 is used
Added some logic if Arduino_boards 1.0.4 is used
Fixed typo
2021-06-22 09:20:48 +02:00
D.R.racer 88074ac6c8 Remove FW version parsing
as it can be done at compile time. Code size dropped by >800 bytes.
2021-06-22 08:49:52 +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
DRracer f36b9173da
Merge pull request #3191 from wavexx/fix_longpress_isr
Handle Long-Press in the main loop
2021-06-22 07:09:01 +02:00
Yuri D'Elia 79287ffb3d Use uint8_t consistently for the block buffer's index
Instead of using a mixture of int8_t, unsigned char and (incorrectly)
int, use uint8_t consistently for indexing the current block.

This improves the performance of the wait loop in plan_buffer_line,
which currently expands all comparisons to a word for no reason.

This also extends the theoretical limit to 128 entries.
Add some static assertions to ensure BLOCK_BUFFER_SIZE is correct.
2021-06-22 06:59:57 +02:00
Yuri D'Elia f4fcdae630 Fixup the DUMP_MAGIC constant 2021-06-22 00:04:39 +02:00
Yuri D'Elia 934b567e5a Remove "bonus" exclamation points from the crash message 2021-06-21 22:37:28 +02:00
jfestrada 72be8f7be5
Fix spanish translation for MSG_UNLOAD_SUCCESSFUL (#3185)
Fix spanish transtalation for MSG_UNLOAD_SUCCESSFUL by: jfestrada <jfestrada@cloudhd.eu>
2021-06-21 12:42:56 +02:00
Yuri D'Elia edde002cdc Merge remote-tracking branch 'upstream/MK3' into fix_longpress_isr 2021-06-21 11:51:45 +02:00
3d-gussner 8d376ebee0 comment out debug echos 2021-06-21 09:22:35 +02:00
3d-gussner 7a67d578fd Pf-build.sh
Change atmega404 board flash argument to y
Use newer version of MK404-build.sh instead start the program

MK404-build.sh
Change board_flash argument to 'y' and firmware_version to 'f
2021-06-21 09:16:19 +02:00
3d-gussner 3c649a89d3 Merge remote-tracking branch 'upstream/MK3' into PFW-1271_PF-buildv20 2021-06-21 08:01:24 +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
Voinea Dragos 0cbc759d8b Second attempt at retrieving the SN from the 32u2 IC 2021-06-21 07:24:41 +02:00
Alex Voinea 6d25345fc4 optiboot_xflash comment about w25x20cl messages
Mention supported ICs
2021-06-21 07:21:40 +02:00
Yuri D'Elia a92c0278fe Use LCD_WIDTH instead of hardcoding 20 2021-06-21 07:21:10 +02:00
metacollin 8a7dd08116 Fixed C++ bug 2021-06-21 07:05:17 +02:00
Yuri D'Elia 09e935d27b Fix two new explicit case fallthru warnings 2021-06-21 06:52:52 +02:00
Yuri D'Elia d727a949dd Silence explicit case-fallthru 2021-06-21 06:52:52 +02:00
Yuri D'Elia c096462aab Clarify statement by adding extra braces 2021-06-21 06:52:52 +02:00
Yuri D'Elia 051f03119b Fix misleading indentation warnings by expanding tabs 2021-06-21 06:52:52 +02:00
Yuri D'Elia f2fe57bfc0 Fix unused static declaration warnings
Guard declarations using the appropriate defines
2021-06-21 06:52:52 +02:00
Jonas Meyer 7bd43b77d7 Remove unnecessary assignment 2021-06-21 06:47:59 +02:00
Yuri D'Elia eafdf6c216 Also move host_keepalive to manage_inactivity()
This avoids the "busy" output interleaving with regular output in very
rare scenarios.

We should focus in finding which calls are not using manage_inactivity()
properly instead of working it around.
2021-06-21 06:46:24 +02:00
Yuri D'Elia 29322d4bf3 Move host_autoreport() to manage_inactivity()
This makes autoreport work more consistently.
2021-06-21 06:46:24 +02:00
Yuri D'Elia 5c8a231ed6 Move autoreporting out of the temperature ISR
Code running in the temperature ISR needs to be fully reentrant, which
is hard to track down.

Move autoreporting to the main processing loop. This can make the
autoreporting slower or pause at times, but removes the reentrant
restriction, which allows us to use printf_P.
2021-06-21 06:46:24 +02:00
Yuri D'Elia 97f66a6a13 Remove ignored/incorrect PROGMEM
This PROGMEM is currently ignored by gcc, but even if it wasn't it
wouldn't be correct since the following code is expecting to read "item"
without fetching the array itself from PROGMEM.
2021-06-21 06:44:19 +02:00
DRracer 5bb8bb2ccb
Merge pull request #3134 from wavexx/fix_partial_redraw2
Redraw "Preheating to load" in full when modified by other actions
2021-06-21 06:42:13 +02:00
Yuri D'Elia 700825ff76 serial_dump: include hex prefix 2021-06-19 13:57:40 +02:00
Yuri D'Elia bff79d290a GETPC: Do not manipulate the 32bit return address
We can do that offline, saving over 30 bytes of instructions.
2021-06-19 13:56:40 +02:00
Yuri D'Elia 72b8f0d1e6 Add some warnings in lcd_buttons_update 2021-06-19 13:46:10 +02:00
3d-gussner dde5cea48b Default extrusion graphics to line. Thanks @vintagepc point it out
Added -g 3 and 4 for more details extrusion lines
Check for updates is default. Fix update if internet connection is lost.
2021-06-18 20:40:17 +02:00
3d-gussner bc98be3d29 Documentation and version number
Added some arguments and checks
2021-06-18 13:47:33 +02:00
3d-gussner b12c0e2326 Use atmega404 if extanded RAM or FLASH size are chosen
Remove MK404 copy of lang file as it has been fixed in MK404
2021-06-18 13:46:25 +02:00
3d-gussner ae41d6ca40 Change version to v2.0.0 2021-06-17 21:02:46 +02:00
3d-gussner 4614400298 Save ELF files for FW3.10.1 debugging PRs
Add verbose_IDE to output more information during build
2021-06-17 20:59:35 +02:00
Yuri D'Elia 06d91ddcee Handle Long-Press in the main loop
The longpress function is currently called within the temperature ISR,
which is bogus. Calling the longpress function at the wrong moment
can corrupt the menu buffers.

Move the call to the main loop by changing the logic slightly:

- still sample the lcd buttons inside the temperature ISR, which keeps
  scrollong/pressing responsive, but...
- set a flag to indicate that longpress has been triggered instead of
  calling the function directly
- call the function on the next manage_inactivity run

Combined with #3180 this removes _most_ unsafe operations out of the ISR
which can happen during a normal run (max/mintemp warnings are still an
exception).
2021-06-17 20:07:01 +02:00
3d-gussner 56889bae13 Update PF-build.sh to work after @DRracer Remove FW version parsing PR 2021-06-17 19:08:55 +02:00
3d-gussner 589b781d04 Merge branch 'MK3_MK404' into PFW-1271_PF-buildv20 2021-06-17 18:47:17 +02:00
Yuri D'Elia dd8c6c064c xfdump: simplify stack debugging (sample pc+sp)
Instead of having to guess the PC where the SP was sampled, always take
both. This allows "seamless" stack decoding for both serial and xflash
dumps, since we don't have to guess which function generated the dump.

Make the core functions (doing the sampling) be ``noinline`` as well,
so that they always have valid frame.
2021-06-17 01:29:25 +02:00
Yuri D'Elia 97535ec0c1 Fix last commit 2021-06-15 22:10:08 +02:00
Yuri D'Elia e6d520cf6e Add test code for the stack overflow handler 2021-06-15 18:49:20 +02:00
Yuri D'Elia a614268c94 serial_dump_and_reset: do not call manage_heater with interrupts disabled
Do not call manage_heater() in print_mem() if interrupts are already
disabled. This means we're running inside the crash handler.
2021-06-15 18:44:44 +02:00
Yuri D'Elia d193d0f7ac serial_dump: manipulate WDT just once 2021-06-15 16:21:56 +02:00
Yuri D'Elia 928c7211ad emergency handlers: always save SP _at_ the crash location
Save SP which is closest to the crash location, which simplifies
debugging. For serial_dump, write SP just before the dump.
For xfdump, save SP in the dump header.

This makes xfdump_dump and xfdump_full_dump_and_reset() equivalent for
stack debugging.
2021-06-15 11:47:27 +02:00
Yuri D'Elia 96aad0a475 Remove duplication in crash handlers
It's kind of nice that all handlers eventually came to become the same.
2021-06-14 12:38:23 +02:00
Yuri D'Elia fa0f58d5bc serial_dump: add description about bad_isr 2021-06-14 12:30:24 +02:00
Yuri D'Elia e90f5d81ec
Merge pull request #7 from leptun/improve_d2
bad ISR catch
2021-06-14 12:27:31 +02:00
Voinea Dragos 8e667a8acd bad ISR catch 2021-06-14 11:30:38 +03:00
Yuri D'Elia d2041ee2fe Enable debugging features on all variants
- XFlash crash dumper on MK3+ series
- Online crash dumper on MK2.5+ series
- D2/D6 on MK3+ series
- D2 on MK2.5+ series
2021-06-13 22:35:43 +02:00
Yuri D'Elia 7db667ca86 serial_dump_and_reset: turn on print fan while dumping
To avoid scorching the sheet while dumping close to the bed.
2021-06-13 22:28:28 +02:00
Yuri D'Elia ea51d65137 serial_dump_and_reset: do not completely disable WDT
Set it to 8s which is long enough to complete the dump.
2021-06-12 15:39:37 +02:00
Yuri D'Elia 6de98f7b0d Move inclusion closer to the usage point 2021-06-12 15:33:18 +02:00
Yuri D'Elia 050cf72e98 Move stack checking to the temperature ISR
Now that the stack_error function is truly minimal,
we can check for stack errors much more frequently.

Also move away stack_error from ultralcd to Marlin_main.
2021-06-12 15:23:33 +02:00
Yuri D'Elia 01934b89e9 xflash_dump is now always required in all variants 2021-06-12 15:13:32 +02:00
Yuri D'Elia 449510392d Untangle a bit some recursive include mess 2021-06-12 15:09:03 +02:00
Yuri D'Elia e28301f391 Report crash also in MK2.5, fix stack_error abuse
Rename EEPROM_CRASH_ACKNOWLEDGED to EEPROM_FW_CRASH_FLAG.

Use EEPROM_FW_CRASH_FLAG to always set the last crash reason, which
simplifies handling between the online/offline variants.

Make stack_error safe, by setting the flag and restarting immediately,
so that the error can be shown after restart.
2021-06-12 14:41:54 +02:00
Yuri D'Elia bd57e00448 Implement an online crash dumper for MK2.5 boards
When XFLASH is not available, allow users to request _online_ crash
dumps by using D23 (since these require active user cooperation).

Once enabled, instead of just rebooting, dump memory directly to
the serial.

As similarly done with EMERGENCY_DUMP, we have two features that can be
enabled:

EMERGENCY_SERIAL_DUMP: enables dumping on crash after being requested
MENU_SERIAL_DUMP: allow triggering the same manually through the support
menu.
2021-06-12 13:37:20 +02:00
Yuri D'Elia f7dc8dcaef Fix usage of RAMEND
RAMEND is the last valid address, not one-past as I expected it to be...
2021-06-12 13:16:12 +02:00
Yuri D'Elia f18d4757c6 Introduce STACK_GUARD_MARGIN in all variants
Create a gap between the BSS and the stack guard.
Set this gap (STACK_GUARD_MARGIN) to 32 bytes in all variants.

The gap serves two purposes:

- Detect a stack overflow earlier (falsely triggering in overtight
  situations is OK!), so that we can hopefully avoid smashing
  the heap and have a clean view during the dump.

- Reserve spack space itself for the stack dumping machinery,
  which is going to grow the stack even further.

Remove get_stack_guard_test_value() which was unused.
2021-06-12 12:08:53 +02:00
Yuri D'Elia 9663653671 xfdump_erase: remove redundant XFLASH_SPI_ENTER() 2021-06-12 12:05:02 +02:00
Yuri D'Elia 3187b96ca4 xfdump: report to the host that a dump is available
As suggested by @3d-gussner, announce to the host that a dump is
available for retrieval using an action "dump_available".

Any kind of dump is announced (even if manually triggered).

To avoid reading from xflash twice, remove some duplication and return
the crash reason directly in xfdump_check_state().
2021-06-11 19:21:51 +02:00
Yuri D'Elia 31f416fd5e Rename dump_crash_source to dump_crash_reason 2021-06-10 17:35:49 +02:00
Yuri D'Elia c375610668 Move "WDR dump" inside EMERGENGENCY_DUMP 2021-06-10 17:02:41 +02:00
Yuri D'Elia 63f870c089 Enable the "WDR reset" menu item in DEBUG_BUILD only 2021-06-10 16:30:59 +02:00
Yuri D'Elia 0362b6484f xfdump_full_dump_and_reset: set a guaranteed minimum WDT
Just prior to dumping, reset the WDT to a known-safe (and not too long)
interval that guarantees a complete dump.
2021-06-10 16:30:39 +02:00
Yuri D'Elia 3f7b9b42b2
Merge pull request #6 from leptun/improve_d2
WDT crash detection
2021-06-10 16:02:56 +02:00
Voinea Dragos 0a77f2c02d Dump header as well 2021-06-10 11:58:46 +03:00
Voinea Dragos 094c577e9d Fix XFLASH_DUMP print_mem 2021-06-09 14:10:20 +03:00
Voinea Dragos 1e786c7f55 WDR crash initial 2021-06-09 13:59:26 +03:00
Voinea Dragos 8c3d76f85f Fix millis reference 2021-06-09 12:44:28 +03:00
Yuri D'Elia fab04dbc6c D6: remove option for unsupported models 2021-06-08 19:53:37 +02:00
Yuri D'Elia 318ee695c2 xfdump_layout: add some comments 2021-06-08 19:50:43 +02:00
Yuri D'Elia c2e64c8c6e xfdump: fix another off-by-one static size check 2021-06-08 19:08:03 +02:00
Yuri D'Elia 378f239ff0 dcode_code: fix inverted define to print larger types 2021-06-08 18:57:16 +02:00
Yuri D'Elia 56d0848ea9 xfdump: fix size check 2021-06-08 18:43:32 +02:00
Yuri D'Elia 9d3b19b637 xfdump: defensive static checks to ensure dump location always fits 2021-06-08 18:29:55 +02:00
Yuri D'Elia dcfdce87c7 Document new applicable build options in the variant files
Document, but don't enable them.
Leave exiting functionality unchanged for now.
2021-06-08 18:17:56 +02:00
Yuri D'Elia c072fbbf02 Dcodes: fix daddr_t type when only XFLASH_DUMP is enabled 2021-06-08 18:14:49 +02:00
Yuri D'Elia c331c07b16 xfdump: reuse standard definitions for SRAM size/offset 2021-06-08 17:53:06 +02:00
Yuri D'Elia 520f7a2e26 config: add sanity checks for XFLASH_DUMP options 2021-06-08 17:32:14 +02:00
Yuri D'Elia 0e75bc9d8e lang/fw-build.sh: fix padding calculation 2021-06-08 17:24:10 +02:00
Yuri D'Elia 1a88e339bf xfdump: fix build with XFLASH_DUMP disabled 2021-06-08 17:17:18 +02:00
Yuri D'Elia a6e372e696 Typo 2021-06-08 17:14:22 +02:00
Yuri D'Elia c31109c750 Implement MENU_DUMP: offline memory dump from "Support"
If MENU_DUMP is enabled, a new entry at the end of the "Support" menu is
added that allows to dump memory for offline use.

This allows to trigger a memory dump at any moment during regular usage
(either idling or printing) and to recover the dump later even after a
hardware reset.
2021-06-08 16:56:58 +02:00
Yuri D'Elia c089ac5341 Implement EMERGENCY_DUMP for offline analysis
If EMERGENCY_DUMP is defined, crash and dump using the new xflash dump
functionality instead of just continuing with an error message.

When an emergency crash is stored, the first restart after a crash
displays a message that debug data is available and to contact support
to submit the crash for analysis.
2021-06-08 16:42:43 +02:00
Yuri D'Elia e7f78125d3 Merge remote-tracking branch 'panayiotis/FixEepromAddressDocumentation' into improve_d2 2021-06-08 16:18:09 +02:00
Yuri D'Elia 30402e0404 Dcodes: add D20/D21/D22 to generate/read/clear dumps 2021-06-08 15:34:39 +02:00
Yuri D'Elia 8417083b13 lang/fw-build.sh: check for language data size during build
Ensure the language data always fits the reserved space in the XFLASH.

The script *should* use the LANG_SIZE definition from "xflash_layout",
which can be obtained by preprocessing the source code.

At the moment though this step has been omitted since running
arduino-builder to preprocess the source requires extra flags passed by
build.sh. The size has been hard-coded (and it's unlikely to change
given the content size is constant for the architecture).
2021-06-08 15:30:05 +02:00
Yuri D'Elia 6dfef76346 xfdump: implement dump-to-xflash functionality
Update xflash_layout to include information about the dump, which sits
at the end of xflash.
2021-06-08 15:28:02 +02:00
Yuri D'Elia b398a09a4f xflash: add xflash_multipage_program and documentation
Add a new high-level command to perform multipage writes quickly.
2021-06-08 15:25:16 +02:00
Yuri D'Elia 86e753fe37 xflash: remove some duplication 2021-06-08 15:24:46 +02:00
Yuri D'Elia 5ae8bad0ba Introduce "xflash_layout" to organize XFLASH's content
Update the language code to use the new LANG_OFFSET definition
and remove hard-coded flash sizes.
2021-06-08 15:22:37 +02:00
Yuri D'Elia af636c7f2a Move "xflash" include inside the conditional 2021-06-08 15:18:33 +02:00
Yuri D'Elia 0fcdada579 D6: add documentation 2021-06-07 19:58:18 +02:00
Yuri D'Elia ed9f52dd85 D6: also hide declaration behind conditional 2021-06-07 18:50:45 +02:00
Yuri D'Elia db096557d4 D[236]: remove "busy" messages while dumping, avoid WDT 2021-06-07 16:41:25 +02:00
Yuri D'Elia 12e124324f Remove PROGMEM handling from print_mem until D5 uses dcode_core
Handling PROGMEM also requires a 32bit address type.
2021-06-07 16:41:25 +02:00
Yuri D'Elia f9371146d0 Implement reading XFLASH with D6
This requires expanding the dcode_core address type to 32bit type,
thus enlarges the D2/D3 implementation as a result.

Still allow to save all the original space if D6 is disabled, for now.
2021-06-07 16:41:25 +02:00
Yuri D'Elia 915f5a7692 Unify D2 and D3 handling
Handle reading/writing memory using the same base functions
in order to save space.
2021-06-07 16:41:25 +02:00
Yuri D'Elia 2d25a5705f Fix D2 to read the entire SRAM content
Allow to read up to 0x21ff, which is the last byte of SRAM.  Set default
starting address to 0x200, which is the first true byte.

0x0-200 is mapped to register/io space and could cause issues when read
from bi-directional registers.
2021-06-07 16:37:34 +02:00
Yuri D'Elia 62f496e1d6 Allow D2 to be enabled selectively 2021-06-07 16:37:34 +02:00
DRracer a8a253c0ae
Merge pull request #3163 from DRracer/farm-m1
Farm workaround M1 message
2021-05-27 09:07:49 +02:00
D.R.racer 6bb7c0e3d3 Farm workaround M1 message
Farmers want to abuse a bug from the previous firmware releases
- they need to see the filename on the status screen instead of "Wait for user..."
So we won't update the message in farm mode...
2021-05-25 09:45:42 +02:00
Panayiotis-git 3c63ddaafd Fix the eeprom address documentation 2021-05-22 17:09:55 +03:00
DRracer f5ca79926e
Merge pull request #3141 from prusa3d/MK3_3.10.0
MK3_3.10.0 -> MK3
2021-05-07 13:56:46 +02:00
D.R.racer 04de9c0c8a Version changed (3.10.0 build 4481) 2021-05-06 13:46:05 +02:00
3d-gussner e765c300b0 Update MK404 part to '--bootloader-file ""'
Some cosmetics
2021-05-05 20:05:35 +02:00
Yuri D'Elia 1a92f2e19f Merge remote-tracking branch 'upstream/MK3_3.10.0' into fix_partial_redraw2 2021-05-04 10:49:24 +02:00
3d-gussner 31b38393e9 Merge branch 'MK3_more_flash_more_ram' into MK3_MK404
Add atmega404
2021-05-03 20:01:48 +02:00
3d-gussner a5ba31b247 Indentations 2021-05-03 14:14:47 +02:00
3d-gussner 16359780f9 Add MK404 'atmega404' and 'atmega404_no_bootloder' option 2021-05-03 14:11:03 +02:00
3d-gussner 41d7eaa94b Update documentation 2021-05-03 08:24:02 +02:00
3d-gussner d8dd8e49e5 Comment out "manual" xflash update as MK404 can do it now
directly from the hex file.
2021-05-03 07:00:15 +02:00
3d-gussner 2195116beb Add EN_ONLY support for MK404 2021-05-01 01:30:03 +02:00
3d-gussner 6ba8999607 Indentations 2021-04-29 19:23:52 +02:00
3d-gussner 90bc572154 Merge remote-tracking branch 'upstream/MK3_3.10.0' into MK3_MK404 2021-04-29 19:15:45 +02:00
3d-gussner 2ad0514d7c Save changes 2021-04-29 19:15:32 +02:00
DRracer eaa6801849
Merge pull request #3136 from leptun/PFW-1225_fix_open_file_from_sd_wrong_file
Fix menu_action_sdfile() check_file(filename) call
2021-04-29 16:34:01 +02:00
DRracer 80e248662c
Merge pull request #3079 from 3d-gussner/PFW-1189
PFW-1189 Pre-release tasks
2021-04-29 16:33:18 +02:00
3d-gussner fa134ee9f1 Update all po files 2021-04-29 15:41:47 +02:00
DRracer 89386036e6
Merge pull request #3137 from leptun/PFW-1239_fix_M23_subroutine_issue
Do not allow M23 to run subroutines
2021-04-29 15:06:33 +02:00
D.R.racer 8e35ab0699 Looks like the last CZ message 2021-04-29 14:40:35 +02:00
D.R.racer 6563a691ce ES missing translations 2021-04-29 13:57:56 +02:00
Yuri D'Elia a5e40079e5 lang-check: optionally check for missing translations 2021-04-29 12:52:17 +02:00
Yuri D'Elia a98bc1616a lang-check: add missing rulers 2021-04-29 12:51:57 +02:00
Yuri D'Elia 8edecc911b lang-check: Fix comment indentation 2021-04-29 12:43:26 +02:00
Yuri D'Elia 752d6c47f8 lang-check: use color names consistently 2021-04-29 12:35:10 +02:00
Yuri D'Elia 27d64b03fa More missing Italian translations 2021-04-29 12:29:29 +02:00
DRracer a3b392d96c
Merge pull request #3130 from DRracer/move-alldata-2-end
Move All Data into last position in Factory Reset menu
2021-04-29 10:08:32 +02:00
Voinea Dragos 8610d0a850 Do not allow M23 to run subroutines 2021-04-29 10:59:21 +03:00
D.R.racer 759451c7e3 PL "Community made" 2021-04-29 09:52:07 +02:00
3d-gussner b9ee74ba0e Update some French and Spanish missing translations 2021-04-29 09:22:29 +02:00
3d-gussner 2580733439 Another missing Spanish translation 2021-04-29 09:16:23 +02:00
DRracer 7c914ec2d1
Merge pull request #3125 from leptun/PFW-1238_fix_M105_from_SD
Fix M105 from SD
2021-04-29 09:12:05 +02:00
3d-gussner 6b0e5ba387 Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-04-29 09:02:23 +02:00
3d-gussner 07cc28e1c9 Updated few missing French Spanish translations 2021-04-29 09:01:44 +02:00
D.R.racer b77945263d IT temperatura 2021-04-29 09:01:37 +02:00
D.R.racer eccb9bb9df PL 2 2021-04-29 08:56:48 +02:00
D.R.racer ba90ee3e28 Add 2 missing translations for PL
still missing "Community made"
2021-04-29 08:55:45 +02:00
Voinea Dragos 1a70f3369d fix comment 2021-04-29 09:48:25 +03:00
Voinea Dragos d9976ca69c Fix menu_action_sdfile() check_file(filename) call 2021-04-29 09:47:16 +03:00
D.R.racer 4aba5b636c CZ Printer IP addr translation 2021-04-29 08:38:30 +02:00
D.R.racer a2326ff986 Merge branch 'PFW-1189' of github.com:3d-gussner/Prusa-Firmware into PFW-1189 2021-04-29 08:34:48 +02:00
D.R.racer 0e3d4932cf Add missing CZ translations 2021-04-29 08:34:31 +02:00
3d-gussner a9ae8ea731 Remove `SpoolJoin` from translations 2021-04-29 08:15:24 +02:00
3d-gussner 2421733b3e Update Dutch translation for `Cont.` as `Door.` 2021-04-29 07:50:08 +02:00
3d-gussner 7357bc0b3b Thanks to @vintagepc for reviewing Dutch translation 2021-04-28 20:33:48 +02:00
3d-gussner ef9748aa43 Update missing Dutch translations 2021-04-28 19:45:20 +02:00
3d-gussner 48dcbbb7b2 More missing German translations 2021-04-28 18:53:00 +02:00
3d-gussner c18243cb21 More missing German translations 2021-04-28 18:42:32 +02:00
3d-gussner 79a5dafd25 Update few missing German translations
Fix Italian "SpoolJoin" to `\x00`
2021-04-28 18:28:54 +02:00
3d-gussner 488d9d4b38 Remove "Firmware" from translations
deleted another unused "Firmware" define in language.h
2021-04-28 18:02:36 +02:00
3d-gussner d251f3980a Remove FlashAir from translations 2021-04-28 17:57:39 +02:00
3d-gussner b5ba4041d3 Remove FINDA from translations 2021-04-28 17:36:17 +02:00
3d-gussner 08566d4121 Remove PINDA from translations 2021-04-28 17:33:52 +02:00
3d-gussner 03c2f5482f Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-04-28 17:30:22 +02:00
3d-gussner 30b383195d Remove copy/paste error 2021-04-28 17:29:32 +02:00
Yuri D'Elia aee04a43e2 Redraw "Preheating to load" in full when modified by other actions
Check for lcd_draw_update to see if the lcd has been altered outside the
function and redraw the screen if full.

This fixes scenarios such as #3129 where the "Card removed" message or
the SD menu is entered from outside the function's control.

This requires checking/resetting bFilamentWaitingFlag carefully to avoid
re-entering this function _twice_ (raise_z_above will run the main
loop until complete).
2021-04-28 17:13:46 +02:00
D.R.racer e172eaeb92 Fix ES 2021-04-28 09:47:36 +02:00
D.R.racer 5089b2cddb Move All Data into last position in Factory Reset menu 2021-04-28 06:43:54 +02:00
3d-gussner 7a54c3638c Remove web links and `Prusa i3 MKxy OK.` from translations
as these never have been translated or doesn't make sense
to translate web links
2021-04-27 20:36:22 +02:00
3d-gussner 686054b95e Changed `x of 4` and `y of 9` to `x/4` and `y/4`
Added `Iteration` translation
2021-04-27 20:22:28 +02:00
3d-gussner 94b195123f Revert "Fix FR"
This reverts commit a2fa7d34c5.

Fixed with commits
b8ae08fd3d
738a24178a
2021-04-27 19:05:29 +02:00
3d-gussner 3983fe9ad6 Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-04-27 16:32:25 +02:00
D.R.racer a2fa7d34c5 Fix FR 2021-04-27 15:33:21 +02:00
D.R.racer c8266988c8 Fix PL 2021-04-27 12:52:25 +02:00
3d-gussner 738a24178a Update #MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=20 r=3 2021-04-27 07:45:36 +02:00
3d-gussner b8ae08fd3d Update `x of 4` and `x of 9` messages so longer text can be used. 2021-04-27 07:18:52 +02:00
3d-gussner b3c5d395d4 Update French translation MSG_RESUME_PRINT 2021-04-26 14:43:06 +02:00
3d-gussner 1145b231a9 Define MSG_SELFTEST_FS_LEVEL 2021-04-26 14:30:20 +02:00
3d-gussner af519626aa Define MSG_FS_V_04_OR_NEWER and MSG_FS_V_03_OR_OLDER c=14 2021-04-26 14:21:33 +02:00
Yuri D'Elia 900443286d lang-check: fancy ruler 2021-04-26 13:40:55 +02:00
3d-gussner c11e06b2d4 Fix character ruler for too many rows 2021-04-26 12:49:05 +02:00
3d-gussner b522ef4812 Update MSG_SEVER_SKEW and MSG_SLIGHT_SKEW message to c=14
Changed and tested Support-> "XYZ cal. details" LCD output
2021-04-26 12:39:13 +02:00
3d-gussner 79f6095bcc Add character ruler 2021-04-26 11:39:37 +02:00
3d-gussner 946675b444 Remove white spaces and shortn some messages (inspired by FR, IT) 2021-04-26 08:28:48 +02:00
3d-gussner 40c8f3e1ca Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-04-26 08:14:44 +02:00
3d-gussner 431c469688 Remove white spaces in cz,nl,pl translations 2021-04-26 08:14:05 +02:00
D.R.racer c843feee02 Fix some trailing whitespace and puctuation CZ 2021-04-26 08:07:51 +02:00
3d-gussner 536a8f5f87
Revert that has been commited by mistake 2021-04-26 07:28:03 +02:00
3d-gussner 466de83ae0 Remove white spaces in messags which saves ~62bytes 2021-04-26 07:22:22 +02:00
3d-gussner 127a8e4068 Fix typo in Spanish 2021-04-24 21:53:06 +02:00
3d-gussner 624827e51d Use same wording in Spanish translation for "knob" 2021-04-24 21:51:15 +02:00
3d-gussner 9cacb41cbf Fix French translation for MSG_MMU_LOAD_FAILS 2021-04-24 20:56:16 +02:00
3d-gussner a645b30f63 Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-04-24 20:52:59 +02:00
3d-gussner cf4d8f68f4
Update lang/lang_en_fr.txt
Co-authored-by: awenelo <56133692+awenelo@users.noreply.github.com>
2021-04-24 20:52:33 +02:00
3d-gussner 2c687a9223
Update lang/lang_en_fr.txt
Co-authored-by: awenelo <56133692+awenelo@users.noreply.github.com>
2021-04-24 20:50:51 +02:00
3d-gussner 29ad021b23 Updated French translation of MSG_MMU_LOAD_FAILED c=20 as @awenelo suggested 2021-04-24 20:50:01 +02:00
3d-gussner 6a52921e63 Use origin message for MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY also in French 2021-04-24 20:44:59 +02:00
3d-gussner fed80ebc73 Update French translation for MSG_SELECT_FILAMENT as @carlin57 suggested 2021-04-24 20:40:54 +02:00
3d-gussner ff2b292234 Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-04-24 20:40:21 +02:00
3d-gussner 93cabea391
Update lang/lang_en_fr.txt
Co-authored-by: awenelo <56133692+awenelo@users.noreply.github.com>
2021-04-24 20:39:47 +02:00
3d-gussner 43b16a95ce
Update lang/lang_en_fr.txt
Co-authored-by: awenelo <56133692+awenelo@users.noreply.github.com>
2021-04-24 20:39:29 +02:00
3d-gussner 1667e39a24
Update lang/lang_en_fr.txt
Co-authored-by: awenelo <56133692+awenelo@users.noreply.github.com>
2021-04-24 20:37:20 +02:00
3d-gussner 7d59e925be
Update lang/lang_en_fr.txt
Co-authored-by: awenelo <56133692+awenelo@users.noreply.github.com>
2021-04-24 20:36:21 +02:00
3d-gussner b5478e5557 Update French translation for MSG_BED_CORRECTION_MENU by @carlin57 2021-04-24 20:33:37 +02:00
3d-gussner c9c48a78e2
Update lang/lang_en_fr.txt
Co-authored-by: awenelo <56133692+awenelo@users.noreply.github.com>
2021-04-24 20:31:44 +02:00
3d-gussner 9f77ca31b8 Set MSG_SET_TEMPERATURE chars to c=20
Fix Italian warning shown by `lang-check.py`
2021-04-24 08:19:48 +02:00
3d-gussner e53f37729b Update German translation 2021-04-24 07:59:50 +02:00
Yuri D'Elia c536407ab0 Italian translation: remove trailing whitespace 2021-04-24 01:04:46 +02:00
Yuri D'Elia ceb1d2aaaf lang-check: handle/warn about trailing whitespace 2021-04-24 01:03:38 +02:00
Yuri D'Elia ecc375f94f lang-check: improve error strings 2021-04-24 00:16:46 +02:00
Yuri D'Elia 0d89e48827 Two Italian translation improvements 2021-04-24 00:05:45 +02:00
Yuri D'Elia e3ec295a0e lang-check: add checks for % escapes 2021-04-23 23:59:50 +02:00
Yuri D'Elia 0db2c5c28a lang-check: cleanup 2021-04-23 23:19:16 +02:00
Yuri D'Elia 5f0f6d740f lang-check: attempt at spotting short translations 2021-04-23 23:08:02 +02:00
Yuri D'Elia 68fc2c71bb lang-check: add basic punctuation checks 2021-04-23 22:49:27 +02:00
Yuri D'Elia 2ceb3897f1 lang-check: respect --no-warning 2021-04-23 22:49:00 +02:00
3d-gussner 4bb13ce582 Merge branch 'PFW-1189' into MK3_MK404 2021-04-23 20:11:49 +02:00
3d-gussner 722415703f Merge remote-tracking branch 'upstream/MK3_3.10.0' into MK3_MK404 2021-04-23 20:10:13 +02:00
3d-gussner 1a5898c673 Improve MK404-build.sh check, update 2021-04-23 20:09:20 +02:00
3d-gussner fe32d42101 Fix Dutch FINDA translation 2021-04-23 16:19:33 +02:00
Yuri D'Elia 201d2a2434 lang-check: handle backslash sequences 2021-04-23 16:15:24 +02:00
Marek Bel aa45091400
Scale extruder motor current linearly with speed. (#2813)
Scale extruder motor current linearly with speed.

49% less heating when running at low speed and standstill, 4% more torque at maximum extrusion rate (15mm^3/s), 15% more torque in high speed movements (un/retractions).

StealthChop mode is used for low speeds (below 900mm/min)
spreadCycle is used above. Transition speed is well above maximum extrusion rate of 15mm^3/s (275mm/min) so mode transition is not expected to be visible on printed surface.

StealthChop is expected to improve printed surface quality (less artifacts).

Warning you can burn extruder motor if it is not the same impedance as original Prusa i3 Extruder stepper motor. There is no current feedback in low speed so lower impedance motor can be burned by over current.

Even there is no direct current feedback, there is no risk for original motor thermal runaway, as motor resistance increases with temperature, current decreases.

Standstill peak phase current is expected to be 500 mA and linearly increase with speed to 970 mA at 900mm/min where spreadCycle constant current regulation takes over and keeps peak current at 805 mA to maximum speed possible.

As motor heating increases with current squared, lowering low speed current from 700mA to 500mA decreases heating 49% in thate mode, where motor spends most of the time.

Enable E-motor cool mode in farm mode only (and experimental menu) - the experimental menu is visible AND the EEPROM_ECOOL variable has a value of the universal answer to all problems of the universe - i.e. two conditions must be met at the start of the FW to enable the E-cool mode. If the user enables the experimental menu, sets the E-cool mode and disables the menu afterwards, on the next start of the FW the E-cool mode will be DISABLED. This is still subject to discussion how much obscure (security through obscurity) we'd like this option to have .

Additional stuff:
* Add serial debug msg to verify if E-cool mode is on
* Avoid access to E-cool mode switch on machines without TMC2130
* Do not allow only M907 E in case of E-cool mode+warn the user on the serial line that the command was skipped

Co-authored-by: D.R.racer <drracer@drracer.eu>
2021-04-23 16:06:28 +02:00
Yuri D'Elia 27d7edae10 lang-check: highlight truncated strings 2021-04-23 15:49:19 +02:00
Yuri D'Elia 7f9910ad28 Update Italian translations 2021-04-23 15:47:48 +02:00
Yuri D'Elia e4655e5afa lang-check: pretty-print errors to aid in translation 2021-04-23 15:31:01 +02:00
Yuri D'Elia 695af99ada lang-check: simplify wrapping, wrap according to cols 2021-04-23 15:31:01 +02:00
Yuri D'Elia 340928acc3 lang-check: print a warning if cols!=20 on multiline messages 2021-04-23 15:31:01 +02:00
3d-gussner 71ab3a9d53 Fix typo thanks to @wavexx 2021-04-23 14:20:28 +02:00
3d-gussner 540940b6a5 Fix German too long translation MSG_MMU_MODE 2021-04-23 13:36:12 +02:00
3d-gussner c2cde83d7e Fix MSG_SELFTEST_WIRINGERROR to c=18 2021-04-23 13:29:45 +02:00
3d-gussner 3f51627c02 Fix MSG_NO being too short, no need to be 2021-04-23 13:23:11 +02:00
3d-gussner 7cd76432b9 Fix German MSG_LOAD_TO_NOZZLE 2021-04-23 13:19:47 +02:00
3d-gussner 10a026e075 Fix Dutch + German MSG_UNLOAD_FILAMENT too long translations 2021-04-23 13:16:36 +02:00
3d-gussner 013708479f Fix MSG_UNLOAD_FILAMENT length as in MMU a number is added 2021-04-23 13:12:57 +02:00
3d-gussner 2281bd1ef7 Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-04-23 13:04:54 +02:00
3d-gussner 032e8a5957 @leptun strip 1st char hack for duplicate `Cancel` 2021-04-23 13:03:59 +02:00
D.R.racer 346044063a Fix length of some CZ messages 2021-04-23 12:48:25 +02:00
Yuri D'Elia 90a9e350c0 Remove warnings caused by '\x00'
Manually unescape '\x00' for the time being, removing spurious warnings.
2021-04-23 12:37:54 +02:00
Yuri D'Elia 2e6e2c4fde Do not output colors when redirecting output 2021-04-23 12:29:57 +02:00
Yuri D'Elia 8b5d01e3b1 Be more strict when checking translation lenght
Strip quotes immediately so that we can measure strings easily.
For single-line strings, check the translation lenght correctly.
2021-04-23 12:18:50 +02:00
Yuri D'Elia a9f0ff441d Allow to customize OUTDIR in config.sh
Useful for custom build trees.
2021-04-23 12:15:48 +02:00
3d-gussner 403b340f19 Added ` EXTENDED_M20` to RepRap Gcode wiki `M115` see https://reprap.org/mediawiki/index.php?title=G-code&type=revision&diff=189034&oldid=189033 2021-04-23 11:02:42 +02:00
Voinea Dragos 635bc442d6 Fix M105 from SD 2021-04-23 11:14:16 +03:00
DRracer b762a98c38
Merge pull request #3081 from 3d-gussner/MK3_Fix1_Dutch
Move Dutch removing part to correct loaction
2021-04-23 09:52:06 +02:00
3d-gussner 28aec049a2 Fix Typo in MSG_FIL_FAILED 2021-04-23 09:41:12 +02:00
3d-gussner ff9185d1bb Readded `>Cancel` as the `>` has some meaning. Sadly the previously 10bytes more free space are gone again 2021-04-23 08:50:50 +02:00
3d-gussner 044c0a0a6a Update "\04Refresh" message as two "abcd" "efgh" in one line cause issues in lang-build scripts 2021-04-23 08:49:22 +02:00
3d-gussner 8eeb177c7e Use textwarp to check the message length and rows
@DRracer: Added origial English text to the output, added cols and rows as well
2021-04-23 08:46:32 +02:00
3d-gussner e18d688b64 Fix merge issues 2021-04-22 20:48:26 +02:00
3d-gussner 681bc560c9 Merge remote-tracking branch 'upstream/MK3_3.10.0' into PFW-1189 2021-04-22 20:43:54 +02:00
DRracer be776f88f2
Merge pull request #3124 from prusa3d/MK3
Sync MK3 -> MK3_3.10.0
2021-04-22 13:31:56 +02:00
DRracer 999b93be35
Merge pull request #3123 from prusa3d/MK3_3.10.0
MK3 3.10.0
2021-04-22 12:53:26 +02:00
DRracer 00ce16ee55
Merge pull request #3121 from wavexx/reduce_m600_min_height
Revert/cleanup mininum extruder height during M600
2021-04-22 11:43:18 +02:00
DRracer 1e0fd8af87
Merge pull request #3120 from wavexx/fix_lcd_redraw_autoload
Fix partial redraw during filament autoload
2021-04-22 10:36:40 +02:00
DRracer 98643825dc
Merge pull request #3055 from awenelo/add-satin-sheet
Add satin sheets
2021-04-22 07:13:32 +02:00
Yuri D'Elia daef5428d2 Rework gcode_M600_filament_change_z_shift to make it consistent
gcode_M600_filament_change_z_shift is almost useless, since it performs
what is already been done internally by filament_unload().

However it *does* cause the carriage to raise earlier during unload
compared to making the user wait after "press for unload".

Change it so the calculated Z height matches MIN_Z_FOR_SWAP.
2021-04-21 19:12:26 +02:00
Yuri D'Elia 8d04316497 Revert/cleanup mininum extruder height during M600
This change restores the minimum extruder height for filament purge
during M600 from the current 50mm back to 27mm from FW 3.9.

We do this by introducing a new option for unload_filament() to indicate
that the unload is part of an automatic swap, and in such cases avoid
raising more than absolutely necessary (this will _also_ come in handy
to avoid the extra purge in PR #2318 during M600).

A new define MIN_Z_FOR_SWAP is introduced for this purpose.
MIN_Z_FOR_UNLOAD is still used for manual lcd unload and for M702 and
hasn't been changed.
2021-04-21 19:07:58 +02:00
Yuri D'Elia bc355674d9 Fix partial redraw during filament autoload
If the printer was already being pre-heated but didn't reach the target
temperature yet and a new filament is being inserted, the LCD used to
display a "Preheating to load" message to block the loading until the
extruder is hot.

This message is currently missing, and the ">Cancel" option doesn't
display immediately either, depending on the extruder height.

This PR fixes this behavior, which was broken during an earlier update.

We now force-update LCD updates during the first (and _only_) time the
screen is setup, and push all messages _before_ the carriage is
eventually raised, so that ">Cancel" is shown immediately as well.
2021-04-21 16:56:16 +02:00
DRracer bdeecd4fee
Merge pull request #3116 from prusa3d/MK3_3.10.0
Merge MK3_3.10.0
2021-04-21 16:22:22 +02:00
DRracer 84a9a5fd3f
Merge pull request #3113 from leptun/MK3_M20L_change_format
M20 L updated format and first implementation of timestamp reporting (M20 T)
2021-04-20 08:24:07 +02:00
Alex Voinea 7d82cab125
Update doxygen 2021-04-20 09:16:56 +03:00
Alex Voinea c4b70b82f3
Document M20 T parameter 2021-04-20 09:13:38 +03:00
Alex Voinea 1c0383c48f
Add capability report for extended M20 2021-04-20 09:03:22 +03: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
DRracer 10de97c042
Merge pull request #3110 from prusa3d/MK3_3.10.0
merge MK3_3.10.0 into MK3
2021-04-19 10:07:42 +02:00
Yuri D'Elia a5e4df390d Sync before/after setting mesh_bed_leveling_flag/homing_flag
mesh_bed_leveling_flag and homing_flag should be set only when the
planner is empty as a consequence of #3100, since any operation executed
*while* the mbl/homing flag is set is considered part of the compound
instruction that generated it (G80, G28, G30, G76).

Failure in doing so can result in instructions just prior being lost,
since they're incorrectly discarded (assumed to be redone).

G1  ; lost ..
G80 ; .. if PP happens here
2021-04-19 06:31:57 +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
3d-gussner f8bec339e2 Hack to get more flash and ram for MK404 debug 2021-04-18 20:28:08 +02:00
D.R.racer c43688a549 Version changed (3.10.0-RC2 build 4104) 2021-04-16 13:52:36 +02:00
DESKTOP-AFI832L\admin 5a91e1de4d Calibration: fix checking of scan of calibration points
PFW-1223
2021-04-14 06:25:18 +02:00
Voinea Dragos 7356cd0811 EEPROM_JOB_ID 2021-04-09 08:09:51 +02:00
DRracer f9f6284c50
Merge pull request #3100 from wavexx/powerpanic_state_fixes
Fix PowerPanic and Crash Detection during homing and bed leveling
2021-04-07 18:19:50 +02:00
Yuri D'Elia 61faa49cbb Fix buffer overflow in buf
Fix cmd overflow introduced in 186ce0f.

With a precision of %f being .6 and assuming a maximum (theoretical)
acceleration of 99999 we need 47 bytes including terminating byte.

Round it to 48
2021-04-07 15:57:50 +02:00
Alex Voinea d31601dcb8 Use correct mfrid for gd25q20c 2021-04-06 10:16:47 +02:00
Alex Voinea 94c1e65d83 Fix MK2.x builds 2021-04-06 10:16:47 +02:00
Alex Voinea 56948157d0 GD25Q40C xflash support 2021-04-06 10:16:47 +02:00
Alex Voinea 07bf4bbe48 Fix gd25120c rd_uid command 2021-04-06 10:16:47 +02:00
Alex Voinea 9454f9d8ec Rename w25x20cl to xflash 2021-04-06 10:16:47 +02:00
Yuri D'Elia 449d181971 G80: handle power panic
This is handled in the same way crash detection is handled: homing/mbl
invalidates saved_target _and_ current position.

Fixes PP recovery during MBL and homing.
2021-04-06 02:20:00 +02:00
Yuri D'Elia b46a52ffa8 G80: Handle crash detection
At a higher level, crash detection will repeat the last gcode command.

Some commands such as G28 or G80 need to be repeated in full and require
special handling.

In such cases, do not store the saved target coordinate (which is fake
in such cases) and invalidate the saved position.

This fixes the last coordinate of the first G1 move after recovery.

We also avoid moving from the origin when the saved position is
invalidated, which is not strictly necessary, but saves some time.
2021-04-06 02:00:47 +02:00
Yuri D'Elia a5530593fa G80: preserve lcd status and message when aborting
Restore the old status just before returning, so that the subsequent G80
can restore the first (initial) message correctly.
2021-04-06 00:31:56 +02:00
Yuri D'Elia 5923276a86 G80: correctly abort during crash detection
Crash detection is handled at a higher level (which automatically
repeats the current command), however we still need to abort the current
command correctly.

Handle XY crashes by checking the planner status after st_synchronize().
2021-04-06 00:31:29 +02:00
Yuri D'Elia 5da39df968 G80: Use consistent XY axis feedrate 2021-04-06 00:10:33 +02:00
Yuri D'Elia ce2e35d14d Move G80 into it's own function
No actual changes done in the function in this, besides break->return.

In G28, simply call the new function instead of using goto, making the
code more readable.

Also remove the senseless comments in G28 about command queuing (dating
back to when G80 was queued instead of being executed).
2021-04-05 23:35:17 +02:00
Yuri D'Elia d2be40491b PP recovery: clamp initial position to software endstops
As done when initializing the printer from a cold start, we need to
clamp the starting position to software endstops before setting the
planner position since 0,0 is frequently out-of-bounds.

This avoids an useless move during recovery that can cause a crash:

- Initial X is set to be 0
- G1 performed by homing will clamp X>=0, resulting in a positive shift
- If X is already at max X (extruder being parked due to PP), this will
  slam at X+, causing an immediate crash.
2021-04-05 22:11:06 +02:00
Yuri D'Elia 3276320a06 Hide tmc2130_sg_change behind DEBUG_CRASHDET_COUNTERS
tmc2130_sg_change is only used for debugging purposes.
Hide definition and usage behind the required define.
2021-04-05 20:07:03 +02:00
Yuri D'Elia 6a61c26955 Removed unused crashdet_stop_and_save_print2 2021-04-05 20:04:50 +02:00
3d-gussner b74e1d6062 Update RepRap url for `M123` 2021-04-01 19:48:14 +02:00
3d-gussner e12c1dde5c Updated RepRap Wiki and removed the @todos 2021-04-01 19:06:31 +02:00
3d-gussner 3b431bcbc1 Fix output "Y distance from min" by removing ":" so translations can use 20 chars 2021-03-31 08:54:16 +02:00
3d-gussner d864a5cfdb Define #MSG_PRINTER_IP c=18 2021-03-31 08:46:17 +02:00
3d-gussner 9922774fa7 Cleanup some comments ////c= 2021-03-31 08:11:19 +02:00
3d-gussner 8e74cbce58 Remove r=1 and some minor fixes 2021-03-31 08:07:42 +02:00
3d-gussner 84c3853351 Fix Dutch #MSG_FINDA c=5 2021-03-31 07:53:27 +02:00
3d-gussner fb691b44b4 Update #MSG_INFO_SENSORS c=18 2021-03-31 07:51:22 +02:00
3d-gussner 3fb90be46f Define #MSG_SELECT c=18 2021-03-31 07:50:18 +02:00
3d-gussner 9a0e67c1d7 Define #MSG_RENAME c=18 2021-03-31 07:43:48 +02:00
3d-gussner 15919a0f09 Define #MSG_NOZZLE_DIFFERS_CONTINUE c=20 r=5, #MSG_NOZZLE_DIFFERS_CANCELLED c=20 r=9 2021-03-31 07:41:21 +02:00
3d-gussner cdfc40fb62 Define #MSG_MODE_CHANGE_IN_PROGRESS c=20 r=3 2021-03-31 07:38:41 +02:00
3d-gussner c0869efc76 Define #MSG_MK3S_FIRMWARE_ON_MK3 c=20 r=4, #MSG_MK3_FIRMWARE_ON_MK3S c=20 r=4 2021-03-31 07:36:26 +02:00
3d-gussner 268d4020cf Define #MSG_FINDA c=5 and update #MSG_PINDA c=5 2021-03-31 07:32:43 +02:00
3d-gussner c0b8eef6cd Define #MSG_FALSE_TRIGGERING c=20 2021-03-31 07:29:42 +02:00
3d-gussner 1ca443f1f4 Define #MSG_CHECKS c=18 2021-03-31 07:28:18 +02:00
3d-gussner e470ee96c8 Update #MSG_BACK c=18 2021-03-31 07:26:41 +02:00
3d-gussner 5e049283be Define #MSG_UNKNOWN c=13 2021-03-31 07:24:41 +02:00
3d-gussner 67a0370332 Delete "Unload" as it isn't used anymore 2021-03-31 07:19:56 +02:00
3d-gussner 982153fee1 Define and update #MSG_PRINT_TIME c=19, #MSG_FILAMENT_USED c=19, #MSG_TOTAL_FILAMENT c=19, #MSG_TOTAL_PRINT_TIME c=19 2021-03-31 07:16:36 +02:00
3d-gussner 7a88ce89e4 Update MSG_TEMPERATURE c=18 2021-03-31 07:11:01 +02:00
3d-gussner c0df79d39a Define #MSG_SELECT_TEMP_MATCHES_MATERIAL c=20 r=4 2021-03-31 07:10:03 +02:00
3d-gussner 7268f6a824 Define #MSG_SELECT_FILAMENT c=20 2021-03-31 07:08:09 +02:00
3d-gussner 2e43234d3f Update #MSG_SUPPORT c=18 2021-03-31 07:06:46 +02:00
3d-gussner ba38262109 Update #MSG_STATISTICS c=18 2021-03-31 07:05:28 +02:00
3d-gussner 960ebac02d Update #MSG_SPEED c=15 2021-03-31 07:04:47 +02:00
3d-gussner b52d87e9a5 Define #MSG_Z-LEVELING_ENFORCED c=20 r=4 2021-03-31 07:02:42 +02:00
3d-gussner acbdc2ac8d Define #MSG_RUNOUTS c=7 2021-03-31 06:59:16 +02:00
3d-gussner 76e7032279 Update #MSG_SOUND_LOUD c=7 2021-03-31 06:54:51 +02:00
3d-gussner 09f4850a8a Define #MSG_SLIGHT_SKEW c=13, #MSG_SEVERE_SKEW c=13 2021-03-31 06:53:04 +02:00
3d-gussner 4749dd1750 Define #MSG_CHECK_IR_CONNECTION c=20 r=4 2021-03-31 06:46:43 +02:00
3d-gussner bd8ab39b39 Define #MSG_UNLOAD_FILAMENT_REPEAT c=20 r=4 2021-03-31 06:45:33 +02:00
3d-gussner 5280a89fba Define #MSG_MMU_INSERT_FILAMENT_FIRST_TUBE c=20 r=6 2021-03-31 06:43:21 +02:00
3d-gussner 0d48a32e87 Define #MSG_RESUME_NOZZLE_TEMP c=20 r=4 2021-03-31 06:41:17 +02:00
3d-gussner 4f394c8c5a Update #MSG_TUNE c=18, #MSG_PREHEAT c=18 2021-03-31 06:38:50 +02:00
3d-gussner fbecae1707 Update MSG_PREHEAT c=18 2021-03-31 06:38:06 +02:00
3d-gussner ac810bf03a Define #MSG_REMOVE_SHIPPING_HELPERS c=20 r=3 2021-03-31 06:36:28 +02:00
3d-gussner 00b100bf26 Define #MSG_NOZZLE_FAN c=10, #MSG_PRINT_FAN c=10 2021-03-31 06:30:00 +02:00
3d-gussner baf231b0f1 Update MSG_NO_CARD c=18 2021-03-31 06:23:18 +02:00
3d-gussner 742b9e9197 Fix #MSG_CRASHDETECT c=13 in Polish lang file 2021-03-30 19:34:10 +02:00
3d-gussner 1c09e8411d Define #MSG_PINDA c=6 and remove duplicate saved 8 bytes 2021-03-30 19:30:26 +02:00
3d-gussner 6a266d497b Define #MSG_REMOVE_TEST_PRINT c=20 r=4 2021-03-30 19:19:43 +02:00
3d-gussner 5fcc731be1 Define #MSG_INSERT_FIL c=20 r=6 2021-03-30 19:17:48 +02:00
3d-gussner 243fa68745 Define #MSG_LIN_CORRECTION c=18 2021-03-30 19:16:11 +02:00
3d-gussner 44f7be134d Define #MSG_FS_VERIFIED c=20 r=3 2021-03-30 19:13:31 +02:00
3d-gussner bcdaecb46d Define #MSG_TO_LOAD_FIL c=20, #MSG_TO_UNLOAD_FIL c=20, #MSG_PRESS_KNOB c=20 2021-03-30 19:10:56 +02:00
3d-gussner de9697b913 Define #MSG_PREHEATING_TO_LOAD/UNLOAD/CUT/EJECT c=20 2021-03-30 19:06:46 +02:00
3d-gussner d601355d40 Define #MSG_GCODE_NEWER_FIRMWARE_CONTINUE c=20 r=5, #MSG_GCODE_NEWER_FIRMWARE_CANCELLED c=20 r=8 2021-03-30 19:01:24 +02:00
3d-gussner 669ab0f7f7 Define #MSG_GCODE_DIFF_CONTINUE c=20 r=4, #MSG_GCODE_DIFF_CANCELLED c=20 r=7 2021-03-30 18:58:04 +02:00
3d-gussner e9750a7312 Update #MSG_FIL_FAILD c=20 r=5 2021-03-30 18:52:58 +02:00
3d-gussner 4a5d7bc6b7 Define #MSG_Y_DIST_FROM_MIN c=20 2021-03-30 18:51:04 +02:00
3d-gussner 2abdfeb4c5 Update #MSG_YES c=3 2021-03-30 18:48:14 +02:00
3d-gussner 7f3fe6740b Update #MSG_NO_MOVE c=20 2021-03-30 18:46:56 +02:00
3d-gussner 1a1a1d88a7 Update MSG_MOVE_X/Y/Z c=18 2021-03-30 18:13:49 +02:00
3d-gussner c1f22a5239 Update #MSG_MOVE_AXIS c=18 2021-03-30 18:12:03 +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 4d9dffb042 Define #MSG_MEASURED_SKEW c=13 2021-03-30 18:06:43 +02:00
3d-gussner 1e2dde9a52 Update #MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 c=20 r=3 2021-03-30 18:02:27 +02:00
3d-gussner afb7c82e26 Update #MSG_LOAD_TO_NOZZLE c=18 2021-03-30 18:00:20 +02:00
3d-gussner 2408bc9f2e Update MSG_LOADING_COLOR c=20 2021-03-30 17:58:51 +02:00
3d-gussner 62ecbb3ae3 Update #MSG_BABYSTEP_Z c=18 2021-03-30 17:57:50 +02:00
3d-gussner 50e69fcca8 Update #MSG_NO c=3 2021-03-30 17:53:58 +02:00
3d-gussner 75c0de741b Update #MSG_AUTO_DEPLETE c=13 2021-03-30 17:52:59 +02:00
3d-gussner ddf47a3cac Update #MSG_NA c=3, #MSG_OFF c=3, #MSG_ON c=3 2021-03-30 17:51:31 +02:00
3d-gussner d1813890a8 Update #MSG_STOPPED c=20 2021-03-30 17:49:02 +02:00
3d-gussner a9ed513979 Update #MSG_STOP_PRINT c=18 2021-03-30 17:48:06 +02:00
3d-gussner 46367c2a33 Update #MSG_STEALTH c=7, #MSG_SILENT c=7, #MSG_NORMAL c=7 2021-03-30 17:46:37 +02:00
3d-gussner 3d848328ed Update #MSG_AUTO_POWER c=10 2021-03-30 17:42:33 +02:00
3d-gussner 8771519880 Update #MSG_HIGH_POWER c=10 2021-03-30 17:41:51 +02:00
3d-gussner afabfa789d Update #MSG_MODE c=6 2021-03-30 17:41:09 +02:00
3d-gussner dc56b74263 Update #MSG_MODE c=9 2021-03-30 17:39:43 +02:00
3d-gussner 2a08a6e441 Update #MSG_SELFTEST_WIRINGERROR c=17 2021-03-30 17:37:50 +02:00
3d-gussner e6ea843e62 Update #MSG_SELFTEST_MOTOR c=18 2021-03-30 17:36:39 +02:00
3d-gussner 35b000faea Update MSG_RESUMING_PRINT c=20 2021-03-30 17:34:36 +02:00
3d-gussner 557486ee0b Update MSG_REFRESH c=18 2021-03-30 17:34:00 +02:00
3d-gussner 54f594238b Update #MSG_NOZZLE c=12 2021-03-30 17:33:15 +02:00
3d-gussner a878056be3 Update MSG_BACK c=18 2021-03-30 17:32:04 +02:00
3d-gussner 610ba9bc45 Update #MSG_CARD_MENU c=18 2021-03-30 17:31:18 +02:00
3d-gussner 5eb14dc433 Update #MSG_MAGNETS_COMP c=13 2021-03-30 17:29:56 +02:00
3d-gussner 12372d6525 Update #MSG_Z_PROBE_NR c=14 2021-03-30 17:28:43 +02:00
3d-gussner 7e2c272839 Update #MSG_MESH c=12 2021-03-30 17:27:02 +02:00
3d-gussner bc8a23a0c6 Update #MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY c=8 2021-03-30 17:25:35 +02:00
3d-gussner 3367d7f8fa Update #MSG_SD_CARD c=8 2021-03-30 17:24:45 +02:00
3d-gussner e8c3ba89dc Update #MSG_MMU_MODE c=8 2021-03-30 17:23:29 +02:00
3d-gussner 532c7438d8 Update #MSG_NOZZLE_DIAMETER c=10, MSG_GCODE c=8 2021-03-30 17:19:00 +02:00
3d-gussner 0a634f7d48 Update #MSG_FIRMWARE c=8 2021-03-30 17:16:31 +02:00
3d-gussner 39b8a35f3a Update #MSG_MODEL c=8 2021-03-30 17:15:48 +02:00
3d-gussner 5b843c3a4d Update #MSG_STRICT c=8 2021-03-30 17:14:49 +02:00
3d-gussner f60ba6de87 Update #MSG_WARN c=8 2021-03-30 17:13:56 +02:00
3d-gussner b465c96327 Update #MSG_NONE c=8 2021-03-30 17:13:09 +02:00
D.R.racer cdcc06f376 SDFile - fix errorneous offset computation
... my fault, I was originally too optimistic about the overflow

Fixes #3077

PFW-1233
2021-03-30 11:33:42 +02:00
DRracer a251dcc14e
Merge pull request #3064 from 3d-gussner/PFW-1222
PFW-1222: Disable M120 M121
2021-03-30 10:09:47 +02:00
DRracer e76b0c40a8
Merge pull request #3066 from espr14/PFW-1223
Calibration: detect biased PINDA and retry calibration PFW-1223
2021-03-30 10:08:16 +02:00
3d-gussner c4f80642b3 Update #MSG_MAIN c=18 2021-03-30 09:52:52 +02:00
3d-gussner 4417deb9ea Update #MSG_SOUND_BLIND c=7, #MSG_SOUND_LOUD c=7, MSG_SOUND_ONCE c=7 2021-03-30 09:50:21 +02:00
3d-gussner e4ed1ffc17 Update #MSG_SOUND c=9 2021-03-30 09:46:20 +02:00
3d-gussner 2ce5d3a840 Update #MSG_RPI_PORT c=13 2021-03-30 09:44:13 +02:00
3d-gussner 2ca8a23e4a Update #MSG_SORT_ALPHA c=8 #MSG_SORT_TIME c=8 2021-03-30 09:42:53 +02:00
3d-gussner c85ebb4aa3 Update #MSG_SORT c=7 2021-03-30 09:40:26 +02:00
3d-gussner 440ec49a36 Update #MSG_SETTINGS c=18 2021-03-30 09:38:33 +02:00
3d-gussner 6900c206cd Define #MSG_SEL_PREHEAT_TEMP c=20 r=6 2021-03-30 09:36:32 +02:00
3d-gussner 12dc48ff1a Update #MSG_BELTTEST c=18 2021-03-30 09:34:41 +02:00
3d-gussner b697117654 Update #MSG_SELFTEST c=18 2021-03-30 09:33:49 +02:00
3d-gussner 9bc702ae0a Update #MSG_SELFTEST_OK c=20 2021-03-30 09:32:27 +02:00
3d-gussner 00fedbb08a Update MSG_LANGUAGE_SELECT c=18 2021-03-30 09:30:04 +02:00
3d-gussner 164226c739 Define #MSG_RIGHT c=10 2021-03-30 09:29:07 +02:00
3d-gussner 2daf1d9114 Define #MSG_LEFT c=10 2021-03-30 09:26:50 +02:00
3d-gussner 169f8983b6 Define #MSG_ADDITIONAL_SHEETS c=20 r=9 2021-03-30 09:23:35 +02:00
3d-gussner a82ca3def4 Update #MSG_WATCH c=18 2021-03-30 09:21:50 +02:00
3d-gussner 0139bb5a5e Update #MSG_CHANGE_SUCCESS c=20 2021-03-30 09:20:57 +02:00
3d-gussner 0e86ab88fd Update #MSG_FILAMENTCHANGE c=18 2021-03-30 09:20:01 +02:00
3d-gussner 9c0300df66 Update #MSG_HEATING c=20 2021-03-30 09:18:11 +02:00
3d-gussner 280a3c4d3a Update #MSG_PRUSA3D_HOWTO c=18 2021-03-30 09:16:14 +02:00
3d-gussner 12bd2f1a09 Update #MSG_PRUSA3D c=18 2021-03-30 09:15:21 +02:00
3d-gussner 4e4fb7a59f Update #MSG_PRUSA3D_FORUM c=18 2021-03-30 09:14:20 +02:00
3d-gussner 10c586b577 Update #MSG_FLOW c=15 2021-03-30 09:13:09 +02:00
3d-gussner db07d55c29 Define #MSG_MMU_FIX_ISSUE c=20 r=4 2021-03-30 09:11:19 +02:00
3d-gussner 7c9891d85e Update #MSG_FSENSOR c=12 2021-03-30 09:09:11 +02:00
3d-gussner 7a99f63ffd Define #MSG_FAIL_STATS c=18 2021-03-30 09:06:59 +02:00
3d-gussner d427563e2b Define #MSG_MMU_FAIL_STATS c=18 2021-03-30 09:05:18 +02:00
3d-gussner 1b4241f031 Update #MSG_ERROR c=10 2021-03-30 09:03:38 +02:00
3d-gussner 1b8ca77b0c Define #MSG_MMU_CUTTING_FIL c=18 2021-03-30 09:01:58 +02:00
3d-gussner b6031c02a8 Update #MSG_DISABLE_STEPPERS c=18 2021-03-30 08:59:27 +02:00
3d-gussner 69b9acdfc1 Define #MSG_CRASH_RESUME c=20 r=3 2021-03-30 08:57:42 +02:00
3d-gussner 411caddc55 Define #MSG_CHOOSE_FIL_1ST_LAYERCAL c=20 r=7 2021-03-30 08:14:46 +02:00
3d-gussner 2d2dc23e81 Define #MSG_CALIBRATING_HOME c=20 2021-03-30 08:12:20 +02:00
3d-gussner c8af50d344 Define #MSG_COPY_SEL_LANG c=20 r=3 2021-03-30 08:09:08 +02:00
3d-gussner 71638b49fc Update #MSG_COOLDOWN c=18 2021-03-30 08:05:54 +02:00
3d-gussner 5f9b66a23a Update #MSG_NOT_COLOR c=19 2021-03-30 08:04:39 +02:00
3d-gussner 02ff05639b Define MSG_CHECKING_FILE c=17 2021-03-30 08:01:26 +02:00
3d-gussner f2298b1a46 Update #MSG_SD_REMOVED c=20 2021-03-30 07:57:42 +02:00
3d-gussner 1e2f5c8323 Update #MSG_MENU_CALIBRATION c=18 2021-03-30 07:55:19 +02:00
3d-gussner 3733c42d38 Update #MSG_HOMEYZ_DONE c=20 2021-03-30 07:54:11 +02:00
3d-gussner 79aa6b198d Update #MSG_HOMEYZ c=18 2021-03-30 07:52:24 +02:00
3d-gussner fa0382fd3e Update #MSG_CALIBRATE_BED c=18 2021-03-30 07:50:54 +02:00
3d-gussner 2985c6bd6b Update #MSG_BED c=13 2021-03-30 07:49:37 +02:00
3d-gussner 7c906dd0b1 Update #MSG_BED_CORRECTION_MENU c=18 2021-03-30 07:44:16 +02:00
awenelo d8996af574
minor changes
Comment out "Please, before you create a new bug report, please make sure you searched in open and closed issues and couldn't find anything that matches."
Fix capitalization on MMU upgrade
Add space before dash for Printer firmware version
Add ** for bolding at the end of MMU upgrade firmware version
Add - to MMU upgrade firmware version
2021-03-22 14:02:49 -04:00
3d-gussner b505dae90d Move Dutch removing part to correct loaction 2021-03-22 18:33:43 +01:00
3d-gussner 4d464b79f4 Update MSG_BED_HEATING c=20 2021-03-20 17:30:44 +01:00
3d-gussner 3ee23af7b7 Update MSG_BED_DONE c=20 2021-03-20 16:04:52 +01:00
3d-gussner ba0f2b2501 Update MSG_LOOSE_PULLEY c=20 2021-03-20 07:11:41 +01:00
3d-gussner 3fcc81ebdb Update MSG_SELFTEST_ENDSTOP c=16 2021-03-20 07:11:07 +01:00
3d-gussner 17df4e1c8d Update MSG_SELFTEST_ENDSTOPS c=20 2021-03-20 07:10:09 +01:00
3d-gussner 4a6c53daf8 Update MSG_SELFTEST_PLEASECHECK c=20 2021-03-20 07:09:33 +01:00
3d-gussner b3d3feef4d Update MSG_SELFTEST_ERROR c=20 2021-03-20 07:08:48 +01:00
3d-gussner 5d167ce813 Update MSG_SELFTEST_NOTCONNECTED c=20 2021-03-20 07:08:20 +01:00
3d-gussner 625604d704 Update MSG_SELFTEST_HEATERTHERMISTOR c=20 2021-03-20 07:07:14 +01:00
3d-gussner b86ad11b68 Update MSG_SELFTEST_BEDHEATER c=20 2021-03-20 07:06:37 +01:00
3d-gussner b3b062e4ba Update MSG_SELFTEST_SWAPPED c=16 2021-03-20 07:05:47 +01:00
3d-gussner b6684f6114 Update MSG_SELFTEST_AXIS c=16 2021-03-20 07:05:03 +01:00
3d-gussner bc9f6b6ae6 Update MSG_SELFTEST_AXIS_LENGTH c=20 2021-03-20 07:03:47 +01:00
3d-gussner 83cbfda113 Update MSG_AUTO_HOME c=18 2021-03-20 07:02:43 +01:00
3d-gussner fe1b4e50be Update MSG_AMBIENT c=14 2021-03-20 06:59:54 +01:00
3d-gussner 178fe36dc7 Create MSG_CANCEL c=9
Delete ">Cancel"
Samed 10 bytes
Updated MSG_MEASURED_OFFSET c=20
2021-03-20 06:30:26 +01:00
3d-gussner 1c965cd988 Update MSG_MEASURED_OFFSET c=20 2021-03-20 06:18:41 +01:00
3d-gussner 92acac453f Update MSG_MMU_POWER_FAILS c=15 2021-03-20 06:16:11 +01:00
3d-gussner dd67c5110a Fix some Dutch translations 2021-03-20 06:09:52 +01:00
3d-gussner 0819a9ba35 Fix too long Dutch translation 2021-03-20 05:49:43 +01:00
3d-gussner 746761b193 Update MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20
Fix Dutch translation to fit in 20 chars
2021-03-19 18:52:32 +01:00
3d-gussner 2a848923ea Update MSG_BED_LEVELING_FAILED_POINT_LOW c=20 r=6
as Dutch translation is longer
2021-03-19 18:50:29 +01:00
3d-gussner baabc0bd1e Fix typo "didnt" to "didn't" 2021-03-19 18:49:13 +01:00
3d-gussner b806c017cb Update MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR c=20 r=6
as Polish translation is longer
2021-03-19 18:47:58 +01:00
3d-gussner 542ff58529 Update MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR c=20 r=6
as Polish translation is longer
2021-03-19 18:47:09 +01:00
3d-gussner 147fddd060 Update MSG_CALIBRATE_BED_RESET c=18 2021-03-19 18:41:01 +01:00
3d-gussner 6300211268 Update MSG_PLACE_STEEL_SHEET c=20 r=5
as Italian translation is longer
2021-03-19 18:37:23 +01:00
3d-gussner 79a148bb14 Update #MSG_DEFAULT_SETTINGS_LOADED c=20 r=6
as Italian translation is longer
2021-03-19 18:34:39 +01:00
3d-gussner 8378ea8f83 Update MSG_NEW_FIRMWARE_AVAILABLE c=20 r=2 2021-03-19 18:20:31 +01:00
3d-gussner 9e60953d44 Update "G-code sliced for a newer firmware. Please update the firmware. Print cancelled."
as French translation is longer
2021-03-19 18:14:03 +01:00
3d-gussner a09f2c2f2d Update "G-code sliced for a newer firmware. Continue?"
as French translation is longer
2021-03-19 18:12:16 +01:00
3d-gussner 9ed4efe5dc Update "G-code sliced for a different level. Please re-slice the model again. Print cancelled."
as French translation is longer
2021-03-19 18:10:13 +01:00
3d-gussner 41022d7d60 Update "Choose a filament for the First Layer Calibration and select it in the on-screen menu."
as French translation is longer
2021-03-19 18:07:04 +01:00
3d-gussner c82c72a937 Fix too long Spanish translation 2021-03-19 18:03:58 +01:00
3d-gussner 813aabab56 Update "Select nozzle preheat temperature which matches your material." c=20 r=6
as Spanish translation is longer
2021-03-19 18:03:06 +01:00
3d-gussner 65e389b6fd Fix too long German translations 2021-03-19 18:01:06 +01:00
3d-gussner d52a7326be Update "Please insert filament into the extruder, then press the knob to load it." c=20 r=6
as German translation is longer
2021-03-19 17:55:03 +01:00
3d-gussner cc29a9485e Update "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." c=20 r=9
as German translation is longer
2021-03-19 17:52:54 +01:00
3d-gussner 03a13ace5a Update "Printer nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled." c=20 r=9
as French translation is longer
2021-03-19 17:47:35 +01:00
3d-gussner 17c015f5c0 Update "Printer nozzle diameter differs from the G-code. Continue?" c=20 r=5 2021-03-19 17:44:07 +01:00
3d-gussner ba9e26f444 Update #MSG_GCODE_DIFF_PRINTER_CANCELLED c=20 r=8 2021-03-19 17:37:24 +01:00
3d-gussner 1bba2255c1 Update MSG_WAITING_TEMP c=20 r=4 2021-03-19 17:34:15 +01:00
3d-gussner 787b6111e5 Fix too long translations in MSG_USERWAIT c=20 2021-03-19 17:32:49 +01:00
3d-gussner bab4994b89 Update #MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 c=20 r=2 2021-03-19 16:52:24 +01:00
3d-gussner 6a54196862 Update "Now remove the test print from steel sheet." c=20 r=4 2021-03-19 16:42:21 +01:00
3d-gussner 8cbf0b3318 Update "Crash detected. Resume print?" c=20 r=2 2021-03-19 16:38:53 +01:00
3d-gussner 891861d475 Update "G-code sliced for a different level. Continue?" c= r= values 2021-03-19 16:35:53 +01:00
3d-gussner f9a92e2277 Update "Y distance from min" c=20 2021-03-19 16:32:13 +01:00
3d-gussner 1f6834204f Update "Select filament:" c= value 2021-03-19 16:30:04 +01:00
3d-gussner cdd1d302fd Update MSG_PLEASE_LOAD_PLA c=20 r=4 2021-03-19 16:24:04 +01:00
3d-gussner cbe2a4d301 Update MSG_CHECK_IDLER c=20 r=5 2021-03-19 16:22:05 +01:00
3d-gussner 4dc99d970d Update "MMU needs user attention." c= r= values 2021-03-19 16:17:26 +01:00
3d-gussner 0928c3d133 Update "Lin. correction" c=18 2021-03-19 16:14:16 +01:00
3d-gussner ce42f2c2a5 Update MSG_BED_HEATING_SAFETY_DISABLED c=20 r=4 2021-03-19 16:11:42 +01:00
3d-gussner 5f9d6a0401 Update "Fail stats" c=18 2021-03-19 16:08:57 +01:00
3d-gussner 878200ecae Update "Fail stats MMU" c=18 2021-03-19 16:06:54 +01:00
3d-gussner 6691f67e7d Fix too long #MSG_RECOVER_PRINT translations 2021-03-19 16:00:58 +01:00
3d-gussner 5cbb5b0e17 Update "Printer nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled." c= r= values 2021-03-19 15:53:36 +01:00
3d-gussner c39b22724d Update "G-code sliced for a different level. Please re-slice the model again. Print cancelled." c= r= values 2021-03-19 15:51:10 +01:00
3d-gussner 65f35e25b8 Update MSG_WIZARD_V2_CAL_2 c=20 r=12 2021-03-19 15:48:52 +01:00
3d-gussner 5a36b49cee Update "Select temperature which matches your material." c= r= values 2021-03-19 15:45:32 +01:00
3d-gussner 41db8eed30 Update "Select nozzle preheat temperature which matches your material." c= r= values 2021-03-19 15:42:17 +01:00
3d-gussner f319dede23 Update "Please insert filament into the first tube of the MMU, then press the knob to load it." c= r= values 2021-03-19 15:39:57 +01:00
3d-gussner 286c1931a5 Update #MSG_WIZARD_LOAD_FILAMENT c=20 r=5 2021-03-19 15:33:13 +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 b001eaec8d Update "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." c= r= values 2021-03-19 15:24:28 +01:00
3d-gussner 18a58c504d Update #MSG_BED_HEATING_SAFETY_DISABLED c=20 r=3 2021-03-19 15:21:42 +01:00
3d-gussner ee8c9227cf Update #MSG_SELFTEST_FANS c=20 2021-03-19 15:16:23 +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
3d-gussner 0c18ddcb10 Update "Choose a filament for the First Layer Calibration and select it in the on-screen menu." c= r= values 2021-03-19 15:10:18 +01:00
3d-gussner 89900a5109 Update "G-code sliced for a newer firmware. Please update the firmware. Print cancelled." c= r= values 2021-03-19 15:07:14 +01:00
3d-gussner 49e8f84916 Update "G-code sliced for a newer firmware. Continue?" c= r= values 2021-03-19 15:02:53 +01:00
3d-gussner fd7aa82dce Update MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND c=20 r=6 2021-03-19 15:00:00 +01:00
3d-gussner 1ed7d8fc4b Update MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR c=20 r=5 2021-03-19 14:42:17 +01:00
3d-gussner dbec06086c Update MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR c=20 r=5 2021-03-19 14:40:04 +01:00
3d-gussner 83d73b9ac0 Remove unused messages from Dutch translation 2021-03-19 14:35:31 +01:00
3d-gussner 37ec18596b Update #MSG_USERWAIT c= value 2021-03-19 14:29:15 +01:00
3d-gussner dd4c02aa15 Update "Heating disabled by safety timer." c= r= values 2021-03-19 14:23:46 +01:00
3d-gussner 9a719fd0b9 Update "Calibrating home" c= value 2021-03-19 14:17:30 +01:00
3d-gussner 693f8d54cf Merge branch 'PFW-1189' of https://github.com/3d-gussner/Prusa-Firmware into PFW-1189 2021-03-19 14:11:38 +01:00
3d-gussner 6d3f76638e Remove duplicate `PINDA` in translations 2021-03-19 14:11:11 +01:00
3d-gussner e0f0aecee8 Delete unused translation 2021-03-19 14:11:11 +01:00
3d-gussner 1ade96bbeb Delete unused `Sensor state` translation 2021-03-19 14:11:11 +01:00
3d-gussner de51d10694 Delete unused `IR:` translation 2021-03-19 14:11:11 +01:00
3d-gussner 38e7779f1f Fix `PINDA` translation 2021-03-19 14:11:11 +01:00
3d-gussner 3bf938f052 Delete unused translations 2021-03-19 14:11:10 +01:00
3d-gussner 02e5000efa Fix `FINDA` translation 2021-03-19 14:11:10 +01:00
DRracer 8ac1d5b95e
Attempt to workaround the M73 C0|D0 visual issue (#3067)
Attempt to workaround the M73 C0|D0 visual issue

This is an attempt to enable alternation of time to print finish and time
to color change even in the last minute of time to color change, i.e. be
able to print "0:00C".

The proposed solution leverages the capability of the current FW to read
float values from the C|D parameter. This could have the raw benefit of
being able still to alternate this time on the LCD as "0:00C" (or
"<1min") if the slicer sends a non-zero but <1 time right before the
color change.

Co-authored-by: D.R.racer <drracer@drracer.eu>
Co-authored-by: 3d-gussner <3d.gussner@gmail.com>
2021-03-19 10:18:28 +01:00
3d-gussner 1259e68d11
Add Contributors 2021-03-18 11:33:15 +01:00
3d-gussner fc30b83b39
Update Contributors 2021-03-18 11:27:52 +01:00
3d-gussner 2851e531eb
Fix link to Prusa MK3 branch 2021-03-18 11:22:27 +01:00
3d-gussner 2ed31ea1ee
Update link 2021-03-18 11:21:17 +01:00
3d-gussner 2a6cecbb07 Add Community_made.md 2021-03-18 11:17:50 +01:00
3d-gussner 48163ad5cc
remove `head` 2021-03-18 06:35:03 +01:00
3d-gussner 84f4f9fd86
Format 2021-03-18 06:33:48 +01:00
3d-gussner 210440eeb4 Init 2021-03-18 06:28:47 +01:00
3d-gussner 4e6fd2a92d fix merge issue 2 2021-03-17 18:42:39 +01:00
3d-gussner 0f771b1218 Merge remote-tracking branch 'upstream/MK3' into MK3_MK404
Fix merge
2021-03-17 18:33:54 +01:00
D.R.racer f31189e5be Version changed (3.10.0-RC1 build 4078) 2021-03-17 12:30:54 +01:00
espr14 99206884b5 Calibration: detect biased PINDA and retry calibration
PFW-1223
2021-03-12 05:04:49 +01:00
3d-gussner 6355458052 Add def `M120_M121_ENABLED` to `Configuration_adv.h` 2021-03-11 15:00:49 +01:00
3d-gussner 832e881955 Disable M120 M121 2021-03-10 17:46:19 +01:00
espr14 eb4cf1a77f Calibration: return XY back after Z search
PFW-1217
2021-03-10 10:27:57 +01:00
awenelo 9b21ebd376 Fix numbering for custum sheet hex values 2021-03-07 12:14:03 -05:00
awenelo 09b3632d43 Final changes + cleanup 2021-03-07 09:44:33 -05:00
awenelo 144fc197a5 Fix index number 2021-03-06 14:20:06 -05:00
awenelo c777199d34 Simplify sheet numbering 2021-03-06 13:26:28 -05:00
DRracer 6489c6f17f
Merge pull request #3036 from wavexx/remove_is_buffer_empty
Remove duplicate function is_buffer_empty()
2021-03-05 08:28:40 +01:00
DRracer 29abff55ba
Merge pull request #3050 from leptun/optiboot_updates
Additional Optiboot fixes
2021-03-05 08:27:02 +01:00
awenelo 53a3772f09 Add satin sheet 2021-03-04 10:14:29 -05:00
Alex Voinea f0eedf301d
optiboot: check boot_app_magic as well before early exit 2021-03-03 16:31:55 +02:00
Alex Voinea c951bea627
Remove unused/broken bootapp code 2021-03-03 16:31:30 +02:00
Alex Voinea c95d2fcbd7
Use avr-libc wdt library 2021-03-03 16:31:06 +02:00
DRracer 073cbe0339
Merge pull request #3048 from DRracer/bootappflags-bad-addr
Fix flashing languages with inline wdr instructions
2021-03-03 13:46:08 +01:00
Alex Voinea 8ced0579d6
Move SerialHead declaration outside of loops 2021-03-03 14:35:37 +02:00
DRracer c1849f5cc2
Merge pull request #2405 from leptun/MK3_NEW_SD_COMPILATION
️New SD menu
2021-03-03 11:45:04 +01:00
Alex Voinea 026145b78b
Fix CFM message end pointer 2021-03-03 12:31:14 +02:00
D.R.racer 3922bf2877 Fix flashing languages with inline wdr instructions
A fairly mysterious situation happened recently in the MK3 branch.
After merging #3033 (change watchdogReset() into a single inline wdr instruction)
we were unable to flash languages.

Since it looked similarly suspicious like issue #2954 we started investigating deeply.
The problem was in the code as described in the comment in this PR.
2021-03-03 11:19:39 +01:00
DRracer a5a83038fe
Merge pull request #2223 from 3d-gussner/MK3_Dutch
PFW-1212: Add Dutch language
2021-03-02 08:27:27 +01:00
3d-gussner 45500d2e29 Run `lang-community.sh` in build.sh 2021-03-02 07:29:39 +01:00
3d-gussner 7fa93dfa1b Fix back from submenu `Community made` to `Select language` after factory reset 2021-03-01 09:18:47 +01:00
3d-gussner fbcbba78a3 Merge remote-tracking branch 'upstream/MK3' into MK3_Dutch 2021-03-01 09:04:10 +01:00
3d-gussner bd50eea758 Update po files 2021-03-01 08:46:16 +01:00
3d-gussner 9f242b7b06 Add template 2021-03-01 08:41:31 +01:00
3d-gussner 1582477926 Fix indentation 2021-03-01 08:39:26 +01:00
3d-gussner 70912e387e Update 2021-03-01 08:33:32 +01:00
3d-gussner 2cfe65f880 Update lang translation files 2021-03-01 08:32:08 +01:00
3d-gussner 779c8d0a78 Move `Dutch` language parts
Not create community languages with `lang-build.sh all` the `lang-community.sh` will call it.
Add templates for future community languages
2021-03-01 08:28:08 +01:00
DRracer e9c3becb2c
Merge pull request #2572 from wavexx/fwretract_plan_sync
Always sync before manipulating the planner position in FWRETRACT
2021-03-01 08:26:57 +01:00
3d-gussner 6ebdb004ab Add `lang-community.sh` script
Fix `Dutch` hex file copied in `PF-build.sh` for MK2.5/S
2021-03-01 08:25:33 +01:00
3d-gussner 6d7d9089f7 Add defines and templates for community languages
Add `Community made` submenu to `Select language`
2021-03-01 08:22:43 +01:00
DRracer 112119284d
Merge pull request #3046 from 3d-gussner/MK3_Fix_PR3032
Fix PR3032
2021-03-01 06:35:05 +01:00
3d-gussner d0d4298249 Update EEPROM documentation for Service prep 2021-02-28 18:18:06 +01:00
3d-gussner 3e06a17810 Fix LCD output 2021-02-28 18:04:07 +01:00
Alex Voinea 28f21c8630
Fix bubblesort sorting speed. ShellSort is probably broken 2021-02-26 19:17:14 +02:00
Alex Voinea 6e0ecf5cd2
Remove redundant click sound in factory reset (MK3 merge issue) 2021-02-26 18:22:32 +02:00
3d-gussner 274a3e93b0 Merge remote-tracking branch 'upstream/MK3' into MK3_MK404 2021-02-26 12:11:14 +01:00
DRracer f3c422c40e
Merge pull request #3039 from 3d-gussner/PFW-910
Fix issue #3037
2021-02-26 12:07:10 +01:00
DRracer 8f216ab475
Merge pull request #3006 from wavexx/babystep_fixes
Babystep insertion fixes
2021-02-26 09:58:27 +01:00
Alex Voinea 194438c130
Fix formatting 2021-02-26 09:54:57 +02:00
Alex Voinea 7faffa539a
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2021-02-26 09:48:46 +02:00
Alex Voinea f346125948
Use BubbleSort by default. Disable ShellSort until I fix it 2021-02-26 09:18:59 +02:00
Alex Voinea 225c456ae6
Limit progressbar to LCD_WIDTH
for some stupid reason bubbleSort sometimes exceeds the total value :)
2021-02-26 09:18:28 +02:00
Alex Voinea c63f92ae52
Invert shellSort logic 2021-02-26 08:57:49 +02:00
Alex Voinea 204da1cc3f
Factory reset and check_file progress bar 2021-02-25 21:04:05 +02:00
Alex Voinea 8821439878
Cardreader progressbar code 2021-02-25 20:25:32 +02:00
Alex Voinea afa7c7ab03
Remove forgotten (?) undef at the end of menu.cpp 2021-02-25 19:29:14 +02:00
Alex Voinea 54b2edbc8c
Update debugging code 2021-02-25 19:26:01 +02:00
Yuri D'Elia e8f6c9fac9 Exit the _lcd_move* menus when homing/leveling
Instead of resetting the encoder status when homing or leveling, simply
exit the move/liveZ menu.

When transitioning from idle->printing, axis move shouldn't be allowed
as it would insert moves during a print. This is always wrong.
The menu must be always dismissed. Instead of checking all places where
the menu could be active, automatically dimiss the menu from within
_lcd_move when homing/MBL is happening. The long-push function and the
settings menu checks if "axis move" is possible, and thus
prevent the user to re-enter the menu already.

When doing the first layer calibration, the _lcd_babystep_z is
automatically brought back after MBL has completed.

Technically we should do the same when entering/exiting the paused state
in _lcd_move. However, it's better to dismiss _any_ menu in
stop_and_save_print_to_ram/restore_print_from_ram_and_continue instead.

To be done later...
2021-02-25 17:33:59 +01:00
Yuri D'Elia b4f5633bde Enable "Move axis" and "Disable steppers" only when idle
Move axis queues movements, which disrupts a normal print, homing (when
XY is combined) or MBL.

Likewise, "Disable steppers" only makes sense when the printer is fully
idle.

Only allow such actions when the printer is not active and/or in the
paused state.
2021-02-25 17:33:59 +01:00
Yuri D'Elia 14a1a93bc8 Include probing/MBL in the PRINTER_ACTIVE check
This prevents to perform disruptive actions during homing or between MBL
probes, which would result in a failure.
2021-02-25 17:33:59 +01:00
Yuri D'Elia 28e9c814fc Remove code duplication for babystep insertion 2021-02-25 16:44:16 +01:00
Yuri D'Elia 019c818c05 Insert babysteps using CRITICAL_SECTION instead of cli/sei 2021-02-25 16:44:16 +01:00
Yuri D'Elia f5e419530b Inhibit LiveZ from the settings menu during mesh bed leveling 2021-02-25 16:44:16 +01:00
Yuri D'Elia ff4e53d2d1 Prevent babysteps in more unsafe situations through homing_flag
Further restrict babystep insertion when the lcd_update is enabled by
toggling homing_flag when probing Z (where Z shouldn't be touched
anyway as it would disrupt the measurement)

Also reset the encoder value during mesh leveling.
2021-02-25 16:44:16 +01:00
Yuri D'Elia c241adec5f Ensure babystep_apply|undo always uses the planner
The code around these calls _requires_ that the steps are immediately
processed and/or added to the subsequent planner moves.

The only part that doesn't care about immediate insertion is the
direct user-insertion though the lcd encoder.
2021-02-25 16:44:16 +01:00
DRracer ffae16bf95
Merge pull request #3033 from DRracer/wdr-inline
Make watchdogReset() force_inline
2021-02-25 13:53:34 +01:00
3d-gussner bc2b2a4f76 Update workflow 2021-02-25 12:27:30 +01:00
3d-gussner c976340dee Remove duplicate `PINDA` in translations 2021-02-25 12:03:15 +01:00
3d-gussner 67526116e2 Delete unused translation 2021-02-25 11:44:29 +01:00
3d-gussner d2bfa666b1 Delete unused `Sensor state` translation 2021-02-25 11:38:43 +01:00
3d-gussner d47d0ed34f Delete unused `IR:` translation 2021-02-25 11:32:16 +01:00
3d-gussner 6f15cc383b Fix `PINDA` translation 2021-02-25 11:25:39 +01:00
3d-gussner 5efe33bfc6 Delete unused translations 2021-02-25 11:23:33 +01:00
3d-gussner 1a6de14a06 Fix `FINDA` translation 2021-02-25 11:16:34 +01:00
3d-gussner 4a241f2a9b Use new `PF-build.sh` parameter `-c 1` 2021-02-25 10:48:55 +01:00
3d-gussner afa84b15bd Translate new messages
Check that amount of messages are equal `lang_en.txt` vs. `lang_en_nl.txt`
2021-02-25 10:40:33 +01:00
3d-gussner d9b820690e Merge remote-tracking branch 'upstream/MK3' into MK3_Dutch
fix merge issues
2021-02-25 09:56:23 +01:00
DRracer 7b22895f23
Merge pull request #3032 from DRracer/service-prep2
Make a special welcome message for Shipping/Service prep.
2021-02-25 08:51:47 +01:00
DRracer 9ed713ab13
Merge pull request #3015 from 3d-gussner/PFW-1174
PFW-1174: Add pause/resume for USB/host prints via LCD menu
2021-02-25 08:50:41 +01:00
DRracer 0eb8303cae
Merge pull request #2575 from 3d-gussner/MK3_Fix_LCD_stats
🐛 Fix LCD output for unit16 values
2021-02-24 09:25:24 +01:00
3d-gussner 657767f073 Merge branch 'MK3' into MK3_Fix_LCD_stats
Fix merge issue
2021-02-24 09:01:30 +01:00
DRracer 526e7f636d
Merge pull request #3040 from 3d-gussner/PFW-969
PFW-969 Fix Sensor info screen is blocking the function of filament IR sensor
2021-02-23 16:17:44 +01:00
D.R.racer 03bd9276e2 Remove unrelated translations from master lang_en.txt as well 2021-02-23 15:33:15 +01:00
D.R.racer fbca8cbe28 Remove unrelated (but still missing) translations
This needs to be fixed in 3.10 final. Rumors say some of the translation
scripts even fail on a message containing both % and a backslash
2021-02-23 15:31:36 +01:00
3d-gussner 076613fd97 Show `Fil. sensor` in Support::Sensor info only if IR Sensor detected 2021-02-23 15:20:08 +01:00
3d-gussner 08a6a4b25e Enable Filament sensor action during print even if in Support::Sensor info 2021-02-23 15:19:03 +01:00
D.R.racer 734e497cd0 Move wizard msgs into messages.h/c + add more translation markers 2021-02-23 15:09:19 +01:00
D.R.racer 95567b8072 Update translations of the Shipping/Service prep welcome msg 2021-02-23 11:10:18 +01:00
3d-gussner fdff5d84b2 Move Filament sensors to Support -> Sensor Info 2021-02-23 08:52:40 +01:00
3d-gussner 8d4176a530 Add "Fan check [On|Off]" menu to tune
User can en/disable the fan check during print. This is very useful in case of false positive
fan errors to let the user to decide to finish print with "faulty" fan.
2021-02-23 07:24:33 +01:00
3d-gussner 30b60e44d2 `|| isPrintPaused` is already in `PRINTER_ACTIVE` 2021-02-22 18:21:20 +01:00
3d-gussner fd154e4b69 Again revert Settings 2021-02-22 18:10:43 +01:00
3d-gussner 5894883324 Fix USB/host FAN Error resume
Show Settings during Pause also for USB/host prints
2021-02-22 16:37:01 +01:00
3d-gussner 9110ffd4ae Revert `M602` 2021-02-22 16:36:21 +01:00
3d-gussner cbe207eb59 Fix issue #3037
`starttime` is only set for SD prints via gcode `M24 and M32`
2021-02-20 13:18:53 +01: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 87f416f303 Keep wizard flag==2 even when a user restarts during Z-calibration
i.e. prevent jumping into the standard wizard if reset during Z-
calibration
2021-02-18 15:39:29 +01:00
3d-gussner 495dcee066 Show LCD Settings during pause 2021-02-18 12:09:43 +01:00
3d-gussner 4c8ba11417 Merge remote-tracking branch 'upstream/MK3' into MK3_MK404 2021-02-18 11:39:36 +01:00
3d-gussner 5df06a64fd Merge branch 'MK3_MK404' of https://github.com/3d-gussner/Prusa-Firmware into MK3_MK404 2021-02-18 11:38:03 +01:00
3d-gussner a109d20506 Merge remote-tracking branch 'upstream/MK3' into PFW-1174
Fix merge issues
2021-02-18 11:05:31 +01:00
3d-gussner c1d8e6660b Indentations 2021-02-18 10:07:40 +01:00
DRracer adf347fdf1
Merge pull request #3034 from 3d-gussner/MK3_PFW-960
PFW-960 Improve M0/M1/M117
2021-02-18 09:59:01 +01:00
3d-gussner 291ee8e46d Indentations 2021-02-18 09:53:14 +01:00
3d-gussner 75a385d614 Indentations 2021-02-18 09:10:28 +01:00
D.R.racer 4e768057e7 Use standard wdt_reset() from AVR lib
which translates to the one `wdr` instruction like before
+ wrap configuration of watchdog into cli/sei
2021-02-17 15:59:52 +01:00
3d-gussner 2b4cf8d56e Fix FANCHECK build error 2021-02-17 13:52:31 +01:00
D.R.racer a456c4a52d Make watchdogReset() force_inline
It makes no sense keeping watchdogReset as a separate function which
must be called, since it only contains one instruction: "wdr".

Not only was the code larger by 32 bytes in total, but also much slower
(call+ret take 4 cycles together for no reason in this case).

Surprisingly, doing just this on FW 3.9.3 solves issue #2954 on the one
affected EINSY board, even though it makes not much sense (there must be
some other timing issue).
2021-02-17 13:04:46 +01:00
D.R.racer c3bea4d71c Make a special welcome message for shipping/service prep
Another request from our Service dept. - the user shall be prevented
from skipping the intro wizard, because otherwise some preset/calibrated
features will look like not done - especially live-z calibration.

And since there are users, who send a machine to service to perform 1st
layer calibration only, they must not omit the Z-calibration at the
start after shipping.
2021-02-17 12:53:56 +01:00
3d-gussner c79bce010d Don't show Settings during pause 2021-02-17 12:18:30 +01:00
DRracer 7a84ad71dc
Merge pull request #3023 from DRracer/service-prep
Add Service prep. item into Factory reset
2021-02-17 10:43:08 +01:00
D.R.racer dbb0269bd4 Make indentation consistent with surrounding code in factory_reset() 2021-02-17 08:27:49 +01:00
3d-gussner afc15b42bb Indentations 2021-02-17 08:13:32 +01:00
3d-gussner 59c2b7e795 Fix Fan error issues. 2021-02-17 07:42:12 +01:00
3d-gussner 66ea1bdfba Indentations 2021-02-16 12:31:23 +01:00
3d-gussner d6c6517fcd Back to Status after Resuming 2021-02-16 07:27:46 +01:00
3d-gussner c2637d9430 Documentation Show Main Menu 2021-02-15 18:35:04 +01:00
3d-gussner c07bcd172a Fix NO Stop print during MBL 2021-02-15 18:34:08 +01:00
3d-gussner 583993b7e2 Back to "Status" after gcode `M0/M1` 2021-02-15 15:25:04 +01:00
3d-gussner 25928232e4 Merge remote-tracking branch 'upstream/MK3' into MK3_PFW-960 2021-02-15 13:06:47 +01:00
3d-gussner 9071a9f8fd Gcode `M1` must have a string while `M0` it is optional
As the `M0/M1` moved to the beginning of the parser
- parser would not be able to "find" `M1nn` command if the query was `M1` instead of `M1 `
- to be able to "stop/halt" without sending a string and display default message use gcode `M0`
- as there are no `M0nn` gcodes the parser can query `M0` without additional space needed as in `M1 `
2021-02-15 12:51:12 +01:00
3d-gussner fc270a356a Fix indentations 2021-02-15 12:50:40 +01:00
3d-gussner 1550e707be Fix few issues
Create MMU2 SDcards
MMU2 only for MK3/S
2021-02-15 11:41:41 +01:00
3d-gussner bf33198866 Add copy of MK3 and MK3S `lang.bin` files to MK404 `*_xflash.bin`
Minor changes:
- Indentations
- Documentation
2021-02-15 11:41:41 +01:00
3d-gussner be9f8e5157 Add force recompile
Added SD card builds
2021-02-15 11:41:41 +01:00
3d-gussner de337476cd Add MK404 support
Indentations
2021-02-15 11:41:41 +01:00
DRracer 86e117679c
Merge pull request #3011 from 3d-gussner/MK3_translation_0121
Fix few translations introduced with #2982
2021-02-15 11:16:54 +01:00
DRracer 2874e704f5
Merge pull request #3021 from 3d-gussner/PFW-910
PFW-910 Add remaining time to change/pause/user interaction to LCD Info screen
2021-02-15 09:13:50 +01:00
3d-gussner 3ad669889e Fix few issues
Create MMU2 SDcards
MMU2 only for MK3/S
2021-02-14 00:18:24 +01:00
3d-gussner f37aedd5dd Add copy of MK3 and MK3S `lang.bin` files to MK404 `*_xflash.bin`
Minor changes:
- Indentations
- Documentation
2021-02-13 10:35:34 +01:00
3d-gussner fb98cb2ff9 Add force recompile
Added SD card builds
2021-02-13 10:05:07 +01:00
3d-gussner b663abf160 Add MK404 support
Indentations
2021-02-12 20:12:37 +01:00
3d-gussner c95a8e13d7 Fix indentations to 4 spaces per tab 2021-02-12 11:47:02 +01:00
3d-gussner f810047a5c Switch between Remaing and Change time every few seconds
- If `M73` `R,S,C,D` values set the LCD Info screen clock switchs between Remaining and Change time
- If Remaining time is 0 while Change time is >0 the clock switchs between Change time and actual printing time
- If Change is 0 while Remaining time is >0 the clock shows the Remaining time
- If both are 0 the clock shows the actual printing time
- `M73 C` values are shown in "Normal" mode
- `M73 D` values are shown in "Stealth" mode
- Changing the speed will try to calculate the espected times and show `?` behind `R` or `C`
2021-02-12 11:29:47 +01:00
3d-gussner d2e60aee90 Use `CLOCK_INTERVAL_TIME` 2021-02-11 10:45:26 +01:00
3d-gussner cf982b0d4d Fix timer issue
The remaining time stays for ~5 seconds while the change time stays just for ~1 second
2021-02-11 10:20:06 +01:00
3d-gussner 14b4bf5fa5 Add CLOCK_INTERVAL_TIME and ShortTimer IntervalTimer 2021-02-11 07:47:44 +01:00
3d-gussner b9a3fa2ddd fix time at speed 2021-02-11 07:47:44 +01:00
3d-gussner b13d4b71d4 Add Change time behind existing message 2021-02-11 07:47:44 +01:00
3d-gussner 4998cfb70d Fix printing time being shown without `M73` gcode
Adjust estimated times only if speed is changed. Printing time has to stay printing time.
2021-02-11 07:47:43 +01:00
3d-gussner d063ffb141 Add parameter `D` to gcode `M73` for silent/stealth mode 2021-02-11 07:47:43 +01:00
3d-gussner 83e791cbbe Fix temp Build number 2021-02-11 07:47:43 +01:00
3d-gussner 91c767b0f2 Reduce code size 2021-02-11 07:47:43 +01:00
3d-gussner ae48e7c3ce indentation 2021-02-11 07:47:43 +01:00
3d-gussner f4ca6ee59d Fix typo 2021-02-11 07:47:43 +01:00
3d-gussner cca90da64b Include silent mode on time change
- depends on difference between print time remaining NORMAL vs SILENT mode
2021-02-11 07:47:43 +01:00
3d-gussner cb61436093 Add remaining time to change/pause/user interaction to LCD Info screen
- Add parameter `C` to gcode `M73`
- LCD Info screen switches to change time if last `M73` gcode contains `C` parameter
  - Examples:
    - `M73 P5 R120` will display on LCD ` SD  5%      02:00R ` if it is printing at 100% speed
    - `M73 P5 R120 C60` will display on LCD ` SD  5%      01:00C ` if it is printing at 100% speed

Slicers can generate "Time to change/pause/user interaction" using `C<mins:0-65535>` parameter to "overwrite" the remaining print time.
To switch between time to change and remaining time just send in intervals `M73` with or without `C` parameter.
2021-02-11 07:47:43 +01: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
Yuri D'Elia e010ca8ceb Fix conflicting extern/inline declarations
The functions find_bed_induction_sensor_point_* have conflicting
extern and inline declarations.

These are used outside of the compilation unit only, and thus there's no
point in defining them inline.

This causes a compilation failure at O1 and above, which is strangely
avoided at Os.
2021-02-10 14:50:13 +01:00
DRracer 80568cfba4
Merge pull request #2967 from DRracer/thumbnails2
Fast skipping of large comment blocks
2021-02-10 12:59:43 +01: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
3d-gussner 8bc46248f6 avoid having the block body twice in the code. Thanks to @DRracer 2021-02-10 11:09:29 +01:00
3d-gussner e5711ea84f Indentation to 4 spaces for tabs 2021-02-10 11:03:23 +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 e6ffc99ff5
Fix compiler bug ... again ...
:endit: :blobhydraulicpress:
2021-02-09 16:28:13 +02:00
Alex Voinea d2a7c62b50
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2021-02-09 16:17:43 +02:00
DRracer a47c971c75
Merge pull request #3010 from leptun/MK3_fix_M23
Fix M23
2021-02-09 15:06:51 +01:00
Alex Voinea 4fcbf95db6
apply RAII principle on the lsDive recursion limiter 2021-02-09 15:00:46 +02:00
D.R.racer 9ccda4c57f Optimize code size
... looks like I've been able to reduce the code by 80B by using the
clamp999() function. There are other spots this function can be used as
well, I didn't touch those yet.
2021-02-09 09:10:23 +01:00
DRracer e491b53f48
Merge branch 'MK3' into MK3_Fix_LCD_stats 2021-02-09 08:53:32 +01:00
DRracer 5c3683b4ad
Merge pull request #3022 from 3d-gussner/PFW-1182
PFW-1182 Fix too long translations during Load/Unload Filament
2021-02-09 08:24:31 +01:00
DRracer d5d44d30a7
Merge pull request #2305 from 3d-gussner/MK3-Fix_M120_M121
Follow RepRap Wiki G-codes documentation
2021-02-09 07:52:14 +01:00
D.R.racer 3668cdeb30 Add Service prep. item into Factory reset
upon request from our Service dept. - it is to do the same stuff like
Shipping prep., but keep the printer's stats intact. Still, this has to
be verified and may undergo some further changes.
2021-02-08 17:27:32 +01:00
D.R.racer 5f49d65546 Farmers' request - allow file sorting menu item 2021-02-08 15:43:08 +01:00
3d-gussner 92db282eca Merge remote-tracking branch 'upstream/MK3' into PFW-960 2021-02-08 12:48:27 +01:00
3d-gussner aecbd7ab49 Fix `c=aa` location in lang files
Fix too long translations in Spanish and Italian
2021-02-08 12:17:41 +01:00
3d-gussner 214695105c Fix issue #2958 2021-02-08 11:33:46 +01:00
3d-gussner fb39e7296b Uniform message `Press the knob` 2021-02-08 10:58:41 +01: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 77a5082b56 Fix presort_flag duplicate declaration 2021-02-06 17:25:17 +02:00
Voinea Dragos 52f7a71dce More fixes that were extracted from #2405 2021-02-06 14:59:11 +02:00
Voinea Dragos f343e6432a Fix diveSubfolder string termination 2021-02-06 12:55:51 +02:00
DRracer 2dfe21358f
Merge pull request #2838 from wavexx/m204_travel_acceleration
Implement M204 T (separate travel acceleration)
2021-02-05 16:27:50 +01:00
DRracer 77eb10000c
Merge pull request #2948 from 3d-gussner/PFW-1168
PFW-1168 Move Z up running xyz calibration
2021-02-05 16:18:07 +01:00
Alex Voinea 84d043d41b Fix WorkDirDepth limit (for good this time) 2021-02-04 17:52:42 +02:00
Alex Voinea 90c0f33bc5 Fix farm filename when LFN is missing 2021-02-04 16:40:15 +02:00
Alex Voinea 080c44cb2e Undo stupid hack for an error because of some compiler issue in the past 2021-02-04 16:37:24 +02:00
Alex Voinea df163066fb Fix "sorting files" messages for both ShellSort and BubbleSort 2021-02-04 15:44:15 +02:00
Alex Voinea 279c0aaa21 Fix double '>' bug and brutal refactoring 2021-02-04 14:21:37 +02:00
Yuri D'Elia 640e8d899b Don't scroll one character past the filename end 2021-02-04 13:33:20 +02:00
Alex Voinea 8445f76eb9 Restructure for loop to work correctly in reverse 2021-02-04 13:26:15 +02:00
Alex Voinea 3c5c1e5167 Use enum for menu state code readability 2021-02-04 13:19:22 +02:00
Alex Voinea ffc3a445ca Remove even more dead code 2021-02-04 11:35:15 +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
Yuri D'Elia 186ce0f4b3 Handle acceleration settings in UVLO/power panic
Acceleration settings need to be saved in UVLO, since these are often
changed/set during a print. This is especially important for travel and
retract acceleration, which is usually set once per-print.

Saving and restoring is not 100% correct.

We save the current front-end value, which might ahead of the backend
when UVLO is triggered. Print acceleration, likely the most significant,
should be saved in the block buffer to be accurate.

Acceleration needs to be restored after the UVLO Z repositioning is
performed, using an M204 command. This is correct, however we don't save
the _temporary_ max acceleration limits set via M201, which could be
higher than the saved limits (via M500). This could result in lower
clamped values compared to the original print.

Maximum acceleration/jerk/feedrate limits should _all_ be saved in UVLO
in the future.
2021-02-03 11:28:51 +01:00
Yuri D'Elia f7542aa064 Report travel acceleration in M503
Use the new M204 format consistently also in M503's output
2021-02-03 11:20:28 +01:00
Yuri D'Elia 76911f67db Take advantage of the new is_uninitialized function
Save some space and perform some cleanup
2021-02-03 11:20:28 +01:00
Yuri D'Elia 45811f82aa Initialize default travel_acceleration from EEPROM
When reading uninitialized memory, preset the travel acceleration to be
the same as the default acceleration.
2021-02-03 11:20:28 +01:00
Yuri D'Elia 5589954b77 Add DEFAULT_TRAVEL_ACCELERATION in all variants
Use the same value as DEFAULT_ACCELERATION for compatibility.
2021-02-03 11:20:28 +01:00
Yuri D'Elia 1c76152e62 Implement separate travel acceleration (M204 T)
Allow to separate extrusion and travel acceleration settings using M204,
as Marlin 1.1.x and 2.x does using M204 T.

This allows to reduce the number of instructions required during
printing, since resetting the acceleration for travel moves is no longer
required and can be done a single time during the print.

Provision for this parameter was pre-existing, but not implemented.
M204 has two forms: the lagacy format (Marlin <1.1):

  M204 S[print-acc] T[retract-acc]

and the newer format:

  M204 P[print-acc] R[retract-acc] T[travel-acc]

The distinction in the MK3 FW is done based on the presence of the P
parameter. If P is seen, the new format is adoped. In the new format
however, M204 T was ignored until this change.

To keep backward compatibility, M204 S[acc] will set both print and
travel acceleration, which is identical in behavior to recent versions
of Marlin.
2021-02-03 11:20:28 +01:00
3d-gussner 2ba24fe0d4 Add pause/resume to USB/host prints via LCD menu
Depending if SD or USB/host print the firmware sends
- SD print: `// action:paused` or `// action:resumed` are send to inform USB/Host
- USB/host print: `// action:pause` or `// action:resume` are send to trigger the USB/host to handle it

- USB/host must handle `// action:pause` and `// action:resume` correctly to work
  - Tested with Octoprint
    - It handles every thing correctly
    - Any combination of Octoprint and/or LCD `pause` and `resume` working correctly
  - Tested with Pronterface
    - It pauses BUT doesn't send the printer in pause position, and so it is not possible to `resume` from LCD menu
    - I guess some Macros can fix that.
  - Repetier Host/Server documentation shows that it should work. Not tested.

Could save 56 bytes in first step and additional 38 bytes adding `MSG_PAUSE_PRINT` to messages.c/.h

Updated `lang_en*.txt`
@todo Polish translation is 19 characters long (it still fits) BUT should be corrected to 18 chars.
2021-02-03 11:00:26 +01:00
DRracer 0bda4504c1
Merge pull request #3013 from leptun/MK3_DIR_DEPTH
DIR depth adjustments
2021-02-02 20:20:25 +01:00
Alex Voinea 896f4e1dd1 Fix compile error 2021-02-02 19:14:05 +02:00
Alex Voinea f6ae379077 Fix dir_names array definition. Prevents overrun 2021-02-02 19:08:44 +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
DRracer f7fd7a5331
Merge pull request #3012 from leptun/MK3_IP_support
M552 - Printer IP address
2021-02-02 15:42:04 +01:00
3d-gussner 57e730c80c Merge remote-tracking branch 'vojtech-pavlik/MK3' into MK3_Test_PRs
Fix merge issues PR1900
2021-02-02 13:49:34 +01:00
Alex Voinea 647cde0cae Add documentation 2021-02-02 13:38:20 +02:00
Alex Voinea 2f4119a6d7 M552 - Printer IP address 2021-02-02 13:21:16 +02:00
DRracer 2b81abb24c
Merge pull request #2814 from wavexx/MK3_PAT9125_I2C
Use hardware TWI for the PAT9125 (optical) filament sensor
2021-02-02 09:15:35 +01:00
D.R.racer 15d76a7501 Remove duplicit incrementation of consecutive comment lines
It was left in the code in one of the refactoring/optimization passes.
It really didn't do any harm, but was limiting the performance of the
skipping algorithm.

+ some verification code added - will be removed after successful tests
2021-02-02 07:57:06 +01:00
DRracer 40e45c5eaa
Merge pull request #3009 from leptun/PFW-1144-LongPathName
"M27 P" support. Get current file absolute filename (file path)
2021-02-01 14:41:15 +01:00
DRracer 58c217a340
Merge pull request #2988 from leptun/PFW-1171-EEPROM_SN
Cache SN to EEPROM on startup
2021-02-01 14:24:13 +01:00
Alex Voinea 7e09df6a34 Add documentation 2021-02-01 14:54:44 +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
Yuri D'Elia ec4c1be058 Silence bUpdateEEPROM unused warning in MK3 variant 2021-02-01 07:09:44 +01:00
Voinea Dragos 30131c9ab5 Patch broken string PROGMEM transition with setTargetedHotend() error 2021-02-01 06:12:37 +01:00
Voinea Dragos ea44d78d68 Merge branch 'MK3' into PFW-1171-EEPROM_SN 2021-01-31 17:19:00 +02:00
Voinea Dragos 698499f00d split timer0 and timer2 initialization. Move timer2 init early 2021-01-31 17:18:32 +02:00
Voinea Dragos 6b6205d2f6 M27 refactoring and M27 L initial implementation 2021-01-31 15:06:20 +02:00
Yuri D'Elia b8b75186fe Remove the extra copy of CRITICAL_SECTION from fastio 2021-01-29 18:30:16 +01:00
Yuri D'Elia 31b3ad0613 Merge remote-tracking branch 'upstream/MK3' into MK3_PAT9125_I2C 2021-01-29 18:28:55 +01:00
Yuri D'Elia 2d71a071f0 Switch twi.c to fastio 2021-01-29 17:51:38 +01:00
Yuri D'Elia 1fa7b8cd8d Move SDA/SCL pins into pins.h for fastio compatibility
fastio relies on macros for pin definitions, so we cannot use the const
declaration in Sd2PinMap or the arduino's definition.

Declare SDA/SCL_PIN into pins.h based on the current MCU, which is
identical in all our variants.

Remove the conflicting/unused declaration in Sd2PinMap.
2021-01-29 17:48:59 +01:00
Yuri D'Elia 30262b0a6e Remove redundant definitions of CRITICAL_SECTION_*
Move CRITICAL_SECTION_START/END into fastio.h, where it's needed.
2021-01-29 17:30:04 +01:00
3d-gussner d75a0fdcbd Merge remote-tracking branch 'upstream/MK3' into MK3_translation_0121 2021-01-29 15:38:48 +01:00
DRracer 42311db5f1
Merge pull request #2789 from wavexx/MK3_TMC2130_DEDGE
Use/enable TMC2130 DEDGE support in MK3/MK3S
2021-01-29 11:13:09 +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
Yuri D'Elia e9d5c44732 Also toggle pins efficiently in sm4.c
Use the same technique used in fastio to toggle pins efficiently in sm4
when DEDGE is used.
2021-01-29 00:13:49 +01:00
3d-gussner fba83bd309 Add new flags -c -p -n 2021-01-28 09:48:05 +01:00
D.R.racer 6c9c1423c6 Remove temporary changes from SdBaseFile.h 2021-01-28 09:42:50 +01:00
D.R.racer 71d825d0f2 Return SdBaseFile into previous state
no changes necessary afterall
2021-01-28 09:41:30 +01: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 c05b625b1c Fix occasionally skipped valid G-code lines
which also allowed for removal of the pre-increment -> post-increment
workaround
2021-01-28 08:13:16 +01:00
D.R.racer d1fd5a555f Clean up gfReset() 2021-01-27 14:12:11 +01:00
D.R.racer b2cf5b7b6c Fix seekSetFilteredGcode()
+some more debug code which will vanish after all is done and verified
2021-01-27 13:01:25 +01:00
D.R.racer b6c59e08ac Workaround ++gfCacheP into postincrement ld r22, Z+
TODO: ideally improve the automaton to work with postincrement only, at
least in this case.
2021-01-27 09:52:20 +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
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
Yuri D'Elia a9625747db Reinstate the nop instruction as delay in non-DEDGE
When TMC2130_MINIMUM_PULSE is 0 a minimum delay is implied.
In this case, use a single "nop" instruction.
2021-01-26 19:43:29 +01:00
Yuri D'Elia d3734b02cc Also fix delay instances inside unused BACKLASH_[XY] 2021-01-26 16:18:23 +01:00
Yuri D'Elia b17cdcd4d7 Ensure MINIMUM_PULSE is always 0 in DEDGE mode
This ensures delays are always properly elided without having to check
for DEDGE all over the place.
2021-01-26 16:12:59 +01:00
Yuri D'Elia 2a6989ecd5 Remove TMC2130 special-cases
With the new STEPPER_MINIMUM_DELAY being automatically removed for
TMC2130 we no longer need to add specialized #ifdefs for DEDGE in
babystep.
2021-01-26 16:09:23 +01:00
Yuri D'Elia 4fed728e08 Elide delayMicroseconds for TMC2130 in non-DEDGE mode
Introduce new macros TMC2130_MINIMUM_DELAY/STEPPER_MINIMUM_DELAY for
blocking pauses.

If MINIMUM_PULSE has defined to be zero, avoid the delay call entirely.
2021-01-26 16:02:53 +01:00
3d-gussner f40c593d11 Fix few translations not being used due to spaces or upper case 2021-01-26 14:15:34 +01:00
D.R.racer c28e5a9dbc Farmer's request 2
Farmers request having the Change filament menu item always visible in
the main menu and located after the Live Adjust Z (which disappears
after the first few printed layers).
2021-01-26 12:19:41 +01:00
DRracer bfe93d3959
Merge pull request #2951 from DRracer/pvb-08
Add PVB preheat and 0.8mm nozzle presets
2021-01-26 12:09:41 +01:00
3d-gussner ad5d068690 Update char lengths part 1
Fix some too long translations
2021-01-26 12:09:35 +01:00
DRracer 891f37a622
Merge pull request #2982 from DRracer/codesize
Reduce code size and RAM usage
2021-01-26 12:04:39 +01:00
3d-gussner 0aae433bda Update po files after all these changes 2021-01-26 11:08:57 +01:00
3d-gussner c555907a12 Remove duplicate string `G-code sliced for a different printer type. Please re-slice the model again. Print cancelled.` using `MSG_GCODE_DIFF_PRINTER_CANCELLED` 2021-01-26 11:01:50 +01:00
3d-gussner 51d1e0bd8a Remove duplicate string `G-code sliced for a different printer type. Continue?` using `MSG_GCODE_DIFF_PRINTER_CONTINUE` 2021-01-26 10:42:56 +01:00
3d-gussner 7916f8b9e8 Merge branch 'codesize' of https://github.com/DRracer/Prusa-Firmware into DRracer_codesize 2021-01-26 10:13:11 +01:00
D.R.racer 0eb7261e29 Save ~100B on menu implementation 2021-01-26 09:29:17 +01:00
3d-gussner ba8386573a Remove duplicate string `Resume print` using `MSG_RESUME_PRINT` 2021-01-26 09:23:55 +01:00
3d-gussner c6a01b3806 Remove duplicate string `Reset` using `MSG_RESET` 2021-01-26 09:15:46 +01:00
3d-gussner ab5aad636f Remove duplicate string `Mesh Bed Leveling` and `Mesh bed leveling` using `MSG_MESH_BED_LEVELING`
Fixed few too long translations
2021-01-26 09:05:38 +01:00
DRracer f4cee7ce84
Merge pull request #2983 from leptun/MK3_fix_sm4.h_line_ending
Fix sm4.h line ending
2021-01-26 08:45:07 +01:00
DRracer bce9f8c949
Merge pull request #2984 from leptun/MK3_Serial_LF_only
Do not send CR on the serial line
2021-01-26 08:42:47 +01:00
DRracer c465417f50
Merge pull request #2987 from leptun/PFW-1144-LongPathName
"M20 L" support. Print long filenames
2021-01-26 08:40:26 +01:00
3d-gussner 84ed0725f2 Merge branch 'codesize' of https://github.com/DRracer/Prusa-Firmware into DRracer_codesize 2021-01-26 08:32:03 +01:00
3d-gussner bce8501eea Remove duplicate string `Extruder` using `MSG_Extruder` 2021-01-26 08:31:21 +01:00
Voinea Dragos c6588193ad Fix some more stuff in cardreader.cpp
Saved 4B of flash and 60B of RAM
2021-01-26 09:25:41 +02:00
3d-gussner ab18a3ccc3 Merge branch 'codesize' of https://github.com/DRracer/Prusa-Firmware into DRracer_codesize 2021-01-26 08:24:11 +01:00
3d-gussner 530b9f50b8 Remove duplicate string `Eject filament` using `MSG_EJECT_FILAMENT`
Fix few translations
2021-01-26 08:22:08 +01:00
D.R.racer 348902240e Fix code_seen_P("fv") broken by one of the merges 2021-01-26 08:02:33 +01:00
3d-gussner 269fabc330 Remove duplicate string `Cut filament` using `MSG_CUT_FILAMENT` 2021-01-26 07:15:46 +01:00
3d-gussner 797d8e74a3 Remove duplicate string `Checking X axis` and `Checking Y axis` using `MSG_CHECKING_X` and `MSG_CHECKING_Y` 2021-01-26 07:10:57 +01:00
3d-gussner 2d1e1e4cee Remove duplicate string `Fans check` using `MSG_FANS_CHECK` 2021-01-25 20:13:12 +01:00
3d-gussner d117a299f7 Remove duplicate string `Fil. runouts ` using `MSG_FIL_RUNOUTS` 2021-01-25 20:04:18 +01:00
3d-gussner 10bbd64b41 Remove duplicate string `Crash` using `MSG_CRASH`
Better Italian translation, thanks to @wavexx
Fix Polish translation as it was too long for the menue and caused LCD issues.
2021-01-25 18:53:53 +01:00
3d-gussner 4878db7365 Remove duplicate string `Last print failures` using `MSG_LAST_PRINT_FAILURES`
Fix too long translations in Spanish and Italian for this message
2021-01-25 18:38:35 +01:00
3d-gussner 99867c8fbd Remove duplicate string `Total failures` using `MSG_TOTAL_FAILURES` 2021-01-25 18:06:47 +01:00
3d-gussner 8f0a45e8a4 Remove duplicate string `Steel sheets` and `Total` using `MSG_STEEL_SHEETS` and `MSG_TOTAL` 2021-01-25 17:58:51 +01:00
3d-gussner 7222cf05cf Remove duplicate string `MMU Fails` and `MMU Load Fails` using `MSG_MMU_FAILS` and `MSG_MMU_LOAD_FAILS` 2021-01-25 17:38:36 +01:00
3d-gussner fbb3fad64b Remove duplicate string `Last print` using `MSG_LAST_PRINT` 2021-01-25 16:54:26 +01:00
3d-gussner 7891d12a32 Remove duplicate string `Is filament loaded?` using `MSG_FILAMENT_LOADED` 2021-01-25 16:44:55 +01:00
3d-gussner 223f32deae Remove duplicate string `HW Setup" using `MSG_HW_SETUP` 2021-01-25 16:15:57 +01:00
3d-gussner 5c1da227fe Merge branch 'codesize' of https://github.com/DRracer/Prusa-Firmware into DRracer_codesize 2021-01-25 16:00:46 +01:00
3d-gussner 377a59c624 Remove duplicate string `Belt status` 2021-01-25 15:53:31 +01:00
D.R.racer d8917a304a Reuse lcd_space() instead of in-place printing of spaces in a cycle
Saves another ~40B
2021-01-25 15:21:25 +01:00
D.R.racer 783e4bbaf9 Add lcd_putc_at (code down >150B), refactor lcd_selftest_screen_step
(RAM down 10B)
2021-01-25 14:58:57 +01:00
DRracer 3975415490
Merge branch 'MK3' into codesize 2021-01-25 12:43:30 +01:00
DRracer 58351fb27a
Merge pull request #2977 from DRracer/farm-patch1
Farmers' requests
2021-01-25 11:15:44 +01:00
D.R.racer 514321f2ce Remove farm_no completely + reuse prusa_stat_farm_number() where
applicable
2021-01-25 11:09:28 +01:00
Voinea Dragos 2b3729125d Prevent wdt reset during file listing 2021-01-25 11:46:51 +02:00
D.R.racer c1ff6242b0 Avoid copying FW version number into RAM - use the PROGMEM string 2021-01-25 09:03:04 +01:00
Voinea Dragos 4f769f0faa PRUSA RESET safety precaution 2021-01-25 09:58:12 +02:00
Voinea Dragos 9fa9d6b063 Move farm strings to PROGMEM 2021-01-25 09:48:17 +02:00
D.R.racer 6a62674bd8 Keep PRUSA RESET available even in non-farm mode 2021-01-25 08:43:37 +01:00
D.R.racer 98a4da571d Merge branch 'farm-patch1' of github.com:DRracer/Prusa-Firmware into farm-patch1 2021-01-25 08:39:20 +01:00
D.R.racer 9bfada94f0 Remove commented code 2021-01-25 08:38:44 +01:00
Voinea Dragos e8e4aabfdb Add gcode documentation 2021-01-22 21:07:14 +02:00
Voinea Dragos 31a6270f69 Abuse \n in lcd printing instead of constantly calling other functions
"other functions" being lcd_set_cursor and lcd_print(char). Saves 100B of flash
2021-01-22 20:12:11 +02:00
Voinea Dragos 4d3f056b81 Fix factory reset menu rendering 2021-01-22 20:07:27 +02:00
Voinea Dragos 37c431abd9 another lcd_puts_at_P 2021-01-22 19:44:46 +02: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 bc7d36b6ff Fix sm4.h line ending 2021-01-22 18:57:24 +02: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 9b34789398 Cleanup reset_menu() 2021-01-22 17:54:44 +01:00
D.R.racer 90d22a376d Remove unused vars in xyzcal.cpp 2021-01-22 17:50:08 +01:00
D.R.racer 2780a03967 Improve duplicate_Tcode_ignored
kudos to @leptun
2021-01-22 17:47:44 +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
D.R.racer 4dec171266 Reduce code by 104 bytes in xyzcal.cpp
Extract CLAMP_median into a non-inline function.
The extra instructions to call that function do not matter from the
speed perspective
2021-01-22 17:13:28 +01: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
Voinea Dragos 9fda6b774d Do not send CR on the serial line 2021-01-22 17:58:01 +02:00
DRracer f809691003
Merge pull request #2968 from espr14/PFW-1186
Calibration: reduce code size PFW-1186
2021-01-22 14:05:13 +01:00
DRracer eceb7b4e5f
Merge pull request #2981 from 3d-gussner/PFW-1140-2
PFW-1140 Add fan speed and position auto report
2021-01-22 13:00:23 +01:00
DRracer defbaa6ff8
Merge branch 'MK3' into PFW-1186 2021-01-22 12:46:25 +01:00
DRracer 4c952a0a9c
Merge pull request #2962 from espr14/PFW-1178
Calibration: code cleaning PFW-1178
2021-01-22 12:41:24 +01:00
3d-gussner 008c6a2590 Remove defines 2021-01-22 12:26:29 +01:00
DRracer ab59449b7c
Merge pull request #2961 from espr14/PFW-1179
Calibration: print skew results PFW-1179
2021-01-22 12:24:52 +01:00
DRracer 85f2c29dfe
Merge pull request #2960 from espr14/PFW-1169-3
Calibration: more accelerations, fix scan, more robust circle search PFW-1169
2021-01-22 12:20:35 +01:00
3d-gussner ede3f34051 Documentation 2021-01-22 10:40:29 +01:00
Voinea Dragos ced3d9fa77 "M20 L" support. Print long filenames 2021-01-22 11:13:44 +02:00
D.R.racer 31951fe8c9 Code refactoring
Motivation:
- save some RAM joining the autoreport flags into 1 byte
- encapsulate the magic of setting bit masks/features into a class with
a stable public interface
2021-01-20 11:46:25 +01:00
Voinea Dragos 70d254a1fc Allow resetting when not in farm mode 2021-01-19 13:39:21 +02:00
Voinea Dragos 48b4bdfe8e Make the PRUSA RESET command functional on the miniRambo 2021-01-19 13:36:08 +02:00
Voinea Dragos 542677c080 Prevent switching to serial port 1 on miniRambo and such 2021-01-19 13:11:48 +02:00
Voinea Dragos 9b847715ac Rename F0 to FRM on the status screen 2021-01-19 13:11:25 +02:00
Voinea Dragos 3f5cfc4e61 Move the change filament button to the main menu when farm printing
PFW-945
2021-01-19 13:06:23 +02:00
D.R.racer a9d8ddc89c Farmers' requests 1
- remove the UI and related stuff to setting a farm number (the
communication protocol must remain intact)
- remove confirmation after print finished ("Print OK")

Both requests are highly welcome, since they allow for lowering the code
size by >1KB

PFW-963, PFW-927
2021-01-19 09:58:02 +01:00
3d-gussner 9264454d3a Gcode `M123` only if FANCHECK and TACHOs are defined
Gcode `M155` added parameter "C" to activate auto-report for temperatures, fans and positions
Updated doxygen
@todo Update RepRap Wiki
@todo improve code
2021-01-19 09:01:46 +01:00
espr14 735895c6bc Use fabs 2021-01-14 16:38:34 +01:00
espr14 ca4e638ea2 Don't use extrusion in XYZ calibration 2021-01-14 13:19:30 +01:00
Alex Voinea 20c3f4cb77 Update comments 2021-01-14 12:53:12 +02:00
Voinea Dragos dea3f23a69 PRUSA SN in eeprom 2021-01-14 11:52:22 +02:00
espr14 9867ecd3f9 Reduce unnecessary code 2021-01-13 13:59:20 +01:00
espr14 21d6f970ef Fix build 2021-01-12 16:26:46 +01:00
espr14 f3faf651c5 Move down before scanning 2021-01-12 16:12:34 +01:00
espr14 9dceb488b6 Revert double scanning 2021-01-12 16:04:04 +01:00
DRracer b71f1be37a
Merge pull request #2957 from wavexx/remove_stray_newline
Remove stray serial newlines in fsensor autoload messages
2021-01-12 14:46:08 +01:00
espr14 546812294e Clean serial output 2021-01-12 00:34:28 +01:00
espr14 d7507649d8 Remove degree char 2021-01-12 00:28:46 +01:00
espr14 180af46fe4 Try double height 2021-01-12 00:27:06 +01:00
espr14 333526f65d Single skew output 2021-01-11 23:14:12 +01:00
espr14 e6e44fe188 Convert to degrees 2021-01-11 23:13:08 +01:00
espr14 b8443b00ad Reverse reverse 2021-01-11 22:18:50 +01:00
espr14 09892bec52 Reverse 2021-01-11 18:46:56 +01:00
Yuri D'Elia 78f8f1e8f9 Remove stray serial newlines in fsensor autoload messages 2021-01-11 18:31:36 +01:00
espr14 211e5f5f37 Define DBG output 2021-01-11 17:31:26 +01:00
espr14 904a23b69e Report calibration results 2021-01-11 17:02:41 +01:00
espr14 2e40a27460 Alignment, comments 2021-01-11 15:40:12 +01:00
DRracer 4728bf2182
Merge pull request #2875 from wavexx/raise_while_preheating
Raise Z while preheating when auto/[un]loading the filament
2021-01-11 07:45:54 +01:00
DRracer 1a6b6fb491
Merge pull request #1776 from wavexx/unused_tmc_defines
Remove an unused define
2021-01-11 07:43:44 +01:00
DRracer ef51652e39
Merge pull request #1758 from wavexx/disable_filament_checks_in_extr_menu
Disable filament checks inside the Move -> Extruder menu
2021-01-11 07:42:25 +01:00
3d-gussner a064ce4722 Add gcode `M123` Tachometer value 2021-01-10 15:15:44 +01:00
D.R.racer 8a083c9970 Add PVB preheat and 0.8mm nozzle presets
minor features reflecting the latest announcement

Needs some 300B of CPU flash though, after 3.9.3 we need to optimize code
size again.
2021-01-08 13:52:39 +01:00
DRracer 5c3513a6cc
Merge pull request #2397 from odaki/flashair_display_ip
Show the FlashAir IP address
2021-01-08 12:20:12 +01:00
DRracer f1f4db0a35
Merge pull request #2850 from 3d-gussner/MK3_PF-build_Fix_EN_ONLY
🐛Fix: PF-build EN_ONLY argument
2021-01-08 12:15:36 +01:00
3d-gussner 67ff9b6b48 Fix typos 2021-01-08 11:01:17 +01:00
3d-gussner 007e59d23c Comment out 'sudo' auto installation
Add '-?' '-h' help output
2021-01-08 11:37:47 +01:00
espr14 584177e8fd Fix E mask 2021-01-08 10:24:36 +01:00
DRracer f549ce690a
Merge pull request #2949 from prusa3d/MK3_3.9.3
Merge 3.9.3 back into MK3
2021-01-08 10:20:40 +01:00
3d-gussner 3329d34ce4 Fix doxygen issue with "^" and "|" only in one line
Doxygen 1.8.13 had no issues but newer doxygen version are failing
to build tables, if a line only consists of "^" and "|"
2021-01-08 09:40:13 +01:00
Mesa Komarevich 2764b94558 Updated the dos2unix instructions to no longer be specific to Debian, as unix based distro's being able to handle windows line endings should be considered an exception, and not the rule. Also fixed a few spelling mistakes in the README. 2021-01-08 09:03:33 +01:00
Mesa Komarevich f7dbc70b9c Added some specific instructions for building firmware with a Debian WSL install. Updated commands to use sudo to avoid permission errors. 2021-01-08 09:03:33 +01:00
DRracer 0ed6b537a8
Merge branch 'MK3' into MK3_3.9.3 2021-01-07 13:27:51 +01:00
D.R.racer 603d704178 Version changed (3.9.3 build 3556) 2021-01-07 12:50:58 +01:00
3d-gussner 8a27b6abdb Move Z up before xy home running xyz calibration
to prevent scratches on bed and sheet
2021-01-07 11:45:40 +01:00
espr14 2981b9e9c5 OctoPrint needs new lines 2021-01-04 14:59:12 +01:00
espr14 cc9e7b9376 Fix comments, remove unused 2021-01-04 13:01:06 +01:00
espr14 49d57ed621 Median dynamic circle 2020-12-30 17:02:31 +01:00
espr14 a9fd09ca3f Implement median 2020-12-30 15:15:17 +01:00
espr14 13fefaa1bf Fix typo 2020-12-30 15:01:32 +01:00
espr14 03b87ae68b Add 8 pixel circle pattern 2020-12-30 13:08:47 +01:00
espr14 c14e725574 Fix moves 2020-12-29 18:27:33 +01:00
espr14 c2ab8785f4 Revert Manhattan 2020-12-29 17:31:34 +01:00
espr14 c1e6567461 Fix step axis coding 2020-12-29 17:17:32 +01:00
espr14 922769cefb axis -> axes 2020-12-29 17:14:18 +01:00
espr14 a01dfe26fe Add Manhattan movement 2020-12-29 17:13:11 +01:00
espr14 6461206e08 Fix direction setting 2020-12-29 14:19:05 +01:00
espr14 b6e78bf900 Fix direction 2020-12-29 14:08:30 +01:00
espr14 c11e8654da Revert both directions, refactor code 2020-12-29 12:39:35 +01:00
espr14 e86ba5e26d Scan only once 2020-12-28 16:45:39 +01:00
D.R.racer 7e02a7f118 Version changed (3.9.3-RC1 build 3555) 2020-12-26 15:45:34 +01:00
DRracer d61cdf2b88
Merge pull request #2932 from espr14/PFW-1165-2
Calibration: Turn off speed optimization due to MK2.5 PFW-1165
2020-12-25 18:22:04 +01:00
espr14 80e32ce1a5 Turn off speed optimization due to MK2.5 2020-12-25 15:27:42 +01:00
DRracer ad68405321
Merge pull request #2931 from 3d-gussner/MK3_3.9.3_SuperPINDA
Add SuperPINDA Support for MK2.5/S for MK3_3.9.3
2020-12-23 21:26:37 +01:00
3d-gussner 12f4102272 Group PINDA defines 2020-12-23 21:00:02 +01:00
3d-gussner 76eb743139 Set default SuperPINDA toggle on MK2.5/S to NO 2020-12-23 20:59:33 +01:00
3d-gussner 4b510fef0a Add PINDA_TEMP_COMP variable to enable SuperPINDA toggle menu/function 2020-12-23 20:59:08 +01:00
3d-gussner a97587f373 Changed PINDA_MINTEMP having own value
Prevent bad readings/issues if someone changes the bed thermistor that is "better" with lower min values and creates a custom firmware.
The firmware will now be in the range of the PINDAv2 thermistor independant from the bed thermistor (which may change and need adjustments)
2020-12-23 20:58:44 +01:00
3d-gussner 732b6e0cad Cleanup 2020-12-23 20:58:20 +01:00
3d-gussner 62c36f718b Add SuperPINDA support for MK2.5/S
- Changed DETECT_SUPERPINDA to SUPERPINDA_SUPPORT as on miniRAMo the thermistor readings below 30°C
  aren't accurate egnough to determine if SUPERPINDA is connected or not
- Add LCD toggle menu Settings -> HW Setup -> SuperPINDA [Yes/No] to overwrite SuperPINDA detection
  - If EEPROM_PINDA_TEMP_COMPENSTATION is empty = 0xff then detect SuperPINDA by checking thermistor
  - If EEPROM_PINDA_TEMP_COMPENSTAION is 0 then forec enable for temperature compensation menues and functions
  - If EEPROM_PINDA_TEMP_COMPENSATION is 1 then force disable for temperature compensation menues and functions
2020-12-23 20:56:50 +01:00
DRracer a8ed6cefcf
Merge pull request #2930 from espr14/PFW-1165
Calibration: Decrease noise PFW-1165
2020-12-23 19:23:26 +01:00
espr14 e6eb3be247 Set jerk = 1, accel. = 1000 2020-12-23 16:56:04 +01:00
espr14 979525f028 Add more restarts 2020-12-22 19:34:12 +01:00
espr14 25d138d198 Revert max.speed 2020-12-22 15:10:01 +01:00
espr14 e24a763e46 Cleanup 2020-12-22 14:45:55 +01:00
espr14 8df2eccf45 Remove defines and unused vars 2020-12-22 14:36:37 +01:00
espr14 25d6e24778 Add comments 2020-12-22 14:16:20 +01:00
espr14 90c8045f7d Clean the code 2020-12-22 13:59:50 +01:00
espr14 20659ec818 Add debug output 2020-12-22 12:51:22 +01:00
espr14 c397e9249a Restart scanning 2020-12-21 19:33:36 +01:00
espr14 1610c96fc4 Fix and report circle divergence 2020-12-21 18:05:52 +01:00
espr14 744763f0a9 Fix diagonal movement 2020-12-21 17:34:54 +01:00
espr14 de23a845b4 Remove unused 2020-12-21 15:53:51 +01:00
espr14 3c9168f8f6 Optimize diagonal 2020-12-21 15:52:25 +01:00
espr14 9a59369c77 Diagonal acceleration 2020-12-21 15:32:09 +01:00
espr14 27ff6b0057 Fix build 2020-12-21 13:11:48 +01:00
espr14 9b55ff9de1 Acceleration up and down 2020-12-21 13:05:26 +01:00
espr14 f39a0999e1 Prepare full acceleration control 2020-12-18 21:33:43 +01:00
espr14 ccf26e4e7a Basic acceleration 2020-12-18 20:04:00 +01:00
DRracer 9141aee916
Merge pull request #2923 from espr14/PFW-1162-4
Calibration: New XY calibration algorithm PFW-1162
2020-12-17 18:23:35 +01:00
espr14 a8f4207df9 New XYZ calibration algorithm 2020-12-17 18:19:36 +01:00
DRracer d167b3bd78
Merge pull request #2870 from leptun/MK3_random_patches
cmdqueue: Patches to Serial communication, pausing and file completion check
2020-11-30 09:01:38 +01:00
Alex Voinea 2ac106d9fe
Merge branch 'MK3' into MK3_random_patches 2020-11-30 09:14:58 +02:00
odaki 61c48df0bd Merge remote-tracking branch 'upstream/MK3' into flashair_display_ip 2020-11-23 15:53:03 +09:00
DRracer 93c3ea75ee
Merge pull request #2893 from leptun/MK3_fix_XYZ_cal_warning
Fix warning and a bit of indentation @XYZ calibration
2020-11-16 10:10:52 +01:00
Voinea Dragos f96f75bd17 Fix warning and a bit of indentation
Saved 64B of flash and 1B of SRAM
2020-11-16 10:58:26 +02:00
Voinea Dragos f3953d7c83 Merge branch 'MK3' into MK3_random_patches 2020-11-16 09:11:12 +02:00
odaki c0070506fb Merge branch 'MK3' into flashair_display_ip 2020-11-13 22:28:22 +09:00
DRracer d013abfd52
Merge pull request #2890 from prusa3d/MK3_3.9.2
Merge MK3_3.9.2 into MK3
2020-11-13 13:03:35 +01:00
DRracer 04bb4b5dad
Merge pull request #2573 from leptun/MK3_filecheck_progress_bar
Progress bar for check_file()
2020-11-13 11:56:04 +01:00
Alex Voinea 807eddafb0
Remove debugging code 2020-11-13 12:12:18 +02:00
Alex Voinea 43ace00a24
Fill the progress bar at the end and code optimizations 2020-11-12 18:43:48 +02:00
Alex Voinea 5ad125cbed
Merge branch 'MK3' into MK3_filecheck_progress_bar 2020-11-12 15:53:33 +02:00
D.R.racer 396ee0fde2
Version changed (3.9.2 build 3524) 2020-11-10 10:27:18 +01:00
DRracer e86be5a30a
Merge pull request #2888 from DRracer/391-sp
Calibration point center search repeat
2020-11-10 09:09:14 +01:00
Voinea Dragos 176e2674b9 Fix M105 ok hack 2020-11-09 21:49:56 +02:00
Voinea Dragos 023ccb0e89 Fix double ok in M603 2020-11-09 21:49:56 +02: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 ff56ece6f8 Remove redundant get_command prototype 2020-11-09 21:49:56 +02:00
Alex Voinea 5f0e4a1cac Temporary M602 patch. Needs more work 2020-11-09 21:49:56 +02:00
Alex Voinea 6873a9d28e Only send capabilities when M115 is run without arguments 2020-11-09 21:49:56 +02:00
Alex Voinea 0ee8e1f424 Fix missing ok in M601 2020-11-09 21:49:56 +02:00
Alex Voinea e5ebf7c67f Fix missing keep-alive messages 2020-11-09 21:49:56 +02:00
Alex Voinea 26f62f042e Use the longest filename instead of just using the long filename in M27 2020-11-09 21:49:56 +02:00
D.R.racer 4747c8c9f5 Increase top Z-offset limit based on some test results 2020-11-09 12:29:19 +01:00
D.R.racer 5184910ef9 Try harder finding the calibration center
with alternative PINDAs it looks like their properties vary a lot
and searching for the calibration center requires trying different
Z levels.
2020-11-09 06:33:41 +01:00
DRracer ed0494af18
Merge pull request #2885 from DRracer/391-sp
XYZ calibration tune
2020-11-06 09:35:33 +01:00
D.R.racer cd4e16ef9f XYZ calibration tune
PFW-1159
2020-11-06 08:25:56 +01:00
Yuri D'Elia f37f132ee4 Allow all microstep resolutions for all axes 2020-11-04 16:07:00 +01:00
3d-gussner 7651fbb0d1 Fix output "Configuration_prusa.h" delay if compiling failed. 2020-11-02 17:11:24 +01:00
3d-gussner a5ba666af0 Changed from arguments to flags/options
Check for "gawk" on Linux
Add argument to change build number automatically to current commit or define own number
Update exit numbers 1-13 for prepare build env 21-29 for prepare compiling 30-36 compiling
2020-11-02 14:54:16 +01:00
3d-gussner 16165ffcad Merge branch 'MK3' into MK3_PF-build_Fix_EN_ONLY 2020-11-02 10:52:47 +01:00
Yuri D'Elia e28159122f Make MIN_Z_FOR_LOAD/UNLOAD the same
When unloading + preheat immediately followed by a load, the carriage is
raised first up to 20mm, then again to 50mm.

With PR #2318 it makes sense to make more space for the extra extrusion
anyway, so make them the same. This moves the carriage only once _while_
preheating, which is nice.
2020-10-29 15:30:16 +01:00
Yuri D'Elia 5f23474c95 Raise Z while preheating when auto/[un]loading the filament
Preheating already raised Z to avoid scorching the PEI sheet, as does
filament loading/unloading to allow for excess material to be removed.

However, when loading/autoloading/unloading via the LCD with a cold
nozzle the preheating menu is performed before the carriage is raised,
leaving the carriage close to the sheet while heating the nozzle.

Pre-raise the carriage already while waiting, so that the subsequent
move is automagically skipped.

Set bFilamentWaitingFlag only once to perform both the LCD
initialization and raising to the appropriate height.

Should fix #2761
2020-10-28 20:49:28 +01:00
DRracer 2103d2f588
Merge pull request #2852 from MartinPoupa/LCD_status_changed
Lcd status changed
2020-10-21 17:07:39 +02:00
DRracer c05d4c9112
Update messages.h
cleanup space
2020-10-21 17:04:20 +02:00
MartinPoupa a84d7ef8d6 corectino of declaration 2020-10-13 16:56:57 +02:00
MartinPoupa c8c7563e8a LCD status changed
When the lcd status changed it will be printed "LCD status changed" to serial line.
2020-10-07 17:44:17 +02:00
3d-gussner e3b3e66665 Clean PF-Firmware build when changing git branch 2020-10-05 15:25:54 +02:00
3d-gussner 93fd3c95a9 Disable pause and warnings using command line with all needed arguments
Install needed apps under linux if needed.
2020-10-05 13:18:18 +02:00
3d-gussner ffc7a5344a Typo fix 2020-10-02 18:56:50 +02:00
3d-gussner 2dbce5c0cb Add UNKNOWN as agrument option 2020-10-02 18:54:18 +02:00
3d-gussner a6a4a0b71d Bug fix if using argument EN_ONLY.
Thank to @leptun for pointing out.
2020-10-01 16:49:38 +02:00
Yuri D'Elia df824414ef Fix probing in IR_SENSOR 2020-09-28 21:02:06 +02:00
Yuri D'Elia c2e8d229a7 Be more compliant in the I2C protocol
- Enter a repeated-start for reading data
- Write in the same session
2020-09-28 20:21:07 +02:00
odaki ebc987bd23 Merge branch 'MK3' into flashair_display_ip 2020-09-28 21:19:44 +09:00
Yuri D'Elia 384f40956c Remove obsolete cbi/sbi 2020-09-27 16:42:20 +02:00
Yuri D'Elia 6d476d7144 Still use SWI2C on RAMBo10a boards
The wiring for the PAT9125 on RAMBo10a boards is not directly connected
to the SCL pin and requires the sw mode.

Detect this requirement by checking the definition for the SWI2C_SCL pin
in the board definition.

Remove SWI2C_SCL/SDA from the other boards to use the HW mode.
2020-09-27 14:29:07 +02:00
DRracer 134f841380
Merge pull request #2841 from leptun/MK3_SD_REMOVED_MESSAGE
SD card released message
2020-09-23 10:22:04 +02:00
DRracer 95e2e2f69c
Merge pull request #2832 from leptun/MK3_AUTO_REPORT_TEMPERATURES
Mk3 auto report temperatures
2020-09-23 08:51:26 +02:00
DRracer ef0840f587
Merge pull request #2786 from leptun/MK3_M115_Capabilities_report
Printer Capabilities framework + Macros + Code cleanup
2020-09-23 08:37:03 +02:00
Alex Voinea d9fa44c142
Document M155 command 2020-09-23 09:14:35 +03:00
DRracer e24466f22e
Merge pull request #2837 from prusa3d/MK3_3.9.1
Merge MK3_3.9.1 into MK3
2020-09-22 10:43:59 +02:00
odaki 4c7100985e Merge branch 'MK3_3.9.1' into flashair_display_ip 2020-09-22 11:59:05 +09:00
D.R.racer 7278458316 Version changed (3.9.1 build 3518) 2020-09-18 16:59:22 +02:00
3d-gussner bd7bb5acb3
Update new messages and their translations (#2835)
* Add missing translations

* Add missing CZ and IT translations

* Update CZ, FR, IT, ES translations
CZ thanks to @DRracer
FR thanks to Carlin Dcustom
ES tried myself
IT thanks to @wavexx

Only missing is PL

* Improve wording +change keys

* Add missing PL translations

* Fix copy paste error in Italian
fix double translations

* Make PL translation shorter

* Fix some length issues and capital letters

* Fixed again translations length issues
updated po files

* Update FR translation - thanks @awenelo

* Fix execution of lang-check.py

- Make lang-check.py executable
- Execute directly instead of specifying the python interpreter manually
  ("python" is no longer available on Debian, and would default to
  version 2 prior to that despite being written for python 3)

* Fix permissions of translation files

Co-authored-by: D.R.racer <drracer@drracer.eu>
Co-authored-by: Yuri D'Elia <wavexx@thregr.org>
2020-09-18 16:50:25 +02:00
DRracer 5e322092b3
Merge pull request #2833 from leptun/MK3_3.9.1
Mk3 3.9.1 - Experimental menu quickfix
2020-09-16 07:48:20 +02:00
Voinea Dragos 2f5083daa7
quickfix to mistake made in the experimental menu visibility code
Fix indentation
2020-09-15 18:56:39 +03:00
DRracer 9fb6efc435
Add newline at the end of file 2020-09-15 14:56:41 +02:00
Voinea Dragos c0fced2f3c Fix typo 2020-09-15 14:21:21 +03:00
Voinea Dragos e2ef5af40e Add capability line 2020-09-15 14:21:09 +03:00
Voinea Dragos a1dfbffedb Merge branch 'MK3_M115_Capabilities_report' into MK3_AUTO_REPORT_TEMPERATURES 2020-09-15 13:39:00 +03:00
Voinea Dragos 073eadff7e Merge branch 'MK3' into MK3_AUTO_REPORT_TEMPERATURES 2020-09-15 13:38:47 +03:00
DRracer 3093c8c7f6
Merge pull request #2829 from wavexx/la10_15_readjust
Re-adjust LA10->15 conversion
2020-09-15 11:59:07 +02:00
Alex Voinea 6bc59197ad
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2020-09-12 08:28:13 +03:00
Alex Voinea c158259970
Remove unused where C++ alternative can be used 2020-09-11 20:04:06 +03:00
Alex Voinea 44b1b1c219
More macros 2020-09-11 18:48:44 +03:00
Alex Voinea c3abd4ffe6
Remove io_atmega2560.h and some more macros 2020-09-11 17:43:38 +03:00
Alex Voinea eb007c35d2
Macros initial 2020-09-11 16:12:49 +03:00
Alex Voinea 160af0a624
Printer capabilities 2020-09-11 16:11:28 +03:00
3d-gussner fef5b02010 Tag as community contribution 2020-09-09 12:34:25 +02:00
3d-gussner e4a444ce5a Updated few translations
thanks to @vintagepc and @jurriaan for the feedback
2020-09-09 12:30:57 +02:00
3d-gussner 4d3aa1b59a Merge remote-tracking branch 'upstream/MK3' into MK3_Dutch
Merge upstream/MK3
Fix conflicts
update Dutch translation
2020-09-09 11:37:35 +02:00
DRracer f145769e98
Merge pull request #2807 from leptun/MK3_Polling
M220 M221 polling of values
2020-09-09 10:25:36 +02:00
DRracer 763d2d9849
Merge pull request #2806 from leptun/MK3_PRUSA_SN
Make the serial number available to the user
2020-09-09 09:54:29 +02:00
DRracer a0420c7928
Merge pull request #2619 from 3d-gussner/MK3_G21
Add dummy G21 to prevent UNKOWN warnings in serial
2020-09-09 09:22:07 +02:00
DRracer b82ee3fc06
Merge pull request #2811 from leptun/MK3_fastio_timer_patch
Fix fastio extra parenthesis
2020-09-09 08:57:37 +02:00
DRracer a2db9e8f6b
Merge pull request #2585 from leptun/MK3_FEEDRATE
🐛♻️ Update the feedrate percentage before drawing the screen
2020-09-09 08:56:46 +02:00
DRracer f08f71a45b
Merge pull request #2828 from leptun/MK3-fix_back_view
Menu view return patch
2020-09-08 09:45:28 +02:00
Yuri D'Elia 26e900896a Re-adjust LA10->15 conversion
After fixing some LA15 issues, the strenght of LA15 increased.
As such, re-adjust the conversion factor so that:

Start K10 => 0.01 (previous minimum was K15)
PLA   K30 => 0.05 (was 0.07, optimal 0.045-0.06)
PETG  K45 => 0.08 (was 0.13, optimal 0.07-0.11 depending on material/temp)
2020-09-07 21:44:34 +02:00
Alex Voinea 7ac16d5f04
Menu view return patch 2020-09-07 19:42:53 +03:00
D.R.racer 02891f6bb8 Version changed (3.9.1-RC1 build 3512) 2020-09-02 11:56:53 +02:00
Alex Voinea 3e7bba54e0
SD card released message 2020-08-28 17:32:07 +03:00
Yuri D'Elia e37cdab38f PAT9125_I2C: accept either NACK or ACK in receive
Both would be technically correct.
2020-08-25 12:15:55 +02:00
Yuri D'Elia d8a8837938 Document the 3 possible modes 2020-08-25 11:32:05 +02:00
Alex Voinea 1659f61dd5
Fix fastio extra parenthesis 2020-08-21 10:51:46 +03:00
Yuri D'Elia 30e7b777e0 Error-out with PAT9125_SWSPI (not fully implemented)
.. and likely will never was/be.
2020-08-20 22:13:13 +02:00
Yuri D'Elia 7f425120f0 Strip down the TWI code
- Only implement a single syncronous read/write function to read a byte,
  since that's all we need currently
- Implement a compact IR_SENSOR probe for PAT9125
- Saves 242 bytes compared to PAT9125_SWI2C
2020-08-20 22:13:04 +02:00
DRracer 772844678f
Merge pull request #2809 from leptun/PFW-1134-ALTFAN_KILLSWITCH
Pfw 1134
2020-08-20 15:42:03 +02:00
Yuri D'Elia 240dc1132e Include initial implementation based on Arduino's twi 2020-08-20 15:34:46 +02:00
Yuri D'Elia 502bc8c72d Isolate more pat9125 code
Remove probing from Marlin_main and move it into pat9125_probe so that
it can support the various variants.
2020-08-20 15:34:46 +02:00
Alex Voinea a41164b3df
Merge pull request #5 from 3d-gussner/patch-4
Update ALTFAN eeprom documentation
2020-08-20 16:18:39 +03:00
3d-gussner 90c36a5887
Update ALTFAN eeprom documentation
EEPROM_ALTFAN_OVERRIDE and EEPROM_EXPERIMENTAL_VISIBILITY are compared to 0xFF in the code that's why I keep the uint8.
2020-08-20 15:14:39 +02:00
Alex Voinea 2c2926882a
Don't switch unnecessarily. Also "\n" the ";S" request 2020-08-18 19:29:18 +03:00
Alex Voinea 8d9dc73d1b
Fix compile error
fix compile


Fix compile error
2020-08-12 17:25:49 +03:00
Alex Voinea 5530b99882
Reboot after factory reset 2020-08-12 12:46:35 +03:00
Alex Voinea 6b853a4cc3
Auto-detect ALTFAN after fw. update 2020-08-12 12:19:08 +03:00
Alex Voinea 96435ad084
Move experimental menu to HW setup 2020-08-12 08:48:12 +03:00
DRracer 008d3b0e65
Merge pull request #2792 from wavexx/MK3_fix_high_speed_deceleration
Mk3 fix high speed deceleration
2020-08-06 13:27:52 +02:00
DRracer 89ecf2ce3a
Merge pull request #2791 from wavexx/stack_protect_reentrant_isr
Fix stack smashing in temperature/fsensor ISR
2020-08-06 13:26:33 +02:00
DRracer d0eca4d5c4
Merge pull request #2794 from leptun/PFW-1134-ALTFAN_KILLSWITCH
Minor documentation fixes to altfan PR
2020-08-06 12:53:34 +02:00
Alex Voinea f1a8657093
Minor documentation fixes
Add even more comments


a
2020-08-06 12:20:38 +03:00
DRracer 22a8c18551
Merge pull request #2784 from leptun/PFW-1134-ALTFAN_KILLSWITCH
altfan killswitch
2020-08-06 08:15:42 +02:00
Yuri D'Elia b3af08d94a Fix stack smashing in temperature/fsensor ISR
The temperature and fsensor ISR re-enable interrupts while executing.

However, we still need to protect the epilogue of the ISR so that
the saved return address is not altered while returning.

We hoist the body of the function out of the isr in both cases for
clarity (and to avoid a stray return bypassing the lock/cli), so that
the re-entrant portion is clearly indicated.

This should fix the "STATIC MEMORY OVERWRITTEN" error messages randomly
happening when stepping at high frequency (where either isr is
preempted more frequently).
2020-08-05 17:47:46 +02:00
DRracer f1bde1a039
Merge pull request #2724 from wavexx/max_ambient
Implement MIN/MAX AMBIENT safety checks
2020-08-05 08:52:55 +02:00
DRracer c0ea67abbf
Merge pull request #2785 from wavexx/la15_acc_fixes
Linear Advance 1.5 Fixes
2020-08-05 08:38:45 +02:00
Yuri D'Elia a2c7dcbbf8 Fix indentation 2020-08-04 13:14:35 +02:00
DRracer 91014b69f5
Merge pull request #2790 from Gottox/patch-1
Update README.md
2020-08-04 11:06:33 +02:00
Alex Voinea 654a3a0d79
Other requested changes 2020-08-04 10:43:30 +03:00
Alex Voinea e0bf92cd4e
Change bool literal to int 2020-08-04 09:54:57 +03:00
DRracer d4cb740d65
Merge pull request #2736 from prusa3d/mkbel-patch-2
Update README.md
2020-08-04 08:19:04 +02:00
Yuri D'Elia b8e8f182ca Add reference C implementations for MultiU16X8toH16/MultiU24X24toH16
Higher step counts might still overflow the ASM MultiU24X24toH16.

e4595fa24a
2020-08-03 19:03:13 +02:00
Yuri D'Elia 30a806608f Also convert acceleration_rate to uint32_t
acceleration_rate is also unsigned
2020-08-03 19:01:38 +02:00
Yuri D'Elia aebaca5cdc Correct comments regarding acceleration ramp
Backport fixes from upstream Marlin
2020-08-03 18:53:13 +02:00
Yuri D'Elia 8108d50b59 Reintroduce/fix check for step_rate underflow during deceleration
Check for negative results and results under the final_rate
2020-08-03 18:53:13 +02:00
Yuri D'Elia 4654283f54 Restore indentation 2020-08-03 18:16:20 +02:00
Alex Voinea 12be141188 Fix high speed deceleration 2020-08-03 18:16:13 +02:00
Enno Boland ae0d8082de
Update README.md
Fix small typo in README.md
2020-08-03 09:00:36 +02:00
Yuri D'Elia a8ce9358e5 Avoid redundant temperature error strings
Factor-out MIN/MAXTEMP [BED/AMB] out of the error message, which is now
built at runtime instead.

Introduce two missing ultralcd functions lcd_setalertstatus and
lcd_updatestatus to handle regular strings.

246272 -> 246084 = 188 bytes saved
2020-08-01 17:47:42 +02:00
Yuri D'Elia e1c79c342d Re-introduce redundant disable_heaters() calls
Partially revert 285b505c73a54e9af01816e3a614de73ad181851 so that
we ensure heaters are disabled ASAP in case of potential bugs
in the max_*_error functions.
2020-08-01 17:47:20 +02:00
Yuri D'Elia a60ed81a35 Implement MIN/MAX AMBIENT safety checks
Take advantage of the NTC thermistor found on the Einsy as an additional
safety measure, following the steps of the other MIN/MAXTEMP errors.

Introduce two configurable params AMBIENT_MINTEMP and AMBIENT_MAXTEMP
in the variant defines and set them for the MK3/MK3S to -30/+100
respectively.

AMBIENT_MINTEMP is primarily intended to catch a defective board
thermistor (to ensure MAXTEMP would be properly triggered) and thus the
trigger temperature is set just above the sensing limit and well below
the operating range.

AMBIENT_MAXTEMP is set at 100C, which is instead 20C above the maximum
recommended operating temperature of the Einsy. The NTC thermistor is
located just above the main power connector on the bottom of the board,
and could also help in detecting a faulty connection which can result in
rapid overheating of the contacts.

As for MAXTEMP, we cut power to the heaters, print fan and motors to
reduce power draw. Resume is not possible except by resetting the
printer, since the user is highly advised to inspect the board for
problems before attempting to continue.
2020-08-01 17:38:10 +02:00
Yuri D'Elia 3336db7954 Add some important notes about thermistor ADC handling 2020-08-01 17:36:43 +02:00
Yuri D'Elia 65f25b0d7e Remove redundant disable_heater() calls in max/min_temp handling
In max/min_temp handlers remove the redundant disable_heater() call.
Handlers already need to call Stop(), which will disable all heaters
as the first step.

Fix comments in order to mention that all heaters get disabled.
Use "MAX/MINTEMP BED" correctly in both the LCD and serial.
2020-08-01 17:36:43 +02:00
Yuri D'Elia 942fca5b66 Remove useless assignment
target_temperature_bed is already reset by disable_heaters() in Stop()
2020-08-01 17:36:43 +02:00
Yuri D'Elia 87bc5a78b6 Remove bogus comment (BED_MINTEMP *is* implemented) 2020-08-01 17:36:43 +02:00
Alex Voinea 773c6997ef
Add comments 2020-07-29 17:36:03 +03:00
Alex Voinea ec6a20971e
Add experimental menu to HW_setup 2020-07-29 11:23:24 +03:00
Alex Voinea d8fbd46cd2
M155 2020-07-23 17:28:25 +03:00
Alex Voinea e2856ba4f5
Make the serial number available to the user 2020-07-21 12:52:04 +03:00
Alex Voinea a95feb56d9
ALTFAN override 2020-07-20 19:35:25 +03:00
Yuri D'Elia 78bbfc6237 Fix delay calculations inside babystep()
- Avoid all delays when using DEDGE stepping
- Correctly account for direction change delays
2020-06-24 17:58:43 +02:00
Yuri D'Elia 6ea198a866 Fix DEDGE in sm4.c (fixes xyz calibration) 2020-06-24 17:58:43 +02:00
Yuri D'Elia e6b182aa9f Implement proper step/delay pauses in tmc2130 functions
Add constants for the various required delays in tmc2130.h,
which will come in handy for stepper.cpp as well.

Move the delays in the _set functions and remove the pauses
from the various calling points and macros.

Note that the hard-coded pause wouldn't cut it for the stepper ISR,
but it's fine for other use cases.
2020-06-24 17:58:43 +02:00
Yuri D'Elia 1181beffb1 Enable DEDGE stepping on supported variants 2020-06-24 17:58:43 +02:00
Yuri D'Elia 6ceca9bf85 Implement double-edge stepping
Introduce new wrapper macros to tick the stepper pins.
Default to the original raising-edge stepping mode.

When using the TMC double-edge stepping mode (aka half-wave or
square-wave mode) the _LO macros become no-ops.
2020-06-24 17:58:43 +02:00
Yuri D'Elia 6017600714 Reintroduce the ability to disable TMC interpolation per-axis 2020-06-24 17:58:43 +02:00
Yuri D'Elia 1c026f0e4d Always sync before manipulating the planner position in FWRETRACT
Calling plan_set_*_position should never be done without a sync, since
the current_position can be (and usually is) several steps ahead.

In retract() and inside the autoretract support, call st_synchronize()
prior to calling any of these functions so that we don't corrupt the
position of the backend!

When unretracting, split the Z and E moves in two steps so that the E
unretraction is not slowed down by the Z axis.

Fix the indentation of the affected code.
2020-06-24 17:45:38 +02:00
Yuri D'Elia d53c55ce64 Disable filament checks inside the Move -> Extruder menu 2020-06-24 16:10:32 +02:00
Alex Voinea a0cf5714ce
M220 M221 2020-06-19 15:39:16 +03:00
Marek Běl 4c5fe05333
Update README.md
Mention gawk dependency for multi language.
2020-06-11 18:32:36 +02:00
odaki 3d979a88a5 Merge remote-tracking branch 'upstream/MK3' into flashair_display_ip 2020-05-20 12:37:07 +09:00
Alex Voinea b1a83c8add
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2020-05-19 16:37:47 +03:00
odaki dfd60a843d Merge remote-tracking branch 'upstream/MK3' into flashair_display_ip 2020-05-10 10:25:13 +09:00
odaki a1254b3a3c Merge branch 'MK3_3.9.0' into flashair_display_ip 2020-04-29 10:19:51 +09:00
odaki c34c622b3c Merge branch 'MK3_3.9.0' into flashair_display_ip 2020-04-28 00:14:47 +09:00
Alex Voinea 0e25eaee8f
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2020-04-19 16:02:11 +03:00
3d-gussner 1bac0c1765 Add dummy G21 to prevent UNKOWN warnings in serial
And as Prusa firmware operates ONLY in milimeters it kind of does what G21 is supposed to do.
2020-04-18 16:39:04 +02:00
Alex Voinea 4c4b4c489c
🐛♻️ Update the feedrate percentage before drawing the screen 2020-04-07 17:10:27 +03:00
3d-gussner 0daa916c8d Merge remote-tracking branch 'upstream/MK3' into MK3_Fix_LCD_stats 2020-04-02 15:14:00 +02:00
3d-gussner dbd07c1d1c Limited LCD output of several uint16 values to 999 2020-04-02 15:11:46 +02:00
Alex Voinea f8843b25b0
Progress bar for check_file() 2020-04-02 13:21:53 +03:00
Alex Voinea 4670c42aeb
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2020-03-26 18:17:26 +02:00
odaki 684b47e417 Update reference URL
There was an official website of Toshiba called "FlashAir Developers '', and
there was information necessary for FlashAir development, but since it closed in September 2019.
Instead, I will point an archive site for developers.
2020-03-15 19:04:02 +09:00
Alex Voinea e914f8e0da
Show "Sorting folders" when folders are being sorted 2020-03-05 13:06:37 +02:00
Alex Voinea 355b003b7f
menu_data_reset() 2020-03-04 22:20:53 +02:00
Alex Voinea 40ebd455f2
Safer menu interrupt call 2020-03-04 22:14:53 +02:00
Alex Voinea 22432b1053
Reset menu state after lcd_sd_refresh 2020-03-04 21:07:51 +02:00
Alex Voinea 5edc1ef297
Fix updir and dir again 2020-03-04 21:03:57 +02:00
Alex Voinea 57c149e7b5
Comment cleanup 2020-03-04 21:01:08 +02:00
Alex Voinea 7b19715c99
Cache sdSort 2020-03-04 20:41:17 +02:00
Alex Voinea f35e553373
Code cleanup 2020-03-04 20:33:43 +02:00
Alex Voinea 8e47cb35a3
Possible fix to longpress in sdcard menu 2020-03-03 15:29:10 +02:00
Alex Voinea d1968f6ff0
Option to refresh/resort SDcard files when flashAir type is selected 2020-03-03 15:17:50 +02:00
Alex Voinea f69a68b966
Fix subdir enter and exit 2020-03-03 14:55:08 +02:00
Alex Voinea 53e130fc6d
Merge branch 'MK3' into MK3_NEW_SD_COMPILATION 2020-03-03 14:14:43 +02:00
Yuri D'Elia 497637ee84 Remove hard-coded X/Y jerk limits 2020-02-18 12:23:42 +01:00
3d-gussner 6d721c9b82 Merge remote-tracking branch 'upstream/MK3' into MK3-Fix_M120_M121
Fix merge with FW3.9.0-beta
2020-01-23 14:46:48 +01:00
vintagepc 8457edfc2b Merge branch 'MK3' of https://github.com/prusa3d/Prusa-Firmware into 2091_2153_sheet_Mcode 2020-01-19 08:58:56 -05:00
odaki a2692665f8 Merge remote-tracking branch 'upstream/MK3' into flashair_display_ip 2020-01-18 22:26:52 +09:00
odaki b09761ed71 Remove '/*' from M46 source
I forgot to remove the unintended comment start mark when merge.
It has been deleted.
2020-01-16 21:38:39 +09:00
odaki 24b748c4ac Merge remote-tracking branch 'upstream/MK3' into flashair_display_ip 2020-01-16 21:25:55 +09:00
odaki 99545a006c M46 "Show the assigned IP address" activated
According to the reprap wiki, M46 has been assigned to display its assigned IP address, but has been disabled.
Now that Toshiba FlashAir IP address processing is working, I activate the M46 code so that I can read the IP address information via serial.
2020-01-12 12:45:43 +09:00
odaki 2ca1bc0acb Support W-04 firmware 4.0.0.01+
W-04 needs to use  CMD17 instead of CMD48 to retrieve iSDIO register memories.
To supporting both W-03 and W-04 card, I changed the readExt() code to use CMD48 first and use CMD17 if it returned some error.
This method is from the FlashAir developer sample code.
https://flashair-developers.github.io/website/docs/tutorials/arduino/2
2020-01-11 21:47:16 +09:00
Alex Voinea 29d0537004
Adjusted progress bar 2020-01-08 21:32:45 +02:00
Alex Voinea e295c83d09
Folder sorting shellSort 2020-01-08 21:16:08 +02:00
3d-gussner 6a7ae6231d Merge remote-tracking branch 'upstream/MK3' into MK3_Dutch 2020-01-08 16:02:00 +01:00
3d-gussner d895890608 Merge remote-tracking branch 'upstream/MK3' into MK3-Fix_M120_M121 2020-01-08 15:59:16 +01:00
Alex Voinea 7028583e9b
Merge branch 'MK3_ShellSort' into MK3_NEW_SD_COMPILATION 2020-01-08 16:27:31 +02:00
Alex Voinea 37dc5fed45
Merge branch 'MK3_revised_filename_scrolling' into MK3_NEW_SD_COMPILATION 2020-01-08 16:26:51 +02:00
Alex Voinea 1ba89b9689
Merge branch 'MK3' into MK3_ShellSort 2020-01-07 14:18:31 +02:00
odaki f923427dc1 Show the FlashAir IP address
Displays the FlashAir IP address in the "Support" menu if the card is available.
If no IP address has been assigned yet, "0.0.0.0" will be displayed.
2020-01-04 12:51:20 +09:00
Alex Voinea f0f7db57ea
Fist attempt at "saved position SD menu" 2019-12-17 00:45:25 +02:00
Alex Voinea 3ad611ca16
Merge branch 'MK3' into MK3_revised_filename_scrolling 2019-12-16 21:39:27 +02:00
Yuri D'Elia 19589f02f1 Remove an unused define 2019-12-04 17:22:21 +01:00
Alex Voinea 63655a906a
Merge branch 'MK3' into MK3_revised_filename_scrolling 2019-11-30 01:31:48 +02:00
Alex Voinea 103e29d38a
Merge branch 'MK3' into MK3_ShellSort 2019-11-29 16:52:20 +02:00
Alex Voinea 7753750fa7
Change for to while 2019-11-27 17:31:47 +02:00
Alex Voinea 11ba616d73
Define for dumping sorting process 2019-11-27 11:03:34 +02:00
Alex Voinea 66e51aa298
Folder sorting finished 2019-11-26 15:49:45 +02:00
Alex Voinea f5bdbcc0bd
Cleanup file compare statement 2019-11-26 14:10:44 +02:00
Alex Voinea a7f2e640e0
Put folders at the beginning 2019-11-26 13:57:08 +02:00
Alex Voinea 960f4a88ed
Status bar, lcd optimization, compile warning fix 2019-11-26 13:36:28 +02:00
Alex Voinea f87b5a2be7
SORTING_DUMP 2019-11-26 12:18:11 +02:00
Alex Voinea b803b2a2dd
Another first implementation 2019-11-26 11:29:57 +02:00
Alex Voinea d40656e3ca
Small changes to rendering 2019-11-24 19:16:22 +02:00
Alex Voinea 273d834b19
Fix card removal 2019-11-22 20:27:24 +02:00
Alex Voinea 2fd192a95d
Set scroll delay to 300ms 2019-11-22 20:14:55 +02:00
Alex Voinea fdab70fa3a
Dir fixes 2019-11-22 14:39:21 +02:00
Alex Voinea 8a806bceea SDDIR 2019-11-21 21:32:52 +02:00
Alex Voinea 6538262e75 First build that actually works 2019-11-21 19:04:45 +02:00
Alex Voinea 8f901d2613 Temporary fix 2019-11-21 14:58:13 +02:00
Alex Voinea b3a587f5a4 SD first attempt. Broken 2019-11-20 20:25:51 +02:00
3d-gussner 21dcfb23f4 Follow RepRap Wiki G-codes documentation
M120 is Enable endstops
M121 is disable endstops
I guess this was just a typo issue.
2019-10-31 15:31:08 +01:00
3d-gussner c772fd2cae Merge branch 'MK3' into MK3_Dutch 2019-10-24 16:44:27 +02:00
3d-gussner 3ed694f1e1 Updated `lang_en_nl.txt` with newest translations 2019-10-24 16:02:58 +02:00
3d-gussner a4211da8f0 Merge branch 'MK3' into MK3_Dutch 2019-10-24 15:39:32 +02:00
3d-gussner f25f697fd0 Some more missing translation 2019-10-24 15:39:06 +02:00
3d-gussner 2eb2385a2e Updated po files 2019-10-03 19:41:26 +02:00
3d-gussner 527f0359f0 Update Dutch translation to v3.8.1-RC1 2019-10-03 19:02:15 +02:00
3d-gussner b52f42b397 Merge branch 'MK3' into MK3_Dutch 2019-10-03 18:54:53 +02:00
3d-gussner e765fe5b60 Updated Dutch translation to latest merge
some messages have been deleted
2019-10-02 11:15:34 +02:00
3d-gussner a4e9f08e16 Merge branch 'MK3' into MK3_Dutch 2019-10-02 11:11:28 +02:00
3d-gussner 2d82374c2b Merge branch 'MK3' into MK3_Dutch
Fix merge conflicts
2019-09-23 18:48:35 +02:00
3d-gussner 18e1a2266a Update `.po` files after modifying `lang_en*.txt` files 2019-09-21 13:52:12 +02:00
3d-gussner 09360b26f4 Update `lang_en_nl.txt` to latest PRs made in MK3 branch 2019-09-21 13:11:48 +02:00
3d-gussner 38f8d419d7 Fix translation file and odd chars in `lang-import.sh` 2019-09-21 12:07:51 +02:00
3d-gussner 049cca297b Merge branch 'MK3' into MK3_Dutch
Merge with MK3 and fix merge issues
2019-09-21 11:54:31 +02:00
3d-gussner 00fb7e5c5c Update Dutch po files 2019-09-14 17:03:21 +02:00
3d-gussner 92d61c6de3 Translated to Dutch 2019-09-14 17:01:16 +02:00
3d-gussner 036d8b1d09 Create new language files #2 2019-09-14 16:27:51 +02:00
3d-gussner e60aceae93 Create new language files 2019-09-14 16:26:57 +02:00
3d-gussner 749e356358 more typo 2019-09-14 15:59:44 +02:00
3d-gussner ee6f074775 Fix typo 2019-09-14 15:57:51 +02:00
3d-gussner c76da6ccff Another syntax fix 2019-09-14 15:57:08 +02:00
3d-gussner 23f786ad7e Looks nicer 2019-09-14 15:54:37 +02:00
3d-gussner 7a5aa352aa Fix syntax 2019-09-14 15:52:59 +02:00
3d-gussner 2c174964da Update documentation 2019-09-14 15:50:25 +02:00
3d-gussner 9a7a909c6f Prepare adding new language 2019-09-14 15:49:33 +02:00
vintagepc bc31de2201 Add Bed/Pinda temp setting support to M850 2019-09-13 18:17:53 -04:00
vintagepc 6ad105f91f Add M850 code for setting sheet label and offsets 2019-09-12 18:32:13 -04:00
Vojtech Pavlik a4bc91ed2f M0/M1/M117 fix: Use CUSTOM_MSG states in M0/1/M117
Now that we have the new CUSTOM_MSG states, we can use them in the M0/M1
and M117 handlers to force the user message to be displayed even when
the printer is printing from a SD card and displaying a file name.
2019-06-06 14:25:36 +02:00
Vojtech Pavlik 5494f23942 M0/M1/M117 fix: Add new CUSTOM_MSG states.
When the printer prints from a SD card, the display of progress messages
and filename takes precedence over CUSTOM_MSG_TYPE_STATUS messages used
by M0/M1/M117. Let's introduce two new CUSTOM_MSG states, one that
overrides the SD status while waiting in M0/M1 (M0WAIT) and one that
ensures the message will be displayed in at least one screen update
(MSGUPD).
2019-06-06 14:25:06 +02:00
Vojtech Pavlik 5d8eb84965 M0/M1/M117 fix: Move M0/M1 to the top of decoder.
Move M0/M1 decoding before any other command. The M0/M1 message can contain
arbitrary characters and so it also can contain substrings that other
decoders trigger on, like the letter 'G'. Any such substring would cause
misdecoding of the M0/M1 and unpredictable behavior in addition to not
making the printer stop.

M117 already received the same treatment in the past, so we take the same
approach for M0/M1.
2019-06-06 14:24:34 +02:00
Jiri Jirus d0f1caf5b8
y-axis self-test hack cleanup
y-axis could not pass self-test when printer build on custom frame with value Y_MIN_POS less then -8
2019-05-02 15:39:18 +02:00
metacollin 5cac3c9254 Make NEW_XYZCAL respect INVERT_*_DIR #defines. 2018-10-17 06:00:23 -06:00
Carsten Weiße bd7b3e0c52
Fix upper limit for x 2018-07-12 12:09:48 +02:00
830 changed files with 264697 additions and 77381 deletions

21
.cmake-format.py Normal file
View File

@ -0,0 +1,21 @@
# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on it's own line.
dangle_parens = True
dangle_align = 'child'
# If true, the parsers may infer whether or not an argument list is sortable
# (without annotation).
autosort = True
# How wide to allow formatted cmake files
line_width = 100
additional_commands = {
"target_sources": {
"kwargs": {
"PUBLIC": "*",
"PRIVATE": "*",
"INTERFACE": "*",
}
},
}

View File

@ -15,4 +15,3 @@ max_line_length = 100
[lang/po/*.po]
end_of_line = crlf
trim_trailing_whitespace = false

3
.gitattributes vendored
View File

@ -1 +1,2 @@
lang/po/*.po text eol=crlf
lang/po/*.po text eol=crlf diff=po
lang/po/*.pot text diff=po

View File

@ -1,34 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]<Enter comprehensive title>"
labels: bug
assignees: ''
---
Please, before you create a new bug report, please make sure you searched in open and closed issues and couldn't find anything that matches.
**Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2]
**Printer firmware version**- [e.g. 3.8.1, 3.8.1-RC1, ...]
**MMU Upgrade** - [e.g. MMU2S, MMU2, MMU1]
**MMU upgrade firmware version [e.g. 1.0.6, 1.0.6-RC2, ...]
**SD card or USB/Octoprint**
Please let us know if you print via SD card or USB/Octoprint
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Please describe steps to reproduce the behavior.
**Expected behavior**
A clear and concise description of what you expected to happen.
**G-code**
Please attach a G-code. This will make it easier for us to replicate the error.
**Video**
Please attach a video. It usually helps to solve the problem.

96
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,96 @@
name: Bug report
description: File a bug report
title: '[BUG] '
labels:
- bug
body:
- type: markdown
attributes:
value: |
Before you create a new bug report, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page. If it does, comment there. Even if it's closed, we can reopen it based on your comment.
- type: dropdown
id: printer_model
attributes:
label: Printer model
description: Enter the printer model(s) where you encountered the issue
options:
- MK3S/+
- MK3
- MK2.5S
- MK2.5
validations:
required: true
- type: dropdown
id: mmu_model
attributes:
label: MMU model
description: Enter the MMU model(s) where you encountered the issue
multiple: false
options:
- No-MMU
- MMU3
- MMU2S
validations:
required: true
- type: input
id: firmware_version
attributes:
label: Firmware versions
description: |
If you're using a custom firmware (not downloaded from Prusa), please note that!
placeholder: '3.14.0, 3.12.0-RC1, 3.14.0 and 3.0.2...'
validations:
required: true
- type: input
id: optional_upgrades
attributes:
label: Upgrades and modifications
description: 'If your printer has upgrades or was modified, please note that! If not, please write None or leave blank.'
placeholder: |
None, custom extruder/hotend (which), different frame, ...
- type: dropdown
id: printing_from
attributes:
label: Printing from...
multiple: false
options:
- SD Card
- PrusaLink
- PrusaConnect
- OctoPrint
- Other host software
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the bug
description: Write a concise description of the bug.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: How to reproduce
description: |
If you are able to reproduce the issue - meaning that you can trigger it yourself by following certain steps - please describe the step-by-step process in as much detail as possible!
- type: textarea
id: expected_behavior
attributes:
label: Expected behavior
description: |
If the printer did something unexpected, or if the procedure is missing a step that would resolve the issue, please provide a step-by-step process of how it should behave.
- type: textarea
id: files
attributes:
label: Files
description: |
Provide at least one of these (ideally as many as you can) to help developers track down the bug.
*To upload files, compress them into a .zip file and drag them to the text area to upload.* Images and videos can be uploaded directly.
- **gcode** file
- **3mf project** which includes the model and printer settings
- **video** or **photos** of the issue happening
**Crash dump: Do not share the file publicly**, as the crash dump contains a raw snapshot of the printer's memory and may include unencrypted sensitive information.
Please send the crash dump file to Prusa by emailing it to reports@prusa3d.com and referencing this issue. In reply to the email, you will be automatically assigned a reference code to be mentioned in the issue. Sharing this file is important and helps us investigate the bug.

25
.github/ISSUE_TEMPLATE/community.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Community
description: Related to "Community made" features
title: '[Community made] '
labels:
- community_made
body:
- type: markdown
attributes:
value: >
Prusa Research will NOT follow up these issues!
The maintainers of the "Community made" feature should/will react.
Please, before you create a new "Community made" ticket, please make sure you searched in open and closed issues and couldn't find anything that matches.
- type: textarea
id: which_community
attributes:
label: Which Community made feature do you want to address?
validations:
required: true
- type: textarea
id: What_about_community
attributes:
label: What is your request/question/suggestion?
validations:
required: true

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,11 @@
contact_links:
- name: Do you need Support?
url: https://help.prusa3d.com/article/customer-support_2287
about: If you are not sure whether what you are reporting is a bug, please contact our support team first. We are providing full 24/7 customer support.
- name: Knowledge Base
url: https://help.prusa3d.com/
about: We have a comprehensive help documentation that could be helpful for troubleshooting.
- name: Prusa Forum
url: https://forum.prusa3d.com/
about: Please get in touch on our Prusa Forum! (Not an official support channel)
blank_issues_enabled: false

View File

@ -1,20 +0,0 @@
---
name: Enhancement
about: Suggest an idea for this project
title: " [ENHANCEMENT]<Enter comprehensive title>"
labels: enhancement
assignees: ''
---
Please, before you create a new feature request, please make sure you searched in open and closed issues and couldn't find anything that matches.
Enter what type of printer or upgrade the enhancement applies to.
**Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2]
**MMU Upgrade** - [e.g. MMU2S, MMU2, MMU1]
**Is your enhancement related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.

35
.github/ISSUE_TEMPLATE/enhancement.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Enhancement
description: Suggest an improvement of the existing functionality
title: '[ENHANCEMENT] '
labels:
- enhancement
body:
- type: markdown
attributes:
value: |
Before you create a new enhancement, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type: checkboxes
id: printer_model
attributes:
label: Printer model
description: Select the printer model(s) where you would like this enhancement
options:
- label: MK3S/+
- label: MK3
- label: MK2.5S
- label: MK2.5
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the enhancement
description: How would this enhancement improve your experience? Do you have a specific use case where this enhancemnet is especially needed?
validations:
required: true
- type: textarea
id: expected_functionality
attributes:
label: Expected functionality
description: |
Describe the way the enhancement would change existing functionality. You can also describe it in a step-by-step basis if applicable.

View File

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE REQUEST]<Enter comprehensive title>"
labels: feature request
assignees: ''
---
Please, before you create a new feature request, please make sure you searched in open and closed issues and couldn't find anything that matches.
If it makes sense, enter what type of printer or upgrade the feature request applies to.
**Printer type** - [e.g. MK3S, MK3, MK2.5S, MK2.5, MK2S, MK2]
**MMU Upgrade** - [e.g. MMU2S, MMU2, MMU1]
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.

View File

@ -0,0 +1,35 @@
name: Feature request
description: Suggest new functionality
title: '[FEATURE REQUEST] '
labels:
- feature request
body:
- type: markdown
attributes:
value: |
Before you create a new feature request, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type: checkboxes
id: printer_model
attributes:
label: Printer model
description: Select the printer model(s) where you would like this feature
options:
- label: MK3S/+
- label: MK3
- label: MK2.5S
- label: MK2.5
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe the feature
description: How would this feature improve the printer? Are there specific use cases where this would be beneficial? Describe how you would use it.
validations:
required: true
- type: textarea
id: expected_functionality
attributes:
label: Expected functionality
description: |
Describe the way the feature would work. You can also describe it in a step-by-step basis if applicable.

View File

@ -1,12 +0,0 @@
---
name: Question
about: What do you want to know?
title: "[QUESTION]<Enter comprehensive title>"
labels: question
assignees: ''
---
Please, before you create a new question, please make sure you searched in open and closed issues and couldn't find anything that matches.
**What is your question?**

16
.github/ISSUE_TEMPLATE/question.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Question
description: Ask a firmware specific question
title: '[QUESTION] '
labels:
- question
body:
- type: markdown
attributes:
value: |
Before you create a new question, please check if an issue with it already exists (either open or closed) by using the search bar on the issues page.
- type: textarea
id: question
attributes:
label: Question
validations:
required: true

178
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,178 @@
name: ci-build
on:
pull_request:
branches:
- '*'
push:
branches: [ MK3, MK3_* ]
tags:
- 'v*'
- 't*'
- 'c*'
env:
GH_ANNOTATIONS: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install cmake ninja-build python3-pyelftools python3-regex python3-polib
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v4
if: ${{ github.event.pull_request }}
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
fetch-depth: 0
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v4
if: ${{ !github.event.pull_request }}
with:
ref: ${{ github.event.ref }}
submodules: true
fetch-depth: 0
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Build
run: |
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja
- name: Upload artifacts
if: ${{ !github.event.pull_request }}
uses: actions/upload-artifact@v4
with:
name: Firmware
path: build/*.hex
- name: RELEASE THE KRAKEN
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/t') || startsWith(github.ref, 'refs/tags/c')
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ github.ref_name }}
draft: true
files: |
${{ github.workspace }}/build/release/*.hex
${{ github.workspace }}/build/release/*.zip
check-lang:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-11 g++11 lcov cmake ninja-build python3-pyelftools python3-regex python3-polib
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v4
if: ${{ github.event.pull_request }}
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
fetch-depth: 0
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v4
if: ${{ !github.event.pull_request }}
with:
ref: ${{ github.event.ref }}
submodules: true
fetch-depth: 0
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Run check
run: |
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja check_lang
tests:
runs-on: ubuntu-latest
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-11 g++11 lcov cmake ninja-build python3-pyelftools python3-regex python3-polib
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v4
if: ${{ github.event.pull_request }}
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
fetch-depth: 0
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v4
if: ${{ !github.event.pull_request }}
with:
ref: ${{ github.event.ref }}
submodules: true
fetch-depth: 0
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Run check
run: |
mkdir build
cd build
cmake .. -G Ninja
ninja test_run_all

56
.github/workflows/pr-size.sh vendored Executable file
View File

@ -0,0 +1,56 @@
#!/bin/sh
MESSAGE=$1
BASE_DIR=$2
PR_DIR=$3
shift 3
# this assumes we're running from the repository root
AVR_SIZE=$(echo .dependencies/avr-gcc-*/bin/avr-size)
test -x "$AVR_SIZE" || exit 2
avr_size()
{
"$AVR_SIZE" --mcu=atmega2560 -C "$@"
}
avr_flash()
{
avr_size "$@" | sed -ne 's/^Program: *\([0-9]\+\).*/\1/p'
}
avr_ram()
{
avr_size "$@" | sed -ne 's/^Data: *\([0-9]\+\).*/\1/p'
}
cat <<EOF > "$MESSAGE"
All values in bytes. Δ Delta to base
| Target| ΔFlash | ΔSRAM | Used Flash | Used SRAM | Free Flash | Free SRAM |
| ------| ------ | ----- | -----------| --------- | ---------- | --------- |
EOF
einsy_max_upload_size=$(grep "prusa_einsy_rambo.upload.maximum_size" .dependencies/prusa3dboards-*/boards.txt | cut -d "=" -f2)
einsy_max_upload_data_size=8192
for TARGET in $@
do
# strip the multilang prefix
variant=${TARGET%_MULTILANG}
base_bin=$(echo ${BASE_DIR}/build_gen/$variant/${variant}_lang_base)
base_flash=$(avr_flash "$base_bin")
base_ram=$(avr_ram "$base_bin")
pr_bin=$(echo ${PR_DIR}/build_gen/$variant/${variant}_lang_base)
pr_flash=$(avr_flash "$pr_bin")
pr_ram=$(avr_ram "$pr_bin")
flash_d=$(($pr_flash - $base_flash))
ram_d=$(($pr_ram - $base_ram))
flash_free=$(($einsy_max_upload_size - $pr_flash))
ram_free=$(($einsy_max_upload_data_size - $pr_ram))
echo "| \`$TARGET\` | $flash_d | $ram_d | $pr_flash | $pr_ram | $flash_free | $ram_free |" >> "$MESSAGE"
done

79
.github/workflows/pr-size.yml vendored Normal file
View File

@ -0,0 +1,79 @@
name: pr-size
on:
pull_request_target:
branches: [ MK3, MK3_* ]
env:
TARGETS: "MK3S_MULTILANG MK3_MULTILANG"
jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
# setup base required dependencies
- name: Setup dependencies
run: |
sudo apt-get update
sudo apt-get install cmake ninja-build python3-pyelftools python3-regex python3-polib
# build the base branch
- name: Checkout base
uses: actions/checkout@v4
- name: Cache Dependencies
uses: actions/cache@v4
id: cache-pkgs
with:
path: ".dependencies"
key: "build-deps-1_0_0-linux"
- name: Setup build dependencies
run: |
./utils/bootstrap.py
- name: Cache permissions
run: sudo chmod -R 744 .dependencies
- name: Build base
run: |
rm -rf build-base
mkdir build-base
cd build-base
cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja $TARGETS
# save pr-size for later use
- name: Save base data
run: |
cp -f ./.github/workflows/pr-size.sh build-base
# build the PR branch
- name: Checkout PR
uses: actions/checkout@v4
with:
clean: false
ref: ${{ github.event.pull_request.head.sha }}
- name: Build PR
run: |
rm -rf build-pr
mkdir build-pr
cd build-pr
cmake .. -DCMAKE_TOOLCHAIN_FILE="../cmake/AvrGcc.cmake" -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja $TARGETS
# extract/show build differences
- name: Calculate binary changes
run: |
rm -rf build-changes
./build-base/pr-size.sh build-changes build-base build-pr $TARGETS
- name: Add PR Comment
uses: mshick/add-pr-comment@v2
with:
message-path: build-changes

30
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Mark stale issues
on:
schedule:
# 1:30 AM on MON/THU
- cron: "30 1 * * 1,2,3,4"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Don't ever mark PRs as stale.
days-before-pr-stale: -1
stale-issue-message: 'Thank you for your contribution to our project. This issue has not received any updates for 60 days and may be considered "stale." If this issue is still important to you, please add an update within the next 7 days to keep it open. Administrators can manually reopen the issue if necessary.'
close-issue-message: 'This issue has been closed due to lack of recent activity. Please consider opening a new one if needed.'
# Don't act on things assigned to a milestone or assigned to someone.
exempt-all-milestones: true
exempt-all-assignees: true
enable-statistics: true
# Disable this and change the operations per run back to 30 when this goes live.
debug-only: false
operations-per-run: 200
stale-issue-label: 'stale-issue'
stale-pr-label: 'stale-pr'
ascending: true

83
.gitignore vendored
View File

@ -1,54 +1,31 @@
.settings
.project
.cproject
Debug
Firmware/Configuration_prusa.h
Firmware/Doc
/Firmware/.vs/Firmware/v14
/Firmware/__vm
/Firmware/Firmware.sln
/Firmware/Firmware.vcxproj
/Firmware/Firmware.vcxproj.filters
/Firmware/Firmware - Shortcut.lnk
/Firmware/variants/1_75mm_MK3-MMU-EINSy10a-E3Dv6full.h.bak
/Firmware/Marlin_main.cpp~RF12cfae7.TMP
/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h.bak
/html
/latex
/Doxyfile
/Firmware/builds/1_75mm_MK3-EINY04-E3Dv6full
/Firmware/Configuration_prusa.h.bak
/Firmware/Configuration_prusa_backup.h
/Firmware/ultralcd_implementation_hitachi_HD44780.h.bak
/Firmware/ultralcd.cpp.bak
/Firmware/temperature.cpp.bak
/Firmware/pins.h.bak
/Firmware/Marlin_main.cpp.bak
/Firmware/language_pl.h.bak
/Firmware/language_it.h.bak
/Firmware/language_es.h.bak
/Firmware/language_en.h.bak
/Firmware/language_de.h.bak
/Firmware/language_cz.h.bak
/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h
/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h
/Firmware/variants/1_75mm_MK2-EINY01-E3Dv6full.h.bak
/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h
/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h
/lang/*.bin
/lang/*.hex
/lang/*.dat
/lang/*.tmp
/lang/*.out
/lang/not_tran*.txt
/lang/not_used*.txt
/lang/progmem1.chr
/lang/progmem1.lss
/lang/progmem1.txt
/lang/progmem1.var
/lang/text.sym
/lang/textaddr.txt
# IDE data
/.settings
/.project
/.cproject
# cmake
/build/
/build_gen/
/.dependencies
/compile_commands.json
# Temporary configuration
/Firmware/Configuration_prusa.h
# Temporary language files
/lang/po/*.mo
/lang/tmp/
/lang/Firmware-intl.hex
/lang/Firmware-intl-en_*.hex
/lang/*.map
# Temporary files and directories
*[~#]
*.tmp
*.bak
.DS_Store
__pycache__
# Generated files
/build-env/
/Firmware/Firmware.vcxproj
/Firmware/Configuration_prusa_bckp.h
/Firmware/variants/printers.h
/Firmware/Doc/

View File

@ -1,35 +0,0 @@
dist: trusty
before_install:
- sudo apt-get install -y ninja-build
# Arduino IDE adds a lot of noise caused by network traffic, trying to firewall it off
- sudo iptables -P INPUT DROP
- sudo iptables -P FORWARD DROP
- sudo iptables -P OUTPUT ACCEPT
- sudo iptables -A INPUT -i lo -j ACCEPT
- sudo iptables -A OUTPUT -o lo -j ACCEPT
- sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
script:
- bash -x test.sh
- cp Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK3S-EINSy10a-E3Dv6full variant failed" && false; }
- rm Firmware/Configuration_prusa.h
- cp Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK3-EINSy10a-E3Dv6full variant failed" && false; }
- rm Firmware/Configuration_prusa.h
- cp Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK25S-RAMBo13a-E3Dv6full variant failed" && false; }
- rm Firmware/Configuration_prusa.h
- cp Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK25S-RAMBo10a-E3Dv6full variant failed" && false; }
- rm Firmware/Configuration_prusa.h
- cp Firmware/variants/1_75mm_MK25-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK25-RAMBo13a-E3Dv6full variant failed" && false; }
- rm Firmware/Configuration_prusa.h
- cp Firmware/variants/1_75mm_MK25-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK25-RAMBo10a-E3Dv6full variant failed" && false; }
- rm Firmware/Configuration_prusa.h
- cp Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK2-RAMBo13a-E3Dv6full variant failed" && false; }
- rm Firmware/Configuration_prusa.h
- cp Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h Firmware/Configuration_prusa.h
- bash -x build.sh || { echo "1_75mm_MK2-RAMBo10a-E3Dv6full variant failed" && false; }

10
.vscode/cmake-kits.json vendored Normal file
View File

@ -0,0 +1,10 @@
[
{
"name": "avr-gcc",
"toolchainFile": "${workspaceFolder}/cmake/AvrGcc.cmake",
"cmakeSettings": {
"CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.12.1/ninja",
"CMAKE_BUILD_TYPE": "Release"
}
}
]

11
.vscode/cmake-variants.yaml vendored Normal file
View File

@ -0,0 +1,11 @@
buildType:
default: debug
choices:
debug:
short: Debug
long: Emit debug information
buildType: Debug
release:
short: Release
long: Optimize generated code
buildType: Release

10
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"cmake.configureOnOpen": true,
"cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json",
"cmake.cmakePath": "${workspaceFolder}/.dependencies/cmake-3.22.5/bin/cmake",
"cmake.generator": "Ninja",
"files.insertFinalNewline": true,
"files.associations": {
"xlocale": "cpp"
}
}

View File

@ -1,24 +1,658 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.19)
include(cmake/Utilities.cmake)
include(cmake/GetGitRevisionDescription.cmake)
include(cmake/ReproducibleBuild.cmake)
include(cmake/ProjectVersion.cmake)
resolve_version_variables()
set (CMAKE_CXX_STANDARD 11)
OPTION(ENFORCE_VERSION_MATCH "Enforce checking that configuration.h matches any parsed git tags" OFF)
OPTION(NO_TAG_IS_FATAL "If tag parsing fails, issue a fatal error" OFF)
project(cmake_test)
set(PROJECT_VERSION_HASH
"<auto>"
CACHE
STRING
"Version suffix to be appended to the final filename (<ver+PROJECT_VERSION_HASH>). Overrides git hash if set."
)
if(PROJECT_VERSION_HASH STREQUAL "<auto>")
set(PROJECT_VERSION_HASH "${FW_COMMIT_HASH}")
endif()
set(PROJECT_VERSION_FULL
"<auto>"
CACHE
STRING
"Full version string to be shown on the info screen in settings. Overrides git version if set."
)
if(PROJECT_VERSION_FULL STREQUAL "<auto>")
set(PROJECT_VERSION_FULL "${FW_COMMIT_DSC}")
endif()
set(PROJECT_REPOSITORY
"Unknown"
CACHE STRING "Repository string to be shown on the info screen in settings."
)
# Prepare "Catch" library for other executables
set(CATCH_INCLUDE_DIR Catch2)
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
set(CUSTOM_COMPILE_OPTIONS
""
CACHE STRING "Allows adding custom C/C++ flags"
)
# Make test executable
set(TEST_SOURCES
Tests/tests.cpp
Tests/Example_test.cpp
Tests/Timer_test.cpp
Tests/AutoDeplete_test.cpp
Tests/PrusaStatistics_test.cpp
Firmware/Timer.cpp
Firmware/AutoDeplete.cpp
)
add_executable(tests ${TEST_SOURCES})
target_include_directories(tests PRIVATE Tests)
target_link_libraries(tests Catch)
#set(FN_VERSION_SUFFIX "FW${PROJECT_VERSION}+${PROJECT_VERSION_HASH}")
set(FN_VERSION_SUFFIX "FW_${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_REV}")
if(PROJECT_VERSION_FLV AND PROJECT_VERSION_FLV_VER)
set (FN_VERSION_SUFFIX "${FN_VERSION_SUFFIX}-${PROJECT_VERSION_FLV}${PROJECT_VERSION_FLV_VER}")
endif()
set(FN_VERSION_DEBUG_SUFFIX "${FN_VERSION_SUFFIX}+${PROJECT_VERSION_COMMIT}")
# Inform user about the resolved settings from Configuration.h
message(STATUS "Project version (Configuration.h): ${PROJECT_VERSION}")
#message(STATUS "Project version major............: ${PROJECT_VERSION_MAJOR}") #For debuging
#message(STATUS "Project version minor............: ${PROJECT_VERSION_MINOR}") #For debuging
#message(STATUS "Project version revision.........: ${PROJECT_VERSION_REV}") #For debuging
#message(STATUS "Project version flavor...........: ${PROJECT_VERSION_FLV}") #For debuging
#message(STATUS "Project version fla-revison......: ${PROJECT_VERSION_FLV_VER}") #For debuging
#message(STATUS "Project version commit number....: ${PROJECT_VERSION_COMMIT}") #For debuging
message(STATUS "Filename suffix..................: ${FN_VERSION_SUFFIX}")
message(STATUS "Filename debug suffix ...........: ${FN_VERSION_DEBUG_SUFFIX}")
#message(STATUS "Host OS .........................: ${CMAKE_HOST_SYSTEM_NAME}")
# testing
# SET(FW_COMMIT_DSC "v3.13.0-1234")
if(NOT "${PROJECT_VERSION_HASH}" STREQUAL "UNKNOWN" AND NOT "${FW_COMMIT_DSC}" MATCHES ".+NOTFOUND.+") # else -> no commit hash is known... likely no git.
string(REGEX MATCH "[v|t|c]([0-9]+)\.([0-9]+)\.([0-9]+)-?(${DEV_TAG_REGEX})?([0-9]+)?-([0-9]+)" TAG_VERSION "${FW_COMMIT_DSC}")
if (CMAKE_MATCH_4) # Do we have a build type?
decode_flavor_code(PROJECT_VER_TAG_FLV "${CMAKE_MATCH_4}" "${CMAKE_MATCH_5}")
else()
# No dev status found, it must be a final tag.
decode_flavor_code(PROJECT_VER_TAG_FLV "RELEASED" "0")
endif()
if(ENFORCE_VERSION_MATCH)
if(NOT ${CMAKE_MATCH_1} STREQUAL ${PROJECT_VERSION_MAJOR})
message(FATAL_ERROR "Major version of current tag disagrees with Configuration.h ${CMAKE_MATCH_1}!=${PROJECT_VERSION_MAJOR}")
endif()
if(NOT ${CMAKE_MATCH_2} STREQUAL ${PROJECT_VERSION_MINOR})
message(FATAL_ERROR "Minor version of current tag disagrees with Configuration.h ${CMAKE_MATCH_2}!=${PROJECT_VERSION_MINOR}")
endif()
if(NOT ${CMAKE_MATCH_3} STREQUAL ${PROJECT_VERSION_REV})
message(FATAL_ERROR "Rev version of current tag disagrees with Configuration.h ${CMAKE_MATCH_3}!=${PROJECT_VERSION_REV}")
endif()
if(NOT ${PROJECT_VER_TAG_FLV} STREQUAL ${PROJECT_VERSION_TWEAK})
message(FATAL_ERROR "Dev status of current tag disagrees with Configuration.h ${PROJECT_VER_TAG_FLV}!=${PROJECT_VERSION_TWEAK}")
endif()
# Note - we don't check the commit counter, that'd be too much of a headache. Maybe it
# should be an error only on a tagged build?
MESSAGE(STATUS "Configuration.h and tag match: OK (${PROJECT_VERSION}/${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})")
else()
MESSAGE(STATUS "Configuration.h and tag (not enforced): (${PROJECT_VERSION}/${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})")
endif()
MESSAGE(STATUS "Commit Nr: Configuration.h: ${PROJECT_VERSION_COMMIT} Tag: ${CMAKE_MATCH_6}")
MESSAGE(STATUS "These tag values will override Configuration.h")
SET(PROJECT_VERSION ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${PROJECT_VER_TAG_FLV})
SET(PROJECT_VERSION_COMMIT ${CMAKE_MATCH_6})
git_get_repository(PROJECT_REPOSITORY)
else(GIT_FOUND)
if (NO_TAG_IS_FATAL)
MESSAGE(FATAL_ERROR "Git was not found or an error occurred parsing the tag. This is a fatal error according to the settings.")
else()
MESSAGE(STATUS "Git was not found or an error occurred parsing the tag. Falling back to Configuration.h values (${PROJECT_VERSION}).")
endif()
set(FW_COMMIT_HASH ${FW_COMMIT_HASH_UNKNOWN}) # Clear it, the code expects a binary...
set(PROJECT_VERSION_TIMESTAMP "0")
endif()
if(CMAKE_MATCH_1 AND CMAKE_MATCH_2)
set(FN_VERSION_SUFFIX "FW_${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
endif()
if(CMAKE_MATCH_4 AND CMAKE_MATCH_5)
set (FN_VERSION_SUFFIX "${FN_VERSION_SUFFIX}-${CMAKE_MATCH_4}${CMAKE_MATCH_5}")
endif()
if(CMAKE_MATCH_6 AND PROJECT_VERSION_HASH)
set(FN_VERSION_DEBUG_SUFFIX "${FN_VERSION_SUFFIX}+${CMAKE_MATCH_6}_${PROJECT_VERSION_HASH}")
endif()
# Inform user about the resolved settings from github
message(STATUS "Project version git..............: ${PROJECT_VERSION}")
message(STATUS "Project version git hash.........: ${PROJECT_VERSION_HASH}")
message(STATUS "Project version git description..: ${PROJECT_VERSION_FULL}")
#message(STATUS "Project version git major........: ${CMAKE_MATCH_1}") #For debuging
#message(STATUS "Project version git minor........: ${CMAKE_MATCH_2}") #For debuging
#message(STATUS "Project version git revision.....: ${CMAKE_MATCH_3}") #For debuging
#message(STATUS "Project version git flavor.......: ${CMAKE_MATCH_4}") #For debuging
#message(STATUS "Project version git fla-revison..: ${CMAKE_MATCH_5}") #For debuging
#message(STATUS "Project version git commit number: ${CMAKE_MATCH_6}") #For debuging
message(STATUS "Filename suffix .................: ${FN_VERSION_SUFFIX}")
message(STATUS "Filename debug suffix ...........: ${FN_VERSION_DEBUG_SUFFIX}")
# Language configuration
set(MAIN_LANGUAGES
cs de es fr it pl
CACHE STRING "The list of 'main' languages to be included, in the correct order"
)
set(COMMUNITY_LANGUAGES
nl
ro
hu
hr
sk
sv
no
CACHE STRING "The list of community languages to be included, in the correct order"
)
set(SELECTED_LANGUAGES ${MAIN_LANGUAGES} ${COMMUNITY_LANGUAGES})
get_dependency_directory(prusa3dboards PRUSA_BOARDS_DIR)
project(Prusa-Firmware VERSION ${PROJECT_VERSION})
add_subdirectory(lib)
# Get LANG_MAX_SIZE from sources
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/Firmware/config.h MAX_SIZE_LINE
REGEX "^#define \+LANG_SIZE_RESERVED \+"
)
string(REGEX MATCH "0x[0-9]+" MAX_SIZE_HEX "${MAX_SIZE_LINE}")
math(EXPR LANG_MAX_SIZE "${MAX_SIZE_HEX}" OUTPUT_FORMAT DECIMAL)
message("Language maximum size (from config.h): ${LANG_MAX_SIZE} bytes")
# Ditto, this in xflash_layout.h but needs invocation of the preprocessor... :-/
set(LANG_BIN_MAX 249856)
# Check GCC Version
get_recommended_gcc_version(RECOMMENDED_TOOLCHAIN_VERSION)
if(CMAKE_CROSSCOMPILING AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL
${RECOMMENDED_TOOLCHAIN_VERSION}
)
message(WARNING "Recommended AVR toolchain is ${RECOMMENDED_TOOLCHAIN_VERSION}"
", but you have ${CMAKE_CXX_COMPILER_VERSION}"
)
elseif(NOT CMAKE_CROSSCOMPILING AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message(
WARNING
"Recommended compiler for host tools and unittests is GCC, you have ${CMAKE_CXX_COMPILER_ID}."
)
endif()
# append custom C/C++ flags
if(CUSTOM_COMPILE_OPTIONS)
string(REPLACE " " ";" CUSTOM_COMPILE_OPTIONS "${CUSTOM_COMPILE_OPTIONS}")
add_compile_options(${CUSTOM_COMPILE_OPTIONS})
endif()
#
# Global Compiler & Linker Configuration
#
# enable warnings
add_compile_options(-Wall -Wextra -Wno-expansion-to-defined -Wsign-compare)
# default standards for all targets
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# support _DEBUG macro (some code uses to recognize debug builds)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(_DEBUG)
endif()
#
# Firmware - get file lists.
#
set(FW_SOURCES
adc.cpp
backlight.cpp
BlinkM.cpp
bootapp.c
cardreader.cpp
cmdqueue.cpp
Configuration.cpp
ConfigurationStore.cpp
Dcodes.cpp
eeprom.cpp
fancheck.cpp
Filament_sensor.cpp
first_lay_cal.cpp
heatbed_pwm.cpp
host.cpp
la10compat.cpp
language.c
lcd.cpp
Marlin_main.cpp
MarlinSerial.cpp
meatpack.cpp
menu.cpp
mesh_bed_calibration.cpp
mesh_bed_leveling.cpp
messages.cpp
mmu2.cpp
mmu2_crc.cpp
mmu2_error_converter.cpp
mmu2_fsensor.cpp
mmu2_log.cpp
mmu2_marlin1.cpp
mmu2_power.cpp
mmu2_progress_converter.cpp
mmu2_protocol.cpp
mmu2_protocol_logic.cpp
mmu2_reporting.cpp
mmu2_serial.cpp
motion_control.cpp
optiboot_xflash.cpp
pat9125.cpp
planner.cpp
power_panic.cpp
printer_state.cpp
Prusa_farm.cpp
rbuf.c
Sd2Card.cpp
SdBaseFile.cpp
SdFatUtil.cpp
SdFile.cpp
SdVolume.cpp
sm4.cpp
sound.cpp
speed_lookuptable.cpp
spi.c
SpoolJoin.cpp
stepper.cpp
stopwatch.cpp
strtod.c
swi2c.c
Tcodes.cpp
temperature.cpp
timer02.c
Timer.cpp
tmc2130.cpp
tone04.c
twi.cpp
uart2.cpp
ultralcd.cpp
util.cpp
xflash.c
xflash_dump.cpp
xyzcal.cpp
)
list(TRANSFORM FW_SOURCES PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/Firmware/)
set(AVR_SOURCES
wiring_digital.c
WInterrupts.c
wiring_pulse.c
hooks.c
wiring.c
wiring_analog.c
wiring_shift.c
CDC.cpp
PluggableUSB.cpp
HardwareSerial.cpp
HardwareSerial0.cpp
HardwareSerial1.cpp
HardwareSerial3.cpp
IPAddress.cpp
HardwareSerial2.cpp
Print.cpp
Stream.cpp
Tone.cpp
USBCore.cpp
WMath.cpp
WString.cpp
abi.cpp
main.cpp
)
list(TRANSFORM AVR_SOURCES PREPEND ${PRUSA_BOARDS_DIR}/cores/prusa_einsy_rambo/)
#
# Target configuration
#
if(CMAKE_CROSSCOMPILING)
set_source_epoch(${PROJECT_VERSION_TIMESTAMP})
# default optimization flags
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
set(CMAKE_CXX_FLAGS_RELEASE "-Os -g -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
# mcu and target-related settings
add_compile_options(
-mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_PRUSA_EINSY_RAMBO
-DARDUINO_ARCH_AVR
)
add_link_options(-mmcu=atmega2560 -Wl,-u,vfprintf -lprintf_flt -lm)
# disable some C++ language features
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-threadsafe-statics>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
# disable exceptions
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-unwind-tables>)
# split and gc sections
add_compile_options(-ffunction-sections -fdata-sections)
add_link_options(-ffunction-sections -fdata-sections -Wl,--gc-sections)
# LTO (with custom options)
add_compile_options(-flto -fno-fat-lto-objects)
add_link_options(-flto)
# Create this target before we apply the GC options
add_library(avr_core STATIC ${AVR_SOURCES})
set_reproducible_target(avr_core)
target_include_directories(
avr_core PRIVATE ${PRUSA_BOARDS_DIR}/cores/prusa_einsy_rambo/
${PRUSA_BOARDS_DIR}/variants/prusa_einsy_rambo/
)
endif()
# Meta targets to build absolutely everything
add_custom_target(ALL_FIRMWARE)
add_custom_target(ALL_ENGLISH)
add_custom_target(ALL_MULTILANG)
add_dependencies(ALL_FIRMWARE ALL_ENGLISH ALL_MULTILANG)
set_target_properties(ALL_MULTILANG PROPERTIES EXCLUDE_FROM_ALL FALSE)
function(add_base_binary variant_name)
add_executable(${variant_name} ${FW_SOURCES} ${FW_HEADERS} ${VARIANT_CFG_DST})
set_target_properties(${variant_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
set_reproducible_target(${variant_name})
target_include_directories(
${variant_name}
PRIVATE ${PRUSA_BOARDS_DIR}/cores/prusa_einsy_rambo/
${PRUSA_BOARDS_DIR}/variants/prusa_einsy_rambo/ ${CMAKE_SOURCE_DIR}/Firmware
)
target_link_libraries(${variant_name} avr_core)
# configure linker script
set(LINKER_SCRIPT ${PRUSA_BOARDS_DIR}/ldscripts/avr6.xn)
target_link_options(${variant_name} PUBLIC -Wl,-T,${LINKER_SCRIPT})
# limit the text section to 248K (256K - 8k reserved for the bootloader)
target_link_options(${variant_name} PUBLIC -Wl,--defsym=__TEXT_REGION_LENGTH__=248K)
# produce ASM listing. Note we also specify the .map as a byproduct so it gets cleaned because
# link_options doesn't have a "generated outputs" feature.
add_custom_command(
TARGET ${variant_name}
POST_BUILD
COMMAND ${CMAKE_OBJDUMP} --prefix ${CMAKE_SOURCE_DIR} -CSd ${variant_name} > ${variant_name}.asm
BYPRODUCTS ${variant_name}.asm ${variant_name}.map
)
# inform about the firmware's size in terminal
add_custom_command(
TARGET ${variant_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo_append "${variant_name} "
COMMAND ${CMAKE_SIZE_UTIL} -C --mcu=atmega2560 ${variant_name}
)
report_size(${variant_name})
# generate linker map file
target_link_options(
${variant_name} PUBLIC -Wl,-Map=${CMAKE_CURRENT_BINARY_DIR}/${variant_name}.map
)
decode_tweak_version(PROJECT_VERSION_FLV PROJECT_VERSION_FLV_VER)
target_compile_definitions(
${variant_name}
PRIVATE CMAKE_CONTROL FW_REPOSITORY="${PROJECT_REPOSITORY}"
FW_COMMIT_HASH="${FW_COMMIT_HASH}"
FW_COMMIT_HASH_LENGTH=${FW_COMMIT_HASH_LENGTH}
FW_MAJOR=${PROJECT_VERSION_MAJOR}
FW_MINOR=${PROJECT_VERSION_MINOR}
FW_REVISION=${PROJECT_VERSION_REV}
FW_COMMITNR=${PROJECT_VERSION_COMMIT}
)
if(NOT PROJECT_VERSION_FLV STREQUAL "RELEASED")
target_compile_definitions(
${variant_name}
PRIVATE
FW_FLAVERSION=${PROJECT_VERSION_FLV_VER}
FW_FLAVOR=${PROJECT_VERSION_FLV}
)
endif()
endfunction()
function(fw_add_variant variant_name)
set(variant_header "variants/${variant_name}.h")
string(REPLACE "1_75mm_" "" variant_name "${variant_name}")
string(REPLACE "-E3Dv6full" "" variant_name "${variant_name}")
# Single-language build
set(FW_EN "${variant_name}_ENGLISH")
#MK3S_MK3S+_FW_3.13.2-RC1_ENGLISH.hex
set(hex_variant_name "${variant_name}")
if(hex_variant_name STRGREATER_EQUAL "MK3S")
string(REPLACE "MK3S" "MK3S_MK3S+" hex_variant_name ${hex_variant_name})
endif()
set(FW_HEX "${CMAKE_BINARY_DIR}/${hex_variant_name}_${FN_VERSION_SUFFIX}_ENGLISH.hex")
#message(STATUS "Hex filename: ${FW_HEX}")
add_base_binary(${FW_EN})
target_compile_definitions(${FW_EN} PUBLIC LANG_MODE=0 FW_VARIANT="${variant_header}")
add_custom_command(
TARGET ${FW_EN}
POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O ihex ${FW_EN} ${FW_EN}.hex
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_EN}.hex ${FW_HEX}
BYPRODUCTS ${FW_EN}.hex ${FW_HEX}
COMMENT "Generating ${FW_EN}.hex"
)
add_dependencies(ALL_ENGLISH ${FW_EN})
# Multi-language build/s
set(FW_LANG_BASE "${variant_name}_lang_base")
set(FW_LANG_PATCH "${variant_name}_lang_patch")
add_base_binary(${FW_LANG_BASE})
target_compile_definitions(${FW_LANG_BASE} PUBLIC LANG_MODE=1 FW_VARIANT="${variant_header}")
# Construct language map
set(LANG_TMP_DIR lang)
set(LANG_MAP ${LANG_TMP_DIR}/${variant_name}_lang.map)
add_custom_command(
OUTPUT ${LANG_MAP}
COMMAND ${CMAKE_OBJCOPY} -O binary ${FW_LANG_BASE} ${FW_LANG_PATCH}.bin
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/lang/lang-map.py ${FW_LANG_BASE} ${FW_LANG_PATCH}.bin > ${LANG_MAP}
COMMAND ${CMAKE_OBJCOPY} -I binary -O ihex ${FW_LANG_PATCH}.bin ${FW_LANG_PATCH}.hex
DEPENDS ${FW_LANG_BASE}
BYPRODUCTS ${FW_LANG_PATCH}.bin ${FW_LANG_PATCH}.hex
COMMENT "Generating ${variant_name} language map"
)
# Base targets for language checks
add_custom_target(check_lang_${variant_name})
add_dependencies(check_lang check_lang_${variant_name})
# Build language catalogs
set(LANG_BINS "")
foreach(LANG IN LISTS SELECTED_LANGUAGES)
set(LANG_BIN ${LANG_TMP_DIR}/${variant_name}_${LANG}.bin)
set(PO_FILE "${CMAKE_SOURCE_DIR}/lang/po/Firmware_${LANG}.po")
# Full language checks
add_custom_target(
check_lang_${variant_name}_${LANG}
COMMENT "Checking ${variant_name} language ${LANG}"
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/lang/lang-check.py --map ${LANG_MAP} ${PO_FILE}
DEPENDS ${LANG_MAP} ${PO_FILE}
USES_TERMINAL
)
add_dependencies(check_lang_${variant_name} check_lang_${variant_name}_${LANG})
add_dependencies(check_lang_${LANG} check_lang_${variant_name}_${LANG})
add_custom_command(
OUTPUT ${LANG_BIN}
# Check po file for errors _only_
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/lang/lang-check.py --errors-only --map ${LANG_MAP} ${PO_FILE}
# Build the catalog
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/lang/lang-build.py ${LANG_MAP} ${PO_FILE} ${LANG_BIN}
# Check bin size
COMMAND ${CMAKE_COMMAND} -DLANG_MAX_SIZE=${LANG_MAX_SIZE} -DLANG_FILE=${LANG_BIN} -P
${PROJECT_CMAKE_DIR}/Check_lang_size.cmake
DEPENDS ${LANG_MAP} ${PO_FILE}
COMMENT "Generating ${variant_name}_${LANG}.bin"
)
list(APPEND LANG_BINS ${LANG_BIN})
endforeach()
string(FIND ${variant_name} "MK3" HAS_XFLASH)
if(${HAS_XFLASH} GREATER_EQUAL 0)
# X-Flash based build (catalogs appended to patched binary)
set(FW_LANG_FINAL "${variant_name}_MULTILANG")
set(hex_variant_name "${variant_name}")
#MK3S_MK3S+_FW_3.13.2-RC1+7651_deadbeef_MULTILANG.hex
if(hex_variant_name STRGREATER_EQUAL "MK3S")
string(REPLACE "MK3S" "MK3S_MK3S+" hex_variant_name ${hex_variant_name})
endif()
set(LANG_HEX ${CMAKE_BINARY_DIR}/${hex_variant_name}_${FN_VERSION_SUFFIX}_MULTILANG.hex)
set(LANG_DEBUG_HEX ${CMAKE_BINARY_DIR}/${hex_variant_name}_${FN_VERSION_DEBUG_SUFFIX}_MULTILANG.hex)
#message(STATUS "Hex filename .....: ${LANG_HEX}")
#message(STATUS "Hex debug filename: ${LANG_DEBUG_HEX}")
set(LANG_CATBIN ${LANG_TMP_DIR}/${variant_name}_cat.bin)
set(LANG_CATHEX ${LANG_TMP_DIR}/${variant_name}_cat.hex)
add_custom_command(
OUTPUT ${LANG_CATBIN}
COMMAND ${CMAKE_COMMAND} -E cat ${LANG_BINS} > ${LANG_CATBIN}
DEPENDS ${LANG_BINS}
COMMENT "Merging language catalogs"
)
#[[
#add_custom_command(OUTPUT ${LANG_FINAL_BIN}
# COMMAND ${CMAKE_COMMAND} -DLANG_MAX_SIZE=${LANG_BIN_MAX} -DLANG_FILE=${LANG_FINAL_BIN}
# -P ${PROJECT_CMAKE_DIR}/Check_final_lang_bin_size.cmake
# APPEND)
#]]
add_custom_command(
OUTPUT ${LANG_CATHEX}
COMMAND ${CMAKE_OBJCOPY} -I binary -O ihex ${LANG_CATBIN} ${LANG_CATHEX}
DEPENDS ${LANG_CATBIN}
COMMENT "Generating Hex for language data"
)
add_custom_command(
OUTPUT ${FW_LANG_FINAL}.hex
COMMAND ${CMAKE_COMMAND} -E cat ${FW_LANG_PATCH}.hex ${LANG_CATHEX} > ${FW_LANG_FINAL}.hex
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_HEX}
BYPRODUCTS ${LANG_HEX}
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_DEBUG_HEX}
BYPRODUCTS ${LANG_DEBUG_HEX}
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${CMAKE_BINARY_DIR}/release/${hex_variant_name}_${FN_VERSION_SUFFIX}_MULTILANG.hex
BYPRODUCTS ${CMAKE_BINARY_DIR}/release/${hex_variant_name}_${FN_VERSION_SUFFIX}_MULTILANG.hex
DEPENDS ${FW_LANG_PATCH}.hex ${LANG_CATHEX}
COMMENT "Generating final ${FW_LANG_FINAL}.hex"
)
add_custom_target(${FW_LANG_FINAL} DEPENDS ${FW_LANG_FINAL}.hex)
add_dependencies(ALL_MULTILANG ${FW_LANG_FINAL})
else()
set(ALL_VARIANT_HEXES "")
# Non-xflash, e.g. MK2.5
foreach(LANG IN LISTS SELECTED_LANGUAGES)
set(FW_LANG_FINAL ${variant_name}_en-${LANG})
set(LANG_HEX ${CMAKE_BINARY_DIR}/${variant_name}_${FN_VERSION_SUFFIX}_en-${LANG}.hex)
set(LANG_DEBUG_HEX ${CMAKE_BINARY_DIR}/${variant_name}_${FN_VERSION_DEBUG_SUFFIX}_en-${LANG}.hex)
set(LANG_BIN ${LANG_TMP_DIR}/${variant_name}_${LANG}.bin)
# Patched binary with pre-baked secondary language
add_custom_command(
OUTPUT ${FW_LANG_FINAL}.bin
COMMAND ${CMAKE_COMMAND} -E copy ${FW_LANG_PATCH}.bin ${FW_LANG_FINAL}.bin
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/lang/lang-patchsec.py ${FW_LANG_BASE} ${LANG_BIN}
${FW_LANG_FINAL}.bin
DEPENDS ${FW_LANG_BASE} ${FW_LANG_PATCH}.bin ${LANG_BIN}
COMMENT "Generating ${FW_LANG_FINAL}.bin"
)
# Final hex files
add_custom_command(
OUTPUT ${FW_LANG_FINAL}.hex
COMMAND ${CMAKE_OBJCOPY} -I binary -O ihex ${FW_LANG_FINAL}.bin ${FW_LANG_FINAL}.hex
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_HEX}
BYPRODUCTS ${LANG_HEX}
COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_DEBUG_HEX}
BYPRODUCTS ${LANG_DEBUG_HEX}
DEPENDS ${FW_LANG_FINAL}.bin
COMMENT "Creating ${FW_LANG_FINAL}.hex"
)
add_custom_target(${FW_LANG_FINAL} DEPENDS ${FW_LANG_FINAL}.hex)
list(APPEND ALL_VARIANT_HEXES ${FW_LANG_FINAL})
endforeach()
add_custom_target("${variant_name}-All-Languages" DEPENDS ${ALL_VARIANT_HEXES})
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
add_custom_command(TARGET "${variant_name}-All-Languages"
POST_BUILD
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "release"
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "release/${variant_name}_${FN_VERSION_SUFFIX}.zip" --format=zip ${variant_name}_${FN_VERSION_SUFFIX}_en*.hex
BYPRODUCTS "${CMAKE_BINARY_DIR}/release/${variant_name}_${FN_VERSION_SUFFIX}.zip"
)
endif()
add_dependencies(ALL_MULTILANG "${variant_name}-All-Languages")
endif()
endfunction()
if(CMAKE_CROSSCOMPILING)
# Main target for language checks
add_custom_target(check_lang)
foreach(LANG IN LISTS SELECTED_LANGUAGES)
add_custom_target(check_lang_${LANG})
add_dependencies(check_lang check_lang_${LANG})
endforeach()
# build a list of all supported variants
file(
GLOB ALL_VARIANTS
RELATIVE ${PROJECT_SOURCE_DIR}/Firmware/variants
${PROJECT_SOURCE_DIR}/Firmware/variants/*.h
)
list(TRANSFORM ALL_VARIANTS REPLACE "\.h$" "")
set(FW_VARIANTS
${ALL_VARIANTS}
CACHE STRING "Firmware variants to be built"
)
foreach(THIS_VAR IN LISTS FW_VARIANTS)
if(NOT ${THIS_VAR} IN_LIST ALL_VARIANTS)
message(FATAL_ERROR "Variant ${THIS_VAR} does not exist")
endif()
message("Variant added: ${THIS_VAR}")
# Generate a file in a subfolder so that we can organize things a little more neatly in VS code
set(DIR_NAME ${THIS_VAR})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build_gen/${DIR_NAME})
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/build_gen/${DIR_NAME}/CMakeLists.txt
"project(${DIR_NAME} VERSION ${PROJECT_VERSION})\nfw_add_variant(${THIS_VAR})"
)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/build_gen/${DIR_NAME})
endforeach(THIS_VAR IN LISTS FW_VARIANTS)
endif()
SET(REVO_FW_ZIP_NAME "E3D_REVO_FW_MK3_MK3S_MK3S+_${FN_VERSION_SUFFIX}.zip")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
add_custom_command(TARGET ALL_MULTILANG
POST_BUILD
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/release
BYPRODUCTS ${CMAKE_BINARY_DIR}/release/${REVO_FW_ZIP_NAME}
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${REVO_FW_ZIP_NAME}" --format=zip *E3DREVO*.hex
COMMAND ${CMAKE_COMMAND} -E rm *E3DREVO*.hex
)
endif()
#
# Tests
#
if(NOT CMAKE_CROSSCOMPILING)
enable_testing()
add_subdirectory(tests)
endif()

File diff suppressed because it is too large Load Diff

65
Community_made.md Normal file
View File

@ -0,0 +1,65 @@
# Community made
Community made features aren't fully supported by Prusa and the owners are responsible to maintain them.
In case the feature isn't maintained OR causes issues Prusa will deactivate these.
## Prusa-Firmware build
- `PF-build.sh`
- Maintainers: **@3d-gussner**
- Co-maintainers:
- Contributors: **@mkbel**, **@ropaha**, **@deliopoulos**, **@DRracer**, **wavexx**, **@leptun**, **@andrewluebke**, **@kuhnmarek**
- [X] **Active** since February 2019
- [X] **Maintained** since January 2019
### How-to use PF-build.sh
Start `./PF-build.sh` and follow the instructions
Help `./PF-build.sh -h`
# MK404 Simulator
## MK404-build.sh
**MK404 is a community 3d printer simulator created by @vintagepc**
Please checkout and support his github repository [MK404](https://github.com/vintagepc/MK404) and the [MK404 Wiki](https://github.com/vintagepc/MK404/wiki)
At this moment the `MK404-build.sh` script is only supported on Linux
- `MK404-build.sh`
- Maintainers: **@3d-gussner**
- Co-maintainers:
- Contributors:
- [X] **Active** since August 2021
- [X] **Maintained** since August 2021
### How-to use MK404-build.sh
After compiling with `PF-build.sh` you get the option to start the `MK404` simulator with the fresh compiled firmware. (Linux only at this moment)
Help `./MK404-build.sh -h`
# Translations
- see [/lang/Community_made_translations.md](https://github.com/prusa3d/Prusa-Firmware/blob/MK3/lang/Community_made_translations.md)
# Arc interpolation features
**Arc interpolation features by @FormerLurker**
Please read more about it [here](https://github.com/prusa3d/Prusa-Firmware/pull/2657) and [here](https://github.com/FormerLurker/ArcWelderPlugin)
- Maintainers: **@FormerLurker**
- Co-maintainers:
- Contributors:
- [X] **Active** since January 2023
- [X] **Maintained** since May 2020
# MeatPack
**MeatPack by @scottmudge**
Please read more about it [here](https://github.com/prusa3d/Prusa-Firmware/pull/2955), [here](https://github.com/prusa3d/Prusa-Firmware/pull/4067) and [here](https://github.com/scottmudge/OctoPrint-MeatPack/)
- Maintainers: **@scottmudge**
- Co-maintainers:
- Contributors:
- [X] **Active** since April 2023
- [X] **Maintained** since January 2021
# E3D Revo
**The E3D REVO support is a community effort thanks to these Contributors, E3D and others.**
- Maintainers: **E3D**
- Co-maintainers:
- Contributors: @alexiri @kromeninja @ulab @JWvP @snafu1282 @matthiazzz @sdh2 @jdrozdz @peschkaj @MarcelTh @zuidwijk @davejhilton @WhiterRice @NightSkySK @D-an-W
- [X] **Active** since June 2023
- [X] **Maintained** since April 2023

View File

@ -1,79 +0,0 @@
//! @file
//! @author: Marek Bel
//! @date Jan 3, 2019
#include "AutoDeplete.h"
#include "assert.h"
//! @brief bit field marking depleted filaments
//!
//! binary 1 marks filament as depleted
//! Zero initialized value means, that no filament is depleted.
static uint8_t depleted;
static const uint8_t filamentCount = 5;
//! @return binary 1 for all filaments
//! @par fCount number of filaments
static constexpr uint8_t allDepleted(uint8_t fCount)
{
return fCount == 1 ? 1 : ((1 << (fCount - 1)) | allDepleted(fCount - 1));
}
//! @brief Is filament available for printing?
//! @par filament Filament number to be checked
//! @retval true Filament is available for printing.
//! @retval false Filament is not available for printing.
static bool loaded(uint8_t filament)
{
if (depleted & (1 << filament)) return false;
return true;
}
//! @brief Mark filament as not available for printing.
//! @par filament filament to be marked
void ad_markDepleted(uint8_t filament)
{
assert(filament < filamentCount);
if (filament < filamentCount)
{
depleted |= 1 << filament;
}
}
//! @brief Mark filament as available for printing.
//! @par filament filament to be marked
void ad_markLoaded(uint8_t filament)
{
assert(filament < filamentCount);
if (filament < filamentCount)
{
depleted &= ~(1 << filament);
}
}
//! @brief Get alternative filament, which is not depleted
//! @par filament filament
//! @return Filament, if it is depleted, returns next available,
//! if all filaments are depleted, returns filament function parameter.
uint8_t ad_getAlternative(uint8_t filament)
{
assert(filament < filamentCount);
for (uint8_t i = 0; i<filamentCount; ++i)
{
uint8_t nextFilament = (filament + i) % filamentCount;
if (loaded(nextFilament)) return nextFilament;
}
return filament;
}
//! @brief Are all filaments depleted?
//! @retval true All filaments are depleted.
//! @retval false All filaments are not depleted.
bool ad_allDepleted()
{
if (allDepleted(filamentCount) == depleted)
{
return true;
}
return false;
}

View File

@ -1,17 +0,0 @@
//! @file
//! @author: Marek Bel
//! @brief Filament auto deplete engine for multi-material prints with MMUv2 (Now marketed as SpoolJoin)
//!
//! Interface for marking MMUv2 filaments as depleted and getting alternative filament for printing.
#ifndef AUTODEPLETE_H
#define AUTODEPLETE_H
#include <stdint.h>
void ad_markDepleted(uint8_t filament);
void ad_markLoaded(uint8_t filament);
uint8_t ad_getAlternative(uint8_t filament);
bool ad_allDepleted();
#endif /* AUTODEPLETE_H */

View File

@ -15,7 +15,7 @@
void SendColors(byte red, byte grn, byte blu)
{
Wire.begin();
Wire.begin();
Wire.beginTransmission(0x09);
Wire.write('o'); //to disable ongoing script, only needs to be used once
Wire.write('n');

View File

@ -1,10 +1,9 @@
#include "Configuration.h"
#include "Configuration_prusa.h"
#include "Configuration_var.h"
const uint16_t _nPrinterType PROGMEM=PRINTER_TYPE;
const char _sPrinterName[] PROGMEM=PRINTER_NAME;
const uint16_t _nPrinterMmuType PROGMEM=PRINTER_MMU_TYPE;
const char _sPrinterMmuName[] PROGMEM=PRINTER_MMU_NAME;
uint16_t nPrinterType;
PGM_P sPrinterName;
static_assert(TEMP_HYSTERESIS > 0, "TEMP_HYSTERESIS must be greater than 0");

View File

@ -1,58 +1,61 @@
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <stdint.h>
#include "boards.h"
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define _CONCAT(x,y) x##y
#define CONCAT(x,y) _CONCAT(x,y)
//-//
#include <avr/pgmspace.h>
extern const uint16_t _nPrinterType;
extern const char _sPrinterName[] PROGMEM;
extern const uint16_t _nPrinterMmuType;
extern const char _sPrinterMmuName[] PROGMEM;
extern uint16_t nPrinterType;
extern PGM_P sPrinterName;
// Firmware version
#define FW_VERSION "3.9.0"
#define FW_COMMIT_NR 3421
// FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN
// Firmware version.
// NOTE: These are ONLY used if you are not building via cmake and/or not in a git repository.
// Otherwise the repository information takes precedence.
#ifndef CMAKE_CONTROL
#define FW_MAJOR 3
#define FW_MINOR 14
#define FW_REVISION 1
#define FW_COMMITNR 8225
#define FW_FLAVOR RC //uncomment if DEV, ALPHA, BETA or RC
#define FW_FLAVERSION 1 //uncomment if FW_FLAVOR is defined and versioning is needed. Limited to max 8.
#endif
#ifndef FW_FLAVOR
#define FW_TWEAK (FIRMWARE_REVISION_RELEASED)
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION)
#define FW_VERSION_FULL STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_COMMITNR)
#else
// Construct the TWEAK value as it is expected from the enum.
#define FW_TWEAK (CONCAT(FIRMWARE_REVISION_,FW_FLAVOR) + FW_FLAVERSION)
#define FW_VERSION STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_FLAVOR) "" STR(FW_FLAVERSION)
#define FW_VERSION_FULL STR(FW_MAJOR) "." STR(FW_MINOR) "." STR(FW_REVISION) "-" STR(FW_FLAVOR) "" STR(FW_FLAVERSION) "+" STR(FW_COMMITNR)
#endif
// The full version string and repository source are set via cmake
#ifndef CMAKE_CONTROL
#define FW_COMMIT_HASH_LENGTH 1
#define FW_COMMIT_HASH "0"
#define FW_REPOSITORY "Unknown"
#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR)
#endif
// G-code language level
#define GCODE_LEVEL 1
// Debug version has debugging enabled (the symbol DEBUG_BUILD is set).
// The debug build may be a bit slower than the non-debug build, therefore the debug build should
// not be shipped to a customer.
#define FW_VERSION_DEBUG 6
// This is a development build. A development build is either built from an unofficial git repository,
// or from an unofficial branch, or it does not have a label set. Only the build server should set this build type.
#define FW_VERSION_DEVEL 5
// This is an alpha release. Only the build server should set this build type.
#define FW_VERSION_ALPHA 4
// This is a beta release. Only the build server should set this build type.
#define FW_VERSION_BETA 3
// This is a release candidate build. Only the build server should set this build type.
#define FW_VERSION_RC 2
// This is a final release. Only the build server should set this build type.
#define FW_VERSION_GOLD 1
// This is an unofficial build. The firmware should only be checked into github with this symbol,
// the build server shall never produce builds with this build type.
#define FW_VERSION_UNKNOWN 0
#if FW_DEV_VERSION == FW_VERSION_DEBUG
#define DEBUG_BUILD
#else
#undef DEBUG_BUILD
#ifndef SOURCE_DATE_EPOCH
#define SOURCE_DATE_EPOCH __DATE__
#endif
#ifndef SOURCE_TIME_EPOCH
#define SOURCE_TIME_EPOCH __TIME__
#endif
#include "Configuration_prusa.h"
#include "Configuration_var.h"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10
@ -67,10 +70,8 @@ extern PGM_P sPrinterName;
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
//#define STRING_VERSION "1.0.2"
#define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
#define STRING_VERSION_CONFIG_H SOURCE_DATE_EPOCH " " SOURCE_TIME_EPOCH // build date and time
#define STRING_CONFIG_H_AUTHOR FW_REPOSITORY // Who made the changes.
// SERIAL_PORT selects which serial port should be used for communication with the host.
// This allows the connection of wireless adapters (for instance) to non-default port pins.
@ -80,6 +81,9 @@ extern PGM_P sPrinterName;
// This determines the communication speed of the printer
#define BAUDRATE 115200
// Enable g-code compression (see https://github.com/scottmudge/OctoPrint-MeatPack)
#define ENABLE_MEATPACK
// This enables the serial port associated to the Bluetooth interface
//#define BTENABLED // Enable BT interface on AT90USB devices
@ -118,13 +122,6 @@ extern PGM_P sPrinterName;
#define TEMP_HYSTERESIS 5 // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early.
// If your bed has low resistance e.g. .6 ohm and throws the fuse you can duty cycle it to reduce the
// average current. The value should be an integer and the heat bed will be turned on for 1 interval of
// HEATER_BED_DUTY_CYCLE_DIVIDER intervals.
//#define HEATER_BED_DUTY_CYCLE_DIVIDER 4
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all extruders) EXTRUDER_WATTS
//#define EXTRUDER_WATTS (12.0*12.0/6.7) // P=I^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R
@ -144,7 +141,7 @@ extern PGM_P sPrinterName;
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
// Ultimaker
// MakerGear
// #define DEFAULT_Kp 7.0
@ -180,15 +177,15 @@ The issue: If a thermistor come off, it will read a lower temperature than actua
The system will turn the heater on forever, burning up the filament and anything
else around.
After the temperature reaches the target for the first time, this feature will
start measuring for how long the current temperature stays below the target
After the temperature reaches the target for the first time, this feature will
start measuring for how long the current temperature stays below the target
minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
If it stays longer than _PERIOD, it means the thermistor temperature
cannot catch up with the target, so something *may be* wrong. Then, to be on the
safe side, the system will he halt.
Bear in mind the count down will just start AFTER the first time the
Bear in mind the count down will just start AFTER the first time the
thermistor temperature is over the target, so you will have no problem if
your extruder heater takes 2 minutes to hit the target on heating.
@ -262,7 +259,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
#define DISABLE_Y 0
#define DISABLE_Z 0
#define DISABLE_E 0// For all extruders
#define DISABLE_INACTIVE_EXTRUDER 1 //disable only inactive extruders and keep active extruder enabled
// ENDSTOP SETTINGS:
@ -281,131 +277,13 @@ your extruder heater takes 2 minutes to hit the target on heating.
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
#define Z_HEIGHT_HIDE_LIVE_ADJUST_MENU 2.0f
#define HOME_Z_SEARCH_THRESHOLD 0.15f // Threshold of the Z height in calibration
//============================= Bed Auto Leveling ===========================
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
#define Z_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled.
#ifdef ENABLE_AUTO_BED_LEVELING
// There are 2 different ways to pick the X and Y locations to probe:
// - "grid" mode
// Probe every point in a rectangular grid
// You must specify the rectangle, and the density of sample points
// This mode is preferred because there are more measurements.
// It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive
// - "3-point" mode
// Probe 3 arbitrary points on the bed (that aren't colinear)
// You must specify the X & Y coordinates of all 3 points
#define AUTO_BED_LEVELING_GRID
// with AUTO_BED_LEVELING_GRID, the bed is sampled in a
// AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid
// and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#ifdef AUTO_BED_LEVELING_GRID
// set the rectangle in which to probe
#define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 170
#define BACK_PROBE_BED_POSITION 180
#define FRONT_PROBE_BED_POSITION 20
// set the number of grid points per dimension
// I wouldn't see a reason to go above 3 (=9 probing points on the bed)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to esimate the plane of the print bed
#define ABL_PROBE_PT_1_X 15
#define ABL_PROBE_PT_1_Y 180
#define ABL_PROBE_PT_2_X 15
#define ABL_PROBE_PT_2_Y 20
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_LEVELING_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets must be integers
#define X_PROBE_OFFSET_FROM_EXTRUDER -25
#define Y_PROBE_OFFSET_FROM_EXTRUDER -29
#define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
#define Z_RAISE_BEFORE_HOMING 5 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define XY_TRAVEL_SPEED 8000 // X and Y axis travel speed between probes, in mm/min
#define Z_RAISE_BEFORE_PROBING 15 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
//If defined, the Probe servo will be turned on only during movement and then turned off to avoid jerk
//The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
// You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
// #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!
//#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area.
// When defined, it will:
// - Allow Z homing only after X and Y homing AND stepper drivers still enabled
// - If stepper drivers timeout, it will need X and Y homing again before Z homing
// - Position the probe in a defined XY point before Z Homing when homing all axis (G28)
// - Block Z homing only when the probe is outside bed area.
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28)
#endif
#ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range
#if X_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(X_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
#error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#else
#if ((X_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
#error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#endif
#if Y_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
#error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#else
#if ((Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
#error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#endif
#endif
#endif // ENABLE_AUTO_BED_LEVELING
// The position of the homing switches
//#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
//#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
@ -413,13 +291,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
//Manual homing switch locations:
// For deltabots this means top and center of the Cartesian print volume.
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
// For the other hotends it is their distance from the extruder 0 hotend.
// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
// The speed change that does not require acceleration (i.e. the software might assume it can be done instantaneously)
#define DEFAULT_XJERK 10 // (mm/sec)
#define DEFAULT_YJERK 10 // (mm/sec)
@ -430,26 +301,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
//=============================Additional Features===========================
//===========================================================================
// Custom M code points
#define CUSTOM_M_CODES
#ifdef CUSTOM_M_CODES
#define CUSTOM_M_CODE_SET_Z_PROBE_OFFSET 851
#define Z_PROBE_OFFSET_RANGE_MIN -15
#define Z_PROBE_OFFSET_RANGE_MAX -5
#endif
// EEPROM
// The microcontroller can store settings in the EEPROM, e.g. max velocity...
// M500 - stores parameters in EEPROM
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
//define this to enable EEPROM support
//#define EEPROM_SETTINGS
//to disable EEPROM Serial responses and decrease program space by ~1700 byte: comment this out:
// please keep turned on if you can.
//#define EEPROM_CHITCHAT
// Host Keepalive
//
// When enabled Marlin will send a busy status message to the host
@ -473,16 +324,15 @@ your extruder heater takes 2 minutes to hit the target on heating.
#define SDSUPPORT
#define LCD_WIDTH 20
#define LCD_HEIGHT 4
#define LCD_BACKLIGHT_LEVEL_HIGH 130
#define LCD_BACKLIGHT_LEVEL_LOW 50
#define LCD_BACKLIGHT_FORCE_ON 30
#define LCD_BACKLIGHT_TIMEOUT 15
// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
//#define FAST_PWM_FAN
// Temperature status LEDs that display the hotend and bet temperature.
// If all hotends and bed temperature and temperature setpoint are < 54C then the BLUE led is on.
// Otherwise the RED led is on. There is 1C hysteresis.
//#define TEMP_STAT_LEDS
// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
// is too low, you should also increment SOFT_PWM_SCALE.
@ -508,55 +358,16 @@ your extruder heater takes 2 minutes to hit the target on heating.
//define BlinkM/CyzRgb Support
//#define BLINKM
/*********************************************************************\
* R/C SERVO support
* Sponsored by TrinityLabs, Reworked by codexmas
**********************************************************************/
// Number of servos
//
// If you select a configuration below, this will receive a default value and does not need to be set manually
// set it manually if you have more servos than extruders and wish to manually control some
// leaving it undefined or defining as 0 will disable the servo subsystem
// If unsure, leave commented / disabled
//
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm). Used by the volumetric extrusion.
// Calibration status of the machine, to be stored into the EEPROM,
// (unsigned char*)EEPROM_CALIBRATION_STATUS
enum CalibrationStatus
{
// Freshly assembled, needs to peform a self-test and the XYZ calibration.
CALIBRATION_STATUS_ASSEMBLED = 255,
// For the wizard: self test has been performed, now the XYZ calibration is needed.
CALIBRATION_STATUS_XYZ_CALIBRATION = 250,
// For the wizard: factory assembled, needs to run Z calibration.
CALIBRATION_STATUS_Z_CALIBRATION = 240,
// The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode.
CALIBRATION_STATUS_LIVE_ADJUST = 230,
// Calibrated, ready to print.
CALIBRATION_STATUS_CALIBRATED = 1,
// Legacy: resetted by issuing a G86 G-code.
// This value can only be expected after an upgrade from the initial MK2 firmware releases.
// Currently the G86 sets the calibration status to
CALIBRATION_STATUS_UNKNOWN = 0,
};
// Try to maintain a minimum distance from the bed even when Z is
// unknown when doing the following operations
#define MIN_Z_FOR_LOAD 50
#define MIN_Z_FOR_UNLOAD 20
#define MIN_Z_FOR_PREHEAT 10
#define MIN_Z_FOR_LOAD 35 // lcd filament loading or autoload (values for load and unload have been unified to prevent movement between unload & load operations!)
#define MIN_Z_FOR_UNLOAD 35 // lcd filament unloading
#define MIN_Z_FOR_SWAP 27 // filament change (including M600)
#define MIN_Z_FOR_PREHEAT 10 // lcd preheat
#include "Configuration_adv.h"
#include "thermistortables.h"
#endif //__CONFIGURATION_H

View File

@ -3,172 +3,112 @@
#include "Marlin.h"
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
#include "ConfigurationStore.h"
#include "Configuration_prusa.h"
#ifdef MESH_BED_LEVELING
#include "mesh_bed_leveling.h"
#endif
#include "Configuration_var.h"
#ifdef TMC2130
#include "tmc2130.h"
#endif
M500_conf cs;
//! @brief Write data to EEPROM
//! @param pos destination in EEPROM, 0 is start
//! @param value value to be written
//! @param size size of type pointed by value
//! @param name name of variable written, used only for debug input if DEBUG_EEPROM_WRITE defined
//! @retval true success
//! @retval false failed
#ifdef DEBUG_EEPROM_WRITE
static bool EEPROM_writeData(uint8_t* pos, uint8_t* value, uint8_t size, const char* name)
#else //DEBUG_EEPROM_WRITE
static bool EEPROM_writeData(uint8_t* pos, uint8_t* value, uint8_t size, const char*)
#endif //DEBUG_EEPROM_WRITE
{
#ifdef DEBUG_EEPROM_WRITE
printf_P(PSTR("EEPROM_WRITE_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name);
#endif //DEBUG_EEPROM_WRITE
while (size--)
{
eeprom_update_byte(pos, *value);
if (eeprom_read_byte(pos) != *value) {
SERIAL_ECHOLNPGM("EEPROM Error");
return false;
}
pos++;
value++;
}
return true;
}
#ifdef DEBUG_EEPROM_READ
static void EEPROM_readData(uint8_t* pos, uint8_t* value, uint8_t size, const char* name)
#else //DEBUG_EEPROM_READ
static void EEPROM_readData(uint8_t* pos, uint8_t* value, uint8_t size, const char*)
#endif //DEBUG_EEPROM_READ
{
#ifdef DEBUG_EEPROM_READ
printf_P(PSTR("EEPROM_READ_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name);
#endif //DEBUG_EEPROM_READ
while(size--)
{
*value = eeprom_read_byte(pos);
pos++;
value++;
}
}
#define EEPROM_VERSION "V2"
#ifdef EEPROM_SETTINGS
void Config_StoreSettings()
{
strcpy(cs.version,"000"); //!< invalidate data first @TODO use erase to save one erase cycle
if (EEPROM_writeData(reinterpret_cast<uint8_t*>(EEPROM_M500_base),reinterpret_cast<uint8_t*>(&cs),sizeof(cs),0), "cs, invalid version")
{
strcpy(cs.version,EEPROM_VERSION); //!< validate data if write succeed
EEPROM_writeData(reinterpret_cast<uint8_t*>(EEPROM_M500_base->version), reinterpret_cast<uint8_t*>(cs.version), sizeof(cs.version), "cs.version valid");
}
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Settings Stored");
}
#endif //EEPROM_SETTINGS
#ifndef DISABLE_M503
void Config_PrintSettings(uint8_t level)
{ // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
#ifdef TMC2130
printf_P(PSTR(
"%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n"
printf_P(PSTR(
"%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n"
"%SUStep resolution: \n%S M350 X%d Y%d Z%d E%d\n"
"%SMaximum feedrates - normal (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
"%SMaximum feedrates - stealth (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
"%SMaximum acceleration - normal (mm/s2):\n%S M201 X%lu Y%lu Z%lu E%lu\n"
"%SMaximum acceleration - stealth (mm/s2):\n%S M201 X%lu Y%lu Z%lu E%lu\n"
"%SAcceleration: S=acceleration, T=retract acceleration\n%S M204 S%.2f T%.2f\n"
"%SAdvanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)\n%S M205 S%.2f T%.2f B%.2f X%.2f Y%.2f Z%.2f E%.2f\n"
"%SAcceleration: P=print, R=retract, T=travel\n%S M204 P%.2f R%.2f T%.2f\n"
"%SAdvanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (us), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)\n%S M205 S%.2f T%.2f B%lu X%.2f Y%.2f Z%.2f E%.2f\n"
"%SHome offset (mm):\n%S M206 X%.2f Y%.2f Z%.2f\n"
),
echomagic, echomagic, cs.axis_steps_per_unit[X_AXIS], cs.axis_steps_per_unit[Y_AXIS], cs.axis_steps_per_unit[Z_AXIS], cs.axis_steps_per_unit[E_AXIS],
echomagic, echomagic, cs.axis_steps_per_mm[X_AXIS], cs.axis_steps_per_mm[Y_AXIS], cs.axis_steps_per_mm[Z_AXIS], cs.axis_steps_per_mm[E_AXIS],
echomagic, echomagic, cs.axis_ustep_resolution[X_AXIS], cs.axis_ustep_resolution[Y_AXIS], cs.axis_ustep_resolution[Z_AXIS], cs.axis_ustep_resolution[E_AXIS],
echomagic, echomagic, cs.max_feedrate_normal[X_AXIS], cs.max_feedrate_normal[Y_AXIS], cs.max_feedrate_normal[Z_AXIS], cs.max_feedrate_normal[E_AXIS],
echomagic, echomagic, cs.max_feedrate_silent[X_AXIS], cs.max_feedrate_silent[Y_AXIS], cs.max_feedrate_silent[Z_AXIS], cs.max_feedrate_silent[E_AXIS],
echomagic, echomagic, cs.max_acceleration_units_per_sq_second_normal[X_AXIS], cs.max_acceleration_units_per_sq_second_normal[Y_AXIS], cs.max_acceleration_units_per_sq_second_normal[Z_AXIS], cs.max_acceleration_units_per_sq_second_normal[E_AXIS],
echomagic, echomagic, cs.max_acceleration_units_per_sq_second_silent[X_AXIS], cs.max_acceleration_units_per_sq_second_silent[Y_AXIS], cs.max_acceleration_units_per_sq_second_silent[Z_AXIS], cs.max_acceleration_units_per_sq_second_silent[E_AXIS],
echomagic, echomagic, cs.acceleration, cs.retract_acceleration,
echomagic, echomagic, cs.minimumfeedrate, cs.mintravelfeedrate, cs.minsegmenttime, cs.max_jerk[X_AXIS], cs.max_jerk[Y_AXIS], cs.max_jerk[Z_AXIS], cs.max_jerk[E_AXIS],
echomagic, echomagic, cs.max_acceleration_mm_per_s2_normal[X_AXIS], cs.max_acceleration_mm_per_s2_normal[Y_AXIS], cs.max_acceleration_mm_per_s2_normal[Z_AXIS], cs.max_acceleration_mm_per_s2_normal[E_AXIS],
echomagic, echomagic, cs.max_acceleration_mm_per_s2_silent[X_AXIS], cs.max_acceleration_mm_per_s2_silent[Y_AXIS], cs.max_acceleration_mm_per_s2_silent[Z_AXIS], cs.max_acceleration_mm_per_s2_silent[E_AXIS],
echomagic, echomagic, cs.acceleration, cs.retract_acceleration, cs.travel_acceleration,
echomagic, echomagic, cs.minimumfeedrate, cs.mintravelfeedrate, cs.min_segment_time_us, cs.max_jerk[X_AXIS], cs.max_jerk[Y_AXIS], cs.max_jerk[Z_AXIS], cs.max_jerk[E_AXIS],
echomagic, echomagic, cs.add_homing[X_AXIS], cs.add_homing[Y_AXIS], cs.add_homing[Z_AXIS]
#else //TMC2130
printf_P(PSTR(
"%SSteps per unit:\n%S M92 X%.2f Y%.2f Z%.2f E%.2f\n"
"%SMaximum feedrates (mm/s):\n%S M203 X%.2f Y%.2f Z%.2f E%.2f\n"
"%SMaximum acceleration (mm/s2):\n%S M201 X%lu Y%lu Z%lu E%lu\n"
"%SAcceleration: S=acceleration, T=retract acceleration\n%S M204 S%.2f T%.2f\n"
"%SAdvanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)\n%S M205 S%.2f T%.2f B%.2f X%.2f Y%.2f Z%.2f E%.2f\n"
"%SAcceleration: P=print, R=retract, T=travel\n%S M204 P%.2f R%.2f T%.2f\n"
"%SAdvanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (us), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)\n%S M205 S%.2f T%.2f B%lu X%.2f Y%.2f Z%.2f E%.2f\n"
"%SHome offset (mm):\n%S M206 X%.2f Y%.2f Z%.2f\n"
),
echomagic, echomagic, cs.axis_steps_per_unit[X_AXIS], cs.axis_steps_per_unit[Y_AXIS], cs.axis_steps_per_unit[Z_AXIS], cs.axis_steps_per_unit[E_AXIS],
echomagic, echomagic, cs.axis_steps_per_mm[X_AXIS], cs.axis_steps_per_mm[Y_AXIS], cs.axis_steps_per_mm[Z_AXIS], cs.axis_steps_per_mm[E_AXIS],
echomagic, echomagic, max_feedrate[X_AXIS], max_feedrate[Y_AXIS], max_feedrate[Z_AXIS], max_feedrate[E_AXIS],
echomagic, echomagic, max_acceleration_units_per_sq_second[X_AXIS], max_acceleration_units_per_sq_second[Y_AXIS], max_acceleration_units_per_sq_second[Z_AXIS], max_acceleration_units_per_sq_second[E_AXIS],
echomagic, echomagic, cs.acceleration, cs.retract_acceleration,
echomagic, echomagic, cs.minimumfeedrate, cs.mintravelfeedrate, cs.minsegmenttime, cs.max_jerk[X_AXIS], cs.max_jerk[Y_AXIS], cs.max_jerk[Z_AXIS], cs.max_jerk[E_AXIS],
echomagic, echomagic, max_acceleration_mm_per_s2[X_AXIS], max_acceleration_mm_per_s2[Y_AXIS], max_acceleration_mm_per_s2[Z_AXIS], max_acceleration_mm_per_s2[E_AXIS],
echomagic, echomagic, cs.acceleration, cs.retract_acceleration, cs.travel_acceleration,
echomagic, echomagic, cs.minimumfeedrate, cs.mintravelfeedrate, cs.min_segment_time_us, cs.max_jerk[X_AXIS], cs.max_jerk[Y_AXIS], cs.max_jerk[Z_AXIS], cs.max_jerk[E_AXIS],
echomagic, echomagic, cs.add_homing[X_AXIS], cs.add_homing[Y_AXIS], cs.add_homing[Z_AXIS]
#endif //TMC2130
);
);
#ifdef PIDTEMP
printf_P(PSTR("%SPID settings:\n%S M301 P%.2f I%.2f D%.2f\n"),
echomagic, echomagic, cs.Kp, unscalePID_i(cs.Ki), unscalePID_d(cs.Kd));
printf_P(PSTR("%SPID settings:\n%S M301 P%.2f I%.2f D%.2f\n"),
echomagic, echomagic, cs.Kp, unscalePID_i(cs.Ki), unscalePID_d(cs.Kd));
#endif
#ifdef PIDTEMPBED
printf_P(PSTR("%SPID heatbed settings:\n%S M304 P%.2f I%.2f D%.2f\n"),
echomagic, echomagic, cs.bedKp, unscalePID_i(cs.bedKi), unscalePID_d(cs.bedKd));
printf_P(PSTR("%SPID heatbed settings:\n%S M304 P%.2f I%.2f D%.2f\n"),
echomagic, echomagic, cs.bedKp, unscalePID_i(cs.bedKi), unscalePID_d(cs.bedKd));
#endif
#ifdef FWRETRACT
printf_P(PSTR(
"%SRetract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)\n%S M207 S%.2f F%.2f Z%.2f\n"
"%SRecover: S=Extra length (mm) F:Speed (mm/m)\n%S M208 S%.2f F%.2f\n"
"%SAuto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries\n%S M209 S%d\n"
),
echomagic, echomagic, cs.retract_length, cs.retract_feedrate*60, cs.retract_zlift,
echomagic, echomagic, cs.retract_recover_length, cs.retract_recover_feedrate*60,
echomagic, echomagic, (cs.autoretract_enabled ? 1 : 0)
);
printf_P(PSTR(
"%SRetract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)\n%S M207 S%.2f F%.2f Z%.2f\n"
"%SRecover: S=Extra length (mm) F:Speed (mm/m)\n%S M208 S%.2f F%.2f\n"
"%SAuto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries\n%S M209 S%d\n"
),
echomagic, echomagic, cs.retract_length, cs.retract_feedrate*60, cs.retract_zlift,
echomagic, echomagic, cs.retract_recover_length, cs.retract_recover_feedrate*60,
echomagic, echomagic, (cs.autoretract_enabled ? 1 : 0)
);
#if EXTRUDERS > 1
printf_P(PSTR("%SMulti-extruder settings:\n%S Swap retract length (mm): %.2f\n%S Swap rec. addl. length (mm): %.2f\n"),
echomagic, echomagic, retract_length_swap, echomagic, retract_recover_length_swap);
printf_P(PSTR("%SMulti-extruder settings:\n%S Swap retract length (mm): %.2f\n%S Swap rec. addl. length (mm): %.2f\n"),
echomagic, echomagic, retract_length_swap, echomagic, retract_recover_length_swap);
#endif
if (cs.volumetric_enabled) {
printf_P(PSTR("%SFilament settings:\n%S M200 D%.2f\n"),
echomagic, echomagic, cs.filament_size[0]);
if (cs.volumetric_enabled) {
printf_P(PSTR("%SFilament settings:\n%S M200 D%.2f\n"),
echomagic, echomagic, cs.filament_size[0]);
#if EXTRUDERS > 1
printf_P(PSTR("%S M200 T1 D%.2f\n"),
echomagic, echomagic, cs.filament_size[1]);
printf_P(PSTR("%S M200 T1 D%.2f\n"),
echomagic, echomagic, cs.filament_size[1]);
#if EXTRUDERS > 2
printf_P(PSTR("%S M200 T1 D%.2f\n"),
echomagic, echomagic, cs.filament_size[2]);
printf_P(PSTR("%S M200 T1 D%.2f\n"),
echomagic, echomagic, cs.filament_size[2]);
#endif
#endif
} else {
printf_P(PSTR("%SFilament settings: Disabled\n"), echomagic);
}
#endif
if (level >= 10) {
if (level >= 10) {
#ifdef LIN_ADVANCE
printf_P(PSTR("%SLinear advance settings:%S M900 K%.2f\n"),
printf_P(PSTR("%SLinear advance settings:%S M900 K%.2f\n"),
echomagic, echomagic, extruder_advance_K);
#endif //LIN_ADVANCE
}
}
// Arc Interpolation Settings
printf_P(PSTR(
"%SArc Settings: P:Max length(mm) S:Min length (mm) N:Corrections R:Min segments F:Segments/sec.\n%S M214 P%.2f S%.2f N%d R%d F%d\n"),
echomagic, echomagic, cs.mm_per_arc_segment, cs.min_mm_per_arc_segment, cs.n_arc_correction, cs.min_arc_segments, cs.arc_segments_per_sec);
#ifdef THERMAL_MODEL
thermal_model_report_settings();
#endif
printf_P(PSTR(
"%SStatistics:\n%S M78 S%lu T%lu\n"),
echomagic, echomagic, eeprom_read_dword((uint32_t *)EEPROM_FILAMENTUSED), eeprom_read_dword((uint32_t *)EEPROM_TOTALTIME));
}
#endif
@ -177,14 +117,10 @@ void Config_PrintSettings(uint8_t level)
static_assert (EXTRUDERS == 1, "ConfigurationStore M500_conf not implemented for more extruders, fix filament_size array size.");
static_assert (NUM_AXIS == 4, "ConfigurationStore M500_conf not implemented for more axis."
"Fix axis_steps_per_unit max_feedrate_normal max_acceleration_units_per_sq_second_normal max_jerk max_feedrate_silent"
" max_acceleration_units_per_sq_second_silent array size.");
#ifdef ENABLE_AUTO_BED_LEVELING
static_assert (false, "zprobe_zoffset was not initialized in printers in field to -(Z_PROBE_OFFSET_FROM_EXTRUDER), so it contains"
"0.0, if this is not acceptable, increment EEPROM_VERSION to force use default_conf");
#endif
"Fix axis_steps_per_mm max_feedrate_normal max_acceleration_mm_per_s2_normal max_jerk max_feedrate_silent"
" max_acceleration_mm_per_s2_silent array size.");
static_assert (sizeof(M500_conf) == 192, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, "
static_assert (sizeof(M500_conf) == 209, "sizeof(M500_conf) has changed, ensure that EEPROM_VERSION has been incremented, "
"or if you added members in the end of struct, ensure that historically uninitialized values will be initialized."
"If this is caused by change to more then 8bit processor, decide whether make this struct packed to save EEPROM,"
"leave as it is to keep fast code, or reorder struct members to pack more tightly.");
@ -232,90 +168,99 @@ static const M500_conf default_conf PROGMEM =
#else // TMC2130
{16,16,16,16},
#endif
DEFAULT_TRAVEL_ACCELERATION,
DEFAULT_MM_PER_ARC_SEGMENT,
DEFAULT_MIN_MM_PER_ARC_SEGMENT,
DEFAULT_N_ARC_CORRECTION,
DEFAULT_MIN_ARC_SEGMENTS,
DEFAULT_ARC_SEGMENTS_PER_SEC
};
void Config_StoreSettings()
{
strcpy_P(cs.version, default_conf.version);
eeprom_update_block_notify(reinterpret_cast<uint8_t*>(&cs), reinterpret_cast<uint8_t*>(EEPROM_M500_base), sizeof(cs));
#ifdef THERMAL_MODEL
thermal_model_save_settings();
#endif
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Settings Stored");
}
//! @brief Read M500 configuration
//! @retval true Succeeded. Stored settings retrieved or default settings retrieved in case EEPROM has been erased.
//! @retval false Failed. Default settings has been retrieved, because of older version or corrupted data.
//! @retval true Succeeded. Stored settings retrieved or default settings retrieved in case EEPROM cs was empty.
//! @retval false Failed. Default settings has been retrieved, because of version mismatch
bool Config_RetrieveSettings()
{
bool previous_settings_retrieved = true;
char ver[4]=EEPROM_VERSION;
EEPROM_readData(reinterpret_cast<uint8_t*>(EEPROM_M500_base->version), reinterpret_cast<uint8_t*>(cs.version), sizeof(cs.version), "cs.version"); //read stored version
eeprom_read_block(reinterpret_cast<uint8_t*>(cs.version), reinterpret_cast<uint8_t*>(EEPROM_M500_base->version), sizeof(cs.version));
// SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << cs.version << "]");
if (strncmp(ver,cs.version,3) == 0) // version number match
if (strncmp_P(cs.version, default_conf.version, sizeof(EEPROM_VERSION)) == 0) // version number match
{
// Initialize arc interpolation settings in eeprom if they are not already
eeprom_init_default_float(&EEPROM_M500_base->mm_per_arc_segment, pgm_read_float(&default_conf.mm_per_arc_segment));
eeprom_init_default_float(&EEPROM_M500_base->min_mm_per_arc_segment, pgm_read_float(&default_conf.min_mm_per_arc_segment));
eeprom_init_default_byte(&EEPROM_M500_base->n_arc_correction, pgm_read_byte(&default_conf.n_arc_correction));
eeprom_init_default_word(&EEPROM_M500_base->min_arc_segments, pgm_read_word(&default_conf.min_arc_segments));
eeprom_init_default_word(&EEPROM_M500_base->arc_segments_per_sec, pgm_read_word(&default_conf.arc_segments_per_sec));
EEPROM_readData(reinterpret_cast<uint8_t*>(EEPROM_M500_base), reinterpret_cast<uint8_t*>(&cs), sizeof(cs), "cs");
// Initialize the travel_acceleration in eeprom if not already
eeprom_init_default_float(&EEPROM_M500_base->travel_acceleration, pgm_read_float(&default_conf.travel_acceleration));
if (cs.max_jerk[X_AXIS] > DEFAULT_XJERK) cs.max_jerk[X_AXIS] = DEFAULT_XJERK;
if (cs.max_jerk[Y_AXIS] > DEFAULT_YJERK) cs.max_jerk[Y_AXIS] = DEFAULT_YJERK;
calculate_extruder_multipliers();
//if max_feedrate_silent and max_acceleration_units_per_sq_second_silent were never stored to eeprom, use default values:
for (uint8_t i = 0; i < (sizeof(cs.max_feedrate_silent)/sizeof(cs.max_feedrate_silent[0])); ++i)
{
const uint32_t erased = 0xffffffff;
bool initialized = false;
for(uint8_t j = 0; j < sizeof(float); ++j)
{
if(0xff != reinterpret_cast<uint8_t*>(&(cs.max_feedrate_silent[i]))[j]) initialized = true;
}
if (!initialized) memcpy_P(&cs.max_feedrate_silent[i],&default_conf.max_feedrate_silent[i], sizeof(cs.max_feedrate_silent[i]));
if (erased == cs.max_acceleration_units_per_sq_second_silent[i]) {
memcpy_P(&cs.max_acceleration_units_per_sq_second_silent[i],&default_conf.max_acceleration_units_per_sq_second_silent[i],sizeof(cs.max_acceleration_units_per_sq_second_silent[i]));
}
}
// Initialize the max_feedrate_silent and max_acceleration_mm_per_s2_silent in eeprom if not already
eeprom_init_default_block(&EEPROM_M500_base->max_feedrate_silent, sizeof(EEPROM_M500_base->max_feedrate_silent), default_conf.max_feedrate_silent);
eeprom_init_default_block(&EEPROM_M500_base->max_acceleration_mm_per_s2_silent, sizeof(EEPROM_M500_base->max_acceleration_mm_per_s2_silent), default_conf.max_acceleration_mm_per_s2_silent);
#ifdef TMC2130
for (uint8_t j = X_AXIS; j <= Y_AXIS; j++)
{
if (cs.max_feedrate_normal[j] > NORMAL_MAX_FEEDRATE_XY)
cs.max_feedrate_normal[j] = NORMAL_MAX_FEEDRATE_XY;
if (cs.max_feedrate_silent[j] > SILENT_MAX_FEEDRATE_XY)
cs.max_feedrate_silent[j] = SILENT_MAX_FEEDRATE_XY;
if (cs.max_acceleration_units_per_sq_second_normal[j] > NORMAL_MAX_ACCEL_XY)
cs.max_acceleration_units_per_sq_second_normal[j] = NORMAL_MAX_ACCEL_XY;
if (cs.max_acceleration_units_per_sq_second_silent[j] > SILENT_MAX_ACCEL_XY)
cs.max_acceleration_units_per_sq_second_silent[j] = SILENT_MAX_ACCEL_XY;
}
if(cs.axis_ustep_resolution[X_AXIS] == 0xff){ cs.axis_ustep_resolution[X_AXIS] = TMC2130_USTEPS_XY; }
if(cs.axis_ustep_resolution[Y_AXIS] == 0xff){ cs.axis_ustep_resolution[Y_AXIS] = TMC2130_USTEPS_XY; }
if(cs.axis_ustep_resolution[Z_AXIS] == 0xff){ cs.axis_ustep_resolution[Z_AXIS] = TMC2130_USTEPS_Z; }
if(cs.axis_ustep_resolution[E_AXIS] == 0xff){ cs.axis_ustep_resolution[E_AXIS] = TMC2130_USTEPS_E; }
eeprom_init_default_block(&EEPROM_M500_base->axis_ustep_resolution, sizeof(EEPROM_M500_base->axis_ustep_resolution), default_conf.axis_ustep_resolution);
#endif // TMC2130
tmc2130_set_res(X_AXIS, cs.axis_ustep_resolution[X_AXIS]);
tmc2130_set_res(Y_AXIS, cs.axis_ustep_resolution[Y_AXIS]);
tmc2130_set_res(Z_AXIS, cs.axis_ustep_resolution[Z_AXIS]);
tmc2130_set_res(E_AXIS, cs.axis_ustep_resolution[E_AXIS]);
// load the CS to RAM
eeprom_read_block(reinterpret_cast<uint8_t*>(&cs), reinterpret_cast<uint8_t*>(EEPROM_M500_base), sizeof(cs));
calculate_extruder_multipliers();
#ifdef TMC2130
for (uint8_t j = X_AXIS; j <= Y_AXIS; j++)
{
if (cs.max_feedrate_normal[j] > NORMAL_MAX_FEEDRATE_XY)
cs.max_feedrate_normal[j] = NORMAL_MAX_FEEDRATE_XY;
if (cs.max_feedrate_silent[j] > SILENT_MAX_FEEDRATE_XY)
cs.max_feedrate_silent[j] = SILENT_MAX_FEEDRATE_XY;
if (cs.max_acceleration_mm_per_s2_normal[j] > NORMAL_MAX_ACCEL_XY)
cs.max_acceleration_mm_per_s2_normal[j] = NORMAL_MAX_ACCEL_XY;
if (cs.max_acceleration_mm_per_s2_silent[j] > SILENT_MAX_ACCEL_XY)
cs.max_acceleration_mm_per_s2_silent[j] = SILENT_MAX_ACCEL_XY;
}
tmc2130_set_res(X_AXIS, cs.axis_ustep_resolution[X_AXIS]);
tmc2130_set_res(Y_AXIS, cs.axis_ustep_resolution[Y_AXIS]);
tmc2130_set_res(Z_AXIS, cs.axis_ustep_resolution[Z_AXIS]);
tmc2130_set_res(E_AXIS, cs.axis_ustep_resolution[E_AXIS]);
#endif //TMC2130
reset_acceleration_rates();
// Call updatePID (similar to when we have processed M301)
updatePID();
// Call updatePID (similar to when we have processed M301)
updatePID();
#ifdef THERMAL_MODEL
thermal_model_load_settings();
#endif
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Stored settings retrieved");
}
else
{
Config_ResetDefault();
//Return false to inform user that eeprom version was changed and firmware is using default hardcoded settings now.
//In case that storing to eeprom was not used yet, do not inform user that hardcoded settings are used.
if (eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[0]))) != 0xFF ||
eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[1]))) != 0xFF ||
eeprom_read_byte(reinterpret_cast<uint8_t*>(&(EEPROM_M500_base->version[2]))) != 0xFF)
{
previous_settings_retrieved = false;
}
//Return false to inform user that eeprom version was changed and firmware is using default hardcoded settings now.
//In case that storing to eeprom was not used yet, do not inform user that hardcoded settings are used.
if (eeprom_is_initialized_block(EEPROM_M500_base->version, sizeof(EEPROM_M500_base->version))) {
return false;
}
}
#ifdef EEPROM_CHITCHAT
Config_PrintSettings();
#endif
return previous_settings_retrieved;
return true;
}
#endif
@ -323,19 +268,20 @@ void Config_ResetDefault()
{
memcpy_P(&cs,&default_conf, sizeof(cs));
// steps per sq second need to be updated to agree with the units per sq second
// steps per sq second need to be updated to agree with the units per sq second
reset_acceleration_rates();
#ifdef PIDTEMP
updatePID();
#ifdef PID_ADD_EXTRUSION_RATE
Kc = DEFAULT_Kc; //this is not stored by Config_StoreSettings
#endif//PID_ADD_EXTRUSION_RATE
#endif//PIDTEMP
#ifdef THERMAL_MODEL
thermal_model_reset_settings();
#endif
calculate_extruder_multipliers();
calculate_extruder_multipliers();
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
}

View File

@ -9,17 +9,17 @@
typedef struct
{
char version[4];
float axis_steps_per_unit[4];
float axis_steps_per_mm[4];
float max_feedrate_normal[4];
unsigned long max_acceleration_units_per_sq_second_normal[4];
uint32_t max_acceleration_mm_per_s2_normal[4];
float acceleration; //!< Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
float retract_acceleration; //!< mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
float minimumfeedrate;
float mintravelfeedrate;
unsigned long minsegmenttime;
uint32_t min_segment_time_us; //!< (µs) M205 B
float max_jerk[4]; //!< Jerk is a maximum immediate velocity change.
float add_homing[3];
float zprobe_zoffset;
float zprobe_zoffset; //!< unused
float Kp;
float Ki;
float Kd;
@ -36,8 +36,15 @@ typedef struct
bool volumetric_enabled;
float filament_size[1]; //!< cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
float max_feedrate_silent[4]; //!< max speeds for silent mode
unsigned long max_acceleration_units_per_sq_second_silent[4];
uint32_t max_acceleration_mm_per_s2_silent[4];
unsigned char axis_ustep_resolution[4];
float travel_acceleration; //!< travel acceleration mm/s^2
// Arc Interpolation Settings, configurable via M214
float mm_per_arc_segment;
float min_mm_per_arc_segment;
uint8_t n_arc_correction; // If equal to zero, this is disabled
uint16_t min_arc_segments; // If equal to zero, this is disabled
uint16_t arc_segments_per_sec; // If equal to zero, this is disabled
} M500_conf;
extern M500_conf cs;
@ -58,8 +65,4 @@ FORCE_INLINE void Config_StoreSettings() {}
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
#endif
inline uint8_t calibration_status() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS); }
inline void calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); }
inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); }
#endif//CONFIG_STORE_H

View File

@ -10,16 +10,6 @@
#endif
#define BED_CHECK_INTERVAL 5000 //ms between checks in bang-bang control
#ifdef PIDTEMP
// this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated.
#define PID_ADD_EXTRUSION_RATE
#ifdef PID_ADD_EXTRUSION_RATE
#define DEFAULT_Kc (1) //heating power=Kc*(e_speed)
#endif
#endif
//automatic temperature: The hot end target temperature is calculated by all the buffered lines of gcode.
//The maximum buffered steps/sec of the extruder motor are called "se".
//You enter the autotemp mode by a M109 S<mintemp> B<maxtemp> F<factor>
@ -62,8 +52,25 @@
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
#define FAN_KICKSTART_TIME 800
/**
* Auto-report all at once with M155 S<seconds> C[bitmask] with single timer
*
* bit 0 = Auto-report temperatures
* bit 1 = Auto-report fans
* bit 2 = Auto-report position
* bit 3 = free
* bit 4 = free
* bit 5 = free
* bit 6 = free
* bit 7 = free
*/
#define AUTO_REPORT
// Keepalive period which is restarted with M79
#define M79_TIMEOUT 30 * 1000 // ms
// A timer which is restarted everytime a G-command is added to the command queue.
#define USB_TIMER_TIMEOUT 10 * 1000 // ms
//===========================================================================
//=============================Mechanical Settings===========================
@ -118,34 +125,6 @@
#endif //End auto min/max positions
//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
// A single Z stepper driver is usually used to drive 2 stepper motors.
// Uncomment this define to utilize a separate stepper driver for each Z axis motor.
// Only a few motherboards support this, like RAMPS, which have dual extruder support (the 2nd, often unused, extruder driver is used
// to control the 2nd Z axis stepper motor). The pins are currently only defined for a RAMPS motherboards.
// On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder.
//#define Z_DUAL_STEPPER_DRIVERS
#ifdef Z_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS
#define EXTRUDERS 1
#endif
// Same again but for Y Axis.
//#define Y_DUAL_STEPPER_DRIVERS
// Define if the two Y drives need to rotate in opposite directions
#define INVERT_Y2_VS_Y_DIR 1
#ifdef Y_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS
#define EXTRUDERS 1
#endif
#if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS)
#error "You cannot have dual drivers for both Y and Z"
#endif
//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
#define X_HOME_RETRACT_MM 5
#define Y_HOME_RETRACT_MM 5
@ -220,35 +199,29 @@
* SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the
* compiler to calculate the worst-case usage and throw an error if the SRAM
* limit is exceeded.
*
* - SDSORT_USES_RAM provides faster sorting via a static directory buffer.
* - SDSORT_USES_STACK does the same, but uses a local stack-based buffer.
* - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!)
* - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!)
*/
#define SDCARD_SORT_ALPHA //Alphabetical sorting of SD files menu
// SD Card Sorting options
// In current firmware Prusa Firmware version,
// SDSORT_CACHE_NAMES and SDSORT_DYNAMIC_RAM is not supported and must be set to 0.
#ifdef SDCARD_SORT_ALPHA
#define SD_SORT_TIME 0
#define SD_SORT_ALPHA 1
#define SD_SORT_NONE 2
#define INSERTSORT
// #define SORTING_DUMP
// #define SORTING_SPEEDTEST
#define SDSORT_LIMIT 100 // Maximum number of sorted items (10-256).
#define FOLDER_SORTING -1 // -1=above 0=none 1=below
#define SDSORT_GCODE 0 // Allow turning sorting on/off with LCD and M34 g-code.
#define SDSORT_USES_RAM 0 // Pre-allocate a static array for faster pre-sorting.
#define SDSORT_USES_STACK 0 // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.)
#define SDSORT_CACHE_NAMES 0 // Keep sorted items in RAM longer for speedy performance. Most expensive option.
#define SDSORT_DYNAMIC_RAM 0 // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use!
#endif
#if defined(SDCARD_SORT_ALPHA)
#define HAS_FOLDER_SORTING (FOLDER_SORTING || SDSORT_GCODE)
#define HAS_FOLDER_SORTING (FOLDER_SORTING)
#endif
// Enabe this option to get a pretty message whenever the endstop gets hit (as in the position at which the endstop got triggered)
//#define VERBOSE_CHECK_HIT_ENDSTOPS
// Enable the option to stop SD printing when hitting and endstops, needs to be enabled from the LCD menu when this option is enabled.
//#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
@ -295,9 +268,7 @@
//#define LA_DEBUG_LOGIC // @wavexx: setup logic channels for isr debugging
#endif
// Arc interpretation settings:
#define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25
// Arc interpretation settings : Moved to the variant files.
const unsigned int dropsegments=5; //everything with less than this number of steps will be ignored as move and joined with the next movement
@ -327,6 +298,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st
// Control heater 0 and heater 1 in parallel.
//#define HEATERS_PARALLEL
//LCD status clock interval timer to switch between
// remaining print time
// and time to change/pause/interaction
#define CLOCK_INTERVAL_TIME 5
//===========================================================================
//=============================Buffers ============================
//===========================================================================
@ -348,6 +324,11 @@ const unsigned int dropsegments=5; //everything with less than this number of st
// 2nd and 3rd byte (LSB first) contains a 16bit length of a command including its preceding comments.
#define CMDHDRSIZE 3
#define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10.f // (mm/s) Unload filament feedrate. This can be pretty fast.
#define FILAMENT_UNLOAD_FAST_RETRACT_FEEDRATE 86.67f // (mm/s) Unload fast retract feedrate.
#define FILAMENT_UNLOAD_SLOW_RETRACT_FEEDRATE 16.67f // (mm/s) Unload slow retract feedrate.
#define FILAMENT_UNLOAD_FAST_RETRACT_LENGTH 45.f // (mm) Unload fast retract length.
#define FILAMENT_UNLOAD_SLOW_RETRACT_LENGTH 35.f // (mm) Unload slow retract length.
// Firmware based and LCD controlled retract
// M207 and M208 can be used to define parameters for the retraction.
@ -376,6 +357,17 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#endif
#endif
/**
* Include capabilities in M115 output
*/
#define EXTENDED_CAPABILITIES_REPORT
/**
* Enable M120/M121 G-code commands
*
*/
//#define M120_M121_ENABLED //Be careful enabling and using these G-code commands.
//===========================================================================
//============================= Define Defines ============================
//===========================================================================
@ -388,14 +380,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#define THERMISTORHEATER_0 TEMP_SENSOR_0
#define HEATER_0_USES_THERMISTOR
#endif
#if TEMP_SENSOR_1 > 0
#define THERMISTORHEATER_1 TEMP_SENSOR_1
#define HEATER_1_USES_THERMISTOR
#endif
#if TEMP_SENSOR_2 > 0
#define THERMISTORHEATER_2 TEMP_SENSOR_2
#define HEATER_2_USES_THERMISTOR
#endif
#if TEMP_SENSOR_BED > 0
#define THERMISTORBED TEMP_SENSOR_BED
#define BED_USES_THERMISTOR
@ -409,12 +393,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#if TEMP_SENSOR_0 == -1
#define HEATER_0_USES_AD595
#endif
#if TEMP_SENSOR_1 == -1
#define HEATER_1_USES_AD595
#endif
#if TEMP_SENSOR_2 == -1
#define HEATER_2_USES_AD595
#endif
#if TEMP_SENSOR_BED == -1
#define BED_USES_AD595
#endif
@ -425,18 +403,14 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#undef HEATER_0_MINTEMP
#undef HEATER_0_MAXTEMP
#endif
#if TEMP_SENSOR_1 == 0
#undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP
#endif
#if TEMP_SENSOR_2 == 0
#undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP
#endif
#if TEMP_SENSOR_BED == 0
#undef BED_MINTEMP
#undef BED_MAXTEMP
#endif
#if TEMP_SENSOR_AMBIENT == 0
#undef AMBIENT_MINTEMP
#undef AMBIENT_MAXTEMP
#endif
#endif //__CONFIGURATION_ADV_H

View File

@ -0,0 +1,10 @@
// Include the printer's variant configuration header
#pragma once
// This is set by the cmake build to be able to take control of
// the variant header without breaking existing build mechanisms.
#ifndef CMAKE_CONTROL
#include "Configuration_prusa.h"
#else
#include FW_VARIANT
#endif

View File

@ -1,8 +1,9 @@
#include "Marlin.h"
#include "Dcodes.h"
//#include "Marlin.h"
#include "Configuration.h"
#include "language.h"
#include "cmdqueue.h"
#include "util.h"
#include <stdio.h>
#include <avr/pgmspace.h>
@ -23,31 +24,28 @@ void print_hex_byte(uint8_t val)
print_hex_nibble(val & 15);
}
void print_hex_word(uint16_t val)
// debug range address type (fits all SRAM/PROGMEM/XFLASH memory ranges)
#if defined(DEBUG_DCODE6) || defined(DEBUG_DCODES) || defined(XFLASH_DUMP)
#include "xflash.h"
#include "xflash_layout.h"
#define DADDR_SIZE 32
typedef uint32_t daddr_t; // XFLASH requires 24 bits
#else
#define DADDR_SIZE 16
typedef uint16_t daddr_t;
#endif
void print_hex_word(daddr_t val)
{
print_hex_byte(val >> 8);
print_hex_byte(val & 255);
#if DADDR_SIZE > 16
print_hex_byte((val >> 16) & 0xFF);
#endif
print_hex_byte((val >> 8) & 0xFF);
print_hex_byte(val & 0xFF);
}
void print_eeprom(uint16_t address, uint16_t count, uint8_t countperline = 16)
{
while (count)
{
print_hex_word(address);
putchar(' ');
uint8_t count_line = countperline;
while (count && count_line)
{
putchar(' ');
print_hex_byte(eeprom_read_byte((uint8_t*)address++));
count_line--;
count--;
}
putchar('\n');
}
}
int parse_hex(char* hex, uint8_t* data, int count)
int parse_hex(const char* hex, uint8_t* data, int count)
{
int parsed = 0;
while (*hex)
@ -71,12 +69,16 @@ int parse_hex(char* hex, uint8_t* data, int count)
}
void print_mem(uint32_t address, uint16_t count, uint8_t type, uint8_t countperline = 16)
enum class dcode_mem_t:uint8_t { sram, eeprom, progmem, xflash };
void print_mem(daddr_t address, daddr_t count, dcode_mem_t type, uint8_t countperline = 16)
{
#if defined(DEBUG_DCODE6) || defined(DEBUG_DCODES) || defined(XFLASH_DUMP)
if(type == dcode_mem_t::xflash)
XFLASH_SPI_ENTER();
#endif
while (count)
{
if (type == 2)
print_hex_nibble(address >> 16);
print_hex_word(address);
putchar(' ');
uint8_t count_line = countperline;
@ -85,81 +87,98 @@ void print_mem(uint32_t address, uint16_t count, uint8_t type, uint8_t countperl
uint8_t data = 0;
switch (type)
{
case 0: data = *((uint8_t*)address++); break;
case 1: data = eeprom_read_byte((uint8_t*)address++); break;
case 2: data = pgm_read_byte_far((uint8_t*)address++); break;
case dcode_mem_t::sram: data = *((uint8_t*)address); break;
case dcode_mem_t::eeprom: data = eeprom_read_byte((uint8_t*)address); break;
case dcode_mem_t::progmem: break;
#if defined(DEBUG_DCODE6) || defined(DEBUG_DCODES) || defined(XFLASH_DUMP)
case dcode_mem_t::xflash: xflash_rd_data(address, &data, 1); break;
#else
case dcode_mem_t::xflash: break;
#endif
}
++address;
putchar(' ');
print_hex_byte(data);
count_line--;
count--;
// sporadically call manage_heater, but only when interrupts are enabled (meaning
// print_mem is called by D2). Don't do anything otherwise: we are inside a crash
// handler where memory & stack needs to be preserved!
if((SREG & (1 << SREG_I)) && !((uint16_t)count % 8192))
manage_heater();
}
putchar('\n');
}
}
// TODO: this only handles SRAM/EEPROM 16bit addresses
void write_mem(uint16_t address, uint16_t count, const uint8_t* data, const dcode_mem_t type)
{
for (uint16_t i = 0; i < count; i++)
{
switch (type)
{
case dcode_mem_t::sram: *((uint8_t*)address) = data[i]; break;
case dcode_mem_t::eeprom: eeprom_write_byte_notify((uint8_t*)address, data[i]); break;
case dcode_mem_t::progmem: break;
case dcode_mem_t::xflash: break;
}
++address;
}
}
void dcode_core(daddr_t addr_start, const daddr_t addr_end, const dcode_mem_t type,
uint8_t dcode, const char* type_desc)
{
KEEPALIVE_STATE(NOT_BUSY);
DBG(_N("D%d - Read/Write %S\n"), dcode, type_desc);
daddr_t count = -1; // RW the entire space by default
if (code_seen('A'))
addr_start = (strchr_pointer[1] == 'x')?strtol(strchr_pointer + 2, 0, 16):(int)code_value();
if (code_seen('C'))
count = code_value_long();
if (addr_start > addr_end)
addr_start = addr_end;
if ((addr_start + count) > addr_end || (addr_start + count) < addr_start)
count = addr_end - addr_start;
if (code_seen('X'))
{
uint8_t data[16];
count = parse_hex(strchr_pointer + 1, data, 16);
write_mem(addr_start, count, data, type);
#if DADDR_SIZE > 16
DBG(_N("%lu bytes written to %S at address 0x%04lx\n"), count, type_desc, addr_start);
#else
DBG(_N("%u bytes written to %S at address 0x%08x\n"), count, type_desc, addr_start);
#endif
}
print_mem(addr_start, count, type);
}
#if defined DEBUG_DCODE3 || defined DEBUG_DCODES
#define EEPROM_SIZE 0x1000
/*!
### D3 - Read/Write EEPROM <a href="https://reprap.org/wiki/G-code#D3:_Read.2FWrite_EEPROM">D3: Read/Write EEPROM</a>
This command can be used without any additional parameters. It will read the entire eeprom.
#### Usage
D3 [ A | C | X ]
#### Parameters
- `A` - Address (x0000-x0fff)
- `C` - Count (1-4096)
- `X` - Data (hex)
#### Notes
- The hex address needs to be lowercase without the 0 before the x
- Count is decimal
- Count is decimal
- The hex data needs to be lowercase
*/
void dcode_3()
{
DBG(_N("D3 - Read/Write EEPROM\n"));
uint16_t address = 0x0000; //default 0x0000
uint16_t count = EEPROM_SIZE; //default 0x1000 (entire eeprom)
if (code_seen('A')) // Address (0x0000-0x0fff)
address = (strchr_pointer[1] == 'x')?strtol(strchr_pointer + 2, 0, 16):(int)code_value();
if (code_seen('C')) // Count (0x0001-0x1000)
count = (int)code_value();
address &= 0x1fff;
if (count > EEPROM_SIZE) count = EEPROM_SIZE;
if ((address + count) > EEPROM_SIZE) count = EEPROM_SIZE - address;
if (code_seen('X')) // Data
{
uint8_t data[16];
count = parse_hex(strchr_pointer + 1, data, 16);
if (count > 0)
{
for (uint16_t i = 0; i < count; i++)
eeprom_write_byte((uint8_t*)(address + i), data[i]);
printf_P(_N("%d bytes written to EEPROM at address 0x%04x"), count, address);
putchar('\n');
}
else
count = 0;
}
print_mem(address, count, 1);
/* while (count)
{
print_hex_word(address);
putchar(' ');
uint8_t countperline = 16;
while (count && countperline)
{
uint8_t data = eeprom_read_byte((uint8_t*)address++);
putchar(' ');
print_hex_byte(data);
countperline--;
count--;
}
putchar('\n');
}*/
dcode_core(0, EEPROM_SIZE, dcode_mem_t::eeprom, 3, _N("EEPROM"));
}
#endif //DEBUG_DCODE3
@ -172,39 +191,19 @@ void dcode_3()
#include <avr/wdt.h>
#include "bootapp.h"
#if 0
#define FLASHSIZE 0x40000
#define RAMSIZE 0x2000
#define boot_src_addr (*((uint32_t*)(RAMSIZE - 16)))
#define boot_dst_addr (*((uint32_t*)(RAMSIZE - 12)))
#define boot_copy_size (*((uint16_t*)(RAMSIZE - 8)))
#define boot_reserved (*((uint8_t*)(RAMSIZE - 6)))
#define boot_app_flags (*((uint8_t*)(RAMSIZE - 5)))
#define boot_app_magic (*((uint32_t*)(RAMSIZE - 4)))
#define BOOT_APP_FLG_ERASE 0x01
#define BOOT_APP_FLG_COPY 0x02
#define BOOT_APP_FLG_FLASH 0x04
extern float current_temperature_pinda;
extern float axis_steps_per_unit[NUM_AXIS];
#define LOG(args...) printf(args)
#endif //0
#define LOG(args...)
/*!
*
### D-1 - Endless Loop <a href="https://reprap.org/wiki/G-code#G28:_Move_to_Origin_.28Home.29">D-1: Endless Loop</a>
D-1
*
*/
void dcode__1()
{
printf_P(PSTR("D-1 - Endless loop\n"));
DBG(_N("D-1 - Endless loop\n"));
// cli();
while (1);
}
@ -214,9 +213,9 @@ void dcode__1()
/*!
### D0 - Reset <a href="https://reprap.org/wiki/G-code#D0:_Reset">D0: Reset</a>
#### Usage
D0 [ B ]
#### Parameters
- `B` - Bootloader
*/
@ -226,9 +225,7 @@ void dcode_0()
LOG("D0 - Reset\n");
if (code_seen('B')) //bootloader
{
cli();
wdt_enable(WDTO_15MS);
while(1);
softReset();
}
else //reset
{
@ -241,9 +238,9 @@ void dcode_0()
/*!
*
### D1 - Clear EEPROM and RESET <a href="https://reprap.org/wiki/G-code#D1:_Clear_EEPROM_and_RESET">D1: Clear EEPROM and RESET</a>
D1
*
*/
void dcode_1()
@ -251,80 +248,45 @@ void dcode_1()
LOG("D1 - Clear EEPROM and RESET\n");
cli();
for (int i = 0; i < 8192; i++)
eeprom_write_byte((unsigned char*)i, (unsigned char)0xff);
wdt_enable(WDTO_15MS);
while(1);
eeprom_write_byte_notify((unsigned char*)i, (unsigned char)0xff);
softReset();
}
#endif
#if defined DEBUG_DCODE2 || defined DEBUG_DCODES
/*!
### D2 - Read/Write RAM <a href="https://reprap.org/wiki/G-code#D2:_Read.2FWrite_RAM">D3: Read/Write RAM</a>
This command can be used without any additional parameters. It will read the entire RAM.
#### Usage
D2 [ A | C | X ]
#### Parameters
- `A` - Address (x0000-x1fff)
- `C` - Count (1-8192)
- `A` - Address (x0000-x21ff)
- `C` - Count (1-8704)
- `X` - Data
#### Notes
- The hex address needs to be lowercase without the 0 before the x
- Count is decimal
- Count is decimal
- The hex data needs to be lowercase
*/
void dcode_2()
{
LOG("D2 - Read/Write RAM\n");
uint16_t address = 0x0000; //default 0x0000
uint16_t count = 0x2000; //default 0x2000 (entire ram)
if (code_seen('A')) // Address (0x0000-0x1fff)
address = (strchr_pointer[1] == 'x')?strtol(strchr_pointer + 2, 0, 16):(int)code_value();
if (code_seen('C')) // Count (0x0001-0x2000)
count = (int)code_value();
address &= 0x1fff;
if (count > 0x2000) count = 0x2000;
if ((address + count) > 0x2000) count = 0x2000 - address;
if (code_seen('X')) // Data
{
uint8_t data[16];
count = parse_hex(strchr_pointer + 1, data, 16);
if (count > 0)
{
for (uint16_t i = 0; i < count; i++)
*((uint8_t*)(address + i)) = data[i];
LOG("%d bytes written to RAM at address %04x", count, address);
}
else
count = 0;
}
print_mem(address, count, 0);
/* while (count)
{
print_hex_word(address);
putchar(' ');
uint8_t countperline = 16;
while (count && countperline)
{
uint8_t data = *((uint8_t*)address++);
putchar(' ');
print_hex_byte(data);
countperline--;
count--;
}
putchar('\n');
}*/
dcode_core(RAMSTART, RAMEND+1, dcode_mem_t::sram, 2, _N("SRAM"));
}
#endif
#ifdef DEBUG_DCODES
/*!
### D4 - Read/Write PIN <a href="https://reprap.org/wiki/G-code#D4:_Read.2FWrite_PIN">D4: Read/Write PIN</a>
To read the digital value of a pin you need only to define the pin number.
#### Usage
D4 [ P | F | V ]
#### Parameters
- `P` - Pin (0-255)
- `F` - Function in/out (0/1)
@ -366,24 +328,23 @@ void dcode_4()
### D5 - Read/Write FLASH <a href="https://reprap.org/wiki/G-code#D5:_Read.2FWrite_FLASH">D5: Read/Write Flash</a>
This command can be used without any additional parameters. It will read the 1kb FLASH.
#### Usage
D5 [ A | C | X | E ]
#### Parameters
- `A` - Address (x00000-x3ffff)
- `C` - Count (1-8192)
- `X` - Data (hex)
- `E` - Erase
#### Notes
- The hex address needs to be lowercase without the 0 before the x
- Count is decimal
- Count is decimal
- The hex data needs to be lowercase
*/
void dcode_5()
{
printf_P(PSTR("D5 - Read/Write FLASH\n"));
puts_P(PSTR("D5 - Read/Write FLASH"));
uint32_t address = 0x0000; //default 0x0000
uint16_t count = 0x0400; //default 0x0400 (1kb block)
if (code_seen('A')) // Address (0x00000-0x3ffff)
@ -420,8 +381,7 @@ void dcode_5()
boot_dst_addr = (uint32_t)address;
boot_src_addr = (uint32_t)(&data);
bootapp_print_vars();
wdt_enable(WDTO_15MS);
while(1);
softReset();
}
while (count)
{
@ -442,17 +402,32 @@ void dcode_5()
}
#endif //DEBUG_DCODE5
#ifdef DEBUG_DCODES
#if defined(XFLASH) && (defined DEBUG_DCODE6 || defined DEBUG_DCODES)
/*!
### D6 - Read/Write external FLASH <a href="https://reprap.org/wiki/G-code#D6:_Read.2FWrite_external_FLASH">D6: Read/Write external Flash</a>
Reserved
This command can be used without any additional parameters. It will read the entire XFLASH.
#### Usage
D6 [ A | C | X ]
#### Parameters
- `A` - Address (x0000-x3ffff)
- `C` - Count (1-262144)
- `X` - Data
#### Notes
- The hex address needs to be lowercase without the 0 before the x
- Count is decimal
- The hex data needs to be lowercase
- Writing is currently not implemented
*/
void dcode_6()
{
LOG("D6 - Read/Write external FLASH\n");
dcode_core(0x0, XFLASH_SIZE, dcode_mem_t::xflash, 6, _N("XFLASH"));
}
#endif
#ifdef DEBUG_DCODES
/*!
### D7 - Read/Write Bootloader <a href="https://reprap.org/wiki/G-code#D7:_Read.2FWrite_Bootloader">D7: Read/Write Bootloader</a>
Reserved
@ -467,17 +442,16 @@ void dcode_7()
boot_copy_size = (uint16_t)0xc00;
boot_src_addr = (uint32_t)0x0003e400;
boot_dst_addr = (uint32_t)0x0003f400;
wdt_enable(WDTO_15MS);
while(1);
softReset();
*/
}
/*!
### D8 - Read/Write PINDA <a href="https://reprap.org/wiki/G-code#D8:_Read.2FWrite_PINDA">D8: Read/Write PINDA</a>
#### Usage
D8 [ ? | ! | P | Z ]
#### Parameters
- `?` - Read PINDA temperature shift values
- `!` - Reset PINDA temperature shift values to default
@ -486,7 +460,7 @@ void dcode_7()
*/
void dcode_8()
{
printf_P(PSTR("D8 - Read/Write PINDA\n"));
puts_P(PSTR("D8 - Read/Write PINDA"));
uint8_t cal_status = calibration_status_pinda();
float temp_pinda = current_temperature_pinda;
float offset_z = temp_compensation_pinda_thermistor_offset(temp_pinda);
@ -497,7 +471,7 @@ void dcode_8()
{
uint16_t offs = 0;
if (i > 0) offs = eeprom_read_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + (i - 1));
float foffs = ((float)offs) / cs.axis_steps_per_unit[Z_AXIS];
float foffs = ((float)offs) / cs.axis_steps_per_mm[Z_AXIS];
offs = 1000 * foffs;
printf_P(PSTR("temp_pinda=%dC temp_shift=%dum\n"), 35 + i * 5, offs);
}
@ -505,12 +479,12 @@ void dcode_8()
else if (strchr_pointer[1+1] == '!')
{
cal_status = 1;
eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, cal_status);
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 0, 8); //40C - 20um - 8usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 1, 24); //45C - 60um - 24usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 2, 48); //50C - 120um - 48usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 3, 80); //55C - 200um - 80usteps
eeprom_write_word(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 4, 120); //60C - 300um - 120usteps
eeprom_write_byte_notify((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, cal_status);
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 0, 8); //40C - 20um - 8usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 1, 24); //45C - 60um - 24usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 2, 48); //50C - 120um - 48usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 3, 80); //55C - 200um - 80usteps
eeprom_write_word_notify(((uint16_t*)EEPROM_PROBE_TEMP_SHIFT) + 4, 120); //60C - 300um - 120usteps
}
else
{
@ -528,11 +502,11 @@ void dcode_8()
/*!
### D9 - Read ADC <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9: Read ADC</a>
#### Usage
D9 [ I | V ]
#### Parameters
- `I` - ADC channel index
- `I` - ADC channel index
- `0` - Heater 0 temperature
- `1` - Heater 1 temperature
- `2` - Bed temperature
@ -557,26 +531,20 @@ const char* dcode_9_ADC_name(uint8_t i)
return 0;
}
#ifdef AMBIENT_THERMISTOR
extern int current_temperature_raw_ambient;
#endif //AMBIENT_THERMISTOR
#ifdef VOLT_PWR_PIN
extern int current_voltage_raw_pwr;
#endif //VOLT_PWR_PIN
#ifdef VOLT_BED_PIN
extern int current_voltage_raw_bed;
#endif //VOLT_BED_PIN
uint16_t dcode_9_ADC_val(uint8_t i)
{
switch (i)
{
#ifdef SHOW_TEMP_ADC_VALUES
case 0: return current_temperature_raw[0];
#endif //SHOW_TEMP_ADC_VALUES
case 1: return 0;
#ifdef SHOW_TEMP_ADC_VALUES
case 2: return current_temperature_bed_raw;
#endif //SHOW_TEMP_ADC_VALUES
#ifdef PINDA_THERMISTOR
case 3: return current_temperature_raw_pinda;
#endif //PINDA_THERMISTOR
#ifdef VOLT_PWR_PIN
case 4: return current_voltage_raw_pwr;
#endif //VOLT_PWR_PIN
@ -592,12 +560,13 @@ uint16_t dcode_9_ADC_val(uint8_t i)
void dcode_9()
{
printf_P(PSTR("D9 - Read/Write ADC\n"));
puts_P(PSTR("D9 - Read/Write ADC"));
if ((strchr_pointer[1+1] == '?') || (strchr_pointer[1+1] == 0))
{
for (uint8_t i = 0; i < ADC_CHAN_CNT; i++)
printf_P(PSTR("\tADC%d=%4d\t(%S)\n"), i, dcode_9_ADC_val(i) >> 4, dcode_9_ADC_name(i));
}
#if 0
else
{
uint8_t index = 0xff;
@ -608,11 +577,12 @@ void dcode_9()
if (code_seen('V')) // value to be written as simulated
{
adc_sim_mask |= (1 << index);
adc_values[index] = (((int)code_value()) << 4);
adc_values[index] = ((uint16_t)code_value_short() << 4);
printf_P(PSTR("ADC%d=%4d\n"), index, adc_values[index] >> 4);
}
}
}
#endif
}
/*!
@ -621,7 +591,7 @@ void dcode_9()
void dcode_10()
{//Tell the printer that XYZ calibration went OK
LOG("D10 - XYZ calibration = OK\n");
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
calibration_status_set(CALIBRATION_STATUS_XYZ);
}
/*!
@ -640,9 +610,9 @@ void dcode_12()
### D80 - Bed check <a href="https://reprap.org/wiki/G-code#D80:_Bed_check">D80: Bed check</a>
This command will log data to SD card file "mesh.txt".
#### Usage
D80 [ E | F | G | H | I | J ]
#### Parameters
- `E` - Dimension X (default 40)
- `F` - Dimention Y (default 40)
@ -680,9 +650,9 @@ void dcode_80()
### D81 - Bed analysis <a href="https://reprap.org/wiki/G-code#D81:_Bed_analysis">D80: Bed analysis</a>
This command will log data to SD card file "wldsd.txt".
#### Usage
D81 [ E | F | G | H | I | J ]
#### Parameters
- `E` - Dimension X (default 40)
- `F` - Dimention Y (default 40)
@ -706,9 +676,9 @@ void dcode_81()
if (code_seen("H")) { strchr_pointer+=1; points_y = code_value(); }
if (code_seen("I")) { strchr_pointer+=1; offset_x = code_value(); }
if (code_seen("J")) { strchr_pointer+=1; offset_y = code_value(); }
bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
}
#endif //HEATBED_ANALYSIS
@ -735,11 +705,11 @@ extern void st_synchronize();
/*!
### D2130 - Trinamic stepper controller <a href="https://reprap.org/wiki/G-code#D2130:_Trinamic_stepper_controller">D2130: Trinamic stepper controller</a>
@todo Please review by owner of the code. RepRap Wiki Gcode needs to be updated after review of owner as well.
#### Usage
D2130 [ Axis | Command | Subcommand | Value ]
#### Parameters
- Axis
- `X` - X stepper driver
@ -768,28 +738,28 @@ extern void st_synchronize();
- `0, 180 --> 250` - Off
- `0.9 --> 1.25` - Valid values (recommended is 1.1)
- `@` - Home calibrate axis
Examples:
D2130E?wave
Print extruder microstep linearity compensation curve
D2130E!wave0
Disable extruder linearity compensation curve, (sine curve is used)
D2130E!wave220
(sin(x))^1.1 extruder microstep compensation curve used
Notes:
For more information see https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2130_datasheet.pdf
*
*/
void dcode_2130()
{
printf_P(PSTR("D2130 - TMC2130\n"));
puts_P(PSTR("D2130 - TMC2130"));
uint8_t axis = 0xff;
switch (strchr_pointer[1+4])
{
@ -845,7 +815,7 @@ void dcode_2130()
}
else if (strcmp(strchr_pointer + 7, "wave") == 0)
{
tmc2130_get_wave(axis, 0, stdout);
tmc2130_get_wave(axis, 0);
}
}
else if (strchr_pointer[1+5] == '!')
@ -866,9 +836,9 @@ void dcode_2130()
uint16_t res_new = tmc2130_mres2usteps(mres);
tmc2130_set_res(axis, res_new);
if (res_new > res)
cs.axis_steps_per_unit[axis] *= (res_new / res);
cs.axis_steps_per_mm[axis] *= (res_new / res);
else
cs.axis_steps_per_unit[axis] /= (res / res_new);
cs.axis_steps_per_mm[axis] /= (res / res_new);
}
}
else if (strncmp(strchr_pointer + 7, "wave", 4) == 0)
@ -888,20 +858,19 @@ void dcode_2130()
}
#endif //TMC2130
#ifdef PAT9125
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
/*!
### D9125 - PAT9125 filament sensor <a href="https://reprap.org/wiki/G-code#D9:_Read.2FWrite_ADC">D9125: PAT9125 filament sensor</a>
#### Usage
D9125 [ ? | ! | R | X | Y | L ]
#### Parameters
- `?` - Print values
- `!` - Print values
- `R` - Resolution. Not active in code
- `X` - X values
- `Y` - Y values
- `L` - Activate filament sensor log
*/
void dcode_9125()
{
@ -935,15 +904,102 @@ void dcode_9125()
pat9125_y = (int)code_value();
LOG("pat9125_y=%d\n", pat9125_y);
}
#ifdef DEBUG_FSENSOR_LOG
if (code_seen('L'))
{
fsensor_log = (int)code_value();
LOG("fsensor_log=%d\n", fsensor_log);
}
#endif //DEBUG_FSENSOR_LOG
}
#endif //PAT9125
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
#endif //DEBUG_DCODES
#ifdef XFLASH_DUMP
#include "xflash_dump.h"
void dcode_20()
{
if(code_seen('E'))
xfdump_full_dump_and_reset();
else
{
unsigned long ts = _millis();
xfdump_dump();
ts = _millis() - ts;
DBG(_N("dump completed in %lums\n"), ts);
}
}
void dcode_21()
{
if(!xfdump_check_state())
DBG(_N("no dump available\n"));
else
{
KEEPALIVE_STATE(NOT_BUSY);
DBG(_N("D21 - read crash dump\n"));
print_mem(DUMP_OFFSET, sizeof(dump_t), dcode_mem_t::xflash);
}
}
void dcode_22()
{
if(!xfdump_check_state())
DBG(_N("no dump available\n"));
else
{
xfdump_reset();
DBG(_N("dump cleared\n"));
}
}
#endif
#ifdef EMERGENCY_SERIAL_DUMP
#include "asm.h"
#include "xflash_dump.h"
bool emergency_serial_dump = false;
void dcode_23()
{
if(code_seen('E'))
serial_dump_and_reset(dump_crash_reason::manual);
else
{
emergency_serial_dump = !code_seen('R');
SERIAL_ECHOPGM("serial dump ");
SERIAL_ECHOLNRPGM(emergency_serial_dump? _N("enabled"): _N("disabled"));
}
}
void __attribute__((noinline)) serial_dump_and_reset(dump_crash_reason reason)
{
uint16_t sp;
uint32_t pc;
// we're being called from a live state, so shut off interrupts ...
cli();
// sample SP/PC
sp = SP;
pc = GETPC();
// extend WDT long enough to allow writing the entire stream
wdt_enable(WDTO_8S);
// ... and heaters
WRITE(FAN_PIN, HIGH);
disable_heater();
// this function can also be called from within a corrupted state, so not use
// printf family of functions that use the heap or grow the stack.
SERIAL_ECHOLNPGM("D23 - emergency serial dump");
SERIAL_ECHOPGM("error: ");
MYSERIAL.print((uint8_t)reason, DEC);
SERIAL_ECHOPGM(" 0x");
MYSERIAL.print(pc, HEX);
SERIAL_ECHOPGM(" 0x");
MYSERIAL.println(sp, HEX);
print_mem(0, RAMEND+1, dcode_mem_t::sram);
SERIAL_ECHOLNRPGM(MSG_OK);
// reset soon
softReset();
}
#endif

View File

@ -4,7 +4,10 @@
extern void dcode__1(); //D-1 - Endless loop (to simulate deadlock)
extern void dcode_0(); //D0 - Reset
extern void dcode_1(); //D1 - Clear EEPROM
#if defined DEBUG_DCODE2 || defined DEBUG_DCODES
extern void dcode_2(); //D2 - Read/Write RAM
#endif
#if defined DEBUG_DCODE3 || defined DEBUG_DCODES
extern void dcode_3(); //D3 - Read/Write EEPROM
@ -16,13 +19,29 @@ extern void dcode_4(); //D4 - Read/Write PIN
extern void dcode_5(); //D5 - Read/Write FLASH
#endif //DEBUG_DCODE5
#if defined DEBUG_DCODE6 || defined DEBUG_DCODES
extern void dcode_6(); //D6 - Read/Write external FLASH
#endif
extern void dcode_7(); //D7 - Read/Write Bootloader
extern void dcode_8(); //D8 - Read/Write PINDA
extern void dcode_9(); //D9 - Read/Write ADC (Write=enable simulated, Read=disable simulated)
extern void dcode_10(); //D10 - XYZ calibration = OK
extern void dcode_12(); //D12 - Log time. Writes the current time in the log file.
#ifdef XFLASH_DUMP
extern void dcode_20(); //D20 - Generate an offline crash dump
extern void dcode_21(); //D21 - Print crash dump to serial
extern void dcode_22(); //D22 - Clear crash dump state
#endif
#ifdef EMERGENCY_SERIAL_DUMP
#include "xflash_dump.h"
extern void dcode_23(); //D23 - Request/generate an online serial crash dump
extern bool emergency_serial_dump; //emergency dump enabled flag
extern void serial_dump_and_reset(dump_crash_reason);
#endif
#ifdef HEATBED_ANALYSIS
extern void dcode_80(); //D80 - Bed check. This command will log data to SD card file "mesh.txt".
extern void dcode_81(); //D81 - Bed analysis. This command will log data to SD card file "wldsd.txt".
@ -34,9 +53,9 @@ extern void dcode_81(); //D81 - Bed analysis. This command will log data to SD c
extern void dcode_2130(); //D2130 - TMC2130
#endif //TMC2130
#ifdef PAT9125
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
extern void dcode_9125(); //D9125 - PAT9125
#endif //PAT9125
#endif //defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
#endif //DCODES_H

View File

@ -0,0 +1,509 @@
#include <avr/pgmspace.h>
#include <stdio.h>
#include <util/atomic.h>
#include "Filament_sensor.h"
#include "Timer.h"
#include "eeprom.h"
#include "language.h"
#include "menu.h"
#include "messages.h"
#include "mmu2.h"
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
#ifdef FILAMENT_SENSOR
FSensorBlockRunout::FSensorBlockRunout() {
fsensor.setRunoutEnabled(false); //suppress filament runouts while loading filament.
fsensor.setAutoLoadEnabled(false); //suppress filament autoloads while loading filament.
#if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
fsensor.setJamDetectionEnabled(false); //suppress filament jam detection while loading filament.
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
// SERIAL_ECHOLNPGM("FSBlockRunout");
}
FSensorBlockRunout::~FSensorBlockRunout() {
fsensor.settings_init(); // restore filament runout state.
// SERIAL_ECHOLNPGM("FSUnBlockRunout");
}
# if FILAMENT_SENSOR_TYPE == FSENSOR_IR
IR_sensor fsensor;
# elif FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG
IR_sensor_analog fsensor;
# elif FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125
PAT9125_sensor fsensor;
# endif
#else // FILAMENT_SENSOR
FSensorBlockRunout::FSensorBlockRunout() { }
FSensorBlockRunout::~FSensorBlockRunout() { }
#endif // FILAMENT_SENSOR
void Filament_sensor::setEnabled(bool enabled) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR, enabled);
if (enabled) {
fsensor.init();
} else {
fsensor.deinit();
}
}
void Filament_sensor::setAutoLoadEnabled(bool state, bool updateEEPROM) {
autoLoadEnabled = state;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENS_AUTOLOAD_ENABLED, state);
}
}
void Filament_sensor::setRunoutEnabled(bool state, bool updateEEPROM) {
runoutEnabled = state;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENS_RUNOUT_ENABLED, state);
}
}
void Filament_sensor::setActionOnError(SensorActionOnError state, bool updateEEPROM) {
sensorActionOnError = state;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR_ACTION_NA, (uint8_t)state);
}
}
void Filament_sensor::settings_init_common() {
bool enabled = eeprom_read_byte((uint8_t *)EEPROM_FSENSOR);
if ((state != State::disabled) != enabled) {
state = enabled ? State::initializing : State::disabled;
}
autoLoadEnabled = eeprom_read_byte((uint8_t *)EEPROM_FSENS_AUTOLOAD_ENABLED);
runoutEnabled = eeprom_read_byte((uint8_t *)EEPROM_FSENS_RUNOUT_ENABLED);
sensorActionOnError = (SensorActionOnError)eeprom_read_byte((uint8_t *)EEPROM_FSENSOR_ACTION_NA);
if (sensorActionOnError == SensorActionOnError::_Undef) {
sensorActionOnError = SensorActionOnError::_Continue;
}
}
bool Filament_sensor::checkFilamentEvents() {
if (state != State::ready)
return false;
if (eventBlankingTimer.running() && !eventBlankingTimer.expired(100)) { // event blanking for 100ms
return false;
}
bool newFilamentPresent = fsensor.getFilamentPresent();
if (oldFilamentPresent != newFilamentPresent) {
oldFilamentPresent = newFilamentPresent;
eventBlankingTimer.start();
if (newFilamentPresent) { // filament insertion
// puts_P(PSTR("filament inserted"));
triggerFilamentInserted();
postponedLoadEvent = true;
} else { // filament removal
// puts_P(PSTR("filament removed"));
triggerFilamentRemoved();
}
return true;
}
return false;
}
void Filament_sensor::triggerFilamentInserted() {
if (autoLoadEnabled
&& (eFilamentAction == FilamentAction::None)
&& !(
MMU2::mmu2.Enabled() // quick and dirty hack to prevent spurious runouts while the MMU is in charge
|| moves_planned() != 0
|| printJobOngoing()
|| (lcd_commands_type == LcdCommands::Layer1Cal)
|| eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE)
)
) {
menu_submenu(lcd_AutoLoadFilament, true);
}
}
void Filament_sensor::triggerFilamentRemoved() {
// SERIAL_ECHOLNPGM("triggerFilamentRemoved");
if (runoutEnabled
&& (eFilamentAction == FilamentAction::None)
&& (
moves_planned() != 0
|| printJobOngoing()
)
&& !(
saved_printing
|| MMU2::mmu2.Enabled() // quick and dirty hack to prevent spurious runouts just before the toolchange
|| (lcd_commands_type == LcdCommands::Layer1Cal)
|| eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE)
)
){
// SERIAL_ECHOPGM("runoutEnabled="); SERIAL_ECHOLN((int)runoutEnabled);
// SERIAL_ECHOPGM("eFilamentAction="); SERIAL_ECHOLN((int)eFilamentAction);
// SERIAL_ECHOPGM("saved_printing="); SERIAL_ECHOLN((int)saved_printing);
filRunout();
}
}
void Filament_sensor::filRunout() {
// SERIAL_ECHOLNPGM("filRunout");
sendHostNotification_P(MSG_FILAMENT_RUNOUT_DETECTED);
runoutEnabled = false;
autoLoadEnabled = false;
stop_and_save_print_to_ram(0, 0);
restore_print_from_ram_and_continue(0);
eeprom_increment_byte((uint8_t *)EEPROM_FERROR_COUNT);
eeprom_increment_word((uint16_t *)EEPROM_FERROR_COUNT_TOT);
enquecommand_front_P(MSG_M600);
}
void Filament_sensor::triggerError() {
state = State::error;
/// some message, idk
; //
}
#if (FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
void IR_sensor::init() {
if (state == State::error) {
fsensor.deinit(); // deinit first if there was an error.
}
// puts_P(PSTR("fsensor::init()"));
SET_INPUT(IR_SENSOR_PIN); // input mode
WRITE(IR_SENSOR_PIN, 1); // pullup
settings_init(); // also sets the state to State::initializing
}
void IR_sensor::deinit() {
// puts_P(PSTR("fsensor::deinit()"));
SET_INPUT(IR_SENSOR_PIN); // input mode
WRITE(IR_SENSOR_PIN, 0); // no pullup
state = State::disabled;
}
bool IR_sensor::update() {
switch (state) {
case State::initializing:
state = State::ready; // the IR sensor gets ready instantly as it's just a gpio read operation.
// initialize the current filament state so that we don't create a switching event right after the sensor is ready.
oldFilamentPresent = fsensor.getFilamentPresent();
[[fallthrough]];
case State::ready: {
postponedLoadEvent = false;
return checkFilamentEvents();
} break;
case State::disabled:
case State::error:
default:
return false;
}
return false;
}
#ifdef FSENSOR_PROBING
bool IR_sensor::probeOtherType() { return pat9125_probe(); }
#endif
void IR_sensor::settings_init() { Filament_sensor::settings_init_common(); }
#if (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
void IR_sensor_analog::init() {
IR_sensor::init();
IR_sensor::settings_init();
sensorRevision = (SensorRevision)eeprom_read_byte((uint8_t *)EEPROM_FSENSOR_PCB);
}
bool IR_sensor_analog::update() {
bool event = IR_sensor::update();
if (state == State::ready) {
if (getVoltReady()) {
clearVoltReady();
uint16_t volt = getVoltRaw();
// printf_P(PSTR("newVoltRaw:%u\n"), volt / OVERSAMPLENR);
// detect min-max, some long term sliding window for filtration may be added
// avoiding floating point operations, thus computing in raw
if (volt > maxVolt) {
maxVolt = volt;
} else if (volt < minVolt) {
minVolt = volt;
}
//! The trouble is, I can hold the filament in the hole in such a way, that it creates the exact voltage
//! to be detected as the new fsensor
//! We can either fake it by extending the detection window to a looooong time
//! or do some other countermeasures
//! what we want to detect:
//! if minvolt gets below ~0.3V, it means there is an old fsensor
//! if maxvolt gets above 4.6V, it means we either have an old fsensor or broken cables/fsensor
//! So I'm waiting for a situation, when minVolt gets to range <0, 1.5> and maxVolt gets into range <3.0, 5>
//! If and only if minVolt is in range <0.3, 1.5> and maxVolt is in range <3.0, 4.6>, I'm considering a situation with the new fsensor
if (minVolt >= IRsensor_Ldiode_TRESHOLD && minVolt <= IRsensor_Lmax_TRESHOLD && maxVolt >= IRsensor_Hmin_TRESHOLD &&
maxVolt <= IRsensor_Hopen_TRESHOLD) {
IR_ANALOG_Check(SensorRevision::_Old, SensorRevision::_Rev04);
}
//! If and only if minVolt is in range <0.0, 0.3> and maxVolt is in range <4.6, 5.0V>, I'm considering a situation with the old fsensor
//! Note, we are not relying on one voltage here - getting just +5V can mean an old fsensor or a broken new sensor - that's why
//! we need to have both voltages detected correctly to allow switching back to the old fsensor.
else if (minVolt < IRsensor_Ldiode_TRESHOLD && maxVolt > IRsensor_Hopen_TRESHOLD && maxVolt <= IRsensor_VMax_TRESHOLD) {
IR_ANALOG_Check(SensorRevision::_Rev04, SensorRevision::_Old);
}
if (!checkVoltage(volt)) {
triggerError();
}
}
}
; //
return event;
}
void IR_sensor_analog::voltUpdate(uint16_t raw) { // to be called from the ADC ISR when a cycle is finished
voltRaw = raw;
voltReady = true;
}
uint16_t IR_sensor_analog::getVoltRaw() {
uint16_t ret;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ret = voltRaw; }
return ret;
}
const char *IR_sensor_analog::getIRVersionText() {
switch (sensorRevision) {
case SensorRevision::_Old:
return _T(MSG_IR_03_OR_OLDER);
case SensorRevision::_Rev04:
return _T(MSG_IR_04_OR_NEWER);
default:
return _T(MSG_IR_UNKNOWN);
}
}
void IR_sensor_analog::setSensorRevision(SensorRevision rev, bool updateEEPROM) {
sensorRevision = rev;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR_PCB, (uint8_t)rev);
}
}
bool IR_sensor_analog::checkVoltage(uint16_t raw) {
if (IRsensor_Lmax_TRESHOLD <= raw && raw <= IRsensor_Hmin_TRESHOLD) {
/// If the voltage is in forbidden range, the fsensor is ok, but the lever is mounted improperly.
/// Or the user is so creative so that he can hold a piece of fillament in the hole in such a genius way,
/// that the IR fsensor reading is within 1.5 and 3V ... this would have been highly unusual
/// and would have been considered more like a sabotage than normal printer operation
if (voltageErrorCnt++ > 4) {
puts_P(PSTR("fsensor in forbidden range 1.5-3V - check sensor"));
return false;
}
} else {
voltageErrorCnt = 0;
}
if (sensorRevision == SensorRevision::_Rev04) {
/// newer IR sensor cannot normally produce 4.6-5V, this is considered a failure/bad mount
if (IRsensor_Hopen_TRESHOLD <= raw && raw <= IRsensor_VMax_TRESHOLD) {
puts_P(PSTR("fsensor v0.4 in fault range 4.6-5V - unconnected"));
return false;
}
}
// otherwise the IR fsensor is considered working correctly
return true;
}
bool IR_sensor_analog::getVoltReady() const {
bool ret;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE){ ret = voltReady; }
return ret;
}
void IR_sensor_analog::clearVoltReady(){
ATOMIC_BLOCK(ATOMIC_RESTORESTATE){ voltReady = false; }
}
void IR_sensor_analog::IR_ANALOG_Check(SensorRevision isVersion, SensorRevision switchTo) {
bool bTemp = (!CHECK_ALL_HEATERS);
bTemp = bTemp && (menu_menu == lcd_status_screen);
bTemp = bTemp && ((sensorRevision == isVersion) || (sensorRevision == SensorRevision::_Undef));
bTemp = bTemp && (state == State::ready);
if (bTemp) {
nFSCheckCount++;
if (nFSCheckCount > FS_CHECK_COUNT) {
nFSCheckCount = 0; // not necessary
setSensorRevision(switchTo, true);
printf_IRSensorAnalogBoardChange();
switch (switchTo) {
case SensorRevision::_Old:
lcd_setstatuspgm(_T(MSG_IR_03_OR_OLDER));
break;
case SensorRevision::_Rev04:
lcd_setstatuspgm(_T(MSG_IR_04_OR_NEWER));
break;
default:
break;
}
}
} else {
nFSCheckCount = 0;
}
}
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
#if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
void PAT9125_sensor::init() {
if (state == State::error) {
deinit(); // deinit first if there was an error.
}
// puts_P(PSTR("fsensor::init()"));
settings_init(); // also sets the state to State::initializing
calcChunkSteps(cs.axis_steps_per_mm[E_AXIS]); // for jam detection
if (!pat9125_init()) {
deinit();
triggerError();
; //
}
#ifdef IR_SENSOR_PIN
else if (!READ(IR_SENSOR_PIN)) {
; // MK3 fw on MK3S printer
}
#endif // IR_SENSOR_PIN
}
void PAT9125_sensor::deinit() {
// puts_P(PSTR("fsensor::deinit()"));
; //
state = State::disabled;
filter = 0;
}
bool PAT9125_sensor::update() {
switch (state) {
case State::initializing:
if (!updatePAT9125()) {
break; // still not stable. Stay in the initialization state.
}
oldFilamentPresent =
getFilamentPresent(); // initialize the current filament state so that we don't create a switching event right after the sensor is ready.
oldPos = pat9125_y;
state = State::ready;
break;
case State::ready: {
updatePAT9125();
postponedLoadEvent = false;
bool event = checkFilamentEvents();
; //
return event;
} break;
case State::disabled:
case State::error:
default:
return false;
}
return false;
}
#ifdef FSENSOR_PROBING
bool PAT9125_sensor::probeOtherType() {
SET_INPUT(IR_SENSOR_PIN); // input mode
WRITE(IR_SENSOR_PIN, 1); // pullup
_delay_us(100); // wait for the pullup to pull the line high (might be needed, not really sure. The internal pullups are quite weak and there might be a
// long wire attached).
bool fsensorDetected = !READ(IR_SENSOR_PIN);
WRITE(IR_SENSOR_PIN, 0); // no pullup
return fsensorDetected;
}
#endif
void PAT9125_sensor::setJamDetectionEnabled(bool state, bool updateEEPROM) {
jamDetection = state;
oldPos = pat9125_y;
resetStepCount();
jamErrCnt = 0;
if (updateEEPROM) {
eeprom_update_byte_notify((uint8_t *)EEPROM_FSENSOR_JAM_DETECTION, state);
}
}
void PAT9125_sensor::settings_init() {
// puts_P(PSTR("settings_init"));
Filament_sensor::settings_init_common();
setJamDetectionEnabled(eeprom_read_byte((uint8_t *)EEPROM_FSENSOR_JAM_DETECTION));
}
int16_t PAT9125_sensor::getStepCount() {
int16_t ret;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ret = stepCount; }
return ret;
}
void PAT9125_sensor::resetStepCount() {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { stepCount = 0; }
}
void PAT9125_sensor::filJam() {
runoutEnabled = false;
autoLoadEnabled = false;
jamDetection = false;
stop_and_save_print_to_ram(0, 0);
restore_print_from_ram_and_continue(0);
eeprom_increment_byte((uint8_t *)EEPROM_FERROR_COUNT);
eeprom_increment_word((uint16_t *)EEPROM_FERROR_COUNT_TOT);
enquecommand_front_P(MSG_M600);
}
bool PAT9125_sensor::updatePAT9125() {
if (jamDetection) {
int16_t _stepCount = getStepCount();
if (abs(_stepCount) >= chunkSteps) { // end of chunk. Check distance
resetStepCount();
if (!pat9125_update()) { // get up to date data. reinit on error.
init(); // try to reinit.
}
bool fsDir = (pat9125_y - oldPos) > 0;
bool stDir = _stepCount > 0;
if (fsDir != stDir) {
jamErrCnt++;
} else if (jamErrCnt) {
jamErrCnt--;
}
oldPos = pat9125_y;
}
if (jamErrCnt > 10) {
jamErrCnt = 0;
filJam();
}
}
if (pollingTimer.expired_cont(pollingPeriod)) {
pollingTimer.start();
if (!pat9125_update()) {
init(); // try to reinit.
}
bool present = (pat9125_s < 17) || (pat9125_s >= 17 && pat9125_b >= 50);
if (present != filterFilPresent) {
filter++;
} else if (filter) {
filter--;
}
if (filter >= filterCnt) {
filter = 0;
filterFilPresent = present;
}
}
return (filter == 0); // return stability
}
#endif // #if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)

212
Firmware/Filament_sensor.h Normal file
View File

@ -0,0 +1,212 @@
#pragma once
#include <inttypes.h>
#include "cmdqueue.h"
#include "pins.h"
#include "fastio.h"
#include "adc.h"
#include "pat9125.h"
#define FSENSOR_IR 1
#define FSENSOR_IR_ANALOG 2
#define FSENSOR_PAT9125 3
/// Can be used to block printer's filament sensor handling - to avoid errorneous injecting of M600
/// while doing a toolchange with the MMU
/// In case of "no filament sensor" these methods default to an empty implementation
class FSensorBlockRunout {
public:
FSensorBlockRunout();
~FSensorBlockRunout();
};
/// Base class Filament sensor
///
/// Ideally, there could have been a nice class hierarchy of filament sensor types with common functionality
/// extracted into this base class.
/// But:
/// - virtual methods take more space
/// - we don't need to switch among different filament sensors at runtime
/// Therefore the class hierarchy carefully avoids using virtual methods and doesn't look too fancy.
#ifdef FILAMENT_SENSOR
class Filament_sensor {
public:
enum class State : uint8_t {
disabled = 0,
initializing,
ready,
error,
};
enum class SensorActionOnError : uint8_t {
_Continue = 0,
_Pause = 1,
_Undef = EEPROM_EMPTY_VALUE
};
static void setEnabled(bool enabled);
void setAutoLoadEnabled(bool state, bool updateEEPROM = false);
bool getAutoLoadEnabled() const { return autoLoadEnabled; }
void setRunoutEnabled(bool state, bool updateEEPROM = false);
bool getRunoutEnabled() const { return runoutEnabled; }
void setActionOnError(SensorActionOnError state, bool updateEEPROM = false);
SensorActionOnError getActionOnError() const { return sensorActionOnError; }
bool getFilamentLoadEvent() const { return postponedLoadEvent; }
bool isError() const { return state == State::error; }
bool isReady() const { return state == State::ready; }
bool isEnabled() const { return state != State::disabled; }
protected:
void settings_init_common();
bool checkFilamentEvents();
void triggerFilamentInserted();
void triggerFilamentRemoved();
void filRunout();
void triggerError();
State state;
bool autoLoadEnabled;
bool runoutEnabled;
bool oldFilamentPresent; //for creating filament presence switching events.
bool postponedLoadEvent; //this event lasts exactly one update cycle. It is long enough to be able to do polling for load event.
ShortTimer eventBlankingTimer;
SensorActionOnError sensorActionOnError;
};
#if (FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
class IR_sensor: public Filament_sensor {
public:
void init();
void deinit();
bool update();
bool getFilamentPresent() const { return !READ(IR_SENSOR_PIN); }
#ifdef FSENSOR_PROBING
static bool probeOtherType(); //checks if the wrong fsensor type is detected.
#endif
void settings_init();
};
#if (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
constexpr static uint16_t Voltage2Raw(float V) {
return (V * 1023 * OVERSAMPLENR / VOLT_DIV_REF ) + 0.5F;
}
constexpr static float Raw2Voltage(uint16_t raw) {
return VOLT_DIV_REF * (raw / (1023.F * OVERSAMPLENR));
}
class IR_sensor_analog: public IR_sensor {
public:
void init();
bool update();
void voltUpdate(uint16_t raw);
uint16_t __attribute__((noinline)) getVoltRaw();
enum class SensorRevision : uint8_t {
_Old = 0,
_Rev04 = 1,
_Undef = EEPROM_EMPTY_VALUE
};
SensorRevision getSensorRevision() const { return sensorRevision; }
const char* __attribute__((noinline)) getIRVersionText();
void setSensorRevision(SensorRevision rev, bool updateEEPROM = false);
constexpr static uint16_t IRsensor_Ldiode_TRESHOLD = Voltage2Raw(0.3F); // ~0.3V, raw value=982
constexpr static uint16_t IRsensor_Lmax_TRESHOLD = Voltage2Raw(1.5F); // ~1.5V (0.3*Vcc), raw value=4910
constexpr static uint16_t IRsensor_Hmin_TRESHOLD = Voltage2Raw(3.0F); // ~3.0V (0.6*Vcc), raw value=9821
constexpr static uint16_t IRsensor_Hopen_TRESHOLD = Voltage2Raw(4.6F); // ~4.6V (N.C. @ Ru~20-50k, Rd'=56k, Ru'=10k), raw value=15059
constexpr static uint16_t IRsensor_VMax_TRESHOLD = Voltage2Raw(5.F); // ~5V, raw value=16368
private:
SensorRevision sensorRevision;
bool voltReady; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltReady()
bool getVoltReady()const;
void clearVoltReady();
uint16_t voltRaw; // set by the adc ISR, therefore avoid accessing the variable directly but use getVoltRaw()
bool checkVoltage(uint16_t raw);
uint16_t minVolt = Voltage2Raw(6.F);
uint16_t maxVolt = 0;
uint16_t nFSCheckCount;
uint8_t voltageErrorCnt;
static constexpr uint16_t FS_CHECK_COUNT = 4;
/// Switching mechanism of the fsensor type.
/// Called from 2 spots which have a very similar behavior
/// 1: SensorRevision::_Old -> SensorRevision::_Rev04 and print _i("FS v0.4 or newer")
/// 2: SensorRevision::_Rev04 -> sensorRevision=SensorRevision::_Old and print _i("FS v0.3 or older")
void IR_ANALOG_Check(SensorRevision isVersion, SensorRevision switchTo);
};
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_IR) || (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
#if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
class PAT9125_sensor: public Filament_sensor {
public:
void init();
void deinit();
bool update();
bool getFilamentPresent() const { return filterFilPresent; }
#ifdef FSENSOR_PROBING
bool probeOtherType(); //checks if the wrong fsensor type is detected.
#endif
void setJamDetectionEnabled(bool state, bool updateEEPROM = false);
bool getJamDetectionEnabled() const { return jamDetection; }
void stStep(bool rev) { //from stepper isr
stepCount += rev ? -1 : 1;
}
void settings_init();
private:
static constexpr uint16_t pollingPeriod = 10; //[ms]
static constexpr uint8_t filterCnt = 5; //how many checks need to be done in order to determine the filament presence precisely.
ShortTimer pollingTimer;
uint8_t filter;
uint8_t filterFilPresent;
bool jamDetection;
int16_t oldPos;
int16_t stepCount;
int16_t chunkSteps;
uint8_t jamErrCnt;
constexpr void calcChunkSteps(float u) {
chunkSteps = (int16_t)(1.25 * u); //[mm]
}
int16_t getStepCount();
void resetStepCount();
void filJam();
bool updatePAT9125();
};
#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
#if FILAMENT_SENSOR_TYPE == FSENSOR_IR
extern IR_sensor fsensor;
#elif FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG
extern IR_sensor_analog fsensor;
#elif FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125
extern PAT9125_sensor fsensor;
#endif
#endif //FILAMENT_SENSOR

74
Firmware/FontTable.h Normal file
View File

@ -0,0 +1,74 @@
{0x3E, {0x0F, 0xA8, 0xAF, 0x00, }, 'H'}, // index=0x80, utf8='🄷'
{0x00, {0x69, 0x96, 0x00, 0x00, }, '\xdf'}, // index=0x81, utf8='°'
{0x60, {0x25, 0x55, 0x58, 0x87, }, 'h'}, // index=0x82, utf8='🌡'
{0x04, {0x27, 0xF2, 0xE0, 0x00, }, '^'}, // index=0x83, utf8='⬏'
{0x34, {0x03, 0xCC, 0x19, 0x60, }, '\xf3'}, // index=0x84, utf8='🔃'
{0x3C, {0x0E, 0xF8, 0x8F, 0x00, }, '\xdb'}, // index=0x85, utf8='🗀'
{0x08, {0x02, 0x94, 0x92, 0x00, }, '>'}, // index=0x86, utf8='»'
{0x1C, {0x07, 0x9A, 0x87, 0x00, }, '\xe5'}, // index=0x87, utf8='🕑'
{0x24, {0x00, 0x85, 0x28, 0x52, }, '\x7e'}, // index=0x88, utf8='⏬'
{0x06, {0x00, 0x1B, 0xE4, 0x00, }, '\x7e'}, // index=0x89, utf8='✔'
{0x78, {0x12, 0x70, 0x78, 0x70, }, 'a'}, // index=0x8A, utf8='á'
{0xF8, {0x12, 0x78, 0x8F, 0x88, }, 'A'}, // index=0x8B, utf8='Á'
{0x78, {0x42, 0x70, 0x78, 0x70, }, 'a'}, // index=0x8C, utf8='à'
{0x78, {0x25, 0x70, 0x78, 0x70, }, 'a'}, // index=0x8D, utf8='â'
{0xF8, {0x50, 0x78, 0x8F, 0x88, }, '\xd1'}, // index=0x8E, utf8='Ä'
{0xF0, {0x25, 0x27, 0x07, 0x87, }, 'a'}, // index=0x8F, utf8='å'
{0xF0, {0x25, 0x27, 0x8F, 0x88, }, 'A'}, // index=0x90, utf8='Å'
{0x2C, {0x0D, 0x27, 0xAA, 0x50, }, '\xd1'}, // index=0x91, utf8='æ'
{0xBC, {0x07, 0x07, 0x87, 0x11, }, 'a'}, // index=0x92, utf8='ą'
{0xBE, {0x78, 0x8F, 0x88, 0x11, }, 'A'}, // index=0x93, utf8='Ą'
{0x78, {0x52, 0x70, 0x78, 0x70, }, 'a'}, // index=0x94, utf8='ă'
{0xF8, {0x52, 0x78, 0x8F, 0x88, }, 'A'}, // index=0x95, utf8='Ă'
{0x20, {0x12, 0x78, 0x88, 0x70, }, 'c'}, // index=0x96, utf8='ć'
{0x20, {0x52, 0x78, 0x88, 0x70, }, 'c'}, // index=0x97, utf8='č'
{0x48, {0x52, 0x78, 0x88, 0x87, }, 'C'}, // index=0x98, utf8='Č'
{0x03, {0x11, 0x17, 0x99, 0x70, }, 'd'}, // index=0x99, utf8='ď'
{0x18, {0x12, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9A, utf8='é'
{0x44, {0x12, 0xF8, 0xF8, 0xF0, }, 'E'}, // index=0x9B, utf8='É'
{0x18, {0x42, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9C, utf8='è'
{0x18, {0x25, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9D, utf8='ê'
{0x18, {0x52, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9E, utf8='ě'
{0x18, {0x50, 0x78, 0xF8, 0x70, }, 'e'}, // index=0x9F, utf8='ë'
{0x0C, {0x07, 0x8F, 0x87, 0x23, }, 'e'}, // index=0xA0, utf8='ę'
{0xA2, {0x0F, 0x8F, 0x8F, 0x11, }, 'E'}, // index=0xA1, utf8='Ę'
{0x00, {0x12, 0x06, 0x22, 0x70, }, 'i'}, // index=0xA2, utf8='í'
{0x00, {0x12, 0x07, 0x22, 0x27, }, 'I'}, // index=0xA3, utf8='Í'
{0x00, {0x25, 0x06, 0x22, 0x70, }, 'i'}, // index=0xA4, utf8='î'
{0x00, {0x25, 0x07, 0x22, 0x27, }, 'I'}, // index=0xA5, utf8='Î'
{0x00, {0x12, 0x06, 0x22, 0x27, }, 'l'}, // index=0xA6, utf8='ĺ'
{0x02, {0x62, 0x36, 0xA2, 0x70, }, 'l'}, // index=0xA7, utf8='ł'
{0x40, {0x45, 0x6C, 0x44, 0x70, }, 'L'}, // index=0xA8, utf8='Ł'
{0x03, {0x62, 0x22, 0x22, 0x70, }, 'l'}, // index=0xA9, utf8='ľ'
{0x43, {0x88, 0x88, 0x88, 0xF0, }, 'L'}, // index=0xAA, utf8='Ľ'
{0x78, {0x12, 0xBC, 0x88, 0x80, }, 'n'}, // index=0xAB, utf8='ń'
{0x78, {0x52, 0xBC, 0x88, 0x80, }, 'n'}, // index=0xAC, utf8='ň'
{0x38, {0x12, 0x78, 0x88, 0x70, }, 'o'}, // index=0xAD, utf8='ó'
{0x78, {0x12, 0x78, 0x88, 0x87, }, 'O'}, // index=0xAE, utf8='Ó'
{0x38, {0x42, 0x78, 0x88, 0x70, }, 'o'}, // index=0xAF, utf8='ò'
{0x38, {0x25, 0x78, 0x88, 0x70, }, 'o'}, // index=0xB0, utf8='ô'
{0x3A, {0x00, 0x79, 0xAC, 0x78, }, 'o'}, // index=0xB1, utf8='ø'
{0x3D, {0x07, 0x9A, 0xAC, 0x78, }, 'o'}, // index=0xB2, utf8='Ø'
{0x78, {0x50, 0x78, 0x88, 0x87, }, '\xef'}, // index=0xB3, utf8='Ö'
{0x39, {0x49, 0x78, 0x88, 0x70, }, 'o'}, // index=0xB4, utf8='ő'
{0x08, {0x52, 0xBC, 0x88, 0x80, }, 'r'}, // index=0xB5, utf8='ř'
{0x98, {0x52, 0xF8, 0x8F, 0x98, }, 'R'}, // index=0xB6, utf8='Ř'
{0x20, {0x12, 0x78, 0x70, 0xF0, }, 's'}, // index=0xB7, utf8='ś'
{0x48, {0x12, 0x78, 0x63, 0x87, }, 'S'}, // index=0xB8, utf8='Ś'
{0x20, {0x52, 0x78, 0x70, 0xF0, }, 's'}, // index=0xB9, utf8='š'
{0x48, {0x52, 0x78, 0x63, 0x87, }, 'S'}, // index=0xBA, utf8='Š'
{0x10, {0x07, 0x87, 0x0F, 0x24, }, 's'}, // index=0xBB, utf8='ș'
{0x12, {0x78, 0x63, 0x87, 0x24, }, 'S'}, // index=0xBC, utf8='Ș'
{0x60, {0x69, 0x9A, 0x98, 0x8B, }, '\xe2'}, // index=0xBD, utf8='ß'
{0x23, {0x04, 0xE4, 0x44, 0x30, }, 't'}, // index=0xBE, utf8='ť'
{0x10, {0x4E, 0x44, 0x43, 0x24, }, 't'}, // index=0xBF, utf8='ț'
{0x7C, {0x12, 0x88, 0x89, 0x60, }, 'u'}, // index=0xC0, utf8='ú'
{0x3C, {0x50, 0x88, 0x88, 0x70, }, 'U'}, // index=0xC1, utf8='Ü'
{0x78, {0x25, 0x28, 0x89, 0x60, }, 'u'}, // index=0xC2, utf8='ů'
{0x79, {0x49, 0x08, 0x89, 0x60, }, 'u'}, // index=0xC3, utf8='ű'
{0x3C, {0x12, 0x88, 0x70, 0x70, }, 'y'}, // index=0xC4, utf8='ý'
{0x0C, {0x12, 0x88, 0x52, 0x22, }, 'Y'}, // index=0xC5, utf8='Ý'
{0x44, {0x12, 0xF1, 0x24, 0xF0, }, 'z'}, // index=0xC6, utf8='ź'
{0x44, {0x52, 0xF1, 0x24, 0xF0, }, 'z'}, // index=0xC7, utf8='ž'
{0x8C, {0x52, 0xF0, 0x36, 0x8F, }, 'Z'}, // index=0xC8, utf8='Ž'
{0x44, {0x20, 0xF1, 0x24, 0xF0, }, 'z'}, // index=0xC9, utf8='ż'

View File

@ -4,7 +4,7 @@
#ifndef MARLIN_H
#define MARLIN_H
#define FORCE_INLINE __attribute__((always_inline)) inline
#include "macros.h"
#include <math.h>
#include <stdio.h>
@ -21,7 +21,7 @@
#include "Configuration.h"
#include "pins.h"
#include "Timer.h"
extern uint8_t mbl_z_probe_nr;
#include "printer_state.h"
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
@ -63,25 +63,13 @@ extern uint8_t mbl_z_probe_nr;
#define MYSERIAL MSerial
#endif
#include "lcd.h"
#ifdef __cplusplus
extern "C" {
#endif
extern FILE _uartout;
#ifdef __cplusplus
}
#endif
#define uartout (&_uartout)
#define SERIAL_PROTOCOL(x) (MYSERIAL.print(x))
#define SERIAL_PROTOCOL_F(x,y) (MYSERIAL.print(x,y))
#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x)))
#define SERIAL_PROTOCOLRPGM(x) (serialprintPGM((x)))
#define SERIAL_PROTOCOLLN(x) (MYSERIAL.println(x)/*,MYSERIAL.write('\n')*/)
#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.println()/*write('\n')*/)
#define SERIAL_PROTOCOLLNRPGM(x) (serialprintPGM((x)),MYSERIAL.println()/*write('\n')*/)
#define SERIAL_PROTOCOLLN(x) (MYSERIAL.println(x))
#define SERIAL_PROTOCOLLNPGM(x) (serialprintlnPGM(PSTR(x)))
#define SERIAL_PROTOCOLLNRPGM(x) (serialprintlnPGM((x)))
extern const char errormagic[] PROGMEM;
@ -115,8 +103,10 @@ void serial_echopair_P(const char *s_P, unsigned long v);
// I'd rather skip a few CPU ticks than 5.5KB (!!) of FLASH
void serialprintPGM(const char *str);
//The "ln" variant of the function above.
void serialprintlnPGM(const char *str);
bool is_buffer_empty();
void get_command();
void process_commands();
void ramming();
@ -131,35 +121,20 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif
#if defined(Y_ENABLE_PIN) && Y_ENABLE_PIN > -1
#ifdef Y_DUAL_STEPPER_DRIVERS
#define enable_y() { WRITE(Y_ENABLE_PIN, Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, Y_ENABLE_ON); }
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); WRITE(Y2_ENABLE_PIN, !Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else
#define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#endif
#define enable_y() WRITE(Y_ENABLE_PIN, Y_ENABLE_ON)
#define disable_y() { WRITE(Y_ENABLE_PIN,!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else
#define enable_y() ;
#define disable_y() ;
#endif
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
#if defined(Z_AXIS_ALWAYS_ON)
#ifdef Z_DUAL_STEPPER_DRIVERS
#define poweron_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
#define poweroff_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define poweron_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define poweroff_z() {}
#endif
#else
#ifdef Z_DUAL_STEPPER_DRIVERS
#define poweron_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
#define poweroff_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define poweron_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define poweroff_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#endif
#endif
#else
#define poweron_z() {}
@ -170,6 +145,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define enable_z() poweron_z()
#define disable_z() poweroff_z()
#else
extern bool bEnableForce_z; // Used by ultralcd stealth toggle
void init_force_z();
void check_force_z();
void enable_force_z();
@ -178,21 +154,6 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_z() disable_force_z()
#endif // PSU_Delta
//#if defined(Z_ENABLE_PIN) && Z_ENABLE_PIN > -1
//#ifdef Z_DUAL_STEPPER_DRIVERS
//#define enable_z() { WRITE(Z_ENABLE_PIN, Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN, Z_ENABLE_ON); }
//#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
//#else
//#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
//#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
//#endif
//#else
//#define enable_z() ;
//#define disable_z() ;
//#endif
#if defined(E0_ENABLE_PIN) && (E0_ENABLE_PIN > -1)
#define enable_e0() WRITE(E0_ENABLE_PIN, E_ENABLE_ON)
#define disable_e0() WRITE(E0_ENABLE_PIN,!E_ENABLE_ON)
@ -201,26 +162,6 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_e0() /* nothing */
#endif
#if (EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e1() /* nothing */
#define disable_e1() /* nothing */
#endif
#if (EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e2() /* nothing */
#define disable_e2() /* nothing */
#endif
#define FARM_FILAMENT_COLOR_NONE 99;
enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
#define X_AXIS_MASK 1
#define Y_AXIS_MASK 2
@ -234,168 +175,137 @@ void FlushSerialRequestResend();
void ClearToSend();
void update_currents();
void get_coordinates();
void prepare_move();
void kill(const char *full_screen_message = NULL, unsigned char id = 0);
void Stop();
bool IsStopped();
void kill(const char *full_screen_message = NULL);
void finishAndDisableSteppers();
//put an ASCII command at the end of the current buffer.
void enquecommand(const char *cmd, bool from_progmem = false);
void UnconditionalStop(); // Stop heaters, motion and clear current print status
void ConditionalStop(); // Similar to UnconditionalStop, but doesn't disable heaters
void ThermalStop(bool allow_pause = false); // Emergency stop used by overtemp functions which allows
// recovery (with pause=true)
bool IsStopped(); // Returns true if the print has been stopped
//put an ASCII command at the end of the current buffer, read from flash
#define enquecommand_P(cmd) enquecommand(cmd, true)
//put an ASCII command at the begin of the current buffer
void enquecommand_front(const char *cmd, bool from_progmem = false);
//put an ASCII command at the begin of the current buffer, read from flash
#define enquecommand_front_P(cmd) enquecommand_front(cmd, true)
void repeatcommand_front();
// Remove all lines from the command queue.
void cmdqueue_reset();
void prepare_arc_move(char isclockwise);
void clamp_to_software_endstops(float target[3]);
void refresh_cmd_timeout(void);
// Timer counter, incremented by the 1ms Arduino timer.
// The standard Arduino timer() function returns this value atomically
// by disabling / enabling interrupts. This is costly, if the interrupts are known
// to be disabled.
#ifdef SYSTEM_TIMER_2
extern volatile unsigned long timer2_millis;
#else //SYSTEM_TIMER_2
extern volatile unsigned long timer0_millis;
#endif //SYSTEM_TIMER_2
// An unsynchronized equivalent to a standard Arduino _millis() function.
// To be used inside an interrupt routine.
FORCE_INLINE unsigned long millis_nc() {
#ifdef SYSTEM_TIMER_2
return timer2_millis;
#else //SYSTEM_TIMER_2
return timer0_millis;
#endif //SYSTEM_TIMER_2
}
#ifdef FAST_PWM_FAN
void setPwmFrequency(uint8_t pin, int val);
#endif
#ifndef CRITICAL_SECTION_START
#define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
#define CRITICAL_SECTION_END SREG = _sreg;
#endif //CRITICAL_SECTION_START
enum class HeatingStatus : uint8_t
{
NO_HEATING = 0,
EXTRUDER_HEATING = 1,
EXTRUDER_HEATING_COMPLETE = 2,
BED_HEATING = 3,
BED_HEATING_COMPLETE = 4,
};
extern HeatingStatus heating_status;
extern bool fans_check_enabled;
extern float homing_feedrate[];
constexpr float homing_feedrate[] = HOMING_FEEDRATE;
extern uint8_t axis_relative_modes;
extern float feedrate;
extern int feedmultiply;
extern int extrudemultiply; // Sets extrude multiply factor (in percent) for all extruders
extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
extern float extruder_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
extern float current_position[NUM_AXIS] ;
extern float destination[NUM_AXIS] ;
extern float min_pos[3];
extern float max_pos[3];
extern bool axis_known_position[3];
extern int fanSpeed;
extern int8_t lcd_change_fil_state;
extern uint8_t fanSpeed; //!< Print fan speed, ranges from 0 to 255
extern uint8_t newFanSpeed;
extern float default_retraction;
void get_coordinates();
void prepare_move(uint16_t start_segment_idx = 0);
void prepare_arc_move(bool isclockwise, uint16_t start_segment_idx = 0);
uint16_t restore_interrupted_gcode();
///@brief Helper function to reduce code size, cheaper to call function than to inline division
///@param feedrate_mm_min feedrate with unit mm per minute
///@returns feedrate with unit mm per second
float __attribute__((noinline)) get_feedrate_mm_s(const float feedrate_mm_min);
#ifdef TMC2130
void homeaxis(int axis, uint8_t cnt = 1, uint8_t* pstep = 0);
void check_Z_crash(void);
void homeaxis(uint8_t axis, uint8_t cnt = 1, uint8_t* pstep = 0);
#else
void homeaxis(int axis, uint8_t cnt = 1);
void homeaxis(uint8_t axis, uint8_t cnt = 1);
#endif //TMC2130
#ifdef FAN_SOFT_PWM
extern unsigned char fanSpeedSoftPwm;
#endif
#ifdef FWRETRACT
extern bool retracted[EXTRUDERS];
extern float retract_length_swap;
extern float retract_recover_length_swap;
#endif
extern uint8_t host_keepalive_interval;
extern unsigned long starttime;
extern unsigned long stoptime;
extern int bowden_length[4];
extern bool is_usb_printing;
extern ShortTimer usb_timer;
extern bool processing_tcode;
extern bool homing_flag;
extern bool loading_flag;
extern unsigned int usb_printing_counter;
extern uint32_t total_filament_used; // mm/100 or 10um
extern unsigned long kicktime;
/// @brief Save print statistics to EEPROM
void save_statistics();
extern unsigned long total_filament_used;
void save_statistics(unsigned long _total_filament_used, unsigned long _total_print_time);
extern unsigned int heating_status;
extern unsigned int status_number;
extern unsigned int heating_status_counter;
extern char snmm_filaments_used;
extern unsigned long PingTime;
extern unsigned long NcTime;
extern bool no_response;
extern uint8_t important_status;
extern uint8_t saved_filament_type;
extern bool fan_state[2];
extern int fan_edge_counter[2];
extern int fan_speed[2];
// Handling multiple extruders pins
extern uint8_t active_extruder;
//Long pause
extern unsigned long pause_time;
extern unsigned long start_pause_print;
extern unsigned long t_fan_rising_edge;
// Active extruder becomes a #define to make the whole firmware compilable.
// We may even remove the references to it wherever possible in the future
#define active_extruder 0
extern bool mesh_bed_leveling_flag;
extern bool mesh_bed_run_from_menu;
extern bool did_pause_print;
extern bool sortAlpha;
extern char dir_names[3][9];
extern int8_t lcd_change_fil_state;
// save/restore printing
extern bool saved_printing;
extern uint32_t saved_sdpos;
extern uint8_t saved_printing_type;
#define PRINTING_TYPE_SD 0
#define PRINTING_TYPE_USB 1
#define PRINTING_TYPE_NONE 2
//save/restore printing in case that mmu is not responding
extern bool mmu_print_saved;
extern uint16_t saved_extruder_temperature; //!< Active extruder temperature
extern uint8_t saved_bed_temperature; //!< Bed temperature
extern bool saved_extruder_relative_mode;
extern uint8_t saved_fan_speed; //!< Print fan speed, ranges from 0 to 255
extern float saved_pos[NUM_AXIS];
extern uint16_t saved_feedrate2;
//estimated time to end of the print
extern uint8_t print_percent_done_normal;
extern uint16_t print_time_remaining_normal;
extern uint8_t print_percent_done_silent;
extern uint16_t print_time_remaining_normal;
extern uint16_t print_time_remaining_silent;
extern uint16_t print_time_to_change_normal;
extern uint16_t print_time_to_change_silent;
#define PRINT_TIME_REMAINING_INIT 0xffff
extern uint16_t mcode_in_progress;
extern uint16_t gcode_in_progress;
extern LongTimer safetyTimer;
#define PRINT_PERCENT_DONE_INIT 0xff
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || mmu_print_saved)
#define PRINT_PERCENT_DONE_INIT 0xff
// Returns true if there is a print running. It does not matter if
// the print is paused, that still counts as a "running" print.
bool printJobOngoing();
// Make debug_printer_states available everywhere
#ifdef DEBUG_PRINTER_STATES
void debug_printer_states();
#endif //DEBUG_PRINTER_STATES
// Printing is paused according to SD or host indicators
bool printingIsPaused();
bool printer_active();
bool printer_recovering();
//! Beware - mcode_in_progress is set as soon as the command gets really processed,
//! which is not the same as posting the M600 command into the command queue
@ -404,11 +314,26 @@ extern LongTimer safetyTimer;
//! Instead, the fsensor uses another state variable :( , which is set to true, when the M600 command is enqued
//! and is reset to false when the fsensor returns into its filament runout finished handler
//! I'd normally change this macro, but who knows what would happen in the MMU :)
#define CHECK_FSENSOR ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active())
bool check_fsensor();
//! Condition where Babystepping is allowed:
//! 1) Not allowed during Homing (printer busy)
//! 2) Not allowed during Mesh Bed Leveling (printer busy)
//! 3) Not allowed when a print job is paused
//! 4) Allowed if:
//! - First Layer Calibration is running (the event when heaters are turned off is used to dismiss the menu)
//! - A print job is running
//! - If the printer is idle with not planned moves
bool babystep_allowed();
//! Same as babystep_allowed() but additionally adds a requirement
//! where the Z-axis position must be less than 2.0mm (only allowed
//! during the first couple of layers)
bool babystep_allowed_strict();
extern void calculate_extruder_multipliers();
// Similar to the default Arduino delay function,
// Similar to the default Arduino delay function,
// but it keeps the background tasks running.
extern void delay_keep_alive(unsigned int ms);
@ -424,7 +349,6 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y);
#endif //HEATBED_ANALYSIS
float temp_comp_interpolation(float temperature);
void show_fw_version_warnings();
uint8_t check_printer_version();
#ifdef PINDA_THERMISTOR
@ -434,30 +358,35 @@ float temp_compensation_pinda_thermistor_offset(float temperature_pinda);
void serialecho_temperatures();
bool check_commands();
void uvlo_();
void uvlo_tiny();
void recover_print(uint8_t automatic);
void setup_uvlo_interrupt();
#if defined(TACH_1) && TACH_1 >-1
void setup_fan_interrupt();
#endif
extern bool recover_machine_state_after_power_panic();
extern void restore_print_from_eeprom(bool mbl_was_active);
extern void position_menu();
extern void print_world_coordinates();
extern void print_physical_coordinates();
extern void print_mesh_bed_leveling_table();
void save_print_file_state();
void restore_print_file_state();
void save_planner_global_state();
void refresh_print_state_in_ram();
/// Updates the feedrate multiplier when a print is saved such that
/// it is not overwritten when the print is later resumed
void refresh_saved_feedrate_multiplier_in_ram();
void clear_print_state_in_ram();
extern void stop_and_save_print_to_ram(float z_move, float e_move);
void restore_file_from_sd();
void restore_extruder_temperature_from_ram();
extern void restore_print_from_ram_and_continue(float e_move);
extern void cancel_saved_printing();
// Define some coordinates outside the clamp limits (making them invalid past the parsing stage) so
// that they can be used later for various logical checks
#define X_COORD_INVALID (X_MIN_POS-1)
#define SAVED_START_POSITION_UNSET X_COORD_INVALID
extern float saved_start_position[NUM_AXIS];
extern uint16_t saved_segment_idx;
extern bool isPartialBackupAvailable;
//estimated time to end of the print
extern uint16_t print_time_remaining();
extern uint8_t calc_percent_done();
@ -467,7 +396,7 @@ extern uint8_t calc_percent_done();
/*enum MarlinBusyState {
NOT_BUSY, // Not in a handler
IN_HANDLER, // Processing a GCode
IN_PROCESS, // Known to be blocking command input (as in G29)
IN_PROCESS, // Known to be blocking command input
PAUSED_FOR_USER, // Blocking pending any input
PAUSED_FOR_INPUT // Blocking pending text input (concept)
};*/
@ -480,6 +409,7 @@ extern uint8_t calc_percent_done();
#define KEEPALIVE_STATE(n) do { busy_state = n;} while (0)
extern void host_keepalive();
extern void host_autoreport();
//extern MarlinBusyState busy_state;
extern int8_t busy_state;
@ -490,6 +420,7 @@ extern int8_t busy_state;
#define FORCE_HIGH_POWER_END force_high_power_mode(false)
void force_high_power_mode(bool start_high_power_section);
void change_power_mode_live(uint8_t mode);
#endif //TMC2130
@ -497,19 +428,25 @@ void force_high_power_mode(bool start_high_power_section);
bool gcode_M45(bool onlyZ, int8_t verbosity_level);
void gcode_M114();
void gcode_M701();
#if (defined(FANCHECK) && (((defined(TACH_0) && (TACH_0 >-1)) || (defined(TACH_1) && (TACH_1 > -1)))))
void gcode_M123();
#endif //FANCHECK and TACH_0 and TACH_1
void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex);
#define UVLO !(PINE & (1<<4))
void proc_commands();
void M600_load_filament();
void M600_load_filament_movements();
void M600_wait_for_user(float HotendTempBckp);
void M600_check_state(float nozzle_temp);
void M600_load_filament(const char* filament_name);
void M600_load_filament_movements(const char* filament_name);
void M600_wait_for_user();
bool M600_check_state_and_repeat(const char* filament_name);
void load_filament_final_feed();
void marlin_wait_for_click();
void raise_z_above(float target, bool plan=true);
float raise_z(float delta);
void raise_z_above(float target);
extern "C" void softReset();
void stack_error();
extern uint32_t IP_address;
#endif

View File

@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 23 November 2006 by David A. Mellis
Modified 28 September 2010 by Mark Sproul
*/
@ -26,11 +26,11 @@
uint8_t selectedSerialPort = 0;
#ifndef AT90USB
// this next line disables the entire HardwareSerial.cpp,
// this next line disables the entire HardwareSerial.cpp,
// this is so I can support Attiny series and any other chip without a UART
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
#if UART_PRESENT(SERIAL_PORT)
#ifdef HAS_UART
ring_buffer rx_buffer = { { 0 }, 0, 0 };
#endif
@ -75,7 +75,7 @@ ISR(M_USARTx_RX_vect)
#endif //DEBUG_DUMP_TO_2ND_SERIAL
}
}
#ifndef SNMM
ISR(USART1_RX_vect)
{
// Test for a framing error.
@ -97,7 +97,6 @@ ISR(USART1_RX_vect)
}
}
#endif
#endif
// Public Methods //////////////////////////////////////////////////////////////
@ -130,10 +129,8 @@ void MarlinSerial::begin(long baud)
sbi(M_UCSRxB, M_RXENx);
sbi(M_UCSRxB, M_TXENx);
sbi(M_UCSRxB, M_RXCIEx);
#ifndef SNMM
if (selectedSerialPort == 1) { //set up also the second serial port
if (selectedSerialPort == 1) { //set up also the second serial port
if (useU2X) {
UCSR1A = 1 << U2X1;
baud_setting = (F_CPU / 4 / baud - 1) / 2;
@ -145,12 +142,11 @@ void MarlinSerial::begin(long baud)
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
UBRR1H = baud_setting >> 8;
UBRR1L = baud_setting;
sbi(UCSR1B, RXEN1);
sbi(UCSR1B, TXEN1);
sbi(UCSR1B, RXCIE1);
sbi(UCSR1B, RXCIE1);
}
#endif
}
void MarlinSerial::end()
@ -159,11 +155,9 @@ void MarlinSerial::end()
cbi(M_UCSRxB, M_TXENx);
cbi(M_UCSRxB, M_RXCIEx);
#ifndef SNMM
cbi(UCSR1B, RXEN1);
cbi(UCSR1B, TXEN1);
cbi(UCSR1B, RXCIE1);
#endif
}
@ -255,8 +249,8 @@ void MarlinSerial::print(double n, int digits)
void MarlinSerial::println(void)
{
print('\r');
print('\n');
// print('\r');
print('\n');
}
/*void MarlinSerial::println(const String &s)
@ -317,13 +311,13 @@ void MarlinSerial::println(double n, int digits)
void MarlinSerial::printNumber(unsigned long n, uint8_t base)
{
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
unsigned long i = 0;
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
uint8_t i = 0;
if (n == 0) {
print('0');
return;
}
}
while (n > 0) {
buf[i++] = n % base;
@ -336,8 +330,8 @@ void MarlinSerial::printNumber(unsigned long n, uint8_t base)
'A' + buf[i - 1] - 10));
}
void MarlinSerial::printFloat(double number, uint8_t digits)
{
void MarlinSerial::printFloat(double number, uint8_t digits)
{
// Handle negative numbers
if (number < 0.0)
{
@ -349,7 +343,7 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
double rounding = 0.5;
for (uint8_t i=0; i<digits; ++i)
rounding /= 10.0;
number += rounding;
// Extract the integer part of the number and print it
@ -359,7 +353,7 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
// Print the decimal point, but only if there are digits beyond
if (digits > 0)
print(".");
print('.');
// Extract digits from the remainder one at a time
while (digits-- > 0)
@ -367,8 +361,8 @@ void MarlinSerial::printFloat(double number, uint8_t digits)
remainder *= 10.0;
int toPrint = int(remainder);
print(toPrint);
remainder -= toPrint;
}
remainder -= toPrint;
}
}
// Preinstantiate Objects //////////////////////////////////////////////////////

View File

@ -23,33 +23,35 @@
#define MarlinSerial_h
#include "Marlin.h"
#if !defined(SERIAL_PORT)
#if !defined(SERIAL_PORT)
#define SERIAL_PORT 0
#endif
// The presence of the UBRRH register is used to detect a UART.
#define UART_PRESENT(port) ((port == 0 && (defined(UBRRH) || defined(UBRR0H))) || \
(port == 1 && defined(UBRR1H)) || (port == 2 && defined(UBRR2H)) || \
(port == 3 && defined(UBRR3H)))
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
// requires two levels of indirection to expand macro values properly)
#define SERIAL_REGNAME(registerbase,number,suffix) SERIAL_REGNAME_INTERNAL(registerbase,number,suffix)
#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##suffix
#else
#define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
#if ((SERIAL_PORT == 0 && (defined(UBRRH) || defined(UBRR0H))) || \
(SERIAL_PORT == 1 && defined(UBRR1H)) || \
(SERIAL_PORT == 2 && defined(UBRR2H)) || \
(SERIAL_PORT == 3 && defined(UBRR3H)))
#define HAS_UART
#endif
// Registers used by MarlinSerial class (these are expanded
// These are macros to build serial port register names for the selected SERIAL_PORT (C preprocessor
// requires two levels of indirection to expand macro values properly)
#if SERIAL_PORT == 0 && (!defined(UBRR0H) || !defined(UDR0)) // use un-numbered registers if necessary
#define SERIAL_REGNAME(registerbase,number,suffix) _REGNAME_SHORT(registerbase, suffix)
#else
#define SERIAL_REGNAME(registerbase,number,suffix) _REGNAME(registerbase, number, suffix)
#endif
// Registers used by MarlinSerial class (these are expanded
// depending on selected serial port
#define M_UCSRxA SERIAL_REGNAME(UCSR,SERIAL_PORT,A) // defines M_UCSRxA to be UCSRnA where n is the serial port number
#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B)
#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,)
#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,)
#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,)
#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,)
#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,)
#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B)
#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,)
#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,)
#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,)
#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,)
#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,)
#define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H)
#define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L)
#define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,)
@ -82,7 +84,7 @@ struct ring_buffer
int tail;
};
#if UART_PRESENT(SERIAL_PORT)
#ifdef HAS_UART
extern ring_buffer rx_buffer;
#endif
@ -95,7 +97,7 @@ class MarlinSerial //: public Stream
static int peek(void);
static int read(void);
static void flush(void);
static /*FORCE_INLINE*/ int available(void)
{
return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE;
@ -122,7 +124,7 @@ class MarlinSerial //: public Stream
UDR1 = c;
}
}
static void checkRx(void)
{
if (selectedSerialPort == 0) {
@ -175,15 +177,15 @@ class MarlinSerial //: public Stream
}
}
}
private:
static void printNumber(unsigned long, uint8_t);
static void printFloat(double, uint8_t);
public:
static /*FORCE_INLINE*/ void write(const char *str)
{
while (*str)
@ -203,7 +205,7 @@ class MarlinSerial //: public Stream
write(s[i]);
}
}*/
static FORCE_INLINE void print(const char *str)
{
write(str);

10733
Firmware/Marlin_main.cpp Executable file → Normal file

File diff suppressed because it is too large Load Diff

496
Firmware/Prusa_farm.cpp Normal file
View File

@ -0,0 +1,496 @@
#include "Prusa_farm.h"
#include "macros.h"
#include "Marlin.h"
#include "cmdqueue.h"
#include "temperature.h"
#include "cardreader.h"
#include "util.h"
#include "ultralcd.h"
#include "Filament_sensor.h"
#include "language.h"
#include "lcd.h"
#include "stopwatch.h"
#ifdef PRUSA_FARM
uint8_t farm_mode = 0;
static ShortTimer NcTime;
static uint8_t farm_timer = 8;
static uint8_t status_number = 0;
static bool no_response = false;
#ifdef PRUSA_M28
#define CHUNK_SIZE 64 // bytes
#define SAFETY_MARGIN 1
bool prusa_sd_card_upload = false;
char chunk[CHUNK_SIZE+SAFETY_MARGIN];
#endif
static void prusa_statistics_err(char c);
static void prusa_stat_printerstatus(uint8_t _status);
static void prusa_stat_farm_number();
static void prusa_stat_diameter();
static void prusa_stat_temperatures();
static void prusa_stat_printinfo();
static void lcd_send_status();
#ifdef FARM_CONNECT_MESSAGE
static void proc_commands();
static void lcd_connect_printer();
#endif //FARM_CONNECT_MESSAGE
#ifdef PRUSA_M28
static void trace();
#endif
static void prusa_statistics_err(char c) {
SERIAL_ECHOPGM("{[ERR:");
SERIAL_ECHO(c);
SERIAL_ECHO(']');
prusa_stat_farm_number();
}
static void prusa_statistics_case0(uint8_t statnr) {
SERIAL_ECHO('{');
prusa_stat_printerstatus(statnr);
prusa_stat_farm_number();
prusa_stat_printinfo();
}
static void prusa_stat_printerstatus(uint8_t _status) {
SERIAL_ECHOPGM("[PRN:");
SERIAL_ECHO(_status);
SERIAL_ECHO(']');
}
static void prusa_stat_farm_number() {
SERIAL_ECHOPGM("[PFN:0]");
}
static void prusa_stat_diameter() {
SERIAL_ECHOPGM("[DIA:");
SERIAL_ECHO(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM));
SERIAL_ECHO(']');
}
static void prusa_stat_temperatures() {
SERIAL_ECHOPGM("[ST0:");
SERIAL_ECHO(target_temperature[0]);
SERIAL_ECHOPGM("][STB:");
SERIAL_ECHO(target_temperature_bed);
SERIAL_ECHOPGM("][AT0:");
SERIAL_ECHO(current_temperature[0]);
SERIAL_ECHOPGM("][ATB:");
SERIAL_ECHO(current_temperature_bed);
SERIAL_ECHO(']');
}
static void prusa_stat_printinfo() {
SERIAL_ECHOPGM("[TFU:");
SERIAL_ECHO(total_filament_used);
SERIAL_ECHOPGM("][PCD:");
SERIAL_ECHO((int)card.percentDone());
SERIAL_ECHOPGM("][FEM:");
SERIAL_ECHO(feedmultiply);
SERIAL_ECHOPGM("][FNM:");
SERIAL_ECHO(card.longFilename[0] ? card.longFilename : card.filename);
SERIAL_ECHOPGM("][TIM:");
if (print_job_timer.isRunning()) {
SERIAL_ECHO(print_job_timer.duration());
}
else {
SERIAL_ECHO(0);
}
SERIAL_ECHOPGM("][FWR:");
SERIAL_ECHORPGM(FW_VERSION_STR_P());
SERIAL_ECHO(']');
prusa_stat_diameter();
}
static void lcd_send_status() {
if (farm_mode && no_response && (NcTime.expired(NC_TIME * 1000))) {
//send important status messages periodicaly
prusa_statistics(8);
NcTime.start();
#ifdef FARM_CONNECT_MESSAGE
lcd_connect_printer();
#endif //FARM_CONNECT_MESSAGE
}
}
#ifdef FARM_CONNECT_MESSAGE
static void proc_commands() {
if (buflen) {
process_commands();
if (!cmdbuffer_front_already_processed)
cmdqueue_pop_front();
cmdbuffer_front_already_processed = false;
}
}
static void lcd_connect_printer() {
lcd_update_enable(false);
lcd_clear();
int i = 0;
int t = 0;
lcd_puts_at_P(0, 0, PSTR("Connect printer to"));
lcd_puts_at_P(0, 1, PSTR("monitoring or hold"));
lcd_puts_at_P(0, 2, PSTR("the knob to continue"));
while (no_response) {
i++;
t++;
delay_keep_alive(100);
proc_commands();
if (t == 10) {
prusa_statistics(8);
t = 0;
}
if (READ(BTN_ENC)) { //if button is not pressed
i = 0;
lcd_puts_at_P(0, 3, PSTR(" "));
}
if (i != 0)
lcd_putc_at((i * 20) / (NC_BUTTON_LONG_PRESS * 10), 3, LCD_STR_SOLID_BLOCK[0]);
if (i == NC_BUTTON_LONG_PRESS * 10)
no_response = false;
}
lcd_update_enable(true);
lcd_update(2);
}
#endif //FARM_CONNECT_MESSAGE
#ifdef PRUSA_M28
static void trace() {
Sound_MakeCustom(25,440,true);
}
void serial_read_stream() {
disable_heater();
lcd_clear();
lcd_puts_P(PSTR(" Upload in progress"));
// first wait for how many bytes we will receive
uint32_t bytesToReceive;
// receive the four bytes
char bytesToReceiveBuffer[4];
for (int i=0; i<4; i++) {
int data;
while ((data = MYSERIAL.read()) == -1) {};
bytesToReceiveBuffer[i] = data;
}
// make it a uint32
memcpy(&bytesToReceive, &bytesToReceiveBuffer, 4);
// we're ready, notify the sender
MYSERIAL.write('+');
// lock in the routine
uint32_t receivedBytes = 0;
while (prusa_sd_card_upload) {
int i;
for (i=0; i<CHUNK_SIZE; i++) {
int data;
// check if we're not done
if (receivedBytes == bytesToReceive) {
break;
}
// read the next byte
while ((data = MYSERIAL.read()) == -1) {};
receivedBytes++;
// save it to the chunk
chunk[i] = data;
}
// write the chunk to SD
card.write_command_no_newline(&chunk[0]);
// notify the sender we're ready for more data
MYSERIAL.write('+');
// for safety
manage_heater();
// check if we're done
if(receivedBytes == bytesToReceive) {
trace(); // beep
card.closefile();
prusa_sd_card_upload = false;
SERIAL_PROTOCOLLNRPGM(MSG_FILE_SAVED);
}
}
}
#endif //PRUSA_M28
void prusa_statistics(uint8_t _message) {
const uint8_t _fil_nr = 0;
if (!farm_mode)
return;
switch (_message) {
case 0: // default message
if (busy_state == PAUSED_FOR_USER) {
prusa_statistics_case0(15);
}
else if (printingIsPaused()) {
prusa_statistics_case0(14);
}
else if (IS_SD_PRINTING || (eFilamentAction != FilamentAction::None)) {
prusa_statistics_case0(4);
}
else {
SERIAL_ECHO('{');
prusa_stat_printerstatus(1);
prusa_stat_farm_number();
prusa_stat_diameter();
status_number = 1;
}
break;
case 1: // 1 heating
SERIAL_ECHO('{');
prusa_stat_printerstatus(2);
prusa_stat_farm_number();
status_number = 2;
farm_timer = 1;
break;
case 2: // heating done
SERIAL_ECHO('{');
prusa_stat_printerstatus(3);
prusa_stat_farm_number();
SERIAL_ECHOLN('}');
status_number = 3;
farm_timer = 1;
if (IS_SD_PRINTING || (eFilamentAction != FilamentAction::None)) {
SERIAL_ECHO('{');
prusa_stat_printerstatus(4);
prusa_stat_farm_number();
status_number = 4;
}
else {
SERIAL_ECHO('{');
prusa_stat_printerstatus(3);
prusa_stat_farm_number();
status_number = 3;
}
farm_timer = 1;
break;
case 3: // filament change
// must do a return here to prevent doing SERIAL_ECHOLN("}") at the very end of this function
// saved a considerable amount of FLASH
return;
break;
case 4: // print succesfull
SERIAL_ECHOPGM("{[RES:1][FIL:");
MYSERIAL.print(int(_fil_nr));
SERIAL_ECHO(']');
prusa_stat_printerstatus(status_number);
prusa_stat_farm_number();
farm_timer = 2;
break;
case 5: // print not succesfull
SERIAL_ECHOPGM("{[RES:0][FIL:");
MYSERIAL.print(int(_fil_nr));
SERIAL_ECHO(']');
prusa_stat_printerstatus(status_number);
prusa_stat_farm_number();
farm_timer = 2;
break;
case 6: // print done
SERIAL_ECHOPGM("{[PRN:8]");
prusa_stat_farm_number();
status_number = 8;
farm_timer = 2;
break;
case 7: // print done - stopped
SERIAL_ECHOPGM("{[PRN:9]");
prusa_stat_farm_number();
status_number = 9;
farm_timer = 2;
break;
case 8: // printer started
SERIAL_ECHOPGM("{[PRN:0]");
prusa_stat_farm_number();
status_number = 0;
farm_timer = 2;
break;
case 20: // echo farm no
SERIAL_ECHO('{');
prusa_stat_printerstatus(status_number);
prusa_stat_farm_number();
farm_timer = 4;
break;
case 21: // temperatures
SERIAL_ECHO('{');
prusa_stat_temperatures();
prusa_stat_farm_number();
prusa_stat_printerstatus(status_number);
break;
case 22: // waiting for filament change
SERIAL_ECHOPGM("{[PRN:5]");
prusa_stat_farm_number();
status_number = 5;
break;
case 90: // Error - Thermal Runaway
prusa_statistics_err('1');
break;
case 91: // Error - Thermal Runaway Preheat
prusa_statistics_err('2');
break;
case 92: // Error - Min temp
prusa_statistics_err('3');
break;
case 93: // Error - Max temp
prusa_statistics_err('4');
break;
case 99: // heartbeat
SERIAL_ECHOPGM("{[PRN:99]");
prusa_stat_temperatures();
prusa_stat_farm_number();
break;
}
SERIAL_ECHOLN('}');
}
void prusa_statistics_update_from_status_screen() {
if (farm_mode) {
farm_timer--;
if (farm_timer < 1) {
farm_timer = 10;
prusa_statistics(0);
}
switch (farm_timer) {
case 8:
prusa_statistics(21);
if(eFilamentAction != FilamentAction::None)
prusa_statistics(22);
break;
case 5:
if (IS_SD_PRINTING)
prusa_statistics(20);
break;
}
}
}
void prusa_statistics_update_from_lcd_update() {
lcd_send_status();
}
void farm_mode_init() {
farm_mode = eeprom_init_default_byte((uint8_t*)EEPROM_FARM_MODE, 0);
if (farm_mode) {
no_response = true; //we need confirmation by recieving PRUSA thx
prusa_statistics(8);
#ifdef HAS_SECOND_SERIAL_PORT
selectedSerialPort = 1;
#endif //HAS_SECOND_SERIAL_PORT
MYSERIAL.begin(BAUDRATE);
#ifdef FILAMENT_SENSOR
//to be converted to Filament_sensor.h...
//disabled filament autoload (PFW360)
fsensor.setAutoLoadEnabled(false);
#endif //FILAMENT_SENSOR
// ~ FanCheck -> on
eeprom_update_byte_notify((uint8_t*)EEPROM_FAN_CHECK_ENABLED, true);
}
}
bool farm_prusa_code_seen() {
if (!farm_mode)
return false;
if (code_seen_P(PSTR("PRN"))) { // PRUSA PRN
printf_P(_N("%u"), status_number);
}
else if (code_seen_P(PSTR("thx"))) { // PRUSA thx
no_response = false;
}
#ifdef PRUSA_M28
else if (code_seen_P(PSTR("M28"))) { // PRUSA M28
trace();
prusa_sd_card_upload = true;
card.openFileWrite(strchr_pointer+4);
}
#endif //PRUSA_M28
else if (code_seen_P(PSTR("fv"))) { // PRUSA fv
// get file version
#ifdef SDSUPPORT
card.openFileReadFilteredGcode(strchr_pointer + 3, true);
while (true) {
uint16_t readByte = card.getFilteredGcodeChar();
MYSERIAL.write(readByte);
if (readByte == '\n') {
break;
}
}
card.closefile();
#endif // SDSUPPORT
}
else {
return false;
}
return true;
}
void farm_gcode_g98() {
farm_mode = 1;
eeprom_update_byte_notify((unsigned char *)EEPROM_FARM_MODE, farm_mode);
SilentModeMenu = SILENT_MODE_OFF;
eeprom_update_byte_notify((unsigned char *)EEPROM_SILENT, SilentModeMenu);
fCheckModeInit(); // alternatively invoke printer reset
}
void farm_gcode_g99() {
farm_disable();
lcd_update(2);
fCheckModeInit(); // alternatively invoke printer reset
}
void farm_disable() {
farm_mode = false;
eeprom_update_byte_notify((uint8_t*)EEPROM_FARM_MODE, farm_mode);
}
#else //PRUSA_FARM
void prusa_statistics(_UNUSED uint8_t message) {
}
void prusa_statistics_update_from_status_screen() {
}
void prusa_statistics_update_from_lcd_update() {
}
void farm_mode_init() {
}
bool farm_prusa_code_seen() {
return false;
}
void farm_gcode_g98() {
}
void farm_gcode_g99() {
}
void farm_disable() {
}
#endif //PRUSA_FARM

32
Firmware/Prusa_farm.h Normal file
View File

@ -0,0 +1,32 @@
#pragma once
#include <inttypes.h>
#include "config.h"
#define FARM_PREHEAT_HOTEND_TEMP 250
#define FARM_PREHEAT_HPB_TEMP 80
#define FARM_DEFAULT_SAFETYTIMER_TIME_ms (45*60*1000ul)
#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring
#define NC_BUTTON_LONG_PRESS 15 //time in s
//#define FARM_CONNECT_MESSAGE
#ifdef PRUSA_FARM
extern uint8_t farm_mode;
#else
#define farm_mode 0
#endif
#ifdef PRUSA_M28
extern bool prusa_sd_card_upload;
extern void serial_read_stream();
#endif
extern void prusa_statistics(uint8_t _message);
extern void prusa_statistics_update_from_status_screen();
extern void prusa_statistics_update_from_lcd_update();
extern void farm_mode_init();
extern bool farm_prusa_code_seen();
extern void farm_gcode_g98();
extern void farm_gcode_g99();
extern void farm_disable();

View File

@ -205,14 +205,14 @@ uint32_t Sd2Card::cardSize() {
}
//------------------------------------------------------------------------------
void Sd2Card::chipSelectHigh() {
digitalWrite(chipSelectPin_, HIGH);
WRITE(SDSS, 1);
}
//------------------------------------------------------------------------------
void Sd2Card::chipSelectLow() {
#ifndef SOFTWARE_SPI
spiInit(spiRate_);
#endif // SOFTWARE_SPI
digitalWrite(chipSelectPin_, LOW);
WRITE(SDSS, 0);
}
//------------------------------------------------------------------------------
/** Erase a range of blocks.
@ -283,26 +283,25 @@ bool Sd2Card::eraseSingleBlockEnable() {
* the value zero, false, is returned for failure. The reason for failure
* can be determined by calling errorCode() and errorData().
*/
bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
bool Sd2Card::init(uint8_t sckRateID) {
errorCode_ = type_ = 0;
chipSelectPin_ = chipSelectPin;
// 16-bit init start time allows over a minute
uint16_t t0 = (uint16_t)_millis();
uint32_t arg;
// set pin modes
pinMode(chipSelectPin_, OUTPUT);
chipSelectHigh();
pinMode(SPI_MISO_PIN, INPUT);
pinMode(SPI_MOSI_PIN, OUTPUT);
pinMode(SPI_SCK_PIN, OUTPUT);
SET_OUTPUT(SDSS);
SET_INPUT(MISO);
SET_OUTPUT(MOSI);
SET_OUTPUT(SCK);
#ifndef SOFTWARE_SPI
// SS must be in output mode even it is not chip select
pinMode(SS_PIN, OUTPUT);
SET_OUTPUT(SS);
// set SS high - may be chip select for another SPI device
#if SET_SPI_SS_HIGH
digitalWrite(SS_PIN, HIGH);
WRITE(SS, 1);
#endif // SET_SPI_SS_HIGH
// set SCK rate for initialization commands
spiRate_ = SPI_SD_INIT_RATE;
@ -312,13 +311,16 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
// must supply min of 74 clock cycles with CS high.
for (uint8_t i = 0; i < 10; i++) spiSend(0XFF);
WRITE(MISO, 1); // temporarily enable the MISO line pullup
// command to go idle in SPI mode
while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) {
if (((uint16_t)_millis() - t0) > SD_INIT_TIMEOUT) {
WRITE(MISO, 0); // disable the MISO line pullup
error(SD_CARD_ERROR_CMD0);
goto fail;
}
}
WRITE(MISO, 0); // disable the MISO line pullup
// send 0xFF until 0xFF received to give card some clock cycles
t0 = (uint16_t)_millis();
@ -765,8 +767,11 @@ uint8_t Sd2Card::waitStartBlock(void) {
return false;
}
// Toshiba FlashAir support, copied from
// Toshiba FlashAir support, copied from
// https://flashair-developers.com/en/documents/tutorials/arduino/
// However, the official website was closed in September 2019.
// There is an archived website (written in Japanese).
// https://flashair-developers.github.io/website/docs/tutorials/arduino/2.html
//------------------------------------------------------------------------------
/** Perform Extention Read. */
@ -774,11 +779,11 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) {
uint16_t i;
// send command and argument.
if (cardCommand(CMD48, arg)) {
if (cardCommand(CMD48, arg) && cardCommand(CMD17, arg)) { // CMD48 for W-03, CMD17 for W-04
error(SD_CARD_ERROR_CMD48);
goto fail;
}
// wait for start block token.
if (!waitStartBlock()) {
goto fail;
@ -788,7 +793,7 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) {
for (i = 0; i < count; ++i) {
dst[i] = spiRec();
}
// skip dummy bytes and 16-bit crc.
for (; i < 514; ++i) {
spiRec();
@ -810,19 +815,19 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) {
* \return The value one, true, is returned for success and
* the value zero, false, is returned for failure.
*/
uint8_t Sd2Card::readExtMemory(uint8_t mio, uint8_t func,
uint8_t Sd2Card::readExtMemory(uint8_t mio, uint8_t func,
uint32_t addr, uint16_t count, uint8_t* dst) {
uint32_t offset = addr & 0x1FF;
if (offset + count > 512) count = 512 - offset;
if (count == 0) return true;
uint32_t arg =
(((uint32_t)mio & 0x1) << 31) |
uint32_t arg =
(((uint32_t)mio & 0x1) << 31) |
(mio ? (((uint32_t)func & 0x7) << 28) : (((uint32_t)func & 0xF) << 27)) |
((addr & 0x1FFFF) << 9) |
((count - 1) & 0x1FF);
return readExt(arg, dst, count);
}

View File

@ -28,7 +28,6 @@
* \brief Sd2Card class for V2 SD/SDHC cards
*/
#include "SdFatConfig.h"
#include "Sd2PinMap.h"
#include "SdInfo.h"
//------------------------------------------------------------------------------
// SPI speed is F_CPU/2^(1 + index), 0 <= index <= 6
@ -133,22 +132,7 @@ uint8_t const SD_CARD_TYPE_SDHC = 3;
//------------------------------------------------------------------------------
// SPI pin definitions - do not edit here - change in SdFatConfig.h
//
#ifndef SOFTWARE_SPI
// hardware pin defs
/** The default chip select pin for the SD card is SS. */
uint8_t const SD_CHIP_SELECT_PIN = SS_PIN;
// The following three pins must not be redefined for hardware SPI.
/** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = MOSI_PIN;
/** SPI Master In Slave Out pin */
uint8_t const SPI_MISO_PIN = MISO_PIN;
/** SPI Clock pin */
uint8_t const SPI_SCK_PIN = SCK_PIN;
#else // SOFTWARE_SPI
/** SPI chip select pin */
uint8_t const SD_CHIP_SELECT_PIN = SOFT_SPI_CS_PIN;
#ifdef SOFTWARE_SPI
/** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = SOFT_SPI_MOSI_PIN;
/** SPI Master In Slave Out pin */
@ -176,22 +160,21 @@ class Sd2Card {
/**
* \return error code for last error. See Sd2Card.h for a list of error codes.
*/
int errorCode() const {return errorCode_;}
uint8_t errorCode() const {return errorCode_;}
/** \return error data for last error. */
int errorData() const {return status_;}
uint8_t errorData() const {return status_;}
/**
* Initialize an SD flash memory card with default clock rate and chip
* select pin. See sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin).
* select pin. See sd2Card::init(uint8_t sckRateID).
*
* \return true for success or false for failure.
*/
bool init(uint8_t sckRateID = SPI_FULL_SPEED,
uint8_t chipSelectPin = SD_CHIP_SELECT_PIN);
bool init(uint8_t sckRateID = SPI_FULL_SPEED);
bool readBlock(uint32_t block, uint8_t* dst);
/**
* Read a card's CID register. The CID contains card identification
* information such as Manufacturer ID, Product name, Product serial
* number and Manufacturing date.
* number and Manufacturing date.
*
* \param[out] cid pointer to area for returned data.
*
@ -232,7 +215,6 @@ class Sd2Card {
private:
//----------------------------------------------------------------------------
uint8_t chipSelectPin_;
uint8_t errorCode_;
uint8_t spiRate_;
uint8_t status_;
@ -261,4 +243,4 @@ class Sd2Card {
#endif // Sd2Card_h
#endif
#endif

View File

@ -1,368 +0,0 @@
/* Arduino SdFat Library
* Copyright (C) 2010 by William Greiman
*
* This file is part of the Arduino SdFat Library
*
* This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
// Warning this file was generated by a program.
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef Sd2PinMap_h
#define Sd2PinMap_h
#include <avr/io.h>
//------------------------------------------------------------------------------
/** struct for mapping digital pins */
struct pin_map_t {
volatile uint8_t* ddr;
volatile uint8_t* pin;
volatile uint8_t* port;
uint8_t bit;
};
//------------------------------------------------------------------------------
#if defined(__AVR_ATmega1280__)\
|| defined(__AVR_ATmega2560__)
// Mega
// Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 20; // D1
uint8_t const SCL_PIN = 21; // D0
#undef MOSI_PIN
#undef MISO_PIN
// SPI port
uint8_t const SS_PIN = 53; // B0
uint8_t const MOSI_PIN = 51; // B2
uint8_t const MISO_PIN = 50; // B3
uint8_t const SCK_PIN = 52; // B1
static const pin_map_t digitalPinMap[] = {
{&DDRE, &PINE, &PORTE, 0}, // E0 0
{&DDRE, &PINE, &PORTE, 1}, // E1 1
{&DDRE, &PINE, &PORTE, 4}, // E4 2
{&DDRE, &PINE, &PORTE, 5}, // E5 3
{&DDRG, &PING, &PORTG, 5}, // G5 4
{&DDRE, &PINE, &PORTE, 3}, // E3 5
{&DDRH, &PINH, &PORTH, 3}, // H3 6
{&DDRH, &PINH, &PORTH, 4}, // H4 7
{&DDRH, &PINH, &PORTH, 5}, // H5 8
{&DDRH, &PINH, &PORTH, 6}, // H6 9
{&DDRB, &PINB, &PORTB, 4}, // B4 10
{&DDRB, &PINB, &PORTB, 5}, // B5 11
{&DDRB, &PINB, &PORTB, 6}, // B6 12
{&DDRB, &PINB, &PORTB, 7}, // B7 13
{&DDRJ, &PINJ, &PORTJ, 1}, // J1 14
{&DDRJ, &PINJ, &PORTJ, 0}, // J0 15
{&DDRH, &PINH, &PORTH, 1}, // H1 16
{&DDRH, &PINH, &PORTH, 0}, // H0 17
{&DDRD, &PIND, &PORTD, 3}, // D3 18
{&DDRD, &PIND, &PORTD, 2}, // D2 19
{&DDRD, &PIND, &PORTD, 1}, // D1 20
{&DDRD, &PIND, &PORTD, 0}, // D0 21
{&DDRA, &PINA, &PORTA, 0}, // A0 22
{&DDRA, &PINA, &PORTA, 1}, // A1 23
{&DDRA, &PINA, &PORTA, 2}, // A2 24
{&DDRA, &PINA, &PORTA, 3}, // A3 25
{&DDRA, &PINA, &PORTA, 4}, // A4 26
{&DDRA, &PINA, &PORTA, 5}, // A5 27
{&DDRA, &PINA, &PORTA, 6}, // A6 28
{&DDRA, &PINA, &PORTA, 7}, // A7 29
{&DDRC, &PINC, &PORTC, 7}, // C7 30
{&DDRC, &PINC, &PORTC, 6}, // C6 31
{&DDRC, &PINC, &PORTC, 5}, // C5 32
{&DDRC, &PINC, &PORTC, 4}, // C4 33
{&DDRC, &PINC, &PORTC, 3}, // C3 34
{&DDRC, &PINC, &PORTC, 2}, // C2 35
{&DDRC, &PINC, &PORTC, 1}, // C1 36
{&DDRC, &PINC, &PORTC, 0}, // C0 37
{&DDRD, &PIND, &PORTD, 7}, // D7 38
{&DDRG, &PING, &PORTG, 2}, // G2 39
{&DDRG, &PING, &PORTG, 1}, // G1 40
{&DDRG, &PING, &PORTG, 0}, // G0 41
{&DDRL, &PINL, &PORTL, 7}, // L7 42
{&DDRL, &PINL, &PORTL, 6}, // L6 43
{&DDRL, &PINL, &PORTL, 5}, // L5 44
{&DDRL, &PINL, &PORTL, 4}, // L4 45
{&DDRL, &PINL, &PORTL, 3}, // L3 46
{&DDRL, &PINL, &PORTL, 2}, // L2 47
{&DDRL, &PINL, &PORTL, 1}, // L1 48
{&DDRL, &PINL, &PORTL, 0}, // L0 49
{&DDRB, &PINB, &PORTB, 3}, // B3 50
{&DDRB, &PINB, &PORTB, 2}, // B2 51
{&DDRB, &PINB, &PORTB, 1}, // B1 52
{&DDRB, &PINB, &PORTB, 0}, // B0 53
{&DDRF, &PINF, &PORTF, 0}, // F0 54
{&DDRF, &PINF, &PORTF, 1}, // F1 55
{&DDRF, &PINF, &PORTF, 2}, // F2 56
{&DDRF, &PINF, &PORTF, 3}, // F3 57
{&DDRF, &PINF, &PORTF, 4}, // F4 58
{&DDRF, &PINF, &PORTF, 5}, // F5 59
{&DDRF, &PINF, &PORTF, 6}, // F6 60
{&DDRF, &PINF, &PORTF, 7}, // F7 61
{&DDRK, &PINK, &PORTK, 0}, // K0 62
{&DDRK, &PINK, &PORTK, 1}, // K1 63
{&DDRK, &PINK, &PORTK, 2}, // K2 64
{&DDRK, &PINK, &PORTK, 3}, // K3 65
{&DDRK, &PINK, &PORTK, 4}, // K4 66
{&DDRK, &PINK, &PORTK, 5}, // K5 67
{&DDRK, &PINK, &PORTK, 6}, // K6 68
{&DDRK, &PINK, &PORTK, 7} // K7 69
};
//------------------------------------------------------------------------------
#elif defined(__AVR_ATmega644P__)\
|| defined(__AVR_ATmega644__)\
|| defined(__AVR_ATmega1284P__)
// Sanguino
// Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 17; // C1
uint8_t const SCL_PIN = 18; // C2
// SPI port
uint8_t const SS_PIN = 4; // B4
uint8_t const MOSI_PIN = 5; // B5
uint8_t const MISO_PIN = 6; // B6
uint8_t const SCK_PIN = 7; // B7
static const pin_map_t digitalPinMap[] = {
{&DDRB, &PINB, &PORTB, 0}, // B0 0
{&DDRB, &PINB, &PORTB, 1}, // B1 1
{&DDRB, &PINB, &PORTB, 2}, // B2 2
{&DDRB, &PINB, &PORTB, 3}, // B3 3
{&DDRB, &PINB, &PORTB, 4}, // B4 4
{&DDRB, &PINB, &PORTB, 5}, // B5 5
{&DDRB, &PINB, &PORTB, 6}, // B6 6
{&DDRB, &PINB, &PORTB, 7}, // B7 7
{&DDRD, &PIND, &PORTD, 0}, // D0 8
{&DDRD, &PIND, &PORTD, 1}, // D1 9
{&DDRD, &PIND, &PORTD, 2}, // D2 10
{&DDRD, &PIND, &PORTD, 3}, // D3 11
{&DDRD, &PIND, &PORTD, 4}, // D4 12
{&DDRD, &PIND, &PORTD, 5}, // D5 13
{&DDRD, &PIND, &PORTD, 6}, // D6 14
{&DDRD, &PIND, &PORTD, 7}, // D7 15
{&DDRC, &PINC, &PORTC, 0}, // C0 16
{&DDRC, &PINC, &PORTC, 1}, // C1 17
{&DDRC, &PINC, &PORTC, 2}, // C2 18
{&DDRC, &PINC, &PORTC, 3}, // C3 19
{&DDRC, &PINC, &PORTC, 4}, // C4 20
{&DDRC, &PINC, &PORTC, 5}, // C5 21
{&DDRC, &PINC, &PORTC, 6}, // C6 22
{&DDRC, &PINC, &PORTC, 7}, // C7 23
{&DDRA, &PINA, &PORTA, 7}, // A7 24
{&DDRA, &PINA, &PORTA, 6}, // A6 25
{&DDRA, &PINA, &PORTA, 5}, // A5 26
{&DDRA, &PINA, &PORTA, 4}, // A4 27
{&DDRA, &PINA, &PORTA, 3}, // A3 28
{&DDRA, &PINA, &PORTA, 2}, // A2 29
{&DDRA, &PINA, &PORTA, 1}, // A1 30
{&DDRA, &PINA, &PORTA, 0} // A0 31
};
//------------------------------------------------------------------------------
#elif defined(__AVR_ATmega32U4__)
// Teensy 2.0
// Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 6; // D1
uint8_t const SCL_PIN = 5; // D0
// SPI port
uint8_t const SS_PIN = 0; // B0
uint8_t const MOSI_PIN = 2; // B2
uint8_t const MISO_PIN = 3; // B3
uint8_t const SCK_PIN = 1; // B1
static const pin_map_t digitalPinMap[] = {
{&DDRB, &PINB, &PORTB, 0}, // B0 0
{&DDRB, &PINB, &PORTB, 1}, // B1 1
{&DDRB, &PINB, &PORTB, 2}, // B2 2
{&DDRB, &PINB, &PORTB, 3}, // B3 3
{&DDRB, &PINB, &PORTB, 7}, // B7 4
{&DDRD, &PIND, &PORTD, 0}, // D0 5
{&DDRD, &PIND, &PORTD, 1}, // D1 6
{&DDRD, &PIND, &PORTD, 2}, // D2 7
{&DDRD, &PIND, &PORTD, 3}, // D3 8
{&DDRC, &PINC, &PORTC, 6}, // C6 9
{&DDRC, &PINC, &PORTC, 7}, // C7 10
{&DDRD, &PIND, &PORTD, 6}, // D6 11
{&DDRD, &PIND, &PORTD, 7}, // D7 12
{&DDRB, &PINB, &PORTB, 4}, // B4 13
{&DDRB, &PINB, &PORTB, 5}, // B5 14
{&DDRB, &PINB, &PORTB, 6}, // B6 15
{&DDRF, &PINF, &PORTF, 7}, // F7 16
{&DDRF, &PINF, &PORTF, 6}, // F6 17
{&DDRF, &PINF, &PORTF, 5}, // F5 18
{&DDRF, &PINF, &PORTF, 4}, // F4 19
{&DDRF, &PINF, &PORTF, 1}, // F1 20
{&DDRF, &PINF, &PORTF, 0}, // F0 21
{&DDRD, &PIND, &PORTD, 4}, // D4 22
{&DDRD, &PIND, &PORTD, 5}, // D5 23
{&DDRE, &PINE, &PORTE, 6} // E6 24
};
//------------------------------------------------------------------------------
#elif defined(__AVR_AT90USB646__)\
|| defined(__AVR_AT90USB1286__)
// Teensy++ 1.0 & 2.0
// Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 1; // D1
uint8_t const SCL_PIN = 0; // D0
// SPI port
uint8_t const SS_PIN = 20; // B0
uint8_t const MOSI_PIN = 22; // B2
uint8_t const MISO_PIN = 23; // B3
uint8_t const SCK_PIN = 21; // B1
static const pin_map_t digitalPinMap[] = {
{&DDRD, &PIND, &PORTD, 0}, // D0 0
{&DDRD, &PIND, &PORTD, 1}, // D1 1
{&DDRD, &PIND, &PORTD, 2}, // D2 2
{&DDRD, &PIND, &PORTD, 3}, // D3 3
{&DDRD, &PIND, &PORTD, 4}, // D4 4
{&DDRD, &PIND, &PORTD, 5}, // D5 5
{&DDRD, &PIND, &PORTD, 6}, // D6 6
{&DDRD, &PIND, &PORTD, 7}, // D7 7
{&DDRE, &PINE, &PORTE, 0}, // E0 8
{&DDRE, &PINE, &PORTE, 1}, // E1 9
{&DDRC, &PINC, &PORTC, 0}, // C0 10
{&DDRC, &PINC, &PORTC, 1}, // C1 11
{&DDRC, &PINC, &PORTC, 2}, // C2 12
{&DDRC, &PINC, &PORTC, 3}, // C3 13
{&DDRC, &PINC, &PORTC, 4}, // C4 14
{&DDRC, &PINC, &PORTC, 5}, // C5 15
{&DDRC, &PINC, &PORTC, 6}, // C6 16
{&DDRC, &PINC, &PORTC, 7}, // C7 17
{&DDRE, &PINE, &PORTE, 6}, // E6 18
{&DDRE, &PINE, &PORTE, 7}, // E7 19
{&DDRB, &PINB, &PORTB, 0}, // B0 20
{&DDRB, &PINB, &PORTB, 1}, // B1 21
{&DDRB, &PINB, &PORTB, 2}, // B2 22
{&DDRB, &PINB, &PORTB, 3}, // B3 23
{&DDRB, &PINB, &PORTB, 4}, // B4 24
{&DDRB, &PINB, &PORTB, 5}, // B5 25
{&DDRB, &PINB, &PORTB, 6}, // B6 26
{&DDRB, &PINB, &PORTB, 7}, // B7 27
{&DDRA, &PINA, &PORTA, 0}, // A0 28
{&DDRA, &PINA, &PORTA, 1}, // A1 29
{&DDRA, &PINA, &PORTA, 2}, // A2 30
{&DDRA, &PINA, &PORTA, 3}, // A3 31
{&DDRA, &PINA, &PORTA, 4}, // A4 32
{&DDRA, &PINA, &PORTA, 5}, // A5 33
{&DDRA, &PINA, &PORTA, 6}, // A6 34
{&DDRA, &PINA, &PORTA, 7}, // A7 35
{&DDRE, &PINE, &PORTE, 4}, // E4 36
{&DDRE, &PINE, &PORTE, 5}, // E5 37
{&DDRF, &PINF, &PORTF, 0}, // F0 38
{&DDRF, &PINF, &PORTF, 1}, // F1 39
{&DDRF, &PINF, &PORTF, 2}, // F2 40
{&DDRF, &PINF, &PORTF, 3}, // F3 41
{&DDRF, &PINF, &PORTF, 4}, // F4 42
{&DDRF, &PINF, &PORTF, 5}, // F5 43
{&DDRF, &PINF, &PORTF, 6}, // F6 44
{&DDRF, &PINF, &PORTF, 7} // F7 45
};
//------------------------------------------------------------------------------
#elif defined(__AVR_ATmega168__)\
||defined(__AVR_ATmega168P__)\
||defined(__AVR_ATmega328P__)
// 168 and 328 Arduinos
// Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 18; // C4
uint8_t const SCL_PIN = 19; // C5
// SPI port
uint8_t const SS_PIN = 10; // B2
uint8_t const MOSI_PIN = 11; // B3
uint8_t const MISO_PIN = 12; // B4
uint8_t const SCK_PIN = 13; // B5
static const pin_map_t digitalPinMap[] = {
{&DDRD, &PIND, &PORTD, 0}, // D0 0
{&DDRD, &PIND, &PORTD, 1}, // D1 1
{&DDRD, &PIND, &PORTD, 2}, // D2 2
{&DDRD, &PIND, &PORTD, 3}, // D3 3
{&DDRD, &PIND, &PORTD, 4}, // D4 4
{&DDRD, &PIND, &PORTD, 5}, // D5 5
{&DDRD, &PIND, &PORTD, 6}, // D6 6
{&DDRD, &PIND, &PORTD, 7}, // D7 7
{&DDRB, &PINB, &PORTB, 0}, // B0 8
{&DDRB, &PINB, &PORTB, 1}, // B1 9
{&DDRB, &PINB, &PORTB, 2}, // B2 10
{&DDRB, &PINB, &PORTB, 3}, // B3 11
{&DDRB, &PINB, &PORTB, 4}, // B4 12
{&DDRB, &PINB, &PORTB, 5}, // B5 13
{&DDRC, &PINC, &PORTC, 0}, // C0 14
{&DDRC, &PINC, &PORTC, 1}, // C1 15
{&DDRC, &PINC, &PORTC, 2}, // C2 16
{&DDRC, &PINC, &PORTC, 3}, // C3 17
{&DDRC, &PINC, &PORTC, 4}, // C4 18
{&DDRC, &PINC, &PORTC, 5} // C5 19
};
#else // defined(__AVR_ATmega1280__)
#error unknown chip
#endif // defined(__AVR_ATmega1280__)
//------------------------------------------------------------------------------
static const uint8_t digitalPinCount = sizeof(digitalPinMap)/sizeof(pin_map_t);
uint8_t badPinNumber(void)
__attribute__((error("Pin number is too large or not a constant")));
static inline __attribute__((always_inline))
bool getPinMode(uint8_t pin) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
return (*digitalPinMap[pin].ddr >> digitalPinMap[pin].bit) & 1;
} else {
return badPinNumber();
}
}
static inline __attribute__((always_inline))
void setPinMode(uint8_t pin, uint8_t mode) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (mode) {
*digitalPinMap[pin].ddr |= 1 << digitalPinMap[pin].bit;
} else {
*digitalPinMap[pin].ddr &= ~(1 << digitalPinMap[pin].bit);
}
} else {
badPinNumber();
}
}
static inline __attribute__((always_inline))
bool fastDigitalRead(uint8_t pin) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
return (*digitalPinMap[pin].pin >> digitalPinMap[pin].bit) & 1;
} else {
return badPinNumber();
}
}
static inline __attribute__((always_inline))
void fastDigitalWrite(uint8_t pin, uint8_t value) {
if (__builtin_constant_p(pin) && pin < digitalPinCount) {
if (value) {
*digitalPinMap[pin].port |= 1 << digitalPinMap[pin].bit;
} else {
*digitalPinMap[pin].port &= ~(1 << digitalPinMap[pin].bit);
}
} else {
badPinNumber();
}
}
#endif // Sd2PinMap_h
#endif

View File

@ -530,9 +530,9 @@ bool SdBaseFile::mkdir(SdBaseFile* parent, const uint8_t dname[11]) {
* \return The value one, true, is returned for success and
* the value zero, false, is returned for failure.
*/
bool SdBaseFile::open(const char* path, uint8_t oflag) {
return open(cwd_, path, oflag);
}
bool SdBaseFile::open(const char* path, uint8_t oflag) {
return open(cwd_, path, oflag);
}
//------------------------------------------------------------------------------
/** Open a file or directory by name.
*
@ -1015,7 +1015,7 @@ void SdBaseFile::printFatTime( uint16_t fatTime) {
* the value zero, false, is returned for failure.
*/
bool SdBaseFile::printName() {
char name[13];
char name[FILENAME_LENGTH];
if (!getFilename(name)) return false;
MYSERIAL.print(name);
return true;
@ -1115,7 +1115,7 @@ int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
int16_t n;
// if not a directory file or miss-positioned return an error
if (!isDir() || (0X1F & curPosition_)) return -1;
//If we have a longFilename buffer, mark it as invalid. If we find a long filename it will be filled automaticly.
if (longFilename != NULL)
{

View File

@ -281,8 +281,10 @@ class SdBaseFile {
static void printFatDate(uint16_t fatDate);
static void printFatTime( uint16_t fatTime);
bool printName();
protected:
int16_t read();
int16_t read(void* buf, uint16_t nbyte);
public:
int8_t readDir(dir_t* dir, char* longFilename);
static bool remove(SdBaseFile* dirFile, const char* path);
bool remove();
@ -321,7 +323,7 @@ class SdBaseFile {
SdVolume* volume() const {return vol_;}
int16_t write(const void* buf, uint16_t nbyte);
//------------------------------------------------------------------------------
private:
protected:
// allow SdFat to set cwd_
friend class SdFat;
// global pointer to cwd dir

View File

@ -468,29 +468,29 @@ uint32_t const FAT32MASK = 0X0FFFFFFF;
* \brief FAT short directory entry
*
* Short means short 8.3 name, not the entry size.
*
* Date Format. A FAT directory entry date stamp is a 16-bit field that is
*
* Date Format. A FAT directory entry date stamp is a 16-bit field that is
* basically a date relative to the MS-DOS epoch of 01/01/1980. Here is the
* format (bit 0 is the LSB of the 16-bit word, bit 15 is the MSB of the
* format (bit 0 is the LSB of the 16-bit word, bit 15 is the MSB of the
* 16-bit word):
*
* Bits 9-15: Count of years from 1980, valid value range 0-127
*
* Bits 9-15: Count of years from 1980, valid value range 0-127
* inclusive (1980-2107).
*
*
* Bits 5-8: Month of year, 1 = January, valid value range 1-12 inclusive.
*
* Bits 0-4: Day of month, valid value range 1-31 inclusive.
*
* Time Format. A FAT directory entry time stamp is a 16-bit field that has
* a granularity of 2 seconds. Here is the format (bit 0 is the LSB of the
* a granularity of 2 seconds. Here is the format (bit 0 is the LSB of the
* 16-bit word, bit 15 is the MSB of the 16-bit word).
*
*
* Bits 11-15: Hours, valid value range 0-23 inclusive.
*
*
* Bits 5-10: Minutes, valid value range 0-59 inclusive.
*
*
* Bits 0-4: 2-second count, valid value range 0-29 inclusive (0 - 58 seconds).
*
*
* The valid time range is from Midnight 00:00:00 to 23:59:58.
*/
struct directoryEntry {
@ -548,7 +548,7 @@ struct directoryEntry {
*
* directoryVFATEntries are found in the same list as normal directoryEntry.
* But have the attribute field set to DIR_ATT_LONG_NAME.
*
*
* Long filenames are saved in multiple directoryVFATEntries.
* Each entry containing 13 UTF-16 characters.
*/

View File

@ -45,27 +45,19 @@ int SdFatUtil::FreeRam() {
#endif // __arm
void SdFatUtil::set_stack_guard()
{
{
uint32_t *stack_guard;
stack_guard = (uint32_t*)&__bss_end;
stack_guard = (uint32_t*)(&__bss_end + STACK_GUARD_MARGIN);
*stack_guard = STACK_GUARD_TEST_VALUE;
}
bool SdFatUtil::test_stack_integrity()
{
uint32_t* stack_guard = (uint32_t*)&__bss_end;
uint32_t* stack_guard = (uint32_t*)(&__bss_end + STACK_GUARD_MARGIN);
return (*stack_guard == STACK_GUARD_TEST_VALUE);
}
uint32_t SdFatUtil::get_stack_guard_test_value()
{
uint32_t* stack_guard;
uint32_t output;
stack_guard = (uint32_t*)&__bss_end;
output = *stack_guard;
return(output);
}
//------------------------------------------------------------------------------
/** %Print a string in flash memory.
*

View File

@ -41,11 +41,10 @@ namespace SdFatUtil {
void SerialPrintln_P(PGM_P str);
void set_stack_guard();
bool test_stack_integrity();
uint32_t get_stack_guard_test_value();
}
using namespace SdFatUtil; // NOLINT
#endif // #define SdFatUtil_h
#endif
#endif

View File

@ -30,6 +30,194 @@
*/
SdFile::SdFile(const char* path, uint8_t oflag) : SdBaseFile(path, oflag) {
}
bool SdFile::openFilteredGcode(SdBaseFile* dirFile, const char* path){
if( open(dirFile, path, O_READ) ){
// compute the block to start with
if( ! gfComputeNextFileBlock() )
return false;
gfReset();
return true;
} else {
return false;
}
}
bool SdFile::seekSetFilteredGcode(uint32_t pos){
if(! seekSet(pos) )return false;
if(! gfComputeNextFileBlock() )return false;
gfReset();
return true;
}
const uint8_t *SdFile::gfBlockBuffBegin() const {
return vol_->cache()->data; // this is constant for the whole time, so it should be fast and sleek
}
void SdFile::gfReset(){
// reset cache read ptr to its begin
gfReadPtr = gfBlockBuffBegin() + gfOffset;
}
// think twice before allowing this to inline - manipulating 4B longs is costly
// moreover - this function has its parameters in registers only, so no heavy stack usage besides the call/ret
void __attribute__((noinline)) SdFile::gfUpdateCurrentPosition(uint16_t inc){
curPosition_ += inc;
}
#define find_endl(resultP, startP) \
__asm__ __volatile__ ( \
"cycle: \n" \
"ld r22, Z+ \n" \
"cpi r22, 0x0A \n" \
"brne cycle \n" \
: "=z" (resultP) /* result of the ASM code - in our case the Z register (R30:R31) */ \
: "z" (startP) /* input of the ASM code - in our case the Z register as well (R30:R31) */ \
: "r22" /* modifying register R22 - so that the compiler knows */ \
)
// avoid calling the default heavy-weight read() for just one byte
int16_t SdFile::readFilteredGcode(){
if( ! gfEnsureBlock() ){
goto eof_or_fail; // this is unfortunate :( ... other calls are using the cache and we can loose the data block of our gcode file
}
// assume, we have the 512B block cache filled and terminated with a '\n'
{
const uint8_t *start = gfReadPtr;
// It may seem unreasonable to copy the variable into a local one and copy it back at the end of this method,
// but there is an important point of view: the compiler is unsure whether it can optimize the reads/writes
// to gfReadPtr within this method, because it is a class member variable.
// The compiler cannot see, if omitting read/write won't have any incorrect side-effects to the rest of the whole FW.
// So this trick explicitly states, that rdPtr is a local variable limited to the scope of this method,
// therefore the compiler can omit read/write to it (keep it in registers!) as it sees fit.
// And it does! Codesize dropped by 68B!
const uint8_t *rdPtr = gfReadPtr;
// the same applies to gfXBegin, codesize dropped another 100B!
const uint8_t *blockBuffBegin = gfBlockBuffBegin();
uint8_t consecutiveCommentLines = 0;
while( *rdPtr == ';' ){
for(;;){
//while( *(++gfReadPtr) != '\n' ); // skip until a newline is found - suboptimal code!
// Wondering, why this "nice while cycle" is done in such a weird way using a separate find_endl() function?
// Have a look at the ASM code GCC produced!
// At first - a separate find_endl() makes the compiler understand,
// that I don't need to store gfReadPtr every time, I'm only interested in the final address where the '\n' was found
// - the cycle can run on CPU registers only without touching memory besides reading the character being compared.
// Not only makes the code run considerably faster, but is also 40B shorter!
// This was the generated code:
//FORCE_INLINE const uint8_t * find_endl(const uint8_t *p){
// while( *(++p) != '\n' ); // skip until a newline is found
// return p; }
// 11c5e: movw r30, r18
// 11c60: subi r18, 0xFF ; 255
// 11c62: sbci r19, 0xFF ; 255
// 11c64: ld r22, Z
// 11c66: cpi r22, 0x0A ; 10
// 11c68: brne .-12 ; 0x11c5e <get_command()+0x524>
// Still, even that was suboptimal as the compiler seems not to understand the usage of ld r22, Z+ (the plus is important)
// aka automatic increment of the Z register (R30:R31 pair)
// There is no other way than pure ASM!
find_endl(rdPtr, rdPtr);
// found a newline, prepare the next block if block cache end reached
if( rdPtr - blockBuffBegin > 512 ){
// at the end of block cache, fill new data in
gfUpdateCurrentPosition( rdPtr - start - 1 );
if( ! gfComputeNextFileBlock() )goto eof_or_fail;
if( ! gfEnsureBlock() )goto eof_or_fail; // fetch it into RAM
rdPtr = start = blockBuffBegin;
} else {
if(consecutiveCommentLines >= 250){
--rdPtr; // unget the already consumed newline
goto emit_char;
}
// peek the next byte - we are inside the block at least at 511th index - still safe
if( *rdPtr == ';' ){
// consecutive comment
++consecutiveCommentLines;
} else {
--rdPtr; // unget the already consumed newline
goto emit_char;
}
break; // found the real end of the line even across many blocks
}
}
}
emit_char:
{
gfUpdateCurrentPosition( rdPtr - start + 1 );
int16_t rv = *rdPtr++;
if( curPosition_ >= fileSize_ ){
// past the end of file
goto eof_or_fail;
} else if( rdPtr - blockBuffBegin >= 512 ){
// past the end of current bufferred block - prepare the next one...
if( ! gfComputeNextFileBlock() )goto eof_or_fail;
// don't need to force fetch the block here, it will get loaded on the next call
rdPtr = blockBuffBegin;
}
// save the current read ptr for the next run
gfReadPtr = rdPtr;
return rv;
}
}
eof_or_fail:
// make the rdptr point to a safe location - end of file
gfReadPtr = gfBlockBuffBegin() + 512;
return -1;
}
bool SdFile::gfEnsureBlock(){
// this comparison is heavy-weight, especially when there is another one inside cacheRawBlock
// but it is necessary to avoid computing of terminateOfs if not needed
if( gfBlock != vol_->cacheBlockNumber_ ){
if ( ! vol_->cacheRawBlock(gfBlock, SdVolume::CACHE_FOR_READ)){
return false;
}
// terminate with a '\n'
const uint32_t terminateOfs = fileSize_ - gfOffset;
vol_->cache()->data[ terminateOfs < 512 ? terminateOfs : 512 ] = '\n';
}
return true;
}
bool SdFile::gfComputeNextFileBlock() {
// error if not open or write only
if (!isOpen() || !(flags_ & O_READ)) return false;
gfOffset = curPosition_ & 0X1FF; // offset in block
if (type_ == FAT_FILE_TYPE_ROOT_FIXED) {
// SHR by 9 means skip the last byte and shift just 3 bytes by 1
// -> should be 8 instructions... and not the horrible loop shifting 4 bytes at once
// still need to get some work on this
gfBlock = vol_->rootDirStart() + (curPosition_ >> 9);
} else {
uint8_t blockOfCluster = vol_->blockOfCluster(curPosition_);
if (gfOffset == 0 && blockOfCluster == 0) {
// start of new cluster
if (curPosition_ == 0) {
// use first cluster in file
curCluster_ = firstCluster_;
} else {
// get next cluster from FAT
if (!vol_->fatGet(curCluster_, &curCluster_)) return false;
}
}
gfBlock = vol_->clusterStartBlock(curCluster_) + blockOfCluster;
}
return true;
}
//------------------------------------------------------------------------------
/** Write data to an open file.
*

View File

@ -34,7 +34,24 @@
* \brief SdBaseFile with Print.
*/
class SdFile : public SdBaseFile/*, public Print*/ {
public:
// GCode filtering vars and methods - due to optimization reasons not wrapped in a separate class
// beware - this read ptr is manipulated inside just 2 methods - readFilteredGcode and gfReset
// If you even want to call gfReset from readFilteredGcode, you must make sure
// to update gfReadPtr inside readFilteredGcode from a local copy (see explanation of this trick in readFilteredGcode)
const uint8_t *gfReadPtr;
uint32_t gfBlock; // remember the current file block to be kept in cache - due to reuse of the memory, the block may fall out a must be read back
uint16_t gfOffset;
const uint8_t *gfBlockBuffBegin()const;
void gfReset();
bool gfEnsureBlock();
bool gfComputeNextFileBlock();
void gfUpdateCurrentPosition(uint16_t inc);
public:
SdFile() {}
SdFile(const char* name, uint8_t oflag);
#if ARDUINO >= 100
@ -42,7 +59,10 @@ class SdFile : public SdBaseFile/*, public Print*/ {
#else
void write(uint8_t b);
#endif
bool openFilteredGcode(SdBaseFile* dirFile, const char* path);
int16_t readFilteredGcode();
bool seekSetFilteredGcode(uint32_t pos);
int16_t write(const void* buf, uint16_t nbyte);
void write(const char* str);
void write_P(PGM_P str);
@ -51,4 +71,4 @@ class SdFile : public SdBaseFile/*, public Print*/ {
#endif // SdFile_h
#endif
#endif

View File

@ -36,7 +36,7 @@
*/
union cache_t {
/** Used to access cached file data blocks. */
uint8_t data[512];
uint8_t data[512 + 1]; // abuse the last byte for saving '\n' - ugly optimization of read_filtered's inner skipping loop
/** Used to access cached FAT16 entries. */
uint16_t fat16[256];
/** Used to access cached FAT32 entries. */
@ -119,6 +119,7 @@ class SdVolume {
bool dbgFat(uint32_t n, uint32_t* v) {return fatGet(n, v);}
//------------------------------------------------------------------------------
private:
friend class SdFile;
// Allow SdBaseFile access to SdVolume private data.
friend class SdBaseFile;
@ -211,4 +212,4 @@ class SdVolume {
#endif // ALLOW_DEPRECATED_FUNCTIONS
};
#endif // SdVolume
#endif
#endif

View File

@ -1,344 +0,0 @@
/*
Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
The servos are pulsed in the background using the value most recently written using the write() method
Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
The methods are:
Servo - Class for manipulating servo motors connected to Arduino pins.
attach(pin ) - Attaches a servo motor to an i/o pin.
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
default min is 544, max is 2400
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
writeMicroseconds() - Sets the servo pulse width in microseconds
read() - Gets the last written servo pulse width as an angle between 0 and 180.
readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin.
*/
#include "Configuration.h"
#ifdef NUM_SERVOS
#include <avr/interrupt.h>
#include <Arduino.h>
#include "Servo.h"
#define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to tick (assumes prescale of 8) // 12 Aug 2009
#define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds
#define TRIM_DURATION 2 // compensation ticks to trim adjust for digitalWrite delays // 12 August 2009
//#define NBR_TIMERS (MAX_SERVOS / SERVOS_PER_TIMER)
static servo_t servos[MAX_SERVOS]; // static array of servo structures
static volatile int8_t Channel[_Nbr_16timers ]; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
uint8_t ServoCount = 0; // the total number of attached servos
// convenience macros
#define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / SERVOS_PER_TIMER)) // returns the timer controlling this servo
#define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % SERVOS_PER_TIMER) // returns the index of the servo on this timer
#define SERVO_INDEX(_timer,_channel) ((_timer*SERVOS_PER_TIMER) + _channel) // macro to access servo index by timer and channel
#define SERVO(_timer,_channel) (servos[SERVO_INDEX(_timer,_channel)]) // macro to access servo class by timer and channel
#define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4) // minimum value in uS for this servo
#define SERVO_MAX() (MAX_PULSE_WIDTH - this->max * 4) // maximum value in uS for this servo
/************ static functions common to all instances ***********************/
static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t *TCNTn, volatile uint16_t* OCRnA)
{
if( Channel[timer] < 0 )
*TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer
else{
if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && SERVO(timer,Channel[timer]).Pin.isActive == true )
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,LOW); // pulse this channel low if activated
}
Channel[timer]++; // increment to the next channel
if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
*OCRnA = *TCNTn + SERVO(timer,Channel[timer]).ticks;
if(SERVO(timer,Channel[timer]).Pin.isActive == true) // check if activated
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // its an active channel so pulse it high
}
else {
// finished all channels so wait for the refresh period to expire before starting over
if( ((unsigned)*TCNTn) + 4 < usToTicks(REFRESH_INTERVAL) ) // allow a few ticks to ensure the next OCR1A not missed
*OCRnA = (unsigned int)usToTicks(REFRESH_INTERVAL);
else
*OCRnA = *TCNTn + 4; // at least REFRESH_INTERVAL has elapsed
Channel[timer] = -1; // this will get incremented at the end of the refresh period to start again at the first channel
}
}
#ifndef WIRING // Wiring pre-defines signal handlers so don't define any if compiling for the Wiring platform
// Interrupt handlers for Arduino
#if defined(_useTimer1)
SIGNAL (TIMER1_COMPA_vect)
{
handle_interrupts(_timer1, &TCNT1, &OCR1A);
}
#endif
#if defined(_useTimer3)
SIGNAL (TIMER3_COMPA_vect)
{
handle_interrupts(_timer3, &TCNT3, &OCR3A);
}
#endif
#if defined(_useTimer4)
SIGNAL (TIMER4_COMPA_vect)
{
handle_interrupts(_timer4, &TCNT4, &OCR4A);
}
#endif
#if defined(_useTimer5)
SIGNAL (TIMER5_COMPA_vect)
{
handle_interrupts(_timer5, &TCNT5, &OCR5A);
}
#endif
#elif defined WIRING
// Interrupt handlers for Wiring
#if defined(_useTimer1)
void Timer1Service()
{
handle_interrupts(_timer1, &TCNT1, &OCR1A);
}
#endif
#if defined(_useTimer3)
void Timer3Service()
{
handle_interrupts(_timer3, &TCNT3, &OCR3A);
}
#endif
#endif
static void initISR(timer16_Sequence_t timer)
{
#if defined (_useTimer1)
if(timer == _timer1) {
TCCR1A = 0; // normal counting mode
TCCR1B = _BV(CS11); // set prescaler of 8
TCNT1 = 0; // clear the timer count
#if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
TIFR |= _BV(OCF1A); // clear any pending interrupts;
TIMSK |= _BV(OCIE1A) ; // enable the output compare interrupt
#else
// here if not ATmega8 or ATmega128
TIFR1 |= _BV(OCF1A); // clear any pending interrupts;
TIMSK1 |= _BV(OCIE1A) ; // enable the output compare interrupt
#endif
#if defined(WIRING)
timerAttach(TIMER1OUTCOMPAREA_INT, Timer1Service);
#endif
}
#endif
#if defined (_useTimer3)
if(timer == _timer3) {
TCCR3A = 0; // normal counting mode
TCCR3B = _BV(CS31); // set prescaler of 8
TCNT3 = 0; // clear the timer count
#if defined(__AVR_ATmega128__)
TIFR |= _BV(OCF3A); // clear any pending interrupts;
ETIMSK |= _BV(OCIE3A); // enable the output compare interrupt
#else
TIFR3 = _BV(OCF3A); // clear any pending interrupts;
TIMSK3 = _BV(OCIE3A) ; // enable the output compare interrupt
#endif
#if defined(WIRING)
timerAttach(TIMER3OUTCOMPAREA_INT, Timer3Service); // for Wiring platform only
#endif
}
#endif
#if defined (_useTimer4)
if(timer == _timer4) {
TCCR4A = 0; // normal counting mode
TCCR4B = _BV(CS41); // set prescaler of 8
TCNT4 = 0; // clear the timer count
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
TIMSK4 = _BV(OCIE4A) ; // enable the output compare interrupt
}
#endif
#if defined (_useTimer5)
if(timer == _timer5) {
TCCR5A = 0; // normal counting mode
TCCR5B = _BV(CS51); // set prescaler of 8
TCNT5 = 0; // clear the timer count
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
TIMSK5 = _BV(OCIE5A) ; // enable the output compare interrupt
}
#endif
}
static void finISR(timer16_Sequence_t timer)
{
//disable use of the given timer
#if defined WIRING // Wiring
if(timer == _timer1) {
#if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
TIMSK1 &= ~_BV(OCIE1A) ; // disable timer 1 output compare interrupt
#else
TIMSK &= ~_BV(OCIE1A) ; // disable timer 1 output compare interrupt
#endif
timerDetach(TIMER1OUTCOMPAREA_INT);
}
else if(timer == _timer3) {
#if defined(__AVR_ATmega1281__)||defined(__AVR_ATmega2561__)
TIMSK3 &= ~_BV(OCIE3A); // disable the timer3 output compare A interrupt
#else
ETIMSK &= ~_BV(OCIE3A); // disable the timer3 output compare A interrupt
#endif
timerDetach(TIMER3OUTCOMPAREA_INT);
}
#else
//For arduino - in future: call here to a currently undefined function to reset the timer
#endif
}
static boolean isTimerActive(timer16_Sequence_t timer)
{
// returns true if any servo is active on this timer
for(uint8_t channel=0; channel < SERVOS_PER_TIMER; channel++) {
if(SERVO(timer,channel).Pin.isActive == true)
return true;
}
return false;
}
/****************** end of static functions ******************************/
Servo::Servo()
{
if( ServoCount < MAX_SERVOS) {
this->servoIndex = ServoCount++; // assign a servo index to this instance
servos[this->servoIndex].ticks = usToTicks(DEFAULT_PULSE_WIDTH); // store default values - 12 Aug 2009
}
else
this->servoIndex = INVALID_SERVO ; // too many servos
}
uint8_t Servo::attach(int pin)
{
return this->attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
}
uint8_t Servo::attach(int pin, int min, int max)
{
if(this->servoIndex < MAX_SERVOS ) {
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
if (pin > 0) this->pin = pin; else pin = this->pin;
#endif
pinMode( pin, OUTPUT) ; // set servo pin to output
servos[this->servoIndex].Pin.nbr = pin;
// todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
this->min = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 uS
this->max = (MAX_PULSE_WIDTH - max)/4;
// initialize the timer if it has not already been initialized
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
if(isTimerActive(timer) == false)
initISR(timer);
servos[this->servoIndex].Pin.isActive = true; // this must be set after the check for isTimerActive
}
return this->servoIndex ;
}
void Servo::detach()
{
servos[this->servoIndex].Pin.isActive = false;
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
if(isTimerActive(timer) == false) {
finISR(timer);
}
}
void Servo::write(int value)
{
if(value < MIN_PULSE_WIDTH)
{ // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
if(value < 0) value = 0;
if(value > 180) value = 180;
value = map(value, 0, 180, SERVO_MIN(), SERVO_MAX());
}
this->writeMicroseconds(value);
}
void Servo::writeMicroseconds(int value)
{
// calculate and store the values for the given channel
byte channel = this->servoIndex;
if( (channel < MAX_SERVOS) ) // ensure channel is valid
{
if( value < SERVO_MIN() ) // ensure pulse width is valid
value = SERVO_MIN();
else if( value > SERVO_MAX() )
value = SERVO_MAX();
value = value - TRIM_DURATION;
value = usToTicks(value); // convert to ticks after compensating for interrupt overhead - 12 Aug 2009
uint8_t oldSREG = SREG;
cli();
servos[channel].ticks = value;
SREG = oldSREG;
}
}
int Servo::read() // return the value as degrees
{
return map( this->readMicroseconds()+1, SERVO_MIN(), SERVO_MAX(), 0, 180);
}
int Servo::readMicroseconds()
{
unsigned int pulsewidth;
if( this->servoIndex != INVALID_SERVO )
pulsewidth = ticksToUs(servos[this->servoIndex].ticks) + TRIM_DURATION ; // 12 aug 2009
else
pulsewidth = 0;
return pulsewidth;
}
bool Servo::attached()
{
return servos[this->servoIndex].Pin.isActive ;
}
#endif

View File

@ -1,135 +0,0 @@
/*
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
Copyright (c) 2009 Michael Margolis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
A servo is activated by creating an instance of the Servo class passing the desired pin to the attach() method.
The servos are pulsed in the background using the value most recently written using the write() method
Note that analogWrite of PWM on pins associated with the timer are disabled when the first servo is attached.
Timers are seized as needed in groups of 12 servos - 24 servos use two timers, 48 servos will use four.
The sequence used to seize timers is defined in timers.h
The methods are:
Servo - Class for manipulating servo motors connected to Arduino pins.
attach(pin ) - Attaches a servo motor to an i/o pin.
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
default min is 544, max is 2400
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
writeMicroseconds() - Sets the servo pulse width in microseconds
read() - Gets the last written servo pulse width as an angle between 0 and 180.
readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
attached() - Returns true if there is a servo attached.
detach() - Stops an attached servos from pulsing its i/o pin.
*/
#ifndef Servo_h
#define Servo_h
#include <inttypes.h>
/*
* Defines for 16 bit timers used with Servo library
*
* If _useTimerX is defined then TimerX is a 16 bit timer on the current board
* timer16_Sequence_t enumerates the sequence that the timers should be allocated
* _Nbr_16timers indicates how many 16 bit timers are available.
*
*/
// Say which 16 bit timers can be used and in what order
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define _useTimer5
//#define _useTimer1
#define _useTimer3
#define _useTimer4
//typedef enum { _timer5, _timer1, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer5, _timer3, _timer4, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_ATmega32U4__)
//#define _useTimer1
#define _useTimer3
//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
#define _useTimer3
//#define _useTimer1
//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#elif defined(__AVR_ATmega128__) ||defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284P__) ||defined(__AVR_ATmega2561__)
#define _useTimer3
//#define _useTimer1
//typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _timer3, _Nbr_16timers } timer16_Sequence_t ;
#else // everything else
//#define _useTimer1
//typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
typedef enum { _Nbr_16timers } timer16_Sequence_t ;
#endif
#define Servo_VERSION 2 // software version of this library
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
#define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
#define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)
#define INVALID_SERVO 255 // flag indicating an invalid servo index
typedef struct {
uint8_t nbr :6 ; // a pin number from 0 to 63
uint8_t isActive :1 ; // true if this channel is enabled, pin not pulsed if false
} ServoPin_t ;
typedef struct {
ServoPin_t Pin;
unsigned int ticks;
} servo_t;
class Servo
{
public:
Servo();
uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or 0 if failure
uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
void detach();
void write(int value); // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
void writeMicroseconds(int value); // Write pulse width in microseconds
int read(); // returns current pulse width as an angle between 0 and 180 degrees
int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
bool attached(); // return true if this servo is attached, otherwise false
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
int pin; // store the hardware pin of the servo
#endif
private:
uint8_t servoIndex; // index into the channel data for this servo
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH
int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH
};
#endif

67
Firmware/SpoolJoin.cpp Normal file
View File

@ -0,0 +1,67 @@
#include "SpoolJoin.h"
#include "Marlin.h"
#include "eeprom.h"
#include "messages.h"
#include "language.h"
namespace SpoolJoin {
SpoolJoin spooljoin;
SpoolJoin::SpoolJoin()
: currentMMUSlot(0)
{
}
void SpoolJoin::initSpoolJoinStatus()
{
// Useful information to see during bootup
SERIAL_ECHOPGM("SpoolJoin is ");
uint8_t status = eeprom_init_default_byte((uint8_t*)EEPROM_SPOOL_JOIN, (uint8_t)EEPROM::Disabled);
if (status == (uint8_t)EEPROM::Enabled)
{
SERIAL_ECHOLNRPGM(_O(MSG_ON));
} else {
SERIAL_ECHOLNRPGM(_O(MSG_OFF));
}
}
void SpoolJoin::toggleSpoolJoin()
{
if (eeprom_read_byte((uint8_t*)EEPROM_SPOOL_JOIN) == (uint8_t)EEPROM::Disabled)
{
eeprom_update_byte_notify((uint8_t*)EEPROM_SPOOL_JOIN, (uint8_t)EEPROM::Enabled);
} else {
eeprom_update_byte_notify((uint8_t*)EEPROM_SPOOL_JOIN, (uint8_t)EEPROM::Disabled);
}
}
bool SpoolJoin::isSpoolJoinEnabled()
{
if(eeprom_read_byte((uint8_t*)EEPROM_SPOOL_JOIN) == (uint8_t)EEPROM::Enabled) {
return true;
} else {
return false;
}
}
void SpoolJoin::setSlot(uint8_t slot)
{
currentMMUSlot = slot;
}
uint8_t SpoolJoin::nextSlot()
{
SERIAL_ECHOPGM("SpoolJoin: ");
SERIAL_ECHO((int)currentMMUSlot);
if (currentMMUSlot >= MMU_FILAMENT_COUNT-1) currentMMUSlot = 0;
else currentMMUSlot++;
SERIAL_ECHOPGM(" -> ");
SERIAL_ECHOLN((int)currentMMUSlot);
return currentMMUSlot;
}
}

46
Firmware/SpoolJoin.h Normal file
View File

@ -0,0 +1,46 @@
/// @file
#pragma once
#include <stdint.h>
// See documentation here: https://help.prusa3d.com/article/spooljoin-mmu2s_134252
namespace SpoolJoin {
class SpoolJoin {
public:
SpoolJoin();
enum class EEPROM : uint8_t {
Unknown, ///< SpoolJoin is unknown while printer is booting up
Enabled, ///< SpoolJoin is enabled in EEPROM
Disabled, ///< SpoolJoin is disabled in EEPROM
Empty = 0xFF ///< EEPROM has not been set before and all bits are 1 (0xFF) - either a new printer or user erased the memory
};
/// @brief Called when EEPROM is ready to be read
void initSpoolJoinStatus();
/// @brief Toggle SpoolJoin
static void toggleSpoolJoin();
/// @brief Check if SpoolJoin is enabled
/// @returns true if enabled, false if disabled
bool isSpoolJoinEnabled();
/// @brief Update the saved MMU slot number so SpoolJoin can determine the next slot to use
/// @param slot number of the slot to set
void setSlot(uint8_t slot);
/// @brief Fetch the next slot number should count from 0 to 4.
/// When filament slot 4 is depleted, the next slot should be 0.
/// @returns the next slot, ranges from 0 to 4
uint8_t nextSlot();
private:
/// @brief Currently used slot, ranges from 0 to 4
uint8_t currentMMUSlot;
};
extern SpoolJoin spooljoin;
} // namespace SpoolJoin

71
Firmware/Tcodes.cpp Normal file
View File

@ -0,0 +1,71 @@
#include "Tcodes.h"
#include "SpoolJoin.h"
#include "Marlin.h"
#include "language.h"
#include "messages.h"
#include "mmu2.h"
#include "ultralcd.h"
#include <avr/pgmspace.h>
#include <stdint.h>
#include <stdio.h>
static const char duplicate_Tcode_ignored[] PROGMEM = "Duplicate T-code ignored.";
inline bool IsInvalidTCode(char *const s, uint8_t i) {
return ((s[i] < '0' || s[i] > '4') && s[i] != '?' && s[i] != 'x' && s[i] != 'c');
}
inline void TCodeInvalid() {
SERIAL_ECHOLNPGM("Invalid T code.");
}
void TCodes(char *const strchr_pointer, const uint8_t codeValue) {
uint8_t index = 1;
for ( /*nothing*/ ; strchr_pointer[index] == ' ' || strchr_pointer[index] == '\t'; index++)
;
strchr_pointer[index] = tolower(strchr_pointer[index]);
if (IsInvalidTCode(strchr_pointer, index)){
TCodeInvalid();
} else if (strchr_pointer[index] == 'x' || strchr_pointer[index] == '?'){
// load to extruder gears; if mmu is not present do nothing
if (MMU2::mmu2.Enabled()) {
MMU2::mmu2.tool_change(strchr_pointer[index], choose_menu_P(_T(MSG_SELECT_FILAMENT), MSG_FILAMENT));
}
} else if (strchr_pointer[index] == 'c'){
// load from extruder gears to nozzle (nozzle should be preheated)
if (MMU2::mmu2.Enabled()) {
MMU2::mmu2.tool_change(strchr_pointer[index], MMU2::mmu2.get_current_tool());
}
} else { // Process T0 ... T4
if (MMU2::mmu2.Enabled()) {
if (codeValue == MMU2::mmu2.get_current_tool()){
// don't execute the same T-code twice in a row
puts_P(duplicate_Tcode_ignored);
} else {
#if defined(MMU_HAS_CUTTER) && defined(MMU_ALWAYS_CUT)
if (EEPROM_MMU_CUTTER_ENABLED_always == eeprom_read_byte((uint8_t *)EEPROM_MMU_CUTTER_ENABLED)) {
MMU2::mmu2.cut_filament(codeValue);
}
#endif // defined(MMU_HAS_CUTTER) && defined(MMU_ALWAYS_CUT)
MMU2::mmu2.tool_change(codeValue);
}
} else {
SERIAL_ECHO_START;
if (codeValue >= EXTRUDERS) {
SERIAL_ECHO('T');
SERIAL_ECHOLN(codeValue + '0');
SERIAL_ECHOLNRPGM(_n("Invalid extruder")); ////MSG_INVALID_EXTRUDER
} else {
// @@TODO if (code_seen('F')) {
// next_feedrate = code_value();
// if (next_feedrate > 0.0) {
// feedrate = next_feedrate;
// }
// }
SERIAL_ECHORPGM(_n("Active Extruder: 0")); ////MSG_ACTIVE_EXTRUDER
}
}
}
}

5
Firmware/Tcodes.h Normal file
View File

@ -0,0 +1,5 @@
/// @file
#pragma once
#include <stdint.h>
void TCodes(char * const strchr_pointer, const uint8_t codeValue);

View File

@ -6,17 +6,6 @@
#include "Timer.h"
#include "system_timer.h"
/**
* @brief construct Timer
*
* It is guaranteed, that construction is equivalent with zeroing all members.
* This property can be exploited in menu_data.
*/
template<typename T>
Timer<T>::Timer() : m_isRunning(false), m_started()
{
}
/**
* @brief Start timer
*/
@ -64,5 +53,24 @@ bool Timer<T>::expired(T msPeriod)
return expired;
}
/**
* @brief Ticks since the timer was started
*
* This function returns 0 if the timer is not started. Otherwise, it returns
* the time in milliseconds since the timer was started.
* This function is expected to handle wrap around of time register well.
* The maximum elapsed time is dictated by the template type
*/
template<typename T>
T Timer<T>::elapsed() {
return m_isRunning ? (_millis() - m_started) : 0;
}
template<typename T>
bool Timer<T>::expired_cont(T msPeriod)
{
return !m_isRunning || expired(msPeriod);
}
template class Timer<unsigned long>;
template class Timer<unsigned short>;

View File

@ -17,13 +17,18 @@ template <class T>
class Timer
{
public:
Timer();
inline constexpr Timer()
: m_isRunning(false)
, m_started(0) {};
void start();
void stop(){m_isRunning = false;}
bool running(){return m_isRunning;}
bool expired(T msPeriod);
bool running()const {return m_isRunning;}
bool expired(T msPeriod); // returns true only once after expiration, then stops running
T elapsed(); // returns the time in milliseconds since the timer was started or 0 otherwise
bool expired_cont(T msPeriod); // return true when continuosly when expired / not running
protected:
T started(){return m_started;}
T started()const {return m_started;}
private:
bool m_isRunning;
T m_started;

View File

@ -1,95 +0,0 @@
//adc.c
#include "adc.h"
#include <stdio.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include "pins.h"
uint8_t adc_state;
uint8_t adc_count;
uint16_t adc_values[ADC_CHAN_CNT];
uint16_t adc_sim_mask;
#ifdef ADC_CALLBACK
extern void ADC_CALLBACK(void);
#endif //ADC_CALLBACK
void adc_init(void)
{
printf_P(PSTR("adc_init\n"));
adc_sim_mask = 0x00;
ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
ADMUX |= (1 << REFS0);
ADCSRA |= (1 << ADEN);
// ADCSRA |= (1 << ADIF) | (1 << ADSC);
DIDR0 = ((ADC_CHAN_MSK & ADC_DIDR_MSK) & 0xff);
DIDR2 = ((ADC_CHAN_MSK & ADC_DIDR_MSK) >> 8);
adc_reset();
// adc_sim_mask = 0b0101;
// adc_sim_mask = 0b100101;
// adc_values[0] = 1023 * 16;
// adc_values[2] = 1023 * 16;
// adc_values[5] = 1002 * 16;
}
void adc_reset(void)
{
adc_state = 0;
adc_count = 0;
uint8_t i; for (i = 0; i < ADC_CHAN_CNT; i++)
if ((adc_sim_mask & (1 << i)) == 0)
adc_values[i] = 0;
}
void adc_setmux(uint8_t ch)
{
ch &= 0x0f;
if (ch & 0x08) ADCSRB |= (1 << MUX5);
else ADCSRB &= ~(1 << MUX5);
ADMUX = (ADMUX & ~(0x07)) | (ch & 0x07);
}
uint8_t adc_chan(uint8_t index)
{
uint8_t chan = 0;
uint16_t mask = 1;
while (mask)
{
if ((mask & ADC_CHAN_MSK) && (index-- == 0)) break;
mask <<= 1;
chan++;
}
return chan;
}
void adc_cycle(void)
{
if (adc_state & 0x80)
{
uint8_t index = adc_state & 0x0f;
if ((adc_sim_mask & (1 << index)) == 0)
adc_values[index] += ADC;
if (++index >= ADC_CHAN_CNT)
{
index = 0;
adc_count++;
if (adc_count >= ADC_OVRSAMPL)
{
#ifdef ADC_CALLBACK
ADC_CALLBACK();
#endif //ADC_CALLBACK
adc_reset();
}
}
adc_setmux(adc_chan(index));
adc_state = index;
}
else
{
ADCSRA |= (1 << ADSC); //start conversion
adc_state |= 0x80;
}
}

81
Firmware/adc.cpp Normal file
View File

@ -0,0 +1,81 @@
#include "adc.h"
#include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <string.h>
#include "pins.h"
static uint8_t adc_count; //used for oversampling
static uint8_t adc_channel_idx; //bitmask index
volatile uint8_t adc_channel; //regular index
volatile uint16_t adc_values[ADC_CHAN_CNT];
static void adc_reset();
static void adc_setmux(uint8_t ch);
void adc_init()
{
puts_P(PSTR("adc_init"));
DIDR0 = ((ADC_CHAN_MSK & ADC_DIDR_MSK) & 0xff); //disable digital inputs PORTF
DIDR2 = ((ADC_CHAN_MSK & ADC_DIDR_MSK) >> 8); //disable digital inputs PORTK
ADMUX |= (1 << REFS0); //use AVCC as reference
//enable ADC, set prescaler/128, enable interrupt
ADCSRA = (1 << ADEN) | (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0) | (1 << ADIF) | (1 << ADIE);
}
static void adc_reset()
{
static const uint8_t first_channel_idx = 0;
static_assert((1 << first_channel_idx) & ADC_CHAN_MSK);
ADCSRA &= ~(1 << ADSC); //stop conversion just in case
adc_count = 0;
adc_channel = 0;
adc_channel_idx = first_channel_idx;
adc_setmux(adc_channel_idx);
memset((void*)adc_values, 0, sizeof(adc_values));
}
static void adc_setmux(uint8_t ch)
{
ch &= 0x0f;
if (ch & 0x08) ADCSRB |= (1 << MUX5);
else ADCSRB &= ~(1 << MUX5);
ADMUX = (ADMUX & ~(0x07)) | (ch & 0x07);
}
void adc_start_cycle() {
adc_reset();
ADCSRA |= (1 << ADSC); //start conversion
}
#ifdef ADC_CALLBACK
extern void ADC_CALLBACK();
#endif //ADC_CALLBACK
ISR(ADC_vect)
{
adc_values[adc_channel] += ADC;
if (++adc_count == ADC_OVRSAMPL)
{
// go to the next channel
if (++adc_channel == ADC_CHAN_CNT) {
#ifdef ADC_CALLBACK
ADC_CALLBACK();
#endif
return; // do not start the next measurement since there are no channels remaining
}
// find the next channel
while (++adc_channel_idx) {
if (ADC_CHAN_MSK & (1 << adc_channel_idx)) {
adc_setmux(adc_channel_idx);
adc_count = 0;
break;
}
}
}
ADCSRA |= (1 << ADSC); //start conversion
}

View File

@ -1,15 +1,8 @@
//adc.h
#ifndef _ADC_H
#define _ADC_H
#pragma once
#include <inttypes.h>
#include "config.h"
#if defined(__cplusplus)
extern "C" {
#endif //defined(__cplusplus)
/*
http://resnet.uoregon.edu/~gurney_j/jmpc/bitwise.html
*/
@ -22,24 +15,11 @@ http://resnet.uoregon.edu/~gurney_j/jmpc/bitwise.html
# error "ADC_CHAN_MSK oes not match ADC_CHAN_CNT"
#endif
extern uint8_t adc_state;
extern uint8_t adc_count;
extern uint16_t adc_values[ADC_CHAN_CNT];
extern uint16_t adc_sim_mask;
#define VOLT_DIV_REF 5 //[V]
extern volatile uint8_t adc_channel;
extern volatile uint16_t adc_values[ADC_CHAN_CNT];
extern void adc_init(void);
extern void adc_reset(void);
extern void adc_setmux(uint8_t ch);
extern uint8_t adc_chan(uint8_t index);
extern void adc_cycle(void);
#if defined(__cplusplus)
}
#endif //defined(__cplusplus)
#endif //_ADC_H
extern void adc_init();
extern void adc_start_cycle(); //should be called from an atomic context only
static inline bool adc_cycle_done() { return adc_channel >= ADC_CHAN_CNT; }

21
Firmware/asm.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include <stdint.h>
#include "macros.h"
#ifdef __AVR_ATmega2560__
// return the current PC (on AVRs with 22bit PC)
FORCE_INLINE __uint24 GETPC(void)
{
__uint24 ret;
asm (
"rcall .\n"
"pop %A0\n"
"pop %B0\n"
"pop %C0\n"
: "=&r" (ret)
);
return ret;
}
#endif

View File

@ -1,12 +1,12 @@
//backlight.cpp
#include "backlight.h"
#include <avr/eeprom.h>
#include <Arduino.h>
#include <avr/eeprom.h>
#include "backlight.h"
#include "eeprom.h"
#include "Marlin.h"
#include "pins.h"
#include "fastio.h"
#include "macros.h"
#include "pins.h"
#include "system_timer.h"
#include "Timer.h"
#ifdef LCD_BL_PIN
@ -14,10 +14,10 @@
#define BL_FLASH_DELAY_MS 25
bool backlightSupport = 0; //only if it's true will any of the settings be visible to the user
int16_t backlightLevel_HIGH = 0;
int16_t backlightLevel_LOW = 0;
uint8_t backlightLevel_HIGH = 0;
uint8_t backlightLevel_LOW = 0;
uint8_t backlightMode = BACKLIGHT_MODE_BRIGHT;
int16_t backlightTimer_period = 10;
int16_t backlightTimer_period = LCD_BACKLIGHT_TIMEOUT;
LongTimer backlightTimer;
static void backlightTimer_reset() //used for resetting the timer and waking the display. Triggered on user interactions.
@ -32,7 +32,7 @@ void force_bl_on(bool section_start)
if (section_start)
{
backlightMode = BACKLIGHT_MODE_BRIGHT;
if (backlightLevel_HIGH < 30) backlightLevel_HIGH = 30;
if (backlightLevel_HIGH < LCD_BACKLIGHT_FORCE_ON) backlightLevel_HIGH = LCD_BACKLIGHT_FORCE_ON;
}
else
{
@ -45,7 +45,7 @@ void force_bl_on(bool section_start)
void backlight_wake(const uint8_t flashNo)
{
if (!backlightSupport) return;
if (flashNo)
{
uint8_t backlightMode_bck = backlightMode;
@ -62,16 +62,16 @@ void backlight_wake(const uint8_t flashNo)
void backlight_save() //saves all backlight data to eeprom.
{
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, (uint8_t)backlightLevel_HIGH);
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW, (uint8_t)backlightLevel_LOW);
eeprom_update_byte((uint8_t *)EEPROM_BACKLIGHT_MODE, backlightMode);
eeprom_update_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, backlightTimer_period);
eeprom_update_byte_notify((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, backlightLevel_HIGH);
eeprom_update_byte_notify((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW, backlightLevel_LOW);
eeprom_update_byte_notify((uint8_t *)EEPROM_BACKLIGHT_MODE, backlightMode);
eeprom_update_word_notify((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, backlightTimer_period);
}
void backlight_update()
{
if (!backlightSupport) return;
if (backlightMode == BACKLIGHT_MODE_AUTO)
{
if (backlightTimer.expired((uint32_t)backlightTimer_period * 1000ul)) analogWrite(LCD_BL_PIN, backlightLevel_LOW);
@ -91,30 +91,22 @@ void backlight_init()
backlightSupport = !READ(LCD_BL_PIN);
if (!backlightSupport) return;
//initialize backlight
backlightMode = eeprom_read_byte((uint8_t *)EEPROM_BACKLIGHT_MODE);
if (backlightMode == 0xFF) //set default values
{
backlightMode = BACKLIGHT_MODE_AUTO;
backlightLevel_HIGH = 130;
backlightLevel_LOW = 50;
backlightTimer_period = 10; //in seconds
backlight_save();
}
backlightLevel_HIGH = eeprom_read_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH);
backlightLevel_LOW = eeprom_read_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW);
backlightTimer_period = eeprom_read_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT);
//initialize backlight
backlightMode = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_MODE, BACKLIGHT_MODE_AUTO);
backlightLevel_HIGH = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_HIGH, LCD_BACKLIGHT_LEVEL_HIGH);
backlightLevel_LOW = eeprom_init_default_byte((uint8_t *)EEPROM_BACKLIGHT_LEVEL_LOW, LCD_BACKLIGHT_LEVEL_LOW);
backlightTimer_period = eeprom_init_default_word((uint16_t *)EEPROM_BACKLIGHT_TIMEOUT, LCD_BACKLIGHT_TIMEOUT); // in seconds
SET_OUTPUT(LCD_BL_PIN);
backlightTimer_reset();
}
#else //LCD_BL_PIN
void force_bl_on(__attribute__((unused)) bool section_start) {}
void force_bl_on(bool) {}
void backlight_update() {}
void backlight_init() {}
void backlight_save() {}
void backlight_wake(__attribute__((unused)) const uint8_t flashNo) {}
void backlight_wake(const uint8_t) {}
#endif //LCD_BL_PIN
#endif //LCD_BL_PIN

View File

@ -3,8 +3,6 @@
#define _BACKLIGHT_H
#include <inttypes.h>
#include "Marlin.h"
#include "pins.h"
enum Backlight_Mode
{
@ -13,8 +11,8 @@ enum Backlight_Mode
BACKLIGHT_MODE_AUTO = 2,
};
extern int16_t backlightLevel_HIGH;
extern int16_t backlightLevel_LOW;
extern uint8_t backlightLevel_HIGH;
extern uint8_t backlightLevel_LOW;
extern uint8_t backlightMode;
extern bool backlightSupport;
extern int16_t backlightTimer_period;

View File

@ -6,17 +6,17 @@
#include <stdio.h>
extern FILE _uartout;
#define uartout (&_uartout)
extern void softReset();
void bootapp_print_vars(void)
{
fprintf_P(uartout, PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr);
fprintf_P(uartout, PSTR("boot_dst_addr =0x%08lx\n"), boot_dst_addr);
fprintf_P(uartout, PSTR("boot_copy_size =0x%04x\n"), boot_copy_size);
fprintf_P(uartout, PSTR("boot_reserved =0x%02x\n"), boot_reserved);
fprintf_P(uartout, PSTR("boot_app_flags =0x%02x\n"), boot_app_flags);
fprintf_P(uartout, PSTR("boot_app_magic =0x%08lx\n"), boot_app_magic);
printf_P(PSTR("boot_src_addr =0x%08lx\n"), boot_src_addr);
printf_P(PSTR("boot_dst_addr =0x%08lx\n"), boot_dst_addr);
printf_P(PSTR("boot_copy_size =0x%04x\n"), boot_copy_size);
printf_P(PSTR("boot_reserved =0x%02x\n"), boot_reserved);
printf_P(PSTR("boot_app_flags =0x%02x\n"), boot_app_flags);
printf_P(PSTR("boot_app_magic =0x%08lx\n"), boot_app_magic);
}
@ -24,23 +24,12 @@ void bootapp_ram2flash(uint16_t rptr, uint16_t fptr, uint16_t size)
{
cli();
boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags |= BOOT_APP_FLG_COPY;
boot_app_flags |= BOOT_APP_FLG_ERASE;
/* uint16_t ui; for (ui = 0; ui < size; ui++)
{
uint8_t uc = ram_array[ui+rptr];
if (pgm_read_byte(ui+fptr) & uc != uc)
{
boot_app_flags |= BOOT_APP_FLG_ERASE;
break;
}
}*/
boot_app_flags |= BOOT_APP_FLG_COPY | BOOT_APP_FLG_ERASE;
boot_copy_size = (uint16_t)size;
boot_src_addr = (uint32_t)rptr;
boot_dst_addr = (uint32_t)fptr;
bootapp_print_vars();
wdt_enable(WDTO_15MS);
while(1);
// bootapp_print_vars();
softReset();
}
void bootapp_reboot_user0(uint8_t reserved)
@ -48,8 +37,8 @@ void bootapp_reboot_user0(uint8_t reserved)
cli();
boot_app_magic = BOOT_APP_MAGIC;
boot_app_flags = BOOT_APP_FLG_USER0;
boot_copy_size = 0;
boot_reserved = reserved;
bootapp_print_vars();
wdt_enable(WDTO_15MS);
while(1);
// bootapp_print_vars();
softReset();
}

View File

@ -3,11 +3,11 @@
#define BOOTAPP_H
#include "config.h"
#include <avr/io.h>
#include <inttypes.h>
#define RAMSIZE 0x2000
#define ram_array ((uint8_t*)(0))
#define RAMSIZE (RAMEND+1-RAMSTART)
#define boot_src_addr (*((uint32_t*)(RAMSIZE - 16)))
#define boot_dst_addr (*((uint32_t*)(RAMSIZE - 12)))
#define boot_copy_size (*((uint16_t*)(RAMSIZE - 8)))
@ -17,11 +17,10 @@
#define BOOT_APP_FLG_ERASE 0x01
#define BOOT_APP_FLG_COPY 0x02
#define BOOT_APP_FLG_FLASH 0x04
#define BOOT_APP_FLG_RUN 0x08
#define BOOT_APP_FLG_USER0 0x80
#define BOOT_APP_MAGIC 0x55aa55aa
#define BOOT_APP_MAGIC 0x55aa55aaUL
#if defined(__cplusplus)

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +1,80 @@
#ifndef CARDREADER_H
#define CARDREADER_H
#define SDSUPPORT
#ifdef SDSUPPORT
#define MAX_DIR_DEPTH 10
#define MAX_DIR_DEPTH 6
#include "SdFile.h"
enum LsAction {LS_SerialPrint,LS_Count,LS_GetFilename};
class CardReader
{
public:
CardReader();
void initsd();
enum LsAction : uint8_t
{
LS_SerialPrint,
LS_Count,
LS_GetFilename,
};
struct ls_param
{
bool LFN : 1;
bool timestamp : 1;
inline ls_param():LFN(0), timestamp(0) { }
inline ls_param(bool LFN, bool timestamp):LFN(LFN), timestamp(timestamp) { }
} __attribute__((packed));
void mount(bool doPresort = true);
void write_command(char *buf);
void write_command_no_newline(char *buf);
//files auto[0-9].g on the sd card are performed in a row
//this is to delay autostart and hence the initialisaiton of the sd card to some seconds after the normal init, so the device is available quick after a reset
void checkautostart(bool x);
void openFile(const char* name,bool read,bool replace_current=true);
void checkautostart(bool x);
void openFileWrite(const char* name);
void openFileReadFilteredGcode(const char* name, bool replace_current = false);
void openLogFile(const char* name);
void removeFile(const char* name);
void closefile(bool store_location=false);
void release();
void startFileprint();
uint32_t getFileSize();
void getStatus();
void getStatus(bool arg_P);
void printingHasFinished();
void getfilename(uint16_t nr, const char* const match=NULL);
void getfilename_simple(uint32_t position, const char * const match = NULL);
void getfilename_simple(uint16_t entry, const char * const match = NULL);
void getfilename_next(uint32_t position, const char * const match = NULL);
uint16_t getnrfilenames();
void getAbsFilename(char *t);
void getDirName(char* name, uint8_t level);
uint16_t getWorkDirDepth();
void ls();
void chdir(const char * relpath);
void getAbsFilename(char *t);
void printAbsFilenameFast();
void getDirName(char* name, uint8_t level);
uint8_t getWorkDirDepth();
void ls(ls_param params);
bool chdir(const char * relpath, bool doPresort);
void updir();
void setroot();
void cdroot(bool doPresort);
#ifdef SDCARD_SORT_ALPHA
void presort();
#ifdef SDSORT_QUICKSORT
void swap(uint8_t left, uint8_t right);
void quicksort(uint8_t left, uint8_t right);
#endif //SDSORT_QUICKSORT
void getfilename_sorted(const uint16_t nr);
#if SDSORT_GCODE
FORCE_INLINE void setSortOn(bool b) { sort_alpha = b; presort(); }
FORCE_INLINE void setSortFolders(int i) { sort_folders = i; presort(); }
//FORCE_INLINE void setSortReverse(bool b) { sort_reverse = b; }
#endif
void getfilename_sorted(const uint16_t nr, uint8_t sdSort);
void getfilename_afterMaxSorting(uint16_t entry, const char * const match = NULL);
#endif
FORCE_INLINE bool isFileOpen() { return file.isOpen(); }
FORCE_INLINE bool eof() { return sdpos>=filesize ;};
FORCE_INLINE int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
bool eof() { return sdpos>=filesize; }
FORCE_INLINE int16_t getFilteredGcodeChar()
{
int16_t c = (int16_t)file.readFilteredGcode();
sdpos = file.curPosition();
return c;
};
void setIndex(long index) {sdpos = index;file.seekSetFilteredGcode(index);};
FORCE_INLINE uint8_t percentDone(){if(!isFileOpen()) return 0; if(filesize) return sdpos/((filesize+99)/100); else return 0;};
FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
FORCE_INLINE uint32_t get_sdpos() { if (!isFileOpen()) return 0; else return(sdpos); };
@ -69,65 +83,35 @@ public:
void ToshibaFlashAir_enable(bool enable) { card.setFlashAirCompatible(enable); }
bool ToshibaFlashAir_GetIP(uint8_t *ip);
//Reprint
bool FileExists(const char* filename);
public:
bool saving;
bool logging;
bool sdprinting ;
bool cardOK ;
char filename[13];
bool sdprinting;
bool mounted;
char filename[FILENAME_LENGTH];
// There are scenarios when simple modification time is not enough (on MS Windows)
// Therefore these timestamps hold the most recent one of creation/modification date/times
uint16_t crmodTime, crmodDate;
uint32_t cluster, position;
uint32_t /* cluster, */ position;
char longFilename[LONG_FILENAME_LENGTH];
bool filenameIsDir;
int lastnr; //last number of the autostart;
#ifdef SDCARD_SORT_ALPHA
bool presort_flag;
#endif // SDCARD_SORT_ALPHA
char dir_names[MAX_DIR_DEPTH][9];
private:
SdFile root,*curDir,workDir,workDirParents[MAX_DIR_DEPTH];
uint16_t workDirDepth;
uint8_t workDirDepth;
// Sort files and folders alphabetically.
#ifdef SDCARD_SORT_ALPHA
uint16_t sort_count; // Count of sorted items in the current directory
#if SDSORT_GCODE
bool sort_alpha; // Flag to enable / disable the feature
int sort_folders; // Flag to enable / disable folder sorting
//bool sort_reverse; // Flag to enable / disable reverse sorting
#endif
// By default the sort index is static
#if SDSORT_DYNAMIC_RAM
uint8_t *sort_order;
#else
uint8_t sort_order[SDSORT_LIMIT];
#endif
// Cache filenames to speed up SD menus.
#if SDSORT_USES_RAM
// If using dynamic ram for names, allocate on the heap.
#if SDSORT_CACHE_NAMES
#if SDSORT_DYNAMIC_RAM
char **sortshort, **sortnames;
#else
char sortshort[SDSORT_LIMIT][FILENAME_LENGTH];
char sortnames[SDSORT_LIMIT][FILENAME_LENGTH];
#endif
#elif !SDSORT_USES_STACK
char sortnames[SDSORT_LIMIT][FILENAME_LENGTH];
uint16_t modification_time[SDSORT_LIMIT];
uint16_t modification_date[SDSORT_LIMIT];
#endif
// Folder sorting uses an isDir array when caching items.
#if HAS_FOLDER_SORTING
#if SDSORT_DYNAMIC_RAM
uint8_t *isDir;
#elif (SDSORT_CACHE_NAMES) || !(SDSORT_USES_STACK)
uint8_t isDir[(SDSORT_LIMIT + 7) >> 3];
#endif
#endif
#endif // SDSORT_USES_RAM
uint16_t sort_entries[SDSORT_LIMIT];
uint16_t lastSortedFilePosition;
#endif // SDCARD_SORT_ALPHA
@ -146,17 +130,13 @@ private:
char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH];
uint32_t filesize;
//int16_t n;
unsigned long autostart_atmillis;
ShortTimer autostart_atmillis;
uint32_t sdpos ;
bool autostart_stilltocheck; //the sd start is delayed, because otherwise the serial cannot answer fast enought to make contact with the hostsoftware.
LsAction lsAction; //stored for recursion.
int16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
char* diveDirName;
uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
void diveSubfolder (const char *fileName, SdFile& dir);
void lsDive(const char *prepend, SdFile parent, const char * const match=NULL);
bool diveSubfolder (const char *&fileName);
void lsDive(const char *prepend, SdFile parent, const char * const match=NULL, LsAction lsAction = LS_GetFilename, ls_param lsParams = ls_param());
#ifdef SDCARD_SORT_ALPHA
void flush_presort();
#endif
@ -166,7 +146,7 @@ extern CardReader card;
#define IS_SD_PRINTING (card.sdprinting)
#if (SDCARDDETECT > -1)
# ifdef SDCARDDETECTINVERTED
# ifdef SDCARDDETECTINVERTED
# define IS_SD_INSERTED (READ(SDCARDDETECT)!=0)
# else
# define IS_SD_INSERTED (READ(SDCARDDETECT)==0)

View File

@ -1,8 +1,14 @@
#include <stdarg.h>
#include <util/atomic.h>
#include "cmdqueue.h"
#include "cardreader.h"
#include "ultralcd.h"
extern bool Stopped;
#include "Prusa_farm.h"
#include "meatpack.h"
#include "messages.h"
#include "language.h"
#include "stopwatch.h"
#include "power_panic.h"
// Reserve BUFSIZE lines of length MAX_CMD_SIZE plus CMDBUFFER_RESERVE_FRONT.
char cmdbuffer[BUFSIZE * (MAX_CMD_SIZE + 1) + CMDBUFFER_RESERVE_FRONT];
@ -18,17 +24,16 @@ int buflen = 0;
// Therefore don't remove the command from the queue in the loop() function.
bool cmdbuffer_front_already_processed = false;
// Used for temporarely preventing accidental adding of Serial commands to the queue.
// For now only check_file and the fancheck pause use this.
bool cmdqueue_serial_disabled = false;
int serial_count = 0; //index of character read from serial line
boolean comment_mode = false;
bool comment_mode = false;
char *strchr_pointer; // just a pointer to find chars in the command string like X, Y, Z, E, etc
unsigned long TimeSent = _millis();
unsigned long TimeNow = _millis();
long gcode_N = 0;
ShortTimer serialTimeoutTimer;
long gcode_LastN = 0;
long Stopped_gcode_LastN = 0;
uint32_t sdpos_atomic = 0;
@ -91,14 +96,19 @@ bool cmdqueue_pop_front()
void cmdqueue_reset()
{
bufindr = 0;
bufindw = 0;
buflen = 0;
while (buflen)
{
// printf_P(PSTR("dumping: \"%s\" of type %u\n"), cmdbuffer+bufindr+CMDHDRSIZE, CMDBUFFER_CURRENT_TYPE);
ClearToSend();
cmdqueue_pop_front();
}
bufindr = 0;
bufindw = 0;
//commands are removed from command queue after process_command() function is finished
//reseting command queue and enqueing new commands during some (usually long running) command processing would cause that new commands are immediately removed from queue (or damaged)
//this will ensure that all new commands which are enqueued after cmdqueue reset, will be always executed
cmdbuffer_front_already_processed = true;
cmdbuffer_front_already_processed = true;
}
// How long a string could be pushed to the front of the command queue?
@ -149,7 +159,7 @@ static bool cmdqueue_could_enqueue_front(size_t len_asked)
// len_asked does not contain the zero terminator size.
// This function may update bufindw, therefore for the power panic to work, this function must be called
// with the interrupts disabled!
static bool cmdqueue_could_enqueue_back(size_t len_asked, bool atomic_update = false)
static bool __attribute__((noinline)) cmdqueue_could_enqueue_back(size_t len_asked)
{
// MAX_CMD_SIZE has to accommodate the zero terminator.
if (len_asked >= MAX_CMD_SIZE)
@ -159,61 +169,29 @@ static bool cmdqueue_could_enqueue_back(size_t len_asked, bool atomic_update = f
// Full buffer.
return false;
if (serial_count > 0) {
// If there is some data stored starting at bufindw, len_asked is certainly smaller than
// the allocated data buffer. Try to reserve a new buffer and to move the already received
// serial data.
// How much memory to reserve for the commands pushed to the front?
// End of the queue, when pushing to the end.
size_t endw = bufindw + len_asked + (1 + CMDHDRSIZE);
if (bufindw < bufindr)
// Simple case. There is a contiguous space between the write buffer and the read buffer.
return endw + CMDBUFFER_RESERVE_FRONT <= bufindr;
// Otherwise the free space is split between the start and end.
if (// Could one fit to the end, including the reserve?
endw + CMDBUFFER_RESERVE_FRONT <= sizeof(cmdbuffer) ||
// Could one fit to the end, and the reserve to the start?
(endw <= sizeof(cmdbuffer) && CMDBUFFER_RESERVE_FRONT <= bufindr))
return true;
// Could one fit both to the start?
if (len_asked + (1 + CMDHDRSIZE) + CMDBUFFER_RESERVE_FRONT <= bufindr) {
// Mark the rest of the buffer as used.
memset(cmdbuffer+bufindw, 0, sizeof(cmdbuffer)-bufindw);
// and point to the start.
// Be careful! The bufindw needs to be changed atomically for the power panic & filament panic to work.
if (atomic_update)
cli();
bufindw = 0;
if (atomic_update)
sei();
return true;
}
} else {
// How much memory to reserve for the commands pushed to the front?
// End of the queue, when pushing to the end.
size_t endw = bufindw + len_asked + (1 + CMDHDRSIZE);
if (bufindw < bufindr)
// Simple case. There is a contiguous space between the write buffer and the read buffer.
return endw + CMDBUFFER_RESERVE_FRONT <= bufindr;
// Otherwise the free space is split between the start and end.
if (// Could one fit to the end, including the reserve?
endw + CMDBUFFER_RESERVE_FRONT <= sizeof(cmdbuffer) ||
// Could one fit to the end, and the reserve to the start?
(endw <= sizeof(cmdbuffer) && CMDBUFFER_RESERVE_FRONT <= bufindr))
return true;
// Could one fit both to the start?
if (len_asked + (1 + CMDHDRSIZE) + CMDBUFFER_RESERVE_FRONT <= bufindr) {
// Mark the rest of the buffer as used.
memset(cmdbuffer+bufindw, 0, sizeof(cmdbuffer)-bufindw);
// and point to the start.
// Be careful! The bufindw needs to be changed atomically for the power panic & filament panic to work.
if (atomic_update)
cli();
bufindw = 0;
if (atomic_update)
sei();
return true;
}
// If there is some data stored starting at bufindw, len_asked is certainly smaller than
// the allocated data buffer. Try to reserve a new buffer and to move the already received
// serial data.
// How much memory to reserve for the commands pushed to the front?
// End of the queue, when pushing to the end.
size_t endw = bufindw + len_asked + (1 + CMDHDRSIZE);
if (bufindw < bufindr)
// Simple case. There is a contiguous space between the write buffer and the read buffer.
return endw + CMDBUFFER_RESERVE_FRONT <= bufindr;
// Otherwise the free space is split between the start and end.
if (// Could one fit to the end, including the reserve?
endw + CMDBUFFER_RESERVE_FRONT <= sizeof(cmdbuffer) ||
// Could one fit to the end, and the reserve to the start?
(endw <= sizeof(cmdbuffer) && CMDBUFFER_RESERVE_FRONT <= bufindr))
return true;
// Could one fit both to the start?
if (len_asked + (1 + CMDHDRSIZE) + CMDBUFFER_RESERVE_FRONT <= bufindr) {
// Mark the rest of the buffer as used.
memset(cmdbuffer+bufindw, 0, sizeof(cmdbuffer)-bufindw);
// and point to the start.
// Be careful! The bufindw needs to be changed atomically for the power panic & filament panic to work.
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { bufindw = 0; }
return true;
}
return false;
}
@ -276,6 +254,22 @@ void cmdqueue_dump_to_serial()
}
#endif /* CMDBUFFER_DEBUG */
static const char bufferFull[] PROGMEM = "\" failed: Buffer full!";
static const char enqueingFront[] PROGMEM = "Enqueing to the front: \"";
void enquecommandf_P(const char *fmt, ...)
{
// MAX_CMD_SIZE is 96, but for formatting
// string we usually don't need more than 30 bytes
char cmd_buffer[30];
va_list ap;
va_start(ap, fmt);
vsnprintf_P(cmd_buffer, sizeof(cmd_buffer), fmt, ap);
va_end(ap);
enquecommand(cmd_buffer, false);
}
//adds an command to the main command buffer
//thats really done in a non-safe way.
//needs overworking someday
@ -311,7 +305,7 @@ void enquecommand(const char *cmd, bool from_progmem)
SERIAL_PROTOCOLRPGM(cmd);
else
SERIAL_ECHO(cmd);
SERIAL_ECHOLNPGM("\" failed: Buffer full!");
SERIAL_ECHOLNRPGM(bufferFull);
#ifdef CMDBUFFER_DEBUG
cmdqueue_dump_to_serial();
#endif /* CMDBUFFER_DEBUG */
@ -335,7 +329,7 @@ void enquecommand_front(const char *cmd, bool from_progmem)
strcpy(cmdbuffer + bufindr + CMDHDRSIZE, cmd);
++ buflen;
SERIAL_ECHO_START;
SERIAL_ECHOPGM("Enqueing to the front: \"");
SERIAL_ECHORPGM(enqueingFront);
SERIAL_ECHO(cmdbuffer + bufindr + CMDHDRSIZE);
SERIAL_ECHOLNPGM("\"");
#ifdef CMDBUFFER_DEBUG
@ -343,12 +337,12 @@ void enquecommand_front(const char *cmd, bool from_progmem)
#endif /* CMDBUFFER_DEBUG */
} else {
SERIAL_ERROR_START;
SERIAL_ECHOPGM("Enqueing to the front: \"");
SERIAL_ECHORPGM(enqueingFront);
if (from_progmem)
SERIAL_PROTOCOLRPGM(cmd);
else
SERIAL_ECHO(cmd);
SERIAL_ECHOLNPGM("\" failed: Buffer full!");
SERIAL_ECHOLNRPGM(bufferFull);
#ifdef CMDBUFFER_DEBUG
cmdqueue_dump_to_serial();
#endif /* CMDBUFFER_DEBUG */
@ -360,28 +354,12 @@ void enquecommand_front(const char *cmd, bool from_progmem)
void repeatcommand_front()
{
cmdbuffer_front_already_processed = true;
}
bool is_buffer_empty()
{
if (buflen == 0) return true;
else return false;
}
void proc_commands() {
if (buflen)
{
process_commands();
if (!cmdbuffer_front_already_processed)
cmdqueue_pop_front();
cmdbuffer_front_already_processed = false;
}
}
void get_command()
{
// Test and reserve space for the new command string.
if (! cmdqueue_could_enqueue_back(MAX_CMD_SIZE - 1, true))
if (! cmdqueue_could_enqueue_back(MAX_CMD_SIZE - 1))
return;
if (MYSERIAL.available() == RX_BUFFER_SIZE - 1) { //compare number of chars buffered in rx buffer with rx buffer size
@ -390,17 +368,24 @@ void get_command()
}
// start of serial line processing loop
while ((MYSERIAL.available() > 0 && !saved_printing) || (MYSERIAL.available() > 0 && isPrintPaused)) { //is print is saved (crash detection or filament detection), dont process data from serial line
while (((MYSERIAL.available() > 0 && !saved_printing) || (MYSERIAL.available() > 0 && printingIsPaused())) && !cmdqueue_serial_disabled) { //is print is saved (crash detection or filament detection), dont process data from serial line
#ifdef ENABLE_MEATPACK
// MeatPack Changes
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const int rec = MYSERIAL.read();
if (rec < 0) continue;
mp_handle_rx_char((uint8_t)rec);
char c_res[2] = {0, 0};
const uint8_t char_count = mp_get_result_char(c_res);
// Note -- Paired bracket in preproc switch below
for (uint8_t i = 0; i < char_count; ++i) { char serial_char = c_res[i];
#else
char serial_char = MYSERIAL.read();
/* if (selectedSerialPort == 1)
{
selectedSerialPort = 0;
MYSERIAL.write(serial_char); // for debuging serial line 2 in farm_mode
selectedSerialPort = 1;
} */ //RP - removed
TimeSent = _millis();
TimeNow = _millis();
#endif
serialTimeoutTimer.start();
if (serial_char < 0)
// Ignore extended ASCII characters. These characters have no meaning in the G-code apart from the file names
@ -416,22 +401,23 @@ void get_command()
comment_mode = false; //for new command
return;
}
cmdbuffer[bufindw+serial_count+CMDHDRSIZE] = 0; //terminate string
cmdbuffer[bufindw+serial_count+CMDHDRSIZE] = 0; // terminate string
char* cmd_head = cmdbuffer+bufindw+CMDHDRSIZE; // current command pointer
char* cmd_start = cmd_head; // pointer past the line number (if any)
if(!comment_mode){
gcode_N = 0;
long gcode_N = -1; // seen line number
// Line numbers must be first in buffer
if (*cmd_head == 'N') {
if ((strstr(cmdbuffer+bufindw+CMDHDRSIZE, "PRUSA") == NULL) &&
(cmdbuffer[bufindw+CMDHDRSIZE] == 'N')) {
// Line number met: decode the number, then move cmd_start past all spaces.
gcode_N = (strtol(cmd_head+1, &cmd_start, 10));
while (*cmd_start == ' ') ++cmd_start;
// Line number met. When sending a G-code over a serial line, each line may be stamped with its index,
// and Marlin tests, whether the successive lines are stamped with an increasing line number ID
gcode_N = (strtol(cmdbuffer+bufindw+CMDHDRSIZE+1, NULL, 10));
if(gcode_N != gcode_LastN+1 && (strstr_P(cmdbuffer+bufindw+CMDHDRSIZE, PSTR("M110")) == NULL) ) {
// M110 - set current line number.
// Line numbers not sent in succession.
// Test whether the successive lines are stamped with an increasing line number ID.
if(gcode_N != gcode_LastN+1 && strncmp_P(cmd_start, PSTR("M110"), 4)) {
// Line numbers not sent in succession and M110 not seen.
SERIAL_ERROR_START;
SERIAL_ERRORRPGM(_n("Line Number is not Last Line Number+1, Last Line: "));////MSG_ERR_LINE_NO
SERIAL_ERRORLN(gcode_LastN);
@ -441,13 +427,13 @@ void get_command()
return;
}
if((strchr_pointer = strchr(cmdbuffer+bufindw+CMDHDRSIZE, '*')) != NULL)
if((strchr_pointer = strchr(cmd_start, '*')) != NULL)
{
byte checksum = 0;
char *p = cmdbuffer+bufindw+CMDHDRSIZE;
char *p = cmd_head;
while (p != strchr_pointer)
checksum = checksum^(*p++);
if (int(strtol(strchr_pointer+1, NULL, 10)) != int(checksum)) {
if (code_value_short() != (int16_t)checksum) {
SERIAL_ERROR_START;
SERIAL_ERRORRPGM(_n("checksum mismatch, Last Line: "));////MSG_ERR_CHECKSUM_MISMATCH
SERIAL_ERRORLN(gcode_LastN);
@ -467,54 +453,82 @@ void get_command()
serial_count = 0;
return;
}
// Don't parse N again with code_seen('N')
cmdbuffer[bufindw + CMDHDRSIZE] = '$';
//if no errors, continue parsing
gcode_LastN = gcode_N;
}
// if we don't receive 'N' but still see '*'
if ((cmdbuffer[bufindw + CMDHDRSIZE] != 'N') && (cmdbuffer[bufindw + CMDHDRSIZE] != '$') && (strchr(cmdbuffer+bufindw+CMDHDRSIZE, '*') != NULL))
else
{
// move cmd_start past all spaces
while (*cmd_start == ' ') ++cmd_start;
SERIAL_ERROR_START;
SERIAL_ERRORRPGM(_n("No Line Number with checksum, Last Line: "));////MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
// if we didn't receive 'N' but still see '*'
if (strchr(cmd_start, '*') != NULL)
{
SERIAL_ERROR_START;
SERIAL_ERRORRPGM(_n("No Line Number with checksum, Last Line: "));////MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM
SERIAL_ERRORLN(gcode_LastN);
FlushSerialRequestResend();
serial_count = 0;
return;
}
}
// Handle KILL early, even when Stopped
if(strcmp_P(cmd_start, PSTR("M112")) == 0)
kill(MSG_M112_KILL);
// Bypass Stopped for some commands
bool allow_when_stopped = false;
if(strncmp_P(cmd_start, PSTR("M310"), 4) == 0)
allow_when_stopped = true;
// Handle the USB timer
if ((*cmd_start == 'G') && (GetPrinterState() != PrinterState::IsSDPrinting)) {
usb_timer.start();
SetPrinterState(PrinterState::IsHostPrinting); //set printer state busy printing to hide LCD menu while USB printing
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
}
if (allow_when_stopped == false && Stopped == true) {
// Stopped can be set either during error states (thermal error: cannot continue), or
// when a printer-initiated action is processed. In such case the printer will send to
// the host an action, but cannot know if the action has been processed while new
// commands are being sent. In this situation we just drop the command while issuing
// periodic "busy" messages in the main loop. Since we're not incrementing the received
// line number, a request for resend will happen (if necessary), ensuring we don't skip
// commands whenever Stopped is cleared and processing resumes.
serial_count = 0;
return;
}
if ((strchr_pointer = strchr(cmdbuffer+bufindw+CMDHDRSIZE, 'G')) != NULL) {
if (! IS_SD_PRINTING) {
usb_printing_counter = 10;
is_usb_printing = true;
}
if (Stopped == true) {
int gcode = strtol(strchr_pointer+1, NULL, 10);
if (gcode >= 0 && gcode <= 3) {
SERIAL_ERRORLNRPGM(MSG_ERR_STOPPED);
LCD_MESSAGERPGM(_T(MSG_STOPPED));
}
}
} // end of 'G' command
//If command was e-stop process now
if(strcmp(cmdbuffer+bufindw+CMDHDRSIZE, "M112") == 0)
kill(MSG_M112_KILL, 2);
// Store the current line into buffer, move to the next line.
// Command is complete: store the current line into buffer, move to the next line.
// Store type of entry
cmdbuffer[bufindw] = gcode_N ? CMDBUFFER_CURRENT_TYPE_USB_WITH_LINENR : CMDBUFFER_CURRENT_TYPE_USB;
cmdbuffer[bufindw] = gcode_N >= 0 ? CMDBUFFER_CURRENT_TYPE_USB_WITH_LINENR : CMDBUFFER_CURRENT_TYPE_USB;
#ifdef CMDBUFFER_DEBUG
SERIAL_ECHO_START;
SERIAL_ECHOPGM("Storing a command line to buffer: ");
SERIAL_ECHO(cmdbuffer+bufindw+CMDHDRSIZE);
SERIAL_ECHO(cmd_start);
SERIAL_ECHOLNPGM("");
#endif /* CMDBUFFER_DEBUG */
bufindw += strlen(cmdbuffer+bufindw+CMDHDRSIZE) + (1 + CMDHDRSIZE);
// Store the command itself (without line number or checksum)
size_t cmd_len;
if (cmd_head == cmd_start)
cmd_len = strlen(cmd_start) + 1;
else {
// strip the line number
cmd_len = 0;
do { cmd_head[cmd_len] = cmd_start[cmd_len]; }
while (cmd_head[cmd_len++]);
}
bufindw += cmd_len + CMDHDRSIZE;
if (bufindw == sizeof(cmdbuffer))
bufindw = 0;
++ buflen;
// Update the processed gcode line
if (gcode_N >= 0)
gcode_LastN = gcode_N;
#ifdef CMDBUFFER_DEBUG
SERIAL_ECHOPGM("Number of commands in the buffer: ");
SERIAL_ECHO(buflen);
@ -524,7 +538,7 @@ void get_command()
serial_count = 0; //clear buffer
// Don't call cmdqueue_could_enqueue_back if there are no characters waiting
// in the queue, as this function will reserve the memory.
if (MYSERIAL.available() == 0 || ! cmdqueue_could_enqueue_back(MAX_CMD_SIZE-1, true))
if (MYSERIAL.available() == 0 || ! cmdqueue_could_enqueue_back(MAX_CMD_SIZE-1))
return;
} // end of "end of line" processing
else {
@ -532,28 +546,20 @@ void get_command()
if(serial_char == ';') comment_mode = true;
if(!comment_mode) cmdbuffer[bufindw+CMDHDRSIZE+serial_count++] = serial_char;
}
#ifdef ENABLE_MEATPACK
}
#endif
} // end of serial line processing loop
if(farm_mode){
TimeNow = _millis();
if ( ((TimeNow - TimeSent) > 800) && (serial_count > 0) ) {
cmdbuffer[bufindw+serial_count+CMDHDRSIZE] = 0;
bufindw += strlen(cmdbuffer+bufindw+CMDHDRSIZE) + (1 + CMDHDRSIZE);
if (bufindw == sizeof(cmdbuffer))
bufindw = 0;
++ buflen;
serial_count = 0;
SERIAL_ECHOPGM("TIMEOUT:");
//memset(cmdbuffer, 0 , sizeof(cmdbuffer));
return;
}
if (serial_count > 0 && serialTimeoutTimer.expired(farm_mode ? 800 : 2000)) {
comment_mode = false;
serial_count = 0;
SERIAL_ECHOLNPGM("RX timeout");
return;
}
#ifdef SDSUPPORT
if(!card.sdprinting || serial_count!=0){
if(!card.sdprinting || !card.isFileOpen() || serial_count!=0){
// If there is a half filled buffer from serial line, wait until return before
// continuing with the serial line.
return;
@ -575,15 +581,14 @@ void get_command()
sd_count.value = 0;
// Reads whole lines from the SD card. Never leaves a half-filled line in the cmdbuffer.
while( !card.eof() && !stop_buffering) {
int16_t n=card.get();
int16_t n=card.getFilteredGcodeChar();
char serial_char = (char)n;
if(serial_char == '\n' ||
serial_char == '\r' ||
((serial_char == '#' || serial_char == ':') && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1) || n==-1)
{
if(card.eof()) break;
if( serial_char == '\n'
|| serial_char == '\r'
|| serial_char == '#'
|| serial_count >= (MAX_CMD_SIZE - 1)
|| n==-1
){
if(serial_char=='#')
stop_buffering=true;
@ -591,15 +596,14 @@ void get_command()
{
// This is either an empty line, or a line with just a comment.
// Continue to the following line, and continue accumulating the number of bytes
// read from the sdcard into sd_count,
// so that the lenght of the already read empty lines and comments will be added
// to the following non-empty line.
comment_mode = false;
continue; //if empty line
// read from the sdcard into sd_count,
// so that the length of the already read empty lines and comments will be added
// to the following non-empty line.
return; // prevent cycling indefinitely - let manage_heaters do their job
}
// The new command buffer could be updated non-atomically, because it is not yet considered
// to be inside the active queue.
sd_count.value = (card.get_sdpos()+1) - sdpos_atomic;
sd_count.value = card.get_sdpos() - sdpos_atomic;
cmdbuffer[bufindw] = CMDBUFFER_CURRENT_TYPE_SDCARD;
cmdbuffer[bufindw+1] = sd_count.lohi.lo;
cmdbuffer[bufindw+2] = sd_count.lohi.hi;
@ -611,10 +615,10 @@ void get_command()
// MYSERIAL.print(sd_count.value, DEC);
// SERIAL_ECHOPGM(") ");
// SERIAL_ECHOLN(cmdbuffer+bufindw+CMDHDRSIZE);
// SERIAL_ECHOPGM("cmdbuffer:");
// MYSERIAL.print(cmdbuffer);
// SERIAL_ECHOPGM("buflen:");
// MYSERIAL.print(buflen+1);
// SERIAL_ECHOPGM("cmdbuffer:");
// MYSERIAL.print(cmdbuffer);
// SERIAL_ECHOPGM("buflen:");
// MYSERIAL.print(buflen+1);
sd_count.value = 0;
cli();
@ -624,21 +628,24 @@ void get_command()
// or a 115200 Bd serial line receive interrupt, which will not trigger faster than 12kHz.
++ buflen;
bufindw += len;
sdpos_atomic = card.get_sdpos()+1;
sdpos_atomic = card.get_sdpos();
if (bufindw == sizeof(cmdbuffer))
bufindw = 0;
sei();
comment_mode = false; //for new command
serial_count = 0; //clear buffer
if(card.eof()) break;
// The following line will reserve buffer space if available.
if (! cmdqueue_could_enqueue_back(MAX_CMD_SIZE-1, true))
if (! cmdqueue_could_enqueue_back(MAX_CMD_SIZE-1))
return;
}
else
{
if(serial_char == ';') comment_mode = true;
else if(!comment_mode) cmdbuffer[bufindw+CMDHDRSIZE+serial_count++] = serial_char;
// there are no comments coming from the filtered file
cmdbuffer[bufindw+CMDHDRSIZE+serial_count++] = serial_char;
}
}
if(card.eof())
@ -649,27 +656,28 @@ void get_command()
// cleared by printingHasFinished after peforming all remaining moves.
if(!cmdqueue_calc_sd_length())
{
// queue is complete, but before we process EOF commands prevent
// re-entry by disabling SD processing from any st_synchronize call
card.closefile();
SERIAL_PROTOCOLLNRPGM(_n("Done printing file"));////MSG_FILE_PRINTED
stoptime=_millis();
char time[30];
unsigned long t=(stoptime-starttime-pause_time)/1000;
pause_time = 0;
uint32_t t = print_job_timer.duration() / 60;
int hours, minutes;
minutes=(t/60)%60;
hours=t/60/60;
save_statistics(total_filament_used, t);
minutes = t % 60;
hours = t / 60;
save_statistics();
sprintf_P(time, PSTR("%i hours %i minutes"),hours, minutes);
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
#ifndef SHOW_FILENAME_AFTER_FINISH
lcd_setstatus(time);
#endif //SHOW_FILENAME_AFTER_FINISH
card.printingHasFinished();
card.checkautostart(true);
if (farm_mode)
{
prusa_statistics(6);
lcd_commands_type = LcdCommands::FarmModeConfirm;
}
prusa_statistics(6);
}
}

View File

@ -2,13 +2,11 @@
#define CMDQUEUE_H
#include "Marlin.h"
#include "language.h"
// String circular buffer. Commands may be pushed to the buffer from both sides:
// Chained commands will be pushed to the front, interactive (from LCD menu)
// Chained commands will be pushed to the front, interactive (from LCD menu)
// and printing commands (from serial line or from SD card) are pushed to the tail.
// First character of each entry indicates the type of the entry:
// First character of each entry indicates the type of the entry:
#define CMDBUFFER_CURRENT_TYPE_UNKNOWN 0
// Command in cmdbuffer was sent over USB.
#define CMDBUFFER_CURRENT_TYPE_USB 1
@ -18,8 +16,8 @@
#define CMDBUFFER_CURRENT_TYPE_UI 3
// Command in cmdbuffer was generated by another G-code.
#define CMDBUFFER_CURRENT_TYPE_CHAINED 4
// Command has been processed and its SD card length has been possibly pushed
// to the planner queue, but not yet removed from the cmdqueue.
// Command has been processed and its SD card length has been possibly pushed
// to the planner queue, but not yet removed from the cmdqueue.
// This is a temporary state to reduce stepper interrupt locking time.
#define CMDBUFFER_CURRENT_TYPE_TO_BE_REMOVED 5
//Command in cmdbuffer was sent over USB and contains line number
@ -35,6 +33,7 @@ extern char cmdbuffer[BUFSIZE * (MAX_CMD_SIZE + 1) + CMDBUFFER_RESERVE_FRONT];
extern size_t bufindr;
extern int buflen;
extern bool cmdbuffer_front_already_processed;
extern bool cmdqueue_serial_disabled;
// Type of a command, which is to be executed right now.
#define CMDBUFFER_CURRENT_TYPE (cmdbuffer[bufindr])
@ -48,15 +47,10 @@ extern bool cmdbuffer_front_already_processed;
extern uint32_t sdpos_atomic;
extern int serial_count;
extern boolean comment_mode;
extern bool comment_mode;
extern char *strchr_pointer;
extern unsigned long TimeSent;
extern unsigned long TimeNow;
extern long gcode_N;
extern long gcode_LastN;
extern long Stopped_gcode_LastN;
extern bool cmdqueue_pop_front();
extern void cmdqueue_reset();
@ -65,30 +59,31 @@ extern void cmdqueue_dump_to_serial_single_line(int nr, const char *p);
extern void cmdqueue_dump_to_serial();
#endif /* CMDBUFFER_DEBUG */
extern bool cmd_buffer_empty();
extern void enquecommand(const char *cmd, bool from_progmem);
extern void enquecommand_front(const char *cmd, bool from_progmem);
/// @brief Variant of enquecommand which accepts a format string
/// @param fmt a format string residing in PROGMEM
void enquecommandf_P(const char *fmt, ...);
extern void enquecommand(const char *cmd, bool from_progmem = false);
extern void enquecommand_front(const char *cmd, bool from_progmem = false);
extern void repeatcommand_front();
extern bool is_buffer_empty();
extern void get_command();
extern uint16_t cmdqueue_calc_sd_length();
#if defined(__cplusplus)
extern "C" {
#endif
extern double strtod_noE(const char* nptr, char** endptr);
#if defined(__cplusplus)
}
#endif
// Return True if a character was found
static inline bool code_seen(char code) { return (strchr_pointer = strchr(CMDBUFFER_CURRENT_STRING, code)) != NULL; }
static inline bool code_seen(const char *code) { return (strchr_pointer = strstr(CMDBUFFER_CURRENT_STRING, code)) != NULL; }
static inline float code_value() { return strtod(strchr_pointer+1, NULL);}
static inline bool code_seen_P(const char *code_PROGMEM) { return (strchr_pointer = strstr_P(CMDBUFFER_CURRENT_STRING, code_PROGMEM)) != NULL; }
static inline float code_value() { return strtod_noE(strchr_pointer+1, NULL);}
static inline long code_value_long() { return strtol(strchr_pointer+1, NULL, 10); }
static inline int16_t code_value_short() { return int16_t(strtol(strchr_pointer+1, NULL, 10)); };
static inline uint8_t code_value_uint8() { return uint8_t(strtol(strchr_pointer+1, NULL, 10)); };
static inline float code_value_float()
{
char* e = strchr(strchr_pointer, 'E');
if (!e) return strtod(strchr_pointer + 1, NULL);
*e = 0;
float ret = strtod(strchr_pointer + 1, NULL);
*e = 'E';
return ret;
}
#endif //CMDQUEUE_H

View File

@ -2,28 +2,24 @@
#define _CONFIG_H
#include "Configuration_prusa.h"
#include "Configuration_var.h"
#include "pins.h"
#if (defined(VOLT_IR_PIN) && defined(IR_SENSOR))
# define IR_SENSOR_ANALOG
#endif
//ADC configuration
#ifndef IR_SENSOR_ANALOG
#define ADC_CHAN_MSK 0b0000001001011111 //used AD channels bit mask (0,1,2,3,4,6,9)
#define ADC_DIDR_MSK 0b0000001001011111 //AD channels DIDR mask (1 ~ disabled digital input)
#define ADC_CHAN_CNT 7 //number of used channels)
#else //!IR_SENSOR_ANALOG
#if defined(FILAMENT_SENSOR) && (FILAMENT_SENSOR_TYPE == FSENSOR_IR_ANALOG)
#define ADC_CHAN_MSK 0b0000001101011111 //used AD channels bit mask (0,1,2,3,4,6,8,9)
#define ADC_DIDR_MSK 0b0000001001011111 //AD channels DIDR mask (1 ~ disabled digital input)
#define ADC_CHAN_CNT 8 //number of used channels)
#endif //!IR_SENSOR_ANALOG
#else
#define ADC_CHAN_MSK 0b0000001001011111 //used AD channels bit mask (0,1,2,3,4,6,9)
#define ADC_DIDR_MSK 0b0000001001011111 //AD channels DIDR mask (1 ~ disabled digital input)
#define ADC_CHAN_CNT 7 //number of used channels)
#endif
#define ADC_OVRSAMPL 16 //oversampling multiplier
#define ADC_CALLBACK adc_ready //callback function ()
#define ADC_CALLBACK adc_callback //callback function ()
//SWI2C configuration
#define SWI2C
//#define SWI2C_SDA 20 //SDA on P3
//#define SWI2C_SCL 21 //SCL on P3
#define SWI2C_A8
@ -31,13 +27,23 @@
#define SWI2C_TMO 2048 //2048 cycles timeout
//PAT9125 configuration
#define PAT9125_SWI2C
#ifdef SWI2C_SCL
#define PAT9125_SWI2C // software I2C mode
#else
#define PAT9125_I2C // hardware I2C mode
#endif
#define PAT9125_I2C_ADDR 0x75 //ID=LO
//#define PAT9125_I2C_ADDR 0x79 //ID=HI
//#define PAT9125_I2C_ADDR 0x73 //ID=NC
#define PAT9125_XRES 0
#define PAT9125_YRES 240 // maximum resolution (5*X cpi)
#define PAT9124_YRES_MM (5*PAT9125_YRES/25.4) // counts per mm
#define PAT9125_YRES_MM (5*PAT9125_YRES/25.4) // counts per mm
#define PAT9125_INVERT_X 0 //1 means flipped
#define PAT9125_INVERT_Y 1 //1 means flipped
#define PAT9125_SWAP_XY 0 //X is Y and Y is X
#define PAT9125_12B_RES 1 //8bit or 12bit signed motion data
#define PAT9125_NEW_INIT 1 //set to 1 to use the magic sequence provided by pixart.
//SM4 configuration
#define SM4_DEFDELAY 500 //default step delay [us]
@ -49,19 +55,73 @@
#define TMC2130_SPCR SPI_SPCR(TMC2130_SPI_RATE, 1, 1, 1, 0)
#define TMC2130_SPSR SPI_SPSR(TMC2130_SPI_RATE)
//W25X20CL configuration
//pinout:
#define W25X20CL_PIN_CS 32
//spi:
#define W25X20CL_SPI_RATE 0 // fosc/4 = 4MHz
#define W25X20CL_SPCR SPI_SPCR(W25X20CL_SPI_RATE, 1, 1, 1, 0)
#define W25X20CL_SPSR SPI_SPSR(W25X20CL_SPI_RATE)
// This is set by the cmake build to be able to take control of
// the language flag, without breaking existing build mechanisms.
#ifndef CMAKE_CONTROL
//LANG - Multi-language support
//#define LANG_MODE 0 // primary language only
#define LANG_MODE 1 // sec. language support
#endif
#define LANG_SIZE_RESERVED 0x3000 // reserved space for secondary language (12288 bytes)
#define LANG_SIZE_RESERVED 0x3500 // reserved space for secondary language (13568 bytes).
// 0x3D00 Maximum 15616 bytes as it depends on xflash_layout.h
// 16 Languages max. per group including stock
#if (LANG_SIZE_RESERVED % 256)
#error "LANG_SIZE_RESERVED should be a multiple of a page size"
#endif
//Community language support
#define COMMUNITY_LANG_GROUP 1
#if (COMMUNITY_LANG_GROUP == 1)
#define COMMUNITY_LANG_GROUP1_NL // Community Dutch language
#define COMMUNITY_LANG_GROUP1_RO // Community Romanian language
#define COMMUNITY_LANG_GROUP1_HU // Community Hungarian language
#define COMMUNITY_LANG_GROUP1_HR // Community Croatian language
#define COMMUNITY_LANG_GROUP1_SK // Community Slovak language
#define COMMUNITY_LANG_GROUP1_SV // Community Swedish language
#define COMMUNITY_LANG_GROUP1_NO // Community Norwegian language
//#define COMMUNITY_LANG_GROUP1_DA // Community Danish language
//#define COMMUNITY_LANG_GROUP1_SL // Community Slovanian language
//#define COMMUNITY_LANG_GROUP1_LB // Community Luxembourgish language
#endif //COMMUNITY_LANG_GROUP 1
#if (COMMUNITY_LANG_GROUP == 2)
#define COMMUNITY_LANG_GROUP2_LT // Community Lithuanian language
//#define COMMUNITY_LANG_GROUP1_QR // Community new language //..use this as a template and replace 'QR'
#endif //COMMUNITY_LANG_GROUP 2
#if (COMMUNITY_LANG_GROUP >=1 )
#define COMMUNITY_LANGUAGE_SUPPORT
#endif
// Sanity checks for correct configuration of XFLASH_DUMP options
#if defined(XFLASH_DUMP) && !defined(XFLASH)
#error "XFLASH_DUMP requires XFLASH support"
#endif
#if (defined(MENU_DUMP) || defined(EMERGENCY_DUMP)) && !defined(XFLASH_DUMP)
#error "MENU_DUMP and EMERGENCY_DUMP require XFLASH_DUMP"
#endif
// Support for serial dumps is mutually exclusive with XFLASH_DUMP features
#if defined(EMERGENCY_DUMP) && defined(EMERGENCY_SERIAL_DUMP)
#error "EMERGENCY_DUMP and EMERGENCY_SERIAL_DUMP are mutually exclusive"
#endif
#if defined(MENU_DUMP) && defined(MENU_SERIAL_DUMP)
#error "MENU_DUMP and MENU_SERIAL_DUMP are mutually exclusive"
#endif
// Reduce internal duplication
#if defined(EMERGENCY_DUMP) || defined(EMERGENCY_SERIAL_DUMP)
#define EMERGENCY_HANDLERS
#endif
//FARM_MODE
#if ( LANG_MODE == 0 ) && defined(XFLASH) //Save resources on EINSY and disable FARM_MODE on multi-language version
#define PRUSA_FARM
#endif //PRUSA_FARM only in english on EINSYs
#ifndef XFLASH //enable FARM_MODE on miniRAMBo boards
#define PRUSA_FARM
#endif
#endif //_CONFIG_H

View File

@ -1,292 +0,0 @@
//conv2str.cpp - Float conversion utilities
#include "conv2str.h"
#include <stdlib.h>
// convert float to string with +123.4 format
char conv[8];
char *ftostr3(const float &x)
{
return itostr3((int)x);
}
char *itostr2(const uint8_t &x)
{
//sprintf(conv,"%5.1f",x);
int xx = x;
conv[0] = (xx / 10) % 10 + '0';
conv[1] = (xx) % 10 + '0';
conv[2] = 0;
return conv;
}
// Convert float to string with 123.4 format, dropping sign
char *ftostr31(const float &x)
{
int xx = x * 10;
conv[0] = (xx >= 0) ? '+' : '-';
xx = abs(xx);
conv[1] = (xx / 1000) % 10 + '0';
conv[2] = (xx / 100) % 10 + '0';
conv[3] = (xx / 10) % 10 + '0';
conv[4] = '.';
conv[5] = (xx) % 10 + '0';
conv[6] = 0;
return conv;
}
// Convert float to string with 123.4 format
char *ftostr31ns(const float &x)
{
int xx = x * 10;
//conv[0]=(xx>=0)?'+':'-';
xx = abs(xx);
conv[0] = (xx / 1000) % 10 + '0';
conv[1] = (xx / 100) % 10 + '0';
conv[2] = (xx / 10) % 10 + '0';
conv[3] = '.';
conv[4] = (xx) % 10 + '0';
conv[5] = 0;
return conv;
}
char *ftostr32(const float &x)
{
long xx = x * 100;
if (xx >= 0)
conv[0] = (xx / 10000) % 10 + '0';
else
conv[0] = '-';
xx = abs(xx);
conv[1] = (xx / 1000) % 10 + '0';
conv[2] = (xx / 100) % 10 + '0';
conv[3] = '.';
conv[4] = (xx / 10) % 10 + '0';
conv[5] = (xx) % 10 + '0';
conv[6] = 0;
return conv;
}
//// Convert float to rj string with 123.45 format
char *ftostr32ns(const float &x) {
long xx = abs(x);
conv[0] = xx >= 10000 ? (xx / 10000) % 10 + '0' : ' ';
conv[1] = xx >= 1000 ? (xx / 1000) % 10 + '0' : ' ';
conv[2] = xx >= 100 ? (xx / 100) % 10 + '0' : '0';
conv[3] = '.';
conv[4] = (xx / 10) % 10 + '0';
conv[5] = xx % 10 + '0';
return conv;
}
// Convert float to string with 1.234 format
char *ftostr43(const float &x, uint8_t offset)
{
const size_t maxOffset = sizeof(conv)/sizeof(conv[0]) - 6;
if (offset>maxOffset) offset = maxOffset;
long xx = x * 1000;
if (xx >= 0)
conv[offset] = (xx / 1000) % 10 + '0';
else
conv[offset] = '-';
xx = abs(xx);
conv[offset + 1] = '.';
conv[offset + 2] = (xx / 100) % 10 + '0';
conv[offset + 3] = (xx / 10) % 10 + '0';
conv[offset + 4] = (xx) % 10 + '0';
conv[offset + 5] = 0;
return conv;
}
//Float to string with 1.23 format
char *ftostr12ns(const float &x)
{
long xx = x * 100;
xx = abs(xx);
conv[0] = (xx / 100) % 10 + '0';
conv[1] = '.';
conv[2] = (xx / 10) % 10 + '0';
conv[3] = (xx) % 10 + '0';
conv[4] = 0;
return conv;
}
//Float to string with 1.234 format
char *ftostr13ns(const float &x)
{
long xx = x * 1000;
if (xx >= 0)
conv[0] = ' ';
else
conv[0] = '-';
xx = abs(xx);
conv[1] = (xx / 1000) % 10 + '0';
conv[2] = '.';
conv[3] = (xx / 100) % 10 + '0';
conv[4] = (xx / 10) % 10 + '0';
conv[5] = (xx) % 10 + '0';
conv[6] = 0;
return conv;
}
// convert float to space-padded string with -_23.4_ format
char *ftostr32sp(const float &x) {
long xx = abs(x * 100);
uint8_t dig;
if (x < 0) { // negative val = -_0
conv[0] = '-';
dig = (xx / 1000) % 10;
conv[1] = dig ? '0' + dig : ' ';
}
else { // positive val = __0
dig = (xx / 10000) % 10;
if (dig) {
conv[0] = '0' + dig;
conv[1] = '0' + (xx / 1000) % 10;
}
else {
conv[0] = ' ';
dig = (xx / 1000) % 10;
conv[1] = dig ? '0' + dig : ' ';
}
}
conv[2] = '0' + (xx / 100) % 10; // lsd always
dig = xx % 10;
if (dig) { // 2 decimal places
conv[5] = '0' + dig;
conv[4] = '0' + (xx / 10) % 10;
conv[3] = '.';
}
else { // 1 or 0 decimal place
dig = (xx / 10) % 10;
if (dig) {
conv[4] = '0' + dig;
conv[3] = '.';
}
else {
conv[3] = conv[4] = ' ';
}
conv[5] = ' ';
}
conv[6] = '\0';
return conv;
}
char *itostr31(const int &xx)
{
conv[0] = (xx >= 0) ? '+' : '-';
conv[1] = (xx / 1000) % 10 + '0';
conv[2] = (xx / 100) % 10 + '0';
conv[3] = (xx / 10) % 10 + '0';
conv[4] = '.';
conv[5] = (xx) % 10 + '0';
conv[6] = 0;
return conv;
}
// Convert int to rj string with 123 or -12 format
char *itostr3(const int &x)
{
int xx = x;
if (xx < 0) {
conv[0] = '-';
xx = -xx;
} else if (xx >= 100)
conv[0] = (xx / 100) % 10 + '0';
else
conv[0] = ' ';
if (xx >= 10)
conv[1] = (xx / 10) % 10 + '0';
else
conv[1] = ' ';
conv[2] = (xx) % 10 + '0';
conv[3] = 0;
return conv;
}
// Convert int to lj string with 123 format
char *itostr3left(const int &xx)
{
if (xx >= 100)
{
conv[0] = (xx / 100) % 10 + '0';
conv[1] = (xx / 10) % 10 + '0';
conv[2] = (xx) % 10 + '0';
conv[3] = 0;
}
else if (xx >= 10)
{
conv[0] = (xx / 10) % 10 + '0';
conv[1] = (xx) % 10 + '0';
conv[2] = 0;
}
else
{
conv[0] = (xx) % 10 + '0';
conv[1] = 0;
}
return conv;
}
// Convert int to rj string with 1234 format
char *itostr4(const int &xx) {
conv[0] = xx >= 1000 ? (xx / 1000) % 10 + '0' : ' ';
conv[1] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
conv[2] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
conv[3] = xx % 10 + '0';
conv[4] = 0;
return conv;
}
// Convert float to rj string with 12345 format
char *ftostr5(const float &x) {
long xx = abs(x);
conv[0] = xx >= 10000 ? (xx / 10000) % 10 + '0' : ' ';
conv[1] = xx >= 1000 ? (xx / 1000) % 10 + '0' : ' ';
conv[2] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
conv[3] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
conv[4] = xx % 10 + '0';
conv[5] = 0;
return conv;
}
// Convert float to string with +1234.5 format
char *ftostr51(const float &x)
{
long xx = x * 10;
conv[0] = (xx >= 0) ? '+' : '-';
xx = abs(xx);
conv[1] = (xx / 10000) % 10 + '0';
conv[2] = (xx / 1000) % 10 + '0';
conv[3] = (xx / 100) % 10 + '0';
conv[4] = (xx / 10) % 10 + '0';
conv[5] = '.';
conv[6] = (xx) % 10 + '0';
conv[7] = 0;
return conv;
}
// Convert float to string with +123.45 format
char *ftostr52(const float &x)
{
long xx = x * 100;
conv[0] = (xx >= 0) ? '+' : '-';
xx = abs(xx);
conv[1] = (xx / 10000) % 10 + '0';
conv[2] = (xx / 1000) % 10 + '0';
conv[3] = (xx / 100) % 10 + '0';
conv[4] = '.';
conv[5] = (xx / 10) % 10 + '0';
conv[6] = (xx) % 10 + '0';
conv[7] = 0;
return conv;
}

View File

@ -1,28 +0,0 @@
//conv2str.h - Float conversion utilities
#ifndef _CONV2STR_H
#define _CONV2STR_H
#include <inttypes.h>
char *itostr2(const uint8_t &x);
char *itostr31(const int &xx);
char *itostr3(const int &xx);
char *itostr3left(const int &xx);
char *itostr4(const int &xx);
char *ftostr3(const float &x);
char *ftostr31ns(const float &x); // float to string without sign character
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *ftostr32ns(const float &x);
char *ftostr43(const float &x, uint8_t offset = 0);
char *ftostr12ns(const float &x);
char *ftostr13ns(const float &x);
char *ftostr32sp(const float &x); // remove zero-padding from ftostr32
char *ftostr5(const float &x);
char *ftostr51(const float &x);
char *ftostr52(const float &x);
#endif //_CONV2STR_H

View File

@ -8,91 +8,69 @@
#include <avr/eeprom.h>
#include <stdint.h>
#include "language.h"
#if 0
template <typename T>
static T eeprom_read(T *address);
template<>
char eeprom_read<char>(char *address)
{
return eeprom_read_byte(reinterpret_cast<uint8_t*>(address));
}
#endif
template <typename T>
static void eeprom_write(T *address, T value);
template<>
void eeprom_write<char>(char *addres, char value)
{
eeprom_write_byte(reinterpret_cast<uint8_t*>(addres), static_cast<uint8_t>(value));
}
template <typename T>
static bool eeprom_is_uninitialized(T *address);
template <>
bool eeprom_is_uninitialized<char>(char *address)
{
return (0xff == eeprom_read_byte(reinterpret_cast<uint8_t*>(address)));
}
bool eeprom_is_sheet_initialized(uint8_t sheet_num)
{
return (0xffff != eeprom_read_word(reinterpret_cast<uint16_t*>(&(EEPROM_Sheets_base->
s[sheet_num].z_offset))));
}
void eeprom_init()
{
if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0);
if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0);
if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, 0);
if (eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_FERROR_COUNT, 0);
if (eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_POWER_COUNT_TOT, 0);
if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT, 0);
if (eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, 0);
if (eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) == 0xffff) eeprom_write_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_POWER_COUNT, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_FERROR_COUNT, 0);
eeprom_init_default_word((uint16_t*)EEPROM_POWER_COUNT_TOT, 0);
eeprom_init_default_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT, 0);
eeprom_init_default_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT, 0);
eeprom_init_default_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, 0);
if (eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_FAIL_TOT, 0);
if (eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0);
if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0);
if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0);
eeprom_init_default_word((uint16_t*)EEPROM_MMU_FAIL_TOT, 0);
eeprom_init_default_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_MMU_FAIL, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, 0);
eeprom_init_default_dword((uint32_t*)EEPROM_MMU_MATERIAL_CHANGES, 0);
if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == EEPROM_EMPTY_VALUE)
{
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0);
eeprom_update_byte_notify(&(EEPROM_Sheets_base->active_sheet), 0);
// When upgrading from version older version (before multiple sheets were implemented in v3.8.0)
// Sheet 1 uses the previous Live adjust Z (@EEPROM_BABYSTEP_Z)
int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z);
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[0].z_offset)), last_babystep);
}
for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); ++i)
{
bool is_uninitialized = true;
for (uint_least8_t j = 0; j < (sizeof(Sheet::name)/sizeof(Sheet::name[0])); ++j)
{
if (!eeprom_is_uninitialized(&(EEPROM_Sheets_base->s[i].name[j]))) is_uninitialized = false;
}
if(is_uninitialized)
{
SheetName sheetName;
eeprom_default_sheet_name(i,sheetName);
for (uint_least8_t a = 0; a < sizeof(Sheet::name); ++a){
eeprom_write(&(EEPROM_Sheets_base->s[i].name[a]), sheetName.c[a]);
}
}
// initialize the sheet names in eeprom
for (uint_least8_t i = 0; i < (sizeof(Sheets::s)/sizeof(Sheets::s[0])); i++) {
SheetName sheetName;
eeprom_default_sheet_name(i, sheetName);
eeprom_init_default_block(EEPROM_Sheets_base->s[i].name, (sizeof(Sheet::name)/sizeof(Sheet::name[0])), sheetName.c);
}
if(!eeprom_is_sheet_initialized(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))))
{
eeprom_switch_to_next_sheet();
}
check_babystep();
// initialize custom mendel name in eeprom
if (eeprom_read_byte((uint8_t*)EEPROM_CUSTOM_MENDEL_NAME) == EEPROM_EMPTY_VALUE) {
//SERIAL_ECHOLN("Init Custom Mendel Name");
eeprom_update_block_notify(CUSTOM_MENDEL_NAME, (uint8_t*)EEPROM_CUSTOM_MENDEL_NAME, sizeof(CUSTOM_MENDEL_NAME));
} //else SERIAL_ECHOLN("Found Custom Mendel Name");
#ifdef PINDA_TEMP_COMP
eeprom_init_default_byte((uint8_t*)EEPROM_PINDA_TEMP_COMPENSATION, 0);
#endif //PINDA_TEMP_COMP
eeprom_init_default_dword((uint32_t*)EEPROM_JOB_ID, 0);
eeprom_init_default_dword((uint32_t*)EEPROM_TOTALTIME, 0);
eeprom_init_default_dword((uint32_t*)EEPROM_FILAMENTUSED, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_HEAT_BED_ON_LOAD_FILAMENT, 1);
}
void eeprom_adjust_bed_reset() {
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_VALID, 1);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_LEFT, 0);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_RIGHT, 0);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_FRONT, 0);
eeprom_update_byte_notify((uint8_t*)EEPROM_BED_CORRECTION_REAR, 0);
}
//! @brief Get default sheet name for index
@ -103,10 +81,10 @@ void eeprom_init()
//! | 1 | Smooth2 |
//! | 2 | Textur1 |
//! | 3 | Textur2 |
//! | 4 | Custom1 |
//! | 5 | Custom2 |
//! | 6 | Custom3 |
//! | 7 | Custom4 |
//! | 4 | Satin |
//! | 5 | NylonPA |
//! | 6 | Custom1 |
//! | 7 | Custom2 |
//!
//! @param[in] index
//! @param[out] sheetName
@ -122,42 +100,23 @@ void eeprom_default_sheet_name(uint8_t index, SheetName &sheetName)
{
strcpy_P(sheetName.c, PSTR("Textur"));
}
else if (index < 5)
{
strcpy_P(sheetName.c, PSTR("Satin "));
}
else if (index < 6)
{
strcpy_P(sheetName.c, PSTR("NylonPA"));
}
else
{
strcpy_P(sheetName.c, PSTR("Custom"));
}
switch (index)
if (index <4 || index >5)
{
case 0:
sheetName.c[6] = '1';
break;
case 1:
sheetName.c[6] = '2';
break;
case 2:
sheetName.c[6] = '1';
break;
case 3:
sheetName.c[6] = '2';
break;
case 4:
sheetName.c[6] = '1';
break;
case 5:
sheetName.c[6] = '2';
break;
case 6:
sheetName.c[6] = '3';
break;
case 7:
sheetName.c[6] = '4';
break;
default:
break;
sheetName.c[6] = '0' + ((index % 2)+1);
sheetName.c[7] = '\0';
}
sheetName.c[7] = '\0';
}
//! @brief Get next initialized sheet
@ -178,10 +137,267 @@ int8_t eeprom_next_initialized_sheet(int8_t sheet)
return -1;
}
#ifdef DEBUG_EEPROM_CHANGES
static void eeprom_byte_notify(uint8_t *dst, uint8_t previous_value, uint8_t value, bool write) {
printf_P(PSTR("EEPROMChng b %s %u %d -> %d\n"), write ? "write":"", dst , previous_value, value);
}
static void eeprom_word_notify(uint16_t *dst, uint16_t previous_value, uint16_t value, bool write) {
printf_P(PSTR("EEPROMChng w %s %u %u -> %u\n"), write ? "write":"", dst , previous_value, value);
}
static void eeprom_dword_notify(uint32_t *dst, uint32_t previous_value, uint32_t value, bool write) {
printf_P(PSTR("EEPROMChng d %s %u %x -> %x\n"), write ? "write":"", reinterpret_cast<const uint16_t>(dst) , previous_value, value);
}
static void eeprom_float_notify(float *dst, float previous_value, float value, bool write) {
printf_P(PSTR("EEPROMChng f %s %u %f -> %f\n"), write ? "write":"", reinterpret_cast<const uint16_t>(dst) , previous_value, value);
}
static void eeprom_block_notify(void *dst, const uint8_t *previous_values, const uint8_t *values, size_t size, bool write) {
for(size_t i = 0; i < size; ++i){
if (previous_values[i] != values[i] || write) {
printf_P(PSTR("EEPROMChng bl %s %u %x -> %x\n"), write ? "write":"", reinterpret_cast<const uint16_t>(dst) + i, previous_values[i], values[i]);
}
}
}
#endif //DEBUG_EEPROM_CHANGES
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_byte_notify(uint8_t *dst, uint8_t value){
#else
void eeprom_write_byte_notify(uint8_t *dst, uint8_t value, bool active){
if (active) {
uint8_t previous_value = eeprom_read_byte(dst);
eeprom_byte_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_byte(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_byte_notify(uint8_t *dst, uint8_t value){
#else
void eeprom_update_byte_notify(uint8_t *dst, uint8_t value, bool active){
if (active) {
uint8_t previous_value = eeprom_read_byte(dst);
if (previous_value != value) {
eeprom_byte_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_byte(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_word_notify(uint16_t *dst, uint16_t value){
#else
void eeprom_write_word_notify(uint16_t *dst, uint16_t value, bool active){
if (active) {
uint16_t previous_value = eeprom_read_word(dst);
eeprom_word_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_word(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_word_notify(uint16_t *dst, uint16_t value){
#else
void eeprom_update_word_notify(uint16_t *dst, uint16_t value, bool active){
if (active) {
uint16_t previous_value = eeprom_read_word(dst);
if (previous_value != value) {
eeprom_word_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_word(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_dword_notify(uint32_t *dst, uint32_t value){
#else
void eeprom_write_dword_notify(uint32_t *dst, uint32_t value, bool active){
if (active) {
uint32_t previous_value = eeprom_read_dword(dst);
eeprom_dword_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_dword(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_dword_notify(uint32_t *dst, uint32_t value){
#else
void eeprom_update_dword_notify(uint32_t *dst, uint32_t value, bool active){
if (active) {
uint32_t previous_value = eeprom_read_dword(dst);
if (previous_value != value) {
eeprom_dword_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_dword(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_float_notify(float *dst, float value){
#else
void eeprom_write_float_notify(float *dst, float value, bool active){
if (active) {
float previous_value = eeprom_read_float(dst);
eeprom_float_notify(dst, previous_value, value, true);
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_write_float(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_float_notify(float *dst, float value){
#else
void eeprom_update_float_notify(float *dst, float value, bool active){
if (active) {
float previous_value = eeprom_read_float(dst);
if (previous_value != value) {
eeprom_float_notify(dst, previous_value, value, false);
}
}
#endif //DEBUG_EEPROM_CHANGES
eeprom_update_float(dst, value);
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_write_block_notify(const void *__src, void *__dst, size_t __n){
eeprom_write_block(__src, __dst, __n);
#else
void eeprom_write_block_notify(const void *__src, void *__dst, size_t __n, bool active){
if (active) {
uint8_t previous_values[__n];
uint8_t new_values[__n];
eeprom_read_block(previous_values, __dst, __n);
eeprom_write_block(__src, __dst, __n);
eeprom_read_block(new_values, __dst, __n);
eeprom_block_notify(__dst, previous_values, new_values, __n, true);
}
#endif //DEBUG_EEPROM_CHANGES
}
#ifndef DEBUG_EEPROM_CHANGES
void eeprom_update_block_notify(const void *__src, void *__dst, size_t __n){
eeprom_update_block(__src, __dst, __n);
#else
void eeprom_update_block_notify(const void *__src, void *__dst, size_t __n, bool active){
if (active) {
uint8_t previous_values[__n];
uint8_t new_values[__n];
eeprom_read_block(previous_values, __dst, __n);
eeprom_update_block(__src, __dst, __n);
eeprom_read_block(new_values, __dst, __n);
eeprom_block_notify(__dst, previous_values, new_values, __n, false);
}
#endif //DEBUG_EEPROM_CHANGES
}
void eeprom_switch_to_next_sheet()
{
int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
sheet = eeprom_next_initialized_sheet(sheet);
if (sheet >= 0) eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet);
if (sheet >= 0) eeprom_update_byte_notify(&(EEPROM_Sheets_base->active_sheet), sheet);
}
bool __attribute__((noinline)) eeprom_is_sheet_initialized(uint8_t sheet_num) {
return (eeprom_read_word(reinterpret_cast<uint16_t*>(&(EEPROM_Sheets_base->s[sheet_num].z_offset))) != EEPROM_EMPTY_VALUE16);
}
bool __attribute__((noinline)) eeprom_is_initialized_block(const void *__p, size_t __n) {
const uint8_t *p = (const uint8_t*)__p;
while (__n--) {
if (eeprom_read_byte(p++) != EEPROM_EMPTY_VALUE)
return true;
}
return false;
}
void eeprom_update_block_P(const void *__src, void *__dst, size_t __n) {
const uint8_t *src = (const uint8_t*)__src;
uint8_t *dst = (uint8_t*)__dst;
while (__n--) {
eeprom_update_byte_notify(dst++, pgm_read_byte(src++));
}
}
void eeprom_toggle(uint8_t *__p) {
eeprom_write_byte_notify(__p, !eeprom_read_byte(__p));
}
void __attribute__((noinline)) eeprom_increment_byte(uint8_t *__p) {
eeprom_write_byte_notify(__p, eeprom_read_byte(__p) + 1);
}
void __attribute__((noinline)) eeprom_increment_word(uint16_t *__p) {
eeprom_write_word_notify(__p, eeprom_read_word(__p) + 1);
}
void __attribute__((noinline)) eeprom_increment_dword(uint32_t *__p) {
eeprom_write_dword_notify(__p, eeprom_read_dword(__p) + 1);
}
void __attribute__((noinline)) eeprom_add_byte(uint8_t *__p, uint8_t add) {
eeprom_write_byte_notify(__p, eeprom_read_byte(__p) + add);
}
void __attribute__((noinline)) eeprom_add_word(uint16_t *__p, uint16_t add) {
eeprom_write_word_notify(__p, eeprom_read_word(__p) + add);
}
void __attribute__((noinline)) eeprom_add_dword(uint32_t *__p, uint32_t add) {
eeprom_write_dword_notify(__p, eeprom_read_dword(__p) + add);
}
uint8_t __attribute__((noinline)) eeprom_init_default_byte(uint8_t *__p, uint8_t def) {
uint8_t val = eeprom_read_byte(__p);
if (val == EEPROM_EMPTY_VALUE) {
eeprom_write_byte_notify(__p, def);
return def;
}
return val;
}
uint16_t __attribute__((noinline)) eeprom_init_default_word(uint16_t *__p, uint16_t def) {
uint16_t val = eeprom_read_word(__p);
if (val == EEPROM_EMPTY_VALUE16) {
eeprom_write_word_notify(__p, def);
return def;
}
return val;
}
uint32_t __attribute__((noinline)) eeprom_init_default_dword(uint32_t *__p, uint32_t def) {
uint32_t val = eeprom_read_dword(__p);
if (val == EEPROM_EMPTY_VALUE32) {
eeprom_write_dword_notify(__p, def);
return def;
}
return val;
}
void __attribute__((noinline)) eeprom_init_default_float(float *__p, float def) {
if (eeprom_read_dword((uint32_t*)__p) == EEPROM_EMPTY_VALUE32)
eeprom_write_float_notify(__p, def);
}
void __attribute__((noinline)) eeprom_init_default_block(void *__p, size_t __n, const void *def) {
if (!eeprom_is_initialized_block(__p, __n))
eeprom_update_block_notify(def, __p, __n);
}
void __attribute__((noinline)) eeprom_init_default_block_P(void *__p, size_t __n, const void *def) {
if (!eeprom_is_initialized_block(__p, __n))
eeprom_update_block_P(def, __p, __n);
}

File diff suppressed because it is too large Load Diff

362
Firmware/fancheck.cpp Executable file
View File

@ -0,0 +1,362 @@
// fan control and check
#include "fancheck.h"
#include "ultralcd.h"
#include "sound.h"
#include "messages.h"
#include "temperature.h"
#include "stepper.h"
#include "stopwatch.h"
#define FAN_CHECK_PERIOD 5000 //5s
#define FAN_CHECK_DURATION 100 //100ms
//Macro for print fan speed
#define FAN_PULSE_WIDTH_LIMIT ((fanSpeed > 100) ? 3 : 4) //time in ms
#ifdef FANCHECK
volatile uint8_t fan_check_error = EFCE_OK;
#endif
#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
static uint32_t t_fan_rising_edge;
#endif // #if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1)
#ifdef EXTRUDER_ALTFAN_DETECT
static struct
{
uint8_t isAltfan : 1;
uint8_t altfanOverride : 1;
} altfanStatus;
#endif //EXTRUDER_ALTFAN_DETECT
unsigned long extruder_autofan_last_check = _millis();
bool fan_measuring = false;
static uint8_t fanState = 0;
#endif
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1)
#if defined(FAN_PIN) && FAN_PIN > -1
#if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set EXTRUDER_0_AUTO_FAN_PIN equal to FAN_PIN"
#endif
#endif
void setExtruderAutoFanState(uint8_t state)
{
//If bit 1 is set (0x02), then the hotend fan speed won't be adjusted according to temperature. Useful for forcing
//the fan to either On or Off during certain tests/errors.
fanState = state;
newFanSpeed = 0;
if (fanState & 0x01)
{
#ifdef EXTRUDER_ALTFAN_DETECT
if (altfanStatus.isAltfan && !altfanStatus.altfanOverride) newFanSpeed = EXTRUDER_ALTFAN_SPEED_SILENT;
else newFanSpeed = EXTRUDER_AUTO_FAN_SPEED;
#else //EXTRUDER_ALTFAN_DETECT
newFanSpeed = EXTRUDER_AUTO_FAN_SPEED;
#endif //EXTRUDER_ALTFAN_DETECT
}
timer4_set_fan0(newFanSpeed);
}
#if (defined(FANCHECK) && (((defined(TACH_0) && (TACH_0 >-1)) || (defined(TACH_1) && (TACH_1 > -1)))))
void countFanSpeed()
{
//SERIAL_ECHOPGM("edge counter 1:"); MYSERIAL.println(fan_edge_counter[1]);
fan_speed[0] = (fan_edge_counter[0] * (float(250) / (_millis() - extruder_autofan_last_check)));
fan_speed[1] = (fan_edge_counter[1] * (float(250) / (_millis() - extruder_autofan_last_check)));
/*SERIAL_ECHOPGM("time interval: "); MYSERIAL.println(_millis() - extruder_autofan_last_check);
SERIAL_ECHOPGM("hotend fan speed:"); MYSERIAL.print(fan_speed[0]); SERIAL_ECHOPGM("; edge counter:"); MYSERIAL.println(fan_edge_counter[0]);
SERIAL_ECHOPGM("print fan speed:"); MYSERIAL.print(fan_speed[1]); SERIAL_ECHOPGM("; edge counter:"); MYSERIAL.println(fan_edge_counter[1]);
SERIAL_ECHOLNPGM(" ");*/
fan_edge_counter[0] = 0;
fan_edge_counter[1] = 0;
}
//! Prints serialMsg to serial port, displays lcdMsg onto the LCD and beeps.
//! Extracted from fanSpeedError to save some space.
//! @param serialMsg pointer into PROGMEM, this text will be printed to the serial port
//! @param lcdMsg pointer into PROGMEM, this text will be printed onto the LCD
static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){
SERIAL_ECHOLNRPGM(serialMsg);
if (get_message_level() == 0) {
Sound_MakeCustom(200,0,true);
LCD_ALERTMESSAGERPGM(lcdMsg);
}
}
void fanSpeedError(unsigned char _fan) {
if (fan_check_error == EFCE_REPORTED) return;
fan_check_error = EFCE_REPORTED;
if (printJobOngoing()) {
// A print is ongoing, pause the print normally
if(!printingIsPaused()) {
if (usb_timer.running())
lcd_pause_usb_print();
else
lcd_pause_print();
}
}
else {
// Nothing is going on, but still turn off heaters and report the error
setTargetHotend(0);
heating_status = HeatingStatus::NO_HEATING;
}
switch (_fan) {
case 0: // extracting the same code from case 0 and case 1 into a function saves 72B
fanSpeedErrorBeep(PSTR("Hotend fan speed is lower than expected"), MSG_FANCHECK_HOTEND);
break;
case 1:
fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), MSG_FANCHECK_PRINT);
break;
}
}
void checkFanSpeed()
{
uint8_t max_fan_errors[2];
#ifdef FAN_SOFT_PWM
max_fan_errors[1] = 3; // 15 seconds (Print fan)
max_fan_errors[0] = 2; // 10 seconds (Hotend fan)
#else //FAN_SOFT_PWM
max_fan_errors[1] = 15; // 15 seconds (Print fan)
max_fan_errors[0] = 5; // 5 seconds (Hotend fan)
#endif //FAN_SOFT_PWM
if(fans_check_enabled)
fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0);
static uint8_t fan_speed_errors[2] = { 0,0 };
#if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 >-1))
if ((fan_speed[0] < 20) && (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)){ fan_speed_errors[0]++;}
else fan_speed_errors[0] = 0;
#endif
#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
if ((fan_speed[1] < 5) && ((blocks_queued() ? block_buffer[block_buffer_tail].fan_speed : fanSpeed) > MIN_PRINT_FAN_SPEED)) fan_speed_errors[1]++;
else fan_speed_errors[1] = 0;
#endif
// drop the fan_check_error flag when both fans are ok
if( fan_speed_errors[0] == 0 && fan_speed_errors[1] == 0 && fan_check_error == EFCE_REPORTED){
// we may even send some info to the LCD from here
fan_check_error = EFCE_FIXED;
}
if ((fan_check_error == EFCE_FIXED) && !printer_active()){
fan_check_error = EFCE_OK; //if the issue is fixed while the printer is doing nothing, reenable processing immediately.
lcd_reset_alert_level(); //for another fan speed error
lcd_setstatuspgm(MSG_WELCOME); // Reset the status line message to visually show the error is gone
}
if (fans_check_enabled && (fan_check_error != EFCE_REPORTED))
{
for (uint8_t fan = 0; fan < 2; fan++)
{
if (fan_speed_errors[fan] > max_fan_errors[fan])
{
fan_speed_errors[fan] = 0;
fanSpeedError(fan);
}
}
}
}
#endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1)
#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
void setup_fan_interrupt() {
//INT7
DDRE &= ~(1 << 7); //input pin
PORTE &= ~(1 << 7); //no internal pull-up
//start with sensing rising edge
EICRB &= ~(1 << 6);
EICRB |= (1 << 7);
//enable INT7 interrupt
EIMSK |= (1 << 7);
}
// The fan interrupt is triggered at maximum 325Hz (may be a bit more due to component tollerances),
// and it takes 4.24 us to process (the interrupt invocation overhead not taken into account).
ISR(INT7_vect) {
//measuring speed now works for fanSpeed > 18 (approximately), which is sufficient because MIN_PRINT_FAN_SPEED is higher
#ifdef FAN_SOFT_PWM
if (!fan_measuring || (fanSpeedSoftPwm < MIN_PRINT_FAN_SPEED)) return;
#else //FAN_SOFT_PWM
if (fanSpeed < MIN_PRINT_FAN_SPEED) return;
#endif //FAN_SOFT_PWM
if ((1 << 6) & EICRB) { //interrupt was triggered by rising edge
t_fan_rising_edge = millis_nc();
}
else { //interrupt was triggered by falling edge
if ((millis_nc() - t_fan_rising_edge) >= FAN_PULSE_WIDTH_LIMIT) {//this pulse was from sensor and not from pwm
fan_edge_counter[1] += 2; //we are currently counting all edges so lets count two edges for one pulse
}
}
EICRB ^= (1 << 6); //change edge
}
#endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
#ifdef EXTRUDER_ALTFAN_DETECT
ISR(INT6_vect) {
fan_edge_counter[0]++;
}
bool extruder_altfan_detect()
{
// override isAltFan setting for detection
altfanStatus.isAltfan = 0;
// During initialisation, use the EEPROM value
altfanStatus.altfanOverride = eeprom_init_default_byte((uint8_t*)EEPROM_ALTFAN_OVERRIDE, 0);
setExtruderAutoFanState(3);
SET_INPUT(TACH_0);
CRITICAL_SECTION_START;
EICRB &= ~(1 << ISC61);
EICRB |= (1 << ISC60);
EIMSK |= (1 << INT6);
fan_edge_counter[0] = 0;
CRITICAL_SECTION_END;
extruder_autofan_last_check = _millis();
_delay(1000);
EIMSK &= ~(1 << INT6);
countFanSpeed();
// restore fan state
altfanStatus.isAltfan = fan_speed[0] > 100;
setExtruderAutoFanState(1);
return altfanStatus.isAltfan;
}
void altfanOverride_toggle()
{
altfanStatus.altfanOverride = !altfanStatus.altfanOverride;
eeprom_update_byte_notify((uint8_t *)EEPROM_ALTFAN_OVERRIDE, altfanStatus.altfanOverride);
}
bool altfanOverride_get()
{
return altfanStatus.altfanOverride;
}
#endif //EXTRUDER_ALTFAN_DETECT
void checkExtruderAutoFans()
{
#if defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1
if (!(fanState & 0x02))
{
fanState &= ~1;
fanState |= current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE;
fanState |= get_temp_error();
}
setExtruderAutoFanState(fanState);
#endif
}
#endif // any extruder auto fan pins set
#if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1))
void readFanTach() {
static bool fan_state[2];
#ifdef FAN_SOFT_PWM
if (READ(TACH_0) != fan_state[0]) {
if(fan_measuring) fan_edge_counter[0] ++;
fan_state[0] = !fan_state[0];
}
#else //FAN_SOFT_PWM
if (READ(TACH_0) != fan_state[0]) {
fan_edge_counter[0] ++;
fan_state[0] = !fan_state[0];
}
#endif
//if (READ(TACH_1) != fan_state[1]) {
// fan_edge_counter[1] ++;
// fan_state[1] = !fan_state[1];
//}
}
#endif //TACH_0
void checkFans()
{
#ifndef DEBUG_DISABLE_FANCHECK
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1)
#ifdef FAN_SOFT_PWM
#ifdef FANCHECK
if ((_millis() - extruder_autofan_last_check > FAN_CHECK_PERIOD) && (!fan_measuring)) {
extruder_autofan_last_check = _millis();
fanSpeedBckp = fanSpeedSoftPwm;
if (fanSpeedSoftPwm >= MIN_PRINT_FAN_SPEED) { //if we are in rage where we are doing fan check, set full PWM range for a short time to measure fan RPM by reading tacho signal without modulation by PWM signal
// printf_P(PSTR("fanSpeedSoftPwm 1: %d\n"), fanSpeedSoftPwm);
fanSpeedSoftPwm = 255;
}
fan_measuring = true;
}
if ((_millis() - extruder_autofan_last_check > FAN_CHECK_DURATION) && (fan_measuring)) {
countFanSpeed();
checkFanSpeed();
//printf_P(PSTR("fanSpeedSoftPwm 1: %d\n"), fanSpeedSoftPwm);
fanSpeedSoftPwm = fanSpeedBckp;
//printf_P(PSTR("fan PWM: %d; extr fanSpeed measured: %d; print fan speed measured: %d \n"), fanSpeedBckp, fan_speed[0], fan_speed[1]);
extruder_autofan_last_check = _millis();
fan_measuring = false;
}
#endif //FANCHECK
checkExtruderAutoFans();
#else //FAN_SOFT_PWM
if(_millis() - extruder_autofan_last_check > 1000) // only need to check fan state very infrequently
{
#if (defined(FANCHECK) && ((defined(TACH_0) && (TACH_0 >-1)) || (defined(TACH_1) && (TACH_1 > -1))))
countFanSpeed();
checkFanSpeed();
#endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1)
checkExtruderAutoFans();
extruder_autofan_last_check = _millis();
}
#endif //FAN_SOFT_PWM
#endif
#endif //DEBUG_DISABLE_FANCHECK
}
void resetFanCheck() {
fan_measuring = false;
extruder_autofan_last_check = _millis();
}
void hotendFanSetFullSpeed()
{
#ifdef EXTRUDER_ALTFAN_DETECT
altfanStatus.altfanOverride = 1; //full speed
#endif //EXTRUDER_ALTFAN_DETECT
resetFanCheck();
setExtruderAutoFanState(3);
SET_OUTPUT(FAN_PIN);
#ifdef FAN_SOFT_PWM
fanSpeedSoftPwm = 255;
#else //FAN_SOFT_PWM
analogWrite(FAN_PIN, 255);
#endif //FAN_SOFT_PWM
fanSpeed = 255;
}
void hotendDefaultAutoFanState()
{
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1)
#ifdef EXTRUDER_ALTFAN_DETECT
altfanStatus.altfanOverride = eeprom_read_byte((uint8_t*)EEPROM_ALTFAN_OVERRIDE);
#endif
resetFanCheck();
setExtruderAutoFanState(1);
#endif
}

42
Firmware/fancheck.h Executable file
View File

@ -0,0 +1,42 @@
// fan control and check
#pragma once
#include "Configuration.h"
#include "config.h"
#if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 > -1))
enum {
EFCE_OK = 0, //!< normal operation, both fans are ok
EFCE_FIXED, //!< previous fan error was fixed
EFCE_REPORTED //!< fan error detected and reported to LCD and serial
};
extern volatile uint8_t fan_check_error;
void readFanTach();
#endif //(defined(TACH_0))
#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
void setup_fan_interrupt();
#endif // (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
#ifdef EXTRUDER_ALTFAN_DETECT
extern bool extruder_altfan_detect();
extern void altfanOverride_toggle();
extern bool altfanOverride_get();
#endif //EXTRUDER_ALTFAN_DETECT
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1)
#ifdef FAN_SOFT_PWM
extern bool fan_measuring;
#endif //FAN_SOFT_PWM
extern unsigned long extruder_autofan_last_check;
void setExtruderAutoFanState(uint8_t state);
void checkExtruderAutoFans();
#endif
void checkFans();
void resetFanCheck(); // resets the fan measuring state
void hotendFanSetFullSpeed();
void hotendDefaultAutoFanState();

View File

@ -7,15 +7,8 @@
#define _FASTIO_ARDUINO_H
#include <avr/io.h>
#include "macros.h"
/*
utility functions
*/
#ifndef MASK
/// MASKING- returns \f$2^PIN\f$
#define MASK(PIN) (1 << PIN)
#endif
/*
magic I/O routines
@ -23,20 +16,20 @@
*/
/// Read a pin
#define _READ(IO) ((bool)(DIO ## IO ## _RPORT & MASK(DIO ## IO ## _PIN)))
#define _READ(IO) ((bool)(DIO ## IO ## _RPORT & _BV(DIO ## IO ## _PIN)))
/// write to a pin
// On some boards pins > 0x100 are used. These are not converted to atomic actions. An critical section is needed.
#define _WRITE_NC(IO, v) do { if (v) {DIO ## IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } else {DIO ## IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); }; } while (0)
#define _WRITE_NC(IO, v) do { if (v) {DIO ## IO ## _WPORT |= _BV(DIO ## IO ## _PIN); } else {DIO ## IO ## _WPORT &= ~_BV(DIO ## IO ## _PIN); }; } while (0)
#define _WRITE_C(IO, v) do { if (v) { \
CRITICAL_SECTION_START; \
{DIO ## IO ## _WPORT |= MASK(DIO ## IO ## _PIN); }\
{DIO ## IO ## _WPORT |= _BV(DIO ## IO ## _PIN); }\
CRITICAL_SECTION_END; \
}\
else {\
CRITICAL_SECTION_START; \
{DIO ## IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); }\
{DIO ## IO ## _WPORT &= ~_BV(DIO ## IO ## _PIN); }\
CRITICAL_SECTION_END; \
}\
}\
@ -45,20 +38,20 @@
#define _WRITE(IO, v) do { if (&(DIO ## IO ## _RPORT) >= (uint8_t *)0x100) {_WRITE_C(IO, v); } else {_WRITE_NC(IO, v); }; } while (0)
/// toggle a pin
#define _TOGGLE(IO) do {DIO ## IO ## _RPORT = MASK(DIO ## IO ## _PIN); } while (0)
#define _TOGGLE(IO) do {DIO ## IO ## _RPORT = _BV(DIO ## IO ## _PIN); } while (0)
/// set pin as input
#define _SET_INPUT(IO) do {DIO ## IO ## _DDR &= ~MASK(DIO ## IO ## _PIN); } while (0)
#define _SET_INPUT(IO) do {DIO ## IO ## _DDR &= ~_BV(DIO ## IO ## _PIN); } while (0)
/// set pin as output
#define _SET_OUTPUT(IO) do {DIO ## IO ## _DDR |= MASK(DIO ## IO ## _PIN); } while (0)
#define _SET_OUTPUT(IO) do {DIO ## IO ## _DDR |= _BV(DIO ## IO ## _PIN); } while (0)
/// check if pin is an input
#define _GET_INPUT(IO) ((DIO ## IO ## _DDR & MASK(DIO ## IO ## _PIN)) == 0)
#define _GET_INPUT(IO) ((DIO ## IO ## _DDR & _BV(DIO ## IO ## _PIN)) == 0)
/// check if pin is an output
#define _GET_OUTPUT(IO) ((DIO ## IO ## _DDR & MASK(DIO ## IO ## _PIN)) != 0)
#define _GET_OUTPUT(IO) ((DIO ## IO ## _DDR & _BV(DIO ## IO ## _PIN)) != 0)
/// check if pin is an timer
#define _GET_TIMER(IO) ((DIO ## IO ## _PWM)
#define _GET_TIMER(IO) (DIO ## IO ## _PWM)
// why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
@ -69,7 +62,7 @@
/// Write to a pin wrapper, non critical.
/// This macro is cheaper than WRITE(IO,v) on ports H,I,J,K,L, as _WRITE_C disables / enables interrupts
/// and stores the old CPU flags on the stack.
/// This macro should only be called, where it cannot be interrupted.
/// This macro should only be called, where it cannot be interrupted.
#define WRITE_NC(IO, v) _WRITE_NC(IO, v)
/// toggle a pin wrapper
@ -938,10 +931,10 @@ pins
#define TXD DIO1
// SPI
#define SCK DIO52
#define MISO DIO50
#define MOSI DIO51
#define SS DIO53
#define SCK 52
#define MISO 50
#define MOSI 51
#define SS 53
// TWI (I2C)
#define SCL DIO21
@ -2074,7 +2067,7 @@ pins
pins
*/
//#define AT90USBxx_TEENSYPP_ASSIGNMENTS // Use Teensy++ 2.0 assignments
//#define AT90USBxx_TEENSYPP_ASSIGNMENTS // Use Teensy++ 2.0 assignments
#ifndef AT90USBxx_TEENSYPP_ASSIGNMENTS // Use traditional Marlin pin assignments
#define DIO0_PIN PINA0
@ -2714,8 +2707,8 @@ pins
/*
AT90USB 51 50 49 48 47 46 45 44 10 11 12 13 14 15 16 17 35 36 37 38 39 40 41 42 25 26 27 28 29 30 31 32 33 34 43 09 18 19 01 02 61 60 59 58 57 56 55 54
Port A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7
AT90USB 51 50 49 48 47 46 45 44 10 11 12 13 14 15 16 17 35 36 37 38 39 40 41 42 25 26 27 28 29 30 31 32 33 34 43 09 18 19 01 02 61 60 59 58 57 56 55 54
Port A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7
Marlin 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
Teensy 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45
The pins 46 and 47 are not supported by Teensyduino, but are supported below.

View File

@ -4,126 +4,13 @@
//! @brief First layer (Z offset) calibration
#include "first_lay_cal.h"
#include "Configuration_prusa.h"
#include "language.h"
#include "Configuration_var.h"
#include "Marlin.h"
#include "mmu.h"
#include "messages.h"
#include "cmdqueue.h"
#include "mmu2.h"
#include <avr/pgmspace.h>
//! @brief Wait for preheat
void lay1cal_wait_preheat()
{
static const char cmd_preheat_0[] PROGMEM = "M107";
static const char cmd_preheat_1[] PROGMEM = "M190";
static const char cmd_preheat_2[] PROGMEM = "M109";
static const char cmd_preheat_4[] PROGMEM = "G28";
static const char cmd_preheat_5[] PROGMEM = "G92 E0.0";
const char * const preheat_cmd[] =
{
cmd_preheat_0,
cmd_preheat_1,
cmd_preheat_2,
_T(MSG_M117_V2_CALIBRATION),
cmd_preheat_4,
cmd_preheat_5,
};
for (uint8_t i = 0; i < (sizeof(preheat_cmd)/sizeof(preheat_cmd[0])); ++i)
{
enquecommand_P(preheat_cmd[i]);
}
}
//! @brief Load filament
//! @param cmd_buffer character buffer needed to format gcodes
//! @param filament filament to use (applies for MMU only)
void lay1cal_load_filament(char *cmd_buffer, uint8_t filament)
{
if (mmu_enabled)
{
enquecommand_P(PSTR("M83"));
enquecommand_P(PSTR("G1 Y-3.0 F1000.0"));
enquecommand_P(PSTR("G1 Z0.4 F1000.0"));
sprintf_P(cmd_buffer, PSTR("T%d"), filament);
enquecommand(cmd_buffer);
}
}
//! @brief Print intro line
void lay1cal_intro_line()
{
static const char cmd_intro_mmu_3[] PROGMEM = "G1 X55.0 E32.0 F1073.0";
static const char cmd_intro_mmu_4[] PROGMEM = "G1 X5.0 E32.0 F1800.0";
static const char cmd_intro_mmu_5[] PROGMEM = "G1 X55.0 E8.0 F2000.0";
static const char cmd_intro_mmu_6[] PROGMEM = "G1 Z0.3 F1000.0";
static const char cmd_intro_mmu_7[] PROGMEM = "G92 E0.0";
static const char cmd_intro_mmu_8[] PROGMEM = "G1 X240.0 E25.0 F2200.0";
static const char cmd_intro_mmu_9[] PROGMEM = "G1 Y-2.0 F1000.0";
static const char cmd_intro_mmu_10[] PROGMEM = "G1 X55.0 E25 F1400.0";
static const char cmd_intro_mmu_11[] PROGMEM = "G1 Z0.20 F1000.0";
static const char cmd_intro_mmu_12[] PROGMEM = "G1 X5.0 E4.0 F1000.0";
static const char * const intro_mmu_cmd[] PROGMEM =
{
cmd_intro_mmu_3,
cmd_intro_mmu_4,
cmd_intro_mmu_5,
cmd_intro_mmu_6,
cmd_intro_mmu_7,
cmd_intro_mmu_8,
cmd_intro_mmu_9,
cmd_intro_mmu_10,
cmd_intro_mmu_11,
cmd_intro_mmu_12,
};
if (mmu_enabled)
{
for (uint8_t i = 0; i < (sizeof(intro_mmu_cmd)/sizeof(intro_mmu_cmd[0])); ++i)
{
enquecommand_P(static_cast<char*>(pgm_read_ptr(&intro_mmu_cmd[i])));
}
}
else
{
enquecommand_P(PSTR("G1 X60.0 E9.0 F1000.0"));
enquecommand_P(PSTR("G1 X100.0 E12.5 F1000.0"));
}
}
//! @brief Setup for printing meander
void lay1cal_before_meander()
{
static const char cmd_pre_meander_0[] PROGMEM = "G92 E0.0";
static const char cmd_pre_meander_1[] PROGMEM = "G21"; //set units to millimeters TODO unsupported command
static const char cmd_pre_meander_2[] PROGMEM = "G90"; //use absolute coordinates
static const char cmd_pre_meander_3[] PROGMEM = "M83"; //use relative distances for extrusion TODO: duplicate
static const char cmd_pre_meander_4[] PROGMEM = "G1 E-1.50000 F2100.00000";
static const char cmd_pre_meander_5[] PROGMEM = "G1 Z5 F7200.000";
static const char cmd_pre_meander_6[] PROGMEM = "M204 S1000"; //set acceleration
static const char cmd_pre_meander_7[] PROGMEM = "G1 F4000";
static const char * const cmd_pre_meander[] PROGMEM =
{
cmd_pre_meander_0,
cmd_pre_meander_1,
cmd_pre_meander_2,
cmd_pre_meander_3,
cmd_pre_meander_4,
cmd_pre_meander_5,
cmd_pre_meander_6,
cmd_pre_meander_7,
};
for (uint8_t i = 0; i < (sizeof(cmd_pre_meander)/sizeof(cmd_pre_meander[0])); ++i)
{
enquecommand_P(static_cast<char*>(pgm_read_ptr(&cmd_pre_meander[i])));
}
}
#include <math.h>
//! @brief Count extrude length
//!
@ -131,83 +18,247 @@ void lay1cal_before_meander()
//! @param extrusion_width extrusion width in mm
//! @param extrusion_length extrusion length in mm
//! @return filament length in mm which needs to be extruded to form line
static constexpr float count_e(float layer_height, float extrusion_width, float extrusion_length)
static constexpr float __attribute__((noinline)) count_e(float layer_height, float extrusion_width, float extrusion_length, float filament_diameter=1.75f)
{
return (extrusion_length * layer_height * extrusion_width / (M_PI * pow(1.75, 2) / 4));
return (extrusion_length * ((M_PI * pow(layer_height, 2)) / 4 + layer_height * (extrusion_width - layer_height))) / ((M_PI * pow(filament_diameter, 2)) / 4);
}
static const float width = 0.4; //!< line width
static const float length = 20 - width; //!< line length
static const float height = 0.2; //!< layer height TODO This is wrong, as current Z height is 0.15 mm
static const float extr = count_e(height, width, length); //!< E axis movement needed to print line
//! @brief Extrusion spacing
//!
//! @param layer_height layer height in mm
//! @param extrusion_width extrusion width in mm
//! @return filament length in mm which needs to be extruded to form line
static constexpr float spacing(float layer_height, float extrusion_width, float overlap_factor=1.f)
{
return extrusion_width - layer_height * (overlap_factor - M_PI/4);
}
// Common code extracted into one function to reduce code size
static void lay1cal_common_enqueue_loop(const char * const * cmd_sequence, const uint8_t steps) {
for (uint8_t i = 0; i < steps; ++i)
{
void * const pgm_ptr = pgm_read_ptr(cmd_sequence + i);
// M702 is currently only used with MMU enabled
if (pgm_ptr == MSG_M702 && !MMU2::mmu2.Enabled()) {
continue;
}
enquecommand_P(static_cast<char*>(pgm_ptr));
}
}
static const char extrude_fmt_X[] PROGMEM = "G1X%.4fE%.4f";
static const char extrude_fmt_Y[] PROGMEM = "G1Y%.4fE%.4f";
static const char zero_extrusion[] PROGMEM = "G92E0";
static const char feedrate_F1080[] PROGMEM = "G1F1080";
#ifndef NEW_FIRST_LAYER_CAL
static constexpr int8_t invert = 1;
static constexpr float short_length = 20;
static constexpr float square_width = short_length;
#else
static constexpr int8_t invert = -1;
static constexpr float short_length = 13.2812; //max_pos[1]/2 / meander * 2
static constexpr float square_width = short_length*2;
#endif //NEW_FIRST_LAYER_CAL
static constexpr float long_length = 150;
//! @brief Wait for preheat
void lay1cal_wait_preheat()
{
static const char preheat_cmd_2[] PROGMEM = "M190";
static const char preheat_cmd_3[] PROGMEM = "M109";
static const char preheat_cmd_4[] PROGMEM = "G28";
static const char * const preheat_cmd[] PROGMEM =
{
MSG_M107,
preheat_cmd_2,
preheat_cmd_3,
preheat_cmd_4,
zero_extrusion
};
lay1cal_common_enqueue_loop(preheat_cmd, sizeof(preheat_cmd)/sizeof(preheat_cmd[0]));
}
//! @brief Load filament
//! @param cmd_buffer character buffer needed to format gcodes
//! @param filament filament to use (applies for MMU only)
//! @returns true if extra purge distance is needed in case of MMU prints (after a toolchange), otherwise false
bool lay1cal_load_filament(uint8_t filament)
{
if (MMU2::mmu2.Enabled())
{
enquecommand_P(MSG_M83);
enquecommand_P(PSTR("G1Y-3F1000"));
enquecommand_P(PSTR("G1Z0.4"));
uint8_t currentTool = MMU2::mmu2.get_current_tool();
if(currentTool == filament ){
// already have the correct tool loaded - do nothing
return false;
} else if( currentTool != (uint8_t)MMU2::FILAMENT_UNKNOWN){
// some other slot is loaded, perform an unload first
enquecommand_P(MSG_M702);
}
// perform a toolchange
enquecommandf_P(PSTR("T%d"), filament);
return true;
}
return false;
}
//! @brief Print intro line
//! @param extraPurgeNeeded false if the first MMU-related "G1 E29" have to be skipped because the nozzle is already full of filament
//! @param layer_height the height of the calibration layer
//! @param extrusion_width the width of the extrusion layer
void lay1cal_intro_line(bool extraPurgeNeeded, float layer_height, float extrusion_width)
{
static const char cmd_intro_mmu_3[] PROGMEM = "G1X55E29F1073";
static const char cmd_intro_mmu_4[] PROGMEM = "G1X5E29F1800";
static const char cmd_intro_mmu_5[] PROGMEM = "G1X55E8F2000";
static const char cmd_intro_mmu_6[] PROGMEM = "G1Z0.3F1000";
static const char cmd_intro_mmu_8[] PROGMEM = "G1X240E25F2200";
static const char cmd_intro_mmu_9[] PROGMEM = "G1Y-2F1000";
static const char cmd_intro_mmu_10[] PROGMEM = "G1X202.5E8F1400";
static const char cmd_intro_mmu_11[] PROGMEM = "G1Z0.2";
static const char * const cmd_intro_mmu[] PROGMEM =
{
// first 2 items are only relevant if filament was not loaded - i.e. extraPurgeNeeded == true
cmd_intro_mmu_3,
cmd_intro_mmu_4,
cmd_intro_mmu_5,
cmd_intro_mmu_6,
zero_extrusion,
cmd_intro_mmu_8,
cmd_intro_mmu_9,
cmd_intro_mmu_10,
cmd_intro_mmu_11,
};
if (MMU2::mmu2.Enabled())
{
for (uint8_t i = (extraPurgeNeeded ? 0 : 2); i < (sizeof(cmd_intro_mmu)/sizeof(cmd_intro_mmu[0])); ++i)
{
enquecommand_P(static_cast<char*>(pgm_read_ptr(&cmd_intro_mmu[i])));
}
}
else
{
enquecommand_P(feedrate_F1080); //fixed velocity for the intro line
enquecommandf_P(extrude_fmt_X, 60.f, count_e(layer_height, extrusion_width * 4.f, 60));
enquecommandf_P(extrude_fmt_X, 202.5f, count_e(layer_height, extrusion_width * 8.f, 142.5));
}
}
//! @brief Setup for printing meander
void lay1cal_before_meander()
{
#ifndef NEW_FIRST_LAYER_CAL
static const char cmd_pre_meander_4[] PROGMEM = "G1E-1.5F2100";
static const char cmd_pre_meander_5[] PROGMEM = "G1Z5F7200";
#endif //NEW_FIRST_LAYER_CAL
static const char cmd_pre_meander_6[] PROGMEM = "M204S1000"; //set acceleration
static const char * const cmd_pre_meander[] PROGMEM =
{
zero_extrusion,
MSG_G90,
MSG_M83, // use relative distances for extrusion
#ifndef NEW_FIRST_LAYER_CAL
cmd_pre_meander_4,
cmd_pre_meander_5,
#endif //NEW_FIRST_LAYER_CAL
cmd_pre_meander_6,
};
lay1cal_common_enqueue_loop(cmd_pre_meander, (sizeof(cmd_pre_meander)/sizeof(cmd_pre_meander[0])));
}
//! @brief Print meander start
void lay1cal_meander_start(float layer_height, float extrusion_width)
{
#ifndef NEW_FIRST_LAYER_CAL
enquecommand_P(PSTR("G1X50Y155"));
#endif //_NEW_FIRST_LAYER_CAL
static const char fmt1[] PROGMEM = "G1Z%.2f";
enquecommandf_P(fmt1, layer_height);
enquecommand_P(feedrate_F1080);
enquecommand_P(MSG_G91); //enable relative XYZ
#ifdef NEW_FIRST_LAYER_CAL
enquecommandf_P(extrude_fmt_Y, short_length, count_e(layer_height, extrusion_width, short_length));
enquecommandf_P(extrude_fmt_X, long_length*invert, count_e(layer_height, extrusion_width, long_length));
enquecommandf_P(extrude_fmt_Y, -short_length*invert, count_e(layer_height, extrusion_width, short_length));
#else
enquecommandf_P(extrude_fmt_X, 25.f*invert, count_e(layer_height, extrusion_width * 4.f, 25));
enquecommandf_P(extrude_fmt_X, 25.f*invert, count_e(layer_height, extrusion_width * 2.f, 25));
enquecommandf_P(extrude_fmt_X, 100.f*invert, count_e(layer_height, extrusion_width, 100));
enquecommandf_P(extrude_fmt_Y, -20.f*invert, count_e(layer_height, extrusion_width, 20));
#endif //_NEW_FIRST_LAYER_CAL
}
//! @brief Print meander
//! @param cmd_buffer character buffer needed to format gcodes
void lay1cal_meander(char *cmd_buffer)
void lay1cal_meander(float layer_height, float extrusion_width)
{
static const char cmd_meander_0[] PROGMEM = "G1 X50 Y155";
static const char cmd_meander_1[] PROGMEM = "G1 Z0.150 F7200.000";
static const char cmd_meander_2[] PROGMEM = "G1 F1080";
static const char cmd_meander_3[] PROGMEM = "G1 X75 Y155 E2.5";
static const char cmd_meander_4[] PROGMEM = "G1 X100 Y155 E2";
static const char cmd_meander_5[] PROGMEM = "G1 X200 Y155 E2.62773";
static const char cmd_meander_6[] PROGMEM = "G1 X200 Y135 E0.66174";
static const char cmd_meander_7[] PROGMEM = "G1 X50 Y135 E3.62773";
static const char cmd_meander_8[] PROGMEM = "G1 X50 Y115 E0.49386";
static const char cmd_meander_9[] PROGMEM = "G1 X200 Y115 E3.62773";
static const char cmd_meander_10[] PROGMEM = "G1 X200 Y95 E0.49386";
static const char cmd_meander_11[] PROGMEM = "G1 X50 Y95 E3.62773";
static const char cmd_meander_12[] PROGMEM = "G1 X50 Y75 E0.49386";
static const char cmd_meander_13[] PROGMEM = "G1 X200 Y75 E3.62773";
static const char cmd_meander_14[] PROGMEM = "G1 X200 Y55 E0.49386";
static const char cmd_meander_15[] PROGMEM = "G1 X50 Y55 E3.62773";
const float long_extrusion = count_e(layer_height, extrusion_width, long_length);
const float short_extrusion = count_e(layer_height, extrusion_width, short_length);
static const char * const cmd_meander[] PROGMEM =
for(int8_t i = 0, xdir = -invert; i <= 4; i++, xdir = -xdir)
{
cmd_meander_0,
cmd_meander_1,
cmd_meander_2,
cmd_meander_3,
cmd_meander_4,
cmd_meander_5,
cmd_meander_6,
cmd_meander_7,
cmd_meander_8,
cmd_meander_9,
cmd_meander_10,
cmd_meander_11,
cmd_meander_12,
cmd_meander_13,
cmd_meander_14,
cmd_meander_15,
};
for (uint8_t i = 0; i < (sizeof(cmd_meander)/sizeof(cmd_meander[0])); ++i)
{
enquecommand_P(static_cast<char*>(pgm_read_ptr(&cmd_meander[i])));
enquecommandf_P(extrude_fmt_X, xdir * long_length, long_extrusion);
enquecommandf_P(extrude_fmt_Y, invert * -short_length, short_extrusion);
}
sprintf_P(cmd_buffer, PSTR("G1 X50 Y35 E%-.3f"), extr);
enquecommand(cmd_buffer);
#ifdef NEW_FIRST_LAYER_CAL
constexpr float mid_length = 0.5f * long_length - 0.5f * square_width;
const float mid_extrusion = count_e(layer_height, extrusion_width, mid_length);
enquecommandf_P(extrude_fmt_X, -mid_length, mid_extrusion); //~Middle of bed X125
enquecommandf_P(extrude_fmt_Y, short_length, short_extrusion); //~Middle of bed Y105
#endif //NEW_FIRST_LAYER_CAL
}
//! @brief Print square
//!
//! This function needs to be called 16 times for i from 0 to 15.
//! This function enqueues 4 lines of the square, so it needs to be called multiple times
//!
//! @param cmd_buffer character buffer needed to format gcodes
//! @param i iteration
void lay1cal_square(char *cmd_buffer, uint8_t i)
void lay1cal_square(float layer_height, float extrusion_width)
{
const float extr_short_segment = count_e(height, width, width);
const float Y_spacing = spacing(layer_height, extrusion_width);
const float long_extrusion = count_e(layer_height, extrusion_width, square_width);
const float short_extrusion = count_e(layer_height, extrusion_width, Y_spacing);
static const char fmt1[] PROGMEM = "G1 X%d Y%-.2f E%-.3f";
static const char fmt2[] PROGMEM = "G1 Y%-.2f E%-.3f";
sprintf_P(cmd_buffer, fmt1, 70, (35 - i*width * 2), extr);
enquecommand(cmd_buffer);
sprintf_P(cmd_buffer, fmt2, (35 - (2 * i + 1)*width), extr_short_segment);
enquecommand(cmd_buffer);
sprintf_P(cmd_buffer, fmt1, 50, (35 - (2 * i + 1)*width), extr);
enquecommand(cmd_buffer);
sprintf_P(cmd_buffer, fmt2, (35 - (i + 1)*width * 2), extr_short_segment);
enquecommand(cmd_buffer);
for (uint8_t i = 0; i < 4; i++)
{
enquecommandf_P(extrude_fmt_X, square_width*invert, long_extrusion);
enquecommandf_P(extrude_fmt_Y, -Y_spacing*invert, short_extrusion);
enquecommandf_P(extrude_fmt_X, -square_width*invert, long_extrusion);
enquecommandf_P(extrude_fmt_Y, -Y_spacing*invert, short_extrusion);
}
}
void lay1cal_finish()
{
static const char cmd_cal_finish_3[] PROGMEM = "G1E-0.075F2100"; // Retract
static const char cmd_cal_finish_4[] PROGMEM = "M140S0"; // Turn off bed heater
static const char cmd_cal_finish_5[] PROGMEM = "G1Z10F1300"; // Lift Z
static const char cmd_cal_finish_6[] PROGMEM = "G1X10Y180F4000"; // Go to parking position
static const char cmd_cal_finish_8[] PROGMEM = "M104S0"; // Turn off hotend heater
static const char * const cmd_cal_finish[] PROGMEM =
{
MSG_G90, // Set to Absolute Positioning
MSG_M107, // Turn off printer fan
cmd_cal_finish_3, // Retract
cmd_cal_finish_4, // Turn off bed heater
cmd_cal_finish_5, // Lift Z
cmd_cal_finish_6, // Go to parking position
MSG_M702, // Unload filament (MMU only)
cmd_cal_finish_8, // Turn off hotend heater
MSG_M84 // Disable stepper motors
};
lay1cal_common_enqueue_loop(cmd_cal_finish, (sizeof(cmd_cal_finish)/sizeof(cmd_cal_finish[0])));
}

View File

@ -7,10 +7,12 @@
#include <stdint.h>
void lay1cal_wait_preheat();
void lay1cal_load_filament(char *cmd_buffer, uint8_t filament);
void lay1cal_intro_line();
[[nodiscard]] bool lay1cal_load_filament(uint8_t filament);
void lay1cal_intro_line(bool skipExtraPurge, float layer_height, float extrusion_width);
void lay1cal_before_meander();
void lay1cal_meander(char *cmd_buffer);
void lay1cal_square(char *cmd_buffer, uint8_t i);
void lay1cal_meander_start(float layer_height, float extrusion_width);
void lay1cal_meander(float layer_height, float extrusion_width);
void lay1cal_square(float layer_height, float extrusion_width);
void lay1cal_finish();
#endif /* FIRMWARE_FIRST_LAY_CAL_H_ */

View File

@ -1,783 +0,0 @@
//! @file
#include "Marlin.h"
#include "fsensor.h"
#include <avr/pgmspace.h>
#include "pat9125.h"
#include "stepper.h"
#include "io_atmega2560.h"
#include "cmdqueue.h"
#include "ultralcd.h"
#include "mmu.h"
#include "cardreader.h"
#include "adc.h"
#include "temperature.h"
#include "config.h"
//! @name Basic parameters
//! @{
#define FSENSOR_CHUNK_LEN 1.25 //!< filament sensor chunk length (mm)
#define FSENSOR_ERR_MAX 4 //!< filament sensor maximum error/chunk count for runout detection
#define FSENSOR_SOFTERR_CMAX 3 //!< number of contiguous soft failures before a triggering a runout
#define FSENSOR_SOFTERR_DELTA 30000 //!< maximum interval (ms) to consider soft failures contiguous
//! @}
//! @name Optical quality measurement parameters
//! @{
#define FSENSOR_OQ_MAX_ES 2 //!< maximum sum of error blocks during filament recheck
#define FSENSOR_OQ_MIN_YD 2 //!< minimum yd sum during filament check (counts per inch)
#define FSENSOR_OQ_MIN_BR 80 //!< minimum brightness value
#define FSENSOR_OQ_MAX_SH 10 //!< maximum shutter value
//! @}
const char ERRMSG_PAT9125_NOT_RESP[] PROGMEM = "PAT9125 not responding (%d)!\n";
// PJ7 can not be used (does not have PinChangeInterrupt possibility)
#define FSENSOR_INT_PIN 75 //!< filament sensor interrupt pin PJ4
#define FSENSOR_INT_PIN_MASK 0x10 //!< filament sensor interrupt pin mask (bit4)
#define FSENSOR_INT_PIN_PIN_REG PINJ // PIN register @ PJ4
#define FSENSOR_INT_PIN_VECT PCINT1_vect // PinChange ISR @ PJ4
#define FSENSOR_INT_PIN_PCMSK_REG PCMSK1 // PinChangeMaskRegister @ PJ4
#define FSENSOR_INT_PIN_PCMSK_BIT PCINT13 // PinChange Interrupt / PinChange Enable Mask @ PJ4
#define FSENSOR_INT_PIN_PCICR_BIT PCIE1 // PinChange Interrupt Enable / Flag @ PJ4
//! enabled = initialized and sampled every chunk event
bool fsensor_enabled = true;
//! runout watching is done in fsensor_update (called from main loop)
bool fsensor_watch_runout = true;
//! not responding - is set if any communication error occurred during initialization or readout
bool fsensor_not_responding = false;
#ifdef PAT9125
uint8_t fsensor_int_pin_old = 0;
//! optical checking "chunk lenght" (already in steps)
int16_t fsensor_chunk_len = 0;
//! enable/disable quality meassurement
bool fsensor_oq_meassure_enabled = false;
//! number of errors, updated in ISR
uint8_t fsensor_err_cnt = 0;
//! variable for accumulating step count (updated callbacks from stepper and ISR)
int16_t fsensor_st_cnt = 0;
//! count of total sensor "soft" failures (filament status checks)
uint8_t fsensor_softfail = 0;
//! timestamp of last soft failure
unsigned long fsensor_softfail_last = 0;
//! count of soft failures within the configured time
uint8_t fsensor_softfail_ccnt = 0;
#endif
#ifdef DEBUG_FSENSOR_LOG
//! log flag: 0=log disabled, 1=log enabled
uint8_t fsensor_log = 1;
#endif //DEBUG_FSENSOR_LOG
//! @name filament autoload variables
//! @{
//! autoload feature enabled
bool fsensor_autoload_enabled = true;
//! autoload watching enable/disable flag
bool fsensor_watch_autoload = false;
#ifdef PAT9125
//
uint16_t fsensor_autoload_y;
//
uint8_t fsensor_autoload_c;
//
uint32_t fsensor_autoload_last_millis;
//
uint8_t fsensor_autoload_sum;
//! @}
#endif
//! @name filament optical quality measurement variables
//! @{
//! Measurement enable/disable flag
bool fsensor_oq_meassure = false;
//! skip-chunk counter, for accurate measurement is necessary to skip first chunk...
uint8_t fsensor_oq_skipchunk;
//! number of samples from start of measurement
uint8_t fsensor_oq_samples;
//! sum of steps in positive direction movements
uint16_t fsensor_oq_st_sum;
//! sum of deltas in positive direction movements
uint16_t fsensor_oq_yd_sum;
//! sum of errors during measurement
uint16_t fsensor_oq_er_sum;
//! max error counter value during measurement
uint8_t fsensor_oq_er_max;
//! minimum delta value
int16_t fsensor_oq_yd_min;
//! maximum delta value
int16_t fsensor_oq_yd_max;
//! sum of shutter value
uint16_t fsensor_oq_sh_sum;
//! @}
#ifdef IR_SENSOR_ANALOG
ClFsensorPCB oFsensorPCB;
ClFsensorActionNA oFsensorActionNA;
bool bIRsensorStateFlag=false;
unsigned long nIRsensorLastTime;
#endif //IR_SENSOR_ANALOG
void fsensor_stop_and_save_print(void)
{
printf_P(PSTR("fsensor_stop_and_save_print\n"));
stop_and_save_print_to_ram(0, 0);
fsensor_watch_runout = false;
}
#ifdef PAT9125
// Reset all internal counters to zero, including stepper callbacks
void fsensor_reset_err_cnt()
{
fsensor_err_cnt = 0;
pat9125_y = 0;
st_reset_fsensor();
}
void fsensor_set_axis_steps_per_unit(float u)
{
fsensor_chunk_len = (int16_t)(FSENSOR_CHUNK_LEN * u);
}
#endif
void fsensor_restore_print_and_continue(void)
{
printf_P(PSTR("fsensor_restore_print_and_continue\n"));
fsensor_watch_runout = true;
#ifdef PAT9125
fsensor_reset_err_cnt();
#endif
restore_print_from_ram_and_continue(0);
}
// fsensor_checkpoint_print cuts the current print job at the current position,
// allowing new instructions to be inserted in the middle
void fsensor_checkpoint_print(void)
{
printf_P(PSTR("fsensor_checkpoint_print\n"));
stop_and_save_print_to_ram(0, 0);
restore_print_from_ram_and_continue(0);
}
#ifdef IR_SENSOR_ANALOG
const char* FsensorIRVersionText()
{
switch(oFsensorPCB)
{
case ClFsensorPCB::_Old:
return _T(MSG_IR_03_OR_OLDER);
case ClFsensorPCB::_Rev04:
return _T(MSG_IR_04_OR_NEWER);
default:
return _T(MSG_IR_UNKNOWN);
}
}
#endif //IR_SENSOR_ANALOG
void fsensor_init(void)
{
#ifdef PAT9125
uint8_t pat9125 = pat9125_init();
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
#endif //PAT9125
uint8_t fsensor_enabled = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
fsensor_autoload_enabled=eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED);
fsensor_not_responding = false;
#ifdef PAT9125
uint8_t oq_meassure_enabled = eeprom_read_byte((uint8_t*)EEPROM_FSENS_OQ_MEASS_ENABLED);
fsensor_oq_meassure_enabled = (oq_meassure_enabled == 1)?true:false;
fsensor_set_axis_steps_per_unit(cs.axis_steps_per_unit[E_AXIS]);
if (!pat9125){
fsensor_enabled = 0; //disable sensor
fsensor_not_responding = true;
}
#endif //PAT9125
#ifdef IR_SENSOR_ANALOG
bIRsensorStateFlag=false;
oFsensorPCB = (ClFsensorPCB)eeprom_read_byte((uint8_t*)EEPROM_FSENSOR_PCB);
oFsensorActionNA = (ClFsensorActionNA)eeprom_read_byte((uint8_t*)EEPROM_FSENSOR_ACTION_NA);
// If the fsensor is not responding even at the start of the printer,
// set this flag accordingly to show N/A in Settings->Filament sensor.
// This is even valid for both fsensor board revisions (0.3 or older and 0.4).
// Must be done after reading what type of fsensor board we have
fsensor_not_responding = ! fsensor_IR_check();
#endif //IR_SENSOR_ANALOG
if (fsensor_enabled){
fsensor_enable(false); // (in this case) EEPROM update is not necessary
} else {
fsensor_disable(false); // (in this case) EEPROM update is not necessary
}
printf_P(PSTR("FSensor %S"), (fsensor_enabled?PSTR("ENABLED"):PSTR("DISABLED")));
#ifdef IR_SENSOR_ANALOG
printf_P(PSTR(" (sensor board revision:%S)\n"), FsensorIRVersionText());
#else //IR_SENSOR_ANALOG
MYSERIAL.println();
#endif //IR_SENSOR_ANALOG
if (check_for_ir_sensor()){
ir_sensor_detected = true;
}
}
bool fsensor_enable(bool bUpdateEEPROM)
{
#ifdef PAT9125
if (mmu_enabled == false) { //filament sensor is pat9125, enable only if it is working
uint8_t pat9125 = pat9125_init();
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
if (pat9125)
fsensor_not_responding = false;
else
fsensor_not_responding = true;
fsensor_enabled = pat9125 ? true : false;
fsensor_watch_runout = true;
fsensor_oq_meassure = false;
fsensor_reset_err_cnt();
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, fsensor_enabled ? 0x01 : 0x00);
FSensorStateMenu = fsensor_enabled ? 1 : 0;
}
else //filament sensor is FINDA, always enable
{
fsensor_enabled = true;
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x01);
FSensorStateMenu = 1;
}
#else // PAT9125
#ifdef IR_SENSOR_ANALOG
if(!fsensor_IR_check())
{
bUpdateEEPROM=true;
fsensor_enabled=false;
fsensor_not_responding=true;
FSensorStateMenu=0;
}
else {
#endif //IR_SENSOR_ANALOG
fsensor_enabled=true;
fsensor_not_responding=false;
FSensorStateMenu=1;
#ifdef IR_SENSOR_ANALOG
}
#endif //IR_SENSOR_ANALOG
if(bUpdateEEPROM)
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, FSensorStateMenu);
#endif //PAT9125
return fsensor_enabled;
}
void fsensor_disable(bool bUpdateEEPROM)
{
fsensor_enabled = false;
FSensorStateMenu = 0;
if(bUpdateEEPROM)
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x00);
}
void fsensor_autoload_set(bool State)
{
#ifdef PAT9125
if (!State) fsensor_autoload_check_stop();
#endif //PAT9125
fsensor_autoload_enabled = State;
eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, fsensor_autoload_enabled);
}
void pciSetup(byte pin)
{
// !!! "digitalPinTo?????bit()" does not provide the correct results for some MCU pins
*digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin
PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
PCICR |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group
}
#ifdef PAT9125
void fsensor_autoload_check_start(void)
{
// puts_P(_N("fsensor_autoload_check_start\n"));
if (!fsensor_enabled) return;
if (!fsensor_autoload_enabled) return;
if (fsensor_watch_autoload) return;
if (!pat9125_update()) //update sensor
{
fsensor_disable();
fsensor_not_responding = true;
fsensor_watch_autoload = false;
printf_P(ERRMSG_PAT9125_NOT_RESP, 3);
return;
}
puts_P(_N("fsensor_autoload_check_start - autoload ENABLED\n"));
fsensor_autoload_y = pat9125_y; //save current y value
fsensor_autoload_c = 0; //reset number of changes counter
fsensor_autoload_sum = 0;
fsensor_autoload_last_millis = _millis();
fsensor_watch_runout = false;
fsensor_watch_autoload = true;
}
void fsensor_autoload_check_stop(void)
{
// puts_P(_N("fsensor_autoload_check_stop\n"));
if (!fsensor_enabled) return;
// puts_P(_N("fsensor_autoload_check_stop 1\n"));
if (!fsensor_autoload_enabled) return;
// puts_P(_N("fsensor_autoload_check_stop 2\n"));
if (!fsensor_watch_autoload) return;
puts_P(_N("fsensor_autoload_check_stop - autoload DISABLED\n"));
fsensor_autoload_sum = 0;
fsensor_watch_autoload = false;
fsensor_watch_runout = true;
fsensor_reset_err_cnt();
}
#endif //PAT9125
bool fsensor_check_autoload(void)
{
if (!fsensor_enabled) return false;
if (!fsensor_autoload_enabled) return false;
if (ir_sensor_detected) {
if (digitalRead(IR_SENSOR_PIN) == 1) {
fsensor_watch_autoload = true;
}
else if (fsensor_watch_autoload == true) {
fsensor_watch_autoload = false;
return true;
}
}
#ifdef PAT9125
if (!fsensor_watch_autoload)
{
fsensor_autoload_check_start();
return false;
}
#if 0
uint8_t fsensor_autoload_c_old = fsensor_autoload_c;
#endif
if ((_millis() - fsensor_autoload_last_millis) < 25) return false;
fsensor_autoload_last_millis = _millis();
if (!pat9125_update_y()) //update sensor
{
fsensor_disable();
fsensor_not_responding = true;
printf_P(ERRMSG_PAT9125_NOT_RESP, 2);
return false;
}
int16_t dy = pat9125_y - fsensor_autoload_y;
if (dy) //? dy value is nonzero
{
if (dy > 0) //? delta-y value is positive (inserting)
{
fsensor_autoload_sum += dy;
fsensor_autoload_c += 3; //increment change counter by 3
}
else if (fsensor_autoload_c > 1)
fsensor_autoload_c -= 2; //decrement change counter by 2
fsensor_autoload_y = pat9125_y; //save current value
}
else if (fsensor_autoload_c > 0)
fsensor_autoload_c--;
if (fsensor_autoload_c == 0) fsensor_autoload_sum = 0;
#if 0
puts_P(_N("fsensor_check_autoload\n"));
if (fsensor_autoload_c != fsensor_autoload_c_old)
printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum);
#endif
// if ((fsensor_autoload_c >= 15) && (fsensor_autoload_sum > 30))
if ((fsensor_autoload_c >= 12) && (fsensor_autoload_sum > 20))
{
// puts_P(_N("fsensor_check_autoload = true !!!\n"));
return true;
}
#endif //PAT9125
return false;
}
#ifdef PAT9125
void fsensor_oq_meassure_set(bool State)
{
fsensor_oq_meassure_enabled = State;
eeprom_update_byte((unsigned char *)EEPROM_FSENS_OQ_MEASS_ENABLED, fsensor_oq_meassure_enabled);
}
void fsensor_oq_meassure_start(uint8_t skip)
{
if (!fsensor_enabled) return;
if (!fsensor_oq_meassure_enabled) return;
printf_P(PSTR("fsensor_oq_meassure_start\n"));
fsensor_oq_skipchunk = skip;
fsensor_oq_samples = 0;
fsensor_oq_st_sum = 0;
fsensor_oq_yd_sum = 0;
fsensor_oq_er_sum = 0;
fsensor_oq_er_max = 0;
fsensor_oq_yd_min = INT16_MAX;
fsensor_oq_yd_max = 0;
fsensor_oq_sh_sum = 0;
pat9125_update();
pat9125_y = 0;
fsensor_oq_meassure = true;
}
void fsensor_oq_meassure_stop(void)
{
if (!fsensor_enabled) return;
if (!fsensor_oq_meassure_enabled) return;
printf_P(PSTR("fsensor_oq_meassure_stop, %hhu samples\n"), fsensor_oq_samples);
printf_P(_N(" st_sum=%u yd_sum=%u er_sum=%u er_max=%hhu\n"), fsensor_oq_st_sum, fsensor_oq_yd_sum, fsensor_oq_er_sum, fsensor_oq_er_max);
printf_P(_N(" yd_min=%u yd_max=%u yd_avg=%u sh_avg=%u\n"), fsensor_oq_yd_min, fsensor_oq_yd_max, (uint16_t)((uint32_t)fsensor_oq_yd_sum * fsensor_chunk_len / fsensor_oq_st_sum), (uint16_t)(fsensor_oq_sh_sum / fsensor_oq_samples));
fsensor_oq_meassure = false;
}
#ifdef FSENSOR_QUALITY
const char _OK[] PROGMEM = "OK";
const char _NG[] PROGMEM = "NG!";
bool fsensor_oq_result(void)
{
if (!fsensor_enabled) return true;
if (!fsensor_oq_meassure_enabled) return true;
printf_P(_N("fsensor_oq_result\n"));
bool res_er_sum = (fsensor_oq_er_sum <= FSENSOR_OQ_MAX_ES);
printf_P(_N(" er_sum = %u %S\n"), fsensor_oq_er_sum, (res_er_sum?_OK:_NG));
bool res_er_max = (fsensor_oq_er_max <= FSENSOR_OQ_MAX_EM);
printf_P(_N(" er_max = %hhu %S\n"), fsensor_oq_er_max, (res_er_max?_OK:_NG));
uint8_t yd_avg = ((uint32_t)fsensor_oq_yd_sum * fsensor_chunk_len / fsensor_oq_st_sum);
bool res_yd_avg = (yd_avg >= FSENSOR_OQ_MIN_YD) && (yd_avg <= FSENSOR_OQ_MAX_YD);
printf_P(_N(" yd_avg = %hhu %S\n"), yd_avg, (res_yd_avg?_OK:_NG));
bool res_yd_max = (fsensor_oq_yd_max <= (yd_avg * FSENSOR_OQ_MAX_PD));
printf_P(_N(" yd_max = %u %S\n"), fsensor_oq_yd_max, (res_yd_max?_OK:_NG));
bool res_yd_min = (fsensor_oq_yd_min >= (yd_avg / FSENSOR_OQ_MAX_ND));
printf_P(_N(" yd_min = %u %S\n"), fsensor_oq_yd_min, (res_yd_min?_OK:_NG));
uint16_t yd_dev = (fsensor_oq_yd_max - yd_avg) + (yd_avg - fsensor_oq_yd_min);
printf_P(_N(" yd_dev = %u\n"), yd_dev);
uint16_t yd_qua = 10 * yd_avg / (yd_dev + 1);
printf_P(_N(" yd_qua = %u %S\n"), yd_qua, ((yd_qua >= 8)?_OK:_NG));
uint8_t sh_avg = (fsensor_oq_sh_sum / fsensor_oq_samples);
bool res_sh_avg = (sh_avg <= FSENSOR_OQ_MAX_SH);
if (yd_qua >= 8) res_sh_avg = true;
printf_P(_N(" sh_avg = %hhu %S\n"), sh_avg, (res_sh_avg?_OK:_NG));
bool res = res_er_sum && res_er_max && res_yd_avg && res_yd_max && res_yd_min && res_sh_avg;
printf_P(_N("fsensor_oq_result %S\n"), (res?_OK:_NG));
return res;
}
#endif //FSENSOR_QUALITY
ISR(FSENSOR_INT_PIN_VECT)
{
if (mmu_enabled || ir_sensor_detected) return;
if (!((fsensor_int_pin_old ^ FSENSOR_INT_PIN_PIN_REG) & FSENSOR_INT_PIN_MASK)) return;
fsensor_int_pin_old = FSENSOR_INT_PIN_PIN_REG;
// prevent isr re-entry
static bool _lock = false;
if (_lock) return;
_lock = true;
// fetch fsensor_st_cnt atomically
int st_cnt = fsensor_st_cnt;
fsensor_st_cnt = 0;
sei();
uint8_t old_err_cnt = fsensor_err_cnt;
uint8_t pat9125_res = fsensor_oq_meassure?pat9125_update():pat9125_update_y();
if (!pat9125_res)
{
fsensor_disable();
fsensor_not_responding = true;
printf_P(ERRMSG_PAT9125_NOT_RESP, 1);
}
if (st_cnt != 0)
{
// movement was planned, check for sensor movement
int8_t st_dir = st_cnt >= 0;
int8_t pat9125_dir = pat9125_y >= 0;
if (pat9125_y == 0)
{
if (st_dir)
{
// no movement detected: we might be within a blind sensor range,
// update the frame and shutter parameters we didn't earlier
if (!fsensor_oq_meassure)
pat9125_update_bs();
// increment the error count only if underexposed: filament likely missing
if ((pat9125_b < FSENSOR_OQ_MIN_BR) && (pat9125_s > FSENSOR_OQ_MAX_SH))
{
// check for a dark frame (<30% avg brightness) with long exposure
++fsensor_err_cnt;
}
else
{
// good frame, filament likely present
if(fsensor_err_cnt) --fsensor_err_cnt;
}
}
}
else if (pat9125_dir != st_dir)
{
// detected direction opposite of motor movement
if (st_dir) ++fsensor_err_cnt;
}
else if (pat9125_dir == st_dir)
{
// direction agreeing with planned movement
if (fsensor_err_cnt) --fsensor_err_cnt;
}
if (st_dir && fsensor_oq_meassure)
{
// extruding with quality assessment
if (fsensor_oq_skipchunk)
{
fsensor_oq_skipchunk--;
fsensor_err_cnt = 0;
}
else
{
if (st_cnt == fsensor_chunk_len)
{
if (pat9125_y > 0) if (fsensor_oq_yd_min > pat9125_y) fsensor_oq_yd_min = (fsensor_oq_yd_min + pat9125_y) / 2;
if (pat9125_y >= 0) if (fsensor_oq_yd_max < pat9125_y) fsensor_oq_yd_max = (fsensor_oq_yd_max + pat9125_y) / 2;
}
fsensor_oq_samples++;
fsensor_oq_st_sum += st_cnt;
if (pat9125_y > 0) fsensor_oq_yd_sum += pat9125_y;
if (fsensor_err_cnt > old_err_cnt)
fsensor_oq_er_sum += (fsensor_err_cnt - old_err_cnt);
if (fsensor_oq_er_max < fsensor_err_cnt)
fsensor_oq_er_max = fsensor_err_cnt;
fsensor_oq_sh_sum += pat9125_s;
}
}
}
#ifdef DEBUG_FSENSOR_LOG
if (fsensor_log)
{
printf_P(_N("FSENSOR cnt=%d dy=%d err=%hhu %S\n"), st_cnt, pat9125_y, fsensor_err_cnt, (fsensor_err_cnt > old_err_cnt)?_N("NG!"):_N("OK"));
if (fsensor_oq_meassure) printf_P(_N("FSENSOR st_sum=%u yd_sum=%u er_sum=%u er_max=%hhu yd_max=%u\n"), fsensor_oq_st_sum, fsensor_oq_yd_sum, fsensor_oq_er_sum, fsensor_oq_er_max, fsensor_oq_yd_max);
}
#endif //DEBUG_FSENSOR_LOG
pat9125_y = 0;
_lock = false;
return;
}
void fsensor_setup_interrupt(void)
{
pinMode(FSENSOR_INT_PIN, OUTPUT);
digitalWrite(FSENSOR_INT_PIN, LOW);
fsensor_int_pin_old = 0;
//pciSetup(FSENSOR_INT_PIN);
// !!! "pciSetup()" does not provide the correct results for some MCU pins
// so interrupt registers settings:
FSENSOR_INT_PIN_PCMSK_REG |= bit(FSENSOR_INT_PIN_PCMSK_BIT); // enable corresponding PinChangeInterrupt (individual pin)
PCIFR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // clear previous occasional interrupt (set of pins)
PCICR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // enable corresponding PinChangeInterrupt (set of pins)
}
void fsensor_st_block_chunk(int cnt)
{
if (!fsensor_enabled) return;
fsensor_st_cnt += cnt;
// !!! bit toggling (PINxn <- 1) (for PinChangeInterrupt) does not work for some MCU pins
if (PIN_GET(FSENSOR_INT_PIN)) {PIN_VAL(FSENSOR_INT_PIN, LOW);}
else {PIN_VAL(FSENSOR_INT_PIN, HIGH);}
}
#endif //PAT9125
//! Common code for enqueing M600 and supplemental codes into the command queue.
//! Used both for the IR sensor and the PAT9125
void fsensor_enque_M600(){
printf_P(PSTR("fsensor_update - M600\n"));
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
enquecommand_front_P((PSTR("M600")));
}
//! @brief filament sensor update (perform M600 on filament runout)
//!
//! Works only if filament sensor is enabled.
//! When the filament sensor error count is larger then FSENSOR_ERR_MAX, pauses print, tries to move filament back and forth.
//! If there is still no plausible signal from filament sensor plans M600 (Filament change).
void fsensor_update(void)
{
#ifdef PAT9125
if (fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX))
{
fsensor_stop_and_save_print();
KEEPALIVE_STATE(IN_HANDLER);
bool autoload_enabled_tmp = fsensor_autoload_enabled;
fsensor_autoload_enabled = false;
bool oq_meassure_enabled_tmp = fsensor_oq_meassure_enabled;
fsensor_oq_meassure_enabled = true;
// move the nozzle away while checking the filament
current_position[Z_AXIS] += 0.8;
if(current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
plan_buffer_line_curposXYZE(max_feedrate[Z_AXIS]);
st_synchronize();
// check the filament in isolation
fsensor_reset_err_cnt();
fsensor_oq_meassure_start(0);
float e_tmp = current_position[E_AXIS];
current_position[E_AXIS] -= 3;
plan_buffer_line_curposXYZE(250/60);
current_position[E_AXIS] = e_tmp;
plan_buffer_line_curposXYZE(200/60);
st_synchronize();
fsensor_oq_meassure_stop();
bool err = false;
err |= (fsensor_err_cnt > 0); // final error count is non-zero
err |= (fsensor_oq_er_sum > FSENSOR_OQ_MAX_ES); // total error count is above limit
err |= (fsensor_oq_yd_sum < FSENSOR_OQ_MIN_YD); // total measured distance is below limit
fsensor_restore_print_and_continue();
fsensor_autoload_enabled = autoload_enabled_tmp;
fsensor_oq_meassure_enabled = oq_meassure_enabled_tmp;
unsigned long now = _millis();
if (!err && (now - fsensor_softfail_last) > FSENSOR_SOFTERR_DELTA)
fsensor_softfail_ccnt = 0;
if (!err && fsensor_softfail_ccnt <= FSENSOR_SOFTERR_CMAX)
{
printf_P(PSTR("fsensor_err_cnt = 0\n"));
++fsensor_softfail;
++fsensor_softfail_ccnt;
fsensor_softfail_last = now;
}
else
{
fsensor_softfail_ccnt = 0;
fsensor_softfail_last = 0;
fsensor_enque_M600();
}
}
#else //PAT9125
if (CHECK_FSENSOR && ir_sensor_detected)
{
if(digitalRead(IR_SENSOR_PIN))
{ // IR_SENSOR_PIN ~ H
#ifdef IR_SENSOR_ANALOG
if(!bIRsensorStateFlag)
{
bIRsensorStateFlag=true;
nIRsensorLastTime=_millis();
}
else
{
if((_millis()-nIRsensorLastTime)>IR_SENSOR_STEADY)
{
uint8_t nMUX1,nMUX2;
uint16_t nADC;
bIRsensorStateFlag=false;
// sequence for direct data reading from AD converter
DISABLE_TEMPERATURE_INTERRUPT();
nMUX1=ADMUX; // ADMUX saving
nMUX2=ADCSRB;
adc_setmux(VOLT_IR_PIN);
ADCSRA|=(1<<ADSC); // first conversion after ADMUX change discarded (preventively)
while(ADCSRA&(1<<ADSC))
;
ADCSRA|=(1<<ADSC); // second conversion used
while(ADCSRA&(1<<ADSC))
;
nADC=ADC;
ADMUX=nMUX1; // ADMUX restoring
ADCSRB=nMUX2;
ENABLE_TEMPERATURE_INTERRUPT();
// end of sequence for ...
// Detection of correct function of fsensor v04 - it must NOT read >4.6V
// If it does, it means a disconnected cables or faulty board
if( (oFsensorPCB == ClFsensorPCB::_Rev04) && ( (nADC*OVERSAMPLENR) > IRsensor_Hopen_TRESHOLD ) )
{
fsensor_disable();
fsensor_not_responding = true;
printf_P(PSTR("IR sensor not responding (%d)!\n"),1);
if((ClFsensorActionNA)eeprom_read_byte((uint8_t*)EEPROM_FSENSOR_ACTION_NA)==ClFsensorActionNA::_Pause)
// if we are printing and FS action is set to "Pause", force pause the print
if(oFsensorActionNA==ClFsensorActionNA::_Pause)
lcd_pause_print();
}
else
{
#endif //IR_SENSOR_ANALOG
fsensor_checkpoint_print();
fsensor_enque_M600();
#ifdef IR_SENSOR_ANALOG
}
}
}
}
else
{ // IR_SENSOR_PIN ~ L
bIRsensorStateFlag=false;
#endif //IR_SENSOR_ANALOG
}
}
#endif //PAT9125
}
#ifdef IR_SENSOR_ANALOG
/// This is called only upon start of the printer or when switching the fsensor ON in the menu
/// We cannot do temporal window checks here (aka the voltage has been in some range for a period of time)
bool fsensor_IR_check(){
if( IRsensor_Lmax_TRESHOLD <= current_voltage_raw_IR && current_voltage_raw_IR <= IRsensor_Hmin_TRESHOLD ){
/// If the voltage is in forbidden range, the fsensor is ok, but the lever is mounted improperly.
/// Or the user is so creative so that he can hold a piece of fillament in the hole in such a genius way,
/// that the IR fsensor reading is within 1.5 and 3V ... this would have been highly unusual
/// and would have been considered more like a sabotage than normal printer operation
printf_P(PSTR("fsensor in forbidden range 1.5-3V - check sensor\n"));
return false;
}
if( oFsensorPCB == ClFsensorPCB::_Rev04 ){
/// newer IR sensor cannot normally produce 4.6-5V, this is considered a failure/bad mount
if( IRsensor_Hopen_TRESHOLD <= current_voltage_raw_IR && current_voltage_raw_IR <= IRsensor_VMax_TRESHOLD ){
printf_P(PSTR("fsensor v0.4 in fault range 4.6-5V - unconnected\n"));
return false;
}
/// newer IR sensor cannot normally produce 0-0.3V, this is considered a failure
#if 0 //Disabled as it has to be decided if we gonna use this or not.
if( IRsensor_Hopen_TRESHOLD <= current_voltage_raw_IR && current_voltage_raw_IR <= IRsensor_VMax_TRESHOLD ){
printf_P(PSTR("fsensor v0.4 in fault range 0.0-0.3V - wrong IR sensor\n"));
return false;
}
#endif
}
/// If IR sensor is "uknown state" and filament is not loaded > 1.5V return false
#if 0
if( (oFsensorPCB == ClFsensorPCB::_Undef) && ( current_voltage_raw_IR > IRsensor_Lmax_TRESHOLD ) ){
printf_P(PSTR("Unknown IR sensor version and no filament loaded detected.\n"));
return false;
}
#endif
// otherwise the IR fsensor is considered working correctly
return true;
}
#endif //IR_SENSOR_ANALOG

View File

@ -1,124 +0,0 @@
//! @file
#ifndef FSENSOR_H
#define FSENSOR_H
#include <inttypes.h>
#include "config.h"
// enable/disable flag
extern bool fsensor_enabled;
// not responding flag
extern bool fsensor_not_responding;
#ifdef PAT9125
// optical checking "chunk lenght" (already in steps)
extern int16_t fsensor_chunk_len;
// count of soft failures
extern uint8_t fsensor_softfail;
#endif
//! @name save restore printing
//! @{
extern void fsensor_stop_and_save_print(void);
//! restore print - restore position and heatup to original temperature
extern void fsensor_restore_print_and_continue(void);
//! split the current gcode stream to insert new instructions
extern void fsensor_checkpoint_print(void);
//! @}
//! initialize
extern void fsensor_init(void);
#ifdef PAT9125
//! update axis resolution
extern void fsensor_set_axis_steps_per_unit(float u);
#endif
//! @name enable/disable
//! @{
extern bool fsensor_enable(bool bUpdateEEPROM=true);
extern void fsensor_disable(bool bUpdateEEPROM=true);
//! @}
//autoload feature enabled
extern bool fsensor_autoload_enabled;
extern void fsensor_autoload_set(bool State);
extern void fsensor_update(void);
#ifdef PAT9125
//! setup pin-change interrupt
extern void fsensor_setup_interrupt(void);
//! @name autoload support
//! @{
extern void fsensor_autoload_check_start(void);
extern void fsensor_autoload_check_stop(void);
#endif //PAT9125
extern bool fsensor_check_autoload(void);
//! @}
#ifdef PAT9125
//! @name optical quality measurement support
//! @{
extern bool fsensor_oq_meassure_enabled;
extern void fsensor_oq_meassure_set(bool State);
extern void fsensor_oq_meassure_start(uint8_t skip);
extern void fsensor_oq_meassure_stop(void);
extern bool fsensor_oq_result(void);
//! @}
//! @name callbacks from stepper
//! @{
extern void fsensor_st_block_chunk(int cnt);
// debugging
extern uint8_t fsensor_log;
// There's really nothing to do in block_begin: the stepper ISR likely has
// called us already at the end of the last block, making this integration
// redundant. LA1.5 might not always do that during a coasting move, so attempt
// to drain fsensor_st_cnt anyway at the beginning of the new block.
#define fsensor_st_block_begin(rev) fsensor_st_block_chunk(0)
//! @}
#endif //PAT9125
#define VOLT_DIV_REF 5
#ifdef IR_SENSOR_ANALOG
#define IR_SENSOR_STEADY 10 // [ms]
enum class ClFsensorPCB:uint_least8_t
{
_Old=0,
_Rev04=1,
_Undef=EEPROM_EMPTY_VALUE
};
enum class ClFsensorActionNA:uint_least8_t
{
_Continue=0,
_Pause=1,
_Undef=EEPROM_EMPTY_VALUE
};
extern ClFsensorPCB oFsensorPCB;
extern ClFsensorActionNA oFsensorActionNA;
extern const char* FsensorIRVersionText();
extern bool fsensor_IR_check();
constexpr uint16_t Voltage2Raw(float V){
return ( V * 1023 * OVERSAMPLENR / VOLT_DIV_REF ) + 0.5F;
}
constexpr float Raw2Voltage(uint16_t raw){
return VOLT_DIV_REF*(raw / (1023.F * OVERSAMPLENR) );
}
constexpr uint16_t IRsensor_Ldiode_TRESHOLD = Voltage2Raw(0.3F); // ~0.3V, raw value=982
constexpr uint16_t IRsensor_Lmax_TRESHOLD = Voltage2Raw(1.5F); // ~1.5V (0.3*Vcc), raw value=4910
constexpr uint16_t IRsensor_Hmin_TRESHOLD = Voltage2Raw(3.0F); // ~3.0V (0.6*Vcc), raw value=9821
constexpr uint16_t IRsensor_Hopen_TRESHOLD = Voltage2Raw(4.6F); // ~4.6V (N.C. @ Ru~20-50k, Rd'=56k, Ru'=10k), raw value=15059
constexpr uint16_t IRsensor_VMax_TRESHOLD = Voltage2Raw(5.F); // ~5V, raw value=16368
#endif //IR_SENSOR_ANALOG
#endif //FSENSOR_H

View File

@ -1,6 +1,5 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include "io_atmega2560.h"
// All this is about silencing the heat bed, as it behaves like a loudspeaker.
// Basically, we want the PWM heating switched at 30Hz (or so) which is a well ballanced
@ -12,7 +11,7 @@
// Doing this at higher frequency than the bed "loudspeaker" can handle makes the click barely audible.
// Technically:
// timer0 is set to fast PWM mode at 62.5kHz (timer0 is linked to the bed heating pin) (zero prescaler)
// To keep the bed switching at 30Hz - we don't want the PWM running at 62kHz all the time
// To keep the bed switching at 30Hz - we don't want the PWM running at 62kHz all the time
// since it would burn the heatbed's MOSFET:
// 16MHz/256 levels of PWM duty gives us 62.5kHz
// 62.5kHz/256 gives ~244Hz, that is still too fast - 244/8 gives ~30Hz, that's what we need
@ -20,9 +19,9 @@
// The finite automaton is running in the ISR(TIMER0_OVF_vect)
// 2019-08-14 update: the original algorithm worked very well, however there were 2 regressions:
// 1. 62kHz ISR requires considerable amount of processing power,
// 1. 62kHz ISR requires considerable amount of processing power,
// USB transfer speed dropped by 20%, which was most notable when doing short G-code segments.
// 2. Some users reported TLed PSU started clicking when running at 120V/60Hz.
// 2. Some users reported TLed PSU started clicking when running at 120V/60Hz.
// This looks like the original algorithm didn't maintain base PWM 30Hz, but only 15Hz
// To address both issues, there is an improved approach based on the idea of leveraging
// different CLK prescalers in some automaton states - i.e. when holding LOW or HIGH on the output pin,
@ -41,7 +40,7 @@
// - it can toggle unnoticed, which will result in bed clicking again.
// That's why there are special transition states ZERO_TO_RISE and ONE_TO_FALL, which enable the
// counter change its operation atomically and without artefacts on the output pin.
// The resulting signal on the output pin was checked with an osciloscope.
// The resulting signal on the output pin was checked with an osciloscope.
// If there are any change requirements in the future, the signal must be checked with an osciloscope again,
// ad-hoc changes may completely screw things up!
@ -58,7 +57,7 @@ enum class States : uint8_t {
ZERO_TO_RISE, ///< metastate allowing the timer change its state atomically without artefacts on the output pin
RISE, ///< 16 fast PWM cycles with increasing duty up to steady ON
RISE_TO_ONE, ///< metastate allowing the timer change its state atomically without artefacts on the output pin
ONE, ///< steady 1 (ON), no change for the whole period
ONE, ///< steady 1 (ON), no change for the whole period
FALL, ///< 16 fast PWM cycles with decreasing duty down to steady OFF
FALL_TO_ZERO ///< metastate allowing the timer change its state atomically without artefacts on the output pin
};
@ -93,7 +92,7 @@ static const uint8_t fastShift = 4;
/// increment slowCounter by 1
/// but use less bits of soft PWM - something like soft_pwm_bed >> 2
/// that may further reduce the CPU cycles required by the bed heating automaton
/// Due to the nature of bed heating the reduced PID precision may not be a major issue, however doing 8x less ISR(timer0_ovf) may significantly improve the performance
/// Due to the nature of bed heating the reduced PID precision may not be a major issue, however doing 8x less ISR(timer0_ovf) may significantly improve the performance
static const uint8_t slowInc = 1;
ISR(TIMER0_OVF_vect) // timer compare interrupt service routine
@ -154,7 +153,6 @@ ISR(TIMER0_OVF_vect) // timer compare interrupt service routine
return; // want full duty for the next ONE cycle again - so keep on heating and just wait for the next timer ovf
}
// otherwise moving towards FALL
state = States::ONE;//_TO_FALL;
state=States::FALL;
fastCounter = fastMax - 1;// we'll do 16-1 cycles of RISE
TCNT0 = 255; // force overflow on the next clock cycle
@ -179,6 +177,6 @@ ISR(TIMER0_OVF_vect) // timer compare interrupt service routine
TCNT0 = 128;
OCR0B = 255;
TCCR0B = (1 << CS01); // change prescaler to 8, i.e. 7.8kHz
break;
break;
}
}

32
Firmware/host.cpp Normal file
View File

@ -0,0 +1,32 @@
#include <string.h>
#include "Configuration_adv.h"
#include "host.h"
#include "Timer.h"
static LongTimer M79_timer;
static char host_status_screen_name[3];
void SetHostStatusScreenName(const char * name) {
strncpy(host_status_screen_name, name, 2);
host_status_screen_name[2] = '\0';
}
char * GetHostStatusScreenName() {
return host_status_screen_name;
}
void ResetHostStatusScreenName() {
memset(host_status_screen_name, 0, sizeof(host_status_screen_name));
}
void M79_timer_restart() {
M79_timer.start();
}
bool M79_timer_get_status() {
return M79_timer.running();
}
void M79_timer_update_status() {
M79_timer.expired(M79_TIMEOUT);
}

22
Firmware/host.h Normal file
View File

@ -0,0 +1,22 @@
#pragma once
/// Assigns host name with up to two characters which will be shown on
/// the UI when printing. The function forces the third byte to be null delimiter.
void SetHostStatusScreenName(const char * name);
/// Returns a pointer to the host name
char * GetHostStatusScreenName();
/// Reset the memory to NULL when the host name should not be used
void ResetHostStatusScreenName();
/// Restart the M79 timer
void M79_timer_restart();
/// Get the current M79 timer status
/// @returns true if running, false otherwise
bool M79_timer_get_status();
/// Checks if the timer period has expired. If the timer
/// has expired, the timer is stopped
void M79_timer_update_status();

View File

@ -1,374 +0,0 @@
//io_atmega2560.h
#ifndef _IO_ATMEGA2560
#define _IO_ATMEGA2560
#define __PIN_P0 PINE
#define __PIN_P1 PINE
#define __PIN_P2 PINE
#define __PIN_P3 PINE
#define __PIN_P4 PING
#define __PIN_P5 PINE
#define __PIN_P6 PINH
#define __PIN_P7 PINH
#define __PIN_P8 PINH
#define __PIN_P9 PINH
#define __PIN_P10 PINB
#define __PIN_P11 PINB
#define __PIN_P12 PINB
#define __PIN_P13 PINB
#define __PIN_P14 PINJ
#define __PIN_P15 PINJ
#define __PIN_P16 PINH
#define __PIN_P17 PINH
#define __PIN_P18 PIND
#define __PIN_P19 PIND
#define __PIN_P20 PIND
#define __PIN_P21 PIND
#define __PIN_P22 PINA
#define __PIN_P23 PINA
#define __PIN_P24 PINA
#define __PIN_P25 PINA
#define __PIN_P26 PINA
#define __PIN_P27 PINA
#define __PIN_P28 PINA
#define __PIN_P29 PINA
#define __PIN_P30 PINC
#define __PIN_P31 PINC
#define __PIN_P32 PINC
#define __PIN_P33 PINC
#define __PIN_P34 PINC
#define __PIN_P35 PINC
#define __PIN_P36 PINC
#define __PIN_P37 PINC
#define __PIN_P38 PIND
#define __PIN_P39 PING
#define __PIN_P40 PING
#define __PIN_P41 PING
#define __PIN_P42 PINL
#define __PIN_P43 PINL
#define __PIN_P44 PINL
#define __PIN_P45 PINL
#define __PIN_P46 PINL
#define __PIN_P47 PINL
#define __PIN_P48 PINL
#define __PIN_P49 PINL
#define __PIN_P50 PINB
#define __PIN_P51 PINB
#define __PIN_P52 PINB
#define __PIN_P53 PINB
#define __PIN_P54 PINF
#define __PIN_P55 PINF
#define __PIN_P56 PINF
#define __PIN_P57 PINF
#define __PIN_P58 PINF
#define __PIN_P59 PINF
#define __PIN_P60 PINF
#define __PIN_P61 PINF
#define __PIN_P62 PINK
#define __PIN_P63 PINK
#define __PIN_P64 PINK
#define __PIN_P65 PINK
#define __PIN_P66 PINK
#define __PIN_P67 PINK
#define __PIN_P68 PINK
#define __PIN_P69 PINK
#define __PIN_P70 PING
#define __PIN_P71 PING
#define __PIN_P72 PINJ
#define __PIN_P73 PINJ
#define __PIN_P74 PINJ
#define __PIN_P75 PINJ
#define __PIN_P76 PINJ
#define __PIN_P77 PINJ
#define __PIN_P78 PINE
#define __PIN_P79 PINE
#define __PIN_P80 PINE
#define __PIN_P81 PIND
#define __PIN_P82 PIND
#define __PIN_P83 PIND
#define __PIN_P84 PINH
#define __PIN_P85 PINH
#define __PORT_P0 PORTE
#define __PORT_P1 PORTE
#define __PORT_P2 PORTE
#define __PORT_P3 PORTE
#define __PORT_P4 PORTG
#define __PORT_P5 PORTE
#define __PORT_P6 PORTH
#define __PORT_P7 PORTH
#define __PORT_P8 PORTH
#define __PORT_P9 PORTH
#define __PORT_P10 PORTB
#define __PORT_P11 PORTB
#define __PORT_P12 PORTB
#define __PORT_P13 PORTB
#define __PORT_P14 PORTJ
#define __PORT_P15 PORTJ
#define __PORT_P16 PORTH
#define __PORT_P17 PORTH
#define __PORT_P18 PORTD
#define __PORT_P19 PORTD
#define __PORT_P20 PORTD
#define __PORT_P21 PORTD
#define __PORT_P22 PORTA
#define __PORT_P23 PORTA
#define __PORT_P24 PORTA
#define __PORT_P25 PORTA
#define __PORT_P26 PORTA
#define __PORT_P27 PORTA
#define __PORT_P28 PORTA
#define __PORT_P29 PORTA
#define __PORT_P30 PORTC
#define __PORT_P31 PORTC
#define __PORT_P32 PORTC
#define __PORT_P33 PORTC
#define __PORT_P34 PORTC
#define __PORT_P35 PORTC
#define __PORT_P36 PORTC
#define __PORT_P37 PORTC
#define __PORT_P38 PORTD
#define __PORT_P39 PORTG
#define __PORT_P40 PORTG
#define __PORT_P41 PORTG
#define __PORT_P42 PORTL
#define __PORT_P43 PORTL
#define __PORT_P44 PORTL
#define __PORT_P45 PORTL
#define __PORT_P46 PORTL
#define __PORT_P47 PORTL
#define __PORT_P48 PORTL
#define __PORT_P49 PORTL
#define __PORT_P50 PORTB
#define __PORT_P51 PORTB
#define __PORT_P52 PORTB
#define __PORT_P53 PORTB
#define __PORT_P54 PORTF
#define __PORT_P55 PORTF
#define __PORT_P56 PORTF
#define __PORT_P57 PORTF
#define __PORT_P58 PORTF
#define __PORT_P59 PORTF
#define __PORT_P60 PORTF
#define __PORT_P61 PORTF
#define __PORT_P62 PORTK
#define __PORT_P63 PORTK
#define __PORT_P64 PORTK
#define __PORT_P65 PORTK
#define __PORT_P66 PORTK
#define __PORT_P67 PORTK
#define __PORT_P68 PORTK
#define __PORT_P69 PORTK
#define __PORT_P70 PORTG
#define __PORT_P71 PORTG
#define __PORT_P72 PORTJ
#define __PORT_P73 PORTJ
#define __PORT_P74 PORTJ
#define __PORT_P75 PORTJ
#define __PORT_P76 PORTJ
#define __PORT_P77 PORTJ
#define __PORT_P78 PORTE
#define __PORT_P79 PORTE
#define __PORT_P80 PORTE
#define __PORT_P81 PORTD
#define __PORT_P82 PORTD
#define __PORT_P83 PORTD
#define __PORT_P84 PORTH
#define __PORT_P85 PORTH
#define __DDR_P0 DDRE
#define __DDR_P1 DDRE
#define __DDR_P2 DDRE
#define __DDR_P3 DDRE
#define __DDR_P4 DDRG
#define __DDR_P5 DDRE
#define __DDR_P6 DDRH
#define __DDR_P7 DDRH
#define __DDR_P8 DDRH
#define __DDR_P9 DDRH
#define __DDR_P10 DDRB
#define __DDR_P11 DDRB
#define __DDR_P12 DDRB
#define __DDR_P13 DDRB
#define __DDR_P14 DDRJ
#define __DDR_P15 DDRJ
#define __DDR_P16 DDRH
#define __DDR_P17 DDRH
#define __DDR_P18 DDRD
#define __DDR_P19 DDRD
#define __DDR_P20 DDRD
#define __DDR_P21 DDRD
#define __DDR_P22 DDRA
#define __DDR_P23 DDRA
#define __DDR_P24 DDRA
#define __DDR_P25 DDRA
#define __DDR_P26 DDRA
#define __DDR_P27 DDRA
#define __DDR_P28 DDRA
#define __DDR_P29 DDRA
#define __DDR_P30 DDRC
#define __DDR_P31 DDRC
#define __DDR_P32 DDRC
#define __DDR_P33 DDRC
#define __DDR_P34 DDRC
#define __DDR_P35 DDRC
#define __DDR_P36 DDRC
#define __DDR_P37 DDRC
#define __DDR_P38 DDRD
#define __DDR_P39 DDRG
#define __DDR_P40 DDRG
#define __DDR_P41 DDRG
#define __DDR_P42 DDRL
#define __DDR_P43 DDRL
#define __DDR_P44 DDRL
#define __DDR_P45 DDRL
#define __DDR_P46 DDRL
#define __DDR_P47 DDRL
#define __DDR_P48 DDRL
#define __DDR_P49 DDRL
#define __DDR_P50 DDRB
#define __DDR_P51 DDRB
#define __DDR_P52 DDRB
#define __DDR_P53 DDRB
#define __DDR_P54 DDRF
#define __DDR_P55 DDRF
#define __DDR_P56 DDRF
#define __DDR_P57 DDRF
#define __DDR_P58 DDRF
#define __DDR_P59 DDRF
#define __DDR_P60 DDRF
#define __DDR_P61 DDRF
#define __DDR_P62 DDRK
#define __DDR_P63 DDRK
#define __DDR_P64 DDRK
#define __DDR_P65 DDRK
#define __DDR_P66 DDRK
#define __DDR_P67 DDRK
#define __DDR_P68 DDRK
#define __DDR_P69 DDRK
#define __DDR_P70 DDRG
#define __DDR_P71 DDRG
#define __DDR_P72 DDRJ
#define __DDR_P73 DDRJ
#define __DDR_P74 DDRJ
#define __DDR_P75 DDRJ
#define __DDR_P76 DDRJ
#define __DDR_P77 DDRJ
#define __DDR_P78 DDRE
#define __DDR_P79 DDRE
#define __DDR_P80 DDRE
#define __DDR_P81 DDRD
#define __DDR_P82 DDRD
#define __DDR_P83 DDRD
#define __DDR_P84 DDRH
#define __DDR_P85 DDRH
#define __BIT_P0 0
#define __BIT_P1 1
#define __BIT_P2 4
#define __BIT_P3 5
#define __BIT_P4 5
#define __BIT_P5 3
#define __BIT_P6 3
#define __BIT_P7 4
#define __BIT_P8 5
#define __BIT_P9 6
#define __BIT_P10 4
#define __BIT_P11 5
#define __BIT_P12 6
#define __BIT_P13 7
#define __BIT_P14 1
#define __BIT_P15 0
#define __BIT_P16 0
#define __BIT_P17 1
#define __BIT_P18 3
#define __BIT_P19 2
#define __BIT_P20 1
#define __BIT_P21 0
#define __BIT_P22 0
#define __BIT_P23 1
#define __BIT_P24 2
#define __BIT_P25 3
#define __BIT_P26 4
#define __BIT_P27 5
#define __BIT_P28 6
#define __BIT_P29 7
#define __BIT_P30 7
#define __BIT_P31 6
#define __BIT_P32 5
#define __BIT_P33 4
#define __BIT_P34 3
#define __BIT_P35 2
#define __BIT_P36 1
#define __BIT_P37 0
#define __BIT_P38 7
#define __BIT_P39 2
#define __BIT_P40 1
#define __BIT_P41 0
#define __BIT_P42 7
#define __BIT_P43 6
#define __BIT_P44 5
#define __BIT_P45 4
#define __BIT_P46 3
#define __BIT_P47 2
#define __BIT_P48 1
#define __BIT_P49 0
#define __BIT_P50 3
#define __BIT_P51 2
#define __BIT_P52 1
#define __BIT_P53 0
#define __BIT_P54 0
#define __BIT_P55 1
#define __BIT_P56 2
#define __BIT_P57 3
#define __BIT_P58 4
#define __BIT_P59 5
#define __BIT_P60 6
#define __BIT_P61 7
#define __BIT_P62 0
#define __BIT_P63 1
#define __BIT_P64 2
#define __BIT_P65 3
#define __BIT_P66 4
#define __BIT_P67 5
#define __BIT_P68 6
#define __BIT_P69 7
#define __BIT_P70 4
#define __BIT_P71 3
#define __BIT_P72 2
#define __BIT_P73 3
#define __BIT_P74 7
#define __BIT_P75 4
#define __BIT_P76 5
#define __BIT_P77 6
#define __BIT_P78 2
#define __BIT_P79 6
#define __BIT_P80 7
#define __BIT_P81 4
#define __BIT_P82 5
#define __BIT_P83 6
#define __BIT_P84 2
#define __BIT_P85 7
#define __BIT(pin) __BIT_P##pin
#define __MSK(pin) (1 << __BIT(pin))
#define __PIN(pin) __PIN_P##pin
#define __PORT(pin) __PORT_P##pin
#define __DDR(pin) __DDR_P##pin
#define PIN(pin) __PIN(pin)
#define PORT(pin) __PORT(pin)
#define DDR(pin) __DDR(pin)
#define PIN_INP(pin) DDR(pin) &= ~__MSK(pin)
#define PIN_OUT(pin) DDR(pin) |= __MSK(pin)
#define PIN_CLR(pin) PORT(pin) &= ~__MSK(pin)
#define PIN_SET(pin) PORT(pin) |= __MSK(pin)
#define PIN_VAL(pin, val) if (val) PIN_SET(pin); else PIN_CLR(pin);
#define PIN_GET(pin) (PIN(pin) & __MSK(pin))
#define PIN_INQ(pin) (PORT(pin) & __MSK(pin))
#endif //_IO_ATMEGA2560

View File

@ -38,7 +38,7 @@ void la10c_mode_change(LA10C_MODE mode)
// Approximate a LA10 value to a LA15 equivalent.
static float la10c_convert(float k)
{
float new_K = k * 0.004 - 0.05;
float new_K = k * 0.002 - 0.01;
return new_K < 0? 0:
new_K > (LA_K_MAX - FLT_EPSILON)? (LA_K_MAX - FLT_EPSILON):
new_K;
@ -74,7 +74,7 @@ float la10c_jerk(float j)
// check for a compatible range of values prior to convert (be sure that
// a higher E-jerk would still be compatible wrt the E accell range)
if(j < 4.5 && cs.max_acceleration_units_per_sq_second_normal[E_AXIS] < 2000)
if(j < 4.5 && cs.max_acceleration_mm_per_s2_normal[E_AXIS] < 2000)
return j;
// bring low E-jerk values into equivalent LA 1.5 values by

View File

@ -1,15 +1,17 @@
//language.c
#include "language.h"
#include <avr/pgmspace.h>
#include <avr/io.h>
#include <avr/eeprom.h>
#include "bootapp.h"
#include "Configuration.h"
#include "pins.h"
#ifdef W25X20CL
#include "w25x20cl.h"
#endif //W25X20CL
#ifdef XFLASH
#include "xflash.h"
#include "xflash_layout.h"
#endif //XFLASH
// Currently active language selection.
uint8_t lang_selected = 0;
@ -17,17 +19,17 @@ uint8_t lang_selected = 0;
#if (LANG_MODE == 0) //primary language only
uint8_t lang_select(__attribute__((unused)) uint8_t lang) { return 0; }
uint8_t lang_select(_UNUSED uint8_t lang) { return 0; }
uint8_t lang_get_count() { return 1; }
uint16_t lang_get_code(__attribute__((unused)) uint8_t lang) { return LANG_CODE_EN; }
const char* lang_get_name_by_code(__attribute__((unused)) uint16_t code) { return _n("English"); }
uint16_t lang_get_code(_UNUSED uint8_t lang) { return LANG_CODE_EN; }
const char* lang_get_name_by_code(_UNUSED uint16_t code) { return _n("English"); }
void lang_reset(void) { }
uint8_t lang_is_selected(void) { return 1; }
#else //(LANG_MODE == 0) //secondary languages in progmem or xflash
//reserved xx kbytes for secondary language table
const char _SEC_LANG[LANG_SIZE_RESERVED] PROGMEM_I2 = "_SEC_LANG";
const char _SEC_LANG[LANG_SIZE_RESERVED] __attribute__((aligned(SPM_PAGESIZE))) PROGMEM_I2 = "_SEC_LANG";
//primary language signature
const uint32_t _PRI_LANG_SIGNATURE[1] __attribute__((section(".progmem0"))) = {0xffffffff};
@ -40,7 +42,7 @@ const char* lang_get_translation(const char* s)
if (lang_selected == 0) return s + 2; //primary language selected, return orig. str.
if (lang_table == 0) return s + 2; //sec. lang table not found, return orig. str.
uint16_t ui = pgm_read_word(((uint16_t*)s)); //read string id
if (ui == 0xffff) return s + 2; //translation not found, return orig. str.
if (ui == 0xffff) return s + 2; //id not assigned, return orig. str.
ui = pgm_read_word(((uint16_t*)(((char*)lang_table + 16 + ui*2)))); //read relative offset
if (pgm_read_byte(((uint8_t*)((char*)lang_table + ui))) == 0) //read first character
return s + 2;//zero length string == not translated, return orig. str.
@ -54,7 +56,7 @@ uint8_t lang_select(uint8_t lang)
lang_table = 0;
lang_selected = lang;
}
#ifdef W25X20CL
#ifdef XFLASH
if (lang_get_code(lang) == lang_get_code(LANG_ID_SEC)) lang = LANG_ID_SEC;
if (lang == LANG_ID_SEC) //current secondary language
{
@ -68,7 +70,7 @@ uint8_t lang_select(uint8_t lang)
}
}
}
#else //W25X20CL
#else //XFLASH
if (lang == LANG_ID_SEC)
{
uint16_t table = _SEC_LANG_TABLE;
@ -82,7 +84,7 @@ uint8_t lang_select(uint8_t lang)
}
}
}
#endif //W25X20CL
#endif //XFLASH
if (lang_selected == lang)
{
eeprom_update_byte((unsigned char*)EEPROM_LANG, lang_selected);
@ -107,19 +109,19 @@ uint8_t lang_get_count()
{
if (pgm_read_dword(((uint32_t*)(_PRI_LANG_SIGNATURE))) == 0xffffffff)
return 1; //signature not set - only primary language will be available
#ifdef W25X20CL
W25X20CL_SPI_ENTER();
#ifdef XFLASH
XFLASH_SPI_ENTER();
uint8_t count = 2; //count = 1+n (primary + secondary + all in xflash)
uint32_t addr = 0x00000; //start of xflash
uint32_t addr = LANG_OFFSET;
lang_table_header_t header; //table header structure
while (1)
{
w25x20cl_rd_data(addr, (uint8_t*)&header, sizeof(lang_table_header_t)); //read table header from xflash
xflash_rd_data(addr, (uint8_t*)&header, sizeof(lang_table_header_t)); //read table header from xflash
if (header.magic != LANG_MAGIC) break; //break if magic not valid
addr += header.size; //calc address of next table
count++; //inc counter
}
#else //W25X20CL
#else //XFLASH
uint16_t table = _SEC_LANG_TABLE;
uint8_t count = 1; //count = 1 (primary)
while (pgm_read_dword(((uint32_t*)table)) == LANG_MAGIC) //magic valid
@ -127,14 +129,14 @@ uint8_t lang_get_count()
table += pgm_read_word((uint16_t*)(table + 4));
count++;
}
#endif //W25X20CL
#endif //XFLASH
return count;
}
uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* offset)
{
if (lang == LANG_ID_PRI) return 0; //primary lang not supported for this function
#ifdef W25X20CL
#ifdef XFLASH
if (lang == LANG_ID_SEC)
{
uint16_t ui = _SEC_LANG_TABLE; //table pointer
@ -142,18 +144,18 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off
if (offset) *offset = ui;
return (header->magic == LANG_MAGIC)?1:0; //return 1 if magic valid
}
W25X20CL_SPI_ENTER();
uint32_t addr = 0x00000; //start of xflash
XFLASH_SPI_ENTER();
uint32_t addr = LANG_OFFSET;
lang--;
while (1)
{
w25x20cl_rd_data(addr, (uint8_t*)(header), sizeof(lang_table_header_t)); //read table header from xflash
xflash_rd_data(addr, (uint8_t*)(header), sizeof(lang_table_header_t)); //read table header from xflash
if (header->magic != LANG_MAGIC) break; //break if not valid
if (offset) *offset = addr;
if (--lang == 0) return 1;
addr += header->size; //calc address of next table
}
#else //W25X20CL
#else //XFLASH
if (lang == LANG_ID_SEC)
{
uint16_t ui = _SEC_LANG_TABLE; //table pointer
@ -161,32 +163,32 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off
if (offset) *offset = ui;
return (header->magic == LANG_MAGIC)?1:0; //return 1 if magic valid
}
#endif //W25X20CL
#endif //XFLASH
return 0;
}
uint16_t lang_get_code(uint8_t lang)
{
if (lang == LANG_ID_PRI) return LANG_CODE_EN; //primary lang = EN
#ifdef W25X20CL
#ifdef XFLASH
if (lang == LANG_ID_SEC)
{
uint16_t ui = _SEC_LANG_TABLE; //table pointer
if (pgm_read_dword(((uint32_t*)(ui + 0))) != LANG_MAGIC) return LANG_CODE_XX; //magic not valid
return pgm_read_word(((uint32_t*)(ui + 10))); //return lang code from progmem
}
W25X20CL_SPI_ENTER();
uint32_t addr = 0x00000; //start of xflash
XFLASH_SPI_ENTER();
uint32_t addr = LANG_OFFSET;
lang_table_header_t header; //table header structure
lang--;
while (1)
{
w25x20cl_rd_data(addr, (uint8_t*)&header, sizeof(lang_table_header_t)); //read table header from xflash
xflash_rd_data(addr, (uint8_t*)&header, sizeof(lang_table_header_t)); //read table header from xflash
if (header.magic != LANG_MAGIC) break; //break if not valid
if (--lang == 0) return header.code;
addr += header.size; //calc address of next table
}
#else //W25X20CL
#else //XFLASH
uint16_t table = _SEC_LANG_TABLE;
uint8_t count = 1; //count = 1 (primary)
while (pgm_read_dword((uint32_t*)table) == LANG_MAGIC) //magic valid
@ -195,7 +197,7 @@ uint16_t lang_get_code(uint8_t lang)
table += pgm_read_word((uint16_t*)(table + 4));
count++;
}
#endif //W25X20CL
#endif //XFLASH
return LANG_CODE_XX;
}
@ -210,6 +212,46 @@ const char* lang_get_name_by_code(uint16_t code)
case LANG_CODE_FR: return _n("Francais");
case LANG_CODE_IT: return _n("Italiano");
case LANG_CODE_PL: return _n("Polski");
#ifdef COMMUNITY_LANGUAGE_SUPPORT //Community language support
#ifdef COMMUNITY_LANG_GROUP1_NL
case LANG_CODE_NL: return _n("Nederlands"); //community Dutch contribution
#endif // COMMUNITY_LANG_GROUP1_NL
#ifdef COMMUNITY_LANG_GROUP1_SV
case LANG_CODE_SV: return _n("Svenska"); //community Swedish contribution
#endif // COMMUNITY_LANG_GROUP1_SV
#ifdef COMMUNITY_LANG_GROUP1_NO
case LANG_CODE_NO: return _n("Norsk"); //community Swedish contribution
#endif // COMMUNITY_LANG_GROUP1_NO
#ifdef COMMUNITY_LANG_GROUP1_DA
case LANG_CODE_DA: return _n("Dansk"); //community Danish contribution
#endif // COMMUNITY_LANG_GROUP1_DA
#ifdef COMMUNITY_LANG_GROUP1_SK
case LANG_CODE_SK: return _n("Slovencina"); //community Slovak contribution
#endif // COMMUNITY_LANG_GROUP1_SK
#ifdef COMMUNITY_LANG_GROUP1_SL
case LANG_CODE_SL: return _n("Slovenscina"); //community Slovanian contribution
#endif // COMMUNITY_LANG_GROUP1_SL
#ifdef COMMUNITY_LANG_GROUP1_HU
case LANG_CODE_HU: return _n("Magyar"); //community Hungarian contribution
#endif // COMMUNITY_LANG_GROUP1_HU
#ifdef COMMUNITY_LANG_GROUP1_LB
case LANG_CODE_LB: return _n("Letzebuergesch"); //community Luxembourgish contribution
#endif // COMMUNITY_LANG_GROUP1_LB
#ifdef COMMUNITY_LANG_GROUP1_HR
case LANG_CODE_HR: return _n("Hrvatski"); //community Croatian contribution
#endif // COMMUNITY_LANG_GROUP1_HR
#ifdef COMMUNITY_LANG_GROUP2_LT
case LANG_CODE_LT: return _n("Lietuviu"); //community Lithuanian contribution
#endif // COMMUNITY_LANG_GROUP2_LT
#ifdef COMMUNITY_LANG_GROUP1_RO
case LANG_CODE_RO: return _n("Romana"); //community Romanian contribution
#endif // COMMUNITY_LANG_GROUP1_RO
//Use the 3 lines below as a template and replace 'QR' and 'New language'
//#ifdef COMMUNITY_LANG_GROUP1_QR
// case LANG_CODE_QR: return _n("New language"); //community contribution
//#endif // COMMUNITY_LANG_GROUP1_QR
#endif // COMMUNITY_LANGUAGE_SUPPORT
}
return _n("??");
}
@ -234,7 +276,7 @@ const char* lang_get_sec_lang_str_by_id(uint16_t id)
return ui + pgm_read_word(((uint16_t*)(ui + 16 + id * 2))); //read relative offset and return calculated pointer
}
uint16_t lang_print_sec_lang(FILE* out)
uint16_t lang_print_sec_lang()
{
printf_P(_n("&_SEC_LANG = 0x%04x\n"), &_SEC_LANG);
printf_P(_n("sizeof(_SEC_LANG) = 0x%04x\n"), sizeof(_SEC_LANG));
@ -256,7 +298,7 @@ uint16_t lang_print_sec_lang(FILE* out)
puts_P(_n(" strings:\n"));
uint16_t ui = _SEC_LANG_TABLE; //table pointer
for (ui = 0; ui < _lt_count; ui++)
fprintf_P(out, _n(" %3d %S\n"), ui, lang_get_sec_lang_str_by_id(ui));
printf_P(_n(" %3d %S\n"), ui, lang_get_sec_lang_str_by_id(ui));
return _lt_count;
}
#endif //DEBUG_SEC_LANG
@ -268,5 +310,5 @@ void lang_boot_update_start(uint8_t lang)
{
uint8_t cnt = lang_get_count();
if ((lang < 2) || (lang > cnt)) return; //only languages from xflash can be selected
bootapp_reboot_user0(lang << 4);
bootapp_reboot_user0(lang << 3);
}

View File

@ -5,6 +5,7 @@
#include "config.h"
#include "macros.h"
#include <inttypes.h>
#ifdef DEBUG_SEC_LANG
#include <stdio.h>
@ -12,27 +13,15 @@
#define PROTOCOL_VERSION "1.0"
#ifndef CUSTOM_MENDEL_NAME
#define MACHINE_NAME "Mendel"
#endif
#ifndef MACHINE_UUID
#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
#endif
#define MSG_FW_VERSION "Firmware"
#define STRINGIFY_(n) #n
#define STRINGIFY(n) STRINGIFY_(n)
#if (LANG_MODE == 0) //primary language only
#define PROGMEM_I2 __attribute__((section(".progmem0")))
#define PROGMEM_I1 __attribute__((section(".progmem1")))
#define PROGMEM_N1 __attribute__((section(".progmem2")))
#define _I(s) (__extension__({static const char __c[] PROGMEM_I1 = s; &__c[0];}))
#define ISTR(s) s
#define _i(s) _I(s)
#define _T(s) s
#define ISTR(s) (s) // declare a translatable string
#define _i(s) _I(s) // declare a translatable string and return the translated form
#define _T(s) (s) // return translated string from reference
#define _O(s) (s) // return original (untranslated) string from reference
#else //(LANG_MODE == 0)
// section .loc_sec (originaly .progmem0) will be used for localized translated strings
#define PROGMEM_I2 __attribute__((section(".loc_sec")))
@ -44,14 +33,17 @@
#define ISTR(s) "\xff\xff" s
#define _i(s) lang_get_translation(_I(s))
#define _T(s) lang_get_translation(s)
#define _O(s) (s + 2)
#endif //(LANG_MODE == 0)
#define _N(s) (__extension__({static const char __c[] PROGMEM_N1 = s; &__c[0];}))
#define _n(s) _N(s)
#define _n(s) _N(s) // declare and return untranslated string
#define _R(s) (s) // return reference to translatable string (for warning suppression)
/** @brief lang_table_header_t structure - (size= 16byte) */
typedef struct
{
uint32_t magic; //+0
uint32_t magic; //+0
uint16_t size; //+4
uint16_t count; //+6
uint16_t checksum; //+8
@ -98,6 +90,45 @@ typedef struct
#define LANG_CODE_FR 0x6672 //!<'fr'
#define LANG_CODE_IT 0x6974 //!<'it'
#define LANG_CODE_PL 0x706c //!<'pl'
#ifdef COMMUNITY_LANGUAGE_SUPPORT //Community language support
#ifdef COMMUNITY_LANG_GROUP1_NL
#define LANG_CODE_NL 0x6e6c //!<'nl'
#endif // COMMUNITY_LANG_GROUP1_NL
#ifdef COMMUNITY_LANG_GROUP1_SV
#define LANG_CODE_SV 0x7376 //!<'sv'
#endif // COMMUNITY_LANG_GROUP1_SV
#ifdef COMMUNITY_LANG_GROUP1_NO
#define LANG_CODE_NO 0x6E6F //!<'no'
#endif // COMMUNITY_LANG_GROUP1_NO
#ifdef COMMUNITY_LANG_GROUP1_DA
#define LANG_CODE_DA 0x6461 //!<'da'
#endif // COMMUNITY_LANG_GROUP1_DA
#ifdef COMMUNITY_LANG_GROUP1_SL
#define LANG_CODE_SL 0x736C //!<'sl'
#endif // COMMUNITY_LANG_GROUP1_SL
#ifdef COMMUNITY_LANG_GROUP1_HU
#define LANG_CODE_HU 0x6875 //!<'hu'
#endif // COMMUNITY_LANG_GROUP1_HU
#ifdef COMMUNITY_LANG_GROUP1_LB
#define LANG_CODE_LB 0x6C62 //!<'lb'
#endif // COMMUNITY_LANG_GROUP1_LB
#ifdef COMMUNITY_LANG_GROUP1_HR
#define LANG_CODE_HR 0x6872 //!<'hr'
#endif // COMMUNITY_LANG_GROUP1_HR
#ifdef COMMUNITY_LANG_GROUP2_LT
#define LANG_CODE_LT 0x6C74 //!<'lt'
#endif // COMMUNITY_LANG_GROUP2_LT
#ifdef COMMUNITY_LANG_GROUP1_SK
#define LANG_CODE_SK 0x736b //!<'sk'
#endif // COMMUNITY_LANG_GROUP1_SK
#ifdef COMMUNITY_LANG_GROUP1_RO
#define LANG_CODE_RO 0x726F //!<'ro'
#endif // COMMUNITY_LANG_GROUP1_RO
//Use the 3 lines below as a template and replace 'QR', '0X7172' and 'qr'
//#ifdef COMMUNITY_LANG_GROUP1_QR
//#define LANG_CODE_QR 0x7172 //!<'qr'
//#endif // COMMUNITY_LANG_GROUP1_QR
#endif // COMMUNITY_LANGUAGE_SUPPORT
///@}
#if defined(__cplusplus)
@ -110,9 +141,7 @@ extern uint8_t lang_selected;
#if (LANG_MODE != 0)
extern const char _SEC_LANG[LANG_SIZE_RESERVED];
extern const char* lang_get_translation(const char* s);
/** @def _SEC_LANG_TABLE
* @brief Align table to start of 256 byte page */
#define _SEC_LANG_TABLE ((((uint16_t)&_SEC_LANG) + 0x00ff) & 0xff00)
#define _SEC_LANG_TABLE ((uint16_t)&_SEC_LANG)
#endif //(LANG_MODE != 0)
/** @brief selects language, eeprom is updated in case of success */
@ -134,7 +163,7 @@ extern uint8_t lang_is_selected(void);
#ifdef DEBUG_SEC_LANG
extern const char* lang_get_sec_lang_str_by_id(uint16_t id);
extern uint16_t lang_print_sec_lang(FILE* out);
extern uint16_t lang_print_sec_lang();
#endif //DEBUG_SEC_LANG
extern void lang_boot_update_start(uint8_t lang);

File diff suppressed because it is too large Load Diff

View File

@ -22,54 +22,40 @@ extern void lcd_clear(void);
extern void lcd_home(void);
/*extern void lcd_no_display(void);
extern void lcd_display(void);
extern void lcd_no_blink(void);
extern void lcd_blink(void);
extern void lcd_no_cursor(void);
extern void lcd_cursor(void);
extern void lcd_scrollDisplayLeft(void);
extern void lcd_scrollDisplayRight(void);
extern void lcd_leftToRight(void);
extern void lcd_rightToLeft(void);
extern void lcd_autoscroll(void);
extern void lcd_no_autoscroll(void);*/
extern void lcd_set_cursor(uint8_t col, uint8_t row);
/// @brief Change the cursor column position while preserving the current row position
/// @param col column number, ranges from 0 to LCD_WIDTH - 1
void lcd_set_cursor_column(uint8_t col);
extern void lcd_createChar_P(uint8_t, const uint8_t*);
extern int lcd_putc(int c);
// char c is non-standard, however it saves 1B on stack
extern int lcd_putc(char c);
extern int lcd_putc_at(uint8_t c, uint8_t r, char ch);
extern int lcd_puts_P(const char* str);
extern int lcd_puts_at_P(uint8_t c, uint8_t r, const char* str);
extern int lcd_printf_P(const char* format, ...);
extern void lcd_space(uint8_t n);
extern void lcd_printNumber(unsigned long n, uint8_t base);
extern void lcd_printFloat(double number, uint8_t digits);
extern void lcd_print(const char*);
extern uint8_t lcd_print_pad(const char* s, uint8_t len);
/// @brief print a string from PROGMEM with left-adjusted padding
/// @param s string from PROGMEM.
/// @param len maximum number of characters to print, including padding. Ranges from 0 to LCD_WIDTH.
/// @return number of padded bytes. 0 means there was no padding.
uint8_t lcd_print_pad_P(const char* s, uint8_t len);
extern void lcd_print(char, int = 0);
extern void lcd_print(unsigned char, int = 0);
extern void lcd_print(int, int = 10);
extern void lcd_print(unsigned int, int = 10);
extern void lcd_print(long, int = 10);
extern void lcd_print(unsigned long, int = 10);
extern void lcd_print(double, int = 2);
//! @brief Clear screen
#define ESC_2J "\x1b[2J"
//! @brief Show cursor
#define ESC_25h "\x1b[?25h"
//! @brief Hide cursor
#define ESC_25l "\x1b[?25l"
//! @brief Set cursor to
//! @param c column
//! @param r row
#define ESC_H(c,r) "\x1b["#r";"#c"H"
#define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 30000ul //!< Generic timeout to status screen in ms, when no user action.
@ -86,17 +72,9 @@ typedef void (*lcd_lcdupdate_func_t)(void);
//Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
extern uint8_t lcd_draw_update;
extern int32_t lcd_encoder;
extern int16_t lcd_encoder;
extern uint8_t lcd_encoder_bits;
// lcd_encoder_diff is updated from interrupt context and added to lcd_encoder every LCD update
extern int8_t lcd_encoder_diff;
//the last checked lcd_buttons in a bit array.
extern uint8_t lcd_buttons;
extern uint8_t lcd_button_pressed;
extern uint8_t lcd_click_trigger;
extern uint8_t lcd_update_enabled;
@ -104,11 +82,8 @@ extern LongTimer lcd_timeoutToStatus;
extern uint32_t lcd_next_update_millis;
extern uint8_t lcd_status_update_delay;
extern lcd_longpress_func_t lcd_longpress_func;
extern lcd_charsetup_func_t lcd_charsetup_func;
extern bool lcd_longpress_trigger;
extern lcd_lcdupdate_func_t lcd_lcdupdate_func;
@ -121,6 +96,10 @@ extern void lcd_beeper_quick_feedback(void);
//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
extern void lcd_quick_feedback(void);
/// @brief Check whether knob is rotated or clicked and update relevant
///variables. Flags are set by lcd_buttons_update in ISR context.
extern void lcd_knob_update();
extern void lcd_update(uint8_t lcdDrawUpdateOverride);
extern void lcd_update_enable(uint8_t enabled);
@ -132,38 +111,25 @@ extern void lcd_buttons_update(void);
//! When constructed (on stack), original state state of lcd_update_enabled is stored
//! and LCD updates are disabled.
//! When destroyed (gone out of scope), original state of LCD update is restored.
//! It has zero overhead compared to storing bool saved = lcd_update_enabled
//! and calling lcd_update_enable(false) and lcd_update_enable(saved).
//! Do not call lcd_update_enable() to prevent calling lcd_update() in sensitive code.
//! in certain scenarios it will cause recursion e.g. in the menus.
class LcdUpdateDisabler
{
public:
LcdUpdateDisabler(): m_updateEnabled(lcd_update_enabled)
{
lcd_update_enable(false);
lcd_update_enabled = false;
}
~LcdUpdateDisabler()
{
lcd_update_enable(m_updateEnabled);
lcd_update_enabled = m_updateEnabled;
}
private:
bool m_updateEnabled;
};
////////////////////////////////////
// Setup button and encode mappings for each panel (into 'lcd_buttons' variable
//
// This is just to map common functions (across different panels) onto the same
// macro name. The mapping is independent of whether the button is directly connected or
// via a shift/i2c register.
#define BLEN_B 1
#define BLEN_A 0
#define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A (1<<BLEN_A)
#define BLEN_C 2
#define EN_C (1<<BLEN_C)
//! @brief Was button clicked?
//!
@ -174,42 +140,32 @@ private:
//!
//! @retval 0 button was not clicked
//! @retval 1 button was clicked
#define LCD_CLICKED (lcd_buttons&EN_C)
////////////////////////
// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
// These values are independent of which pins are used for EN_A and EN_B indications
// The rotary encoder part is also independent to the chipset used for the LCD
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#define LCD_CLICKED (lcd_click_trigger)
////////////////////////////////////
//Custom characters defined in the first 8 characters of the LCD
#define LCD_STR_BEDTEMP "\x00"
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_UP "\x0B"
#define LCD_STR_ARROW_DOWN "\x01"
#define LCD_STR_ARROW_RIGHT "\x7E" //from the default character set
#define LCD_STR_ARROW_RIGHT "\x7E" //from the default character set
#define LCD_STR_ARROW_LEFT "\x7F" //from the default character set
#define LCD_STR_BEDTEMP "\x80"
#define LCD_STR_DEGREE "\x81"
#define LCD_STR_THERMOMETER "\x82"
#define LCD_STR_UPLEVEL "\x83"
#define LCD_STR_REFRESH "\x84"
#define LCD_STR_FOLDER "\x85"
#define LCD_STR_FEEDRATE "\x86"
#define LCD_STR_CLOCK "\x87"
#define LCD_STR_ARROW_2_DOWN "\x88"
#define LCD_STR_CONFIRM "\x89"
#define LCD_STR_SOLID_BLOCK "\xFF" //from the default character set
extern void lcd_set_custom_characters(void);
extern void lcd_set_custom_characters_arrows(void);
extern void lcd_set_custom_characters_progress(void);
extern void lcd_set_custom_characters_nextpage(void);
extern void lcd_set_custom_characters_degree(void);
extern void lcd_frame_start();
//! @brief Consume click event
//! @brief Consume click and longpress event
inline void lcd_consume_click()
{
lcd_button_pressed = 0;
lcd_buttons &= 0xff^EN_C;
lcd_click_trigger = 0;
lcd_longpress_trigger = 0;
}

93
Firmware/macros.h Normal file
View File

@ -0,0 +1,93 @@
#ifndef MACROS_H
#define MACROS_H
#include <avr/interrupt.h> //for cli() and sei()
#define FORCE_INLINE __attribute__((always_inline)) inline
#define _UNUSED __attribute__((unused))
#ifndef CRITICAL_SECTION_START
#define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
#define CRITICAL_SECTION_END SREG = _sreg;
#endif //CRITICAL_SECTION_START
#define _REGNAME(registerbase,number,suffix) registerbase##number##suffix
#define _REGNAME_SHORT(registerbase,suffix) registerbase##suffix
// Macros to make a string from a macro
#define STRINGIFY_(M) #M
#define STRINGIFY(M) STRINGIFY_(M)
// Macros for bit masks
#undef _BV
#define _BV(n) (1<<(n))
#define TEST(n,b) (!!((n)&_BV(b)))
#define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
#ifndef SBI
#define SBI(A,B) (A |= (1 << (B)))
#endif
#ifndef CBI
#define CBI(A,B) (A &= ~(1 << (B)))
#endif
#define TBI(N,B) (N ^= _BV(B))
// Macros to chain up to 12 conditions
#define _DO_1(W,C,A) (_##W##_1(A))
#define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B))
#define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V))
#define _DO_4(W,C,A,V...) (_##W##_1(A) C _DO_3(W,C,V))
#define _DO_5(W,C,A,V...) (_##W##_1(A) C _DO_4(W,C,V))
#define _DO_6(W,C,A,V...) (_##W##_1(A) C _DO_5(W,C,V))
#define _DO_7(W,C,A,V...) (_##W##_1(A) C _DO_6(W,C,V))
#define _DO_8(W,C,A,V...) (_##W##_1(A) C _DO_7(W,C,V))
#define _DO_9(W,C,A,V...) (_##W##_1(A) C _DO_8(W,C,V))
#define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V))
#define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V))
#define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V))
#define __DO_N(W,C,N,V...) _DO_##N(W,C,V)
#define _DO_N(W,C,N,V...) __DO_N(W,C,N,V)
#define DO(W,C,V...) _DO_N(W,C,NUM_ARGS(V),V)
// Macros to support option testing
#define _CAT(a,V...) a##V
#define CAT(a,V...) _CAT(a,V)
#define _ISENA_ ~,1
#define _ISENA_1 ~,1
#define _ISENA_0x1 ~,1
#define _ISENA_true ~,1
#define _ISENA(V...) IS_PROBE(V)
#define _ENA_1(O) _ISENA(CAT(_IS,CAT(ENA_, O)))
#define _DIS_1(O) NOT(_ENA_1(O))
#define ENABLED(V...) DO(ENA,&&,V)
#define DISABLED(V...) DO(DIS,&&,V)
#define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION converted to '0' or '1'
#define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION converted to A or '0'
#define TERN1(O,A) _TERN(_ENA_1(O),1,A) // OPTION converted to A or '1'
#define TERN_(O,A) _TERN(_ENA_1(O),,A) // OPTION converted to A or '<nul>'
#define _TERN(E,V...) __TERN(_CAT(T_,E),V) // Prepend 'T_' to get 'T_0' or 'T_1'
#define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
#define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B.
// Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
#define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
#define NUM_ARGS(V...) _NUM_ARGS(0,V,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
//
// Primitives supporting precompiler REPEAT
//
#define FIRST(a,...) a
#define SECOND(a,b,...) b
#define THIRD(a,b,c,...) c
#define IS_PROBE(V...) SECOND(V, 0) // Get the second item passed, or 0
#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
#endif //MACROS_H

379
Firmware/meatpack.cpp Normal file
View File

@ -0,0 +1,379 @@
/*
* MeatPack G-Code Compression
*
* Algorithm & Implementation: Scott Mudge - mail@scottmudge.com
* Date: Dec. 2020
*/
#include "meatpack.h"
#ifdef ENABLE_MEATPACK
#include "language.h"
#include "Marlin.h"
//#define MP_DEBUG
// Utility definitions
#define MeatPack_CommandByte 0b11111111
#define MeatPack_NextPackedFirst 0b00000001
#define MeatPack_NextPackedSecond 0b00000010
#define MeatPack_SpaceCharIdx 11U
#define MeatPack_SpaceCharReplace 'E'
#define MeatPack_ProtocolVersion "PV01"
/*
Character Frequencies from ~30 MB of comment-stripped gcode:
'1' -> 4451136
'0' -> 4253577
' ' -> 3053297
'.' -> 3035310
'2' -> 1523296
'8' -> 1366812
'4' -> 1353273
'9' -> 1352147
'3' -> 1262929
'5' -> 1189871
'6' -> 1127900
'7' -> 1112908
'\n' -> 1087683
'G' -> 1075806
'X' -> 975742
'E' -> 965275
'Y' -> 965274
'F' -> 99416
'-' -> 90242
'Z' -> 34109
'M' -> 11879
'S' -> 9910
If spaces are omitted, we add 'E'
*/
// Note:
// I've tried both a switch/case method and a lookup table. The disassembly is exactly the same after compilation, byte-to-byte.
// Thus, performance is identical.
#define USE_LOOKUP_TABLE
// State variables
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
enum MeatPack_ConfigStateFlags {
MPConfig_None = 0,
MPConfig_Active = (1 << 0),
MPConfig_NoSpaces = (1 << 1)
};
uint8_t mp_config = MPConfig_None; // Configuration state
uint8_t mp_cmd_active = 0; // Is a command is pending
uint8_t mp_char_buf = 0; // Buffers a character if dealing with out-of-sequence pairs
uint8_t mp_cmd_count = 0; // Counts how many command bytes are received (need 2)
uint8_t mp_full_char_queue = 0; // Counts how many full-width characters are to be received
uint8_t mp_char_out_buf[2]; // Output buffer for caching up to 2 characters
uint8_t mp_char_out_count = 0; // Stores number of characters to be read out.
#ifdef USE_LOOKUP_TABLE
// The 15 most-common characters used in G-code, ~90-95% of all g-code uses these characters
// NOT storing this with PROGMEM, given how frequently this table will be accessed.
uint8_t MeatPackLookupTbl[16] = {
'0', // 0000
'1', // 0001
'2', // 0010
'3', // 0011
'4', // 0100
'5', // 0101
'6', // 0110
'7', // 0111
'8', // 1000
'9', // 1001
'.', // 1010
' ', // 1011
'\n', // 1100
'G', // 1101
'X', // 1110
'\0' // never used, 0b1111 is used to indicate next 8-bits is a full character
};
#else
inline uint8_t get_char(const uint8_t in) {
switch (in) {
case 0b0000:
return '0';
break;
case 0b0001:
return '1';
break;
case 0b0010:
return '2';
break;
case 0b0011:
return '3';
break;
case 0b0100:
return '4';
break;
case 0b0101:
return '5';
break;
case 0b0110:
return '6';
break;
case 0b0111:
return '7';
break;
case 0b1000:
return '8';
break;
case 0b1001:
return '9';
break;
case 0b1010:
return '.';
break;
case 0b1011:
return (mp_config & MPConfig_NoSpaces) ? MeatPack_SpaceCharReplace : ' ';
break;
case 0b1100:
return '\n';
break;
case 0b1101:
return 'G';
break;
case 0b1110:
return 'X';
break;
}
return 0;
}
#endif
// #DEBUGGING
#ifdef MP_DEBUG
uint32_t mp_chars_decoded = 0;
#endif
void FORCE_INLINE mp_handle_output_char(const uint8_t c) {
mp_char_out_buf[mp_char_out_count++] = c;
#ifdef MP_DEBUG
if (mp_chars_decoded < 4096) {
++mp_chars_decoded;
SERIAL_ECHOPGM("RB: ");
MYSERIAL.print((char)c);
SERIAL_ECHOLNPGM("");
}
#endif
}
// Storing
// packed = ((low & 0xF) << 4) | (high & 0xF);
// Unpacking
// low = (packed >> 4) & 0xF;
// high = (packed & 0xF);
//==========================================================================
uint8_t FORCE_INLINE mp_unpack_chars(const uint8_t pk, uint8_t* __restrict const chars_out) {
uint8_t out = 0;
#ifdef USE_LOOKUP_TABLE
// If lower 4 bytes is 0b1111, the higher 4 are unused, and next char is full.
if ((pk & MeatPack_FirstNotPacked) == MeatPack_FirstNotPacked) out |= MeatPack_NextPackedFirst;
else chars_out[0] = MeatPackLookupTbl[(pk & 0xF)]; // Assign lower char
// Check if upper 4 bytes is 0b1111... if so, we don't need the second char.
if ((pk & MeatPack_SecondNotPacked) == MeatPack_SecondNotPacked) out |= MeatPack_NextPackedSecond;
else chars_out[1] = MeatPackLookupTbl[((pk >> 4) & 0xf)]; // Assign upper char
#else
// If lower 4 bytes is 0b1111, the higher 4 are unused, and next char is full.
if ((pk & MeatPack_FirstNotPacked) == MeatPack_FirstNotPacked) out |= MeatPack_NextPackedFirst;
else chars_out[0] = get_char(pk & 0xF); // Assign lower char
// Check if upper 4 bytes is 0b1111... if so, we don't need the second char.
if ((pk & MeatPack_SecondNotPacked) == MeatPack_SecondNotPacked) out |= MeatPack_NextPackedSecond;
else chars_out[1] = get_char((pk >> 4) & 0xf); // Assign upper char
#endif
return out;
}
//==============================================================================
void FORCE_INLINE mp_reset_state() {
mp_char_out_count = 0;
mp_cmd_active = MPCommand_None;
mp_config = MPConfig_None;
mp_char_buf = 0;
mp_cmd_count = 0;
mp_cmd_active = 0;
mp_full_char_queue = 0;
#ifdef MP_DEBUG
mp_chars_decoded = 0;
SERIAL_ECHOLNPGM("MP Reset");
#endif
}
//==========================================================================
void FORCE_INLINE mp_handle_rx_char_inner(const uint8_t c) {
// Packing enabled, handle character and re-arrange them appropriately.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (mp_config & MPConfig_Active) {
if (mp_full_char_queue > 0) {
mp_handle_output_char(c);
if (mp_char_buf > 0) {
mp_handle_output_char(mp_char_buf);
mp_char_buf = 0;
}
--mp_full_char_queue;
}
else {
uint8_t buf[2] = { 0,0 };
const uint8_t res = mp_unpack_chars(c, buf);
if (res & MeatPack_NextPackedFirst) {
++mp_full_char_queue;
if (res & MeatPack_NextPackedSecond) ++mp_full_char_queue;
else mp_char_buf = buf[1];
}
else {
mp_handle_output_char(buf[0]);
if (buf[0] != '\n') {
if (res & MeatPack_NextPackedSecond) ++mp_full_char_queue;
else mp_handle_output_char(buf[1]);
}
}
}
}
else // Packing not enabled, just copy character to output
mp_handle_output_char(c);
}
//==========================================================================
void FORCE_INLINE mp_echo_config_state() {
SERIAL_ECHOPGM(" [MP] "); // Add space at idx 0 just in case first character is dropped due to timing/sync issues.
// NOTE: if any configuration vars are added below, the outgoing sync text for host plugin
// should not contain the "PV' substring, as this is used to indicate protocol version
SERIAL_ECHOPGM(MeatPack_ProtocolVersion);
// Echo current state
if (mp_config & MPConfig_Active)
SERIAL_ECHOPGM(" ON");
else
SERIAL_ECHOPGM(" OFF");
if (mp_config & MPConfig_NoSpaces)
SERIAL_ECHOPGM(" NSP"); // [N]o [SP]aces
else
SERIAL_ECHOPGM(" ESP"); // [E]nabled [SP]aces
SERIAL_ECHOLNPGM("");
// Validate config vars
#ifdef USE_LOOKUP_TABLE
if (mp_config & MPConfig_NoSpaces)
MeatPackLookupTbl[MeatPack_SpaceCharIdx] = (uint8_t)(MeatPack_SpaceCharReplace);
else
MeatPackLookupTbl[MeatPack_SpaceCharIdx] = ' ';
#endif
}
//==========================================================================
void FORCE_INLINE mp_handle_cmd(const MeatPack_Command c) {
switch (c) {
case MPCommand_EnablePacking: {
mp_config |= MPConfig_Active;
#ifdef MP_DEBUG
SERIAL_ECHOLNPGM("[MPDBG] ENABL REC");
#endif
} break;
case MPCommand_DisablePacking: {
mp_config &= ~(MPConfig_Active);
#ifdef MP_DEBUG
SERIAL_ECHOLNPGM("[MPDBG] DISBL REC");
#endif
} break;
case MPCommand_ResetAll: {
mp_reset_state();
#ifdef MP_DEBUG
SERIAL_ECHOLNPGM("[MPDBG] RESET REC");
#endif
} break;
case MPCommand_EnableNoSpaces: {
mp_config |= MPConfig_NoSpaces;
#ifdef MP_DEBUG
SERIAL_ECHOLNPGM("[MPDBG] ENABL NSP");
#endif
} break;
case MPCommand_DisableNoSpaces: {
mp_config &= ~(MPConfig_NoSpaces);
#ifdef MP_DEBUG
SERIAL_ECHOLNPGM("[MPDBG] DISBL NSP");
#endif
} break;
default: {
#ifdef MP_DEBUG
SERIAL_ECHOLN("[MPDBG] UNK CMD REC");
#endif
}
case MPCommand_QueryConfig:
break;
}
mp_echo_config_state();
}
//==========================================================================
void mp_handle_rx_char(const uint8_t c) {
// Check for commit complete
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (c == (uint8_t)(MeatPack_CommandByte)) {
if (mp_cmd_count > 0) {
mp_cmd_active = 1;
mp_cmd_count = 0;
}
else
++mp_cmd_count;
return;
}
if (mp_cmd_active > 0) {
mp_handle_cmd((MeatPack_Command)c);
mp_cmd_active = 0;
return;
}
if (mp_cmd_count > 0) {
mp_handle_rx_char_inner((uint8_t)(MeatPack_CommandByte));
mp_cmd_count = 0;
}
mp_handle_rx_char_inner(c);
}
//==========================================================================
uint8_t mp_get_result_char(char* const __restrict out) {
if (mp_char_out_count > 0) {
const uint8_t res = mp_char_out_count;
for (uint8_t i = 0; i < mp_char_out_count; ++i)
out[i] = (char)mp_char_out_buf[i];
mp_char_out_count = 0;
return res;
}
return 0;
}
//==============================================================================
void mp_trigger_cmd(const MeatPack_Command cmd)
{
mp_handle_cmd(cmd);
}
#endif

70
Firmware/meatpack.h Normal file
View File

@ -0,0 +1,70 @@
/*
* MeatPack G-Code Compression
*
* Algorithm & Implementation: Scott Mudge - mail@scottmudge.com
* Date: Dec. 2020
*
* Specifically optimized for 3D printing G-Code, this is a zero-cost data compression method
* which packs ~180-190% more data into the same amount of bytes going to the CNC controller.
* As a majority of G-Code can be represented by a restricted alphabet, I performed histogram
* analysis on a wide variety of 3D printing gcode samples, and found ~93% of all gcode could
* be represented by the same 15-character alphabet.
*
* This allowed me to design a system of packing 2 8-bit characters into a single byte, assuming
* they fall within this limited 15-character alphabet. Using a 4-bit lookup table, these 8-bit
* characters can be represented by a 4-bit index.
*
* Combined with some logic to allow commingling of full-width characters outside of this 15-
* character alphabet (at the cost of an extra 8-bits per full-width character), and by stripping
* out unnecessary comments, the end result is gcode which is roughly half the original size.
*
* Why did I do this? I noticed micro-stuttering and other data-bottleneck issues while printing
* objects with high curvature, especially at high speeds. There is also the issue of the limited
* baud rate provided by Prusa's Atmega2560-based boards, over the USB serial connection. So soft-
* ware like OctoPrint would also suffer this same micro-stuttering and poor print quality issue.
*
*/
#include <stdint.h>
#include "Configuration.h"
#ifndef MEATPACK_H_
#define MEATPACK_H_
#ifdef ENABLE_MEATPACK
#define MeatPack_SecondNotPacked 0b11110000
#define MeatPack_FirstNotPacked 0b00001111
// These are commands sent to MeatPack to control its behavior.
// They are sent by first sending 2x MeatPack_CommandByte (0xFF) in sequence,
// followed by one of the command bytes below.
// Provided that 0xFF is an exceedingly rare character that is virtually never
// present in g-code naturally, it is safe to assume 2 in sequence should never
// happen naturally, and so it is used as a signal here.
//
// 0xFF *IS* used in "packed" g-code (used to denote that the next 2 characters are
// full-width), however 2 in a row will never occur, as the next 2 bytes will always
// some non-0xFF character.
enum MeatPack_Command {
MPCommand_None = 0U,
// MPCommand_TogglePacking = 253U, -- Unused, byte 253 can be re-used later.
MPCommand_EnablePacking = 251U,
MPCommand_DisablePacking = 250U,
MPCommand_ResetAll = 249U,
MPCommand_QueryConfig = 248U,
MPCommand_EnableNoSpaces = 247U,
MPCommand_DisableNoSpaces = 246U
};
// Pass in a character rx'd by SD card or serial. Automatically parses command/ctrl sequences,
// and will control state internally.
extern void mp_handle_rx_char(const uint8_t c);
// After passing in rx'd char using above method, call this to get characters out. Can return
// from 0 to 2 characters at once.
// @param out [in] Output pointer for unpacked/processed data.
// @return Number of characters returned. Range from 0 to 2.
extern uint8_t mp_get_result_char(char* const __restrict out);
#endif
#endif // MEATPACK_H_

Some files were not shown because too many files have changed in this diff Show More