auto-sync
This commit is contained in:
parent
a5cd50b59a
commit
d7c2bc9e85
|
@ -482,6 +482,8 @@ void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputC
|
|||
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engine));
|
||||
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(engine));
|
||||
#endif
|
||||
tsOutputChannels->clutchUpState = engine->clutchUpState;
|
||||
tsOutputChannels->clutchDownState = engine->clutchDownState;
|
||||
tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake);
|
||||
float timing = getAdvance(rpm, engineLoad PASS_ENGINE_PARAMETER);
|
||||
tsOutputChannels->inj_adv = timing > 360 ? timing - 720 : timing;
|
||||
|
|
|
@ -70,6 +70,8 @@ typedef struct {
|
|||
unsigned int checkEngine : 1; // bit 8
|
||||
unsigned int needBurn : 1; // bit 9
|
||||
unsigned int secondTriggerChannelEnabled : 1; // bit 10
|
||||
unsigned int clutchUpState : 1; // bit 11
|
||||
unsigned int clutchDownState : 1; // bit 11
|
||||
float vehicleSpeedKph;
|
||||
unsigned int isTpsError : 1; // bit 0
|
||||
unsigned int isCltError : 1; // bit 1
|
||||
|
|
|
@ -41,6 +41,9 @@ public:
|
|||
float dwellAngle;
|
||||
float advance;
|
||||
|
||||
bool_t clutchUpState;
|
||||
bool_t clutchDownState;
|
||||
|
||||
trigger_shape_s triggerShape;
|
||||
|
||||
float angleExtra[IGNITION_PIN_COUNT];
|
||||
|
|
|
@ -36,11 +36,6 @@
|
|||
|
||||
static THD_WORKING_AREA(ivThreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||
|
||||
/**
|
||||
* here we keep the value we got from IDLE SWITCH input
|
||||
*/
|
||||
static volatile int idleSwitchState;
|
||||
|
||||
static Logging logger;
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
@ -52,10 +47,6 @@ static SimplePwm idleValvePwm;
|
|||
*/
|
||||
static IdleValveState idle;
|
||||
|
||||
int getIdleSwitch() {
|
||||
return idleSwitchState;
|
||||
}
|
||||
|
||||
void idleDebug(const char *msg, percent_t value) {
|
||||
printMsg(&logger, "%s%f", msg, value);
|
||||
scheduleLogging(&logger);
|
||||
|
@ -97,9 +88,13 @@ static msg_t ivThread(int param) {
|
|||
|
||||
// this value is not used yet
|
||||
if (boardConfiguration->clutchDownPin != GPIO_UNASSIGNED) {
|
||||
idleSwitchState = palReadPad(getHwPort(boardConfiguration->clutchDownPin),
|
||||
engine->clutchDownState = palReadPad(getHwPort(boardConfiguration->clutchDownPin),
|
||||
getHwPin(boardConfiguration->clutchDownPin));
|
||||
}
|
||||
if (engineConfiguration->clutchUpPin != GPIO_UNASSIGNED) {
|
||||
engine->clutchUpState = palReadPad(getHwPort(engineConfiguration->clutchUpPin),
|
||||
getHwPin(engineConfiguration->clutchUpPin));
|
||||
}
|
||||
|
||||
if (engineConfiguration->idleMode != IM_AUTO)
|
||||
continue;
|
||||
|
@ -150,10 +145,11 @@ void startIdleThread(Engine *engine) {
|
|||
// this is idle switch INPUT - sometimes there is a switch on the throttle pedal
|
||||
// this switch is not used yet
|
||||
if (boardConfiguration->clutchDownPin != GPIO_UNASSIGNED)
|
||||
mySetPadMode2("clutch down switch", boardConfiguration->clutchDownPin, PAL_MODE_INPUT);
|
||||
mySetPadMode2("clutch down switch", boardConfiguration->clutchDownPin,
|
||||
getInputMode(boardConfiguration->clutchDownPinMode));
|
||||
|
||||
if (engineConfiguration->clutchUpPin != GPIO_UNASSIGNED)
|
||||
mySetPadMode2("clutch up switch", engineConfiguration->clutchUpPin, PAL_MODE_INPUT);
|
||||
mySetPadMode2("clutch up switch", engineConfiguration->clutchUpPin, getInputMode(engineConfiguration->clutchUpPinMode));
|
||||
|
||||
addConsoleAction("idleinfo", showIdleInfo);
|
||||
addConsoleActionI("set_idle_rpm", setIdleRpmAction);
|
||||
|
|
|
@ -12,6 +12,5 @@
|
|||
#include "engine.h"
|
||||
|
||||
void startIdleThread(Engine *engine);
|
||||
int getIdleSwitch(void);
|
||||
|
||||
#endif /* IDLE_THREAD_H_ */
|
||||
|
|
|
@ -144,6 +144,18 @@ void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode) {
|
|||
mySetPadMode(msg, getHwPort(pin), getHwPin(pin), mode);
|
||||
}
|
||||
|
||||
iomode_t getInputMode(pin_input_mode_e mode) {
|
||||
switch (mode) {
|
||||
case PI_PULLUP:
|
||||
return PAL_MODE_INPUT_PULLUP;
|
||||
case PI_PULLDOWN:
|
||||
return PAL_MODE_INPUT_PULLDOWN;
|
||||
case PI_DEFAULT:
|
||||
default:
|
||||
return PAL_MODE_INPUT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method would set an error condition if pin is already used
|
||||
*/
|
||||
|
|
|
@ -28,6 +28,7 @@ void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode);
|
|||
char *portname(GPIO_TypeDef* GPIOx);
|
||||
// does not exactly belong here, but that works better for tests
|
||||
void outputPinRegister(const char *msg, io_pin_e ioPin, GPIO_TypeDef *port, uint32_t pin);
|
||||
iomode_t getInputMode(pin_input_mode_e mode);
|
||||
|
||||
ioportmask_t getHwPin(brain_pin_e brainPin);
|
||||
GPIO_TypeDef * getHwPort(brain_pin_e brainPin);
|
||||
|
|
Loading…
Reference in New Issue