auto-sync

This commit is contained in:
rusEfi 2015-05-21 20:05:52 -04:00
parent ac2d51626f
commit f536633c2f
6 changed files with 11 additions and 8 deletions

View File

@ -391,6 +391,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->HD44780width = 20; engineConfiguration->HD44780width = 20;
engineConfiguration->HD44780height = 4; engineConfiguration->HD44780height = 4;
engineConfiguration->alternatorOffset = 0;
engineConfiguration->alternatorControlPFactor = 30; engineConfiguration->alternatorControlPFactor = 30;
boardConfiguration->alternatorDT = 100; boardConfiguration->alternatorDT = 100;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Wed May 13 20:30:29 EDT 2015 // this section was generated by config_definition.jar on Thu May 21 19:13:37 EDT 2015
// begin // begin
#include "rusefi_types.h" #include "rusefi_types.h"
typedef struct { typedef struct {
@ -896,7 +896,7 @@ typedef struct {
/** /**
* offset 604 * offset 604
*/ */
float unused596; float alternatorOffset;
/** /**
* @see hasBaroSensor * @see hasBaroSensor
* offset 608 * offset 608
@ -1302,4 +1302,4 @@ typedef struct {
} persistent_config_s; } persistent_config_s;
// end // end
// this section was generated by config_definition.jar on Wed May 13 20:30:29 EDT 2015 // this section was generated by config_definition.jar on Thu May 21 19:13:37 EDT 2015

View File

@ -192,7 +192,7 @@
#define afr_v2_offset_hex 254 #define afr_v2_offset_hex 254
#define afr_value2_offset 600 #define afr_value2_offset 600
#define afr_value2_offset_hex 258 #define afr_value2_offset_hex 258
#define unused596_offset 604 #define alternatorOffset_offset 604
#define baroSensor_offset 608 #define baroSensor_offset 608
#define baroSensor_offset_hex 260 #define baroSensor_offset_hex 260
#define baroSensor_valueAt0_offset 608 #define baroSensor_valueAt0_offset 608

View File

@ -36,7 +36,7 @@ static msg_t AltCtrlThread(int param) {
while (true) { while (true) {
chThdSleepMilliseconds(boardConfiguration->alternatorDT); chThdSleepMilliseconds(boardConfiguration->alternatorDT);
currentAltDuty = altPid.getValue(boardConfiguration->targetVBatt, getVBatt(engineConfiguration), 1); currentAltDuty = engineConfiguration->alternatorOffset + altPid.getValue(boardConfiguration->targetVBatt, getVBatt(engineConfiguration), 1);
if (boardConfiguration->isVerboseAlternator) { if (boardConfiguration->isVerboseAlternator) {
scheduleMsg(logger, "alt duty: %f/vbatt=%f/p=%f/i=%f/d=%f int=%f", currentAltDuty, getVBatt(engineConfiguration), scheduleMsg(logger, "alt duty: %f/vbatt=%f/p=%f/i=%f/d=%f int=%f", currentAltDuty, getVBatt(engineConfiguration),
altPid.getP(), altPid.getI(), altPid.getD(), altPid.getIntegration()); altPid.getP(), altPid.getI(), altPid.getD(), altPid.getIntegration());
@ -57,8 +57,8 @@ void showAltInfo(void) {
scheduleMsg(logger, "alt=%s @%s t=%dms", boolToString(engineConfiguration->isAlternatorControlEnabled), scheduleMsg(logger, "alt=%s @%s t=%dms", boolToString(engineConfiguration->isAlternatorControlEnabled),
hwPortname(boardConfiguration->alternatorControlPin), hwPortname(boardConfiguration->alternatorControlPin),
boardConfiguration->alternatorDT); boardConfiguration->alternatorDT);
scheduleMsg(logger, "p=%f/i=%f/d=%f", engineConfiguration->alternatorControlPFactor, scheduleMsg(logger, "p=%f/i=%f/d=%f offset=%f", engineConfiguration->alternatorControlPFactor,
0, 0); // todo: i & d 0, 0, engineConfiguration->alternatorOffset); // todo: i & d
scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(engineConfiguration), currentAltDuty, scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(engineConfiguration), currentAltDuty,
boardConfiguration->targetVBatt); boardConfiguration->targetVBatt);
} }

View File

@ -946,6 +946,8 @@ static void setValue(const char *paramStr, const char *valueStr) {
boardConfiguration->alternatorDT = valueI; boardConfiguration->alternatorDT = valueI;
} }
showAltInfo(); showAltInfo();
} else if (strEqualCaseInsensitive(paramStr, "alt_offset")) {
engineConfiguration->alternatorOffset = valueI;
} else if (strEqualCaseInsensitive(paramStr, "alt_p")) { } else if (strEqualCaseInsensitive(paramStr, "alt_p")) {
setAltPFactor(valueF); setAltPFactor(valueF);
#endif #endif

View File

@ -278,7 +278,7 @@ end_struct
afr_sensor_s afr;@see hasAfrSensor afr_sensor_s afr;@see hasAfrSensor
float unused596; float alternatorOffset;
air_pressure_sensor_config_s baroSensor;@see hasBaroSensor air_pressure_sensor_config_s baroSensor;@see hasBaroSensor