Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into ender3v2_bu…
Browse files Browse the repository at this point in the history
…gfix

* upstream/bugfix-2.0.x: (90 commits)
  Sanity check MIXING_EXTRUDER + DISTINCT_E_FACTORS (MarlinFirmware#21689)
  Drop Deviot workaround
  Use temperature accessors
  Backlash Compensation for COREnn (MarlinFirmware#21612)
  Soft Reset via Serial or post-kill button click (MarlinFirmware#21652)
  Avoid + 0.0f in menu items (MarlinFirmware#21642)
  Fix Bed Tramming 5th point (MarlinFirmware#21646)
  Move last bootscreen delay to end of setup (MarlinFirmware#21665)
  Clean up / improve generate_version script (MarlinFirmware#21674)
  ExtUI::onPostprocessSettings (MarlinFirmware#21683)
  Prevent extrusion on M600 un-park (MarlinFirmware#21670)
  MCP4451 Digipot Support for Azteeg X5 GT (MarlinFirmware#21680)
  Fix MP_SCARA compile (MarlinFirmware#21686)
  Don't display service prompt unless needed (MarlinFirmware#21654)
  Fix Celsius precision, current temp accessors (MarlinFirmware#21678)
  Add whole-degree accessors, simplify some temperature-related features (MarlinFirmware#21685)
  [cron] Bump distribution date (2021-04-24)
  Let compiler do Temperature inlining
  Clean up formatting, wrap macros
  Update temperature types
  ...
  • Loading branch information
Michael authored and Michael committed Apr 24, 2021
2 parents a1c6cb0 + 3b8f83a commit 9b89771
Show file tree
Hide file tree
Showing 217 changed files with 5,283 additions and 2,453 deletions.
23 changes: 0 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,29 +122,6 @@ tags
.gcc-flags.json
/lib/

# Workaround for Deviot+platformio quirks
Marlin/lib
Marlin/platformio.ini
Marlin/*/platformio.ini
Marlin/*/*/platformio.ini
Marlin/*/*/*/platformio.ini
Marlin/*/*/*/*/platformio.ini
Marlin/.travis.yml
Marlin/*/.travis.yml
Marlin/*/*/.travis.yml
Marlin/*/*/*/.travis.yml
Marlin/*/*/*/*/.travis.yml
Marlin/.gitignore
Marlin/*/.gitignore
Marlin/*/*/.gitignore
Marlin/*/*/*/.gitignore
Marlin/*/*/*/*/.gitignore
Marlin/readme.txt
Marlin/*/readme.txt
Marlin/*/*/readme.txt
Marlin/*/*/*/readme.txt
Marlin/*/*/*/*/readme.txt

# Secure Credentials
Configuration_Secure.h

Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/HAL/AVR/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ void HAL_init() {
#endif
}

void HAL_reboot() {
#if ENABLED(USE_WATCHDOG)
while (1) { /* run out the watchdog */ }
#else
void (*resetFunc)() = 0; // Declare resetFunc() at address 0
resetFunc(); // Jump to address 0
#endif
}

#if ENABLED(SDSUPPORT)

#include "../../sd/SdFatUtil.h"
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/HAL/AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,28 @@ typedef int8_t pin_t;
#define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
#else
#if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#define MYSERIAL1 customizedSerial1

#ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3)
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#define MYSERIAL2 customizedSerial2
#endif
#endif

#ifdef MMU2_SERIAL_PORT
#if !WITHIN(MMU2_SERIAL_PORT, -1, 3)
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#define MMU2_SERIAL mmuSerial
#endif

#ifdef LCD_SERIAL_PORT
#if !WITHIN(LCD_SERIAL_PORT, -1, 3)
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD
Expand All @@ -135,7 +135,7 @@ void HAL_init();
inline void HAL_clear_reset_source() { MCUSR = 0; }
inline uint8_t HAL_get_reset_source() { return MCUSR; }

inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot();

#if GCC_VERSION <= 50000
#pragma GCC diagnostic push
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/HAL/DUE/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ uint8_t HAL_get_reset_source() {
}
}

void HAL_reboot() { rstc_start_software_reset(RSTC); }

void _delay_ms(const int delay_ms) {
// Todo: port for Due?
delay(delay_ms);
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/HAL/DUE/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "The required SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif

#ifdef SERIAL_PORT_2
Expand All @@ -65,15 +65,15 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

#ifdef MMU2_SERIAL_PORT
#if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else
#error "MMU2_SERIAL_PORT must be from 0 to 3. Please update your configuration."
#error "MMU2_SERIAL_PORT must be from 0 to 3."
#endif
#endif

Expand All @@ -83,7 +83,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

Expand Down Expand Up @@ -113,7 +113,7 @@ void sei(); // Enable interrupts
void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason

inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot();

//
// ADC
Expand Down
18 changes: 9 additions & 9 deletions Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready() {
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
*nb_sector = card.getSd2Card().cardSize() - 1;
*nb_sector = card.diskIODriver()->cardSize() - 1;
return CTRL_GOOD;
}

Expand Down Expand Up @@ -74,24 +74,24 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#endif

// Start reading
if (!card.getSd2Card().readStart(addr))
if (!card.diskIODriver()->readStart(addr))
return CTRL_FAIL;

// For each specified sector
while (nb_sector--) {

// Read a sector
card.getSd2Card().readData(sector_buf);
card.diskIODriver()->readData(sector_buf);

// RAM -> USB
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.getSd2Card().readStop();
card.diskIODriver()->readStop();
return CTRL_FAIL;
}
}

// Stop reading
card.getSd2Card().readStop();
card.diskIODriver()->readStop();

// Done
return CTRL_GOOD;
Expand All @@ -113,24 +113,24 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
}
#endif

if (!card.getSd2Card().writeStart(addr, nb_sector))
if (!card.diskIODriver()->writeStart(addr, nb_sector))
return CTRL_FAIL;

// For each specified sector
while (nb_sector--) {

// USB -> RAM
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.getSd2Card().writeStop();
card.diskIODriver()->writeStop();
return CTRL_FAIL;
}

// Write a sector
card.getSd2Card().writeData(sector_buf);
card.diskIODriver()->writeData(sector_buf);
}

// Stop writing
card.getSd2Card().writeStop();
card.diskIODriver()->writeStop();

// Done
return CTRL_GOOD;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/usb/usb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void usb_task_init(void) {
char *sptr;

// Patch in the filament diameter
sprintf_P(diam, PSTR("%d"), (int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000.0));
itoa((int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000), diam, 10);

// And copy it to the proper place, expanding it to unicode
sptr = &diam[0];
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/HAL/ESP32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ void HAL_clear_reset_source() { }

uint8_t HAL_get_reset_source() { return rtc_get_reset_reason(1); }

void HAL_reboot() { ESP.restart(); }

void _delay_ms(int delay_ms) { delay(delay_ms); }

// return free memory between end of heap (or end bss) and whatever is current
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/ESP32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void HAL_clear_reset_source();
// reset reason
uint8_t HAL_get_reset_source();

inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot();

void _delay_ms(int delay);

Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/HAL/LINUX/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,6 @@ void HAL_pwm_init() {

}

void HAL_reboot() { /* Reset the application state and GPIO */ }

#endif // __PLAT_LINUX__
2 changes: 1 addition & 1 deletion Marlin/src/HAL/LINUX/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ uint16_t HAL_adc_get_result();
inline void HAL_clear_reset_source(void) {}
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }

inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot(); // Reset the application state and GPIO

/* ---------------- Delay in cycles */
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/HAL/LPC1768/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void flashFirmware(const int16_t) {
delay(500); // Give OS time to disconnect
USB_Connect(false); // USB clear connection
delay(1000); // Give OS time to notice
NVIC_SystemReset();
HAL_reboot();
}

void HAL_clear_reset_source(void) {
Expand All @@ -81,4 +81,6 @@ uint8_t HAL_get_reset_source(void) {
return RST_POWER_ON;
}

void HAL_reboot() { NVIC_SystemReset(); }

#endif // TARGET_LPC1768
10 changes: 5 additions & 5 deletions Marlin/src/HAL/LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif

#ifdef SERIAL_PORT_2
Expand All @@ -80,7 +80,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

Expand All @@ -90,7 +90,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

Expand All @@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() MSerial0.available()
Expand Down Expand Up @@ -218,4 +218,4 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255,
void HAL_clear_reset_source(void);
uint8_t HAL_get_reset_source(void);

inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot();
2 changes: 2 additions & 0 deletions Marlin/src/HAL/SAMD51/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ uint8_t HAL_get_reset_source() {
}
#pragma pop_macro("WDT")

void HAL_reboot() { NVIC_SystemReset(); }

extern "C" {
void * _sbrk(int incr);

Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/HAL/SAMD51/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif

#ifdef SERIAL_PORT_2
Expand All @@ -63,7 +63,7 @@
#elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

Expand All @@ -73,7 +73,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else
#error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

Expand All @@ -83,7 +83,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else
#error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

Expand All @@ -109,7 +109,7 @@ typedef int8_t pin_t;
void HAL_clear_reset_source(); // clear reset reason
uint8_t HAL_get_reset_source(); // get reset reason

inline void HAL_reboot() {} // reboot the board or restart the bootloader
void HAL_reboot();

//
// ADC
Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ uint8_t HAL_get_reset_source() {
;
}

void HAL_reboot() { NVIC_SystemReset(); }

void _delay_ms(const int delay_ms) { delay(delay_ms); }

extern "C" {
Expand All @@ -147,8 +149,8 @@ extern "C" {
void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
uint16_t HAL_adc_get_result() { return HAL_adc_result; }

// Reset the system (to initiate a firmware flash)
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
// Reset the system to initiate a firmware flash
void flashFirmware(const int16_t) { HAL_reboot(); }

// Maple Compatibility
volatile uint32_t systick_uptime_millis = 0;
Expand Down
Loading

0 comments on commit 9b89771

Please sign in to comment.