Skip to content

Commit

Permalink
Drop return value from Serial::write() (MarlinFirmware#21567)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiropolla committed Apr 9, 2021
1 parent 1a2cbe1 commit 8048d14
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Marlin/src/HAL/AVR/MarlinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ void MarlinSerial<Cfg>::flush() {
}

template<typename Cfg>
size_t MarlinSerial<Cfg>::write(const uint8_t c) {
void MarlinSerial<Cfg>::write(const uint8_t c) {
if (Cfg::TX_SIZE == 0) {

_written = true;
Expand All @@ -480,7 +480,7 @@ size_t MarlinSerial<Cfg>::write(const uint8_t c) {
// location". This makes sure flush() won't return until the bytes
// actually got written
B_TXC = 1;
return 1;
return;
}

const uint8_t i = (tx_buffer.head + 1) & (Cfg::TX_SIZE - 1);
Expand Down Expand Up @@ -510,7 +510,6 @@ size_t MarlinSerial<Cfg>::write(const uint8_t c) {
// Enable TX ISR - Non atomic, but it will eventually enable TX ISR
B_UDRIE = 1;
}
return 1;
}

template<typename Cfg>
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/AVR/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
static int read();
static void flush();
static ring_buffer_pos_t available();
static size_t write(const uint8_t c);
static void write(const uint8_t c);
static void flushTX();
#if HAS_DGUS_LCD
static ring_buffer_pos_t get_tx_buffer_free();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/serial_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct SerialBase {

// Static dispatch methods below:
// The most important method here is where it all ends to:
size_t write(uint8_t c) { return SerialChild->write(c); }
void write(uint8_t c) { SerialChild->write(c); }

// Called when the parser finished processing an instruction, usually build to nothing
void msgDone() const { SerialChild->msgDone(); }
Expand Down

0 comments on commit 8048d14

Please sign in to comment.