diff --git a/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_frm_signal.h b/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_frm_signal.h index f598bfa..44caeb1 100644 --- a/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_frm_signal.h +++ b/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_frm_signal.h @@ -10,7 +10,7 @@ extern "C" #include "app_dependence.h" #define MAX_SIGNALS 500u // 每个优先级的最大信号数量 -#define MAX_SUBSCRIBERS 50u // 不同信号的订阅者数量 +#define MAX_SUBSCRIBERS 70u // 不同信号的订阅者数量 #define MAX_CALLBACKS 25u // 每个信号最多支持多少订阅者 #define PRIORITY_LEVELS 2u // 优先级层次 diff --git a/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_rc.c b/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_rc.c index 7f52626..112b994 100644 --- a/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_rc.c +++ b/boards/e3_176_ref/app_demo/eth-xip/sf/app/app_rc.c @@ -142,6 +142,21 @@ void rcNodeCheck(void *signal_id) &rc_app_state.rc_traditional_last_seq, rc_app_state.rc_traditional_enable ); + + /************************* 新增:状态打印 *************************/ + // 打印16通道遥控器:使能状态 + 节点状态 + printf("[RC Check] 16CH Remote: Enable=%d, State=%d\r\n", + rc_app_state.rc_16ch_enable, + rc_app_state.rc_16ch_state); + + // 打印传统遥控器:使能状态 + 节点状态 + printf("[RC Check] Traditional RC: Enable=%d, State=%d\r\n", + rc_app_state.rc_traditional_enable, + rc_app_state.rc_traditional_state); + /******************************************************************/ + + // 启动定时器,500ms周期 + timerStart(&rc_timer, 500, 1); } @@ -195,30 +210,30 @@ void rcInputHandler(void *signal_id) else if (rc_app_state.rc_16ch_state == RC_NODE_ONLINE) { // 16通道遥控器在线,使用16通道遥控器数据 - // 通道2(CH2):速度,映射 -2000~2000 + // 通道2(CH2):速度,映射 -2000~2000 需要反相 int16_t processed_ch2 = remote_control_16ch_output.frame.CH2 - RC_CH_MID_VALUE; if (processed_ch2 < -RC_DEADZONE) { - un_remote_control_input.bit_data.speed = (int16_t)(processed_ch2 * 2000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); + un_remote_control_input.bit_data.speed = -(int16_t)(processed_ch2 * 2000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); } else if (processed_ch2 > RC_DEADZONE) { - un_remote_control_input.bit_data.speed = (int16_t)(processed_ch2 * 2000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); + un_remote_control_input.bit_data.speed = -(int16_t)(processed_ch2 * 2000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); } else { un_remote_control_input.bit_data.speed = 0; } - // 通道1(CH1):转向,映射 -20000~20000 + // 通道1(CH1):转向,映射 -20000~20000 需要反相 int16_t processed_ch1 = remote_control_16ch_output.frame.CH1 - RC_CH_MID_VALUE; if (processed_ch1 < -RC_DEADZONE) { - un_remote_control_input.bit_data.curvature = (int16_t)(processed_ch1 * 20000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); + un_remote_control_input.bit_data.curvature = -(int16_t)(processed_ch1 * 20000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); } else if (processed_ch1 > RC_DEADZONE) { - un_remote_control_input.bit_data.curvature = (int16_t)(processed_ch1 * 20000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); + un_remote_control_input.bit_data.curvature = -(int16_t)(processed_ch1 * 20000.0f / (RC_CH_MAX_VALUE - RC_CH_MID_VALUE)); } else { diff --git a/boards/e3_176_ref/app_demo/eth-xip/sf/interface.h b/boards/e3_176_ref/app_demo/eth-xip/sf/interface.h index 53bb399..b234eeb 100644 --- a/boards/e3_176_ref/app_demo/eth-xip/sf/interface.h +++ b/boards/e3_176_ref/app_demo/eth-xip/sf/interface.h @@ -224,9 +224,9 @@ typedef union _UnRequestFrame typedef struct _StrRemoteControlInput { //-----接收数据0x12000013---------------------------------------------- - unsigned int speed : 16; // 速度 - unsigned int curvature : 16; // 曲率 - unsigned int reserve1 : 16; // 遥控轴 + int16_t speed ; // 速度 + int16_t curvature ; // 曲率 + int16_t reserve1 ; // 遥控轴 unsigned int switch_a : 1; // SwA unsigned int switch_b : 2; // SwB 急停开关 1释放 0/2是急停 @@ -235,7 +235,7 @@ typedef struct _StrRemoteControlInput unsigned int reserve2 : 1; // 保留 unsigned int reserve3 : 1; // 保留 - unsigned int enable : 8; // 使能 + int8_t enable ; // 使能 } StrRemoteControlInput; typedef union _UnRemoteControlInput