|
|
@@ -97,6 +97,7 @@ my $stateLast = $state;
|
|
|
my %exists = ();
|
|
|
my $pushLast = 0;
|
|
|
my $pullLast = time();
|
|
|
+my $update = 0;
|
|
|
|
|
|
# Always force lights out at launch
|
|
|
DMX::dim({ 'channel' => 0, 'value' => 0, 'time' => 0 });
|
|
|
@@ -104,9 +105,6 @@ DMX::dim({ 'channel' => 0, 'value' => 0, 'time' => 0 });
|
|
|
# Loop forever
|
|
|
while (1) {
|
|
|
|
|
|
- # Set anywhere to force an update this cycle
|
|
|
- my $forceUpdate = 0;
|
|
|
-
|
|
|
# State is calculated; use newState to gather data
|
|
|
my $newState = $state;
|
|
|
|
|
|
@@ -117,6 +115,15 @@ while (1) {
|
|
|
$pullLast = time();
|
|
|
}
|
|
|
|
|
|
+ # Skip processing when in RAVE mode
|
|
|
+ if ($exists{'RAVE'}) {
|
|
|
+ if ($DEBUG) {
|
|
|
+ print STDERR "Suspending normal operation while in RAVE mode\n";
|
|
|
+ }
|
|
|
+ $update = 1;
|
|
|
+ next;
|
|
|
+ }
|
|
|
+
|
|
|
# Calculate the new state
|
|
|
$stateLast = $state;
|
|
|
if ($exists{'LIGHTS'}) {
|
|
|
@@ -132,7 +139,7 @@ while (1) {
|
|
|
|
|
|
# Force updates on a periodic basis
|
|
|
if (time() - $pushLast > $PUSH_TIMEOUT) {
|
|
|
- $forceUpdate = 1;
|
|
|
+ $update = 1;
|
|
|
}
|
|
|
|
|
|
# Die if we don't see regular updates
|
|
|
@@ -145,15 +152,18 @@ while (1) {
|
|
|
if ($DEBUG) {
|
|
|
print STDERR 'State change: ' . $stateLast . ' => ' . $state . "\n";
|
|
|
}
|
|
|
- $forceUpdate = 1;
|
|
|
+ $update = 1;
|
|
|
}
|
|
|
|
|
|
# Update the lighting
|
|
|
- if ($forceUpdate) {
|
|
|
+ if ($update) {
|
|
|
# Update
|
|
|
DMX::applyDataset($DIM{$state}, $state, $OUTPUT_FILE);
|
|
|
|
|
|
# Update the push time
|
|
|
$pushLast = time();
|
|
|
+
|
|
|
+ # Clear the update flag
|
|
|
+ $update = 0;
|
|
|
}
|
|
|
}
|