修改一些备注

main
Zeng wei (曾威) 2 years ago
parent d81878fc09
commit 82badf0a0b

@ -89,8 +89,8 @@ void PID_Calc() // pid calc
{ {
// Obtain the current deviation value // Obtain the current deviation value
// when the target temperature is 1 degree Celsius higher than the actual temperature, heat up // when the target temperature is 1 degree Celsius higher than the actual temperature, heat up
// close compressoropen heater // close compressor open heater
/*GPIO1->Alarm bell GPIO3->heater GPIO4>Fresh air fan GPIO5->humidifier GPIO6->compressor */ /*GPIO1->Alarm bell GPIO3->heater GPIO4->Fresh air fan GPIO5->humidifier GPIO6->compressor */
HC595_Send_Byte(gpio_state &= 0xDF);//close compressor &=1101 1111 0xDF HC595_Send_Byte(gpio_state &= 0xDF);//close compressor &=1101 1111 0xDF
num = 0; num = 0;
TIM_SetCompare3(TIM3, 0); TIM_SetCompare3(TIM3, 0);
@ -101,9 +101,9 @@ void PID_Calc() // pid calc
{ {
// Obtain the current deviation value // Obtain the current deviation value
// when the target temperature is lower than the actual temperature, refrigerate // when the target temperature is lower than the actual temperature, refrigerate
// open compressorclose heater // open compressor close heater
HC595_Send_Byte(gpio_state &= 0xFB); // close heater &=1111 1011 0xFB HC595_Send_Byte(gpio_state &= 0xFB); // close heater &=1111 1011 0xFB
// 0-200 correspond 0-100%, if pid.out=50, percentage means 25%//num=50*400/200=100100/400=25% // 0-200 correspond 0-100%, if pid.out=50, percentage means 25% //num=50*400/200=100 100/400=25%
num = (((pid.OUT * 400) / pid.pwmcycle) - 1); // Conversion of pid.OUT and PWM Duty Cycle Values num = (((pid.OUT * 400) / pid.pwmcycle) - 1); // Conversion of pid.OUT and PWM Duty Cycle Values
TIM_SetCompare3(TIM3, num / 4); TIM_SetCompare3(TIM3, num / 4);
// printf("%d\r\n",num); // printf("%d\r\n",num);

File diff suppressed because one or more lines are too long

@ -1,26 +1,26 @@
#include "myfreertos.h" #include "myfreertos.h"
char pubTopic[512] = "/sys/hp8oQhMZJ67/Device1/thing/event/property/post"; // 发布的主题 char pubTopic[512] = "/sys/hp8oQhMZJ67/Device1/thing/event/property/post"; // Publish topic
char subTopic[512] = "/sys/hp8oQhMZJ67/Device1/thing/service/property/set"; // 订阅的主题 char subTopic[512] = "/sys/hp8oQhMZJ67/Device1/thing/service/property/set"; // Subscribe topic
#define MQTT_SOCK 5 #define MQTT_SOCK 5
// 任务优先级 // task priority
#define START_TASK_PRIO 0 #define START_TASK_PRIO 0
// 任务堆栈大小 // Task stack size
#define START_STK_SIZE 128 #define START_STK_SIZE 128
// 任务句柄 // task handle
TaskHandle_t StartTask_Handler; TaskHandle_t StartTask_Handler;
// 任务函数 // task function
void start_task(void *pvParameters); void start_task(void *pvParameters);
// 任务优先级 // task priority
#define Sensor_Communication_TASK_PRIO 1 // 与传感器通信 #define Sensor_Communication_TASK_PRIO 1 // Communication with sensors
// 任务堆栈大小 // Task stack size
#define Sensor_Communication_STK_SIZE 512 #define Sensor_Communication_STK_SIZE 512
// 任务句柄 // task handle
TaskHandle_t Sensor_CommunicationTask_Handler; TaskHandle_t Sensor_CommunicationTask_Handler;
// 任务函数 // task function
void Sensor_Communication_task(void *pvParameters); void Sensor_Communication_task(void *pvParameters);
void Host_Computer_Communication(void); void Host_Computer_Communication(void);
@ -28,16 +28,16 @@ void Host_Computer_Communication(void);
int isZeros(u8 arr[]); int isZeros(u8 arr[]);
u8 RS485_RX_BUF_COPY[128] = {0}; u8 RS485_RX_BUF_COPY[128] = {0};
u8 cnt_flag = 0, sub_flag = 0, pub_flag = 0; u8 cnt_flag = 0, sub_flag = 0, pub_flag = 0;
u16 time = 0; // 记录ping服务器的时间 u16 time = 0; // Record the time of pinging the server
char wet_temp[256]; // 订阅与发布消息的缓存区 char wet_temp[256]; // Cache area for subscription and publication of messages
u8 store_stage = 1; // 写入flash的阶段号断电重启后读取可以紧接着上次的阶段运行 u8 store_stage = 1; // Write the stage number of the flash, and after a power outage and restart, it can run immediately following the previous stage and status
extern PID pid; extern PID pid;
extern float kd; extern float kd;
extern float ki; extern float ki;
u8 batch_sync_buf[11]; // 单个同步剪切得到的数组 u8 batch_sync_buf[11]; // Array obtained by single synchronous cutting
u8 ins_1 = 0; u8 ins_1 = 0;
int diff = 0; int diff = 0;
u8 gpio_state = 0x00; // 继电器状态 u8 gpio_state = 0x00; // relay status
u8 NUM = 1; // 批量同步发送的阶段号 u8 NUM = 1; // 批量同步发送的阶段号
u8 n; // 阶段号 u8 n; // 阶段号
u16 i; // 序列号 u16 i; // 序列号
@ -46,15 +46,15 @@ u8 cminute; //
u8 hot_clod_flag = 0; // 加热制冷标志位。hot_clod_flag=0, 不加热不制冷hot_clod_flag=2,加热hot_clod_flag=1,制冷 u8 hot_clod_flag = 0; // 加热制冷标志位。hot_clod_flag=0, 不加热不制冷hot_clod_flag=2,加热hot_clod_flag=1,制冷
u8 humidity_flag = 0; // 加湿除湿标志位。 humidity_flag=0不加湿不除湿 humidity_flag=2,加湿; humidity_flag=1除湿 u8 humidity_flag = 0; // 加湿除湿标志位。 humidity_flag=0不加湿不除湿 humidity_flag=2,加湿; humidity_flag=1除湿
u8 ALARM = 0; // 报警标志位。ALARM=0,不报警ALARM=1,报警 u8 ALARM = 0; // 报警标志位。ALARM=0,不报警ALARM=1,报警
u16 tick = 0; // tick大于600触发报警条件会报警小于600则不报警 u16 tick = 0; // tick大于600触发报警条件会报警小于600则不报警
u8 Feed_Dog_Count = 0; // 喂狗计时 u8 Feed_Dog_Count = 0; // Feeding dog timing
u8 now_stage = 1; // 当前运行阶段 u8 now_stage = 1; // Current operational phase
u16 tem, hum, red, blue, white; u16 tem, hum, red, blue, white;
u8 hour, min; u8 hour, min;
u8 change_stage_rev1 = 0; u8 change_stage_rev1 = 0;
u8 change_stage_rev2 = 0; u8 change_stage_rev2 = 0;
u8 change_stage_rev3 = 0; u8 change_stage_rev3 = 0;
u8 rs485buf[8] = {0x02, 0x03, 0x00, 0x01, 0x00, 0x09, 0xD4, 0x3F}; // 传感器交换数据 u8 rs485buf[8] = {0x02, 0x03, 0x00, 0x01, 0x00, 0x09, 0xD4, 0x3F}; // Sensor exchange data
u16 sync_cnt = 0; // 同步环境控制参数的计数器到0同步 u16 sync_cnt = 0; // 同步环境控制参数的计数器到0同步
int T = 0, H = 0, C = 0, G = 0, current_T = 0; int T = 0, H = 0, C = 0, G = 0, current_T = 0;
extern u8 total[]; extern u8 total[];
@ -65,12 +65,12 @@ float temperature = 0;
/********************* /*********************
********************** **********************
entry function
********************** **********************
*********************/ *********************/
void os_init(void) void os_init(void)
{ {
// printf("入口函数调用成功\r\n"); // printf("Entry function call successful\r\n");
xTaskCreate((TaskFunction_t)start_task, xTaskCreate((TaskFunction_t)start_task,
(char *)"start_task", (char *)"start_task",
(uint16_t)START_STK_SIZE, (uint16_t)START_STK_SIZE,
@ -82,7 +82,7 @@ void os_init(void)
/********************* /*********************
********************** **********************
, Create handles for tasks, queues, signal sets, etc., which can also be tested using
********************** **********************
*********************/ *********************/
BaseType_t handler = 0; BaseType_t handler = 0;
@ -100,7 +100,7 @@ BaseType_t handler11 = 0;
/* /*
Start function: Create other functions and timers
*/ */

Loading…
Cancel
Save