Skip to content

Commit 839bf7d

Browse files
MichaelMichael
authored andcommitted
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into ender3v2_bugfix
* upstream/bugfix-2.0.x: (125 commits) Suppress redundant serial errors [cron] Bump distribution date (2021-04-04) [cron] Bump distribution date (2021-04-03) Update u8g / AVR display timing defaults (MarlinFirmware#21518) GT2560 V3 followup (MarlinFirmware#21512) Remove extraneous 'extern' hints (MarlinFirmware#21516) Requiring PIO >= 5.0.3 Split up platformio.ini (MarlinFirmware#21507) [cron] Bump distribution date (2021-04-02) Followup to Laser Flow Meter (MarlinFirmware#21498) MKS H43 fix, cleanup (MarlinFirmware#21500) G26 Hilbert Curve followup (MarlinFirmware#21480) Board IDs for G2560 Rev B, G2560 v4, GTM32 VD (MarlinFirmware#21499) Replace 'const float &' with 'const_float_t' (MarlinFirmware#21505) [cron] Bump distribution date (2021-04-01) MKS H43 fix, cleanup (MarlinFirmware#21485) Update UBL param Move apply_rotation_xyz into matrix_3x3 Put ABL state into a class FTDI Touch UI fix and reorganize (MarlinFirmware#21487) ... # Conflicts: # Marlin/Configuration.h
2 parents f0c8c35 + 895e401 commit 839bf7d

File tree

498 files changed

+10326
-6847
lines changed

Some content is hidden

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

498 files changed

+10326
-6847
lines changed

.github/workflows/test-builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
# Non-working environment tests
9999
#- at90usb1286_cdc
100100
#- STM32F103CB_malyan
101+
#- STM32F103RE
101102
#- mks_robin_mini
102103

103104
steps:

Marlin/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1111)
219219
else ifeq ($(HARDWARE_MOTHERBOARD),1112)
220220
# MKS GEN L
221221
else ifeq ($(HARDWARE_MOTHERBOARD),1113)
222-
# zrib V2.0 control board (Chinese knock off RAMPS replica)
222+
# zrib V2.0 control board (Chinese RAMPS replica)
223223
else ifeq ($(HARDWARE_MOTHERBOARD),1114)
224224
# BigTreeTech or BIQU KFB2.0
225225
else ifeq ($(HARDWARE_MOTHERBOARD),1115)

Marlin/src/HAL/AVR/HAL_SPI.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void spiBegin() {
8888
}
8989

9090
/** SPI read data */
91-
void spiRead(uint8_t* buf, uint16_t nbyte) {
91+
void spiRead(uint8_t *buf, uint16_t nbyte) {
9292
if (nbyte-- == 0) return;
9393
SPDR = 0xFF;
9494
for (uint16_t i = 0; i < nbyte; i++) {
@@ -107,7 +107,7 @@ void spiBegin() {
107107
}
108108

109109
/** SPI send block */
110-
void spiSendBlock(uint8_t token, const uint8_t* buf) {
110+
void spiSendBlock(uint8_t token, const uint8_t *buf) {
111111
SPDR = token;
112112
for (uint16_t i = 0; i < 512; i += 2) {
113113
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
@@ -215,7 +215,7 @@ void spiBegin() {
215215
}
216216

217217
// Soft SPI read data
218-
void spiRead(uint8_t* buf, uint16_t nbyte) {
218+
void spiRead(uint8_t *buf, uint16_t nbyte) {
219219
for (uint16_t i = 0; i < nbyte; i++)
220220
buf[i] = spiRec();
221221
}
@@ -242,7 +242,7 @@ void spiBegin() {
242242
}
243243

244244
// Soft SPI send block
245-
void spiSendBlock(uint8_t token, const uint8_t* buf) {
245+
void spiSendBlock(uint8_t token, const uint8_t *buf) {
246246
spiSend(token);
247247
for (uint16_t i = 0; i < 512; i++)
248248
spiSend(buf[i]);

Marlin/src/HAL/AVR/MarlinSerial.h

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,13 @@
252252
template <uint8_t serial>
253253
struct MMU2SerialCfg {
254254
static constexpr int PORT = serial;
255+
static constexpr unsigned int RX_SIZE = 32;
256+
static constexpr unsigned int TX_SIZE = 32;
255257
static constexpr bool XONOFF = false;
256258
static constexpr bool EMERGENCYPARSER = false;
257259
static constexpr bool DROPPED_RX = false;
258260
static constexpr bool RX_FRAMING_ERRORS = false;
259261
static constexpr bool MAX_RX_QUEUED = false;
260-
static constexpr unsigned int RX_SIZE = 32;
261-
static constexpr unsigned int TX_SIZE = 32;
262262
static constexpr bool RX_OVERRUNS = false;
263263
};
264264

@@ -270,28 +270,17 @@
270270

271271
template <uint8_t serial>
272272
struct LCDSerialCfg {
273-
static constexpr int PORT = serial;
274-
static constexpr bool XONOFF = false;
275-
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
276-
static constexpr bool DROPPED_RX = false;
277-
static constexpr bool RX_FRAMING_ERRORS = false;
278-
static constexpr bool MAX_RX_QUEUED = false;
279-
#if HAS_DGUS_LCD
280-
static constexpr unsigned int RX_SIZE = DGUS_RX_BUFFER_SIZE;
281-
static constexpr unsigned int TX_SIZE = DGUS_TX_BUFFER_SIZE;
282-
static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
283-
#elif EITHER(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON)
284-
static constexpr unsigned int RX_SIZE = 64;
285-
static constexpr unsigned int TX_SIZE = 128;
286-
static constexpr bool RX_OVERRUNS = false;
287-
#else
288-
static constexpr unsigned int RX_SIZE = 64;
289-
static constexpr unsigned int TX_SIZE = 128;
290-
static constexpr bool RX_OVERRUNS = false
291-
#endif
273+
static constexpr int PORT = serial;
274+
static constexpr unsigned int RX_SIZE = TERN(HAS_DGUS_LCD, DGUS_RX_BUFFER_SIZE, 64);
275+
static constexpr unsigned int TX_SIZE = TERN(HAS_DGUS_LCD, DGUS_TX_BUFFER_SIZE, 128);
276+
static constexpr bool XONOFF = false;
277+
static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
278+
static constexpr bool DROPPED_RX = false;
279+
static constexpr bool RX_FRAMING_ERRORS = false;
280+
static constexpr bool MAX_RX_QUEUED = false;
281+
static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
292282
};
293283

294-
295284
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
296285
extern MSerialT4 lcdSerial;
297286
#endif

Marlin/src/HAL/AVR/eeprom.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ bool PersistentStore::access_start() { return true; }
4040
bool PersistentStore::access_finish() { return true; }
4141

4242
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
43+
uint16_t written = 0;
4344
while (size--) {
4445
uint8_t * const p = (uint8_t * const)pos;
4546
uint8_t v = *value;
46-
// EEPROM has only ~100,000 write cycles,
47-
// so only write bytes that have changed!
48-
if (v != eeprom_read_byte(p)) {
47+
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
4948
eeprom_write_byte(p, v);
49+
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
5050
if (eeprom_read_byte(p) != v) {
5151
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
5252
return true;

Marlin/src/HAL/AVR/fastio.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ uint8_t extDigitalRead(const int8_t pin) {
241241
*
242242
* DC values -1.0 to 1.0. Negative duty cycle inverts the pulse.
243243
*/
244-
uint16_t set_pwm_frequency_hz(const float &hz, const float dca, const float dcb, const float dcc) {
244+
uint16_t set_pwm_frequency_hz(const_float_t hz, const float dca, const float dcb, const float dcc) {
245245
float count = 0;
246246
if (hz > 0 && (dca || dcb || dcc)) {
247247
count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq.

Marlin/src/HAL/DUE/HAL.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ uint16_t HAL_adc_get_result() {
106106
}
107107

108108
// Forward the default serial ports
109-
#if ANY_SERIAL_IS(0)
109+
#if USING_HW_SERIAL0
110110
DefaultSerial1 MSerial0(false, Serial);
111111
#endif
112-
#if ANY_SERIAL_IS(1)
112+
#if USING_HW_SERIAL1
113113
DefaultSerial2 MSerial1(false, Serial1);
114114
#endif
115-
#if ANY_SERIAL_IS(2)
115+
#if USING_HW_SERIAL2
116116
DefaultSerial3 MSerial2(false, Serial2);
117117
#endif
118-
#if ANY_SERIAL_IS(3)
118+
#if USING_HW_SERIAL3
119119
DefaultSerial4 MSerial3(false, Serial3);
120120
#endif
121121

Marlin/src/HAL/DUE/HAL_SPI.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
#pragma GCC optimize (3)
5757

5858
typedef uint8_t (*pfnSpiTransfer)(uint8_t b);
59-
typedef void (*pfnSpiRxBlock)(uint8_t* buf, uint32_t nbyte);
60-
typedef void (*pfnSpiTxBlock)(const uint8_t* buf, uint32_t nbyte);
59+
typedef void (*pfnSpiRxBlock)(uint8_t *buf, uint32_t nbyte);
60+
typedef void (*pfnSpiTxBlock)(const uint8_t *buf, uint32_t nbyte);
6161

6262
/* ---------------- Macros to be able to access definitions from asm */
6363
#define _PORT(IO) DIO ## IO ## _WPORT
@@ -270,7 +270,7 @@
270270
static pfnSpiTransfer spiTransferTx = (pfnSpiTransfer)spiTransferX;
271271

272272
// Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded)
273-
static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) {
273+
static void spiTxBlock0(const uint8_t *ptr, uint32_t todo) {
274274
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */
275275
uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN);
276276
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
@@ -349,7 +349,7 @@
349349
);
350350
}
351351

352-
static void spiRxBlock0(uint8_t* ptr, uint32_t todo) {
352+
static void spiRxBlock0(uint8_t *ptr, uint32_t todo) {
353353
uint32_t bin = 0;
354354
uint32_t work = 0;
355355
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 */
@@ -425,13 +425,13 @@
425425
);
426426
}
427427

428-
static void spiTxBlockX(const uint8_t* buf, uint32_t todo) {
428+
static void spiTxBlockX(const uint8_t *buf, uint32_t todo) {
429429
do {
430430
(void)spiTransferTx(*buf++);
431431
} while (--todo);
432432
}
433433

434-
static void spiRxBlockX(uint8_t* buf, uint32_t todo) {
434+
static void spiRxBlockX(uint8_t *buf, uint32_t todo) {
435435
do {
436436
*buf++ = spiTransferRx(0xFF);
437437
} while (--todo);
@@ -463,7 +463,7 @@
463463
return b;
464464
}
465465

466-
void spiRead(uint8_t* buf, uint16_t nbyte) {
466+
void spiRead(uint8_t *buf, uint16_t nbyte) {
467467
if (nbyte) {
468468
_SS_WRITE(LOW);
469469
WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1
@@ -478,7 +478,7 @@
478478
_SS_WRITE(HIGH);
479479
}
480480

481-
void spiSendBlock(uint8_t token, const uint8_t* buf) {
481+
void spiSendBlock(uint8_t token, const uint8_t *buf) {
482482
_SS_WRITE(LOW);
483483
(void)spiTransferTx(token);
484484
spiTxBlock(buf, 512);
@@ -645,7 +645,7 @@
645645
}
646646

647647
// Read from SPI into buffer
648-
void spiRead(uint8_t* buf, uint16_t nbyte) {
648+
void spiRead(uint8_t *buf, uint16_t nbyte) {
649649
if (!nbyte) return;
650650
--nbyte;
651651
for (int i = 0; i < nbyte; i++) {
@@ -668,7 +668,7 @@
668668
//DELAY_US(1U);
669669
}
670670

671-
void spiSend(const uint8_t* buf, size_t nbyte) {
671+
void spiSend(const uint8_t *buf, size_t nbyte) {
672672
if (!nbyte) return;
673673
--nbyte;
674674
for (size_t i = 0; i < nbyte; i++) {
@@ -689,7 +689,7 @@
689689
FLUSH_RX();
690690
}
691691

692-
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {
692+
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) {
693693
if (!nbyte) return;
694694
--nbyte;
695695
for (size_t i = 0; i < nbyte; i++) {
@@ -702,7 +702,7 @@
702702
}
703703

704704
// Write from buffer to SPI
705-
void spiSendBlock(uint8_t token, const uint8_t* buf) {
705+
void spiSendBlock(uint8_t token, const uint8_t *buf) {
706706
SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN);
707707
WHILE_TX(0);
708708
//WHILE_RX(0);
@@ -801,19 +801,19 @@
801801

802802
uint8_t spiRec() { return (uint8_t)spiTransfer(0xFF); }
803803

804-
void spiRead(uint8_t* buf, uint16_t nbyte) {
804+
void spiRead(uint8_t *buf, uint16_t nbyte) {
805805
for (int i = 0; i < nbyte; i++)
806806
buf[i] = spiTransfer(0xFF);
807807
}
808808

809809
void spiSend(uint8_t data) { spiTransfer(data); }
810810

811-
void spiSend(const uint8_t* buf, size_t nbyte) {
811+
void spiSend(const uint8_t *buf, size_t nbyte) {
812812
for (uint16_t i = 0; i < nbyte; i++)
813813
spiTransfer(buf[i]);
814814
}
815815

816-
void spiSendBlock(uint8_t token, const uint8_t* buf) {
816+
void spiSendBlock(uint8_t token, const uint8_t *buf) {
817817
spiTransfer(token);
818818
for (uint16_t i = 0; i < 512; i++)
819819
spiTransfer(buf[i]);

Marlin/src/HAL/DUE/MarlinSerial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ void MarlinSerial<Cfg>::flushTX() {
476476

477477

478478
// If not using the USB port as serial port
479-
#if SERIAL_PORT >= 0
479+
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
480480
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
481481
MSerialT customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
482482
#endif

Marlin/src/HAL/DUE/MarlinSerial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct MarlinSerialCfg {
140140
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
141141
};
142142

143-
#if SERIAL_PORT >= 0
143+
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
144144
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
145145
extern MSerialT customizedSerial1;
146146
#endif

0 commit comments

Comments
 (0)