chore: formatting of telemetry structs for readability (#4753)
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define CS(id,subId,name,unit,precision) {id,subId,unit,precision,name}
|
#define CS(id,subId,name,unit,precision) {id,subId,unit,precision,name}
|
||||||
|
|
||||||
const CrossfireSensor crossfireSensors[] = {
|
const CrossfireSensor crossfireSensors[] = {
|
||||||
@@ -59,6 +60,7 @@ const CrossfireSensor crossfireSensors[] = {
|
|||||||
CS(BARO_ALT_ID, 0, STR_SENSOR_ALT, UNIT_METERS, 2),
|
CS(BARO_ALT_ID, 0, STR_SENSOR_ALT, UNIT_METERS, 2),
|
||||||
CS(0, 0, "UNKNOWN", UNIT_RAW, 0),
|
CS(0, 0, "UNKNOWN", UNIT_RAW, 0),
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
const CrossfireSensor & getCrossfireSensor(uint8_t id, uint8_t subId)
|
const CrossfireSensor & getCrossfireSensor(uint8_t id, uint8_t subId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ enum
|
|||||||
AFHDS2A_ID_END = 0xFF,
|
AFHDS2A_ID_END = 0xFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define FS(type,name,unit,precision) {type,unit,precision,name}
|
#define FS(type,name,unit,precision) {type,unit,precision,name}
|
||||||
|
|
||||||
const FlySkySensor flySkySensors[] = {
|
const FlySkySensor flySkySensors[] = {
|
||||||
@@ -199,6 +200,7 @@ const FlySkySensor flySkySensors[] = {
|
|||||||
|
|
||||||
FS( 0x00, NULL, UNIT_RAW, 0 ), // sentinel
|
FS( 0x00, NULL, UNIT_RAW, 0 ), // sentinel
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
int32_t getALT(uint32_t value);
|
int32_t getALT(uint32_t value);
|
||||||
inline int setFlyskyTelemetryValue( int16_t type, uint8_t instance, int32_t value, uint32_t unit, uint32_t prec)
|
inline int setFlyskyTelemetryValue( int16_t type, uint8_t instance, int32_t value, uint32_t unit, uint32_t prec)
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ union nv14SensorData {
|
|||||||
|
|
||||||
FlyskyNv14Sensor defaultNv14Sensor = {0, 0, "UNKNOWN", UNIT_RAW, 0, 0, 2, false};
|
FlyskyNv14Sensor defaultNv14Sensor = {0, 0, "UNKNOWN", UNIT_RAW, 0, 0, 2, false};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
const FlyskyNv14Sensor Nv14Sensor[]=
|
const FlyskyNv14Sensor Nv14Sensor[]=
|
||||||
{
|
{
|
||||||
{FLYSKY_FIXED_RX_VOLTAGE, 0, STR_SENSOR_A1, UNIT_VOLTS, 2, 0, 2, false},
|
{FLYSKY_FIXED_RX_VOLTAGE, 0, STR_SENSOR_A1, UNIT_VOLTS, 2, 0, 2, false},
|
||||||
@@ -84,7 +85,7 @@ const FlyskyNv14Sensor Nv14Sensor[]=
|
|||||||
// {FLYSKY_SENSOR_SYNC, 0, "Sync", UNIT_RAW, 0, 0, 2, false},
|
// {FLYSKY_SENSOR_SYNC, 0, "Sync", UNIT_RAW, 0, 0, 2, false},
|
||||||
defaultNv14Sensor
|
defaultNv14Sensor
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
extern uint32_t NV14internalModuleFwVersion;
|
extern uint32_t NV14internalModuleFwVersion;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct FrSkySportSensor {
|
|||||||
const char * name;
|
const char * name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define FS(firstId,lastId,subId,name,unit,prec) {firstId,lastId-firstId,subId,prec,unit,name}
|
#define FS(firstId,lastId,subId,name,unit,prec) {firstId,lastId-firstId,subId,prec,unit,name}
|
||||||
|
|
||||||
const FrSkySportSensor sportSensors[] = {
|
const FrSkySportSensor sportSensors[] = {
|
||||||
@@ -105,6 +106,7 @@ const FrSkySportSensor sportSensors[] = {
|
|||||||
FS( SERVO_FIRST_ID, SERVO_LAST_ID, 3, STR_SENSOR_SERVO_STATUS, UNIT_TEXT, 0 ),
|
FS( SERVO_FIRST_ID, SERVO_LAST_ID, 3, STR_SENSOR_SERVO_STATUS, UNIT_TEXT, 0 ),
|
||||||
FS( 0, 0, 0, nullptr, UNIT_RAW, 0 ) // sentinel
|
FS( 0, 0, 0, nullptr, UNIT_RAW, 0 ) // sentinel
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
const FrSkySportSensor * getFrSkySportSensor(uint16_t id, uint8_t subId=0)
|
const FrSkySportSensor * getFrSkySportSensor(uint16_t id, uint8_t subId=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ struct GhostSensor
|
|||||||
const char * name;
|
const char * name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define GS(id,name,unit,precision) {id,unit,precision,name}
|
#define GS(id,name,unit,precision) {id,unit,precision,name}
|
||||||
|
|
||||||
// telemetry sensors ID
|
// telemetry sensors ID
|
||||||
@@ -92,6 +93,7 @@ const GhostSensor ghostSensors[] = {
|
|||||||
|
|
||||||
GS(0x00, NULL, UNIT_RAW, 0),
|
GS(0x00, NULL, UNIT_RAW, 0),
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
const GhostSensor *getGhostSensor(uint8_t id)
|
const GhostSensor *getGhostSensor(uint8_t id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ enum
|
|||||||
HITEC_ID_TX_LQI = 0xFF01, // Pseudo id outside 1 byte range of Hitec sensors
|
HITEC_ID_TX_LQI = 0xFF01, // Pseudo id outside 1 byte range of Hitec sensors
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define HS(id,name,unit,precision) {id,unit,precision,name}
|
#define HS(id,name,unit,precision) {id,unit,precision,name}
|
||||||
|
|
||||||
const HitecSensor hitecSensors[] = {
|
const HitecSensor hitecSensors[] = {
|
||||||
@@ -205,6 +206,7 @@ const HitecSensor hitecSensors[] = {
|
|||||||
HS(HITEC_ID_TX_LQI, STR_SENSOR_TX_QUALITY, UNIT_RAW, 0), // Pseudo id outside 1 byte range of Hitec sensors// Pseudo sensor for TLQI
|
HS(HITEC_ID_TX_LQI, STR_SENSOR_TX_QUALITY, UNIT_RAW, 0), // Pseudo id outside 1 byte range of Hitec sensors// Pseudo sensor for TLQI
|
||||||
HS(0x00, NULL, UNIT_RAW, 0), // sentinel
|
HS(0x00, NULL, UNIT_RAW, 0), // sentinel
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
const HitecSensor * getHitecSensor(uint16_t id)
|
const HitecSensor * getHitecSensor(uint16_t id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ struct HottSensor
|
|||||||
const char * name;
|
const char * name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define HS(id,name,unit,precision) {id,unit,precision,name}
|
#define HS(id,name,unit,precision) {id,unit,precision,name}
|
||||||
|
|
||||||
const HottSensor hottSensors[] = {
|
const HottSensor hottSensors[] = {
|
||||||
@@ -292,6 +293,7 @@ const HottSensor hottSensors[] = {
|
|||||||
// sentinel
|
// sentinel
|
||||||
HS(0x00, NULL, UNIT_RAW, 0) // sentinel
|
HS(0x00, NULL, UNIT_RAW, 0) // sentinel
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
const HottSensor * getHottSensor(uint16_t id)
|
const HottSensor * getHottSensor(uint16_t id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct MLinkSensor
|
|||||||
const char * name;
|
const char * name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define MS(id,name,unit,precision) {id,unit,precision,name}
|
#define MS(id,name,unit,precision) {id,unit,precision,name}
|
||||||
|
|
||||||
const MLinkSensor mlinkSensors[] = {
|
const MLinkSensor mlinkSensors[] = {
|
||||||
@@ -53,6 +54,7 @@ const MLinkSensor mlinkSensors[] = {
|
|||||||
MS(MLINK_TX_RSSI, STR_SENSOR_TX_RSSI, UNIT_RAW, 0),
|
MS(MLINK_TX_RSSI, STR_SENSOR_TX_RSSI, UNIT_RAW, 0),
|
||||||
MS(MLINK_TX_LQI, STR_SENSOR_TX_QUALITY, UNIT_RAW, 0),
|
MS(MLINK_TX_LQI, STR_SENSOR_TX_QUALITY, UNIT_RAW, 0),
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
const MLinkSensor * getMLinkSensor(uint16_t id)
|
const MLinkSensor * getMLinkSensor(uint16_t id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ struct SpektrumSensor {
|
|||||||
const char *name;
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#define SS(i2caddress,startByte,dataType,name,unit,precision) {i2caddress,startByte,dataType,precision,unit,name}
|
#define SS(i2caddress,startByte,dataType,name,unit,precision) {i2caddress,startByte,dataType,precision,unit,name}
|
||||||
|
|
||||||
// IMPORTANT: Keep the sensor table incremtally sorted by i2caddress
|
// IMPORTANT: Keep the sensor table incremtally sorted by i2caddress
|
||||||
@@ -355,6 +356,7 @@ const SpektrumSensor spektrumSensors[] = {
|
|||||||
SS(I2C_PSEUDO_TX, 10, uint32, STR_SENSOR_CELLS, UNIT_CELLS, 2),
|
SS(I2C_PSEUDO_TX, 10, uint32, STR_SENSOR_CELLS, UNIT_CELLS, 2),
|
||||||
SS(0, 0, int16, NULL, UNIT_RAW, 0) //sentinel
|
SS(0, 0, int16, NULL, UNIT_RAW, 0) //sentinel
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
// Alt Low and High needs to be combined (in 2 diff packets)
|
// Alt Low and High needs to be combined (in 2 diff packets)
|
||||||
static uint8_t gpsAltHigh = 0;
|
static uint8_t gpsAltHigh = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user