|
@@ -43,7 +43,7 @@
|
|
|
#include "pressure.h"
|
|
|
#include "iap.h"
|
|
|
/* USER CODE END Includes */
|
|
|
-#if 1
|
|
|
+#if 0
|
|
|
#define IR_ROM1 0x08000000
|
|
|
#else
|
|
|
#define IR_ROM1 0x08020000
|
|
@@ -130,8 +130,13 @@ uint8_t CMD_GetTempAndYewei[8]={0x51, 0x04, 00, 00, 00, 0x10, 0x03 ,0xae};//
|
|
|
uint8_t CMD_GetTempHuaTian[8]={0x61, 0x03, 00, 04, 00, 01,0,0};//读取华天传感器的第一个温度点
|
|
|
|
|
|
uint8_t CMD_TemAng[8]={TEM_STARTADDR, 0x03, 00, 00, 00, 02,0,0};//FST100-611 通过模拟量模块,读取温度
|
|
|
+
|
|
|
+uint8_t CMD_Temperature[8]={TEM_STARTADDR, 0x03, 00, 02, 00, 02,0,0};
|
|
|
uint8_t CMD_Pressure[8]={PRESSURE_STARTADDR, 0x03, 0x00, 0x00, 0x00, 0x02,0,0}; //FST800-801 读取压力数据, 没有标零指令
|
|
|
|
|
|
+//uint8_t CMD_FSTTem[8]={TEM_STARTADDR, 0x03, 00, 02, 00, 02,0,0};//FST100-1007G371C //温压一体, 读温度指令
|
|
|
+//uint8_t CMD_FSTPressure[8]={PRESSURE_STARTADDR, 0x03, 00, 00, 00, 02,0,0};//FST100-1007G371C //温压一体, 读压力指令
|
|
|
+
|
|
|
|
|
|
|
|
|
//磁编码传感器读取协议 。
|
|
@@ -1908,7 +1913,7 @@ void StartTask02(void *argument) //卸
|
|
|
|
|
|
if(i001 == 15){
|
|
|
|
|
|
- if(pcang->Pressure){
|
|
|
+ if(Pressure_FST800_801 == pcang->Pressure){
|
|
|
|
|
|
ModbusCRC = LIB_CRC_MODBUS(CMD_Pressure, 6);
|
|
|
CMD_Pressure[6] = ModbusCRC >> 8;
|
|
@@ -2209,17 +2214,22 @@ void StartTask03(void *argument) //
|
|
|
Cang_Inf* pcang = &cang_inf;
|
|
|
Level_Inf* plevel = level_inf;
|
|
|
Tem_Inf* ptem = tem_inf;
|
|
|
+ Pressure_Inf* pPressure = pressure_inf;
|
|
|
+
|
|
|
typedef union{
|
|
|
float QDGH_data_temp; //青鸟贵和磁致伸缩液位温度一体传感器
|
|
|
uint8_t arr[4];
|
|
|
}Hex_to_float;
|
|
|
static Hex_to_float hex_to_float;
|
|
|
+ uint8_t pressureaddr_max = 0;
|
|
|
+
|
|
|
leveladdr_max=0;
|
|
|
if(pcang->Temperture==2)
|
|
|
pcang->Temperture=3;
|
|
|
for(i = 0;i < pcang->Cang_Num;i++)
|
|
|
{
|
|
|
- rkgaddr_max += pcang->RKG_Num[i]; //人孔盖最大地址
|
|
|
+ rkgaddr_max += pcang->RKG_Num[i];
|
|
|
+ pressureaddr_max += pcang->Pressure_Num[i]; //人孔盖最大地址
|
|
|
leveladdr_max++;
|
|
|
temaddr_max++;
|
|
|
}
|
|
@@ -2246,11 +2256,13 @@ void StartTask03(void *argument) //
|
|
|
rkgaddr_max = 0;
|
|
|
leveladdr_max=0;
|
|
|
temaddr_max = 0;
|
|
|
+ pressureaddr_max = 0;
|
|
|
if(pcang->Temperture==2)
|
|
|
pcang->Temperture=3;
|
|
|
for(i = 0;i < pcang->Cang_Num;i++)
|
|
|
{
|
|
|
- rkgaddr_max += pcang->RKG_Num[i]; //人孔盖最大地址
|
|
|
+ rkgaddr_max += pcang->RKG_Num[i];
|
|
|
+ pressureaddr_max += pcang->Pressure_Num[i]; //人孔盖最大地址
|
|
|
leveladdr_max++;
|
|
|
temaddr_max++;
|
|
|
}
|
|
@@ -2459,12 +2471,63 @@ void StartTask03(void *argument) //
|
|
|
else
|
|
|
CMD_TemAng[0] = TEM_STARTADDR;
|
|
|
|
|
|
- }
|
|
|
- else
|
|
|
+ }else if(Tem_FST100_1007 == pcang->Temperture )
|
|
|
+ {
|
|
|
+ // taskENTER_CRITICAL();
|
|
|
+ ModbusCRC = LIB_CRC_MODBUS(CMD_Temperature,6);
|
|
|
+ CMD_Temperature[6] = ModbusCRC>>8;
|
|
|
+ CMD_Temperature[7] = ModbusCRC&0xff;
|
|
|
+
|
|
|
+ HAL_GPIO_WritePin(GPIOB,Con01_uart1_rankonggai_Pin,GPIO_PIN_RESET);//
|
|
|
+ delay_sys_us(80);
|
|
|
+ HAL_UART_Transmit_IT(&huart1,CMD_Temperature,8);
|
|
|
+ while (huart1.gState == HAL_UART_STATE_BUSY_TX)
|
|
|
+ {
|
|
|
+ osDelay(1);
|
|
|
+ }
|
|
|
+ //HAL_UART_Transmit(&huart1,CMD_GetTempHuaTian,8,100);
|
|
|
+ //delay_sys_us(80);
|
|
|
+ HAL_GPIO_WritePin(GPIOB,Con01_uart1_rankonggai_Pin,GPIO_PIN_SET);//
|
|
|
+ // taskEXIT_CRITICAL();
|
|
|
+
|
|
|
+ ptem[CMD_Temperature[0] - TEM_STARTADDR].RTData_Num++;
|
|
|
+
|
|
|
+ if((CMD_Temperature[0] - TEM_STARTADDR+1) < temaddr_max)
|
|
|
+ CMD_Temperature[0] = CMD_Temperature[0]+1;
|
|
|
+ else
|
|
|
+ CMD_Temperature[0] = TEM_STARTADDR;
|
|
|
+
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ i001=12;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(i001==12){
|
|
|
+ if(Pressure_FST100_1007 == pcang->Pressure )
|
|
|
+ {
|
|
|
+ ModbusCRC = LIB_CRC_MODBUS(CMD_Pressure, 6);
|
|
|
+ CMD_Pressure[6] = ModbusCRC >> 8;
|
|
|
+ CMD_Pressure[7] = ModbusCRC & 0xff;
|
|
|
+ HAL_GPIO_WritePin(GPIOB, Con01_uart1_rankonggai_Pin, GPIO_PIN_RESET);
|
|
|
+ delay_sys_us(80);
|
|
|
+ HAL_UART_Transmit(&huart1, CMD_Pressure, 8, 200);
|
|
|
+ delay_sys_us(80);
|
|
|
+ HAL_GPIO_WritePin(GPIOB, Con01_uart1_rankonggai_Pin, GPIO_PIN_SET);
|
|
|
+
|
|
|
+ pPressure[CMD_Pressure[0] - PRESSURE_STARTADDR].RTData_Num++;
|
|
|
+
|
|
|
+ if (CMD_Pressure[0] - PRESSURE_STARTADDR +1 < pressureaddr_max)
|
|
|
+ CMD_Pressure[0]++;
|
|
|
+ else
|
|
|
+ CMD_Pressure[0] = PRESSURE_STARTADDR;
|
|
|
+
|
|
|
+ }else
|
|
|
{
|
|
|
i001=0x0;
|
|
|
continue;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else //平台通过卸油阀总线直接操作传感器
|
|
@@ -2663,13 +2726,26 @@ void StartTask03(void *argument) //
|
|
|
else if(USART1_RX_BUF002[0] >=0x60 && USART1_RX_BUF002[0] <= 0x6f) //华天三点式温度传感器接收数据 邵磊明增加
|
|
|
{
|
|
|
Parse_Tem(USART1_RX_BUF002, pcang->Temperture);
|
|
|
-
|
|
|
- i001 = 0;
|
|
|
- continue;
|
|
|
+
|
|
|
+ i001 = 15;
|
|
|
+ continue;
|
|
|
+
|
|
|
}
|
|
|
- else if(0) //暂未使用
|
|
|
+ else if(USART1_RX_BUF002[0] >=0xA0 && USART1_RX_BUF002[0] <= 0xAF) //暂未使用
|
|
|
{
|
|
|
-
|
|
|
+ if (i001 < 9){
|
|
|
+
|
|
|
+ }else if(i001 < 12){
|
|
|
+ Parse_Tem(USART1_RX_BUF002, pcang->Temperture);
|
|
|
+ i001 = 12;
|
|
|
+ continue;
|
|
|
+
|
|
|
+ }else if(i001 < 15){
|
|
|
+
|
|
|
+ Prase_Pressure(USART1_RX_BUF002, pcang->Pressure);
|
|
|
+ i001 = 0;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
else if(0) //暂未使用
|
|
|
{
|
|
@@ -2708,12 +2784,19 @@ void StartTask03(void *argument) //
|
|
|
{
|
|
|
Level_Error(CMD_LDYW[0]);
|
|
|
}else if(i001 == 11){
|
|
|
- Tem_Error(CMD_TemAng[0]);
|
|
|
+ if(Tem_FST100_611 == pcang->Temperture){
|
|
|
+ Tem_Error(CMD_TemAng[0]);
|
|
|
+ }else if(Tem_FST100_1007 == pcang->Temperture){
|
|
|
+ Tem_Error(CMD_Temperature[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(i001 == 15){
|
|
|
+ Pressure_Error(CMD_Pressure[0]);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(i001<0x0c)
|
|
|
+ if(i001<16)
|
|
|
i001++;
|
|
|
else
|
|
|
i001 = 0;
|
|
@@ -2925,7 +3008,7 @@ void StartTask04(void *argument) //
|
|
|
break;
|
|
|
case 0x7a:
|
|
|
SetSuccess = Tem_SetType(ptx); //设置温度传感器种类
|
|
|
- // Flash_Change = 1;
|
|
|
+ //Flash_Change = 1;
|
|
|
break;
|
|
|
case 0x7b:
|
|
|
HDF_Set_CloseVal(ptx); //设置智能海底阀放大倍数
|