Add dynamic buffer space

Add dynamic buffer space
This commit is contained in:
Theo Arends 2018-11-27 12:09:36 +01:00
parent b3f1730660
commit 3f33e3efa8

View File

@ -36,7 +36,7 @@ TasmotaSerial *SerialBridgeSerial;
uint8_t serial_bridge_active = 1;
uint8_t serial_bridge_in_byte_counter = 0;
unsigned long serial_bridge_polling_window = 0;
char serial_bridge_buffer[SERIAL_BRIDGE_BUFFER_SIZE];
char *serial_bridge_buffer = NULL;
void SerialBridgeInput(void)
{
@ -75,6 +75,8 @@ void SerialBridgeInit(void)
{
serial_bridge_active = 0;
if ((pin[GPIO_SBR_RX] < 99) && (pin[GPIO_SBR_TX] < 99)) {
serial_bridge_buffer = (char*)(malloc(SERIAL_BRIDGE_BUFFER_SIZE));
if (serial_bridge_buffer != NULL) {
SerialBridgeSerial = new TasmotaSerial(pin[GPIO_SBR_RX], pin[GPIO_SBR_TX]);
if (SerialBridgeSerial->begin(Settings.sbaudrate * 1200)) { // Baud rate is stored div 1200 so it fits into one byte
serial_bridge_active = 1;
@ -82,6 +84,7 @@ void SerialBridgeInit(void)
}
}
}
}
/*********************************************************************************************\
* Commands