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:
@@ -428,9 +428,10 @@ void telemetryWakeup()
|
|||||||
|
|
||||||
void telemetryInterrupt10ms()
|
void telemetryInterrupt10ms()
|
||||||
{
|
{
|
||||||
|
#if defined(CPUARM)
|
||||||
uint16_t voltage = frskyData.hub.cellsSum; /* unit: 1/10 volts */
|
uint16_t voltage = frskyData.hub.cellsSum; /* unit: 1/10 volts */
|
||||||
|
#elif defined(FRSKY_HUB)
|
||||||
#if defined(FRSKY_HUB)
|
uint16_t voltage = 0; /* unit: 1/10 volts */
|
||||||
for (uint8_t i=0; i<frskyData.hub.cellsCount; i++)
|
for (uint8_t i=0; i<frskyData.hub.cellsCount; i++)
|
||||||
voltage += frskyData.hub.cellVolts[i];
|
voltage += frskyData.hub.cellVolts[i];
|
||||||
voltage /= (10 / TELEMETRY_CELL_VOLTAGE_MUTLIPLIER);
|
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
|
// 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)
|
void frskySetCellsCount(uint8_t cellscount)
|
||||||
{
|
{
|
||||||
if (cellscount <= DIM(frskyData.hub.cellVolts)) {
|
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));
|
frskyCellVoltage_t cellVolts = (frskyCellVoltage_t) (((((frskyData.hub.volts & 0xFF00) >> 8) + ((frskyData.hub.volts & 0x000F) << 8))) / (5*TELEMETRY_CELL_VOLTAGE_MUTLIPLIER));
|
||||||
frskySetCellVoltage(battnumber, cellVolts);
|
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
|
#endif
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ PACK(struct FrskySerialData {
|
|||||||
uint16_t gpsDistance;
|
uint16_t gpsDistance;
|
||||||
int16_t gpsAltitudeOffset;
|
int16_t gpsAltitudeOffset;
|
||||||
uint8_t varioAltitudeQueuePointer; // circular-buffer pointer
|
uint8_t varioAltitudeQueuePointer; // circular-buffer pointer
|
||||||
uint8_t cellsState;
|
uint8_t minCellIdx;
|
||||||
int16_t cellsSum;
|
int16_t cellsSum;
|
||||||
uint16_t currentConsumption; // 0x35 openXsensor only! Otherwise calculated by the Tx from current
|
uint16_t currentConsumption; // 0x35 openXsensor only! Otherwise calculated by the Tx from current
|
||||||
uint16_t currentPrescale;
|
uint16_t currentPrescale;
|
||||||
|
|||||||
@@ -215,10 +215,8 @@ void parseTelemHubByte(uint8_t byte)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case offsetof(FrskySerialData, volts):
|
case offsetof(FrskySerialData, volts):
|
||||||
{
|
|
||||||
frskyUpdateCells();
|
frskyUpdateCells();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(GPS)
|
#if defined(GPS)
|
||||||
case offsetof(FrskySerialData, hour):
|
case offsetof(FrskySerialData, hour):
|
||||||
|
|||||||
Reference in New Issue
Block a user