Skip to content

Commit

Permalink
Fix hardcoded 3S bat. levels used for gauge color
Browse files Browse the repository at this point in the history
Still need to expose the percentage function to QML like the todo in
the code mentions
  • Loading branch information
steveatinfincia committed Oct 17, 2019
1 parent b336fcc commit 18974c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion qml/ui/widgets/AirBatteryWidgetForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ BaseWidget {
y: 8
width: 36
height: 48
color: MavlinkTelemetry.battery_voltage_raw < 11.2 ? (MavlinkTelemetry.battery_voltage_raw < 10.9 ? "#ff0000" : "#fbfd15") : "#ffffff"
// @disable-check M223
color: {
// todo: expose battery_voltage_to_percent to QML instead of using cell levels here
// @disable-check M222
var cells = settings.value("show_ground_status", true);
var cellVoltage = MavlinkTelemetry.battery_voltage_raw / cells;
// 20% warning, 15% critical
return cellVoltage < 3.73 ? (cellVoltage < 3.71 ? "#ff0000" : "#fbfd15") : "#ffffff"
}
text: MavlinkTelemetry.battery_gauge
anchors.left: parent.left
anchors.leftMargin: 12
Expand Down

0 comments on commit 18974c8

Please sign in to comment.