auto-sync

This commit is contained in:
rusEfi 2015-05-13 20:09:11 -04:00
parent df837a8746
commit 157403ffe8
1 changed files with 10 additions and 9 deletions

View File

@ -53,10 +53,20 @@ static void applySettings(void) {
altPid.updateFactors(engineConfiguration->alternatorControlPFactor, 0, 0);
}
static void showAltInfo(void) {
scheduleMsg(logger, "alt=%s @ %s", boolToString(engineConfiguration->isAlternatorControlEnabled),
hwPortname(boardConfiguration->alternatorControlPin));
scheduleMsg(logger, "p=%f/i=%f/d=%f", engineConfiguration->alternatorControlPFactor,
0, 0); // todo: i & d
scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(engineConfiguration), currentAltDuty,
boardConfiguration->targetVBatt);
}
static void setAltPFactor(float p) {
engineConfiguration->alternatorControlPFactor = p;
scheduleMsg(logger, "setAltPid: %f", p);
applySettings();
showAltInfo();
}
static void applyAlternatorPinState(PwmConfig *state, int stateIndex) {
@ -68,15 +78,6 @@ static void applyAlternatorPinState(PwmConfig *state, int stateIndex) {
output->setValue(value);
}
static void showAltInfo(void) {
scheduleMsg(logger, "alt=%s @ %s", boolToString(engineConfiguration->isAlternatorControlEnabled),
hwPortname(boardConfiguration->alternatorControlPin));
scheduleMsg(logger, "p=%f/i=%f/d=%f", engineConfiguration->alternatorControlPFactor,
0, 0); // todo: i & d
scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(engineConfiguration), currentAltDuty,
boardConfiguration->targetVBatt);
}
void initAlternatorCtrl(Logging *sharedLogger) {
logger = sharedLogger;
if (boardConfiguration->alternatorControlPin == GPIO_UNASSIGNED)