1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-13 03:19:58 +03:00

Merge pull request #9868 from iNavFlight/MrD_Change-sensor-IDs-for-GPS-and-Modes-on-SmartPort

Change SmartPort sensor IDs for GPS and Modes
This commit is contained in:
Darren Lines 2024-09-17 12:09:51 +01:00 committed by GitHub
commit 2dfceb7c66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 117 additions and 87 deletions

View file

@ -1162,6 +1162,16 @@ S.Port telemetry: Send pitch and roll degrees*10 instead of raw accelerometer da
---
### frsky_use_legacy_gps_mode_sensor_ids
S.Port telemetry: If `ON`, send the legacy telemetry IDs for modes (Tmp1) and GNSS (Tmp2). These are old IDs, deprecated, and will be removed in INAV 10.0. Tools and scripts using these IDs should be updated to use the new IDs of **470** for Modes and **480** for GNSS. Default: 'OFF'
| Default | Min | Max |
| --- | --- | --- |
| OFF | OFF | ON |
---
### fw_autotune_max_rate_deflection
The target percentage of maximum mixer output used for determining the rates in `AUTO` and `LIMIT`.

View file

@ -102,17 +102,21 @@ The following sensors are transmitted
* **VSpd** : vertical speed, unit is cm/s.
* **Hdg** : heading, North is 0°, South is 180°.
* **AccX,Y,Z** : accelerometer values (not sent if `frsky_pitch_roll = ON`).
* **Tmp1** : flight mode, sent as 5 digits. Number is sent as **ABCDE** detailed below. The numbers are additives (for example: if digit C is 6, it means both position hold and altitude hold are active) :
* **470** : flight mode, sent as 5 digits. Number is sent as **ABCDE** detailed below. The numbers are additives (for example: if digit C is 6, it means both position hold and altitude hold are active) :
* **A** : 1 = flaperon mode, 2 = auto tune mode, 4 = failsafe mode
* **B** : 1 = return to home, 2 = waypoint mode, 4 = headfree mode
* **C** : 1 = heading hold, 2 = altitude hold, 4 = position hold
* **D** : 1 = angle mode, 2 = horizon mode, 4 = passthru mode
* **E** : 1 = ok to arm, 2 = arming is prevented, 4 = armed
* **Tmp2** : GPS lock status, accuracy, home reset trigger, and number of satellites. Number is sent as **ABCD** detailed below. Typical minimum GPS 3D lock value is 3906 (GPS locked and home fixed, HDOP highest accuracy, 6 satellites).
_NOTE_ This sensor used to be **Tmp1**. The ID has been reassigned in INAV 8.0. The old ID of **Tmp1** can still be used, by using `set frsky_use_legacy_gps_mode_sensor_ids = ON`. This is deprecated and will be removed in INAV 10.0. All tools and scripts using the old IDs should be updated to use the new ID.
* **480** : GPS lock status, accuracy, home reset trigger, and number of satellites. Number is sent as **ABCD** detailed below. Typical minimum GPS 3D lock value is 3906 (GPS locked and home fixed, HDOP highest accuracy, 6 satellites).
* **A** : 1 = GPS fix, 2 = GPS home fix, 4 = home reset (numbers are additive)
* **B** : GPS accuracy based on HDOP (0 = lowest to 9 = highest accuracy)
* **C** : number of satellites locked (digit C & D are the number of locked satellites)
* **D** : number of satellites locked (if 14 satellites are locked, C = 1 & D = 4)
_NOTE_ This sensor used to be **Tmp2**. The ID has been reassigned in INAV 8.0. The old ID of **Tmp2** can still be used, by using `set frsky_use_legacy_gps_mode_sensor_ids = ON`. This is deprecated and will be removed in INAV 10.0. All tools and scripts using the old IDs should be updated to use the new ID.
* **GAlt** : GPS altitude, sea level is zero.
* **ASpd** : true air speed, from pitot sensor. This is _Knots * 10_
* **A4** : average cell value. Warning : unlike FLVSS and MLVSS sensors, you do not get actual lowest value of a cell, but an average : (total lipo voltage) / (number of cells)

View file

@ -3052,6 +3052,10 @@ groups:
description: "S.Port telemetry: Send pitch and roll degrees*10 instead of raw accelerometer data"
default_value: OFF
type: bool
- name: frsky_use_legacy_gps_mode_sensor_ids
description: "S.Port telemetry: If `ON`, send the legacy telemetry IDs for modes (Tmp1) and GNSS (Tmp2). These are old IDs, deprecated, and will be removed in INAV 10.0. Tools and scripts using these IDs should be updated to use the new IDs of **470** for Modes and **480** for GNSS. Default: 'OFF'"
default_value: OFF
type: bool
- name: report_cell_voltage
description: "S.Port and IBUS telemetry: Send the average cell voltage if set to ON"
default_value: OFF

