useful content from Move ETB control to a thread #1374
This commit is contained in:
parent
d25c33492b
commit
44facf1140
|
@ -387,6 +387,11 @@ void EtbController::update(efitick_t nowNt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
|
/**
|
||||||
|
* Things running on a timer (instead of a thread) don't participate it the RTOS's thread priority system,
|
||||||
|
* and operate essentially "first come first serve", which risks starvation.
|
||||||
|
* Since ETB is a safety critical device, we need the hard RTOS guarantee that it will be scheduled over other less important tasks.
|
||||||
|
*/
|
||||||
#include "periodic_thread_controller.h"
|
#include "periodic_thread_controller.h"
|
||||||
struct EtbImpl final : public EtbController, public PeriodicController<512> {
|
struct EtbImpl final : public EtbController, public PeriodicController<512> {
|
||||||
EtbImpl() : PeriodicController("ETB", NORMALPRIO + 3, ETB_LOOP_FREQUENCY) {}
|
EtbImpl() : PeriodicController("ETB", NORMALPRIO + 3, ETB_LOOP_FREQUENCY) {}
|
||||||
|
|
|
@ -7,7 +7,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
|
/**
|
||||||
|
* Hard code ETB update speed.
|
||||||
|
* Since this is a safety critical system with no real reason for a user to ever need to change the update rate,
|
||||||
|
* it's locked to 500hz, along with the ADC.
|
||||||
|
* https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
|
||||||
|
*/
|
||||||
#define ETB_LOOP_FREQUENCY 500
|
#define ETB_LOOP_FREQUENCY 500
|
||||||
#define DEFAULT_ETB_PWM_FREQUENCY 800
|
#define DEFAULT_ETB_PWM_FREQUENCY 800
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue