Commit 2173373
authored
ledc.c: Fix analogWrite() last channel available verification (#8509)
* Fix analogWrite channel available verification
The last channel allocated is number 0, which conflicted with the value given to an uninitialized pin, giving the "No more analogWrite channels available!" error when trying to use it
Pins are now given the value -1 to indicate that they are not used so channel 0 can be used without errors.
* Fix incorrect array initialization
Keeping array of zeros for `pin_to_channel` and shifting stored channel
values by +1 to keep the pin with channel 0 from being interpreted as unused.
ref: #8509 (comment)1 parent e2c4799 commit 2173373
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
0 commit comments