Update initial checkup states

This commit is contained in:
Jasper Blanckenburg 2023-08-04 00:17:24 +02:00
parent a6c55d9869
commit 58ce5b06c6
4 changed files with 58 additions and 78 deletions

View File

@ -46,15 +46,23 @@ typedef enum {
INICHK_START = 0,
INICHK_WD_CHECK = 1,
INICHK_WD_OK = 2,
INICHK_ASB_CHECK_1 = 3,
INICHK_ASB_CHECK_2 = 4,
INICHK_WAIT_TS = 5,
INICHK_EBS_CHECK_A = 6,
INICHK_EBS_CHECK_B = 7,
INICHK_DONE = 8,
INICHK_ERROR = 9
INICHK_POS_CHK_1 = 3,
INICHK_ASB_CHECK_A_1 = 4,
INICHK_ASB_CHECK_A_2 = 5,
INICHK_SWITCH_B = 6,
INICHK_ASB_CHECK_B_1 = 7,
INICHK_ASB_CHECK_B_2 = 8,
INICHK_SWITCH_A = 9,
INICHK_ASB_CHECK_AB_1 = 10,
INICHK_ASB_CHECK_AB_2 = 11,
INICHK_POS_CHK_2 = 12,
INICHK_WAIT_TS = 13,
INICHK_DONE = 14,
INICHK_ERROR = 15
} IniChkState;
const char *inichkstate_str(IniChkState state);
typedef enum {
AMS_ERROR_NONE = 0x00,
AMS_ERROR_SLAVE_TIMEOUT = 0x01,

View File

@ -1,3 +1,41 @@
#include "vehicle_state.h"
VehicleState vehicle_state = {0};
const char *inichkstate_str(IniChkState state) {
switch (vehicle_state.ini_chk_state) {
case INICHK_START:
return "START";
case INICHK_WD_CHECK:
return "WD CHK";
case INICHK_WD_OK:
return "WD OK";
case INICHK_POS_CHK_1:
return "POS CHK 1";
case INICHK_ASB_CHECK_A_1:
return "ASB CHK A1";
case INICHK_ASB_CHECK_A_2:
return "ASB CHK A2";
case INICHK_SWITCH_B:
return "SWITCH B";
case INICHK_ASB_CHECK_B_1:
return "ASB CHK B1";
case INICHK_ASB_CHECK_B_2:
return "ASB CHK B2";
case INICHK_SWITCH_A:
return "SWITCH A";
case INICHK_ASB_CHECK_AB_1:
return "ASB CHK AB1";
case INICHK_ASB_CHECK_AB_2:
return "ASB CHK AB2";
case INICHK_POS_CHK_2:
return "POS CHK 2";
case INICHK_WAIT_TS:
return "WAIT TS";
case INICHK_DONE:
return "DONE";
case INICHK_ERROR:
return "ERROR";
}
return "UNKNOWN";
}

View File

@ -80,47 +80,16 @@ void AMIView::setIniChkState(IniChkState state) {
} else {
if (state == INICHK_WAIT_TS) {
progressBar.setColor(DriverViewStatusItem::COLOR_TS);
progressBar.setValue(100);
} else {
progressBar.setColor(DriverViewStatusItem::COLOR_OK);
float prog = ((float)vehicle_state.ini_chk_state) / INICHK_DONE;
progressBar.setValue(prog * 100);
}
float prog = ((float)vehicle_state.ini_chk_state) / INICHK_DONE;
progressBar.setValue(prog * 100);
}
progressBar.invalidate();
const char *label = "UNKNOWN";
switch (vehicle_state.ini_chk_state) {
case INICHK_START:
label = "START";
break;
case INICHK_WD_CHECK:
label = "WD CHK";
break;
case INICHK_WD_OK:
label = "WD OK";
break;
case INICHK_ASB_CHECK_1:
label = "ASB CHK 1";
break;
case INICHK_ASB_CHECK_2:
label = "ASB CHK 2";
break;
case INICHK_WAIT_TS:
label = "WAIT TS";
break;
case INICHK_EBS_CHECK_A:
label = "EBS CHK A";
break;
case INICHK_EBS_CHECK_B:
label = "EBS CHK B";
break;
case INICHK_DONE:
label = "DONE";
break;
case INICHK_ERROR:
label = "ERROR";
break;
}
const char *label = inichkstate_str(state);
touchgfx::Unicode::strncpy(progressBuffer, label,
sizeof(progressBuffer) / sizeof(*progressBuffer));
progressLabel.setWildcard(progressBuffer);

View File

@ -144,42 +144,7 @@ void *get_r2dprog_text() {
}
void *get_inichk_text() {
const char *text;
switch (vehicle_state.ini_chk_state) {
case INICHK_START:
text = "START";
break;
case INICHK_WD_CHECK:
text = "WD CHK";
break;
case INICHK_WD_OK:
text = "WD OK";
break;
case INICHK_ASB_CHECK_1:
text = "ASB CHK1";
break;
case INICHK_ASB_CHECK_2:
text = "ASB CHK2";
break;
case INICHK_WAIT_TS:
text = "WAIT TS";
break;
case INICHK_EBS_CHECK_A:
text = "EBS CHKA";
break;
case INICHK_EBS_CHECK_B:
text = "EBS CHKB";
break;
case INICHK_DONE:
text = "DONE";
break;
case INICHK_ERROR:
text = "ERROR";
break;
default:
text = "UNKNOWN";
}
return (void *)text;
return (void *)inichkstate_str(vehicle_state.ini_chk_state);
}
void *get_sdc_text() {