|
|
|
|
@ -4,10 +4,10 @@
|
|
|
|
|
#include "Relays.h"
|
|
|
|
|
#include "myfreertos.h"
|
|
|
|
|
|
|
|
|
|
u8 prev_sendbuf[49] = {0xEE, 0xB5, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
|
|
|
|
|
u8 sendbuf[49] = {0xEE, 0xB5, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
|
|
|
|
|
u8 prev_sendbuf[53] = {0xEE, 0xB5, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
|
|
|
|
|
u8 sendbuf[53] = {0xEE, 0xB5, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFF};
|
|
|
|
|
u8 sendbuf_crc[20] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
|
|
|
extern u8 global_buffer[64];
|
|
|
|
|
@ -394,10 +394,10 @@ void RS485_1_Upload_Params(void)
|
|
|
|
|
sendbuf[1] = 0xB5;
|
|
|
|
|
sendbuf[2] = 0x05;
|
|
|
|
|
|
|
|
|
|
sendbuf[45] = 0xFF;
|
|
|
|
|
sendbuf[46] = 0xFC;
|
|
|
|
|
sendbuf[47] = 0xFF;
|
|
|
|
|
sendbuf[48] = 0xFF;
|
|
|
|
|
sendbuf[49] = 0xFF;
|
|
|
|
|
sendbuf[50] = 0xFC;
|
|
|
|
|
sendbuf[51] = 0xFF;
|
|
|
|
|
sendbuf[52] = 0xFF;
|
|
|
|
|
|
|
|
|
|
if (T <= 1000 && T >= -1000)
|
|
|
|
|
{
|
|
|
|
|
@ -491,30 +491,34 @@ void RS485_1_Upload_Params(void)
|
|
|
|
|
sendbuf[36] = (int)(pid.cp * 1000) % 256; // Kp 110
|
|
|
|
|
sendbuf[37] = ((int)(pid.ci * 100000)) / 256; // Ti 0.001
|
|
|
|
|
sendbuf[38] = ((int)(pid.ci * 100000)) % 256; // Ti 0.001
|
|
|
|
|
// sendbuf[39] = (int)pid.cd / 256; // Td 340
|
|
|
|
|
// sendbuf[40] = (int)pid.cd % 256; // Td 340
|
|
|
|
|
// TODO::temply print out_tem
|
|
|
|
|
sendbuf[39] = (int)(pid.out_tem * 10) / 256; // Td 340
|
|
|
|
|
sendbuf[40] = (int)(pid.out_tem * 10) % 256; // Td 340
|
|
|
|
|
sendbuf[39] = (int)pid.cd / 256; // Td 340
|
|
|
|
|
sendbuf[40] = (int)pid.cd % 256; // Td 340
|
|
|
|
|
// // TODO::temply print out_tem
|
|
|
|
|
// sendbuf[39] = (int)(pid.out_tem * 10) / 256; // Td 340
|
|
|
|
|
// sendbuf[40] = (int)(pid.out_tem * 10) % 256; // Td 340
|
|
|
|
|
sendbuf[41] = pid.c_speed / 256; // h_percent
|
|
|
|
|
sendbuf[42] = pid.c_speed % 256; // h_percent
|
|
|
|
|
sendbuf[43] = (int)(pid.out_tem * 10) / 256;
|
|
|
|
|
sendbuf[44] = (int)(pid.out_tem * 10) % 256;
|
|
|
|
|
sendbuf[45] = (int)(pid.out_humidity * 10) / 256;
|
|
|
|
|
sendbuf[46] = (int)(pid.out_humidity * 10) % 256;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// bufcut_Init(sendbuf_crc, sendbuf, 3, 31);
|
|
|
|
|
// GetCRC16(sendbuf_crc, 28, &crc_num1, &crc_num2);
|
|
|
|
|
|
|
|
|
|
GetCRC16(sendbuf, 43, &crc_num1, &crc_num2);
|
|
|
|
|
sendbuf[43] = crc_num1;
|
|
|
|
|
sendbuf[44] = crc_num2;
|
|
|
|
|
GetCRC16(sendbuf, 47, &crc_num1, &crc_num2);
|
|
|
|
|
sendbuf[47] = crc_num1;
|
|
|
|
|
sendbuf[48] = crc_num2;
|
|
|
|
|
|
|
|
|
|
// u8 tmpabc[] = {0xAA, 0xBB, 0xCC};
|
|
|
|
|
// RS485_1_Send_Data(tmpabc, 3);
|
|
|
|
|
// only when modify happen, then send
|
|
|
|
|
// if (cmp_str(prev_sendbuf, sendbuf, 49) != 0) {
|
|
|
|
|
|
|
|
|
|
RS485_1_Send_Data(sendbuf, 49);
|
|
|
|
|
RS485_1_Send_Data(sendbuf, 53);
|
|
|
|
|
vTaskDelay(100);
|
|
|
|
|
cp_str_to_prev(prev_sendbuf, sendbuf, 49);
|
|
|
|
|
cp_str_to_prev(prev_sendbuf, sendbuf, 53);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|