Restrict hardware serial

Restrict hardware serial
This commit is contained in:
Theo Arends 2018-11-07 15:37:06 +01:00
parent c75ae78d88
commit 4a21d3270d
3 changed files with 4 additions and 4 deletions

View File

@ -76,7 +76,7 @@ static void (*ISRList[16])() = {
tms_isr_15
};
TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, bool hardware_fallback)
TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fallback)
{
m_valid = false;
m_hardserial = 0;
@ -91,7 +91,7 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, bool hardware_fa
if (hardware_fallback && (((3 == m_rx_pin) && (1 == m_tx_pin)) || ((3 == m_rx_pin) && (-1 == m_tx_pin)) || ((-1 == m_rx_pin) && (1 == m_tx_pin)))) {
m_hardserial = 1;
}
else if (hardware_fallback && (((13 == m_rx_pin) && (15 == m_tx_pin)) || ((13 == m_rx_pin) && (-1 == m_tx_pin)) || ((-1 == m_rx_pin) && (15 == m_tx_pin)))) {
else if ((2 == hardware_fallback) && (((13 == m_rx_pin) && (15 == m_tx_pin)) || ((13 == m_rx_pin) && (-1 == m_tx_pin)) || ((-1 == m_rx_pin) && (15 == m_tx_pin)))) {
m_hardserial = 1;
m_hardswap = 1;
}

View File

@ -38,7 +38,7 @@
class TasmotaSerial : public Stream {
public:
TasmotaSerial(int receive_pin, int transmit_pin, bool hardware_fallback = false);
TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fallback = 0);
virtual ~TasmotaSerial();
bool begin(long speed, int stop_bits = 1);

View File

@ -284,7 +284,7 @@ void TuyaInit()
if (!Settings.param[P_TUYA_DIMMER_ID]) {
Settings.param[P_TUYA_DIMMER_ID] = TUYA_DIMMER_ID;
}
TuyaSerial = new TasmotaSerial(pin[GPIO_TUYA_RX], pin[GPIO_TUYA_TX], 1);
TuyaSerial = new TasmotaSerial(pin[GPIO_TUYA_RX], pin[GPIO_TUYA_TX], 2);
if (TuyaSerial->begin(9600)) {
if (TuyaSerial->hardwareSerial()) { ClaimSerial(); }
// Get MCU Configuration