summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2024-01-04 20:05:15 -0500
committerScott Murray <scott.murray@konsulko.com>2024-01-04 20:05:15 -0500
commit5588d1d26f1be968af6809e43507d7be0fadf434 (patch)
treedd60d2cad95a69b5e9fa8877fd2fff86c69fb15a /lib
parent2d395f4431ba4aa5055d02437463588f4d4c8127 (diff)
Tweak idle speed in hybrid animation logic
To improve the behavior with our simple CAN simulator script and agl-demo-control-panel, tweak the hybrid animation logic to treat 600 rpm as the threshold for idling, instead of using 0. This should trigger the battery charging animation more often in the demo scenarios. Bug-AGL: SPEC-5027 Change-Id: I1578c39e220c5d2943959194640ade4219bc2b1b Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/data/data_providers/hybrid_notifier.dart32
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/data/data_providers/hybrid_notifier.dart b/lib/data/data_providers/hybrid_notifier.dart
index 7381f5c..51a65fe 100644
--- a/lib/data/data_providers/hybrid_notifier.dart
+++ b/lib/data/data_providers/hybrid_notifier.dart
@@ -9,20 +9,20 @@ class HybridNotifier extends StateNotifier<Hybrid> {
switch (hybridState) {
case HybridState.idle:
state = state.copyWith(
- hybridState: hybridState,
- topArrowState: ArrowState.blue,
- leftArrowState: ArrowState.blue,
- rightArrowState: ArrowState.blue,
- batteryState: BatteryState.white,
+ hybridState: hybridState,
+ topArrowState: ArrowState.blue,
+ leftArrowState: ArrowState.blue,
+ rightArrowState: ArrowState.blue,
+ batteryState: BatteryState.white,
);
break;
case HybridState.engineOutput:
state = state.copyWith(
- hybridState: hybridState,
- topArrowState: ArrowState.red,
- leftArrowState: ArrowState.red,
- rightArrowState: ArrowState.blue,
- batteryState: BatteryState.red,
+ hybridState: hybridState,
+ topArrowState: ArrowState.red,
+ leftArrowState: ArrowState.red,
+ rightArrowState: ArrowState.blue,
+ batteryState: BatteryState.red,
);
break;
case HybridState.regenerativeBreaking:
@@ -31,8 +31,7 @@ class HybridNotifier extends StateNotifier<Hybrid> {
topArrowState: ArrowState.blue,
leftArrowState: ArrowState.blue,
rightArrowState: ArrowState.green,
- batteryState: BatteryState.green
- );
+ batteryState: BatteryState.green);
break;
case HybridState.batteryOutput:
state = state.copyWith(
@@ -40,8 +39,7 @@ class HybridNotifier extends StateNotifier<Hybrid> {
topArrowState: ArrowState.blue,
leftArrowState: ArrowState.blue,
rightArrowState: ArrowState.yellow,
- batteryState: BatteryState.yellow
- );
+ batteryState: BatteryState.yellow);
break;
default:
state = state.copyWith(hybridState: hybridState);
@@ -61,11 +59,11 @@ class HybridNotifier extends StateNotifier<Hybrid> {
// Variable for storing the average value of RPM
double avgRpm = 0.0;
-
- if (speed == 0 && engineSpeed == 0) {
+
+ if (speed == 0 && engineSpeed <= 600) {
// Set idle state.
currentState = HybridState.idle;
- } else if (engineSpeed > 0 && speed > 0) {
+ } else if (engineSpeed > 600 && speed > 0) {
// Set engine output state..
currentState = HybridState.engineOutput;
} else if (speed < 0 && brake) {