mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 16:55:20 +03:00
[Crossfire] Telemetry packets are bigger
This commit is contained in:
parent
d51e86b669
commit
9b5b9be50c
6 changed files with 16 additions and 8 deletions
|
@ -299,7 +299,7 @@ bool luaFindFieldByName(const char * name, LuaField & field, unsigned int flags)
|
||||||
static int luaSportTelemetryPop(lua_State * L)
|
static int luaSportTelemetryPop(lua_State * L)
|
||||||
{
|
{
|
||||||
if (!luaInputTelemetryFifo) {
|
if (!luaInputTelemetryFifo) {
|
||||||
luaInputTelemetryFifo = new Fifo<LuaTelemetryPacket, 16>();
|
luaInputTelemetryFifo = new Fifo<LuaTelemetryPacket, LUA_TELEMETRY_FIFO_SIZE>();
|
||||||
if (!luaInputTelemetryFifo) {
|
if (!luaInputTelemetryFifo) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ static int luaSportTelemetryPush(lua_State * L)
|
||||||
static int luaCrossfireTelemetryPop(lua_State * L)
|
static int luaCrossfireTelemetryPop(lua_State * L)
|
||||||
{
|
{
|
||||||
if (!luaInputTelemetryFifo) {
|
if (!luaInputTelemetryFifo) {
|
||||||
luaInputTelemetryFifo = new Fifo<LuaTelemetryPacket, 16>();
|
luaInputTelemetryFifo = new Fifo<LuaTelemetryPacket, LUA_TELEMETRY_FIFO_SIZE>();
|
||||||
if (!luaInputTelemetryFifo) {
|
if (!luaInputTelemetryFifo) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,6 @@ static int luaCrossfireTelemetryPop(lua_State * L)
|
||||||
lua_pushinteger(L, packet.crossfire.data[i]);
|
lua_pushinteger(L, packet.crossfire.data[i]);
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
}
|
}
|
||||||
lua_settable(L, -3);
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ void checkTrainerSettings(void);
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#include "fifo.h"
|
#include "fifo.h"
|
||||||
#include "dmafifo.h"
|
#include "dmafifo.h"
|
||||||
extern Fifo<uint8_t, 32> telemetryFifo;
|
extern Fifo<uint8_t, 64> telemetryFifo;
|
||||||
extern DMAFifo<32> serial2RxFifo;
|
extern DMAFifo<32> serial2RxFifo;
|
||||||
extern Fifo<uint8_t, 32> sbusFifo;
|
extern Fifo<uint8_t, 32> sbusFifo;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
Fifo<uint8_t, 32> telemetryFifo;
|
Fifo<uint8_t, 64> telemetryFifo;
|
||||||
uint32_t telemetryErrors = 0;
|
uint32_t telemetryErrors = 0;
|
||||||
|
|
||||||
void telemetryPortInit(uint32_t baudrate)
|
void telemetryPortInit(uint32_t baudrate)
|
||||||
|
|
|
@ -509,19 +509,22 @@ struct LuaTelemetryPacket
|
||||||
}
|
}
|
||||||
} sport;
|
} sport;
|
||||||
|
|
||||||
|
#if defined(CROSSFIRE)
|
||||||
struct {
|
struct {
|
||||||
uint8_t command;
|
uint8_t command;
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t data[8];
|
uint8_t data[32];
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
command = 0x00;
|
command = 0x00;
|
||||||
}
|
}
|
||||||
} crossfire;
|
} crossfire;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Fifo<LuaTelemetryPacket, 16> * luaInputTelemetryFifo;
|
#define LUA_TELEMETRY_FIFO_SIZE 8
|
||||||
|
extern Fifo<LuaTelemetryPacket, LUA_TELEMETRY_FIFO_SIZE> * luaInputTelemetryFifo;
|
||||||
extern LuaTelemetryPacket luaOutputTelemetryPacket;
|
extern LuaTelemetryPacket luaOutputTelemetryPacket;
|
||||||
void sportSendLuaPacket(LuaTelemetryPacket & packet);
|
void sportSendLuaPacket(LuaTelemetryPacket & packet);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -460,6 +460,6 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LUA)
|
#if defined(LUA)
|
||||||
Fifo<LuaTelemetryPacket, 16> * luaInputTelemetryFifo = NULL;
|
Fifo<LuaTelemetryPacket, LUA_TELEMETRY_FIFO_SIZE> * luaInputTelemetryFifo = NULL;
|
||||||
LuaTelemetryPacket luaOutputTelemetryPacket;
|
LuaTelemetryPacket luaOutputTelemetryPacket;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,7 +60,13 @@ extern uint8_t telemetryState;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TELEMETRY_TIMEOUT10ms 100 // 1 second
|
#define TELEMETRY_TIMEOUT10ms 100 // 1 second
|
||||||
|
|
||||||
|
#if defined(CROSSFIRE)
|
||||||
|
#define TELEMETRY_RX_PACKET_SIZE 40
|
||||||
|
#else
|
||||||
#define TELEMETRY_RX_PACKET_SIZE 19 // 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)
|
#define TELEMETRY_RX_PACKET_SIZE 19 // 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
|
extern uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
|
||||||
extern uint8_t telemetryRxBufferCount;
|
extern uint8_t telemetryRxBufferCount;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue