[riot-notifications] [RIOT-OS/RIOT] cpu/esp8266: fix pwm_set func (#10982)

MrKevinWeiss notifications at github.com
Wed May 15 12:05:05 CEST 2019


MrKevinWeiss commented on this pull request.

It seems like the pwm osci with those settings have some issues on master and this PR seems to resolve them.  Tested with a scope.
It seems the code adds (80315 - 80223) 92 bytes or so, but I don't know how you can reduce so I think it is good.

>              break;
     }
 
-    _pwm_dev.chn[channel].next_off = _pwm_dev.chn[channel].next_on + value;
+    next_off = next_on + value;
+
+    next_on = (_pwm_dev.cycles < next_on) ? next_on : next_on + _pwm_dev.res;

I find 
```c
if (_pwm_dev.cycles >= next_on) {
    next_on += _pwm_dev.res;
}
```
a bit easier to read but I won't push, just a suggestion (even though it is more lines)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10982#pullrequestreview-237724899
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190515/8674ec80/attachment.html>


More information about the notifications mailing list