mirror of
https://github.com/dekuNukem/USB4VC.git
synced 2025-10-31 11:26:46 -07:00
apply curve to analog axis now
This commit is contained in:
@@ -670,6 +670,7 @@ def ui_init():
|
|||||||
global this_pboard_id
|
global this_pboard_id
|
||||||
load_config()
|
load_config()
|
||||||
pboard_info_spi_msg = usb4vc_usb_scan.get_pboard_info()
|
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]
|
this_pboard_id = pboard_info_spi_msg[3]
|
||||||
if this_pboard_id in pboard_database:
|
if this_pboard_id in pboard_database:
|
||||||
# load custom profile mapping into protocol list
|
# load custom profile mapping into protocol list
|
||||||
@@ -762,4 +763,7 @@ def ui_worker():
|
|||||||
def get_gamepad_protocol():
|
def get_gamepad_protocol():
|
||||||
return my_menu.current_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)
|
ui_thread = threading.Thread(target=ui_worker, daemon=True)
|
||||||
|
|||||||
@@ -148,7 +148,12 @@ def convert_to_8bit_midpoint127(value, axes_dict, axis_key):
|
|||||||
if rmax is None:
|
if rmax is None:
|
||||||
return 127
|
return 127
|
||||||
value -= rmid
|
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 = {
|
IBMPC_GGP_SPI_LOOKUP = {
|
||||||
'IBM_GGP_BTN_1':4,
|
'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_gp_output = curr_gp_output
|
||||||
prev_kb_output = curr_kb_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
|
return gp_spi_msg, kb_spi_msg, mouse_spi_msg
|
||||||
|
|
||||||
def make_gamepad_spi_packet(gp_status_dict, gp_id, axes_info):
|
def make_gamepad_spi_packet(gp_status_dict, gp_id, axes_info):
|
||||||
|
|||||||
Reference in New Issue
Block a user