From 7b36eb98f5db33fcb52b761b02c235a8478fd829 Mon Sep 17 00:00:00 2001 From: strawmanbobi Date: Sat, 14 Mar 2020 20:47:35 +0800 Subject: [PATCH] fixed dyson decode for algorithm 0.2.5 --- src/ir_decoder/CMakeLists.txt | 4 +++- src/ir_decoder/src/include/ir_decode.h | 1 + src/ir_decoder/src/ir_decode.c | 22 ---------------------- src/ir_decoder/src/ir_decode_test.c | 22 ++++++++++++++++++++-- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/ir_decoder/CMakeLists.txt b/src/ir_decoder/CMakeLists.txt index 44ed710..f735655 100644 --- a/src/ir_decoder/CMakeLists.txt +++ b/src/ir_decoder/CMakeLists.txt @@ -38,7 +38,9 @@ set(SOURCE_FILES_LIB src/ir_ac_build_frame.c src/ir_ac_parse_parameter.c src/ir_ac_parse_forbidden_info.c - src/ir_ac_parse_frame_info.c + + + System.out.println("continue downloading"); src/ir_ac_parse_frame_info.c src/ir_ac_control.c src/ir_ac_binary_parse.c src/ir_decode.c) diff --git a/src/ir_decoder/src/include/ir_decode.h b/src/ir_decoder/src/include/ir_decode.h index 0a19fc5..5ba789f 100644 --- a/src/ir_decoder/src/include/ir_decode.h +++ b/src/ir_decoder/src/include/ir_decode.h @@ -212,6 +212,7 @@ typedef enum REMOTE_CATEGORY_BSTB = 11, REMOTE_CATEGORY_CLEANING_ROBOT = 12, REMOTE_CATEGORY_AREMOTE_CLEANER = 13, + REMOTE_CATEGORY_DYSON = 14, REMOTE_CATEGORY_NEXT, REMOTE_CATEGORY_MAX = 64, } t_remote_category; diff --git a/src/ir_decoder/src/ir_decode.c b/src/ir_decoder/src/ir_decode.c index 26c864c..eb47c7e 100644 --- a/src/ir_decoder/src/ir_decode.c +++ b/src/ir_decoder/src/ir_decode.c @@ -468,19 +468,6 @@ static UINT16 ir_ac_control(t_remote_ac_status ac_status, UINT16* user_data, UIN time_length = create_ir_frame(); -#if (defined BOARD_PC) -#if (defined BOARD_PC_JNI) - ir_printf("code count = %d\n", context->code_cnt); -#else - int i = 0; - for (i = 0; i < context->code_cnt; i++) - { - ir_printf("%d,", context->time[i]); - } -#endif - ir_printf("\n"); -#endif - return time_length; } @@ -724,15 +711,6 @@ static UINT16 ir_tv_control(UINT8 key, UINT16 *l_user_data) memset(l_user_data, 0x00, USER_DATA_SIZE); ir_code_length = tv_binary_decode(key, l_user_data); -#if defined BOARD_PC - // have some debug - ir_printf("length of IR code = %d\n", ir_code_length); - for (print_index = 0; print_index < ir_code_length; print_index++) - { - ir_printf("%d ", l_user_data[print_index]); - } -#endif - return ir_code_length; } diff --git a/src/ir_decoder/src/ir_decode_test.c b/src/ir_decoder/src/ir_decode_test.c index 5ae2a1b..d14f0f3 100644 --- a/src/ir_decoder/src/ir_decode_test.c +++ b/src/ir_decoder/src/ir_decode_test.c @@ -63,6 +63,8 @@ static INT8 decode_as_ac(char *file_name) UINT8 function_code = AC_FUNCTION_MAX; int key_code = 0; int first_time = 1; + int length = 0; + int index = 0; // get status UINT8 supported_mode = 0x00; @@ -218,7 +220,13 @@ static INT8 decode_as_ac(char *file_name) ac_status.ac_wind_dir, function_code); - ir_decode(function_code, user_data, &ac_status, change_wind_dir); + length = ir_decode(function_code, user_data, &ac_status, change_wind_dir); + printf("\n === Binary decoded : %d\n", length); + for (index = 0; index < length; index++) + { + printf("%d, ", user_data[index]); + } + printf("===\n"); } } } while (TRUE); @@ -233,6 +241,8 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode) // keyboard input int key_code = 0; int first_time = 1; + int length = 0; + int index = 0; // here remote category TV represents for command typed IR code if (IR_DECODE_FAILED == ir_file_open(REMOTE_CATEGORY_TV, ir_hex_encode, file_name)) @@ -258,7 +268,13 @@ static INT8 decode_as_tv(char *file_name, UINT8 ir_hex_encode) { break; } - ir_decode(key_code, user_data, NULL, 0); + length = ir_decode(key_code, user_data, NULL, 0); + printf("\n === Binary decoded : %d\n", length); + for (index = 0; index < length; index++) + { + printf("%d, ", user_data[index]); + } + printf("===\n"); } while (TRUE); @@ -303,4 +319,6 @@ int main(int argc, char *argv[]) printf("Decode functionality not supported : %c\n", function); break; } + + } \ No newline at end of file