Skip to content

Conversation

@perpernorbi
Copy link

The conversion was just backwards. In COMPAT_MODE, period value of 1000
corresponds to 1kHz, while, without COMPAT_MODE, 5000 corresponds to
the same period. So when SDK_PWM_PERIOD_COMPAT_MODE is set, period
should be multiplied by 5. For the same reason, duty needs to be
divided by 5.

The conversion was just backwards. In COMPAT_MODE, period value of 1000
corresponds to 1kHz, while, without COMPAT_MODE, 5000 corresponds to
the same period. So when SDK_PWM_PERIOD_COMPAT_MODE is set, period
should be multiplied by 5. For the same reason, duty needs to be
divided by 5.
perpernorbi added a commit to perpernorbi/Sming that referenced this pull request Aug 24, 2018
Conversions in pwm.c are bugous. Fix is already available for the
original repository, but the merge request has not yet been accepted.
See StefanBruens/ESP8266_new_pwm#26
for details.
slaff pushed a commit to SmingHub/Sming that referenced this pull request Aug 28, 2018
* Fix duty and period conversion in pwm.c
Conversions in pwm.c are bugous. Fix is already available for the
original repository, but the merge request has not yet been accepted.
See StefanBruens/ESP8266_new_pwm#26
for details.

* Create macro to calculate max duty

* Remove hard-coded maximum duty

Class HardwarePWM actually provides a function to query the maximum
value of duty.

* Fix comment

ENABLE_CUSTOM_PWM defaults to 1 since d870c27.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant