Skip to content

Commit

Permalink
Merge branch 'MarlinFirmware:bugfix-2.1.x' into bugfix-2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpond authored Aug 30, 2024
2 parents 0836ddf + 68a2459 commit 3db3076
Show file tree
Hide file tree
Showing 49 changed files with 1,774 additions and 5,359 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

/**
* Select a third serial port on the board to use for communication with the host.
* Currently only supported for AVR, DUE, LPC1768/9 and STM32/STM32F1
* Currently supported for AVR, DUE, SAMD51, LPC1768/9, STM32/STM32F1/HC32, and Teensy 4.x
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
*/
//#define SERIAL_PORT_3 1
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2024-08-25"
//#define STRING_DISTRIBUTION_DATE "2024-08-30"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HC32/sysclock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void core_hook_sysclock_init() {
#endif

// sysclk is now configured according to F_CPU (i.e., 200MHz PLL output)
constexpr uint32_t sysclock = F_CPU;
const uint32_t sysclock = F_CPU;

// Setup clock divisors for sysclk = 200 MHz
// Note: PCLK1 is used for step+temp timers, and need to be kept at 50 MHz (until there is a better solution)
Expand Down
10 changes: 10 additions & 0 deletions Marlin/src/HAL/SAMD51/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
#endif
#endif

#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 MSerial0
#elif WITHIN(SERIAL_PORT_3, 0, 3)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#endif

#ifdef MMU2_SERIAL_PORT
#if MMU2_SERIAL_PORT == -1
#define MMU2_SERIAL MSerial0
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/leds/pca9632.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void PCA9632_set_led_color(const LEDColor &color) {

#if ENABLED(PCA9632_BUZZER)

void PCA9632_buzz(const long, const uint16_t=0) {
void PCA9632_buzz(const long, const uint16_t/*=0*/) {
uint8_t data[] = PCA9632_BUZZER_DATA;
Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
Wire.write(data, sizeof(data));
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/gcode/control/M80_M81.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
#include "../../feature/power.h"
#endif

#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/powerloss.h"
#endif

#if HAS_SUICIDE
#include "../../MarlinCore.h"
#endif
Expand Down Expand Up @@ -84,6 +88,8 @@ void GcodeSuite::M81() {
ZERO(thermalManager.saved_fan_speed);
#endif

TERN_(POWER_LOSS_RECOVERY, recovery.purge()); // Clear PLR on intentional shutdown

safe_delay(1000); // Wait 1 second before switching off

LCD_MESSAGE_F(MACHINE_NAME " " STR_OFF ".");
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void GCodeQueue::RingBuffer::commit_command(const bool skip_ok
commands[index_w].skip_ok = skip_ok;
TERN_(HAS_MULTI_SERIAL, commands[index_w].port = serial_ind);
TERN_(POWER_LOSS_RECOVERY, recovery.commit_sdpos(index_w));
advance_pos(index_w, 1);
advance_w();
}

/**
Expand Down Expand Up @@ -702,7 +702,7 @@ void GCodeQueue::advance() {
#endif // HAS_MEDIA

// The queue may be reset by a command handler or by code invoked by idle() within a handler
ring_buffer.advance_pos(ring_buffer.index_r, -1);
ring_buffer.advance_r();
}

#if ENABLED(BUFFER_MONITORING)
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/gcode/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class GCodeQueue {
inline void clear() { length = index_r = index_w = 0; }

void advance_pos(uint8_t &p, const int inc) { if (++p >= BUFSIZE) p = 0; length += inc; }
inline void advance_w() { advance_pos(index_w, 1); }
inline void advance_r() { if (length) advance_pos(index_r, -1); }

void commit_command(const bool skip_ok
OPTARG(HAS_MULTI_SERIAL, serial_index_t serial_ind=serial_index_t())
Expand Down
Loading

0 comments on commit 3db3076

Please sign in to comment.