auto-sync

This commit is contained in:
rusEfi 2016-01-20 23:03:03 -05:00
parent 2dba0e0a71
commit 37f52a6930
11 changed files with 56 additions and 58 deletions

View File

@ -1,25 +0,0 @@
/**
* @file can_header.h
*
* @date Dec 21, 2013
* @author Andrey Belomutskiy, (c) 2012-2016
*/
#ifndef CAN_HEADER_H_
#define CAN_HEADER_H_
#include "rusefi_enums.h"
/**
* Net Body Computer types
*/
typedef enum {
CAN_BUS_NBC_BMW = 0,
CAN_BUS_NBC_FIAT = 1,
CAN_BUS_NBC_VAG = 2,
CAN_BUS_MAZDA_RX8 = 3,
Internal_ForceMyEnumIntSize_can_nbc = ENUM_32_BITS,
} can_nbc_e;
#endif /* CAN_HEADER_H_ */

View File

@ -11,7 +11,6 @@
#include "efifeatures.h" #include "efifeatures.h"
#include "crc.h" #include "crc.h"
#include "can_header.h"
#include "rusefi_enums.h" #include "rusefi_enums.h"
#include "global.h" #include "global.h"
#include "rusefi_types.h" #include "rusefi_types.h"

View File

@ -1,5 +1,9 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016 // this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016
// begin // begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
#include "rusefi_types.h" #include "rusefi_types.h"
typedef struct { typedef struct {
/** /**
@ -1607,5 +1611,6 @@ typedef struct {
/** total size 16088*/ /** total size 16088*/
} persistent_config_s; } persistent_config_s;
#endif
// end // end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016 // this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016

View File

@ -640,5 +640,16 @@ typedef enum {
Internal_ForceMyEnumIntSize_chamber_stype = ENUM_32_BITS, Internal_ForceMyEnumIntSize_chamber_stype = ENUM_32_BITS,
} chamber_style_e; } chamber_style_e;
/**
* Net Body Computer types
*/
typedef enum {
CAN_BUS_NBC_BMW = 0,
CAN_BUS_NBC_FIAT = 1,
CAN_BUS_NBC_VAG = 2,
CAN_BUS_MAZDA_RX8 = 3,
Internal_ForceMyEnumIntSize_can_nbc = ENUM_32_BITS,
} can_nbc_e;
#endif /* RUSEFI_ENUMS_H_ */ #endif /* RUSEFI_ENUMS_H_ */

View File

@ -16,6 +16,9 @@
#include "voltage.h" #include "voltage.h"
#include "pid.h" #include "pid.h"
#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__)
EXTERN_ENGINE EXTERN_ENGINE
; ;
@ -25,7 +28,8 @@ static Logging *logger;
static SimplePwm alternatorControl; static SimplePwm alternatorControl;
static OutputPin alternatorPin; static OutputPin alternatorPin;
static Pid altPid(10, 0, 0, 1, 90); static pid_s *altPidS = &persistentState.persistentConfiguration.engineConfiguration.alternatorControl;
static Pid altPid(altPidS, 1, 90);
static THD_WORKING_AREA(alternatorControlThreadStack, UTILITY_THREAD_STACK_SIZE); static THD_WORKING_AREA(alternatorControlThreadStack, UTILITY_THREAD_STACK_SIZE);
@ -108,3 +112,5 @@ void initAlternatorCtrl(Logging *sharedLogger) {
applySettings(); applySettings();
} }
#endif /* EFI_ALTERNATOR_CONTROL */

View File

@ -54,7 +54,8 @@ static OutputPin output2 CCM_OPTIONAL;
static OutputPin outputDirectionOpen CCM_OPTIONAL; static OutputPin outputDirectionOpen CCM_OPTIONAL;
static OutputPin outputDirectionClose CCM_OPTIONAL; static OutputPin outputDirectionClose CCM_OPTIONAL;
static Pid pid(1, 0, 0, 0, 100); static pid_s etbS;
static Pid pid(&etbS, 0, 100);
static float prevTps; static float prevTps;

View File

@ -9,10 +9,8 @@
#include "pid.h" #include "pid.h"
Pid::Pid(float pFactor, float iFactor, float dFactor, float minResult, float maxResult) { Pid::Pid(pid_s *pid, float minResult, float maxResult) {
this->pFactor = pFactor; this->pid = pid;
this->iFactor = iFactor;
this->dFactor = dFactor;
this->minResult = minResult; this->minResult = minResult;
this->maxResult = maxResult; this->maxResult = maxResult;
@ -23,9 +21,9 @@ Pid::Pid(float pFactor, float iFactor, float dFactor, float minResult, float max
float Pid::getValue(float target, float input, float dTime) { float Pid::getValue(float target, float input, float dTime) {
float error = target - input; float error = target - input;
float pTerm = pFactor * error; float pTerm = pid->pFactor * error;
iTerm += iFactor * dTime * error; iTerm += pid->iFactor * dTime * error;
float dTerm = dFactor / dTime * (error - prevError); float dTerm = pid->dFactor / dTime * (error - prevError);
prevError = error; prevError = error;
@ -41,9 +39,9 @@ float Pid::getValue(float target, float input, float dTime) {
} }
void Pid::updateFactors(float pFactor, float iFactor, float dFactor) { void Pid::updateFactors(float pFactor, float iFactor, float dFactor) {
this->pFactor = pFactor; pid->pFactor = pFactor;
this->iFactor = iFactor; pid->iFactor = iFactor;
this->dFactor = dFactor; pid->dFactor = dFactor;
reset(); reset();
} }
@ -53,11 +51,11 @@ void Pid::reset(void) {
} }
float Pid::getP(void) { float Pid::getP(void) {
return pFactor; return pid->pFactor;
} }
float Pid::getI(void) { float Pid::getI(void) {
return iFactor; return pid->iFactor;
} }
float Pid::getIntegration(void) { float Pid::getIntegration(void) {
@ -65,7 +63,7 @@ float Pid::getIntegration(void) {
} }
float Pid::getD(void) { float Pid::getD(void) {
return dFactor; return pid->dFactor;
} }

View File

@ -8,10 +8,12 @@
#ifndef PID_H_ #ifndef PID_H_
#define PID_H_ #define PID_H_
#include "engine_configuration_generated_structures.h"
class Pid { class Pid {
public: public:
Pid(float pFactor, float iFactor, float dFactor, float minResult, float maxResult); Pid(pid_s *pid, float minResult, float maxResult);
float getValue(float target, float input, float dTime); float getValue(float target, float input, float dTime);
void updateFactors(float pFactor, float iFactor, float dFactor); void updateFactors(float pFactor, float iFactor, float dFactor);
void reset(void); void reset(void);
@ -20,15 +22,12 @@ public:
float getIntegration(void); float getIntegration(void);
float getD(void); float getD(void);
private: private:
float pFactor; pid_s *pid;
float iFactor;
float dFactor;
float minResult; float minResult;
float maxResult; float maxResult;
float iTerm; float iTerm;
float prevError; float prevError;
}; };
#endif /* PID_H_ */ #endif /* PID_H_ */

View File

@ -18,7 +18,6 @@
#include "pin_repository.h" #include "pin_repository.h"
#include "engine_state.h" #include "engine_state.h"
#include "can_header.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "vehicle_speed.h" #include "vehicle_speed.h"
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */

View File

@ -946,7 +946,7 @@ fileVersion = { 20151201 }
gauge3 = throttleGauge gauge3 = throttleGauge
gauge4 = mafGaugeVolts gauge4 = mafGaugeVolts
gauge5 = afr1Gauge gauge5 = afr1Gauge
gauge6 = tpsADCGauge gauge6 = VBattGauge
gauge7 = dwellGauge gauge7 = dwellGauge
gauge8 = ignadvGauge gauge8 = ignadvGauge
@ -985,14 +985,14 @@ fileVersion = { 20151201 }
; Channel Label Type Format ; Channel Label Type Format
entry = time, "Time", float, "%.3f" entry = time, "Time", float, "%.3f"
entry = rpm, "RPM", int, "%d" entry = rpm, "RPM", int, "%d"
entry = coolant, "CLT", float, "%.1f" entry = coolant, "CLT", float, "%.2f"
entry = intake, "IAT", float, "%.1f" entry = intake, "IAT", float, "%.2f"
entry = TPS, "TPS", float, "%d" entry = TPS, "TPS", float, "%d"
entry = MAF, "MAF", float, "%.2f" entry = MAF, "MAF", float, "%.2f"
entry = MAPValue, "MAP", float, "%d" entry = MAPValue, "MAP", float, "%.1f"
entry = AFRactual, "AFR", float, "%.2f" entry = AFRactual, "AFR", float, "%.2f"
entry = VBatt, "vBatt", float, "%.2f" entry = VBatt, "vBatt", float, "%.2f"
entry = engineLoad, "Load", float, "%d" entry = engineLoad, "Load", float, "%.1f"
entry = ign_adv, "ignAdv", float, "%.2f" entry = ign_adv, "ignAdv", float, "%.2f"
entry = knockLevel, "Knock", float, "%.2f" entry = knockLevel, "Knock", float, "%.2f"
entry = vehicleSpeedKph, "speed", float, "%.2f" entry = vehicleSpeedKph, "speed", float, "%.2f"

View File

@ -39,7 +39,12 @@ void testIdleController(void) {
void testPidController(void) { void testPidController(void) {
print("******************************************* testPidController\r\n"); print("******************************************* testPidController\r\n");
Pid pid(50, 0.5, 0, 10, 90); pid_s pidS;
pidS.pFactor = 50;
pidS.iFactor = 0.5;
pidS.dFactor = 0;
Pid pid(&pidS, 10, 90);
assertEquals(90, pid.getValue(14, 12, 0.1)); assertEquals(90, pid.getValue(14, 12, 0.1));