Imprecise gamepad stick controls

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kwakwarakwa

I have some issues with gamepad controls. I want to aim around player node using sticks X and Y axis. Instead of smooth movement in 360 degrees range, it aims every 45 degrees. Aiming in directions between those angles is possible, but rather hard. May it be fault of the gamepad? Is there any possibility to make aiming with stick more smooth and precise?
My code for now:

func control(delta): 
if abs(Input.get_joy_axis(0, JOY_AXIS_3)) > deadZone or 
    abs(Input.get_joy_axis(0,JOY_AXIS_2)) > deadZone:
	          cannon_stick_dir = Vector2(Input.get_joy_axis(0, JOY_AXIS_3) * -1, 
                      Input.get_joy_axis(0, JOY_AXIS_2))
var cannon_position = $Cannon.get_rotation()  * 0.85 #* 1.10714872  
if cannon_position != cannon_stick_dir.angle():
	cannon_dir_vector = Vector2(cos($Cannon.get_rotation()), 
	if cannon_position != cannon_stick_dir.angle():
		if cannon_dir_vector.angle_to(cannon_stick_dir) >= 0:
			rot_dir -= 1
			$Cannon.rotation = (rot_speed * rot_dir * delta) 
		elif cannon_dir_vector.angle_to(cannon_stick_dir) < 0:
			rot_dir += 1
			$Cannon.rotation = (rot_speed * rot_dir * delta) 
			rot_speed = 0