200 extra bytes used on 9x with FRSKY_HUB option. I return to previous

implementation. Only ARM boards will have the extra features.
This commit is contained in:
bsongis
2014-07-08 11:38:47 +02:00
parent cf546a2341
commit f8efcf420a
3 changed files with 24 additions and 6 deletions
+23 -3
View File
@@ -428,9 +428,10 @@ void telemetryWakeup()
void telemetryInterrupt10ms()
{
#if defined(CPUARM)
uint16_t voltage = frskyData.hub.cellsSum; /* unit: 1/10 volts */
#if defined(FRSKY_HUB)
#elif defined(FRSKY_HUB)
uint16_t voltage = 0; /* unit: 1/10 volts */
for (uint8_t i=0; i<frskyData.hub.cellsCount; i++)
voltage += frskyData.hub.cellVolts[i];
voltage /= (10 / TELEMETRY_CELL_VOLTAGE_MUTLIPLIER);
@@ -609,7 +610,7 @@ void telemetryInit(void)
// we don't reset the telemetry here as we would also reset the consumption after model load
}
#if defined(CPUARM) || defined(FRSKY_HUB)
#if defined(CPUARM)
void frskySetCellsCount(uint8_t cellscount)
{
if (cellscount <= DIM(frskyData.hub.cellVolts)) {
@@ -671,4 +672,23 @@ void frskyUpdateCells(void)
frskyCellVoltage_t cellVolts = (frskyCellVoltage_t) (((((frskyData.hub.volts & 0xFF00) >> 8) + ((frskyData.hub.volts & 0x000F) << 8))) / (5*TELEMETRY_CELL_VOLTAGE_MUTLIPLIER));
frskySetCellVoltage(battnumber, cellVolts);
}
#elif defined(FRSKY_HUB)
void frskyUpdateCells(void)
{
// 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;
}
uint8_t cellVolts = (uint8_t)(((((frskyData.hub.volts & 0xFF00) >> 8) + ((frskyData.hub.volts & 0x000F) << 8))) / 10);
frskyData.hub.cellVolts[battnumber] = cellVolts;
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;
}
}
}
#endif
+1 -1
View File
@@ -232,7 +232,7 @@ PACK(struct FrskySerialData {
uint16_t gpsDistance;
int16_t gpsAltitudeOffset;
uint8_t varioAltitudeQueuePointer; // circular-buffer pointer
uint8_t cellsState;
uint8_t minCellIdx;
int16_t cellsSum;
uint16_t currentConsumption; // 0x35 openXsensor only! Otherwise calculated by the Tx from current
uint16_t currentPrescale;
-2
View File
@@ -215,10 +215,8 @@ void parseTelemHubByte(uint8_t byte)
#endif
case offsetof(FrskySerialData, volts):
{
frskyUpdateCells();
break;
}
#if defined(GPS)
case offsetof(FrskySerialData, hour):