RobotDynOfficial / RBDDimmer

The following library is used for work with dimmer, it gives ability to control large ammoun of dimmer. This lib uses with Leonardo, Mega, UNO, ESP8266, ESP32, Arduino M0, Arduino Zero, Arduino Due, STM32.
244 stars 112 forks source link

Inconsistent control #7

Open Mesmer88 opened 5 years ago

Mesmer88 commented 5 years ago

Also getting inconsistent control on AC load. Looks like when power is above 95, it's actually chopping a lot .

This section doesn't make much sense to me:

        /*****
         * DEFAULT DIMMING MODE (NOT TOGGLE)
         *****/
        if (dimCounter[k] >= dimPulseBegin[k] )
        {
            digitalWrite(dimOutPin[k], HIGH);   
        }

        if (dimCounter[k] >=  (dimPulseBegin[k] + pulseWidth) )
        {
            digitalWrite(dimOutPin[k], LOW);
            zeroCross[k] = 0;
            dimCounter[k] = 0;
        }

Looks like in some conditions it will enter both if statements.

Mesmer88 commented 5 years ago

Managed to fix it. You can check this pull request:

https://github.com/RobotDynOfficial/RBDDimmer/pull/8