auto-sync

This commit is contained in:
rusEfi 2016-06-27 22:02:41 -04:00
parent 076d0159db
commit 55d8acc7af
3 changed files with 34 additions and 0 deletions

View File

@ -72,6 +72,8 @@
#define EFI_ALTERNATOR_CONTROL TRUE
#define EFI_AUX_PID TRUE
#define EFI_SIGNAL_EXECUTOR_SLEEP FALSE
#define EFI_SIGNAL_EXECUTOR_ONE_TIMER TRUE
#define EFI_SIGNAL_EXECUTOR_HW_TIMER FALSE

View File

@ -7,7 +7,34 @@
#include "aux_pid.h"
#if EFI_AUX_PID || defined(__DOXYGEN__)
EXTERN_ENGINE
;
// todo: this is to some extent a copy-paste of alternatorController. maybe same loop
// for all PIDs?
static THD_WORKING_AREA(auxPidThreadStack, UTILITY_THREAD_STACK_SIZE);
static msg_t auxPidThread(int param) {
UNUSED(param);
chRegSetThreadName("AuxPidController");
while (true) {
int dt = maxI(10, engineConfiguration->auxPid1DT);
chThdSleepMilliseconds(dt);
}
#if defined __GNUC__
return -1;
#endif
}
void initAuxPid(Logging *sharedLogger) {
chThdCreateStatic(auxPidThreadStack, sizeof(auxPidThreadStack), LOWPRIO,
(tfunc_t) auxPidThread, NULL);
}
#endif

View File

@ -50,6 +50,7 @@
#include "alternatorController.h"
#include "fuel_math.h"
#include "settings.h"
#include "aux_pid.h"
#if HAL_USE_ADC || defined(__DOXYGEN__)
#include "AdcConfiguration.h"
@ -617,6 +618,10 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S) {
initAlternatorCtrl(sharedLogger);
#endif
#if EFI_AUX_PID || defined(__DOXYGEN__)
initAuxPid(sharedLogger);
#endif
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
initElectronicThrottle();
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */