Skip to content

Commit fc87e19

Browse files
committed
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro
2 parents dcddbf1 + 54a12ee commit fc87e19

File tree

243 files changed

+13363
-13098
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+13363
-13098
lines changed

Marlin/Configuration.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
/**
100100
* Select the serial port on the board to use for communication with the host.
101101
* This allows the connection of wireless adapters (for instance) to non-default port pins.
102+
* Serial port -1 is the USB emulated serial port, if available.
102103
* Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader.
103104
*
104105
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
@@ -107,9 +108,6 @@
107108

108109
/**
109110
* Select a secondary serial port on the board to use for communication with the host.
110-
* This allows the connection of wireless adapters (for instance) to non-default port pins.
111-
* Serial port -1 is the USB emulated serial port, if available.
112-
*
113111
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
114112
*/
115113
#define SERIAL_PORT_2 1
@@ -475,7 +473,7 @@
475473
#if ENABLED(PIDTEMP)
476474
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
477475
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
478-
//#define PID_DEBUG // Sends debug data to the serial port.
476+
//#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
479477
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
480478
//#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
481479
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)

Marlin/src/HAL/DUE/HAL.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <stdint.h>
4040

4141
// Define MYSERIAL0/1 before MarlinSerial includes!
42-
#if SERIAL_PORT == -1
42+
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
4343
#define MYSERIAL0 customizedSerial1
4444
#elif SERIAL_PORT == 0
4545
#define MYSERIAL0 Serial
@@ -56,7 +56,7 @@
5656
#ifdef SERIAL_PORT_2
5757
#if SERIAL_PORT_2 == SERIAL_PORT
5858
#error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration."
59-
#elif SERIAL_PORT_2 == -1
59+
#elif SERIAL_PORT_2 == -1 || ENABLED(EMERGENCY_PARSER)
6060
#define MYSERIAL1 customizedSerial2
6161
#elif SERIAL_PORT_2 == 0
6262
#define MYSERIAL1 Serial
@@ -94,7 +94,6 @@
9494
#endif
9595
#endif
9696

97-
9897
#include "MarlinSerial.h"
9998
#include "MarlinSerialUSB.h"
10099

Marlin/src/HAL/DUE/MarlinSerial.cpp

