Exemplo n.º 1
0
static void _controller_HSM()
{
//----- ISRs. These should be considered the highest priority scheduler functions ----//
/*	
 *	HI	Stepper DDA pulse generation		// see stepper.h
 *	HI	Stepper load routine SW interrupt	// see stepper.h
 *	HI	Dwell timer counter 				// see stepper.h
 *	MED	GPIO1 switch port - limits / homing	// see gpio.h
 *  MED	Serial RX for USB					// see xio_usart.h
 *  LO	Segment execution SW interrupt		// see stepper.h
 *  LO	Serial TX for USB & RS-485			// see xio_usart.h
 *	LO	Real time clock interrupt			// see xmega_rtc.h
 */
//----- kernel level ISR handlers ----(flags are set in ISRs)-----------//
											// Order is important:
	DISPATCH(_reset_handler());				// 1. received software reset request
	DISPATCH(_bootloader_handler());		// 2. received bootloader request
	DISPATCH(_limit_switch_handler());		// 3. limit switch has been thrown
	DISPATCH(_alarm_idler());				// 4. idle in alarm state
	DISPATCH(_system_assertions());			// 5. system integrity assertions
	DISPATCH(cm_feedhold_sequencing_callback());
	DISPATCH(mp_plan_hold_callback());		// plan a feedhold from line runtime

//----- planner hierarchy for gcode and cycles -------------------------//
	DISPATCH(rpt_status_report_callback());	// conditionally send status report
	DISPATCH(rpt_queue_report_callback());	// conditionally send queue report
	DISPATCH(ar_arc_callback());			// arc generation runs behind lines
	DISPATCH(cm_homing_callback());			// G28.2 continuation

//----- command readers and parsers ------------------------------------//
	DISPATCH(_sync_to_planner());			// ensure there is at least one free buffer in planning queue
	DISPATCH(_sync_to_tx_buffer());			// sync with TX buffer (pseudo-blocking)
	DISPATCH(cfg_baud_rate_callback());		// perform baud rate update (must be after TX sync)
	DISPATCH(_dispatch());					// read and execute next command
}
Exemplo n.º 2
0
static void _controller_HSM()
{
//----- Interrupt Service Routines are the highest priority controller functions ----//
//      See hardware.h for a list of ISRs and their priorities.
//
//----- kernel level ISR handlers ----(flags are set in ISRs)------------------------//
												// Order is important:
//RXMOD		DISPATCH(hw_hard_reset_handler());			// 1. handle hard reset requests
//RXMOD		DISPATCH(hw_bootloader_handler());			// 2. handle requests to enter bootloader

	DISPATCH(_shutdown_idler());				// 3. idle in shutdown state
//	DISPATCH( poll_switches());					// 4. run a switch polling cycle
	DISPATCH(_limit_switch_handler());			// 5. limit switch has been thrown

	DISPATCH(cm_feedhold_sequencing_callback());// 6a. feedhold state machine runner
	DISPATCH(mp_plan_hold_callback());			// 6b. plan a feedhold from line runtime
	DISPATCH(_system_assertions());				// 7. system integrity assertions

//----- planner hierarchy for gcode and cycles ---------------------------------------//
	DISPATCH(st_motor_power_callback());		// stepper motor power sequencing
//	DISPATCH(switch_debounce_callback());		// debounce switches
	DISPATCH(sr_status_report_callback());		// conditionally send status report
	DISPATCH(qr_queue_report_callback());		// conditionally send queue report
	DISPATCH(rx_report_callback());             // conditionally send rx report
	DISPATCH(arcoOK_Macro());
	DISPATCH(cm_arc_callback());				// arc generation runs behind lines
	DISPATCH(cm_homing_callback());				// G28.2 continuation
	DISPATCH(cm_jogging_callback());			// jog function
	DISPATCH(cm_probe_callback());				// G38.2 continuation
	DISPATCH(cm_wait_callback());				//
	DISPATCH(cm_deferred_write_callback());		// persist G10 changes when not in machining cycle

//----- command readers and parsers --------------------------------------------------//

	DISPATCH(_sync_to_planner());				// ensure there is at least one free buffer in planning queue
	DISPATCH(_sync_to_tx_buffer());				// sync with TX buffer (pseudo-blocking)
#ifdef __AVR
	DISPATCH(set_baud_callback());				// perform baud rate update (must be after TX sync)
#endif

	//static uint32_t  linebuffer = 0;
	//if (linebuffer != cm_get_linenum(RUNTIME))
	//	printf("line - %d\n", cm_get_linenum(RUNTIME));
	//linebuffer = cm_get_linenum(RUNTIME);

	DISPATCH(macro_func_ptr());				// read and execute next command
	DISPATCH(_normal_idler());					// blink LEDs slowly to show everything is OK
}