Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

1 Follower

About Mr.Silver

  • Rank
  • Birthday 03/11/1977
  1. You 've to keep in mind that some blinkin features are provided by the script itself and vpinball do nothing about it (timers are one of this features and also whenever you use the B option iin the script) So be aware that you've to provide some sort of timing for each output and this will be hardware controlled by arduino. If you look at the ledwiz script code you'll find the related code easily: 'out is temporized ? If (IsTemporized()) Then ' if output is active in ROM and timer is not running If ((OutsPD<>0) and not m_TimerOn) then ' activate the output OutsPD=OutsPD Or m_l2Power(OutNum) ' init the timer m_TimerCount= 0 ' set up the flag for indicating timer is running m_TimerOn=True ' is this a shaker ? If (m_ShakerInt>0) Then ' then set the intensity level SetOutputIntensity outNum,m_ShakerInt End If ' if timer is running ElseIf m_TimerOn then ' increment it gTimerFreq ms m_TimerCount=m_TimerCount+gTimerFreq ' its there freq interval? if (m_Repeat<>0) then if (m_repeatCount>=m_FreqTime) then OutsPD=OutsPD Or m_l2Power(OutNum) m_RepeatCount=0 else OutsPD=0 m_RepeatCount=m_RepeatCount+1 end if Else ' output is still active OutsPD=OutsPD Or m_l2Power(OutNum) end if End if ' timer expired? If (TimerExpired(m_TimerCount) and m_TimerOn) Then ' switch off the output OutsPD=0 ' reset time counter m_TimerCount = 0 ' switch off timer m_TimerOn=false m_RepeatCount=0 End if End If Keep in mind this code does not send signals to the ledwiz, it only mask the bits on the OutsPD variable ( a 32 bit value containing the states of all the outputs), this is done lately in the code ' did the outsputs changed? If (OutsPD<>lastOutputStates) Then ' send the states to ledwiz LedControl.Command ="SBA:" & (OutsPD and &hFF) & "," & (RShift(OutsPD,8) and &hff) & "," & (RShift(OutsPD,16) and &hff) & "," & (RShift(OutsPD,24) and &hff) & ",1" ' store latest send value lastOutputStates=OutsPD End If This code maybe its a bit difficult to read but this is due the lack of vbscript for bit swifting operations, rshift functions shift the bits correctly the corresponding number of bytes, notice also that we only send values to ledwizard if there is something that has changed, i keep track of the last states in lastOutputStates.
  2. Hi everybody, first of all i don't want to discourage anybody from trying their own solution for vpinball, any contribution is always welcome and so this will give a chance to everybody to choose one wao or another for making their own virtual pinball. Said that, i want to tell everybody a few things to make clear what could be achieved either with arduino or ledwiz systems. The stuttering problem is not a problem about your computer, having a top notch system wouldn't save you from suffering stuttering when using external hardware. Fist of all is the way how vpinball works, vpinball uses a main loop for synchronizing with pinmame wich controls all the rom events. This means that vpinball does not stay sincronized with rom events altought you have this illusion because the timer fires many times per second. Ledwiz system also uses its own timer to check out rom events, latest versions of the script included a variable to adjust this time to suit your needs. When the timer its fired the script does the job of checking the light states and so and send the instructions to ledwiz, the script sends just one command to the ledwiz for all the outputs (32) this is the fastest way to do it instead of setting each out individually. Here is the problem, this command does the jod synchronously , this means that the script does not pass control to the next instruction until ledwiz has finished his job so the script have to wait for ledwiz to end. Current ledwiz dll and ocx works synchronously, and that's the real problem for stuttering, if you want to avoid stuttering with arduino or other hardware you have to implement a asynchronous comunication something like this: if arduino is busy wait for it if arduino is not busy, send instructions asyncronously and let the rest flow normally Hopefully when the next timer event fires arduino will have finished doing its things and you don't have to wait for it but you have to make sure its not busy before sending instructions again or you'll hang it in a eternal loop causing the whole thing to freeze That's the only solution i now that could make any real improvement to the virtual pinball lightning system. Because you don't stop the script too much waiting for the hardware to finish its things, you're letting the hardware work while you're are letting vpinball things to happen. Other facts you'l have to take into consideration. Arduino uses serial protocol (altought it connects trought and usb cable) , its serial standard comunication emulated, but the communication speed is the same, make sure you use the fastest baudrate but keep in mind that serial protocol is slow by nature. From what I know arduino i/o is not the fastest thing in the world and their standard libraries slown down i/o output a lot, there are some direct hardware implementation for accesing the i/o of arduino on the web wich are a lot faster than the default ones make sure you use it too. Good luck!
  • Create New...