mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 03:49:52 +03:00
LUA sport/crossfireTelemetryPush protocol detection (#7229)
Make sportTelemetryPush/crossfireTelemetryPush return nil if they detect the wrong telemetry protocol. This allows us to differentiate between wrong protocol and telemetry buffer not available. For lua scripts supporting both crossfire and smartport this will let us reliably detect the telemetry protocol using these functions.
This commit is contained in:
parent
acf00938c3
commit
c9c33fd737
1 changed files with 8 additions and 4 deletions
|
@ -440,13 +440,15 @@ When called without parameters, it will only return the status of the output buf
|
|||
|
||||
@retval boolean data queued in output buffer or not.
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
@retval nil incorrect telemetry protocol.
|
||||
|
||||
@status current Introduced in 2.2.0, retval nil added in 2.3.4
|
||||
*/
|
||||
|
||||
static int luaSportTelemetryPush(lua_State * L)
|
||||
{
|
||||
if (!IS_FRSKY_SPORT_PROTOCOL()) {
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -637,12 +639,14 @@ When called without parameters, it will only return the status of the output buf
|
|||
|
||||
@retval boolean data queued in output buffer or not.
|
||||
|
||||
@status current Introduced in 2.2.0
|
||||
@retval nil incorrect telemetry protocol.
|
||||
|
||||
@status current Introduced in 2.2.0, retval nil added in 2.3.4
|
||||
*/
|
||||
static int luaCrossfireTelemetryPush(lua_State * L)
|
||||
{
|
||||
if (telemetryProtocol != PROTOCOL_TELEMETRY_CROSSFIRE) {
|
||||
lua_pushboolean(L, false);
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue