Merge branch 'bugfix-2.1.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.1.x-February2

This commit is contained in:
classicrocker883 2025-05-04 06:41:23 -04:00
commit 95c8f12b0f
330 changed files with 4443 additions and 3939 deletions

View file

@ -260,6 +260,7 @@
#define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // A pair of angles for { E0, E1 }.
// For Dual Servo use two pairs: { { lower, raise }, { lower, raise } }
#define SWITCHING_NOZZLE_SERVO_DWELL 2500 // Dwell time to wait for servo to make physical move
#define SWITCHING_NOZZLE_LIFT_TO_PROBE // Lift toolheads out of the way while probing
#endif
// Switch nozzles by bumping the toolhead. Requires EVENT_GCODE_TOOLCHANGE_#.
@ -899,7 +900,7 @@
#if ANY(PIDTEMP, PIDTEMPBED, PIDTEMPCHAMBER)
//#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
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
#define PID_FUNCTIONAL_RANGE 20 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of flash)
@ -2036,8 +2037,11 @@
//#define FILAMENT_MOTION_SENSOR
#if ENABLED(FILAMENT_MOTION_SENSOR)
//#define FILAMENT_SWITCH_AND_MOTION
//#define FILAMENT_SWITCH_AND_MOTION // Define separate pins below to sense motion
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define FILAMENT_MOTION_DISTANCE_MM 3.0 // (mm) Missing distance required to trigger runout
#define NUM_MOTION_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_MOTION#_PIN for each.
//#define FIL_MOTION1_PIN -1
@ -2073,7 +2077,7 @@
//#define FIL_MOTION8_STATE LOW
//#define FIL_MOTION8_PULLUP
//#define FIL_MOTION8_PULLDOWN
#endif
#endif // FILAMENT_SWITCH_AND_MOTION
#endif // FILAMENT_MOTION_SENSOR
#endif // FILAMENT_RUNOUT_DISTANCE_MM
#endif // FILAMENT_RUNOUT_SENSOR
@ -2276,7 +2280,7 @@
//===========================================================================
#define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed
#define GRID_MAX_POINTS_X 3 // Don't use more than 7 points per axis, implementation limited.
#define GRID_MAX_POINTS_X 3
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
//#define MESH_G28_REST_ORIGIN // After homing all axes ('G28' or 'G28 XYZ') rest Z at Z_MIN_POS
@ -3282,7 +3286,7 @@
#endif
//
// Touch-screen LCD for Malyan M200/M300 printers
// LCD for Malyan M200/M300 printers
//
//#define MALYAN_LCD

View file

