Skip to content

Commit 7c9f467

Browse files
committed
Refactor default member initialization for those that are required - m_invert was lacking before.
1 parent c0dc6d6 commit 7c9f467

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/SoftwareSerial.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,10 @@ __attribute__((always_inline)) inline void IRAM_ATTR UARTBase::restoreInterrupts
5252
constexpr uint8_t BYTE_ALL_BITS_SET = ~static_cast<uint8_t>(0);
5353

5454
UARTBase::UARTBase() {
55-
m_isrOverflow = false;
56-
m_rxGPIOHasPullUp = false;
57-
m_rxGPIOPullUpEnabled = true;
58-
m_txGPIOOpenDrain = false;
5955
}
6056

6157
UARTBase::UARTBase(int8_t rxPin, int8_t txPin, bool invert)
6258
{
63-
m_isrOverflow = false;
64-
m_rxGPIOHasPullUp = false;
65-
m_rxGPIOPullUpEnabled = true;
66-
m_txGPIOOpenDrain = false;
6759
m_rxPin = rxPin;
6860
m_txPin = txPin;
6961
m_invert = invert;

src/SoftwareSerial.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ class UARTBase : public Stream {
342342
/// PDU bits include data, parity and stop bits; the start bit is not counted.
343343
uint8_t m_pduBits;
344344
bool m_intTxEnabled;
345-
bool m_rxGPIOHasPullUp;
346-
bool m_rxGPIOPullUpEnabled;
347-
bool m_txGPIOOpenDrain;
345+
bool m_rxGPIOHasPullUp = false;
346+
bool m_rxGPIOPullUpEnabled = true;
347+
bool m_txGPIOOpenDrain = false;
348348
Parity m_parityMode;
349349
uint8_t m_stopBits;
350350
bool m_lastReadParity;
@@ -367,7 +367,7 @@ class UARTBase : public Stream {
367367
// 1 = positive including 0, 0 = negative.
368368
std::unique_ptr<circular_queue<uint32_t, UARTBase*> > m_isrBuffer;
369369
const Delegate<void(uint32_t&&), UARTBase*> m_isrBufferForEachDel = { [](UARTBase* self, uint32_t&& isrTick) { self->rxBits(isrTick); }, this };
370-
std::atomic<bool> m_isrOverflow;
370+
std::atomic<bool> m_isrOverflow = false;
371371
uint32_t m_isrLastTick;
372372
bool m_rxCurParity = false;
373373
Delegate<void(), void*> m_rxHandler;

0 commit comments

Comments
 (0)