1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 08:15:17 +03:00

Merge pull request #4009 from opentx/raphaelcoeffic/lua_sport_buffer_query

lua: allow telemtry output buffer availability to be queried
This commit is contained in:
Raphael Coeffic 2016-11-09 21:22:05 +01:00 committed by GitHub
commit 95598e5de0

View file

@ -333,7 +333,10 @@ uint8_t getDataId(uint8_t physicalId)
static int luaSportTelemetryPush(lua_State * L)
{
if (isSportOutputBufferAvailable()) {
if (lua_gettop(L) == 0) {
lua_pushboolean(L, isSportOutputBufferAvailable());
}
else if (isSportOutputBufferAvailable()) {
SportTelemetryPacket packet;
packet.physicalId = getDataId(luaL_checkunsigned(L, 1));
packet.primId = luaL_checkunsigned(L, 2);
@ -378,7 +381,10 @@ static int luaCrossfireTelemetryPop(lua_State * L)
static int luaCrossfireTelemetryPush(lua_State * L)
{
if (isCrossfireOutputBufferAvailable()) {
if (lua_gettop(L) == 0) {
lua_pushboolean(L, isCrossfireOutputBufferAvailable());
}
else if (isCrossfireOutputBufferAvailable()) {
uint8_t command = luaL_checkunsigned(L, 1);
luaL_checktype(L, 2, LUA_TTABLE);
uint8_t length = luaL_len(L, 2);