buffersize updates

This commit is contained in:
Nick Leeman 2021-05-05 23:00:55 +02:00
parent 929f4042e0
commit 96186e98be
3 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "SimpleSerialProtocol", "name": "SimpleSerialProtocol",
"version": "1.8.0", "version": "1.9.0",
"description": "Easy-to-use serial protocol system for arduino type devices.", "description": "Easy-to-use serial protocol system for arduino type devices.",
"keywords": "Serial, Connectivity, USB, Simple", "keywords": "Serial, Connectivity, USB, Simple",
"repository": "repository":

View File

@ -23,8 +23,9 @@
class SerialConnection class SerialConnection
{ {
private: private:
int serialBufferSize = 265; int serialTransmitBufferSize = 960;
char serialBuffer[265]; int serialBufferSize = 1024;
char serialBuffer[1024];
// Receiving a new packet // Receiving a new packet
boolean newSerialData = false; boolean newSerialData = false;
@ -46,7 +47,7 @@ class SerialConnection
void init(HardwareSerial &serialHandle, unsigned long serialBaud); void init(HardwareSerial &serialHandle, unsigned long serialBaud);
void send(char* data); void send(char* data);
char* handle(); char* handle();
int getBufferSize(); int getTransmitBufferSize();
}; };
@ -94,6 +95,6 @@ void SerialConnection::send(char* data) {
serialRefrence->println(data); serialRefrence->println(data);
}; };
int SerialConnection::getBufferSize() { int SerialConnection::getTransmitBufferSize() {
return (int)serialBufferSize; return (int)serialTransmitBufferSize;
}; };

View File

@ -85,7 +85,7 @@ bool SimpleSerialProtocol::receivePackets(void (*callback)(Packet)) {
bool SimpleSerialProtocol::sendPacket(char* id, char* type, char* data) { bool SimpleSerialProtocol::sendPacket(char* id, char* type, char* data) {
// Create new packet buffer // Create new packet buffer
char serialPacketBuffer[serialConnection.getBufferSize()]; char serialPacketBuffer[serialConnection.getTransmitBufferSize()];
// Pack data in buffer // Pack data in buffer
sprintf(serialPacketBuffer, "%c%s%c%s%c%s%c", sprintf(serialPacketBuffer, "%c%s%c%s%c%s%c",