update param config
This commit is contained in:
@ -19,7 +19,7 @@ public:
|
||||
void incParam() override;
|
||||
void confirmParam() override;
|
||||
|
||||
void abxParamConfirmed(ParamType param);
|
||||
void paramConfirmed(ParamType param);
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
||||
@ -254,6 +254,27 @@ void *get_err_text() {
|
||||
return (void *)text;
|
||||
}
|
||||
|
||||
void *get_discipline_text() {
|
||||
const char *text;
|
||||
switch (params[PF_Discipline].value) {
|
||||
case DC_0:
|
||||
text = "zero";
|
||||
break;
|
||||
case DC_1:
|
||||
text = "one";
|
||||
break;
|
||||
case DC_2:
|
||||
text = "two";
|
||||
break;
|
||||
case DC_3:
|
||||
text = "three";
|
||||
break;
|
||||
default:
|
||||
text = "unknown";
|
||||
}
|
||||
return (void *)text;
|
||||
}
|
||||
|
||||
void *get_compiler_build_hash() { return (void *)git_hash; }
|
||||
|
||||
void *get_zero() {
|
||||
@ -344,15 +365,26 @@ NamedFieldDescription dataFieldDescs[] = {
|
||||
static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) == DataFieldType_COUNT,
|
||||
"Incorrect number of data field descriptions");
|
||||
|
||||
#define PARAM_FIELD(FIELD) []() { return (void *)¶ms.FIELD; }
|
||||
#define PARAM_FIELD(FIELD) []() { return (void *)¶ms[FIELD].value; }
|
||||
#define SCALED_PARAM_FIELD(FIELD) \
|
||||
[]() { \
|
||||
static float x; \
|
||||
x = params[FIELD].value * params[FIELD].display_factor; \
|
||||
return (void *)&x; \
|
||||
}
|
||||
|
||||
NamedFieldDescription paramFieldDescs[] = {
|
||||
[PF_PLIM] = {NamedFieldKind::Int, "PLIM", 2, 0, PARAM_FIELD(plim)},
|
||||
[PF_TLIM] = {NamedFieldKind::Int, "TLIM", 4, 1, PARAM_FIELD(tlim)},
|
||||
[PF_SLIM] = {NamedFieldKind::Int, "SLIM", 2, 2, PARAM_FIELD(slim)},
|
||||
[PF_TVEC] = {NamedFieldKind::Int, "TVEC", 2, 1, PARAM_FIELD(tvec)},
|
||||
[PF_PG] = {NamedFieldKind::Int, "PG", 2, 0, PARAM_FIELD(pg)},
|
||||
[PF_REKU] = {NamedFieldKind::Int, "REKU", 2, 0, PARAM_FIELD(reku)},
|
||||
[PF_SpeedLimit] = {NamedFieldKind::Int, "SpLim", 2, 0, PARAM_FIELD(PF_SpeedLimit)},
|
||||
[PF_TorqueLimit] = {NamedFieldKind::Int, "TqLim", 2, 0, PARAM_FIELD(PF_TorqueLimit)},
|
||||
[PF_PowerLimit] = {NamedFieldKind::Int, "PwLim", 2, 0, PARAM_FIELD(PF_PowerLimit)},
|
||||
[PF_Discipline] = {NamedFieldKind::Text, "Disci", 2, 0, get_discipline_text},
|
||||
[PF_TorqueVectoringOn] = {NamedFieldKind::Int, "TVEC", 2, 1, PARAM_FIELD(PF_TorqueVectoringOn)},
|
||||
[PF_TractionControlOn] = {NamedFieldKind::Int, "TC_On", 2, 1, PARAM_FIELD(PF_TractionControlOn)},
|
||||
[PF_Rekuperation] = {NamedFieldKind::Int, "Reku", 2, 0, PARAM_FIELD(PF_Rekuperation)},
|
||||
[PF_TractionControlP] = {NamedFieldKind::Float, "TC_P", 2, 1, SCALED_PARAM_FIELD(PF_TractionControlP)},
|
||||
[PF_TractionControlI] = {NamedFieldKind::Float, "TC_I", 2, 1, SCALED_PARAM_FIELD(PF_TractionControlI)},
|
||||
[PF_TractionControlMuMax] = {NamedFieldKind::Float, "TC_MM", 2, 1, SCALED_PARAM_FIELD(PF_TractionControlMuMax)},
|
||||
[PF_TractionControlSlipRef] = {NamedFieldKind::Float, "TC_SR", 2, 1, SCALED_PARAM_FIELD(PF_TractionControlSlipRef)},
|
||||
};
|
||||
|
||||
static_assert(sizeof(paramFieldDescs) / sizeof(paramFieldDescs[0]) == ParamType_COUNT,
|
||||
|
||||
@ -25,12 +25,12 @@ void ConfigItem::typeUpdated() {
|
||||
switch (desc->kind) {
|
||||
case NamedFieldKind::Float:
|
||||
case NamedFieldKind::Int:
|
||||
value.setTypedText(T_NUMBERWILDCARD);
|
||||
value.setTypedText(T_HUGEVALUEWILDCARD);
|
||||
break;
|
||||
case NamedFieldKind::Hex:
|
||||
case NamedFieldKind::Bool:
|
||||
case NamedFieldKind::Text:
|
||||
value.setTypedText(T_DEFAULTWILDCARD_CENTERED);
|
||||
value.setTypedText(T_HUGEVALUEWILDCARD);
|
||||
break;
|
||||
}
|
||||
value.invalidate();
|
||||
|
||||
@ -19,12 +19,12 @@ void DriverViewField::typeUpdated() {
|
||||
switch (desc->kind) {
|
||||
case NamedFieldKind::Float:
|
||||
case NamedFieldKind::Int:
|
||||
value.setTypedText(T_NUMBERWILDCARD);
|
||||
value.setTypedText(T_HUGEVALUEWILDCARD);
|
||||
break;
|
||||
case NamedFieldKind::Hex:
|
||||
case NamedFieldKind::Bool:
|
||||
case NamedFieldKind::Text:
|
||||
value.setTypedText(T_DEFAULTWILDCARD_CENTERED);
|
||||
value.setTypedText(T_HUGEVALUEWILDCARD);
|
||||
break;
|
||||
}
|
||||
value.invalidate();
|
||||
|
||||
@ -53,7 +53,7 @@ void Temperature::setSmallText(bool small_) {
|
||||
value.setHeight(33);
|
||||
value.setY(14);
|
||||
} else {
|
||||
value.setTypedText(T_NUMBERWILDCARD);
|
||||
value.setTypedText(T_HUGEVALUEWILDCARD);
|
||||
value.setHeight(50);
|
||||
value.setY(0);
|
||||
}
|
||||
|
||||
@ -12,4 +12,4 @@ void VehicleConfigPresenter::nextScreen() {
|
||||
static_cast<FrontendApplication *>(Application::getInstance())->gotoSystemOverviewScreenNoTransition();
|
||||
}
|
||||
|
||||
void VehicleConfigPresenter::paramConfirmed() { view.abxParamConfirmed(vehicle_state.last_param_confirmed); }
|
||||
void VehicleConfigPresenter::paramConfirmed() { view.paramConfirmed(vehicle_state.last_param_confirmed); }
|
||||
|
||||
@ -48,7 +48,7 @@ void VehicleConfigView::confirmParam() {
|
||||
params_broadcast(static_cast<ParamType>(selectedParam));
|
||||
}
|
||||
|
||||
void VehicleConfigView::abxParamConfirmed(ParamType param) {
|
||||
void VehicleConfigView::paramConfirmed(ParamType param) {
|
||||
paramsDirty[param] = false;
|
||||
params.itemChanged(param);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user