Exemplo n.º 1
0
static stat_t _homing_error_exit(int8_t axis)
{
	// Generate the warning message. Since the error exit returns via the homing callback
	// - and not the main controller - it requires its own display processing
	cmd_reset_list();

	if (axis == -2) {
		cmd_add_conditional_message((const char_t *)"*** WARNING *** Homing error: Specified axis(es) cannot be homed");;
	} else {
		char message[CMD_MESSAGE_LEN];
		sprintf_P(message, PSTR("*** WARNING *** Homing error: %c axis settings misconfigured"), cm_get_axis_char(axis));
		cmd_add_conditional_message((char_t *)message);
	}
	cmd_print_list(STAT_HOMING_CYCLE_FAILED, TEXT_INLINE_VALUES, JSON_RESPONSE_FORMAT);

	// clean up and exit
	mp_flush_planner(); 						// should be stopped, but in case of switch closure
												// don't use cm_request_queue_flush() here
	cm_set_coord_system(hm.saved_coord_system);	// restore to work coordinate system
	cm_set_units_mode(hm.saved_units_mode);
	cm_set_distance_mode(hm.saved_distance_mode);
	cm_set_feed_rate(hm.saved_feed_rate);
	cm_set_motion_mode(MODEL, MOTION_MODE_CANCEL_MOTION_MODE);
	cm.cycle_state = CYCLE_OFF;
	cm_cycle_end();
	return (STAT_HOMING_CYCLE_FAILED);			// homing state remains HOMING_NOT_HOMED
}
Exemplo n.º 2
0
static stat_t _homing_finalize_exit(int8_t axis)			// third part of return to home
{
	mp_flush_planner(); 									// should be stopped, but in case of switch closure.
															// don't use cm_request_queue_flush() here

	cm_set_coord_system(hm.saved_coord_system);				// restore to work coordinate system
	cm_set_units_mode(hm.saved_units_mode);
	cm_set_distance_mode(hm.saved_distance_mode);
	cm_set_feed_rate(hm.saved_feed_rate);
	cm_set_motion_mode(MODEL, MOTION_MODE_CANCEL_MOTION_MODE);
	cm.cycle_state = CYCLE_OFF;								// required
	cm_cycle_end();
	return (STAT_OK);
}
Exemplo n.º 3
0
static stat_t _homing_finalize_exit(int8_t axis)	// third part of return to home
{
	mp_flush_planner(); 							// should be stopped, but in case of switch closure.
													// don't use cm_request_queue_flush() here

	cm_set_coord_system(hm.saved_coord_system);		// restore to work coordinate system
	cm_set_units_mode(hm.saved_units_mode);
	cm_set_distance_mode(hm.saved_distance_mode);
	cm_set_feed_rate(hm.saved_feed_rate);
	cm_set_motion_mode(MODEL, MOTION_MODE_CANCEL_MOTION_MODE);
	cm.homing_state = HOMING_HOMED;
	cm.cycle_state = CYCLE_OFF;						// required
	cm_cycle_end();
//+++++ DIAGNOSTIC +++++
//	printf("Homed: posX: %6.3f, posY: %6.3f\n", (double)gm.position[AXIS_X], (double)gm.target[AXIS_Y]);
	return (STAT_OK);
}
Exemplo n.º 4
0
static void _probe_restore_settings()
{
	mp_flush_planner();
//	if (cm.hold_state == FEEDHOLD_HOLD);
//		cm_end_hold();
    cm_end_hold();                                          // ends hold if on is in effect

    gpio_set_probing_mode(pb.probe_input, false);

	// restore axis jerk
	for (uint8_t axis=0; axis<AXES; axis++) {
		cm.a[axis].jerk_max = pb.saved_jerk[axis];
    }

	// restore coordinate system and distance mode
	cm_set_coord_system(pb.saved_coord_system);
	cm_set_distance_mode(pb.saved_distance_mode);

	// update the model with actual position
	cm_set_motion_mode(MODEL, MOTION_MODE_CANCEL_MOTION_MODE);
	cm_canned_cycle_end();
}
Exemplo n.º 5
0
static void _probe_restore_settings()
{
    // flush queue and end feedhold (if any)
    cm_queue_flush();

    // set input back to normal operation
    gpio_set_probing_mode(pb.probe_input, false);

	// restore axis jerk
	for (uint8_t axis=0; axis<AXES; axis++) {
		cm.a[axis].jerk_max = pb.saved_jerk[axis];
    }

	// restore coordinate system and distance mode
	cm_set_coord_system(pb.saved_coord_system);
	cm_set_distance_mode(pb.saved_distance_mode);

    // restart spindle if it was paused
    cm_spindle_resume(spindle.dwell_seconds);

	// cancel the feed modes used during probing
	cm_set_motion_mode(MODEL, MOTION_MODE_CANCEL_MOTION_MODE);
	cm_canned_cycle_end();
}