コード例 #1
0
ファイル: search.c プロジェクト: Dave2084/freewpc
/** Returns true if the given solenoid is OK to fire during
 * a ball search.  The following should be avoided:
 * - kickout coils from ball devices
 * - the knocker
 * - flashers
 * - anything else the machine description says not to fire
 */
static bool ball_search_solenoid_ok (U8 sol)
{
	device_t *dev;

#if !defined(MACHINE_SOL_FLASHERP)
	/* If the machine description is not proper, then we can't know
	 * for sure which solenoids are OK, so don't fire _any_.  */
	return (FALSE);
#endif

#if defined(MACHINE_SOLENOID_P)
	/* If it's not a valid solenoid number, don't allow it.  This
	skips coils that are not installed. */
	if (!MACHINE_SOLENOID_P (sol))
		return FALSE;
#endif

	/* Skip known coils which should always be skipped. */
	if (MACHINE_SOL_FLASHERP(sol)
#ifdef MACHINE_BALL_SERVE_SOLENOID
		 || (sol == MACHINE_BALL_SERVE_SOLENOID)
#endif
#ifdef MACHINE_KNOCKER_SOLENOID
		 || (sol == MACHINE_KNOCKER_SOLENOID)
#endif
#ifdef MACHINE_SOL_NOSEARCHP
		 || (MACHINE_SOL_NOSEARCHP(sol))
#endif
		 )
		return (FALSE);

	/* Also check for all ball device kick coils; skip them */
	for (dev=device_entry(0); dev < device_entry(NUM_DEVICES); dev++)
	{
		if (sol == dev->props->sol)
		{
			/* This coil controls a ball device. */

			/* If there are no balls detected here, pulse it */
			if (dev->actual_count == 0)
				return TRUE;

			/* If chase ball is turned off, then during the 5th ball search,
			pulse it */
			if (!chase_ball_enabled () && ball_search_count == 5)
				return (TRUE);

			/* Default is NOT to fire such a coil */
			return (FALSE);
		}
	}

	/* OK, you can use it. */
	return (TRUE);
}
コード例 #2
0
ファイル: wpc-sol.c プロジェクト: DenDuze/freewpc
/** Return 0 if the given solenoid/flasher should be off,
else return the bitmask that reflects that solenoid's
position in the output register. */
extern inline U8 platform_sol_timer_check (const U8 id)
{
	if (MACHINE_SOL_FLASHERP (id))
		if (likely (sol_timers[id - SOL_MIN_FLASHER] != 0))
		{
			sol_timers[id - SOL_MIN_FLASHER]--;

			if (likely (sol_duty_state[id - SOL_MIN_FLASHER] & sol_duty_mask))
				return 1;
		}
	return 0;
}
コード例 #3
0
ファイル: flash.c プロジェクト: SonnyJim/freewpc
/**
 * Randomly pulse all flashers for the given duration, with the given delay
 * in between each pulse.
 */
void flasher_randomize (task_ticks_t delay, U16 duration)
{
	U8 id;
	duration *= TIME_1S;
	while (duration > 0)
	{
		do {
			id = random_scaled (SOL_COUNT);
		} while (!MACHINE_SOL_FLASHERP (id));
		flasher_pulse (id);
		task_sleep (delay);
		duration -= delay;
	}
}
コード例 #4
0
ファイル: burnin.c プロジェクト: hydra/freewpc
void burnin_sol_thread (void)
{
	for (;;)
	{
		U8 sol;
		for (sol=0; sol < NUM_POWER_DRIVES; sol++)
		{
			if (!MACHINE_SOL_FLASHERP (sol))
			{
				sol_request_async (sol);
				task_sleep_sec (2);
			}
		}
	}
}
コード例 #5
0
ファイル: burnin.c プロジェクト: hydra/freewpc
void burnin_flasher_thread (void)
{
	for (;;)
	{
		U8 sol;
		for (sol=0; sol < NUM_POWER_DRIVES; sol++)
		{
			if (MACHINE_SOL_FLASHERP (sol))
			{
				flasher_pulse (sol);
				task_sleep (TIME_200MS);
			}
		}
	}
}
コード例 #6
0
ファイル: coil.c プロジェクト: Dave2084/freewpc
void sim_coil_init (void)
{
	int devno;
	int sol;

	/* Initialize everything to zero first */
	for (sol = 0; sol < PINIO_NUM_SOLS; sol++)
	{
		char item_name[32];
		struct sim_coil_state *c = coil_states + sol;
		memset (c, 0, sizeof (struct sim_coil_state));
		if (MACHINE_SOL_FLASHERP (sol))
			c->type = &flasher_type_coil;
		else
			c->type = &generic_type_coil;
		c->master = c;
		snprintf (item_name, sizeof (item_name), "coil.%d.disabled", sol);
		conf_add (item_name, &c->disabled);
	}

	/* Note coils which are attached to ball devices */
	for (devno = 0; devno < NUM_DEVICES; devno++)
	{
		const device_properties_t *props = &device_properties_table[devno];
		device_coil_init (props->sol, &device_nodes[devno]);
	}

	/* Initialize Fliptronic coils */
#if (MACHINE_FLIPTRONIC == 1)
	fliptronic_coil_init (SOL_LL_FLIP_POWER);
	fliptronic_coil_init (SOL_LR_FLIP_POWER);
#ifdef SOL_UL_FLIP_POWER
	fliptronic_coil_init (SOL_UL_FLIP_POWER);
#endif
#ifdef SOL_UR_FLIP_POWER
	fliptronic_coil_init (SOL_UR_FLIP_POWER);
#endif
#endif

	/* Initialize machine specific coils */
#ifdef CONFIG_MACHINE_SIM
	mach_coil_init ();
#endif
}