+5-15
Original file line numberDiff line numberDiff line change
@@ -629,23 +629,13 @@ void MarlinSerial<Cfg>::printFloat(double number, uint8_t digits) {
629629

630630
// If not using the USB port as serial port
631631
#if SERIAL_PORT >= 0
632-
633-
// Preinstantiate
634-
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>;
635-
636-
// Instantiate
637-
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
638-
632+
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT>>; // Define
633+
MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1; // Instantiate
639634
#endif
640635

641-
#ifdef SERIAL_PORT_2
642-
643-
// Preinstantiate
644-
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>;
645-
646-
// Instantiate
647-
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
648-
636+
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
637+
template class MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>>; // Define
638+
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2; // Instantiate
649639
#endif
650640

651641
#endif // ARDUINO_ARCH_SAM

Marlin/src/HAL/DUE/MarlinSerial.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,9 @@ struct MarlinSerialCfg {
172172
};
173173

174174
#if SERIAL_PORT >= 0
175-
176175
extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
176+
#endif
177177

178-
#endif // SERIAL_PORT >= 0
179-
180-
#ifdef SERIAL_PORT_2
181-
178+
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
182179
extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT_2>> customizedSerial2;
183-
184180
#endif

Marlin/src/HAL/DUE/MarlinSerialUSB.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include "../../inc/MarlinConfig.h"
3131

32-
#if SERIAL_PORT == -1
32+
#if HAS_USB_SERIAL
3333

3434
#include "MarlinSerialUSB.h"
3535

@@ -283,8 +283,12 @@ void MarlinSerialUSB::printFloat(double number, uint8_t digits) {
283283
}
284284

285285
// Preinstantiate
286-
MarlinSerialUSB customizedSerial1;
287-
288-
#endif // SERIAL_PORT == -1
286+
#if SERIAL_PORT == -1
287+
MarlinSerialUSB customizedSerial1;
288+
#endif
289+
#if SERIAL_PORT_2 == -1
290+
MarlinSerialUSB customizedSerial2;
291+
#endif
289292

293+
#endif // HAS_USB_SERIAL
290294
#endif // ARDUINO_ARCH_SAM

Marlin/src/HAL/DUE/MarlinSerialUSB.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "../../inc/MarlinConfig.h"
3030

31-
#if SERIAL_PORT == -1
31+
#if HAS_USB_SERIAL
3232

3333
#include <WString.h>
3434

@@ -88,6 +88,12 @@ class MarlinSerialUSB {
8888
static void printFloat(double, uint8_t);
8989
};
9090

91-
extern MarlinSerialUSB customizedSerial1;
91+
#if SERIAL_PORT == -1
92+
extern MarlinSerialUSB customizedSerial1;
93+
#endif
94+
95+
#if SERIAL_PORT_2 == -1
96+
extern MarlinSerialUSB customizedSerial2;
97+
#endif
9298

93-
#endif // SERIAL_PORT == -1
99+
#endif // HAS_USB_SERIAL

Marlin/src/HAL/DUE/fastio/G2_PWM.cpp

+108-47
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,31 @@
4646

4747
#include "G2_PWM.h"
4848

49+
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
50+
#define G2_PWM_X 1
51+
#else
52+
#define G2_PWM_X 0
53+
#endif
54+
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
55+
#define G2_PWM_Y 1
56+
#else
57+
#define G2_PWM_Y 0
58+
#endif
59+
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
60+
#define G2_PWM_Z 1
61+
#else
62+
#define G2_PWM_Z 0
63+
#endif
64+
#if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
65+
#define G2_PWM_E 1
66+
#else
67+
#define G2_PWM_E 0
68+
#endif
69+
#define G2_MASK_X(V) (G2_PWM_X * (V))
70+
#define G2_MASK_Y(V) (G2_PWM_Y * (V))
71+
#define G2_MASK_Z(V) (G2_PWM_Z * (V))
72+
#define G2_MASK_E(V) (G2_PWM_E * (V))
73+
4974
volatile uint32_t *SODR_A = &PIOA->PIO_SODR,
5075
*SODR_B = &PIOB->PIO_SODR,
5176
*CODR_A = &PIOA->PIO_CODR,
@@ -55,10 +80,18 @@ PWM_map ISR_table[NUM_PWMS] = PWM_MAP_INIT;
5580

5681
void Stepper::digipot_init() {
5782

58-
OUT_WRITE(MOTOR_CURRENT_PWM_X_PIN, 0); // init pins
59-
OUT_WRITE(MOTOR_CURRENT_PWM_Y_PIN, 0);
60-
OUT_WRITE(MOTOR_CURRENT_PWM_Z_PIN, 0);
61-
OUT_WRITE(MOTOR_CURRENT_PWM_E_PIN, 0);
83+
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
84+
OUT_WRITE(MOTOR_CURRENT_PWM_X_PIN, 0); // init pins
85+
#endif
86+
#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
87+
OUT_WRITE(MOTOR_CURRENT_PWM_Y_PIN, 0);
88+
#endif
89+
#if G2_PWM_Z
90+
OUT_WRITE(MOTOR_CURRENT_PWM_Z_PIN, 0);
91+
#endif
92+
#if G2_PWM_E
93+
OUT_WRITE(MOTOR_CURRENT_PWM_E_PIN, 0);
94+
#endif
6295

6396
#define WPKEY (0x50574D << 8) // “PWM” in ASCII
6497
#define WPCMD_DIS_SW 0 // command to disable Write Protect SW
@@ -71,30 +104,51 @@ void Stepper::digipot_init() {
71104
PWM->PWM_WPCR = WPKEY | WPRG_ALL | WPCMD_DIS_SW; // enable setting of all PWM registers
72105
PWM->PWM_CLK = PWM_CLOCK_F; // enable CLK_A and set it to 1MHz, leave CLK_B disabled
73106
PWM->PWM_CH_NUM[0].PWM_CMR = 0b1011; // set channel 0 to Clock A input & to left aligned
74-
PWM->PWM_CH_NUM[1].PWM_CMR = 0b1011; // set channel 1 to Clock A input & to left aligned
75-
PWM->PWM_CH_NUM[2].PWM_CMR = 0b1011; // set channel 2 to Clock A input & to left aligned
76-
PWM->PWM_CH_NUM[3].PWM_CMR = 0b1011; // set channel 3 to Clock A input & to left aligned
77-
PWM->PWM_CH_NUM[4].PWM_CMR = 0b1011; // set channel 4 to Clock A input & to left aligned
107+
if (G2_PWM_X) PWM->PWM_CH_NUM[1].PWM_CMR = 0b1011; // set channel 1 to Clock A input & to left aligned
108+
if (G2_PWM_Y) PWM->PWM_CH_NUM[2].PWM_CMR = 0b1011; // set channel 2 to Clock A input & to left aligned
109+
if (G2_PWM_Z) PWM->PWM_CH_NUM[3].PWM_CMR = 0b1011; // set channel 3 to Clock A input & to left aligned
110+
if (G2_PWM_E) PWM->PWM_CH_NUM[4].PWM_CMR = 0b1011; // set channel 4 to Clock A input & to left aligned
78111

79112
PWM->PWM_CH_NUM[0].PWM_CPRD = PWM_PERIOD_US; // set channel 0 Period
80113

81114
PWM->PWM_IER2 = PWM_IER1_CHID0; // generate interrupt when counter0 overflows
82-
PWM->PWM_IER2 = PWM_IER2_CMPM0 | PWM_IER2_CMPM1 | PWM_IER2_CMPM2 | PWM_IER2_CMPM3 | PWM_IER2_CMPM4; // generate interrupt on compare event
83-
84-
PWM->PWM_CMP[1].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 1 PWM inactive
85-
PWM->PWM_CMP[2].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 2 PWM inactive
86-
PWM->PWM_CMP[3].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[1])); // interrupt when counter0 == CMPV - used to set Motor 3 PWM inactive
87-
PWM->PWM_CMP[4].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[2])); // interrupt when counter0 == CMPV - used to set Motor 4 PWM inactive
88-
89-
PWM->PWM_CMP[1].PWM_CMPM = 0x0001; // enable compare event
90-
PWM->PWM_CMP[2].PWM_CMPM = 0x0001; // enable compare event
91-
PWM->PWM_CMP[3].PWM_CMPM = 0x0001; // enable compare event
92-
PWM->PWM_CMP[4].PWM_CMPM = 0x0001; // enable compare event
93-
94-
PWM->PWM_SCM = PWM_SCM_UPDM_MODE0 | PWM_SCM_SYNC0 | PWM_SCM_SYNC1 | PWM_SCM_SYNC2 | PWM_SCM_SYNC3 | PWM_SCM_SYNC4; // sync 1-4 with 0, use mode 0 for updates
95-
96-
PWM->PWM_ENA = PWM_ENA_CHID0 | PWM_ENA_CHID1 | PWM_ENA_CHID2 | PWM_ENA_CHID3 | PWM_ENA_CHID4; // enable the channels used by G2
97-
PWM->PWM_IER1 = PWM_IER1_CHID0 | PWM_IER1_CHID1 | PWM_IER1_CHID2 | PWM_IER1_CHID3 | PWM_IER1_CHID4; // enable interrupts for the channels used by G2
115+
PWM->PWM_IER2 = PWM_IER2_CMPM0
116+
| G2_MASK_X(PWM_IER2_CMPM1)
117+
| G2_MASK_Y(PWM_IER2_CMPM2)
118+
| G2_MASK_Z(PWM_IER2_CMPM3)
119+
| G2_MASK_E(PWM_IER2_CMPM4)
120+
; // generate interrupt on compare event
121+
122+
if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 1 PWM inactive
123+
if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 2 PWM inactive
124+
if (G2_PWM_Z) PWM->PWM_CMP[3].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[1])); // interrupt when counter0 == CMPV - used to set Motor 3 PWM inactive
125+
if (G2_PWM_E) PWM->PWM_CMP[4].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[2])); // interrupt when counter0 == CMPV - used to set Motor 4 PWM inactive
126+
127+
if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPM = 0x0001; // enable compare event
128+
if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPM = 0x0001; // enable compare event
129+
if (G2_PWM_Z) PWM->PWM_CMP[3].PWM_CMPM = 0x0001; // enable compare event
130+
if (G2_PWM_E) PWM->PWM_CMP[4].PWM_CMPM = 0x0001; // enable compare event
131+
132+
PWM->PWM_SCM = PWM_SCM_UPDM_MODE0 | PWM_SCM_SYNC0
133+
| G2_MASK_X(PWM_SCM_SYNC1)
134+
| G2_MASK_Y(PWM_SCM_SYNC2)
135+
| G2_MASK_Z(PWM_SCM_SYNC3)
136+
| G2_MASK_E(PWM_SCM_SYNC4)
137+
; // sync 1-4 with 0, use mode 0 for updates
138+
139+
PWM->PWM_ENA = PWM_ENA_CHID0
140+
| G2_MASK_X(PWM_ENA_CHID1)
141+
| G2_MASK_Y(PWM_ENA_CHID2)
142+
| G2_MASK_Z(PWM_ENA_CHID3)
143+
| G2_MASK_E(PWM_ENA_CHID4)
144+
; // enable channels used by G2
145+
146+
PWM->PWM_IER1 = PWM_IER1_CHID0
147+
| G2_MASK_X(PWM_IER1_CHID1)
148+
| G2_MASK_Y(PWM_IER1_CHID2)
149+
| G2_MASK_Z(PWM_IER1_CHID3)
150+
| G2_MASK_E(PWM_IER1_CHID4)
151+
; // enable interrupts for channels used by G2
98152

