mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-01 06:57:43 +00:00
Add dynamic buffer space
Add dynamic buffer space
This commit is contained in:
parent
b3f1730660
commit
3f33e3efa8
@ -36,7 +36,7 @@ TasmotaSerial *SerialBridgeSerial;
|
|||||||
uint8_t serial_bridge_active = 1;
|
uint8_t serial_bridge_active = 1;
|
||||||
uint8_t serial_bridge_in_byte_counter = 0;
|
uint8_t serial_bridge_in_byte_counter = 0;
|
||||||
unsigned long serial_bridge_polling_window = 0;
|
unsigned long serial_bridge_polling_window = 0;
|
||||||
char serial_bridge_buffer[SERIAL_BRIDGE_BUFFER_SIZE];
|
char *serial_bridge_buffer = NULL;
|
||||||
|
|
||||||
void SerialBridgeInput(void)
|
void SerialBridgeInput(void)
|
||||||
{
|
{
|
||||||
@ -75,12 +75,15 @@ void SerialBridgeInit(void)
|
|||||||
{
|
{
|
||||||
serial_bridge_active = 0;
|
serial_bridge_active = 0;
|
||||||
if ((pin[GPIO_SBR_RX] < 99) && (pin[GPIO_SBR_TX] < 99)) {
|
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]);
|
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
|
if (SerialBridgeSerial->begin(Settings.sbaudrate * 1200)) { // Baud rate is stored div 1200 so it fits into one byte
|
||||||
serial_bridge_active = 1;
|
serial_bridge_active = 1;
|
||||||
SerialBridgeSerial->flush();
|
SerialBridgeSerial->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user