better constraint validation
This commit is contained in:
parent
b377e1f2f0
commit
2ae53d1681
|
@ -2082,7 +2082,7 @@ typedef enum {
|
||||||
|
|
||||||
CUSTOM_INVALID_ADC = 6720,
|
CUSTOM_INVALID_ADC = 6720,
|
||||||
CUSTOM_INVALID_MODE_SETTING = 6721,
|
CUSTOM_INVALID_MODE_SETTING = 6721,
|
||||||
CUSTOM_ERR_6722 = 6722,
|
CUSTOM_ERR_TASK_TIMER_OVERFLOW = 6722,
|
||||||
CUSTOM_ERR_6723 = 6723,
|
CUSTOM_ERR_6723 = 6723,
|
||||||
CUSTOM_ERR_6724 = 6724,
|
CUSTOM_ERR_6724 = 6724,
|
||||||
CUSTOM_ERR_6725 = 6725,
|
CUSTOM_ERR_6725 = 6725,
|
||||||
|
|
|
@ -87,6 +87,16 @@ void SingleTimerExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeu
|
||||||
void SingleTimerExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitime_t nt, action_s action) {
|
void SingleTimerExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitime_t nt, action_s action) {
|
||||||
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
||||||
|
|
||||||
|
#if EFI_ENABLE_ASSERTS
|
||||||
|
int deltaTimeUs = nt - getTimeNowNt();
|
||||||
|
|
||||||
|
if (deltaTimeUs >= TOO_FAR_INTO_FUTURE) {
|
||||||
|
// we are trying to set callback for too far into the future. This does not look right at all
|
||||||
|
firmwareError(CUSTOM_ERR_TASK_TIMER_OVERFLOW, "scheduleByTimestampNt() too far: %d", deltaTimeUs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
scheduleCounter++;
|
scheduleCounter++;
|
||||||
bool alreadyLocked = true;
|
bool alreadyLocked = true;
|
||||||
if (!reentrantFlag) {
|
if (!reentrantFlag) {
|
||||||
|
|
|
@ -82,9 +82,9 @@ void setHardwareUsTimer(int32_t deltaTimeUs) {
|
||||||
if (deltaTimeUs < 2)
|
if (deltaTimeUs < 2)
|
||||||
deltaTimeUs = 2; // for some reason '1' does not really work
|
deltaTimeUs = 2; // for some reason '1' does not really work
|
||||||
efiAssertVoid(CUSTOM_ERR_6681, deltaTimeUs > 0, "not positive deltaTimeUs");
|
efiAssertVoid(CUSTOM_ERR_6681, deltaTimeUs > 0, "not positive deltaTimeUs");
|
||||||
if (deltaTimeUs >= 10 * US_PER_SECOND) {
|
if (deltaTimeUs >= TOO_FAR_INTO_FUTURE) {
|
||||||
// we are trying to set callback for too far into the future. This does not look right at all
|
// we are trying to set callback for too far into the future. This does not look right at all
|
||||||
firmwareError(CUSTOM_ERR_TIMER_OVERFLOW, "setHardwareUsTimer() too long: %d", deltaTimeUs);
|
firmwareError(CUSTOM_ERR_TIMER_OVERFLOW, "setHardwareUsTimer() too far: %d", deltaTimeUs);
|
||||||
// let's make this look special and NOT toggle enginePins.debugSetTimer
|
// let's make this look special and NOT toggle enginePins.debugSetTimer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ extern "C"
|
||||||
void initMicrosecondTimer(void);
|
void initMicrosecondTimer(void);
|
||||||
void setHardwareUsTimer(int32_t deltaTimeUs);
|
void setHardwareUsTimer(int32_t deltaTimeUs);
|
||||||
|
|
||||||
|
#define TOO_FAR_INTO_FUTURE 10 * US_PER_SECOND
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
Loading…
Reference in New Issue