Author Topic: Problems with Flash Drop Targets  (Read 1247 times)

uncivil engineer

  • Wizard
  • *****
  • Posts: 118
  • Alan
    • View Profile
Problems with Flash Drop Targets
« on: March 31, 2015, 07:02:02 PM »
So Ive run into a problem programming for the drop targets on my flash machine.

For those of you not familiar with early solid state Williams drop targets, the work in the following manner:
When the target is hit and goes down, the contacts will close a switch circuit on thy way down, but at the bottom of their fall, the circuit opens up again.  When all the targets are down, It is supposed to create an ‘all down’ switch circuit.  However, due to the nature of the design, this ‘all down’ switch rarely works.  When the drop targets reset, the switch also end up getting triggered on the way up.

So to make the switches register more reliably, I am trying to create some coding that detects the switch closing and opening quickly, and then sets a flag that shows that target is down.  I then would check all the flags for the targets to see if the entire bank is down.  What would be the best way to go about this?  Could I use a call like sw_droptarget_active_for_10ms?  I need to check my last log file to see what the minimum time the targets are going from close to open. 

On my other issue, with the switches closing on the way back up, I may have to move my reset routine to a higher mode (my utility mode runs at 99) and then employ a switch stop to keep them from scoring on the way back up.  Any ideas how I can do this during game play?  The best I can come up with is a flag in my player stats that comes up during the reset, and is applied in the top mode to stop the score from registering, and then gets turned off after the reset coils finish. 

I do have a ‘all targets up’ switch I could use, and it seems to work reliably.

What I have so far can be found in the drop target file on my github. :

Uncivil Engineer


  • Wizard
  • *****
  • Posts: 113
    • View Profile
    • PinMAME for P-ROC/Linux
Re: Problems with Flash Drop Targets
« Reply #1 on: April 03, 2015, 04:28:34 PM »
It should be possible to create a class for the drop target bank, and hook into that for various events.  Maybe that's actually a mode that runs above other modes to filter events, or it can call other methods with a "target dropped" event after filtering the switch events.

The class keeps some properties around, like when you're resetting the target bank and what the state of each target is.  When you see a switch event indicating a target dropped, only pass that through if the target's state is "up" and you're not resetting the target bank.

When you fire the reset coil, ignore switch hits until you see the "all up" switch closure or after some timeout (via a delay() method call) to account for a broken "all up" switch.

Each "target down" switch calls a shared method with its unique index:

Code: [Select]
if self.bank_resetting or self.targets[index].is_down:
    # block event from lower modes
else:[index].is_down = True
    # pass event to lower modes

When the "all up" switch triggers or called by a delay:

Code: [Select]
self.bank_resetting = False
for target in self.targets:
    target.is_down = False