| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /*
- * Copyright (c) 2006-2021, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2024-09-29 Administrator the first version
- */
- #include <rtthread.h>
- #include <cJSON.h>
- #include <control.h>
- #include "selfcheck.h"
- #include <hmi.h>
- #include <dtu_uart2.h>
- #include <sht30_collect.h>
- #define DBG_ENABLE
- #define DBG_COLOR
- #define DBG_TAG "selfcheck"
- #define DBG_LEVEL DBG_LOG
- #include <rtdbg.h> //must after of DBG_LVL, DBG_TAG or other options
- rt_timer_t timer_takephoto = RT_NULL;
- Device_Status_typedef device_status;
- static int calculate_average(int arr[], int n) {
- int sum = 0; // 用于存储数组元素的总和
- for (int i = 0; i < n; i++) {
- sum += arr[i]; // 累加每个元素
- }
- // 计算平均值
- int average = sum / n; // 强制类型转换确保得到浮点数结果
- return average;
- }
- static void t_takephoto_callback(void *parameter)
- {
- // rt_timer_delete(timer_takephoto);
- LOG_E("拍照超时!");
- device_status.C01 |= (1<<2); //拍照故障
- device_status.C01 |= (1<<3); //补光灯故障
- HMI_WRITE("selfcheck.t4.bco=63488");
- HMI_WRITE("selfcheck.t3.bco=63488");
- HMI_WRITE("sysSet.va0.txt=\"拍照超时\"");
- }
- int selfcheck(uint8_t type)
- {
- return 0;
- }
- //int rt_software_timer_init(void)
- //{
- // //启动拍照超时定时器
- // timer_takephoto = rt_timer_create("t_takephoto",t_takephoto_callback,RT_NULL, 100000, RT_TIMER_FLAG_ONE_SHOT|RT_TIMER_FLAG_HARD_TIMER);
- // if(timer_takephoto==RT_NULL)
- // {
- // LOG_E("rt_timer_create t_takephoto failed!");
- // return RT_ERROR;
- // }
- // else
- // {
- // return RT_EOK;
- // }
- //}
- //INIT_APP_EXPORT(rt_software_timer_init);
|