mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 06:15:10 +03:00
Compilation fix
This commit is contained in:
parent
36ecf77639
commit
e4b894b58e
2 changed files with 13 additions and 2 deletions
|
@ -209,8 +209,9 @@ static void luaPushLatLon(lua_State* L, TelemetrySensor & telemetrySensor, Telem
|
||||||
lua_pushtablenumber(L, "lon", telemetryItem.gps.longitude * 0.000001);
|
lua_pushtablenumber(L, "lon", telemetryItem.gps.longitude * 0.000001);
|
||||||
lua_pushtablenumber(L, "pilot-lon", telemetryItem.pilotLongitude * 0.000001);
|
lua_pushtablenumber(L, "pilot-lon", telemetryItem.pilotLongitude * 0.000001);
|
||||||
|
|
||||||
if (telemetryItem.hasReceiveTime())
|
int8_t delay = telemetryItem.getDelaySinceLastValue();
|
||||||
lua_pushtableinteger(L, "delay", telemetryItem.getDelaySinceLastValue());
|
if (delay >= 0)
|
||||||
|
lua_pushtableinteger(L, "delay", delay);
|
||||||
else
|
else
|
||||||
lua_pushtablenil(L, "delay");
|
lua_pushtablenil(L, "delay");
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,16 @@ class TelemetryItem
|
||||||
return (timeout == TELEMETRY_SENSOR_TIMEOUT_OLD);
|
return (timeout == TELEMETRY_SENSOR_TIMEOUT_OLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool hasReceiveTime()
|
||||||
|
{
|
||||||
|
return timeout >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int8_t getDelaySinceLastValue()
|
||||||
|
{
|
||||||
|
return hasReceiveTime() ? TELEMETRY_SENSOR_TIMEOUT_START - timeout : TELEMETRY_SENSOR_TIMEOUT_OLD;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool isFresh()
|
inline bool isFresh()
|
||||||
{
|
{
|
||||||
return TELEMETRY_SENSOR_TIMEOUT_START - timeout <= 1; // 2 * 160ms
|
return TELEMETRY_SENSOR_TIMEOUT_START - timeout <= 1; // 2 * 160ms
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue