Skip to content

Commit

Permalink
DB2S Not lights up at start, but only with PWM modified tables #81
Browse files Browse the repository at this point in the history
First test, mapping all values > 128 to boolean True
  • Loading branch information
JockeJarre committed Feb 28, 2024
1 parent d468f07 commit ffdb408
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions b2sbackglassserver/b2sbackglassserver/Server.vb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Public Class Server
Private tableHandle As Integer = 0
Private tableCount As Integer = 0
Private tableReset As Boolean = False
Private lamplighted As Integer = 0

Private isChangedLampsCalled As Boolean = False
Private isChangedSolenoidsCalled As Boolean = False
Expand Down Expand Up @@ -814,7 +815,7 @@ Public Class Server

' enter new lamp state
sb.Remove(lampid, 1)
If lampstate <> 0 Then
If lampstate > lamplighted Then
sb.Insert(lampid, "1")
Else
sb.Insert(lampid, "0")
Expand All @@ -827,10 +828,10 @@ Public Class Server
Dim topvisible As Boolean = lastTopVisible
Dim secondvisible As Boolean = lastSecondVisible
If (datatypes And B2SCollectData.eCollectedDataType.TopImage) <> 0 Then
topvisible = (lampstate <> 0)
topvisible = (lampstate > lamplighted)
If formBackglass.TopRomInverted Then topvisible = Not topvisible
ElseIf (datatypes And B2SCollectData.eCollectedDataType.SecondImage) <> 0 Then
secondvisible = (lampstate <> 0)
secondvisible = (lampstate > lamplighted)
If formBackglass.SecondRomInverted Then topvisible = Not topvisible
End If
If lastTopVisible <> topvisible OrElse lastSecondVisible <> secondvisible OrElse Not isVisibleStateSet Then
Expand All @@ -854,7 +855,7 @@ Public Class Server
For Each picbox As B2SPictureBox In B2SData.UsedRomLampIDs(lampid)
'If picbox IsNot Nothing Then
If picbox IsNot Nothing AndAlso (Not B2SData.UseIlluminationLocks OrElse String.IsNullOrEmpty(picbox.GroupName) OrElse Not B2SData.IlluminationLocks.ContainsKey(picbox.GroupName)) Then
Dim visible As Boolean = (lampstate <> 0)
Dim visible As Boolean = (lampstate > lamplighted)
If picbox.RomInverted Then visible = Not visible
If B2SData.UseRotatingImage AndAlso B2SData.RotatingPictureBox(0) IsNot Nothing AndAlso picbox.Equals(B2SData.RotatingPictureBox(0)) Then
If visible Then
Expand All @@ -873,7 +874,7 @@ Public Class Server
If (datatypes And B2SCollectData.eCollectedDataType.Animation) <> 0 Then
If B2SData.UsedAnimationLampIDs.ContainsKey(lampid) Then
For Each animation As B2SData.AnimationInfo In B2SData.UsedAnimationLampIDs(lampid)
Dim start As Boolean = (lampstate <> 0)
Dim start As Boolean = (lampstate > lamplighted)
If animation.Inverted Then start = Not start
If start Then
formBackglass.StartAnimation(animation.AnimationName)
Expand All @@ -884,7 +885,7 @@ Public Class Server
End If
' random animation start
If B2SData.UsedRandomAnimationLampIDs.ContainsKey(lampid) Then
Dim start As Boolean = (lampstate <> 0)
Dim start As Boolean = (lampstate > lamplighted)
Dim isrunning As Boolean = False
If start Then
For Each matchinganimation As B2SData.AnimationInfo In B2SData.UsedRandomAnimationLampIDs(lampid)
Expand Down Expand Up @@ -1565,6 +1566,7 @@ Public Class Server
End Get
Set(ByVal value As Integer)
VPinMAME.SolMask(number) = value
If number = 2 Then lamplighted = If(value = 2, 128, 0)
End Set
End Property

Expand Down

0 comments on commit ffdb408

Please sign in to comment.