icuStartCapture panic better state validation

This commit is contained in:
rusefi 2017-04-26 11:57:02 -04:00
parent 429847a4d9
commit cc55c143f5
4 changed files with 15 additions and 1 deletions

View File

@ -547,6 +547,16 @@ void chDbgPanic3(const char *msg, const char * file, int line);
#define hasFatalError() (FALSE)
#endif
#define chDbgAssert(c, remark) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
/*lint -restore*/ \
chSysHalt(remark); \
} \
} \
} while (false)
#endif /* _CHCONF_H_ */
/** @} */

View File

@ -211,6 +211,8 @@ void startInputDriver(digital_input_s *hw, bool isActiveHigh) {
}
wave_icucfg.channel = getInputCaptureChannel(hw->brainPin);
efiIcuStart(driver, &wave_icucfg);
efiAssertVoid(driver != NULL, "di: driver is NULL");
efiAssertVoid(driver->state == ICU_READY, "di: driver not ready");
icuStartCapture(driver); // this would change state from READY to WAITING
icuEnableNotifications(driver);
}

View File

@ -123,6 +123,8 @@ static ICUDriver *turnOnTriggerInputPin(const char *msg, brain_pin_e hwPin, ICUC
efiIcuStart(driver, icucfg);
if (driver->state == ICU_READY) {
efiAssertVoid(driver != NULL, "ti: driver is NULL");
efiAssertVoid(driver->state == ICU_READY, "ti: driver not ready");
icuStartCapture(driver); // this would change state from READY to WAITING
icuEnableNotifications(driver);
} else {

View File

@ -251,5 +251,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20170424;
return 20170426;
}