put ignition pin back

This commit is contained in:
Matthew Kennedy 2024-07-03 01:24:14 -07:00
parent 3986ddab31
commit 06e52a0bc7
2 changed files with 21 additions and 0 deletions

View File

@ -137,6 +137,25 @@ static brain_pin_e parseBrainPinWithErrorMessage(const char *pinName) {
return pin;
}
/**
* For example:
* set_ignition_pin 1 PD7
* todo: this method counts index from 1 while at least 'set_trigger_input_pin' counts from 0.
* todo: make things consistent
*/
static void setIgnitionPin(const char *indexStr, const char *pinName) {
int index = atoi(indexStr) - 1; // convert from human index into software index
if (index < 0 || index >= MAX_CYLINDER_COUNT)
return;
brain_pin_e pin = parseBrainPinWithErrorMessage(pinName);
if (pin == Gpio::Invalid) {
return;
}
efiPrintf("setting ignition pin[%d] to %s please save&restart", index, hwPortname(pin));
engineConfiguration->ignitionPins[index] = pin;
incrementGlobalConfigurationVersion();
}
static void setIndividualPin(const char *pinName, brain_pin_e *targetPin, const char *name) {
brain_pin_e pin = parseBrainPinWithErrorMessage(pinName);
if (pin == Gpio::Invalid) {
@ -479,6 +498,7 @@ void initSettings() {
addConsoleActionS("get", getValue);
#if EFI_PROD_CODE
addConsoleActionSS(CMD_IGNITION_PIN, setIgnitionPin);
addConsoleActionSS(CMD_TRIGGER_PIN, setTriggerInputPin);
addConsoleActionSS(CMD_TRIGGER_SIMULATOR_PIN, setTriggerSimulatorPin);

View File

@ -1774,6 +1774,7 @@ end_struct
#define CMD_IDLE_PIN "set_idle_pin"
#define CMD_BOOST_PIN "set_boost_pin"
#define CMD_TRIGGER_SIMULATOR_PIN "set_trigger_simulator_pin"
#define CMD_IGNITION_PIN "set_ignition_pin"
#define CMD_RESET_ENGINE_SNIFFER "reset_engine_chart"
#define CMD_FUNCTIONAL_TEST_MODE "test_mode"