feat: Support for 8s Cell Sensor such as FrSky FLVS ADV (#2302)
* first commit for FrSky 8s Lipo Sensor FLVS Advanced transfers up to 8 cell voltages for Cels sensor * correcting mistake made transferring local change to PR * complementary extension of Companion telemetry simulator to enable simulation of 8 cells * change to allow selection of cells 7 and 8 in calculated sensor with formula Cell * (cpn) Add bin and yml conversions and basic semantic version helper Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
@@ -442,6 +442,8 @@ void TelemetrySimulator::generateTelemetryFrame()
|
||||
cellValues[3] = ui->cell4->value();
|
||||
cellValues[4] = ui->cell5->value();
|
||||
cellValues[5] = ui->cell6->value();
|
||||
cellValues[6] = ui->cell7->value();
|
||||
cellValues[7] = ui->cell8->value();
|
||||
generateSportPacket(buffer, ui->cells_inst->text().toInt(&ok, 0) - 1, DATA_FRAME, CELLS_FIRST_ID, flvss->setAllCells_GetNextPair(cellValues));
|
||||
}
|
||||
else {
|
||||
@@ -547,6 +549,7 @@ void TelemetrySimulator::FlvssEmulator::encodeAllCells()
|
||||
cellData1 = encodeCellPair(numCells, 0, cellFloats[0], cellFloats[1]);
|
||||
if (numCells > 2) cellData2 = encodeCellPair(numCells, 2, cellFloats[2], cellFloats[3]); else cellData2 = 0;
|
||||
if (numCells > 4) cellData3 = encodeCellPair(numCells, 4, cellFloats[4], cellFloats[5]); else cellData3 = 0;
|
||||
if (numCells > 6) cellData4 = encodeCellPair(numCells, 6, cellFloats[6], cellFloats[7]); else cellData4 = 0;
|
||||
}
|
||||
|
||||
void TelemetrySimulator::FlvssEmulator::splitIntoCells(double totalVolts)
|
||||
@@ -564,7 +567,7 @@ void TelemetrySimulator::FlvssEmulator::splitIntoCells(double totalVolts)
|
||||
numCells = numCells > MAXCELLS ? MAXCELLS : numCells; // force into valid cell count in case of input out of range
|
||||
}
|
||||
|
||||
uint32_t TelemetrySimulator::FlvssEmulator::setAllCells_GetNextPair(double cellValues[6])
|
||||
uint32_t TelemetrySimulator::FlvssEmulator::setAllCells_GetNextPair(double cellValues[MAXCELLS])
|
||||
{
|
||||
numCells = 0;
|
||||
for (uint32_t i = 0; i < MAXCELLS; i++) {
|
||||
@@ -603,6 +606,9 @@ uint32_t TelemetrySimulator::FlvssEmulator::setAllCells_GetNextPair(double cellV
|
||||
case 4:
|
||||
cellData = cellData3;
|
||||
break;
|
||||
case 6:
|
||||
cellData = cellData4;
|
||||
break;
|
||||
}
|
||||
nextCellNum += 2;
|
||||
return cellData;
|
||||
@@ -1198,6 +1204,10 @@ void TelemetrySimulator::on_saveTelemetryvalues_clicked()
|
||||
out<<"\r\n";
|
||||
out << ui -> cell6 -> text();
|
||||
out<<"\r\n";
|
||||
out << ui -> cell7 -> text();
|
||||
out<<"\r\n";
|
||||
out << ui -> cell8 -> text();
|
||||
out<<"\r\n";
|
||||
out << ui -> aspeed -> text();
|
||||
out<<"\r\n";
|
||||
out << ui -> gps_alt -> text();
|
||||
@@ -1330,6 +1340,14 @@ void TelemetrySimulator::on_loadTelemetryvalues_clicked()
|
||||
ns = n.toDouble();
|
||||
ui -> cell6 -> setValue(ns);
|
||||
|
||||
n = in.readLine();
|
||||
ns = n.toDouble();
|
||||
ui -> cell7 -> setValue(ns);
|
||||
|
||||
n = in.readLine();
|
||||
ns = n.toDouble();
|
||||
ui -> cell8 -> setValue(ns);
|
||||
|
||||
n = in.readLine();
|
||||
ns = n.toDouble();
|
||||
ui -> aspeed -> setValue(ns);
|
||||
|
||||
Reference in New Issue
Block a user