You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
3.1 KiB
118 lines
3.1 KiB
/* |
|
* @Author: your name |
|
* @Date: 2021-06-26 15:37:21 |
|
* @LastEditTime: 2021-07-15 08:36:21 |
|
* @LastEditors: Please set LastEditors |
|
* @Description: In User Settings Edit |
|
* @FilePath: \warter_rader\App\freertos_action.c |
|
*/ |
|
#include "freertos_action.h" |
|
|
|
void task_usart_rev_action(void) |
|
{ |
|
usart_data_t data = {0}; |
|
// uint8_t data_uart; |
|
osStatus_t os_status; |
|
osDelay(5000); |
|
request_QOAR1271_data(); |
|
active_uasrt_irq(); |
|
for(;;) |
|
{ |
|
if (usart_rev_queueHandle != NULL) |
|
{ |
|
os_status = osMessageQueueGet(usart_rev_queueHandle, &data, NULL, osWaitForever); |
|
if (os_status == osOK) |
|
{ |
|
parse_ar1271_data(&data); |
|
} |
|
} |
|
else |
|
{ |
|
osDelay(2); |
|
} |
|
} |
|
} |
|
|
|
void task_uavcan_rev_action(void) |
|
{ |
|
uavcan_rev_t uavcan_rev_data; |
|
osStatus_t os_status; |
|
|
|
/* Infinite loop */ |
|
for (;;) |
|
{ |
|
if (uavcan_rev_queueHandle != NULL) |
|
{ |
|
os_status = osMessageQueueGet(uavcan_rev_queueHandle, &uavcan_rev_data, NULL, osWaitForever); |
|
if (os_status == osOK) |
|
{ |
|
handle_uavcan_rx_frame(&uavcan_rev_data); |
|
} |
|
} |
|
else |
|
{ |
|
osDelay(2); |
|
} |
|
} |
|
} |
|
|
|
void task_uavcan_send_action(void) |
|
{ |
|
uavcan_send_data_t data = {0}; |
|
float depth_data=0.0f; |
|
osStatus_t status; |
|
|
|
for(;;) |
|
{ |
|
if (uavcan_send_queueHandle != NULL) |
|
{ |
|
status = osMessageQueueGet(uavcan_send_queueHandle, &data, NULL, 5); |
|
if (status == osOK) |
|
{ |
|
send_uavcan_data(&data); |
|
} |
|
} |
|
send_canard(); |
|
} |
|
} |
|
|
|
void task_default_action(void) |
|
{ |
|
init_allocation(); |
|
uint32_t last_send_node_status_tick =0; |
|
uint32_t last_send_proximity_tick =0; |
|
/* Infinite loop */ |
|
for (;;) |
|
{ |
|
if(last_send_node_status_tick+1000<HAL_GetTick()) |
|
{ |
|
last_send_node_status_tick = HAL_GetTick(); |
|
if (uavcan_send_queueHandle != NULL) |
|
{ |
|
uavcan_send_data_t send_data ={0}; |
|
send_data.id = UAVCAN_NODE_STATUS_DATA_TYPE_ID; |
|
uavcan_node_status_t data ={0}; |
|
memcpy(&send_data.content.node_state,&data,sizeof(uavcan_node_status_t)); |
|
osMessageQueuePut(uavcan_send_queueHandle,&send_data,0,10); |
|
} |
|
} |
|
|
|
// if (last_send_proximity_tick + 200 < HAL_GetTick()) |
|
// { |
|
// last_send_proximity_tick = HAL_GetTick(); |
|
// if (uavcan_send_queueHandle != NULL) |
|
// { |
|
// uavcan_send_data_t send_data = {0}; |
|
// send_data.id = ZRZK_EQUIPMENT_RANGE_SENSOR_PROXIMITY_ID; |
|
// uavcan_proximity_t data = {0}; |
|
// data.d0 = 200; |
|
// data.d45 = 300; |
|
// data.d315 = 400; |
|
// data.d135 = 500; |
|
// memcpy(&send_data.content.node_state, &data, sizeof(uavcan_node_status_t)); |
|
// osMessageQueuePut(uavcan_send_queueHandle, &send_data, 0, 10); |
|
// } |
|
// } |
|
osDelay(200); |
|
} |
|
} |