Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arming flags sensor to SmartPort #182

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/cli/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ const clivalue_t valueTable[] = {
{ "telemetry_enable_headspeed", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = LOG2(SENSOR_HEADSPEED), PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, enableSensors)},
{ "telemetry_enable_tailspeed", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = LOG2(SENSOR_TAILSPEED), PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, enableSensors)},
{ "telemetry_enable_throttle_control",VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = LOG2(SENSOR_THROTTLE_CONTROL),PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, enableSensors)},
{ "telemetry_enable_arming_flags", VAR_UINT32 | MASTER_VALUE | MODE_BITSET, .config.bitpos = LOG2(SENSOR_ARMING_FLAGS), PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, enableSensors)},
#else
{ "telemetry_enable_sensors", VAR_UINT32 | MASTER_VALUE, .config.u32Max = SENSOR_ALL, PG_TELEMETRY_CONFIG, offsetof(telemetryConfig_t, enableSensors)},
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/main/pg/telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ typedef enum {
SENSOR_BEC_VOLTAGE = BIT(26),
SENSOR_HEADSPEED = BIT(27),
SENSOR_TAILSPEED = BIT(28),
SENSOR_THROTTLE_CONTROL = BIT(29),
SENSOR_THROTTLE_CONTROL= BIT(29),
SENSOR_ARMING_FLAGS = BIT(30),
} sensor_e;

typedef enum {
Expand Down
11 changes: 10 additions & 1 deletion src/main/telemetry/smartport.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ enum
FSSP_DATAID_THROTTLE_CONTROL = 0x5440 , // custom
FSSP_DATAID_GOV_MODE = 0x5450 , // custom
FSSP_DATAID_MODEL_ID = 0x5460 , // custom
FSSP_DATAID_ARMING_FLAGS = 0x5462 , // custom
FSSP_DATAID_PID_PROFILE = 0x5471 , // custom
FSSP_DATAID_RATES_PROFILE = 0x5472 , // custom
#if defined(USE_ACC)
Expand All @@ -139,7 +140,7 @@ enum
};

// if adding more sensors then increase this value (should be equal to the maximum number of ADD_SENSOR calls)
#define MAX_DATAIDS 30
#define MAX_DATAIDS 31

static uint16_t frSkyDataIdTable[MAX_DATAIDS];

Expand Down Expand Up @@ -322,6 +323,10 @@ static void initSmartPortSensors(void)
ADD_SENSOR(FSSP_DATAID_MODEL_ID);
}

if (telemetryIsSensorEnabled(SENSOR_ARMING_FLAGS)) {
ADD_SENSOR(FSSP_DATAID_ARMING_FLAGS);
}

if (telemetryIsSensorEnabled(SENSOR_PID_PROFILE)) {
ADD_SENSOR(FSSP_DATAID_PID_PROFILE);
}
Expand Down Expand Up @@ -662,6 +667,10 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
smartPortSendPackage(id, telemetrySensorValue(TELEM_MODEL_ID));
*clearToSend = false;
break;
case FSSP_DATAID_ARMING_FLAGS :
smartPortSendPackage(id, telemetrySensorValue(TELEM_ARMING_FLAGS));
*clearToSend = false;
break;
case FSSP_DATAID_PID_PROFILE :
smartPortSendPackage(id, telemetrySensorValue(TELEM_PID_PROFILE));
*clearToSend = false;
Expand Down