99153
NVIC_EnableIRQ(PWM_IRQn); // Enable interrupt handler
100154
NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module (can stand some jitter on the Vref signals)
@@ -105,20 +159,27 @@ void Stepper::digipot_current(const uint8_t driver, const int16_t current) {
105159
if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init(); // Init PWM system if needed
106160

107161
switch (driver) {
108-
case 0: PWM->PWM_CMP[1].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update X & Y
109-
PWM->PWM_CMP[2].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));
110-
PWM->PWM_CMP[1].PWM_CMPMUPD = 0x0001; // enable compare event
111-
PWM->PWM_CMP[2].PWM_CMPMUPD = 0x0001; // enable compare event
112-
PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
113-
break;
114-
case 1: PWM->PWM_CMP[3].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update Z
115-
PWM->PWM_CMP[3].PWM_CMPMUPD = 0x0001; // enable compare event
116-
PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
117-
break;
118-
default:PWM->PWM_CMP[4].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update E
119-
PWM->PWM_CMP[4].PWM_CMPMUPD = 0x0001; // enable compare event
120-
PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
121-
break;
162+
case 0:
163+
if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update X & Y
164+
if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current));
165+
if (G2_PWM_X) PWM->PWM_CMP[1].PWM_CMPMUPD = 0x0001; // enable compare event
166+
if (G2_PWM_Y) PWM->PWM_CMP[2].PWM_CMPMUPD = 0x0001; // enable compare event
167+
if (G2_PWM_X || G2_PWM_Y) PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
168+
break;
169+
case 1:
170+
if (G2_PWM_Z) {
171+
PWM->PWM_CMP[3].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update Z
172+
PWM->PWM_CMP[3].PWM_CMPMUPD = 0x0001; // enable compare event
173+
PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
174+
}
175+
break;
176+
default:
177+
if (G2_PWM_E) {
178+
PWM->PWM_CMP[4].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update E
179+
PWM->PWM_CMP[4].PWM_CMPMUPD = 0x0001; // enable compare event
180+
PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle
181+
}
182+
break;
122183
}
123184
}
124185

@@ -127,17 +188,17 @@ volatile uint32_t PWM_ISR1_STATUS, PWM_ISR2_STATUS;
127188
void PWM_Handler() {
128189
PWM_ISR1_STATUS = PWM->PWM_ISR1;
129190
PWM_ISR2_STATUS = PWM->PWM_ISR2;
130-
if (PWM_ISR1_STATUS & PWM_IER1_CHID0) { // CHAN_0 interrupt
131-
*ISR_table[0].set_register = ISR_table[0].write_mask; // set X to active
132-
*ISR_table[1].set_register = ISR_table[1].write_mask; // set Y to active
133-
*ISR_table[2].set_register = ISR_table[2].write_mask; // set Z to active
134-
*ISR_table[3].set_register = ISR_table[3].write_mask; // set E to active
191+
if (PWM_ISR1_STATUS & PWM_IER1_CHID0) { // CHAN_0 interrupt
192+
if (G2_PWM_X) *ISR_table[0].set_register = ISR_table[0].write_mask; // set X to active
193+
if (G2_PWM_Y) *ISR_table[1].set_register = ISR_table[1].write_mask; // set Y to active
194+
if (G2_PWM_Z) *ISR_table[2].set_register = ISR_table[2].write_mask; // set Z to active
195+
if (G2_PWM_E) *ISR_table[3].set_register = ISR_table[3].write_mask; // set E to active
135196
}
136197
else {
137-
if (PWM_ISR2_STATUS & PWM_IER2_CMPM1) *ISR_table[0].clr_register = ISR_table[0].write_mask; // set X to inactive
138-
if (PWM_ISR2_STATUS & PWM_IER2_CMPM2) *ISR_table[1].clr_register = ISR_table[1].write_mask; // set Y to inactive
139-
if (PWM_ISR2_STATUS & PWM_IER2_CMPM3) *ISR_table[2].clr_register = ISR_table[2].write_mask; // set Z to inactive
140-
if (PWM_ISR2_STATUS & PWM_IER2_CMPM4) *ISR_table[3].clr_register = ISR_table[3].write_mask; // set E to inactive
198+
if (G2_PWM_X && (PWM_ISR2_STATUS & PWM_IER2_CMPM1)) *ISR_table[0].clr_register = ISR_table[0].write_mask; // set X to inactive
199+
if (G2_PWM_Y && (PWM_ISR2_STATUS & PWM_IER2_CMPM2)) *ISR_table[1].clr_register = ISR_table[1].write_mask; // set Y to inactive
200+
if (G2_PWM_Z && (PWM_ISR2_STATUS & PWM_IER2_CMPM3)) *ISR_table[2].clr_register = ISR_table[2].write_mask; // set Z to inactive
201+
if (G2_PWM_E && (PWM_ISR2_STATUS & PWM_IER2_CMPM4)) *ISR_table[3].clr_register = ISR_table[3].write_mask; // set E to inactive
141202
}
142203
return;
143204
}

Marlin/src/HAL/LPC1768/HAL.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
6767
return ind > -1 ? ind : dval;
6868
}
6969

70-
void flashFirmware(int16_t value) {
71-
NVIC_SystemReset();
72-
}
70+
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
7371

7472
void HAL_clear_reset_source(void) {
7573
#if ENABLED(USE_WATCHDOG)

Marlin/src/HAL/LPC1768/HAL.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
195195
void HAL_idletask();
196196

197197
#define PLATFORM_M997_SUPPORT
198-
void flashFirmware(int16_t value);
198+
void flashFirmware(const int16_t);
199199

200200
/**
201201
* set_pwm_frequency

Marlin/src/HAL/STM32/HAL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,6 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRe
133133

134134
uint16_t HAL_adc_get_result() { return HAL_adc_result; }
135135

136-
void flashFirmware(int16_t) { NVIC_SystemReset(); }
136+
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
137137

138138
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

Marlin/src/HAL/STM32/HAL.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,4 @@ uint16_t HAL_adc_get_result();
223223
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
224224

225225
#define PLATFORM_M997_SUPPORT
226-
void flashFirmware(int16_t value);
226+
void flashFirmware(const int16_t);

Marlin/src/HAL/STM32F1/HAL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,6 @@ void analogWrite(pin_t pin, int pwm_val8) {
388388
analogWrite(uint8_t(pin), pwm_val8);
389389
}
390390

391-
void flashFirmware(int16_t value) { nvic_sys_reset(); }
391+
void flashFirmware(const int16_t) { nvic_sys_reset(); }
392392

393393
#endif // __STM32F1__

Marlin/src/HAL/STM32F1/HAL.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ void HAL_idletask();
160160

161161
#ifndef digitalPinHasPWM
162162
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != nullptr)
163+
#define NO_COMPILE_TIME_PWM
163164
#endif
164165

165166
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); (void)__iCliRetVal()
@@ -287,4 +288,4 @@ void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!?
287288
#define JTAGSWD_DISABLE() afio_cfg_debug_ports(AFIO_DEBUG_NONE)
288289

289290
#define PLATFORM_M997_SUPPORT
290-
void flashFirmware(int16_t value);
291+
void flashFirmware(const int16_t);

0 commit comments

Comments
 (0)