apply curve to analog axis now

This commit is contained in:
dekunukem
2022-01-12 19:53:26 +00:00
parent 33be87b077
commit bc9690b534
2 changed files with 11 additions and 2 deletions

View File

@@ -670,6 +670,7 @@ def ui_init():
global this_pboard_id
load_config()
pboard_info_spi_msg = usb4vc_usb_scan.get_pboard_info()
print("PB INFO:", pboard_info_spi_msg)
this_pboard_id = pboard_info_spi_msg[3]
if this_pboard_id in pboard_database:
# load custom profile mapping into protocol list
@@ -762,4 +763,7 @@ def ui_worker():
def get_gamepad_protocol():
return my_menu.current_gamepad_protocol
def get_joystick_curve():
return joystick_curve_list[my_menu.current_joystick_curve_index]
ui_thread = threading.Thread(target=ui_worker, daemon=True)

View File

@@ -148,7 +148,12 @@ def convert_to_8bit_midpoint127(value, axes_dict, axis_key):
if rmax is None:
return 127
value -= rmid
return int((value / rmax) * 255) + 127
# print(usb4vc_ui.get_joystick_curve())
clean_result_neg127_to_127 = int((value / rmax) * 255)
curve_applied = usb4vc_ui.get_joystick_curve().get(abs(clean_result_neg127_to_127), clean_result_neg127_to_127)
if clean_result_neg127_to_127 < 0:
curve_applied *= -1
return curve_applied + 127
IBMPC_GGP_SPI_LOOKUP = {
'IBM_GGP_BTN_1':4,
@@ -355,7 +360,7 @@ def make_generic_gamepad_spi_packet(gp_status_dict, gp_id, axes_info, mapping_in
prev_gp_output = curr_gp_output
prev_kb_output = curr_kb_output
print(curr_gp_output)
print(gp_spi_msg)
return gp_spi_msg, kb_spi_msg, mouse_spi_msg
def make_gamepad_spi_packet(gp_status_dict, gp_id, axes_info):