Skip to content

Commit

Permalink
implement rule 75
Browse files Browse the repository at this point in the history
  • Loading branch information
jabdoa2 committed Feb 7, 2018
1 parent b072adf commit adc75d5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
5 changes: 4 additions & 1 deletion mpf/devices/flipper.py
Expand Up @@ -97,7 +97,10 @@ def enable(self, **kwargs):
# Apply the proper hardware rules for our config

if not self.config['hold_coil']: # single coil
self._enable_single_coil_rule()
if self.config['use_eos']:
self._enable_main_coil_eos_cutoff_rule()
else:
self._enable_single_coil_rule()

elif not self.config['use_eos']: # two coils, no eos
self._enable_main_coil_pulse_rule()
Expand Down
23 changes: 20 additions & 3 deletions mpf/platforms/fast/fast.py
Expand Up @@ -677,10 +677,27 @@ def set_pulse_on_hit_and_enable_and_release_and_disable_rule(self, enable_switch
"%s, Driver: %s", enable_switch.hw_switch.number,
coil.hw_driver.number)

# map this to pulse without eos for now
# TODO: implement correctly
del disable_switch
# TODO: hold does not work here

self.set_pulse_on_hit_and_release_rule(enable_switch, coil)
self.set_pulse_on_hit_and_release_rule(disable_switch, coil)
self._check_switch_coil_combincation(enable_switch, coil)

driver = coil.hw_driver

cmd = '{}{},{},{},75,{},{},00,{},{}'.format(
driver.get_config_cmd(),
coil.hw_driver.number,
driver.get_control_for_cmd(enable_switch),
enable_switch.hw_switch.number[0],
disable_switch.hw_switch.number[0],
Util.int_to_hex_string(coil.pulse_settings.duration),
driver.get_pwm_for_cmd(coil.pulse_settings.power),
driver.get_recycle_ms_for_cmd(coil.recycle, coil.pulse_settings.duration))

enable_switch.hw_switch.configure_debounce(enable_switch.debounce)
disable_switch.hw_switch.configure_debounce(disable_switch.debounce)
driver.set_autofire(cmd, coil.pulse_settings.duration, coil.pulse_settings.power, 0)

def set_pulse_on_hit_rule(self, enable_switch: SwitchSettings, coil: DriverSettings):
"""Set pulse on hit rule on driver."""
Expand Down

0 comments on commit adc75d5

Please sign in to comment.