mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 20:35:17 +03:00
Increase output buffer (#7323)
This commit is contained in:
parent
cde54f04f4
commit
6a52627f47
2 changed files with 12 additions and 2 deletions
|
@ -456,6 +456,10 @@ static int luaSportTelemetryPush(lua_State * L)
|
||||||
lua_pushboolean(L, outputTelemetryBuffer.isAvailable());
|
lua_pushboolean(L, outputTelemetryBuffer.isAvailable());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if (lua_gettop(L) > sizeof(SportTelemetryPacket) ) {
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t dataId = luaL_checkunsigned(L, 3);
|
uint16_t dataId = luaL_checkunsigned(L, 3);
|
||||||
|
|
||||||
|
@ -653,6 +657,10 @@ static int luaCrossfireTelemetryPush(lua_State * L)
|
||||||
if (lua_gettop(L) == 0) {
|
if (lua_gettop(L) == 0) {
|
||||||
lua_pushboolean(L, outputTelemetryBuffer.isAvailable());
|
lua_pushboolean(L, outputTelemetryBuffer.isAvailable());
|
||||||
}
|
}
|
||||||
|
else if (lua_gettop(L) > TELEMETRY_OUTPUT_BUFFER_SIZE ) {
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
else if (outputTelemetryBuffer.isAvailable()) {
|
else if (outputTelemetryBuffer.isAvailable()) {
|
||||||
uint8_t command = luaL_checkunsigned(L, 1);
|
uint8_t command = luaL_checkunsigned(L, 1);
|
||||||
luaL_checktype(L, 2, LUA_TTABLE);
|
luaL_checktype(L, 2, LUA_TTABLE);
|
||||||
|
|
|
@ -171,6 +171,7 @@ void logTelemetryWriteByte(uint8_t data);
|
||||||
#define LOG_TELEMETRY_WRITE_START()
|
#define LOG_TELEMETRY_WRITE_START()
|
||||||
#define LOG_TELEMETRY_WRITE_BYTE(data)
|
#define LOG_TELEMETRY_WRITE_BYTE(data)
|
||||||
#endif
|
#endif
|
||||||
|
#define TELEMETRY_OUTPUT_BUFFER_SIZE 64
|
||||||
|
|
||||||
class OutputTelemetryBuffer {
|
class OutputTelemetryBuffer {
|
||||||
public:
|
public:
|
||||||
|
@ -212,7 +213,8 @@ class OutputTelemetryBuffer {
|
||||||
|
|
||||||
void pushByte(uint8_t byte)
|
void pushByte(uint8_t byte)
|
||||||
{
|
{
|
||||||
data[size++] = byte;
|
if (size < TELEMETRY_OUTPUT_BUFFER_SIZE)
|
||||||
|
data[size++] = byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushByteWithBytestuffing(uint8_t byte)
|
void pushByteWithBytestuffing(uint8_t byte)
|
||||||
|
@ -244,7 +246,7 @@ class OutputTelemetryBuffer {
|
||||||
public:
|
public:
|
||||||
union {
|
union {
|
||||||
SportTelemetryPacket sport;
|
SportTelemetryPacket sport;
|
||||||
uint8_t data[16];
|
uint8_t data[TELEMETRY_OUTPUT_BUFFER_SIZE];
|
||||||
};
|
};
|
||||||
uint8_t size;
|
uint8_t size;
|
||||||
uint8_t timeout;
|
uint8_t timeout;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue