fix #129
This commit is contained in:
parent
41bcceae40
commit
2bb110e5e1
|
@ -139,10 +139,9 @@ efitimeus_t PwmConfig::togglePwmState() {
|
||||||
|
|
||||||
if (cisnan(periodNt)) {
|
if (cisnan(periodNt)) {
|
||||||
/**
|
/**
|
||||||
* NaN period means PWM is paused
|
* NaN period means PWM is paused, we also set the pin low
|
||||||
* TODO: what about pin state? low, high or random?
|
|
||||||
* TODO: cover this with a unit test
|
|
||||||
*/
|
*/
|
||||||
|
stateChangeCallback(this, 0);
|
||||||
return getTimeNowUs() + MS2US(NAN_FREQUENCY_SLEEP_PERIOD_MS);
|
return getTimeNowUs() + MS2US(NAN_FREQUENCY_SLEEP_PERIOD_MS);
|
||||||
}
|
}
|
||||||
if (mode != PM_NORMAL) {
|
if (mode != PM_NORMAL) {
|
||||||
|
|
|
@ -91,11 +91,11 @@ static void testSwitchToNanPeriod() {
|
||||||
|
|
||||||
expectedTimeOfNextEvent += 600;
|
expectedTimeOfNextEvent += 600;
|
||||||
assertEqualsM2("1@1000/NAN", expectedTimeOfNextEvent, schedulingQueue.getForUnitText(0)->momentX, 0);
|
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);
|
expectedTimeOfNextEvent += MS2US(NAN_FREQUENCY_SLEEP_PERIOD_MS);
|
||||||
assertEqualsM2("2@1000/NAN", expectedTimeOfNextEvent, schedulingQueue.getForUnitText(0)->momentX, 0);
|
assertEqualsM2("2@1000/NAN", expectedTimeOfNextEvent, schedulingQueue.getForUnitText(0)->momentX, 0);
|
||||||
assertNextEvent("exec3@NAN", 1);
|
assertNextEvent("exec3@NAN", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testPwmGenerator() {
|
void testPwmGenerator() {
|
||||||
|
|
Loading…
Reference in New Issue