Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update battery voltage range #208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/src/data/metrics/drive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class DriveMetrics extends Metrics<DriveData> {
/// The severity for the electrical metrics.
Severity? get electricalSeverity {
if (data.batteryVoltage == 0) return null;
if (data.batteryVoltage <= 25) {
if (data.batteryVoltage <= 20) {
return Severity.critical;
} else if (data.batteryVoltage <= 26) {
} else if (data.batteryVoltage <= 22) {
return Severity.warning;
} else {
return null;
Expand Down Expand Up @@ -82,7 +82,7 @@ class DriveMetrics extends Metrics<DriveData> {
double get batteryVoltage => data.batteryVoltage;

/// The charge of the battery, as a percentage.
double get batteryPercentage => (batteryVoltage - 24) / 6; // 24-30 as a percentage
double get batteryPercentage => (batteryVoltage - 19) / (24.5 - 19); // 19-24.5 as a percentage

@override
Version get supportedVersion => Version(major: 1);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/data/metrics/vitals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class VitalsMetrics extends Metrics {
/// The severity of the [DriveData.batteryVoltage] readings.
Severity? get voltageSeverity {
if (drive.batteryVoltage == 0) return null;
if (drive.batteryVoltage <= 25) {
if (drive.batteryVoltage <= 20) {
return Severity.critical;
} else if (drive.batteryVoltage <= 26) {
} else if (drive.batteryVoltage <= 21.5) {
return Severity.warning;
} else {
return null;
Expand Down
Loading