diff --git a/usersrc/encoder.c b/usersrc/encoder.c index 2c5dd74..058fd9b 100644 --- a/usersrc/encoder.c +++ b/usersrc/encoder.c @@ -8,6 +8,8 @@ static encoder_light_state_t camera_encoder_state = STANDBY; static encoder_light_state_t driven_encoder_gear_state = STANDBY; static uint32_t camera_encoder_lastprocess = 0; static uint32_t driven_encoder_gear_lastprocess = 0; +static bool camera_encoder_light_state; +static bool driven_encoder_light_state; static encoder_t m_uarts[] = { {&camera_encoder, TIM_CHANNEL_1 | TIM_CHANNEL_2}, // 相机编码器 @@ -76,8 +78,6 @@ bool encoder_read_with_encoder(encoder_usage_t encoder, uint32_t *encoder_value) void encoder_light_schedule(void) { - static bool camera_encoder_light_state; - static bool driven_encoder_light_state; if (camera_encoder_state == STANDBY) { if (sys_haspassedms(camera_encoder_lastprocess) > 500) @@ -127,7 +127,7 @@ void encoder_set_state(encoder_usage_t encoder, encoder_light_state_t state) else if (state == WORKING) { /* 如果工作状态的时候触发了genlock等,灯的状态不应该变成待机状态,只有同为待机的时候闪烁,上层写的时候需要加判断 */ - // HAL_GPIO_WritePin(ENCODER_LIGHT_GPIO_Port, ENCODER_LIGHT_Pin, GPIO_PIN_RESET); + encoder_light_switch_set_color_and_brightness(CAMERA_ENCODER, ENCODER_LIGHT_COLOR_BLUE, encoder_light_max_brightness); } } else if (encoder == DRIVEN_ENCODER_GEAR) @@ -140,7 +140,7 @@ void encoder_set_state(encoder_usage_t encoder, encoder_light_state_t state) } else if (state == WORKING) { - // HAL_GPIO_WritePin(ENCODER_LIGHT_GPIO_Port, ENCODER_LIGHT_Pin, GPIO_PIN_SET); + encoder_light_switch_set_color_and_brightness(DRIVEN_ENCODER_GEAR, ENCODER_LIGHT_COLOR_BLUE, encoder_light_max_brightness); } } }