Jump to content

LED Data Stream Decoding


N11VX

Recommended Posts

Howdy Folks

 

I am working on a plugin that rides off the back of the B2S Server and receives the update stream from PinMAME.  I am trying to determine the proper way to decode "D" digits.  I have the 7 segment and 10 segment maps, so that's not the problem.  I know that a 63 is 0 and 111 is 9, etc.  The issue I am asking about is blanking.  In VBS, Controller keeps track of "Changed LEDs" and checking the ChangedLEDs array, we have the LED number in position 0, the value in position 1, and a flag to indicate if it changed from last peek.  All good...

 

The stream from B2S which comes from PinMAME has the a type "D", a LED number, and the current value.  The value NEVER comes through as anything to indicate that the LED has been extinguished or blanked as it does from Controller in VPX.  I did notice that byte zero having a value of 0 does seem to be a flag of some kind that seems to indicate that the LED values should be flushed or blanked (or both--not sure).  I think that value coming through is the key to knowin when to blank the LEDs, but it needs to be within the context of the values that came before since the last time a 0,0 was received--I think...

 

Here's a snippet of the data stream:

 

The long number in front are milliseconds for timing / tracking where the pauses are in the update:

 

63797919484319 D 0 -> 237

63797919484322 D 1 -> 63

63797919484325 D 2 -> 63

63797919484327 D 3 -> 191

63797919484331 D 4 -> 63

63797919484334 D 5 -> 63

63797919484337 D 6 -> 63

63797919484340 D 7 -> 237

63797919484343 D 8 -> 63

63797919484346 D 9 -> 63

63797919484349 D 10 -> 191

63797919484351 D 11 -> 63

63797919484354 D 12 -> 63

63797919484357 D 13 -> 63

63797919484360 D 14 -> 237

63797919484363 D 15 -> 63

63797919484366 D 16 -> 63

63797919484369 D 17 -> 191

63797919484371 D 18 -> 63

63797919484374 D 19 -> 63

63797919484378 D 20 -> 63

63797919484381 D 21 -> 237

63797919484384 D 22 -> 63

63797919484387 D 23 -> 63

63797919484390 D 24 -> 191

63797919484393 D 25 -> 63

63797919484397 D 26 -> 63

63797919484400 D 27 -> 63

63797919484403 D 0 -> 0


** Here, the player 1 Score is 237, 63, 63, 191, 63, 63, 63 or "5,000,000" -- this is the highscore

 

63797919484598 D 5 -> 63

63797919484601 D 6 -> 63

63797919484604 D 12 -> 63

63797919484607 D 13 -> 63

63797919484610 D 19 -> 63

63797919484613 D 20 -> 63

63797919484616 D 26 -> 63

63797919484619 D 27 -> 63

63797919484622 D 0 -> 0

 

** Here, ONLY LEDs 5 and 6 have been updated for player 1 to 63, 63, so if I had blanked the scores, the player one score would be "00"

 

There was 195 ms between the display containing 5,000,000 and the next update that only reset the last two positions of each player's score.

 

I think the proper solution is to flush the scores when byte 0 contains the value 0 and reset the buffer holding the LED values for the next set of updates.  Rinse and repeat.

 

Can anyone confirm and/or tell me if there is something else that I am missing?

 

Much apprecaited.  Soon, I will have  a nice plugin for the community--things are moving along with this being something I think I've got worked out, but thought I'd ask those that truly know this inside and out.

 

Thank you!

 

-Randy

 

Link to comment
Share on other sites

My premise was incorrect. 

 

B2SServer was actually broken and not sending all the LED clearing data.  I found the issue and will be submitting a pull request for the fix in case any future developers want to develop plugins that require full LED information.

 

-Randy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...