Class Mycila::CycleStealingDimmer¶
ClassList > Mycila > CycleStealingDimmer
#include <MycilaDimmerCycleStealing.h>
Inherits the following classes: Mycila::Dimmer
Public Functions¶
| Type | Name |
|---|---|
| virtual bool | begin () override Enable a dimmer on a specific GPIO pin. |
| virtual void | end () override Disable the dimmer. |
| gpio_num_t | getPin () const Get the GPIO pin used for the dimmer. |
| void | setPin (gpio_num_t pin) Set the GPIO pin to use for the dimmer. |
| virtual const char * | type () override const |
| virtual | ~CycleStealingDimmer () |
Public Functions inherited from Mycila::Dimmer¶
See Mycila::Dimmer
| Type | Name |
|---|---|
| virtual bool | begin () |
| bool | calculateHarmonics (float * array, size_t n) const |
| bool | calculateMetrics (Metrics & metrics, float gridVoltage, float loadResistance) const |
| virtual void | end () |
| float | getDutyCycle () const Get the power duty cycle configured for the dimmer by the user. |
| float | getDutyCycleFire () const Get the real firing duty cycle (conduction duty cycle) applied to the dimmer in the range [0, 1]. |
| float | getDutyCycleLimit () const Get the power duty cycle limit of the dimmer. |
| float | getDutyCycleMapped () const Get the remapped power duty cycle from the currently user set duty cycle. |
| float | getDutyCycleMax () const Get the remapped "1" of the dimmer duty cycle. |
| float | getDutyCycleMin () const Get the remapped "0" of the dimmer duty cycle. |
| virtual float | getPowerRatio () const |
| bool | isEnabled () const Check if the dimmer is enabled (if it was able to initialize correctly) |
| bool | isOff () const Check if the dimmer is off. |
| bool | isOn () const Check if the dimmer is on. |
| bool | isOnAtFullPower () const Check if the dimmer is on at full power. |
| virtual bool | isOnline () const Returns true if the dimmer is online. |
| void | off () Turn off the dimmer. |
| void | on () Turn on the dimmer at full power. |
| virtual bool | setDutyCycle (float dutyCycle) Set the power duty. |
| void | setDutyCycleLimit (float limit) Set the power duty cycle limit of the dimmer. The duty cycle will be clamped to this limit. |
| void | setDutyCycleMax (float max) Duty remapping (equivalent to Shelly Dimmer remapping feature). Useful to calibrate the dimmer when using for example a PWM signal to 0-10V analog convertor connected to a voltage regulator which is only working in a specific voltage range like 1-8V. |
| void | setDutyCycleMin (float min) Duty remapping (equivalent to Shelly Dimmer remapping feature). Useful to calibrate the dimmer when using for example a PWM signal to 0-10V analog convertor connected to a voltage regulator which is only working in a specific voltage range like 1-8V. |
| void | setOnline (bool online) Set the online status of the dimmer. |
| virtual const char * | type () const |
| virtual | ~Dimmer () |
Public Static Functions¶
| Type | Name |
|---|---|
| void | onZeroCross (int16_t delayUntilZero, void * args) |
Public Static Functions inherited from Mycila::Dimmer¶
See Mycila::Dimmer
| Type | Name |
|---|---|
| uint16_t | getSemiPeriod () Get the semi-period in us used for the power LUT calculations. If LUT is disabled, returns 0. |
| void | setSemiPeriod (uint16_t semiPeriod) Set the semi-period of the grid frequency in us for this dimmer. This is mandatory when using power LUT. |
Protected Attributes inherited from Mycila::Dimmer¶
See Mycila::Dimmer
| Type | Name |
|---|---|
| float | _dutyCycle = 0.0f |
| float | _dutyCycleFire = 0.0f |
| float | _dutyCycleLimit = 1.0f |
| float | _dutyCycleMax = 1.0f |
| float | _dutyCycleMin = 0.0f |
| bool | _enabled = false |
| bool | _online = false |
Protected Static Attributes inherited from Mycila::Dimmer¶
See Mycila::Dimmer
| Type | Name |
|---|---|
| uint16_t | _semiPeriod = 0 |
Protected Functions¶
| Type | Name |
|---|---|
| virtual bool | _apply () override |
| virtual bool | _calculateDimmerHarmonics (float * array, size_t n) override const |
Protected Functions inherited from Mycila::Dimmer¶
See Mycila::Dimmer
| Type | Name |
|---|---|
| virtual bool | _apply () |
| virtual bool | _calculateDimmerHarmonics (float * array, size_t n) const |
Protected Static Functions inherited from Mycila::Dimmer¶
See Mycila::Dimmer
| Type | Name |
|---|---|
| float | _contrain (float amt, float low, float high) |
Public Functions Documentation¶
function begin¶
Enable a dimmer on a specific GPIO pin.
Warning:
Dimmer won't be enabled if pin is invalid
Implements Mycila::Dimmer::begin
function end¶
Disable the dimmer.
Warning:
Dimmer won't be destroyed but won't turn on anymore even is a duty cycle is set.
Implements Mycila::Dimmer::end
function getPin¶
Get the GPIO pin used for the dimmer.
function setPin¶
Set the GPIO pin to use for the dimmer.
function type¶
Implements Mycila::Dimmer::type
function ~CycleStealingDimmer¶
Public Static Functions Documentation¶
function onZeroCross¶
Optional: Integration with a Zero-Cross Detection (ZCD) system
Callback to be called when a zero-crossing event is detected.
This is optional when using standard (sync) Solid State Relays (SSR) that only activate or deactivate when the AC voltage crosses zero. This is usually the behavior of most SSRs available on the market.
If you are using a Random Solid State Relay (SSR) or a TRIAC that can be triggered at any point in the AC cycle, then you need to set this callback so that the library knows when to fire and stop the SSR/TRIAC.
When using MycilaPulseAnalyzer library, this callback can be registered like this:
pulseAnalyzer.onZeroCross(Mycila::CycleStealingDimmer::onZeroCross);
- When using your own ISR with the RobotDyn ZCD, you can call this method with delayUntilZero == 200 since the length of the ZCD pulse is about 400 us.
- When using your own ISR with the ZCd from Daniel S, you can call this method with delayUntilZero == 550 since the length of the ZCD pulse is about 1100 us.
Protected Functions Documentation¶
function _apply¶
Implements Mycila::Dimmer::_apply
function _calculateDimmerHarmonics¶
inline virtual bool Mycila::CycleStealingDimmer::_calculateDimmerHarmonics (
float * array,
size_t n
) override const
Implements Mycila::Dimmer::_calculateDimmerHarmonics
The documentation for this class was generated from the following file src/MycilaDimmerCycleStealing.h