From 370dbb5ca16944c064c69ac24aa2e28b607ac9a9 Mon Sep 17 00:00:00 2001 From: "Jasper v. Blanckenburg" Date: Wed, 12 Apr 2023 13:48:02 +0200 Subject: [PATCH] Add MUMAX parameter --- Core/Inc/params.h | 5 +++-- Core/Src/params.c | 11 +++++++++++ TouchGFX/gui/src/common/NamedField.cpp | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Core/Inc/params.h b/Core/Inc/params.h index 1e7098e..a113893 100644 --- a/Core/Inc/params.h +++ b/Core/Inc/params.h @@ -10,12 +10,13 @@ extern "C" { #include "util.h" -CountedEnum(ParamType, size_t, PF_BBAL, PF_SLIPREF, PF_ASRP, PF_ASRON, PF_TEST1, - PF_TEST2, PF_TEST3, PF_TEST4); +CountedEnum(ParamType, size_t, PF_BBAL, PF_SLIPREF, PF_MUMAX, PF_ASRP, PF_ASRON, + PF_TEST1, PF_TEST2, PF_TEST3, PF_TEST4); typedef struct { float bbal; float slipref; + float mumax; unsigned asrp; unsigned asron; unsigned test[4]; diff --git a/Core/Src/params.c b/Core/Src/params.c index 730592a..bbb0708 100644 --- a/Core/Src/params.c +++ b/Core/Src/params.c @@ -17,6 +17,9 @@ void params_inc(ParamType param) { case PF_SLIPREF: params.slipref += 0.01f; break; + case PF_MUMAX: + params.mumax += 0.1f; + break; case PF_ASRP: params.asrp++; break; @@ -51,6 +54,11 @@ void params_dec(ParamType param) { params.slipref -= 0.01f; } break; + case PF_MUMAX: + if (params.mumax > 0) { + params.mumax -= 0.1f; + } + break; case PF_ASRP: if (params.asrp > 0) { params.asrp--; @@ -91,6 +99,9 @@ void params_broadcast(ParamType param) { case PF_SLIPREF: value = params.slipref * 100; break; + case PF_MUMAX: + value = params.mumax * 10; + break; case PF_ASRP: value = params.asrp; break; diff --git a/TouchGFX/gui/src/common/NamedField.cpp b/TouchGFX/gui/src/common/NamedField.cpp index fcf54c4..4fea283 100644 --- a/TouchGFX/gui/src/common/NamedField.cpp +++ b/TouchGFX/gui/src/common/NamedField.cpp @@ -282,6 +282,7 @@ NamedFieldDescription paramFieldDescs[] = { [PF_BBAL] = {NamedFieldKind::Float, "BBAL", 2, 1, PARAM_FIELD(bbal)}, [PF_SLIPREF] = {NamedFieldKind::Float, "SLIPREF", 2, 2, PARAM_FIELD(slipref)}, + [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])},