Skip to content

Commit

Permalink
Add laptop battery support (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle authored May 10, 2024
1 parent 9110903 commit 469e359
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion qml/ui/widgets/GroundPowerWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,19 @@ BaseWidget {

onTriggered: {
var currentVoltage = _ohdSystemGround.ina219_voltage_millivolt;
if (_ohdSystemGround.ina219_current_milliamps===1338) {
var percentage = _ohdSystemGround.ina219_voltage_millivolt;
battery_volt_text.visible= false;
battery_amp_text.visible=false;
}
else if (_ohdSystemGround.ina219_current_milliamps===1337) {
var percentage = _ohdSystemGround.ina219_voltage_millivolt;
battery_volt_text.visible= false;
battery_amp_text.visible= false;
}
else {
var percentage = calculateBatteryPercentage(currentVoltage);
}
settings.ground_voltage_in_percent = percentage;
}
}
Expand Down Expand Up @@ -244,7 +256,10 @@ BaseWidget {

// Define symbols based on battery level
var symbol;
if (percent < 10) {
if (_ohdSystemGround.ina219_current_milliamps===1337) {
symbol = "\uF084"; // Charging
}
else if (percent < 10) {
symbol = "\uf07a"; // Change the symbol for battery level below 10%
} else if (percent < 20) {
symbol = "\uf07b"; // Change the symbol for battery level below 20%
Expand Down

0 comments on commit 469e359

Please sign in to comment.