#640 Occasional halts on "Burn" in TunerStudio ("Red" LED is on)
This commit is contained in:
parent
aeea2b95d0
commit
d55c7dd856
|
@ -1932,7 +1932,7 @@ typedef enum {
|
|||
|
||||
CUSTOM_ERR_6570 = 6570,
|
||||
CUSTOM_ERR_6571 = 6571,
|
||||
CUSTOM_ERR_6572 = 6572,
|
||||
CUSTOM_ERR_ARRAY_REMOVE = 6572,
|
||||
CUSTOM_ERR_6573 = 6573,
|
||||
CUSTOM_ERR_6574 = 6574,
|
||||
CUSTOM_ERR_6575 = 6575,
|
||||
|
@ -2070,9 +2070,9 @@ typedef enum {
|
|||
CUSTOM_ERR_6695 = 6695,
|
||||
CUSTOM_ERR_6696 = 6696,
|
||||
CUSTOM_ERR_6697 = 6697,
|
||||
CUSTOM_ERR_6698 = 6698,
|
||||
CUSTOM_ERR_6699 = 6699,
|
||||
CUSTOM_ERR_6700 = 6700,
|
||||
CUSTOM_ERR_ARRAY_IS_FULL = 6698,
|
||||
CUSTOM_ERR_ARRAY_REMOVE_ERROR = 6699,
|
||||
CUSTOM_ERR_INVALID_INPUT_ICU_PIN = 6700,
|
||||
|
||||
// this is needed for proper enum size, this matters for malfunction_central
|
||||
Internal_ForceMyEnumIntSize_cranking_obd_code = ENUM_32_BITS,
|
||||
|
|
|
@ -107,7 +107,7 @@ ArrayList<Type, Dimention>::ArrayList(void) {
|
|||
|
||||
template<class Type, int Dimention>
|
||||
void ArrayList<Type, Dimention>::removeAt(int index) {
|
||||
efiAssertVoid(CUSTOM_ERR_6572, index < size, "index greater then size");
|
||||
efiAssertVoid(CUSTOM_ERR_ARRAY_REMOVE, index >= 0 && index < size, "invalid index");
|
||||
memcpy(&elements[index], &elements[size - 1], sizeof(Type));
|
||||
memset(&elements[size - 1], 0, sizeof(Type));
|
||||
size--;
|
||||
|
|
|
@ -127,12 +127,11 @@ static void initWave(const char *name, int index) {
|
|||
reader->name = name;
|
||||
|
||||
reader->hw = addWaveAnalyzerDriver("wave input", brainPin);
|
||||
if (reader->hw != NULL) {
|
||||
reader->hw->widthListeners.registerCallback((VoidInt)(void*) waAnaWidthCallback, (void*) reader);
|
||||
|
||||
|
||||
reader->hw->widthListeners.registerCallback((VoidInt)(void*) waAnaWidthCallback, (void*) reader);
|
||||
|
||||
reader->hw->periodListeners.registerCallback((VoidInt)(void*) waIcuPeriodCallback, (void*) reader);
|
||||
|
||||
reader->hw->periodListeners.registerCallback((VoidInt)(void*) waIcuPeriodCallback, (void*) reader);
|
||||
}
|
||||
|
||||
print("wave%d input on %s\r\n", index, hwPortname(brainPin));
|
||||
startInputDriver(reader->hw, mode);
|
||||
|
|
|
@ -46,6 +46,7 @@ static ICUConfig wave_icucfg = { ICU_INPUT_ACTIVE_LOW, CORE_CLOCK / 100, icuWidt
|
|||
|
||||
static ArrayList<digital_input_s, 8> registeredIcus;
|
||||
|
||||
//Nullable
|
||||
static digital_input_s * finddigital_input_s(ICUDriver *driver) {
|
||||
for (int i = 0; i < registeredIcus.size; i++) {
|
||||
if (registeredIcus.elements[i].driver == driver) {
|
||||
|
@ -145,8 +146,9 @@ icuchannel_t getInputCaptureChannel(brain_pin_e hwPin) {
|
|||
*
|
||||
* TODO: migrate slow ADC to software timer so that TIM8 is also available for input capture
|
||||
* todo: https://github.com/rusefi/rusefi/issues/630 ?
|
||||
*
|
||||
* @return NULL if pin could not be used for ICU
|
||||
*/
|
||||
//Nullable
|
||||
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin) {
|
||||
if (hwPin == GPIO_UNASSIGNED || hwPin == GPIO_INVALID) {
|
||||
return NULL;
|
||||
|
@ -208,6 +210,10 @@ void turnOnCapturePin(const char *msg, brain_pin_e brainPin) {
|
|||
*/
|
||||
digital_input_s * addWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
||||
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
|
||||
if (driver == NULL) {
|
||||
warning(CUSTOM_ERR_INVALID_INPUT_ICU_PIN, "not input pin");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
digital_input_s *hw = registeredIcus.add();
|
||||
hw->widthListeners.clear();
|
||||
|
@ -247,7 +253,13 @@ void removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
|||
}
|
||||
}
|
||||
|
||||
void startInputDriver(digital_input_s *hw, bool isActiveHigh) {
|
||||
void startInputDriver(/*nullable*/digital_input_s *hw, bool isActiveHigh) {
|
||||
if (hw == NULL) {
|
||||
// we can get NULL driver if user somehow has invalid pin in his configuration
|
||||
warning(CUSTOM_ERR_INVALID_INPUT_ICU_PIN, "not input pin");
|
||||
return;
|
||||
}
|
||||
|
||||
hw->isActiveHigh = isActiveHigh;
|
||||
if (hw->isActiveHigh) {
|
||||
wave_icucfg.mode = ICU_INPUT_ACTIVE_HIGH;
|
||||
|
|
|
@ -26,10 +26,12 @@ typedef struct {
|
|||
void turnOnCapturePin(const char *msg, brain_pin_e brainPin);
|
||||
|
||||
digital_input_s *addWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||
void startInputDriver(digital_input_s *hw, bool isActiveHigh);
|
||||
void startInputDriver(/*nullable*/digital_input_s *hw, bool isActiveHigh);
|
||||
void removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||
|
||||
//Nullable
|
||||
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
|
||||
//Nullable
|
||||
icuchannel_t getInputCaptureChannel(brain_pin_e hwPin);
|
||||
|
||||
#endif /* HAL_USE_ICU */
|
||||
|
|
Loading…
Reference in New Issue