Compare commits

...

409 Commits

Author SHA1 Message Date
InsanityAutomation 3ce050a494 Initial Commit 2021-05-25 09:21:30 -04:00
InsanityAutomation 6d39a6fc55 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-05-23 15:06:33 -04:00
Scott Lahteine d71b35c24f 🎨 Apply shorthand and cleanups 2021-05-23 03:04:36 -05:00
Scott Lahteine ff0318c5bd 🎨 pause => pause_heaters 2021-05-23 03:04:36 -05:00
Scott Lahteine 92dea8e6cc ♻️ Refactor, comment endstop/probe enums 2021-05-23 03:04:31 -05:00
thinkyhead e1921f808c [cron] Bump distribution date (2021-05-23) 2021-05-23 01:15:23 +00:00
Scott Lahteine d8c4be375c 🎨 Null heating message method 2021-05-22 17:56:31 -05:00
Scott Lahteine aee971bcaf 🎨 Combine M104/M109 and M140/M190 code 2021-05-22 17:47:23 -05:00
Scott Lahteine 6689e5ed75 🐛 Fix Selena Compact probe pin 2021-05-22 17:47:23 -05:00
Danol 43b736906a 🐛 Fix wrong Z_ENDSTOP flag bit (#21963)
Bug introduced in #18424
2021-05-22 17:47:23 -05:00
Alvaro Segura Del Barco 7c2834c33c 🐛 Fix Teensy PINS_DEBUG compile (#21958)
Followup to 84a11cfedc
2021-05-22 15:52:41 -05:00
Scott Lahteine 464a9f0ab6 📝 Update ExtUI example 2021-05-21 23:04:11 -05:00
Scott Lahteine 8af4d70922 🎨 Shorten lcd relative paths 2021-05-21 23:04:01 -05:00
Scott Lahteine 4ea4fa78aa 📝 Document diveToFile, printListing 2021-05-21 22:45:54 -05:00
thinkyhead 7985f7f116 [cron] Bump distribution date (2021-05-22) 2021-05-22 01:06:28 +00:00
Scott Lahteine 2de54dab84 🎨 Move HAS_EXTRUDERS 2021-05-21 08:40:30 -05:00
Scott Lahteine ad30909a2d 🎨 Update a condition 2021-05-21 08:37:46 -05:00
Scott Lahteine f4951ed56b 🎨 Rename all/no axis enums 2021-05-21 08:36:54 -05:00
Scott Lahteine 2db640ea80 Add a test for SAVED_POSITIONS 2021-05-21 00:31:56 -05:00
Scott Lahteine 8f0f6c1ac1 🐛 Fix compile with PREVENT_COLD_EXTRUSION off 2021-05-21 00:30:57 -05:00
thinkyhead 67f08ef07f [cron] Bump distribution date (2021-05-21) 2021-05-21 01:07:03 +00:00
Scott Lahteine 000388b1d9 🎨 MULTI_MANUAL => MULTI_E_MANUAL 2021-05-20 17:12:18 -05:00
Pascal de Bruijn 781b34709b MEDIA_MENU_AT_TOP for MarlinUI (#21925) 2021-05-20 06:35:38 -05:00
Moonglow 7da4ed7340 🐛 Fix Toshiba FlashAir (SDCARD_COMMANDS_SPLIT) (#21944) 2021-05-20 06:09:10 -05:00
charlespick 29ad42e54e Independent baud rates (#21949)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-05-20 06:06:26 -05:00
Scott Lahteine e018f041ba 🎨 Move switch sensor strings 2021-05-20 00:59:58 -05:00
Scott Lahteine 49771c4a9e 🎨 Flags for homing directions 2021-05-20 00:59:58 -05:00
Scott Lahteine 0dae140080 🐛 Fix DELTA with SENSORLESS_PROBING 2021-05-20 00:59:58 -05:00
Scott Lahteine 458677c63a ♻️ Refactor axis homing/trusted state bits 2021-05-20 00:59:58 -05:00
Scott Lahteine 02f904dbf9 ♻️ Minimize endstop bits 2021-05-20 00:59:58 -05:00
Scott Lahteine 18b1ccda27 Fix tests for EXTRUDERS 0 2021-05-20 00:59:58 -05:00
Scott Lahteine 926a7f27c6 ♻️ Simplify TMC utilities for more axes 2021-05-20 00:59:58 -05:00
Scott Lahteine a6e5492b08 ♻️ Refactor axis counts and loops 2021-05-20 00:59:58 -05:00
Scott Lahteine abbe3f0dc7 🎨 Misc cleanup and fixes 2021-05-20 00:59:58 -05:00
Scott Lahteine 50355f4607 Fix 'G29 K' value 2021-05-19 22:02:28 -05:00
thinkyhead 419d67237c [cron] Bump distribution date (2021-05-20) 2021-05-20 01:03:10 +00:00
thinkyhead 90f46d1226 [cron] Bump distribution date (2021-05-19) 2021-05-19 01:05:23 +00:00
Scott Lahteine ad8c16177e Use defined strings 2021-05-17 21:17:42 -05:00
ellensp 1e189506ef Fix EEPROM_CHITCHAT (#21934)
Fix #21929
2021-05-17 21:16:47 -05:00
thinkyhead 4d7feea72e [cron] Bump distribution date (2021-05-18) 2021-05-18 01:09:42 +00:00
ellensp c3a65eef7a Fix envs using mks_encrypt.py (#21933)
Fix #21928
2021-05-17 18:22:33 -05:00
thinkyhead 9c61e6f1c0 [cron] Bump distribution date (2021-05-17) 2021-05-17 01:06:01 +00:00
ekef ebb75a529b Fix MKS Robin E3 BLTOUCH and Fan PWM timer conflicts (#21889) 2021-05-16 13:59:15 -05:00
InsanityAutomation 10e5d92dec Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-05-16 14:18:43 -04:00
thinkyhead 533ba2ac96 [cron] Bump distribution date (2021-05-16) 2021-05-16 01:12:19 +00:00
Scott Lahteine 05bb3bde7a Update Hex Version to 02000801 2021-05-15 15:21:02 -05:00
Luu Lac 7f774cab90 M154 Position Auto-Report (#18427)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-05-15 15:02:20 -05:00
Moonglow 376f0be5da Fix MKS UI missing font select condition (#21905) 2021-05-14 22:30:16 -05:00
ondrada 874c531f27 Fix G29_RETRY_AND_RECOVER dependency (#21907)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-14 22:29:17 -05:00
thinkyhead 3b4643d31a [cron] Bump distribution date (2021-05-15) 2021-05-15 01:05:33 +00:00
Victor Oliveira 2a5ab55c36 🚑️ Fix TFT for Robin Pro (#21900) 2021-05-14 00:22:43 -05:00
Keith Bennett e5b280c309 🚑️ BTT Octopus Step Timer (#21901) 2021-05-14 00:20:24 -05:00
Scott Lahteine a69e2923dd 🐛 Fix RR collision with MM (#21902) 2021-05-14 00:17:04 -05:00
Jamie d97c1f1c62 Instant Freeze/Resume Function (#17462)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-05-14 00:14:59 -05:00
thinkyhead 558b60858c [cron] Bump distribution date (2021-05-14) 2021-05-14 01:08:17 +00:00
Keith Bennett fe60a18923 Fix Octopus 12864 LCD Delays (#21883) 2021-05-13 15:25:39 -05:00
ellensp 90f1436764 Fix nextion compile error (#21884) 2021-05-13 15:19:12 -05:00
Alexander D. Kanevskiy 9336517258 Fix compilation failure in M1001 (#21897) 2021-05-13 15:10:48 -05:00
FilippoR e72fe0ad14 fix compilation for home hon top (#21894) 2021-05-13 10:56:49 -05:00
Scott Lahteine 69473daa3d 🔧 Improve SD_DETECT_STATE default (#21885) 2021-05-13 01:14:37 -05:00
thinkyhead 75f76cbf26 [cron] Bump distribution date (2021-05-13) 2021-05-13 01:06:32 +00:00
Scott Lahteine eb7f75461a Clean up hasty PR 2021-05-12 19:44:21 -05:00
Victor Oliveira c8f9a32610 Update Robin Pro TFT Pins (#21879) 2021-05-12 18:10:31 -05:00
Victor Oliveira b3804fb277 minor multi volume config typo (#21880) 2021-05-12 17:57:43 -05:00
Keith Bennett 175fac8fe8 Always Invert Octopus Onboard SD Detect Pin (#21882) 2021-05-12 17:48:24 -05:00
Scott Lahteine 75dadcc669 📝 Fix version reference 2021-05-12 03:27:56 -05:00
Keith Bennett 3734e8e02f BigTreeTech Octopus board (STM32F446ZET6) (#21826) 2021-05-12 03:26:19 -05:00
Elton Law de77dbedf1 🐛 Fix G5 IJ with Motion Mode (#21858) 2021-05-12 02:21:55 -05:00
ellensp 10a1ff1622 Fix compile error (#21877) 2021-05-12 02:18:44 -05:00
vyacheslav-shubin 0d629c80c7 🩹 G60-G61 Save E position (#21810) 2021-05-12 02:17:06 -05:00
thinkyhead 5353a1ed1a [cron] Bump distribution date (2021-05-12) 2021-05-12 01:01:39 +00:00
Scott Lahteine 0c8a53e507 🎨 Misc. code cleanup 2021-05-11 10:47:50 -05:00
Scott Lahteine 390878e78a 🎨 Additional utility macros 2021-05-11 10:47:50 -05:00
Scott Lahteine 398ce22c2e 🎨 Better error message for bad array sizes 2021-05-11 10:45:57 -05:00
Victor Oliveira a42760d38a BTT SKR Mini E3 for HAL/STM32 (#21488) 2021-05-11 10:44:54 -05:00
Scott Lahteine e5dc2c5321 Simplify macro expansion with recursion (#21859) 2021-05-11 08:30:16 -05:00
Scott Lahteine 0264316797 Fix L64xx init for Z4 2021-05-11 03:48:52 -05:00
Scott Lahteine 9746a8427c Use adafruit/Adafruit NeoPixel@~1.8.0 2021-05-11 03:46:34 -05:00
Scott Lahteine dd16d6ad6e Update Chart.js to 2.9.4
Addressing CVE-2020-7746
2021-05-10 22:47:34 -05:00
thinkyhead 782ced6ff7 [cron] Bump distribution date (2021-05-11) 2021-05-11 01:00:06 +00:00
ellensp 61ac1ed2f6 update FLSUN_HISPEED env to flsun_hispeedv1 (#21510) 2021-05-10 16:33:43 -05:00
tobuh 8e56f9366d Fix and improve Power-Loss Recovery (#21779)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-05-10 07:24:35 -05:00
thinkyhead 4a7f5603de [cron] Bump distribution date (2021-05-10) 2021-05-10 01:00:29 +00:00
Giuliano Zaro fff5e9ba4a Fix insane mmu2 timeout (#21855)
* Fix insane mmu2 timeout

Fix insane timeout value. Now match original Prusa firmware.

* Update mmu2.cpp

Co-authored-by: Luu Lac <45380455+shitcreek@users.noreply.github.com>
2021-05-09 16:58:36 -04:00
Keith Bennett b12d0d06eb Unify BTT Motor Expansion Options (#21823) 2021-05-09 03:52:53 -05:00
Scott Lahteine 49548c343d Optimize G-code flag parameters (#21849) 2021-05-09 03:50:51 -05:00
charlespick 4588d836a3 Update Advanced Pause description (#21829)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-05-08 22:46:35 -05:00
Victor Oliveira 4335f4e41f 🐛 Fix Lerdge USB Flash Drive envs (#21847) 2021-05-08 21:05:47 -05:00
BigTreeTech c9de9d4f9b Capacitive Touch Screen (GT911) for SKR SE BX (#21843)
Co-authored-by: Msq001 <alansayyeah@gmail.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-08 21:02:16 -05:00
thinkyhead 6cc45d2578 [cron] Bump distribution date (2021-05-09) 2021-05-09 01:08:03 +00:00
Scott Lahteine 9f10695b3f Fix TFT typo 2021-05-08 19:00:47 -05:00
Scott Lahteine 42a2b5c3ec Move temp errors calling kill() out of ISR (#21832) 2021-05-08 17:34:21 -05:00
sanek88lbl f95f18c8e5 Lerdge K EEPROM and TFT (#21812)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-08 17:06:21 -05:00
Antonino Di Guardo adefecca6c Always prompt in M125 if host-prompt (as with Ext UI) (#21828)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-08 06:27:02 -05:00
Scott Lahteine 4f2ff42003 Update SKR 1.3 touch pins 2021-05-08 06:01:52 -05:00
Scott Lahteine 98e7e63240 TFT pins for BTT GTR V1
Proposed in #21772
2021-05-08 06:01:52 -05:00
Scott Lahteine 6f494e9bed Better opt_set comment of old val 2021-05-08 05:49:06 -05:00
Scott Lahteine b65cdbed91 Signal SD completion later (#21840) 2021-05-08 04:35:35 -05:00
Adrian DC 57025b75e1 Fix E3V2 Control Menu icon/text order (#21838)
Fixes #21837
2021-05-08 01:46:21 -05:00
charlespick 01741576eb Active MMU slot indicator (#21842) 2021-05-08 01:44:34 -05:00
Scott Lahteine f09fa69e86 Add and apply REPEAT_1 macro 2021-05-08 01:41:40 -05:00
Scott Lahteine a03811f4e8 Update MF states 2021-05-07 22:58:31 -05:00
Scott Lahteine 206d495ba4 Misc. code cleanup 2021-05-07 22:56:54 -05:00
Scott Lahteine 1292ff76b3 Debounce for Power-Loss pin 2021-05-07 22:56:54 -05:00
Scott Lahteine 9f7177c67d Misc Power Loss cleanup 2021-05-07 22:56:54 -05:00
thinkyhead 8fd4bfc0e7 [cron] Bump distribution date (2021-05-08) 2021-05-08 00:57:21 +00:00
Scott Lahteine 4428affc20 Let M421 C select any point
Fixing #21147
2021-05-07 00:56:01 -05:00
ellensp 02405add76 Support a third serial port (#21784) 2021-05-07 00:31:45 -05:00
Scott Lahteine be6fbc76a1 Serial and pins debug cleanup
- Rename some AVR / DUE / ESP32 serial types
- Reduce two #error to one static_assert
- Update AVR/DUE error messages
2021-05-06 22:39:34 -05:00
thinkyhead 32bf447644 [cron] Bump distribution date (2021-05-07) 2021-05-07 00:58:41 +00:00
Scott Lahteine ecca81beba Reformat features.ini 2021-05-06 19:34:15 -05:00
InsanityAutomation 2e11485da4 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-05-06 11:55:25 -04:00
sanek88lbl 9485d44903 Patches for CASE_LIGHT_USE_RGB_LED (#21811)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-06 06:10:18 -05:00
Luu Lac 64ad96e19e TFT SPI for BTT SKR v1.3 (#21794) 2021-05-06 04:52:18 -05:00
Scott Lahteine a7cb13f339 Tweak SKR pins comments 2021-05-06 04:44:55 -05:00
Scott Lahteine 6f06801f1d Detab 2021-05-06 04:44:53 -05:00
Scott Lahteine 8d9021e806 Move ExtUI subfolders up a level (#21820) 2021-05-06 04:17:59 -05:00
ellensp fb87b2d1ad Simplify / undef extra endstops (#21808)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-05-06 01:54:02 -05:00
Scott Lahteine 28318f27d9 Use SERIAL_ECHOLNPAIR for resend 2021-05-06 01:51:19 -05:00
ellensp b1cca43252 Fix MMU2 compile with include (#21809) 2021-05-06 01:43:16 -05:00
hannesweisbach 857976b29f Allow undefined [XYZ]_ENABLE_PIN (for sensitive pins) (#21801) 2021-05-05 20:13:21 -05:00
Keith Bennett cbcc6ef9c4 Split up SKR V2 Rev A / B (#21805) 2021-05-05 20:11:54 -05:00
ManuelMcLure bac72ff0cc Only look for target disk during Upload (#21804) 2021-05-05 19:59:56 -05:00
thinkyhead 2470dc822f [cron] Bump distribution date (2021-05-06) 2021-05-06 00:55:43 +00:00
Scott Lahteine 1eb68e9f9a Echo LCD message to serial in kill 2021-05-05 17:43:01 -05:00
Scott Lahteine 301ee6c57a Add MKS_LCD12864B 2021-05-05 17:03:08 -05:00
InsanityAutomation d305f0a14b Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-05-05 09:46:59 -04:00
Scott Lahteine fccfcfbe5f Cleanup, hex formatting, includes 2021-05-05 08:04:04 -05:00
Scott Lahteine 5f30e9fe1c Add MKS_LCD12864B 2021-05-05 08:04:04 -05:00
Scott Lahteine 80c8218d94 Add MKS_LCD12864B 2021-05-05 07:23:52 -05:00
Scott Lahteine bed2bfdc24 Misc comments 2021-05-05 07:18:05 -05:00
Scott Lahteine 6f2967a8dc Cleanup, hex formatting 2021-05-05 06:34:02 -05:00
thinkyhead f3f82f56bf [cron] Bump distribution date (2021-05-05) 2021-05-05 00:57:34 +00:00
Scott Lahteine 9405a5e443 Fix flush_and_request_resend 2021-05-04 01:47:42 -05:00
Vert f4f41d01bf UMW follow-up (#21791) 2021-05-03 21:07:57 -05:00
Scott Lahteine dfc906930c Pause and PLR refinements
- Move `pause_print` argument `unload_length` after `show_lcd` so it's next to `DXC_ARGS`.
- Tweak the position and conditions of PLR save in `resume_print`.
- Add `Nozzle::park_mode_0_height` accessor to get the raised Z height.
- Remove extraneous `recovery.save` from `dwin.cpp`.
- Move PLR `info.volumetric...` to `flag`.
- Remove some G-code spaces in PLR code
- Document `pause.h` function declarations.
2021-05-03 20:55:05 -05:00
Scott Lahteine 01825d883e Apply SBI/CBI/TEST in HAL 2021-05-03 20:23:14 -05:00
thinkyhead 65b1139d93 [cron] Bump distribution date (2021-05-04) 2021-05-04 00:59:46 +00:00
Victor Oliveira dc18769010 Prevent watchdog reset in setup() (#21776)
Cause `manage_heaters` to only reset the watchdog and return until `setup()` is completed.

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-02 21:37:54 -05:00
Scott Lahteine 9dd884a324 Drop early_safe_delay 2021-05-02 21:32:42 -05:00
Scott Lahteine becdac19ea Temperature cleanup 2021-05-02 21:32:21 -05:00
thinkyhead eaa64967b5 [cron] Bump distribution date (2021-05-03) 2021-05-03 01:04:25 +00:00
Victor Oliveira fb2bfe1cef Fix bad DELTA probe move (#21781) 2021-05-02 17:05:15 -05:00
Vert cb5e6bfef6 UBL Mesh Wizard (#21556)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-02 16:38:55 -05:00
Scott Lahteine 30c299fd26 Fix parser temperature rounding 2021-05-02 16:07:27 -05:00
Victor Oliveira ae06ee24c5 Fix bad call to 'diskIODriver' (#21775) 2021-05-02 16:06:44 -05:00
Scott Lahteine fbc7a3775a SOFT_RESET_VIA_SERIAL sanity-check 2021-05-02 03:02:24 -05:00
Ken Sanislo 78de32e552 Allow Creality V4 SERVO0 and PROBE pin overrides (#21770) 2021-05-02 02:09:23 -05:00
Elton Law 661395a3b2 Allow disable of POWER_TIMEOUT (#21771)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-02 02:06:55 -05:00
Scott Lahteine 257ae51275 Use ststm32@~12.1 2021-05-01 21:15:12 -05:00
vyacheslav-shubin 46eb12da51 ExtUI event for PID tuning start (#21734) 2021-05-01 20:28:49 -05:00
thinkyhead 4d544e35e3 [cron] Bump distribution date (2021-05-02) 2021-05-02 01:16:57 +00:00
Scott Lahteine 95a5d63622 Air Assist tests 2021-05-01 20:10:16 -05:00
Scott Lahteine ffbf7a9141 Fix undefined abl_points 2021-05-01 20:07:20 -05:00
Scott Lahteine a95a21a353 Define 'filelist' for dgus/origin 2021-05-01 20:07:20 -05:00
Mike La Spina 741e3c1280 Laser Cutter Air Assist (#21753) 2021-05-01 19:59:45 -05:00
ellensp 9d43570ada Add missing ExtUI method (#21763)
Fixes #21761
2021-05-01 19:42:38 -05:00
Sebastiaan Dammann b356b44849 Fix Z raise in filament load M701 (#21762)
Fixes #21750
2021-05-01 19:38:31 -05:00
tobuh 05c25b8cdb Fix Power-Loss Save on Pause (#21749) 2021-05-01 03:46:26 -05:00
hartmannathan eddce4182b Comment correction (#21729) 2021-05-01 03:43:32 -05:00
ellensp ef9ca61039 Fix Singlenozzle Standby issues (#21759)
Fixes #21758

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-05-01 03:21:18 -05:00
ellensp 8c912d7ece Fix SDCARD_CONNECTION default for BTT SKR (#21755) 2021-04-30 23:15:16 -05:00
thinkyhead ff41bf5be8 [cron] Bump distribution date (2021-05-01) 2021-05-01 01:04:09 +00:00
Scott Lahteine 2f537768bc MKS Robin flash address 2021-04-30 08:30:41 -05:00
Nikolay March 68c010f82a Sanity-check for COREnn backlash (#21731) 2021-04-30 04:45:43 -05:00
lujios 4e4c3ef8fc Fix compile with DISTINCT_E_FACTORS + SLIM_LCD_MENUS (#21733)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-30 04:38:30 -05:00
Scott Lahteine e4f60f82a4 Heater error status 2021-04-30 03:24:57 -05:00
Keith Bennett f58b923fd4 Fix BTT E3 RRF and SKR V2 (Generic PIO) (#21741)
Follow-up to #21655
2021-04-30 03:07:18 -05:00
David cfdfd16779 Fix Thermal Runaway false-alarm in M303, add HeaterWatch::check (#21743)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-30 01:51:26 -05:00
Scott Lahteine 636facf40d Silence warning in gcode_D 2021-04-29 21:13:54 -05:00
thinkyhead b5fac1ac95 [cron] Bump distribution date (2021-04-30) 2021-04-30 00:24:56 +00:00
thinkyhead 082fce5e3e [cron] Bump distribution date (2021-04-29) 2021-04-29 00:34:04 +00:00
David 2e0a1f1aff Color UI Move Screen for 320x240 TFT (#21708) 2021-04-28 04:08:21 -05:00
thinkyhead f7f88b7187 [cron] Bump distribution date (2021-04-28) 2021-04-28 00:34:25 +00:00
Keith Bennett f04b2a9390 Clean up TFT comments (#21723) 2021-04-27 19:21:13 -05:00
Keith Bennett 516fe131be BTT SKR V2 probe and chamber pins (#21717) 2021-04-27 07:16:19 -05:00
Scott Lahteine ee016e605c Rename, clean up boards/variants (#21655)
* Consolidate variant scripts
* Rename Marlin-local boards
* Simplify variants where possible
* Rename variants
* CHITU_F103 and MEEB_3DP: Maple platform `platformio-build-stm32f1.py` uses the 'board' name, not 'board_build.variant' so folder names match 'board' and not `board_build.variant`.
2021-04-27 04:49:21 -05:00
Keith Bennett 69d85cce2d BTT SKR V2.0 / Stepper Driver Anti-Reverse Protection (#21503) 2021-04-27 02:22:09 -05:00
Adrian DC fe7f5ca7f4 Fix E3V2 Advanced Settings with PLR off (#21700)
Fixes #21534
2021-04-26 23:42:28 -05:00
Marcio T 9c7344487a FTDI EVE Touch UI fixes (#21706) 2021-04-26 23:40:59 -05:00
ellensp 5f9aac2027 Use temp_info_t for temp_redundant (#21715)
Fixes #21712

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-04-26 23:36:39 -05:00
thinkyhead 43fc1bd21c [cron] Bump distribution date (2021-04-27) 2021-04-27 00:35:59 +00:00
Victor Oliveira a981c33bad Remove compiler flag merge-constants (#21711) 2021-04-26 19:30:34 -05:00
Sebastiaan Dammann 36ec7ab150 Make Cancel Objects reporting optional (#21698) 2021-04-26 18:32:13 -05:00
hartmannathan 5301ec618b typo (#21710) 2021-04-26 18:30:26 -05:00
Vert a0a24e9380 Help users confused by "bed size" (#21714) 2021-04-26 18:23:00 -05:00
Keith Bennett 40d789ce18 Fix "continuous" typo (#21701) 2021-04-25 23:34:42 -05:00
Scott Lahteine 641bca87bc Prettier output from opt scripts (#21707) 2021-04-25 23:33:52 -05:00
Vert 5ad473fc62 Fix relocated LiquidCrystal library (#21699)
Followup to 770e539859
2021-04-25 20:55:15 -05:00
thinkyhead 7aeb6b5200 [cron] Bump distribution date (2021-04-26) 2021-04-26 00:36:31 +00:00
Scott Lahteine e250f6a275 whitespace 2021-04-25 17:17:33 -05:00
Scott Lahteine e59192b9ea Fix HMI_HomeOffN axis
Followup to #21534
2021-04-25 04:15:13 -05:00
pinchies a1ee5124d3 Fix usage, commentary of MANUAL_PROBE_START_Z, Z_AFTER_PROBING (#21692)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-25 03:48:20 -05:00
thinkyhead a280077820 [cron] Bump distribution date (2021-04-25) 2021-04-25 00:36:37 +00:00
Miguel Risco-Castillo 13f3ccb85d E3V2 DWIN Advanced Settings (#21534)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-24 18:50:44 -05:00
Scott Lahteine 770e539859 Use Adafruit LiquidCrystal 2021-04-24 15:41:01 -05:00
Scott Lahteine 993f9f3efd Remove extra platform_packages line 2021-04-24 15:23:28 -05:00
Scott Lahteine f3c7b61f29 Add INO to .editorconfig 2021-04-24 15:23:28 -05:00
Vert 3b8f83a5ae Sanity check MIXING_EXTRUDER + DISTINCT_E_FACTORS (#21689) 2021-04-24 05:35:02 -05:00
Scott Lahteine 836c4e0198 Drop Deviot workaround 2021-04-24 05:28:50 -05:00
Scott Lahteine dfcccb63a1 Use temperature accessors 2021-04-24 05:20:55 -05:00
Nikolay March 6f5800bd74 Backlash Compensation for COREnn (#21612)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-04-24 04:38:00 -05:00
fedetony d3a2c6a0b4 Soft Reset via Serial or post-kill button click (#21652)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-24 02:53:52 -05:00
Ramiro Polla 7a8e3cc258 Avoid + 0.0f in menu items (#21642) 2021-04-24 02:52:34 -05:00
Malderin e7f26cabfe Fix Bed Tramming 5th point (#21646) 2021-04-24 02:42:44 -05:00
Scott Lahteine a29aefc9c0 Move last bootscreen delay to end of setup (#21665) 2021-04-24 01:29:30 -05:00
Ryan Finnie a73dce4a56 Clean up / improve generate_version script (#21674) 2021-04-24 01:26:17 -05:00
vyacheslav-shubin f424da498a ExtUI::onPostprocessSettings (#21683) 2021-04-24 01:16:14 -05:00
Sebastiaan Dammann 8b5e7429d7 Prevent extrusion on M600 un-park (#21670)
Fixes #21669
2021-04-24 01:01:17 -05:00
unknownlamer 5dfe28db2a MCP4451 Digipot Support for Azteeg X5 GT (#21680) 2021-04-24 00:59:31 -05:00
ellensp 949d2d9e50 Fix MP_SCARA compile (#21686) 2021-04-24 00:11:11 -05:00
Jim Hyslop 0fe30d14a8 Don't display service prompt unless needed (#21654) 2021-04-24 00:09:51 -05:00
Victor Oliveira 46f272b669 Fix Celsius precision, current temp accessors (#21678) 2021-04-23 20:29:15 -05:00
Scott Lahteine c4620bb528 Add whole-degree accessors, simplify some temperature-related features (#21685) 2021-04-23 20:19:23 -05:00
thinkyhead 384e09aa7c [cron] Bump distribution date (2021-04-24) 2021-04-24 00:54:41 +00:00
Scott Lahteine 54ad22a455 Let compiler do Temperature inlining 2021-04-23 19:40:46 -05:00
Scott Lahteine 3bddbb1110 Clean up formatting, wrap macros 2021-04-23 19:21:39 -05:00
Scott Lahteine 72e3d2492f Update temperature types 2021-04-23 19:20:11 -05:00
Scott Lahteine 51a61c5431 Nextion cleanup 2021-04-23 19:15:22 -05:00
Scott Lahteine 4e10f46899 Use configured temp window for Chiron 2021-04-23 19:10:32 -05:00
thinkyhead a729cdcfdd [cron] Bump distribution date (2021-04-23) 2021-04-23 00:34:45 +00:00
BigTreeTech a58276c4c1 Enable Purge More / Resume with EP + Host Prompt (#21671)
Co-authored-by: Msq001 <alansayyeah@gmail.com>
2021-04-22 18:43:28 -05:00
Mike La Spina f075dd0db3 M10-M11 Air Evacuation for Spindle/Laser (#21668)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-22 18:19:41 -05:00
thinkyhead 4d34d16bd8 [cron] Bump distribution date (2021-04-22) 2021-04-22 00:41:44 +00:00
Scott Lahteine 57d0f0ce2e Fix Chiron typos, file nav 2021-04-21 15:28:50 -05:00
thinkyhead 778b8a45e9 [cron] Bump distribution date (2021-04-21) 2021-04-21 00:34:13 +00:00
Scott Lahteine 3c46a4062e Fix mfconfig 'copying' message 2021-04-20 16:36:19 -05:00
Axel Sepúlveda 2a7ba427dd Fix Grand Central SD dependency (#21660)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-04-20 05:14:21 -05:00
Scott Lahteine d87a71bd04 Extra dependency script logging 2021-04-20 05:11:43 -05:00
Scott Lahteine 6bb10b1898 Changes supporting "Prussia3D" MK3 (#21617) 2021-04-20 00:44:19 -05:00
Scott Lahteine f52351d116 Update mftest help 2021-04-20 00:32:51 -05:00
thinkyhead 7d72004742 [cron] Bump distribution date (2021-04-20) 2021-04-20 00:34:39 +00:00
Scott Lahteine 09de17fb59 Trigorilla Pro: Allow for swapped Z-stops 2021-04-19 13:30:21 -05:00
Scott Lahteine 2c2984fd29 Update realtime, DLP comments 2021-04-19 00:07:57 -05:00
Nick d5143c2c15 Support new style Anycubic Chiron TFT (#21597) 2021-04-18 23:04:38 -05:00
Scott Lahteine 59fd6428ae Skip preflight checks only (#21658)
Followup to e8af38cc2d
2021-04-18 22:46:43 -05:00
thinkyhead 07c5a4fa04 [cron] Bump distribution date (2021-04-19) 2021-04-19 00:34:55 +00:00
Scott Lahteine 550a806d77 More detailed serial config error 2021-04-18 18:24:58 -05:00
Scott Lahteine dc6c977766 Fix CHDK warning 2021-04-18 17:13:35 -05:00
Scott Lahteine 86397df32d BTT E3 RRF Support 2021-04-18 15:55:04 -05:00
Scott Lahteine 8e60b19662 Disable assert() by default 2021-04-18 15:55:04 -05:00
Scott Lahteine c508c2213e Misc. pio cleanup 2021-04-18 15:55:04 -05:00
thinkyhead 5d8727a59c [cron] Bump distribution date (2021-04-18) 2021-04-18 00:34:57 +00:00
Scott Lahteine e8af38cc2d Skip scripts during 'platformio init' (#21643) 2021-04-17 14:19:33 -05:00
fedetony b8cf818dac Fix Realtime Reporting with G-code Motion Modes (#21630) 2021-04-17 03:54:43 -05:00
Scott Lahteine bca4652c5e Leave Hybrid Threshold as-is for now
Reverting 253ee0c407
2021-04-17 02:03:16 -05:00
thinkyhead 3c4308b7b6 [cron] Bump distribution date (2021-04-17) 2021-04-17 00:33:21 +00:00
Scott Lahteine 464b2242e2 Better chopper defaults 2021-04-16 09:30:39 -05:00
MangaValk 553487cc8a Tool sensors (#17239) 2021-04-16 08:02:31 -05:00
Scott Lahteine 73f6426114 Use itoa for sprintf int 2021-04-16 05:14:37 -05:00
Scott Lahteine 07cac80fb0 Drop extraneous inlines 2021-04-16 05:03:46 -05:00
Scott Lahteine 253ee0c407 Init pwm_thrs to 0 when HYBRID_THRESHOLD is off (#21623) 2021-04-16 04:04:07 -05:00
Luca Zimmermann 2d1d628340 Always swap with PRIME_FIRST_USED disabled (#21622) 2021-04-16 04:01:50 -05:00
Scott Lahteine c6c6c56186 SDIO cleanup 2021-04-16 03:16:44 -05:00
Scott Lahteine 528b9bd872 Revert experimental NAN patch
Hold changes from #21575 (24a095c) for more testing.
2021-04-16 02:43:59 -05:00
fedetony 32dba5e0c7 Realtime Reporting, S000, P000, R000 (#19330) 2021-04-16 01:59:28 -05:00
Scott Lahteine 58cc4b7043 Use celsius_t for temperature accessors 2021-04-15 20:18:20 -05:00
thinkyhead 795253a9d5 [cron] Bump distribution date (2021-04-16) 2021-04-16 00:32:47 +00:00
Sola 3cdf363cce Fix MKS H43 compile (#21619) 2021-04-15 04:45:30 -05:00
Andrea 63673d3ce0 Fix Custom Menu audio and return (#21616) 2021-04-15 04:37:37 -05:00
thinkyhead 2d8ee3a496 [cron] Bump distribution date (2021-04-15) 2021-04-15 00:34:28 +00:00
Scott Lahteine 0561d5bea3 Add E1 for RAMPS 1.4.4 / AGC 2021-04-14 05:55:14 -05:00
XDA-Bam cc5297d637 Space-separate scrolling Status Message (#21523)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-04-14 04:42:04 -05:00
Scott Lahteine 1595fdb54b Use sq 2021-04-13 23:25:25 -05:00
Scott Lahteine d705a5b45e Fix long acceleration overflow 2021-04-13 23:25:25 -05:00
Scott Lahteine 0e9836649e Misc. formatting, serial out 2021-04-13 21:41:04 -05:00
thinkyhead 4849d313fd [cron] Bump distribution date (2021-04-14) 2021-04-14 00:32:34 +00:00
Marcio T 3ec5cd312b Enhance and fix FTDI Eve Touch UI (#21607) 2021-04-13 18:31:12 -05:00
Victor Oliveira 138340ee99 Multi-Volume. Select Media for LVGL (#21344) 2021-04-13 17:34:19 -05:00
gmarsh a5f0075a60 Fix and improve Power Monitor (#21551) 2021-04-13 15:17:52 -05:00
Scott Lahteine 84c79d7531 Followup to sprintf cleanup 2021-04-13 15:07:25 -05:00
Scott Lahteine fd99ea09ec Add fan percent accessors 2021-04-13 04:00:39 -05:00
Scott Lahteine 4e314ef6d4 More MKS UI sprintf 2021-04-13 03:53:50 -05:00
Veisen 776c1e66db Fix ANYCUBIC_LCD_I3MEGA compile (#21585) 2021-04-13 03:09:21 -05:00
Scott Lahteine e0ed57db67 Remove extraneous MKS UI sprintf 2021-04-12 23:40:32 -05:00
pinchies 41eb5813e0 Fix Flash size (512KB) for STM32F103ZE (#21590) 2021-04-12 21:14:34 -05:00
ellensp 5fb3ee6101 Fix Max Temperature not enforced (#21592) 2021-04-12 21:02:55 -05:00
Scott Lahteine 3517fbdcbd Blocking move followup 2021-04-12 20:58:43 -05:00
Giuliano Zaro 7f56538602 Chamber Fan mode 3 (#21594) 2021-04-12 20:28:13 -05:00
Scott Lahteine 4044ed8783 Add 'blocking move' comments 2021-04-12 20:15:41 -05:00
espr14 a5d6f6ac98 Fix Resume Print with UBL (#21564)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-04-12 20:10:21 -05:00
thinkyhead 41c55a30cd [cron] Bump distribution date (2021-04-13) 2021-04-13 00:45:21 +00:00
Scott Lahteine 4a1d2d816c Update old-style axis indexes 2021-04-12 19:34:31 -05:00
Mike La Spina 1e357b3c74 Tweak cooler / flowmeter icons (#21573) 2021-04-12 17:52:18 -05:00
Ramiro Polla f69da7d00d Add 'jump relaxing' compile flag to AVR targets (#21566) 2021-04-12 17:39:22 -05:00
Scott Lahteine 24a095c5c1 Reduce math library code size by 3.4KB (#21575) 2021-04-12 16:49:53 -05:00
thinkyhead 1742fb8655 [cron] Bump distribution date (2021-04-12) 2021-04-12 00:36:20 +00:00
Malderin 76cc736755 MKS LVGL UI: Fix icon layout (#21595) 2021-04-11 16:32:28 -05:00
Scott Lahteine c35e271dba Clean up, update some variants 2021-04-10 21:19:32 -05:00
Scott Lahteine 6ab7baa413 tick() => isr() to spotlight interrupt-time 2021-04-10 19:53:43 -05:00
thinkyhead 1114bdbb04 [cron] Bump distribution date (2021-04-11) 2021-04-11 00:37:24 +00:00
Scott Lahteine f86423972f EXP2_01_PIN for BTT BTT002 1.0 2021-04-10 18:28:13 -05:00
ellensp 62f992af23 Followup to "no status for serial::write" (#21577) 2021-04-10 15:35:45 -05:00
BigTreeTech 37e671612e Fix M114 E / R broken by LIN_ADVANCE (#21579) 2021-04-10 03:44:36 -05:00
thinkyhead 3b3a3fa845 [cron] Bump distribution date (2021-04-10) 2021-04-10 00:34:56 +00:00
Sola 4cba40f9fd Fix manual move with MKS H43 (#21511)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-04-09 15:29:59 -05:00
Ramiro Polla 8048d1411f Drop return value from Serial::write() (#21567) 2021-04-08 21:05:31 -05:00
Ramiro Polla 1a2cbe100c Macros to eliminate 'f + 0.0' (#21568) 2021-04-08 21:03:34 -05:00
ellensp 19320a1f8f Check for old Marlin files mixed in (#21574) 2021-04-08 20:36:48 -05:00
Victor Oliveira 7124326808 Delay U8glib init using U8glib-HAL 0.4.4 (#21496)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-08 20:35:21 -05:00
thinkyhead ecd5ae890f [cron] Bump distribution date (2021-04-09) 2021-04-09 00:32:51 +00:00
thinkyhead aa2601bb9e [cron] Bump distribution date (2021-04-08) 2021-04-08 00:37:38 +00:00
Scott Lahteine 1879eede0d Fix axis char printing 2021-04-07 15:43:57 -05:00
ellensp facbbba789 Sanity Check newer Configs too (#21550)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-04-07 15:02:09 -05:00
Radim Karniš d61bc2d136 Park Magnetic Switching Toolhead at the very end (#21552) 2021-04-07 14:41:38 -05:00
thinkyhead 5ab220fa76 [cron] Bump distribution date (2021-04-07) 2021-04-07 00:34:41 +00:00
BigTreeTech b483a8d652 BTT SKR-SE-BX (STM32H743IIT6 ARM Cortex M7) and BIQU_BX_TFT70 (#21536) 2021-04-05 21:40:50 -05:00
Scott Lahteine ed14731146 getHighESpeed => autotemp_task 2021-04-05 21:27:05 -05:00
Malderin 746eae15f3 Cast celsius to int for MKS LVGL UI (#21502) 2021-04-05 20:55:00 -05:00
Victor Oliveira 121b606f9c Fix Rumba32 variant for Marlin (#21497) 2021-04-05 20:46:21 -05:00
Malderin 61af08d499 MKS LVGL UI: Display/edit fan percentage (#21544)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-04-05 20:39:57 -05:00
thinkyhead a6105ef37f [cron] Bump distribution date (2021-04-06) 2021-04-06 00:35:12 +00:00
Mike La Spina 993609b5aa Make DELAY_NS round up on AVR (#21546) 2021-04-05 16:34:31 -05:00
Scott Lahteine e3116eed2e write_command changes input 2021-04-05 15:34:51 -05:00
Scott Lahteine 98d6c751d3 Fix CardReader string args 2021-04-04 23:52:11 -05:00
thinkyhead 9165749321 [cron] Bump distribution date (2021-04-05) 2021-04-05 00:36:21 +00:00
Marcio T 75b790376d Touch UI Bed Mesh Screen refactor, enhancements (#21521)
- Split mesh view and edit screen into two screens
- The editor now live-updates the graphics
- Added Touch UI mesh progress feedback to `G26`
- Show positive / negative mesh values in different colors
2021-04-04 18:58:03 -05:00
vyacheslav-shubin 8da8bf7e87 Fix FAT delete of items with long name (#21528) 2021-04-04 18:52:16 -05:00
Scott Lahteine 8b6718c632 misc. pointer formatting 2021-04-04 18:08:13 -05:00
InsanityAutomation 98b2b45264 Revert "Optimized string-to-number functions" (#21532)
This reverts #21484
2021-04-04 17:35:58 -05:00
InsanityAutomation c4b69fcddd Fix Hotend-abort-on-idle Check (#21535) 2021-04-04 16:55:34 -05:00
Giuliano Zaro a628559258 Update Italian language (#21537) 2021-04-04 16:45:56 -05:00
Scott Lahteine 895e40190b Suppress redundant serial errors 2021-04-03 20:33:11 -05:00
thinkyhead c442485137 [cron] Bump distribution date (2021-04-04) 2021-04-04 00:35:49 +00:00
thinkyhead dd76a50683 [cron] Bump distribution date (2021-04-03) 2021-04-03 00:33:51 +00:00
XDA-Bam 9d0e82788a Update u8g / AVR display timing defaults (#21518) 2021-04-02 19:11:22 -05:00
Vert d0d5003f45 GT2560 V3 followup (#21512) 2021-04-02 19:06:43 -05:00
Scott Lahteine c2b72c0e73 Remove extraneous 'extern' hints (#21516) 2021-04-02 14:22:43 -05:00
Scott Lahteine 9d0b6c5730 Requiring PIO >= 5.0.3 2021-04-01 21:54:51 -05:00
Scott Lahteine 3229100025 Split up platformio.ini (#21507) 2021-04-01 21:53:19 -05:00
thinkyhead 0dde8f8968 [cron] Bump distribution date (2021-04-02) 2021-04-02 01:13:58 +00:00
Mike La Spina 235ba92602 Followup to Laser Flow Meter (#21498) 2021-04-01 19:29:49 -05:00
Sola 6747d350a5 MKS H43 fix, cleanup (#21500)
Followup to #21485
2021-04-01 19:19:22 -05:00
Marcio T 45c1432946 G26 Hilbert Curve followup (#21480) 2021-04-01 19:12:00 -05:00
Vert 05b39623b0 Board IDs for G2560 Rev B, G2560 v4, GTM32 VD (#21499) 2021-04-01 18:05:02 -05:00
Scott Lahteine 62f37669dc Replace 'const float &' with 'const_float_t' (#21505) 2021-04-01 17:59:57 -05:00
thinkyhead 600ef1e47c [cron] Bump distribution date (2021-04-01) 2021-04-01 00:34:23 +00:00
Sola 4d17613050 MKS H43 fix, cleanup (#21485)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-31 02:34:17 -05:00
Scott Lahteine bfdd1f4662 Update UBL param 2021-03-30 23:58:32 -05:00
Scott Lahteine be775ed72d Move apply_rotation_xyz into matrix_3x3 2021-03-30 23:58:32 -05:00
Scott Lahteine 8d083eb248 Put ABL state into a class 2021-03-30 23:58:32 -05:00
Marcio T 7573524a14 FTDI Touch UI fix and reorganize (#21487) 2021-03-30 21:23:43 -05:00
Ramiro Polla 20d2061f22 Optimized string-to-number functions (#21484) 2021-03-30 21:20:33 -05:00
Marco van Wieringen df297b6ca3 Fix FYSETC_S6 heaters pins (#21483)
When adding support FYSETC Spider board the S6 pins file was broken.
2021-03-30 20:11:33 -05:00
thinkyhead 6175802693 [cron] Bump distribution date (2021-03-31) 2021-03-31 00:29:24 +00:00
Scott Lahteine 0f23090545 Serial flags followup
Followup to #21318
2021-03-29 22:38:33 -05:00
Scott Lahteine f43b250ed2 Adjust microsteps alignment 2021-03-29 21:54:32 -05:00
Victor Oliveira 6e0b79a33b Fix and add STM32 SDIO DMA (#21476) 2021-03-29 21:52:30 -05:00
X-Ryl669 139c149486 Flags for MarlinSerial instance features (#21318) 2021-03-29 21:36:01 -05:00
Giuliano Zaro 3f7cd45df4 Generalize MMU (#21469) 2021-03-29 21:14:11 -05:00
Ste c298095000 Align temp settings (#21329) 2021-03-29 21:07:21 -05:00
Ramiro Polla d30b5481f5 Optimize BLTouch code for size (#21477) 2021-03-29 20:56:44 -05:00
Scott Lahteine f587a4e3f3 Improve uncrust script 2021-03-29 20:44:20 -05:00
Scott Lahteine 3b73b115ca Apply pointer formatting 2021-03-29 20:36:37 -05:00
thinkyhead 71e789943e [cron] Bump distribution date (2021-03-30) 2021-03-30 00:32:47 +00:00
ellensp 1caf8a1f5b GT2560 Rev.A Plus Z Max Pin with BLTouch (#21375) 2021-03-29 04:43:07 -05:00
George Fu 1d3f28da2e FYSETC Spider board (#21458) 2021-03-29 04:38:28 -05:00
Scott Lahteine 86ba0cde35 reduced verbiage 2021-03-29 03:33:19 -05:00
Malderin a335cf2edf Fix MKS LVGL UI Main screen / print buttons (#21468) 2021-03-29 03:19:38 -05:00
Scott Lahteine 33ccf1b931 Adjust mfconfig script 2021-03-29 01:49:35 -05:00
Mike La Spina ccdbffbf3f Laser Coolant Flow Meter / Safety Shutdown (#21431)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-29 01:41:56 -05:00
thinkyhead 8f509b0ae0 [cron] Bump distribution date (2021-03-29) 2021-03-29 00:45:48 +00:00
Vert 001c77d1f7 YHCB2004 pins followup (#21472) 2021-03-28 19:27:02 -05:00
Marcio T c45b91aa94 Refactor Hilbert curve. Enhance Touch UI Bed Level Screen. (#21453) 2021-03-27 22:57:12 -05:00
thinkyhead 5d0e6c21aa [cron] Bump distribution date (2021-03-28) 2021-03-28 00:34:16 +00:00
thinkyhead 5991836e1f [cron] Bump distribution date (2021-03-27) 2021-03-27 00:32:48 +00:00
Leoric 532df198da MKS UI: Monitor state when idle (#21452)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-26 15:41:55 -05:00
Vert 241d2e3fa3 Fix for YHCB2004 (#21450) 2021-03-25 20:44:35 -05:00
thinkyhead c55d53daa6 [cron] Bump distribution date (2021-03-26) 2021-03-26 00:31:14 +00:00
Tomas Rimkus 8a67846872 Avoid watchdog reset in all wired EEPROMs (#21436)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-25 19:16:45 -05:00
Scott Lahteine 704b8cd83c Apply TMC UART to STM32, simplify 2021-03-25 16:53:05 -05:00
Scott Lahteine 84b961cb20 Define HW serial ports needed for TMC UART (#21446) 2021-03-25 16:19:03 -05:00
Ramiro Polla 8bf6b190ff Optimize LSF for size, efficiency (#21443) 2021-03-24 22:56:48 -05:00
ldursw 69c6ffa90b Followup to SDIO patch (#21440) 2021-03-24 22:40:48 -05:00
espr14 e989bf3b0e Endstops always on in G28 (#21441) 2021-03-24 22:39:29 -05:00
espr14 cfdeab70cd Endstops always on after delta homing (#21442) 2021-03-24 22:39:10 -05:00
MarlinFirmware de1161536b [cron] Bump distribution date (2021-03-25) 2021-03-25 00:27:01 +00:00
Scott Lahteine 589bb921ae Tweak disabled variant options 2021-03-24 12:23:10 -05:00
Scott Lahteine b59a4331fa Update common-cxxflags.py comment 2021-03-24 12:23:10 -05:00
Scott Lahteine 832059967c Comment, clean up some PlatformIO scripts 2021-03-24 12:23:10 -05:00
Martijn Bosgraaf 30e7e2c276 Extend M106/M107 for better laser module support (#16082)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-24 12:21:11 -05:00
Bryan Hunwardsen 3ae892bf91 SKR E3 Mini V2.0 Fan Bug Fix (#21079)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-24 12:05:46 -05:00
Miguel Risco-Castillo 930752d46e Ender 3 V2 Status Line (#21369)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-24 10:12:57 -05:00
ldursw d172c71376 Fix SDIO buffer alignment (#21396) 2021-03-24 09:30:19 -05:00
kpishere fd8207dd9a Misc build fixes (#21413)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-24 09:14:11 -05:00
Ramiro Polla e7596d92c7 Update Anet V1.0 display timing (#21425) 2021-03-24 07:45:43 -05:00
Ramiro Polla 3ced55aa93 Optimize MarlinSettings with template methods (#21426) 2021-03-24 07:32:08 -05:00
Scott Lahteine 2d2291d00e More IntelliSense-friendly declarations 2021-03-24 05:50:47 -05:00
Scott Lahteine da4b6896f7 Group UBL parameters, add comments 2021-03-24 05:50:47 -05:00
Scott Lahteine 8fca37f373 Misc LCD cleanup 2021-03-24 05:50:47 -05:00
Scott Lahteine 155dea6f14 Tweak mf helper scripts 2021-03-24 04:15:25 -05:00
Scott Lahteine e5ff55a1be Add typedef celsius_t (#21374) 2021-03-24 04:11:43 -05:00
MarlinFirmware 07c24e72ac [cron] Bump distribution date (2021-03-24) 2021-03-24 00:13:49 +00:00
Scott Lahteine a8ea6e6463 Max temp/target followup 2021-03-23 10:56:10 -05:00
Scott Lahteine 58f0330d3f MKS / E3V2 LCD code cleanup 2021-03-23 10:46:54 -05:00
Scott Lahteine f7aaa2e1c7 Add typedef extra_fan_t 2021-03-23 09:39:44 -05:00
Scott Lahteine cfa6c7d45b Improve max temp / target 2021-03-23 09:39:09 -05:00
borland1 df1ef496d1 Main / Config Custom Submenus (#18177)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-23 08:21:11 -05:00
Scott Lahteine dd92c8e927 Followup to UBL Hilbert 2021-03-23 05:54:41 -05:00
ellensp 10c14bcc05 Check NOZZLE_CLEAN_FEATURE settings (#21332)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-23 01:47:07 -05:00
Marcio T eee726ec7d UBL - Hilbert space-filling curve probing sequence (#21387) 2021-03-23 01:45:51 -05:00
Scott Lahteine 22fc59ab59 Minor process_subcommands_now followup 2021-03-23 01:03:32 -05:00
mihtjel 50a6ffa952 Fix macros that call macros crashing (#21383)
When macros call macros, the null termination should remain in place until the macro is completed, and only then put back. Otherwise, the macro handler interprets this as setting the macro called to a new value.
2021-03-23 01:00:22 -05:00
Sola 2b621eb45d Fix MKS H43 sensorless homing (#21388) 2021-03-23 00:58:52 -05:00
Zs.Antal c44ff3eb3d Update Hungarian language (#21407) 2021-03-23 00:57:50 -05:00
Marcio T 3e7d830f57 Mesh Editor for FTDI Eve Touch UI (#21381) 2021-03-23 00:51:03 -05:00
thinkyhead 26db51fa9d [cron] Bump distribution date (2021-03-23) 2021-03-23 00:13:33 +00:00
thinkyhead fb9502e0fb [cron] Bump distribution date (2021-03-22) 2021-03-22 00:13:40 +00:00
thinkyhead d0ea2b2867 [cron] Bump distribution date (2021-03-21) 2021-03-21 00:14:12 +00:00
1111 changed files with 32478 additions and 17525 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ root = true
[{*.patch,syntax_test_*}] [{*.patch,syntax_test_*}]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[{*.c,*.cpp,*.h}] [{*.c,*.cpp,*.h,*.ino}]
charset = utf-8 charset = utf-8
[{*.c,*.cpp,*.h,Makefile}] [{*.c,*.cpp,*.h,*.ino,Makefile}]
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
end_of_line = lf end_of_line = lf
+5
View File
@@ -72,6 +72,7 @@ jobs:
# STM32 (ST) Environments # STM32 (ST) Environments
- STM32F103RC_btt_stm32
- STM32F407VE_black - STM32F407VE_black
- STM32F401VE_STEVAL - STM32F401VE_STEVAL
- BIGTREE_BTT002 - BIGTREE_BTT002
@@ -86,9 +87,12 @@ jobs:
- FLYF407ZG - FLYF407ZG
- rumba32 - rumba32
- LERDGEX - LERDGEX
- LERDGEK
- mks_robin_nano35_stm32 - mks_robin_nano35_stm32
- NUCLEO_F767ZI - NUCLEO_F767ZI
- REMRAM_V1 - REMRAM_V1
- BTT_SKR_SE_BX
- chitu_f103
# Put lengthy tests last # Put lengthy tests last
@@ -98,6 +102,7 @@ jobs:
# Non-working environment tests # Non-working environment tests
#- at90usb1286_cdc #- at90usb1286_cdc
#- STM32F103CB_malyan #- STM32F103CB_malyan
#- STM32F103RE
#- mks_robin_mini #- mks_robin_mini
steps: steps:
-23
View File
@@ -122,29 +122,6 @@ tags
.gcc-flags.json .gcc-flags.json
/lib/ /lib/
# Workaround for Deviot+platformio quirks
Marlin/lib
Marlin/platformio.ini
Marlin/*/platformio.ini
Marlin/*/*/platformio.ini
Marlin/*/*/*/platformio.ini
Marlin/*/*/*/*/platformio.ini
Marlin/.travis.yml
Marlin/*/.travis.yml
Marlin/*/*/.travis.yml
Marlin/*/*/*/.travis.yml
Marlin/*/*/*/*/.travis.yml
Marlin/.gitignore
Marlin/*/.gitignore
Marlin/*/*/.gitignore
Marlin/*/*/*/.gitignore
Marlin/*/*/*/*/.gitignore
Marlin/readme.txt
Marlin/*/readme.txt
Marlin/*/*/readme.txt
Marlin/*/*/*/readme.txt
Marlin/*/*/*/*/readme.txt
# Secure Credentials # Secure Credentials
Configuration_Secure.h Configuration_Secure.h
+113 -82
View File
@@ -35,7 +35,7 @@
* *
* Advanced settings can be found in Configuration_adv.h * Advanced settings can be found in Configuration_adv.h
*/ */
#define CONFIGURATION_H_VERSION 020008 #define CONFIGURATION_H_VERSION 02000801
//=========================================================================== //===========================================================================
//============================= Getting Started ============================= //============================= Getting Started =============================
@@ -69,7 +69,7 @@
// @section info // @section info
// Author info of this build printed to the host during boot and M115 // Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes. #define STRING_CONFIG_H_AUTHOR "Insanity Automation" // Who made the changes.
//#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes) //#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes)
/** /**
@@ -105,14 +105,9 @@
#define SERIAL_PORT 0 #define SERIAL_PORT 0
/** /**
* Select a secondary serial port on the board to use for communication with the host. * Serial Port Baud Rate
* Currently Ethernet (-2) is only supported on Teensy 4.1 boards. * This is the default communication speed for all serial ports.
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7] * Set the baud rate defaults for additional serial ports below.
*/
//#define SERIAL_PORT_2 -1
/**
* This setting determines the communication speed of the printer.
* *
* 250000 works in most cases, but you might try a lower speed if * 250000 works in most cases, but you might try a lower speed if
* you commonly experience drop-outs during host printing. * you commonly experience drop-outs during host printing.
@@ -121,13 +116,30 @@
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
*/ */
#define BAUDRATE 250000 #define BAUDRATE 250000
//#define BAUD_RATE_GCODE // Enable G-code M575 to set the baud rate
/**
* Select a secondary serial port on the board to use for communication with the host.
* Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_2 -1
//#define BAUDRATE_2 250000 // Enable to override BAUDRATE
/**
* Select a third serial port on the board to use for communication with the host.
* Currently only supported for AVR, DUE, LPC1768/9 and STM32/STM32F1
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_3 1
//#define BAUDRATE_3 250000 // Enable to override BAUDRATE
// Enable the Bluetooth serial interface on AT90USB devices // Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH //#define BLUETOOTH
// Choose the name from boards.h that matches your setup // Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD #ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_RAMPS_14_EFB #define MOTHERBOARD BOARD_ORTUR_4
#endif #endif
// Name displayed in the LCD "Ready" message and Info menu // Name displayed in the LCD "Ready" message and Info menu
@@ -163,8 +175,8 @@
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version) * PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
* PRUSA_MMU2 : Průša MMU2 * PRUSA_MMU2 : Průša MMU2
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5) * PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
* SMUFF_EMU_MMU2 : Technik Gegg SMuFF (Průša MMU2 emulation mode) * EXTENDABLE_EMU_MMU2 : MMU with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
* SMUFF_EMU_MMU2S : Technik Gegg SMuFF (Průša MMU2S emulation mode) * EXTENDABLE_EMU_MMU2S : MMUS with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
* *
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails. * Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
* See additional options in Configuration_adv.h. * See additional options in Configuration_adv.h.
@@ -417,7 +429,7 @@
#define TEMP_SENSOR_5 0 #define TEMP_SENSOR_5 0
#define TEMP_SENSOR_6 0 #define TEMP_SENSOR_6 0
#define TEMP_SENSOR_7 0 #define TEMP_SENSOR_7 0
#define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_PROBE 0 #define TEMP_SENSOR_PROBE 0
#define TEMP_SENSOR_CHAMBER 0 #define TEMP_SENSOR_CHAMBER 0
#define TEMP_SENSOR_COOLER 0 #define TEMP_SENSOR_COOLER 0
@@ -437,11 +449,11 @@
//#define TEMP_SENSOR_1_AS_REDUNDANT //#define TEMP_SENSOR_1_AS_REDUNDANT
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 #define TEMP_RESIDENCY_TIME 5 // (seconds) Time to wait for hotend to "settle" in M109
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer #define TEMP_WINDOW 2 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target #define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 #define TEMP_BED_RESIDENCY_TIME 5 // (seconds) Time to wait for bed to "settle" in M190
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer #define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target #define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
@@ -473,7 +485,7 @@
#define HEATER_5_MAXTEMP 275 #define HEATER_5_MAXTEMP 275
#define HEATER_6_MAXTEMP 275 #define HEATER_6_MAXTEMP 275
#define HEATER_7_MAXTEMP 275 #define HEATER_7_MAXTEMP 275
#define BED_MAXTEMP 150 #define BED_MAXTEMP 120
#define CHAMBER_MAXTEMP 60 #define CHAMBER_MAXTEMP 60
/** /**
@@ -484,6 +496,7 @@
*/ */
#define HOTEND_OVERSHOOT 15 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT #define HOTEND_OVERSHOOT 15 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT
#define BED_OVERSHOOT 10 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT #define BED_OVERSHOOT 10 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT
#define COOLER_OVERSHOOT 2 // (°C) Forbid temperatures closer than OVERSHOOT
//=========================================================================== //===========================================================================
//============================= PID Settings ================================ //============================= PID Settings ================================
@@ -497,8 +510,8 @@
#define PID_K1 0.95 // Smoothing factor within any PID loop #define PID_K1 0.95 // Smoothing factor within any PID loop
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM) #define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM) #define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2] // Set/get with gcode: M301 E[extruder number, 0-2]
@@ -532,7 +545,7 @@
* heater. If your configuration is significantly different than this and you don't understand * heater. If your configuration is significantly different than this and you don't understand
* the issues involved, don't use bed PID until someone else verifies that your hardware works. * the issues involved, don't use bed PID until someone else verifies that your hardware works.
*/ */
//#define PIDTEMPBED #define PIDTEMPBED
//#define BED_LIMIT_SWITCHING //#define BED_LIMIT_SWITCHING
@@ -550,9 +563,9 @@
// 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) // 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) // from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#define DEFAULT_bedKp 10.00 #define DEFAULT_bedKp 87.23
#define DEFAULT_bedKi .023 #define DEFAULT_bedKi 13.31
#define DEFAULT_bedKd 305.4 #define DEFAULT_bedKd 381.14
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED #endif // PIDTEMPBED
@@ -709,13 +722,13 @@
#endif #endif
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup). // Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
#define X_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define Y_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Y_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define Z_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // Set to true to invert the logic of the probe.
/** /**
* Stepper Drivers * Stepper Drivers
@@ -798,14 +811,14 @@
* Override with M92 * Override with M92
* X, Y, Z, E0 [, E1[, E2...]] * X, Y, Z, E0 [, E1[, E2...]]
*/ */
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 } #define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 95 }
/** /**
* Default Max Feed Rate (mm/s) * Default Max Feed Rate (mm/s)
* Override with M203 * Override with M203
* X, Y, Z, E0 [, E1[, E2...]] * X, Y, Z, E0 [, E1[, E2...]]
*/ */
#define DEFAULT_MAX_FEEDRATE { 300, 300, 5, 25 } #define DEFAULT_MAX_FEEDRATE { 500, 500, 10, 65 }
//#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2 //#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2
#if ENABLED(LIMITED_MAX_FR_EDITING) #if ENABLED(LIMITED_MAX_FR_EDITING)
@@ -818,7 +831,7 @@
* Override with M201 * Override with M201
* X, Y, Z, E0 [, E1[, E2...]] * X, Y, Z, E0 [, E1[, E2...]]
*/ */
#define DEFAULT_MAX_ACCELERATION { 3000, 3000, 100, 10000 } #define DEFAULT_MAX_ACCELERATION { 2500, 2500, 18000, 8000 }
//#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2 //#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2
#if ENABLED(LIMITED_MAX_ACCEL_EDITING) #if ENABLED(LIMITED_MAX_ACCEL_EDITING)
@@ -833,8 +846,8 @@
* M204 R Retract Acceleration * M204 R Retract Acceleration
* M204 T Travel Acceleration * M204 T Travel Acceleration
*/ */
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves #define DEFAULT_ACCELERATION 2000 // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts #define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves #define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
/** /**
@@ -845,10 +858,10 @@
* When changing speed and direction, if the difference is less than the * When changing speed and direction, if the difference is less than the
* value set here, it may happen instantaneously. * value set here, it may happen instantaneously.
*/ */
//#define CLASSIC_JERK #define CLASSIC_JERK
#if ENABLED(CLASSIC_JERK) #if ENABLED(CLASSIC_JERK)
#define DEFAULT_XJERK 10.0 #define DEFAULT_XJERK 15.0
#define DEFAULT_YJERK 10.0 #define DEFAULT_YJERK 15.0
#define DEFAULT_ZJERK 0.3 #define DEFAULT_ZJERK 0.3
//#define TRAVEL_EXTRA_XYJERK 0.0 // Additional jerk allowance for all travel moves //#define TRAVEL_EXTRA_XYJERK 0.0 // Additional jerk allowance for all travel moves
@@ -882,7 +895,7 @@
* *
* See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained * See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained
*/ */
//#define S_CURVE_ACCELERATION #define S_CURVE_ACCELERATION
//=========================================================================== //===========================================================================
//============================= Z Probe Options ============================= //============================= Z Probe Options =============================
@@ -898,7 +911,7 @@
* The probe replaces the Z-MIN endstop and is used for Z homing. * The probe replaces the Z-MIN endstop and is used for Z homing.
* (Automatically enables USE_PROBE_FOR_Z_HOMING.) * (Automatically enables USE_PROBE_FOR_Z_HOMING.)
*/ */
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
// Force the use of the probe for Z-axis homing // Force the use of the probe for Z-axis homing
//#define USE_PROBE_FOR_Z_HOMING //#define USE_PROBE_FOR_Z_HOMING
@@ -933,13 +946,12 @@
* or (with LCD_BED_LEVELING) the LCD controller. * or (with LCD_BED_LEVELING) the LCD controller.
*/ */
//#define PROBE_MANUALLY //#define PROBE_MANUALLY
//#define MANUAL_PROBE_START_Z 0.2
/** /**
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment. * A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
* (e.g., an inductive probe or a nozzle-based probe-switch.) * (e.g., an inductive probe or a nozzle-based probe-switch.)
*/ */
//#define FIX_MOUNTED_PROBE #define FIX_MOUNTED_PROBE
/** /**
* Use the nozzle as the probe, as with a conductive * Use the nozzle as the probe, as with a conductive
@@ -1048,17 +1060,17 @@
* | [-] | * | [-] |
* O-- FRONT --+ * O-- FRONT --+
*/ */
#define NOZZLE_TO_PROBE_OFFSET { 10, 10, 0 } #define NOZZLE_TO_PROBE_OFFSET { -25, 0, 0 }
// Most probes should stay away from the edges of the bed, but // Most probes should stay away from the edges of the bed, but
// with NOZZLE_AS_PROBE this can be negative for a wider probing area. // with NOZZLE_AS_PROBE this can be negative for a wider probing area.
#define PROBING_MARGIN 10 #define PROBING_MARGIN 8
// X and Y axis travel speed (mm/min) between probes // X and Y axis travel speed (mm/min) between probes
#define XY_PROBE_FEEDRATE (133*60) #define XY_PROBE_FEEDRATE (133*60)
// Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2) // Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2)
#define Z_PROBE_FEEDRATE_FAST (4*60) #define Z_PROBE_FEEDRATE_FAST (10*60)
// Feedrate (mm/min) for the "accurate" probe of each point // Feedrate (mm/min) for the "accurate" probe of each point
#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 2) #define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 2)
@@ -1099,7 +1111,7 @@
* A total of 2 does fast/slow probes with a weighted average. * A total of 2 does fast/slow probes with a weighted average.
* A total of 3 or more adds more slow probes, taking the average. * A total of 3 or more adds more slow probes, taking the average.
*/ */
//#define MULTIPLE_PROBING 2 #define MULTIPLE_PROBING 2
//#define EXTRA_PROBING 1 //#define EXTRA_PROBING 1
/** /**
@@ -1116,16 +1128,16 @@
* Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle.
* But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle.
*/ */
#define Z_CLEARANCE_DEPLOY_PROBE 10 // Z Clearance for Deploy/Stow #define Z_CLEARANCE_DEPLOY_PROBE 5 // Z Clearance for Deploy/Stow
#define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points #define Z_CLEARANCE_BETWEEN_PROBES 5 // Z Clearance between probe points
#define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes #define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes
//#define Z_AFTER_PROBING 5 // Z position after probing is done //#define Z_AFTER_PROBING 5 // Z position after probing is done
#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping #define Z_PROBE_LOW_POINT -4 // Farthest distance below the trigger-point to go before stopping
// For M851 give a range for adjusting the Z probe offset // For M851 give a range for adjusting the Z probe offset
#define Z_PROBE_OFFSET_RANGE_MIN -20 #define Z_PROBE_OFFSET_RANGE_MIN -9
#define Z_PROBE_OFFSET_RANGE_MAX 20 #define Z_PROBE_OFFSET_RANGE_MAX 9
// Enable the M48 repeatability test to test probe accuracy // Enable the M48 repeatability test to test probe accuracy
//#define Z_MIN_PROBE_REPEATABILITY_TEST //#define Z_MIN_PROBE_REPEATABILITY_TEST
@@ -1185,12 +1197,12 @@
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false #define INVERT_X_DIR false
#define INVERT_Y_DIR true #define INVERT_Y_DIR true
#define INVERT_Z_DIR false #define INVERT_Z_DIR true
// @section extruder // @section extruder
// For direct drive extruder v9 set to true, for geared extruder set to false. // For direct drive extruder v9 set to true, for geared extruder set to false.
#define INVERT_E0_DIR false #define INVERT_E0_DIR true
#define INVERT_E1_DIR false #define INVERT_E1_DIR false
#define INVERT_E2_DIR false #define INVERT_E2_DIR false
#define INVERT_E3_DIR false #define INVERT_E3_DIR false
@@ -1224,17 +1236,17 @@
// @section machine // @section machine
// The size of the print bed // The size of the printable area
#define X_BED_SIZE 200 #define X_BED_SIZE 255
#define Y_BED_SIZE 200 #define Y_BED_SIZE 300
// Travel limits (mm) after homing, corresponding to endstop positions. // Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS 0 #define X_MIN_POS -10.5
#define Y_MIN_POS 0 #define Y_MIN_POS -9
#define Z_MIN_POS 0 #define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE #define X_MAX_POS 260
#define Y_MAX_POS Y_BED_SIZE #define Y_MAX_POS 310
#define Z_MAX_POS 200 #define Z_MAX_POS 295
/** /**
* Software Endstops * Software Endstops
@@ -1262,7 +1274,7 @@
#endif #endif
#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
//#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD
#endif #endif
/** /**
@@ -1278,7 +1290,7 @@
* RAMPS-based boards use SERVO3_PIN for the first runout sensor. * RAMPS-based boards use SERVO3_PIN for the first runout sensor.
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc. * For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
*/ */
//#define FILAMENT_RUNOUT_SENSOR #define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR) #if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500. #define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. #define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
@@ -1330,7 +1342,7 @@
// After a runout is detected, continue printing this length of filament // After a runout is detected, continue printing this length of filament
// before executing the runout script. Useful for a sensor at the end of // before executing the runout script. Useful for a sensor at the end of
// a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead. // a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
//#define FILAMENT_RUNOUT_DISTANCE_MM 25 #define FILAMENT_RUNOUT_DISTANCE_MM 5
#ifdef FILAMENT_RUNOUT_DISTANCE_MM #ifdef FILAMENT_RUNOUT_DISTANCE_MM
// Enable this option to use an encoder disc that toggles the runout pin // Enable this option to use an encoder disc that toggles the runout pin
@@ -1380,7 +1392,7 @@
*/ */
//#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR //#define AUTO_BED_LEVELING_LINEAR
//#define AUTO_BED_LEVELING_BILINEAR #define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL //#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING //#define MESH_BED_LEVELING
@@ -1389,13 +1401,13 @@
* these options to restore the prior leveling state or to always enable * these options to restore the prior leveling state or to always enable
* leveling immediately after G28. * leveling immediately after G28.
*/ */
//#define RESTORE_LEVELING_AFTER_G28 #define RESTORE_LEVELING_AFTER_G28
//#define ENABLE_LEVELING_AFTER_G28 //#define ENABLE_LEVELING_AFTER_G28
/** /**
* Auto-leveling needs preheating * Auto-leveling needs preheating
*/ */
//#define PREHEAT_BEFORE_LEVELING #define PREHEAT_BEFORE_LEVELING
#if ENABLED(PREHEAT_BEFORE_LEVELING) #if ENABLED(PREHEAT_BEFORE_LEVELING)
#define LEVELING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time #define LEVELING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time
#define LEVELING_BED_TEMP 50 #define LEVELING_BED_TEMP 50
@@ -1408,13 +1420,18 @@
*/ */
//#define DEBUG_LEVELING_FEATURE //#define DEBUG_LEVELING_FEATURE
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL, PROBE_MANUALLY)
// Set a height for the start of manual adjustment
#define MANUAL_PROBE_START_Z 0.2 // (mm) Comment out to use the last-measured height
#endif
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL) #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL)
// Gradually reduce leveling correction until a set height is reached, // Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane. // at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height> // The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT #define ENABLE_LEVELING_FADE_HEIGHT
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
#define DEFAULT_LEVELING_FADE_HEIGHT 10.0 // (mm) Default fade height. #define DEFAULT_LEVELING_FADE_HEIGHT 0.0 // (mm) Default fade height.
#endif #endif
// For Cartesian machines, instead of dividing moves on mesh boundaries, // For Cartesian machines, instead of dividing moves on mesh boundaries,
@@ -1442,7 +1459,7 @@
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// Set the number of grid points per dimension. // Set the number of grid points per dimension.
#define GRID_MAX_POINTS_X 3 #define GRID_MAX_POINTS_X 5
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
// Probe along the Y axis, advancing X after each column // Probe along the Y axis, advancing X after each column
@@ -1478,12 +1495,16 @@
#define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited.
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
//#define UBL_HILBERT_CURVE // Use Hilbert distribution for less travel when probing multiple points
#define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle
#define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500
//#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used
// as the Z-Height correction value. // as the Z-Height correction value.
//#define UBL_MESH_WIZARD // Run several commands in a row to get a complete mesh
#elif ENABLED(MESH_BED_LEVELING) #elif ENABLED(MESH_BED_LEVELING)
//=========================================================================== //===========================================================================
@@ -1502,27 +1523,27 @@
* Add a bed leveling sub-menu for ABL or MBL. * Add a bed leveling sub-menu for ABL or MBL.
* Include a guided procedure if manual probing is enabled. * Include a guided procedure if manual probing is enabled.
*/ */
//#define LCD_BED_LEVELING #define LCD_BED_LEVELING
#if ENABLED(LCD_BED_LEVELING) #if ENABLED(LCD_BED_LEVELING)
#define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis. #define MESH_EDIT_Z_STEP 0.025 // (mm) Step size while manually probing Z axis.
#define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment #define LCD_PROBE_Z_RANGE 4 // (mm) Z Range centered on Z_MIN_POS for LCD Z adjustment
//#define MESH_EDIT_MENU // Add a menu to edit mesh points #define MESH_EDIT_MENU // Add a menu to edit mesh points
#endif #endif
// Add a menu item to move between bed corners for manual bed adjustment // Add a menu item to move between bed corners for manual bed adjustment
//#define LEVEL_BED_CORNERS #define LEVEL_BED_CORNERS
#if ENABLED(LEVEL_BED_CORNERS) #if ENABLED(LEVEL_BED_CORNERS)
#define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets #define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
#define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points
#define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Z height of nozzle between leveling points
//#define LEVEL_CENTER_TOO // Move to the center after the last corner //#define LEVEL_CENTER_TOO // Move to the center after the last corner
//#define LEVEL_CORNERS_USE_PROBE #define LEVEL_CORNERS_USE_PROBE
#if ENABLED(LEVEL_CORNERS_USE_PROBE) #if ENABLED(LEVEL_CORNERS_USE_PROBE)
#define LEVEL_CORNERS_PROBE_TOLERANCE 0.1 #define LEVEL_CORNERS_PROBE_TOLERANCE 0.1
#define LEVEL_CORNERS_VERIFY_RAISED // After adjustment triggers the probe, re-probe to verify #define LEVEL_CORNERS_VERIFY_RAISED // After adjustment triggers the probe, re-probe to verify
//#define LEVEL_CORNERS_AUDIO_FEEDBACK #define LEVEL_CORNERS_AUDIO_FEEDBACK
#endif #endif
/** /**
@@ -1656,12 +1677,12 @@
* M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes) * M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes)
* M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.) * M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.)
*/ */
//#define EEPROM_SETTINGS // Persistent storage with M500 and M501 #define EEPROM_SETTINGS // Persistent storage with M500 and M501
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! //#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. #define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load #define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
//#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors. #define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
#endif #endif
// //
@@ -1712,11 +1733,11 @@
* P1 Raise the nozzle always to Z-park height. * P1 Raise the nozzle always to Z-park height.
* P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
*/ */
//#define NOZZLE_PARK_FEATURE #define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE) #if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise } // Specify a park position as { X, Y, Z_raise }
#define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MIN_POS + 10), 5 }
//#define NOZZLE_PARK_X_ONLY // X move only is required to park //#define NOZZLE_PARK_X_ONLY // X move only is required to park
//#define NOZZLE_PARK_Y_ONLY // Y move only is required to park //#define NOZZLE_PARK_Y_ONLY // Y move only is required to park
#define NOZZLE_PARK_Z_RAISE_MIN 2 // (mm) Always raise Z by at least this distance #define NOZZLE_PARK_Z_RAISE_MIN 2 // (mm) Always raise Z by at least this distance
@@ -1920,7 +1941,7 @@
* SD Card support is disabled by default. If your controller has an SD slot, * SD Card support is disabled by default. If your controller has an SD slot,
* you must uncomment the following option or it won't work. * you must uncomment the following option or it won't work.
*/ */
//#define SDSUPPORT #define SDSUPPORT
/** /**
* SD CARD: ENABLE CRC * SD CARD: ENABLE CRC
@@ -1967,7 +1988,7 @@
// //
// Set this option if CLOCKWISE causes values to DECREASE // Set this option if CLOCKWISE causes values to DECREASE
// //
//#define REVERSE_ENCODER_DIRECTION #define REVERSE_ENCODER_DIRECTION
// //
// This option reverses the encoder direction for navigating LCD menus. // This option reverses the encoder direction for navigating LCD menus.
@@ -1990,7 +2011,7 @@
// //
// Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. // Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu.
// //
//#define INDIVIDUAL_AXIS_HOMING_MENU #define INDIVIDUAL_AXIS_HOMING_MENU
// //
// SPEAKER/BUZZER // SPEAKER/BUZZER
@@ -1998,7 +2019,7 @@
// If you have a speaker that can produce tones, enable it here. // If you have a speaker that can produce tones, enable it here.
// By default Marlin assumes you have a buzzer with a fixed frequency. // By default Marlin assumes you have a buzzer with a fixed frequency.
// //
//#define SPEAKER #define SPEAKER
// //
// The duration and frequency for the UI feedback sound. // The duration and frequency for the UI feedback sound.
@@ -2179,7 +2200,7 @@
// RepRapDiscount FULL GRAPHIC Smart Controller // RepRapDiscount FULL GRAPHIC Smart Controller
// https://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // https://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller
// //
//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
// //
// K.3D Full Graphic Smart Controller // K.3D Full Graphic Smart Controller
@@ -2251,7 +2272,8 @@
// MKS LCD12864A/B with graphic controller and SD support. Follows MKS_MINI_12864 pinout. // MKS LCD12864A/B with graphic controller and SD support. Follows MKS_MINI_12864 pinout.
// https://www.aliexpress.com/item/33018110072.html // https://www.aliexpress.com/item/33018110072.html
// //
//#define MKS_LCD12864 //#define MKS_LCD12864A
//#define MKS_LCD12864B
// //
// FYSETC variant of the MINI12864 graphic controller with SD support // FYSETC variant of the MINI12864 graphic controller with SD support
@@ -2370,7 +2392,11 @@
//#define DGUS_LCD_UI_ORIGIN //#define DGUS_LCD_UI_ORIGIN
//#define DGUS_LCD_UI_FYSETC //#define DGUS_LCD_UI_FYSETC
//#define DGUS_LCD_UI_HIPRECY //#define DGUS_LCD_UI_HIPRECY
//#define DGUS_LCD_UI_MKS //#define DGUS_LCD_UI_MKS
#if ENABLED(DGUS_LCD_UI_MKS)
#define USE_MKS_GREEN_UI
#endif
// //
// Touch-screen LCD for Malyan M200/M300 printers // Touch-screen LCD for Malyan M200/M300 printers
@@ -2489,6 +2515,11 @@
// //
//#define ANET_ET5_TFT35 //#define ANET_ET5_TFT35
//
// 1024x600, 7", RGB Stock Display from BIQU-BX
//
//#define BIQU_BX_TFT70
// //
// Generic TFT with detailed options // Generic TFT with detailed options
// //
@@ -2545,7 +2576,7 @@
//#define DWIN_CREALITY_LCD //#define DWIN_CREALITY_LCD
// //
// ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8 // Touch Screen Settings
// //
//#define TOUCH_SCREEN //#define TOUCH_SCREEN
#if ENABLED(TOUCH_SCREEN) #if ENABLED(TOUCH_SCREEN)
+281 -107
View File
@@ -30,7 +30,7 @@
* *
* Basic settings can be found in Configuration.h * Basic settings can be found in Configuration.h
*/ */
#define CONFIGURATION_ADV_H_VERSION 020008 #define CONFIGURATION_ADV_H_VERSION 02000801
//=========================================================================== //===========================================================================
//============================= Thermal Settings ============================ //============================= Thermal Settings ============================
@@ -163,7 +163,7 @@
//#define CHAMBER_FAN // Enable a fan on the chamber //#define CHAMBER_FAN // Enable a fan on the chamber
#if ENABLED(CHAMBER_FAN) #if ENABLED(CHAMBER_FAN)
#define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve. #define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve; 3=similar to 1 but fan is always on.
#if CHAMBER_FAN_MODE == 0 #if CHAMBER_FAN_MODE == 0
#define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255) #define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255)
#elif CHAMBER_FAN_MODE == 1 #elif CHAMBER_FAN_MODE == 1
@@ -172,6 +172,9 @@
#elif CHAMBER_FAN_MODE == 2 #elif CHAMBER_FAN_MODE == 2
#define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255) #define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target #define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target
#elif CHAMBER_FAN_MODE == 3
#define CHAMBER_FAN_BASE 128 // Base chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C above target
#endif #endif
#endif #endif
@@ -204,6 +207,20 @@
#endif #endif
#endif #endif
//
// Laser Coolant Flow Meter
//
//#define LASER_COOLANT_FLOW_METER
#if ENABLED(LASER_COOLANT_FLOW_METER)
#define FLOWMETER_PIN 20 // Requires an external interrupt-enabled pin (e.g., RAMPS 2,3,18,19,20,21)
#define FLOWMETER_PPL 5880 // (pulses/liter) Flow meter pulses-per-liter on the input pin
#define FLOWMETER_INTERVAL 1000 // (ms) Flow rate calculation interval in milliseconds
#define FLOWMETER_SAFETY // Prevent running the laser without the minimum flow rate set below
#if ENABLED(FLOWMETER_SAFETY)
#define FLOWMETER_MIN_LITERS_PER_MINUTE 1.5 // (liters/min) Minimum flow required when enabled
#endif
#endif
/** /**
* Thermal Protection provides additional protection to your printer from damage * Thermal Protection provides additional protection to your printer from damage
* and fire. Marlin always includes safe min and max temperature ranges which * and fire. Marlin always includes safe min and max temperature ranges which
@@ -222,11 +239,11 @@
*/ */
#if ENABLED(THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 40 // Seconds #define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius #define THERMAL_PROTECTION_HYSTERESIS 15 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops #define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
#if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP)
//#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303
#endif #endif
/** /**
@@ -420,9 +437,9 @@
* Hotend Idle Timeout * Hotend Idle Timeout
* Prevent filament in the nozzle from charring and causing a critical jam. * Prevent filament in the nozzle from charring and causing a critical jam.
*/ */
//#define HOTEND_IDLE_TIMEOUT #define HOTEND_IDLE_TIMEOUT
#if ENABLED(HOTEND_IDLE_TIMEOUT) #if ENABLED(HOTEND_IDLE_TIMEOUT)
#define HOTEND_IDLE_TIMEOUT_SEC (5*60) // (seconds) Time without extruder movement to trigger protection #define HOTEND_IDLE_TIMEOUT_SEC (15*60) // (seconds) Time without extruder movement to trigger protection
#define HOTEND_IDLE_MIN_TRIGGER 180 // (°C) Minimum temperature to enable hotend protection #define HOTEND_IDLE_MIN_TRIGGER 180 // (°C) Minimum temperature to enable hotend protection
#define HOTEND_IDLE_NOZZLE_TARGET 0 // (°C) Safe temperature for the nozzle after timeout #define HOTEND_IDLE_NOZZLE_TARGET 0 // (°C) Safe temperature for the nozzle after timeout
#define HOTEND_IDLE_BED_TARGET 0 // (°C) Safe temperature for the bed after timeout #define HOTEND_IDLE_BED_TARGET 0 // (°C) Safe temperature for the bed after timeout
@@ -631,7 +648,7 @@
// //
// For Z set the number of stepper drivers // For Z set the number of stepper drivers
// //
#define NUM_Z_STEPPER_DRIVERS 1 // (1-4) Z options change based on how many #define NUM_Z_STEPPER_DRIVERS 2 // (1-4) Z options change based on how many
#if NUM_Z_STEPPER_DRIVERS > 1 #if NUM_Z_STEPPER_DRIVERS > 1
// Enable if Z motor direction signals are the opposite of Z1 // Enable if Z motor direction signals are the opposite of Z1
@@ -724,7 +741,7 @@
//#define HOMING_BACKOFF_POST_MM { 2, 2, 2 } // (mm) Backoff from endstops after homing //#define HOMING_BACKOFF_POST_MM { 2, 2, 2 } // (mm) Backoff from endstops after homing
//#define QUICK_HOME // If G28 contains XY do a diagonal move first #define QUICK_HOME // If G28 contains XY do a diagonal move first
//#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X //#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X
//#define HOME_Z_FIRST // Home Z first. Requires a Z-MIN endstop (not a probe). //#define HOME_Z_FIRST // Home Z first. Requires a Z-MIN endstop (not a probe).
//#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first //#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first
@@ -804,7 +821,7 @@
* Z Steppers Auto-Alignment * Z Steppers Auto-Alignment
* Add the G34 command to align multiple Z steppers using a bed probe. * Add the G34 command to align multiple Z steppers using a bed probe.
*/ */
//#define Z_STEPPER_AUTO_ALIGN #define Z_STEPPER_AUTO_ALIGN
#if ENABLED(Z_STEPPER_AUTO_ALIGN) #if ENABLED(Z_STEPPER_AUTO_ALIGN)
// Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]] // Define probe X and Y positions for Z1, Z2 [, Z3 [, Z4]]
// If not defined, probe limits will be used. // If not defined, probe limits will be used.
@@ -948,19 +965,22 @@
// Backlash Compensation // Backlash Compensation
// Adds extra movement to axes on direction-changes to account for backlash. // Adds extra movement to axes on direction-changes to account for backlash.
// //
//#define BACKLASH_COMPENSATION #define BACKLASH_COMPENSATION
#if ENABLED(BACKLASH_COMPENSATION) #if ENABLED(BACKLASH_COMPENSATION)
// Define values for backlash distance and correction. // Define values for backlash distance and correction.
// If BACKLASH_GCODE is enabled these values are the defaults. // If BACKLASH_GCODE is enabled these values are the defaults.
#define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm) #define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm)
#define BACKLASH_CORRECTION 0.0 // 0.0 = no correction; 1.0 = full correction #define BACKLASH_CORRECTION 0.1 // 0.0 = no correction; 1.0 = full correction
// Add steps for motor direction changes on CORE kinematics
//#define CORE_BACKLASH
// Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments // Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments
// to reduce print artifacts. (Enabling this is costly in memory and computation!) // to reduce print artifacts. (Enabling this is costly in memory and computation!)
//#define BACKLASH_SMOOTHING_MM 3 // (mm) //#define BACKLASH_SMOOTHING_MM 3 // (mm)
// Add runtime configuration and tuning of backlash values (M425) // Add runtime configuration and tuning of backlash values (M425)
//#define BACKLASH_GCODE #define BACKLASH_GCODE
#if ENABLED(BACKLASH_GCODE) #if ENABLED(BACKLASH_GCODE)
// Measure the Z backlash when probing (G29) and set with "M425 Z" // Measure the Z backlash when probing (G29) and set with "M425 Z"
@@ -1155,7 +1175,7 @@
#endif #endif
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU #define LCD_INFO_MENU
#if ENABLED(LCD_INFO_MENU) #if ENABLED(LCD_INFO_MENU)
//#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages //#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages
#endif #endif
@@ -1209,13 +1229,13 @@
#endif #endif
// Scroll a longer status message into view // Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING #define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY
// Add an 'M73' G-code to set the current percentage // Add an 'M73' G-code to set the current percentage
//#define LCD_SET_PROGRESS_MANUALLY #define LCD_SET_PROGRESS_MANUALLY
// Show the E position (filament used) during printing // Show the E position (filament used) during printing
//#define LCD_SHOW_E_TOTAL //#define LCD_SHOW_E_TOTAL
@@ -1281,6 +1301,8 @@
//#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted //#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted
//#define MEDIA_MENU_AT_TOP // Force the media menu to be listed on the top of the main menu
#define EVENT_GCODE_SD_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27") #define EVENT_GCODE_SD_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#if ENABLED(PRINTER_EVENT_LEDS) #if ENABLED(PRINTER_EVENT_LEDS)
@@ -1295,7 +1317,7 @@
* an option on the LCD screen to continue the print from the last-known * an option on the LCD screen to continue the print from the last-known
* point in the file. * point in the file.
*/ */
//#define POWER_LOSS_RECOVERY #define POWER_LOSS_RECOVERY
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) #define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss //#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
@@ -1361,10 +1383,10 @@
//#define UTF_FILENAME_SUPPORT //#define UTF_FILENAME_SUPPORT
// This allows hosts to request long names for files and folders with M33 // This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT #define LONG_FILENAME_HOST_SUPPORT
// Enable this option to scroll long filenames in the SD card menu // Enable this option to scroll long filenames in the SD card menu
//#define SCROLL_LONG_FILENAMES #define SCROLL_LONG_FILENAMES
// Leave the heaters on after Stop Print (not recommended!) // Leave the heaters on after Stop Print (not recommended!)
//#define SD_ABORT_NO_COOLDOWN //#define SD_ABORT_NO_COOLDOWN
@@ -1386,7 +1408,7 @@
/** /**
* Auto-report SdCard status with M27 S<seconds> * Auto-report SdCard status with M27 S<seconds>
*/ */
//#define AUTO_REPORT_SD_STATUS #define AUTO_REPORT_SD_STATUS
/** /**
* Support for USB thumb drives using an Arduino USB Host Shield or * Support for USB thumb drives using an Arduino USB Host Shield or
@@ -1461,6 +1483,15 @@
// Enable if SD detect is rendered useless (e.g., by using an SD extender) // Enable if SD detect is rendered useless (e.g., by using an SD extender)
//#define NO_SD_DETECT //#define NO_SD_DETECT
// Multiple volume support - EXPERIMENTAL.
//#define MULTI_VOLUME
#if ENABLED(MULTI_VOLUME)
#define VOLUME_SD_ONBOARD
#define VOLUME_USB_FLASH_DRIVE
#define DEFAULT_VOLUME SV_SD_ONBOARD
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
#endif
#endif // SDSUPPORT #endif // SDSUPPORT
/** /**
@@ -1539,6 +1570,7 @@
#define STATUS_CHAMBER_ANIM // Use a second bitmap to indicate chamber heating #define STATUS_CHAMBER_ANIM // Use a second bitmap to indicate chamber heating
//#define STATUS_CUTTER_ANIM // Use a second bitmap to indicate spindle / laser active //#define STATUS_CUTTER_ANIM // Use a second bitmap to indicate spindle / laser active
//#define STATUS_COOLER_ANIM // Use a second bitmap to indicate laser cooling //#define STATUS_COOLER_ANIM // Use a second bitmap to indicate laser cooling
//#define STATUS_FLOWMETER_ANIM // Use multiple bitmaps to indicate coolant flow
//#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap
//#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap
//#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
@@ -1590,6 +1622,31 @@
#endif #endif
#endif // HAS_DGUS_LCD #endif // HAS_DGUS_LCD
//
// Additional options for AnyCubic Chiron TFT displays
//
#if ENABLED(ANYCUBIC_LCD_CHIRON)
// By default the type of panel is automatically detected.
// Enable one of these options if you know the panel type.
//#define CHIRON_TFT_STANDARD
//#define CHIRON_TFT_NEW
// Enable the longer Anycubic powerup startup tune
//#define AC_DEFAULT_STARTUP_TUNE
/**
* Display Folders
* By default the file browser lists all G-code files (including those in subfolders) in a flat list.
* Enable this option to display a hierarchical file browser.
*
* NOTES:
* - Without this option it helps to enable SDCARD_SORT_ALPHA so files are sorted before/after folders.
* - When used with the "new" panel, folder names will also have '.gcode' appended to their names.
* This hack is currently required to force the panel to show folders.
*/
#define AC_SD_FOLDER_VIEW
#endif
// //
// Specify additional languages for the UI. Default specified by LCD_LANGUAGE. // Specify additional languages for the UI. Default specified by LCD_LANGUAGE.
// //
@@ -1735,18 +1792,18 @@
* *
* Warning: Does not respect endstops! * Warning: Does not respect endstops!
*/ */
//#define BABYSTEPPING #define BABYSTEPPING
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR #define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
//#define BABYSTEP_WITHOUT_HOMING //#define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). #define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
//#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps //#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
#define BABYSTEP_MULTIPLICATOR_Z 1 // (steps or mm) Steps or millimeter distance for each Z babystep #define BABYSTEP_MULTIPLICATOR_Z 1 // (steps or mm) Steps or millimeter distance for each Z babystep
#define BABYSTEP_MULTIPLICATOR_XY 1 // (steps or mm) Steps or millimeter distance for each XY babystep #define BABYSTEP_MULTIPLICATOR_XY 1 // (steps or mm) Steps or millimeter distance for each XY babystep
//#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
// Note: Extra time may be added to mitigate controller latency. // Note: Extra time may be added to mitigate controller latency.
@@ -1758,10 +1815,10 @@
//#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28
//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
#endif #endif
#endif #endif
@@ -2059,9 +2116,6 @@
//#define SERIAL_XON_XOFF //#define SERIAL_XON_XOFF
#endif #endif
// Add M575 G-code to change the baud rate
//#define BAUD_RATE_GCODE
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
// Enable this option to collect and display the maximum // Enable this option to collect and display the maximum
// RX queue usage after transferring a file to SD. // RX queue usage after transferring a file to SD.
@@ -2086,7 +2140,27 @@
* Currently handles M108, M112, M410, M876 * Currently handles M108, M112, M410, M876
* NOTE: Not yet implemented for all platforms. * NOTE: Not yet implemented for all platforms.
*/ */
//#define EMERGENCY_PARSER #define EMERGENCY_PARSER
/**
* Realtime Reporting (requires EMERGENCY_PARSER)
*
* - Report position and state of the machine (like Grbl).
* - Auto-report position during long moves.
* - Useful for CNC/LASER.
*
* Adds support for commands:
* S000 : Report State and Position while moving.
* P000 : Instant Pause / Hold while moving.
* R000 : Resume from Pause / Hold.
*
* - During Hold all Emergency Parser commands are available, as usual.
* - Enable NANODLP_Z_SYNC and NANODLP_ALL_AXIS for move command end-state reports.
*/
//#define REALTIME_REPORTING_COMMANDS
#if ENABLED(REALTIME_REPORTING_COMMANDS)
//#define FULL_REPORT_TO_HOST_FEATURE // Auto-report the machine status like Grbl CNC
#endif
// Bad Serial-connections can miss a received command by sending an 'ok' // Bad Serial-connections can miss a received command by sending an 'ok'
// Therefore some clients abort after 30 seconds in a timeout. // Therefore some clients abort after 30 seconds in a timeout.
@@ -2095,7 +2169,7 @@
//#define NO_TIMEOUTS 1000 // Milliseconds //#define NO_TIMEOUTS 1000 // Milliseconds
// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. // Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
//#define ADVANCED_OK #define ADVANCED_OK
// Printrun may have trouble receiving long strings all at once. // Printrun may have trouble receiving long strings all at once.
// This option inserts short delays between lines of serial output. // This option inserts short delays between lines of serial output.
@@ -2162,6 +2236,12 @@
//#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // Extra G-code to run after tool-change //#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // Extra G-code to run after tool-change
#endif #endif
/**
* Tool Sensors detect when tools have been picked up or dropped.
* Requires the pins TOOL_SENSOR1_PIN, TOOL_SENSOR2_PIN, etc.
*/
//#define TOOL_SENSOR
/** /**
* Retract and prime filament on tool-change to reduce * Retract and prime filament on tool-change to reduce
* ooze and stringing and to get cleaner transitions. * ooze and stringing and to get cleaner transitions.
@@ -2220,16 +2300,17 @@
#endif // HAS_MULTI_EXTRUDER #endif // HAS_MULTI_EXTRUDER
/** /**
* Advanced Pause * Advanced Pause for Filament Change
* Experimental feature for filament change support and for parking the nozzle when paused. * - Adds the G-code M600 Filament Change to initiate a filament change.
* Adds the GCode M600 for initiating filament change. * - This feature is required for the default FILAMENT_RUNOUT_SCRIPT.
* If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle.
* *
* Requires an LCD display. * Requirements:
* Requires NOZZLE_PARK_FEATURE. * - For Filament Change parking enable and configure NOZZLE_PARK_FEATURE.
* This feature is required for the default FILAMENT_RUNOUT_SCRIPT. * - For user interaction enable an LCD display, HOST_PROMPT_SUPPORT, or EMERGENCY_PARSER.
*
* Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
*/ */
//#define ADVANCED_PAUSE_FEATURE #define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
@@ -2264,14 +2345,14 @@
#define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload #define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload
#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. #define FILAMENT_CHANGE_ALERT_BEEPS 2 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
//#define HOME_BEFORE_FILAMENT_CHANGE // If needed, home before parking for filament change #define HOME_BEFORE_FILAMENT_CHANGE // If needed, home before parking for filament change
//#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. #define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) #define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
#endif #endif
// @section tmc // @section tmc
@@ -2638,22 +2719,22 @@
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] } * { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
*/ */
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below) #define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below)
//#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below) //#define CHOPPER_TIMING_X CHOPPER_TIMING // For X Axes (override below)
//#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_X2 CHOPPER_TIMING_X
//#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below) //#define CHOPPER_TIMING_Y CHOPPER_TIMING // For Y Axes (override below)
//#define CHOPPER_TIMING_Y2 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_Y2 CHOPPER_TIMING_Y
//#define CHOPPER_TIMING_Z CHOPPER_DEFAULT_12V // For Z Axes (override below) //#define CHOPPER_TIMING_Z CHOPPER_TIMING // For Z Axes (override below)
//#define CHOPPER_TIMING_Z2 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_Z2 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_Z3 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_Z3 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_Z4 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_Z4 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_E CHOPPER_DEFAULT_12V // For Extruders (override below) //#define CHOPPER_TIMING_E CHOPPER_TIMING // For Extruders (override below)
//#define CHOPPER_TIMING_E1 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_E1 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E2 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_E2 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E3 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_E3 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E4 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_E4 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E5 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_E5 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E6 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_E6 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E7 CHOPPER_DEFAULT_12V //#define CHOPPER_TIMING_E7 CHOPPER_TIMING_E
/** /**
* Monitor Trinamic drivers * Monitor Trinamic drivers
@@ -2761,7 +2842,7 @@
/** /**
* Enable M122 debugging command for TMC stepper drivers. * Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continous reporting. * M122 S0/1 will enable continuous reporting.
*/ */
//#define TMC_DEBUG //#define TMC_DEBUG
@@ -3082,6 +3163,18 @@
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC) #define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
//#define AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11
#if ENABLED(AIR_EVACUATION)
#define AIR_EVACUATION_ACTIVE LOW // Set to "HIGH" if the on/off function is active HIGH
//#define AIR_EVACUATION_PIN 42 // Override the default Cutter Vacuum or Laser Blower pin
#endif
//#define AIR_ASSIST // Air Assist control with G-codes M8-M9
#if ENABLED(AIR_ASSIST)
#define AIR_ASSIST_ACTIVE LOW // Active state on air assist pin
//#define AIR_ASSIST_PIN 44 // Override the default Air Assist pin
#endif
//#define SPINDLE_SERVO // A servo converting an angle to spindle power //#define SPINDLE_SERVO // A servo converting an angle to spindle power
#ifdef SPINDLE_SERVO #ifdef SPINDLE_SERVO
#define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control #define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control
@@ -3217,6 +3310,18 @@
#endif #endif
#endif #endif
/**
* Synchronous Laser Control with M106/M107
*
* Marlin normally applies M106/M107 fan speeds at a time "soon after" processing
* a planner block. This is too inaccurate for a PWM/TTL laser attached to the fan
* header (as with some add-on laser kits). Enable this option to set fan/laser
* speeds with much more exact timing for improved print fidelity.
*
* NOTE: This option sacrifices some cooling fan speed options.
*/
//#define LASER_SYNCHRONOUS_M106_M107
/** /**
* Coolant Control * Coolant Control
* *
@@ -3276,13 +3381,27 @@
*/ */
//#define POWER_MONITOR_CURRENT // Monitor the system current //#define POWER_MONITOR_CURRENT // Monitor the system current
//#define POWER_MONITOR_VOLTAGE // Monitor the system voltage //#define POWER_MONITOR_VOLTAGE // Monitor the system voltage
#if EITHER(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE)
#if ENABLED(POWER_MONITOR_CURRENT)
#define POWER_MONITOR_VOLTS_PER_AMP 0.05000 // Input voltage to the MCU analog pin per amp - DO NOT apply more than ADC_VREF! #define POWER_MONITOR_VOLTS_PER_AMP 0.05000 // Input voltage to the MCU analog pin per amp - DO NOT apply more than ADC_VREF!
#define POWER_MONITOR_CURRENT_OFFSET -1 // Offset value for current sensors with linear function output #define POWER_MONITOR_CURRENT_OFFSET 0 // Offset (in amps) applied to the calculated current
#define POWER_MONITOR_VOLTS_PER_VOLT 0.11786 // Input voltage to the MCU analog pin per volt - DO NOT apply more than ADC_VREF!
#define POWER_MONITOR_FIXED_VOLTAGE 13.6 // Voltage for a current sensor with no voltage sensor (for power display) #define POWER_MONITOR_FIXED_VOLTAGE 13.6 // Voltage for a current sensor with no voltage sensor (for power display)
#endif #endif
#if ENABLED(POWER_MONITOR_VOLTAGE)
#define POWER_MONITOR_VOLTS_PER_VOLT 0.077933 // Input voltage to the MCU analog pin per volt - DO NOT apply more than ADC_VREF!
#define POWER_MONITOR_VOLTAGE_OFFSET 0 // Offset (in volts) applied to the calculated voltage
#endif
/**
* Stepper Driver Anti-SNAFU Protection
*
* If the SAFE_POWER_PIN is defined for your board, Marlin will check
* that stepper drivers are properly plugged in before applying power.
* Disable protection if your stepper drivers don't support the feature.
*/
//#define DISABLE_DRIVER_SAFE_POWER_PROTECT
/** /**
* CNC Coordinate Systems * CNC Coordinate Systems
* *
@@ -3296,6 +3415,11 @@
*/ */
#define AUTO_REPORT_TEMPERATURES #define AUTO_REPORT_TEMPERATURES
/**
* Auto-report position with M154 S<seconds>
*/
//#define AUTO_REPORT_POSITION
/** /**
* Include capabilities in M115 output * Include capabilities in M115 output
*/ */
@@ -3365,7 +3489,7 @@
#define PROPORTIONAL_FONT_RATIO 1.0 #define PROPORTIONAL_FONT_RATIO 1.0
/** /**
* Spend 28 bytes of SRAM to optimize the GCode parser * Spend 28 bytes of SRAM to optimize the G-code parser
*/ */
#define FASTER_GCODE_PARSER #define FASTER_GCODE_PARSER
@@ -3415,6 +3539,71 @@
#define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro
#endif #endif
/**
* User-defined menu items to run custom G-code.
* Up to 25 may be defined, but the actual number is LCD-dependent.
*/
// Custom Menu: Main Menu
//#define CUSTOM_MENU_MAIN
#if ENABLED(CUSTOM_MENU_MAIN)
//#define CUSTOM_MENU_MAIN_TITLE "Custom Commands"
#define CUSTOM_MENU_MAIN_SCRIPT_DONE "M117 User Script Done"
#define CUSTOM_MENU_MAIN_SCRIPT_AUDIBLE_FEEDBACK
//#define CUSTOM_MENU_MAIN_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_MAIN_ONLY_IDLE // Only show custom menu when the machine is idle
#define MAIN_MENU_ITEM_1_DESC "Home & UBL Info"
#define MAIN_MENU_ITEM_1_GCODE "G28\nG29 W"
//#define MAIN_MENU_ITEM_1_CONFIRM // Show a confirmation dialog before this action
#define MAIN_MENU_ITEM_2_DESC "Preheat for " PREHEAT_1_LABEL
#define MAIN_MENU_ITEM_2_GCODE "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
//#define MAIN_MENU_ITEM_2_CONFIRM
//#define MAIN_MENU_ITEM_3_DESC "Preheat for " PREHEAT_2_LABEL
//#define MAIN_MENU_ITEM_3_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
//#define MAIN_MENU_ITEM_3_CONFIRM
//#define MAIN_MENU_ITEM_4_DESC "Heat Bed/Home/Level"
//#define MAIN_MENU_ITEM_4_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
//#define MAIN_MENU_ITEM_4_CONFIRM
//#define MAIN_MENU_ITEM_5_DESC "Home & Info"
//#define MAIN_MENU_ITEM_5_GCODE "G28\nM503"
//#define MAIN_MENU_ITEM_5_CONFIRM
#endif
// Custom Menu: Configuration Menu
//#define CUSTOM_MENU_CONFIG
#if ENABLED(CUSTOM_MENU_CONFIG)
//#define CUSTOM_MENU_CONFIG_TITLE "Custom Commands"
#define CUSTOM_MENU_CONFIG_SCRIPT_DONE "M117 Wireless Script Done"
#define CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK
//#define CUSTOM_MENU_CONFIG_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_CONFIG_ONLY_IDLE // Only show custom menu when the machine is idle
#define CONFIG_MENU_ITEM_1_DESC "Wifi ON"
#define CONFIG_MENU_ITEM_1_GCODE "M118 [ESP110] WIFI-STA pwd=12345678"
//#define CONFIG_MENU_ITEM_1_CONFIRM // Show a confirmation dialog before this action
#define CONFIG_MENU_ITEM_2_DESC "Bluetooth ON"
#define CONFIG_MENU_ITEM_2_GCODE "M118 [ESP110] BT pwd=12345678"
//#define CONFIG_MENU_ITEM_2_CONFIRM
//#define CONFIG_MENU_ITEM_3_DESC "Radio OFF"
//#define CONFIG_MENU_ITEM_3_GCODE "M118 [ESP110] OFF pwd=12345678"
//#define CONFIG_MENU_ITEM_3_CONFIRM
//#define CONFIG_MENU_ITEM_4_DESC "Wifi ????"
//#define CONFIG_MENU_ITEM_4_GCODE "M118 ????"
//#define CONFIG_MENU_ITEM_4_CONFIRM
//#define CONFIG_MENU_ITEM_5_DESC "Wifi ????"
//#define CONFIG_MENU_ITEM_5_GCODE "M118 ????"
//#define CONFIG_MENU_ITEM_5_CONFIRM
#endif
/** /**
* User-defined buttons to run custom G-code. * User-defined buttons to run custom G-code.
* Up to 25 may be defined. * Up to 25 may be defined.
@@ -3446,39 +3635,6 @@
#endif #endif
#endif #endif
/**
* User-defined menu items to run custom G-code.
* Up to 25 may be defined, but the actual number is LCD-dependent.
*/
//#define CUSTOM_USER_MENUS
#if ENABLED(CUSTOM_USER_MENUS)
//#define CUSTOM_USER_MENU_TITLE "Custom Commands"
#define USER_SCRIPT_DONE "M117 User Script Done"
#define USER_SCRIPT_AUDIBLE_FEEDBACK
//#define USER_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_ONLY_IDLE // Only show custom menu when the machine is idle
#define USER_DESC_1 "Home & UBL Info"
#define USER_GCODE_1 "G28\nG29W"
//#define USER_CONFIRM_1 // Show a confirmation dialog before this action
#define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL
#define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
//#define USER_CONFIRM_2
#define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL
#define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
//#define USER_CONFIRM_3
#define USER_DESC_4 "Heat Bed/Home/Level"
#define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
//#define USER_CONFIRM_4
#define USER_DESC_5 "Home & Info"
#define USER_GCODE_5 "G28\nM503"
//#define USER_CONFIRM_5
#endif
/** /**
* Host Action Commands * Host Action Commands
* *
@@ -3493,10 +3649,10 @@
* Host Prompt Support enables Marlin to use the host for user prompts so * Host Prompt Support enables Marlin to use the host for user prompts so
* filament runout and other processes can be managed from the host side. * filament runout and other processes can be managed from the host side.
*/ */
//#define HOST_ACTION_COMMANDS #define HOST_ACTION_COMMANDS
#if ENABLED(HOST_ACTION_COMMANDS) #if ENABLED(HOST_ACTION_COMMANDS)
//#define HOST_PROMPT_SUPPORT #define HOST_PROMPT_SUPPORT
//#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start #define HOST_START_MENU_ITEM // Add a menu item that tells the host to start
#endif #endif
/** /**
@@ -3505,6 +3661,9 @@
* Implement M486 to allow Marlin to skip objects * Implement M486 to allow Marlin to skip objects
*/ */
//#define CANCEL_OBJECTS //#define CANCEL_OBJECTS
#if ENABLED(CANCEL_OBJECTS)
#define CANCEL_OBJECTS_REPORTING // Emit the current object as a status message
#endif
/** /**
* I2C position encoders for closed loop control. * I2C position encoders for closed loop control.
@@ -3626,6 +3785,16 @@
#define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position #define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position
#endif #endif
/**
* Instant freeze / unfreeze functionality
* Specified pin has pullup and connecting to ground will instantly pause motion.
* Potentially useful for emergency stop that allows being resumed.
*/
//#define FREEZE_FEATURE
#if ENABLED(FREEZE_FEATURE)
//#define FREEZE_PIN 41 // Override the default (KILL) pin here
#endif
/** /**
* MAX7219 Debug Matrix * MAX7219 Debug Matrix
* *
@@ -3662,14 +3831,13 @@
/** /**
* NanoDLP Sync support * NanoDLP Sync support
* *
* Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" * Support for Synchronized Z moves when used with NanoDLP. G0/G1 axis moves will
* string to enable synchronization with DLP projector exposure. This change will allow to use * output a "Z_move_comp" string to enable synchronization with DLP projector exposure.
* [[WaitForDoneMessage]] instead of populating your gcode with M400 commands * This feature allows you to use [[WaitForDoneMessage]] instead of M400 commands.
*/ */
//#define NANODLP_Z_SYNC //#define NANODLP_Z_SYNC
#if ENABLED(NANODLP_Z_SYNC) #if ENABLED(NANODLP_Z_SYNC)
//#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. //#define NANODLP_ALL_AXIS // Send a "Z_move_comp" report for any axis move (not just Z).
// Default behavior is limited to Z axis only.
#endif #endif
/** /**
@@ -3833,7 +4001,7 @@
// //
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe // M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
// //
//#define PINS_DEBUGGING #define PINS_DEBUGGING
// Enable Marlin dev mode which adds some special commands // Enable Marlin dev mode which adds some special commands
//#define MARLIN_DEV_MODE //#define MARLIN_DEV_MODE
@@ -3844,3 +4012,9 @@
* a crash from a remote location. Requires ~400 bytes of SRAM and 5Kb of flash. * a crash from a remote location. Requires ~400 bytes of SRAM and 5Kb of flash.
*/ */
//#define POSTMORTEM_DEBUGGING //#define POSTMORTEM_DEBUGGING
/**
* Software Reset options
*/
//#define SOFT_RESET_VIA_SERIAL // 'KILL' and '^X' commands will soft-reset the controller
//#define SOFT_RESET_ON_KILL // Use a digital button to soft-reset the controller after KILL
+2 -2
View File
@@ -219,7 +219,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1111)
else ifeq ($(HARDWARE_MOTHERBOARD),1112) else ifeq ($(HARDWARE_MOTHERBOARD),1112)
# MKS GEN L # MKS GEN L
else ifeq ($(HARDWARE_MOTHERBOARD),1113) else ifeq ($(HARDWARE_MOTHERBOARD),1113)
# zrib V2.0 control board (Chinese knock off RAMPS replica) # zrib V2.0 control board (Chinese RAMPS replica)
else ifeq ($(HARDWARE_MOTHERBOARD),1114) else ifeq ($(HARDWARE_MOTHERBOARD),1114)
# BigTreeTech or BIQU KFB2.0 # BigTreeTech or BIQU KFB2.0
else ifeq ($(HARDWARE_MOTHERBOARD),1115) else ifeq ($(HARDWARE_MOTHERBOARD),1115)
@@ -993,5 +993,5 @@ clean:
.PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
# Automaticaly include the dependency files created by gcc # Automatically include the dependency files created by gcc
-include ${patsubst %.o, %.d, ${OBJ}} -include ${patsubst %.o, %.d, ${OBJ}}
+9
View File
@@ -58,6 +58,15 @@ void HAL_init() {
#endif #endif
} }
void HAL_reboot() {
#if ENABLED(USE_WATCHDOG)
while (1) { /* run out the watchdog */ }
#else
void (*resetFunc)() = 0; // Declare resetFunc() at address 0
resetFunc(); // Jump to address 0
#endif
}
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "../../sd/SdFatUtil.h" #include "../../sd/SdFatUtil.h"
+12 -5
View File
@@ -93,28 +93,35 @@ typedef int8_t pin_t;
#define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0) #define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
#else #else
#if !WITHIN(SERIAL_PORT, -1, 3) #if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif #endif
#define MYSERIAL1 customizedSerial1 #define MYSERIAL1 customizedSerial1
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3) #if !WITHIN(SERIAL_PORT_2, -1, 3)
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial."
#endif #endif
#define MYSERIAL2 customizedSerial2 #define MYSERIAL2 customizedSerial2
#endif #endif
#ifdef SERIAL_PORT_3
#if !WITHIN(SERIAL_PORT_3, -1, 3)
#error "SERIAL_PORT_3 must be from 0 to 3, or -1 for USB Serial."
#endif
#define MYSERIAL3 customizedSerial3
#endif
#endif #endif
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if !WITHIN(MMU2_SERIAL_PORT, -1, 3) #if !WITHIN(MMU2_SERIAL_PORT, -1, 3)
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif #endif
#define MMU2_SERIAL mmuSerial #define MMU2_SERIAL mmuSerial
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
#if !WITHIN(LCD_SERIAL_PORT, -1, 3) #if !WITHIN(LCD_SERIAL_PORT, -1, 3)
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif #endif
#define LCD_SERIAL lcdSerial #define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
@@ -135,7 +142,7 @@ void HAL_init();
inline void HAL_clear_reset_source() { MCUSR = 0; } inline void HAL_clear_reset_source() { MCUSR = 0; }
inline uint8_t HAL_get_reset_source() { return MCUSR; } inline uint8_t HAL_get_reset_source() { return MCUSR; }
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
#if GCC_VERSION <= 50000 #if GCC_VERSION <= 50000
#pragma GCC diagnostic push #pragma GCC diagnostic push
+27 -10
View File
@@ -454,7 +454,7 @@ void MarlinSerial<Cfg>::flush() {
} }
template<typename Cfg> template<typename Cfg>
size_t MarlinSerial<Cfg>::write(const uint8_t c) { void MarlinSerial<Cfg>::write(const uint8_t c) {
if (Cfg::TX_SIZE == 0) { if (Cfg::TX_SIZE == 0) {
_written = true; _written = true;
@@ -480,7 +480,7 @@ size_t MarlinSerial<Cfg>::write(const uint8_t c) {
// location". This makes sure flush() won't return until the bytes // location". This makes sure flush() won't return until the bytes
// actually got written // actually got written
B_TXC = 1; B_TXC = 1;
return 1; return;
} }
const uint8_t i = (tx_buffer.head + 1) & (Cfg::TX_SIZE - 1); const uint8_t i = (tx_buffer.head + 1) & (Cfg::TX_SIZE - 1);
@@ -510,7 +510,6 @@ size_t MarlinSerial<Cfg>::write(const uint8_t c) {
// Enable TX ISR - Non atomic, but it will eventually enable TX ISR // Enable TX ISR - Non atomic, but it will eventually enable TX ISR
B_UDRIE = 1; B_UDRIE = 1;
} }
return 1;
} }
template<typename Cfg> template<typename Cfg>
@@ -568,7 +567,7 @@ ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _UDRE_vect)) {
// Because of the template definition above, it's required to instantiate the template to have all methods generated // Because of the template definition above, it's required to instantiate the template to have all methods generated
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >; template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
MSerialT customizedSerial1(MSerialT::HasEmergencyParser); MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -583,7 +582,24 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> >; template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> >;
MSerialT2 customizedSerial2(MSerialT2::HasEmergencyParser); MSerialT2 customizedSerial2(MSerialT2::HasEmergencyParser);
#endif
#endif // SERIAL_PORT_2
#ifdef SERIAL_PORT_3
// Hookup ISR handlers
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_3, _RX_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_3>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_3, _UDRE_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_3>>::_tx_udr_empty_irq();
}
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> >;
MSerialT3 customizedSerial3(MSerialT3::HasEmergencyParser);
#endif // SERIAL_PORT_3
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
@@ -596,8 +612,9 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
} }
template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >; template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
MSerialT3 mmuSerial(MSerialT3::HasEmergencyParser); MSerialMMU2 mmuSerial(MSerialMMU2::HasEmergencyParser);
#endif
#endif // MMU2_SERIAL_PORT
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
@@ -610,7 +627,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
} }
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >; template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
MSerialT4 lcdSerial(MSerialT4::HasEmergencyParser); MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
template<typename Cfg> template<typename Cfg>
@@ -623,13 +640,13 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
} }
#endif #endif
#endif #endif // LCD_SERIAL_PORT
#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) #endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
// For AT90USB targets use the UART for BT interfacing // For AT90USB targets use the UART for BT interfacing
#if defined(USBCON) && ENABLED(BLUETOOTH) #if defined(USBCON) && ENABLED(BLUETOOTH)
MSerialT5 bluetoothSerial(false); MSerialBT bluetoothSerial(false);
#endif #endif
#endif // __AVR__ #endif // __AVR__
+14 -9
View File
@@ -210,7 +210,7 @@
static int read(); static int read();
static void flush(); static void flush();
static ring_buffer_pos_t available(); static ring_buffer_pos_t available();
static size_t write(const uint8_t c); static void write(const uint8_t c);
static void flushTX(); static void flushTX();
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
static ring_buffer_pos_t get_tx_buffer_free(); static ring_buffer_pos_t get_tx_buffer_free();
@@ -238,14 +238,19 @@
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED); static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
}; };
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
extern MSerialT customizedSerial1; extern MSerialT1 customizedSerial1;
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2; extern MSerialT2 customizedSerial2;
#endif #endif
#ifdef SERIAL_PORT_3
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> > > MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
#endif // !USBCON #endif // !USBCON
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
@@ -262,8 +267,8 @@
static constexpr bool RX_OVERRUNS = false; static constexpr bool RX_OVERRUNS = false;
}; };
typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3; typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialMMU2;
extern MSerialT3 mmuSerial; extern MSerialMMU2 mmuSerial;
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
@@ -281,12 +286,12 @@
static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS); static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
}; };
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4; typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialLCD;
extern MSerialT4 lcdSerial; extern MSerialLCD lcdSerial;
#endif #endif
// Use the UART for Bluetooth in AT90USB configurations // Use the UART for Bluetooth in AT90USB configurations
#if defined(USBCON) && ENABLED(BLUETOOTH) #if defined(USBCON) && ENABLED(BLUETOOTH)
typedef Serial1Class<HardwareSerial> MSerialT5; typedef Serial1Class<HardwareSerial> MSerialBT;
extern MSerialT5 bluetoothSerial; extern MSerialBT bluetoothSerial;
#endif #endif
+3 -3
View File
@@ -40,13 +40,13 @@ bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles, if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+1 -1
View File
@@ -241,7 +241,7 @@ uint8_t extDigitalRead(const int8_t pin) {
* *
* DC values -1.0 to 1.0. Negative duty cycle inverts the pulse. * DC values -1.0 to 1.0. Negative duty cycle inverts the pulse.
*/ */
uint16_t set_pwm_frequency_hz(const float &hz, const float dca, const float dcb, const float dcc) { uint16_t set_pwm_frequency_hz(const_float_t hz, const float dca, const float dcb, const float dcc) {
float count = 0; float count = 0;
if (hz > 0 && (dca || dcb || dcc)) { if (hz > 0 && (dca || dcb || dcc)) {
count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq. count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq.
+1 -1
View File
@@ -38,7 +38,7 @@
// portModeRegister takes a different argument // portModeRegister takes a different argument
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p) #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p) #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
#define digitalPinToPort_DEBUG(p) digitalPinToPort_Teensy(p) #define digitalPinToPort_DEBUG(p) digitalPinToPort(p)
#define GET_PINMODE(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin)) #define GET_PINMODE(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin))
#elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70 #elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70
+6 -4
View File
@@ -77,6 +77,8 @@ uint8_t HAL_get_reset_source() {
} }
} }
void HAL_reboot() { rstc_start_software_reset(RSTC); }
void _delay_ms(const int delay_ms) { void _delay_ms(const int delay_ms) {
// Todo: port for Due? // Todo: port for Due?
delay(delay_ms); delay(delay_ms);
@@ -106,16 +108,16 @@ uint16_t HAL_adc_get_result() {
} }
// Forward the default serial ports // Forward the default serial ports
#if ANY_SERIAL_IS(0) #if USING_HW_SERIAL0
DefaultSerial1 MSerial0(false, Serial); DefaultSerial1 MSerial0(false, Serial);
#endif #endif
#if ANY_SERIAL_IS(1) #if USING_HW_SERIAL1
DefaultSerial2 MSerial1(false, Serial1); DefaultSerial2 MSerial1(false, Serial1);
#endif #endif
#if ANY_SERIAL_IS(2) #if USING_HW_SERIAL2
DefaultSerial3 MSerial2(false, Serial2); DefaultSerial3 MSerial2(false, Serial2);
#endif #endif
#if ANY_SERIAL_IS(3) #if USING_HW_SERIAL3
DefaultSerial4 MSerial3(false, Serial3); DefaultSerial4 MSerial3(false, Serial3);
#endif #endif
+16 -9
View File
@@ -50,13 +50,12 @@ extern DefaultSerial4 MSerial3;
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
// Define MYSERIAL1/2 before MarlinSerial includes!
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER) #if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL1 customizedSerial1 #define MYSERIAL1 customizedSerial1
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "The required SERIAL_PORT must be from 0 to 3, or -1 for USB Serial."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -65,7 +64,17 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL3 customizedSerial3
#elif WITHIN(SERIAL_PORT_3, 0, 3)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 0 to 3, or -1 for USB Serial."
#endif #endif
#endif #endif
@@ -73,17 +82,15 @@ extern DefaultSerial4 MSerial3;
#if WITHIN(MMU2_SERIAL_PORT, 0, 3) #if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from 0 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3."
#endif #endif
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1 #if WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL lcdSerial
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3."
#endif #endif
#endif #endif
@@ -113,7 +120,7 @@ void sei(); // Enable interrupts
void HAL_clear_reset_source(); // clear reset reason void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason uint8_t HAL_get_reset_source(); // get reset reason
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
// //
// ADC // ADC
+7 -2
View File
@@ -476,9 +476,9 @@ void MarlinSerial<Cfg>::flushTX() {
// If not using the USB port as serial port // If not using the USB port as serial port
#if SERIAL_PORT >= 0 #if defined(SERIAL_PORT) && SERIAL_PORT >= 0
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >; template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
MSerialT customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER); MSerialT1 customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
#endif #endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
@@ -486,4 +486,9 @@ void MarlinSerial<Cfg>::flushTX() {
MSerialT2 customizedSerial2(MarlinSerialCfg<SERIAL_PORT_2>::EMERGENCYPARSER); MSerialT2 customizedSerial2(MarlinSerialCfg<SERIAL_PORT_2>::EMERGENCYPARSER);
#endif #endif
#if defined(SERIAL_PORT_3) && SERIAL_PORT_3 >= 0
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> >;
MSerialT3 customizedSerial3(MarlinSerialCfg<SERIAL_PORT_3>::EMERGENCYPARSER);
#endif
#endif // ARDUINO_ARCH_SAM #endif // ARDUINO_ARCH_SAM
+8 -3
View File
@@ -140,12 +140,17 @@ struct MarlinSerialCfg {
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED); static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
}; };
#if SERIAL_PORT >= 0 #if defined(SERIAL_PORT) && SERIAL_PORT >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
extern MSerialT customizedSerial1; extern MSerialT1 customizedSerial1;
#endif #endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2; extern MSerialT2 customizedSerial2;
#endif #endif
#if defined(SERIAL_PORT_3) && SERIAL_PORT_3 >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> > > MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
+8 -5
View File
@@ -19,13 +19,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
#ifdef ARDUINO_ARCH_SAM
/** /**
* MarlinSerial_Due.cpp - Hardware serial library for Arduino DUE * MarlinSerial_Due.cpp - Hardware serial library for Arduino DUE
* Copyright (c) 2017 Eduardo José Tagle. All right reserved * Copyright (c) 2017 Eduardo José Tagle. All right reserved
* Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved. * Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved.
*/ */
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
@@ -65,7 +65,7 @@ int MarlinSerialUSB::peek() {
pending_char = udi_cdc_getc(); pending_char = udi_cdc_getc();
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)pending_char)); TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)pending_char));
return pending_char; return pending_char;
} }
@@ -87,7 +87,7 @@ int MarlinSerialUSB::read() {
int c = udi_cdc_getc(); int c = udi_cdc_getc();
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)c)); TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)c));
return c; return c;
} }
@@ -129,10 +129,13 @@ size_t MarlinSerialUSB::write(const uint8_t c) {
// Preinstantiate // Preinstantiate
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
MSerialT customizedSerial1(TERN0(EMERGENCY_PARSER, true)); MSerialT1 customizedSerial1(TERN0(EMERGENCY_PARSER, true));
#endif #endif
#if SERIAL_PORT_2 == -1 #if SERIAL_PORT_2 == -1
MSerialT customizedSerial2(TERN0(EMERGENCY_PARSER, true)); MSerialT2 customizedSerial2(TERN0(EMERGENCY_PARSER, true));
#endif
#if SERIAL_PORT_3 == -1
MSerialT3 customizedSerial3(TERN0(EMERGENCY_PARSER, true));
#endif #endif
#endif // HAS_USB_SERIAL #endif // HAS_USB_SERIAL
+9 -7
View File
@@ -27,11 +27,9 @@
*/ */
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if HAS_USB_SERIAL
#include <WString.h>
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
#include <WString.h>
struct MarlinSerialUSB { struct MarlinSerialUSB {
void begin(const long); void begin(const long);
@@ -50,14 +48,18 @@ struct MarlinSerialUSB {
FORCE_INLINE int rxMaxEnqueued() { return 0; } FORCE_INLINE int rxMaxEnqueued() { return 0; }
#endif #endif
}; };
typedef Serial1Class<MarlinSerialUSB> MSerialT;
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
extern MSerialT customizedSerial1; typedef Serial1Class<MarlinSerialUSB> MSerialT1;
extern MSerialT1 customizedSerial1;
#endif #endif
#if SERIAL_PORT_2 == -1 #if SERIAL_PORT_2 == -1
extern MSerialT customizedSerial2; typedef Serial1Class<MarlinSerialUSB> MSerialT2;
extern MSerialT2 customizedSerial2;
#endif #endif
#endif // HAS_USB_SERIAL #if SERIAL_PORT_3 == -1
typedef Serial1Class<MarlinSerialUSB> MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
+3 -4
View File
@@ -976,14 +976,13 @@ bool PersistentStore::access_start() { ee_Init(); return true; }
bool PersistentStore::access_finish() { ee_Flush(); return true; } bool PersistentStore::access_finish() { ee_Flush(); return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles, if (v != ee_Read(uint32_t(p))) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != ee_Read(uint32_t(p))) {
ee_Write(uint32_t(p), v); ee_Write(uint32_t(p), v);
delay(2); if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (ee_Read(uint32_t(p)) != v) { if (ee_Read(uint32_t(p)) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+3 -4
View File
@@ -42,14 +42,13 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles, if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
delay(2); if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+1 -1
View File
@@ -33,7 +33,7 @@
* For ARDUINO_ARCH_SAM * For ARDUINO_ARCH_SAM
* Note the code here was specifically crafted by disassembling what GCC produces * Note the code here was specifically crafted by disassembling what GCC produces
* out of it, so GCC is able to optimize it out as much as possible to the least * out of it, so GCC is able to optimize it out as much as possible to the least
* amount of instructions. Be very carefull if you modify them, as "clean code" * amount of instructions. Be very careful if you modify them, as "clean code"
* leads to less efficient compiled code!! * leads to less efficient compiled code!!
*/ */
+9 -9
View File
@@ -32,7 +32,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready() {
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) { Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()) if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT; return CTRL_NO_PRESENT;
*nb_sector = card.getSd2Card().cardSize() - 1; *nb_sector = card.diskIODriver()->cardSize() - 1;
return CTRL_GOOD; return CTRL_GOOD;
} }
@@ -74,24 +74,24 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#endif #endif
// Start reading // Start reading
if (!card.getSd2Card().readStart(addr)) if (!card.diskIODriver()->readStart(addr))
return CTRL_FAIL; return CTRL_FAIL;
// For each specified sector // For each specified sector
while (nb_sector--) { while (nb_sector--) {
// Read a sector // Read a sector
card.getSd2Card().readData(sector_buf); card.diskIODriver()->readData(sector_buf);
// RAM -> USB // RAM -> USB
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) { if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.getSd2Card().readStop(); card.diskIODriver()->readStop();
return CTRL_FAIL; return CTRL_FAIL;
} }
} }
// Stop reading // Stop reading
card.getSd2Card().readStop(); card.diskIODriver()->readStop();
// Done // Done
return CTRL_GOOD; return CTRL_GOOD;
@@ -113,7 +113,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
} }
#endif #endif
if (!card.getSd2Card().writeStart(addr, nb_sector)) if (!card.diskIODriver()->writeStart(addr, nb_sector))
return CTRL_FAIL; return CTRL_FAIL;
// For each specified sector // For each specified sector
@@ -121,16 +121,16 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
// USB -> RAM // USB -> RAM
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) { if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.getSd2Card().writeStop(); card.diskIODriver()->writeStop();
return CTRL_FAIL; return CTRL_FAIL;
} }
// Write a sector // Write a sector
card.getSd2Card().writeData(sector_buf); card.diskIODriver()->writeData(sector_buf);
} }
// Stop writing // Stop writing
card.getSd2Card().writeStop(); card.diskIODriver()->writeStop();
// Done // Done
return CTRL_GOOD; return CTRL_GOOD;
+1 -1
View File
@@ -322,7 +322,7 @@ void usb_task_init(void) {
char *sptr; char *sptr;
// Patch in the filament diameter // Patch in the filament diameter
sprintf_P(diam, PSTR("%d"), (int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000.0)); itoa((int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000), diam, 10);
// And copy it to the proper place, expanding it to unicode // And copy it to the proper place, expanding it to unicode
sptr = &diam[0]; sptr = &diam[0];
+2
View File
@@ -141,6 +141,8 @@ void HAL_clear_reset_source() { }
uint8_t HAL_get_reset_source() { return rtc_get_reset_reason(1); } uint8_t HAL_get_reset_source() { return rtc_get_reset_reason(1); }
void HAL_reboot() { ESP.restart(); }
void _delay_ms(int delay_ms) { delay(delay_ms); } void _delay_ms(int delay_ms) { delay(delay_ms); }
// return free memory between end of heap (or end bss) and whatever is current // return free memory between end of heap (or end bss) and whatever is current
+1 -1
View File
@@ -101,7 +101,7 @@ void HAL_clear_reset_source();
// reset reason // reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
void _delay_ms(int delay); void _delay_ms(int delay);
+1 -1
View File
@@ -29,7 +29,7 @@
#include "wifi.h" #include "wifi.h"
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
MSerialT webSocketSerial(false); MSerialWebSocketT webSocketSerial(false);
AsyncWebSocket ws("/ws"); // TODO Move inside the class. AsyncWebSocket ws("/ws"); // TODO Move inside the class.
// RingBuffer impl // RingBuffer impl
+2 -2
View File
@@ -81,5 +81,5 @@ public:
#endif #endif
}; };
typedef Serial1Class<WebSocketSerial> MSerialT; typedef Serial1Class<WebSocketSerial> MSerialWebSocketT;
extern MSerialT webSocketSerial; extern MSerialWebSocketT webSocketSerial;
+2
View File
@@ -73,4 +73,6 @@ void HAL_pwm_init() {
} }
void HAL_reboot() { /* Reset the application state and GPIO */ }
#endif // __PLAT_LINUX__ #endif // __PLAT_LINUX__
+1 -1
View File
@@ -107,7 +107,7 @@ uint16_t HAL_adc_get_result();
inline void HAL_clear_reset_source(void) {} inline void HAL_clear_reset_source(void) {}
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot(); // Reset the application state and GPIO
/* ---------------- Delay in cycles */ /* ---------------- Delay in cycles */
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) { FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
+3 -1
View File
@@ -67,7 +67,7 @@ void flashFirmware(const int16_t) {
delay(500); // Give OS time to disconnect delay(500); // Give OS time to disconnect
USB_Connect(false); // USB clear connection USB_Connect(false); // USB clear connection
delay(1000); // Give OS time to notice delay(1000); // Give OS time to notice
NVIC_SystemReset(); HAL_reboot();
} }
void HAL_clear_reset_source(void) { void HAL_clear_reset_source(void) {
@@ -81,4 +81,6 @@ uint8_t HAL_get_reset_source(void) {
return RST_POWER_ON; return RST_POWER_ON;
} }
void HAL_reboot() { NVIC_SystemReset(); }
#endif // TARGET_LPC1768 #endif // TARGET_LPC1768
+18 -5
View File
@@ -71,7 +71,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -80,7 +80,17 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 USBSerial
#elif WITHIN(SERIAL_PORT_3, 0, 3)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -90,7 +100,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -100,7 +110,10 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() MSerial0.available()
#endif #endif
#endif #endif
@@ -215,4 +228,4 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255,
void HAL_clear_reset_source(void); void HAL_clear_reset_source(void);
uint8_t HAL_get_reset_source(void); uint8_t HAL_get_reset_source(void);
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
+1
View File
@@ -21,6 +21,7 @@
*/ */
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#if ENABLED(POSTMORTEM_DEBUGGING) #if ENABLED(POSTMORTEM_DEBUGGING)
+14 -13
View File
@@ -21,25 +21,26 @@
*/ */
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768
#include "../../inc/MarlinConfigPre.h"
#include "MarlinSerial.h" #include "MarlinSerial.h"
#if ANY_SERIAL_IS(0) #include "../../inc/MarlinConfig.h"
MarlinSerial _MSerial(LPC_UART0);
MSerialT MSerial0(true, _MSerial); #if USING_HW_SERIAL0
extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); } MarlinSerial _MSerial0(LPC_UART0);
MSerialT MSerial0(true, _MSerial0);
extern "C" void UART0_IRQHandler() { _MSerial0.IRQHandler(); }
#endif #endif
#if ANY_SERIAL_IS(1) #if USING_HW_SERIAL1
MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1); MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1);
MSerialT MSerial1(true, _MSerial1); MSerialT MSerial1(true, _MSerial1);
extern "C" void UART1_IRQHandler() { _MSerial1.IRQHandler(); } extern "C" void UART1_IRQHandler() { _MSerial1.IRQHandler(); }
#endif #endif
#if ANY_SERIAL_IS(2) #if USING_HW_SERIAL2
MarlinSerial _MSerial2(LPC_UART2); MarlinSerial _MSerial2(LPC_UART2);
MSerialT MSerial2(true, _MSerial2); MSerialT MSerial2(true, _MSerial2);
extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); } extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); }
#endif #endif
#if ANY_SERIAL_IS(3) #if USING_HW_SERIAL3
MarlinSerial _MSerial3(LPC_UART3); MarlinSerial _MSerial3(LPC_UART3);
MSerialT MSerial3(true, _MSerial3); MSerialT MSerial3(true, _MSerial3);
extern "C" void UART3_IRQHandler() { _MSerial3.IRQHandler(); } extern "C" void UART3_IRQHandler() { _MSerial3.IRQHandler(); }
@@ -50,16 +51,16 @@
bool MarlinSerial::recv_callback(const char c) { bool MarlinSerial::recv_callback(const char c) {
// Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro) // Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
if (false) {} if (false) {}
#if ANY_SERIAL_IS(0) #if USING_HW_SERIAL0
else if (this == &_MSerial) emergency_parser.update(MSerial0.emergency_state, c); else if (this == &_MSerial0) emergency_parser.update(MSerial0.emergency_state, c);
#endif #endif
#if ANY_SERIAL_IS(1) #if USING_HW_SERIAL1
else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c); else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);
#endif #endif
#if ANY_SERIAL_IS(2) #if USING_HW_SERIAL2
else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c); else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c);
#endif #endif
#if ANY_SERIAL_IS(3) #if USING_HW_SERIAL3
else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c); else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c);
#endif #endif
return true; return true;
+2 -2
View File
@@ -60,8 +60,8 @@ extern MSerialT MSerial1;
extern MSerialT MSerial2; extern MSerialT MSerial2;
extern MSerialT MSerial3; extern MSerialT MSerial3;
// Consequently, we can't use a RuntimeSerial either. The workaround would be to use a RuntimeSerial<ForwardSerial<MarlinSerial>> type here // Consequently, we can't use a RuntimeSerial either. The workaround would be to use
// Right now, let's ignore this until it's actually required. // a RuntimeSerial<ForwardSerial<MarlinSerial>> type here. Ignore for now until it's actually required.
#if ENABLED(SERIAL_RUNTIME_HOOK) #if ENABLED(SERIAL_RUNTIME_HOOK)
#error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x." #error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x."
#endif #endif
+4 -8
View File
@@ -42,25 +42,22 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
} }
} }
crc16(crc, &v, 1); crc16(crc, &v, 1);
pos++; pos++;
value++; value++;
}; }
return false; return false;
} }
@@ -68,7 +65,6 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
do { do {
// Read from external EEPROM // Read from external EEPROM
const uint8_t c = eeprom_read_byte((uint8_t*)pos); const uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c; if (writing) *value = c;
crc16(crc, &c, 1); crc16(crc, &c, 1);
pos++; pos++;
+5 -5
View File
@@ -92,7 +92,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#define ANY_TX(N,V...) DO(IS_TX##N,||,V) #define ANY_TX(N,V...) DO(IS_TX##N,||,V)
#define ANY_RX(N,V...) DO(IS_RX##N,||,V) #define ANY_RX(N,V...) DO(IS_RX##N,||,V)
#if ANY_SERIAL_IS(0) #if USING_HW_SERIAL0
#define IS_TX0(P) (P == P0_02) #define IS_TX0(P) (P == P0_02)
#define IS_RX0(P) (P == P0_03) #define IS_RX0(P) (P == P0_03)
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI) #if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
@@ -106,7 +106,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#undef IS_RX0 #undef IS_RX0
#endif #endif
#if ANY_SERIAL_IS(1) #if USING_HW_SERIAL1
#define IS_TX1(P) (P == P0_15) #define IS_TX1(P) (P == P0_15)
#define IS_RX1(P) (P == P0_16) #define IS_RX1(P) (P == P0_16)
#define _IS_TX1_1 IS_TX1 #define _IS_TX1_1 IS_TX1
@@ -127,7 +127,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#undef _IS_RX1_1 #undef _IS_RX1_1
#endif #endif
#if ANY_SERIAL_IS(2) #if USING_HW_SERIAL2
#define IS_TX2(P) (P == P0_10) #define IS_TX2(P) (P == P0_10)
#define IS_RX2(P) (P == P0_11) #define IS_RX2(P) (P == P0_11)
#define _IS_TX2_1 IS_TX2 #define _IS_TX2_1 IS_TX2
@@ -144,7 +144,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#error "Serial port pins (2) conflict with Z4 pins!" #error "Serial port pins (2) conflict with Z4 pins!"
#elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN) #elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
#error "Serial port pins (2) conflict with other pins!" #error "Serial port pins (2) conflict with other pins!"
#elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN) #elif Y_HOME_TO_MIN && IS_TX2(Y_STOP_PIN)
#error "Serial port pins (2) conflict with Y endstop pin!" #error "Serial port pins (2) conflict with Y endstop pin!"
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN) #elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
#error "Serial port pins (2) conflict with probe pin!" #error "Serial port pins (2) conflict with probe pin!"
@@ -161,7 +161,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#undef _IS_RX2_1 #undef _IS_RX2_1
#endif #endif
#if ANY_SERIAL_IS(3) #if USING_HW_SERIAL3
#define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00) #define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
#define PIN_IS_RX3(P) (P##_PIN == P0_01) #define PIN_IS_RX3(P) (P##_PIN == P0_01)
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX) #if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
+1 -1
View File
@@ -117,7 +117,7 @@ void HAL_init() {
PinCfg.Pinmode = 2; // no pull-up/pull-down PinCfg.Pinmode = 2; // no pull-up/pull-down
PINSEL_ConfigPin(&PinCfg); PINSEL_ConfigPin(&PinCfg);
// now set CLKOUT_EN bit // now set CLKOUT_EN bit
LPC_SC->CLKOUTCFG |= (1<<8); SBI(LPC_SC->CLKOUTCFG, 8);
#endif #endif
USB_Init(); // USB Initialization USB_Init(); // USB Initialization
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS #if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
#include "xpt2046.h" #include "xpt2046.h"
#include <SPI.h> #include <SPI.h>
@@ -20,6 +20,7 @@ def print_error(e):
'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \ 'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \
%(e, env.get('PIOENV'))) %(e, env.get('PIOENV')))
def before_upload(source, target, env):
try: try:
# #
# Find a disk for upload # Find a disk for upload
@@ -118,3 +119,5 @@ try:
except Exception as e: except Exception as e:
print_error(str(e)) print_error(str(e))
env.AddPreAction("upload", before_upload)
+7 -5
View File
@@ -25,19 +25,19 @@
#include <wiring_private.h> #include <wiring_private.h>
#ifdef ADAFRUIT_GRAND_CENTRAL_M4 #ifdef ADAFRUIT_GRAND_CENTRAL_M4
#if ANY_SERIAL_IS(-1) #if USING_HW_SERIALUSB
DefaultSerial1 MSerial0(false, Serial); DefaultSerial1 MSerial0(false, Serial);
#endif #endif
#if ANY_SERIAL_IS(0) #if USING_HW_SERIAL0
DefaultSerial2 MSerial1(false, Serial1); DefaultSerial2 MSerial1(false, Serial1);
#endif #endif
#if ANY_SERIAL_IS(1) #if USING_HW_SERIAL1
DefaultSerial3 MSerial2(false, Serial2); DefaultSerial3 MSerial2(false, Serial2);
#endif #endif
#if ANY_SERIAL_IS(2) #if USING_HW_SERIAL2
DefaultSerial4 MSerial3(false, Serial3); DefaultSerial4 MSerial3(false, Serial3);
#endif #endif
#if ANY_SERIAL_IS(3) #if USING_HW_SERIAL3
DefaultSerial5 MSerial4(false, Serial4); DefaultSerial5 MSerial4(false, Serial4);
#endif #endif
#endif #endif
@@ -436,6 +436,8 @@ uint8_t HAL_get_reset_source() {
} }
#pragma pop_macro("WDT") #pragma pop_macro("WDT")
void HAL_reboot() { NVIC_SystemReset(); }
extern "C" { extern "C" {
void * _sbrk(int incr); void * _sbrk(int incr);
+5 -7
View File
@@ -43,8 +43,6 @@
extern DefaultSerial4 MSerial3; extern DefaultSerial4 MSerial3;
extern DefaultSerial5 MSerial4; extern DefaultSerial5 MSerial4;
// MYSERIAL1 required before MarlinSerial includes!
#define __MSERIAL(X) MSerial##X #define __MSERIAL(X) MSerial##X
#define _MSERIAL(X) __MSERIAL(X) #define _MSERIAL(X) __MSERIAL(X)
#define MSERIAL(X) _MSERIAL(INCREMENT(X)) #define MSERIAL(X) _MSERIAL(INCREMENT(X))
@@ -54,7 +52,7 @@
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -63,7 +61,7 @@
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -73,7 +71,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -83,7 +81,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration." #error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -109,7 +107,7 @@ typedef int8_t pin_t;
void HAL_clear_reset_source(); // clear reset reason void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason uint8_t HAL_get_reset_source(); // get reset reason
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
// //
// ADC // ADC
+3 -3
View File
@@ -27,7 +27,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ANY_SERIAL_IS(1) #if USING_HW_SERIAL1
UartT Serial2(false, &sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX); UartT Serial2(false, &sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);
void SERCOM4_0_Handler() { Serial2.IrqHandler(); } void SERCOM4_0_Handler() { Serial2.IrqHandler(); }
void SERCOM4_1_Handler() { Serial2.IrqHandler(); } void SERCOM4_1_Handler() { Serial2.IrqHandler(); }
@@ -35,7 +35,7 @@
void SERCOM4_3_Handler() { Serial2.IrqHandler(); } void SERCOM4_3_Handler() { Serial2.IrqHandler(); }
#endif #endif
#if ANY_SERIAL_IS(2) #if USING_HW_SERIAL2
UartT Serial3(false, &sercom1, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX); UartT Serial3(false, &sercom1, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX);
void SERCOM1_0_Handler() { Serial3.IrqHandler(); } void SERCOM1_0_Handler() { Serial3.IrqHandler(); }
void SERCOM1_1_Handler() { Serial3.IrqHandler(); } void SERCOM1_1_Handler() { Serial3.IrqHandler(); }
@@ -43,7 +43,7 @@
void SERCOM1_3_Handler() { Serial3.IrqHandler(); } void SERCOM1_3_Handler() { Serial3.IrqHandler(); }
#endif #endif
#if ANY_SERIAL_IS(3) #if USING_HW_SERIAL3
UartT Serial4(false, &sercom5, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX); UartT Serial4(false, &sercom5, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX);
void SERCOM5_0_Handler() { Serial4.IrqHandler(); } void SERCOM5_0_Handler() { Serial4.IrqHandler(); }
void SERCOM5_1_Handler() { Serial4.IrqHandler(); } void SERCOM5_1_Handler() { Serial4.IrqHandler(); }
+3 -2
View File
@@ -41,12 +41,13 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
const uint8_t v = *value; const uint8_t v = *value;
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
delay(2); if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+10 -2
View File
@@ -96,6 +96,12 @@ void HAL_init() {
#if HAS_SD_HOST_DRIVE #if HAS_SD_HOST_DRIVE
MSC_SD_init(); // Enable USB SD card access MSC_SD_init(); // Enable USB SD card access
#endif #endif
#if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay(1000); // Give OS time to notice
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif
} }
// HAL idle task // HAL idle task
@@ -133,6 +139,8 @@ uint8_t HAL_get_reset_source() {
; ;
} }
void HAL_reboot() { NVIC_SystemReset(); }
void _delay_ms(const int delay_ms) { delay(delay_ms); } void _delay_ms(const int delay_ms) { delay(delay_ms); }
extern "C" { extern "C" {
@@ -147,8 +155,8 @@ extern "C" {
void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); } void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
uint16_t HAL_adc_get_result() { return HAL_adc_result; } uint16_t HAL_adc_get_result() { return HAL_adc_result; }
// Reset the system (to initiate a firmware flash) // Reset the system to initiate a firmware flash
void flashFirmware(const int16_t) { NVIC_SystemReset(); } void flashFirmware(const int16_t) { HAL_reboot(); }
// Maple Compatibility // Maple Compatibility
volatile uint32_t systick_uptime_millis = 0; volatile uint32_t systick_uptime_millis = 0;
+18 -8
View File
@@ -37,6 +37,9 @@
#include <stdint.h> #include <stdint.h>
//
// Serial Ports
//
#ifdef USBCON #ifdef USBCON
#include <USBSerial.h> #include <USBSerial.h>
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
@@ -44,9 +47,6 @@
extern DefaultSerial1 MSerial0; extern DefaultSerial1 MSerial0;
#endif #endif
// ------------------------
// Defines
// ------------------------
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
@@ -55,7 +55,7 @@
#elif WITHIN(SERIAL_PORT, 1, 6) #elif WITHIN(SERIAL_PORT, 1, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration." #error "SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -64,7 +64,17 @@
#elif WITHIN(SERIAL_PORT_2, 1, 6) #elif WITHIN(SERIAL_PORT_2, 1, 6)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be -1 or from 1 to 6. Please update your configuration." #error "SERIAL_PORT_2 must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 MSerial0
#elif WITHIN(SERIAL_PORT_3, 1, 6)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -74,7 +84,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6) #elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration." #error "MMU2_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -84,7 +94,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 1, 6) #elif WITHIN(LCD_SERIAL_PORT, 1, 6)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration." #error "LCD_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
@@ -144,7 +154,7 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
void _delay_ms(const int delay); void _delay_ms(const int delay);
+1 -1
View File
@@ -72,7 +72,7 @@ static void TXBegin() {
}; };
NVICMin *nvicBase = (NVICMin*)0xE000E100; NVICMin *nvicBase = (NVICMin*)0xE000E100;
nvicBase->ICER[nvicIndex / 32] |= _BV32(nvicIndex % 32); SBI32(nvicBase->ICER[nvicIndex >> 5], nvicIndex & 0x1F);
// We NEED memory barriers to ensure Interrupts are actually disabled! // We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
+1 -1
View File
@@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) #if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(STM32H7xx)
#include "MarlinSPI.h" #include "MarlinSPI.h"
+29 -14
View File
@@ -28,7 +28,6 @@
#ifndef USART4 #ifndef USART4
#define USART4 UART4 #define USART4 UART4
#endif #endif
#ifndef USART5 #ifndef USART5
#define USART5 UART5 #define USART5 UART5
#endif #endif
@@ -38,22 +37,38 @@
MSerialT MSerial ## ser_num (true, USART ## ser_num, &_rx_complete_irq_ ## ser_num); \ MSerialT MSerial ## ser_num (true, USART ## ser_num, &_rx_complete_irq_ ## ser_num); \
void _rx_complete_irq_ ## ser_num (serial_t * obj) { MSerial ## ser_num ._rx_complete_irq(obj); } void _rx_complete_irq_ ## ser_num (serial_t * obj) { MSerial ## ser_num ._rx_complete_irq(obj); }
#define DECLARE_SERIAL_PORT_EXP(ser_num) DECLARE_SERIAL_PORT(ser_num) #if USING_HW_SERIAL1
DECLARE_SERIAL_PORT(1)
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT)
#endif #endif
#if USING_HW_SERIAL2
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0 DECLARE_SERIAL_PORT(2)
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT_2)
#endif #endif
#if USING_HW_SERIAL3
#if defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT >= 0 DECLARE_SERIAL_PORT(3)
DECLARE_SERIAL_PORT_EXP(MMU2_SERIAL_PORT)
#endif #endif
#if USING_HW_SERIAL4
#if defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT >= 0 DECLARE_SERIAL_PORT(4)
DECLARE_SERIAL_PORT_EXP(LCD_SERIAL_PORT) #endif
#if USING_HW_SERIAL5
DECLARE_SERIAL_PORT(5)
#endif
#if USING_HW_SERIAL6
DECLARE_SERIAL_PORT(6)
#endif
#if USING_HW_SERIAL7
DECLARE_SERIAL_PORT(7)
#endif
#if USING_HW_SERIAL8
DECLARE_SERIAL_PORT(8)
#endif
#if USING_HW_SERIAL9
DECLARE_SERIAL_PORT(9)
#endif
#if USING_HW_SERIAL10
DECLARE_SERIAL_PORT(10)
#endif
#if USING_HW_SERIALLP1
DECLARE_SERIAL_PORT(LP1)
#endif #endif
void MarlinSerial::begin(unsigned long baud, uint8_t config) { void MarlinSerial::begin(unsigned long baud, uint8_t config) {
+113 -95
View File
@@ -36,7 +36,8 @@
// use USB drivers // use USB drivers
extern "C" { int8_t SD_MSC_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len); extern "C" {
int8_t SD_MSC_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
int8_t SD_MSC_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len); int8_t SD_MSC_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
extern SD_HandleTypeDef hsd; extern SD_HandleTypeDef hsd;
} }
@@ -75,7 +76,18 @@
#error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported" #error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported"
#endif #endif
// Fixed
#define SDIO_D0_PIN PC8
#define SDIO_D1_PIN PC9
#define SDIO_D2_PIN PC10
#define SDIO_D3_PIN PC11
#define SDIO_CK_PIN PC12
#define SDIO_CMD_PIN PD2
SD_HandleTypeDef hsd; // create SDIO structure SD_HandleTypeDef hsd; // create SDIO structure
// F4 supports one DMA for RX and another for TX, but Marlin will never
// do read and write at same time, so we use the same DMA for both.
DMA_HandleTypeDef hdma_sdio;
/* /*
SDIO_INIT_CLK_DIV is 118 SDIO_INIT_CLK_DIV is 118
@@ -96,7 +108,7 @@
// Target Clock, configurable. Default is 18MHz, from STM32F1 // Target Clock, configurable. Default is 18MHz, from STM32F1
#ifndef SDIO_CLOCK #ifndef SDIO_CLOCK
#define SDIO_CLOCK 18000000 /* 18 MHz */ #define SDIO_CLOCK 18000000 // 18 MHz
#endif #endif
// SDIO retries, configurable. Default is 3, from STM32F1 // SDIO retries, configurable. Default is 3, from STM32F1
@@ -120,24 +132,21 @@
} }
void go_to_transfer_speed() { void go_to_transfer_speed() {
SD_InitTypeDef Init;
/* Default SDIO peripheral configuration for SD card initialization */ /* Default SDIO peripheral configuration for SD card initialization */
Init.ClockEdge = hsd.Init.ClockEdge; hsd.Init.ClockEdge = hsd.Init.ClockEdge;
Init.ClockBypass = hsd.Init.ClockBypass; hsd.Init.ClockBypass = hsd.Init.ClockBypass;
Init.ClockPowerSave = hsd.Init.ClockPowerSave; hsd.Init.ClockPowerSave = hsd.Init.ClockPowerSave;
Init.BusWide = hsd.Init.BusWide; hsd.Init.BusWide = hsd.Init.BusWide;
Init.HardwareFlowControl = hsd.Init.HardwareFlowControl; hsd.Init.HardwareFlowControl = hsd.Init.HardwareFlowControl;
Init.ClockDiv = clock_to_divider(SDIO_CLOCK); hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
/* Initialize SDIO peripheral interface with default configuration */ /* Initialize SDIO peripheral interface with default configuration */
SDIO_Init(hsd.Instance, Init); SDIO_Init(hsd.Instance, hsd.Init);
} }
void SD_LowLevel_Init(void) { void SD_LowLevel_Init(void) {
uint32_t tempreg; uint32_t tempreg;
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks __HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks
__HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks __HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks
@@ -163,11 +172,45 @@
GPIO_InitStruct.Pin = GPIO_PIN_2; GPIO_InitStruct.Pin = GPIO_PIN_2;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
#if DISABLED(STM32F1xx) // Setup DMA
// TODO: use __HAL_RCC_SDIO_RELEASE_RESET() and __HAL_RCC_SDIO_CLK_ENABLE(); #if defined(STM32F1xx)
RCC->APB2RSTR &= ~RCC_APB2RSTR_SDIORST_Msk; // take SDIO out of reset hdma_sdio.Init.Mode = DMA_NORMAL;
RCC->APB2ENR |= RCC_APB2RSTR_SDIORST_Msk; // enable SDIO clock hdma_sdio.Instance = DMA2_Channel4;
// Enable the DMA2 Clock HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn);
#elif defined(STM32F4xx)
hdma_sdio.Init.Mode = DMA_PFCTRL;
hdma_sdio.Instance = DMA2_Stream3;
hdma_sdio.Init.Channel = DMA_CHANNEL_4;
hdma_sdio.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
hdma_sdio.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_sdio.Init.MemBurst = DMA_MBURST_INC4;
hdma_sdio.Init.PeriphBurst = DMA_PBURST_INC4;
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
#endif
HAL_NVIC_EnableIRQ(SDIO_IRQn);
hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;
hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;
__HAL_LINKDMA(&hsd, hdmarx, hdma_sdio);
__HAL_LINKDMA(&hsd, hdmatx, hdma_sdio);
#if defined(STM32F1xx)
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_DMA2_CLK_ENABLE();
#else
__HAL_RCC_SDIO_FORCE_RESET();
delay(2);
__HAL_RCC_SDIO_RELEASE_RESET();
delay(2);
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_DMA2_FORCE_RESET();
delay(2);
__HAL_RCC_DMA2_RELEASE_RESET();
delay(2);
__HAL_RCC_DMA2_CLK_ENABLE();
#endif #endif
//Initialize the SDIO (with initial <400Khz Clock) //Initialize the SDIO (with initial <400Khz Clock)
@@ -179,6 +222,7 @@
// Power up the SDIO // Power up the SDIO
SDIO_PowerState_ON(SDIO); SDIO_PowerState_ON(SDIO);
hsd.Instance = SDIO;
} }
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init
@@ -222,107 +266,81 @@
if (!status) break; if (!status) break;
if (!--retry_Cnt) return false; // return failing status if retries are exhausted if (!--retry_Cnt) return false; // return failing status if retries are exhausted
} }
go_to_transfer_speed();
} }
#endif #endif
return true; return true;
} }
/*
void init_SDIO_pins(void) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
// SDIO GPIO Configuration static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) {
// PC8 ------> SDIO_D0 if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
// PC12 ------> SDIO_CK
// PD2 ------> SDIO_CMD
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}
*/
//bool SDIO_init() { return (bool) (SD_SDIO_Init() ? 1 : 0);}
//bool SDIO_Init_C() { return (bool) (SD_SDIO_Init() ? 1 : 0);}
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
hsd.Instance = SDIO;
uint8_t retryCnt = SDIO_READ_RETRIES;
bool status;
for (;;) {
TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
status = (bool) HAL_SD_ReadBlocks(&hsd, (uint8_t*)dst, block, 1, 1000); // read one 512 byte block with 500mS timeout
status |= (bool) HAL_SD_GetCardState(&hsd); // make sure all is OK HAL_StatusTypeDef ret;
if (!status) break; // return passing status if (src) {
if (!--retryCnt) break; // return failing status if retries are exhausted hdma_sdio.Init.Direction = DMA_MEMORY_TO_PERIPH;
HAL_DMA_Init(&hdma_sdio);
ret = HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t *)src, block, 1);
}
else {
hdma_sdio.Init.Direction = DMA_PERIPH_TO_MEMORY;
HAL_DMA_Init(&hdma_sdio);
ret = HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t *)dst, block, 1);
} }
return status;
/* if (ret != HAL_OK) {
return (bool) ((status_read | status_card) ? 1 : 0); HAL_DMA_Abort_IT(&hdma_sdio);
HAL_DMA_DeInit(&hdma_sdio);
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false;
if ((0x03 & (uint32_t)data)) return false; // misaligned data
if (SdCard.CardType != CARD_SDHC_SDXC) { blockAddress *= 512U; }
if (!SDIO_CmdReadSingleBlock(blockAddress)) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS);
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
return false; return false;
} }
while (!SDIO_GET_FLAG(SDIO_STA_DATAEND | SDIO_STA_TRX_ERROR_FLAGS)) {} millis_t timeout = millis() + 500;
// Wait the transfer
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); while (hsd.State != HAL_SD_STATE_READY) {
if (ELAPSED(millis(), timeout)) {
if (SDIO->STA & SDIO_STA_RXDAVL) { HAL_DMA_Abort_IT(&hdma_sdio);
while (SDIO->STA & SDIO_STA_RXDAVL) (void)SDIO->FIFO; HAL_DMA_DeInit(&hdma_sdio);
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false; return false;
} }
if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
} }
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
*/ while (__HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TC_FLAG_INDEX(&hdma_sdio)) != 0
|| __HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TE_FLAG_INDEX(&hdma_sdio)) != 0) { /* nada */ }
HAL_DMA_Abort_IT(&hdma_sdio);
HAL_DMA_DeInit(&hdma_sdio);
timeout = millis() + 500;
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false;
return true; return true;
} }
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
uint8_t retries = SDIO_READ_RETRIES;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, NULL, dst)) return true;
return false;
}
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
hsd.Instance = SDIO; uint8_t retries = SDIO_READ_RETRIES;
uint8_t retryCnt = SDIO_READ_RETRIES; while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, NULL)) return true;
bool status; return false;
for (;;) {
status = (bool) HAL_SD_WriteBlocks(&hsd, (uint8_t*)src, block, 1, 500); // write one 512 byte block with 500mS timeout
status |= (bool) HAL_SD_GetCardState(&hsd); // make sure all is OK
if (!status) break; // return passing status
if (!--retryCnt) break; // return failing status if retries are exhausted
}
return status;
} }
#if defined(STM32F1xx)
#define DMA_IRQ_HANDLER DMA2_Channel4_5_IRQHandler
#elif defined(STM32F4xx)
#define DMA_IRQ_HANDLER DMA2_Stream3_IRQHandler
#else
#error "Unknown STM32 architecture."
#endif
extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
#endif // !USBD_USE_CDC_COMPOSITE #endif // !USBD_USE_CDC_COMPOSITE
#endif // SDIO_SUPPORT #endif // SDIO_SUPPORT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
+4 -7
View File
@@ -43,25 +43,22 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
} }
} }
crc16(crc, &v, 1); crc16(crc, &v, 1);
pos++; pos++;
value++; value++;
}; }
return false; return false;
} }
+2 -2
View File
@@ -52,6 +52,6 @@
#error "SERIAL_STATS_DROPPED_RX is not supported on STM32." #error "SERIAL_STATS_DROPPED_RX is not supported on STM32."
#endif #endif
#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32F4xx, STM32F1xx) #if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32H7xx, STM32F4xx, STM32F1xx)
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32F4 and STM32F1 hardware." #error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware."
#endif #endif
+25 -13
View File
@@ -30,54 +30,66 @@
class Sd2CardUSBMscHandler : public USBMscHandler { class Sd2CardUSBMscHandler : public USBMscHandler {
public: public:
DiskIODriver* diskIODriver() {
#if ENABLED(MULTI_VOLUME)
#if SHARED_VOLUME_IS(SD_ONBOARD)
return &card.media_sd_spi;
#elif SHARED_VOLUME_IS(USB_FLASH_DRIVE)
return &card.media_usbFlashDrive;
#endif
#else
return card.diskIODriver();
#endif
}
bool GetCapacity(uint32_t *pBlockNum, uint16_t *pBlockSize) { bool GetCapacity(uint32_t *pBlockNum, uint16_t *pBlockSize) {
*pBlockNum = card.getSd2Card().cardSize(); *pBlockNum = diskIODriver()->cardSize();
*pBlockSize = BLOCK_SIZE; *pBlockSize = BLOCK_SIZE;
return true; return true;
} }
bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) { bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = card.getSd2Card(); auto sd2card = diskIODriver();
// single block // single block
if (blkLen == 1) { if (blkLen == 1) {
watchdog_refresh(); watchdog_refresh();
sd2card.writeBlock(blkAddr, pBuf); sd2card->writeBlock(blkAddr, pBuf);
return true; return true;
} }
// multi block optmization // multi block optmization
sd2card.writeStart(blkAddr, blkLen); sd2card->writeStart(blkAddr, blkLen);
while (blkLen--) { while (blkLen--) {
watchdog_refresh(); watchdog_refresh();
sd2card.writeData(pBuf); sd2card->writeData(pBuf);
pBuf += BLOCK_SIZE; pBuf += BLOCK_SIZE;
} }
sd2card.writeStop(); sd2card->writeStop();
return true; return true;
} }
bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) { bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = card.getSd2Card(); auto sd2card = diskIODriver();
// single block // single block
if (blkLen == 1) { if (blkLen == 1) {
watchdog_refresh(); watchdog_refresh();
sd2card.readBlock(blkAddr, pBuf); sd2card->readBlock(blkAddr, pBuf);
return true; return true;
} }
// multi block optmization // multi block optmization
sd2card.readStart(blkAddr); sd2card->readStart(blkAddr);
while (blkLen--) { while (blkLen--) {
watchdog_refresh(); watchdog_refresh();
sd2card.readData(pBuf); sd2card->readData(pBuf);
pBuf += BLOCK_SIZE; pBuf += BLOCK_SIZE;
} }
sd2card.readStop(); sd2card->readStop();
return true; return true;
} }
bool IsReady() { bool IsReady() {
return card.isMounted(); return diskIODriver()->isReady();
} }
}; };
@@ -105,8 +117,8 @@ USBMscHandler *pSingleMscHandler = &usbMscHandler;
void MSC_SD_init() { void MSC_SD_init() {
USBDevice.end(); USBDevice.end();
delay(200); delay(200);
USBDevice.begin();
USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata); USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata);
USBDevice.begin();
} }
#endif // __STM32F1__ && HAS_SD_HOST_DRIVE #endif // __STM32F1__ && HAS_SD_HOST_DRIVE
+202
View File
@@ -0,0 +1,202 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program 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 program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "../../../inc/MarlinConfig.h"
#if ENABLED(TFT_TOUCH_DEVICE_GT911)
#include "gt911.h"
#include "pinconfig.h"
SW_IIC::SW_IIC(uint16_t sda, uint16_t scl) {
scl_pin = scl;
sda_pin = sda;
}
// Software I2C hardware io init
void SW_IIC::init() {
OUT_WRITE(scl_pin, HIGH);
OUT_WRITE(sda_pin, HIGH);
}
// Software I2C start signal
void SW_IIC::start() {
write_sda(HIGH); // SDA = 1
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_sda(LOW); // SDA = 0
iic_delay(1);
write_scl(LOW); // SCL = 0 // keep SCL low, avoid false stop caused by level jump caused by SDA switching IN/OUT
}
// Software I2C stop signal
void SW_IIC::stop() {
write_scl(LOW); // SCL = 0
iic_delay(2);
write_sda(LOW); // SDA = 0
iic_delay(2);
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_sda(HIGH); // SDA = 1
}
// Software I2C sends ACK or NACK signal
void SW_IIC::send_ack(bool ack) {
write_sda(ack ? LOW : HIGH); // SDA = !ack
iic_delay(2);
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_scl(LOW); // SCL = 0
}
// Software I2C read ACK or NACK signal
bool SW_IIC::read_ack() {
bool error = 0;
set_sda_in();
iic_delay(2);
write_scl(HIGH); // SCL = 1
error = read_sda();
iic_delay(2);
write_scl(LOW); // SCL = 0
set_sda_out();
return error;
}
void SW_IIC::send_byte(uint8_t txd) {
LOOP_L_N(i, 8) {
write_sda(txd & 0x80); // write data bit
txd <<= 1;
iic_delay(1);
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_scl(LOW); // SCL = 0
iic_delay(1);
}
read_ack(); // wait ack
}
uint8_t SW_IIC::read_byte(bool ack) {
uint8_t data = 0;
set_sda_in();
LOOP_L_N(i, 8) {
write_scl(HIGH); // SCL = 1
iic_delay(1);
data <<= 1;
if (read_sda()) data++;
write_scl(LOW); // SCL = 0
iic_delay(2);
}
set_sda_out();
send_ack(ack);
return data;
}
GT911_REG_MAP GT911::reg;
SW_IIC GT911::sw_iic = SW_IIC(GT911_SW_I2C_SDA_PIN, GT911_SW_I2C_SCL_PIN);
void GT911::write_reg(uint16_t reg, uint8_t reg_len, uint8_t* w_data, uint8_t w_len) {
sw_iic.start();
sw_iic.send_byte(gt911_slave_address); // Set IIC Slave address
LOOP_L_N(i, reg_len) { // Set reg address
uint8_t r = (reg >> (8 * (reg_len - 1 - i))) & 0xFF;
sw_iic.send_byte(r);
}
LOOP_L_N(i, w_len) { // Write data to reg
sw_iic.send_byte(w_data[i]);
}
sw_iic.stop();
}
void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len) {
sw_iic.start();
sw_iic.send_byte(gt911_slave_address); // Set IIC Slave address
LOOP_L_N(i, reg_len) { // Set reg address
uint8_t r = (reg >> (8 * (reg_len - 1 - i))) & 0xFF;
sw_iic.send_byte(r);
}
sw_iic.start();
sw_iic.send_byte(gt911_slave_address + 1); // Set read mode
LOOP_L_N(i, r_len) {
r_data[i] = sw_iic.read_byte(1); // Read data from reg
}
sw_iic.stop();
}
void GT911::Init() {
OUT_WRITE(GT911_RST_PIN, LOW);
OUT_WRITE(GT911_INT_PIN, LOW);
delay(20);
WRITE(GT911_RST_PIN, HIGH);
SET_INPUT(GT911_INT_PIN);
sw_iic.init();
uint8_t clear_reg = 0x0000;
write_reg(0x814E, 2, &clear_reg, 2); // Reset to 0 for start
}
bool GT911::getFirstTouchPoint(int16_t *x, int16_t *y) {
read_reg(0x814E, 2, &reg.REG.status, 1);
if (reg.REG.status & 0x80) {
uint8_t clear_reg = 0x00;
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
read_reg(0x8150, 2, reg.map + 2, 8 * (reg.REG.status & 0x0F));
// First touch point
*x = ((reg.REG.point[0].xh & 0x0F) << 8) | reg.REG.point[0].xl;
*y = ((reg.REG.point[0].yh & 0x0F) << 8) | reg.REG.point[0].yl;
return true;
}
return false;
}
bool GT911::getPoint(int16_t *x, int16_t *y) {
static bool touched = 0;
static int16_t read_x = 0, read_y = 0;
static millis_t next_time = 0;
if (ELAPSED(millis(), next_time)) {
touched = getFirstTouchPoint(&read_x, &read_y);
next_time = millis() + 20;
}
*x = read_x;
*y = read_y;
return touched;
}
#endif // TFT_TOUCH_DEVICE_GT911
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
+120
View File
@@ -0,0 +1,120 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program 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 program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../../../inc/MarlinConfig.h"
#define GT911_SLAVE_ADDRESS 0xBA
#if !PIN_EXISTS(GT911_RST)
#error "GT911_RST_PIN is not defined."
#elif !PIN_EXISTS(GT911_INT)
#error "GT911_INT_PIN is not defined."
#elif !PIN_EXISTS(GT911_SW_I2C_SCL)
#error "GT911_SW_I2C_SCL_PIN is not defined."
#elif !PIN_EXISTS(GT911_SW_I2C_SDA)
#error "GT911_SW_I2C_SDA_PIN is not defined."
#endif
class SW_IIC {
private:
uint16_t scl_pin;
uint16_t sda_pin;
void write_scl(bool level)
{
WRITE(scl_pin, level);
}
void write_sda(bool level)
{
WRITE(sda_pin, level);
}
bool read_sda()
{
return READ(sda_pin);
}
void set_sda_out()
{
SET_OUTPUT(sda_pin);
}
void set_sda_in()
{
SET_INPUT_PULLUP(sda_pin);
}
static void iic_delay(uint8_t t)
{
delayMicroseconds(t);
}
public:
SW_IIC(uint16_t sda, uint16_t scl);
// setSCL/SDA have to be called before begin()
void setSCL(uint16_t scl)
{
scl_pin = scl;
};
void setSDA(uint16_t sda)
{
sda_pin = sda;
};
void init(); // Initialize the IO port of IIC
void start(); // Send IIC start signal
void stop(); // Send IIC stop signal
void send_byte(uint8_t txd); // IIC sends a byte
uint8_t read_byte(bool ack); // IIC reads a byte
void send_ack(bool ack); // IIC sends ACK or NACK signal
bool read_ack();
};
typedef struct __attribute__((__packed__)) {
uint8_t xl;
uint8_t xh;
uint8_t yl;
uint8_t yh;
uint8_t sizel;
uint8_t sizeh;
uint8_t reserved;
uint8_t track_id;
} GT911_POINT;
typedef union __attribute__((__packed__)) {
uint8_t map[42];
struct {
uint8_t status; // 0x814E
uint8_t track_id; // 0x814F
GT911_POINT point[5]; // [0]:0x8150 - 0x8157 / [1]:0x8158 - 0x815F / [2]:0x8160 - 0x8167 / [3]:0x8168 - 0x816F / [4]:0x8170 - 0x8177
} REG;
} GT911_REG_MAP;
class GT911 {
private:
static const uint8_t gt911_slave_address = GT911_SLAVE_ADDRESS;
static GT911_REG_MAP reg;
static SW_IIC sw_iic;
static void write_reg(uint16_t reg, uint8_t reg_len, uint8_t* w_data, uint8_t w_len);
static void read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len);
public:
static void Init();
static bool getFirstTouchPoint(int16_t *x, int16_t *y);
static bool getPoint(int16_t *x, int16_t *y);
};
+387
View File
@@ -0,0 +1,387 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program 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 program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "../../../inc/MarlinConfig.h"
#if HAS_LTDC_TFT
#include "tft_ltdc.h"
#include "pinconfig.h"
#define FRAME_BUFFER_ADDRESS 0XC0000000 // SDRAM address
#define SDRAM_TIMEOUT ((uint32_t)0xFFFF)
#define REFRESH_COUNT ((uint32_t)0x02A5) // SDRAM refresh counter
#define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000)
#define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001)
#define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002)
#define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004)
#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000)
#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008)
#define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020)
#define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030)
#define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200)
void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command) {
__IO uint32_t tmpmrd =0;
/* Step 1: Configure a clock configuration enable command */
Command->CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 2: Insert 100 us minimum delay */
/* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
HAL_Delay(1);
/* Step 3: Configure a PALL (precharge all) command */
Command->CommandMode = FMC_SDRAM_CMD_PALL;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 4 : Configure a Auto-Refresh command */
Command->CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 8;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 5: Program the external memory mode register */
tmpmrd = (uint32_t)(SDRAM_MODEREG_BURST_LENGTH_1 |
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |
SDRAM_MODEREG_CAS_LATENCY_2 |
SDRAM_MODEREG_OPERATING_MODE_STANDARD |
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE);
Command->CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = tmpmrd;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 6: Set the refresh rate counter */
/* Set the device refresh rate */
HAL_SDRAM_ProgramRefreshRate(hsdram, REFRESH_COUNT);
}
void SDRAM_Config() {
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_RCC_FMC_CLK_ENABLE();
SDRAM_HandleTypeDef hsdram;
FMC_SDRAM_TimingTypeDef SDRAM_Timing;
FMC_SDRAM_CommandTypeDef command;
/* Configure the SDRAM device */
hsdram.Instance = FMC_SDRAM_DEVICE;
hsdram.Init.SDBank = FMC_SDRAM_BANK1;
hsdram.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9;
hsdram.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13;
hsdram.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16;
hsdram.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
hsdram.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_2;
hsdram.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
hsdram.Init.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2;
hsdram.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE;
hsdram.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_0;
/* Timing configuration for 100Mhz as SDRAM clock frequency (System clock is up to 200Mhz) */
SDRAM_Timing.LoadToActiveDelay = 2;
SDRAM_Timing.ExitSelfRefreshDelay = 8;
SDRAM_Timing.SelfRefreshTime = 6;
SDRAM_Timing.RowCycleDelay = 6;
SDRAM_Timing.WriteRecoveryTime = 2;
SDRAM_Timing.RPDelay = 2;
SDRAM_Timing.RCDDelay = 2;
/* Initialize the SDRAM controller */
if (HAL_SDRAM_Init(&hsdram, &SDRAM_Timing) != HAL_OK)
{
/* Initialization Error */
}
/* Program the SDRAM external device */
SDRAM_Initialization_Sequence(&hsdram, &command);
}
void LTDC_Config() {
__HAL_RCC_LTDC_CLK_ENABLE();
__HAL_RCC_DMA2D_CLK_ENABLE();
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
/* The PLL3R is configured to provide the LTDC PCLK clock */
/* PLL3_VCO Input = HSE_VALUE / PLL3M = 25Mhz / 5 = 5 Mhz */
/* PLL3_VCO Output = PLL3_VCO Input * PLL3N = 5Mhz * 160 = 800 Mhz */
/* PLLLCDCLK = PLL3_VCO Output/PLL3R = 800Mhz / 16 = 50Mhz */
/* LTDC clock frequency = PLLLCDCLK = 50 Mhz */
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
PeriphClkInitStruct.PLL3.PLL3M = 5;
PeriphClkInitStruct.PLL3.PLL3N = 160;
PeriphClkInitStruct.PLL3.PLL3FRACN = 0;
PeriphClkInitStruct.PLL3.PLL3P = 2;
PeriphClkInitStruct.PLL3.PLL3Q = 2;
PeriphClkInitStruct.PLL3.PLL3R = (800 / LTDC_LCD_CLK);
PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOWIDE;
PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_2;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
LTDC_HandleTypeDef hltdc_F;
LTDC_LayerCfgTypeDef pLayerCfg;
/* LTDC Initialization -------------------------------------------------------*/
/* Polarity configuration */
/* Initialize the horizontal synchronization polarity as active low */
hltdc_F.Init.HSPolarity = LTDC_HSPOLARITY_AL;
/* Initialize the vertical synchronization polarity as active low */
hltdc_F.Init.VSPolarity = LTDC_VSPOLARITY_AL;
/* Initialize the data enable polarity as active low */
hltdc_F.Init.DEPolarity = LTDC_DEPOLARITY_AL;
/* Initialize the pixel clock polarity as input pixel clock */
hltdc_F.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
/* Timing configuration */
hltdc_F.Init.HorizontalSync = (LTDC_LCD_HSYNC - 1);
hltdc_F.Init.VerticalSync = (LTDC_LCD_VSYNC - 1);
hltdc_F.Init.AccumulatedHBP = (LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
hltdc_F.Init.AccumulatedVBP = (LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
hltdc_F.Init.AccumulatedActiveH = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
hltdc_F.Init.AccumulatedActiveW = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
hltdc_F.Init.TotalHeigh = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
hltdc_F.Init.TotalWidth = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP + LTDC_LCD_HFP - 1);
/* Configure R,G,B component values for LCD background color : all black background */
hltdc_F.Init.Backcolor.Blue = 0;
hltdc_F.Init.Backcolor.Green = 0;
hltdc_F.Init.Backcolor.Red = 0;
hltdc_F.Instance = LTDC;
/* Layer0 Configuration ------------------------------------------------------*/
/* Windowing configuration */
pLayerCfg.WindowX0 = 0;
pLayerCfg.WindowX1 = TFT_WIDTH;
pLayerCfg.WindowY0 = 0;
pLayerCfg.WindowY1 = TFT_HEIGHT;
/* Pixel Format configuration*/
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
/* Start Address configuration : frame buffer is located at SDRAM memory */
pLayerCfg.FBStartAdress = (uint32_t)(FRAME_BUFFER_ADDRESS);
/* Alpha constant (255 == totally opaque) */
pLayerCfg.Alpha = 255;
/* Default Color configuration (configure A,R,G,B component values) : no background color */
pLayerCfg.Alpha0 = 0; /* fully transparent */
pLayerCfg.Backcolor.Blue = 0;
pLayerCfg.Backcolor.Green = 0;
pLayerCfg.Backcolor.Red = 0;
/* Configure blending factors */
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
/* Configure the number of lines and number of pixels per line */
pLayerCfg.ImageWidth = TFT_WIDTH;
pLayerCfg.ImageHeight = TFT_HEIGHT;
/* Configure the LTDC */
if (HAL_LTDC_Init(&hltdc_F) != HAL_OK)
{
/* Initialization Error */
}
/* Configure the Layer*/
if (HAL_LTDC_ConfigLayer(&hltdc_F, &pLayerCfg, 0) != HAL_OK)
{
/* Initialization Error */
}
}
uint16_t TFT_LTDC::x_min = 0;
uint16_t TFT_LTDC::x_max = 0;
uint16_t TFT_LTDC::y_min = 0;
uint16_t TFT_LTDC::y_max = 0;
uint16_t TFT_LTDC::x_cur = 0;
uint16_t TFT_LTDC::y_cur = 0;
uint8_t TFT_LTDC::reg = 0;
volatile uint16_t* TFT_LTDC::framebuffer = (volatile uint16_t* )FRAME_BUFFER_ADDRESS;
void TFT_LTDC::Init() {
// SDRAM pins init
for (uint16_t i = 0; PinMap_SDRAM[i].pin != NC; i++)
pinmap_pinout(PinMap_SDRAM[i].pin, PinMap_SDRAM);
// SDRAM peripheral config
SDRAM_Config();
// LTDC pins init
for (uint16_t i = 0; PinMap_LTDC[i].pin != NC; i++)
pinmap_pinout(PinMap_LTDC[i].pin, PinMap_LTDC);
// LTDC peripheral config
LTDC_Config();
}
uint32_t TFT_LTDC::GetID() {
return 0xABAB;
}
uint32_t TFT_LTDC::ReadID(tft_data_t Reg) {
return 0xABAB;
}
bool TFT_LTDC::isBusy() {
return false;
}
uint16_t TFT_LTDC::ReadPoint(uint16_t x, uint16_t y) {
return framebuffer[(TFT_WIDTH * y) + x];
}
void TFT_LTDC::DrawPoint(uint16_t x, uint16_t y, uint16_t color) {
framebuffer[(TFT_WIDTH * y) + x] = color;
}
void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color) {
if (sx == ex || sy == ey) return;
uint16_t offline = TFT_WIDTH - (ex - sx);
uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx];
CBI(DMA2D->CR, 0);
DMA2D->CR = 3 << 16;
DMA2D->OPFCCR = 0X02;
DMA2D->OOR = offline;
DMA2D->OMAR = addr;
DMA2D->NLR = (ey - sy) | ((ex - sx) << 16);
DMA2D->OCOLR = color;
SBI(DMA2D->CR, 0);
uint32_t timeout = 0;
while (!TEST(DMA2D->ISR, 1)) {
timeout++;
if (timeout > 0x1FFFFF) break;
}
SBI(DMA2D->IFCR, 1);
}
void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) {
if (sx == ex || sy == ey) return;
uint16_t offline = TFT_WIDTH - (ex - sx);
uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx];
CBI(DMA2D->CR, 0);
DMA2D->CR = 0 << 16;
DMA2D->FGPFCCR = 0X02;
DMA2D->FGOR = 0;
DMA2D->OOR = offline;
DMA2D->FGMAR = (uint32_t)colors;
DMA2D->OMAR = addr;
DMA2D->NLR = (ey - sy) | ((ex - sx) << 16);
SBI(DMA2D->CR, 0);
uint32_t timeout = 0;
while (!TEST(DMA2D->ISR, 1)) {
timeout++;
if (timeout > 0x1FFFFF) break;
}
SBI(DMA2D->IFCR, 1);
}
void TFT_LTDC::WriteData(uint16_t data) {
switch (reg) {
case 0x01: x_cur = x_min = data; return;
case 0x02: x_max = data; return;
case 0x03: y_cur = y_min = data; return;
case 0x04: y_max = data; return;
}
Transmit(data);
}
void TFT_LTDC::Transmit(tft_data_t Data) {
DrawPoint(x_cur, y_cur, Data);
x_cur++;
if (x_cur > x_max) {
x_cur = x_min;
y_cur++;
if (y_cur > y_max) y_cur = y_min;
}
}
void TFT_LTDC::WriteReg(uint16_t Reg) {
reg = Reg;
}
void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
while (x_cur != x_min && Count) {
Transmit(*Data);
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
Count--;
}
uint16_t width = x_max - x_min + 1;
uint16_t height = Count / width;
uint16_t x_end_cnt = Count - (width * height);
if (height) {
if (MemoryIncrease == DMA_PINC_ENABLE) {
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
Data += width * height;
} else {
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
}
y_cur += height;
}
while (x_end_cnt) {
Transmit(*Data);
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
x_end_cnt--;
}
}
#endif // HAS_LTDC_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
+155
View File
@@ -0,0 +1,155 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program 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 program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../../../inc/MarlinConfig.h"
#ifdef STM32H7xx
#include "stm32h7xx_hal.h"
#else
#error "LTDC TFT is currently only supported on STM32H7 hardware."
#endif
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
#define TFT_IO_DRIVER TFT_LTDC
#define TFT_DATASIZE DATASIZE_16BIT
typedef uint16_t tft_data_t;
class TFT_LTDC {
private:
static volatile uint16_t *framebuffer;
static uint16_t x_min, x_max, y_min, y_max, x_cur, y_cur;
static uint8_t reg;
static uint32_t ReadID(tft_data_t Reg);
static uint16_t ReadPoint(uint16_t x, uint16_t y);
static void DrawPoint(uint16_t x, uint16_t y, uint16_t color);
static void DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color);
static void DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors);
static void Transmit(tft_data_t Data);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
public:
static void Init();
static uint32_t GetID();
static bool isBusy();
static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ }
static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {}
static void DataTransferEnd() {};
static void WriteData(uint16_t Data);
static void WriteReg(uint16_t Reg);
static void WriteSequence(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
static uint16_t Data; Data = Color;
while (Count > 0) {
TransmitDMA(DMA_MINC_DISABLE, &Data, Count > 0xFFFF ? 0xFFFF : Count);
Count = Count > 0xFFFF ? Count - 0xFFFF : 0;
}
}
};
const PinMap PinMap_LTDC[] = {
{PF_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_DE
{PG_7, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_CLK
{PI_9, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_VSYNC
{PI_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_HSYNC
{PG_6, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R7
{PH_12, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R6
{PH_11, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R5
{PH_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R4
{PH_9, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R3
{PI_2, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G7
{PI_1, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G6
{PI_0, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G5
{PH_15, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G4
{PH_14, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G3
{PH_13, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G2
{PI_7, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B7
{PI_6, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B6
{PI_5, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B5
{PI_4, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B4
{PG_11, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B3
{NC, NP, 0}
};
const PinMap PinMap_SDRAM[] = {
{PC_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNWE
{PC_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNE0
{PC_3, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCKE0
{PE_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_NBL0
{PE_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_NBL1
{PF_11, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNRAS
{PG_8, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCLK
{PG_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNCAS
{PG_4, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_BA0
{PG_5, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_BA1
{PD_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D0
{PD_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D1
{PD_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D2
{PD_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D3
{PE_7, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D4
{PE_8, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D5
{PE_9, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D6
{PE_10, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D7
{PE_11, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D8
{PE_12, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D9
{PE_13, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D10
{PE_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D11
{PE_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D12
{PD_8, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D13
{PD_9, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D14
{PD_10, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D15
{PF_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A0
{PF_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A1
{PF_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A2
{PF_3, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A3
{PF_4, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A4
{PF_5, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A5
{PF_12, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A6
{PF_13, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A7
{PF_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A8
{PF_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A9
{PG_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A10
{PG_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A11
{PG_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A12
{NC, NP, 0}
};
const PinMap PinMap_QUADSPI[] = {
{PB_2, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_CLK
{PB_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_NCS
{PF_6, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO3
{PF_7, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO2
{PF_8, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK1_IO0
{PF_9, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK1_IO1
{NC, NP, 0}
};
+1 -1
View File
@@ -23,7 +23,7 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS #if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
#include "xpt2046.h" #include "xpt2046.h"
#include "pinconfig.h" #include "pinconfig.h"
+1 -1
View File
@@ -74,7 +74,7 @@
#elif defined(STM32F401xC) || defined(STM32F401xE) #elif defined(STM32F401xC) || defined(STM32F401xE)
#define MCU_STEP_TIMER 9 #define MCU_STEP_TIMER 9
#define MCU_TEMP_TIMER 10 #define MCU_TEMP_TIMER 10
#elif defined(STM32F4xx) || defined(STM32F7xx) #elif defined(STM32F4xx) || defined(STM32F7xx) || defined(STM32H7xx)
#define MCU_STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8 #define MCU_STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8
#define MCU_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used. #define MCU_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
#endif #endif
-3
View File
@@ -21,15 +21,12 @@
*/ */
#pragma once #pragma once
#include <stdint.h>
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
// ------------------------ // ------------------------
// Defines // Defines
// ------------------------ // ------------------------
#define FORCE_INLINE __attribute__((always_inline)) inline
// STM32 timers may be 16 or 32 bit. Limiting HAL_TIMER_TYPE_MAX to 16 bits // STM32 timers may be 16 or 32 bit. Limiting HAL_TIMER_TYPE_MAX to 16 bits
// avoids issues with STM32F0 MCUs, which seem to pause timers if UINT32_MAX // avoids issues with STM32F0 MCUs, which seem to pause timers if UINT32_MAX
// is written to the register. STM32F4 timers do not manifest this issue, // is written to the register. STM32F4 timers do not manifest this issue,
+4 -2
View File
@@ -293,7 +293,7 @@ void HAL_init() {
#if PIN_EXISTS(USB_CONNECT) #if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay(1000); // Give OS time to notice delay(1000); // Give OS time to notice
OUT_WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING); WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif #endif
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler
} }
@@ -453,6 +453,8 @@ void analogWrite(pin_t pin, int pwm_val8) {
analogWrite(uint8_t(pin), pwm_val8); analogWrite(uint8_t(pin), pwm_val8);
} }
void flashFirmware(const int16_t) { nvic_sys_reset(); } void HAL_reboot() { nvic_sys_reset(); }
void flashFirmware(const int16_t) { HAL_reboot(); }
#endif // __STM32F1__ #endif // __STM32F1__
+24 -19
View File
@@ -36,7 +36,6 @@
#include "fastio.h" #include "fastio.h"
#include "watchdog.h" #include "watchdog.h"
#include <stdint.h> #include <stdint.h>
#include <util/atomic.h> #include <util/atomic.h>
@@ -53,7 +52,7 @@
// ------------------------ // ------------------------
#ifndef STM32_FLASH_SIZE #ifndef STM32_FLASH_SIZE
#if EITHER(MCU_STM32F103RE, MCU_STM32F103VE) #if ANY(MCU_STM32F103RE, MCU_STM32F103VE, MCU_STM32F103ZE)
#define STM32_FLASH_SIZE 512 #define STM32_FLASH_SIZE 512
#else #else
#define STM32_FLASH_SIZE 256 #define STM32_FLASH_SIZE 256
@@ -63,11 +62,10 @@
#ifdef SERIAL_USB #ifdef SERIAL_USB
typedef ForwardSerial1Class< USBSerial > DefaultSerial1; typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
extern DefaultSerial1 MSerial0; extern DefaultSerial1 MSerial0;
#if HAS_SD_HOST_DRIVE
#if !HAS_SD_HOST_DRIVE
#define UsbSerial MSerial0
#else
#define UsbSerial MarlinCompositeSerial #define UsbSerial MarlinCompositeSerial
#else
#define UsbSerial MSerial0
#endif #endif
#endif #endif
@@ -84,10 +82,9 @@
#define MYSERIAL1 UsbSerial #define MYSERIAL1 UsbSerial
#elif WITHIN(SERIAL_PORT, 1, NUM_UARTS) #elif WITHIN(SERIAL_PORT, 1, NUM_UARTS)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#elif NUM_UARTS == 5
#error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#else #else
#error "SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration." #define MYSERIAL1 MSERIAL(1) // dummy port
static_assert(false, "SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -95,10 +92,20 @@
#define MYSERIAL2 UsbSerial #define MYSERIAL2 UsbSerial
#elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS) #elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#elif NUM_UARTS == 5
#error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration."
#else #else
#error "SERIAL_PORT_2 must be -1 or from 1 to 3. Please update your configuration." #define MYSERIAL2 MSERIAL(1) // dummy port
static_assert(false, "SERIAL_PORT_2 must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 UsbSerial
#elif WITHIN(SERIAL_PORT_3, 1, NUM_UARTS)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#define MYSERIAL3 MSERIAL(1) // dummy port
static_assert(false, "SERIAL_PORT_3 must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#endif #endif
@@ -107,10 +114,9 @@
#define MMU2_SERIAL UsbSerial #define MMU2_SERIAL UsbSerial
#elif WITHIN(MMU2_SERIAL_PORT, 1, NUM_UARTS) #elif WITHIN(MMU2_SERIAL_PORT, 1, NUM_UARTS)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#elif NUM_UARTS == 5
#error "MMU2_SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#else #else
#error "MMU2_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration." #define MMU2_SERIAL MSERIAL(1) // dummy port
static_assert(false, "MMU2_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#endif #endif
@@ -119,10 +125,9 @@
#define LCD_SERIAL UsbSerial #define LCD_SERIAL UsbSerial
#elif WITHIN(LCD_SERIAL_PORT, 1, NUM_UARTS) #elif WITHIN(LCD_SERIAL_PORT, 1, NUM_UARTS)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#elif NUM_UARTS == 5
#error "LCD_SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#else #else
#error "LCD_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration." #define LCD_SERIAL MSERIAL(1) // dummy port
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
@@ -195,7 +200,7 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
void _delay_ms(const int delay); void _delay_ms(const int delay);
+1 -1
View File
@@ -55,7 +55,7 @@ static void TXBegin() {
nvic_irq_disable(dev->irq_num); nvic_irq_disable(dev->irq_num);
// Use this if removing libmaple // Use this if removing libmaple
//NVIC_BASE->ICER[1] |= _BV(irq - 32); //SBI(NVIC_BASE->ICER[1], irq - 32);
// We NEED memory barriers to ensure Interrupts are actually disabled! // We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
+1 -1
View File
@@ -60,7 +60,7 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb
} }
else if (srflags & USART_SR_ORE) { else if (srflags & USART_SR_ORE) {
// overrun and empty data, just do a dummy read to clear ORE // overrun and empty data, just do a dummy read to clear ORE
// and prevent a raise condition where a continous interrupt stream (due to ORE set) occurs // and prevent a raise condition where a continuous interrupt stream (due to ORE set) occurs
// (see chapter "Overrun error" ) in STM32 reference manual // (see chapter "Overrun error" ) in STM32 reference manual
regs->DR; regs->DR;
} }
+3 -6
View File
@@ -19,14 +19,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
* *
*/ */
#ifdef __STM32F1__
/** /**
* PersistentStore for Arduino-style EEPROM interface * PersistentStore for Arduino-style EEPROM interface
* with simple implementations supplied by Marlin. * with simple implementations supplied by Marlin.
*/ */
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM) #if ENABLED(IIC_BL24CXX_EEPROM)
@@ -48,13 +47,11 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
size_t written = 0; uint16_t written = 0;
while (size--) { while (size--) {
uint8_t v = *value; uint8_t v = *value;
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
// EEPROM has only ~100,000 write cycles, if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
+3 -3
View File
@@ -52,13 +52,13 @@ bool PersistentStore::access_start() {
} }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles, if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS #if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
#include "xpt2046.h" #include "xpt2046.h"
#include <SPI.h> #include <SPI.h>
+4 -4
View File
@@ -25,9 +25,10 @@
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1) * HAL for stm32duino.com based on Libmaple and compatible (STM32F1)
*/ */
#include <stdint.h> #include "../../inc/MarlinConfig.h"
#include "HAL.h"
#include <libmaple/timer.h> #include <libmaple/timer.h>
#include "../../core/boards.h"
// ------------------------ // ------------------------
// Defines // Defines
@@ -37,7 +38,6 @@
* TODO: Check and confirm what timer we will use for each Temps and stepper driving. * TODO: Check and confirm what timer we will use for each Temps and stepper driving.
* We should probable drive temps with PWM. * We should probable drive temps with PWM.
*/ */
#define FORCE_INLINE __attribute__((always_inline)) inline
typedef uint16_t hal_timer_t; typedef uint16_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFF #define HAL_TIMER_TYPE_MAX 0xFFFF
@@ -80,7 +80,7 @@ typedef uint16_t hal_timer_t;
//#define TEMP_TIMER_NUM 4 // 2->4, Timer 2 for Stepper Current PWM //#define TEMP_TIMER_NUM 4 // 2->4, Timer 2 for Stepper Current PWM
#endif #endif
#if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE) #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE, MKS_ROBIN_E3D, MKS_ROBIN_E3)
// SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM. // SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM.
#ifdef STM32_HIGH_DENSITY #ifdef STM32_HIGH_DENSITY
#define SERVO0_TIMER_NUM 8 // tone.cpp uses Timer 4 #define SERVO0_TIMER_NUM 8 // tone.cpp uses Timer 4
+4
View File
@@ -35,6 +35,8 @@
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X) #define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3) #if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT); IMPLEMENT_SERIAL(SERIAL_PORT);
#else
#error "SERIAL_PORT must be from 0 to 3."
#endif #endif
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);
@@ -76,6 +78,8 @@ uint8_t HAL_get_reset_source() {
return 0; return 0;
} }
void HAL_reboot() { _reboot_Teensyduino_(); }
extern "C" { extern "C" {
extern char __bss_end; extern char __bss_end;
extern char __heap_start; extern char __heap_start;
+3 -2
View File
@@ -34,7 +34,6 @@
#include "fastio.h" #include "fastio.h"
#include "watchdog.h" #include "watchdog.h"
#include <stdint.h> #include <stdint.h>
#define ST7920_DELAY_1 DELAY_NS(600) #define ST7920_DELAY_1 DELAY_NS(600)
@@ -69,6 +68,8 @@ extern USBSerialType USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
DECLARE_SERIAL(SERIAL_PORT); DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from 0 to 3, or -1 for Native USB."
#endif #endif
#define HAL_SERVO_LIB libServo #define HAL_SERVO_LIB libServo
@@ -93,7 +94,7 @@ void HAL_clear_reset_source();
// Get the reason for the reset // Get the reason for the reset
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
+2 -1
View File
@@ -21,11 +21,12 @@
*/ */
#ifdef __MK20DX256__ #ifdef __MK20DX256__
#include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include <SPI.h> #include <SPI.h>
#include <pins_arduino.h> #include <pins_arduino.h>
#include "spi_pins.h" #include "spi_pins.h"
#include "../../core/macros.h"
static SPISettings spiConfig; static SPISettings spiConfig;
+7 -7
View File
@@ -18,14 +18,14 @@
*/ */
#ifdef __MK20DX256__ #ifdef __MK20DX256__
#include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
/** /**
* HAL PersistentStore for Teensy 3.2 (MK20DX256) * HAL PersistentStore for Teensy 3.2 (MK20DX256)
*/ */
#include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <avr/eeprom.h> #include <avr/eeprom.h>
@@ -38,13 +38,13 @@ bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles, if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+2
View File
@@ -86,6 +86,8 @@ uint8_t HAL_get_reset_source() {
return 0; return 0;
} }
void HAL_reboot() { _reboot_Teensyduino_(); }
extern "C" { extern "C" {
extern char __bss_end; extern char __bss_end;
extern char __heap_start; extern char __heap_start;
+3 -1
View File
@@ -72,6 +72,8 @@ extern USBSerialType USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
DECLARE_SERIAL(SERIAL_PORT); DECLARE_SERIAL(SERIAL_PORT);
#else
#error "SERIAL_PORT must be from 0 to 3, or -1 for Native USB."
#endif #endif
#define HAL_SERVO_LIB libServo #define HAL_SERVO_LIB libServo
@@ -99,7 +101,7 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
inline void HAL_reboot() {} // reboot the board or restart the bootloader void HAL_reboot();
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
+2 -1
View File
@@ -26,11 +26,12 @@
#if defined(__MK64FX512__) || defined(__MK66FX1M0__) #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
#include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include <SPI.h> #include <SPI.h>
#include <pins_arduino.h> #include <pins_arduino.h>
#include "spi_pins.h" #include "spi_pins.h"
#include "../../core/macros.h"
static SPISettings spiConfig; static SPISettings spiConfig;
+3 -3
View File
@@ -42,13 +42,13 @@ bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles, if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+4 -1
View File
@@ -26,10 +26,11 @@
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__
#include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include "../shared/Delay.h" #include "../shared/Delay.h"
#include "timers.h" #include "timers.h"
#include <Wire.h> #include <Wire.h>
#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X) #define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
@@ -120,6 +121,8 @@ uint8_t HAL_get_reset_source() {
return 0; return 0;
} }
void HAL_reboot() { _reboot_Teensyduino_(); }
#define __bss_end _ebss #define __bss_end _ebss
extern "C" { extern "C" {
+4 -2
View File
@@ -74,7 +74,7 @@ extern USBSerialType USBSerial;
DECLARE_SERIAL(SERIAL_PORT); DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration." #error "The required SERIAL_PORT must be from 0 to 8, or -1 for Native USB."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -85,7 +85,7 @@ extern USBSerialType USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 8) #elif WITHIN(SERIAL_PORT_2, 0, 8)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from -2 to 8. Please update your configuration." #error "SERIAL_PORT_2 must be from 0 to 8, or -1 for Native USB, or -2 for Ethernet."
#endif #endif
#endif #endif
@@ -121,6 +121,8 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
void HAL_reboot();
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#if GCC_VERSION <= 50000 #if GCC_VERSION <= 50000
+2 -1
View File
@@ -26,11 +26,12 @@
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__
#include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include <SPI.h> #include <SPI.h>
#include <pins_arduino.h> #include <pins_arduino.h>
#include "spi_pins.h" #include "spi_pins.h"
#include "../../core/macros.h"
static SPISettings spiConfig; static SPISettings spiConfig;
+7 -7
View File
@@ -22,14 +22,14 @@
*/ */
#ifdef __IMXRT1062__ #ifdef __IMXRT1062__
#include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
/** /**
* HAL PersistentStore for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) * HAL PersistentStore for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A)
*/ */
#include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <avr/eeprom.h> #include <avr/eeprom.h>
@@ -42,13 +42,13 @@ bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles, if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+32 -3
View File
@@ -150,8 +150,37 @@ void calibrate_delay_loop();
#endif #endif
// Delay in nanoseconds /**************************************************************
#define DELAY_NS(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL) / 1000UL) * Delay in nanoseconds. Requires the F_CPU macro.
* These macros follow avr-libc delay conventions.
*
* For AVR there are three possible operation modes, due to its
* slower clock speeds and thus coarser delay resolution. For
* example, when F_CPU = 16000000 the resolution is 62.5ns.
*
* Round up (default)
* Round up the delay according to the CPU clock resolution.
* e.g., 100 will give a delay of 2 cycles (125ns).
*
* Round down (DELAY_NS_ROUND_DOWN)
* Round down the delay according to the CPU clock resolution.
* e.g., 100 will be rounded down to 1 cycle (62.5ns).
*
* Nearest (DELAY_NS_ROUND_CLOSEST)
* Round the delay to the nearest number of clock cycles.
* e.g., 165 will be rounded up to 3 cycles (187.5ns) because
* it's closer to the requested delay than 2 cycle (125ns).
*/
#ifndef __AVR__
#undef DELAY_NS_ROUND_DOWN
#undef DELAY_NS_ROUND_CLOSEST
#endif
#if ENABLED(DELAY_NS_ROUND_DOWN)
#define DELAY_NS(x) DELAY_CYCLES((x) * ((F_CPU) / 1000000UL) / 1000UL) // floor
#elif ENABLED(DELAY_NS_ROUND_CLOSEST)
#define DELAY_NS(x) DELAY_CYCLES(((x) * ((F_CPU) / 1000000UL) + 500) / 1000UL) // round
#else
#define DELAY_NS(x) DELAY_CYCLES(((x) * ((F_CPU) / 1000000UL) + 999) / 1000UL) // "ceil"
#endif
+4
View File
@@ -82,4 +82,8 @@
#define UNUSED(x) ((void)(x)) #define UNUSED(x) ((void)(x))
#endif #endif
#ifndef FORCE_INLINE
#define FORCE_INLINE inline __attribute__((always_inline))
#endif
#include "progmem.h" #include "progmem.h"
@@ -321,7 +321,7 @@ void hook_cpu_exceptions() {
// probably break if the flash happens to be more than 128MB, but in this case, we are not magician, we need help from outside. // probably break if the flash happens to be more than 128MB, but in this case, we are not magician, we need help from outside.
unsigned long *vecAddr = (unsigned long*)get_vtor(); unsigned long *vecAddr = (unsigned long*)get_vtor();
SERIAL_ECHO("Vector table addr: "); SERIAL_ECHOPGM("Vector table addr: ");
SERIAL_PRINTLN(get_vtor(), HEX); SERIAL_PRINTLN(get_vtor(), HEX);
#ifdef VECTOR_TABLE_SIZE #ifdef VECTOR_TABLE_SIZE
@@ -348,7 +348,7 @@ void hook_cpu_exceptions() {
// 128 bytes alignement is required for writing the VTOR register // 128 bytes alignement is required for writing the VTOR register
alignas(128) static unsigned long vectable[VECTOR_TABLE_SENTINEL]; alignas(128) static unsigned long vectable[VECTOR_TABLE_SENTINEL];
SERIAL_ECHO("Detected vector table size: "); SERIAL_ECHOPGM("Detected vector table size: ");
SERIAL_PRINTLN(vec_size, HEX); SERIAL_PRINTLN(vec_size, HEX);
#endif #endif
@@ -372,7 +372,7 @@ void hook_cpu_exceptions() {
HW_REG(0xE000ED08) = (unsigned long)vectable | _BV32(29); // 29th bit is for telling the CPU the table is now in SRAM (should be present already) HW_REG(0xE000ED08) = (unsigned long)vectable | _BV32(29); // 29th bit is for telling the CPU the table is now in SRAM (should be present already)
SERIAL_ECHOLN("Installed fault handlers"); SERIAL_ECHOLNPGM("Installed fault handlers");
#endif #endif
} }
+7 -1
View File
@@ -30,11 +30,17 @@
#if ENABLED(I2C_EEPROM) #if ENABLED(I2C_EEPROM)
#include "eeprom_if.h" #include "eeprom_if.h"
#if ENABLED(SOFT_I2C_EEPROM)
#include <SlowSoftWire.h>
SlowSoftWire Wire = SlowSoftWire(I2C_SDA_PIN, I2C_SCL_PIN, true);
#else
#include <Wire.h> #include <Wire.h>
#endif
void eeprom_init() { void eeprom_init() {
Wire.begin( Wire.begin(
#if PINS_EXIST(I2C_SCL, I2C_SDA) #if PINS_EXIST(I2C_SCL, I2C_SDA) && DISABLED(SOFT_I2C_EEPROM)
uint8_t(I2C_SDA_PIN), uint8_t(I2C_SCL_PIN) uint8_t(I2C_SDA_PIN), uint8_t(I2C_SCL_PIN)
#endif #endif
); );
+88 -40
View File
@@ -68,15 +68,14 @@
#endif #endif
#if HAS_TFT_LVGL_UI #if HAS_TFT_LVGL_UI
#include "lcd/extui/lib/mks_ui/tft_lvgl_configuration.h" #include "lcd/extui/mks_ui/tft_lvgl_configuration.h"
#include "lcd/extui/lib/mks_ui/draw_ui.h" #include "lcd/extui/mks_ui/draw_ui.h"
#include "lcd/extui/lib/mks_ui/mks_hardware_test.h" #include "lcd/extui/mks_ui/mks_hardware_test.h"
#include <lvgl.h> #include <lvgl.h>
#endif #endif
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/dwin/e3v2/dwin.h" #include "lcd/dwin/e3v2/dwin.h"
#include "lcd/dwin/dwin_lcd.h"
#include "lcd/dwin/e3v2/rotary_encoder.h" #include "lcd/dwin/e3v2/rotary_encoder.h"
#endif #endif
@@ -211,9 +210,7 @@
#include "feature/fanmux.h" #include "feature/fanmux.h"
#endif #endif
#if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER, ELECTROMAGNETIC_SWITCHING_TOOLHEAD, SWITCHING_TOOLHEAD)
#include "module/tool_change.h" #include "module/tool_change.h"
#endif
#if ENABLED(USE_CONTROLLER_FAN) #if ENABLED(USE_CONTROLLER_FAN)
#include "feature/controllerfan.h" #include "feature/controllerfan.h"
@@ -232,7 +229,11 @@
#endif #endif
#if ENABLED(DGUS_LCD_UI_MKS) #if ENABLED(DGUS_LCD_UI_MKS)
#include "lcd/extui/lib/dgus/DGUSScreenHandler.h" #include "lcd/extui/dgus/DGUSScreenHandler.h"
#endif
#if HAS_DRIVER_SAFE_POWER_PROTECT
#include "feature/stepper_driver_safety.h"
#endif #endif
PGMSTR(M112_KILL_STR, "M112 Shutdown"); PGMSTR(M112_KILL_STR, "M112 Shutdown");
@@ -330,18 +331,14 @@ void disable_all_steppers() {
} }
/** /**
* A Print Job exists when the timer is running or SD printing * A Print Job exists when the timer is running or SD is printing
*/ */
bool printJobOngoing() { bool printJobOngoing() { return print_job_timer.isRunning() || IS_SD_PRINTING(); }
return print_job_timer.isRunning() || IS_SD_PRINTING();
}
/** /**
* Printing is active when the print job timer is running * Printing is active when a job is underway but not paused
*/ */
bool printingIsActive() { bool printingIsActive() { return !did_pause_print && printJobOngoing(); }
return !did_pause_print && (print_job_timer.isRunning() || IS_SD_PRINTING());
}
/** /**
* Printing is paused according to SD or host indicators * Printing is paused according to SD or host indicators
@@ -366,7 +363,7 @@ void startOrResumeJob() {
inline void abortSDPrinting() { inline void abortSDPrinting() {
IF_DISABLED(NO_SD_AUTOSTART, card.autofile_cancel()); IF_DISABLED(NO_SD_AUTOSTART, card.autofile_cancel());
card.endFilePrint(TERN_(SD_RESORT, true)); card.abortFilePrintNow(TERN_(SD_RESORT, true));
queue.clear(); queue.clear();
quickstop_stepper(); quickstop_stepper();
@@ -389,8 +386,8 @@ void startOrResumeJob() {
} }
inline void finishSDPrinting() { inline void finishSDPrinting() {
if (queue.enqueue_one_P(PSTR("M1001"))) { if (queue.enqueue_one_P(PSTR("M1001"))) { // Keep trying until it gets queued
marlin_state = MF_RUNNING; marlin_state = MF_RUNNING; // Signal to stop trying
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine()); TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished()); TERN_(DGUS_LCD_UI_MKS, ScreenHandler.SDPrintingFinished());
} }
@@ -456,7 +453,8 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
already_shutdown_steppers = false; already_shutdown_steppers = false;
} }
#if PIN_EXISTS(CHDK) // Check if pin should be set to LOW (after M240 set it HIGH) #if ENABLED(PHOTO_GCODE) && PIN_EXISTS(CHDK)
// Check if CHDK should be set to LOW (after M240 set it HIGH)
extern millis_t chdk_timeout; extern millis_t chdk_timeout;
if (chdk_timeout && ELAPSED(ms, chdk_timeout)) { if (chdk_timeout && ELAPSED(ms, chdk_timeout)) {
chdk_timeout = 0; chdk_timeout = 0;
@@ -485,6 +483,10 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
} }
#endif #endif
#if HAS_FREEZE_PIN
Stepper::frozen = !READ(FREEZE_PIN);
#endif
#if HAS_HOME #if HAS_HOME
// Handle a standalone HOME button // Handle a standalone HOME button
constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL; constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL;
@@ -602,7 +604,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
TERN_(HOTEND_IDLE_TIMEOUT, hotend_idle.check()); TERN_(HOTEND_IDLE_TIMEOUT, hotend_idle.check());
#if ENABLED(EXTRUDER_RUNOUT_PREVENT) #if ENABLED(EXTRUDER_RUNOUT_PREVENT)
if (thermalManager.degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP if (thermalManager.degHotend(active_extruder) > (EXTRUDER_RUNOUT_MINTEMP)
&& ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS)) && ELAPSED(ms, gcode.previous_move_ms + SEC_TO_MS(EXTRUDER_RUNOUT_SECONDS))
&& !planner.has_blocks_queued() && !planner.has_blocks_queued()
) { ) {
@@ -732,6 +734,9 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Return if setup() isn't completed // Return if setup() isn't completed
if (marlin_state == MF_INITIALIZING) goto IDLE_DONE; if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;
// TODO: Still causing errors
(void)check_tool_sensor_stats(active_extruder, true);
// Handle filament runout sensors // Handle filament runout sensors
TERN_(HAS_FILAMENT_SENSOR, runout.run()); TERN_(HAS_FILAMENT_SENSOR, runout.run());
@@ -743,7 +748,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Handle Power-Loss Recovery // Handle Power-Loss Recovery
#if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS) #if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS)
if (printJobOngoing()) recovery.outage(); if (IS_SD_PRINTING()) recovery.outage();
#endif #endif
// Run StallGuard endstop checks // Run StallGuard endstop checks
@@ -758,7 +763,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
TERN_(SDSUPPORT, card.manage_media()); TERN_(SDSUPPORT, card.manage_media());
// Handle USB Flash Drive insert / remove // Handle USB Flash Drive insert / remove
TERN_(USB_FLASH_DRIVE_SUPPORT, Sd2Card::idle()); TERN_(USB_FLASH_DRIVE_SUPPORT, card.diskIODriver()->idle());
// Announce Host Keepalive state (if any) // Announce Host Keepalive state (if any)
TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive()); TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive());
@@ -791,6 +796,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
if (!gcode.autoreport_paused) { if (!gcode.autoreport_paused) {
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_reporter.tick()); TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_reporter.tick());
TERN_(AUTO_REPORT_SD_STATUS, card.auto_reporter.tick()); TERN_(AUTO_REPORT_SD_STATUS, card.auto_reporter.tick());
TERN_(AUTO_REPORT_POSITION, position_auto_reporter.tick());
} }
#endif #endif
@@ -820,18 +826,19 @@ void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr
TERN_(HAS_CUTTER, cutter.kill()); // Full cutter shutdown including ISR control TERN_(HAS_CUTTER, cutter.kill()); // Full cutter shutdown including ISR control
SERIAL_ERROR_MSG(STR_ERR_KILLED); // Echo the LCD message to serial for extra context
if (lcd_error) { SERIAL_ECHO_START(); SERIAL_ECHOLNPGM_P(lcd_error); }
#if HAS_DISPLAY #if HAS_DISPLAY
ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component ?: NUL_STR); ui.kill_screen(lcd_error ?: GET_TEXT(MSG_KILLED), lcd_component ?: NUL_STR);
#else #else
UNUSED(lcd_error); UNUSED(lcd_error); UNUSED(lcd_component);
UNUSED(lcd_component);
#endif #endif
#if HAS_TFT_LVGL_UI TERN_(HAS_TFT_LVGL_UI, lv_draw_error_message(lcd_error));
lv_draw_error_message(lcd_error);
#endif // "Error:Printer halted. kill() called!"
SERIAL_ERROR_MSG(STR_ERR_KILLED);
#ifdef ACTION_ON_KILL #ifdef ACTION_ON_KILL
host_action_kill(); host_action_kill();
@@ -862,20 +869,22 @@ void minkill(const bool steppers_off/*=false*/) {
TERN_(HAS_SUICIDE, suicide()); TERN_(HAS_SUICIDE, suicide());
#if HAS_KILL #if EITHER(HAS_KILL, SOFT_RESET_ON_KILL)
// Wait for kill to be released // Wait for both KILL and ENC to be released
while (kill_state()) watchdog_refresh(); while (TERN0(HAS_KILL, !kill_state()) || TERN0(SOFT_RESET_ON_KILL, !ui.button_pressed()))
watchdog_refresh();
// Wait for kill to be pressed // Wait for either KILL or ENC press
while (!kill_state()) watchdog_refresh(); while (TERN1(HAS_KILL, kill_state()) && TERN1(SOFT_RESET_ON_KILL, ui.button_pressed()))
watchdog_refresh();
void (*resetFunc)() = 0; // Declare resetFunc() at address 0 // Reboot the board
resetFunc(); // Jump to address 0 HAL_reboot();
#else #else
for (;;) watchdog_refresh(); // Wait for reset for (;;) watchdog_refresh(); // Wait for RESET button or power-cycle
#endif #endif
} }
@@ -893,7 +902,7 @@ void stop() {
thermalManager.set_fans_paused(false); // Un-pause fans for safety thermalManager.set_fans_paused(false); // Un-pause fans for safety
#endif #endif
if (IsRunning()) { if (!IsStopped()) {
SERIAL_ERROR_MSG(STR_ERR_STOPPED); SERIAL_ERROR_MSG(STR_ERR_STOPPED);
LCD_MESSAGEPGM(MSG_STOPPED); LCD_MESSAGEPGM(MSG_STOPPED);
safe_delay(350); // allow enough time for messages to get out before stopping safe_delay(350); // allow enough time for messages to get out before stopping
@@ -1064,9 +1073,20 @@ void setup() {
while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (!MYSERIAL1.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#if HAS_MULTI_SERIAL && !HAS_ETHERNET #if HAS_MULTI_SERIAL && !HAS_ETHERNET
MYSERIAL2.begin(BAUDRATE); #ifndef BAUDRATE_2
#define BAUDRATE_2 BAUDRATE
#endif
MYSERIAL2.begin(BAUDRATE_2);
serial_connect_timeout = millis() + 1000UL; serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL2.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (!MYSERIAL2.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#ifdef SERIAL_PORT_3
#ifndef BAUDRATE_3
#define BAUDRATE_3 BAUDRATE
#endif
MYSERIAL3.begin(BAUDRATE_3);
serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL3.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif
#endif #endif
SERIAL_ECHOLNPGM("start"); SERIAL_ECHOLNPGM("start");
@@ -1080,6 +1100,10 @@ void setup() {
#endif #endif
#endif #endif
#if HAS_FREEZE_PIN
SET_INPUT_PULLUP(FREEZE_PIN);
#endif
#if HAS_SUICIDE #if HAS_SUICIDE
SETUP_LOG("SUICIDE_PIN"); SETUP_LOG("SUICIDE_PIN");
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
@@ -1213,12 +1237,22 @@ void setup() {
DWIN_UpdateLCD(); // Show bootscreen (first image) DWIN_UpdateLCD(); // Show bootscreen (first image)
#else #else
SETUP_RUN(ui.init()); SETUP_RUN(ui.init());
#if HAS_WIRED_LCD && ENABLED(SHOW_BOOTSCREEN) #if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
SETUP_RUN(ui.show_bootscreen()); SETUP_RUN(ui.show_bootscreen());
const millis_t bootscreen_ms = millis();
#endif #endif
SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.) SETUP_RUN(ui.reset_status()); // Load welcome message early. (Retained if no errors exist.)
#endif #endif
#if PIN_EXISTS(SAFE_POWER)
#if HAS_DRIVER_SAFE_POWER_PROTECT
SETUP_RUN(stepper_driver_backward_check());
#else
SETUP_LOG("SAFE_POWER");
OUT_WRITE(SAFE_POWER_PIN, HIGH);
#endif
#endif
#if ENABLED(PROBE_TARE) #if ENABLED(PROBE_TARE)
SETUP_RUN(probe.tare_init()); SETUP_RUN(probe.tare_init());
#endif #endif
@@ -1460,7 +1494,11 @@ void setup() {
#endif #endif
#if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF) #if HAS_TRINAMIC_CONFIG && DISABLED(PSU_DEFAULT_OFF)
SETUP_RUN(test_tmc_connection(true, true, true, true)); SETUP_RUN(test_tmc_connection());
#endif
#if HAS_DRIVER_SAFE_POWER_PROTECT
SETUP_RUN(stepper_driver_backward_report());
#endif #endif
#if HAS_PRUSA_MMU2 #if HAS_PRUSA_MMU2
@@ -1476,7 +1514,9 @@ void setup() {
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
Encoder_Configuration(); Encoder_Configuration();
HMI_Init(); HMI_Init();
DWIN_JPG_CacheTo1(Language_English);
HMI_StartFrame(true); HMI_StartFrame(true);
DWIN_StatusChanged(GET_TEXT(WELCOME_MSG));
#endif #endif
#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD) #if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)
@@ -1498,6 +1538,14 @@ void setup() {
SETUP_RUN(tft_lvgl_init()); SETUP_RUN(tft_lvgl_init());
#endif #endif
#if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
const millis_t elapsed = millis() - bootscreen_ms;
#if ENABLED(MARLIN_DEV_MODE)
SERIAL_ECHOLNPAIR("elapsed=", elapsed);
#endif
SETUP_RUN(ui.bootscreen_completion(elapsed));
#endif
#if ENABLED(PASSWORD_ON_STARTUP) #if ENABLED(PASSWORD_ON_STARTUP)
SETUP_RUN(password.lock_machine()); // Will not proceed until correct password provided SETUP_RUN(password.lock_machine()); // Will not proceed until correct password provided
#endif #endif
+9 -8
View File
@@ -57,19 +57,20 @@ void minkill(const bool steppers_off=false);
// Global State of the firmware // Global State of the firmware
enum MarlinState : uint8_t { enum MarlinState : uint8_t {
MF_INITIALIZING = 0, MF_INITIALIZING = 0,
MF_RUNNING = _BV(0), MF_STOPPED,
MF_PAUSED = _BV(1), MF_KILLED,
MF_WAITING = _BV(2), MF_RUNNING,
MF_STOPPED = _BV(3), MF_SD_COMPLETE,
MF_SD_COMPLETE = _BV(4), MF_PAUSED,
MF_KILLED = _BV(7) MF_WAITING,
}; };
extern MarlinState marlin_state; extern MarlinState marlin_state;
inline bool IsRunning() { return marlin_state == MF_RUNNING; } inline bool IsRunning() { return marlin_state >= MF_RUNNING; }
inline bool IsStopped() { return marlin_state != MF_RUNNING; } inline bool IsStopped() { return marlin_state == MF_STOPPED; }
bool printingIsActive(); bool printingIsActive();
bool printJobOngoing();
bool printingIsPaused(); bool printingIsPaused();
void startOrResumeJob(); void startOrResumeJob();
+48 -38
View File
@@ -68,8 +68,8 @@
#define BOARD_MKS_GEN_13 1112 // MKS GEN v1.3 or 1.4 #define BOARD_MKS_GEN_13 1112 // MKS GEN v1.3 or 1.4
#define BOARD_MKS_GEN_L 1113 // MKS GEN L #define BOARD_MKS_GEN_L 1113 // MKS GEN L
#define BOARD_KFB_2 1114 // BigTreeTech or BIQU KFB2.0 #define BOARD_KFB_2 1114 // BigTreeTech or BIQU KFB2.0
#define BOARD_ZRIB_V20 1115 // zrib V2.0 control board (Chinese knock off RAMPS replica) #define BOARD_ZRIB_V20 1115 // zrib V2.0 (Chinese RAMPS replica)
#define BOARD_ZRIB_V52 1116 // zrib V5.2 control board (Chinese knock off RAMPS replica) #define BOARD_ZRIB_V52 1116 // zrib V5.2 (Chinese RAMPS replica)
#define BOARD_FELIX2 1117 // Felix 2.0+ Electronics Board (RAMPS like) #define BOARD_FELIX2 1117 // Felix 2.0+ Electronics Board (RAMPS like)
#define BOARD_RIGIDBOARD 1118 // Invent-A-Part RigidBoard #define BOARD_RIGIDBOARD 1118 // Invent-A-Part RigidBoard
#define BOARD_RIGIDBOARD_V2 1119 // Invent-A-Part RigidBoard V2 #define BOARD_RIGIDBOARD_V2 1119 // Invent-A-Part RigidBoard V2
@@ -87,7 +87,7 @@
#define BOARD_FORMBOT_RAPTOR 1131 // Formbot Raptor #define BOARD_FORMBOT_RAPTOR 1131 // Formbot Raptor
#define BOARD_FORMBOT_RAPTOR2 1132 // Formbot Raptor 2 #define BOARD_FORMBOT_RAPTOR2 1132 // Formbot Raptor 2
#define BOARD_BQ_ZUM_MEGA_3D 1133 // bq ZUM Mega 3D #define BOARD_BQ_ZUM_MEGA_3D 1133 // bq ZUM Mega 3D
#define BOARD_MAKEBOARD_MINI 1134 // MakeBoard Mini v2.1.2 is a control board sold by MicroMake #define BOARD_MAKEBOARD_MINI 1134 // MakeBoard Mini v2.1.2 by MicroMake
#define BOARD_TRIGORILLA_13 1135 // TriGorilla Anycubic version 1.3-based on RAMPS EFB #define BOARD_TRIGORILLA_13 1135 // TriGorilla Anycubic version 1.3-based on RAMPS EFB
#define BOARD_TRIGORILLA_14 1136 // ... Ver 1.4 #define BOARD_TRIGORILLA_14 1136 // ... Ver 1.4
#define BOARD_TRIGORILLA_14_11 1137 // ... Rev 1.1 (new servo pin order) #define BOARD_TRIGORILLA_14_11 1137 // ... Rev 1.1 (new servo pin order)
@@ -146,17 +146,19 @@
#define BOARD_ELEFU_3 1311 // Elefu Ra Board (v3) #define BOARD_ELEFU_3 1311 // Elefu Ra Board (v3)
#define BOARD_LEAPFROG 1312 // Leapfrog #define BOARD_LEAPFROG 1312 // Leapfrog
#define BOARD_MEGACONTROLLER 1313 // Mega controller #define BOARD_MEGACONTROLLER 1313 // Mega controller
#define BOARD_GT2560_REV_A 1314 // Geeetech GT2560 Rev. A #define BOARD_GT2560_REV_A 1314 // Geeetech GT2560 Rev A
#define BOARD_GT2560_REV_A_PLUS 1315 // Geeetech GT2560 Rev. A+ (with auto level probe) #define BOARD_GT2560_REV_A_PLUS 1315 // Geeetech GT2560 Rev A+ (with auto level probe)
#define BOARD_GT2560_V3 1316 // Geeetech GT2560 Rev B for A10(M/D) #define BOARD_GT2560_REV_B 1316 // Geeetech GT2560 Rev B
#define BOARD_GT2560_V3_MC2 1317 // Geeetech GT2560 Rev B for Mecreator2 #define BOARD_GT2560_V3 1317 // Geeetech GT2560 Rev B for A10(M/D)
#define BOARD_GT2560_V3_A20 1318 // Geeetech GT2560 Rev B for A20(M/D) #define BOARD_GT2560_V4 1318 // Geeetech GT2560 Rev B for A10(M/D)
#define BOARD_EINSTART_S 1319 // Einstart retrofit #define BOARD_GT2560_V3_MC2 1319 // Geeetech GT2560 Rev B for Mecreator2
#define BOARD_WANHAO_ONEPLUS 1320 // Wanhao 0ne+ i3 Mini #define BOARD_GT2560_V3_A20 1320 // Geeetech GT2560 Rev B for A20(M/D)
#define BOARD_LEAPFROG_XEED2015 1321 // Leapfrog Xeed 2015 #define BOARD_EINSTART_S 1321 // Einstart retrofit
#define BOARD_PICA_REVB 1322 // PICA Shield (original version) #define BOARD_WANHAO_ONEPLUS 1322 // Wanhao 0ne+ i3 Mini
#define BOARD_PICA 1323 // PICA Shield (rev C or later) #define BOARD_LEAPFROG_XEED2015 1323 // Leapfrog Xeed 2015
#define BOARD_INTAMSYS40 1324 // Intamsys 4.0 (Funmat HT) #define BOARD_PICA_REVB 1324 // PICA Shield (original version)
#define BOARD_PICA 1325 // PICA Shield (rev C or later)
#define BOARD_INTAMSYS40 1326 // Intamsys 4.0 (Funmat HT)
// //
// ATmega1281, ATmega2561 // ATmega1281, ATmega2561
@@ -174,8 +176,8 @@
#define BOARD_MELZI 1502 // Melzi #define BOARD_MELZI 1502 // Melzi
#define BOARD_MELZI_V2 1503 // Melzi V2 #define BOARD_MELZI_V2 1503 // Melzi V2
#define BOARD_MELZI_MAKR3D 1504 // Melzi with ATmega1284 (MaKr3d version) #define BOARD_MELZI_MAKR3D 1504 // Melzi with ATmega1284 (MaKr3d version)
#define BOARD_MELZI_CREALITY 1505 // Melzi Creality3D board (for CR-10 etc) #define BOARD_MELZI_CREALITY 1505 // Melzi Creality3D (for CR-10 etc)
#define BOARD_MELZI_MALYAN 1506 // Melzi Malyan M150 board #define BOARD_MELZI_MALYAN 1506 // Melzi Malyan M150
#define BOARD_MELZI_TRONXY 1507 // Tronxy X5S #define BOARD_MELZI_TRONXY 1507 // Tronxy X5S
#define BOARD_STB_11 1508 // STB V1.1 #define BOARD_STB_11 1508 // STB V1.1
#define BOARD_AZTEEG_X1 1509 // Azteeg X1 #define BOARD_AZTEEG_X1 1509 // Azteeg X1
@@ -194,8 +196,8 @@
#define BOARD_GEN7_12 1605 // Gen7 v1.1, v1.2 #define BOARD_GEN7_12 1605 // Gen7 v1.1, v1.2
#define BOARD_GEN7_13 1606 // Gen7 v1.3 #define BOARD_GEN7_13 1606 // Gen7 v1.3
#define BOARD_GEN7_14 1607 // Gen7 v1.4 #define BOARD_GEN7_14 1607 // Gen7 v1.4
#define BOARD_OMCA_A 1608 // Alpha OMCA board #define BOARD_OMCA_A 1608 // Alpha OMCA
#define BOARD_OMCA 1609 // Final OMCA board #define BOARD_OMCA 1609 // Final OMCA
#define BOARD_SETHI 1610 // Sethi 3D_1 #define BOARD_SETHI 1610 // Sethi 3D_1
// //
@@ -226,7 +228,7 @@
#define BOARD_SELENA_COMPACT 2008 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1) #define BOARD_SELENA_COMPACT 2008 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1)
#define BOARD_BIQU_B300_V1_0 2009 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver) #define BOARD_BIQU_B300_V1_0 2009 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
#define BOARD_MKS_SGEN_L 2010 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan) #define BOARD_MKS_SGEN_L 2010 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan)
#define BOARD_GMARSH_X6_REV1 2011 // GMARSH X6 board, revision 1 prototype #define BOARD_GMARSH_X6_REV1 2011 // GMARSH X6, revision 1 prototype
#define BOARD_BTT_SKR_V1_1 2012 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed) #define BOARD_BTT_SKR_V1_1 2012 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed)
#define BOARD_BTT_SKR_V1_3 2013 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) #define BOARD_BTT_SKR_V1_3 2013 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
#define BOARD_BTT_SKR_V1_4 2014 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed) #define BOARD_BTT_SKR_V1_4 2014 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed)
@@ -341,6 +343,7 @@
#define BOARD_FLSUN_HISPEED 4046 // FLSUN HiSpeedV1 (STM32F103VET6) #define BOARD_FLSUN_HISPEED 4046 // FLSUN HiSpeedV1 (STM32F103VET6)
#define BOARD_BEAST 4047 // STM32F103RET6 Libmaple-based controller #define BOARD_BEAST 4047 // STM32F103RET6 Libmaple-based controller
#define BOARD_MINGDA_MPX_ARM_MINI 4048 // STM32F103ZET6 Mingda MD-16 #define BOARD_MINGDA_MPX_ARM_MINI 4048 // STM32F103ZET6 Mingda MD-16
#define BOARD_GTM32_PRO_VD 4049 // STM32F103VET6 controller
// //
// ARM Cortex-M4F // ARM Cortex-M4F
@@ -360,23 +363,29 @@
#define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE #define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE
#define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE #define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE
#define BOARD_STEVAL_3DP001V1 4206 // STEVAL-3DP001V1 3D PRINTER BOARD #define BOARD_STEVAL_3DP001V1 4206 // STEVAL-3DP001V1 3D PRINTER BOARD
#define BOARD_BTT_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG) #define BOARD_BTT_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZGT6)
#define BOARD_BTT_SKR_PRO_V1_2 4208 // BigTreeTech SKR Pro v1.2 (STM32F407ZG) #define BOARD_BTT_SKR_PRO_V1_2 4208 // BigTreeTech SKR Pro v1.2 (STM32F407ZGT6)
#define BOARD_BTT_BTT002_V1_0 4209 // BigTreeTech BTT002 v1.0 (STM32F407VG) #define BOARD_BTT_BTT002_V1_0 4209 // BigTreeTech BTT002 v1.0 (STM32F407VGT6)
#define BOARD_BTT_GTR_V1_0 4210 // BigTreeTech GTR v1.0 (STM32F407IGT) #define BOARD_BTT_E3_RRF 4210 // BigTreeTech E3 RRF (STM32F407VGT6)
#define BOARD_LERDGE_K 4211 // Lerdge K (STM32F407ZG) #define BOARD_BTT_SKR_V2_0_REV_A 4211 // BigTreeTech SKR v2.0 Rev A (STM32F407VGT6)
#define BOARD_LERDGE_S 4212 // Lerdge S (STM32F407VE) #define BOARD_BTT_SKR_V2_0_REV_B 4212 // BigTreeTech SKR v2.0 Rev B (STM32F407VGT6)
#define BOARD_LERDGE_X 4213 // Lerdge X (STM32F407VE) #define BOARD_BTT_GTR_V1_0 4213 // BigTreeTech GTR v1.0 (STM32F407IGT)
#define BOARD_VAKE403D 4214 // VAkE 403D (STM32F446VET6) #define BOARD_BTT_OCTOPUS_V1_0 4214 // BigTreeTech Octopus v1.0 (STM32F446ZET6)
#define BOARD_FYSETC_S6 4215 // FYSETC S6 board #define BOARD_LERDGE_K 4215 // Lerdge K (STM32F407ZG)
#define BOARD_FYSETC_S6_V2_0 4216 // FYSETC S6 v2.0 board #define BOARD_LERDGE_S 4216 // Lerdge S (STM32F407VE)
#define BOARD_FLYF407ZG 4217 // FLYF407ZG board (STM32F407ZG) #define BOARD_LERDGE_X 4217 // Lerdge X (STM32F407VE)
#define BOARD_MKS_ROBIN2 4218 // MKS_ROBIN2 (STM32F407ZE) #define BOARD_VAKE403D 4218 // VAkE 403D (STM32F446VET6)
#define BOARD_MKS_ROBIN_PRO_V2 4219 // MKS Robin Pro V2 (STM32F407VE) #define BOARD_FYSETC_S6 4219 // FYSETC S6 (STM32F446VET6)
#define BOARD_MKS_ROBIN_NANO_V3 4220 // MKS Robin Nano V3 (STM32F407VG) #define BOARD_FYSETC_S6_V2_0 4220 // FYSETC S6 v2.0 (STM32F446VET6)
#define BOARD_ANET_ET4 4221 // ANET ET4 V1.x (STM32F407VGT6) #define BOARD_FYSETC_SPIDER 4221 // FYSETC Spider (STM32F446VET6)
#define BOARD_ANET_ET4P 4222 // ANET ET4P V1.x (STM32F407VGT6) #define BOARD_FLYF407ZG 4222 // FLYF407ZG (STM32F407ZG)
#define BOARD_FYSETC_CHEETAH_V20 4223 // FYSETC Cheetah V2.0 #define BOARD_MKS_ROBIN2 4223 // MKS_ROBIN2 (STM32F407ZE)
#define BOARD_MKS_ROBIN_PRO_V2 4224 // MKS Robin Pro V2 (STM32F407VE)
#define BOARD_MKS_ROBIN_NANO_V3 4225 // MKS Robin Nano V3 (STM32F407VG)
#define BOARD_ANET_ET4 4226 // ANET ET4 V1.x (STM32F407VGT6)
#define BOARD_ANET_ET4P 4227 // ANET ET4P V1.x (STM32F407VGT6)
#define BOARD_FYSETC_CHEETAH_V20 4228 // FYSETC Cheetah V2.0
// //
// ARM Cortex M7 // ARM Cortex M7
@@ -386,14 +395,15 @@
#define BOARD_TEENSY41 5001 // Teensy 4.1 #define BOARD_TEENSY41 5001 // Teensy 4.1
#define BOARD_T41U5XBB 5002 // T41U5XBB Teensy 4.1 breakout board #define BOARD_T41U5XBB 5002 // T41U5XBB Teensy 4.1 breakout board
#define BOARD_NUCLEO_F767ZI 5003 // ST NUCLEO-F767ZI Dev Board #define BOARD_NUCLEO_F767ZI 5003 // ST NUCLEO-F767ZI Dev Board
#define BOARD_BTT_SKR_SE_BX 5004 // BigTreeTech SKR SE BX (STM32H743II)
// //
// Espressif ESP32 WiFi // Espressif ESP32 WiFi
// //
#define BOARD_ESPRESSIF_ESP32 6000 // Generic ESP32 #define BOARD_ESPRESSIF_ESP32 6000 // Generic ESP32
#define BOARD_MRR_ESPA 6001 // MRR ESPA board based on ESP32 (native pins only) #define BOARD_MRR_ESPA 6001 // MRR ESPA based on ESP32 (native pins only)
#define BOARD_MRR_ESPE 6002 // MRR ESPE board based on ESP32 (with I2S stepper stream) #define BOARD_MRR_ESPE 6002 // MRR ESPE based on ESP32 (with I2S stepper stream)
#define BOARD_E4D_BOX 6003 // E4d@BOX #define BOARD_E4D_BOX 6003 // E4d@BOX
#define BOARD_FYSETC_E4 6004 // FYSETC E4 #define BOARD_FYSETC_E4 6004 // FYSETC E4
+4 -2
View File
@@ -27,10 +27,12 @@
// Useful macro for stopping the CPU on an unexpected condition // Useful macro for stopping the CPU on an unexpected condition
// This is used like SERIAL_ECHOPAIR, that is: a key-value call of the local variables you want // This is used like SERIAL_ECHOPAIR, that is: a key-value call of the local variables you want
// to dump to the serial port before stopping the CPU. // to dump to the serial port before stopping the CPU.
#define BUG_ON(V...) do { SERIAL_ECHOPAIR(ONLY_FILENAME, __LINE__, ": "); SERIAL_ECHOLNPAIR(V); SERIAL_FLUSHTX(); *(char*)0 = 42; } while(0) // \/ Don't replace by SERIAL_ECHOPAIR since ONLY_FILENAME cannot be transformed to a PGM string on Arduino and it breaks building
#define BUG_ON(V...) do { SERIAL_ECHO(ONLY_FILENAME); SERIAL_ECHO(__LINE__); SERIAL_ECHOLNPGM(": "); SERIAL_ECHOLNPAIR(V); SERIAL_FLUSHTX(); *(char*)0 = 42; } while(0)
#elif ENABLED(MARLIN_DEV_MODE) #elif ENABLED(MARLIN_DEV_MODE)
// Don't stop the CPU here, but at least dump the bug on the serial port // Don't stop the CPU here, but at least dump the bug on the serial port
#define BUG_ON(V...) do { SERIAL_ECHOPAIR(ONLY_FILENAME, __LINE__, ": BUG!\n"); SERIAL_ECHOLNPAIR(V); SERIAL_FLUSHTX(); } while(0) // \/ Don't replace by SERIAL_ECHOPAIR since ONLY_FILENAME cannot be transformed to a PGM string on Arduino and it breaks building
#define BUG_ON(V...) do { SERIAL_ECHO(ONLY_FILENAME); SERIAL_ECHO(__LINE__); SERIAL_ECHOLNPGM(": BUG!"); SERIAL_ECHOLNPAIR(V); SERIAL_FLUSHTX(); } while(0)
#else #else
// Release mode, let's ignore the bug // Release mode, let's ignore the bug
#define BUG_ON(V...) NOOP #define BUG_ON(V...) NOOP
+1 -1
View File
@@ -44,6 +44,6 @@ private:
SERIAL_ECHOPGM_P(the_msg); SERIAL_ECHOPGM_P(the_msg);
} }
SERIAL_CHAR(' '); SERIAL_CHAR(' ');
print_xyz(current_position); print_pos(current_position);
} }
}; };
+33 -26
View File
@@ -130,6 +130,7 @@
#define STR_COUNT_A " Count A:" #define STR_COUNT_A " Count A:"
#define STR_WATCHDOG_FIRED "Watchdog timeout. Reset required." #define STR_WATCHDOG_FIRED "Watchdog timeout. Reset required."
#define STR_ERR_KILLED "Printer halted. kill() called!" #define STR_ERR_KILLED "Printer halted. kill() called!"
#define STR_FLOWMETER_FAULT "Coolant flow fault. Flowmeter safety is active. Attention required."
#define STR_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)" #define STR_ERR_STOPPED "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"
#define STR_ERR_SERIAL_MISMATCH "Serial status mismatch" #define STR_ERR_SERIAL_MISMATCH "Serial status mismatch"
#define STR_BUSY_PROCESSING "busy: processing" #define STR_BUSY_PROCESSING "busy: processing"
@@ -139,25 +140,7 @@
#define STR_RESEND "Resend: " #define STR_RESEND "Resend: "
#define STR_UNKNOWN_COMMAND "Unknown command: \"" #define STR_UNKNOWN_COMMAND "Unknown command: \""
#define STR_ACTIVE_EXTRUDER "Active Extruder: " #define STR_ACTIVE_EXTRUDER "Active Extruder: "
#define STR_X_MIN "x_min"
#define STR_X_MAX "x_max"
#define STR_X2_MIN "x2_min"
#define STR_X2_MAX "x2_max"
#define STR_Y_MIN "y_min"
#define STR_Y_MAX "y_max"
#define STR_Y2_MIN "y2_min"
#define STR_Y2_MAX "y2_max"
#define STR_Z_MIN "z_min"
#define STR_Z_MAX "z_max"
#define STR_Z2_MIN "z2_min"
#define STR_Z2_MAX "z2_max"
#define STR_Z3_MIN "z3_min"
#define STR_Z3_MAX "z3_max"
#define STR_Z4_MIN "z4_min"
#define STR_Z4_MAX "z4_max"
#define STR_Z_PROBE "z_probe"
#define STR_PROBE_EN "probe_en"
#define STR_FILAMENT_RUNOUT_SENSOR "filament"
#define STR_PROBE_OFFSET "Probe Offset" #define STR_PROBE_OFFSET "Probe Offset"
#define STR_SKEW_MIN "min_skew_factor: " #define STR_SKEW_MIN "min_skew_factor: "
#define STR_SKEW_MAX "max_skew_factor: " #define STR_SKEW_MAX "max_skew_factor: "
@@ -276,14 +259,30 @@
#define STR_REMINDER_SAVE_SETTINGS "Remember to save!" #define STR_REMINDER_SAVE_SETTINGS "Remember to save!"
#define STR_PASSWORD_SET "Password is " #define STR_PASSWORD_SET "Password is "
// LCD Menu Messages //
// Endstop Names used by Endstops::report_states
#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(fontdata/langdata_##M.h) //
#define LANGUAGE_DATA_INCL(M) LANGUAGE_DATA_INCL_(M) #define STR_X_MIN "x_min"
#define STR_X_MAX "x_max"
#define LANGUAGE_INCL_(M) STRINGIFY_(../lcd/language/language_##M.h) #define STR_X2_MIN "x2_min"
#define LANGUAGE_INCL(M) LANGUAGE_INCL_(M) #define STR_X2_MAX "x2_max"
#define STR_Y_MIN "y_min"
#define STR_Y_MAX "y_max"
#define STR_Y2_MIN "y2_min"
#define STR_Y2_MAX "y2_max"
#define STR_Z_MIN "z_min"
#define STR_Z_MAX "z_max"
#define STR_Z2_MIN "z2_min"
#define STR_Z2_MAX "z2_max"
#define STR_Z3_MIN "z3_min"
#define STR_Z3_MAX "z3_max"
#define STR_Z4_MIN "z4_min"
#define STR_Z4_MAX "z4_max"
#define STR_Z_PROBE "z_probe"
#define STR_PROBE_EN "probe_en"
#define STR_FILAMENT_RUNOUT_SENSOR "filament"
// General axis names
#define STR_X "X" #define STR_X "X"
#define STR_Y "Y" #define STR_Y "Y"
#define STR_Z "Z" #define STR_Z "Z"
@@ -385,6 +384,14 @@
#define LCD_STR_E6 "E" LCD_STR_N6 #define LCD_STR_E6 "E" LCD_STR_N6
#define LCD_STR_E7 "E" LCD_STR_N7 #define LCD_STR_E7 "E" LCD_STR_N7
// Include localized LCD Menu Messages
#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(fontdata/langdata_##M.h)
#define LANGUAGE_DATA_INCL(M) LANGUAGE_DATA_INCL_(M)
#define LANGUAGE_INCL_(M) STRINGIFY_(../lcd/language/language_##M.h)
#define LANGUAGE_INCL(M) LANGUAGE_INCL_(M)
// Use superscripts, if possible. Evaluated at point of use. // Use superscripts, if possible. Evaluated at point of use.
#define SUPERSCRIPT_TWO TERN(NOT_EXTENDED_ISO10646_1_5X7, "^2", "²") #define SUPERSCRIPT_TWO TERN(NOT_EXTENDED_ISO10646_1_5X7, "^2", "²")
#define SUPERSCRIPT_THREE TERN(NOT_EXTENDED_ISO10646_1_5X7, "^3", "³") #define SUPERSCRIPT_THREE TERN(NOT_EXTENDED_ISO10646_1_5X7, "^3", "³")
+101 -33
View File
@@ -187,14 +187,21 @@
#define DISABLED(V...) DO(DIS,&&,V) #define DISABLED(V...) DO(DIS,&&,V)
#define COUNT_ENABLED(V...) DO(ENA,+,V) #define COUNT_ENABLED(V...) DO(ENA,+,V)
#define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION converted to '0' or '1' #define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION ? 'A' : 'B'
#define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION converted to A or '0' #define TERN0(O,A) _TERN(_ENA_1(O),0,A) // OPTION ? 'A' : '0'
#define TERN1(O,A) _TERN(_ENA_1(O),1,A) // OPTION converted to A or '1' #define TERN1(O,A) _TERN(_ENA_1(O),1,A) // OPTION ? 'A' : '1'
#define TERN_(O,A) _TERN(_ENA_1(O),,A) // OPTION converted to A or '<nul>' #define TERN_(O,A) _TERN(_ENA_1(O),,A) // OPTION ? 'A' : '<nul>'
#define _TERN(E,V...) __TERN(_CAT(T_,E),V) // Prepend 'T_' to get 'T_0' or 'T_1' #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(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. #define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B.
// Macros to avoid 'f + 0.0' which is not always optimized away. Minus included for symmetry.
// Compiler flags -fno-signed-zeros -ffinite-math-only also cover 'f * 1.0', 'f - f', etc.
#define PLUS_TERN0(O,A) _TERN(_ENA_1(O),,+ (A)) // OPTION ? '+ (A)' : '<nul>'
#define MINUS_TERN0(O,A) _TERN(_ENA_1(O),,- (A)) // OPTION ? '- (A)' : '<nul>'
#define SUM_TERN(O,B,A) ((B) PLUS_TERN0(O,A)) // ((B) (OPTION ? '+ (A)' : '<nul>'))
#define DIFF_TERN(O,B,A) ((B) MINUS_TERN0(O,A)) // ((B) (OPTION ? '- (A)' : '<nul>'))
#define IF_ENABLED TERN_ #define IF_ENABLED TERN_
#define IF_DISABLED(O,A) TERN(O,,A) #define IF_DISABLED(O,A) TERN(O,,A)
@@ -230,6 +237,38 @@
memcpy(&a[0],&b[0],_MIN(sizeof(a),sizeof(b))); \ memcpy(&a[0],&b[0],_MIN(sizeof(a),sizeof(b))); \
}while(0) }while(0)
#define CODE_9( A,B,C,D,E,F,G,H,I,...) A; B; C; D; E; F; G; H; I
#define CODE_8( A,B,C,D,E,F,G,H,...) A; B; C; D; E; F; G; H
#define CODE_7( A,B,C,D,E,F,G,...) A; B; C; D; E; F; G
#define CODE_6( A,B,C,D,E,F,...) A; B; C; D; E; F
#define CODE_5( A,B,C,D,E,...) A; B; C; D; E
#define CODE_4( A,B,C,D,...) A; B; C; D
#define CODE_3( A,B,C,...) A; B; C
#define CODE_2( A,B,...) A; B
#define CODE_1( A,...) A
#define _CODE_N(N,V...) CODE_##N(V)
#define CODE_N(N,V...) _CODE_N(N,V)
#define GANG_16(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) A B C D E F G H I J K L M N O P
#define GANG_15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) A B C D E F G H I J K L M N O
#define GANG_14(A,B,C,D,E,F,G,H,I,J,K,L,M,N,...) A B C D E F G H I J K L M N
#define GANG_13(A,B,C,D,E,F,G,H,I,J,K,L,M...) A B C D E F G H I J K L M
#define GANG_12(A,B,C,D,E,F,G,H,I,J,K,L...) A B C D E F G H I J K L
#define GANG_11(A,B,C,D,E,F,G,H,I,J,K,...) A B C D E F G H I J K
#define GANG_10(A,B,C,D,E,F,G,H,I,J,...) A B C D E F G H I J
#define GANG_9( A,B,C,D,E,F,G,H,I,...) A B C D E F G H I
#define GANG_8( A,B,C,D,E,F,G,H,...) A B C D E F G H
#define GANG_7( A,B,C,D,E,F,G,...) A B C D E F G
#define GANG_6( A,B,C,D,E,F,...) A B C D E F
#define GANG_5( A,B,C,D,E,...) A B C D E
#define GANG_4( A,B,C,D,...) A B C D
#define GANG_3( A,B,C,...) A B C
#define GANG_2( A,B,...) A B
#define GANG_1( A,...) A
#define _GANG_N(N,V...) GANG_##N(V)
#define GANG_N(N,V...) _GANG_N(N,V)
#define GANG_N_1(N,K) _GANG_N(N,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K)
// Macros for initializing arrays // Macros for initializing arrays
#define LIST_16(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P #define LIST_16(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P
#define LIST_15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O #define LIST_15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O
@@ -247,10 +286,13 @@
#define LIST_3( A,B,C,...) A,B,C #define LIST_3( A,B,C,...) A,B,C
#define LIST_2( A,B,...) A,B #define LIST_2( A,B,...) A,B
#define LIST_1( A,...) A #define LIST_1( A,...) A
#define LIST_0(...)
#define _LIST_N(N,V...) LIST_##N(V) #define _LIST_N(N,V...) LIST_##N(V)
#define LIST_N(N,V...) _LIST_N(N,V) #define LIST_N(N,V...) _LIST_N(N,V)
#define LIST_N_1(N,K) _LIST_N(N,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K)
#define ARRAY_N(N,V...) { _LIST_N(N,V) } #define ARRAY_N(N,V...) { _LIST_N(N,V) }
#define ARRAY_N_1(N,K) { LIST_N_1(N,K) }
#define _JOIN_1(O) (O) #define _JOIN_1(O) (O)
#define JOIN_N(N,C,V...) (DO(JOIN,C,LIST_N(N,V))) #define JOIN_N(N,C,V...) (DO(JOIN,C,LIST_N(N,V)))
@@ -294,8 +336,12 @@
#define HYPOT(x,y) SQRT(HYPOT2(x,y)) #define HYPOT(x,y) SQRT(HYPOT2(x,y))
// Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments // 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(_,n,m,l,k,j,i,h,g,f,e,d,c,b,a,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) #define NUM_ARGS(V...) _NUM_ARGS(0,V,40,39,38,37,36,35,34,33,32,31,30,29,28,27,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)
// Use TWO_ARGS(__VA_ARGS__) to get whether there are 1, 2, or >2 arguments
#define _TWO_ARGS(_,n,m,l,k,j,i,h,g,f,e,d,c,b,a,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 TWO_ARGS(V...) _TWO_ARGS(0,V,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,0)
#ifdef __cplusplus #ifdef __cplusplus
@@ -318,6 +364,16 @@
#endif #endif
// Allow manipulating enumeration value like flags without ugly cast everywhere
#define ENUM_FLAGS(T) \
FORCE_INLINE constexpr T operator&(T x, T y) { return static_cast<T>(static_cast<int>(x) & static_cast<int>(y)); } \
FORCE_INLINE constexpr T operator|(T x, T y) { return static_cast<T>(static_cast<int>(x) | static_cast<int>(y)); } \
FORCE_INLINE constexpr T operator^(T x, T y) { return static_cast<T>(static_cast<int>(x) ^ static_cast<int>(y)); } \
FORCE_INLINE constexpr T operator~(T x) { return static_cast<T>(~static_cast<int>(x)); } \
FORCE_INLINE T & operator&=(T &x, T y) { return x &= y; } \
FORCE_INLINE T & operator|=(T &x, T y) { return x |= y; } \
FORCE_INLINE T & operator^=(T &x, T y) { return x ^= y; }
// C++11 solution that is standard compliant. <type_traits> is not available on all platform // C++11 solution that is standard compliant. <type_traits> is not available on all platform
namespace Private { namespace Private {
template<bool, typename _Tp = void> struct enable_if { }; template<bool, typename _Tp = void> struct enable_if { };
@@ -357,51 +413,59 @@
return *str ? findStringEnd(str + 1) : str; return *str ? findStringEnd(str + 1) : str;
} }
// Check whether a string contains a slash // Check whether a string contains a specific character
constexpr bool containsSlash(const char *str) { constexpr bool contains(const char *str, const char ch) {
return *str == '/' ? true : (*str ? containsSlash(str + 1) : false); return *str == ch ? true : (*str ? contains(str + 1, ch) : false);
} }
// Find the last position of the slash // Find the last position of the specific character (should be called with findStringEnd)
constexpr const char* findLastSlashPos(const char* str) { constexpr const char* findLastPos(const char *str, const char ch) {
return *str == '/' ? (str + 1) : findLastSlashPos(str - 1); return *str == ch ? (str + 1) : findLastPos(str - 1, ch);
} }
// Compile-time evaluation of the last part of a file path // Compile-time evaluation of the last part of a file path
// Typically used to shorten the path to file in compiled strings // Typically used to shorten the path to file in compiled strings
// CompileTimeString::baseName(__FILE__) returns "macros.h" and not /path/to/Marlin/src/core/macros.h // CompileTimeString::baseName(__FILE__) returns "macros.h" and not /path/to/Marlin/src/core/macros.h
constexpr const char* baseName(const char *str) { constexpr const char* baseName(const char *str) {
return containsSlash(str) ? findLastSlashPos(findStringEnd(str)) : str; return contains(str, '/') ? findLastPos(findStringEnd(str), '/') : str;
}
// Find the first occurence of a character in a string (or return the last position in the string)
constexpr const char* findFirst(const char *str, const char ch) {
return *str == ch || *str == 0 ? (str + 1) : findFirst(str + 1, ch);
}
// Compute the string length at compile time
constexpr unsigned stringLen(const char *str) {
return *str == 0 ? 0 : 1 + stringLen(str + 1);
} }
} }
#define ONLY_FILENAME CompileTimeString::baseName(__FILE__) #define ONLY_FILENAME CompileTimeString::baseName(__FILE__)
/** Get the templated type name. This does not depends on RTTI, but on the preprocessor, so it should be quite safe to use even on old compilers.
WARNING: DO NOT RENAME THIS FUNCTION (or change the text inside the function to match what the preprocessor will generate)
The name is chosen very short since the binary will store "const char* gtn(T*) [with T = YourTypeHere]" so avoid long function name here */
template <typename T>
inline const char* gtn(T*) {
// It works on GCC by instantiating __PRETTY_FUNCTION__ and parsing the result. So the syntax here is very limited to GCC output
constexpr unsigned verboseChatLen = sizeof("const char* gtn(T*) [with T = ") - 1;
static char templateType[sizeof(__PRETTY_FUNCTION__) - verboseChatLen] = {};
__builtin_memcpy(templateType, __PRETTY_FUNCTION__ + verboseChatLen, sizeof(__PRETTY_FUNCTION__) - verboseChatLen - 2);
return templateType;
}
#else #else
#define MIN_2(a,b) ((a)<(b)?(a):(b))
#define MIN_3(a,V...) MIN_2(a,MIN_2(V))
#define MIN_4(a,V...) MIN_2(a,MIN_3(V))
#define MIN_5(a,V...) MIN_2(a,MIN_4(V))
#define MIN_6(a,V...) MIN_2(a,MIN_5(V))
#define MIN_7(a,V...) MIN_2(a,MIN_6(V))
#define MIN_8(a,V...) MIN_2(a,MIN_7(V))
#define MIN_9(a,V...) MIN_2(a,MIN_8(V))
#define MIN_10(a,V...) MIN_2(a,MIN_9(V))
#define __MIN_N(N,V...) MIN_##N(V) #define __MIN_N(N,V...) MIN_##N(V)
#define _MIN_N(N,V...) __MIN_N(N,V) #define _MIN_N(N,V...) __MIN_N(N,V)
#define _MIN(V...) _MIN_N(NUM_ARGS(V), V) #define _MIN_N_REF() _MIN_N
#define _MIN(V...) EVAL(_MIN_N(TWO_ARGS(V),V))
#define MIN_2(a,b) ((a)<(b)?(a):(b))
#define MIN_3(a,V...) MIN_2(a,DEFER2(_MIN_N_REF)()(TWO_ARGS(V),V))
#define MAX_2(a,b) ((a)>(b)?(a):(b))
#define MAX_3(a,V...) MAX_2(a,MAX_2(V))
#define MAX_4(a,V...) MAX_2(a,MAX_3(V))
#define MAX_5(a,V...) MAX_2(a,MAX_4(V))
#define MAX_6(a,V...) MAX_2(a,MAX_5(V))
#define MAX_7(a,V...) MAX_2(a,MAX_6(V))
#define MAX_8(a,V...) MAX_2(a,MAX_7(V))
#define MAX_9(a,V...) MAX_2(a,MAX_8(V))
#define MAX_10(a,V...) MAX_2(a,MAX_9(V))
#define __MAX_N(N,V...) MAX_##N(V) #define __MAX_N(N,V...) MAX_##N(V)
#define _MAX_N(N,V...) __MAX_N(N,V) #define _MAX_N(N,V...) __MAX_N(N,V)
#define _MAX(V...) _MAX_N(NUM_ARGS(V), V) #define _MAX_N_REF() _MAX_N
#define _MAX(V...) EVAL(_MAX_N(TWO_ARGS(V),V))
#define MAX_2(a,b) ((a)>(b)?(a):(b))
#define MAX_3(a,V...) MAX_2(a,DEFER2(_MAX_N_REF)()(TWO_ARGS(V),V))
#endif #endif
@@ -436,6 +500,9 @@
#define ADD8(N) ADD4(ADD4(N)) #define ADD8(N) ADD4(ADD4(N))
#define ADD9(N) ADD4(ADD5(N)) #define ADD9(N) ADD4(ADD5(N))
#define ADD10(N) ADD5(ADD5(N)) #define ADD10(N) ADD5(ADD5(N))
#define SUM(A,B) _CAT(ADD,A)(B)
#define DOUBLE_(n) ADD##n(n)
#define DOUBLE(n) DOUBLE_(n)
// Macros for subtracting // Macros for subtracting
#define DEC_0 0 #define DEC_0 0
@@ -544,6 +611,7 @@
// Repeat a macro passing S...N-1. // Repeat a macro passing S...N-1.
#define REPEAT_S(S,N,OP) EVAL(_REPEAT(S,SUB##S(N),OP)) #define REPEAT_S(S,N,OP) EVAL(_REPEAT(S,SUB##S(N),OP))
#define REPEAT(N,OP) REPEAT_S(0,N,OP) #define REPEAT(N,OP) REPEAT_S(0,N,OP)
#define REPEAT_1(N,OP) REPEAT_S(1,INCREMENT(N),OP)
// Repeat a macro passing 0...N-1 plus additional arguments. // Repeat a macro passing 0...N-1 plus additional arguments.
#define REPEAT2_S(S,N,OP,V...) EVAL(_REPEAT2(S,SUB##S(N),OP,V)) #define REPEAT2_S(S,N,OP,V...) EVAL(_REPEAT2(S,SUB##S(N),OP,V))
+12 -2
View File
@@ -44,6 +44,9 @@ PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMST
#if ENABLED(MEATPACK_ON_SERIAL_PORT_2) #if ENABLED(MEATPACK_ON_SERIAL_PORT_2)
SerialLeafT2 mpSerial2(false, _SERIAL_LEAF_2); SerialLeafT2 mpSerial2(false, _SERIAL_LEAF_2);
#endif #endif
#if ENABLED(MEATPACK_ON_SERIAL_PORT_3)
SerialLeafT3 mpSerial3(false, _SERIAL_LEAF_3);
#endif
// Step 2: For multiserial, handle the second serial port as well // Step 2: For multiserial, handle the second serial port as well
#if HAS_MULTI_SERIAL #if HAS_MULTI_SERIAL
@@ -52,7 +55,14 @@ PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMST
SerialLeafT2 msSerial2(ethernet.have_telnet_client, MYSERIAL2, false); SerialLeafT2 msSerial2(ethernet.have_telnet_client, MYSERIAL2, false);
#endif #endif
SerialOutputT multiSerial(SERIAL_LEAF_1, SERIAL_LEAF_2); #define __S_LEAF(N) ,SERIAL_LEAF_##N
#define _S_LEAF(N) __S_LEAF(N)
SerialOutputT multiSerial( SERIAL_LEAF_1 REPEAT_S(2, INCREMENT(NUM_SERIAL), _S_LEAF) );
#undef __S_LEAF
#undef _S_LEAF
#endif #endif
void serialprintPGM(PGM_P str) { void serialprintPGM(PGM_P str) {
@@ -91,7 +101,7 @@ void print_bin(uint16_t val) {
} }
} }
void print_xyz(const float &x, const float &y, const float &z, PGM_P const prefix/*=nullptr*/, PGM_P const suffix/*=nullptr*/) { void print_pos(const_float_t x, const_float_t y, const_float_t z, PGM_P const prefix/*=nullptr*/, PGM_P const suffix/*=nullptr*/) {
if (prefix) serialprintPGM(prefix); if (prefix) serialprintPGM(prefix);
SERIAL_ECHOPAIR_P(SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z); SERIAL_ECHOPAIR_P(SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z);
if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
+62 -139
View File
@@ -62,7 +62,7 @@ extern uint8_t marlin_debug_flags;
// //
// Serial redirection // Serial redirection
// //
// Step 1: Find what's the first serial leaf // Step 1: Find out what the first serial leaf is
#if BOTH(HAS_MULTI_SERIAL, SERIAL_CATCHALL) #if BOTH(HAS_MULTI_SERIAL, SERIAL_CATCHALL)
#define _SERIAL_LEAF_1 MYSERIAL #define _SERIAL_LEAF_1 MYSERIAL
#else #else
@@ -78,7 +78,8 @@ extern uint8_t marlin_debug_flags;
#define SERIAL_LEAF_1 _SERIAL_LEAF_1 #define SERIAL_LEAF_1 _SERIAL_LEAF_1
#endif #endif
// Step 2: For multiserial, handle the second serial port as well // Step 2: For multiserial wrap all serial ports in a single
// interface with the ability to output to multiple serial ports.
#if HAS_MULTI_SERIAL #if HAS_MULTI_SERIAL
#define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p) #define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
#define _PORT_RESTORE(n,p) RESTORE(n) #define _PORT_RESTORE(n,p) RESTORE(n)
@@ -86,18 +87,17 @@ extern uint8_t marlin_debug_flags;
// If we have a catchall, use that directly // If we have a catchall, use that directly
#ifdef SERIAL_CATCHALL #ifdef SERIAL_CATCHALL
#define _SERIAL_LEAF_2 SERIAL_CATCHALL #define _SERIAL_LEAF_2 SERIAL_CATCHALL
#else #elif HAS_ETHERNET
#if HAS_ETHERNET typedef ConditionalSerial<decltype(MYSERIAL2)> SerialLeafT2; // We need to create an instance here
// We need to create an instance here
typedef ConditionalSerial<decltype(MYSERIAL2)> SerialLeafT2;
extern SerialLeafT2 msSerial2; extern SerialLeafT2 msSerial2;
#define _SERIAL_LEAF_2 msSerial2 #define _SERIAL_LEAF_2 msSerial2
#else #else
// Don't create a useless instance here, directly use the existing instance #define _SERIAL_LEAF_2 MYSERIAL2 // Don't create a useless instance here, directly use the existing instance
#define _SERIAL_LEAF_2 MYSERIAL2
#endif
#endif #endif
// Nothing complicated here
#define _SERIAL_LEAF_3 MYSERIAL3
// Hook Meatpack if it's enabled on the second leaf // Hook Meatpack if it's enabled on the second leaf
#if ENABLED(MEATPACK_ON_SERIAL_PORT_2) #if ENABLED(MEATPACK_ON_SERIAL_PORT_2)
typedef MeatpackSerial<decltype(_SERIAL_LEAF_2)> SerialLeafT2; typedef MeatpackSerial<decltype(_SERIAL_LEAF_2)> SerialLeafT2;
@@ -107,7 +107,23 @@ extern uint8_t marlin_debug_flags;
#define SERIAL_LEAF_2 _SERIAL_LEAF_2 #define SERIAL_LEAF_2 _SERIAL_LEAF_2
#endif #endif
typedef MultiSerial<decltype(SERIAL_LEAF_1), decltype(SERIAL_LEAF_2), 0> SerialOutputT; // Hook Meatpack if it's enabled on the third leaf
#if ENABLED(MEATPACK_ON_SERIAL_PORT_3)
typedef MeatpackSerial<decltype(_SERIAL_LEAF_3)> SerialLeafT3;
extern SerialLeafT3 mpSerial3;
#define SERIAL_LEAF_3 mpSerial3
#else
#define SERIAL_LEAF_3 _SERIAL_LEAF_3
#endif
#define __S_MULTI(N) decltype(SERIAL_LEAF_##N),
#define _S_MULTI(N) __S_MULTI(N)
typedef MultiSerial< REPEAT_1(NUM_SERIAL, _S_MULTI) 0> SerialOutputT;
#undef __S_MULTI
#undef _S_MULTI
extern SerialOutputT multiSerial; extern SerialOutputT multiSerial;
#define SERIAL_IMPL multiSerial #define SERIAL_IMPL multiSerial
#else #else
@@ -144,6 +160,7 @@ void SERIAL_ECHO(T x) { SERIAL_IMPL.print(x); }
typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t; typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t;
inline void SERIAL_ECHO(serial_char_t x) { SERIAL_IMPL.write(x.c); } inline void SERIAL_ECHO(serial_char_t x) { SERIAL_IMPL.write(x.c); }
#define AS_CHAR(C) serial_char_t(C) #define AS_CHAR(C) serial_char_t(C)
#define AS_DIGIT(C) AS_CHAR('0' + (C))
// SERIAL_ECHO_F prints a floating point value with optional precision // SERIAL_ECHO_F prints a floating point value with optional precision
inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, digit); } inline void SERIAL_ECHO_F(EnsureDouble x, int digit=2) { SERIAL_IMPL.print(x, digit); }
@@ -165,139 +182,45 @@ inline void SERIAL_FLUSHTX() { SERIAL_IMPL.flushTX(); }
// Print a single PROGMEM string to serial // Print a single PROGMEM string to serial
void serialprintPGM(PGM_P str); void serialprintPGM(PGM_P str);
// SERIAL_ECHOPAIR / SERIAL_ECHOPAIR_P is used to output a key value pair. The key must be a string and the value can be anything //
// Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR(). // SERIAL_ECHOPAIR... macros are used to output string-value pairs.
//
// Print up to 20 pairs of values. Odd elements must be literal strings.
#define __SEP_N(N,V...) _SEP_##N(V) #define __SEP_N(N,V...) _SEP_##N(V)
#define _SEP_N(N,V...) __SEP_N(N,V) #define _SEP_N(N,V...) __SEP_N(N,V)
#define _SEP_1(PRE) SERIAL_ECHOPGM(PRE) #define _SEP_N_REF() _SEP_N
#define _SEP_2(PRE,V) serial_echopair_PGM(PSTR(PRE),V) #define _SEP_1(s) SERIAL_ECHOPGM(s);
#define _SEP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOPGM(c); }while(0) #define _SEP_2(s,v) serial_echopair_PGM(PSTR(s),v);
#define _SEP_4(a,b,V...) do{ _SEP_2(a,b); _SEP_2(V); }while(0) #define _SEP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SEP_N_REF)()(TWO_ARGS(V),V);
#define _SEP_5(a,b,V...) do{ _SEP_2(a,b); _SEP_3(V); }while(0) #define SERIAL_ECHOPAIR(V...) do{ EVAL(_SEP_N(TWO_ARGS(V),V)); }while(0)
#define _SEP_6(a,b,V...) do{ _SEP_2(a,b); _SEP_4(V); }while(0)
#define _SEP_7(a,b,V...) do{ _SEP_2(a,b); _SEP_5(V); }while(0)
#define _SEP_8(a,b,V...) do{ _SEP_2(a,b); _SEP_6(V); }while(0)
#define _SEP_9(a,b,V...) do{ _SEP_2(a,b); _SEP_7(V); }while(0)
#define _SEP_10(a,b,V...) do{ _SEP_2(a,b); _SEP_8(V); }while(0)
#define _SEP_11(a,b,V...) do{ _SEP_2(a,b); _SEP_9(V); }while(0)
#define _SEP_12(a,b,V...) do{ _SEP_2(a,b); _SEP_10(V); }while(0)
#define _SEP_13(a,b,V...) do{ _SEP_2(a,b); _SEP_11(V); }while(0)
#define _SEP_14(a,b,V...) do{ _SEP_2(a,b); _SEP_12(V); }while(0)
#define _SEP_15(a,b,V...) do{ _SEP_2(a,b); _SEP_13(V); }while(0)
#define _SEP_16(a,b,V...) do{ _SEP_2(a,b); _SEP_14(V); }while(0)
#define _SEP_17(a,b,V...) do{ _SEP_2(a,b); _SEP_15(V); }while(0)
#define _SEP_18(a,b,V...) do{ _SEP_2(a,b); _SEP_16(V); }while(0)
#define _SEP_19(a,b,V...) do{ _SEP_2(a,b); _SEP_17(V); }while(0)
#define _SEP_20(a,b,V...) do{ _SEP_2(a,b); _SEP_18(V); }while(0)
#define _SEP_21(a,b,V...) do{ _SEP_2(a,b); _SEP_19(V); }while(0)
#define _SEP_22(a,b,V...) do{ _SEP_2(a,b); _SEP_20(V); }while(0)
#define _SEP_23(a,b,V...) do{ _SEP_2(a,b); _SEP_21(V); }while(0)
#define _SEP_24(a,b,V...) do{ _SEP_2(a,b); _SEP_22(V); }while(0)
#define SERIAL_ECHOPAIR(V...) _SEP_N(NUM_ARGS(V),V) // Print up to 20 pairs of values followed by newline. Odd elements must be literal strings.
// Print up to 12 pairs of values. Odd elements must be PSTR pointers.
#define __SEP_N_P(N,V...) _SEP_##N##_P(V)
#define _SEP_N_P(N,V...) __SEP_N_P(N,V)
#define _SEP_1_P(PRE) serialprintPGM(PRE)
#define _SEP_2_P(PRE,V) serial_echopair_PGM(PRE,V)
#define _SEP_3_P(a,b,c) do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0)
#define _SEP_4_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_2_P(V); }while(0)
#define _SEP_5_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_3_P(V); }while(0)
#define _SEP_6_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_4_P(V); }while(0)
#define _SEP_7_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_5_P(V); }while(0)
#define _SEP_8_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_6_P(V); }while(0)
#define _SEP_9_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_7_P(V); }while(0)
#define _SEP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_8_P(V); }while(0)
#define _SEP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_9_P(V); }while(0)
#define _SEP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_10_P(V); }while(0)
#define _SEP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_11_P(V); }while(0)
#define _SEP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_12_P(V); }while(0)
#define _SEP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_13_P(V); }while(0)
#define _SEP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_14_P(V); }while(0)
#define _SEP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_15_P(V); }while(0)
#define _SEP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_16_P(V); }while(0)
#define _SEP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_17_P(V); }while(0)
#define _SEP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_18_P(V); }while(0)
#define _SEP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_19_P(V); }while(0)
#define _SEP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_20_P(V); }while(0)
#define _SEP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_21_P(V); }while(0)
#define _SEP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_22_P(V); }while(0)
// SERIAL_ECHOPAIR_P is used to output a key value pair. Unlike SERIAL_ECHOPAIR, the key must be a PGM string already and the value can be anything
#define SERIAL_ECHOPAIR_P(V...) _SEP_N_P(NUM_ARGS(V),V)
// Print up to 12 pairs of values followed by newline
#define __SELP_N(N,V...) _SELP_##N(V) #define __SELP_N(N,V...) _SELP_##N(V)
#define _SELP_N(N,V...) __SELP_N(N,V) #define _SELP_N(N,V...) __SELP_N(N,V)
#define _SELP_1(PRE) SERIAL_ECHOLNPGM(PRE) #define _SELP_N_REF() _SELP_N
#define _SELP_2(PRE,V) do{ serial_echopair_PGM(PSTR(PRE),V); SERIAL_EOL(); }while(0) #define _SELP_1(s) SERIAL_ECHOLNPGM(s);
#define _SELP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOLNPGM(c); }while(0) #define _SELP_2(s,v) serial_echopair_PGM(PSTR(s),v); SERIAL_EOL();
#define _SELP_4(a,b,V...) do{ _SEP_2(a,b); _SELP_2(V); }while(0) #define _SELP_3(s,v,V...) _SEP_2(s,v); DEFER2(_SELP_N_REF)()(TWO_ARGS(V),V);
#define _SELP_5(a,b,V...) do{ _SEP_2(a,b); _SELP_3(V); }while(0) #define SERIAL_ECHOLNPAIR(V...) do{ EVAL(_SELP_N(TWO_ARGS(V),V)); }while(0)
#define _SELP_6(a,b,V...) do{ _SEP_2(a,b); _SELP_4(V); }while(0)
#define _SELP_7(a,b,V...) do{ _SEP_2(a,b); _SELP_5(V); }while(0)
#define _SELP_8(a,b,V...) do{ _SEP_2(a,b); _SELP_6(V); }while(0)
#define _SELP_9(a,b,V...) do{ _SEP_2(a,b); _SELP_7(V); }while(0)
#define _SELP_10(a,b,V...) do{ _SEP_2(a,b); _SELP_8(V); }while(0)
#define _SELP_11(a,b,V...) do{ _SEP_2(a,b); _SELP_9(V); }while(0)
#define _SELP_12(a,b,V...) do{ _SEP_2(a,b); _SELP_10(V); }while(0)
#define _SELP_13(a,b,V...) do{ _SEP_2(a,b); _SELP_11(V); }while(0)
#define _SELP_14(a,b,V...) do{ _SEP_2(a,b); _SELP_12(V); }while(0)
#define _SELP_15(a,b,V...) do{ _SEP_2(a,b); _SELP_13(V); }while(0)
#define _SELP_16(a,b,V...) do{ _SEP_2(a,b); _SELP_14(V); }while(0)
#define _SELP_17(a,b,V...) do{ _SEP_2(a,b); _SELP_15(V); }while(0)
#define _SELP_18(a,b,V...) do{ _SEP_2(a,b); _SELP_16(V); }while(0)
#define _SELP_19(a,b,V...) do{ _SEP_2(a,b); _SELP_17(V); }while(0)
#define _SELP_20(a,b,V...) do{ _SEP_2(a,b); _SELP_18(V); }while(0)
#define _SELP_21(a,b,V...) do{ _SEP_2(a,b); _SELP_19(V); }while(0)
#define _SELP_22(a,b,V...) do{ _SEP_2(a,b); _SELP_20(V); }while(0)
#define _SELP_23(a,b,V...) do{ _SEP_2(a,b); _SELP_21(V); }while(0)
#define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0)
#define _SELP_25(a,b,V...) do{ _SEP_2(a,b); _SELP_23(V); }while(0)
#define _SELP_26(a,b,V...) do{ _SEP_2(a,b); _SELP_24(V); }while(0)
#define _SELP_27(a,b,V...) do{ _SEP_2(a,b); _SELP_25(V); }while(0)
#define _SELP_28(a,b,V...) do{ _SEP_2(a,b); _SELP_26(V); }while(0)
#define _SELP_29(a,b,V...) do{ _SEP_2(a,b); _SELP_27(V); }while(0)
#define _SELP_30(a,b,V...) do{ _SEP_2(a,b); _SELP_28(V); }while(0) // Eat two args, pass the rest up
#define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V) // Print up to 20 pairs of values. Odd elements must be PSTR pointers.
#define __SEP_N_P(N,V...) _SEP_##N##_P(V)
#define _SEP_N_P(N,V...) __SEP_N_P(N,V)
#define _SEP_N_P_REF() _SEP_N_P
#define _SEP_1_P(s) serialprintPGM(s);
#define _SEP_2_P(s,v) serial_echopair_PGM(s,v);
#define _SEP_3_P(s,v,V...) _SEP_2_P(s,v); DEFER2(_SEP_N_P_REF)()(TWO_ARGS(V),V);
#define SERIAL_ECHOPAIR_P(V...) do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
// Print up to 12 pairs of values followed by newline // Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
#define __SELP_N_P(N,V...) _SELP_##N##_P(V) #define __SELP_N_P(N,V...) _SELP_##N##_P(V)
#define _SELP_N_P(N,V...) __SELP_N_P(N,V) #define _SELP_N_P(N,V...) __SELP_N_P(N,V)
#define _SELP_1_P(PRE) serialprintPGM(PRE) #define _SELP_N_P_REF() _SELP_N_P
#define _SELP_2_P(PRE,V) do{ serial_echopair_PGM(PRE,V); SERIAL_EOL(); }while(0) #define _SELP_1_P(s) { serialprintPGM(s); SERIAL_EOL(); }
#define _SELP_3_P(a,b,c) do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0) #define _SELP_2_P(s,v) { serial_echopair_PGM(s,v); SERIAL_EOL(); }
#define _SELP_4_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_2_P(V); }while(0) #define _SELP_3_P(s,v,V...) { _SEP_2_P(s,v); DEFER2(_SELP_N_P_REF)()(TWO_ARGS(V),V); }
#define _SELP_5_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_3_P(V); }while(0) #define SERIAL_ECHOLNPAIR_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
#define _SELP_6_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_4_P(V); }while(0)
#define _SELP_7_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_5_P(V); }while(0)
#define _SELP_8_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_6_P(V); }while(0)
#define _SELP_9_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_7_P(V); }while(0)
#define _SELP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_8_P(V); }while(0)
#define _SELP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_9_P(V); }while(0)
#define _SELP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_10_P(V); }while(0)
#define _SELP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_11_P(V); }while(0)
#define _SELP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_12_P(V); }while(0)
#define _SELP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_13_P(V); }while(0)
#define _SELP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_14_P(V); }while(0)
#define _SELP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_15_P(V); }while(0)
#define _SELP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_16_P(V); }while(0)
#define _SELP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_17_P(V); }while(0)
#define _SELP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_18_P(V); }while(0)
#define _SELP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_19_P(V); }while(0)
#define _SELP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_20_P(V); }while(0)
#define _SELP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_21_P(V); }while(0)
#define _SELP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_22_P(V); }while(0)
#define _SELP_25_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_23_P(V); }while(0)
#define _SELP_26_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_24_P(V); }while(0)
#define _SELP_27_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_25_P(V); }while(0)
#define _SELP_28_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_26_P(V); }while(0)
#define _SELP_29_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_27_P(V); }while(0)
#define _SELP_30_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_28_P(V); }while(0) // Eat two args, pass the rest up
#define SERIAL_ECHOLNPAIR_P(V...) _SELP_N_P(NUM_ARGS(V),V)
#ifdef AllowDifferentTypeInList #ifdef AllowDifferentTypeInList
@@ -387,11 +310,11 @@ void serialprint_truefalse(const bool tf);
void serial_spaces(uint8_t count); void serial_spaces(uint8_t count);
void print_bin(const uint16_t val); void print_bin(const uint16_t val);
void print_xyz(const float &x, const float &y, const float &z, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr); void print_pos(const_float_t x, const_float_t y, const_float_t z, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr);
inline void print_xyz(const xyz_pos_t &xyz, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr) { inline void print_pos(const xyz_pos_t &xyz, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr) {
print_xyz(xyz.x, xyz.y, xyz.z, prefix, suffix); print_pos(xyz.x, xyz.y, xyz.z, prefix, suffix);
} }
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(VAR, PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n")); }while(0) #define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n")); }while(0)
#define SERIAL_XYZ(PREFIX,V...) do { print_xyz(V, PSTR(PREFIX), nullptr); }while(0) #define SERIAL_XYZ(PREFIX,V...) do { print_pos(V, PSTR(PREFIX), nullptr); }while(0)
+48 -20
View File
@@ -45,10 +45,6 @@ struct serial_index_t {
constexpr serial_index_t() : index(-1) {} constexpr serial_index_t() : index(-1) {}
}; };
// flushTX is not implemented in all HAL, so use SFINAE to call the method where it is.
CALL_IF_EXISTS_IMPL(void, flushTX);
CALL_IF_EXISTS_IMPL(bool, connected, true);
// In order to catch usage errors in code, we make the base to encode number explicit // In order to catch usage errors in code, we make the base to encode number explicit
// If given a number (and not this enum), the compiler will reject the overload, falling back to the (double, digit) version // If given a number (and not this enum), the compiler will reject the overload, falling back to the (double, digit) version
// We don't want hidden conversion of the first parameter to double, so it has to be as hard to do for the compiler as creating this enum // We don't want hidden conversion of the first parameter to double, so it has to be as hard to do for the compiler as creating this enum
@@ -59,19 +55,34 @@ enum class PrintBase {
Bin = 2 Bin = 2
}; };
// A simple forward struct that prevent the compiler to select print(double, int) as a default overload for any type different than // A simple feature list enumeration
// double or float. For double or float, a conversion exists so the call will be transparent enum class SerialFeature {
None = 0x00,
MeatPack = 0x01, //!< Enabled when Meatpack is present
BinaryFileTransfer = 0x02, //!< Enabled for BinaryFile transfer support (in the future)
Virtual = 0x04, //!< Enabled for virtual serial port (like Telnet / Websocket / ...)
Hookable = 0x08, //!< Enabled if the serial class supports a setHook method
};
ENUM_FLAGS(SerialFeature);
// flushTX is not implemented in all HAL, so use SFINAE to call the method where it is.
CALL_IF_EXISTS_IMPL(void, flushTX);
CALL_IF_EXISTS_IMPL(bool, connected, true);
CALL_IF_EXISTS_IMPL(SerialFeature, features, SerialFeature::None);
// A simple forward struct to prevent the compiler from selecting print(double, int) as a default overload
// for any type other than double/float. For double/float, a conversion exists so the call will be invisible.
struct EnsureDouble { struct EnsureDouble {
double a; double a;
FORCE_INLINE operator double() { return a; } FORCE_INLINE operator double() { return a; }
// If the compiler breaks on ambiguity here, it's likely because you're calling print(X, base) with X not a double or a float, and a // If the compiler breaks on ambiguity here, it's likely because print(X, base) is called with X not a double/float, and
// base that's not one of PrintBase's value. This exact code is made to detect such error, you NEED to set a base explicitely like this: // a base that's not a PrintBase value. This code is made to detect the error. You MUST set a base explicitly like this:
// SERIAL_PRINT(v, PrintBase::Hex) // SERIAL_PRINT(v, PrintBase::Hex)
FORCE_INLINE EnsureDouble(double a) : a(a) {} FORCE_INLINE EnsureDouble(double a) : a(a) {}
FORCE_INLINE EnsureDouble(float a) : a(a) {} FORCE_INLINE EnsureDouble(float a) : a(a) {}
}; };
// Using Curiously Recurring Template Pattern here to avoid virtual table cost when compiling. // Using Curiously-Recurring Template Pattern here to avoid virtual table cost when compiling.
// Since the real serial class is known at compile time, this results in the compiler writing // Since the real serial class is known at compile time, this results in the compiler writing
// a completely efficient code. // a completely efficient code.
template <class Child> template <class Child>
@@ -85,27 +96,44 @@ struct SerialBase {
SerialBase(const bool) {} SerialBase(const bool) {}
#endif #endif
#define SerialChild static_cast<Child*>(this)
// Static dispatch methods below: // Static dispatch methods below:
// The most important method here is where it all ends to: // The most important method here is where it all ends to:
size_t write(uint8_t c) { return static_cast<Child*>(this)->write(c); } void write(uint8_t c) { SerialChild->write(c); }
// Called when the parser finished processing an instruction, usually build to nothing // Called when the parser finished processing an instruction, usually build to nothing
void msgDone() { static_cast<Child*>(this)->msgDone(); } void msgDone() const { SerialChild->msgDone(); }
// Called upon initialization
void begin(const long baudRate) { static_cast<Child*>(this)->begin(baudRate); } // Called on initialization
// Called upon destruction void begin(const long baudRate) { SerialChild->begin(baudRate); }
void end() { static_cast<Child*>(this)->end(); }
// Called on destruction
void end() { SerialChild->end(); }
/** Check for available data from the port /** Check for available data from the port
@param index The port index, usually 0 */ @param index The port index, usually 0 */
int available(serial_index_t index = 0) { return static_cast<Child*>(this)->available(index); } int available(serial_index_t index=0) const { return SerialChild->available(index); }
/** Read a value from the port /** Read a value from the port
@param index The port index, usually 0 */ @param index The port index, usually 0 */
int read(serial_index_t index = 0) { return static_cast<Child*>(this)->read(index); } int read(serial_index_t index=0) { return SerialChild->read(index); }
/** Combine the features of this serial instance and return it
@param index The port index, usually 0 */
SerialFeature features(serial_index_t index=0) const { return static_cast<const Child*>(this)->features(index); }
// Check if the serial port has a feature
bool has_feature(serial_index_t index, SerialFeature flag) const { return (features(index) & flag) != SerialFeature::None; }
// Check if the serial port is connected (usually bypassed) // Check if the serial port is connected (usually bypassed)
bool connected() { return static_cast<Child*>(this)->connected(); } bool connected() const { return SerialChild->connected(); }
// Redirect flush // Redirect flush
void flush() { static_cast<Child*>(this)->flush(); } void flush() { SerialChild->flush(); }
// Not all implementation have a flushTX, so let's call them only if the child has the implementation // Not all implementation have a flushTX, so let's call them only if the child has the implementation
void flushTX() { CALL_IF_EXISTS(void, static_cast<Child*>(this), flushTX); } void flushTX() { CALL_IF_EXISTS(void, SerialChild, flushTX); }
// Glue code here // Glue code here
FORCE_INLINE void write(const char *str) { while (*str) write(*str++); } FORCE_INLINE void write(const char *str) { while (*str) write(*str++); }
+83 -41
View File
@@ -65,7 +65,9 @@ struct BaseSerial : public SerialBase< BaseSerial<SerialT> >, public SerialT {
bool connected() { return CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected);; } bool connected() { return CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected);; }
void flushTX() { CALL_IF_EXISTS(void, static_cast<SerialT*>(this), flushTX); } void flushTX() { CALL_IF_EXISTS(void, static_cast<SerialT*>(this), flushTX); }
// We have 2 implementation of the same method in both base class, let's say which one we want SerialFeature features(serial_index_t index) const { return CALL_IF_EXISTS(SerialFeature, static_cast<const SerialT*>(this), features, index); }
// Two implementations of the same method exist in both base classes so indicate the right one
using SerialT::available; using SerialT::available;
using SerialT::read; using SerialT::read;
using SerialT::begin; using SerialT::begin;
@@ -102,6 +104,7 @@ struct ConditionalSerial : public SerialBase< ConditionalSerial<SerialT> > {
int read(serial_index_t) { return (int)out.read(); } int read(serial_index_t) { return (int)out.read(); }
int available() { return (int)out.available(); } int available() { return (int)out.available(); }
int read() { return (int)out.read(); } int read() { return (int)out.read(); }
SerialFeature features(serial_index_t index) const { return CALL_IF_EXISTS(SerialFeature, &out, features, index); }
ConditionalSerial(bool & conditionVariable, SerialT & out, const bool e) : BaseClassT(e), condition(conditionVariable), out(out) {} ConditionalSerial(bool & conditionVariable, SerialT & out, const bool e) : BaseClassT(e), condition(conditionVariable), out(out) {}
}; };
@@ -126,11 +129,12 @@ struct ForwardSerial : public SerialBase< ForwardSerial<SerialT> > {
int read(serial_index_t) { return (int)out.read(); } int read(serial_index_t) { return (int)out.read(); }
int available() { return (int)out.available(); } int available() { return (int)out.available(); }
int read() { return (int)out.read(); } int read() { return (int)out.read(); }
SerialFeature features(serial_index_t index) const { return CALL_IF_EXISTS(SerialFeature, &out, features, index); }
ForwardSerial(const bool e, SerialT & out) : BaseClassT(e), out(out) {} ForwardSerial(const bool e, SerialT & out) : BaseClassT(e), out(out) {}
}; };
// A class that's can be hooked and unhooked at runtime, useful to capturing the output of the serial interface // A class that can be hooked and unhooked at runtime, useful to capture the output of the serial interface
template <class SerialT> template <class SerialT>
struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public SerialT { struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public SerialT {
typedef SerialBase< RuntimeSerial<SerialT> > BaseClassT; typedef SerialBase< RuntimeSerial<SerialT> > BaseClassT;
@@ -163,10 +167,16 @@ struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public Seria
// Underlying implementation might use Arduino's bool operator // Underlying implementation might use Arduino's bool operator
bool connected() { bool connected() {
return Private::HasMember_connected<SerialT>::value ? CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected) : static_cast<SerialT*>(this)->operator bool(); return Private::HasMember_connected<SerialT>::value
? CALL_IF_EXISTS(bool, static_cast<SerialT*>(this), connected)
: static_cast<SerialT*>(this)->operator bool();
} }
void flushTX() { CALL_IF_EXISTS(void, static_cast<SerialT*>(this), flushTX); } void flushTX() { CALL_IF_EXISTS(void, static_cast<SerialT*>(this), flushTX); }
// Append Hookable for this class
SerialFeature features(serial_index_t index) const { return SerialFeature::Hookable | CALL_IF_EXISTS(SerialFeature, static_cast<const SerialT*>(this), features, index); }
void setHook(WriteHook writeHook = 0, EndOfMessageHook eofHook = 0, void * userPointer = 0) { void setHook(WriteHook writeHook = 0, EndOfMessageHook eofHook = 0, void * userPointer = 0) {
// Order is important here as serial code can be called inside interrupts // Order is important here as serial code can be called inside interrupts
// When setting a hook, the user pointer must be set first so if writeHook is called as soon as it's set, it'll be valid // When setting a hook, the user pointer must be set first so if writeHook is called as soon as it's set, it'll be valid
@@ -185,56 +195,71 @@ struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public Seria
RuntimeSerial(const bool e, Args... args) : BaseClassT(e), SerialT(args...), writeHook(0), eofHook(0), userPointer(0) {} RuntimeSerial(const bool e, Args... args) : BaseClassT(e), SerialT(args...), writeHook(0), eofHook(0), userPointer(0) {}
}; };
// A class that duplicates its output conditionally to 2 serial interfaces #define _S_CLASS(N) class Serial##N##T,
template <class Serial0T, class Serial1T, const uint8_t offset = 0, const uint8_t step = 1> #define _S_NAME(N) Serial##N##T,
struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > {
typedef SerialBase< MultiSerial<Serial0T, Serial1T, offset, step> > BaseClassT; template < REPEAT(NUM_SERIAL, _S_CLASS) const uint8_t offset=0, const uint8_t step=1 >
struct MultiSerial : public SerialBase< MultiSerial< REPEAT(NUM_SERIAL, _S_NAME) offset, step > > {
typedef SerialBase< MultiSerial< REPEAT(NUM_SERIAL, _S_NAME) offset, step > > BaseClassT;
#undef _S_CLASS
#undef _S_NAME
SerialMask portMask; SerialMask portMask;
Serial0T & serial0;
Serial1T & serial1;
static constexpr uint8_t Usage = ((1 << step) - 1); // A bit mask containing as many bits as step #define _S_DECLARE(N) Serial##N##T & serial##N;
static constexpr uint8_t FirstOutput = (Usage << offset); REPEAT(NUM_SERIAL, _S_DECLARE);
static constexpr uint8_t SecondOutput = (Usage << (offset + step)); #undef _S_DECLARE
static constexpr uint8_t Both = FirstOutput | SecondOutput;
NO_INLINE size_t write(uint8_t c) { static constexpr uint8_t Usage = _BV(step) - 1; // A bit mask containing 'step' bits
size_t ret = 0;
if (portMask.enabled(FirstOutput)) ret = serial0.write(c); #define _OUT_PORT(N) (Usage << (offset + (step * N))),
if (portMask.enabled(SecondOutput)) ret = serial1.write(c) | ret; static constexpr uint8_t output[] = { REPEAT(NUM_SERIAL, _OUT_PORT) };
return ret; #undef _OUT_PORT
#define _OUT_MASK(N) | output[N]
static constexpr uint8_t ALL = 0 REPEAT(NUM_SERIAL, _OUT_MASK);
#undef _OUT_MASK
NO_INLINE void write(uint8_t c) {
#define _S_WRITE(N) if (portMask.enabled(output[N])) serial##N.write(c);
REPEAT(NUM_SERIAL, _S_WRITE);
#undef _S_WRITE
} }
NO_INLINE void msgDone() { NO_INLINE void msgDone() {
if (portMask.enabled(FirstOutput)) serial0.msgDone(); #define _S_DONE(N) if (portMask.enabled(output[N])) serial##N.msgDone();
if (portMask.enabled(SecondOutput)) serial1.msgDone(); REPEAT(NUM_SERIAL, _S_DONE);
#undef _S_DONE
} }
int available(serial_index_t index) { int available(serial_index_t index) {
if (index.within(0 + offset, step + offset - 1)) uint8_t pos = offset;
return serial0.available(index); #define _S_AVAILABLE(N) if (index.within(pos, pos + step - 1)) return serial##N.available(index); else pos += step;
else if (index.within(step + offset, 2 * step + offset - 1)) REPEAT(NUM_SERIAL, _S_AVAILABLE);
return serial1.available(index); #undef _S_AVAILABLE
return false; return false;
} }
int read(serial_index_t index) { int read(serial_index_t index) {
if (index.within(0 + offset, step + offset - 1)) uint8_t pos = offset;
return serial0.read(index); #define _S_READ(N) if (index.within(pos, pos + step - 1)) return serial##N.read(index); else pos += step;
else if (index.within(step + offset, 2 * step + offset - 1)) REPEAT(NUM_SERIAL, _S_READ);
return serial1.read(index); #undef _S_READ
return -1; return -1;
} }
void begin(const long br) { void begin(const long br) {
if (portMask.enabled(FirstOutput)) serial0.begin(br); #define _S_BEGIN(N) if (portMask.enabled(output[N])) serial##N.begin(br);
if (portMask.enabled(SecondOutput)) serial1.begin(br); REPEAT(NUM_SERIAL, _S_BEGIN);
#undef _S_BEGIN
} }
void end() { void end() {
if (portMask.enabled(FirstOutput)) serial0.end(); #define _S_END(N) if (portMask.enabled(output[N])) serial##N.end();
if (portMask.enabled(SecondOutput)) serial1.end(); REPEAT(NUM_SERIAL, _S_END);
#undef _S_END
} }
bool connected() { bool connected() {
bool ret = true; bool ret = true;
if (portMask.enabled(FirstOutput)) ret = CALL_IF_EXISTS(bool, &serial0, connected); #define _S_CONNECTED(N) if (portMask.enabled(output[N]) && !CALL_IF_EXISTS(bool, &serial##N, connected)) ret = false;
if (portMask.enabled(SecondOutput)) ret = ret && CALL_IF_EXISTS(bool, &serial1, connected); REPEAT(NUM_SERIAL, _S_CONNECTED);
#undef _S_CONNECTED
return ret; return ret;
} }
@@ -243,17 +268,31 @@ struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset,
// Redirect flush // Redirect flush
NO_INLINE void flush() { NO_INLINE void flush() {
if (portMask.enabled(FirstOutput)) serial0.flush(); #define _S_FLUSH(N) if (portMask.enabled(output[N])) serial##N.flush();
if (portMask.enabled(SecondOutput)) serial1.flush(); REPEAT(NUM_SERIAL, _S_FLUSH);
#undef _S_FLUSH
} }
NO_INLINE void flushTX() { NO_INLINE void flushTX() {
if (portMask.enabled(FirstOutput)) CALL_IF_EXISTS(void, &serial0, flushTX); #define _S_FLUSHTX(N) if (portMask.enabled(output[N])) CALL_IF_EXISTS(void, &serial0, flushTX);
if (portMask.enabled(SecondOutput)) CALL_IF_EXISTS(void, &serial1, flushTX); REPEAT(NUM_SERIAL, _S_FLUSHTX);
#undef _S_FLUSHTX
} }
MultiSerial(Serial0T & serial0, Serial1T & serial1, const SerialMask mask = Both, const bool e = false) : // Forward feature queries
BaseClassT(e), SerialFeature features(serial_index_t index) const {
portMask(mask), serial0(serial0), serial1(serial1) {} uint8_t pos = offset;
#define _S_FEATURES(N) if (index.within(pos, pos + step - 1)) return serial##N.features(index); else pos += step;
REPEAT(NUM_SERIAL, _S_FEATURES);
#undef _S_FEATURES
return SerialFeature::None;
}
#define _S_REFS(N) Serial##N##T & serial##N,
#define _S_INIT(N) ,serial##N (serial##N)
MultiSerial(REPEAT(NUM_SERIAL, _S_REFS) const SerialMask mask = ALL, const bool e = false)
: BaseClassT(e), portMask(mask) REPEAT(NUM_SERIAL, _S_INIT) {}
}; };
// Build the actual serial object depending on current configuration // Build the actual serial object depending on current configuration
@@ -261,4 +300,7 @@ struct MultiSerial : public SerialBase< MultiSerial<Serial0T, Serial1T, offset,
#define ForwardSerial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, ForwardSerial) #define ForwardSerial1Class TERN(SERIAL_RUNTIME_HOOK, RuntimeSerial, ForwardSerial)
#ifdef HAS_MULTI_SERIAL #ifdef HAS_MULTI_SERIAL
#define Serial2Class ConditionalSerial #define Serial2Class ConditionalSerial
#if NUM_SERIAL >= 3
#define Serial3Class ConditionalSerial
#endif
#endif #endif
+60 -44
View File
@@ -29,34 +29,6 @@
class __FlashStringHelper; class __FlashStringHelper;
typedef const __FlashStringHelper *progmem_str; typedef const __FlashStringHelper *progmem_str;
//
// Enumerated axis indices
//
// - X_AXIS, Y_AXIS, and Z_AXIS should be used for axes in Cartesian space
// - A_AXIS, B_AXIS, and C_AXIS should be used for Steppers, corresponding to XYZ on Cartesians
// - X_HEAD, Y_HEAD, and Z_HEAD should be used for Steppers on Core kinematics
//
enum AxisEnum : uint8_t {
X_AXIS = 0, A_AXIS = 0,
Y_AXIS = 1, B_AXIS = 1,
Z_AXIS = 2, C_AXIS = 2,
E_AXIS = 3,
X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 6,
E0_AXIS = 3,
E1_AXIS, E2_AXIS, E3_AXIS, E4_AXIS, E5_AXIS, E6_AXIS, E7_AXIS,
ALL_AXES = 0xFE, NO_AXIS = 0xFF
};
//
// Loop over XYZE axes
//
#define LOOP_XYZ(VAR) LOOP_S_LE_N(VAR, X_AXIS, Z_AXIS)
#define LOOP_XYZE(VAR) LOOP_S_LE_N(VAR, X_AXIS, E_AXIS)
#define LOOP_XYZE_N(VAR) LOOP_S_L_N(VAR, X_AXIS, XYZE_N)
#define LOOP_ABC(VAR) LOOP_S_LE_N(VAR, A_AXIS, C_AXIS)
#define LOOP_ABCE(VAR) LOOP_S_LE_N(VAR, A_AXIS, E_AXIS)
#define LOOP_ABCE_N(VAR) LOOP_S_L_N(VAR, A_AXIS, XYZE_N)
// //
// Conditional type assignment magic. For example... // Conditional type assignment magic. For example...
// //
@@ -67,21 +39,65 @@ struct IF { typedef R type; };
template <class L, class R> template <class L, class R>
struct IF<true, L, R> { typedef L type; }; struct IF<true, L, R> { typedef L type; };
//
// Enumerated axis indices
//
// - X_AXIS, Y_AXIS, and Z_AXIS should be used for axes in Cartesian space
// - A_AXIS, B_AXIS, and C_AXIS should be used for Steppers, corresponding to XYZ on Cartesians
// - X_HEAD, Y_HEAD, and Z_HEAD should be used for Steppers on Core kinematics
//
enum AxisEnum : uint8_t {
X_AXIS = 0, A_AXIS = X_AXIS,
Y_AXIS = 1, B_AXIS = Y_AXIS,
Z_AXIS = 2, C_AXIS = Z_AXIS,
E_AXIS,
X_HEAD, Y_HEAD, Z_HEAD,
E0_AXIS = E_AXIS,
E1_AXIS, E2_AXIS, E3_AXIS, E4_AXIS, E5_AXIS, E6_AXIS, E7_AXIS,
ALL_AXES_ENUM = 0xFE, NO_AXIS_ENUM = 0xFF
};
//
// Loop over axes
//
#define LOOP_ABC(VAR) LOOP_S_LE_N(VAR, A_AXIS, C_AXIS)
#define LOOP_LINEAR_AXES(VAR) LOOP_S_L_N(VAR, X_AXIS, LINEAR_AXES)
#define LOOP_LOGICAL_AXES(VAR) LOOP_S_L_N(VAR, X_AXIS, LOGICAL_AXES)
#define LOOP_DISTINCT_AXES(VAR) LOOP_S_L_N(VAR, X_AXIS, DISTINCT_AXES)
// //
// feedRate_t is just a humble float // feedRate_t is just a humble float
// //
typedef float feedRate_t; typedef float feedRate_t;
//
// celsius_t is the native unit of temperature. Signed to handle a disconnected thermistor value (-14).
// For more resolition (e.g., for a chocolate printer) this may later be changed to Celsius x 100
//
typedef int16_t celsius_t;
typedef float celsius_float_t;
//
// On AVR pointers are only 2 bytes so use 'const float &' for 'const float'
//
#ifdef __AVR__
typedef const float & const_float_t;
#else
typedef const float const_float_t;
#endif
typedef const_float_t const_feedRate_t;
typedef const_float_t const_celsius_float_t;
// Conversion macros // Conversion macros
#define MMM_TO_MMS(MM_M) feedRate_t(float(MM_M) / 60.0f) #define MMM_TO_MMS(MM_M) feedRate_t(static_cast<float>(MM_M) / 60.0f)
#define MMS_TO_MMM(MM_S) (float(MM_S) * 60.0f) #define MMS_TO_MMM(MM_S) (static_cast<float>(MM_S) * 60.0f)
// //
// Coordinates structures for XY, XYZ, XYZE... // Coordinates structures for XY, XYZ, XYZE...
// //
// Helpers // Helpers
#define _RECIP(N) ((N) ? 1.0f / float(N) : 0.0f) #define _RECIP(N) ((N) ? 1.0f / static_cast<float>(N) : 0.0f)
#define _ABS(N) ((N) < 0 ? -(N) : (N)) #define _ABS(N) ((N) < 0 ? -(N) : (N))
#define _LS(N) (N = (T)(uint32_t(N) << v)) #define _LS(N) (N = (T)(uint32_t(N) << v))
#define _RS(N) (N = (T)(uint32_t(N) >> v)) #define _RS(N) (N = (T)(uint32_t(N) >> v))
@@ -183,8 +199,8 @@ struct XYval {
FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; } FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; }
FI void set(const T (&arr)[XYZ]) { x = arr[0]; y = arr[1]; } FI void set(const T (&arr)[XYZ]) { x = arr[0]; y = arr[1]; }
FI void set(const T (&arr)[XYZE]) { x = arr[0]; y = arr[1]; } FI void set(const T (&arr)[XYZE]) { x = arr[0]; y = arr[1]; }
#if XYZE_N > XYZE #if DISTINCT_AXES > LOGICAL_AXES
FI void set(const T (&arr)[XYZE_N]) { x = arr[0]; y = arr[1]; } FI void set(const T (&arr)[DISTINCT_AXES]) { x = arr[0]; y = arr[1]; }
#endif #endif
FI void reset() { x = y = 0; } FI void reset() { x = y = 0; }
FI T magnitude() const { return (T)sqrtf(x*x + y*y); } FI T magnitude() const { return (T)sqrtf(x*x + y*y); }
@@ -198,8 +214,8 @@ struct XYval {
FI XYval<int32_t> asLong() const { return { int32_t(x), int32_t(y) }; } FI XYval<int32_t> asLong() const { return { int32_t(x), int32_t(y) }; }
FI XYval<int32_t> ROUNDL() { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } FI XYval<int32_t> ROUNDL() { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; }
FI XYval<int32_t> ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; } FI XYval<int32_t> ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)) }; }
FI XYval<float> asFloat() { return { float(x), float(y) }; } FI XYval<float> asFloat() { return { static_cast<float>(x), static_cast<float>(y) }; }
FI XYval<float> asFloat() const { return { float(x), float(y) }; } FI XYval<float> asFloat() const { return { static_cast<float>(x), static_cast<float>(y) }; }
FI XYval<float> reciprocal() const { return { _RECIP(x), _RECIP(y) }; } FI XYval<float> reciprocal() const { return { _RECIP(x), _RECIP(y) }; }
FI XYval<float> asLogical() const { XYval<float> o = asFloat(); toLogical(o); return o; } FI XYval<float> asLogical() const { XYval<float> o = asFloat(); toLogical(o); return o; }
FI XYval<float> asNative() const { XYval<float> o = asFloat(); toNative(o); return o; } FI XYval<float> asNative() const { XYval<float> o = asFloat(); toNative(o); return o; }
@@ -294,8 +310,8 @@ struct XYZval {
FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; } FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; }
FI void set(const T (&arr)[XYZ]) { x = arr[0]; y = arr[1]; z = arr[2]; } FI void set(const T (&arr)[XYZ]) { x = arr[0]; y = arr[1]; z = arr[2]; }
FI void set(const T (&arr)[XYZE]) { x = arr[0]; y = arr[1]; z = arr[2]; } FI void set(const T (&arr)[XYZE]) { x = arr[0]; y = arr[1]; z = arr[2]; }
#if XYZE_N > XYZE #if DISTINCT_AXES > XYZE
FI void set(const T (&arr)[XYZE_N]) { x = arr[0]; y = arr[1]; z = arr[2]; } FI void set(const T (&arr)[DISTINCT_AXES]) { x = arr[0]; y = arr[1]; z = arr[2]; }
#endif #endif
FI void reset() { x = y = z = 0; } FI void reset() { x = y = z = 0; }
FI T magnitude() const { return (T)sqrtf(x*x + y*y + z*z); } FI T magnitude() const { return (T)sqrtf(x*x + y*y + z*z); }
@@ -309,8 +325,8 @@ struct XYZval {
FI XYZval<int32_t> asLong() const { return { int32_t(x), int32_t(y), int32_t(z) }; } FI XYZval<int32_t> asLong() const { return { int32_t(x), int32_t(y), int32_t(z) }; }
FI XYZval<int32_t> ROUNDL() { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)) }; } FI XYZval<int32_t> ROUNDL() { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)) }; }
FI XYZval<int32_t> ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)) }; } FI XYZval<int32_t> ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)) }; }
FI XYZval<float> asFloat() { return { float(x), float(y), float(z) }; } FI XYZval<float> asFloat() { return { static_cast<float>(x), static_cast<float>(y), static_cast<float>(z) }; }
FI XYZval<float> asFloat() const { return { float(x), float(y), float(z) }; } FI XYZval<float> asFloat() const { return { static_cast<float>(x), static_cast<float>(y), static_cast<float>(z) }; }
FI XYZval<float> reciprocal() const { return { _RECIP(x), _RECIP(y), _RECIP(z) }; } FI XYZval<float> reciprocal() const { return { _RECIP(x), _RECIP(y), _RECIP(z) }; }
FI XYZval<float> asLogical() const { XYZval<float> o = asFloat(); toLogical(o); return o; } FI XYZval<float> asLogical() const { XYZval<float> o = asFloat(); toLogical(o); return o; }
FI XYZval<float> asNative() const { XYZval<float> o = asFloat(); toNative(o); return o; } FI XYZval<float> asNative() const { XYZval<float> o = asFloat(); toNative(o); return o; }
@@ -409,8 +425,8 @@ struct XYZEval {
FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; } FI void set(const T (&arr)[XY]) { x = arr[0]; y = arr[1]; }
FI void set(const T (&arr)[XYZ]) { x = arr[0]; y = arr[1]; z = arr[2]; } FI void set(const T (&arr)[XYZ]) { x = arr[0]; y = arr[1]; z = arr[2]; }
FI void set(const T (&arr)[XYZE]) { x = arr[0]; y = arr[1]; z = arr[2]; e = arr[3]; } FI void set(const T (&arr)[XYZE]) { x = arr[0]; y = arr[1]; z = arr[2]; e = arr[3]; }
#if XYZE_N > XYZE #if DISTINCT_AXES > XYZE
FI void set(const T (&arr)[XYZE_N]) { x = arr[0]; y = arr[1]; z = arr[2]; e = arr[3]; } FI void set(const T (&arr)[DISTINCT_AXES]) { x = arr[0]; y = arr[1]; z = arr[2]; e = arr[3]; }
#endif #endif
FI XYZEval<T> copy() const { return *this; } FI XYZEval<T> copy() const { return *this; }
FI XYZEval<T> ABS() const { return { T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(e)) }; } FI XYZEval<T> ABS() const { return { T(_ABS(x)), T(_ABS(y)), T(_ABS(z)), T(_ABS(e)) }; }
@@ -420,8 +436,8 @@ struct XYZEval {
FI XYZEval<int32_t> asLong() const { return { int32_t(x), int32_t(y), int32_t(z), int32_t(e) }; } FI XYZEval<int32_t> asLong() const { return { int32_t(x), int32_t(y), int32_t(z), int32_t(e) }; }
FI XYZEval<int32_t> ROUNDL() { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(e)) }; } FI XYZEval<int32_t> ROUNDL() { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(e)) }; }
FI XYZEval<int32_t> ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(e)) }; } FI XYZEval<int32_t> ROUNDL() const { return { int32_t(LROUND(x)), int32_t(LROUND(y)), int32_t(LROUND(z)), int32_t(LROUND(e)) }; }
FI XYZEval<float> asFloat() { return { float(x), float(y), float(z), float(e) }; } FI XYZEval<float> asFloat() { return { static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), static_cast<float>(e) }; }
FI XYZEval<float> asFloat() const { return { float(x), float(y), float(z), float(e) }; } FI XYZEval<float> asFloat() const { return { static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), static_cast<float>(e) }; }
FI XYZEval<float> reciprocal() const { return { _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(e) }; } FI XYZEval<float> reciprocal() const { return { _RECIP(x), _RECIP(y), _RECIP(z), _RECIP(e) }; }
FI XYZEval<float> asLogical() const { XYZEval<float> o = asFloat(); toLogical(o); return o; } FI XYZEval<float> asLogical() const { XYZEval<float> o = asFloat(); toLogical(o); return o; }
FI XYZEval<float> asNative() const { XYZEval<float> o = asFloat(); toNative(o); return o; } FI XYZEval<float> asNative() const { XYZEval<float> o = asFloat(); toNative(o); return o; }
@@ -500,4 +516,4 @@ struct XYZEval {
#undef FI #undef FI
const xyze_char_t axis_codes { 'X', 'Y', 'Z', 'E' }; const xyze_char_t axis_codes { 'X', 'Y', 'Z', 'E' };
#define XYZ_CHAR(A) ((char)('X' + A)) #define AXIS_CHAR(A) ((char)('X' + A))
+2 -2
View File
@@ -123,9 +123,9 @@ void safe_delay(millis_t ms) {
#endif #endif
#if ABL_PLANAR #if ABL_PLANAR
SERIAL_ECHOPGM("ABL Adjustment X"); SERIAL_ECHOPGM("ABL Adjustment X");
LOOP_XYZ(a) { LOOP_LINEAR_AXES(a) {
const float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a]; const float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
SERIAL_CHAR(' ', XYZ_CHAR(a)); SERIAL_CHAR(' ', AXIS_CHAR(a));
if (v > 0) SERIAL_CHAR('+'); if (v > 0) SERIAL_CHAR('+');
SERIAL_DECIMAL(v); SERIAL_DECIMAL(v);
} }
+2 -3
View File
@@ -25,8 +25,7 @@
#include "../core/types.h" #include "../core/types.h"
#include "../core/millis_t.h" #include "../core/millis_t.h"
// Delay that ensures heaters and watchdog are kept alive void safe_delay(millis_t ms); // Delay ensuring that temperatures are updated and the watchdog is kept alive.
void safe_delay(millis_t ms);
#if ENABLED(SERIAL_OVERRUN_PROTECTION) #if ENABLED(SERIAL_OVERRUN_PROTECTION)
void serial_delay(const millis_t ms); void serial_delay(const millis_t ms);
@@ -34,7 +33,7 @@ void safe_delay(millis_t ms);
inline void serial_delay(const millis_t) {} inline void serial_delay(const millis_t) {}
#endif #endif
#if GRID_MAX_POINTS_X && GRID_MAX_POINTS_Y #if (GRID_MAX_POINTS_X) && (GRID_MAX_POINTS_Y)
// 16x16 bit arrays // 16x16 bit arrays
template <int W, int H> template <int W, int H>
+1 -1
View File
@@ -50,7 +50,7 @@ void Babystep::step_axis(const AxisEnum axis) {
} }
} }
void Babystep::add_mm(const AxisEnum axis, const float &mm) { void Babystep::add_mm(const AxisEnum axis, const_float_t mm) {
add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]); add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]);
} }
+1 -1
View File
@@ -61,7 +61,7 @@ public:
#endif #endif
static void add_steps(const AxisEnum axis, const int16_t distance); static void add_steps(const AxisEnum axis, const int16_t distance);
static void add_mm(const AxisEnum axis, const float &mm); static void add_mm(const AxisEnum axis, const_float_t mm);
static inline bool has_steps() { static inline bool has_steps() {
return steps[BS_AXIS_IND(X_AXIS)] || steps[BS_AXIS_IND(Y_AXIS)] || steps[BS_AXIS_IND(Z_AXIS)]; return steps[BS_AXIS_IND(X_AXIS)] || steps[BS_AXIS_IND(Y_AXIS)] || steps[BS_AXIS_IND(Z_AXIS)];

Some files were not shown because too many files have changed in this diff Show More