Squashed commit of the following:

commit 4b9fce2e85
Merge: ecb08b15be e17d710c5c
Author: Sergey <sergey@terentiev.me>
Date:   Mon Dec 27 16:47:22 2021 +0300

    Merge branch '2.0.x' into vanilla_fb_2.0.x

commit e17d710c5c
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sat Dec 25 22:13:20 2021 -0600

    🔖 Marlin 2.0.9.3

commit 9b13ae2399
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Sat Dec 25 19:41:01 2021 -0800

    🐛 Fix MKS Robin E3 NeoPixel pin default (#23350)

commit 06f36dc746
Author: kaidegit <60053077+kaidegit@users.noreply.github.com>
Date:   Sun Dec 26 10:12:20 2021 +0800

    🐛 Fix open for bin rename (#23351)

commit 98eca9cb23
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sat Dec 25 03:27:45 2021 -0600

    🔧 Move MOTHERBOARD closer to top

commit 6268795003
Author: fflosi <34758322+fflosi@users.noreply.github.com>
Date:   Sat Dec 25 05:57:07 2021 -0300

     Per-axis TMC hold multiplier (#23345)

commit b4f0922a7c
Author: Sola <42537573+solawc@users.noreply.github.com>
Date:   Fri Dec 24 14:03:32 2021 +0800

     MKS TinyBee board support (#23340)

    Co-Authored-By: Sola <42537573+solawc@users.noreply.github.com>

commit aef613acd3
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Thu Dec 23 15:19:39 2021 +0700

    🔧 Group FAST_PWM_FAN.options (#23331)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit 9ecfa1d252
Author: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com>
Date:   Tue Dec 21 23:09:55 2021 -0500

     BLTouch High Speed mode runtime configuration (#22916, #23337)

    Co-Authored-By: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit e0bed1e344
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Wed Dec 22 15:44:04 2021 +1300

     Option to reset EEPROM on first run (#23276)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit d21fa25ab8
Author: Spencer Owen <owenspencer@gmail.com>
Date:   Sat Dec 18 18:58:46 2021 -0700

     Creality3D V4.2.3 / Ender-2 Pro board (#23307)

commit 0dc1a58b24
Author: X-Ryl669 <boite.pour.spam@gmail.com>
Date:   Tue Dec 14 07:22:06 2021 +0100

     Configurations embed and retrieve (#21321, #23303)

commit f2ca70e232
Author: John Lagonikas <39417467+zeleps@users.noreply.github.com>
Date:   Wed Dec 8 20:55:09 2021 +0200

    🐛 Fix and improve MAX31865 (#23215)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit a6bed22839
Author: BigTreeTech <38851044+bigtreetech@users.noreply.github.com>
Date:   Sat Dec 11 03:38:03 2021 +0800

     BigTreeTech SKR mini E3 V3.0 (STM32G0B1RET6) (#23283)

commit efd67cf80d
Author: Giuseppe499 <giuseppe499@live.it>
Date:   Tue Dec 7 02:53:51 2021 +0100

     X Twist Compensation & Calibration (#23238)

commit 15204470a8
Author: ladismrkolj <ladismrkolj@gmail.com>
Date:   Sun Dec 5 22:41:39 2021 +0100

    🔧 Chamber Fan index option (#23262)

commit 48358d6a5c
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Fri Dec 3 12:48:48 2021 -0600

    🏗️ Fix Maple HAL/STM32F1 PWM (#23211)

commit d7abb891cd
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Fri Dec 3 19:31:48 2021 +0100

    🏗️ Rework STM32 timer frequency protection (#23187)

commit 52a44eb200
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Tue Nov 30 15:04:05 2021 -0600

    🐛 Fix STM32 FastPWM

commit 9b1c0a75e1
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Nov 27 18:33:32 2021 -0600

    🎨 Rename HAL timer elements

commit d75e7784e5
Author: schmttc <89831403+schmttc@users.noreply.github.com>
Date:   Wed Nov 24 08:52:18 2021 +1100

     EasyThreeD ET4000+ board and UI (#23080)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit 0e60c8b7e0
Author: John Robertson <john@cirtech.co.uk>
Date:   Tue Nov 23 21:24:24 2021 +0000

     MarkForged YX kinematics (#23163)

commit 018c7b1cf4
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Sun Nov 21 11:25:06 2021 -0800

     BigTreeTech Mini 12864 V1.0 (#23130)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit af1d603374
Author: Giuliano Zaro <3684609+GMagician@users.noreply.github.com>
Date:   Tue Nov 23 21:01:53 2021 +0100

     Fan tachometer support (#23086, #23180, #23199)

    Co-Authored-By: Scott Lahteine <github@thinkyhead.com>

commit 884308f964
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Nov 16 08:54:30 2021 -0600

    🔧 SOUND_MENU_ITEM for E3V2

commit 7269990413
Author: Miguel Risco-Castillo <mriscoc@users.noreply.github.com>
Date:   Wed Nov 10 11:31:35 2021 -0500

    🚸 Expose sub-options for E3V2 Enhanced (#23099)

commit 2a90d93b17
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Wed Nov 17 09:33:42 2021 -0800

    📌 Overridable probe-related pins (#23107)

commit 6e284f8823
Author: BigTreeTech <38851044+bigtreetech@users.noreply.github.com>
Date:   Wed Nov 10 23:56:10 2021 +0800

     Support for BIQU B1-SE-Plus strain gauge probe (#23101)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit a2349fc411
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Fri Dec 24 23:47:52 2021 -0600

    🔨 Configurable firmware bin filename

    Configuration.h > FIRMWARE_BIN

commit a3964b2b40
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Fri Dec 24 20:59:28 2021 -0600

    🔨 Ignore more generated files

commit 226ee7c1f3
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Fri Dec 24 01:46:51 2021 -0600

    🔧 Sanity check MMU2_MENUS

commit 2c12171f46
Author: Attila BODY <attila.body@gmail.com>
Date:   Fri Dec 24 06:57:20 2021 +0100

    🐛 Fix Robin Nano v3 filament runout pins (#23344)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit d034a9c295
Author: MrAlvin <umo-testing@3iii.dk>
Date:   Thu Dec 23 10:47:52 2021 +0100

    🚸 Show mm'ss during first hour (#23335)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit d2c7104bb3
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Wed Dec 15 07:51:19 2021 +0700

    🚸 Change "SD" to "Media" or "SD/FD" (#23297)

commit 570c7e8638
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Wed Dec 22 13:48:38 2021 +1300

    🐛 Fix Chitu Z_STOP_PIN (#23330)

commit cc4578a3d3
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Thu Dec 23 07:49:15 2021 +0100

    🩹 Fix settings G21 report (#23338)

commit 1db84be66a
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Tue Dec 21 01:26:31 2021 -0600

    🚑️ FAST_PWM_FAN default 1KHz base freq. (#23326)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit 77c9668fe2
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Tue Dec 14 19:25:28 2021 +1300

    🐛 Fix LCD_BED_LEVELING compile (#23298)

commit 22cf9b444e
Author: GHGiampy <83699429+GHGiampy@users.noreply.github.com>
Date:   Mon Dec 20 09:44:43 2021 +0100

    🧑‍💻 Option allowing > 127 Neopixels (#23322)

commit 97798d1e47
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Thu Jul 8 01:33:49 2021 -0500

    🎨 Update SKR V2 pins

commit f4b808456a
Author: Giuliano Zaro <3684609+GMagician@users.noreply.github.com>
Date:   Tue Dec 14 01:47:57 2021 +0100

    🚸 Use M600 for disabled MMU (#21865)

commit 6264736968
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Tue Dec 14 01:41:21 2021 +0100

    🐛 Fix TFT_COLOR_UI Release Media issue (#23123)

commit 7a5f103bcf
Author: John Lagonikas <39417467+zeleps@users.noreply.github.com>
Date:   Sat Dec 18 01:31:10 2021 +0200

    🔧 Warning for IGNORE_THERMOCOUPLE_ERRORS (#23312)

commit 1a8307b196
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sat Dec 18 17:38:29 2021 -0600

    📝 Fix a config comment

commit 13a1c86ae8
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Tue Dec 14 13:18:24 2021 +1300

     M115 flag EXTENDED_M20 (#22941)

commit 15656201d2
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Tue Dec 14 13:13:34 2021 +1300

    ✏️ Clean up duplicate defs (#23182)

commit f3e372cb4c
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Tue Dec 14 07:11:52 2021 +0700

    🩹 Init fan speed at boot (#23181)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit c781ecc437
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Mon Dec 13 16:15:46 2021 -0600

    🔧 Fix unknown board test

commit daa8fff6c6
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sun Dec 12 16:16:40 2021 -0600

    🩹 SD abort requires open file

    See #22566

commit d481bba327
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Sun Dec 12 11:06:45 2021 +1300

    🐛 Fix MARLIN_F103Rx variant SCK / MOSI pins (#23282)

commit 32b08ae04c
Author: Scott Alfter <scott@alfter.us>
Date:   Wed Dec 8 23:18:04 2021 -0800

    Fix Endstops::report_states (#23280)

    Fix regression 4d45fdf0eb

commit f00a0356c7
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Wed Dec 8 18:36:08 2021 -0600

    🎨 Misc. probe / endstop cleanup

commit 9871800874
Author: Sola <42537573+solawc@users.noreply.github.com>
Date:   Thu Dec 9 03:37:45 2021 +0800

    🐛 Fix MKS LVGL UI retraction (#23267)

commit 39c2c038be
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Thu Dec 9 02:15:31 2021 +0700

    🩹 Coerce pin_t in set_pwm_duty macros (#23273)

commit 285d6488a3
Author: Jason Smith <jason.inet@gmail.com>
Date:   Wed Dec 8 11:10:37 2021 -0800

    🐛 Fix ACTION_ITEM with nullptr (#23195)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit eecbd09a46
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Thu Dec 9 01:57:50 2021 +0700

    🚸 Onboard SD for SKR 2.0 / SKR PRO (#23274)

commit 8d4e4ac115
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Wed Dec 8 12:40:23 2021 -0600

    🎨 Rename MAX31865 elements

commit b77a5d4c8d
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Mon Dec 6 20:18:50 2021 -0600

    ✏️ MAX31856 => MAX31865

commit c3b8b3e7e6
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Mon Dec 6 15:52:18 2021 -0600

    🩹 Fix non-PWM cutter compile (#23169)

commit 7123b15801
Author: Stuart Pittaway <1201909+stuartpittaway@users.noreply.github.com>
Date:   Mon Dec 6 21:40:18 2021 +0000

    🐛 Fix TWIBus Wire.begin call (#23183)

commit 8a2f13d657
Author: Chris Pepper <p3p@p3psoft.co.uk>
Date:   Sun Dec 5 22:18:02 2021 +0000

    🐛 HAL_reboot for native HAL (#23246)

commit 251d9fc1d7
Author: tommywienert <53783769+tommywienert@users.noreply.github.com>
Date:   Sun Dec 5 23:16:23 2021 +0100

    🐛 Fix env:chitu_f103 (#23225)

commit 5eeb9650b5
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Mon Dec 6 10:42:56 2021 +1300

    📌 More Longer3D LKx Pro serial tests  (#23260)

commit c0addd1d33
Author: Stuart Pittaway <1201909+stuartpittaway@users.noreply.github.com>
Date:   Sat Dec 4 23:44:10 2021 +0000

     M3426 to read i2c MCP3426 ADC (#23184)

commit 05b57278d4
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Dec 4 17:17:10 2021 -0600

    🔧 Cutter pins for SKR 2.0

commit aa3ec2fbfd
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Sun Dec 5 05:14:19 2021 +0700

    🚸 Park nozzle on "loud kill" (#23172)

commit 4468516aa2
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Sun Dec 5 11:10:29 2021 +1300

     BigTree SKR 2 with F429 (#23177)

commit 95d006b406
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Sat Dec 4 09:48:54 2021 +1300

    🐛 Fix TIMER_TONE for ZM3E4 (#23212)

commit 5b057b4bcf
Author: Jiri Jirus <jiri.jirus@cloudaper.com>
Date:   Tue Nov 30 21:46:48 2021 +0100

    🩹 Assume 4K EEPROM for RUMBA32 BTT (#23205)

commit 77af48e547
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Nov 30 13:03:31 2021 -0600

    🐛 Fix STM32 FastPWM

commit 0f7f709aad
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Sat Nov 27 14:59:32 2021 -0800

    ✏️ Fix Unicode (#23186)

commit a8c0e11cb1
Author: Jason Smith <jason.inet@gmail.com>
Date:   Sat Nov 27 13:54:39 2021 -0800

    🩹 Handle nullptr in CardReader::printLongPath (#23197)

commit 0556da85b0
Author: Anson Liu <ansonl@users.noreply.github.com>
Date:   Sat Nov 27 17:58:05 2021 -0500

    🩹 UM2 extruder cooling fan on PJ6 (#23194)

commit 93652e5c6f
Author: George Fu <nailao_5918@163.com>
Date:   Sun Nov 28 03:26:53 2021 +0800

      FYSETC Spider v2.2 (#23208)

commit f3fc1d15a3
Author: Giuliano Zaro <3684609+GMagician@users.noreply.github.com>
Date:   Tue Nov 23 22:33:33 2021 +0100

    🩹 Fix include path (#23150)

commit 3148060550
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Tue Nov 23 13:54:31 2021 -0800

    📌 Biqu BX temporary framework workaround (#23131)

commit 5f08864d1f
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Tue Nov 23 14:05:50 2021 -0600

    🐛 Fix STM32 set_pwm_duty (#23125)

commit 184fc36a08
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Sun Nov 21 20:13:01 2021 +0100

    🐛 Fix TFT backlight sleep/wake (#23153)

commit 281ed99868
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Sat Nov 20 02:44:53 2021 +0100

    ️ Reduce calls to set fan PWM (#23149)

commit 2cc4a1b326
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Wed Nov 17 13:01:44 2021 -0600

    🎨 Misc formatting

commit c5bd08755c
Author: BigTreeTech <38851044+bigtreetech@users.noreply.github.com>
Date:   Thu Nov 18 01:35:28 2021 +0800

    🐛 Init PROBE_ENABLE_PIN (#23133)

commit 99f58f63f2
Author: luzpaz <luzpaz@users.noreply.github.com>
Date:   Wed Nov 17 12:09:01 2021 -0500

    🎨 Fix misspelling (#23137)

commit c2a674d2c1
Author: espr14 <espr14@gmail.com>
Date:   Wed Nov 17 18:07:11 2021 +0100

    🏗️ Planner::busy() (#23145)

commit feffc19867
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Tue Nov 16 14:06:36 2021 -0600

    🐛 Fix fast PWM WGM code

    Followup to #23102

commit f637e1c501
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Tue Nov 16 12:49:25 2021 -0600

    🔨 Bring Makefile up to date

commit 78240a279b
Author: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com>
Date:   Tue Nov 16 19:32:43 2021 +0300

    🔨 Ignore sim flashdrive file (#23129)

commit 656034d2d9
Author: Luc Van Daele <lvd@sound-silence.com>
Date:   Tue Nov 16 16:24:53 2021 +0100

    🐛 Fix G33, Delta radii, reachable (#22795)

commit 39a81d167e
Author: Mikhail Basov <github@basov.net>
Date:   Mon Nov 15 07:46:34 2021 +0300

    🚸 LCD_SHOW_E_TOTAL for TFT_COLOR_UI (#23127)

commit cb1570d162
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sun Nov 14 17:19:57 2021 -0600

    🐛 Fix SENSORLESS_HOMING for 6-axis

commit 8cb646cc20
Author: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com>
Date:   Mon Nov 15 00:15:07 2021 +0300

    🚸 Simplify touchscreen calibration for SimUI (#23124)

commit 3cccb21dc9
Author: Miguel Risco-Castillo <mriscoc@users.noreply.github.com>
Date:   Wed Nov 10 11:55:20 2021 -0500

    🚸 Fix up E3V2 Enhanced (#23100)

commit 7f4a49cc44
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Fri Oct 22 13:21:26 2021 -0500

    🎨 Misc. issue review patches

commit e0c439fe91
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Sun Nov 14 05:55:31 2021 -0600

    ️ Controller Fan software PWM (etc.) (#23102)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit 49e233e06f
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Fri Nov 12 21:26:19 2021 +0100

    🎨 MPX ARM Mini pins cleanup (#23113)

commit b662dd1f92
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Fri Nov 12 12:14:28 2021 -0600

    🐛 [LCP1768] Init PWM in set_pwm_duty (#23110)

commit 700cae43ab
Author: Skruppy <skruppy@onmars.eu>
Date:   Fri Nov 12 15:57:24 2021 +0100

    🩹 Fix RGB case light compile (#23108)

commit 1c74c6e7ac
Author: George Fu <nailao_5918@163.com>
Date:   Wed Nov 10 23:58:20 2021 +0800

    🐛 Fix FYSETC Cheetah 2.0 pins for production (#23104)

commit 757a9477db
Author: Minims <github@minims.fr>
Date:   Sun Oct 10 01:10:21 2021 +0200

    🩹 Adjust GTR 1.0 ST7920 display delay (#22904)

commit 59d43408f6
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sat Dec 25 00:57:30 2021 -0600

    fix breaks in F() resolution

commit 1d8941d008
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Oct 5 21:35:31 2021 -0500

    🔨 Port libsdl2_net required for macOS simulator

commit 17f853d99c
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Tue Nov 9 08:30:02 2021 -0800

    ️ BTT002 (STM32F407VET6) variant, MK3_FAN_PINS flag (#23093)

commit 6f9f25dbb2
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sun Nov 7 01:11:51 2021 -0600

    🎨 Misc. code cleanup

commit 0273a68587
Author: VragVideo <91742261+VragVideo@users.noreply.github.com>
Date:   Sun Oct 3 06:12:51 2021 +0300

     WYH L12864 LCD (Alfawise Ex8) (#22863)

commit 58a26fcaac
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Sat Nov 6 23:09:15 2021 -0700

    🚸 Indicate Preheating for probe / leveling (#23088)

commit 489aca03ff
Author: Evgeniy Zhabotinskiy <evg-zhabotinsky@users.noreply.github.com>
Date:   Sun Nov 7 07:16:18 2021 +0300

    🩹 Fix M503 report (#23084)

commit f32e19e1c6
Author: Jin <3448324+jinhong-@users.noreply.github.com>
Date:   Sun Nov 7 11:53:36 2021 +0800

    🍻 Preliminary fix for Max31865 SPI (#22682)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit 57bd04b6ce
Author: dwzg <50058606+dwzg@users.noreply.github.com>
Date:   Sun Nov 7 04:48:00 2021 +0100

    🐛 Fix JyersUI scrolling filename, etc. (#23082)

    Co-authored-by: Scott Lahteine <github@thinkyhead.com>

commit 396df93220
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Sun Nov 7 15:27:53 2021 +1300

    🐛 Fix DGUS Reloaded status message (#23090)

commit 9b76b58b79
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Thu Nov 4 12:18:23 2021 -0500

    🍻 Get/clear reset source earlier

    Followup to #23075

commit 9fffed7160
Author: Skruppy <skruppy@onmars.eu>
Date:   Thu Nov 4 18:11:57 2021 +0100

    🐛 Prevent AVR watchdogpile (#23075)

commit fd136d5501
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Thu Nov 4 18:04:04 2021 +0100

    🐛 Fix TFT backlight [STM32] (#23062)

commit 89ec1c71f0
Author: BigTreeTech <38851044+bigtreetech@users.noreply.github.com>
Date:   Thu Nov 4 18:54:38 2021 +0800

    🐛 Fix Octopus-Pro Max31865 / SPI (#23072)

commit fc2020c6ec
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Thu Nov 4 17:28:42 2021 +0700

    🔨 Fix IntelliSense / PIO conflicts (#23058)

    Co-authored-by: Scott Lahteine <github@thinkyhead.com>

commit f97635de36
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Thu Nov 4 14:04:06 2021 +1300

    📌 'STOP' auto-assign, some Chitu V9 pins (#22889)

    Co-authored-by: Scott Lahteine <github@thinkyhead.com>

commit a0a57406a2
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Wed Nov 3 07:06:31 2021 -0500

    🔨 Script 'mfprep' finds pending commits

commit 5efef86cfa
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Wed Nov 3 07:02:21 2021 -0500

    🔨 Update git helper scripts

commit 20c747753d
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Nov 2 01:28:00 2021 -0500

    🔨 Support ABM in mf scripts

commit 08a9c61587
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Mon Nov 1 23:15:29 2021 -0700

    📌 Default NeoPixel pin for MKS Robin E3/E3D (#23060)

commit 0d91b07797
Author: Andrei M <22990561+andrei-moraru@users.noreply.github.com>
Date:   Tue Nov 2 01:47:16 2021 -0400

    ⚗️ Use pwm_set_duty over analogWrite to set PWM (#23048)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit b033da1782
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Mon Nov 1 22:43:40 2021 -0700

    🔧 Endstop / DIAG homing conflict warning (#23050)

commit 4dcd872be5
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Mon Nov 1 21:23:54 2021 -0700

     Allow Low EJERK with LA, optional (#23054)

commit 7e9e2a7435
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Mon Nov 1 20:23:24 2021 -0700

     Artillery Ruby (STM32F401RCT6) (#23029)

commit 0b84194127
Author: tombrazier <68918209+tombrazier@users.noreply.github.com>
Date:   Mon Nov 1 23:03:50 2021 +0000

    🚸 More flexible Probe Temperature Compensation (#23033)

commit efd9329c81
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Thu Jul 8 01:17:16 2021 -0500

    📝 Tweak EXP comments

commit 5cbb820e29
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Oct 30 23:43:19 2021 -0500

    🔨 Help for GDB remote debugging

commit 5a0166489e
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Oct 30 22:43:02 2021 -0500

    🩹 Fix linker error (transfer_port_index)

commit 692c9a6312
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Oct 30 04:16:37 2021 -0500

    💚 Update Ender-3 V2 config path

    MarlinFirmware/Configurations#600

commit 545d14f9a5
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Oct 30 01:39:33 2021 -0500

    🎨 Adjust Ender-3 V2 DWIN options

commit 7b9e01eb2b
Author: aalku <aalku7@gmail.com>
Date:   Sat Oct 30 07:17:20 2021 +0200

     Shutdown Host Action (#22908)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit 8562f0ec44
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Fri Oct 29 20:46:55 2021 -0500

     "Rutilea" ESP32 board (#22880)

commit 6f59d8171f
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Fri Oct 29 20:42:52 2021 -0500

    🔧 Configuration version 02000903

commit d29a9014f2
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Wed Oct 27 21:36:06 2021 -0500

    🎨 Standard 'cooldown' method

commit 205d867e4b
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Wed Oct 27 20:01:44 2021 -0500

    🎨 Standard material presets behavior

commit 84f9490149
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Wed Oct 27 21:15:58 2021 -0500

    🎨 Define HAS_PREHEAT conditional

commit 1fd4258423
Author: tome9111991 <57866234+tome9111991@users.noreply.github.com>
Date:   Sat Oct 30 00:49:12 2021 +0200

    🐛 Fix E3V2 (CrealityUI) Tune/Prepare > Zoffset (#23040)

commit e8a55972a7
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Thu Oct 28 19:22:35 2021 -0500

    🐛 Fix EZBoard V2 board name

commit aef413202e
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Thu Oct 28 03:26:05 2021 -0700

    🐛 Fix MKS Robin E3/E3D Z Stop/Probe pins (#23034)

commit cbc7dadf42
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Oct 26 21:54:43 2021 -0500

    🎨 Apply HAS_MULTI_HOTEND conditional

commit c508ecc414
Author: Zlopi <zlopi.ru@gmail.com>
Date:   Wed Oct 27 23:10:46 2021 +0300

    🚸 Scroll long filename on MKS TFT (#23031)

commit 384a31765f
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Thu Oct 28 09:06:06 2021 +1300

    🩹 Retain LCD pins with motor expansion (#23024)

commit 0f2c4fc40b
Author: somehibs <hibs@circuitco.de>
Date:   Wed Oct 27 21:00:02 2021 +0100

    🐛 Fix serial PORT_RESTORE (and BUFFER_MONITORING) (#23022)

commit 66a274452c
Author: tome9111991 <57866234+tome9111991@users.noreply.github.com>
Date:   Wed Oct 27 21:58:32 2021 +0200

    🐛 Fix E3V2 (CrealityUI) position display (#23023)

    Followup to #23005, #22778

commit 12f8168d1e
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Oct 26 19:36:16 2021 -0500

    🚸 Tweaks to UBL G29 Q

commit 2142e1dae4
Author: woisy00 <spam@bergermeier.info>
Date:   Wed Oct 27 01:05:34 2021 +0200

    🐛 Fix AUTOTEMP bug (thermal runaway) (#23025)

    Regression from 9823a37

commit 8d21ea55a2
Author: tombrazier <68918209+tombrazier@users.noreply.github.com>
Date:   Mon Oct 25 06:33:40 2021 +0100

    🐛 Add USE_TEMP_EXT_COMPENSATION options (#23007)

commit a0da7e8a1f
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sun Oct 24 23:33:27 2021 -0500

    🔧 Fewer alerts about Z_SAFE_HOMING

commit e2452d6c57
Author: tome9111991 <57866234+tome9111991@users.noreply.github.com>
Date:   Fri Oct 22 18:16:07 2021 +0200

    🐛 Fix SHOW_REMAINING_TIME option for JyersUI (#22999)

commit 5173a3140d
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Fri Oct 22 08:52:31 2021 -0700

     BigTreeTech TFT35 SPI V1.0 (#22986)

commit e44f2b7d2d
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Tue Oct 19 06:05:23 2021 -0500

    🩹 Fix pragma ignored for older GCC (#22978)

commit ed78f7f4e6
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Tue Oct 19 05:59:48 2021 -0500

    🎨 Refactor MOSFET pins layout (#22983)

commit aa198e41dd
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Oct 19 05:52:41 2021 -0500

    🎨 Pragma GCC cleanup

commit 18b38fb58a
Author: Jason Smith <jason.inet@gmail.com>
Date:   Mon Oct 18 01:11:16 2021 -0700

    🐛 Fix max chamber fan speed (#22977)

commit 5d79d8fad6
Author: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com>
Date:   Mon Oct 18 00:57:54 2021 -0700

    🐛 Fix I2C EEPROM SDA/SCL aliases with SKR Mini E3 V2 (#22955)

commit e7a746966d
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Mon Oct 18 20:54:20 2021 +1300

    🐛 Fix MMU1 compile (#22965)

commit 555f35d46f
Author: Mike La Spina <mike.laspina@shaw.ca>
Date:   Mon Oct 18 02:40:47 2021 -0500

    🎨 Suppress type warning (#22976)

commit de77dfcbbd
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sun Oct 17 22:10:08 2021 -0500

    🎨 Add MKS UI goto_previous_ui

commit af08f16efc
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sun Oct 17 20:24:41 2021 -0500

    🚸 Tweak MKS UI G-code console

commit 01a0f3a8cf
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sun Oct 17 18:11:16 2021 -0500

    🎨 Fix up MKS UI defines

commit f80bcdcc5c
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Fri Oct 15 00:24:08 2021 -0500

    🎨 Refactor Host Actions as singleton

commit 1ead7ce681
Author: ellensp <530024+ellensp@users.noreply.github.com>
Date:   Fri Oct 15 14:38:03 2021 +1300

    🔧 Add, update TFT sanity checks (#22928)

commit dffa56463e
Author: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com>
Date:   Tue Oct 12 23:19:05 2021 -0400

    ️ Formbot ST7920 delays, intentional X2 pins (#22915)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit ae98d2e5ea
Author: Dmytro <svetotled@gmail.com>
Date:   Wed Oct 13 05:45:00 2021 +0300

    🎨 Update MKS UI for no bed, extruder (#22938)

    Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>

commit 5b1ef638ee
Author: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com>
Date:   Tue Oct 12 19:40:56 2021 -0400

    🐛 Fix IDEX + DISABLE_INACTIVE_EXTRUDER (#22925)

commit f3be03da20
Author: Stuart Pittaway <1201909+stuartpittaway@users.noreply.github.com>
Date:   Mon Oct 11 23:42:29 2021 +0100

     M261 S I2C output format (#22890)

    Co-authored-by: Scott Lahteine <github@thinkyhead.com>

commit 64128a5bcb
Author: Tanguy Pruvot <tpruvot@users.noreply.github.com>
Date:   Sun Oct 10 01:05:24 2021 +0200

    🐛 Queue string followup (#22900)

commit 0018c94a79
Author: Pyro-Fox <36782094+Pyro-Fox@users.noreply.github.com>
Date:   Sat Oct 9 15:09:50 2021 -0700

    🐛 LCD string followup (#22892)

commit d48cb11537
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Tue Oct 5 21:19:28 2021 -0500

    🐛 Followup to F() in config_line

    Followup to 1dafd1887e

commit d9f7de7a24
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Mon Oct 4 19:50:14 2021 -0500

    🐛 ExtUI F() followups

    Followup to 12b5d997a2

commit 3d102a77ca
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Tue Sep 28 20:15:52 2021 -0500

    🎨 Apply F() to kill / sendinfoscreen

commit 492d70424d
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Tue Sep 28 19:28:29 2021 -0500

    🎨 Apply F() to MKS UI errors, assets

commit 24dbeceb45
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Mon Sep 27 13:46:42 2021 -0500

    🎨 Apply F() to various reports

commit cabd538fdd
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Mon Sep 27 13:40:01 2021 -0500

    🎨 Apply F() to G-code report header

commit 9cf1c3cf05
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sat Sep 25 23:52:41 2021 -0500

    🎨 Apply F() to UTF-8/MMU2 string put

commit c3ae221a10
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Sat Sep 25 22:11:48 2021 -0500

    🎨 Apply F() to some ExtUI functions

commit 7626d859a6
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Mon Sep 27 11:55:08 2021 -0500

    🎨 Apply F() to Host Actions strings

commit 360311f232
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Sep 25 17:05:11 2021 -0500

    🎨 Apply F() to status message

commit 433eedd50f
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Mon Sep 27 11:03:07 2021 -0500

    🎨 Apply F() to serial macros

commit 46c53f6730
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Sep 25 21:11:31 2021 -0500

    🎨 Apply F() to G-code suite and queue

commit 2b9ae0cc33
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Sep 25 18:43:52 2021 -0500

    🎨 Apply F() to G-code subcommands

commit 433a27e475
Author: Scott Lahteine <github@thinkyhead.com>
Date:   Sat Sep 25 18:22:37 2021 -0500

    🎨 Update F string declarations

commit 1de265ea5d
Author: Scott Lahteine <thinkyhead@users.noreply.github.com>
Date:   Mon Oct 4 00:24:41 2021 -0500

    🎨 Axis name string interpolation, with examples (#22879)

commit ecb08b15be
Merge: 798d12c2af 854ce63358
Author: Sergey <sergey@terentiev.me>
Date:   Wed Dec 22 11:58:28 2021 +0300

    Merge branch '2.0.x' into vanilla_fb_2.0.x

commit 854ce63358
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Sun Dec 19 05:33:21 2021 +0700

    🐛 Fix loud_kill heater disable (#23314)

commit 170f77fada
Author: lukrow80 <64228214+lukrow80@users.noreply.github.com>
Date:   Tue Nov 23 22:30:13 2021 +0100

    🐛 Fix homing current for extra axes (#23152)

    Followup to #19112

commit 72b99bf1ba
Author: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com>
Date:   Sat Oct 9 19:13:19 2021 -0400

    🐛 Fix IDEX Duplication Mode Positioning (#22914)

    Fixing #22538

commit 1a8583f4fc
Author: Robby Candra <robbycandra.mail@gmail.com>
Date:   Wed Nov 24 04:19:32 2021 +0700

    🐛 Fix serial_data_available (#23160)
This commit is contained in:
Sergey
2021-12-27 17:18:41 +03:00
parent aed6f4290c
commit 9b2be293eb
733 changed files with 14130 additions and 7216 deletions

View File

@@ -40,31 +40,31 @@
* All rights reserved.
*/
// Useful for RTD debugging.
//#define MAX31865_DEBUG
//#define MAX31865_DEBUG_SPI
#include "../inc/MarlinConfig.h"
#if HAS_MAX31865 && !USE_ADAFRUIT_MAX31865
//#include <SoftwareSPI.h> // TODO: switch to SPIclass/SoftSPI
#include "MAX31865.h"
#ifndef MAX31865_MIN_SAMPLING_TIME_MSEC
#define MAX31865_MIN_SAMPLING_TIME_MSEC 0
#endif
#ifdef TARGET_LPC1768
#include <SoftwareSPI.h>
#endif
#define DEBUG_OUT ENABLED(DEBUG_MAX31865)
#include "../core/debug_out.h"
// The maximum speed the MAX31865 can do is 5 MHz
SPISettings MAX31865::spiConfig = SPISettings(
#if defined(TARGET_LPC1768)
SPI_QUARTER_SPEED
#elif defined(ARDUINO_ARCH_STM32)
SPI_CLOCK_DIV4
#else
500000
#endif
, MSBFIRST
, SPI_MODE_1 // CPOL0 CPHA1
TERN(TARGET_LPC1768, SPI_QUARTER_SPEED, TERN(ARDUINO_ARCH_STM32, SPI_CLOCK_DIV4, 500000)),
MSBFIRST,
SPI_MODE1 // CPOL0 CPHA1
);
#ifndef LARGE_PINMAP
#if DISABLED(LARGE_PINMAP)
/**
* Create the interface object using software (bitbang) SPI for PIN values
@@ -76,10 +76,10 @@ SPISettings MAX31865::spiConfig = SPISettings(
* @param spi_clk the SPI clock pin to use
*/
MAX31865::MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk) {
_cs = spi_cs;
_mosi = spi_mosi;
_miso = spi_miso;
_sclk = spi_clk;
cselPin = spi_cs;
mosiPin = spi_mosi;
misoPin = spi_miso;
sclkPin = spi_clk;
}
/**
@@ -89,11 +89,11 @@ SPISettings MAX31865::spiConfig = SPISettings(
* @param spi_cs the SPI CS pin to use along with the default SPI device
*/
MAX31865::MAX31865(int8_t spi_cs) {
_cs = spi_cs;
_sclk = _miso = _mosi = -1;
cselPin = spi_cs;
sclkPin = misoPin = mosiPin = -1;
}
#else
#else // LARGE_PINMAP
/**
* Create the interface object using software (bitbang) SPI for PIN values
@@ -106,13 +106,11 @@ SPISettings MAX31865::spiConfig = SPISettings(
* @param spi_clk the SPI clock pin to use
* @param pin_mapping set to 1 for positive pin values
*/
MAX31865::MAX31865(uint32_t spi_cs, uint32_t spi_mosi,
uint32_t spi_miso, uint32_t spi_clk,
uint8_t pin_mapping) {
_cs = spi_cs;
_mosi = spi_mosi;
_miso = spi_miso;
_sclk = spi_clk;
MAX31865::MAX31865(uint32_t spi_cs, uint32_t spi_mosi, uint32_t spi_miso, uint32_t spi_clk, uint8_t pin_mapping) {
cselPin = spi_cs;
mosiPin = spi_mosi;
misoPin = spi_miso;
sclkPin = spi_clk;
}
/**
@@ -124,156 +122,139 @@ SPISettings MAX31865::spiConfig = SPISettings(
* @param pin_mapping set to 1 for positive pin values
*/
MAX31865::MAX31865(uint32_t spi_cs, uint8_t pin_mapping) {
_cs = spi_cs;
_sclk = _miso = _mosi = -1UL; //-1UL or 0xFFFFFFFF or 4294967295
cselPin = spi_cs;
sclkPin = misoPin = mosiPin = -1UL; //-1UL or 0xFFFFFFFF or 4294967295
}
#endif // LARGE_PINMAP
/**
*
* Instance & Class methods
*
*/
/**
* Initialize the SPI interface and set the number of RTD wires used
*
* @param wires The number of wires in enum format. Can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE.
* @param zero The resistance of the RTD at 0 degC, in ohms.
* @param ref The resistance of the reference resistor, in ohms.
* @param wire The resistance of the wire connecting the sensor to the RTD, in ohms.
*/
void MAX31865::begin(max31865_numwires_t wires, float zero, float ref) {
Rzero = zero;
Rref = ref;
void MAX31865::begin(max31865_numwires_t wires, float zero_res, float ref_res, float wire_res) {
zeroRes = zero_res;
refRes = ref_res;
wireRes = wire_res;
OUT_WRITE(_cs, HIGH);
pinMode(cselPin, OUTPUT);
digitalWrite(cselPin, HIGH);
if (_sclk != TERN(LARGE_PINMAP, -1UL, -1)) {
// Define pin modes for Software SPI
#ifdef MAX31865_DEBUG
SERIAL_ECHOLN("Initializing MAX31865 Software SPI");
#endif
OUT_WRITE(_sclk, LOW);
SET_OUTPUT(_mosi);
SET_INPUT(_miso);
}
if (sclkPin != TERN(LARGE_PINMAP, -1UL, 255))
softSpiBegin(SPI_QUARTER_SPEED); // Define pin modes for Software SPI
else {
// Start and configure hardware SPI
#ifdef MAX31865_DEBUG
SERIAL_ECHOLN("Initializing MAX31865 Hardware SPI");
#endif
SPI.begin();
DEBUG_ECHOLNPGM("Initializing MAX31865 Hardware SPI");
SPI.begin(); // Start and configure hardware SPI
}
setWires(wires);
enableBias(false);
autoConvert(false);
clearFault();
initFixedFlags(wires);
#ifdef MAX31865_DEBUG_SPI
#ifndef LARGE_PINMAP
SERIAL_ECHOLNPGM(
"Regular begin call with _cs: ", _cs,
" _miso: ", _miso,
" _sclk: ", _sclk,
" _mosi: ", _mosi
);
#else
SERIAL_ECHOLNPGM(
"LARGE_PINMAP begin call with _cs: ", _cs,
" _miso: ", _miso,
" _sclk: ", _sclk,
" _mosi: ", _mosi
);
#endif // LARGE_PINMAP
clearFault(); // also initializes flags
SERIAL_ECHOLNPGM("config: ", readRegister8(MAX31856_CONFIG_REG));
SERIAL_EOL();
#endif // MAX31865_DEBUG_SPI
#if DISABLED(MAX31865_USE_AUTO_MODE) // make a proper first 1 shot read to initialize _lastRead
enableBias();
DELAY_US(11500);
oneShot();
DELAY_US(65000);
uint16_t rtd = readRegister16(MAX31865_RTDMSB_REG);
if (rtd & 1) {
lastRead = 0xFFFF; // some invalid value
lastFault = readRegister8(MAX31865_FAULTSTAT_REG);
clearFault(); // also clears the bias voltage flag, so no further action is required
DEBUG_ECHOLNPGM("MAX31865 read fault: ", rtd);
}
else {
DEBUG_ECHOLNPGM("RTD MSB:", (rtd >> 8), " RTD LSB:", (rtd & 0x00FF));
resetFlags();
lastRead = rtd;
nextEvent = SETUP_BIAS_VOLTAGE;
millis_t now = millis();
nextEventStamp = now + MAX31865_MIN_SAMPLING_TIME_MSEC;
TERN_(MAX31865_USE_READ_ERROR_DETECTION, lastReadStamp = now);
}
#endif // !MAX31865_USE_AUTO_MODE
DEBUG_ECHOLNPGM(
TERN(LARGE_PINMAP, "LARGE_PINMAP", "Regular")
" begin call with cselPin: ", cselPin,
" misoPin: ", misoPin,
" sclkPin: ", sclkPin,
" mosiPin: ", mosiPin,
" config: ", readRegister8(MAX31865_CONFIG_REG)
);
}
/**
* Read the raw 8-bit FAULTSTAT register
* Return and clear the last fault value
*
* @return The raw unsigned 8-bit FAULT status register
* @return The raw unsigned 8-bit FAULT status register or spike fault
*/
uint8_t MAX31865::readFault() {
return readRegister8(MAX31856_FAULTSTAT_REG);
uint8_t r = lastFault;
lastFault = 0;
return r;
}
/**
* Clear all faults in FAULTSTAT.
* Clear last fault
*/
void MAX31865::clearFault() {
setConfig(MAX31856_CONFIG_FAULTSTAT, 1);
setConfig(MAX31865_CONFIG_FAULTSTAT, 1);
}
/**
* Whether we want to have continuous conversions (50/60 Hz)
*
* @param b If true, auto conversion is enabled
* Reset flags
*/
void MAX31865::autoConvert(bool b) {
setConfig(MAX31856_CONFIG_MODEAUTO, b);
}
/**
* Whether we want filter out 50Hz noise or 60Hz noise
*
* @param b If true, 50Hz noise is filtered, else 60Hz(default)
*/
void MAX31865::enable50HzFilter(bool b) {
setConfig(MAX31856_CONFIG_FILT50HZ, b);
void MAX31865::resetFlags() {
writeRegister8(MAX31865_CONFIG_REG, stdFlags);
}
/**
* Enable the bias voltage on the RTD sensor
*
* @param b If true bias is enabled, else disabled
*/
void MAX31865::enableBias(bool b) {
setConfig(MAX31856_CONFIG_BIAS, b);
// From the datasheet:
// Note that if VBIAS is off (to reduce supply current between conversions), any filter
// capacitors at the RTDIN inputs need to charge before an accurate conversion can be
// performed. Therefore, enable VBIAS and wait at least 10.5 time constants of the input
// RC network plus an additional 1ms before initiating the conversion.
if (b)
DELAY_US(11500); //11.5ms
void MAX31865::enableBias() {
setConfig(MAX31865_CONFIG_BIAS, 1);
}
/**
* Start a one-shot temperature reading.
*/
void MAX31865::oneShot() {
setConfig(MAX31856_CONFIG_1SHOT, 1);
// From the datasheet:
// Note that a single conversion requires approximately 52ms in 60Hz filter
// mode or 62.5ms in 50Hz filter mode to complete. 1-Shot is a self-clearing bit.
// TODO: switch this out depending on the filter mode.
DELAY_US(65000); // 65ms
setConfig(MAX31865_CONFIG_1SHOT | MAX31865_CONFIG_BIAS, 1);
}
/**
* How many wires we have in our RTD setup, can be MAX31865_2WIRE,
* MAX31865_3WIRE, or MAX31865_4WIRE
* Initialize standard flags with flags that will not change during operation (Hz, polling mode and no. of wires)
*
* @param wires The number of wires in enum format
*/
void MAX31865::setWires(max31865_numwires_t wires) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
void MAX31865::initFixedFlags(max31865_numwires_t wires) {
// set config-defined flags (same for all sensors)
stdFlags = TERN(MAX31865_50HZ_FILTER, MAX31865_CONFIG_FILT50HZ, MAX31865_CONFIG_FILT60HZ) |
TERN(MAX31865_USE_AUTO_MODE, MAX31865_CONFIG_MODEAUTO | MAX31865_CONFIG_BIAS, MAX31865_CONFIG_MODEOFF);
if (wires == MAX31865_3WIRE)
t |= MAX31856_CONFIG_3WIRE;
else // 2 or 4 wire
t &= ~MAX31856_CONFIG_3WIRE;
writeRegister8(MAX31856_CONFIG_REG, t);
stdFlags |= MAX31865_CONFIG_3WIRE;
else // 2 or 4 wire
stdFlags &= ~MAX31865_CONFIG_3WIRE;
}
/**
@@ -283,33 +264,96 @@ void MAX31865::setWires(max31865_numwires_t wires) {
* @return The raw unsigned 16-bit register value with ERROR bit attached, NOT temperature!
*/
uint16_t MAX31865::readRaw() {
clearFault();
enableBias(true);
oneShot();
uint16_t rtd = readRegister16(MAX31856_RTDMSB_REG);
#if ENABLED(MAX31865_USE_AUTO_MODE)
const uint16_t rtd = readRegister16(MAX31865_RTDMSB_REG);
DEBUG_ECHOLNPGM("MAX31865 RTD MSB:", (rtd >> 8), " LSB:", (rtd & 0x00FF));
if (rtd & 1) {
lastFault = readRegister8(MAX31865_FAULTSTAT_REG);
lastRead |= 1;
clearFault(); // also clears the bias voltage flag, so no further action is required
DEBUG_ECHOLNPGM("MAX31865 read fault: ", rtd);
}
#if ENABLED(MAX31865_USE_READ_ERROR_DETECTION)
else if (ABS(lastRead - rtd) > 500 && PENDING(millis(), lastReadStamp + 1000)) { // if two readings within a second differ too much (~20°C), consider it a read error.
lastFault = 0x01;
lastRead |= 1;
DEBUG_ECHOLNPGM("MAX31865 read error: ", rtd);
}
#endif
else {
lastRead = rtd;
TERN_(MAX31865_USE_READ_ERROR_DETECTION, lastReadStamp = millis());
}
#else
if (PENDING(millis(), nextEventStamp)) {
DEBUG_ECHOLNPGM("MAX31865 waiting for event ", nextEvent);
return lastRead;
}
switch (nextEvent) {
case SETUP_BIAS_VOLTAGE:
enableBias();
nextEventStamp = millis() + 11; // wait at least 11msec before enabling 1shot
nextEvent = SETUP_1_SHOT_MODE;
DEBUG_ECHOLN("MAX31865 bias voltage enabled");
break;
case SETUP_1_SHOT_MODE:
oneShot();
nextEventStamp = millis() + 65; // wait at least 65msec before reading RTD register
nextEvent = READ_RTD_REG;
DEBUG_ECHOLN("MAX31865 1 shot mode enabled");
break;
case READ_RTD_REG: {
const uint16_t rtd = readRegister16(MAX31865_RTDMSB_REG);
DEBUG_ECHOLNPGM("MAX31865 RTD MSB:", (rtd >> 8), " LSB:", (rtd & 0x00FF));
if (rtd & 1) {
lastFault = readRegister8(MAX31865_FAULTSTAT_REG);
lastRead |= 1;
clearFault(); // also clears the bias voltage flag, so no further action is required
DEBUG_ECHOLNPGM("MAX31865 read fault: ", rtd);
}
#if ENABLED(MAX31865_USE_READ_ERROR_DETECTION)
else if (ABS(lastRead - rtd) > 500 && PENDING(millis(), lastReadStamp + 1000)) { // if two readings within a second differ too much (~20°C), consider it a read error.
lastFault = 0x01;
lastRead |= 1;
DEBUG_ECHOLNPGM("MAX31865 read error: ", rtd);
}
#endif
else {
lastRead = rtd;
TERN_(MAX31865_USE_READ_ERROR_DETECTION, lastReadStamp = millis());
}
if (!(rtd & 1)) // if clearFault() was not invoked, need to clear the bias voltage and 1-shot flags
resetFlags();
nextEvent = SETUP_BIAS_VOLTAGE;
nextEventStamp = millis() + MAX31865_MIN_SAMPLING_TIME_MSEC; // next step should not occur within less than MAX31865_MIN_SAMPLING_TIME_MSEC from the last one
} break;
}
#ifdef MAX31865_DEBUG
SERIAL_ECHOLNPGM("RTD MSB:", (rtd >> 8), " RTD LSB:", (rtd & 0x00FF));
#endif
// Disable the bias to lower power dissipation between reads.
// If the ref resistor heats up, the temperature reading will be skewed.
enableBias(false);
return rtd;
return lastRead;
}
/**
* Calculate and return the resistance value of the connected RTD.
*
* @param refResistor The value of the matching reference resistor, usually 430 or 4300
* @return The raw RTD resistance value, NOT temperature!
*/
float MAX31865::readResistance() {
// Strip the error bit (D0) and convert to a float ratio.
// less precise method: (readRaw() * Rref) >> 16
return (((readRaw() >> 1) / 32768.0f) * Rref);
// less precise method: (readRaw() * refRes) >> 16
return ((readRaw() * RECIPROCAL(65536.0f)) * refRes - wireRes);
}
/**
@@ -326,8 +370,8 @@ float MAX31865::temperature() {
*
* @return Temperature in C
*/
float MAX31865::temperature(uint16_t adcVal) {
return temperature(((adcVal) / 32768.0f) * Rref);
float MAX31865::temperature(uint16_t adc_val) {
return temperature(((adc_val) * RECIPROCAL(32768.0f)) * refRes - wireRes);
}
/**
@@ -335,11 +379,11 @@ float MAX31865::temperature(uint16_t adcVal) {
* Uses the technique outlined in this PDF:
* http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
*
* @param Rrtd the resistance value in ohms
* @return the temperature in degC
* @param rtd_res the resistance value in ohms
* @return the temperature in degC
*/
float MAX31865::temperature(float Rrtd) {
float temp = (RTD_Z1 + sqrt(RTD_Z2 + (RTD_Z3 * Rrtd))) / RTD_Z4;
float MAX31865::temperature(float rtd_res) {
float temp = (RTD_Z1 + sqrt(RTD_Z2 + (RTD_Z3 * rtd_res))) * RECIPROCAL(RTD_Z4);
// From the PDF...
//
@@ -350,17 +394,17 @@ float MAX31865::temperature(float Rrtd) {
// of resistance.
//
if (temp < 0) {
Rrtd = (Rrtd / Rzero) * 100; // normalize to 100 ohm
float rpoly = Rrtd;
rtd_res = (rtd_res / zeroRes) * 100; // normalize to 100 ohm
float rpoly = rtd_res;
temp = -242.02 + (2.2228 * rpoly);
rpoly *= Rrtd; // square
rpoly *= rtd_res; // square
temp += 2.5859e-3 * rpoly;
rpoly *= Rrtd; // ^3
rpoly *= rtd_res; // ^3
temp -= 4.8260e-6 * rpoly;
rpoly *= Rrtd; // ^4
rpoly *= rtd_res; // ^4
temp -= 2.8183e-8 * rpoly;
rpoly *= Rrtd; // ^5
rpoly *= rtd_res; // ^5
temp += 1.5243e-10 * rpoly;
}
@@ -371,7 +415,6 @@ float MAX31865::temperature(float Rrtd) {
// private:
//
/**
* Set a value in the configuration register.
*
@@ -379,12 +422,9 @@ float MAX31865::temperature(float Rrtd) {
* @param enable whether to enable or disable the value
*/
void MAX31865::setConfig(uint8_t config, bool enable) {
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
if (enable)
t |= config;
else
t &= ~config; // disable
writeRegister8(MAX31856_CONFIG_REG, t);
uint8_t t = stdFlags;
if (enable) t |= config; else t &= ~config;
writeRegister8(MAX31865_CONFIG_REG, t);
}
/**
@@ -396,7 +436,6 @@ void MAX31865::setConfig(uint8_t config, bool enable) {
uint8_t MAX31865::readRegister8(uint8_t addr) {
uint8_t ret = 0;
readRegisterN(addr, &ret, 1);
return ret;
}
@@ -407,14 +446,9 @@ uint8_t MAX31865::readRegister8(uint8_t addr) {
* @return both register contents as a single 16-bit int
*/
uint16_t MAX31865::readRegister16(uint8_t addr) {
uint8_t buffer[2] = {0, 0};
uint8_t buffer[2] = { 0 };
readRegisterN(addr, buffer, 2);
uint16_t ret = buffer[0];
ret <<= 8;
ret |= buffer[1];
return ret;
return uint16_t(buffer[0]) << 8 | buffer[1];
}
/**
@@ -426,26 +460,28 @@ uint16_t MAX31865::readRegister16(uint8_t addr) {
*/
void MAX31865::readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n) {
addr &= 0x7F; // make sure top bit is not set
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
if (sclkPin == TERN(LARGE_PINMAP, -1UL, 255))
SPI.beginTransaction(spiConfig);
else
WRITE(_sclk, LOW);
digitalWrite(sclkPin, LOW);
WRITE(_cs, LOW);
spixfer(addr);
digitalWrite(cselPin, LOW);
#ifdef TARGET_LPC1768
DELAY_CYCLES(spiSpeed);
#endif
spiTransfer(addr);
while (n--) {
buffer[0] = spixfer(0xFF);
#ifdef MAX31865_DEBUG_SPI
SERIAL_ECHOLNPGM("buffer read ", n, " data: ", buffer[0]);
#endif
buffer[0] = spiTransfer(0xFF);
buffer++;
}
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
if (sclkPin == TERN(LARGE_PINMAP, -1UL, 255))
SPI.endTransaction();
WRITE(_cs, HIGH);
digitalWrite(cselPin, HIGH);
}
/**
@@ -455,20 +491,24 @@ void MAX31865::readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n) {
* @param data the data to write
*/
void MAX31865::writeRegister8(uint8_t addr, uint8_t data) {
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
if (sclkPin == TERN(LARGE_PINMAP, -1UL, 255))
SPI.beginTransaction(spiConfig);
else
WRITE(_sclk, LOW);
digitalWrite(sclkPin, LOW);
WRITE(_cs, LOW);
digitalWrite(cselPin, LOW);
spixfer(addr | 0x80); // make sure top bit is set
spixfer(data);
#ifdef TARGET_LPC1768
DELAY_CYCLES(spiSpeed);
#endif
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
spiTransfer(addr | 0x80); // make sure top bit is set
spiTransfer(data);
if (sclkPin == TERN(LARGE_PINMAP, -1UL, 255))
SPI.endTransaction();
WRITE(_cs, HIGH);
digitalWrite(cselPin, HIGH);
}
/**
@@ -480,21 +520,43 @@ void MAX31865::writeRegister8(uint8_t addr, uint8_t data) {
* @param x an 8-bit chunk of data to write
* @return the 8-bit response
*/
uint8_t MAX31865::spixfer(uint8_t x) {
if (_sclk == TERN(LARGE_PINMAP, -1UL, -1))
uint8_t MAX31865::spiTransfer(uint8_t x) {
if (sclkPin == TERN(LARGE_PINMAP, -1UL, 255))
return SPI.transfer(x);
uint8_t reply = 0;
for (int i = 7; i >= 0; i--) {
reply <<= 1;
WRITE(_sclk, HIGH);
WRITE(_mosi, x & (1 << i));
WRITE(_sclk, LOW);
if (READ(_miso))
reply |= 1;
}
#ifdef TARGET_LPC1768
return reply;
return swSpiTransfer(x, spiSpeed, sclkPin, misoPin, mosiPin);
#else
uint8_t reply = 0;
for (int i = 7; i >= 0; i--) {
digitalWrite(sclkPin, HIGH); DELAY_NS_VAR(spiDelay);
reply <<= 1;
digitalWrite(mosiPin, x & _BV(i)); DELAY_NS_VAR(spiDelay);
if (digitalRead(misoPin)) reply |= 1;
digitalWrite(sclkPin, LOW); DELAY_NS_VAR(spiDelay);
}
return reply;
#endif
}
void MAX31865::softSpiBegin(const uint8_t spi_speed) {
DEBUG_ECHOLNPGM("Initializing MAX31865 Software SPI");
#ifdef TARGET_LPC1768
swSpiBegin(sclkPin, misoPin, mosiPin);
spiSpeed = swSpiInit(spi_speed, sclkPin, mosiPin);
#else
spiDelay = (100UL << spi_speed) / 3; // Calculate delay in ns. Top speed is ~10MHz, or 100ns delay between bits.
pinMode(sclkPin, OUTPUT);
digitalWrite(sclkPin, LOW);
pinMode(mosiPin, OUTPUT);
pinMode(misoPin, INPUT);
#endif
}
#endif // HAS_MAX31865 && !USE_ADAFRUIT_MAX31865

View File

@@ -41,28 +41,30 @@
*/
#pragma once
//#define DEBUG_MAX31865
#include "../inc/MarlinConfig.h"
#include "../HAL/shared/Delay.h"
#include HAL_PATH(../HAL, MarlinSPI.h)
#define MAX31856_CONFIG_REG 0x00
#define MAX31856_CONFIG_BIAS 0x80
#define MAX31856_CONFIG_MODEAUTO 0x40
#define MAX31856_CONFIG_MODEOFF 0x00
#define MAX31856_CONFIG_1SHOT 0x20
#define MAX31856_CONFIG_3WIRE 0x10
#define MAX31856_CONFIG_24WIRE 0x00
#define MAX31856_CONFIG_FAULTSTAT 0x02
#define MAX31856_CONFIG_FILT50HZ 0x01
#define MAX31856_CONFIG_FILT60HZ 0x00
#define MAX31865_CONFIG_REG 0x00
#define MAX31865_CONFIG_BIAS 0x80
#define MAX31865_CONFIG_MODEAUTO 0x40
#define MAX31865_CONFIG_MODEOFF 0x00
#define MAX31865_CONFIG_1SHOT 0x20
#define MAX31865_CONFIG_3WIRE 0x10
#define MAX31865_CONFIG_24WIRE 0x00
#define MAX31865_CONFIG_FAULTSTAT 0x02
#define MAX31865_CONFIG_FILT50HZ 0x01
#define MAX31865_CONFIG_FILT60HZ 0x00
#define MAX31856_RTDMSB_REG 0x01
#define MAX31856_RTDLSB_REG 0x02
#define MAX31856_HFAULTMSB_REG 0x03
#define MAX31856_HFAULTLSB_REG 0x04
#define MAX31856_LFAULTMSB_REG 0x05
#define MAX31856_LFAULTLSB_REG 0x06
#define MAX31856_FAULTSTAT_REG 0x07
#define MAX31865_RTDMSB_REG 0x01
#define MAX31865_RTDLSB_REG 0x02
#define MAX31865_HFAULTMSB_REG 0x03
#define MAX31865_HFAULTLSB_REG 0x04
#define MAX31865_LFAULTMSB_REG 0x05
#define MAX31865_LFAULTLSB_REG 0x06
#define MAX31865_FAULTSTAT_REG 0x07
#define MAX31865_FAULT_HIGHTHRESH 0x80 // D7
#define MAX31865_FAULT_LOWTHRESH 0x40 // D6
@@ -84,13 +86,42 @@ typedef enum max31865_numwires {
MAX31865_4WIRE = 0
} max31865_numwires_t;
#if DISABLED(MAX31865_USE_AUTO_MODE)
typedef enum one_shot_event : uint8_t {
SETUP_BIAS_VOLTAGE,
SETUP_1_SHOT_MODE,
READ_RTD_REG
} one_shot_event_t;
#endif
/* Interface class for the MAX31865 RTD Sensor reader */
class MAX31865 {
private:
static SPISettings spiConfig;
TERN(LARGE_PINMAP, uint32_t, uint8_t) _sclk, _miso, _mosi, _cs;
float Rzero, Rref;
TERN(LARGE_PINMAP, uint32_t, uint8_t) sclkPin, misoPin, mosiPin, cselPin;
#ifdef TARGET_LPC1768
uint8_t spiSpeed;
#else
uint16_t spiDelay;
#endif
float zeroRes, refRes, wireRes;
#if ENABLED(MAX31865_USE_READ_ERROR_DETECTION)
millis_t lastReadStamp = 0;
#endif
uint16_t lastRead = 0;
uint8_t lastFault = 0;
#if DISABLED(MAX31865_USE_AUTO_MODE)
millis_t nextEventStamp;
one_shot_event_t nextEvent;
#endif
uint8_t stdFlags = 0;
void setConfig(uint8_t config, bool enable);
@@ -99,10 +130,19 @@ private:
uint16_t readRegister16(uint8_t addr);
void writeRegister8(uint8_t addr, uint8_t reg);
uint8_t spixfer(uint8_t addr);
uint8_t spiTransfer(uint8_t addr);
void softSpiBegin(const uint8_t spi_speed);
void initFixedFlags(max31865_numwires_t wires);
void enable50HzFilter(bool b);
void enableBias();
void oneShot();
void resetFlags();
public:
#ifdef LARGE_PINMAP
#if ENABLED(LARGE_PINMAP)
MAX31865(uint32_t spi_cs, uint8_t pin_mapping);
MAX31865(uint32_t spi_cs, uint32_t spi_mosi, uint32_t spi_miso,
uint32_t spi_clk, uint8_t pin_mapping);
@@ -112,20 +152,14 @@ public:
int8_t spi_clk);
#endif
void begin(max31865_numwires_t wires, float zero, float ref);
void begin(max31865_numwires_t wires, float zero_res, float ref_res, float wire_res);
uint8_t readFault();
void clearFault();
void setWires(max31865_numwires_t wires);
void autoConvert(bool b);
void enable50HzFilter(bool b);
void enableBias(bool b);
void oneShot();
uint16_t readRaw();
float readResistance();
float temperature();
float temperature(uint16_t adcVal);
float temperature(float Rrtd);
float temperature(uint16_t adc_val);
float temperature(float rtd_res);
};

View File

@@ -44,7 +44,7 @@ struct AutoReporter {
next_report_ms = ms + SEC_TO_MS(report_interval);
PORT_REDIRECT(report_port_mask);
Helper::report();
//PORT_RESTORE();
PORT_RESTORE();
}
}
};

View File

@@ -106,8 +106,8 @@ struct duration_t {
return this->value;
}
#pragma GCC diagnostic push
#if GCC_VERSION <= 50000
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#endif
@@ -127,11 +127,11 @@ struct duration_t {
* 59s
*/
char* toString(char * const buffer) const {
int y = this->year(),
d = this->day() % 365,
h = this->hour() % 24,
m = this->minute() % 60,
s = this->second() % 60;
const uint16_t y = this->year(),
d = this->day() % 365,
h = this->hour() % 24,
m = this->minute() % 60,
s = this->second() % 60;
if (y) sprintf_P(buffer, PSTR("%iy %id %ih %im %is"), y, d, h, m, s);
else if (d) sprintf_P(buffer, PSTR("%id %ih %im %is"), d, h, m, s);
@@ -149,28 +149,32 @@ struct duration_t {
*
* Output examples:
* 123456789 (strlen)
* 12'34
* 99:59
* 11d 12:33
*/
uint8_t toDigital(char *buffer, bool with_days=false) const {
uint16_t h = uint16_t(this->hour()),
m = uint16_t(this->minute() % 60UL);
const uint16_t h = uint16_t(this->hour()),
m = uint16_t(this->minute() % 60UL);
if (with_days) {
uint16_t d = this->day();
sprintf_P(buffer, PSTR("%hud %02hu:%02hu"), d, h % 24, m);
const uint16_t d = this->day();
sprintf_P(buffer, PSTR("%hud %02hu:%02hu"), d, h % 24, m); // 1d 23:45
return d >= 10 ? 9 : 8;
}
else if (!h) {
const uint16_t s = uint16_t(this->second() % 60UL);
sprintf_P(buffer, PSTR("%02hu'%02hu"), m, s); // 12'34
return 5;
}
else if (h < 100) {
sprintf_P(buffer, PSTR("%02hu:%02hu"), h, m);
sprintf_P(buffer, PSTR("%02hu:%02hu"), h, m); // 12:34
return 5;
}
else {
sprintf_P(buffer, PSTR("%hu:%02hu"), h, m);
sprintf_P(buffer, PSTR("%hu:%02hu"), h, m); // 123:45
return 6;
}
}
#if GCC_VERSION <= 50000
#pragma GCC diagnostic pop
#endif
#pragma GCC diagnostic pop
};

View File

@@ -27,7 +27,7 @@
// Utility functions to create and print hex strings as nybble, byte, and word.
//
FORCE_INLINE char hex_nybble(const uint8_t n) {
constexpr char hex_nybble(const uint8_t n) {
return (n & 0xF) + ((n & 0xF) < 10 ? '0' : 'A' - 10);
}
char* hex_byte(const uint8_t b);

View File

@@ -34,7 +34,7 @@ millis_t Stopwatch::startTimestamp;
millis_t Stopwatch::stopTimestamp;
bool Stopwatch::stop() {
Stopwatch::debug(PSTR("stop"));
debug(F("stop"));
if (isRunning() || isPaused()) {
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStopped());
@@ -46,7 +46,7 @@ bool Stopwatch::stop() {
}
bool Stopwatch::pause() {
Stopwatch::debug(PSTR("pause"));
debug(F("pause"));
if (isRunning()) {
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerPaused());
@@ -58,7 +58,7 @@ bool Stopwatch::pause() {
}
bool Stopwatch::start() {
Stopwatch::debug(PSTR("start"));
debug(F("start"));
TERN_(EXTENSIBLE_UI, ExtUI::onPrintTimerStarted());
@@ -74,14 +74,14 @@ bool Stopwatch::start() {
}
void Stopwatch::resume(const millis_t with_time) {
Stopwatch::debug(PSTR("resume"));
debug(F("resume"));
reset();
if ((accumulator = with_time)) state = RUNNING;
}
void Stopwatch::reset() {
Stopwatch::debug(PSTR("reset"));
debug(F("reset"));
state = STOPPED;
startTimestamp = 0;
@@ -95,12 +95,8 @@ millis_t Stopwatch::duration() {
#if ENABLED(DEBUG_STOPWATCH)
void Stopwatch::debug(const char func[]) {
if (DEBUGGING(INFO)) {
SERIAL_ECHOPGM("Stopwatch::");
SERIAL_ECHOPGM_P(func);
SERIAL_ECHOLNPGM("()");
}
void Stopwatch::debug(FSTR_P const func) {
if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::", func, "()");
}
#endif

View File

@@ -21,14 +21,11 @@
*/
#pragma once
#include "../inc/MarlinConfig.h"
// Print debug messages with M111 S2 (Uses 156 bytes of PROGMEM)
//#define DEBUG_STOPWATCH
#include "../core/macros.h" // for FORCE_INLINE
#include <stdint.h>
typedef uint32_t millis_t;
/**
* @brief Stopwatch class
* @details This class acts as a timer proving stopwatch functionality including
@@ -113,11 +110,11 @@ class Stopwatch {
* @brief Print a debug message
* @details Print a simple debug message "Stopwatch::function"
*/
static void debug(const char func[]);
static void debug(FSTR_P const);
#else
static inline void debug(const char[]) {}
static inline void debug(FSTR_P const) {}
#endif
};

View File

@@ -75,8 +75,8 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) {
matrix.vectors[0].z * _x + matrix.vectors[1].z * _y + matrix.vectors[2].z * _z };
}
void vector_3::debug(PGM_P const title) {
SERIAL_ECHOPGM_P(title);
void vector_3::debug(FSTR_P const title) {
SERIAL_ECHOF(title);
SERIAL_ECHOPAIR_F_P(SP_X_STR, x, 6);
SERIAL_ECHOPAIR_F_P(SP_Y_STR, y, 6);
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z, 6);
@@ -100,14 +100,14 @@ void matrix_3x3::set_to_identity() {
// Create a matrix from 3 vector_3 inputs
matrix_3x3 matrix_3x3::create_from_rows(const vector_3 &row_0, const vector_3 &row_1, const vector_3 &row_2) {
//row_0.debug(PSTR("row_0"));
//row_1.debug(PSTR("row_1"));
//row_2.debug(PSTR("row_2"));
//row_0.debug(F("row_0"));
//row_1.debug(F("row_1"));
//row_2.debug(F("row_2"));
matrix_3x3 new_matrix;
new_matrix.vectors[0] = row_0;
new_matrix.vectors[1] = row_1;
new_matrix.vectors[2] = row_2;
//new_matrix.debug(PSTR("new_matrix"));
//new_matrix.debug(F("new_matrix"));
return new_matrix;
}
@@ -117,14 +117,14 @@ matrix_3x3 matrix_3x3::create_look_at(const vector_3 &target) {
x_row = vector_3(1, 0, -target.x / target.z).get_normal(),
y_row = vector_3::cross(z_row, x_row).get_normal();
// x_row.debug(PSTR("x_row"));
// y_row.debug(PSTR("y_row"));
// z_row.debug(PSTR("z_row"));
// x_row.debug(F("x_row"));
// y_row.debug(F("y_row"));
// z_row.debug(F("z_row"));
// create the matrix already correctly transposed
matrix_3x3 rot = matrix_3x3::create_from_rows(x_row, y_row, z_row);
// rot.debug(PSTR("rot"));
// rot.debug(F("rot"));
return rot;
}
@@ -137,8 +137,8 @@ matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) {
return new_matrix;
}
void matrix_3x3::debug(PGM_P const title) {
if (title) SERIAL_ECHOLNPGM_P(title);
void matrix_3x3::debug(FSTR_P const title) {
if (title) SERIAL_ECHOLNF(title);
LOOP_L_N(i, 3) {
LOOP_L_N(j, 3) {
if (vectors[i][j] >= 0.0) SERIAL_CHAR('+');

View File

@@ -78,7 +78,7 @@ struct vector_3 {
operator xy_float_t() { return xy_float_t({ x, y }); }
operator xyz_float_t() { return xyz_float_t({ x, y, z }); }
void debug(PGM_P const title);
void debug(FSTR_P const title);
};
struct matrix_3x3 {
@@ -91,7 +91,7 @@ struct matrix_3x3 {
void set_to_identity();
void debug(PGM_P const title);
void debug(FSTR_P const title);
void apply_rotation_xyz(float &x, float &y, float &z);
};