disable interrupts in adc reading critical section
This commit is contained in:
@@ -227,6 +227,15 @@ void rtIgnitionTask::rtIgnitionTask_realtime(void *pvParameters)
|
|||||||
|
|
||||||
if (cycle12 && cycle34) // wait for both 12 and 34 cycles to complete before sending data to main loop and resetting peak detectors
|
if (cycle12 && cycle34) // wait for both 12 and 34 cycles to complete before sending data to main loop and resetting peak detectors
|
||||||
{
|
{
|
||||||
|
// disable interrupts during adc samples
|
||||||
|
disableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_12p));
|
||||||
|
disableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_12n));
|
||||||
|
disableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_34p));
|
||||||
|
disableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_34n));
|
||||||
|
disableInterrupt(digitalPinToInterrupt(rt_int.spark_pin_12));
|
||||||
|
disableInterrupt(digitalPinToInterrupt(rt_int.spark_pin_34));
|
||||||
|
|
||||||
|
// reset coils 12 and 34 cycles
|
||||||
cycle12 = false;
|
cycle12 = false;
|
||||||
cycle34 = false;
|
cycle34 = false;
|
||||||
|
|
||||||
@@ -284,9 +293,18 @@ void rtIgnitionTask::rtIgnitionTask_realtime(void *pvParameters)
|
|||||||
if (xQueueSendToBack(rt_queue, (void *)&ign_box_sts, 0) != pdPASS)
|
if (xQueueSendToBack(rt_queue, (void *)&ign_box_sts, 0) != pdPASS)
|
||||||
ign_box_sts.n_queue_errors = ++n_errors;
|
ign_box_sts.n_queue_errors = ++n_errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// enable interrupts ready for a new cycle
|
||||||
|
enableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_12p));
|
||||||
|
enableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_12n));
|
||||||
|
enableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_34p));
|
||||||
|
enableInterrupt(digitalPinToInterrupt(rt_int.trig_pin_34n));
|
||||||
|
enableInterrupt(digitalPinToInterrupt(rt_int.spark_pin_12));
|
||||||
|
enableInterrupt(digitalPinToInterrupt(rt_int.spark_pin_34));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete the timeout timer
|
// Delete the timeout timer
|
||||||
|
esp_timer_stop(timeout_timer);
|
||||||
esp_timer_delete(timeout_timer);
|
esp_timer_delete(timeout_timer);
|
||||||
LOG_WARN("rtTask Ending [", params->name.c_str(), "]");
|
LOG_WARN("rtTask Ending [", params->name.c_str(), "]");
|
||||||
// Ignition A Interrupts DETACH
|
// Ignition A Interrupts DETACH
|
||||||
|
|||||||
Reference in New Issue
Block a user