Issue #708 fixed (Bugs in Telemetry and Logical Switches)

This commit is contained in:
Bertrand Songis
2014-02-15 20:38:01 +01:00
parent 52dff725c1
commit 79e86c249a
5 changed files with 19 additions and 10 deletions
+8 -7
View File
@@ -1484,17 +1484,18 @@ bool getSwitch(int8_t swtch)
}
}
else {
uint8_t v1 = cs->v1;
#if defined(FRSKY)
// Telemetry
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
if ((!TELEMETRY_STREAMING() && cs->v1 >= MIXSRC_FIRST_TELEM+TELEM_FIRST_STREAMED_VALUE-1) || IS_FAI_FORBIDDEN(cs->v1-1))
if (v1 >= MIXSRC_FIRST_TELEM) {
if ((!TELEMETRY_STREAMING() && v1 >= MIXSRC_FIRST_TELEM+TELEM_FIRST_STREAMED_VALUE-1) || IS_FAI_FORBIDDEN(v1-1))
return swtch > 0 ? false : true;
y = convertCswTelemValue(cs);
#if defined(FRSKY_HUB) && defined(GAUGES)
if (s == LS_FAMILY_OFS) {
uint8_t idx = cs->v1-MIXSRC_FIRST_TELEM+1-TELEM_ALT;
uint8_t idx = v1-MIXSRC_FIRST_TELEM+1-TELEM_ALT;
if (idx < THLD_MAX) {
// Fill the threshold array
barsThresholds[idx] = 128 + cs->v2;
@@ -1502,17 +1503,17 @@ bool getSwitch(int8_t swtch)
}
#endif
}
else if (cs->v1 >= MIXSRC_GVAR1) {
else if (v1 >= MIXSRC_GVAR1) {
y = cs->v2;
}
else {
y = calc100toRESX(cs->v2);
}
#else
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
if (v1 >= MIXSRC_FIRST_TELEM) {
y = (int16_t)3 * (128+cs->v2); // it's a Timer
}
else if (cs->v1 >= MIXSRC_GVAR1) {
else if (v1 >= MIXSRC_GVAR1) {
y = cs->v2; // it's a GVAR
}
else {
@@ -1523,7 +1524,7 @@ bool getSwitch(int8_t swtch)
switch (cs->func) {
case LS_FUNC_VEQUAL:
#if defined(GVARS)
if (cs->v1 >= MIXSRC_GVAR1 && cs->v1 <= MIXSRC_LAST_GVAR)
if (v1 >= MIXSRC_GVAR1 && v1 <= MIXSRC_LAST_GVAR)
result = (x==y);
else
#endif
+2
View File
@@ -139,6 +139,8 @@ PACK(struct FrskySerialData {
int16_t maxTemperature2;
uint16_t maxGpsSpeed;
uint16_t maxGpsDistance;
int16_t minCell;
int16_t minVfas;
uint16_t maxCurrent;
uint16_t maxPower;
/* end */
+6 -2
View File
@@ -214,8 +214,8 @@ void processHubPacket(uint8_t id, uint16_t value)
#else
frskyData.hub.vfas = ((frskyData.hub.volts_bp * 100 + frskyData.hub.volts_ap * 10) * 21) / 110;
#endif
/* TODO later if (!frskyData.hub.minVfas || frskyData.hub.minVfas > frskyData.hub.vfas)
frskyData.hub.minVfas = frskyData.hub.vfas; */
if (!frskyData.hub.minVfas || frskyData.hub.vfas < frskyData.hub.minVfas)
frskyData.hub.minVfas = frskyData.hub.vfas;
break;
case BARO_ALT_AP_ID:
@@ -268,6 +268,8 @@ void processHubPacket(uint8_t id, uint16_t value)
if (!frskyData.hub.minCellVolts || cellVolts < frskyData.hub.minCellVolts || battnumber==frskyData.hub.minCellIdx) {
frskyData.hub.minCellIdx = battnumber;
frskyData.hub.minCellVolts = cellVolts;
if (!frskyData.hub.minCell || frskyData.hub.minCellVolts < frskyData.hub.minCell)
frskyData.hub.minCell = frskyData.hub.minCellVolts;
}
}
break;
@@ -761,6 +763,8 @@ void resetTelemetry()
frskyData.rssi[1].value = 30;
frskyData.hub.fuelLevel = 75;
frskyData.hub.rpm = 12000;
frskyData.hub.vfas = 100;
frskyData.hub.minVfas = 90;
frskyData.hub.gpsFix = 1;
frskyData.hub.gpsLatitude_bp = 4401;
+2
View File
@@ -123,6 +123,8 @@ PACK(struct FrskySerialData {
int16_t maxTemperature2;
uint16_t maxGpsSpeed;
uint16_t maxGpsDistance;
int16_t minCell;
int16_t minVfas;
uint16_t maxCurrent;
uint16_t maxPower;
/* end */
+1 -1
View File
@@ -261,7 +261,7 @@
#define TR_RSSI_0 "Tx\0 "
#define TR_RSSI_1 "Rx\0 "
#endif
#define TR_VTELEMCHNS "---\0""Batt""Tmr1""Tmr2" TR_RSSI_0 TR_RSSI_1 "A1\0 ""A2\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Cels""Vfas""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""ASpd""dTE\0""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cel-""Vfs-""Cel-""Vfs-""Cur+""Pwr+""Acc\0""Time"
#define TR_VTELEMCHNS "---\0""Batt""Tmr1""Tmr2" TR_RSSI_0 TR_RSSI_1 "A1\0 ""A2\0 ""Alt\0""Rpm\0""Fuel""T1\0 ""T2\0 ""Spd\0""Dist""GAlt""Cell""Cels""Vfas""Curr""Cnsp""Powr""AccX""AccY""AccZ""Hdg\0""VSpd""ASpd""dTE\0""A1-\0""A2-\0""Alt-""Alt+""Rpm+""T1+\0""T2+\0""Spd+""Dst+""Cel-""Vfs-""Cur+""Pwr+""Acc\0""Time"
#if defined(CPUARM)
#define LEN_VUNITSSYSTEM TR("\006", "\010")