FluxDC/components/FluxProtocol/FluxProtocol.c
2025-04-23 09:36:19 +08:00

107 lines
3.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file FluxProtocol.c
* @brief 流量计通讯协议部分
*
* 用于声明便携制氧机参数
*
* @author wang xiang en
* @date 2025-04-18
* @version 版本号
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd
*/
#include <stdio.h>
#include "FluxProtocol.h"
#include "esp_log.h"
/*记录spirits3的没分钟输出的体积*/
float Spirit3_Volume[4] = { 210,420,630,750};
float Spirit6_Volume[6] = { 210,420,630,840,1050,1200};
float YULite8_Volume[6] = { 210,420,630,840,1050,1200};
/* 应用 event_homePage 中的测试状态显示变量 */
extern bool is_bs_test_ing;
/*
* @brief 拼接测试过程中用于展示的字符串
* 1.时间设置发送成功 Time setting sent successfully
* 2.开始测试 start testing
* 3.等待测试结束 Waiting for the end of the test
* 4.当前频率测试结束 The current frequency test has ended
* 5.所有频率测试完毕,请记录。 All frequency tests have been completed, please record.
* 6.设备已启动成功,请开始测试。 Device started successfully, please start testing.
*/
char *test_info[] = {"Time setting sent successfully!!",\
"start testing....",\
"Waiting for the end of the test...",\
"The current frequency test has ended!!",\
"All frequency tests have been completed!!",\
"Device started successfully!!!!"
};
/* 导出协议数据结构体 */
struct FluxProtocol fluxProtocol;
/**
* @brief 新建用于进行带BS测试的任务函数
*
* @param[in] arg not used
*
*/
void bs_test_task(void* arg)
{
while(1)
{
vTaskDelay(1000 / portTICK_PERIOD_MS);
ESP_LOGI("bs_test_task", "bs_test_task");
vTaskDelay(4000 / portTICK_PERIOD_MS);
ESP_LOGI("bs_test_task", "bs_test_task end?");
ESP_LOGI("bs_test_timer_func","hahahahhahah............");
/* 显示测试成功 */
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[3]);
vTaskDelay(4000/portTICK_PERIOD_MS);
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[4]);
vTaskDelay(4000/portTICK_PERIOD_MS);
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[5]);
vTaskDelay(4000/portTICK_PERIOD_MS);
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[1]);
vTaskDelay(4000/portTICK_PERIOD_MS);
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[2]);
ESP_LOGI("bs_test_timer_func","bs_test_timer_func end right");
/* 任务测试完毕 删除任务 */
lv_label_set_text(ui_pageHome_labelStartTest1,"Start Test BS");
is_bs_test_ing = false;
vTaskDelete(NULL);
}
}
/**
* @brief 测试状态显示线程
*
* 设置一个LED小灯测试的时候bling bling 闪
*
* @param[in] arg not used
*
*/
void bs_test_led_task(void* arg)
{
while(1)
{
vTaskDelay(1000 / portTICK_PERIOD_MS);
ESP_LOGI("bs_test_led_task", "bs_test_led_task");
vTaskDelay(1000 / portTICK_PERIOD_MS);
ESP_LOGI("bs_test_led_task", "bs_test_led_task end?");
}
}