Introduced frskyCellVoltage_t type and united code with frskyUpdateCells()

This commit is contained in:
Damjan Adamic
2014-07-02 12:57:36 +02:00
parent e6370ebb2a
commit 038365e639
4 changed files with 21 additions and 36 deletions
+1 -13
View File
@@ -216,19 +216,7 @@ void parseTelemHubByte(uint8_t byte)
case offsetof(FrskySerialData, volts):
{
// Voltage => Cell number + Cell voltage
uint8_t battnumber = ((frskyData.hub.volts & 0x00F0) >> 4);
if (battnumber < 12) {
if (frskyData.hub.cellsCount < battnumber+1) {
frskyData.hub.cellsCount = battnumber+1;
}
#if defined(CPUARM)
uint16_t cellVolts = (uint16_t)(((((frskyData.hub.volts & 0xFF00) >> 8) + ((frskyData.hub.volts & 0x000F) << 8))) / 5);
#else
uint8_t cellVolts = (uint8_t)(((((frskyData.hub.volts & 0xFF00) >> 8) + ((frskyData.hub.volts & 0x000F) << 8))) / 10);
#endif
frskySetCellVoltage(battnumber, cellVolts);
}
frskyUpdateCells();
break;
}