diff --git a/UARTReplacement/SerialPort.cs b/UARTReplacement/SerialPort.cs index 07126d8..69a4e3b 100644 --- a/UARTReplacement/SerialPort.cs +++ b/UARTReplacement/SerialPort.cs @@ -193,6 +193,7 @@ public int Baud public void Reset(byte ResetByte) { + if (port is null) return; // bit 7 = Indicates the reset signal to the expansion bus and esp is asserted bool resetESP = (ResetByte & 128) == 128; if (resetESP) @@ -216,7 +217,7 @@ public void EnableEspGpio(byte EnableByte) public void SetEspGpio(byte GpioByte) { - if (enableEspGpio) + if (enableEspGpio || port is null) return; // bit 0 = Read / Write ESP GPIO0 (hard reset = 1)