diff --git a/firmware/util/math/pid.cpp b/firmware/util/math/pid.cpp index 1cd09b0ba7..8546df9aa4 100644 --- a/firmware/util/math/pid.cpp +++ b/firmware/util/math/pid.cpp @@ -12,6 +12,7 @@ #include "os_access.h" #include "pid.h" #include "math.h" +#include "engine_configuration_generated_structures.h" Pid::Pid() { initPidClass(NULL); @@ -28,7 +29,7 @@ void Pid::initPidClass(pid_s *parameters) { reset(); } -bool Pid::isSame(pid_s *parameters) const { +bool Pid::isSame(const pid_s *parameters) const { efiAssert(OBD_PCM_Processor_Fault, this->parameters != NULL, "PID::isSame invalid", false); efiAssert(OBD_PCM_Processor_Fault, parameters != NULL, "PID::isSame NULL", false); return this->parameters->pFactor == parameters->pFactor @@ -153,7 +154,7 @@ void Pid::sleep() { #endif /* EFI_UNIT_TEST */ } -void Pid::showPidStatus(Logging *logging, const char*msg) { +void Pid::showPidStatus(Logging *logging, const char*msg) const { scheduleMsg(logging, "%s settings: offset=%f P=%.5f I=%.5f D=%.5f period=%dms", msg, getOffset(), diff --git a/firmware/util/math/pid.h b/firmware/util/math/pid.h index becd8be186..1374894317 100644 --- a/firmware/util/math/pid.h +++ b/firmware/util/math/pid.h @@ -8,8 +8,6 @@ #ifndef PID_H_ #define PID_H_ -#include "global.h" -#include "engine_configuration_generated_structures.h" #include "engine_state_generated.h" #include "pid_state_generated.h" @@ -30,13 +28,16 @@ #define MS2SEC(x) (x * 0.001) +struct pid_s; +class Logging; + class Pid : public pid_state_s { public: Pid(); explicit Pid(pid_s *parameters); void initPidClass(pid_s *parameters); - bool isSame(pid_s *parameters) const; + bool isSame(const pid_s *parameters) const; /** * This version of the method takes dTime from pid_s @@ -62,7 +63,7 @@ public: void postState(TunerStudioOutputChannels *tsOutputChannels); void postState(TunerStudioOutputChannels *tsOutputChannels, int pMult); #endif /* EFI_TUNER_STUDIO */ - void showPidStatus(Logging *logging, const char*msg); + void showPidStatus(Logging *logging, const char*msg) const; void sleep(); int resetCounter; // todo: move this to pid_s one day