Documentation
¶
Overview ¶
Package dmx provides DMX output management and Art-Net communication.
Index ¶
- Constants
- type Config
- type Service
- func (s *Service) ClearActiveScene()
- func (s *Service) ClearAllOverrides()
- func (s *Service) ClearChannelOverride(universe, channel int)
- func (s *Service) CountActiveChannels() int
- func (s *Service) DisableArtNet()
- func (s *Service) FadeToBlack()
- func (s *Service) ForceImmediateTransmission()
- func (s *Service) GetActiveSceneID() *string
- func (s *Service) GetAllUniverses() map[int][]int
- func (s *Service) GetBroadcastAddress() string
- func (s *Service) GetChannelValue(universe, channel int) byte
- func (s *Service) GetCurrentRate() int
- func (s *Service) GetUniverse(universe int) []int
- func (s *Service) Initialize() error
- func (s *Service) IsActive() bool
- func (s *Service) IsEnabled() bool
- func (s *Service) ReloadBroadcastAddress(newAddress string) error
- func (s *Service) SetActiveScene(sceneID string)
- func (s *Service) SetAllChannels(universe int, values []byte)
- func (s *Service) SetChannelOverride(universe, channel int, value byte)
- func (s *Service) SetChannelValue(universe, channel int, value byte)
- func (s *Service) Stop()
- func (s *Service) TriggerChangeDetection()
Constants ¶
const ( // UniverseSize is the number of channels per DMX universe. UniverseSize = 512 // MaxUniverses is the maximum number of supported universes. MaxUniverses = 4 )
const ( DefaultRetryInterval = 5 * time.Second DefaultMaxRetries = 60 // 5 minutes of retries at 5s intervals )
Default retry configuration
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Enabled bool
BroadcastAddr string
Port int
RefreshRateHz int
IdleRateHz int
HighRateDuration time.Duration
// Retry configuration for network connection attempts
RetryInterval time.Duration // How often to retry (default: 5s)
MaxRetries int // Maximum retry attempts (default: 60)
}
Config holds DMX service configuration.
func ConfigFromEnv ¶
func ConfigFromEnv() Config
ConfigFromEnv loads configuration from environment variables.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a configuration with default values.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages DMX channel values and Art-Net output.
func (*Service) ClearActiveScene ¶
func (s *Service) ClearActiveScene()
ClearActiveScene clears the active scene.
func (*Service) ClearAllOverrides ¶
func (s *Service) ClearAllOverrides()
ClearAllOverrides removes all channel overrides.
func (*Service) ClearChannelOverride ¶
ClearChannelOverride removes a channel override.
func (*Service) CountActiveChannels ¶
CountActiveChannels returns the number of non-zero channels.
func (*Service) DisableArtNet ¶
func (s *Service) DisableArtNet()
DisableArtNet disables Art-Net output and closes the connection. The broadcast address is preserved so it can be displayed in status and used when re-enabling without needing to reload from settings.
func (*Service) FadeToBlack ¶
func (s *Service) FadeToBlack()
FadeToBlack sets all channels to 0 (immediate, no fade).
func (*Service) ForceImmediateTransmission ¶ added in v0.2.10
func (s *Service) ForceImmediateTransmission()
ForceImmediateTransmission forces an immediate Art-Net transmission. This is used when we need to ensure the first frame of a fade is sent immediately without waiting for the next transmitLoop tick.
func (*Service) GetActiveSceneID ¶
GetActiveSceneID returns the currently active scene ID.
func (*Service) GetAllUniverses ¶
GetAllUniverses returns all universes with channel values (1-indexed).
func (*Service) GetBroadcastAddress ¶
GetBroadcastAddress returns the Art-Net broadcast address.
func (*Service) GetChannelValue ¶
GetChannelValue returns the current value of a channel.
func (*Service) GetCurrentRate ¶
GetCurrentRate returns the current transmission rate in Hz.
func (*Service) GetUniverse ¶
GetUniverse returns all channel values for a universe (as ints for API compatibility).
func (*Service) Initialize ¶
Initialize starts the DMX service and Art-Net transmission.
func (*Service) ReloadBroadcastAddress ¶
ReloadBroadcastAddress updates the broadcast address and reconnects. If Art-Net was disabled, this will enable it. If the connection fails (e.g., network not ready), it starts a background retry loop that will keep trying until successful.
func (*Service) SetActiveScene ¶
SetActiveScene sets the currently active scene ID.
func (*Service) SetAllChannels ¶
SetAllChannels sets all channels in a universe.
func (*Service) SetChannelOverride ¶
SetChannelOverride sets a channel override value.
func (*Service) SetChannelValue ¶
SetChannelValue sets a channel value.
func (*Service) TriggerChangeDetection ¶
func (s *Service) TriggerChangeDetection()
TriggerChangeDetection manually triggers high-rate mode (useful for fades). This switches to high-rate transmission mode but lets the transmitLoop handle actual packet sending to avoid race conditions and duplicate transmissions.