@ -1960,8 +1960,8 @@
#if ENABLED(MULTI_VOLUME)
#define VOLUME_SD_ONBOARD
#define VOLUME_USB_FLASH_DRIVE
#define DEFAULT_VOLUME SV_SD_ONBOARD
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
#define DEFAULT_VOLUME SD_ONBOARD // :[ 'SD_ONBOARD', 'USB_FLASH_DRIVE' ]
#define DEFAULT_SHARED_VOLUME USB_FLASH_DRIVE // :[ 'SD_ONBOARD', 'USB_FLASH_DRIVE' ]
#endif
#endif // HAS_MEDIA
@ -2268,6 +2268,8 @@
#define ADC_BUTTON_DEBOUNCE_DELAY 16 // (count) Increase if buttons bounce or repeat too fast
#endif
//#define FAST_BUTTON_POLLING // Poll buttons at ~1kHz on 8-bit AVR. Set to 'false' for slow polling on 32-bit.
// @section safety
/**
@ -2350,6 +2352,24 @@
//#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L.
//#define LA_DEBUG // Print debug information to serial during operation. Disable for production use.
//#define EXPERIMENTAL_I2S_LA // Allow I2S_STEPPER_STREAM to be used with LA. Performance degrades as the LA step rate reaches ~20kHz.
//#define SMOOTH_LIN_ADVANCE // Remove limits on acceleration by gradual increase of nozzle pressure
#if ENABLED(SMOOTH_LIN_ADVANCE)
/**
* ADVANCE_TAU is also the time ahead that the smoother needs to look
* into the planner, so the planner needs to have enough blocks loaded.
* For k=0.04 at 10k acceleration and an "Orbiter 2" extruder it can be as low as 0.0075.
* Adjust by lowering the value until you observe the extruder skipping, then raise slightly.
* Higher k and higher XY acceleration may require larger ADVANCE_TAU to avoid skipping steps.
*/
#if ENABLED(DISTINCT_E_FACTORS)
#define ADVANCE_TAU { 0.01 } // (s) Smoothing time to reduce extruder acceleration, per extruder
#else
#define ADVANCE_TAU 0.01 // (s) Smoothing time to reduce extruder acceleration
#endif
#define SMOOTH_LIN_ADV_HZ 5000 // (Hz) How often to update extruder speed
#define INPUT_SHAPING_E_SYNC // Synchronize the extruder-shaped XY axes (to increase precision)
#endif
#endif
/**
@ -3682,6 +3702,8 @@
#define SPEED_POWER_MIN 5000 // (RPM)
#define SPEED_POWER_MAX 30000 // (RPM) SuperPID router controller 0 - 30,000 RPM
#define SPEED_POWER_STARTUP 25000 // (RPM) M3/M4 speed/power default (with no arguments)
//#define DEFAULT_ACCELERATION_SPINDLE 1000 // (°/s/s) Default spindle acceleration (speed change with time)
#endif
#else

View file

@ -127,9 +127,9 @@ NEOPIXEL ?= 0
# on GCC versions:
# https://www.avrfreaks.net/comment/1789106#comment-1789106
CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d\ )
CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d\ )
CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d\ )
CC_MAJ:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC__ | cut -f3 -d' ' )
CC_MIN:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_MINOR__ | cut -f3 -d' ' )
CC_PATCHLEVEL:=$(shell $(CC) -dM -E - < /dev/null | grep __GNUC_PATCHLEVEL__ | cut -f3 -d' ' )
CC_VER:=$(shell echo $$(( $(CC_MAJ) * 10000 + $(CC_MIN) * 100 + $(CC_PATCHLEVEL) )))
ifeq ($(shell test $(CC_VER) -lt 40901 && echo 1),1)
$(warning This GCC version $(CC_VER) is likely broken. Enabling relocation workaround.)
@ -868,8 +868,8 @@ else ifeq ($(HARDWARE_VARIANT), archim)
endif
# Add all the source directories as include directories too
CINCS = ${addprefix -I ,${VPATH}}
CXXINCS = ${addprefix -I ,${VPATH}}
CINCS = ${addprefix -I, ${VPATH}}
CXXINCS = ${addprefix -I, ${VPATH}}
# Silence warnings for library code (won't work for .h files, unfortunately)
LIBWARN = -w -Wno-packed-bitfield-compat

View file

@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2025-04-08"
//#define STRING_DISTRIBUTION_DATE "2025-05-04"
/**
* The protocol for communication to the host. Protocol indicates communication

View file

@ -204,7 +204,7 @@ public:
static void isr_on() { sei(); }
static void isr_off() { cli(); }
static void delay_ms(const int ms) { _delay_ms(ms); }
static void delay_ms(const int ms) { delay(ms); }
// Tasks, called from idle()
static void idletask() {}

View file

@ -363,8 +363,11 @@
#define AIO7_PWM 0
#define AIO7_DDR DDRF
//-- Begin not supported by Teensyduino
//-- don't use Arduino functions on these pins pinMode/digitalWrite/etc
//-- 46-47 are not supported by Teensyduino
//-- Don't use Arduino functions (pinMode, digitalWrite, etc.) on these pins
#define PIN_E2 46
#define PIN_E3 47
#define DIO46_PIN PINE2
#define DIO46_RPORT PINE
#define DIO46_WPORT PORTE
@ -377,10 +380,7 @@
#define DIO47_PWM 0
#define DIO47_DDR DDRE
#define TEENSY_E2 46
#define TEENSY_E3 47
//-- end not supported by Teensyduino
//--
#undef PA0
#define PA0_PIN PINA0

View file

@ -377,16 +377,16 @@ void printPinPort(const pin_t pin) { // print port number
uint8_t x;
SERIAL_ECHOPGM(" Port: ");
#if AVR_AT90USB1286_FAMILY
x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64;
x = (pin == PIN_E2 || pin == PIN_E3) ? 'E' : 'A' + digitalPinToPort_DEBUG(pin) - 1;
#else
x = digitalPinToPort_DEBUG(pin) + 64;
x = 'A' + digitalPinToPort_DEBUG(pin) - 1;
#endif
SERIAL_CHAR(x);
#if AVR_AT90USB1286_FAMILY
if (pin == 46)
if (pin == PIN_E2)
x = '2';
else if (pin == 47)
else if (pin == PIN_E3)
x = '3';
else {
uint8_t temp = digitalPinToBitMask_DEBUG(pin);

View file

@ -48,92 +48,92 @@
const uint8_t PROGMEM digital_pin_to_port_PGM_plus_70[] = {
// PORTLIST
// ------------------------
PE , // PE 0 ** 0 ** USART0_RX
PE , // PE 1 ** 1 ** USART0_TX
PE , // PE 4 ** 2 ** PWM2
PE , // PE 5 ** 3 ** PWM3
PG , // PG 5 ** 4 ** PWM4
PE , // PE 3 ** 5 ** PWM5
PH , // PH 3 ** 6 ** PWM6
PH , // PH 4 ** 7 ** PWM7
PH , // PH 5 ** 8 ** PWM8
PH , // PH 6 ** 9 ** PWM9
PB , // PB 4 ** 10 ** PWM10
PB , // PB 5 ** 11 ** PWM11
PB , // PB 6 ** 12 ** PWM12
PB , // PB 7 ** 13 ** PWM13
PJ , // PJ 1 ** 14 ** USART3_TX
PJ , // PJ 0 ** 15 ** USART3_RX
PH , // PH 1 ** 16 ** USART2_TX
PH , // PH 0 ** 17 ** USART2_RX
PD , // PD 3 ** 18 ** USART1_TX
PD , // PD 2 ** 19 ** USART1_RX
PD , // PD 1 ** 20 ** I2C_SDA
PD , // PD 0 ** 21 ** I2C_SCL
PA , // PA 0 ** 22 ** D22
PA , // PA 1 ** 23 ** D23
PA , // PA 2 ** 24 ** D24
PA , // PA 3 ** 25 ** D25
PA , // PA 4 ** 26 ** D26
PA , // PA 5 ** 27 ** D27
PA , // PA 6 ** 28 ** D28
PA , // PA 7 ** 29 ** D29
PC , // PC 7 ** 30 ** D30
PC , // PC 6 ** 31 ** D31
PC , // PC 5 ** 32 ** D32
PC , // PC 4 ** 33 ** D33
PC , // PC 3 ** 34 ** D34
PC , // PC 2 ** 35 ** D35
PC , // PC 1 ** 36 ** D36
PC , // PC 0 ** 37 ** D37
PD , // PD 7 ** 38 ** D38
PG , // PG 2 ** 39 ** D39
PG , // PG 1 ** 40 ** D40
PG , // PG 0 ** 41 ** D41
PL , // PL 7 ** 42 ** D42
PL , // PL 6 ** 43 ** D43
PL , // PL 5 ** 44 ** D44
PL , // PL 4 ** 45 ** D45
PL , // PL 3 ** 46 ** D46
PL , // PL 2 ** 47 ** D47
PL , // PL 1 ** 48 ** D48
PL , // PL 0 ** 49 ** D49
PB , // PB 3 ** 50 ** SPI_MISO
PB , // PB 2 ** 51 ** SPI_MOSI
PB , // PB 1 ** 52 ** SPI_SCK
PB , // PB 0 ** 53 ** SPI_SS
PF , // PF 0 ** 54 ** A0
PF , // PF 1 ** 55 ** A1
PF , // PF 2 ** 56 ** A2
PF , // PF 3 ** 57 ** A3
PF , // PF 4 ** 58 ** A4
PF , // PF 5 ** 59 ** A5
PF , // PF 6 ** 60 ** A6
PF , // PF 7 ** 61 ** A7
PK , // PK 0 ** 62 ** A8
PK , // PK 1 ** 63 ** A9
PK , // PK 2 ** 64 ** A10
PK , // PK 3 ** 65 ** A11
PK , // PK 4 ** 66 ** A12
PK , // PK 5 ** 67 ** A13
PK , // PK 6 ** 68 ** A14
PK , // PK 7 ** 69 ** A15
PG , // PG 4 ** 70 **
PG , // PG 3 ** 71 **
PJ , // PJ 2 ** 72 **
PJ , // PJ 3 ** 73 **
PJ , // PJ 7 ** 74 **
PJ , // PJ 4 ** 75 **
PJ , // PJ 5 ** 76 **
PJ , // PJ 6 ** 77 **
PE , // PE 2 ** 78 **
PE , // PE 6 ** 79 **
PE , // PE 7 ** 80 **
PD , // PD 4 ** 81 **
PD , // PD 5 ** 82 **
PD , // PD 6 ** 83 **
PH , // PH 2 ** 84 **
PH , // PH 7 ** 85 **
PE, // PE 0 ** 0 ** USART0_RX
PE, // PE 1 ** 1 ** USART0_TX
PE, // PE 4 ** 2 ** PWM2
PE, // PE 5 ** 3 ** PWM3
PG, // PG 5 ** 4 ** PWM4
PE, // PE 3 ** 5 ** PWM5
PH, // PH 3 ** 6 ** PWM6
PH, // PH 4 ** 7 ** PWM7
PH, // PH 5 ** 8 ** PWM8
PH, // PH 6 ** 9 ** PWM9
PB, // PB 4 ** 10 ** PWM10
PB, // PB 5 ** 11 ** PWM11
PB, // PB 6 ** 12 ** PWM12
PB, // PB 7 ** 13 ** PWM13
PJ, // PJ 1 ** 14 ** USART3_TX
PJ, // PJ 0 ** 15 ** USART3_RX
PH, // PH 1 ** 16 ** USART2_TX
PH, // PH 0 ** 17 ** USART2_RX
PD, // PD 3 ** 18 ** USART1_TX
PD, // PD 2 ** 19 ** USART1_RX
PD, // PD 1 ** 20 ** I2C_SDA
PD, // PD 0 ** 21 ** I2C_SCL
PA, // PA 0 ** 22 ** D22
PA, // PA 1 ** 23 ** D23
PA, // PA 2 ** 24 ** D24
PA, // PA 3 ** 25 ** D25
PA, // PA 4 ** 26 ** D26
PA, // PA 5 ** 27 ** D27
PA, // PA 6 ** 28 ** D28
PA, // PA 7 ** 29 ** D29
PC, // PC 7 ** 30 ** D30
PC, // PC 6 ** 31 ** D31
PC, // PC 5 ** 32 ** D32
PC, // PC 4 ** 33 ** D33
PC, // PC 3 ** 34 ** D34
PC, // PC 2 ** 35 ** D35
PC, // PC 1 ** 36 ** D36
PC, // PC 0 ** 37 ** D37
PD, // PD 7 ** 38 ** D38
PG, // PG 2 ** 39 ** D39
PG, // PG 1 ** 40 ** D40
PG, // PG 0 ** 41 ** D41
PL, // PL 7 ** 42 ** D42
PL, // PL 6 ** 43 ** D43
PL, // PL 5 ** 44 ** D44
PL, // PL 4 ** 45 ** D45
PL, // PL 3 ** 46 ** D46
PL, // PL 2 ** 47 ** D47
PL, // PL 1 ** 48 ** D48
PL, // PL 0 ** 49 ** D49
PB, // PB 3 ** 50 ** SPI_MISO
PB, // PB 2 ** 51 ** SPI_MOSI
PB, // PB 1 ** 52 ** SPI_SCK
PB, // PB 0 ** 53 ** SPI_SS
PF, // PF 0 ** 54 ** A0
PF, // PF 1 ** 55 ** A1
PF, // PF 2 ** 56 ** A2
PF, // PF 3 ** 57 ** A3
PF, // PF 4 ** 58 ** A4
PF, // PF 5 ** 59 ** A5
PF, // PF 6 ** 60 ** A6
PF, // PF 7 ** 61 ** A7
PK, // PK 0 ** 62 ** A8
PK, // PK 1 ** 63 ** A9
PK, // PK 2 ** 64 ** A10
PK, // PK 3 ** 65 ** A11
PK, // PK 4 ** 66 ** A12
PK, // PK 5 ** 67 ** A13
PK, // PK 6 ** 68 ** A14
PK, // PK 7 ** 69 ** A15
PG, // PG 4 ** 70 **
PG, // PG 3 ** 71 **
PJ, // PJ 2 ** 72 **
PJ, // PJ 3 ** 73 **
PJ, // PJ 7 ** 74 **
PJ, // PJ 4 ** 75 **
PJ, // PJ 5 ** 76 **
PJ, // PJ 6 ** 77 **
PE, // PE 2 ** 78 **
PE, // PE 6 ** 79 **
PE, // PE 7 ** 80 **
PD, // PD 4 ** 81 **
PD, // PD 5 ** 82 **
PD, // PD 6 ** 83 **
PH, // PH 2 ** 84 **
PH, // PH 7 ** 85 **
};
#define digitalPinToPort_plus_70(P) ( pgm_read_byte( digital_pin_to_port_PGM_plus_70 + (P) ) )
@ -141,92 +141,92 @@ const uint8_t PROGMEM digital_pin_to_port_PGM_plus_70[] = {
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM_plus_70[] = {
// PIN IN PORT
// ------------------------
_BV( 0 ) , // PE 0 ** 0 ** USART0_RX
_BV( 1 ) , // PE 1 ** 1 ** USART0_TX
_BV( 4 ) , // PE 4 ** 2 ** PWM2
_BV( 5 ) , // PE 5 ** 3 ** PWM3
_BV( 5 ) , // PG 5 ** 4 ** PWM4
_BV( 3 ) , // PE 3 ** 5 ** PWM5
_BV( 3 ) , // PH 3 ** 6 ** PWM6
_BV( 4 ) , // PH 4 ** 7 ** PWM7
_BV( 5 ) , // PH 5 ** 8 ** PWM8
_BV( 6 ) , // PH 6 ** 9 ** PWM9
_BV( 4 ) , // PB 4 ** 10 ** PWM10
_BV( 5 ) , // PB 5 ** 11 ** PWM11
_BV( 6 ) , // PB 6 ** 12 ** PWM12
_BV( 7 ) , // PB 7 ** 13 ** PWM13
_BV( 1 ) , // PJ 1 ** 14 ** USART3_TX
_BV( 0 ) , // PJ 0 ** 15 ** USART3_RX
_BV( 1 ) , // PH 1 ** 16 ** USART2_TX
_BV( 0 ) , // PH 0 ** 17 ** USART2_RX
_BV( 3 ) , // PD 3 ** 18 ** USART1_TX
_BV( 2 ) , // PD 2 ** 19 ** USART1_RX
_BV( 1 ) , // PD 1 ** 20 ** I2C_SDA
_BV( 0 ) , // PD 0 ** 21 ** I2C_SCL
_BV( 0 ) , // PA 0 ** 22 ** D22
_BV( 1 ) , // PA 1 ** 23 ** D23
_BV( 2 ) , // PA 2 ** 24 ** D24
_BV( 3 ) , // PA 3 ** 25 ** D25
_BV( 4 ) , // PA 4 ** 26 ** D26
_BV( 5 ) , // PA 5 ** 27 ** D27
_BV( 6 ) , // PA 6 ** 28 ** D28
_BV( 7 ) , // PA 7 ** 29 ** D29
_BV( 7 ) , // PC 7 ** 30 ** D30
_BV( 6 ) , // PC 6 ** 31 ** D31
_BV( 5 ) , // PC 5 ** 32 ** D32
_BV( 4 ) , // PC 4 ** 33 ** D33
_BV( 3 ) , // PC 3 ** 34 ** D34
_BV( 2 ) , // PC 2 ** 35 ** D35
_BV( 1 ) , // PC 1 ** 36 ** D36
_BV( 0 ) , // PC 0 ** 37 ** D37
_BV( 7 ) , // PD 7 ** 38 ** D38
_BV( 2 ) , // PG 2 ** 39 ** D39
_BV( 1 ) , // PG 1 ** 40 ** D40
_BV( 0 ) , // PG 0 ** 41 ** D41
_BV( 7 ) , // PL 7 ** 42 ** D42
_BV( 6 ) , // PL 6 ** 43 ** D43
_BV( 5 ) , // PL 5 ** 44 ** D44
_BV( 4 ) , // PL 4 ** 45 ** D45
_BV( 3 ) , // PL 3 ** 46 ** D46
_BV( 2 ) , // PL 2 ** 47 ** D47
_BV( 1 ) , // PL 1 ** 48 ** D48
_BV( 0 ) , // PL 0 ** 49 ** D49
_BV( 3 ) , // PB 3 ** 50 ** SPI_MISO
_BV( 2 ) , // PB 2 ** 51 ** SPI_MOSI
_BV( 1 ) , // PB 1 ** 52 ** SPI_SCK
_BV( 0 ) , // PB 0 ** 53 ** SPI_SS
_BV( 0 ) , // PF 0 ** 54 ** A0
_BV( 1 ) , // PF 1 ** 55 ** A1
_BV( 2 ) , // PF 2 ** 56 ** A2
_BV( 3 ) , // PF 3 ** 57 ** A3
_BV( 4 ) , // PF 4 ** 58 ** A4
_BV( 5 ) , // PF 5 ** 59 ** A5
_BV( 6 ) , // PF 6 ** 60 ** A6
_BV( 7 ) , // PF 7 ** 61 ** A7
_BV( 0 ) , // PK 0 ** 62 ** A8
_BV( 1 ) , // PK 1 ** 63 ** A9
_BV( 2 ) , // PK 2 ** 64 ** A10
_BV( 3 ) , // PK 3 ** 65 ** A11
_BV( 4 ) , // PK 4 ** 66 ** A12
_BV( 5 ) , // PK 5 ** 67 ** A13
_BV( 6 ) , // PK 6 ** 68 ** A14
_BV( 7 ) , // PK 7 ** 69 ** A15
_BV( 4 ) , // PG 4 ** 70 **
_BV( 3 ) , // PG 3 ** 71 **
_BV( 2 ) , // PJ 2 ** 72 **
_BV( 3 ) , // PJ 3 ** 73 **
_BV( 7 ) , // PJ 7 ** 74 **
_BV( 4 ) , // PJ 4 ** 75 **
_BV( 5 ) , // PJ 5 ** 76 **
_BV( 6 ) , // PJ 6 ** 77 **
_BV( 2 ) , // PE 2 ** 78 **
_BV( 6 ) , // PE 6 ** 79 **
_BV( 7 ) , // PE 7 ** 80 **
_BV( 4 ) , // PD 4 ** 81 **
_BV( 5 ) , // PD 5 ** 82 **
_BV( 6 ) , // PD 6 ** 83 **
_BV( 2 ) , // PH 2 ** 84 **
_BV( 7 ) , // PH 7 ** 85 **
_BV( 0 ), // PE 0 ** 0 ** USART0_RX
_BV( 1 ), // PE 1 ** 1 ** USART0_TX
_BV( 4 ), // PE 4 ** 2 ** PWM2
_BV( 5 ), // PE 5 ** 3 ** PWM3
_BV( 5 ), // PG 5 ** 4 ** PWM4
_BV( 3 ), // PE 3 ** 5 ** PWM5
_BV( 3 ), // PH 3 ** 6 ** PWM6
_BV( 4 ), // PH 4 ** 7 ** PWM7
_BV( 5 ), // PH 5 ** 8 ** PWM8
_BV( 6 ), // PH 6 ** 9 ** PWM9
_BV( 4 ), // PB 4 ** 10 ** PWM10
_BV( 5 ), // PB 5 ** 11 ** PWM11
_BV( 6 ), // PB 6 ** 12 ** PWM12
_BV( 7 ), // PB 7 ** 13 ** PWM13
_BV( 1 ), // PJ 1 ** 14 ** USART3_TX
_BV( 0 ), // PJ 0 ** 15 ** USART3_RX
_BV( 1 ), // PH 1 ** 16 ** USART2_TX
_BV( 0 ), // PH 0 ** 17 ** USART2_RX
_BV( 3 ), // PD 3 ** 18 ** USART1_TX
_BV( 2 ), // PD 2 ** 19 ** USART1_RX
_BV( 1 ), // PD 1 ** 20 ** I2C_SDA
_BV( 0 ), // PD 0 ** 21 ** I2C_SCL
_BV( 0 ), // PA 0 ** 22 ** D22
_BV( 1 ), // PA 1 ** 23 ** D23
_BV( 2 ), // PA 2 ** 24 ** D24
_BV( 3 ), // PA 3 ** 25 ** D25
_BV( 4 ), // PA 4 ** 26 ** D26
_BV( 5 ), // PA 5 ** 27 ** D27
_BV( 6 ), // PA 6 ** 28 ** D28
_BV( 7 ), // PA 7 ** 29 ** D29
_BV( 7 ), // PC 7 ** 30 ** D30
_BV( 6 ), // PC 6 ** 31 ** D31
_BV( 5 ), // PC 5 ** 32 ** D32
_BV( 4 ), // PC 4 ** 33 ** D33
_BV( 3 ), // PC 3 ** 34 ** D34
_BV( 2 ), // PC 2 ** 35 ** D35
_BV( 1 ), // PC 1 ** 36 ** D36
_BV( 0 ), // PC 0 ** 37 ** D37
_BV( 7 ), // PD 7 ** 38 ** D38
_BV( 2 ), // PG 2 ** 39 ** D39
_BV( 1 ), // PG 1 ** 40 ** D40
_BV( 0 ), // PG 0 ** 41 ** D41
_BV( 7 ), // PL 7 ** 42 ** D42
_BV( 6 ), // PL 6 ** 43 ** D43
_BV( 5 ), // PL 5 ** 44 ** D44
_BV( 4 ), // PL 4 ** 45 ** D45
_BV( 3 ), // PL 3 ** 46 ** D46
_BV( 2 ), // PL 2 ** 47 ** D47
_BV( 1 ), // PL 1 ** 48 ** D48
_BV( 0 ), // PL 0 ** 49 ** D49
_BV( 3 ), // PB 3 ** 50 ** SPI_MISO
_BV( 2 ), // PB 2 ** 51 ** SPI_MOSI
_BV( 1 ), // PB 1 ** 52 ** SPI_SCK
_BV( 0 ), // PB 0 ** 53 ** SPI_SS
_BV( 0 ), // PF 0 ** 54 ** A0
_BV( 1 ), // PF 1 ** 55 ** A1
_BV( 2 ), // PF 2 ** 56 ** A2
_BV( 3 ), // PF 3 ** 57 ** A3
_BV( 4 ), // PF 4 ** 58 ** A4
_BV( 5 ), // PF 5 ** 59 ** A5
_BV( 6 ), // PF 6 ** 60 ** A6
_BV( 7 ), // PF 7 ** 61 ** A7
_BV( 0 ), // PK 0 ** 62 ** A8
_BV( 1 ), // PK 1 ** 63 ** A9
_BV( 2 ), // PK 2 ** 64 ** A10
_BV( 3 ), // PK 3 ** 65 ** A11
_BV( 4 ), // PK 4 ** 66 ** A12
_BV( 5 ), // PK 5 ** 67 ** A13
_BV( 6 ), // PK 6 ** 68 ** A14
_BV( 7 ), // PK 7 ** 69 ** A15
_BV( 4 ), // PG 4 ** 70 **
_BV( 3 ), // PG 3 ** 71 **
_BV( 2 ), // PJ 2 ** 72 **
_BV( 3 ), // PJ 3 ** 73 **
_BV( 7 ), // PJ 7 ** 74 **
_BV( 4 ), // PJ 4 ** 75 **
_BV( 5 ), // PJ 5 ** 76 **
_BV( 6 ), // PJ 6 ** 77 **
_BV( 2 ), // PE 2 ** 78 **
_BV( 6 ), // PE 6 ** 79 **
_BV( 7 ), // PE 7 ** 80 **
_BV( 4 ), // PD 4 ** 81 **
_BV( 5 ), // PD 5 ** 82 **
_BV( 6 ), // PD 6 ** 83 **
_BV( 2 ), // PH 2 ** 84 **
_BV( 7 ), // PH 7 ** 85 **
};
#define digitalPinToBitMask_plus_70(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM_plus_70 + (P) ) )
@ -234,86 +234,86 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM_plus_70[] = {
const uint8_t PROGMEM digital_pin_to_timer_PGM_plus_70[] = {
// TIMERS
// ------------------------
NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX
NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX
TIMER3B , // PE 4 ** 2 ** PWM2
TIMER3C , // PE 5 ** 3 ** PWM3
TIMER0B , // PG 5 ** 4 ** PWM4
TIMER3A , // PE 3 ** 5 ** PWM5
TIMER4A , // PH 3 ** 6 ** PWM6
TIMER4B , // PH 4 ** 7 ** PWM7
TIMER4C , // PH 5 ** 8 ** PWM8
TIMER2B , // PH 6 ** 9 ** PWM9
TIMER2A , // PB 4 ** 10 ** PWM10
TIMER1A , // PB 5 ** 11 ** PWM11
TIMER1B , // PB 6 ** 12 ** PWM12
TIMER0A , // PB 7 ** 13 ** PWM13
NOT_ON_TIMER , // PJ 1 ** 14 ** USART3_TX
NOT_ON_TIMER , // PJ 0 ** 15 ** USART3_RX
NOT_ON_TIMER , // PH 1 ** 16 ** USART2_TX
NOT_ON_TIMER , // PH 0 ** 17 ** USART2_RX
NOT_ON_TIMER , // PD 3 ** 18 ** USART1_TX
NOT_ON_TIMER , // PD 2 ** 19 ** USART1_RX
NOT_ON_TIMER , // PD 1 ** 20 ** I2C_SDA
NOT_ON_TIMER , // PD 0 ** 21 ** I2C_SCL
NOT_ON_TIMER , // PA 0 ** 22 ** D22
NOT_ON_TIMER , // PA 1 ** 23 ** D23
NOT_ON_TIMER , // PA 2 ** 24 ** D24
NOT_ON_TIMER , // PA 3 ** 25 ** D25
NOT_ON_TIMER , // PA 4 ** 26 ** D26
NOT_ON_TIMER , // PA 5 ** 27 ** D27
NOT_ON_TIMER , // PA 6 ** 28 ** D28
NOT_ON_TIMER , // PA 7 ** 29 ** D29
NOT_ON_TIMER , // PC 7 ** 30 ** D30
NOT_ON_TIMER , // PC 6 ** 31 ** D31
NOT_ON_TIMER , // PC 5 ** 32 ** D32
NOT_ON_TIMER , // PC 4 ** 33 ** D33
NOT_ON_TIMER , // PC 3 ** 34 ** D34
NOT_ON_TIMER , // PC 2 ** 35 ** D35
NOT_ON_TIMER , // PC 1 ** 36 ** D36
NOT_ON_TIMER , // PC 0 ** 37 ** D37
NOT_ON_TIMER , // PD 7 ** 38 ** D38
NOT_ON_TIMER , // PG 2 ** 39 ** D39
NOT_ON_TIMER , // PG 1 ** 40 ** D40
NOT_ON_TIMER , // PG 0 ** 41 ** D41
NOT_ON_TIMER , // PL 7 ** 42 ** D42
NOT_ON_TIMER , // PL 6 ** 43 ** D43
TIMER5C , // PL 5 ** 44 ** D44
TIMER5B , // PL 4 ** 45 ** D45
TIMER5A , // PL 3 ** 46 ** D46
NOT_ON_TIMER , // PL 2 ** 47 ** D47
NOT_ON_TIMER , // PL 1 ** 48 ** D48
NOT_ON_TIMER , // PL 0 ** 49 ** D49
NOT_ON_TIMER , // PB 3 ** 50 ** SPI_MISO
NOT_ON_TIMER , // PB 2 ** 51 ** SPI_MOSI
NOT_ON_TIMER , // PB 1 ** 52 ** SPI_SCK
NOT_ON_TIMER , // PB 0 ** 53 ** SPI_SS
NOT_ON_TIMER , // PF 0 ** 54 ** A0
NOT_ON_TIMER , // PF 1 ** 55 ** A1
NOT_ON_TIMER , // PF 2 ** 56 ** A2
NOT_ON_TIMER , // PF 3 ** 57 ** A3
NOT_ON_TIMER , // PF 4 ** 58 ** A4
NOT_ON_TIMER , // PF 5 ** 59 ** A5
NOT_ON_TIMER , // PF 6 ** 60 ** A6
NOT_ON_TIMER , // PF 7 ** 61 ** A7
NOT_ON_TIMER , // PK 0 ** 62 ** A8
NOT_ON_TIMER , // PK 1 ** 63 ** A9
NOT_ON_TIMER , // PK 2 ** 64 ** A10
NOT_ON_TIMER , // PK 3 ** 65 ** A11
NOT_ON_TIMER , // PK 4 ** 66 ** A12
NOT_ON_TIMER , // PK 5 ** 67 ** A13
NOT_ON_TIMER , // PK 6 ** 68 ** A14
NOT_ON_TIMER , // PK 7 ** 69 ** A15
NOT_ON_TIMER , // PG 4 ** 70 **
NOT_ON_TIMER , // PG 3 ** 71 **
NOT_ON_TIMER , // PJ 2 ** 72 **
NOT_ON_TIMER , // PJ 3 ** 73 **
NOT_ON_TIMER , // PJ 7 ** 74 **
NOT_ON_TIMER , // PJ 4 ** 75 **
NOT_ON_TIMER , // PJ 5 ** 76 **
NOT_ON_TIMER , // PJ 6 ** 77 **
NOT_ON_TIMER , // PE 2 ** 78 **
NOT_ON_TIMER , // PE 6 ** 79 **
NOT_ON_TIMER, // PE 0 ** 0 ** USART0_RX
NOT_ON_TIMER, // PE 1 ** 1 ** USART0_TX
TIMER3B, // PE 4 ** 2 ** PWM2
TIMER3C, // PE 5 ** 3 ** PWM3
TIMER0B, // PG 5 ** 4 ** PWM4
TIMER3A, // PE 3 ** 5 ** PWM5
TIMER4A, // PH 3 ** 6 ** PWM6
TIMER4B, // PH 4 ** 7 ** PWM7
TIMER4C, // PH 5 ** 8 ** PWM8
TIMER2B, // PH 6 ** 9 ** PWM9
TIMER2A, // PB 4 ** 10 ** PWM10
TIMER1A, // PB 5 ** 11 ** PWM11
TIMER1B, // PB 6 ** 12 ** PWM12
TIMER0A, // PB 7 ** 13 ** PWM13
NOT_ON_TIMER, // PJ 1 ** 14 ** USART3_TX
NOT_ON_TIMER, // PJ 0 ** 15 ** USART3_RX
NOT_ON_TIMER, // PH 1 ** 16 ** USART2_TX
NOT_ON_TIMER, // PH 0 ** 17 ** USART2_RX
NOT_ON_TIMER, // PD 3 ** 18 ** USART1_TX
NOT_ON_TIMER, // PD 2 ** 19 ** USART1_RX
NOT_ON_TIMER, // PD 1 ** 20 ** I2C_SDA
NOT_ON_TIMER, // PD 0 ** 21 ** I2C_SCL
NOT_ON_TIMER, // PA 0 ** 22 ** D22
NOT_ON_TIMER, // PA 1 ** 23 ** D23
NOT_ON_TIMER, // PA 2 ** 24 ** D24
NOT_ON_TIMER, // PA 3 ** 25 ** D25
NOT_ON_TIMER, // PA 4 ** 26 ** D26
NOT_ON_TIMER, // PA 5 ** 27 ** D27
NOT_ON_TIMER, // PA 6 ** 28 ** D28
NOT_ON_TIMER, // PA 7 ** 29 ** D29
NOT_ON_TIMER, // PC 7 ** 30 ** D30
NOT_ON_TIMER, // PC 6 ** 31 ** D31
NOT_ON_TIMER, // PC 5 ** 32 ** D32
NOT_ON_TIMER, // PC 4 ** 33 ** D33
NOT_ON_TIMER, // PC 3 ** 34 ** D34
NOT_ON_TIMER, // PC 2 ** 35 ** D35
NOT_ON_TIMER, // PC 1 ** 36 ** D36
NOT_ON_TIMER, // PC 0 ** 37 ** D37
NOT_ON_TIMER, // PD 7 ** 38 ** D38
NOT_ON_TIMER, // PG 2 ** 39 ** D39
NOT_ON_TIMER, // PG 1 ** 40 ** D40
NOT_ON_TIMER, // PG 0 ** 41 ** D41
NOT_ON_TIMER, // PL 7 ** 42 ** D42
NOT_ON_TIMER, // PL 6 ** 43 ** D43
TIMER5C, // PL 5 ** 44 ** D44
TIMER5B, // PL 4 ** 45 ** D45
TIMER5A, // PL 3 ** 46 ** D46
NOT_ON_TIMER, // PL 2 ** 47 ** D47
NOT_ON_TIMER, // PL 1 ** 48 ** D48
NOT_ON_TIMER, // PL 0 ** 49 ** D49
NOT_ON_TIMER, // PB 3 ** 50 ** SPI_MISO
NOT_ON_TIMER, // PB 2 ** 51 ** SPI_MOSI
NOT_ON_TIMER, // PB 1 ** 52 ** SPI_SCK
NOT_ON_TIMER, // PB 0 ** 53 ** SPI_SS
NOT_ON_TIMER, // PF 0 ** 54 ** A0
NOT_ON_TIMER, // PF 1 ** 55 ** A1
NOT_ON_TIMER, // PF 2 ** 56 ** A2
NOT_ON_TIMER, // PF 3 ** 57 ** A3
NOT_ON_TIMER, // PF 4 ** 58 ** A4
NOT_ON_TIMER, // PF 5 ** 59 ** A5
NOT_ON_TIMER, // PF 6 ** 60 ** A6
NOT_ON_TIMER, // PF 7 ** 61 ** A7
NOT_ON_TIMER, // PK 0 ** 62 ** A8
NOT_ON_TIMER, // PK 1 ** 63 ** A9
NOT_ON_TIMER, // PK 2 ** 64 ** A10
NOT_ON_TIMER, // PK 3 ** 65 ** A11
NOT_ON_TIMER, // PK 4 ** 66 ** A12
NOT_ON_TIMER, // PK 5 ** 67 ** A13
NOT_ON_TIMER, // PK 6 ** 68 ** A14
NOT_ON_TIMER, // PK 7 ** 69 ** A15
NOT_ON_TIMER, // PG 4 ** 70 **
NOT_ON_TIMER, // PG 3 ** 71 **
NOT_ON_TIMER, // PJ 2 ** 72 **
NOT_ON_TIMER, // PJ 3 ** 73 **
NOT_ON_TIMER, // PJ 7 ** 74 **
NOT_ON_TIMER, // PJ 4 ** 75 **
NOT_ON_TIMER, // PJ 5 ** 76 **
NOT_ON_TIMER, // PJ 6 ** 77 **
NOT_ON_TIMER, // PE 2 ** 78 **
NOT_ON_TIMER, // PE 6 ** 79 **
};
#define digitalPinToTimer_plus_70(P) ( pgm_read_byte( digital_pin_to_timer_PGM_plus_70 + (P) ) )

View file

@ -102,6 +102,10 @@ void watchdogSetup() {
#if ENABLED(USE_WATCHDOG)
#ifndef WATCHDOG_PIO_RESET
#define WATCHDOG_PIO_RESET
#endif
// 4 seconds timeout
uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000);
@ -115,15 +119,16 @@ void watchdogSetup() {
timeout = 0xFFF;
// We want to enable the watchdog with the specified timeout
uint32_t value =
WDT_MR_WDV(timeout) | // With the specified timeout
WDT_MR_WDD(timeout) | // and no invalid write window
#if !(SAMV70 || SAMV71 || SAME70 || SAMS70)
WDT_MR_WDRPROC | // WDT fault resets processor only - We want
// to keep PIO controller state
#endif
WDT_MR_WDDBGHLT | // WDT stops in debug state.
WDT_MR_WDIDLEHLT; // WDT stops in idle state.
uint32_t value = (0
| WDT_MR_WDV(timeout) // With the specified timeout
| WDT_MR_WDD(timeout) // and no invalid write window
#if NONE(WATCHDOG_PIO_RESET, SAMV70, SAMV71, SAME70, SAMS70)
| WDT_MR_WDRPROC // WDT fault resets processor only with this flag.
// Omit to also reset the PIO controller.
#endif
| WDT_MR_WDDBGHLT // WDT stops in debug state.
| WDT_MR_WDIDLEHLT // WDT stops in idle state.
);
#if ENABLED(WATCHDOG_RESET_MANUAL)
// We enable the watchdog timer, but only for the interrupt.

View file

@ -208,8 +208,8 @@
A("str %[sck_mask],[%[sck_port],#0x4]") /* CODR */
A("bfi %[bin],%[work],#0,#1") /* Store read bit as the bit 0 */
: [bin]"+r"(bin),
[work]"+r"(work)
: [bin]"+r"( bin ),
[work]"+r"( work )
: [bitband_miso_port]"r"( BITBAND_MISO_PORT ),
[sck_mask]"r"( SCK_MASK ),
[sck_port]"r"( SCK_PORT_PLUS30 )
@ -350,7 +350,7 @@
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 */
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 */
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN);
@ -412,10 +412,10 @@
A("strb.w %[bin], [%[ptr]], #1") /* Store read value into buffer, increment buffer pointer */
A("bne.n loop%=") /* Repeat until done */
: [ptr]"+r"(ptr),
[todo]"+r"(todo),
[bin]"+r"(bin),
[work]"+r"(work)
: [ptr]"+r"( ptr ),
[todo]"+r"( todo ),
[bin]"+r"( bin ),
[work]"+r"( work )
: [bitband_miso_port]"r"( BITBAND_MISO_PORT ),
[sck_mask]"r"( SCK_MASK ),
[sck_port]"r"( SCK_PORT_PLUS30 )

