const + fwd declare pid things (#1024)

This commit is contained in:
Matthew Kennedy 2019-11-22 12:55:38 -08:00 committed by rusefi
parent 1ad5b55dbb
commit 3514eb313e
2 changed files with 8 additions and 6 deletions

View File

@ -12,6 +12,7 @@
#include "os_access.h" #include "os_access.h"
#include "pid.h" #include "pid.h"
#include "math.h" #include "math.h"
#include "engine_configuration_generated_structures.h"
Pid::Pid() { Pid::Pid() {
initPidClass(NULL); initPidClass(NULL);
@ -28,7 +29,7 @@ void Pid::initPidClass(pid_s *parameters) {
reset(); 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, this->parameters != NULL, "PID::isSame invalid", false);
efiAssert(OBD_PCM_Processor_Fault, parameters != NULL, "PID::isSame NULL", false); efiAssert(OBD_PCM_Processor_Fault, parameters != NULL, "PID::isSame NULL", false);
return this->parameters->pFactor == parameters->pFactor return this->parameters->pFactor == parameters->pFactor
@ -153,7 +154,7 @@ void Pid::sleep() {
#endif /* EFI_UNIT_TEST */ #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", scheduleMsg(logging, "%s settings: offset=%f P=%.5f I=%.5f D=%.5f period=%dms",
msg, msg,
getOffset(), getOffset(),

View File

@ -8,8 +8,6 @@
#ifndef PID_H_ #ifndef PID_H_
#define PID_H_ #define PID_H_
#include "global.h"
#include "engine_configuration_generated_structures.h"
#include "engine_state_generated.h" #include "engine_state_generated.h"
#include "pid_state_generated.h" #include "pid_state_generated.h"
@ -30,13 +28,16 @@
#define MS2SEC(x) (x * 0.001) #define MS2SEC(x) (x * 0.001)
struct pid_s;
class Logging;
class Pid : public pid_state_s { class Pid : public pid_state_s {
public: public:
Pid(); Pid();
explicit Pid(pid_s *parameters); explicit Pid(pid_s *parameters);
void initPidClass(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 * This version of the method takes dTime from pid_s
@ -62,7 +63,7 @@ public:
void postState(TunerStudioOutputChannels *tsOutputChannels); void postState(TunerStudioOutputChannels *tsOutputChannels);
void postState(TunerStudioOutputChannels *tsOutputChannels, int pMult); void postState(TunerStudioOutputChannels *tsOutputChannels, int pMult);
#endif /* EFI_TUNER_STUDIO */ #endif /* EFI_TUNER_STUDIO */
void showPidStatus(Logging *logging, const char*msg); void showPidStatus(Logging *logging, const char*msg) const;
void sleep(); void sleep();
int resetCounter; int resetCounter;
// todo: move this to pid_s one day // todo: move this to pid_s one day