Ejemplo n.º 1
0
void set_motor_duty_pct (uint8_t duty)
{
	if (duty > 100)
		duty = 100;
	
	set_motor_duty ((uint16_t)(((uint32_t)duty * (uint32_t)ICR1) / 100));
}
Ejemplo n.º 2
0
BOOL parse_speed_command( char* mIncoming )
{
	char expression[] = "^motor speed:([vV]\\d+)? ?([wW]\\d+)? ?([xX]\\d+)? ?([yY]\\d+)? ?([zZ]\\d+)?";
	
	BOOL is_speed_command = strcmp(mIncoming, "motor speed");
	byte which = which_motors(mIncoming);
	float fraction=0.0;
	for (int b=0; b<NUM_MOTORS; b++)
	{
		if (is_in_set(which, b) )
			set_motor_duty( b, fraction );		
	}
	form_response("ACK: speed request");	
	return is_speed_command;
}
Ejemplo n.º 3
0
BOOL parse_home_command( char* mIncoming )
{
	char expression = "home ([vV])? ([wW])? ([xX])? ([yY])? ([zZ])?";
	int match = re_match( 2, Captures, expression, mIncoming );
		
	BOOL is_speed_command = strcmp(mIncoming, "HOME:");
	byte which = which_motors(mIncoming);
	for (int b=0; b<NUM_MOTORS; b++)
	{
		if (is_in_set(which, b) )
			set_motor_duty( b, HOMING_SPEED );		
	}
	form_response("ACK: homing...");
	return is_speed_command;
}
Ejemplo n.º 4
0
BOOL parse_measure_travel( char* mIncoming )
{
	char expression = "measure travel";
	int match = re_match( 2, Captures, expression, mIncoming );
	
	BOOL is_speed_command = strcmp(mIncoming, "measure travel");
	byte which = which_motors(mIncoming);
	for (int b=0; b<NUM_MOTORS; b++)
	{
		if (is_in_set(which, b) )
			set_motor_duty( b, HOMING_SPEED );		
	}
	// Don't wait until further limit switches triggered, just ack the cmd:
	form_response( "ACK measuring travel..." );
	return is_speed_command;
}
Ejemplo n.º 5
0
void set_motor_raw_PWM (const uint16_t pwm)
{
	set_motor_duty(pwm);
}
Ejemplo n.º 6
0
void set_motor_duty_8bit (uint8_t duty)
{
	set_motor_duty ((uint16_t)(((uint32_t)duty * (uint32_t)ICR1) / 256));
}