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" #include "util.h"
CountedEnum(ParamType, size_t, PF_BBAL, PF_SLIPREF, PF_MUMAX, PF_ASRP, PF_ASRON, 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 { typedef struct {
float bbal; float bbal;
float slipref; float slipref;
float mumax; float mumax;
unsigned asrp; unsigned asrp;
unsigned asri;
unsigned asron; unsigned asron;
unsigned test[4];
} Params; } Params;
extern Params params; extern Params params;

View File

@ -23,21 +23,12 @@ void params_inc(ParamType param) {
case PF_ASRP: case PF_ASRP:
params.asrp++; params.asrp++;
break; break;
case PF_ASRI:
params.asri++;
break;
case PF_ASRON: case PF_ASRON:
params.asron = 1; params.asron = 1;
break; 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--; params.asrp--;
} }
break; break;
case PF_ASRI:
if (params.asri > 0) {
params.asri--;
}
break;
case PF_ASRON: case PF_ASRON:
params.asron = 0; params.asron = 0;
break; 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: case PF_ASRP:
value = params.asrp; value = params.asrp;
break; break;
case PF_ASRI:
value = params.asri;
break;
case PF_ASRON: case PF_ASRON:
value = params.asron; value = params.asron;
break; 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: default:
return; return;
} }

View File

@ -309,10 +309,7 @@ NamedFieldDescription paramFieldDescs[] = {
[PF_MUMAX] = {NamedFieldKind::Float, "MUMAX", 2, 1, PARAM_FIELD(mumax)}, [PF_MUMAX] = {NamedFieldKind::Float, "MUMAX", 2, 1, PARAM_FIELD(mumax)},
[PF_ASRP] = {NamedFieldKind::Int, "ASR-P", 2, 0, PARAM_FIELD(asrp)}, [PF_ASRP] = {NamedFieldKind::Int, "ASR-P", 2, 0, PARAM_FIELD(asrp)},
[PF_ASRON] = {NamedFieldKind::Int, "ASR-ON", 2, 0, PARAM_FIELD(asron)}, [PF_ASRON] = {NamedFieldKind::Int, "ASR-ON", 2, 0, PARAM_FIELD(asron)},
[PF_TEST1] = {NamedFieldKind::Int, "TEST1", 2, 0, PARAM_FIELD(test[0])}, [PF_ASRI] = {NamedFieldKind::Int, "ASR-I", 2, 0, PARAM_FIELD(asri)},
[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])},
}; };
static_assert(sizeof(paramFieldDescs) / sizeof(paramFieldDescs[0]) == static_assert(sizeof(paramFieldDescs) / sizeof(paramFieldDescs[0]) ==