optimized debug info for decode algorithm

This commit is contained in:
strawmanbobi
2019-03-03 21:23:50 +08:00
parent 604feb39f8
commit f97f487901
7 changed files with 36 additions and 28 deletions

View File

@@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.2)
########################################################
project(irda_decoder)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DBOARD_PC -DDEBUG)
# add_definitions(-DBOARD_PC -DBOARD_PC_JNI)
# add_definitions(-DBOARD_PC -DDEBUG)
add_definitions(-DBOARD_PC -DBOARD_PC_JNI -DDEBUG)
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
MESSAGE("compile platform : Linux")
@@ -90,5 +90,5 @@ set(SOURCE_FILES_JNI_SHARED_LIB
include/ir_decode.h)
# add_library(irda_decoder SHARED ${SOURCE_FILES_SHARED_LIB})
add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE})
# add_library(irda_decoder SHARED ${SOURCE_FILES_JNI_SHARED_LIB})
# add_executable(irda_decoder ${SOURCE_FILES_EXECUTABLE})
add_library(irda_decoder SHARED ${SOURCE_FILES_JNI_SHARED_LIB})

View File

@@ -54,7 +54,7 @@ void noprint(const char *fmt, ...);
#define ir_memcpy(A, B, C) memcpy(A, B, C)
#define ir_memset(A, B, C) memset(A, B, C)
#define ir_strlen(A) strlen(A)
#if (defined BOARD_PC) && (!defined BOARD_PC_JNI)
#if ((defined BOARD_PC) || (defined BOARD_PC_JNI)) && (defined DEBUG)
#define ir_printf printf
#else
#define ir_printf noprint

View File

@@ -54,7 +54,7 @@ JNIEXPORT jint JNICALL Java_net_irext_decode_sdk_IRDecode_irOpenBinary
JNIEXPORT jintArray JNICALL Java_net_irext_decode_sdk_IRDecode_irDecode
(JNIEnv *env, jobject this_obj, jint key_code, jobject jni_ac_status, jint change_wind_direction)
{
UINT16 user_data[USER_DATA_SIZE];
UINT16 user_data[USER_DATA_SIZE] = { 0 };
int i = 0;
jint copy_array[USER_DATA_SIZE] = { 0 };
t_remote_ac_status ac_status;

View File

@@ -182,6 +182,13 @@ UINT16 ir_decode(UINT8 key_code, UINT16* user_data, t_remote_ac_status* ac_statu
{
return 0;
}
ir_printf("ac status is not null in decode core : power = %d, mode = %d, "
"temp = %d, wind_dir = %d, wind_speed = %d, "
"keycode = %d, change_wind_direction = %d\n",
ac_status->ac_power, ac_status->ac_mode,
ac_status->ac_temp, ac_status->ac_wind_dir,
ac_status->ac_wind_speed,
key_code, change_wind_direction);
return ir_ac_control(*ac_status, user_data, key_code, change_wind_direction);
}
}

View File

@@ -158,12 +158,13 @@ INT8 decode_as_ac(char *file_name)
if (TRUE == op_match && TRUE == need_control)
{
ir_printf("switch AC to power = %d, mode = %d, temp = %d, speed = %d, swing = %d\n",
ir_printf("switch AC to power = %d, mode = %d, temp = %d, speed = %d, swing = %d with function code = %d\n",
ac_status.ac_power,
ac_status.ac_mode,
ac_status.ac_temp,
ac_status.ac_wind_speed,
ac_status.ac_wind_dir
ac_status.ac_wind_dir,
function_code
);
ir_decode(function_code, user_data, &ac_status, TRUE);