Merge pull request #3326 from opentx/bsongis/passthrough_sport_to_lua

Bsongis/passthrough sport to lua
This commit is contained in:
Bertrand Songis
2016-03-05 00:27:13 +01:00
17 changed files with 131 additions and 70 deletions
+6 -1
View File
@@ -44,7 +44,7 @@ uint8_t telemetryState = TELEMETRY_INIT;
#endif
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
Fifo<512> telemetryFifo; // TODO should be in the driver
Fifo<uint8_t, 512> telemetryFifo; // TODO should be in the driver
#endif
uint8_t frskyRxBufferCount = 0;
@@ -665,3 +665,8 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm)
{
return (45 - 3*alarm + g_model.frsky.rssiAlarms[alarm].value);
}
#if defined(LUA)
Fifo<LuaTelemetryValue, 16> * luaInputTelemetryFifo = NULL;
Fifo<LuaTelemetryValue, 16> * luaOutputTelemetryFifo = NULL;
#endif
+13 -1
View File
@@ -139,6 +139,8 @@
#define POWERBOX_STATE_LAST_ID 0x0b2f
#define POWERBOX_CNSP_FIRST_ID 0x0b30
#define POWERBOX_CNSP_LAST_ID 0x0b3f
#define DIY_FIRST_ID 0x5000
#define DIY_LAST_ID 0x50ff
#define RSSI_ID 0xf101
#define ADC1_ID 0xf102
#define ADC2_ID 0xf103
@@ -344,7 +346,6 @@ struct FrskyData {
};
#endif
#if defined(PCBTARANIS) && defined(REVPLUS)
#define IS_VALID_XJT_VERSION() (frskyData.xjtVersion != 0 && frskyData.xjtVersion != 0xff)
#else
@@ -553,4 +554,15 @@ void processSerialData(uint8_t data);
#define MODEL_TELEMETRY_PROTOCOL() g_model.telemetryProtocol
#endif
#if defined(LUA)
struct LuaTelemetryValue
{
uint8_t id;
uint32_t value;
};
extern Fifo<LuaTelemetryValue, 16> * luaInputTelemetryFifo;
extern Fifo<LuaTelemetryValue, 16> * luaOutputTelemetryFifo;
#endif
#endif // _FRSKY_H_
+7
View File
@@ -269,6 +269,13 @@ void processSportPacket(uint8_t * packet)
processSportPacket(id, 6, instance, bool(data & 0x2000000));
processSportPacket(id, 7, instance, bool(data & 0x4000000));
}
else if (id >= DIY_FIRST_ID && id <= DIY_LAST_ID) {
#if defined(LUA)
if (luaInputTelemetryFifo) {
luaInputTelemetryFifo->push((LuaTelemetryValue){(uint8_t)id, data});
}
#endif
}
else {
processSportPacket(id, 0, instance, data);
}
+1 -1
View File
@@ -21,7 +21,7 @@
#ifndef _TELEMETRY_H_
#define _TELEMETRY_H_
extern Fifo<512> telemetryFifo;
extern Fifo<uint8_t, 512> telemetryFifo;
enum TelemetryProtocol
{