summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2024-08-15 15:50:02 -0400
committerScott Murray <scott.murray@konsulko.com>2024-08-19 13:42:14 +0000
commite39bf6a1e3657542a56f21b3afa6a65ea0a194e2 (patch)
tree359f9b37525e164d7abe69705a342ff8a16c670f /lib
parentefe93cd680b82f1b577c5180846c502749476d79 (diff)
Fix engine speed signal type
Update use of the VSS engine speed (RPM) signal to match the fix done to the AGL VSS overlays to restore the upstream integer data type. Bug-AGL: SPEC-5204 Change-Id: I22bd80817088a67a2f62dab129920e19c949846a Signed-off-by: Scott Murray <scott.murray@konsulko.com> (cherry picked from commit 4a6dd91a1e1c7821eae1668449885a8c04825071)
Diffstat (limited to 'lib')
-rw-r--r--lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart8
-rw-r--r--lib/vehicle-signals/vehicle_status_provider.dart6
-rw-r--r--lib/vehicle-signals/vss_provider.dart4
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart b/lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart
index fa76bd8..b110a1a 100644
--- a/lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart
+++ b/lib/screen/widgets/gauges/rpm_gauge_animation_wrapper.dart
@@ -16,7 +16,7 @@ class RPMGauge extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
- final double rpm = ref.watch(vehicleStatusProvider.select((p) => p.rpm));
+ final int rpm = ref.watch(vehicleStatusProvider.select((p) => p.rpm));
const double minRPM = 0;
const double maxRPM = 8000;
@@ -25,7 +25,7 @@ class RPMGauge extends HookConsumerWidget {
final animationController = useAnimationController(
lowerBound: minRPM,
upperBound: maxRPM,
- )..animateTo(rpm,
+ )..animateTo(rpm.toDouble(),
duration: sweepDuration, curve: Curves.linearToEaseOut);
return AnimatedBuilder(
animation: animationController,
@@ -38,8 +38,8 @@ class RPMGauge extends HookConsumerWidget {
high: maxRPM,
mainValue: animationController.value,
label: "rpm",
- zeroTickLabel: minRPM.toInt().toString(),
- maxTickLabel: maxRPM.toInt().toString(),
+ zeroTickLabel: minRPM.toString(),
+ maxTickLabel: maxRPM.toString(),
inPrimaryColor: gaugeColor?.inPrimary,
outPrimaryColor: gaugeColor?.outPrimary,
secondaryColor: gaugeColor?.secondary,
diff --git a/lib/vehicle-signals/vehicle_status_provider.dart b/lib/vehicle-signals/vehicle_status_provider.dart
index 0c53b2d..da593cb 100644
--- a/lib/vehicle-signals/vehicle_status_provider.dart
+++ b/lib/vehicle-signals/vehicle_status_provider.dart
@@ -40,7 +40,7 @@ class VehicleStatus {
});
final double speed;
- final double rpm;
+ final int rpm;
final double fuelLevel;
final double coolantTemp;
final double cruiseControlSpeed;
@@ -73,7 +73,7 @@ class VehicleStatus {
VehicleStatus copyWith({
double? speed,
- double? rpm,
+ int? rpm,
double? fuelLevel,
double? coolantTemp,
bool? isLeftIndicator,
@@ -182,7 +182,7 @@ class VehicleStatusNotifier extends StateNotifier<VehicleStatus> {
);
void update({
double? speed,
- double? rpm,
+ int? rpm,
double? fuelLevel,
double? coolantTemp,
bool? isLeftIndicator,
diff --git a/lib/vehicle-signals/vss_provider.dart b/lib/vehicle-signals/vss_provider.dart
index 50a3b6b..5c62b96 100644
--- a/lib/vehicle-signals/vss_provider.dart
+++ b/lib/vehicle-signals/vss_provider.dart
@@ -71,8 +71,8 @@ class DashboardVssClient extends VssClient {
}
break;
case VSSPath.vehicleEngineRPM:
- if (update.entry.value.hasFloat()) {
- vehicleStatus.update(rpm: update.entry.value.float);
+ if (update.entry.value.hasUint32()) {
+ vehicleStatus.update(rpm: update.entry.value.uint32);
}
break;
case VSSPath.vehicleFuelLevel: