Compare commits

...

577 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
thinkyhead 5573d98ecc [cron] Bump distribution date (2021-03-20) 2021-03-20 00:13:15 +00:00
Scott Lahteine 38b44e3fc9 HAL eeprom cleanup 2021-03-19 04:51:41 -05:00
Scott Lahteine d4ab2024f5 Fix bool++ warning 2021-03-19 04:51:41 -05:00
ellensp 790bba1556 Fix preflight motherboard target check (#21372)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-19 00:05:30 -05:00
Skorpi08 b51aed8aa5 Nextion TFT touch screen (#21324)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-18 20:51:19 -05:00
thinkyhead 1f52112d72 [cron] Bump distribution date (2021-03-19) 2021-03-19 00:13:41 +00:00
Scott Lahteine ad907a51e2 Followup to planner cleanup 2021-03-18 00:11:25 -05:00
Scott Lahteine 6673359d89 Move web-ui out of Marlin root folder 2021-03-17 21:36:30 -05:00
Scott Lahteine 560448afed Revert "Fix small wired EEPROM (#21337)"
Reverting commit cc3e878f90 pending further investigation.
2021-03-17 21:36:30 -05:00
Scott Lahteine deaefbf1dc Minor E3 V2 dwin cleanup 2021-03-17 20:06:16 -05:00
Scott Lahteine 9823a37362 E1+ Autotemp and Planner comments 2021-03-17 20:06:16 -05:00
Scott Lahteine 15bda88d04 Un-pause fans on STOP 2021-03-17 19:25:05 -05:00
Scott Lahteine de73b9b934 Update setup() description 2021-03-17 19:25:05 -05:00
thinkyhead 2fc854eda0 [cron] Bump distribution date (2021-03-18) 2021-03-18 00:15:21 +00:00
Scott Lahteine 60607ed18d mftest: usage with error 2021-03-17 02:39:26 -05:00
thinkyhead 546e56ef3d [cron] Bump distribution date (2021-03-17) 2021-03-17 00:13:28 +00:00
Scott Lahteine dc78e0a250 Detect extra ENVS in preflight checks (#21361) 2021-03-16 17:33:10 -05:00
thinkyhead 5ffa6f3331 [cron] Bump distribution date (2021-03-16) 2021-03-16 00:13:07 +00:00
K.3D 1a23ffd776 KRATOS32 / K.32 board and LCD controllers (#21334) 2021-03-15 11:02:40 -05:00
X-Ryl669 c07f99d5e4 Teensy USB / serial followup (#21316) 2021-03-14 20:23:41 -05:00
thinkyhead ae8be31247 [cron] Bump distribution date (2021-03-15) 2021-03-15 00:13:36 +00:00
Victor Oliveira 4f6910c131 Script to generate Marlin TFT Images (#21340) 2021-03-14 12:14:09 -05:00
X-Ryl669 d787cd3076 Fix build with Meatpack only on 2nd port (#21336)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-14 12:11:11 -05:00
Scott Lahteine cc3e878f90 Fix small wired EEPROM (#21337)
Co-Authored-By: jafal99 <26922965+jafal99@users.noreply.github.com>
2021-03-14 11:43:20 -05:00
XDA-Bam b9b9a3115a Update display timing for SKR Pro (#21346) 2021-03-14 11:42:25 -05:00
thinkyhead 36d3b6aa95 [cron] Bump distribution date (2021-03-14) 2021-03-14 00:13:50 +00:00
InsanityAutomation 911cd1a6d3 Custom menu items confirm option (#21338)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-13 07:37:49 -06:00
Victor Oliveira da84b59ee4 No extra build folder for st/jlink upload (#21341) 2021-03-13 05:01:02 -06:00
thinkyhead 11343bb0ea [cron] Bump distribution date (2021-03-13) 2021-03-13 00:16:55 +00:00
Scott Lahteine 3107d8a0f4 Tweak opt_set, opt_enable 2021-03-12 09:29:48 -06:00
Scott Lahteine 7f1fa0d1ff Add M207/8/9 reporting (#21335) 2021-03-12 09:25:41 -06:00
Scott Lahteine 604c5dedf4 MarlinSerial cleanup 2021-03-12 08:38:52 -06:00
Scott Lahteine 71f2617263 Pause SD queue early on M25 (#21317) 2021-03-12 08:34:22 -06:00
Scott Lahteine 8532c2b9b6 Fix MarlinSerial typo 2021-03-12 07:37:50 -06:00
Scott Lahteine 1affbe2100 Clean up, optimize ExtUI/TFT code (#21333) 2021-03-12 06:54:42 -06:00
X-Ryl669 9dc2712c47 Undef unused 2nd serial option(s) (#21331)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-12 05:25:30 -06:00
Evgeny Z 6e1024737d Lerdge-X I²C EEPROM pins, size (#21322) 2021-03-11 20:12:24 -06:00
thinkyhead 03a41021de [cron] Bump distribution date (2021-03-12) 2021-03-12 00:13:16 +00:00
thinkyhead a73cff8e4f [cron] Bump distribution date (2021-03-11) 2021-03-11 00:13:08 +00:00
ellensp 8857fc6c4b Fix password menu stickiness before first auth (#21295) 2021-03-10 16:02:35 -06:00
Evgeny Z f671e6d138 Lerdge-K TMC 2208/9 UART pins (#21299) 2021-03-10 15:02:29 -06:00
Keith Bennett 4d6ebf95fc Fix LERDGE 'extends' env references (#21305)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-10 14:57:54 -06:00
Cal1sto 8c512191b2 Fix TouchMI stow in G34 (#21291) 2021-03-10 14:37:22 -06:00
X-Ryl669 f147a8990a Fix MeatPack with per-serial-port instances (#21306) 2021-03-10 14:22:20 -06:00
Scott Lahteine 048f6b4731 Tricked-out declaration 2021-03-10 13:45:53 -06:00
Scott Lahteine 9cba3c87ef Update MEATPACK test 2021-03-10 13:45:53 -06:00
Scott Lahteine dbd28eecc9 Number serial from 1 to match settings 2021-03-10 13:45:53 -06:00
Scott Lahteine 2c62886c71 Clean up spaces and words 2021-03-10 13:45:53 -06:00
Scott Lahteine fe0b770033 Fix serial index types 2021-03-10 13:45:53 -06:00
Scott Lahteine b75e682c50 Add binary file transfer test 2021-03-10 13:45:53 -06:00
Victor Mateus Oliveira bb6d718e19 fix meat pack internal buffer for multi serial 2021-03-10 06:55:40 -06:00
thinkyhead 28a136d7f4 [cron] Bump distribution date (2021-03-10) 2021-03-10 00:13:12 +00:00
Chris 10ec5c7f34 Fix LPC + TMC boot loop (#21298) 2021-03-09 17:06:00 -06:00
X-Ryl669 55c31fbe9a Distinguish serial index from mask (#21287) 2021-03-09 03:20:37 -06:00
Victor Oliveira 2f1fd4bbaa Host Keepalive followup (#21290)
Followup to #21283

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-08 20:01:45 -06:00
thinkyhead 18a10c0db1 [cron] Bump distribution date (2021-03-09) 2021-03-09 00:13:12 +00:00
ellensp aad0f517b4 CUSTOM_USER_BUTTONS followup (#21284)
Followup to #18389
2021-03-08 04:14:18 -06:00
Victor Oliveira 1b9ff68f8c Fix Host Keepalive serial target (#21283)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-08 01:11:37 -06:00
ellensp aa054471f2 M303 followup (#21282)
Followup to f2ed18d150
2021-03-07 22:06:33 -06:00
thinkyhead f2ff75f3a2 [cron] Bump distribution date (2021-03-08) 2021-03-08 00:18:19 +00:00
Keith Bennett 5dc8f5cfab Extend Heater Overshoot Options (#21273)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-06 22:55:37 -06:00
ellensp ced1bb9404 Update obsolete debug define (#21276) 2021-03-06 21:43:43 -06:00
thinkyhead 9f14127fd6 [cron] Bump distribution date (2021-03-07) 2021-03-07 00:14:45 +00:00
Mike La Spina b95e548ddb Cooler (for Laser) - M143, M193 (#21255) 2021-03-06 14:13:28 -06:00
Scott Lahteine 87bef13a4c Fix DGUS include paths
Followup to #20609
2021-03-06 10:20:01 -06:00
Sola 72cc5a49e6 MKS H43 fixup (#21267)
Co-authored-by: makerbase <4164049@qq.com>
Co-authored-by: MKS-Sean <56996910+MKS-Sean@users.noreply.github.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-06 09:04:05 -06:00
ellensp a94fa7b476 Fix Creality DWIN - Broken (bool)Serial ? (#21272)
Co-authored-by: ellensp <ellensp@hotmsil.com>
2021-03-06 07:19:15 -06:00
Scott Lahteine 43b712d42b Pins/tests followup 2021-03-06 06:58:00 -06:00
Keith Bennett 2c5967925f Pins/tests followup (#21268)
Missing commit from #21254
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-06 03:50:26 -06:00
Zs.Antal 4182cf3e9e Update Hungarian language (#21266) 2021-03-06 02:00:10 -06:00
qwewer0 a1796ecace Link to bugfix tree (#21263) 2021-03-06 01:56:43 -06:00
Keith Bennett 3eb8e26174 Tweak/Consolidate followup (#21261) 2021-03-06 01:53:44 -06:00
thinkyhead d05bf563a2 [cron] Bump distribution date (2021-03-06) 2021-03-06 00:12:57 +00:00
Scott Lahteine 3ea56ba4c7 Tweak tests, consolidate pins target validation (#21254) 2021-03-05 04:30:52 -06:00
thinkyhead f56929d0df [cron] Bump distribution date (2021-03-05) 2021-03-05 00:17:19 +00:00
Victor Oliveira 101f09aabd Fix multi-serial CRC error crash (#21249) 2021-03-04 17:39:08 -06:00
Tanguy Pruvot a0d312396a Followup to MP_SCARA/TPARA patches (#21248) 2021-03-04 17:34:38 -06:00
Scott Lahteine 6903a2ffc5 Remove extra G42 2021-03-04 16:36:44 -06:00
Oleksii Zelivianskyi 8dee12ff05 Correct fan pins for MKS Robin Nano v3 (#21238) 2021-03-04 03:33:02 -06:00
Keith Bennett 9299f4e98a SMUFF => SMuFF (#21243) 2021-03-04 03:32:02 -06:00
Scott Lahteine 6225870aa9 Implement G42, after all 2021-03-04 03:28:45 -06:00
Scott Lahteine dad486c01b MK2_MULTIPLEXER dependency 2021-03-04 03:25:48 -06:00
Scott Lahteine 0b7e857614 Update some py scripts 2021-03-03 20:48:58 -06:00
Scott Lahteine 431f6bf3a5 Parking Extruder solenoid fix/cleanup 2021-03-03 20:48:33 -06:00
Scott Lahteine 9372aa99af Fix teensy35 tests 2021-03-03 20:48:33 -06:00
thinkyhead 81c29ecc7e [cron] Bump distribution date (2021-03-04) 2021-03-04 00:17:17 +00:00
Scott Lahteine dd388aedfd TPARA followup 2021-03-03 17:57:24 -06:00
Axel a46e025725 TPARA - 3DOF robot arm IK (#21005)
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
2021-03-03 17:46:32 -06:00
Scott Lahteine fd270ddc6c misc. cleanup 2021-03-03 00:18:50 -06:00
Scott Lahteine 369ffe518d Improve opt_set (etc.) used for tests 2021-03-03 00:18:50 -06:00
Sola 0afa4cc957 Fix MKS H43 compile (#21240) 2021-03-02 20:58:42 -06:00
thinkyhead 872f031405 [cron] Bump distribution date (2021-03-03) 2021-03-03 00:15:08 +00:00
Scott Lahteine 35791c6371 Trust XY after Quiet Probing short sleep (#21237) 2021-03-01 19:39:43 -06:00
thinkyhead 137f70b122 [cron] Bump distribution date (2021-03-02) 2021-03-02 00:11:00 +00:00
Scott Lahteine dfa33082bb Fix some config builds 2021-03-01 09:14:17 -06:00
Scott Lahteine b2bc85f6f6 build_all_examples -c -s, silent mftest 2021-03-01 09:14:05 -06:00
Scott Lahteine 21372c3d4e Better mftest order 2021-03-01 09:13:54 -06:00
MoellerDi 7ee9aefed7 G-code Digital Buttons (#18389)
Co-Authored-By: android444 <24375898+android444@users.noreply.github.com>
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-03-01 08:03:41 -06:00
Scott Lahteine 8c9a59c29e Fewer warnings 2021-03-01 06:21:51 -06:00
Scott Lahteine 28404f9e87 POWER_LOSS_ZHOME_POS followup 2021-03-01 06:19:38 -06:00
Nick e66e51fa6d Safe Z homing for Power Loss Recovery (#16909) 2021-03-01 04:23:10 -06:00
Ilya 2b9842e094 Default microsteps to axis first stepper (#21230) 2021-03-01 01:33:07 -06:00
Marcio T f52cba6aff Minor FTDI EVE Touch UI fixes (#21232) 2021-02-28 20:52:59 -06:00
Stephan 713de872ce Filament Runout handling for Mixing Extruder (#20327)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-02-28 20:16:22 -06:00
Scott Lahteine 1aa421efe5 Filament sensor cleanup 2021-02-28 20:02:24 -06:00
Scott Lahteine dd42831cba Serial macros cleanup 2021-02-28 20:02:24 -06:00
thinkyhead f0b662ff58 [cron] Bump distribution date (2021-03-01) 2021-03-01 00:13:41 +00:00
Roman Moravčík e8ca077f30 Update Slovak language (#21224) 2021-02-28 16:12:27 -06:00
Fabio Viappiani 2328f8b9b8 Fix TERN typo (#21229) 2021-02-28 16:09:15 -06:00
Scott Lahteine 680172a084 Tweaks to build scripts 2021-02-27 23:51:56 -06:00
Giuliano Zaro 254b25296b [SAMD51] Respect serial buffer size (#21194) 2021-02-27 22:41:16 -06:00
Scott Lahteine 903d0b91fc Tweaks to build scripts 2021-02-27 22:38:57 -06:00
Scott Lahteine 54ccfcc705 whitespace 2021-02-27 22:34:54 -06:00
ldursw dfacd260bb ST STM32 platform version 12 (#21219) 2021-02-27 22:32:34 -06:00
RudolphRiedel 04b83d50a2 Two additional EVE displays (#18839) 2021-02-27 19:39:32 -06:00
thinkyhead 1236585693 [cron] Bump distribution date (2021-02-28) 2021-02-28 00:13:36 +00:00
Sola c76008bd6a MKS H43 controller (#20609) 2021-02-27 17:35:32 -06:00
LinFor e0aa9ce372 RGB Caselight (#20341) 2021-02-27 16:06:48 -06:00
jbuck2005 ee7701c15b SPEED => FEEDRATE (#21217) 2021-02-27 15:54:43 -06:00
Evgeny Z 6e1c133e33 Apply AUTO_POWER_CONTROL later in setup() (#21193)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-02-27 13:50:44 -06:00
Kachidoki 969268166e Duplicate fan speed in M106/7 IDEX Duplication Mode (#21208) 2021-02-27 13:45:12 -06:00
Arjan Mels 83a156ef47 Fix M876 when called from EP (#21210) 2021-02-27 13:32:57 -06:00
Giuliano Zaro 6136959a6a [SAMD51] Postmortem Debugging not implemented (#21211) 2021-02-27 13:24:36 -06:00
Giuliano Zaro 4f840c211c [SMUFF] Use EXTRUDERS for extended commands (#21212) 2021-02-27 13:23:00 -06:00
X-Ryl669 db5967472b Fix G-code Queue merge (#21213) 2021-02-27 13:17:21 -06:00
X-Ryl669 e65a84f6ea G-code Queue followup (#21214) 2021-02-27 13:13:04 -06:00
thinkyhead 526924559f [cron] Bump distribution date (2021-02-27) 2021-02-27 00:12:45 +00:00
Alexander D. Kanevskiy 24623d398c Fix preflight complex extend handling (#21191) 2021-02-26 18:03:11 -06:00
X-Ryl669 56462cf082 Make F_CPU a compile-time constant (#21051) 2021-02-26 17:59:28 -06:00
Victor Oliveira f384f81253 Fix GTR / SKR PRO + USB Flash Drive build (#21197) 2021-02-26 17:36:22 -06:00
Victor Oliveira 427b5d61f4 More LERDGE envs followup (#21205) 2021-02-26 17:33:34 -06:00
Fabio Viappiani e27fba0c06 Fix M355 with NEOPIXEL (#21200) 2021-02-26 17:10:50 -06:00
ldursw 7a1ec78563 Init (stow) BLTouch before X/Y homing (#21192) 2021-02-26 17:01:11 -06:00
X-Ryl669 ec42be346d Fix and improve G-code queue (#21122)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-02-26 16:54:46 -06:00
thinkyhead ccf990a0d7 [cron] Bump distribution date (2021-02-26) 2021-02-26 00:12:56 +00:00
Scott Lahteine fd77251fdd Chamber followup 2021-02-25 10:24:58 -06:00
Vi B-P f7d9305786 Preheat Menu shortcut option (#20350) 2021-02-25 10:23:17 -06:00
swissnorp bcda46e3f3 Combine Z_AFTER_DEACTIVATE with UNKNOWN_Z_NO_RAISE (#20444)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-02-25 10:09:00 -06:00
Victor Oliveira 7fc75fc482 Zero Endstops followup (#21188) 2021-02-25 09:23:30 -06:00
qwewer0 45fff07a4c Fix LEVEL_CORNERS_USE_PROBE with BLTOUCH_HS_MODE (#21161) 2021-02-25 09:21:17 -06:00
Scott Lahteine 08d54b3d78 Eryone Thinker V2 (#21190)
Co-Authored-By: Bryan Joshua Pedini <b.pedini@bjphoster.com>
2021-02-25 09:16:19 -06:00
Katelyn Schiesser 735c1b6183 PROBING_HEATERS_OFF sub-option WAIT_FOR_HOTEND (#20835) 2021-02-25 08:33:16 -06:00
ellensp bb1039d4c9 Preflight checks for PlatformIO builds (#21068)
Co-authored-by: Alexander D. Kanevskiy <alexander.kanevskiy@intel.com>
2021-02-25 08:15:55 -06:00
Katelyn Schiesser a21d4c06ae Use 'H' value for UBL G29 z-clearance (#21114) 2021-02-25 08:14:24 -06:00
Scott Lahteine 12468f5e9f Tweak case light comment 2021-02-25 05:15:49 -06:00
deirdreobyrne 468e437390 Allow Zero Endstops (e.g., for CNC) (#21120)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-02-25 04:49:34 -06:00
Tanguy Pruvot d167af4c38 Add BOARD_PREINIT (for Longer3D open drain pins) (#21159) 2021-02-25 04:35:18 -06:00
Scott Lahteine 3061a31c92 Update BLTOUCH_HS_MODE comment 2021-02-25 01:56:47 -06:00
Nick 73e354b7a0 Fix Anycubic Chiron TFT SD menu (#21183) 2021-02-25 01:38:01 -06:00
X-Ryl669 0cc03f912c Let libmaple accept RX/TX_BUFFER_SIZE (#21177) 2021-02-25 01:26:56 -06:00
X-Ryl669 f003e52009 Combined LPC / Serial fixes (#21178)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-02-25 01:23:29 -06:00
Scott Lahteine 13c4eef637 Expose more env builds in PlatformIO extension 2021-02-25 00:56:15 -06:00
Victor Oliveira d5b06624fb Fix MKS Robin Nano V3 I2C pins (#21174) 2021-02-24 18:36:55 -06:00
Ken Sanislo a3a10b62f2 Chamber Heater PID (#21156)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2021-02-24 18:26:51 -06:00
thinkyhead 03160719eb [cron] Bump distribution date (2021-02-25) 2021-02-25 00:12:36 +00:00
Nick b276a7fd17 Fix Chiron TFT serial comms (#21152) 2021-02-23 20:13:24 -06:00
thinkyhead 37e2250992 [cron] Bump distribution date (2021-02-24) 2021-02-24 00:12:40 +00:00
Scott Lahteine bdb8c07bb2 Outdent UBL code 2021-02-23 16:09:54 -06:00
Scott Lahteine 27f9437d31 G92, subcodes flag cleanup 2021-02-23 16:08:00 -06:00
Marcio T ba301fd800 FTDI Touch UI followup (#21167) 2021-02-23 16:03:40 -06:00
thinkyhead 53d7ae4e9b [cron] Bump distribution date (2021-02-23) 2021-02-23 00:12:43 +00:00
thinkyhead 7a027be255 [cron] Bump distribution date (2021-02-22) 2021-02-22 00:12:47 +00:00
Marcio T ece06c26a9 Enhance and fix FTDI Touch UI (#21148) 2021-02-21 04:05:59 -06:00
X-Ryl669 8d28853774 Postmortem Debugging to serial port (#20492) 2021-02-20 20:22:20 -06:00
kpishere fb8b421aac Fix SPI on SMART RAMPS with mega2560 (#21128) 2021-02-20 20:20:55 -06:00
ellensp b3ecede429 Fix G29 missing defines (#21145)
Co-authored-by: ellensp <ellensp@hotmsil.com>
2021-02-20 20:14:47 -06:00
thinkyhead b8d7925d0d [cron] Bump distribution date (2021-02-21) 2021-02-21 00:13:04 +00:00
thinkyhead 95e0ed2826 [cron] Bump distribution date (2021-02-20) 2021-02-20 00:12:21 +00:00
1412 changed files with 49613 additions and 23958 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ root = true
[{*.patch,syntax_test_*}]
trim_trailing_whitespace = false
[{*.c,*.cpp,*.h}]
[{*.c,*.cpp,*.h,*.ino}]
charset = utf-8
[{*.c,*.cpp,*.h,Makefile}]
[{*.c,*.cpp,*.h,*.ino,Makefile}]
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
+5
View File
@@ -72,6 +72,7 @@ jobs:
# STM32 (ST) Environments
- STM32F103RC_btt_stm32
- STM32F407VE_black
- STM32F401VE_STEVAL
- BIGTREE_BTT002
@@ -86,9 +87,12 @@ jobs:
- FLYF407ZG
- rumba32
- LERDGEX
- LERDGEK
- mks_robin_nano35_stm32
- NUCLEO_F767ZI
- REMRAM_V1
- BTT_SKR_SE_BX
- chitu_f103
# Put lengthy tests last
@@ -98,6 +102,7 @@ jobs:
# Non-working environment tests
#- at90usb1286_cdc
#- STM32F103CB_malyan
#- STM32F103RE
#- mks_robin_mini
steps:
-23
View File
@@ -122,29 +122,6 @@ tags
.gcc-flags.json
/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
Configuration_Secure.h
+227 -106
View File
@@ -35,7 +35,7 @@
*
* Advanced settings can be found in Configuration_adv.h
*/
#define CONFIGURATION_H_VERSION 020008
#define CONFIGURATION_H_VERSION 02000801
//===========================================================================
//============================= Getting Started =============================
@@ -58,23 +58,18 @@
*/
//===========================================================================
//============================= DELTA Printer ===============================
//========================== DELTA / SCARA / TPARA ==========================
//===========================================================================
// For a Delta printer, start with one of the configuration files in the config/examples/delta directory
// from https://github.com/MarlinFirmware/Configurations/branches/all and customize for your machine.
//
//===========================================================================
//============================= SCARA Printer ===============================
//===========================================================================
// For a SCARA printer, start with one of the configuration files in the config/examples/SCARA directory
// from https://github.com/MarlinFirmware/Configurations/branches/all and customize for your machine.
// Download configurations from the link above and customize for your machine.
// Examples are located in config/examples/delta, .../SCARA, and .../TPARA.
//
//===========================================================================
// @section info
// 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)
/**
@@ -110,14 +105,9 @@
#define SERIAL_PORT 0
/**
* 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
/**
* This setting determines the communication speed of the printer.
* Serial Port Baud Rate
* This is the default communication speed for all serial ports.
* Set the baud rate defaults for additional serial ports below.
*
* 250000 works in most cases, but you might try a lower speed if
* you commonly experience drop-outs during host printing.
@@ -126,13 +116,30 @@
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
*/
#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
//#define BLUETOOTH
// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_RAMPS_14_EFB
#define MOTHERBOARD BOARD_ORTUR_4
#endif
// Name displayed in the LCD "Ready" message and Info menu
@@ -165,11 +172,11 @@
* Multi-Material Unit
* Set to one of these predefined models:
*
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
* PRUSA_MMU2 : Průša MMU2
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
* SMUFF_EMU_MMU2 : Technik Gegg SMUFF (Průša MMU2 emulation mode)
* SMUFF_EMU_MMU2S : Technik Gegg SMUFF (Průša MMU2S emulation mode)
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
* PRUSA_MMU2 : Průša MMU2
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
* EXTENDABLE_EMU_MMU2 : MMU with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware)
* 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.
* See additional options in Configuration_adv.h.
@@ -334,8 +341,10 @@
#define AUTO_POWER_E_FANS
#define AUTO_POWER_CONTROLLERFAN
#define AUTO_POWER_CHAMBER_FAN
#define AUTO_POWER_COOLER_FAN
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU if any extruder is over this temperature
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU if the chamber is over this temperature
//#define AUTO_POWER_COOLER_TEMP 26 // (°C) Turn on PSU if the cooler is over this temperature
#define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration
//#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
#endif
@@ -420,9 +429,10 @@
#define TEMP_SENSOR_5 0
#define TEMP_SENSOR_6 0
#define TEMP_SENSOR_7 0
#define TEMP_SENSOR_BED 0
#define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_PROBE 0
#define TEMP_SENSOR_CHAMBER 0
#define TEMP_SENSOR_COOLER 0
// Dummy thermistor constant temperature readings, for use with 998 and 999
#define DUMMY_THERMISTOR_998_VALUE 25
@@ -439,13 +449,17 @@
//#define TEMP_SENSOR_1_AS_REDUNDANT
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109
#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_RESIDENCY_TIME 5 // (seconds) Time to wait for hotend to "settle" in M109
#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_BED_RESIDENCY_TIME 10 // (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_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#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_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_CHAMBER_RESIDENCY_TIME 10 // (seconds) Time to wait for chamber to "settle" in M191
#define TEMP_CHAMBER_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
// Below this temperature the heater will be switched off
// because it probably indicates a broken thermistor wire.
@@ -458,6 +472,7 @@
#define HEATER_6_MINTEMP 5
#define HEATER_7_MINTEMP 5
#define BED_MINTEMP 5
#define CHAMBER_MINTEMP 5
// Above this temperature the heater will be switched off.
// This can protect components from overheating, but NOT from shorts and failures.
@@ -470,7 +485,18 @@
#define HEATER_5_MAXTEMP 275
#define HEATER_6_MAXTEMP 275
#define HEATER_7_MAXTEMP 275
#define BED_MAXTEMP 150
#define BED_MAXTEMP 120
#define CHAMBER_MAXTEMP 60
/**
* Thermal Overshoot
* During heatup (and printing) the temperature can often "overshoot" the target by many degrees
* (especially before PID tuning). Setting the target temperature too close to MAXTEMP guarantees
* a MAXTEMP shutdown! Use these values to forbid temperatures being set too close to MAXTEMP.
*/
#define HOTEND_OVERSHOOT 15 // (°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 ================================
@@ -484,8 +510,8 @@
#define PID_K1 0.95 // Smoothing factor within any PID loop
#if ENABLED(PIDTEMP)
//#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_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_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2]
@@ -519,7 +545,7 @@
* 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.
*/
//#define PIDTEMPBED
#define PIDTEMPBED
//#define BED_LIMIT_SWITCHING
@@ -537,14 +563,58 @@
// 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)
#define DEFAULT_bedKp 10.00
#define DEFAULT_bedKi .023
#define DEFAULT_bedKd 305.4
#define DEFAULT_bedKp 87.23
#define DEFAULT_bedKi 13.31
#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.
#endif // PIDTEMPBED
#if EITHER(PIDTEMP, PIDTEMPBED)
//===========================================================================
//==================== PID > Chamber Temperature Control ====================
//===========================================================================
/**
* PID Chamber Heating
*
* If this option is enabled set PID constants below.
* If this option is disabled, bang-bang will be used and CHAMBER_LIMIT_SWITCHING will enable
* hysteresis.
*
* The PID frequency will be the same as the extruder PWM.
* If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz,
* which is fine for driving a square wave into a resistive load and does not significantly
* impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 200W
* heater. If your configuration is significantly different than this and you don't understand
* the issues involved, don't use chamber PID until someone else verifies that your hardware works.
*/
//#define PIDTEMPCHAMBER
//#define CHAMBER_LIMIT_SWITCHING
/**
* Max Chamber Power
* Applies to all forms of chamber control (PID, bang-bang, and bang-bang with hysteresis).
* When set to any value below 255, enables a form of PWM to the chamber heater that acts like a divider
* so don't use it unless you are OK with PWM on your heater. (See the comment on enabling PIDTEMPCHAMBER)
*/
#define MAX_CHAMBER_POWER 255 // limits duty cycle to chamber heater; 255=full current
#if ENABLED(PIDTEMPCHAMBER)
#define MIN_CHAMBER_POWER 0
//#define PID_CHAMBER_DEBUG // Sends debug data to the serial port.
// Lasko "MyHeat Personal Heater" (200w) modified with a Fotek SSR-10DA to control only the heating element
// and placed inside the small Creality printer enclosure tent.
//
#define DEFAULT_chamberKp 37.04
#define DEFAULT_chamberKi 1.40
#define DEFAULT_chamberKd 655.17
// M309 P37.04 I1.04 D655.17
// FIND YOUR OWN: "M303 E-2 C8 S50" to run autotune on the chamber at 50 degreesC for 8 cycles.
#endif // PIDTEMPCHAMBER
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
//#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
//#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
@@ -591,6 +661,7 @@
#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed
#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
#define THERMAL_PROTECTION_COOLER // Enable thermal protection for the laser cooling
//===========================================================================
//============================= Mechanical Settings =========================
@@ -651,13 +722,13 @@
#endif
// 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 Y_MIN_ENDSTOP_INVERTING false // 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 X_MIN_ENDSTOP_INVERTING true // 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 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 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_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
@@ -740,14 +811,14 @@
* Override with M92
* 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)
* Override with M203
* 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
#if ENABLED(LIMITED_MAX_FR_EDITING)
@@ -760,7 +831,7 @@
* Override with M201
* 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
#if ENABLED(LIMITED_MAX_ACCEL_EDITING)
@@ -775,8 +846,8 @@
* M204 R Retract Acceleration
* M204 T Travel Acceleration
*/
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
#define DEFAULT_ACCELERATION 2000 // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
/**
@@ -787,10 +858,10 @@
* When changing speed and direction, if the difference is less than the
* value set here, it may happen instantaneously.
*/
//#define CLASSIC_JERK
#define CLASSIC_JERK
#if ENABLED(CLASSIC_JERK)
#define DEFAULT_XJERK 10.0
#define DEFAULT_YJERK 10.0
#define DEFAULT_XJERK 15.0
#define DEFAULT_YJERK 15.0
#define DEFAULT_ZJERK 0.3
//#define TRAVEL_EXTRA_XYJERK 0.0 // Additional jerk allowance for all travel moves
@@ -824,7 +895,7 @@
*
* See https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained
*/
//#define S_CURVE_ACCELERATION
#define S_CURVE_ACCELERATION
//===========================================================================
//============================= Z Probe Options =============================
@@ -840,7 +911,7 @@
* The probe replaces the Z-MIN endstop and is used 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
//#define USE_PROBE_FOR_Z_HOMING
@@ -875,13 +946,12 @@
* or (with LCD_BED_LEVELING) the LCD controller.
*/
//#define PROBE_MANUALLY
//#define MANUAL_PROBE_START_Z 0.2
/**
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
* (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
@@ -990,20 +1060,20 @@
* | [-] |
* 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
// 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
#define XY_PROBE_SPEED (133*60)
#define XY_PROBE_FEEDRATE (133*60)
// Feedrate (mm/min) for the first approach when double-probing (MULTIPLE_PROBING == 2)
#define Z_PROBE_SPEED_FAST (4*60)
#define Z_PROBE_FEEDRATE_FAST (10*60)
// Feedrate (mm/min) for the "accurate" probe of each point
#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2)
#define Z_PROBE_FEEDRATE_SLOW (Z_PROBE_FEEDRATE_FAST / 2)
/**
* Probe Activation Switch
@@ -1041,7 +1111,7 @@
* 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.
*/
//#define MULTIPLE_PROBING 2
#define MULTIPLE_PROBING 2
//#define EXTRA_PROBING 1
/**
@@ -1058,16 +1128,16 @@
* 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.
*/
#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_MULTI_PROBE 5 // Z Clearance between multiple probes
//#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
#define Z_PROBE_OFFSET_RANGE_MIN -20
#define Z_PROBE_OFFSET_RANGE_MAX 20
#define Z_PROBE_OFFSET_RANGE_MIN -9
#define Z_PROBE_OFFSET_RANGE_MAX 9
// Enable the M48 repeatability test to test probe accuracy
//#define Z_MIN_PROBE_REPEATABILITY_TEST
@@ -1088,6 +1158,7 @@
//#define PROBING_HEATERS_OFF // Turn heaters off when probing
#if ENABLED(PROBING_HEATERS_OFF)
//#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy)
//#define WAIT_FOR_HOTEND // Wait for hotend to heat back up between probes (to improve accuracy & prevent cold extrude)
#endif
//#define PROBING_FANS_OFF // Turn fans off when probing
//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing
@@ -1126,12 +1197,12 @@
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false
#define INVERT_Y_DIR true
#define INVERT_Z_DIR false
#define INVERT_Z_DIR true
// @section extruder
// 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_E2_DIR false
#define INVERT_E3_DIR false
@@ -1144,7 +1215,13 @@
//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed. Also enable HOME_AFTER_DEACTIVATE for extra safety.
//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated. Also enable NO_MOTION_BEFORE_HOMING for extra safety.
//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off.
/**
* Set Z_IDLE_HEIGHT if the Z-Axis moves on its own when steppers are disabled.
* - Use a low value (i.e., Z_MIN_POS) if the nozzle falls down to the bed.
* - Use a large value (i.e., Z_MAX_POS) if the bed falls down, away from the nozzle.
*/
//#define Z_IDLE_HEIGHT Z_HOME_POS
//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
// Be sure to have this much clearance over your Z_MAX_POS to prevent grinding.
@@ -1159,17 +1236,17 @@
// @section machine
// The size of the print bed
#define X_BED_SIZE 200
#define Y_BED_SIZE 200
// The size of the printable area
#define X_BED_SIZE 255
#define Y_BED_SIZE 300
// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS 0
#define Y_MIN_POS 0
#define X_MIN_POS -10.5
#define Y_MIN_POS -9
#define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 200
#define X_MAX_POS 260
#define Y_MAX_POS 310
#define Z_MAX_POS 295
/**
* Software Endstops
@@ -1197,7 +1274,7 @@
#endif
#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
/**
@@ -1213,7 +1290,7 @@
* 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.
*/
//#define FILAMENT_RUNOUT_SENSOR
#define 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 NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
@@ -1221,6 +1298,8 @@
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
//#define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder.
// This is automatically enabled for MIXING_EXTRUDERs.
// Override individually if the runout sensors vary
//#define FIL_RUNOUT1_STATE LOW
@@ -1255,14 +1334,15 @@
//#define FIL_RUNOUT8_PULLUP
//#define FIL_RUNOUT8_PULLDOWN
// Set one or more commands to execute on filament runout.
// (After 'M412 H' Marlin will ask the host to handle the process.)
// Commands to execute on filament runout.
// With multiple runout sensors use the %c placeholder for the current tool in commands (e.g., "M600 T%c")
// NOTE: After 'M412 H1' the host handles filament runout and this script does not apply.
#define FILAMENT_RUNOUT_SCRIPT "M600"
// After a runout is detected, continue printing this length of filament
// 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.
//#define FILAMENT_RUNOUT_DISTANCE_MM 25
#define FILAMENT_RUNOUT_DISTANCE_MM 5
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
// Enable this option to use an encoder disc that toggles the runout pin
@@ -1312,7 +1392,7 @@
*/
//#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR
//#define AUTO_BED_LEVELING_BILINEAR
#define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING
@@ -1321,13 +1401,13 @@
* these options to restore the prior leveling state or to always enable
* leveling immediately after G28.
*/
//#define RESTORE_LEVELING_AFTER_G28
#define RESTORE_LEVELING_AFTER_G28
//#define ENABLE_LEVELING_AFTER_G28
/**
* Auto-leveling needs preheating
*/
//#define PREHEAT_BEFORE_LEVELING
#define PREHEAT_BEFORE_LEVELING
#if ENABLED(PREHEAT_BEFORE_LEVELING)
#define LEVELING_NOZZLE_TEMP 120 // (°C) Only applies to E0 at this time
#define LEVELING_BED_TEMP 50
@@ -1340,13 +1420,18 @@
*/
//#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)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
#define 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
// For Cartesian machines, instead of dividing moves on mesh boundaries,
@@ -1374,7 +1459,7 @@
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// 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
// Probe along the Y axis, advancing X after each column
@@ -1410,12 +1495,16 @@
#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 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_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
// 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)
//===========================================================================
@@ -1434,27 +1523,27 @@
* Add a bed leveling sub-menu for ABL or MBL.
* Include a guided procedure if manual probing is enabled.
*/
//#define LCD_BED_LEVELING
#define LCD_BED_LEVELING
#if ENABLED(LCD_BED_LEVELING)
#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 MESH_EDIT_MENU // Add a menu to edit mesh points
#define MESH_EDIT_MENU // Add a menu to edit mesh points
#endif
// 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)
#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_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_CORNERS_USE_PROBE
#define LEVEL_CORNERS_USE_PROBE
#if ENABLED(LEVEL_CORNERS_USE_PROBE)
#define LEVEL_CORNERS_PROBE_TOLERANCE 0.1
#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
/**
@@ -1588,12 +1677,12 @@
* M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes)
* 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 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
#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
//
@@ -1624,11 +1713,13 @@
#define PREHEAT_1_LABEL "PLA"
#define PREHEAT_1_TEMP_HOTEND 180
#define PREHEAT_1_TEMP_BED 70
#define PREHEAT_1_TEMP_CHAMBER 35
#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255
#define PREHEAT_2_LABEL "ABS"
#define PREHEAT_2_TEMP_HOTEND 240
#define PREHEAT_2_TEMP_BED 110
#define PREHEAT_2_TEMP_CHAMBER 35
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
/**
@@ -1642,11 +1733,11 @@
* P1 Raise the nozzle always to Z-park height.
* 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)
// 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_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
@@ -1850,7 +1941,7 @@
* 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.
*/
//#define SDSUPPORT
#define SDSUPPORT
/**
* SD CARD: ENABLE CRC
@@ -1897,7 +1988,7 @@
//
// 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.
@@ -1920,7 +2011,7 @@
//
// 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
@@ -1928,7 +2019,7 @@
// If you have a speaker that can produce tones, enable it here.
// 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.
@@ -2109,7 +2200,12 @@
// 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
//
//#define K3D_FULL_GRAPHIC_SMART_CONTROLLER
//
// ReprapWorld Graphical LCD
@@ -2176,7 +2272,8 @@
// MKS LCD12864A/B with graphic controller and SD support. Follows MKS_MINI_12864 pinout.
// 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
@@ -2248,7 +2345,7 @@
//#define OLED_PANEL_TINYBOY2
//
// MKS OLED 1.3" 128×64 FULL GRAPHICS CONTROLLER
// MKS OLED 1.3" 128×64 Full Graphics Controller
// https://reprap.org/wiki/MKS_12864OLED
//
// Tiny, but very sharp OLED display
@@ -2257,7 +2354,7 @@
//#define MKS_12864OLED_SSD1306 // Uses the SSD1306 controller
//
// Zonestar OLED 128×64 FULL GRAPHICS CONTROLLER
// Zonestar OLED 128×64 Full Graphics Controller
//
//#define ZONESTAR_12864LCD // Graphical (DOGM) with ST7920 controller
//#define ZONESTAR_12864OLED // 1.3" OLED with SH1106 controller (default)
@@ -2274,10 +2371,15 @@
//#define OVERLORD_OLED
//
// FYSETC OLED 2.42" 128×64 FULL GRAPHICS CONTROLLER with WS2812 RGB
// FYSETC OLED 2.42" 128×64 Full Graphics Controller with WS2812 RGB
// Where to find : https://www.aliexpress.com/item/4000345255731.html
//#define FYSETC_242_OLED_12864 // Uses the SSD1309 controller
//
// K.3D SSD1309 OLED 2.42" 128×64 Full Graphics Controller
//
//#define K3D_242_OLED_CONTROLLER // Software SPI
//=============================================================================
//========================== Extensible UI Displays ===========================
//=============================================================================
@@ -2291,6 +2393,11 @@
//#define DGUS_LCD_UI_FYSETC
//#define DGUS_LCD_UI_HIPRECY
//#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
//
@@ -2315,6 +2422,14 @@
//#define ANYCUBIC_LCD_DEBUG
#endif
//
// 320x240 Nextion 2.8" serial TFT Resistive Touch Screen NX3224T028
//
//#define NEXTION_TFT
#if ENABLED(NEXTION_TFT)
#define LCD_SERIAL_PORT 1 // Default is 1 for Nextion
#endif
//
// Third-party or vendor-customized controller interfaces.
// Sources should be installed in 'src/lcd/extui'.
@@ -2400,6 +2515,11 @@
//
//#define ANET_ET5_TFT35
//
// 1024x600, 7", RGB Stock Display from BIQU-BX
//
//#define BIQU_BX_TFT70
//
// Generic TFT with detailed options
//
@@ -2456,7 +2576,7 @@
//#define DWIN_CREALITY_LCD
//
// ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8
// Touch Screen Settings
//
//#define TOUCH_SCREEN
#if ENABLED(TOUCH_SCREEN)
@@ -2591,6 +2711,7 @@
// Use a single NeoPixel LED for static (background) lighting
//#define NEOPIXEL_BKGD_LED_INDEX 0 // Index of the LED to use
//#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W
//#define NEOPIXEL_BKGD_ALWAYS_ON // Keep the backlight on when other NeoPixels are off
#endif
/**
+515 -229
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -219,7 +219,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1111)
else ifeq ($(HARDWARE_MOTHERBOARD),1112)
# MKS GEN L
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)
# BigTreeTech or BIQU KFB2.0
else ifeq ($(HARDWARE_MOTHERBOARD),1115)
@@ -323,6 +323,8 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1203)
else ifeq ($(HARDWARE_MOTHERBOARD),1204)
# abee Scoovo X9H
else ifeq ($(HARDWARE_MOTHERBOARD),1205)
# Rambo ThinkerV2
else ifeq ($(HARDWARE_MOTHERBOARD),1206)
#
# Other ATmega1280, ATmega2560
@@ -991,5 +993,5 @@ clean:
.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}}
+10 -1
View File
@@ -25,7 +25,7 @@
#include "HAL.h"
#ifdef USBCON
DefaultSerial MSerial(false, Serial);
DefaultSerial1 MSerial0(false, Serial);
#ifdef BLUETOOTH
BTSerial btSerial(false, bluetoothSerial);
#endif
@@ -58,6 +58,15 @@ void HAL_init() {
#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)
#include "../../sd/SdFatUtil.h"
+18 -11
View File
@@ -83,38 +83,45 @@ typedef int8_t pin_t;
// Serial ports
#ifdef USBCON
#include "../../core/serial_hook.h"
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
extern DefaultSerial MSerial;
typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
extern DefaultSerial1 MSerial0;
#ifdef BLUETOOTH
typedef ForwardSerial0Type< decltype(bluetoothSerial) > BTSerial;
typedef ForwardSerial1Class< decltype(bluetoothSerial) > BTSerial;
extern BTSerial btSerial;
#endif
#define MYSERIAL0 TERN(BLUETOOTH, btSerial, MSerial)
#define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
#else
#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
#define MYSERIAL0 customizedSerial1
#define MYSERIAL1 customizedSerial1
#ifdef SERIAL_PORT_2
#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
#define MYSERIAL1 customizedSerial2
#define MYSERIAL2 customizedSerial2
#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
#ifdef MMU2_SERIAL_PORT
#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
#define MMU2_SERIAL mmuSerial
#endif
#ifdef LCD_SERIAL_PORT
#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
#define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD
@@ -135,7 +142,7 @@ void HAL_init();
inline void HAL_clear_reset_source() { MCUSR = 0; }
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
#pragma GCC diagnostic push
+4 -4
View File
@@ -88,7 +88,7 @@ void spiBegin() {
}
/** SPI read data */
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte-- == 0) return;
SPDR = 0xFF;
for (uint16_t i = 0; i < nbyte; i++) {
@@ -107,7 +107,7 @@ void spiBegin() {
}
/** SPI send block */
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) {
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
@@ -215,7 +215,7 @@ void spiBegin() {
}
// Soft SPI read data
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
buf[i] = spiRec();
}
@@ -242,7 +242,7 @@ void spiBegin() {
}
// Soft SPI send block
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
spiSend(token);
for (uint16_t i = 0; i < 512; i++)
spiSend(buf[i]);
+27 -10
View File
@@ -454,7 +454,7 @@ void MarlinSerial<Cfg>::flush() {
}
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) {
_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
// actually got written
B_TXC = 1;
return 1;
return;
}
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
B_UDRIE = 1;
}
return 1;
}
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
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
#ifdef SERIAL_PORT_2
@@ -583,7 +582,24 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> >;
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
@@ -596,8 +612,9 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
}
template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
MSerialT3 mmuSerial(MSerialT3::HasEmergencyParser);
#endif
MSerialMMU2 mmuSerial(MSerialMMU2::HasEmergencyParser);
#endif // MMU2_SERIAL_PORT
#ifdef LCD_SERIAL_PORT
@@ -610,7 +627,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
}
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
MSerialT4 lcdSerial(MSerialT4::HasEmergencyParser);
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
#if HAS_DGUS_LCD
template<typename Cfg>
@@ -623,13 +640,13 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
}
#endif
#endif
#endif // LCD_SERIAL_PORT
#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
// For AT90USB targets use the UART for BT interfacing
#if defined(USBCON) && ENABLED(BLUETOOTH)
MSerialT5 bluetoothSerial(false);
MSerialBT bluetoothSerial(false);
#endif
#endif // __AVR__
+26 -32
View File
@@ -210,7 +210,7 @@
static int read();
static void flush();
static ring_buffer_pos_t available();
static size_t write(const uint8_t c);
static void write(const uint8_t c);
static void flushTX();
#if HAS_DGUS_LCD
static ring_buffer_pos_t get_tx_buffer_free();
@@ -238,66 +238,60 @@
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
};
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT customizedSerial1;
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
extern MSerialT1 customizedSerial1;
#ifdef SERIAL_PORT_2
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2;
#endif
#ifdef SERIAL_PORT_3
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> > > MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
#endif // !USBCON
#ifdef MMU2_SERIAL_PORT
template <uint8_t serial>
struct MMU2SerialCfg {
static constexpr int PORT = serial;
static constexpr unsigned int RX_SIZE = 32;
static constexpr unsigned int TX_SIZE = 32;
static constexpr bool XONOFF = false;
static constexpr bool EMERGENCYPARSER = false;
static constexpr bool DROPPED_RX = false;
static constexpr bool RX_FRAMING_ERRORS = false;
static constexpr bool MAX_RX_QUEUED = false;
static constexpr unsigned int RX_SIZE = 32;
static constexpr unsigned int TX_SIZE = 32;
static constexpr bool RX_OVERRUNS = false;
};
typedef Serial0Type< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
extern MSerialT3 mmuSerial;
typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialMMU2;
extern MSerialMMU2 mmuSerial;
#endif
#ifdef LCD_SERIAL_PORT
template <uint8_t serial>
struct LCDSerialCfg {
static constexpr int PORT = serial;
static constexpr bool XONOFF = false;
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
static constexpr bool DROPPED_RX = false;
static constexpr bool RX_FRAMING_ERRORS = false;
static constexpr bool MAX_RX_QUEUED = false;
#if HAS_DGUS_LCD
static constexpr unsigned int RX_SIZE = DGUS_RX_BUFFER_SIZE;
static constexpr unsigned int TX_SIZE = DGUS_TX_BUFFER_SIZE;
static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
static constexpr unsigned int RX_SIZE = 64;
static constexpr unsigned int TX_SIZE = 128;
static constexpr bool RX_OVERRUNS = false;
#else
static constexpr unsigned int RX_SIZE = 64;
static constexpr unsigned int TX_SIZE = 128;
static constexpr bool RX_OVERRUNS = false
#endif
static constexpr int PORT = serial;
static constexpr unsigned int RX_SIZE = TERN(HAS_DGUS_LCD, DGUS_RX_BUFFER_SIZE, 64);
static constexpr unsigned int TX_SIZE = TERN(HAS_DGUS_LCD, DGUS_TX_BUFFER_SIZE, 128);
static constexpr bool XONOFF = false;
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
static constexpr bool DROPPED_RX = false;
static constexpr bool RX_FRAMING_ERRORS = false;
static constexpr bool MAX_RX_QUEUED = false;
static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
};
typedef Serial0Type< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
extern MSerialT4 lcdSerial;
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialLCD;
extern MSerialLCD lcdSerial;
#endif
// Use the UART for Bluetooth in AT90USB configurations
#if defined(USBCON) && ENABLED(BLUETOOTH)
typedef Serial0Type<HardwareSerial> MSerialT5;
extern MSerialT5 bluetoothSerial;
typedef Serial1Class<HardwareSerial> MSerialBT;
extern MSerialBT bluetoothSerial;
#endif
+3 -3
View File
@@ -40,13 +40,13 @@ bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
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);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
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.
*/
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;
if (hz > 0 && (dca || dcb || dcc)) {
count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq.
+1 -1
View File
@@ -285,7 +285,7 @@ enum ClockSource2 : char {
*/
// Determine which harware PWMs are already in use
#define _PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == E6_AUTO_FAN_PIN || P == E7_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN)
#define _PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == E6_AUTO_FAN_PIN || P == E7_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN || P == COOLER_AUTO_FAN_PIN)
#if PIN_EXISTS(CONTROLLER_FAN)
#define PWM_CHK_FAN_B(P) (_PWM_CHK_FAN_B(P) || P == CONTROLLER_FAN_PIN)
#else
+7
View File
@@ -56,3 +56,10 @@
#if BOTH(HAS_TMC_SW_SERIAL, MONITOR_DRIVER_STATUS)
#error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue."
#endif
/**
* Postmortem debugging
*/
#if ENABLED(POSTMORTEM_DEBUGGING)
#error "POSTMORTEM_DEBUGGING is not supported on AVR boards."
#endif
+1 -1
View File
@@ -38,7 +38,7 @@
// portModeRegister takes a different argument
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer(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))
#elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70
-342
View File
@@ -1,342 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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/>.
*
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../core/macros.h"
#include "../../core/serial.h"
#include "../shared/backtrace/unwinder.h"
#include "../shared/backtrace/unwmemaccess.h"
#include <stdarg.h>
// Debug monitor that dumps to the Programming port all status when
// an exception or WDT timeout happens - And then resets the board
// All the Monitor routines must run with interrupts disabled and
// under an ISR execution context. That is why we cannot reuse the
// Serial interrupt routines or any C runtime, as we don't know the
// state we are when running them
// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() __asm__ volatile("": : :"memory");
// (re)initialize UART0 as a monitor output to 250000,n,8,1
static void TXBegin() {
// Disable UART interrupt in NVIC
NVIC_DisableIRQ( UART_IRQn );
// We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
__DSB();
__ISB();
// Disable clock
pmc_disable_periph_clk( ID_UART );
// Configure PMC
pmc_enable_periph_clk( ID_UART );
// Disable PDC channel
UART->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
// Reset and disable receiver and transmitter
UART->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS;
// Configure mode: 8bit, No parity, 1 bit stop
UART->UART_MR = UART_MR_CHMODE_NORMAL | US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_NO;
// Configure baudrate (asynchronous, no oversampling) to BAUDRATE bauds
UART->UART_BRGR = (SystemCoreClock / (BAUDRATE << 4));
// Enable receiver and transmitter
UART->UART_CR = UART_CR_RXEN | UART_CR_TXEN;
}
// Send character through UART with no interrupts
static void TX(char c) {
while (!(UART->UART_SR & UART_SR_TXRDY)) { WDT_Restart(WDT); sw_barrier(); };
UART->UART_THR = c;
}
// Send String through UART
static void TX(const char* s) {
while (*s) TX(*s++);
}
static void TXDigit(uint32_t d) {
if (d < 10) TX((char)(d+'0'));
else if (d < 16) TX((char)(d+'A'-10));
else TX('?');
}
// Send Hex number thru UART
static void TXHex(uint32_t v) {
TX("0x");
for (uint8_t i = 0; i < 8; i++, v <<= 4)
TXDigit((v >> 28) & 0xF);
}
// Send Decimal number thru UART
static void TXDec(uint32_t v) {
if (!v) {
TX('0');
return;
}
char nbrs[14];
char *p = &nbrs[0];
while (v != 0) {
*p++ = '0' + (v % 10);
v /= 10;
}
do {
p--;
TX(*p);
} while (p != &nbrs[0]);
}
// Dump a backtrace entry
static bool UnwReportOut(void* ctx, const UnwReport* bte) {
int* p = (int*)ctx;
(*p)++;
TX('#'); TXDec(*p); TX(" : ");
TX(bte->name?bte->name:"unknown"); TX('@'); TXHex(bte->function);
TX('+'); TXDec(bte->address - bte->function);
TX(" PC:");TXHex(bte->address); TX('\n');
return true;
}
#ifdef UNW_DEBUG
void UnwPrintf(const char* format, ...) {
char dest[256];
va_list argptr;
va_start(argptr, format);
vsprintf(dest, format, argptr);
va_end(argptr);
TX(&dest[0]);
}
#endif
/* Table of function pointers for passing to the unwinder */
static const UnwindCallbacks UnwCallbacks = {
UnwReportOut,
UnwReadW,
UnwReadH,
UnwReadB
#ifdef UNW_DEBUG
, UnwPrintf
#endif
};
/**
* HardFaultHandler_C:
* This is called from the HardFault_HandlerAsm with a pointer the Fault stack
* as the parameter. We can then read the values from the stack and place them
* into local variables for ease of reading.
* We then read the various Fault Status and Address Registers to help decode
* cause of the fault.
* The function ends with a BKPT instruction to force control back into the debugger
*/
extern "C"
void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause) {
static const char* causestr[] = {
"NMI","Hard","Mem","Bus","Usage","Debug","WDT","RSTC"
};
UnwindFrame btf;
// Dump report to the Programming port (interrupts are DISABLED)
TXBegin();
TX("\n\n## Software Fault detected ##\n");
TX("Cause: "); TX(causestr[cause]); TX('\n');
TX("R0 : "); TXHex(((unsigned long)sp[0])); TX('\n');
TX("R1 : "); TXHex(((unsigned long)sp[1])); TX('\n');
TX("R2 : "); TXHex(((unsigned long)sp[2])); TX('\n');
TX("R3 : "); TXHex(((unsigned long)sp[3])); TX('\n');
TX("R12 : "); TXHex(((unsigned long)sp[4])); TX('\n');
TX("LR : "); TXHex(((unsigned long)sp[5])); TX('\n');
TX("PC : "); TXHex(((unsigned long)sp[6])); TX('\n');
TX("PSR : "); TXHex(((unsigned long)sp[7])); TX('\n');
// Configurable Fault Status Register
// Consists of MMSR, BFSR and UFSR
TX("CFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED28)))); TX('\n');
// Hard Fault Status Register
TX("HFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED2C)))); TX('\n');
// Debug Fault Status Register
TX("DFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED30)))); TX('\n');
// Auxiliary Fault Status Register
TX("AFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED3C)))); TX('\n');
// Read the Fault Address Registers. These may not contain valid values.
// Check BFARVALID/MMARVALID to see if they are valid values
// MemManage Fault Address Register
TX("MMAR : "); TXHex((*((volatile unsigned long *)(0xE000ED34)))); TX('\n');
// Bus Fault Address Register
TX("BFAR : "); TXHex((*((volatile unsigned long *)(0xE000ED38)))); TX('\n');
TX("ExcLR: "); TXHex(lr); TX('\n');
TX("ExcSP: "); TXHex((unsigned long)sp); TX('\n');
btf.sp = ((unsigned long)sp) + 8*4; // The original stack pointer
btf.fp = btf.sp;
btf.lr = ((unsigned long)sp[5]);
btf.pc = ((unsigned long)sp[6]) | 1; // Force Thumb, as CORTEX only support it
// Perform a backtrace
TX("\nBacktrace:\n\n");
int ctr = 0;
UnwindStart(&btf, &UnwCallbacks, &ctr);
// Disable all NVIC interrupts
NVIC->ICER[0] = 0xFFFFFFFF;
NVIC->ICER[1] = 0xFFFFFFFF;
// Relocate VTOR table to default position
SCB->VTOR = 0;
// Disable USB
otg_disable();
// Restart watchdog
WDT_Restart(WDT);
// Reset controller
NVIC_SystemReset();
for (;;) WDT_Restart(WDT);
}
__attribute__((naked)) void NMI_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#0")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void HardFault_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#1")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void MemManage_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#2")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void BusFault_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#3")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void UsageFault_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#4")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void DebugMon_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#5")
A("b HardFault_HandlerC")
);
}
/* This is NOT an exception, it is an interrupt handler - Nevertheless, the framing is the same */
__attribute__((naked)) void WDT_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#6")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void RSTC_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#7")
A("b HardFault_HandlerC")
);
}
#endif // ARDUINO_ARCH_SAM
+13 -8
View File
@@ -40,6 +40,8 @@ uint16_t HAL_adc_result;
// Public functions
// ------------------------
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
// HAL initialization task
void HAL_init() {
// Initialize the USB stack
@@ -47,6 +49,7 @@ void HAL_init() {
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif
usb_task_init();
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
}
// HAL idle task
@@ -74,6 +77,8 @@ uint8_t HAL_get_reset_source() {
}
}
void HAL_reboot() { rstc_start_software_reset(RSTC); }
void _delay_ms(const int delay_ms) {
// Todo: port for Due?
delay(delay_ms);
@@ -103,17 +108,17 @@ uint16_t HAL_adc_get_result() {
}
// Forward the default serial ports
#if ANY_SERIAL_IS(0)
DefaultSerial MSerial(false, Serial);
#if USING_HW_SERIAL0
DefaultSerial1 MSerial0(false, Serial);
#endif
#if ANY_SERIAL_IS(1)
DefaultSerial1 MSerial1(false, Serial1);
#if USING_HW_SERIAL1
DefaultSerial2 MSerial1(false, Serial1);
#endif
#if ANY_SERIAL_IS(2)
DefaultSerial2 MSerial2(false, Serial2);
#if USING_HW_SERIAL2
DefaultSerial3 MSerial2(false, Serial2);
#endif
#if ANY_SERIAL_IS(3)
DefaultSerial3 MSerial3(false, Serial3);
#if USING_HW_SERIAL3
DefaultSerial4 MSerial3(false, Serial3);
#endif
#endif // ARDUINO_ARCH_SAM
+28 -22
View File
@@ -38,35 +38,43 @@
#include "../../core/serial_hook.h"
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2;
typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3;
extern DefaultSerial MSerial;
extern DefaultSerial1 MSerial1;
extern DefaultSerial2 MSerial2;
extern DefaultSerial3 MSerial3;
typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
typedef ForwardSerial1Class< decltype(Serial1) > DefaultSerial2;
typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
typedef ForwardSerial1Class< decltype(Serial3) > DefaultSerial4;
extern DefaultSerial1 MSerial0;
extern DefaultSerial2 MSerial1;
extern DefaultSerial3 MSerial2;
extern DefaultSerial4 MSerial3;
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
#define MSerial0 MSerial
// Define MYSERIAL0/1 before MarlinSerial includes!
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL0 customizedSerial1
#define MYSERIAL1 customizedSerial1
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL1 customizedSerial2
#define MYSERIAL2 customizedSerial2
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@@ -74,17 +82,15 @@ extern DefaultSerial3 MSerial3;
#if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
#ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1
#define LCD_SERIAL lcdSerial
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#if WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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
@@ -114,7 +120,7 @@ void sei(); // Enable interrupts
void HAL_clear_reset_source(); // clear 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
+91
View File
@@ -0,0 +1,91 @@
/**
* 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/>.
*
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(POSTMORTEM_DEBUGGING)
#include "../shared/HAL_MinSerial.h"
#include <stdarg.h>
static void TXBegin() {
// Disable UART interrupt in NVIC
NVIC_DisableIRQ( UART_IRQn );
// We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
__DSB();
__ISB();
// Disable clock
pmc_disable_periph_clk( ID_UART );
// Configure PMC
pmc_enable_periph_clk( ID_UART );
// Disable PDC channel
UART->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
// Reset and disable receiver and transmitter
UART->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS;
// Configure mode: 8bit, No parity, 1 bit stop
UART->UART_MR = UART_MR_CHMODE_NORMAL | US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_NO;
// Configure baudrate (asynchronous, no oversampling) to BAUDRATE bauds
UART->UART_BRGR = (SystemCoreClock / (BAUDRATE << 4));
// Enable receiver and transmitter
UART->UART_CR = UART_CR_RXEN | UART_CR_TXEN;
}
// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() __asm__ volatile("": : :"memory");
static void TX(char c) {
while (!(UART->UART_SR & UART_SR_TXRDY)) { WDT_Restart(WDT); sw_barrier(); };
UART->UART_THR = c;
}
void install_min_serial() {
HAL_min_serial_init = &TXBegin;
HAL_min_serial_out = &TX;
}
#if DISABLED(DYNAMIC_VECTORTABLE)
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"))) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) NMI_Handler();
}
#endif
#endif // POSTMORTEM_DEBUGGING
#endif // ARDUINO_ARCH_SAM
+15 -15
View File
@@ -56,8 +56,8 @@
#pragma GCC optimize (3)
typedef uint8_t (*pfnSpiTransfer)(uint8_t b);
typedef void (*pfnSpiRxBlock)(uint8_t* buf, uint32_t nbyte);
typedef void (*pfnSpiTxBlock)(const uint8_t* buf, uint32_t nbyte);
typedef void (*pfnSpiRxBlock)(uint8_t *buf, uint32_t nbyte);
typedef void (*pfnSpiTxBlock)(const uint8_t *buf, uint32_t nbyte);
/* ---------------- Macros to be able to access definitions from asm */
#define _PORT(IO) DIO ## IO ## _WPORT
@@ -270,7 +270,7 @@
static pfnSpiTransfer spiTransferTx = (pfnSpiTransfer)spiTransferX;
// Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded)
static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) {
static void spiTxBlock0(const uint8_t *ptr, uint32_t todo) {
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */
uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN);
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
@@ -349,7 +349,7 @@
);
}
static void spiRxBlock0(uint8_t* ptr, uint32_t todo) {
static void spiRxBlock0(uint8_t *ptr, uint32_t todo) {
uint32_t bin = 0;
uint32_t work = 0;
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */
@@ -425,13 +425,13 @@
);
}
static void spiTxBlockX(const uint8_t* buf, uint32_t todo) {
static void spiTxBlockX(const uint8_t *buf, uint32_t todo) {
do {
(void)spiTransferTx(*buf++);
} while (--todo);
}
static void spiRxBlockX(uint8_t* buf, uint32_t todo) {
static void spiRxBlockX(uint8_t *buf, uint32_t todo) {
do {
*buf++ = spiTransferRx(0xFF);
} while (--todo);
@@ -463,7 +463,7 @@
return b;
}
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte) {
_SS_WRITE(LOW);
WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1
@@ -478,7 +478,7 @@
_SS_WRITE(HIGH);
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
_SS_WRITE(LOW);
(void)spiTransferTx(token);
spiTxBlock(buf, 512);
@@ -645,7 +645,7 @@
}
// Read from SPI into buffer
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (!nbyte) return;
--nbyte;
for (int i = 0; i < nbyte; i++) {
@@ -668,7 +668,7 @@
//DELAY_US(1U);
}
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
if (!nbyte) return;
--nbyte;
for (size_t i = 0; i < nbyte; i++) {
@@ -689,7 +689,7 @@
FLUSH_RX();
}
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {
if (!nbyte) return;
--nbyte;
for (size_t i = 0; i < nbyte; i++) {
@@ -702,7 +702,7 @@
}
// Write from buffer to SPI
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN);
WHILE_TX(0);
//WHILE_RX(0);
@@ -801,19 +801,19 @@
uint8_t spiRec() { return (uint8_t)spiTransfer(0xFF); }
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
for (int i = 0; i < nbyte; i++)
buf[i] = spiTransfer(0xFF);
}
void spiSend(uint8_t data) { spiTransfer(data); }
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
spiTransfer(buf[i]);
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
spiTransfer(buf[i]);
+7 -2
View File
@@ -476,9 +476,9 @@ void MarlinSerial<Cfg>::flushTX() {
// 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> >;
MSerialT customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
MSerialT1 customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
#endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
@@ -486,4 +486,9 @@ void MarlinSerial<Cfg>::flushTX() {
MSerialT2 customizedSerial2(MarlinSerialCfg<SERIAL_PORT_2>::EMERGENCYPARSER);
#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
+9 -4
View File
@@ -140,12 +140,17 @@ struct MarlinSerialCfg {
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
};
#if SERIAL_PORT >= 0
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT customizedSerial1;
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1;
extern MSerialT1 customizedSerial1;
#endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
typedef Serial0Type< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2;
#endif
#if defined(SERIAL_PORT_3) && SERIAL_PORT_3 >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> > > MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
+13 -11
View File
@@ -19,13 +19,13 @@
* 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
* Copyright (c) 2017 Eduardo José Tagle. All right reserved
* Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved.
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfig.h"
@@ -65,7 +65,7 @@ int MarlinSerialUSB::peek() {
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;
}
@@ -87,17 +87,16 @@ int MarlinSerialUSB::read() {
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;
}
bool MarlinSerialUSB::available() {
/* If Pending chars */
return pending_char >= 0 ||
/* or USB CDC enumerated and configured on the PC side and some
bytes where sent to us */
(usb_task_cdc_isenabled() && udi_cdc_is_rx_ready());
int MarlinSerialUSB::available() {
if (pending_char > 0) return pending_char;
return pending_char == 0 ||
// or USB CDC enumerated and configured on the PC side and some bytes where sent to us */
(usb_task_cdc_isenabled() && udi_cdc_is_rx_ready());
}
void MarlinSerialUSB::flush() { }
@@ -130,10 +129,13 @@ size_t MarlinSerialUSB::write(const uint8_t c) {
// Preinstantiate
#if SERIAL_PORT == -1
MSerialT customizedSerial1(TERN0(EMERGENCY_PARSER, true));
MSerialT1 customizedSerial1(TERN0(EMERGENCY_PARSER, true));
#endif
#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 // HAS_USB_SERIAL
+10 -8
View File
@@ -27,11 +27,9 @@
*/
#include "../../inc/MarlinConfig.h"
#if HAS_USB_SERIAL
#include <WString.h>
#include "../../core/serial_hook.h"
#include <WString.h>
struct MarlinSerialUSB {
void begin(const long);
@@ -39,7 +37,7 @@ struct MarlinSerialUSB {
int peek();
int read();
void flush();
bool available();
int available();
size_t write(const uint8_t c);
#if ENABLED(SERIAL_STATS_DROPPED_RX)
@@ -50,14 +48,18 @@ struct MarlinSerialUSB {
FORCE_INLINE int rxMaxEnqueued() { return 0; }
#endif
};
typedef Serial0Type<MarlinSerialUSB> MSerialT;
#if SERIAL_PORT == -1
extern MSerialT customizedSerial1;
typedef Serial1Class<MarlinSerialUSB> MSerialT1;
extern MSerialT1 customizedSerial1;
#endif
#if SERIAL_PORT_2 == -1
extern MSerialT customizedSerial2;
typedef Serial1Class<MarlinSerialUSB> MSerialT2;
extern MSerialT2 customizedSerial2;
#endif
#endif // HAS_USB_SERIAL
#if SERIAL_PORT_3 == -1
typedef Serial1Class<MarlinSerialUSB> MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
+12 -13
View File
@@ -135,11 +135,11 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes
#define DEBUG_OUT ENABLED(EE_EMU_DEBUG)
#include "../../core/debug_out.h"
static void ee_Dump(const int page, const void* data) {
static void ee_Dump(const int page, const void *data) {
#ifdef EE_EMU_DEBUG
const uint8_t* c = (const uint8_t*) data;
const uint8_t *c = (const uint8_t*) data;
char buffer[80];
sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page);
@@ -181,7 +181,7 @@ static void ee_Dump(const int page, const void* data) {
* @param data (pointer to the data buffer)
*/
__attribute__ ((long_call, section (".ramfunc")))
static bool ee_PageWrite(uint16_t page, const void* data) {
static bool ee_PageWrite(uint16_t page, const void *data) {
uint16_t i;
uint32_t addrflash = uint32_t(getFlashStorage(page));
@@ -293,8 +293,8 @@ static bool ee_PageWrite(uint16_t page, const void* data) {
ee_Dump(-page, data);
// Calculate count of changed bits
uint32_t* p1 = (uint32_t*)addrflash;
uint32_t* p2 = (uint32_t*)data;
uint32_t *p1 = (uint32_t*)addrflash;
uint32_t *p2 = (uint32_t*)data;
int count = 0;
for (i =0; i<PageSize >> 2; i++) {
if (p1[i] != p2[i]) {
@@ -470,7 +470,7 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) {
// Get a pointer to the flash page
uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
@@ -550,7 +550,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) {
// Get a pointer to the flash page
uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
@@ -589,7 +589,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
}
static bool ee_IsPageClean(int page) {
uint32_t* pflash = (uint32_t*) getFlashStorage(page);
uint32_t *pflash = (uint32_t*) getFlashStorage(page);
for (uint16_t i = 0; i < (PageSize >> 2); ++i)
if (*pflash++ != 0xFFFFFFFF) return false;
return true;
@@ -599,7 +599,7 @@ static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData
// Check if RAM buffer has something to be written
bool isEmpty = true;
uint32_t* p = (uint32_t*) &buffer[0];
uint32_t *p = (uint32_t*) &buffer[0];
for (uint16_t j = 0; j < (PageSize >> 2); j++) {
if (*p++ != 0xFFFFFFFF) {
isEmpty = false;
@@ -976,14 +976,13 @@ bool PersistentStore::access_start() { ee_Init(); 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) {
uint16_t written = 0;
while (size--) {
uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != ee_Read(uint32_t(p))) {
if (v != ee_Read(uint32_t(p))) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
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) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
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::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
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);
delay(2);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
+1 -1
View File
@@ -33,7 +33,7 @@
* For ARDUINO_ARCH_SAM
* 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
* 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!!
*/
+1 -1
View File
@@ -57,5 +57,5 @@
#endif
#if HAS_TMC_SW_SERIAL
#error "TMC220x Software Serial is not supported on this platform."
#error "TMC220x Software Serial is not supported on the DUE platform."
#endif
+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) {
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
*nb_sector = card.getSd2Card().cardSize() - 1;
*nb_sector = card.diskIODriver()->cardSize() - 1;
return CTRL_GOOD;
}
@@ -74,24 +74,24 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#endif
// Start reading
if (!card.getSd2Card().readStart(addr))
if (!card.diskIODriver()->readStart(addr))
return CTRL_FAIL;
// For each specified sector
while (nb_sector--) {
// Read a sector
card.getSd2Card().readData(sector_buf);
card.diskIODriver()->readData(sector_buf);
// RAM -> USB
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.getSd2Card().readStop();
card.diskIODriver()->readStop();
return CTRL_FAIL;
}
}
// Stop reading
card.getSd2Card().readStop();
card.diskIODriver()->readStop();
// Done
return CTRL_GOOD;
@@ -113,7 +113,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
}
#endif
if (!card.getSd2Card().writeStart(addr, nb_sector))
if (!card.diskIODriver()->writeStart(addr, nb_sector))
return CTRL_FAIL;
// 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
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.getSd2Card().writeStop();
card.diskIODriver()->writeStop();
return CTRL_FAIL;
}
// Write a sector
card.getSd2Card().writeData(sector_buf);
card.diskIODriver()->writeData(sector_buf);
}
// Stop writing
card.getSd2Card().writeStop();
card.diskIODriver()->writeStop();
// Done
return CTRL_GOOD;
+2 -2
View File
@@ -675,11 +675,11 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s
* - \code // Waits and gets a value on CDC line
int udi_cdc_getc(void);
// Reads a RAM buffer on CDC line
iram_size_t udi_cdc_read_buf(int* buf, iram_size_t size);
iram_size_t udi_cdc_read_buf(int *buf, iram_size_t size);
// Puts a byte on CDC line
int udi_cdc_putc(int value);
// Writes a RAM buffer on CDC line
iram_size_t udi_cdc_write_buf(const int* buf, iram_size_t size); \endcode
iram_size_t udi_cdc_write_buf(const int *buf, iram_size_t size); \endcode
*
* \section udi_cdc_use_cases Advanced use cases
* For more advanced use of the UDI CDC module, see the following use cases:
+2 -2
View File
@@ -264,7 +264,7 @@ bool usb_task_extra_string(void) {
** Handle device requests that the ASF stack doesn't
*/
bool usb_task_other_requests(void) {
uint8_t* ptr = 0;
uint8_t *ptr = 0;
uint16_t size = 0;
if (Udd_setup_type() == USB_REQ_TYPE_VENDOR) {
@@ -322,7 +322,7 @@ void usb_task_init(void) {
char *sptr;
// 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
sptr = &diam[0];
@@ -20,11 +20,10 @@
*
*/
#include "FlushableHardwareSerial.h"
#ifdef ARDUINO_ARCH_ESP32
#include "FlushableHardwareSerial.h"
Serial0Type<FlushableHardwareSerial> flushableSerial(false, 0);
Serial1Class<FlushableHardwareSerial> flushableSerial(false, 0);
#endif // ARDUINO_ARCH_ESP32
#endif
@@ -21,9 +21,9 @@
*/
#pragma once
#ifdef ARDUINO_ARCH_ESP32
#include <HardwareSerial.h>
#include "../shared/Marduino.h"
#include "../../core/serial_hook.h"
class FlushableHardwareSerial : public HardwareSerial {
@@ -31,6 +31,4 @@ public:
FlushableHardwareSerial(int uart_nr) : HardwareSerial(uart_nr) {}
};
extern Serial0Type<FlushableHardwareSerial> flushableSerial;
#endif // ARDUINO_ARCH_ESP32
extern Serial1Class<FlushableHardwareSerial> flushableSerial;
+4 -1
View File
@@ -41,7 +41,7 @@
#endif
#if ENABLED(ESP3D_WIFISUPPORT)
DefaultSerial MSerial(false, Serial2Socket);
DefaultSerial1 MSerial0(false, Serial2Socket);
#endif
// ------------------------
@@ -141,6 +141,8 @@ void HAL_clear_reset_source() { }
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); }
// return free memory between end of heap (or end bss) and whatever is current
@@ -185,6 +187,7 @@ void HAL_adc_init() {
TERN_(HAS_TEMP_ADC_7, adc3_set_attenuation(get_channel(TEMP_7_PIN), ADC_ATTEN_11db));
TERN_(HAS_HEATED_BED, adc1_set_attenuation(get_channel(TEMP_BED_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_CHAMBER, adc1_set_attenuation(get_channel(TEMP_CHAMBER_PIN), ADC_ATTEN_11db));
TERN_(HAS_TEMP_COOLER, adc1_set_attenuation(get_channel(TEMP_COOLER_PIN), ADC_ATTEN_11db));
TERN_(FILAMENT_WIDTH_SENSOR, adc1_set_attenuation(get_channel(FILWIDTH_PIN), ADC_ATTEN_11db));
// Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail.
+6 -6
View File
@@ -51,15 +51,15 @@
extern portMUX_TYPE spinlock;
#define MYSERIAL0 flushableSerial
#define MYSERIAL1 flushableSerial
#if EITHER(WIFISUPPORT, ESP3D_WIFISUPPORT)
#if ENABLED(ESP3D_WIFISUPPORT)
typedef ForwardSerial0Type< decltype(Serial2Socket) > DefaultSerial;
extern DefaultSerial MSerial;
#define MYSERIAL1 MSerial
typedef ForwardSerial1Class< decltype(Serial2Socket) > DefaultSerial1;
extern DefaultSerial1 MSerial0;
#define MYSERIAL2 MSerial0
#else
#define MYSERIAL1 webSocketSerial
#define MYSERIAL2 webSocketSerial
#endif
#endif
@@ -101,7 +101,7 @@ void HAL_clear_reset_source();
// reset reason
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);
+2 -2
View File
@@ -85,7 +85,7 @@ uint8_t spiRec() {
return returnByte;
}
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig);
SPI.transferBytes(0, buf, nbyte);
SPI.endTransaction();
@@ -97,7 +97,7 @@ void spiSend(uint8_t b) {
SPI.endTransaction();
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.beginTransaction(spiConfig);
SPI.transfer(token);
SPI.writeBytes(const_cast<uint8_t*>(buf), 512);
+2 -2
View File
@@ -29,7 +29,7 @@
#include "wifi.h"
#include <ESPAsyncWebServer.h>
MSerialT webSocketSerial(false);
MSerialWebSocketT webSocketSerial(false);
AsyncWebSocket ws("/ws"); // TODO Move inside the class.
// RingBuffer impl
@@ -137,7 +137,7 @@ size_t WebSocketSerial::write(const uint8_t c) {
return ret;
}
size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
size_t WebSocketSerial::write(const uint8_t *buffer, size_t size) {
size_t written = 0;
for (size_t i = 0; i < size; i++)
written += write(buffer[i]);
+4 -4
View File
@@ -54,7 +54,7 @@ public:
ring_buffer_pos_t read(uint8_t *buffer);
void flush();
ring_buffer_pos_t write(const uint8_t c);
ring_buffer_pos_t write(const uint8_t* buffer, ring_buffer_pos_t size);
ring_buffer_pos_t write(const uint8_t *buffer, ring_buffer_pos_t size);
};
class WebSocketSerial: public Stream {
@@ -70,7 +70,7 @@ public:
int read();
void flush();
size_t write(const uint8_t c);
size_t write(const uint8_t* buffer, size_t size);
size_t write(const uint8_t *buffer, size_t size);
#if ENABLED(SERIAL_STATS_DROPPED_RX)
FORCE_INLINE uint32_t dropped() { return 0; }
@@ -81,5 +81,5 @@ public:
#endif
};
typedef Serial0Type<WebSocketSerial> MSerialT;
extern MSerialT webSocketSerial;
typedef Serial1Class<WebSocketSerial> MSerialWebSocketT;
extern MSerialWebSocketT webSocketSerial;
+1 -1
View File
@@ -139,7 +139,7 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) {
I2S0.int_clr.val = I2S0.int_st.val; //clear pending interrupt
}
void stepperTask(void* parameter) {
void stepperTask(void *parameter) {
uint32_t remaining = 0;
while (1) {
+5 -1
View File
@@ -30,9 +30,13 @@
#endif
#if HAS_TMC_SW_SERIAL
#error "TMC220x Software Serial is not supported on this platform."
#error "TMC220x Software Serial is not supported on ESP32."
#endif
#if BOTH(WIFISUPPORT, ESP3D_WIFISUPPORT)
#error "Only enable one WiFi option, either WIFISUPPORT or ESP3D_WIFISUPPORT."
#endif
#if ENABLED(POSTMORTEM_DEBUGGING)
#error "POSTMORTEM_DEBUGGING is not yet supported on ESP32."
#endif
-6
View File
@@ -29,12 +29,6 @@
#include HAL_PATH(.,HAL.h)
#ifdef SERIAL_PORT_2
#define NUM_SERIAL 2
#else
#define NUM_SERIAL 1
#endif
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
#ifndef I2C_ADDRESS
+2
View File
@@ -73,4 +73,6 @@ void HAL_pwm_init() {
}
void HAL_reboot() { /* Reset the application state and GPIO */ }
#endif // __PLAT_LINUX__
+2 -2
View File
@@ -61,7 +61,7 @@ uint8_t _getc();
#define SHARED_SERVOS HAS_SERVOS
extern MSerialT usb_serial;
#define MYSERIAL0 usb_serial
#define MYSERIAL1 usb_serial
#define ST7920_DELAY_1 DELAY_NS(600)
#define ST7920_DELAY_2 DELAY_NS(750)
@@ -107,7 +107,7 @@ uint16_t HAL_adc_get_result();
inline void HAL_clear_reset_source(void) {}
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 */
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
+5 -1
View File
@@ -35,5 +35,9 @@
#endif
#if HAS_TMC_SW_SERIAL
#error "TMC220x Software Serial is not supported on this platform."
#error "TMC220x Software Serial is not supported on LINUX."
#endif
#if ENABLED(POSTMORTEM_DEBUGGING)
#error "POSTMORTEM_DEBUGGING is not yet supported on LINUX."
#endif
+1 -1
View File
@@ -115,4 +115,4 @@ struct HalSerial {
volatile bool host_connected;
};
typedef Serial0Type<HalSerial> MSerialT;
typedef Serial1Class<HalSerial> MSerialT;
+2 -2
View File
@@ -105,8 +105,8 @@ int main() {
std::thread write_serial (write_serial_thread);
std::thread read_serial (read_serial_thread);
#ifdef MYSERIAL0
MYSERIAL0.begin(BAUDRATE);
#ifdef MYSERIAL1
MYSERIAL1.begin(BAUDRATE);
SERIAL_ECHOLNPGM("x86_64 Initialized");
SERIAL_FLUSHTX();
#endif
-322
View File
@@ -1,322 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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/>.
*
*/
#ifdef TARGET_LPC1768
#include "../../core/macros.h"
#include "../../core/serial.h"
#include <stdarg.h>
#include "../shared/backtrace/unwinder.h"
#include "../shared/backtrace/unwmemaccess.h"
#include "watchdog.h"
#include <debug_frmwrk.h>
// Debug monitor that dumps to the Programming port all status when
// an exception or WDT timeout happens - And then resets the board
// All the Monitor routines must run with interrupts disabled and
// under an ISR execution context. That is why we cannot reuse the
// Serial interrupt routines or any C runtime, as we don't know the
// state we are when running them
// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() __asm__ volatile("": : :"memory");
// (re)initialize UART0 as a monitor output to 250000,n,8,1
static void TXBegin() {
}
// Send character through UART with no interrupts
static void TX(char c) {
_DBC(c);
}
// Send String through UART
static void TX(const char* s) {
while (*s) TX(*s++);
}
static void TXDigit(uint32_t d) {
if (d < 10) TX((char)(d+'0'));
else if (d < 16) TX((char)(d+'A'-10));
else TX('?');
}
// Send Hex number thru UART
static void TXHex(uint32_t v) {
TX("0x");
for (uint8_t i = 0; i < 8; i++, v <<= 4)
TXDigit((v >> 28) & 0xF);
}
// Send Decimal number thru UART
static void TXDec(uint32_t v) {
if (!v) {
TX('0');
return;
}
char nbrs[14];
char *p = &nbrs[0];
while (v != 0) {
*p++ = '0' + (v % 10);
v /= 10;
}
do {
p--;
TX(*p);
} while (p != &nbrs[0]);
}
// Dump a backtrace entry
static bool UnwReportOut(void* ctx, const UnwReport* bte) {
int* p = (int*)ctx;
(*p)++;
TX('#'); TXDec(*p); TX(" : ");
TX(bte->name?bte->name:"unknown"); TX('@'); TXHex(bte->function);
TX('+'); TXDec(bte->address - bte->function);
TX(" PC:");TXHex(bte->address); TX('\n');
return true;
}
#ifdef UNW_DEBUG
void UnwPrintf(const char* format, ...) {
char dest[256];
va_list argptr;
va_start(argptr, format);
vsprintf(dest, format, argptr);
va_end(argptr);
TX(&dest[0]);
}
#endif
/* Table of function pointers for passing to the unwinder */
static const UnwindCallbacks UnwCallbacks = {
UnwReportOut,
UnwReadW,
UnwReadH,
UnwReadB
#ifdef UNW_DEBUG
,UnwPrintf
#endif
};
/**
* HardFaultHandler_C:
* This is called from the HardFault_HandlerAsm with a pointer the Fault stack
* as the parameter. We can then read the values from the stack and place them
* into local variables for ease of reading.
* We then read the various Fault Status and Address Registers to help decode
* cause of the fault.
* The function ends with a BKPT instruction to force control back into the debugger
*/
extern "C"
void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause) {
static const char* causestr[] = {
"NMI","Hard","Mem","Bus","Usage","Debug","WDT","RSTC"
};
UnwindFrame btf;
// Dump report to the Programming port (interrupts are DISABLED)
TXBegin();
TX("\n\n## Software Fault detected ##\n");
TX("Cause: "); TX(causestr[cause]); TX('\n');
TX("R0 : "); TXHex(((unsigned long)sp[0])); TX('\n');
TX("R1 : "); TXHex(((unsigned long)sp[1])); TX('\n');
TX("R2 : "); TXHex(((unsigned long)sp[2])); TX('\n');
TX("R3 : "); TXHex(((unsigned long)sp[3])); TX('\n');
TX("R12 : "); TXHex(((unsigned long)sp[4])); TX('\n');
TX("LR : "); TXHex(((unsigned long)sp[5])); TX('\n');
TX("PC : "); TXHex(((unsigned long)sp[6])); TX('\n');
TX("PSR : "); TXHex(((unsigned long)sp[7])); TX('\n');
// Configurable Fault Status Register
// Consists of MMSR, BFSR and UFSR
TX("CFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED28)))); TX('\n');
// Hard Fault Status Register
TX("HFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED2C)))); TX('\n');
// Debug Fault Status Register
TX("DFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED30)))); TX('\n');
// Auxiliary Fault Status Register
TX("AFSR : "); TXHex((*((volatile unsigned long *)(0xE000ED3C)))); TX('\n');
// Read the Fault Address Registers. These may not contain valid values.
// Check BFARVALID/MMARVALID to see if they are valid values
// MemManage Fault Address Register
TX("MMAR : "); TXHex((*((volatile unsigned long *)(0xE000ED34)))); TX('\n');
// Bus Fault Address Register
TX("BFAR : "); TXHex((*((volatile unsigned long *)(0xE000ED38)))); TX('\n');
TX("ExcLR: "); TXHex(lr); TX('\n');
TX("ExcSP: "); TXHex((unsigned long)sp); TX('\n');
btf.sp = ((unsigned long)sp) + 8*4; // The original stack pointer
btf.fp = btf.sp;
btf.lr = ((unsigned long)sp[5]);
btf.pc = ((unsigned long)sp[6]) | 1; // Force Thumb, as CORTEX only support it
// Perform a backtrace
TX("\nBacktrace:\n\n");
int ctr = 0;
UnwindStart(&btf, &UnwCallbacks, &ctr);
// Disable all NVIC interrupts
NVIC->ICER[0] = 0xFFFFFFFF;
NVIC->ICER[1] = 0xFFFFFFFF;
// Relocate VTOR table to default position
SCB->VTOR = 0;
// Clear cause of reset to prevent entering smoothie bootstrap
HAL_clear_reset_source();
// Restart watchdog
#if ENABLED(USE_WATCHDOG)
//WDT_Restart(WDT);
watchdog_init();
#endif
// Reset controller
NVIC_SystemReset();
// Nothing below here is compiled because NVIC_SystemReset loops forever
for (;;) { TERN_(USE_WATCHDOG, watchdog_init()); }
}
extern "C" {
__attribute__((naked)) void NMI_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#0")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void HardFault_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#1")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void MemManage_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#2")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void BusFault_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#3")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void UsageFault_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#4")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void DebugMon_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#5")
A("b HardFault_HandlerC")
);
}
/* This is NOT an exception, it is an interrupt handler - Nevertheless, the framing is the same */
__attribute__((naked)) void WDT_IRQHandler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#6")
A("b HardFault_HandlerC")
);
}
__attribute__((naked)) void RSTC_Handler() {
__asm__ __volatile__ (
".syntax unified" "\n\t"
A("tst lr, #4")
A("ite eq")
A("mrseq r0, msp")
A("mrsne r0, psp")
A("mov r1,lr")
A("mov r2,#7")
A("b HardFault_HandlerC")
);
}
}
#endif // TARGET_LPC1768
+4 -2
View File
@@ -29,7 +29,7 @@
#include "watchdog.h"
#endif
DefaultSerial USBSerial(false, UsbSerial);
DefaultSerial1 USBSerial(false, UsbSerial);
uint32_t HAL_adc_reading = 0;
@@ -67,7 +67,7 @@ void flashFirmware(const int16_t) {
delay(500); // Give OS time to disconnect
USB_Connect(false); // USB clear connection
delay(1000); // Give OS time to notice
NVIC_SystemReset();
HAL_reboot();
}
void HAL_clear_reset_source(void) {
@@ -81,4 +81,6 @@ uint8_t HAL_get_reset_source(void) {
return RST_POWER_ON;
}
void HAL_reboot() { NVIC_SystemReset(); }
#endif // TARGET_LPC1768
+24 -12
View File
@@ -60,28 +60,37 @@ extern "C" volatile uint32_t _millis;
#define ST7920_DELAY_3 DELAY_NS(750)
#endif
typedef ForwardSerial0Type< decltype(UsbSerial) > DefaultSerial;
extern DefaultSerial USBSerial;
typedef ForwardSerial1Class< decltype(UsbSerial) > DefaultSerial1;
extern DefaultSerial1 USBSerial;
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
#define MSerial0 MSerial
#if SERIAL_PORT == -1
#define MYSERIAL0 USBSerial
#define MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 USBSerial
#define MYSERIAL2 USBSerial
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@@ -91,7 +100,7 @@ extern DefaultSerial USBSerial;
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
@@ -101,7 +110,10 @@ extern DefaultSerial USBSerial;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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
@@ -216,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);
uint8_t HAL_get_reset_source(void);
inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot();
+51
View File
@@ -0,0 +1,51 @@
/**
* 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/>.
*
*/
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#include "HAL.h"
#if ENABLED(POSTMORTEM_DEBUGGING)
#include "../shared/HAL_MinSerial.h"
#include <debug_frmwrk.h>
static void TX(char c) { _DBC(c); }
void install_min_serial() { HAL_min_serial_out = &TX; }
#if DISABLED(DYNAMIC_VECTORTABLE)
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"))) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"))) NMI_Handler();
}
#endif
#endif // POSTMORTEM_DEBUGGING
#endif // TARGET_LPC1768
+5 -5
View File
@@ -93,12 +93,12 @@
void spiSend(uint8_t b) { (void)spiTransfer(b); }
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++)
(void)spiTransfer(buf[i]);
}
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);
@@ -135,13 +135,13 @@
void spiSend(uint8_t b) { doio(b); }
void spiSend(const uint8_t* buf, size_t nbyte) {
void spiSend(const uint8_t *buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]);
}
void spiSend(uint32_t chan, byte b) {}
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {}
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {}
// Read single byte from SPI
uint8_t spiRec() { return doio(0xFF); }
@@ -156,7 +156,7 @@
uint8_t spiTransfer(uint8_t b) { return doio(b); }
// Write from buffer to SPI
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
(void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]);
+40 -13
View File
@@ -21,24 +21,51 @@
*/
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfigPre.h"
#include "MarlinSerial.h"
#if ANY_SERIAL_IS(0)
MSerialT MSerial(true, LPC_UART0);
extern "C" void UART0_IRQHandler() { MSerial.IRQHandler(); }
#include "../../inc/MarlinConfig.h"
#if USING_HW_SERIAL0
MarlinSerial _MSerial0(LPC_UART0);
MSerialT MSerial0(true, _MSerial0);
extern "C" void UART0_IRQHandler() { _MSerial0.IRQHandler(); }
#endif
#if ANY_SERIAL_IS(1)
MSerialT MSerial1(true, (LPC_UART_TypeDef *) LPC_UART1);
extern "C" void UART1_IRQHandler() { MSerial1.IRQHandler(); }
#if USING_HW_SERIAL1
MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1);
MSerialT MSerial1(true, _MSerial1);
extern "C" void UART1_IRQHandler() { _MSerial1.IRQHandler(); }
#endif
#if ANY_SERIAL_IS(2)
MSerialT MSerial2(true, LPC_UART2);
extern "C" void UART2_IRQHandler() { MSerial2.IRQHandler(); }
#if USING_HW_SERIAL2
MarlinSerial _MSerial2(LPC_UART2);
MSerialT MSerial2(true, _MSerial2);
extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); }
#endif
#if ANY_SERIAL_IS(3)
MSerialT MSerial3(true, LPC_UART3);
extern "C" void UART3_IRQHandler() { MSerial3.IRQHandler(); }
#if USING_HW_SERIAL3
MarlinSerial _MSerial3(LPC_UART3);
MSerialT MSerial3(true, _MSerial3);
extern "C" void UART3_IRQHandler() { _MSerial3.IRQHandler(); }
#endif
#if ENABLED(EMERGENCY_PARSER)
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)
if (false) {}
#if USING_HW_SERIAL0
else if (this == &_MSerial0) emergency_parser.update(MSerial0.emergency_state, c);
#endif
#if USING_HW_SERIAL1
else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);
#endif
#if USING_HW_SERIAL2
else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c);
#endif
#if USING_HW_SERIAL3
else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c);
#endif
return true;
}
#endif
#endif // TARGET_LPC1768
+12 -6
View File
@@ -47,15 +47,21 @@ public:
void end() {}
#if ENABLED(EMERGENCY_PARSER)
bool recv_callback(const char c) override {
emergency_parser.update(static_cast<Serial0Type<MarlinSerial> *>(this)->emergency_state, c);
return true; // do not discard character
}
bool recv_callback(const char c) override;
#endif
};
typedef Serial0Type<MarlinSerial> MSerialT;
extern MSerialT MSerial;
// On LPC176x framework, HardwareSerial does not implement the same interface as Arduino's Serial, so overloads
// of 'available' and 'read' method are not used in this multiple inheritance scenario.
// Instead, use a ForwardSerial here that adapts the interface.
typedef ForwardSerial1Class<MarlinSerial> MSerialT;
extern MSerialT MSerial0;
extern MSerialT MSerial1;
extern MSerialT MSerial2;
extern MSerialT MSerial3;
// Consequently, we can't use a RuntimeSerial either. The workaround would be to use
// a RuntimeSerial<ForwardSerial<MarlinSerial>> type here. Ignore for now until it's actually required.
#if ENABLED(SERIAL_RUNTIME_HOOK)
#error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x."
#endif
+3 -4
View File
@@ -83,14 +83,13 @@ bool PersistentStore::access_finish() {
static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
PGM_P const rw_str = write ? PSTR("write") : PSTR("read");
SERIAL_CHAR(' ');
serialprintPGM(rw_str);
SERIAL_ECHOPGM_P(rw_str);
SERIAL_ECHOLNPAIR("_data(", pos, ",", value, ",", size, ", ...)");
if (total) {
SERIAL_ECHOPGM(" f_");
serialprintPGM(rw_str);
SERIAL_ECHOPGM_P(rw_str);
SERIAL_ECHOPAIR("()=", s, "\n size=", size, "\n bytes_");
serialprintPGM(write ? PSTR("written=") : PSTR("read="));
SERIAL_ECHOLN(total);
SERIAL_ECHOLNPAIR_P(write ? PSTR("written=") : PSTR("read="), total);
}
else
SERIAL_ECHOLNPAIR(" f_lseek()=", s);
+4 -8
View File
@@ -42,25 +42,22 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
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;
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);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
}
}
crc16(crc, &v, 1);
pos++;
value++;
};
}
return false;
}
@@ -68,7 +65,6 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
do {
// Read from external EEPROM
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
@@ -30,6 +30,5 @@
// LPC1768 boards seem to lose steps when saving to EEPROM during print (issue #20785)
// TODO: Which other boards are incompatible?
#if defined(MCU_LPC1768) && PRINTCOUNTER_SAVE_INTERVAL > 0
#warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save."
#define PRINTCOUNTER_SYNC 1
#endif
+7 -7
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_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_RX0(P) (P == P0_03)
#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
#endif
#if ANY_SERIAL_IS(1)
#if USING_HW_SERIAL1
#define IS_TX1(P) (P == P0_15)
#define IS_RX1(P) (P == P0_16)
#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
#endif
#if ANY_SERIAL_IS(2)
#if USING_HW_SERIAL2
#define IS_TX2(P) (P == P0_10)
#define IS_RX2(P) (P == P0_11)
#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!"
#elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
#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!"
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_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
#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_RX3(P) (P##_PIN == P0_01)
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
@@ -270,7 +270,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
#error "SERIAL_STATS_MAX_RX_QUEUED is not supported on this platform."
#error "SERIAL_STATS_MAX_RX_QUEUED is not supported on LPC176x."
#elif ENABLED(SERIAL_STATS_DROPPED_RX)
#error "SERIAL_STATS_DROPPED_RX is not supported on this platform."
#error "SERIAL_STATS_DROPPED_RX is not supported on LPX176x."
#endif
+6 -4
View File
@@ -46,6 +46,8 @@ extern "C" {
void SysTick_Callback() { disk_timerproc(); }
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
void HAL_init() {
// Init LEDs
@@ -115,7 +117,7 @@ void HAL_init() {
PinCfg.Pinmode = 2; // no pull-up/pull-down
PINSEL_ConfigPin(&PinCfg);
// now set CLKOUT_EN bit
LPC_SC->CLKOUTCFG |= (1<<8);
SBI(LPC_SC->CLKOUTCFG, 8);
#endif
USB_Init(); // USB Initialization
@@ -123,9 +125,7 @@ void HAL_init() {
delay(1000); // Give OS time to notice
USB_Connect(true);
#if HAS_SD_HOST_DRIVE
MSC_SD_Init(0); // Enable USB SD card access
#endif
TERN_(HAS_SD_HOST_DRIVE, MSC_SD_Init(0)); // Enable USB SD card access
const millis_t usb_timeout = millis() + 2000;
while (!USB_Configuration && PENDING(millis(), usb_timeout)) {
@@ -137,6 +137,8 @@ void HAL_init() {
}
HAL_timer_init();
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
}
// HAL idle task
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
#include "xpt2046.h"
#include <SPI.h>
@@ -66,7 +66,7 @@
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
void spiSend(const uint8_t *buf, size_t n);
static uint8_t rs_last_state = 255;
+87 -87
View File
@@ -8,9 +8,7 @@ from __future__ import print_function
target_filename = "FIRMWARE.CUR"
target_drive = "REARM"
import os
import getpass
import platform
import os,getpass,platform
current_OS = platform.system()
Import("env")
@@ -22,102 +20,104 @@ def print_error(e):
'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \
%(e, env.get('PIOENV')))
try:
#
# Find a disk for upload
#
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
if current_OS == 'Windows':
def before_upload(source, target, env):
try:
#
# platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
# Windows - doesn't care about the disk's name, only cares about the drive letter
import subprocess
from ctypes import windll
import string
# Find a disk for upload
#
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
if current_OS == 'Windows':
#
# platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
# Windows - doesn't care about the disk's name, only cares about the drive letter
import subprocess,string
from ctypes import windll
# getting list of drives
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
# getting list of drives
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
for drive in drives:
final_drive_name = drive + ':\\'
# print ('disc check: {}'.format(final_drive_name))
try:
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
except Exception as e:
print ('error:{}'.format(e))
continue
else:
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = final_drive_name
if target_filename in volume_info:
if not target_file_found:
for drive in drives:
final_drive_name = drive + ':\\'
# print ('disc check: {}'.format(final_drive_name))
try:
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
except Exception as e:
print ('error:{}'.format(e))
continue
else:
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = final_drive_name
target_file_found = True
if target_filename in volume_info:
if not target_file_found:
upload_disk = final_drive_name
target_file_found = True
elif current_OS == 'Linux':
#
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
if target_drive in drives: # If target drive is found, use it.
target_drive_found = True
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
else:
elif current_OS == 'Linux':
#
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
if target_drive in drives: # If target drive is found, use it.
target_drive_found = True
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
else:
for drive in drives:
try:
files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive))
except:
continue
else:
if target_filename in files:
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
target_file_found = True
break
#
# set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(
UPLOAD_FLAGS="-P$UPLOAD_PORT"
)
elif current_OS == 'Darwin': # MAC
#
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir('/Volumes') # human readable names
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = '/Volumes/' + target_drive + '/'
for drive in drives:
try:
files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive))
filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected
except:
continue
else:
if target_filename in files:
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
if target_filename in filenames:
if not target_file_found:
upload_disk = '/Volumes/' + drive + '/'
target_file_found = True
break
#
# set upload_port to drive if found
#
#
# Set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(
UPLOAD_FLAGS="-P$UPLOAD_PORT"
)
env.Replace(UPLOAD_PORT=upload_disk)
print('\nUpload disk: ', upload_disk, '\n')
else:
print_error('Autodetect Error')
elif current_OS == 'Darwin': # MAC
#
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir('/Volumes') # human readable names
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = '/Volumes/' + target_drive + '/'
for drive in drives:
try:
filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected
except:
continue
else:
if target_filename in filenames:
if not target_file_found:
upload_disk = '/Volumes/' + drive + '/'
target_file_found = True
except Exception as e:
print_error(str(e))
#
# Set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(UPLOAD_PORT=upload_disk)
print('\nUpload disk: ', upload_disk, '\n')
else:
print_error('Autodetect Error')
except Exception as e:
print_error(str(e))
env.AddPreAction("upload", before_upload)
+2 -2
View File
@@ -29,8 +29,8 @@
EmergencyParser::State emergency_state;
bool CDC_RecvCallback(const char buffer) {
emergency_parser.update(emergency_state, buffer);
bool CDC_RecvCallback(const char c) {
emergency_parser.update(emergency_state, c);
return true;
}
+26 -10
View File
@@ -25,20 +25,20 @@
#include <wiring_private.h>
#ifdef ADAFRUIT_GRAND_CENTRAL_M4
#if ANY_SERIAL_IS(-1)
DefaultSerial MSerial(false, Serial);
#if USING_HW_SERIALUSB
DefaultSerial1 MSerial0(false, Serial);
#endif
#if ANY_SERIAL_IS(0)
DefaultSerial1 MSerial1(false, Serial1);
#if USING_HW_SERIAL0
DefaultSerial2 MSerial1(false, Serial1);
#endif
#if ANY_SERIAL_IS(1)
DefaultSerial2 MSerial2(false, Serial2);
#if USING_HW_SERIAL1
DefaultSerial3 MSerial2(false, Serial2);
#endif
#if ANY_SERIAL_IS(2)
DefaultSerial3 MSerial3(false, Serial3);
#if USING_HW_SERIAL2
DefaultSerial4 MSerial3(false, Serial3);
#endif
#if ANY_SERIAL_IS(3)
DefaultSerial4 MSerial4(false, Serial4);
#if USING_HW_SERIAL3
DefaultSerial5 MSerial4(false, Serial4);
#endif
#endif
@@ -57,6 +57,7 @@
#define GET_PROBE_ADC() TERN(HAS_TEMP_PROBE, PIN_TO_ADC(TEMP_PROBE_PIN), -1)
#define GET_BED_ADC() TERN(HAS_TEMP_ADC_BED, PIN_TO_ADC(TEMP_BED_PIN), -1)
#define GET_CHAMBER_ADC() TERN(HAS_TEMP_ADC_CHAMBER, PIN_TO_ADC(TEMP_CHAMBER_PIN), -1)
#define GET_COOLER_ADC() TERN(HAS_TEMP_ADC_COOLER, PIN_TO_ADC(TEMP_COOLER_PIN), -1)
#define GET_FILAMENT_WIDTH_ADC() TERN(FILAMENT_WIDTH_SENSOR, PIN_TO_ADC(FILWIDTH_PIN), -1)
#define GET_BUTTONS_ADC() TERN(HAS_ADC_BUTTONS, PIN_TO_ADC(ADC_KEYPAD_PIN), -1)
@@ -66,6 +67,7 @@
|| GET_PROBE_ADC() == n \
|| GET_BED_ADC() == n \
|| GET_CHAMBER_ADC() == n \
|| GET_COOLER_ADC() == n \
|| GET_FILAMENT_WIDTH_ADC() == n \
|| GET_BUTTONS_ADC() == n \
)
@@ -144,6 +146,9 @@ uint16_t HAL_adc_result;
#if GET_CHAMBER_ADC() == 0
TEMP_CHAMBER_PIN,
#endif
#if GET_COOLER_ADC() == 0
TEMP_COOLER_PIN,
#endif
#if GET_FILAMENT_WIDTH_ADC() == 0
FILWIDTH_PIN,
#endif
@@ -184,6 +189,9 @@ uint16_t HAL_adc_result;
#if GET_CHAMBER_ADC() == 1
TEMP_CHAMBER_PIN,
#endif
#if GET_COOLER_ADC() == 1
TEMP_COOLER_PIN,
#endif
#if GET_FILAMENT_WIDTH_ADC() == 1
FILWIDTH_PIN,
#endif
@@ -232,6 +240,9 @@ uint16_t HAL_adc_result;
#if GET_CHAMBER_ADC() == 0
{ PIN_TO_INPUTCTRL(TEMP_CHAMBER_PIN) },
#endif
#if GET_COOLER_ADC() == 0
{ PIN_TO_INPUTCTRL(TEMP_COOLER_PIN) },
#endif
#if GET_FILAMENT_WIDTH_ADC() == 0
{ PIN_TO_INPUTCTRL(FILWIDTH_PIN) },
#endif
@@ -281,6 +292,9 @@ uint16_t HAL_adc_result;
#if GET_CHAMBER_ADC() == 1
{ PIN_TO_INPUTCTRL(TEMP_CHAMBER_PIN) },
#endif
#if GET_COOLER_ADC() == 1
{ PIN_TO_INPUTCTRL(TEMP_COOLER_PIN) },
#endif
#if GET_FILAMENT_WIDTH_ADC() == 1
{ PIN_TO_INPUTCTRL(FILWIDTH_PIN) },
#endif
@@ -422,6 +436,8 @@ uint8_t HAL_get_reset_source() {
}
#pragma pop_macro("WDT")
void HAL_reboot() { NVIC_SystemReset(); }
extern "C" {
void * _sbrk(int incr);
+21 -23
View File
@@ -32,58 +32,56 @@
#include "MarlinSerial_AGCM4.h"
// Serial ports
typedef ForwardSerial0Type< decltype(Serial) > DefaultSerial;
typedef ForwardSerial0Type< decltype(Serial1) > DefaultSerial1;
typedef ForwardSerial0Type< decltype(Serial2) > DefaultSerial2;
typedef ForwardSerial0Type< decltype(Serial3) > DefaultSerial3;
typedef ForwardSerial0Type< decltype(Serial4) > DefaultSerial4;
extern DefaultSerial MSerial;
extern DefaultSerial1 MSerial1;
extern DefaultSerial2 MSerial2;
extern DefaultSerial3 MSerial3;
extern DefaultSerial4 MSerial4;
// MYSERIAL0 required before MarlinSerial includes!
typedef ForwardSerial1Class< decltype(Serial) > DefaultSerial1;
typedef ForwardSerial1Class< decltype(Serial1) > DefaultSerial2;
typedef ForwardSerial1Class< decltype(Serial2) > DefaultSerial3;
typedef ForwardSerial1Class< decltype(Serial3) > DefaultSerial4;
typedef ForwardSerial1Class< decltype(Serial4) > DefaultSerial5;
extern DefaultSerial1 MSerial0;
extern DefaultSerial2 MSerial1;
extern DefaultSerial3 MSerial2;
extern DefaultSerial4 MSerial3;
extern DefaultSerial5 MSerial4;
#define __MSERIAL(X) MSerial##X
#define _MSERIAL(X) __MSERIAL(X)
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
#if SERIAL_PORT == -1
#define MYSERIAL0 MSerial
#define MYSERIAL1 MSerial0
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 MSerial
#define MYSERIAL2 MSerial0
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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 MMU2_SERIAL_PORT
#if MMU2_SERIAL_PORT == -1
#define MMU2_SERIAL MSerial
#define MMU2_SERIAL MSerial0
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
#ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1
#define LCD_SERIAL MSerial
#define LCD_SERIAL MSerial0
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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
@@ -109,7 +107,7 @@ typedef int8_t pin_t;
void HAL_clear_reset_source(); // clear 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
+2 -2
View File
@@ -103,7 +103,7 @@
* @param nbyte Number of bytes to receive.
* @return Nothing
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte == 0) return;
memset(buf, 0xFF, nbyte);
sdSPI.beginTransaction(spiConfig);
@@ -132,7 +132,7 @@
*
* @details Uses DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
sdSPI.beginTransaction(spiConfig);
sdSPI.transfer(token);
sdSPI.transfer((uint8_t*)buf, nullptr, 512);
+3 -3
View File
@@ -27,7 +27,7 @@
#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);
void SERCOM4_0_Handler() { Serial2.IrqHandler(); }
void SERCOM4_1_Handler() { Serial2.IrqHandler(); }
@@ -35,7 +35,7 @@
void SERCOM4_3_Handler() { Serial2.IrqHandler(); }
#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);
void SERCOM1_0_Handler() { Serial3.IrqHandler(); }
void SERCOM1_1_Handler() { Serial3.IrqHandler(); }
@@ -43,7 +43,7 @@
void SERCOM1_3_Handler() { Serial3.IrqHandler(); }
#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);
void SERCOM5_0_Handler() { Serial4.IrqHandler(); }
void SERCOM5_1_Handler() { Serial4.IrqHandler(); }
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../core/serial_hook.h"
typedef Serial0Type<Uart> UartT;
typedef Serial1Class<Uart> UartT;
extern UartT Serial2;
extern UartT Serial3;
+3 -2
View File
@@ -41,12 +41,13 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
const uint8_t v = *value;
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);
delay(2);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
+4
View File
@@ -50,3 +50,7 @@
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on SAMD51."
#endif
#if ENABLED(POSTMORTEM_DEBUGGING)
#error "POSTMORTEM_DEBUGGING is not yet supported on AGCM4."
#endif
+21 -3
View File
@@ -29,7 +29,7 @@
#include "../shared/Delay.h"
#ifdef USBCON
DefaultSerial MSerial(false, SerialUSB);
DefaultSerial1 MSerial0(false, SerialUSB);
#endif
#if ENABLED(SRAM_EEPROM_EMULATION)
@@ -57,10 +57,18 @@ uint16_t HAL_adc_result;
// Public functions
// ------------------------
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
// HAL initialization task
void HAL_init() {
FastIO_init();
// Ensure F_CPU is a constant expression.
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
// So better safe than sorry here.
constexpr int cpuFreq = F_CPU;
UNUSED(cpuFreq);
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT) && (defined(SDSS) && SDSS != -1)
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
#endif
@@ -83,9 +91,17 @@ void HAL_init() {
USB_Hook_init();
#endif
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
#if HAS_SD_HOST_DRIVE
MSC_SD_init(); // Enable USB SD card access
#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
@@ -123,6 +139,8 @@ uint8_t HAL_get_reset_source() {
;
}
void HAL_reboot() { NVIC_SystemReset(); }
void _delay_ms(const int delay_ms) { delay(delay_ms); }
extern "C" {
@@ -137,8 +155,8 @@ extern "C" {
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; }
// Reset the system (to initiate a firmware flash)
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
// Reset the system to initiate a firmware flash
void flashFirmware(const int16_t) { HAL_reboot(); }
// Maple Compatibility
volatile uint32_t systick_uptime_millis = 0;
+26 -16
View File
@@ -37,54 +37,64 @@
#include <stdint.h>
//
// Serial Ports
//
#ifdef USBCON
#include <USBSerial.h>
#include "../../core/serial_hook.h"
typedef ForwardSerial0Type< decltype(SerialUSB) > DefaultSerial;
extern DefaultSerial MSerial;
typedef ForwardSerial1Class< decltype(SerialUSB) > DefaultSerial1;
extern DefaultSerial1 MSerial0;
#endif
// ------------------------
// Defines
// ------------------------
#define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X)
#if SERIAL_PORT == -1
#define MYSERIAL0 MSerial
#define MYSERIAL1 MSerial0
#elif WITHIN(SERIAL_PORT, 1, 6)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 MSerial
#define MYSERIAL2 MSerial0
#elif WITHIN(SERIAL_PORT_2, 1, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
#ifdef MMU2_SERIAL_PORT
#if MMU2_SERIAL_PORT == -1
#define MMU2_SERIAL MSerial
#define MMU2_SERIAL MSerial0
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#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
#ifdef LCD_SERIAL_PORT
#if LCD_SERIAL_PORT == -1
#define LCD_SERIAL MSerial
#define LCD_SERIAL MSerial0
#elif WITHIN(LCD_SERIAL_PORT, 1, 6)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#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
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
@@ -144,7 +154,7 @@ void HAL_clear_reset_source();
// Reset reason
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);
+152
View File
@@ -0,0 +1,152 @@
/**
* 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
* Copyright (c) 2017 Victor Perez
*
* 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/MarlinConfigPre.h"
#if ENABLED(POSTMORTEM_DEBUGGING)
#include "../shared/HAL_MinSerial.h"
#include "watchdog.h"
/* Instruction Synchronization Barrier */
#define isb() __asm__ __volatile__ ("isb" : : : "memory")
/* Data Synchronization Barrier */
#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
// Dumb mapping over the registers of a USART device on STM32
struct USARTMin {
volatile uint32_t SR;
volatile uint32_t DR;
volatile uint32_t BRR;
volatile uint32_t CR1;
volatile uint32_t CR2;
};
#if WITHIN(SERIAL_PORT, 1, 6)
// Depending on the CPU, the serial port is different for USART1
static const uintptr_t regsAddr[] = {
TERN(STM32F1xx, 0x40013800, 0x40011000), // USART1
0x40004400, // USART2
0x40004800, // USART3
0x40004C00, // UART4_BASE
0x40005000, // UART5_BASE
0x40011400 // USART6
};
static USARTMin * regs = (USARTMin*)regsAddr[SERIAL_PORT - 1];
#endif
static void TXBegin() {
#if !WITHIN(SERIAL_PORT, 1, 6)
#warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error."
#warning "Disabling the severe error reporting feature currently because the used serial port is not a HW port."
#else
// This is common between STM32F1/STM32F2 and STM32F4
const int nvicUART[] = { /* NVIC_USART1 */ 37, /* NVIC_USART2 */ 38, /* NVIC_USART3 */ 39, /* NVIC_UART4 */ 52, /* NVIC_UART5 */ 53, /* NVIC_USART6 */ 71 };
int nvicIndex = nvicUART[SERIAL_PORT - 1];
struct NVICMin {
volatile uint32_t ISER[32];
volatile uint32_t ICER[32];
};
NVICMin *nvicBase = (NVICMin*)0xE000E100;
SBI32(nvicBase->ICER[nvicIndex >> 5], nvicIndex & 0x1F);
// We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
dsb();
isb();
// Example for USART1 disable: (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN))
// Too difficult to reimplement here, let's query the STM32duino macro here
#if SERIAL_PORT == 1
__HAL_RCC_USART1_CLK_DISABLE();
__HAL_RCC_USART1_CLK_ENABLE();
#elif SERIAL_PORT == 2
__HAL_RCC_USART2_CLK_DISABLE();
__HAL_RCC_USART2_CLK_ENABLE();
#elif SERIAL_PORT == 3
__HAL_RCC_USART3_CLK_DISABLE();
__HAL_RCC_USART3_CLK_ENABLE();
#elif SERIAL_PORT == 4
__HAL_RCC_UART4_CLK_DISABLE(); // BEWARE: UART4 and not USART4 here
__HAL_RCC_UART4_CLK_ENABLE();
#elif SERIAL_PORT == 5
__HAL_RCC_UART5_CLK_DISABLE(); // BEWARE: UART5 and not USART5 here
__HAL_RCC_UART5_CLK_ENABLE();
#elif SERIAL_PORT == 6
__HAL_RCC_USART6_CLK_DISABLE();
__HAL_RCC_USART6_CLK_ENABLE();
#endif
uint32_t brr = regs->BRR;
regs->CR1 = 0; // Reset the USART
regs->CR2 = 0; // 1 stop bit
// If we don't touch the BRR (baudrate register), we don't need to recompute.
regs->BRR = brr;
regs->CR1 = _BV(3) | _BV(13); // 8 bits, no parity, 1 stop bit (TE | UE)
#endif
}
// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() __asm__ volatile("": : :"memory");
static void TX(char c) {
#if WITHIN(SERIAL_PORT, 1, 6)
constexpr uint32_t usart_sr_txe = _BV(7);
while (!(regs->SR & usart_sr_txe)) {
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
sw_barrier();
}
regs->DR = c;
#else
// Let's hope a mystical guru will fix this, one day by writting interrupt-free USB CDC ACM code (or, at least, by polling the registers since interrupt will be queued but will never trigger)
// For now, it's completely lost to oblivion.
#endif
}
void install_min_serial() {
HAL_min_serial_init = &TXBegin;
HAL_min_serial_out = &TX;
}
#if DISABLED(DYNAMIC_VECTORTABLE) && DISABLED(STM32F0xx) // Cortex M0 can't jump to a symbol that's too far from the current function, so we work around this in exception_arm.cpp
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) HardFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) BusFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) UsageFault_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) MemManage_Handler();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) NMI_Handler();
}
#endif
#endif // POSTMORTEM_DEBUGGING
#endif // ARDUINO_ARCH_STM32
+2 -2
View File
@@ -193,7 +193,7 @@ static SPISettings spiConfig;
*
* @details Uses DMA
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
if (nbyte == 0) return;
memset(buf, 0xFF, nbyte);
SPI.transfer(buf, nbyte);
@@ -218,7 +218,7 @@ static SPISettings spiConfig;
*
* @details Use DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
uint8_t rxBuf[512];
SPI.transfer(token);
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
+1 -1
View File
@@ -19,7 +19,7 @@
* 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"
+29 -14
View File
@@ -28,7 +28,6 @@
#ifndef USART4
#define USART4 UART4
#endif
#ifndef USART5
#define USART5 UART5
#endif
@@ -38,22 +37,38 @@
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); }
#define DECLARE_SERIAL_PORT_EXP(ser_num) DECLARE_SERIAL_PORT(ser_num)
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT)
#if USING_HW_SERIAL1
DECLARE_SERIAL_PORT(1)
#endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT_2)
#if USING_HW_SERIAL2
DECLARE_SERIAL_PORT(2)
#endif
#if defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT >= 0
DECLARE_SERIAL_PORT_EXP(MMU2_SERIAL_PORT)
#if USING_HW_SERIAL3
DECLARE_SERIAL_PORT(3)
#endif
#if defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT >= 0
DECLARE_SERIAL_PORT_EXP(LCD_SERIAL_PORT)
#if USING_HW_SERIAL4
DECLARE_SERIAL_PORT(4)
#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
void MarlinSerial::begin(unsigned long baud, uint8_t config) {
+3 -3
View File
@@ -29,20 +29,20 @@
typedef void (*usart_rx_callback_t)(serial_t * obj);
struct MarlinSerial : public HardwareSerial {
MarlinSerial(void* peripheral, usart_rx_callback_t rx_callback) :
MarlinSerial(void *peripheral, usart_rx_callback_t rx_callback) :
HardwareSerial(peripheral), _rx_callback(rx_callback)
{ }
void begin(unsigned long baud, uint8_t config);
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
void _rx_complete_irq(serial_t* obj);
void _rx_complete_irq(serial_t *obj);
protected:
usart_rx_callback_t _rx_callback;
};
typedef Serial0Type<MarlinSerial> MSerialT;
typedef Serial1Class<MarlinSerial> MSerialT;
extern MSerialT MSerial1;
extern MSerialT MSerial2;
extern MSerialT MSerial3;
+118 -100
View File
@@ -36,9 +36,10 @@
// use USB drivers
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);
extern SD_HandleTypeDef hsd;
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);
extern SD_HandleTypeDef hsd;
}
bool SDIO_Init() {
@@ -75,7 +76,18 @@
#error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported"
#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
// 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
@@ -96,12 +108,12 @@
// Target Clock, configurable. Default is 18MHz, from STM32F1
#ifndef SDIO_CLOCK
#define SDIO_CLOCK 18000000 /* 18 MHz */
#define SDIO_CLOCK 18000000 // 18 MHz
#endif
// SDIO retries, configurable. Default is 3, from STM32F1
#ifndef SDIO_READ_RETRIES
#define SDIO_READ_RETRIES 3
#define SDIO_READ_RETRIES 3
#endif
// SDIO Max Clock (naming from STM Manual, don't change)
@@ -120,24 +132,21 @@
}
void go_to_transfer_speed() {
SD_InitTypeDef Init;
/* Default SDIO peripheral configuration for SD card initialization */
Init.ClockEdge = hsd.Init.ClockEdge;
Init.ClockBypass = hsd.Init.ClockBypass;
Init.ClockPowerSave = hsd.Init.ClockPowerSave;
Init.BusWide = hsd.Init.BusWide;
Init.HardwareFlowControl = hsd.Init.HardwareFlowControl;
Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
hsd.Init.ClockEdge = hsd.Init.ClockEdge;
hsd.Init.ClockBypass = hsd.Init.ClockBypass;
hsd.Init.ClockPowerSave = hsd.Init.ClockPowerSave;
hsd.Init.BusWide = hsd.Init.BusWide;
hsd.Init.HardwareFlowControl = hsd.Init.HardwareFlowControl;
hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
/* Initialize SDIO peripheral interface with default configuration */
SDIO_Init(hsd.Instance, Init);
SDIO_Init(hsd.Instance, hsd.Init);
}
void SD_LowLevel_Init(void) {
uint32_t tempreg;
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks
__HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks
@@ -163,11 +172,45 @@
GPIO_InitStruct.Pin = GPIO_PIN_2;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
#if DISABLED(STM32F1xx)
// TODO: use __HAL_RCC_SDIO_RELEASE_RESET() and __HAL_RCC_SDIO_CLK_ENABLE();
RCC->APB2RSTR &= ~RCC_APB2RSTR_SDIORST_Msk; // take SDIO out of reset
RCC->APB2ENR |= RCC_APB2RSTR_SDIORST_Msk; // enable SDIO clock
// Enable the DMA2 Clock
// Setup DMA
#if defined(STM32F1xx)
hdma_sdio.Init.Mode = DMA_NORMAL;
hdma_sdio.Instance = DMA2_Channel4;
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
//Initialize the SDIO (with initial <400Khz Clock)
@@ -179,6 +222,7 @@
// Power up the SDIO
SDIO_PowerState_ON(SDIO);
hsd.Instance = SDIO;
}
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init
@@ -222,107 +266,81 @@
if (!status) break;
if (!--retry_Cnt) return false; // return failing status if retries are exhausted
}
go_to_transfer_speed();
}
#endif
return true;
}
/*
void init_SDIO_pins(void) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
// SDIO GPIO Configuration
// PC8 ------> SDIO_D0
// PC12 ------> SDIO_CK
// PD2 ------> SDIO_CMD
static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) {
if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
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);
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
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());
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
if (!status) break; // return passing status
if (!--retryCnt) break; // return failing status if retries are exhausted
HAL_StatusTypeDef ret;
if (src) {
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;
/*
return (bool) ((status_read | status_card) ? 1 : 0);
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);
if (ret != HAL_OK) {
HAL_DMA_Abort_IT(&hdma_sdio);
HAL_DMA_DeInit(&hdma_sdio);
return false;
}
while (!SDIO_GET_FLAG(SDIO_STA_DATAEND | SDIO_STA_TRX_ERROR_FLAGS)) {}
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
if (SDIO->STA & SDIO_STA_RXDAVL) {
while (SDIO->STA & SDIO_STA_RXDAVL) (void)SDIO->FIFO;
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
millis_t timeout = millis() + 500;
// Wait the transfer
while (hsd.State != HAL_SD_STATE_READY) {
if (ELAPSED(millis(), timeout)) {
HAL_DMA_Abort_IT(&hdma_sdio);
HAL_DMA_DeInit(&hdma_sdio);
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;
}
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
hsd.Instance = SDIO;
uint8_t retryCnt = SDIO_READ_RETRIES;
bool status;
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;
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) {
uint8_t retries = SDIO_READ_RETRIES;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, NULL)) return true;
return false;
}
#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 // SDIO_SUPPORT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
+1 -1
View File
@@ -48,7 +48,7 @@
#include "stm32_def.h"
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
#include "src/core/debug_out.h"
#include "../../core/debug_out.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
+4 -7
View File
@@ -43,25 +43,22 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
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;
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);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
}
}
crc16(crc, &v, 1);
pos++;
value++;
};
}
return false;
}
@@ -24,3 +24,9 @@
#if defined(USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
#define HAS_SD_HOST_DRIVE 1
#endif
// Fix F_CPU not being a compile-time constant in STSTM32 framework
#ifdef BOARD_F_CPU
#undef F_CPU
#define F_CPU BOARD_F_CPU
#endif
+4 -4
View File
@@ -47,11 +47,11 @@
#endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
#error "SERIAL_STATS_MAX_RX_QUEUED is not supported on this platform."
#error "SERIAL_STATS_MAX_RX_QUEUED is not supported on STM32."
#elif ENABLED(SERIAL_STATS_DROPPED_RX)
#error "SERIAL_STATS_DROPPED_RX is not supported on this platform."
#error "SERIAL_STATS_DROPPED_RX is not supported on STM32."
#endif
#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32F4xx, STM32F1xx)
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32F4 and STM32F1 hardware."
#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 STM32H7, STM32F4 and STM32F1 hardware."
#endif
+25 -13
View File
@@ -30,54 +30,66 @@
class Sd2CardUSBMscHandler : public USBMscHandler {
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) {
*pBlockNum = card.getSd2Card().cardSize();
*pBlockNum = diskIODriver()->cardSize();
*pBlockSize = BLOCK_SIZE;
return true;
}
bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = card.getSd2Card();
auto sd2card = diskIODriver();
// single block
if (blkLen == 1) {
watchdog_refresh();
sd2card.writeBlock(blkAddr, pBuf);
sd2card->writeBlock(blkAddr, pBuf);
return true;
}
// multi block optmization
sd2card.writeStart(blkAddr, blkLen);
sd2card->writeStart(blkAddr, blkLen);
while (blkLen--) {
watchdog_refresh();
sd2card.writeData(pBuf);
sd2card->writeData(pBuf);
pBuf += BLOCK_SIZE;
}
sd2card.writeStop();
sd2card->writeStop();
return true;
}
bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = card.getSd2Card();
auto sd2card = diskIODriver();
// single block
if (blkLen == 1) {
watchdog_refresh();
sd2card.readBlock(blkAddr, pBuf);
sd2card->readBlock(blkAddr, pBuf);
return true;
}
// multi block optmization
sd2card.readStart(blkAddr);
sd2card->readStart(blkAddr);
while (blkLen--) {
watchdog_refresh();
sd2card.readData(pBuf);
sd2card->readData(pBuf);
pBuf += BLOCK_SIZE;
}
sd2card.readStop();
sd2card->readStop();
return true;
}
bool IsReady() {
return card.isMounted();
return diskIODriver()->isReady();
}
};
@@ -105,8 +117,8 @@ USBMscHandler *pSingleMscHandler = &usbMscHandler;
void MSC_SD_init() {
USBDevice.end();
delay(200);
USBDevice.begin();
USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata);
USBDevice.begin();
}
#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}
};
+3 -3
View File
@@ -207,12 +207,12 @@ void TFT_SPI::Transmit(uint16_t Data) {
while ((SPIx.Instance->SR & SPI_FLAG_BSY) == SPI_FLAG_BSY) {}
if (TFT_MISO_PIN != TFT_MOSI_PIN)
__HAL_SPI_CLEAR_OVRFLAG(&SPIx); /* Clear overrun flag in 2 Lines communication mode because received is not read */
__HAL_SPI_CLEAR_OVRFLAG(&SPIx); // Clear overrun flag in 2 Lines communication mode because received is not read
}
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
// Wait last dma finish, to start another
while(isBusy()) { }
while (isBusy()) { /* nada */ }
DMAtx.Init.MemInc = MemoryIncrease;
HAL_DMA_Init(&DMAtx);
@@ -225,7 +225,7 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count);
__HAL_SPI_ENABLE(&SPIx);
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); /* Enable Tx DMA Request */
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
Abort();
+1 -1
View File
@@ -23,7 +23,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
#include "xpt2046.h"
#include "pinconfig.h"
+1 -1
View File
@@ -74,7 +74,7 @@
#elif defined(STM32F401xC) || defined(STM32F401xE)
#define MCU_STEP_TIMER 9
#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_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
#endif
-3
View File
@@ -21,15 +21,12 @@
*/
#pragma once
#include <stdint.h>
#include "../../inc/MarlinConfig.h"
// ------------------------
// Defines
// ------------------------
#define FORCE_INLINE __attribute__((always_inline)) inline
// 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
// is written to the register. STM32F4 timers do not manifest this issue,
+1 -1
View File
@@ -110,7 +110,7 @@ uint8_t BulkStorage::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t bl
}
uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) {
return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast <uint8_t*>(buf), blocks) != USBH_OK;
return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast<uint8_t*>(buf), blocks) != USBH_OK;
}
#endif // USE_OTG_USB_HOST && USBHOST
+18 -4
View File
@@ -84,7 +84,7 @@
#if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE
USBSerial SerialUSB;
DefaultSerial MSerial(true, SerialUSB);
DefaultSerial1 MSerial0(true, SerialUSB);
#if ENABLED(EMERGENCY_PARSER)
#include "../libmaple/usb/stm32f1/usb_reg_map.h"
@@ -107,7 +107,7 @@
len = usb_cdcacm_peek(buf, total);
for (uint32 i = 0; i < len; i++)
emergency_parser.update(MSerial.emergency_state, buf[i + total - len]);
emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]);
}
#endif
#endif
@@ -132,6 +132,9 @@ const uint8_t adc_pins[] = {
#if HAS_TEMP_CHAMBER
TEMP_CHAMBER_PIN,
#endif
#if HAS_TEMP_COOLER
TEMP_COOLER_PIN,
#endif
#if HAS_TEMP_ADC_1
TEMP_1_PIN,
#endif
@@ -189,6 +192,9 @@ enum TempPinIndex : char {
#if HAS_TEMP_CHAMBER
TEMP_CHAMBER,
#endif
#if HAS_TEMP_COOLER
TEMP_COOLER_PIN,
#endif
#if HAS_TEMP_ADC_1
TEMP_1,
#endif
@@ -272,6 +278,8 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) {
} }
#endif
TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
void HAL_init() {
NVIC_SetPriorityGrouping(0x3);
#if PIN_EXISTS(LED)
@@ -285,8 +293,9 @@ void HAL_init() {
#if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay(1000); // Give OS time to notice
OUT_WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler
}
// HAL idle task
@@ -382,6 +391,9 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
#if HAS_TEMP_CHAMBER
case TEMP_CHAMBER_PIN: pin_index = TEMP_CHAMBER; break;
#endif
#if HAS_TEMP_COOLER
case TEMP_COOLER_PIN: pin_index = TEMP_COOLER; break;
#endif
#if HAS_TEMP_ADC_1
case TEMP_1_PIN: pin_index = TEMP_1; break;
#endif
@@ -441,6 +453,8 @@ void analogWrite(pin_t pin, int 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__
+30 -25
View File
@@ -36,7 +36,6 @@
#include "fastio.h"
#include "watchdog.h"
#include <stdint.h>
#include <util/atomic.h>
@@ -53,7 +52,7 @@
// ------------------------
#ifndef STM32_FLASH_SIZE
#if EITHER(MCU_STM32F103RE, MCU_STM32F103VE)
#if ANY(MCU_STM32F103RE, MCU_STM32F103VE, MCU_STM32F103ZE)
#define STM32_FLASH_SIZE 512
#else
#define STM32_FLASH_SIZE 256
@@ -61,13 +60,12 @@
#endif
#ifdef SERIAL_USB
typedef ForwardSerial0Type< USBSerial > DefaultSerial;
extern DefaultSerial MSerial;
#if !HAS_SD_HOST_DRIVE
#define UsbSerial MSerial
#else
typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
extern DefaultSerial1 MSerial0;
#if HAS_SD_HOST_DRIVE
#define UsbSerial MarlinCompositeSerial
#else
#define UsbSerial MSerial0
#endif
#endif
@@ -81,24 +79,33 @@
#endif
#if SERIAL_PORT == -1
#define MYSERIAL0 UsbSerial
#define MYSERIAL1 UsbSerial
#elif WITHIN(SERIAL_PORT, 1, NUM_UARTS)
#define MYSERIAL0 MSERIAL(SERIAL_PORT)
#elif NUM_UARTS == 5
#error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#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
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1
#define MYSERIAL1 UsbSerial
#define MYSERIAL2 UsbSerial
#elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS)
#define MYSERIAL1 MSERIAL(SERIAL_PORT_2)
#elif NUM_UARTS == 5
#error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration."
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#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
@@ -107,10 +114,9 @@
#define MMU2_SERIAL UsbSerial
#elif WITHIN(MMU2_SERIAL_PORT, 1, NUM_UARTS)
#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
#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
@@ -119,10 +125,9 @@
#define LCD_SERIAL UsbSerial
#elif WITHIN(LCD_SERIAL_PORT, 1, NUM_UARTS)
#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
#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
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
@@ -195,7 +200,7 @@ void HAL_clear_reset_source();
// Reset reason
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);
+118
View File
@@ -0,0 +1,118 @@
/**
* 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
* Copyright (c) 2017 Victor Perez
*
* 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/>.
*
*/
#ifdef __STM32F1__
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(POSTMORTEM_DEBUGGING)
#include "../shared/HAL_MinSerial.h"
#include "watchdog.h"
#include <libmaple/usart.h>
#include <libmaple/rcc.h>
#include <libmaple/nvic.h>
/* Instruction Synchronization Barrier */
#define isb() __asm__ __volatile__ ("isb" : : : "memory")
/* Data Synchronization Barrier */
#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
static void TXBegin() {
#if !WITHIN(SERIAL_PORT, 1, 6)
#warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error."
#warning "Disabling the severe error reporting feature currently because the used serial port is not a HW port."
#else
// We use MYSERIAL1 here, so we need to figure out how to get the linked register
struct usart_dev* dev = MYSERIAL1.c_dev();
// Or use this if removing libmaple
// int irq = dev->irq_num;
// int nvicUART[] = { NVIC_USART1 /* = 37 */, NVIC_USART2 /* = 38 */, NVIC_USART3 /* = 39 */, NVIC_UART4 /* = 52 */, NVIC_UART5 /* = 53 */ };
// Disabling irq means setting the bit in the NVIC ICER register located at
// Disable UART interrupt in NVIC
nvic_irq_disable(dev->irq_num);
// Use this if removing libmaple
//SBI(NVIC_BASE->ICER[1], irq - 32);
// We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
dsb();
isb();
rcc_clk_disable(dev->clk_id);
rcc_clk_enable(dev->clk_id);
usart_reg_map *regs = dev->regs;
regs->CR1 = 0; // Reset the USART
regs->CR2 = 0; // 1 stop bit
// If we don't touch the BRR (baudrate register), we don't need to recompute. Else we would need to call
usart_set_baud_rate(dev, 0, BAUDRATE);
regs->CR1 = (USART_CR1_TE | USART_CR1_UE); // 8 bits, no parity, 1 stop bit
#endif
}
// A SW memory barrier, to ensure GCC does not overoptimize loops
#define sw_barrier() __asm__ volatile("": : :"memory");
static void TX(char c) {
#if WITHIN(SERIAL_PORT, 1, 6)
struct usart_dev* dev = MYSERIAL1.c_dev();
while (!(dev->regs->SR & USART_SR_TXE)) {
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
sw_barrier();
}
dev->regs->DR = c;
#endif
}
void install_min_serial() {
HAL_min_serial_init = &TXBegin;
HAL_min_serial_out = &TX;
}
#if DISABLED(DYNAMIC_VECTORTABLE) && DISABLED(STM32F0xx) // Cortex M0 can't branch to a symbol that's too far, so we have a specific hack for them
extern "C" {
__attribute__((naked)) void JumpHandler_ASM() {
__asm__ __volatile__ (
"b CommonHandler_ASM\n"
);
}
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __exc_hardfault();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __exc_busfault();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __exc_usagefault();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __exc_memmanage();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __exc_nmi();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __stm32reservedexception7();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __stm32reservedexception8();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __stm32reservedexception9();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __stm32reservedexception10();
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) __stm32reservedexception13();
}
#endif
#endif // POSTMORTEM_DEBUGGING
#endif // __STM32F1__
+3 -3
View File
@@ -123,7 +123,7 @@ uint8_t spiRec() {
*
* @details Uses DMA
*/
void spiRead(uint8_t* buf, uint16_t nbyte) {
void spiRead(uint8_t *buf, uint16_t nbyte) {
SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
}
@@ -146,7 +146,7 @@ void spiSend(uint8_t b) {
*
* @details Use DMA
*/
void spiSendBlock(uint8_t token, const uint8_t* buf) {
void spiSendBlock(uint8_t token, const uint8_t *buf) {
SPI.send(token);
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
}
@@ -160,7 +160,7 @@ uint8_t spiRec(uint32_t chan) { return SPI.transfer(0xFF); }
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
// Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n) {
void spiSend(uint32_t chan, const uint8_t *buf, size_t n) {
for (size_t p = 0; p < n; p++) spiSend(chan, buf[p]);
}
+4 -4
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) {
// 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
regs->DR;
}
@@ -134,12 +134,12 @@ constexpr bool IsSerialClassAllowed(const HardwareSerial&) { return false; }
// If you encounter this error, replace SerialX with MSerialX, for example MSerial3.
// Non-TMC ports were already validated in HAL.h, so do not require verbose error messages.
#ifdef MYSERIAL0
CHECK_CFG_SERIAL(MYSERIAL0);
#endif
#ifdef MYSERIAL1
CHECK_CFG_SERIAL(MYSERIAL1);
#endif
#ifdef MYSERIAL2
CHECK_CFG_SERIAL(MYSERIAL2);
#endif
#ifdef LCD_SERIAL
CHECK_CFG_SERIAL(LCD_SERIAL);
#endif
+1 -1
View File
@@ -47,7 +47,7 @@ struct MarlinSerial : public HardwareSerial {
#endif
};
typedef Serial0Type<MarlinSerial> MSerialT;
typedef Serial1Class<MarlinSerial> MSerialT;
extern MSerialT MSerial1;
extern MSerialT MSerial2;
+3 -6
View File
@@ -19,14 +19,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef __STM32F1__
/**
* PersistentStore for Arduino-style EEPROM interface
* with simple implementations supplied by Marlin.
*/
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h"
#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::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
size_t written = 0;
uint16_t written = 0;
while (size--) {
uint8_t v = *value;
uint8_t * const p = (uint8_t * const)pos;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
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);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
+2 -2
View File
@@ -48,8 +48,8 @@ static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false;
bool PersistentStore::access_start() {
const uint32_t* source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
uint32_t* destination = reinterpret_cast<uint32_t*>(ram_eeprom);
const uint32_t *source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
uint32_t *destination = reinterpret_cast<uint32_t*>(ram_eeprom);
static_assert(0 == (MARLIN_EEPROM_SIZE) % 4, "MARLIN_EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe
constexpr size_t eeprom_size_u32 = (MARLIN_EEPROM_SIZE) / 4;

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