View file

@ -21,7 +21,7 @@
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
@ -132,7 +132,7 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes
curGroup = 0xFF; // Current FLASH group
#define DEBUG_OUT ENABLED(EE_EMU_DEBUG)
#include "../../core/debug_out.h"
#include "../../../core/debug_out.h"
static void ee_Dump(const int page, const void *data) {
@ -953,7 +953,7 @@ static void ee_Init() {
/* PersistentStore -----------------------------------------------------------*/
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB

View file

@ -21,7 +21,7 @@
*/
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -30,8 +30,8 @@
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."

View file

@ -40,11 +40,12 @@
* Some jitter in the Vref signal is OK so the interrupt priority is left at its default value.
*/
#include "../../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfigPre.h"
#if MB(PRINTRBOARD_G2)
#include "G2_PWM.h"
#include "../../../module/stepper.h"
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
#define G2_PWM_X 1

View file

@ -26,10 +26,7 @@
* PR #7500. It is hardwired for the PRINTRBOARD_G2 Motor Current needs.
*/
#include "../../../inc/MarlinConfigPre.h"
#include "../../../module/stepper.h"
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\module\stepper.h
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\HAL\HAL_DUE\G2_PWM.h
#include <stdint.h>
#define PWM_PERIOD_US 100 // base repetition rate in micro seconds

View file

@ -63,8 +63,8 @@
#include "compiler.h"
#include "preprocessor.h"
#ifdef FREERTOS_USED
#include "FreeRTOS.h"
#include "semphr.h"
#include <FreeRTOS.h>
#include <semphr.h>
#endif
#include "ctrl_access.h"

View file

@ -19,7 +19,7 @@ void sd_mmc_spi_mem_init() {
}
inline bool media_ready() {
return IS_SD_MOUNTED() && IS_SD_INSERTED() && !IS_SD_FILE_OPEN() && !IS_SD_PRINTING();
return card.isMounted() && card.isInserted() && !card.isFileOpen() && !card.isStillPrinting();
}
bool sd_mmc_spi_unload(bool) { return true; }
@ -29,11 +29,10 @@ bool sd_mmc_spi_wr_protect() { return false; }
bool sd_mmc_spi_removal() { return !media_ready(); }
Ctrl_status sd_mmc_spi_test_unit_ready() {
#ifdef DISABLE_DUE_SD_MMC
#if ENABLED(DISABLE_DUE_SD_MMC)
return CTRL_NO_PRESENT;
#endif
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
return CTRL_GOOD;
return sd_mmc_spi_removal() ? CTRL_NO_PRESENT : CTRL_GOOD;
}
// NOTE: This function is defined as returning the address of the last block
@ -58,9 +57,10 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
// #define DEBUG_MMC
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC
#if ENABLED(DISABLE_DUE_SD_MMC)
return CTRL_NO_PRESENT;
#endif
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC
@ -97,9 +97,10 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
}
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC
#if ENABLED(DISABLE_DUE_SD_MMC)
return CTRL_NO_PRESENT;
#endif
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
#ifdef DEBUG_MMC

View file

@ -34,13 +34,13 @@
#if ENABLED(WIFISUPPORT)
#include <ESPAsyncWebServer.h>
#include "wifi.h"
#include "wifi/wifi.h"
#if ENABLED(OTASUPPORT)
#include "ota.h"
#include "wifi/ota.h"
#endif
#if ENABLED(WEBSUPPORT)
#include "spiffs.h"
#include "web.h"
#include "wifi/spiffs.h"
#include "wifi/web.h"
#endif
#endif
@ -175,8 +175,6 @@ uint8_t MarlinHAL::get_reset_source() { return rtc_get_reset_reason(1); }
void MarlinHAL::reboot() { ESP.restart(); }
void _delay_ms(const int ms) { delay(ms); }
// return free memory between end of heap (or end bss) and whatever is current
int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }

