Esempio n. 1
0
void setup()
{
	connected = false;
	preparing = false;
	last_active = millis();
	last_micros = utime();
	serialdev = NULL;
	command_end = 0;
	arch_setup_start();
	setup_spacetypes();
	// Initialize volatile variables.
	initialized = false;
#if DEBUG_BUFFER_LENGTH > 0
	debug_buffer_ptr = 0;
#endif
	debug("Starting");
	pollfds[0].fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
	pollfds[0].events = POLLIN | POLLPRI;
	pollfds[0].revents = 0;
	motors_busy = false;
	current_extruder = 0;
	ping = 0;
	for (int i = 0; i < 4; ++i) {
		pending_len[i] = 0;
		wait_for_reply[i] = NULL;
		serial_cb[i] = NULL;
	}
	out_busy = 0;
	num_file_done_events = 0;
	continue_event = false;
	num_movecbs = 0;
	led_pin.init();
	stop_pin.init();
	probe_pin.init();
	led_phase = 0;
	temps_busy = 0;
	store_adc = NULL;
	requested_temp = ~0;
	refilling = false;
	running_fragment = 0;
	current_fragment = running_fragment;
	//debug("current_fragment = running_fragment; %d %p", current_fragment, &current_fragment);
	current_fragment_pos = 0;
	num_active_motors = 0;
	default_hwtime_step = 4000;
	min_hwtime_step = 3000;
	settings.hwtime_step = default_hwtime_step;
	feedrate = 1;
	max_deviation = 0;
	max_v = 100;
	max_a = 10000;
	targetx = 0;
	targety = 0;
	zoffset = 0;
	aborting = false;
	computing_move = false;
	stopping = 0;
	sending_fragment = 0;
	transmitting_fragment = false;
	start_pending = false;
	stop_pending = false;
	discard_pending = false;
	change_pending = false;
	discarding = false;
	cbs_after_current_move = 0;
	which_autosleep = 0;
	timeout = 0;
	bed_id = 255;
	fan_id = 255;
	spindle_id = 255;
	run_file_map = NULL;
	run_file_finishing = false;
	expected_replies = 0;
	num_temps = 0;
	temps = NULL;
	num_gpios = 0;
	gpios = NULL;
	pattern.step_pin.read(0);
	pattern.dir_pin.read(0);
	pattern.active = false;
	for (int s = 0; s < NUM_SPACES; ++s)
		spaces[s].init(s);
	arch_setup_end();
}
Esempio n. 2
0
void setup()
{
	serial_buffer_head = serial_buffer;
	serial_buffer_tail = serial_buffer;
	serial_overflow = false;
	debug_value = 0x1337;
	arch_setup_start();
	enabled_pins = NUM_DIGITAL_PINS;
	for (uint8_t p = 0; p < NUM_DIGITAL_PINS; ++p) {
		pin[p].duty = 255;
		// Reset state is unset, then unset the pin.
		pin[p].state = CTRL_UNSET << 2 | CTRL_RESET;
		UNSET(p);
	}
	pin_events = 0;
	notified_current_fragment = 0;
	current_fragment = notified_current_fragment;
	last_fragment = current_fragment;
	filling = 0;
	// Disable all adcs.
	for (uint8_t a = 0; a < NUM_ANALOG_INPUTS; ++a) {
		for (uint8_t i = 0; i < 2; ++i) {
			adc[a].linked[i] = ~0;
			adc[a].value[i] = 1 << 15;
			adc[a].is_on = false;
		}
	}
	adc_phase = INACTIVE;
	adc_current = ~0;
	adc_next = ~0;
	// Set up communication state.
	command_end = 0;
	had_data = false;
	ping = 0;
	out_busy = 0;
	ff_in = 0;
	ff_out = 0;
	reply_ready = 0;
	adcreply_ready = 0;
	timeout = false;
	timeout_time = 0;
	// Set up homing state.
	homers = 0;
	home_step_time = 0;
	// Set up movement state.
	last_len = 0;
	stopping = -1;
	arch_set_speed(0);
	current_len = 0;
	active_motors = 0;
	move_phase = 0;
	full_phase = 1;
	// Set up led state.
	led_fast = 0;
	led_last = millis();
	led_phase = 0;
	led_pin = ~0;
	stop_pin = ~0;
	probe_pin = ~0;
	spiss_pin = ~0;
	audio = 0;
	audio_motor = 0;
	// Do arch-specific things.  This fills printerid and uuid.
	arch_setup_end();
	// Inform host of reset.
	send_id(CMD_STARTUP);
}
Esempio n. 3
0
void setup(char const *port, char const *run_id)
{
	preparing = false;
	host_block = true;
	last_active = millis();
	last_micros = utime();
	serialdev[0] = &host_serial;
	host_serial.begin(115200);
	serialdev[1] = NULL;
	arch_setup_start(port);
	setup_spacetypes();
	// Initialize volatile variables.
	initialized = false;
#if DEBUG_BUFFER_LENGTH > 0
	debug_buffer_ptr = 0;
#endif
	debug("Starting");
	pollfds[0].fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
	pollfds[0].events = POLLIN | POLLPRI;
	pollfds[0].revents = 0;
	command_end[0] = 0;
	command_end[1] = 0;
	motors_busy = false;
	current_extruder = 0;
	continue_cb = 0;
	ping = 0;
	for (int i = 0; i < 4; ++i)
		pending_len[i] = 0;
	out_busy = 0;
	led_pin.init();
	probe_pin.init();
	led_phase = 0;
	temps_busy = 0;
	store_adc = NULL;
	requested_temp = ~0;
	refilling = false;
	running_fragment = 0;
	current_fragment = running_fragment;
	current_fragment_pos = 0;
	num_active_motors = 0;
	hwtime_step = 4000;
	audio_hwtime_step = 1;	// This is set by audio file.
	feedrate = 1;
	max_deviation = 0;
	max_v = INFINITY;
	zoffset = 0;
	aborting = false;
	computing_move = false;
	moving_to_current = 0;
	prepared = false;
	stopping = 0;
	sending_fragment = 0;
	start_pending = false;
	stop_pending = false;
	discard_pending = 0;
	discarding = false;
	cbs_after_current_move = 0;
	which_autosleep = 0;
	timeout = 0;
	bed_id = 255;
	fan_id = 255;
	spindle_id = 255;
	run_file_map = NULL;
	run_file_finishing = false;
	expected_replies = 0;
	for (int i = 0; i < 4; ++i)
		wait_for_reply[i] = NULL;
	num_temps = 0;
	temps = NULL;
	num_gpios = 0;
	gpios = NULL;
	arch_setup_end(run_id);
}