From 9e4cc08ef294f5b4af11d30988075340cc74efe9 Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Sun, 27 Sep 2015 10:19:49 +0200 Subject: [PATCH] Reworked S.Port Telemetry to comply with FrSky hardware sensors. Signed-off-by: Lutz Bender --- Telemetry.cpp | 359 +++++++++++++++++++++++++++++++++----------------- Telemetry.h | 153 ++++++++++++++------- config.h | 22 +++- 3 files changed, 362 insertions(+), 172 deletions(-) diff --git a/Telemetry.cpp b/Telemetry.cpp index 2f9a1da3..1bc856ca 100644 --- a/Telemetry.cpp +++ b/Telemetry.cpp @@ -437,7 +437,22 @@ void run_telemetry(void) #if defined(SPORT_TELEMETRY) static short _FrSkySport_crc; - static short _currentGPSValue; + #ifdef ACC + static short _currentACCValue; + #endif + #ifdef BARO + static short _currentVarioValue; + #endif + #if GPS + static short _currentGPSValue; + static short _currentRPMValue; + #endif + #ifdef VBAT_CELLS + static short _currentFLVSSValue; + #endif + #ifdef VBAT || POWERMETER + static short _currentFCSValue; + #endif void FrSkySport_sendByte(uint8_t byte) { @@ -476,130 +491,232 @@ void run_telemetry(void) FrSkySport_sendCrc(); } - void FrSkySport_sendA2voltage() - { - #ifdef VBAT - uint32_t opentx_val = (255.0 * (float)(analog.vbat / (float)FRSKY_SPORT_A2_MAX)); - FrSkySport_sendValue(FRSKY_SPORT_ADC2_ID, (opentx_val)); - #endif - } + void FrSkySport_sendEmpty(uint16_t id) + { + FrSkySport_sendByte(0x00); + uint8_t *bytes = (uint8_t*)&id; + FrSkySport_sendByte(bytes[0]); + FrSkySport_sendByte(bytes[1]); + for(uint8_t i = 0; i < 4; i++) + FrSkySport_sendByte(0x00); + FrSkySport_sendCrc(); + } - uint32_t FrSkySport_EncodeCoordinate(float latLon, bool isLat) - { - #if GPS - uint32_t otx_coord = 0; - if (!isLat) - { - otx_coord = abs(latLon); // now we have unsigned value and one bit to spare - otx_coord = (otx_coord + otx_coord / 2) / 25 | 0x80000000; // 6/100 = 1.5/25, division by power of 2 is fast - if (latLon < 0) otx_coord |= 0x40000000; - } - else { - otx_coord = abs(latLon); // now we have unsigned value and one bit to spare - otx_coord = (otx_coord + otx_coord / 2) / 25; // 6/100 = 1.5/25, division by power of 2 is fast - if (latLon < 0) otx_coord |= 0x40000000; - } - return otx_coord; - #endif + void FrSkySport_Vario() + { + #if BARO + switch(_currentVarioValue){ + case 0: + FrSkySport_sendValue(FRSKY_SPORT_ALT_ID, (int32_t)(alt.EstAlt) * 100); // cm + break; + case 1: + #ifdef VARIOMETER + FrSkySport_sendValue(FRSKY_SPORT_VARIO_ID, ((uint32_t)alt.vario)); // unknown unit + #else + FrSkySport_sendEmpty(FRSKY_SPORT_VARIO_ID); + #endif + break; } - - void FrSkySport_sendGPSCoordinate() - { - #if GPS - uint32_t GPSValueToSend = 0; - - if (f.GPS_FIX && GPS_numSat >= 4) - { - switch (_currentGPSValue) - { - case 0: - GPSValueToSend = FrSkySport_EncodeCoordinate(GPS_coord[LON], false); - _currentGPSValue = 1; - break; - case 1: - GPSValueToSend = FrSkySport_EncodeCoordinate(GPS_coord[LAT], true); - _currentGPSValue = 0; - break; - } - FrSkySport_sendValue(FRSKY_SPORT_GPS_LONG_LATI_ID, GPSValueToSend); - } + #ifdef VARIOMETER + _currentVarioValue = ++_currentVarioValue % 2; #endif + #endif + } + + void FrSkySport_FLVSS() + { + /* + * requirement: + * analog.vbatcells[0] = cell1 + * analog.vbatcells[1] = cell1 + cell2 + * analog.vbatcells[2] = cell1 + cell2 + cell3 + * analog.vbatcells[3] = cell1 + cell2 + cell3 +cell4 + * analog.vbatcells[4] = cell1 + cell2 + cell3 +cell4 + cell5 + * analog.vbatcells[5] = cell1 + cell2 + cell3 +cell4 + cell5 + cell6 + */ + #ifdef VBAT_CELLS + uint8_t firstCellNo = _currentFLVSSValue * 2; + uint16_t cell1Data = 0; + uint16_t cell2Data = 0; + uint32_t cellData = 0; + if(firstCellNo == 0){ + cell1Data = analog.vbatcells[firstCellNo] * 50; + } else { + cell1Data = (analog.vbatcells[firstCellNo] - analog.vbatcells[firstCellNo-1]) * 50; + } + if(VBAT_CELLS_NUM > (firstCellNo+1)) + cell2Data = (analog.vbatcells[firstCellNo+1] - analog.vbatcells[firstCellNo]) * 50; + + cellData = cell2Data & 0x0FFF; + cellData <<= 12; + cellData |= cell1Data & 0x0FFF; + cellData <<= 4; + cellData |= VBAT_CELLS_NUM & 0x0F; + cellData <<= 4; + cellData |= firstCellNo & 0x0F; + + if(VBAT_CELLS_NUM > (firstCellNo+2)){ + _currentFLVSSValue++; + } else { + _currentFLVSSValue = 0; } + FrSkySport_sendValue(FRSKY_SPORT_CELLS_ID, cellData); + #endif + } - void FrSkySport_sendGPSAltitude() - { - #if defined(TELEMETRY_ALT_GPS) and GPS - if (f.GPS_FIX && GPS_numSat >= 4) - { - FrSkySport_sendValue(FRSKY_SPORT_GPS_ALT_ID, (int32_t)(GPS_altitude)); // m??? - } + void FrSkySport_FCS() + { + #ifdef VBAT || POWERMETER + switch(_currentFCSValue){ + case 0: + #ifdef VBAT + FrSkySport_sendValue(FRSKY_SPORT_VFAS_ID, (uint32_t)(analog.vbat * 10)); + #else + FrSkySport_sendEmpty(FRSKY_SPORT_VFAS_ID); #endif - } - - void FrSkySport_sendGPSSpeed() { - #if GPS - if (f.GPS_FIX && GPS_numSat >= 4) - { - uint32_t speed = ((float)GPS_speed * 100); - FrSkySport_sendValue(FRSKY_SPORT_GPS_SPEED_ID, speed); // unknown unit, just a guess - } - #endif + break; + case 1: + #ifdef POWERMETER + FrSkySport_sendValue(FRSKY_SPORT_CURR_ID, (uint32_t)analog.amperage); // not tested! must be A*10 + #else + FrSkySport_sendEmpty(FRSKY_SPORT_CURR_ID); + #endif + break; } + _currentFCSValue = ++_currentFCSValue % 2; + #endif + } - void FrSkySport_sendAltitude() + uint32_t FrSkySport_EncodeCoordinate(float latLon, bool isLat) + { + #if GPS + uint32_t coord = 0; + if (!isLat) { - #if defined(TELEMETRY_ALT_BARO) and BARO - FrSkySport_sendValue(FRSKY_SPORT_ALT_ID, (int32_t)(alt.EstAlt) * 100); // cm - #endif + coord = abs(latLon); // now we have unsigned value and one bit to spare + coord = (coord + coord / 2) / 25 | 0x80000000; // 6/100 = 1.5/25, division by power of 2 is fast + if (latLon < 0) coord |= 0x40000000; } + else { + coord = abs(latLon); // now we have unsigned value and one bit to spare + coord = (coord + coord / 2) / 25; // 6/100 = 1.5/25, division by power of 2 is fast + if (latLon < 0) coord |= 0x40000000; + } + return coord; + #endif + } - void FrSkySport_sendHeading() + void FrSkySport_GPS() { - #if defined(TELEMETRY_COURSE_MAG) or (defined(TELEMETRY_COURSE_GPS) and GPS) - #if defined(TELEMETRY_COURSE_MAG) - uint32_t otx_heading = (uint32_t)(att.heading + 360) % 360 * 100; - FrSkySport_sendValue(FRSKY_SPORT_GPS_COURS_ID, otx_heading); // 1 deg = 100, 0 - 359000 - #elif defined(TELEMETRY_COURSE_GPS) && defined(GPS) - if (f.GPS_FIX && GPS_numSat >= 4) - { - uint32_t otx_heading = (uint32_t)(GPS_ground_course + 360) % 360 * 100; - FrSkySport_sendValue(FRSKY_SPORT_GPS_COURS_ID, otx_heading); // 1 deg = 100, 0 - 359000 - } - #endif + #if GPS + uint32_t GPSValueToSend = 0; + uint16_t GPSId = 0; + + switch(_currentGPSValue){ + case 0: // latitude + GPSValueToSend = FrSkySport_EncodeCoordinate(GPS_coord[LON], false); + GPSId = FRSKY_SPORT_GPS_LONG_LATI_ID; + break; + case 1: // longitude + GPSValueToSend = FrSkySport_EncodeCoordinate(GPS_coord[LAT], true); + GPSId = FRSKY_SPORT_GPS_LONG_LATI_ID; + break; + case 2: // altitude + GPSValueToSend = (int32_t)(GPS_altitude * 100); // meter + GPSId = FRSKY_SPORT_GPS_ALT_ID; + break; + case 3: // speed + GPSValueToSend = ((float)GPS_speed * 1000); // TODO: unknown unit, gives same numbers as MultiWiiConf + GPSId = FRSKY_SPORT_GPS_SPEED_ID; + break; + case 4: // course over ground + GPSValueToSend = (uint32_t)(GPS_ground_course + 360) % 360 * 100; // 1 deg = 100, 0 - 359000 + GPSId = FRSKY_SPORT_GPS_COURS_ID; + break; + } + if (f.GPS_FIX && GPS_numSat >= 4) { + FrSkySport_sendValue(GPSId, GPSValueToSend); + } else { + FrSkySport_sendEmpty(GPSId); + } + _currentGPSValue = ++_currentGPSValue % 5; #endif } - void FrSkySport_sendACCX() - { - #ifdef ACC - FrSkySport_sendValue(FRSKY_SPORT_ACCX_ID, imu.accSmooth[0] / 5); // unknown unit - #endif - } - void FrSkySport_sendACCY() - { - #ifdef ACC - FrSkySport_sendValue(FRSKY_SPORT_ACCY_ID, imu.accSmooth[1] / 5); // unknown unit + void FrSkySport_RPM() + { + #if GPS + switch(_currentRPMValue){ + case 0: // temperature 1 contains num sats + FrSkySport_sendValue(FRSKY_SPORT_T1_ID, (int32_t)GPS_numSat); + break; + case 1: // temperature 2 contains distance to home + if (f.GPS_FIX && GPS_numSat >= 4) { + FrSkySport_sendValue(FRSKY_SPORT_T2_ID, GPS_distanceToHome); + } else { + FrSkySport_sendEmpty(FRSKY_SPORT_T2_ID); + } + break; + } + _currentRPMValue = ++_currentRPMValue % 2; #endif - } + } +/* + void FrSkySport_SP2UART() + { + // TODO + } - void FrSkySport_sendACCZ() - { - #ifdef ACC - FrSkySport_sendValue(FRSKY_SPORT_ACCZ_ID, imu.accSmooth[2] / 5); // unknown unit - #endif + void FrSkySport_ASS() + { + // TODO + } +*/ + + void FrSkySport_ACC() + { + #ifdef ACC + switch(_currentACCValue){ + case 0: + FrSkySport_sendValue(FRSKY_SPORT_ACCX_ID, imu.accSmooth[0] / (ACC_1G / 100)); + break; + case 1: + FrSkySport_sendValue(FRSKY_SPORT_ACCY_ID, imu.accSmooth[1] / (ACC_1G / 100)); + break; + case 2: + FrSkySport_sendValue(FRSKY_SPORT_ACCZ_ID, imu.accSmooth[2] / (ACC_1G / 100)); + break; } + _currentACCValue = ++_currentACCValue % 3; + #endif + } - void FrSkySport_sendAltVario() + void FrSkySport_MAGHeading() { - #ifdef VARIOMETER - FrSkySport_sendValue(FRSKY_SPORT_VARIO_ID, ((uint32_t)alt.vario)); // unknown unit + #ifdef MAG + FrSkySport_sendValue(FRSKY_SPORT_GPS_COURS_ID, (uint32_t)(att.heading + 360) % 360 * 100); // 1 deg = 100, 0 - 359000 #endif } void init_telemetry(void) { + #ifdef ACC + _currentACCValue = 0; + #endif + #ifdef BARO + _currentVarioValue = 0; + #endif + #if GPS _currentGPSValue = 0; + _currentRPMValue = 0; + #endif + #ifdef VBAT_CELLS + _currentFLVSSValue = 0; + #endif + #ifdef VBAT || POWERMETER + _currentFCSValue = 0; + #endif SerialOpen(TELEMETRY_SERIAL,TELEMETRY_BAUD); } @@ -612,38 +729,34 @@ void run_telemetry(void) int rx = SerialRead(TELEMETRY_SERIAL); if (lastRx == FRSKY_START_STOP) { - debug[1] = rx; switch (rx) { - case FRSKY_SPORT_DEVICE_4: - FrSkySport_sendA2voltage(); - break; - case FRSKY_SPORT_DEVICE_8: - FrSkySport_sendACCX(); + case FRSKY_SPORT_DEVICE_VARIO: // Variometer + FrSkySport_Vario(); break; - case FRSKY_SPORT_DEVICE_9: - FrSkySport_sendACCY(); + case FRSKY_SPORT_DEVICE_FLVSS: // FLVSS + FrSkySport_FLVSS(); break; - case FRSKY_SPORT_DEVICE_10: - FrSkySport_sendACCZ(); + case FRSKY_SPORT_DEVICE_FCS: // FCS-40A/FCS-150A + FrSkySport_FCS(); break; - case FRSKY_SPORT_DEVICE_11: - FrSkySport_sendAltitude(); + case FRSKY_SPORT_DEVICE_GPS: // GPS + FrSkySport_GPS(); break; - case FRSKY_SPORT_DEVICE_12: - FrSkySport_sendAltVario(); + case FRSKY_SPORT_DEVICE_RPM: // RPM + FrSkySport_RPM(); // provides num sat and distance to home break; - case FRSKY_SPORT_DEVICE_13: - FrSkySport_sendHeading(); + //case FRSKY_SPORT_DEVICE_SP2UART: // S.Port tu UART TODO + // FrSkySport_SP2UART(); // provides 2 temperatures + // break; + //case FRSKY_SPORT_DEVICE_ASS: // ASS TODO + // FrSkySport_ASS(); + // break; + case FRSKY_SPORT_DEVICE_ACC: // ACC + FrSkySport_ACC(); break; - case FRSKY_SPORT_DEVICE_14: - FrSkySport_sendGPSSpeed(); - break; - case FRSKY_SPORT_DEVICE_15: - FrSkySport_sendGPSAltitude(); - break; - case FRSKY_SPORT_DEVICE_16: - FrSkySport_sendGPSCoordinate(); + case FRSKY_SPORT_DEVICE_MAG: // MAG heading implemented as second GPS device + FrSkySport_MAGHeading(); break; } } @@ -651,4 +764,4 @@ void run_telemetry(void) } } #endif // S.PORT telemetry - + diff --git a/Telemetry.h b/Telemetry.h index 8d449e30..13292fc7 100644 --- a/Telemetry.h +++ b/Telemetry.h @@ -64,59 +64,120 @@ #define FRSKY_STUFF_MASK 0x20 // FrSky data IDs (2 bytes) - #define FRSKY_SPORT_RSSI_ID 0xf101 - #define FRSKY_SPORT_ADC1_ID 0xf102 // A1 - #define FRSKY_SPORT_ADC2_ID 0xf103 // A2 - #define FRSKY_SPORT_BATT_ID 0xf104 - #define FRSKY_SPORT_SWR_ID 0xf105 - #define FRSKY_SPORT_T1_ID 0x0400 - #define FRSKY_SPORT_T2_ID 0x0410 - #define FRSKY_SPORT_RPM_ID 0x0500 + #define FRSKY_SPORT_ALT_ID 0x0100 // used by Vario + #define FRSKY_SPORT_VARIO_ID 0x0110 // used by vario + #define FRSKY_SPORT_CURR_ID 0x0200 // used by FCS + #define FRSKY_SPORT_VFAS_ID 0x0210 // used by FCS + #define FRSKY_SPORT_CELLS_ID 0x0300 // used by FLVSS + #define FRSKY_SPORT_T1_ID 0x0400 // used by RPM + #define FRSKY_SPORT_T2_ID 0x0410 // used by RPM + #define FRSKY_SPORT_RPM_ID 0x0500 // used by RPM #define FRSKY_SPORT_FUEL_ID 0x0600 - #define FRSKY_SPORT_ALT_ID 0x0100 - #define FRSKY_SPORT_VARIO_ID 0x0110 #define FRSKY_SPORT_ACCX_ID 0x0700 #define FRSKY_SPORT_ACCY_ID 0x0710 #define FRSKY_SPORT_ACCZ_ID 0x0720 - #define FRSKY_SPORT_CURR_ID 0x0200 - #define FRSKY_SPORT_VFAS_ID 0x0210 - #define FRSKY_SPORT_CELLS_ID 0x0300 - #define FRSKY_SPORT_GPS_LONG_LATI_ID 0x0800 - #define FRSKY_SPORT_GPS_ALT_ID 0x0820 - #define FRSKY_SPORT_GPS_SPEED_ID 0x0830 - #define FRSKY_SPORT_GPS_COURS_ID 0x0840 - #define FRSKY_SPORT_GPS_TIME_DATE_ID 0x0850 + #define FRSKY_SPORT_GPS_LONG_LATI_ID 0x0800 // used by GPS + #define FRSKY_SPORT_GPS_ALT_ID 0x0820 // used by GPS + #define FRSKY_SPORT_GPS_SPEED_ID 0x0830 // used by GPS + #define FRSKY_SPORT_GPS_COURS_ID 0x0840 // used by GPS + #define FRSKY_SPORT_GPS_TIME_DATE_ID 0x0850 // used by GPS + #define FRSKY_SPORT_ADC3_ID 0x0900 // used by SP2UART + #define FRSKY_SPORT_ADC4_ID 0x0910 // used by SP2UART + #define FRSKY_SPORT_AIR_SPEED_ID 0x0a00 // used by ASS + #define FRSKY_SPORT_RSSI_ID 0xf101 // used by rx + #define FRSKY_SPORT_ADC1_ID 0xf102 // used by rx + #define FRSKY_SPORT_ADC2_ID 0xf103 // used by rx + #define FRSKY_SPORT_BATT_ID 0xf104 // used by rx + #define FRSKY_SPORT_SWR_ID 0xf105 // used by tx // FrSky sensor IDs (this also happens to be the order in which they're broadcast from an X8R) // NOTE: As FrSky puts out more sensors let's try to add comments here indicating which is which - #define FRSKY_SPORT_DEVICE_1 0xa1 - #define FRSKY_SPORT_DEVICE_2 0x22 - #define FRSKY_SPORT_DEVICE_3 0x83 - #define FRSKY_SPORT_DEVICE_4 0xe4 - #define FRSKY_SPORT_DEVICE_5 0x45 - #define FRSKY_SPORT_DEVICE_6 0xc6 - #define FRSKY_SPORT_DEVICE_7 0x67 - #define FRSKY_SPORT_DEVICE_8 0x48 - #define FRSKY_SPORT_DEVICE_9 0xe9 - #define FRSKY_SPORT_DEVICE_10 0x6a - #define FRSKY_SPORT_DEVICE_11 0xcb - #define FRSKY_SPORT_DEVICE_12 0xac - #define FRSKY_SPORT_DEVICE_13 0xd - #define FRSKY_SPORT_DEVICE_14 0x8e - #define FRSKY_SPORT_DEVICE_15 0x2f - #define FRSKY_SPORT_DEVICE_16 0xd0 - #define FRSKY_SPORT_DEVICE_17 0x71 - #define FRSKY_SPORT_DEVICE_18 0xf2 - #define FRSKY_SPORT_DEVICE_19 0x53 - #define FRSKY_SPORT_DEVICE_20 0x34 - #define FRSKY_SPORT_DEVICE_21 0x95 - #define FRSKY_SPORT_DEVICE_22 0x16 - #define FRSKY_SPORT_DEVICE_23 0xb7 - #define FRSKY_SPORT_DEVICE_24 0x98 - #define FRSKY_SPORT_DEVICE_25 0x39 - #define FRSKY_SPORT_DEVICE_26 0xba - #define FRSKY_SPORT_DEVICE_27 0x1b + #define FRSKY_SPORT_DEVICE_1 0x00 // Variometer + #define FRSKY_SPORT_DEVICE_2 0xa1 // FLVSS + #define FRSKY_SPORT_DEVICE_3 0x22 // FCS + #define FRSKY_SPORT_DEVICE_4 0x83 // GSP + #define FRSKY_SPORT_DEVICE_5 0xe4 // RPM + #define FRSKY_SPORT_DEVICE_6 0x45 + #define FRSKY_SPORT_DEVICE_7 0xc6 // SP2UART + #define FRSKY_SPORT_DEVICE_8 0x67 + #define FRSKY_SPORT_DEVICE_9 0x48 + #define FRSKY_SPORT_DEVICE_10 0xe9 // ASS + #define FRSKY_SPORT_DEVICE_11 0x6a + #define FRSKY_SPORT_DEVICE_12 0xcb + #define FRSKY_SPORT_DEVICE_13 0xac + #define FRSKY_SPORT_DEVICE_14 0xd + #define FRSKY_SPORT_DEVICE_15 0x8e + #define FRSKY_SPORT_DEVICE_16 0x2f + #define FRSKY_SPORT_DEVICE_17 0xd0 + #define FRSKY_SPORT_DEVICE_18 0x71 + #define FRSKY_SPORT_DEVICE_19 0xf2 + #define FRSKY_SPORT_DEVICE_20 0x53 + #define FRSKY_SPORT_DEVICE_21 0x34 + #define FRSKY_SPORT_DEVICE_22 0x95 + #define FRSKY_SPORT_DEVICE_23 0x16 + #define FRSKY_SPORT_DEVICE_24 0xb7 + #define FRSKY_SPORT_DEVICE_25 0x98 // rx + #define FRSKY_SPORT_DEVICE_26 0x39 + #define FRSKY_SPORT_DEVICE_27 0xba // A2 on rx X4R + #define FRSKY_SPORT_DEVICE_28 0x1b + // Default IDs for simulated sensors + #define FRSKY_SPORT_DEVICE_VARIO FRSKY_SPORT_DEVICE_1 + #define FRSKY_SPORT_DEVICE_FLVSS FRSKY_SPORT_DEVICE_2 + #define FRSKY_SPORT_DEVICE_FCS FRSKY_SPORT_DEVICE_3 + #define FRSKY_SPORT_DEVICE_GPS FRSKY_SPORT_DEVICE_4 + #define FRSKY_SPORT_DEVICE_RPM FRSKY_SPORT_DEVICE_5 + #define FRSKY_SPORT_DEVICE_SP2UART FRSKY_SPORT_DEVICE_7 + #define FRSKY_SPORT_DEVICE_ASS FRSKY_SPORT_DEVICE_10 + #define FRSKY_SPORT_DEVICE_ACC FRSKY_SPORT_DEVICE_20 + #define FRSKY_SPORT_DEVICE_MAG FRSKY_SPORT_DEVICE_21 + + // Override default IDs + // Vario + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_VARIO + #undef FRSKY_SPORT_DEVICE_VARIO + #define FRSKY_SPORT_DEVICE_VARIO FRSKY_SPORT_OVERRIDE_DEVICE_VARIO + #endif + // FLVSS + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_FLVSS + #undef FRSKY_SPORT_DEVICE_FLVSS + #define FRSKY_SPORT_DEVICE_FLVSS FRSKY_SPORT_OVERRIDE_DEVICE_FLVSS + #endif + // FCS + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_FCS + #undef FRSKY_SPORT_DEVICE_FCS + #define FRSKY_SPORT_DEVICE_FCS FRSKY_SPORT_OVERRIDE_DEVICE_FCS + #endif + // GPS + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_GPS + #undef FRSKY_SPORT_DEVICE_GPS + #define FRSKY_SPORT_DEVICE_GPS FRSKY_SPORT_OVERRIDE_DEVICE_GPS + #endif + // RPM + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_RPM + #undef FRSKY_SPORT_DEVICE_RPM + #define FRSKY_SPORT_DEVICE_RPM FRSKY_SPORT_OVERRIDE_DEVICE_RPM + #endif + // SP2UART + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_SP2UART + #undef FRSKY_SPORT_DEVICE_SP2UART + #define FRSKY_SPORT_DEVICE_SP2UART FRSKY_SPORT_OVERRIDE_DEVICE_SP2UART + #endif + // ASS + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_ASS + #undef FRSKY_SPORT_DEVICE_ASS + #define FRSKY_SPORT_DEVICE_ASS FRSKY_SPORT_OVERRIDE_DEVICE_ASS + #endif + // ACC + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_ACC + #undef FRSKY_SPORT_DEVICE_ACC + #define FRSKY_SPORT_DEVICE_ACC FRSKY_SPORT_OVERRIDE_DEVICE_ACC + #endif + // MAG + #ifdef FRSKY_SPORT_OVERRIDE_DEVICE_MAG + #undef FRSKY_SPORT_DEVICE_MAG + #define FRSKY_SPORT_DEVICE_MAG FRSKY_SPORT_OVERRIDE_DEVICE_MAG + #endif #endif // S.PORT telemetry // Variables @@ -126,4 +187,4 @@ extern uint32_t armedTime; void init_telemetry(void); void run_telemetry(void); #endif /* TELEMETRY_H_ */ - + diff --git a/config.h b/config.h index dffdfa1e..893613e1 100644 --- a/config.h +++ b/config.h @@ -884,7 +884,14 @@ Also note, that maqgnetic declination changes with time, so recheck your value e //#define FRSKY_TELEMETRY // used for FRSKY twoway receivers with telemetry (D-series like D8R-II or D8R-XP) // VBAT, Baro, MAG, GPS and POWERMETER are helpful // VBAT_CELLS is optional for a forth screen on the display FLD-02 - //#define SPORT_TELEMETRY // for FRSKY twoway receivers with S.PORT telemetry (S-series like X4R/X6R/X8R), not implemented yet - TO BE DONE + //#define SPORT_TELEMETRY // for FRSKY twoway receivers with S.PORT telemetry (X-series like X4R/X6R/X8R) + // definitions simulated sensor + // Baro, VARIO -> Vario + // VBAT,POWERMETER -> FCS + // VBAT_CELLS -> FLVSS + // GPS -> GPS + // ACC -> ACC + // MAG -> heading via second GPS // FRSKY common entries - valid for both protocols #define TELEMETRY_SERIAL 3 // change if required @@ -902,7 +909,16 @@ Also note, that maqgnetic declination changes with time, so recheck your value e //#define TELEMETRY_COURSE_GPS // send GPS based course/heading, don't use together with TELEMETRY_COURSE_MAG, FLD-02 does not display // S.PORT specific entries - #define FRSKY_SPORT_A2_MAX 124 // A2 voltage is represented by a value in the range 0-255. A value of 16 results in 1.6V, 124 is 12.4V, etc + // Override default simulated sensor ID. Usefull if you have hardware sensors with same ID installed. + //#define FRSKY_SPORT_OVERRIDE_DEVICE_VARIO FRSKY_SPORT_DEVICE_1 // default 1 + //#define FRSKY_SPORT_OVERRIDE_DEVICE_FLVSS FRSKY_SPORT_DEVICE_2 // default 2 + //#define FRSKY_SPORT_OVERRIDE_DEVICE_FCS FRSKY_SPORT_DEVICE_3 // default 3 + //#define FRSKY_SPORT_OVERRIDE_DEVICE_GPS FRSKY_SPORT_DEVICE_4 // default 4 + //#define FRSKY_SPORT_OVERRIDE_DEVICE_RPM FRSKY_SPORT_DEVICE_5 // default 5 + //#define FRSKY_SPORT_OVERRIDE_DEVICE_SP2UART FRSKY_SPORT_DEVICE_7 // default 7 - TODO + //#define FRSKY_SPORT_OVERRIDE_DEVICE_ASS FRSKY_SPORT_DEVICE_10 // default 10 - TODO + //#define FRSKY_SPORT_OVERRIDE_DEVICE_ACC FRSKY_SPORT_DEVICE_20 // default 20 - no hardware sensor yet + //#define FRSKY_SPORT_OVERRIDE_DEVICE_MAG FRSKY_SPORT_DEVICE_21 // default 21 - no hardware sensor yet /********************************************************************/ /**** Buzzer ****/ @@ -1228,4 +1244,4 @@ Also note, that maqgnetic declination changes with time, so recheck your value e /*************************************************************************************************/ #endif /* CONFIG_H_ */ - +