View file

@ -37,11 +37,11 @@
#include "i2s.h"
#if ENABLED(WIFISUPPORT)
#include "WebSocketSerial.h"
#include "wifi/WebSocketSerial.h"
#endif
#if ENABLED(ESP3D_WIFISUPPORT)
#include "esp3dlib.h"
#include <esp3dlib.h>
#endif
#include "FlushableHardwareSerial.h"
@ -165,8 +165,6 @@ int freeMemory();
#pragma GCC diagnostic pop
void _delay_ms(const int ms);
// ------------------------
// MarlinHAL Class
// ------------------------
@ -194,7 +192,7 @@ public:
static void isr_on() { if (spinlock.owner != portMUX_FREE_VAL) portEXIT_CRITICAL(&spinlock); }
static void isr_off() { portENTER_CRITICAL(&spinlock); }
static void delay_ms(const int ms) { _delay_ms(ms); }
static void delay_ms(const int ms) { delay(ms); }
// Tasks, called from idle()
static void idletask();

View file

@ -145,7 +145,7 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) {
void stepperTask(void *parameter) {
uint32_t nextMainISR = 0;
#if ENABLED(LIN_ADVANCE)
uint32_t nextAdvanceISR = Stepper::LA_ADV_NEVER;
uint32_t nextAdvanceISR = stepper.LA_ADV_NEVER;
#endif
for (;;) {
@ -167,13 +167,13 @@ void stepperTask(void *parameter) {
if (!using_ftMotion) {
if (!nextMainISR) {
Stepper::pulse_phase_isr();
nextMainISR = Stepper::block_phase_isr();
stepper.pulse_phase_isr();
nextMainISR = stepper.block_phase_isr();
}
#if ENABLED(LIN_ADVANCE)
else if (!nextAdvanceISR) {
Stepper::advance_isr();
nextAdvanceISR = Stepper::la_interval;
stepper.advance_isr();
nextAdvanceISR = stepper.la_interval;
}
#endif
else
@ -182,10 +182,10 @@ void stepperTask(void *parameter) {
nextMainISR--;
#if ENABLED(LIN_ADVANCE)
if (nextAdvanceISR == Stepper::LA_ADV_NEVER)
nextAdvanceISR = Stepper::la_interval;
if (nextAdvanceISR == stepper.LA_ADV_NEVER)
nextAdvanceISR = stepper.la_interval;
if (nextAdvanceISR && nextAdvanceISR != Stepper::LA_ADV_NEVER)
if (nextAdvanceISR && nextAdvanceISR != stepper.LA_ADV_NEVER)
nextAdvanceISR--;
#endif
}

View file

@ -35,7 +35,7 @@
#if HAS_MEDIA
#include "../../sd/cardreader.h"
#if ENABLED(ESP3D_WIFISUPPORT)
#include "sd_ESP32.h"
#include <sd_ESP32.h>
#endif
#endif

View file

@ -21,7 +21,7 @@
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(WIFISUPPORT)

View file

@ -21,8 +21,8 @@
*/
#pragma once
#include "../../inc/MarlinConfig.h"
#include "../../core/serial_hook.h"
#include "../../../inc/MarlinConfig.h"
#include "../../../core/serial_hook.h"
#include <Stream.h>

View file

@ -27,7 +27,7 @@
#undef ENABLED
#undef DISABLED
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if ALL(WIFISUPPORT, OTASUPPORT)

View file

@ -21,11 +21,11 @@
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if ALL(WIFISUPPORT, WEBSUPPORT)
#include "../../core/serial.h"
#include "../../../core/serial.h"
#include <FS.h>
#include <SPIFFS.h>

View file

@ -21,11 +21,11 @@
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if ALL(WIFISUPPORT, WEBSUPPORT)
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#undef DISABLED // esp32-hal-gpio.h
#include <SPIFFS.h>

View file

@ -21,11 +21,11 @@
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(WIFISUPPORT)
#include "../../core/serial.h"
#include "../../../core/serial.h"
#include <WiFi.h>
#include <ESPmDNS.h>

View file

@ -60,10 +60,9 @@ MarlinSerial& MarlinSerial::get_instance(usart::USART_Base Base, pin_size_t rxPi
static MarlinSerial* current_serial_instance = nullptr;
static void emergency_callback() {
if (current_serial_instance) {
uint8_t last_data = current_serial_instance->get_last_data();
emergency_parser.update(current_serial_instance->emergency_state, last_data);
}
if (!current_serial_instance) return;
const uint8_t last_data = current_serial_instance->get_last_data();
emergency_parser.update(current_serial_instance->emergency_state, last_data);
}
void MarlinSerial::register_emergency_callback(void (*callback)()) {
@ -72,26 +71,23 @@ MarlinSerial& MarlinSerial::get_instance(usart::USART_Base Base, pin_size_t rxPi
#endif
void MarlinSerial::begin(unsigned long baudrate, uint16_t config) {
UsartSerial::begin(baudrate, config);
#if DISABLED(SERIAL_DMA)
#if ENABLED(EMERGENCY_PARSER)
current_serial_instance = this;
register_emergency_callback(emergency_callback);
#endif
UsartSerial::begin(baudrate, config, ENABLED(SERIAL_DMA));
#if ENABLED(EMERGENCY_PARSER) && DISABLED(SERIAL_DMA)
current_serial_instance = this;
register_emergency_callback(emergency_callback);
#endif
}
void MarlinSerial::updateRxDmaBuffer() {
#if ENABLED(EMERGENCY_PARSER)
// Get the number of bytes available in the receive buffer
size_t available_bytes = usart_.available_for_read(true);
uint8_t data;
const size_t available_bytes = usart_.available_for_read(true);
// Process only the available data
for (size_t i = 0; i < available_bytes; ++i) {
if (usart_.read_rx_buffer(data)) {
uint8_t data;
if (usart_.read_rx_buffer(data))
emergency_parser.update(emergency_state, data);
}
}
#endif
// Call the base class implementation to handle any additional updates

View file

@ -41,23 +41,26 @@ static uint32_t servo_interrupt_priority = NVIC_EncodePriority(NVIC_GetPriorityG
// This must be called after the MFL Servo class has initialized the timer.
// To be safe this is currently called after every call to attach().
static void fixServoTimerInterruptPriority() {
NVIC_SetPriority(getTimerUpIRQ(TIMER_SERVO), servo_interrupt_priority);
auto& servoTimerIdx = GeneralTimer::get_instance(static_cast<timer::TIMER_Base>(TIMER_SERVO));
NVIC_SetPriority(servoTimerIdx.getTimerUpIRQ(), servo_interrupt_priority);
}
// Default constructor for libServo class.
// Initializes the servo delay, pause state, and pause value.
// Registers the servo instance in the servos array.
libServo::libServo() : delay(servoDelay[servoCount]),
libServo::libServo() :
delay(servoDelay[servoCount]),
was_attached_before_pause(false),
value_before_pause(0) {
value_before_pause(0)
{
servos[servoCount++] = this;
}
// Attaches a servo to a specified pin.
int8_t libServo::attach(const int pin) {
if (servoCount >= MAX_SERVOS) return -1;
if (pin > 0) servo_pin = pin;
auto result = mflServo.attach(servo_pin);
if (pin > 0) servoPin = pin;
auto result = mflServo.attach(servoPin);
fixServoTimerInterruptPriority();
return result;
}
@ -65,8 +68,8 @@ int8_t libServo::attach(const int pin) {
// Attaches a servo to a specified pin with minimum and maximum pulse widths.
int8_t libServo::attach(const int pin, const int min, const int max) {
if (servoCount >= MAX_SERVOS) return -1;
if (pin > 0) servo_pin = pin;
auto result = mflServo.attach(servo_pin, min, max);
if (pin > 0) servoPin = pin;
auto result = mflServo.attach(servoPin, min, max);
fixServoTimerInterruptPriority();
return result;
}

View file

@ -25,16 +25,16 @@
* with simple implementations supplied by Marlin.
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef ARDUINO_ARCH_MFL
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."

View file

@ -25,16 +25,16 @@
* Enable USE_SHARED_EEPROM if not supplied by the framework.
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef ARDUINO_ARCH_MFL
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../../libs/BL24CXX.h"
#include "../shared/eeprom_if.h"
#include "../../../libs/BL24CXX.h"
#include "../../shared/eeprom_if.h"
void eeprom_init() {
BL24CXX::init();

View file

@ -19,11 +19,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef ARDUINO_ARCH_MFL
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -32,8 +32,8 @@
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)

View file

@ -27,9 +27,12 @@
#include <PinOps.hpp>
#include <PinOpsMap.hpp>
static inline void fast_write_pin_wrapper(pin_size_t IO, bool V) {
if (V) gpio::fast_set_pin(getPortFromPin(IO), getPinInPort(IO));
else gpio::fast_clear_pin(getPortFromPin(IO), getPinInPort(IO));
template<typename T>
static inline void fast_write_pin_wrapper(pin_size_t IO, T V) {
auto port = getPortFromPin(IO);
auto pin = getPinInPort(IO);
if (static_cast<bool>(V)) gpio::fast_set_pin(port, pin);
else gpio::fast_clear_pin(port, pin);
}
static inline bool fast_read_pin_wrapper(pin_size_t IO) {

View file

@ -15,12 +15,12 @@
// If not, see <https://www.gnu.org/licenses/>.
//
#include "../platforms.h"
#include "../../platforms.h"
#ifdef ARDUINO_ARCH_MFL
#include "../../inc/MarlinConfig.h"
#include "../shared/Delay.h"
#include "../../../inc/MarlinConfig.h"
#include "../../shared/Delay.h"
#include "SDCard.h"
#include <string.h>

View file

@ -16,9 +16,9 @@
//
#pragma once
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#include "SDIO.hpp"
#include <SDIO.hpp>
namespace sdio {

View file

@ -20,11 +20,11 @@
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef ARDUINO_ARCH_MFL
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(ONBOARD_SDIO)
@ -215,7 +215,6 @@ void DMA1_IRQHandler() {
}
}
extern "C" {
void SDIO_IRQHandler(void) {
@ -228,6 +227,5 @@ extern "C" {
} // extern "C"
#endif // ONBOARD_SDIO
#endif // ARDUINO_ARCH_MFL

View file

@ -92,7 +92,9 @@ bool is_temp_timer_initialized = false;
// Retrieves the clock frequency of the stepper timer
uint32_t GetStepperTimerClkFreq() {
return Step_Timer.getTimerClockFrequency();
// Cache result
static uint32_t clkFreq = Step_Timer.getTimerClockFrequency();
return clkFreq;
}
/**
@ -191,10 +193,12 @@ void SetTimerInterruptPriorities() {
// Detect timer conflicts
// ------------------------
TERN_(HAS_TMC_SW_SERIAL, static constexpr timer::TIMER_Base timer_serial[] = {static_cast<timer::TIMER_Base>(TIMER_SERIAL)});
TERN_(SPEAKER, static constexpr timer::TIMER_Base timer_tone[] = {static_cast<timer::TIMER_Base>(TIMER_TONE)});
TERN_(HAS_SERVOS, static constexpr timer::TIMER_Base timer_servo[] = {static_cast<timer::TIMER_Base>(TIMER_SERVO)});
enum TimerPurpose {
PURPOSE_SERIAL,
PURPOSE_TONE,
PURPOSE_SERVO,
PURPOSE_STEP,
@ -205,6 +209,9 @@ enum TimerPurpose {
// Includes the timer purpose to ease debugging when evaluating at build-time
// This cannot yet account for timers used for PWM output, such as for fans
static constexpr struct { TimerPurpose p; int t; } timers_in_use[] = {
#if HAS_TMC_SW_SERIAL
{ PURPOSE_SERIAL, timer_base_to_index(timer_serial[0]) }, // Set in variant.h
#endif
#if ENABLED(SPEAKER)
{ PURPOSE_TONE, timer_base_to_index(timer_tone[0]) }, // Set in variant.h
#endif

View file

@ -27,7 +27,7 @@
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
#include HAL_PATH(..,HAL.h)
#include HAL_PATH(.., HAL.h)
extern MarlinHAL hal;
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)

View file

@ -26,12 +26,12 @@
*/
#ifdef ARDUINO_ARCH_HC32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../shared/eeprom_api.h"
#include "../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."

View file

@ -26,12 +26,12 @@
*/
#ifdef ARDUINO_ARCH_HC32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../../libs/BL24CXX.h"
#include "../shared/eeprom_if.h"
#include "../../../libs/BL24CXX.h"
#include "../../shared/eeprom_if.h"
void eeprom_init() {
BL24CXX::init();

View file

@ -25,12 +25,12 @@
*/
#ifdef ARDUINO_ARCH_HC32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(SDCARD_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../sd/cardreader.h"
#include "../../shared/eeprom_api.h"
#include "../../../sd/cardreader.h"
#define EEPROM_FILENAME "eeprom.dat"

View file

@ -21,7 +21,7 @@
*/
#ifdef ARDUINO_ARCH_HC32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -32,8 +32,8 @@
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."

View file

@ -124,7 +124,7 @@ public:
static void isr_on() {}
static void isr_off() {}
static void delay_ms(const int ms) { _delay_ms(ms); }
static void delay_ms(const int ms) { delay(ms); }
// Tasks, called from idle()
static void idletask() {}

View file

@ -31,8 +31,6 @@ void cli() { } // Disable
void sei() { } // Enable
// Time functions
void _delay_ms(const int ms) { delay(ms); }
unsigned long millis() {
return (unsigned long)Clock::millis();
}

View file

@ -74,7 +74,6 @@ extern "C" {
// Time functions
extern "C" void delay(const int ms);
void _delay_ms(const int ms);
void delayMicroseconds(unsigned long);
unsigned long millis();

View file

@ -173,13 +173,8 @@ void MarlinHAL::init() {
// HAL idle task
void MarlinHAL::idletask() {
#if HAS_SHARED_MEDIA
// If Marlin is using the SD card we need to lock it to prevent access from
// a PC via USB.
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
// this will not reliably detect delete operations. To be safe we will lock
// the disk if Marlin has it mounted. Unfortunately there is currently no way
// to unmount the disk from the LCD menu.
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
// When Marlin is using the SD Card it must be locked to prevent PC access via USB.
// For maximum safety we lock the disk if Marlin has it mounted for any reason.
if (card.isMounted())
MSC_Aquire_Lock();
else

View file

@ -36,11 +36,11 @@
* 16Kb I/O buffers (intended to hold DMA USB and Ethernet data, but currently
* unused).
*/
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
extern "C" {
#include <lpc17xx_iap.h>

View file

@ -26,13 +26,13 @@
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(SDCARD_EEPROM_EMULATION)
//#define DEBUG_SD_EEPROM_EMULATION
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
#include <chanfs/diskio.h>
#include <chanfs/ff.h>
@ -52,7 +52,6 @@ bool eeprom_file_open = false;
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF;
MSC_Aquire_Lock();
if (f_mount(&fat_fs, "", 1)) {
MSC_Release_Lock();
@ -65,6 +64,7 @@ bool PersistentStore::access_start() {
UINT bytes_written;
FSIZE_t file_size = f_size(&eeprom_file);
f_lseek(&eeprom_file, file_size);
const char eeprom_erase_value = 0xFF;
while (file_size < capacity() && res == FR_OK) {
res = f_write(&eeprom_file, &eeprom_erase_value, 1, &bytes_written);
file_size++;

View file

@ -21,7 +21,7 @@
*/
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -30,8 +30,8 @@
* with implementations supplied by the framework.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x8000 // 32K

View file

@ -52,7 +52,9 @@ uint8_t _getc();
// ------------------------
#define CPU_32_BIT
#define SHARED_SERVOS HAS_SERVOS // Use shared/servos.cpp
class Servo;
typedef Servo hal_servo_t;
#define F_CPU 100000000
#define SystemCoreClock F_CPU
@ -193,7 +195,7 @@ public:
static void isr_on() {}
static void isr_off() {}
static void delay_ms(const int ms) { _delay_ms(ms); }
static void delay_ms(const int ms) { delay(ms); }
// Tasks, called from idle()
static void idletask();
@ -232,8 +234,10 @@ public:
* No option to invert the duty cycle [default = false]
* No option to change the scale of the provided value to enable finer PWM duty control [default = 255]
*/
static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) {
analogWrite(pin, v);
static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false) {
auto value = map(v, 0, v_size, 0, UINT16_MAX);
value = invert ? UINT16_MAX - value : value;
analogWrite(pin, value);
}
static void set_pwm_frequency(const pin_t, int) {}

View file

@ -0,0 +1,104 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2025 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/>.
*
*/
#include "../platforms.h"
#ifdef __PLAT_NATIVE_SIM__
#include "../../inc/MarlinConfig.h"
#if HAS_SERVOS
#include "Servo.h"
//#define DEBUG_SERVOS
#define DEBUG_OUT ENABLED(DEBUG_SERVOS)
#include "../../../core/debug_out.h"
uint8_t ServoCount = 0; // the total number of attached servos
Servo::Servo() {
// Constructor stub
DEBUG_ECHOLNPGM("Debug Servo: constructor");
this->servoIndex = ServoCount++; // assign a servo index to this instance
}
uint8_t Servo::attach(int pin) {
// Attach stub
DEBUG_ECHOLNPGM("Debug Servo: attach to pin ", pin, " servo index ", this->servoIndex);
return attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
}
uint8_t Servo::attach(int pin, int min, int max) {
// Attach with min and max stub
DEBUG_ECHOLNPGM("Debug Servo: attach to pin ", pin, " with min ", min, " and max ", max);
if (pin > 0) servo_pin = pin;
return this->servoIndex;
}
void Servo::detach() {
// Detach stub
DEBUG_ECHOLNPGM("Debug Servo: detach");
}
// If value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
void Servo::write(int value) {
if (value < MIN_PULSE_WIDTH) { // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
value = map(constrain(value, 0, 180), 0, 180, SERVO_MIN_US(min), SERVO_MAX_US(max));
}
writeMicroseconds(value);
DEBUG_ECHOLNPGM("Debug Servo: write ", value);
}
void Servo::writeMicroseconds(int value) {
// Simulate the servo movement
this->value = value;
hal.set_pwm_duty(pin_t(this->servo_pin), (float(value) / 20000) * UINT16_MAX, UINT16_MAX);
DEBUG_ECHOLNPGM("Debug Servo: write microseconds ", value);
}
int Servo::read() {
// Read stub
DEBUG_ECHOLNPGM("Debug Servo: read ", this->value);
return this->value;
}
int Servo::readMicroseconds() {
// Read microseconds stub
DEBUG_ECHOLNPGM("Debug Servo: read microseconds");
return 0;
}
bool Servo::attached() {
// Attached stub
DEBUG_ECHOLNPGM("Debug Servo: attached");
return false;
}
int Servo::move(const unsigned char cmd) {
// Move stub
DEBUG_ECHOLNPGM("Debug Servo: move ", cmd);
write(cmd);
return 0;
}
#endif // HAS_SERVOS
#endif // __PLAT_NATIVE_SIM__

View file

@ -0,0 +1,48 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2025 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
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define SERVO_MIN_US(v) (MIN_PULSE_WIDTH - (v) * 4) // minimum value in uS for this servo
#define SERVO_MAX_US(v) (MAX_PULSE_WIDTH - (v) * 4) // maximum value in uS for this servo
class Servo {
public:
Servo();
uint8_t attach(int pin); // Attach the given pin to the next free channel, set pinMode, return channel number or INVALID_SERVO if failure
uint8_t attach(int pin, int min, int max); // As above but also set min and max values for writes.
void detach();
void write(int value); // If value is < 200 it's treated as an angle, otherwise as pulse width in microseconds
void writeMicroseconds(int value); // Write pulse width in microseconds
int read(); // Return current pulse width as an angle between 0 and 180 degrees
int readMicroseconds(); // Return current pulse width in microseconds for this servo
bool attached(); // Return true if this servo is attached, otherwise false
int move (const unsigned char cmd);
private:
uint8_t servoIndex; // Index into the channel data for this servo
int8_t min; // Minimum is this value times 4 added to MIN_PULSE_WIDTH
int8_t max; // Maximum is this value times 4 added to MAX_PULSE_WIDTH
int value; // Pulse width in microseconds for this servo
int servo_pin = 0; // pin number for this servo
};

View file

@ -0,0 +1,30 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2025 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
#error "ENDSTOP_INTERRUPTS_FEATURE is not supported in this simulation environment."
void setup_endstop_interrupts() {
// This function is a stub for setting up endstop interrupts.
// Since this is a simulation environment, actual hardware interrupts
// are not applicable. Add any necessary simulation-specific logic here.
}

View file

@ -1,79 +0,0 @@
/**
* 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
/**
* servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
* Copyright (c) 2009 Michael Margolis. All right reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
*
* The only modification was to update/delete macros to match the LPC176x.
*
*/
#include <stdint.h>
// Macros
//values in microseconds
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
#define MAX_SERVOS 4
#define INVALID_SERVO 255 // flag indicating an invalid servo index
// Types
typedef struct {
uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin)
uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false
} ServoPin_t;
typedef struct {
ServoPin_t Pin;
unsigned int pulse_width; // pulse width in microseconds
} ServoInfo_t;
// Global variables
extern uint8_t ServoCount;
extern ServoInfo_t servo_info[MAX_SERVOS];

View file

@ -77,7 +77,7 @@ void MarlinHAL::init() {
HAL_timer_init();
#if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC
#if ALL(EMERGENCY_PARSER, USBD_USE_CDC)
USB_Hook_init();
#endif
@ -87,7 +87,7 @@ void MarlinHAL::init() {
#if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay_ms(1000); // Give OS time to notice
delay_ms(1000); // Give OS time to notice
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif
}

View file

@ -29,16 +29,16 @@
#include "arduino_extras.h"
#include "../../core/macros.h"
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio.h"
//#include "Servo.h"
#include "watchdog.h"
#include "../../inc/MarlinConfigPre.h"
#include <stdint.h>
#if HAS_SD_HOST_DRIVE
#include "msc_sd.h"
#endif
//
// Serial Ports
@ -139,10 +139,10 @@ public:
static void isr_on() { __enable_irq(); }
static void isr_off() { __disable_irq(); }
static void delay_ms(const int ms) { ::delay(ms); }
static void delay_ms(const int ms) { delay(ms); }
// Tasks, called from idle()
static void idletask() {}
static void idletask() { TERN_(HAS_SD_HOST_DRIVE, tuh_task()); }
// Reset
static uint8_t get_reset_source();

View file

@ -29,7 +29,6 @@
#include "../shared/HAL_MinSerial.h"
static void TXBegin() {
#if !WITHIN(SERIAL_PORT, -1, 2)
#warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error."

View file

@ -19,15 +19,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef __PLAT_RP2040__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
// NOTE: The Bigtreetech SKR Pico has an onboard W25Q16 flash module

View file

@ -19,11 +19,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef __PLAT_RP2040__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -32,8 +32,8 @@
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)

View file

@ -21,7 +21,7 @@
*/
#pragma once
#if ALL(SDSUPPORT, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
#if HAS_MEDIA && DISABLED(NO_SD_HOST_DRIVE)
#define HAS_SD_HOST_DRIVE 1
#endif

View file

@ -27,109 +27,77 @@
#if HAS_SD_HOST_DRIVE
#include "../shared/Marduino.h"
#include "msc_sd.h"
#include "usbd_core.h"
#include "../../sd/cardreader.h"
#include <USB.h>
#include <USBMscHandler.h>
#include <tusb.h> // TinyUSB device stack
#define BLOCK_SIZE 512
#define PRODUCT_ID 0x29
#define SD_MULTIBLOCK_RETRY_CNT 1
class Sd2CardUSBMscHandler : public USBMscHandler {
public:
DiskIODriver* diskIODriver() {
#if HAS_MULTI_VOLUME
#if SHARED_VOLUME_IS(SD_ONBOARD)
return &card.media_driver_sdcard;
#elif SHARED_VOLUME_IS(USB_FLASH_DRIVE)
return &card.media_driver_usbFlash;
#endif
#else
return card.diskIODriver();
DiskIODriver* diskIODriver() {
#if HAS_MULTI_VOLUME
#if SHARED_VOLUME_IS(SD_ONBOARD)
return &card.media_driver_sdcard;
#elif SHARED_VOLUME_IS(USB_FLASH_DRIVE)
return &card.media_driver_usbFlash;
#endif
}
#else
return card.diskIODriver();
#endif
}
bool GetCapacity(uint32_t *pBlockNum, uint16_t *pBlockSize) {
*pBlockNum = diskIODriver()->cardSize();
*pBlockSize = BLOCK_SIZE;
return true;
}
/** Callbacks used by TinyUSB MSC **/
bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = diskIODriver();
// single block
if (blkLen == 1) {
watchdog_refresh();
sd2card->writeBlock(blkAddr, pBuf);
return true;
extern "C" {
bool tud_msc_ready_cb(uint8_t lun) {
return diskIODriver()->isReady();
}
int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, void* buffer, uint32_t bufsize) {
const uint32_t blocks = bufsize / BLOCK_SIZE;
for (uint16_t rcount = SD_MULTIBLOCK_RETRY_CNT; rcount--; ) {
if (diskIODriver()->readBlocks(lba, (uint8_t*)buffer, blocks))
return bufsize; // Success
}
return -1; // Failure after retries
}
int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint8_t const* buffer, uint32_t bufsize) {
const uint32_t blocks = bufsize / BLOCK_SIZE;
for (uint16_t rcount = SD_MULTIBLOCK_RETRY_CNT; rcount--; ) {
if (diskIODriver()->writeBlocks(lba, buffer, blocks))
return bufsize; // Success
}
return -1; // Failure after retries
}
void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) {
memcpy(vendor_id, "MARLIN ", 8);
memcpy(product_id, "Product ", 16);
memcpy(product_rev, "0.01", 4);
}
void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) {
*block_count = diskIODriver()->cardSize();
*block_size = BLOCK_SIZE;
}
void tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) {
if (load_eject) {
if (start) {
// Handle media load
} else {
// Handle media eject
}
// multi block optimization
sd2card->writeStart(blkAddr, blkLen);
while (blkLen--) {
watchdog_refresh();
sd2card->writeData(pBuf);
pBuf += BLOCK_SIZE;
}
sd2card->writeStop();
return true;
}
}
bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = diskIODriver();
// single block
if (blkLen == 1) {
watchdog_refresh();
sd2card->readBlock(blkAddr, pBuf);
return true;
}
// multi block optimization
sd2card->readStart(blkAddr);
while (blkLen--) {
watchdog_refresh();
sd2card->readData(pBuf);
pBuf += BLOCK_SIZE;
}
sd2card->readStop();
return true;
}
bool IsReady() {
return diskIODriver()->isReady();
}
};
Sd2CardUSBMscHandler usbMscHandler;
/* USB Mass storage Standard Inquiry Data */
uint8_t Marlin_STORAGE_Inquirydata[] = { /* 36 */
/* LUN 0 */
0x00,
0x80,
0x02,
0x02,
(STANDARD_INQUIRY_DATA_LEN - 5),
0x00,
0x00,
0x00,
'M', 'A', 'R', 'L', 'I', 'N', ' ', ' ', /* Manufacturer : 8 bytes */
'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'0', '.', '0', '1', /* Version : 4 Bytes */
};
USBMscHandler *pSingleMscHandler = &usbMscHandler;
} // extern "C"
void MSC_SD_init() {
USBDevice.end();
delay(200);
USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata);
USBDevice.begin();
tusb_init();
// Add USB reinitialization logic if needed
}
#endif // HAS_SD_HOST_DRIVE

View file

@ -131,19 +131,19 @@ FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, hal_time
switch (timer_num) {
case 0:
alarm_pool_add_alarm_in_us(HAL_timer_pool_0 ,compare , HAL_timer_alarm_pool_0_callback ,0 ,false );
alarm_pool_add_alarm_in_us(HAL_timer_pool_0, compare, HAL_timer_alarm_pool_0_callback, 0, false);
break;
case 1:
alarm_pool_add_alarm_in_us(HAL_timer_pool_1 ,compare , HAL_timer_alarm_pool_1_callback ,0 ,false );
alarm_pool_add_alarm_in_us(HAL_timer_pool_1, compare, HAL_timer_alarm_pool_1_callback, 0, false);
break;
case 2:
alarm_pool_add_alarm_in_us(HAL_timer_pool_2 ,compare , HAL_timer_alarm_pool_2_callback ,0 ,false );
alarm_pool_add_alarm_in_us(HAL_timer_pool_2, compare, HAL_timer_alarm_pool_2_callback, 0, false);
break;
case 3:
alarm_pool_add_alarm_in_us(HAL_timer_pool_3 ,compare , HAL_timer_alarm_pool_3_callback ,0 ,false );
alarm_pool_add_alarm_in_us(HAL_timer_pool_3, compare, HAL_timer_alarm_pool_3_callback, 0, false);
break;
}
}

View file

@ -24,7 +24,7 @@
* SAMD21 HAL developed by Bart Meijer (brupje)
* Based on SAMD51 HAL by Giuliano Zaro (AKA GMagician)
*/
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(QSPI_EEPROM)

View file

@ -26,7 +26,7 @@
*/
#ifdef __SAMD21__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
@ -35,7 +35,7 @@
/* reserve flash memory */
static const uint8_t flashdata[TOTAL_FLASH_SIZE] __attribute__((__aligned__(256))) { }; \
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }

View file

@ -26,13 +26,13 @@
*/
#ifdef __SAMD21__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(QSPI_EEPROM)
#error "QSPI_EEPROM emulation Not implemented on SAMD21"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
#include "QSPIFlash.h"

View file

@ -26,7 +26,7 @@
*/
#ifdef __SAMD21__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -36,8 +36,8 @@
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."

View file

@ -20,7 +20,7 @@
*
*/
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(QSPI_EEPROM)

View file

@ -25,11 +25,11 @@
*/
#ifdef __SAMD51__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
#define NVMCTRL_CMD(c) do{ \
SYNC(!NVMCTRL->STATUS.bit.READY); \

View file

@ -25,11 +25,11 @@
*/
#ifdef __SAMD51__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(QSPI_EEPROM)
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
#include "QSPIFlash.h"

View file

@ -25,7 +25,7 @@
*/
#ifdef __SAMD51__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -34,8 +34,8 @@
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."

View file

@ -43,8 +43,8 @@
#endif
#if HAS_SD_HOST_DRIVE
#include "msc_sd.h"
#include "usbd_cdc_if.h"
#include "sd/msc_sd.h"
#include <usbd_cdc_if.h>
#endif
// ------------------------
@ -87,7 +87,7 @@ void MarlinHAL::init() {
SetTimerInterruptPriorities();
#if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC)
#if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC)
USB_Hook_init();
#endif
@ -97,7 +97,7 @@ void MarlinHAL::init() {
#if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay(1000); // Give OS time to notice
delay_ms(1000); // Give OS time to notice
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif
}

View file

@ -23,18 +23,14 @@
#define CPU_32_BIT
#include "../../core/macros.h"
#include "../shared/Marduino.h"
#include "../../inc/MarlinConfigPre.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "temp_soc.h"
#include "fastio.h"
#include "Servo.h"
#include "../../inc/MarlinConfigPre.h"
#include <stdint.h>
//
// Default graphical display delays
//

View file

@ -20,7 +20,7 @@
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
@ -29,12 +29,12 @@
* with simple implementations supplied by Marlin.
*/
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
//
// PersistentStore

View file

@ -19,15 +19,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
// Better: "utility/stm32_eeprom.h", but only after updating stm32duino to 2.0.0
// Use EEPROM.h for compatibility, for now.
@ -50,10 +50,10 @@
#if ENABLED(FLASH_EEPROM_LEVELING)
#include "stm32_def.h"
#include <stm32_def.h>
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
#include "../../core/debug_out.h"
#include "../../../core/debug_out.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB

View file

@ -20,7 +20,7 @@
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
@ -29,12 +29,12 @@
* Enable USE_SHARED_EEPROM if not supplied by the framework.
*/
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../../libs/BL24CXX.h"
#include "../shared/eeprom_if.h"
#include "../../../libs/BL24CXX.h"
#include "../../shared/eeprom_if.h"
void eeprom_init() { BL24CXX::init(); }

View file

@ -20,7 +20,7 @@
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
@ -28,12 +28,12 @@
* Implementation of EEPROM settings in SD Card
*/
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(SDCARD_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../sd/cardreader.h"
#include "../../shared/eeprom_api.h"
#include "../../../sd/cardreader.h"
#define EEPROM_FILENAME "eeprom.dat"

View file

@ -19,16 +19,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(SRAM_EEPROM_EMULATION)
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB

View file

@ -19,11 +19,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
@ -32,8 +32,8 @@
* with simple implementations supplied by Marlin.
*/
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)

View file

@ -20,20 +20,19 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if HAS_SD_HOST_DRIVE
#include "../shared/Marduino.h"
#include "../../../sd/cardreader.h"
#include "msc_sd.h"
#include "usbd_core.h"
#include "../../sd/cardreader.h"
#include <usbd_core.h>
#include <USB.h>
#include <USBMscHandler.h>
@ -49,6 +48,7 @@
class Sd2CardUSBMscHandler : public USBMscHandler {
public:
DiskIODriver* diskIODriver() {
// TODO: Explore a variable shared volume, or auto share the un-mounted volume(s)
#if HAS_MULTI_VOLUME
#if SHARED_VOLUME_IS(SD_ONBOARD)
return &card.media_driver_sdcard;

View file

@ -20,18 +20,17 @@
*
*/
#include "../platforms.h"
#include "../../platforms.h"
#ifdef HAL_STM32
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ALL(USE_OTG_USB_HOST, USBHOST)
#include "usb_host.h"
#include "../shared/Marduino.h"
#include "usbh_core.h"
#include "usbh_msc.h"
#include <usbh_core.h>
#include <usbh_msc.h>
USBH_HandleTypeDef hUsbHost;
USBHost usb;

View file

@ -26,7 +26,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC)
#if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC)
#include "usb_serial.h"
#include "../../feature/e_parser.h"
@ -56,5 +56,5 @@ void USB_Hook_init() {
USBD_CDC_fops.Receive = USBD_CDC_Receive_hook;
}
#endif // EMERGENCY_PARSER && USBD_USE_CDC
#endif // EMERGENCY_PARSER && (USBD_USE_CDC || USBD_USE_CDC_MSC)
#endif // HAL_STM32

View file

@ -65,7 +65,8 @@ uint16_t adc_results[ADC_COUNT];
emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]);
}
#endif
#endif
#endif // SERIAL_USB && !HAS_SD_HOST_DRIVE
// ------------------------
// Watchdog Timer
@ -252,7 +253,7 @@ void MarlinHAL::init() {
#endif
#if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay(1000); // Give OS time to notice
delay_ms(1000); // Give OS time to notice
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler
@ -264,7 +265,7 @@ void MarlinHAL::idletask() {
/**
* When Marlin is using the SD card it should be locked to prevent it being
* accessed from a PC over USB.
* Other HALs use (IS_SD_PRINTING() || IS_SD_FILE_OPEN()) to check for access
* Other HALs use (card.isStillPrinting() || card.isFileOpen()) to check for access
* but this won't reliably detect other file operations. To be safe we just lock
* the drive whenever Marlin has it mounted. LCDs should include an Unmount
* command so drives can be released as needed.

View file

@ -40,7 +40,7 @@
#include "../../inc/MarlinConfigPre.h"
#if HAS_SD_HOST_DRIVE
#include "msc_sd.h"
#include "sd/msc_sd.h"
#endif
// ------------------------

View file

@ -239,8 +239,8 @@ typedef struct {
#define ADC_WORKMODE_SLOW_INTERL ((uint32_t)0x00080000)
#define ADC_WORKMODE_ALTER_TRIG ((uint32_t)0x00090000)
#define ADC_EXT_TRIGCONV_T1_CC3 ((uint32_t)0x00040000) //!< For ADC1, ADC2 , ADC3 and ADC4
#define ADC_EXT_TRIGCONV_NONE ((uint32_t)0x000E0000) //!< For ADC1, ADC2 , ADC3 and ADC4
#define ADC_EXT_TRIGCONV_T1_CC3 ((uint32_t)0x00040000) //!< For ADC1, ADC2, ADC3, and ADC4
#define ADC_EXT_TRIGCONV_NONE ((uint32_t)0x000E0000) //!< For ADC1, ADC2, ADC3, and ADC4
#define ADC_DAT_ALIGN_R ((uint32_t)0x00000000)
#define ADC_DAT_ALIGN_L ((uint32_t)0x00000800)
@ -603,9 +603,9 @@ typedef struct {
#define DMA_CHCFG7_PINC ((uint16_t)0x0040) //!< Peripheral increment mode
#define DMA_CHCFG7_MINC ((uint16_t)0x0080) //!< Memory increment mode
#define DMA_CHCFG7_PSIZE , ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size)
#define DMA_CHCFG7_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0
#define DMA_CHCFG7_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1
#define DMA_CHCFG7_PSIZE ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size)
#define DMA_CHCFG7_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0
#define DMA_CHCFG7_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1
#define DMA_CHCFG7_MSIZE ((uint16_t)0x0C00) //!< MSIZE[1:0] bits (Memory size)
#define DMA_CHCFG7_MSIZE_0 ((uint16_t)0x0400) //!< Bit 0
@ -627,9 +627,9 @@ typedef struct {
#define DMA_CHCFG8_PINC ((uint16_t)0x0040) //!< Peripheral increment mode
#define DMA_CHCFG8_MINC ((uint16_t)0x0080) //!< Memory increment mode
#define DMA_CHCFG8_PSIZE , ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size)
#define DMA_CHCFG8_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0
#define DMA_CHCFG8_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1
#define DMA_CHCFG8_PSIZE ((uint16_t)0x0300) //!< PSIZE[1:0] bits (Peripheral size)
#define DMA_CHCFG8_PSIZE_0 ((uint16_t)0x0100) //!< Bit 0
#define DMA_CHCFG8_PSIZE_1 ((uint16_t)0x0200) //!< Bit 1
#define DMA_CHCFG8_MSIZE ((uint16_t)0x0C00) //!< MSIZE[1:0] bits (Memory size)
#define DMA_CHCFG8_MSIZE_0 ((uint16_t)0x0400) //!< Bit 0

View file

@ -26,12 +26,12 @@
* with simple implementations supplied by Marlin.
*/
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
//
// PersistentStore

View file

@ -28,11 +28,11 @@
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(FLASH_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_api.h"
#include <flash_stm32.h>
#include <EEPROM.h>

View file

@ -27,12 +27,12 @@
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../../libs/BL24CXX.h"
#include "../shared/eeprom_if.h"
#include "../../../libs/BL24CXX.h"
#include "../../shared/eeprom_if.h"
void eeprom_init() { BL24CXX::init(); }

View file

@ -27,12 +27,12 @@
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if ENABLED(SDCARD_EEPROM_EMULATION)
#include "../shared/eeprom_api.h"
#include "../../sd/cardreader.h"
#include "../../shared/eeprom_api.h"
#include "../../../sd/cardreader.h"
#define EEPROM_FILENAME "eeprom.dat"

View file

@ -26,12 +26,12 @@
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
#include "../../shared/eeprom_if.h"
#include "../../shared/eeprom_api.h"
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."

View file

@ -22,20 +22,21 @@
*/
#ifdef __STM32F1__
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if HAS_SD_HOST_DRIVE
#include "msc_sd.h"
#include "SPI.h"
#include "usb_reg_map.h"
#include "../SPI.h"
#include <usb_reg_map.h>
#define PRODUCT_ID 0x29
USBMassStorage MarlinMSC;
Serial1Class<USBCompositeSerial> MarlinCompositeSerial(true);
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if SD_CONNECTION_IS(ONBOARD)

View file

@ -24,8 +24,8 @@
#include <USBComposite.h>
#include "../../inc/MarlinConfigPre.h"
#include "../../core/serial_hook.h"
#include "../../../inc/MarlinConfigPre.h"
#include "../../../core/serial_hook.h"
extern USBMassStorage MarlinMSC;
extern Serial1Class<USBCompositeSerial> MarlinCompositeSerial;

View file

@ -13,13 +13,13 @@
#ifdef __STM32F1__
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#if SD_CONNECTION_IS(ONBOARD)
#include "onboard_sd.h"
#include "SPI.h"
#include "fastio.h"
#include "../SPI.h"
#include "../fastio.h"
#ifndef ONBOARD_SPI_DEVICE
#define ONBOARD_SPI_DEVICE SPI_DEVICE

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