View file

@ -83,14 +83,16 @@ enum
FSSP_DATAID_ACCX = 0x0700,
FSSP_DATAID_ACCY = 0x0710,
FSSP_DATAID_ACCZ = 0x0720,
FSSP_DATAID_T1 = 0x0400 ,
FSSP_DATAID_T2 = 0x0410 ,
FSSP_DATAID_LEGACY_MODES = 0x0400, // Deprecated. Should be removed in INAV 10.0
FSSP_DATAID_LEGACY_GNSS = 0x0410, // Deprecated. Should be removed in INAV 10.0
FSSP_DATAID_HOME_DIST = 0x0420,
FSSP_DATAID_GPS_ALT = 0x0820,
FSSP_DATAID_ASPD = 0x0A00,
FSSP_DATAID_A3 = 0x0900,
FSSP_DATAID_A4 = 0x0910,
FSSP_DATAID_AZIMUTH = 0x0460
FSSP_DATAID_AZIMUTH = 0x0460,
FSSP_DATAID_MODES = 0x0470,
FSSP_DATAID_GNSS = 0x0480,
};
const uint16_t frSkyDataIdTable[] = {
@ -115,8 +117,8 @@ const uint16_t frSkyDataIdTable[] = {
FSSP_DATAID_ACCX,
FSSP_DATAID_ACCY,
FSSP_DATAID_ACCZ,
FSSP_DATAID_T1 ,
FSSP_DATAID_T2 ,
FSSP_DATAID_MODES,
FSSP_DATAID_GNSS,
FSSP_DATAID_HOME_DIST,
FSSP_DATAID_GPS_ALT,
FSSP_DATAID_ASPD,
@ -539,19 +541,27 @@ void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *clear
*clearToSend = false;
}
break;
case FSSP_DATAID_T1 :
case FSSP_DATAID_MODES:
{
if (telemetryConfig()->frsky_use_legacy_gps_mode_sensor_ids)
id = FSSP_DATAID_LEGACY_MODES;
smartPortSendPackage(id, frskyGetFlightMode());
*clearToSend = false;
break;
}
#ifdef USE_GPS
case FSSP_DATAID_T2 :
case FSSP_DATAID_GNSS:
{
if (telemetryConfig()->frsky_use_legacy_gps_mode_sensor_ids)
id = FSSP_DATAID_LEGACY_GNSS;
if (smartPortShouldSendGPSData()) {
smartPortSendPackage(id, frskyGetGPSState());
*clearToSend = false;
}
break;
}
case FSSP_DATAID_SPEED:
if (smartPortShouldSendGPSData()) {
//convert to knots: 1cm/s = 0.0194384449 knots

View file

@ -62,6 +62,7 @@ PG_RESET_TEMPLATE(telemetryConfig_t, telemetryConfig,
.telemetry_switch = SETTING_TELEMETRY_SWITCH_DEFAULT,
.telemetry_inverted = SETTING_TELEMETRY_INVERTED_DEFAULT,
.frsky_pitch_roll = SETTING_FRSKY_PITCH_ROLL_DEFAULT,
.frsky_use_legacy_gps_mode_sensor_ids = SETTING_FRSKY_USE_LEGACY_GPS_MODE_SENSOR_IDS_DEFAULT,
.report_cell_voltage = SETTING_REPORT_CELL_VOLTAGE_DEFAULT,
.hottAlarmSoundInterval = SETTING_HOTT_ALARM_SOUND_INTERVAL_DEFAULT,
.halfDuplex = SETTING_TELEMETRY_HALFDUPLEX_DEFAULT,

View file

@ -46,6 +46,7 @@ typedef struct telemetryConfig_s {
uint8_t telemetry_switch; // Use aux channel to change serial output & baudrate( MSP / Telemetry ). It disables automatic switching to Telemetry when armed.
uint8_t telemetry_inverted; // Flip the default inversion of the protocol - Same as serialrx_inverted in rx.c, but for telemetry.
uint8_t frsky_pitch_roll;
bool frsky_use_legacy_gps_mode_sensor_ids;
uint8_t report_cell_voltage;
uint8_t hottAlarmSoundInterval;
uint8_t halfDuplex;