This commit is contained in:
bsongis
2015-06-14 23:16:19 +02:00
parent f4d1389c4d
commit fc492a7709
4 changed files with 49 additions and 14 deletions
+13 -1
View File
@@ -236,7 +236,19 @@ void processSportPacket(uint8_t *packet)
unit = sensor->unit;
precision = sensor->prec;
}
setTelemetryValue(TELEM_PROTO_FRSKY_SPORT, appId, dataId, data, unit, precision);
if (unit == UNIT_CELLS) {
uint8_t cellsCount = (data & 0xF0) >> 4;
uint8_t cellIndex = (data & 0x0F);
uint32_t mask = (cellsCount << 24) + (cellIndex << 16);
setTelemetryValue(TELEM_PROTO_FRSKY_SPORT, appId, dataId, mask + (((data & 0x000FFF00) >> 8) / 5), unit, precision);
if (cellIndex+1 < cellsCount) {
mask += (1 << 16);
setTelemetryValue(TELEM_PROTO_FRSKY_SPORT, appId, dataId, mask + (((data & 0xFFF00000) >> 20) / 5), unit, precision);
}
}
else {
setTelemetryValue(TELEM_PROTO_FRSKY_SPORT, appId, dataId, data, unit, precision);
}
}
}
}