You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// duty cycle resolution (_depth) can be extracted from this formula: CLOCK_FREQUENCY > _frequency * 2^_depth
413
+
for (_depth = MAX_BIT_WIDTH; _depth > 8; _depth--) if (((CLOCK_FREQUENCY/_frequency) >> _depth) > 0) break;
387
414
388
415
#ifdef ESP8266
389
-
// duty cycle resolution (_depth) can be extracted from this formula: 1MHz > _frequency * 2^_depth
390
-
if (_frequency > 1760) _depth = 8;
391
-
elseif (_frequency > 880) _depth = 9;
392
-
else _depth = 10; // WLED_PWM_FREQ <= 880Hz
393
416
analogWriteRange((1<<_depth)-1);
394
417
analogWriteFreq(_frequency);
395
418
#else
396
419
_ledcStart = pinManager.allocateLedc(numPins);
397
420
if (_ledcStart == 255) { //no more free LEDC channels
398
421
deallocatePins(); return;
399
422
}
400
-
// duty cycle resolution (_depth) can be extracted from this formula: 80MHz > _frequency * 2^_depth
401
-
if (_frequency > 78124) _depth = 9;
402
-
elseif (_frequency > 39062) _depth = 10;
403
-
elseif (_frequency > 19531) _depth = 11;
404
-
else _depth = 12; // WLED_PWM_FREQ <= 19531Hz
405
423
#endif
406
424
407
425
for (unsigned i = 0; i < numPins; i++) {
@@ -419,7 +437,7 @@ BusPwm::BusPwm(BusConfig &bc)
419
437
}
420
438
_data = _pwmdata; // avoid malloc() and use stack
421
439
_valid = true;
422
-
DEBUG_PRINTF_P(PSTR("%successfully inited PWM strip with type %uand pins %u,%u,%u,%u,%u\n"), _valid?"S":"Uns", bc.type, _pins[0], _pins[1], _pins[2], _pins[3], _pins[4]);
440
+
DEBUG_PRINTF_P(PSTR("%successfully inited PWM strip with type %u, frequency %u, bit depth %u and pins %u,%u,%u,%u,%u\n"), _valid?"S":"Uns", bc.type, _frequency, _depth, _pins[0], _pins[1], _pins[2], _pins[3], _pins[4]);
423
441
}
424
442
425
443
voidBusPwm::setPixelColor(uint16_t pix, uint32_t c) {
0 commit comments