This commit is contained in:
rusefi 2018-12-08 23:02:51 -05:00
parent 41bcceae40
commit 2bb110e5e1
2 changed files with 4 additions and 5 deletions

View File

@ -139,10 +139,9 @@ efitimeus_t PwmConfig::togglePwmState() {
if (cisnan(periodNt)) {
/**
* NaN period means PWM is paused
* TODO: what about pin state? low, high or random?
* TODO: cover this with a unit test
* NaN period means PWM is paused, we also set the pin low
*/
stateChangeCallback(this, 0);
return getTimeNowUs() + MS2US(NAN_FREQUENCY_SLEEP_PERIOD_MS);
}
if (mode != PM_NORMAL) {

View File

@ -91,11 +91,11 @@ static void testSwitchToNanPeriod() {
expectedTimeOfNextEvent += 600;
assertEqualsM2("1@1000/NAN", expectedTimeOfNextEvent, schedulingQueue.getForUnitText(0)->momentX, 0);
assertNextEvent("exec2@70", 1);
assertNextEvent("exec2@NAN", 0);
expectedTimeOfNextEvent += MS2US(NAN_FREQUENCY_SLEEP_PERIOD_MS);
assertEqualsM2("2@1000/NAN", expectedTimeOfNextEvent, schedulingQueue.getForUnitText(0)->momentX, 0);
assertNextEvent("exec3@NAN", 1);
assertNextEvent("exec3@NAN", 0);
}
void testPwmGenerator() {