auto-sync

This commit is contained in:
rusEfi 2015-03-13 21:05:50 -05:00
parent f72b8f37a7
commit 1955a7c220
5 changed files with 17 additions and 15 deletions

View File

@ -140,14 +140,9 @@ static void reportSensorI(Logging *log, bool fileFormat, const char *caption, co
} }
} }
static const char* boolean2string(int value) {
return value ? "YES" : "NO";
}
EXTERN_ENGINE EXTERN_ENGINE
; ;
void printSensors(Logging *log, bool fileFormat) { void printSensors(Logging *log, bool fileFormat) {
// current time, in milliseconds // current time, in milliseconds
int nowMs = currentTimeMillis(); int nowMs = currentTimeMillis();
@ -663,7 +658,7 @@ void startStatusThreads(Engine *engine) {
} }
void setFullLog(int value) { void setFullLog(int value) {
print("Setting full logging: %s\r\n", boolean2string(value)); print("Setting full logging: %s\r\n", boolToString(value));
printMsg(&logger, "%s%d", FULL_LOGGING_KEY, value); printMsg(&logger, "%s%d", FULL_LOGGING_KEY, value);
fullLog = value; fullLog = value;
} }

View File

@ -29,17 +29,19 @@ static Pid altPid(10, 0, 0, 10, 90);
static THD_WORKING_AREA(alternatorControlThreadStack, UTILITY_THREAD_STACK_SIZE); static THD_WORKING_AREA(alternatorControlThreadStack, UTILITY_THREAD_STACK_SIZE);
static float currentAltDuty;
static msg_t AltCtrlThread(int param) { static msg_t AltCtrlThread(int param) {
chRegSetThreadName("AlternatorController"); chRegSetThreadName("AlternatorController");
while (true) { while (true) {
chThdSleepMilliseconds(100); chThdSleepMilliseconds(100);
float result = altPid.getValue(14, getVBatt(engineConfiguration), 1); currentAltDuty = altPid.getValue(14, getVBatt(engineConfiguration), 1);
if (boardConfiguration->isVerboseAlternator) { if (boardConfiguration->isVerboseAlternator) {
scheduleMsg(logger, "alt duty: %f", result); scheduleMsg(logger, "alt duty: %f/vbatt=%f", currentAltDuty, getVBatt(engineConfiguration));
} }
alternatorControl.setSimplePwmDutyCycle(result / 100); alternatorControl.setSimplePwmDutyCycle(currentAltDuty / 100);
} }
#if defined __GNUC__ #if defined __GNUC__
return -1; return -1;
@ -60,6 +62,11 @@ static void applyAlternatorPinState(PwmConfig *state, int stateIndex) {
output->setValue(value); output->setValue(value);
} }
static void showAltInfo(void) {
scheduleMsg(logger, "atl=%s", boolToString(engineConfiguration->isAlternatorControlEnabled));
scheduleMsg(logger, "vbatt=%f/duty=%f", getVBatt(engineConfiguration), currentAltDuty);
}
void initAlternatorCtrl(Logging *sharedLogger) { void initAlternatorCtrl(Logging *sharedLogger) {
logger = sharedLogger; logger = sharedLogger;
if (boardConfiguration->alternatorControlPin == GPIO_UNASSIGNED) if (boardConfiguration->alternatorControlPin == GPIO_UNASSIGNED)
@ -72,4 +79,5 @@ void initAlternatorCtrl(Logging *sharedLogger) {
(tfunc_t) AltCtrlThread, NULL); (tfunc_t) AltCtrlThread, NULL);
addConsoleActionF("alt_pid", setAltPid); addConsoleActionF("alt_pid", setAltPid);
addConsoleAction("altinfo", showAltInfo);
} }

View File

@ -98,6 +98,9 @@ static void printOutputs(engine_configuration_s *engineConfiguration) {
scheduleMsg(&logger, "mainRelay: mode %s @ %s", getPin_output_mode_e(boardConfiguration->mainRelayPinMode), scheduleMsg(&logger, "mainRelay: mode %s @ %s", getPin_output_mode_e(boardConfiguration->mainRelayPinMode),
hwPortname(boardConfiguration->mainRelayPin)); hwPortname(boardConfiguration->mainRelayPin));
scheduleMsg(&logger, "alternator field: mode %s @ %s", getPin_output_mode_e(boardConfiguration->alternatorControlPinMode),
hwPortname(boardConfiguration->alternatorControlPin));
} }
EXTERN_ENGINE EXTERN_ENGINE

View File

@ -276,5 +276,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] == 0) if (UNUSED_CCM_SIZE[0] == 0)
return 1; // this is here to make the compiler happy about the unused array return 1; // this is here to make the compiler happy about the unused array
return 20150311; return 20150313;
} }

View File

@ -85,12 +85,8 @@ public class SensorCentral {
for (SensorListener listener : listeners) for (SensorListener listener : listeners)
listener.onSensorUpdate(value); listener.onSensorUpdate(value);
ResponseImpl r = new ResponseImpl(); ResponseImpl r = new ResponseImpl();
LoggerData d = new LoggerData() { LoggerData d = new LoggerData() {
@Override @Override
public String toString() { public String toString() {
@ -99,7 +95,7 @@ public class SensorCentral {
@Override @Override
public String getId() { public String getId() {
return sensor.getName(); return sensor.name();
} }
@Override @Override