From 4927bd73ddf2a922922eba57a41be07265e93bdb Mon Sep 17 00:00:00 2001 From: Hugo Jean Ponsin Date: Tue, 28 Jul 2026 11:19:39 +0200 Subject: [PATCH] constante is without a e in English, add Enable in front of data type --- src/device/handlers/DemandHandler.cpp | 49 +++++++++++---------- src/device/handlers/DemandHandler.h | 12 ++--- src/device/handlers/DemandHandlerConfig.h | 4 +- src/device/handlers/FeedbackHandler.cpp | 18 ++++---- src/device/handlers/FeedbackHandler.h | 4 +- src/device/handlers/FeedbackHandlerConfig.h | 4 +- src/device/handlers/OutputHandler.cpp | 5 +-- src/device/handlers/PressureCalculator.cpp | 22 ++++----- src/device/handlers/PressureCalculator.h | 8 ++-- 9 files changed, 61 insertions(+), 65 deletions(-) diff --git a/src/device/handlers/DemandHandler.cpp b/src/device/handlers/DemandHandler.cpp index 8c3765d..5267a03 100644 --- a/src/device/handlers/DemandHandler.cpp +++ b/src/device/handlers/DemandHandler.cpp @@ -48,19 +48,19 @@ bool DemandHandler::init() { initSuccess = false; } if (o[DemandHandlerConfig::DEMAND].size() < - static_cast(ParameterIndex::CONSTANTE_1)) { - TMFE::Instance()->Msg( - MERROR, __FUNCTION__, - "Constante 1 index is %i, where array size is %i.", - static_cast(ParameterIndex::CONSTANTE_1), o.size()); + static_cast(ParameterIndex::CONSTANT_1)) { + TMFE::Instance()->Msg(MERROR, __FUNCTION__, + "Constant 1 index is %i, where array size is %i.", + static_cast(ParameterIndex::CONSTANT_1), + o.size()); initSuccess = false; } if (o[DemandHandlerConfig::DEMAND].size() < - static_cast(ParameterIndex::CONSTANTE_2)) { - TMFE::Instance()->Msg( - MERROR, __FUNCTION__, - "Constante 2 index is %i, where array size is %i.", - static_cast(ParameterIndex::CONSTANTE_2), o.size()); + static_cast(ParameterIndex::CONSTANT_2)) { + TMFE::Instance()->Msg(MERROR, __FUNCTION__, + "Constant 2 index is %i, where array size is %i.", + static_cast(ParameterIndex::CONSTANT_2), + o.size()); initSuccess = false; } if (o[DemandHandlerConfig::DEMAND].size() < @@ -86,8 +86,8 @@ bool DemandHandler::init() { this->pullMinimalPressure(); this->pullMaximalPressure(); - this->pullConstante1(); - this->pullConstante2(); + this->pullConstant1(); + this->pullConstant2(); this->pullPressureControlMode(); return true; } @@ -102,11 +102,11 @@ bool DemandHandler::setHotlink() { case static_cast(ParameterIndex::MAXIMAL_PRESSURE): pullMaximalPressure(); break; - case static_cast(ParameterIndex::CONSTANTE_1): - pullConstante1(); + case static_cast(ParameterIndex::CONSTANT_1): + pullConstant1(); break; - case static_cast(ParameterIndex::CONSTANTE_2): - pullConstante2(); + case static_cast(ParameterIndex::CONSTANT_2): + pullConstant2(); break; case static_cast(ParameterIndex::PRESSURE_CONTROL_MODE): pullPressureControlMode(); @@ -140,19 +140,19 @@ void DemandHandler::pullMaximalPressure() { eventBus.publish(event); } -void DemandHandler::pullConstante1() { +void DemandHandler::pullConstant1() { midas::odb o(this->path); float constante1 = o[DemandHandlerConfig::DEMAND] - [static_cast(ParameterIndex::CONSTANTE_1)]; - Event event = {EventType::CONSTANTE_1, constante1}; + [static_cast(ParameterIndex::CONSTANT_1)]; + Event event = {EventType::CONSTANT_1, constante1}; eventBus.publish(event); } -void DemandHandler::pullConstante2() { +void DemandHandler::pullConstant2() { midas::odb o(this->path); float constance2 = o[DemandHandlerConfig::DEMAND] - [static_cast(ParameterIndex::CONSTANTE_2)]; - Event event = {EventType::CONSTANTE_2, constance2}; + [static_cast(ParameterIndex::CONSTANT_2)]; + Event event = {EventType::CONSTANT_2, constance2}; eventBus.publish(event); } @@ -161,7 +161,8 @@ void DemandHandler::pullPressureControlMode() { float pressureControlMode = o[DemandHandlerConfig::DEMAND] [static_cast(ParameterIndex::PRESSURE_CONTROL_MODE)]; - Event event = {EventType::PRESSURE_CONTROL_MODE, pressureControlMode != 0}; + Event event = {EventType::ENABLE_PRESSURE_CONTROL_MODE, + pressureControlMode != 0}; eventBus.publish(event); } @@ -169,7 +170,7 @@ void DemandHandler::pullSetPressure() { midas::odb o(this->path); float setPressure = o[DemandHandlerConfig::DEMAND] [static_cast(ParameterIndex::SET_PRESSURE)]; - Event event = {EventType::SET_PRESSURE, setPressure != 0}; + Event event = {EventType::ENABLE_SET_PRESSURE, setPressure != 0}; eventBus.publish(event); } diff --git a/src/device/handlers/DemandHandler.h b/src/device/handlers/DemandHandler.h index d9f4f00..0ee62c8 100644 --- a/src/device/handlers/DemandHandler.h +++ b/src/device/handlers/DemandHandler.h @@ -10,10 +10,10 @@ class DemandHandler { enum class EventType { MINIMAL_PRESSURE, MAXIMAL_PRESSURE, - CONSTANTE_1, - CONSTANTE_2, - PRESSURE_CONTROL_MODE, - SET_PRESSURE + CONSTANT_1, + CONSTANT_2, + ENABLE_PRESSURE_CONTROL_MODE, + ENABLE_SET_PRESSURE }; struct Event { @@ -32,8 +32,8 @@ class DemandHandler { */ void pullMinimalPressure(); void pullMaximalPressure(); - void pullConstante1(); - void pullConstante2(); + void pullConstant1(); + void pullConstant2(); void pullPressureControlMode(); void pullSetPressure(); diff --git a/src/device/handlers/DemandHandlerConfig.h b/src/device/handlers/DemandHandlerConfig.h index d08975c..39f24ad 100644 --- a/src/device/handlers/DemandHandlerConfig.h +++ b/src/device/handlers/DemandHandlerConfig.h @@ -14,8 +14,8 @@ enum class ParameterIndex { SET_PRESSURE = 7, MINIMAL_PRESSURE = 8, MAXIMAL_PRESSURE = 9, - CONSTANTE_1 = 10, - CONSTANTE_2 = 11, + CONSTANT_1 = 10, + CONSTANT_2 = 11, MAXIMUM_PARAMETER_INDEX = 11 }; diff --git a/src/device/handlers/FeedbackHandler.cpp b/src/device/handlers/FeedbackHandler.cpp index 1e34df6..2dec504 100644 --- a/src/device/handlers/FeedbackHandler.cpp +++ b/src/device/handlers/FeedbackHandler.cpp @@ -17,10 +17,10 @@ FeedbackHandler::FeedbackHandler(EventBus &eventBusReference, [this](const DemandHandler::Event &e) { generateOdbKeyIfNeeded(); switch (e.type) { - case DemandHandler::EventType::PRESSURE_CONTROL_MODE: + case DemandHandler::EventType::ENABLE_PRESSURE_CONTROL_MODE: enablePressureControlMode(std::get(e.value)); break; - case DemandHandler::EventType::SET_PRESSURE: + case DemandHandler::EventType::ENABLE_SET_PRESSURE: enableSetPressure(std::get(e.value)); break; default: @@ -48,8 +48,8 @@ FeedbackHandler::FeedbackHandler(EventBus &eventBusReference, eventBusReference.subscribe( [this](const PressureCalculator::Event &e) { generateOdbKeyIfNeeded(); - setConstante1(e.c1contrib); - setConstante2(e.c2contrib); + setConstant1(e.c1contrib); + setConstant2(e.c2contrib); setPressureMinimum(e.uncapedPressure); setPressureMaximum(e.uncapedPressure); setPressure(e.cappedPressure); @@ -109,11 +109,10 @@ void FeedbackHandler::setPressure(float value) { updatePressure(); } -void FeedbackHandler::setConstante1(float value) { +void FeedbackHandler::setConstant1(float value) { midas::odb o(path); o[FeedbackHandlerConf::OUTPUT_VARNAME] - [static_cast(FeedbackHandlerConf::RegisterIndex::CONSTANTE_1)] = - value; + [static_cast(FeedbackHandlerConf::RegisterIndex::CONSTANT_1)] = value; } void FeedbackHandler::setAveragePower(float value) { midas::odb o(path); @@ -122,11 +121,10 @@ void FeedbackHandler::setAveragePower(float value) { value; } -void FeedbackHandler::setConstante2(float value) { +void FeedbackHandler::setConstant2(float value) { midas::odb o(path); o[FeedbackHandlerConf::OUTPUT_VARNAME] - [static_cast(FeedbackHandlerConf::RegisterIndex::CONSTANTE_2)] = - value; + [static_cast(FeedbackHandlerConf::RegisterIndex::CONSTANT_2)] = value; } void FeedbackHandler::setPressureMinimum(float value) { diff --git a/src/device/handlers/FeedbackHandler.h b/src/device/handlers/FeedbackHandler.h index c3ef9e8..0e2ff68 100644 --- a/src/device/handlers/FeedbackHandler.h +++ b/src/device/handlers/FeedbackHandler.h @@ -30,8 +30,8 @@ class FeedbackHandler { void setPower(float value); void setAveragePower(float value); void setPressure(float value); - void setConstante1(float value); - void setConstante2(float value); + void setConstant1(float value); + void setConstant2(float value); /* Update pressure value diff --git a/src/device/handlers/FeedbackHandlerConfig.h b/src/device/handlers/FeedbackHandlerConfig.h index 16df396..2ef01b8 100644 --- a/src/device/handlers/FeedbackHandlerConfig.h +++ b/src/device/handlers/FeedbackHandlerConfig.h @@ -19,8 +19,8 @@ enum class RegisterIndex { PRESSURE = 5, MINIMUM_PRESSURE = 8, MAXIMUM_PRESSURE = 9, - CONSTANTE_1 = 10, - CONSTANTE_2 = 11, + CONSTANT_1 = 10, + CONSTANT_2 = 11, MAXIMUM_REGISTRY_INDEX = 11 // Used as a safety guard for undersize array. Put this enum member // always as the same value as the highest member diff --git a/src/device/handlers/OutputHandler.cpp b/src/device/handlers/OutputHandler.cpp index 4ec7d83..b686361 100644 --- a/src/device/handlers/OutputHandler.cpp +++ b/src/device/handlers/OutputHandler.cpp @@ -58,9 +58,6 @@ void OutputHandler::update() { isIndexValid = true; } - //// SHOULD I CRASH IF KEY NOT VALID ? - //// FOR NOW, FAILED SILENTLY - if (isSetPressureEnable && isKeyValid) o(OutputHandlerConfig::OUTPUT_VARIABLE)[outputPressureSPIndex] = pressure; @@ -71,7 +68,7 @@ OutputHandler::OutputHandler(EventBus &eventBusReference) { eventBusReference.subscribe( [this](const DemandHandler::Event &e) { switch (e.type) { - case DemandHandler::EventType::SET_PRESSURE: + case DemandHandler::EventType::ENABLE_SET_PRESSURE: enableSetPressure(std::get(e.value)); break; default: diff --git a/src/device/handlers/PressureCalculator.cpp b/src/device/handlers/PressureCalculator.cpp index 1dba962..009dfbd 100644 --- a/src/device/handlers/PressureCalculator.cpp +++ b/src/device/handlers/PressureCalculator.cpp @@ -7,15 +7,15 @@ void PressureCalculator::update() { double averagePower = average.getAverage(); - double c2contrib = averagePower * cachedConstante2; + double c2contrib = averagePower * cachedConstant2; double c1contrib = - cachedConstante1 * (cachedTemperature - cachedSP - c2contrib); + cachedConstant1 * (cachedTemperature - cachedSP - c2contrib); double uncapedPressure = cachedMinimalPressure + c1contrib; double cappedPressure = uncapedPressure; if (c2contrib != 0) { - c2contrib = -c2contrib * cachedConstante1; + c2contrib = -c2contrib * cachedConstant1; } else { c2contrib = 0.0f; } @@ -48,11 +48,11 @@ PressureCalculator::PressureCalculator(EventBus &eventBusReference) case DemandHandler::EventType::MAXIMAL_PRESSURE: updateMaximalPressure(std::get(e.value)); break; - case DemandHandler::EventType::CONSTANTE_1: - updateConstante1(std::get(e.value)); + case DemandHandler::EventType::CONSTANT_1: + updateConstant1(std::get(e.value)); break; - case DemandHandler::EventType::CONSTANTE_2: - updateConstante2(std::get(e.value)); + case DemandHandler::EventType::CONSTANT_2: + updateConstant2(std::get(e.value)); break; default: break; @@ -108,12 +108,12 @@ void PressureCalculator::updateMaximalPressure(float value) { update(); } -void PressureCalculator::updateConstante1(float value) { - cachedConstante1 = value; +void PressureCalculator::updateConstant1(float value) { + cachedConstant1 = value; update(); } -void PressureCalculator::updateConstante2(float value) { - cachedConstante2 = value; +void PressureCalculator::updateConstant2(float value) { + cachedConstant2 = value; update(); } diff --git a/src/device/handlers/PressureCalculator.h b/src/device/handlers/PressureCalculator.h index e5a1f15..aa5e547 100644 --- a/src/device/handlers/PressureCalculator.h +++ b/src/device/handlers/PressureCalculator.h @@ -26,8 +26,8 @@ class PressureCalculator { float cachedMinimalPressure; float cachedMaximalPressure; - float cachedConstante1; - float cachedConstante2; + float cachedConstant1; + float cachedConstant2; /* Internal value setters (from InputHandler) @@ -40,8 +40,8 @@ class PressureCalculator { */ void updateMinimalPressure(float value); void updateMaximalPressure(float value); - void updateConstante1(float value); - void updateConstante2(float value); + void updateConstant1(float value); + void updateConstant2(float value); /* Update pressure value