8000 Waveform: int/uint8_t inconsistency and implied stop PWM by dok-net · Pull Request #8008 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Waveform: int/uint8_t inconsistency and implied stop PWM #8008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean code.
  • Loading branch information
dok-net committed Dec 23, 2022
commit 5de25bde5e3a947bc6f0f275ba6725451f5f8ef8
4 changes: 3 additions & 1 deletion cores/esp8266/core_esp8266_wiring_pwm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ extern void __analogWriteMode(uint8_t pin, int val, bool openDrain) {
// val: the duty cycle: between 0 (always off) and 255 (always on).
// So if val = 0 we have digitalWrite(LOW), if we have val==range we have digitalWrite(HIGH)
if (_setPWM(pin, val, analogScale)) {
if (val > 0 && val < analogScale) analogMap |= (1 << pin);
if (val > 0 && val < analogScale) {
analogMap |= (1 << pin);
}
} else {
const bool detach = (val == 0 || val == analogScale);
// To go steady LOW or HIGH, let the waveform run into next duty cycle, if any. Then stop.
Expand Down
0