Replace TEST1..4 with ASRI

This commit is contained in:
Jasper Blanckenburg 2023-06-26 17:18:51 +02:00
parent 64ff7b3439
commit 0736955fd9
3 changed files with 14 additions and 50 deletions

View File

@ -11,15 +11,15 @@ extern "C" {
#include "util.h"
CountedEnum(ParamType, size_t, PF_BBAL, PF_SLIPREF, PF_MUMAX, PF_ASRP, PF_ASRON,
PF_TEST1, PF_TEST2, PF_TEST3, PF_TEST4);
PF_ASRI);
typedef struct {
float bbal;
float slipref;
float mumax;
unsigned asrp;
unsigned asri;
unsigned asron;
unsigned test[4];
} Params;
extern Params params;

View File

@ -23,21 +23,12 @@ void params_inc(ParamType param) {
case PF_ASRP:
params.asrp++;
break;
case PF_ASRI:
params.asri++;
break;
case PF_ASRON:
params.asron = 1;
break;
case PF_TEST1:
params.test[0]++;
break;
case PF_TEST2:
params.test[1]++;
break;
case PF_TEST3:
params.test[2]++;
break;
case PF_TEST4:
params.test[3]++;
break;
}
}
@ -64,29 +55,14 @@ void params_dec(ParamType param) {
params.asrp--;
}
break;
case PF_ASRI:
if (params.asri > 0) {
params.asri--;
}
break;
case PF_ASRON:
params.asron = 0;
break;
case PF_TEST1:
if (params.test[0] > 0) {
params.test[0]--;
}
break;
case PF_TEST2:
if (params.test[1] > 0) {
params.test[1]--;
}
break;
case PF_TEST3:
if (params.test[2] > 0) {
params.test[2]--;
}
break;
case PF_TEST4:
if (params.test[3] > 0) {
params.test[3]--;
}
break;
}
}
@ -105,21 +81,12 @@ void params_broadcast(ParamType param) {
case PF_ASRP:
value = params.asrp;
break;
case PF_ASRI:
value = params.asri;
break;
case PF_ASRON:
value = params.asron;
break;
case PF_TEST1:
value = params.test[0];
break;
case PF_TEST2:
value = params.test[1];
break;
case PF_TEST3:
value = params.test[2];
break;
case PF_TEST4:
value = params.test[3];
break;
default:
return;
}

View File

@ -309,10 +309,7 @@ NamedFieldDescription paramFieldDescs[] = {
[PF_MUMAX] = {NamedFieldKind::Float, "MUMAX", 2, 1, PARAM_FIELD(mumax)},
[PF_ASRP] = {NamedFieldKind::Int, "ASR-P", 2, 0, PARAM_FIELD(asrp)},
[PF_ASRON] = {NamedFieldKind::Int, "ASR-ON", 2, 0, PARAM_FIELD(asron)},
[PF_TEST1] = {NamedFieldKind::Int, "TEST1", 2, 0, PARAM_FIELD(test[0])},
[PF_TEST2] = {NamedFieldKind::Int, "TEST2", 2, 0, PARAM_FIELD(test[1])},
[PF_TEST3] = {NamedFieldKind::Int, "TEST3", 2, 0, PARAM_FIELD(test[2])},
[PF_TEST4] = {NamedFieldKind::Int, "TEST4", 2, 0, PARAM_FIELD(test[3])},
[PF_ASRI] = {NamedFieldKind::Int, "ASR-I", 2, 0, PARAM_FIELD(asri)},
};
static_assert(sizeof(paramFieldDescs) / sizeof(paramFieldDescs[0]) ==