Skip to content

Commit

Permalink
[BUILD] Add adapter input debug to Kconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Feb 21, 2021
1 parent 9f00402 commit cb4bf85
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
10 changes: 10 additions & 0 deletions main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ menu "BlueRetro"
help
Select this to enable Generic HID report debug.

config BLUERETRO_ADAPTER_INPUT_DBG
bool "Enable adapter input debug"
help
Select this to enable adapter input debug.

config BLUERETRO_ADAPTER_INPUT_MAP_DBG
bool "Enable adapter input mapping debug"
help
Select this to enable adapter input mapping debug.

config BLUERETRO_WIRED_TRACE
bool "Enable wired trace"
help
Expand Down
16 changes: 3 additions & 13 deletions main/adapter/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,13 @@ void IRAM_ATTR adapter_init_buffer(uint8_t wired_id) {
}
}

//#define INPUT_DBG
//#define INPUT_MAP_DBG
void adapter_bridge(struct bt_data *bt_data) {
uint32_t out_mask = 0;
//uint32_t end, start = xthal_get_ccount();
//static uint32_t last = 0;
//uint32_t cur = xthal_get_ccount();
#if 1

if (bt_data->dev_id != BT_NONE && to_generic_func[bt_data->dev_type]) {
to_generic_func[bt_data->dev_type](bt_data, &ctrl_input);

#ifdef INPUT_DBG
#ifdef CONFIG_BLUERETRO_ADAPTER_INPUT_DBG
printf("LX: %s%08X%s, LY: %s%08X%s, RX: %s%08X%s, RY: %s%08X%s, LT: %s%08X%s, RT: %s%08X%s, BTNS: %s%08X%s, BTNS: %s%08X%s, BTNS: %s%08X%s, BTNS: %s%08X%s\n",
BOLD, ctrl_input.axes[0].value, RESET, BOLD, ctrl_input.axes[1].value, RESET, BOLD, ctrl_input.axes[2].value, RESET, BOLD, ctrl_input.axes[3].value, RESET,
BOLD, ctrl_input.axes[4].value, RESET, BOLD, ctrl_input.axes[5].value, RESET, BOLD, ctrl_input.btns[0].value, RESET, BOLD, ctrl_input.btns[1].value, RESET,
Expand All @@ -423,7 +418,7 @@ void adapter_bridge(struct bt_data *bt_data) {

out_mask = adapter_mapping(&config.in_cfg[bt_data->dev_id]);

#ifdef INPUT_MAP_DBG
#ifdef CONFIG_BLUERETRO_ADAPTER_INPUT_MAP_DBG
printf("LX: %s%08X%s, LY: %s%08X%s, RX: %s%08X%s, RY: %s%08X%s, LT: %s%08X%s, RT: %s%08X%s, BTNS: %s%08X%s, BTNS: %s%08X%s, BTNS: %s%08X%s, BTNS: %s%08X%s\n",
BOLD, ctrl_output[0].axes[0].value, RESET, BOLD, ctrl_output[0].axes[1].value, RESET, BOLD, ctrl_output[0].axes[2].value, RESET, BOLD, ctrl_output[0].axes[3].value, RESET,
BOLD, ctrl_output[0].axes[4].value, RESET, BOLD, ctrl_output[0].axes[5].value, RESET, BOLD, ctrl_output[0].btns[0].value, RESET, BOLD, ctrl_output[0].btns[1].value, RESET,
Expand All @@ -439,11 +434,6 @@ void adapter_bridge(struct bt_data *bt_data) {
}
#endif
}
#endif
//end = xthal_get_ccount();
//printf("%dus\n", (end - start)/CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
//printf("%dus\n", (cur - last)/CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
//last = cur;
}

void adapter_fb_stop_timer_start(uint8_t dev_id, uint64_t dur_us) {
Expand Down
2 changes: 2 additions & 0 deletions sdkconfig
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ CONFIG_BLUERETRO_SYSTEM_UNIVERSAL=y
# CONFIG_BLUERETRO_BT_DISABLE is not set
# CONFIG_BLUERETRO_BT_H4_TRACE is not set
# CONFIG_BLUERETRO_GENERIC_HID_DEBUG is not set
# CONFIG_BLUERETRO_ADAPTER_INPUT_DBG is not set
# CONFIG_BLUERETRO_ADAPTER_INPUT_MAP_DBG is not set
# CONFIG_BLUERETRO_WIRED_TRACE is not set
# CONFIG_BLUERETRO_BT_TIMING_TESTS is not set
# end of Debug
Expand Down

0 comments on commit cb4bf85

Please sign in to comment.