diff options
author | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-05-14 17:04:28 +0900 |
---|---|---|
committer | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-05-14 17:04:28 +0900 |
commit | 701f1ff00b3b6cf5f5a50b4cf3f65e176cb26460 (patch) | |
tree | 0a5978ce85085f52357531cb5438d3ec1f47afe2 /src/policy_manager/zipc | |
parent | b126caef1760902eb863af8ea892c4db9b9663f9 (diff) |
Change the policy of switchng car run/stop in dummy stm
Change-Id: Ie3770060828f32749e7c47076d901263454e43c2
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager/zipc')
-rw-r--r-- | src/policy_manager/zipc/dummy_stm.c | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c index f174866..d695486 100644 --- a/src/policy_manager/zipc/dummy_stm.c +++ b/src/policy_manager/zipc/dummy_stm.c @@ -110,6 +110,7 @@ const char* gStmLayoutNo2Name[] = { stm_state_t g_crr_state; stm_state_t g_prv_state; +int g_prv_restriction_state_car_stop = 0; int g_prv_apps_state_car_stop = 0; void stmInitialize() { @@ -379,19 +380,12 @@ int stmTransitionState(int event, stm_state_t* state) { break; case STM_EVT_NO_ACCEL_PEDAL_OFF: if (gStmAccelPedalStateNoOff != accel_pedal_state) { - g_crr_state.layer.apps.state = g_prv_apps_state_car_stop; - g_crr_state.layer.apps.is_changed = STM_TRUE; - g_crr_state.accel_pedal.state = gStmAccelPedalStateNoOff; g_crr_state.accel_pedal.is_changed = STM_TRUE; } break; case STM_EVT_NO_ACCEL_PEDAL_ON: if (gStmAccelPedalStateNoOn != accel_pedal_state) { - g_prv_apps_state_car_stop = apps_state; - g_crr_state.layer.apps.state = gStmLayoutNoM1; - g_crr_state.layer.apps.is_changed = STM_TRUE; - g_crr_state.accel_pedal.state = gStmAccelPedalStateNoOn; g_crr_state.accel_pedal.is_changed = STM_TRUE; } @@ -432,6 +426,44 @@ int stmTransitionState(int event, stm_state_t* state) { break; } + // Set car state + if (g_crr_state.parking_brake.is_changed + || g_crr_state.accel_pedal.is_changed) { + if ((gStmParkingBrakeStateNoOff == g_crr_state.parking_brake.state) + && (gStmAccelPedalStateNoOn == g_crr_state.accel_pedal.state)){ + if (gStmCarStateNoRun != car_state) { + // Car state is changed stop -> run + g_crr_state.car.state = gStmCarStateNoRun; + g_crr_state.car.is_changed = STM_TRUE; + + // Update restriction layer + g_prv_restriction_state_car_stop = restriction_state; + g_crr_state.layer.restriction.state = gStmLayoutNoNone; + g_crr_state.layer.restriction.is_changed = STM_TRUE; + + // Update apps layer + g_prv_apps_state_car_stop = apps_state; + g_crr_state.layer.apps.state = gStmLayoutNoM1; + g_crr_state.layer.apps.is_changed = STM_TRUE; + } + } + else { + if (gStmCarStateNoStop != car_state) { + // Car state is changed run -> stop + g_crr_state.car.state = gStmCarStateNoStop; + g_crr_state.car.is_changed = STM_TRUE; + + // Update restriction layer + g_crr_state.layer.restriction.state = g_prv_restriction_state_car_stop; + g_crr_state.layer.restriction.is_changed = STM_TRUE; + + // Update apps layer + g_crr_state.layer.apps.state = g_prv_apps_state_car_stop; + g_crr_state.layer.apps.is_changed = STM_TRUE; + } + } + } + // Copy current state for return memcpy(state, &g_crr_state, sizeof(g_crr_state)); |