Skip to content

Commit 644bfb2

Browse files
committed
Merge bugfix-2.0.x changes & revert original TFT upscaler
2 parents d2aea39 + 97b5a5f commit 644bfb2

File tree

726 files changed

+13114
-695415
lines changed

Some content is hidden

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

726 files changed

+13114
-695415
lines changed

.github/FUNDING.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
custom: http://www.thinkyhead.com/donate-to-marlin
1+
github: [thinkyhead]
2+
patreon: thinkyhead
3+
custom: ["http://www.thinkyhead.com/donate-to-marlin"]

.github/workflows/bump-date.yml

-25
This file was deleted.

.github/workflows/test-builds.yml

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
- BIGTREE_SKR_PRO
5555
- mks_robin
5656
- ARMED
57+
- FYSETC_S6
5758

5859
# Put lengthy tests last
5960

@@ -94,6 +95,8 @@ jobs:
9495

9596
- name: Run ${{ matrix.test-platform }} Tests
9697
run: |
98+
# Inline tests script
99+
[[ "$GITHUB_REPOSITORY" == "MarlinFirmware/Marlin" ]] || exit 0
97100
chmod +x buildroot/bin/*
98101
chmod +x buildroot/share/tests/*
99102
export PATH=./buildroot/bin/:./buildroot/share/tests/:${PATH}

Marlin/src/HAL/HAL_AVR/HAL.h

+22-9
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,37 @@ typedef int8_t pin_t;
9191
#define NUM_SERIAL 1
9292
#else
9393
#if !WITHIN(SERIAL_PORT, -1, 3)
94-
#error "SERIAL_PORT must be from -1 to 3"
94+
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
9595
#endif
9696

9797
#define MYSERIAL0 customizedSerial1
9898

9999
#ifdef SERIAL_PORT_2
100100
#if !WITHIN(SERIAL_PORT_2, -1, 3)
101-
#error "SERIAL_PORT_2 must be from -1 to 3"
101+
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
102102
#elif SERIAL_PORT_2 == SERIAL_PORT
103-
#error "SERIAL_PORT_2 must be different than SERIAL_PORT"
103+
#error "SERIAL_PORT_2 must be different than SERIAL_PORT. Please update your configuration."
104104
#endif
105-
#define NUM_SERIAL 2
106105
#define MYSERIAL1 customizedSerial2
106+
#define NUM_SERIAL 2
107107
#else
108108
#define NUM_SERIAL 1
109109
#endif
110110
#endif
111111

112+
#ifdef DGUS_SERIAL_PORT
113+
#if !WITHIN(DGUS_SERIAL_PORT, -1, 3)
114+
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
115+
#elif DGUS_SERIAL_PORT == SERIAL_PORT
116+
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT. Please update your configuration."
117+
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
118+
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
119+
#endif
120+
#define DGUS_SERIAL internalDgusSerial
121+
122+
#define DGUS_SERIAL_GET_TX_BUFFER_FREE DGUS_SERIAL.get_tx_buffer_free
123+
#endif
124+
112125
// ------------------------
113126
// Public functions
114127
// ------------------------
@@ -345,9 +358,9 @@ void TIMER0_COMPB_vect_bottom()
345358

346359
// ADC
347360
#ifdef DIDR2
348-
#define HAL_ANALOG_SELECT(pin) do{ if (pin < 8) SBI(DIDR0, pin); else SBI(DIDR2, pin & 0x07); }while(0)
361+
#define HAL_ANALOG_SELECT(ind) do{ if (ind < 8) SBI(DIDR0, ind); else SBI(DIDR2, ind & 0x07); }while(0)
349362
#else
350-
#define HAL_ANALOG_SELECT(pin) do{ SBI(DIDR0, pin); }while(0)
363+
#define HAL_ANALOG_SELECT(ind) SBI(DIDR0, ind);
351364
#endif
352365

353366
inline void HAL_adc_init() {
@@ -358,11 +371,11 @@ inline void HAL_adc_init() {
358371
#endif
359372
}
360373

361-
#define SET_ADMUX_ADCSRA(pin) ADMUX = _BV(REFS0) | (pin & 0x07); SBI(ADCSRA, ADSC)
374+
#define SET_ADMUX_ADCSRA(ch) ADMUX = _BV(REFS0) | (ch & 0x07); SBI(ADCSRA, ADSC)
362375
#ifdef MUX5
363-
#define HAL_START_ADC(pin) if (pin > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
376+
#define HAL_START_ADC(ch) if (ch > 7) ADCSRB = _BV(MUX5); else ADCSRB = 0; SET_ADMUX_ADCSRA(ch)
364377
#else
365-
#define HAL_START_ADC(pin) ADCSRB = 0; SET_ADMUX_ADCSRA(pin)
378+
#define HAL_START_ADC(ch) ADCSRB = 0; SET_ADMUX_ADCSRA(ch)
366379
#endif
367380

368381
#define HAL_ADC_RESOLUTION 10

Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp

+28-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
4242

4343
#include "MarlinSerial.h"
44-
#include "../../Marlin.h"
44+
#include "../../MarlinCore.h"
4545

4646
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
4747
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_t MarlinSerial<Cfg>::tx_buffer = { 0 };
@@ -757,6 +757,33 @@
757757

758758
#endif
759759

760+
#ifdef DGUS_SERIAL_PORT
761+
762+
template<typename Cfg>
763+
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
764+
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
765+
h = tx_buffer.head; // next pos for queue.
766+
int ret = t - h - 1;
767+
if (ret < 0) ret += Cfg::TX_SIZE + 1;
768+
return ret;
769+
}
770+
771+
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_RX_vect)) {
772+
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::store_rxd_char();
773+
}
774+
775+
ISR(SERIAL_REGNAME(USART,DGUS_SERIAL_PORT,_UDRE_vect)) {
776+
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>::_tx_udr_empty_irq();
777+
}
778+
779+
// Preinstantiate
780+
template class MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>>;
781+
782+
// Instantiate
783+
MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
784+
785+
#endif
786+
760787
// For AT90USB targets use the UART for BT interfacing
761788
#if defined(USBCON) && ENABLED(BLUETOOTH)
762789
HardwareSerial bluetoothSerial;

Marlin/src/HAL/HAL_AVR/MarlinSerial.h

+20
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@
217217
static ring_buffer_pos_t available();
218218
static void write(const uint8_t c);
219219
static void flushTX();
220+
#ifdef DGUS_SERIAL_PORT
221+
static ring_buffer_pos_t get_tx_buffer_free();
222+
#endif
220223

221224
FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
222225
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
@@ -292,6 +295,23 @@
292295
extern MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
293296
#endif
294297

298+
#ifdef DGUS_SERIAL_PORT
299+
template <uint8_t serial>
300+
struct MarlinInternalSerialCfg {
301+
static constexpr int PORT = serial;
302+
static constexpr unsigned int RX_SIZE = 128;
303+
static constexpr unsigned int TX_SIZE = 48;
304+
static constexpr bool XONOFF = false;
305+
static constexpr bool EMERGENCYPARSER = false;
306+
static constexpr bool DROPPED_RX = false;
307+
static constexpr bool RX_OVERRUNS = bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS;
308+
static constexpr bool RX_FRAMING_ERRORS = false;
309+
static constexpr bool MAX_RX_QUEUED = false;
310+
};
311+
312+
extern MarlinSerial<MarlinInternalSerialCfg<DGUS_SERIAL_PORT>> internalDgusSerial;
313+
#endif
314+
295315
// Use the UART for Bluetooth in AT90USB configurations
296316
#if defined(USBCON) && ENABLED(BLUETOOTH)
297317
extern HardwareSerial bluetoothSerial;

Marlin/src/HAL/HAL_AVR/endstop_interrupts.h

+16
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,22 @@ void setup_endstop_interrupts() {
232232
pciSetup(Z3_MIN_PIN);
233233
#endif
234234
#endif
235+
#if HAS_Z4_MAX
236+
#if (digitalPinToInterrupt(Z4_MAX_PIN) != NOT_AN_INTERRUPT)
237+
_ATTACH(Z4_MAX_PIN);
238+
#else
239+
static_assert(digitalPinHasPCICR(Z4_MAX_PIN), "Z4_MAX_PIN is not interrupt-capable");
240+
pciSetup(Z4_MAX_PIN);
241+
#endif
242+
#endif
243+
#if HAS_Z4_MIN
244+
#if (digitalPinToInterrupt(Z4_MIN_PIN) != NOT_AN_INTERRUPT)
245+
_ATTACH(Z4_MIN_PIN);
246+
#else
247+
static_assert(digitalPinHasPCICR(Z4_MIN_PIN), "Z4_MIN_PIN is not interrupt-capable");
248+
pciSetup(Z4_MIN_PIN);
249+
#endif
250+
#endif
235251
#if HAS_Z_MIN_PROBE_PIN
236252
#if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT)
237253
_ATTACH(Z_MIN_PROBE_PIN);

Marlin/src/HAL/HAL_AVR/inc/SanityCheck.h

+4
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@
5959
#if HAS_TRINAMIC && ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
6060
#error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
6161
#endif
62+
63+
#if TMC_HAS_SW_SERIAL && ENABLED(MONITOR_DRIVER_STATUS)
64+
#error "MONITOR_DRIVER_STATUS causes performance issues when used with SoftwareSerial-connected drivers. Disable MONITOR_DRIVER_STATUS or use hardware serial to continue."
65+
#endif

Marlin/src/HAL/HAL_AVR/pinsDebug.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,7 @@ static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin");
234234
void com_print(uint8_t N, uint8_t Z) {
235235
const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
236236
SERIAL_ECHOPGM(" COM");
237-
SERIAL_CHAR('0' + N);
238-
SERIAL_CHAR('A' + Z);
237+
SERIAL_CHAR('0' + N, 'A' + Z);
239238
SERIAL_ECHOPAIR(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03));
240239
}
241240

@@ -247,8 +246,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
247246
if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
248247

249248
SERIAL_ECHOPGM(" TIMER");
250-
SERIAL_CHAR(T + '0');
251-
SERIAL_CHAR(L);
249+
SERIAL_CHAR(T + '0', L);
252250
SERIAL_ECHO_SP(3);
253251

254252
if (N == 3) {

Marlin/src/HAL/HAL_AVR/watchdog.cpp

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

2929
#include "watchdog.h"
3030

31-
#include "../../Marlin.h"
31+
#include "../../MarlinCore.h"
3232

3333
// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s.
3434
void watchdog_init() {

Marlin/src/HAL/HAL_DUE/HAL.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ int freeMemory() {
9494
// ADC
9595
// ------------------------
9696

97-
void HAL_adc_start_conversion(const uint8_t adc_pin) {
98-
HAL_adc_result = analogRead(adc_pin);
97+
void HAL_adc_start_conversion(const uint8_t ch) {
98+
HAL_adc_result = analogRead(ch);
9999
}
100100

101101
uint16_t HAL_adc_get_result() {

Marlin/src/HAL/HAL_DUE/HAL.h

+25-5
Original file line numberDiff line numberDiff line change
@@ -56,8 +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-
#endif
60-
#if SERIAL_PORT_2 == -1
59+
#elif SERIAL_PORT_2 == -1
6160
#define MYSERIAL1 customizedSerial2
6261
#elif SERIAL_PORT_2 == 0
6362
#define MYSERIAL1 Serial
@@ -75,6 +74,27 @@
7574
#define NUM_SERIAL 1
7675
#endif
7776

77+
#ifdef DGUS_SERIAL_PORT
78+
#if DGUS_SERIAL_PORT == SERIAL_PORT
79+
#error "DGUS_SERIAL_PORT must be different from SERIAL_PORT. Please update your configuration."
80+
#elif defined(SERIAL_PORT_2) && DGUS_SERIAL_PORT == SERIAL_PORT_2
81+
#error "DGUS_SERIAL_PORT must be different than SERIAL_PORT_2. Please update your configuration."
82+
#elif DGUS_SERIAL_PORT == -1
83+
#define DGUS_SERIAL internalDgusSerial
84+
#elif DGUS_SERIAL_PORT == 0
85+
#define DGUS_SERIAL Serial
86+
#elif DGUS_SERIAL_PORT == 1
87+
#define DGUS_SERIAL Serial1
88+
#elif DGUS_SERIAL_PORT == 2
89+
#define DGUS_SERIAL Serial2
90+
#elif DGUS_SERIAL_PORT == 3
91+
#define DGUS_SERIAL Serial3
92+
#else
93+
#error "DGUS_SERIAL_PORT must be from -1 to 3. Please update your configuration."
94+
#endif
95+
#endif
96+
97+
7898
#include "MarlinSerial.h"
7999
#include "MarlinSerialUSB.h"
80100

@@ -128,16 +148,16 @@ extern uint16_t HAL_adc_result; // result of last ADC conversion
128148
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
129149
#endif
130150

131-
#define HAL_ANALOG_SELECT(pin)
151+
#define HAL_ANALOG_SELECT(ch)
132152

133153
inline void HAL_adc_init() {}//todo
134154

135-
#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin)
155+
#define HAL_START_ADC(ch) HAL_adc_start_conversion(ch)
136156
#define HAL_ADC_RESOLUTION 10
137157
#define HAL_READ_ADC() HAL_adc_result
138158
#define HAL_ADC_READY() true
139159

140-
void HAL_adc_start_conversion(const uint8_t adc_pin);
160+
void HAL_adc_start_conversion(const uint8_t ch);
141161
uint16_t HAL_adc_get_result();
142162

143163
//

Marlin/src/HAL/HAL_DUE/HAL_SPI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
}
241241

242242
// all the others
243-
static uint32_t spiDelayCyclesX4 = (F_CPU) / 1000000; // 4uS => 125khz
243+
static uint32_t spiDelayCyclesX4 = (F_CPU) / 1000000; // 4µs => 125khz
244244

245245
static uint8_t spiTransferX(uint8_t b) { // using Mode 0
246246
int bits = 8;

Marlin/src/HAL/HAL_DUE/MarlinSerial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#include "MarlinSerial.h"
3333
#include "InterruptVectors.h"
34-
#include "../../Marlin.h"
34+
#include "../../MarlinCore.h"
3535

3636
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_r MarlinSerial<Cfg>::rx_buffer = { 0, 0, { 0 } };
3737
template<typename Cfg> typename MarlinSerial<Cfg>::ring_buffer_t MarlinSerial<Cfg>::tx_buffer = { 0 };

Marlin/src/HAL/HAL_DUE/dogm/u8g_com_HAL_DUE_shared_hw_spi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
#include <U8glib.h>
6565

66-
#include "../../../Marlin.h"
66+
#include "../../../MarlinCore.h"
6767

6868
void spiBegin();
6969
void spiInit(uint8_t spiRate);

Marlin/src/HAL/HAL_DUE/endstop_interrupts.h

+6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ void setup_endstop_interrupts() {
7777
#if HAS_Z3_MIN
7878
_ATTACH(Z3_MIN_PIN);
7979
#endif
80+
#if HAS_Z4_MAX
81+
_ATTACH(Z4_MAX_PIN);
82+
#endif
83+
#if HAS_Z4_MIN
84+
_ATTACH(Z4_MIN_PIN);
85+
#endif
8086
#if HAS_Z_MIN_PROBE_PIN
8187
_ATTACH(Z_MIN_PROBE_PIN);
8288
#endif

Marlin/src/HAL/HAL_DUE/inc/SanityCheck.h

+4
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@
5555
#if ENABLED(FAST_PWM_FAN)
5656
#error "FAST_PWM_FAN is not yet implemented for this platform."
5757
#endif
58+
59+
#if TMC_HAS_SW_SERIAL
60+
#error "TMC220x Software Serial is not supported on this platform."
61+
#endif

Marlin/src/HAL/HAL_DUE/usb/uotghs_device_due.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ static void udd_ctrl_in_sent(void)
14791479
// The IN data don't must be written in endpoint 0 DPRAM during
14801480
// a next setup reception in same endpoint 0 DPRAM.
14811481
// Thereby, an OUT ZLP reception must check before IN data write
1482-
// and if no OUT ZLP is recevied the data must be written quickly (800us)
1482+
// and if no OUT ZLP is received the data must be written quickly (800µs)
14831483
// before an eventually ZLP OUT and SETUP reception
14841484
flags = cpu_irq_save();
14851485
if (Is_udd_out_received(0)) {

Marlin/src/HAL/HAL_DUE/watchdog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#ifdef ARDUINO_ARCH_SAM
2424

2525
#include "../../inc/MarlinConfig.h"
26-
#include "../../Marlin.h"
26+
#include "../../MarlinCore.h"
2727
#include "watchdog.h"
2828

2929
// Override Arduino runtime to either config or disable the watchdog

0 commit comments

Comments
 (0)