/** Sets the intensity (brightness) of a single GI triac */ void gi_leff_dim (U8 triac, U8 brightness) { /* Disable the GI string first. */ gi_clear_dimming (triac, gi_leff_dimming); gi_leff_output &= ~triac; if (brightness == 0) { /* Nothing to do if brightness = off */ } else if (brightness < 7 && system_config.allow_dim_illum == YES) { /* We want to dim the lamps at levels 1-6. Level 7 doesn't work because the GI string would have to be turned on and off very shortly before the next zerocross point, which can't be guaranteed to work. */ gi_leff_dimming[7-brightness] |= triac; } else { /* If the brightness is greater than the threshold, or if dimming has been disabled in the menu adjustments, then just it turn on all the way -- no need to do any dimming at IRQ time. */ gi_leff_output |= triac; } triac_update (); }
/** Frees a set of triacs at the end of a lamp effect */ void gi_leff_free (U8 triac) { gi_clear_dimming (triac, gi_leff_dimming); gi_leff_alloc &= ~triac; gi_leff_output &= ~triac; triac_update (); }
/** Turns off one or more triacs */ void gi_disable (U8 triac) { log_event (SEV_INFO, MOD_TRIAC, EV_TRIAC_OFF, triac); gi_clear_dimming (triac, gi_dimming); triac_output &= ~triac; triac_update (); }
/** Enable dimming for a GI string. */ void gi_dim (U8 triac, U8 intensity) { gi_clear_dimming (triac, gi_dimming); triac_output &= ~triac; gi_dimming[intensity] |= triac; triac_update (); }
/** Turns on one or more triacs */ void triac_enable (U8 triac) { log_event (SEV_INFO, MOD_TRIAC, EV_TRIAC_ON, triac); gi_clear_dimming (triac, gi_dimming); triac_output |= triac; triac_update (); }
/** Enable dimming for a GI string. */ void gi_dim (U8 triac, U8 brightness) { gi_clear_dimming (triac, gi_dimming); triac_output &= ~triac; if (brightness == 0) ; else if (brightness < 7 && system_config.allow_dim_illum == YES) gi_dimming[7 - brightness] |= triac; else triac_output |= triac; triac_update (); }
/** Disables a triac from a lamp effect */ void gi_leff_disable (U8 triac) { gi_clear_dimming (triac, gi_leff_dimming); gi_leff_output &= ~triac; triac_update (); }
/** Enables a triac from a lamp effect at full brightness */ void triac_leff_enable (U8 triac) { gi_clear_dimming (triac, gi_leff_dimming); gi_leff_output |= triac; triac_update (); }