1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 00:05:17 +03:00

[FrSky] Support of old FAS prototypes (different resistors)

This commit is contained in:
Bertrand Songis 2016-04-30 19:33:00 +02:00
parent 1f7485ed91
commit d8736bfe94
3 changed files with 12 additions and 3 deletions

View file

@ -22,6 +22,7 @@ option(JITTER_FILTER "Enable ADC jitter filtering" ON)
option(WATCHDOG_DISABLED "Disable hardware Watchdog on Horus" OFF) # TODO remove it when it's OK
option(SIMU_AUDIO "Enable simulator audio" OFF)
option(SIMU_DISKIO "Enable disk IO simulation in simulator. Simulator will use FatFs module and simulated IO layer that uses \"./sdcard.image\" file as image of SD card. This file must contain whole SD card from first to last sector" OFF)
option(FAS_PROTOTYPE "Support of old FAS prototypes (different resistors)" OFF)
enable_language(ASM)
set(OPT s)
@ -850,6 +851,10 @@ elseif(FAI STREQUAL CHOICE)
add_definitions(-DFAI_CHOICE)
endif()
if(FAS_PROTOTYPE)
add_definitions(-DFAS_PROTOTYPE)
endif()
if(AUTOSOURCE)
add_definitions(-DAUTOSOURCE)
endif()

View file

@ -18,7 +18,7 @@
* GNU General Public License for more details.
*/
#include "../opentx.h"
#include "opentx.h"
#if (defined(FRSKY_HUB) || defined(WS_HOW_HIGH))
void checkMinMaxAltitude()
@ -130,10 +130,10 @@ void parseTelemHubByte(uint8_t byte)
break;
case offsetof(FrskyTelemetryData, volts_ap):
#if defined(FAS_BSS)
#if defined(FAS_PROTOTYPE)
telemetryData.hub.vfas = (telemetryData.hub.volts_bp * 10 + telemetryData.hub.volts_ap);
#else
telemetryData.hub.vfas = ((telemetryData.hub.volts_bp * 100 + telemetryData.hub.volts_ap * 10) * 21) / 110;
telemetryData.hub.vfas = ((telemetryData.hub.volts_bp * 10 + telemetryData.hub.volts_ap) * 21) / 11;
#endif
/* TODO later if (!telemetryData.hub.minVfas || telemetryData.hub.minVfas > telemetryData.hub.vfas)
telemetryData.hub.minVfas = telemetryData.hub.vfas; */

View file

@ -207,7 +207,11 @@ void processHubPacket(uint8_t id, int16_t value)
}
else if (id == VOLTS_AP_ID) {
if (lastId == VOLTS_BP_ID) {
#if defined(FAS_PROTOTYPE)
data = lastBPValue * 100 + value * 10;
#else
data = ((lastBPValue * 100 + value * 10) * 210) / 110;
#endif
unit = UNIT_VOLTS;
precision = 2;
}