SENT fixes (#4687)

* SENT: cache current setting to do proper clean-up on stop

* SENT: microRusEfi supports send on "AN temp 2" = PA1 only

* SENT: microRusEfi: fix pin number

* SENT: use activeConfiguration during sentStop()

* MRE: pin 23: can accept events (for SENT)
This commit is contained in:
Andrey G 2022-10-20 20:33:16 +03:00 committed by GitHub
parent ea8f75a6cb
commit a50f898982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 16 deletions

View File

@ -157,8 +157,8 @@ pins:
type: at
- pin: 23
id: [A1, EFI_ADC_1]
class: [switch_inputs, analog_inputs]
id: [A1, A1, EFI_ADC_1]
class: [event_inputs, switch_inputs, analog_inputs]
color: dark green
function: IAT sensor
ts_name: 23 - AN temp 2

View File

@ -1,5 +1,5 @@
microRusEFI
24 - AN temp 3
PA2
23 - AN temp 2
PA1
ICU2

View File

@ -50,29 +50,36 @@ static ICUConfig icucfg_in1 =
.arr = 0xFFFFFFFFU,
};
/* current config */
static brain_input_pin_e sentPins[SENT_INPUT_COUNT];
void startSent()
{
brain_pin_e sentPin = engineConfiguration->sentInputPins[0];
for (int i = 0; i < SENT_INPUT_COUNT; i++) {
brain_input_pin_e sentPin = engineConfiguration->sentInputPins[i];
if (isBrainPinValid(sentPin)) {
efiSetPadMode("SENT", sentPin, SENT_INPUT_AF);
if (isBrainPinValid(sentPin)) {
efiSetPadMode("SENT", sentPin, SENT_INPUT_AF);
icuStart(&SENT_ICU_UNIT, &icucfg_in1);
icuStartCapture(&SENT_ICU_UNIT);
icuEnableNotifications(&SENT_ICU_UNIT);
icuStart(&SENT_ICU_UNIT, &icucfg_in1);
icuStartCapture(&SENT_ICU_UNIT);
icuEnableNotifications(&SENT_ICU_UNIT);
}
}
}
void stopSent()
{
brain_pin_e sentPin = engineConfiguration->sentInputPins[0];
for (int i = 0; i < SENT_INPUT_COUNT; i++) {
brain_input_pin_e sentPin = activeConfiguration.sentInputPins[i];
if (isBrainPinValid(sentPin)) {
icuDisableNotifications(&SENT_ICU_UNIT);
icuStopCapture(&SENT_ICU_UNIT);
icuStop(&SENT_ICU_UNIT);
if (isBrainPinValid(sentPin)) {
icuDisableNotifications(&SENT_ICU_UNIT);
icuStopCapture(&SENT_ICU_UNIT);
icuStop(&SENT_ICU_UNIT);
efiSetPadUnused(sentPin);
efiSetPadUnused(sentPin);
}
}
}