|
|
@ -35,6 +35,10 @@ static zkey_module_t s_key_module = ZMODULE_INIT(s_keys, onkey); |
|
|
|
|
|
|
|
static uint16_t encoder_get_temp; |
|
|
|
|
|
|
|
static bool netif_link_status; |
|
|
|
static bool camera_encoder_raw_count_update_flag; |
|
|
|
static bool driven_encoder_gear_raw_count_update_flag; |
|
|
|
|
|
|
|
static void zkey_schedule() |
|
|
|
{ |
|
|
|
static uint32_t lastprocess_key_ticket; |
|
|
@ -118,12 +122,14 @@ void netif_link_up_user_func(void) |
|
|
|
{ |
|
|
|
encoder_light_switch_set_color(CAMERA_ENCODER, ENCODER_LIGHT_COLOR_GREEN); |
|
|
|
encoder_light_switch_set_color(DRIVEN_ENCODER_GEAR, ENCODER_LIGHT_COLOR_GREEN); |
|
|
|
netif_link_status = true; |
|
|
|
} |
|
|
|
|
|
|
|
void netif_link_down_user_func(void) |
|
|
|
{ |
|
|
|
encoder_light_switch_set_color(CAMERA_ENCODER, ENCODER_LIGHT_COLOR_RED); |
|
|
|
encoder_light_switch_set_color(DRIVEN_ENCODER_GEAR, ENCODER_LIGHT_COLOR_RED); |
|
|
|
netif_link_status = false; |
|
|
|
} |
|
|
|
|
|
|
|
static void encoder_get_and_calculation(void) |
|
|
@ -133,6 +139,7 @@ static void encoder_get_and_calculation(void) |
|
|
|
{ |
|
|
|
encoder_get_camera_encoder_structer()->count += compute_uint16_t_minus_the_numbers(encoder_get_temp, encoder_get_camera_encoder_structer()->last_count); |
|
|
|
encoder_get_camera_encoder_structer()->last_count = encoder_get_temp; |
|
|
|
camera_encoder_raw_count_update_flag = true; |
|
|
|
} |
|
|
|
|
|
|
|
encoder_get_temp = __HAL_TIM_GET_COUNTER(encoder_get_driven_encoder_gear_structer()->tim_handler); |
|
|
@ -140,6 +147,7 @@ static void encoder_get_and_calculation(void) |
|
|
|
{ |
|
|
|
encoder_get_driven_encoder_gear_structer()->count += compute_uint16_t_minus_the_numbers(encoder_get_temp, encoder_get_driven_encoder_gear_structer()->last_count); |
|
|
|
encoder_get_driven_encoder_gear_structer()->last_count = encoder_get_temp; |
|
|
|
driven_encoder_gear_raw_count_update_flag = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -167,7 +175,7 @@ void user_main() |
|
|
|
zkey_schedule(); |
|
|
|
udp_client_recv(); |
|
|
|
at_cmd_processer_try_process_data(); |
|
|
|
encoder_light_schedule(); |
|
|
|
encoder_light_schedule(netif_link_status, &camera_encoder_raw_count_update_flag, &driven_encoder_gear_raw_count_update_flag); |
|
|
|
port_do_debug_light_state(); |
|
|
|
osDelay(1); |
|
|
|
} |
|
|
|