Use macros that explicitly avoid double-evaluation and can be used for any datatype, replacing `min`, `max`, `abs`, `fabs`, `labs`, and `FABS`.
Co-Authored-By: ejtagle <ejtagle@hotmail.com>
As Bob-The-Khun suggested, resetting the USB peripheral solves the huge startup delays that happen when a WDT reset happens and we are connected through the native port
- Watchdog reset during SD Card initialization.
- Move `DebugMonitor` to `DebugMonitor_Due.cpp`.
- Since the watchdog is enabled on boot do extra resets during init.
- Have `thermalManager` do watchdog reset before its ISR starts to prevent reset.
- Ensure that timers are stopped before reprogramming them to address tone issues.
- Improve SAM3XE reset when reflashed through the native port.
DUE USB CDC: Do not send any character if no program on the PC is listening to them. This avoids Marlin waiting until the user actually opens a program that is able to consume the output of Marlin
Added Arduino-compatible kludge to the (ATMEL supplied) SAM3X USB stack we are now using so the Native port is also usable as a programming port on Arduino DUE and derived designs
Adding USB MSD implementation to the HAL: Now, when you plug the Native USB port of the Arduino DUE to your PC, it will be detected as a composite USB device: One of the devices is a USB CDC (Serial port over USB) with native USB handshake (no more overflows!!) (set SERIAL_PORT to -1 to use it as main serial port) and also, a MSD (USB Mass Storage Device) will be detected, and the SD card present on the socket will be reflected as a Removable disk on your PC)