4034 lines
88 KiB
C
4034 lines
88 KiB
C
#include "includes.h"
|
||
#include "drv_dtu.h"
|
||
|
||
// 窗口ID
|
||
typedef enum
|
||
{
|
||
FORM_ID_START, // 启动界面
|
||
FORM_ID_METER, // 表盘显示
|
||
FORM_ID_PWD, // 输密码界面
|
||
FORM_ID_000, // 主菜单
|
||
FORM_ID_100, // PSN设置
|
||
FORM_ID_200, // 储罐信息设置
|
||
FORM_ID_210, // 储罐类型设置
|
||
FORM_ID_220, // 介质设置
|
||
FORM_ID_230, // 长度设置
|
||
FORM_ID_240, // 直径设置
|
||
FORM_ID_250, // 充装比设置
|
||
FORM_ID_251, // 低液位百分比设置
|
||
FORM_ID_260, // 密度设置
|
||
FORM_ID_270, // 压力报警低点设置
|
||
FORM_ID_271, // 压力报警高点设置
|
||
FORM_ID_280, // 容积显示
|
||
FORM_ID_285, // 4~20mA输出液位高度(该功能无实际客户应用,该项菜单改为选择4-20mA输出方式)
|
||
FORM_ID_290, // Modbus通信地址设置
|
||
FORM_ID_300, // 上报周期设置
|
||
FORM_ID_310, // 采集周期设置
|
||
FORM_ID_320, // 发送周期设置
|
||
FORM_ID_400, // 标定界面
|
||
FORM_ID_410, // 电容标定
|
||
FORM_ID_411, // C1(100pF)标定
|
||
FORM_ID_412, // C2(400pF)标定
|
||
FORM_ID_413, // 零点标定
|
||
FORM_ID_420, // 压力标定
|
||
FORM_ID_421, // 低压力标定
|
||
FORM_ID_422, // 高压力标定
|
||
FORM_ID_430, // 温度标定
|
||
FORM_ID_431, // 低温度标定
|
||
FORM_ID_432, // 高温度标定
|
||
FORM_ID_500, // 量程设置
|
||
FORM_ID_510, // 电容量程
|
||
FORM_ID_511, // 底电容设置
|
||
FORM_ID_512, // 增长电容设置
|
||
FORM_ID_520, // 压力量程
|
||
FORM_ID_521, // 压力低量程设置
|
||
FORM_ID_522, // 压力高量程设置
|
||
FORM_ID_530, // 温度量程
|
||
FORM_ID_531, // 温度低量程设置
|
||
FORM_ID_532, // 温度高量程设置
|
||
FORM_ID_600, // 系统信息
|
||
FORM_ID_700, // 查看真空度
|
||
} TForm_Id;
|
||
|
||
void Change_Form(TForm_Id formId);
|
||
uint32_t Comm_Sample();
|
||
|
||
// 主界面参数
|
||
typedef struct
|
||
{
|
||
u8 blinkVisible; // 闪烁状态:亮或熄
|
||
u8 menuIdx[3]; // 各级菜单当前项
|
||
u8 privilege; // 操作权限:0-查询,1-设置参数,2-标定
|
||
u8 meterPage; // 表盘显示页面:测量页面、GPRS/GPS页面1、GPRS/GPS页面2、标定页面
|
||
u8 infoPage; // 信息显示页面:软件版本、硬件版本
|
||
u8 caliIdx; // 标定传感器路数
|
||
} TForm_Params;
|
||
|
||
TForm_Params formParam;
|
||
|
||
// 是否允许充装
|
||
volatile uint8_t Charge_Enabled = 0, last_Charge_Enabled = 0, Anti_Enabled = 1;
|
||
volatile uint32_t Charge_Pulse_Time = 0, Anti_Pulse_Time = 0;
|
||
|
||
// 是否允许报警
|
||
volatile uint8_t Alarm_Enabled = 1, Low_Alarm_Enabled = 1, Leak_Alarm_Enabled = 1;
|
||
volatile uint8_t Press_Alarm_Enabled = 1, Low_Press_Alarm_Enabled = 1, ExtPress_Alarm_Enabled = 1, Low_ExtPress_Alarm_Enabled = 1;
|
||
volatile uint8_t Alarm_Output = 0, Low_Alarm_Output = 0, Leak_Alarm_Output = 0;
|
||
volatile uint8_t Press_Alarm_Output = 0, Low_Press_Alarm_Output = 0, ExtPress_Alarm_Output = 0, Low_ExtPress_Alarm_Output = 0;
|
||
|
||
// 是否匹配槽车
|
||
volatile uint8_t Truck_Matched = 0, Truck_Charging = 0;
|
||
volatile uint8_t Match_Charging = 1; // 回持区间,未充满
|
||
|
||
// 充液泵控制
|
||
volatile uint32_t Pump_Stop_Time = 0;
|
||
volatile uint8_t Pump_Stop_posState = 0;
|
||
volatile uint32_t Pump_Stop_Longitude = 0, Pump_Stop_Latitude = 0;
|
||
|
||
// 手动启动充装
|
||
volatile uint8_t Manual_Charing = 0;
|
||
|
||
// 是否在测试界面
|
||
uint8_t MeterInSamplePage()
|
||
{
|
||
return (formParam.meterPage == 3);
|
||
}
|
||
|
||
// 检查当前显示单位是否合法,如不合法则移到最近的合法单位上, 不保存
|
||
void Check_L_Unit(u8 key)
|
||
{
|
||
while(((dcBuff.configBottle.dispMode == DISP_MODE_DPRESS || dcBuff.configBottle.dispMode == DISP_MODE_KG) && dcBuff.configDisplay.L_Unit == UNIT_L)
|
||
|| ((dcBuff.configBottle.dispMode == DISP_MODE_DPRESS || dcBuff.configBottle.dispMode == DISP_MODE_L) && dcBuff.configDisplay.L_Unit == UNIT_KG)
|
||
|| ((dcBuff.configDisplay.op_USE_CAPACITY_SENSOR || dcBuff.configDisplay.op_USE_HEIGHT_LEVEL || dcBuff.configDisplay.op_USE_PCT_LEVEL)
|
||
&& (dcBuff.configDisplay.L_Unit == UNIT_KPA || dcBuff.configDisplay.L_Unit == UNIT_MMH2O))
|
||
|| (dcBuff.configDisplay.op_DISP_MMWC_ONLY && dcBuff.configDisplay.L_Unit != UNIT_MMH2O)
|
||
|| (dcBuff.configDisplay.L_Unit == UNIT_M3 || dcBuff.configDisplay.L_Unit == UNIT_CAL || dcBuff.configDisplay.L_Unit == UNIT_PSI || dcBuff.configDisplay.L_Unit == UNIT_INH2O)
|
||
)
|
||
{
|
||
if(key == KEY_UP)
|
||
{
|
||
if(dcBuff.configDisplay.L_Unit == UNIT_PCT)
|
||
dcBuff.configDisplay.L_Unit = UNIT_CAL;
|
||
else
|
||
dcBuff.configDisplay.L_Unit++;
|
||
}
|
||
else
|
||
{
|
||
if(dcBuff.configDisplay.L_Unit == UNIT_CAL)
|
||
dcBuff.configDisplay.L_Unit = UNIT_PCT;
|
||
else
|
||
dcBuff.configDisplay.L_Unit--;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 显示容积百分比(指针)
|
||
void Meter_DispNeedle()
|
||
{
|
||
u8 needle;
|
||
|
||
if(dcBuff.sampleData.staDPress.notConnect)
|
||
{
|
||
Disp_WriteNeedle(0);
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.underFlow)
|
||
{
|
||
Disp_WriteNeedle(0);
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.overFlow)
|
||
{
|
||
Disp_WriteNeedle(0);
|
||
}
|
||
else
|
||
{
|
||
// 百分比:10段显示
|
||
needle = (u8) ((dcBuff.sampleData.volumePct / 100 + 5) / 10);
|
||
Disp_WriteNeedle(needle);
|
||
}
|
||
}
|
||
|
||
// 显示差压数据
|
||
void Meter_DispDiffData()
|
||
{
|
||
s8 text[10];
|
||
float quotient = 0;
|
||
|
||
Disp_Fld1PointOff();
|
||
Disp_Fld1MultiOff();
|
||
if(dcBuff.sampleData.staDPress.notConnect)
|
||
{
|
||
Disp_Fld1Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.underFlow)
|
||
{
|
||
Disp_Fld1Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.overFlow)
|
||
{
|
||
Disp_Fld1Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
if(dcBuff.sampleData.diff >= 10000)
|
||
{
|
||
// 显示x1000
|
||
Disp_Fld1MultiOn();
|
||
|
||
quotient = dcBuff.sampleData.diff / 1000;
|
||
if(quotient >= 1000)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) quotient);
|
||
// 不显示小数点
|
||
}
|
||
else if(quotient >= 100)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 10));
|
||
// 显示1位小数点
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 100));
|
||
// 显示2位小数点
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
Disp_Fld1Text(text);
|
||
}
|
||
else if(dcBuff.sampleData.diff >= 1000) // 不显示小数
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (dcBuff.sampleData.diff));
|
||
Disp_Fld1Text(text);
|
||
}
|
||
else if(dcBuff.sampleData.diff >= 100) // 显示1位小数
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (dcBuff.sampleData.diff * 10));
|
||
Disp_Fld1Text(text);
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
else if(dcBuff.sampleData.diff >= 10) // 显示2位小数
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (dcBuff.sampleData.diff * 100));
|
||
Disp_Fld1Text(text);
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
else // 显示3位小数
|
||
{
|
||
sprintf(text, "%04d", (uint16_t) (dcBuff.sampleData.diff * 1000));
|
||
Disp_Fld1Text(text);
|
||
Disp_Fld1PointOn(3);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 显示液位数据
|
||
void Meter_DispLevelData()
|
||
{
|
||
s8 text[10];
|
||
float quotient = 0;
|
||
|
||
Disp_Fld1PointOff();
|
||
Disp_Fld1MultiOff();
|
||
if(dcBuff.sampleData.staDPress.notConnect)
|
||
{
|
||
Disp_Fld1Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.underFlow)
|
||
{
|
||
Disp_Fld1Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.overFlow)
|
||
{
|
||
Disp_Fld1Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
if(dcBuff.sampleData.height >= 10000)
|
||
{
|
||
// 显示x1000
|
||
Disp_Fld1MultiOn();
|
||
|
||
quotient = dcBuff.sampleData.height / 1000;
|
||
if(quotient >= 1000)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) quotient);
|
||
// 不显示小数点
|
||
}
|
||
else if(quotient >= 100)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 10));
|
||
// 显示1位小数点
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 100));
|
||
// 显示2位小数点
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
Disp_Fld1Text(text);
|
||
}
|
||
else // 不显示小数
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (dcBuff.sampleData.height));
|
||
Disp_Fld1Text(text);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 显示质量数据
|
||
void Meter_DispQualityData()
|
||
{
|
||
s8 text[10];
|
||
float quotient = 0;
|
||
|
||
Disp_Fld1PointOff();
|
||
Disp_Fld1MultiOff();
|
||
if(dcBuff.sampleData.staDPress.notConnect)
|
||
{
|
||
Disp_Fld1Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.underFlow)
|
||
{
|
||
Disp_Fld1Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.overFlow)
|
||
{
|
||
Disp_Fld1Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
if(dcBuff.sampleData.weight >= 10000)
|
||
{
|
||
// 显示x1000
|
||
Disp_Fld1MultiOn();
|
||
|
||
quotient = ((float) dcBuff.sampleData.weight) / 1000;
|
||
if(quotient >= 1000)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) quotient);
|
||
// 不显示小数点
|
||
}
|
||
else if(quotient >= 100)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 10));
|
||
// 显示1位小数点
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 100));
|
||
// 显示2位小数点
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
Disp_Fld1Text(text);
|
||
}
|
||
else // 不显示小数
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (dcBuff.sampleData.weight));
|
||
Disp_Fld1Text(text);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 显示mmWC数据
|
||
void Meter_DispmmH2OData()
|
||
{
|
||
s8 text[10];
|
||
float mmH2O = KPa2mmH2O(dcBuff.sampleData.diff);
|
||
float quotient = 0;
|
||
|
||
Disp_Fld1PointOff();
|
||
Disp_Fld1MultiOff();
|
||
if(dcBuff.sampleData.staDPress.notConnect)
|
||
{
|
||
Disp_Fld1Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.underFlow)
|
||
{
|
||
Disp_Fld1Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.overFlow)
|
||
{
|
||
Disp_Fld1Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
if(mmH2O >= 10000)
|
||
{
|
||
// 显示x1000
|
||
Disp_Fld1MultiOn();
|
||
|
||
quotient = mmH2O / 1000;
|
||
if(quotient >= 1000)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) quotient);
|
||
// 不显示小数点
|
||
}
|
||
else if(quotient >= 100)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 10));
|
||
// 显示1位小数点
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 100));
|
||
// 显示2位小数点
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
Disp_Fld1Text(text);
|
||
}
|
||
else // 不显示小数
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (mmH2O));
|
||
Disp_Fld1Text(text);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 显示体积数据
|
||
void Meter_DispVolumeData()
|
||
{
|
||
s8 text[10];
|
||
float quotient = 0;
|
||
|
||
Disp_Fld1PointOff();
|
||
Disp_Fld1MultiOff();
|
||
if(dcBuff.sampleData.staDPress.notConnect)
|
||
{
|
||
Disp_Fld1Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.underFlow)
|
||
{
|
||
Disp_Fld1Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.overFlow)
|
||
{
|
||
Disp_Fld1Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
if(dcBuff.sampleData.volume >= 10000)
|
||
{
|
||
// 显示x1000
|
||
Disp_Fld1MultiOn();
|
||
|
||
quotient = ((float) dcBuff.sampleData.volume) / 1000;
|
||
if(quotient >= 1000)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) quotient);
|
||
// 不显示小数点
|
||
}
|
||
else if(quotient >= 100)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 10));
|
||
// 显示1位小数点
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (quotient * 100));
|
||
// 显示2位小数点
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
Disp_Fld1Text(text);
|
||
}
|
||
else // 不显示小数
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (dcBuff.sampleData.volume));
|
||
Disp_Fld1Text(text);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 显示百分比数据
|
||
void Meter_DispPercentData()
|
||
{
|
||
s8 text[10];
|
||
|
||
Disp_Fld1PointOff();
|
||
Disp_Fld1MultiOff();
|
||
if(dcBuff.sampleData.staDPress.notConnect)
|
||
{
|
||
Disp_Fld1Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.underFlow)
|
||
{
|
||
Disp_Fld1Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.overFlow)
|
||
{
|
||
Disp_Fld1Text("+EE");
|
||
}
|
||
else if(dcBuff.sampleData.staDPress.full)
|
||
{
|
||
Disp_Fld1Text("FULL");
|
||
}
|
||
else
|
||
{
|
||
if(dcBuff.sampleData.volumePct >= 10000)
|
||
{
|
||
sprintf(text, "%d", (uint16_t) (dcBuff.sampleData.volumePct / 100));
|
||
Disp_Fld1Text(text);
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%03d", (uint16_t) (dcBuff.sampleData.volumePct / 10));
|
||
// 至少要显示两位数字
|
||
if(text[0] == '0')
|
||
Disp_Fld1Text(text + 1);
|
||
else
|
||
Disp_Fld1Text(text);
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 显示压力数据
|
||
void Meter_DispPres1Data()
|
||
{
|
||
s8 text[10];
|
||
|
||
Disp_Fld4PointOff();
|
||
if(dcBuff.sampleData.staPress.notConnect)
|
||
{
|
||
Disp_Fld4Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staPress.underFlow)
|
||
{
|
||
Disp_Fld4Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staPress.overFlow)
|
||
{
|
||
Disp_Fld4Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%03d", (uint16_t) ((dcBuff.sampleData.pressure + 5) / 10));
|
||
Disp_Fld4Text(text);
|
||
Disp_Fld4PointOn(2);
|
||
}
|
||
}
|
||
|
||
void Meter_DispPres2Data()
|
||
{
|
||
s8 text[10];
|
||
|
||
Disp_Fld3PointOff();
|
||
if(dcBuff.sampleData.staExtPress[0].notConnect)
|
||
{
|
||
Disp_Fld3Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staExtPress[0].underFlow)
|
||
{
|
||
Disp_Fld3Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staExtPress[0].overFlow)
|
||
{
|
||
Disp_Fld3Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%03d", (uint16_t) ((dcBuff.sampleData.extPressure[0] + 5) / 10));
|
||
Disp_Fld3Text(text);
|
||
Disp_Fld3PointOn(2);
|
||
}
|
||
}
|
||
|
||
// 显示温度数据
|
||
void Meter_DispTemp1Data()
|
||
{
|
||
s8 text[10];
|
||
|
||
if(dcBuff.sampleData.staExtTempr[0].notConnect)
|
||
{
|
||
Disp_Fld3Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staExtTempr[0].underFlow)
|
||
{
|
||
Disp_Fld3Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staExtTempr[0].overFlow)
|
||
{
|
||
Disp_Fld3Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%d", dcBuff.sampleData.extTempr[0]);
|
||
Disp_Fld3Text(text);
|
||
}
|
||
}
|
||
|
||
// 显示温度数据
|
||
void Meter_DispTemp2Data()
|
||
{
|
||
s8 text[10];
|
||
|
||
if(dcBuff.sampleData.staExtTempr[1].notConnect)
|
||
{
|
||
Disp_Fld4Text("---");
|
||
}
|
||
else if(dcBuff.sampleData.staExtTempr[1].underFlow)
|
||
{
|
||
Disp_Fld4Text("-EE");
|
||
}
|
||
else if(dcBuff.sampleData.staExtTempr[1].overFlow)
|
||
{
|
||
Disp_Fld4Text("+EE");
|
||
}
|
||
else
|
||
{
|
||
sprintf(text, "%d", dcBuff.sampleData.extTempr[1]);
|
||
Disp_Fld4Text(text);
|
||
}
|
||
}
|
||
|
||
// 显示真空数据
|
||
void Meter_DispVacuData()
|
||
{
|
||
s8 text[10];
|
||
|
||
// 隐藏真空显示
|
||
if(dcBuff.configBottle.hideVacu)
|
||
return;
|
||
|
||
// 如无真空计则不显示
|
||
if(dcBuff.sampleData.vacuum[0].staVacuum == VACUUM_STATUS_COMM_FAULT)
|
||
return;
|
||
|
||
if(dcBuff.sampleData.vacuum[0].staVacuum == VACUUM_STATUS_FAULT || dcBuff.sampleData.vacuum[0].vacuum > 99.99999999)
|
||
Disp_Fld2Text("+EE");
|
||
else if(dcBuff.sampleData.vacuum[0].vacuum > 0.00999999)
|
||
{
|
||
sprintf(text, "%04d", (uint16_t) (dcBuff.sampleData.vacuum[0].vacuum * 100));
|
||
// 至少要显示三位数字
|
||
if(text[0] == '0')
|
||
Disp_Fld2Text(text + 1);
|
||
else
|
||
Disp_Fld2Text(text);
|
||
Disp_Fld2PointOn(2);
|
||
}
|
||
else
|
||
Disp_Fld2Text("-EE");
|
||
|
||
// 显示单位
|
||
Disp_Fld2UnitOn(UNIT_PV_PA);
|
||
}
|
||
|
||
// 刷新状态信息:gprs信号,联网,电池电量
|
||
void Meter_RefreshStatus()
|
||
{
|
||
Disp_WriteBattery((dcBuff.dtuData.batPct + 12) / 25);
|
||
Disp_WriteStrength((dcBuff.dtuData.rssi + 12) / 25);
|
||
Disp_WriteCommunication(!VCC_POWER_STATUS() && dcBuff.dtuData.batLow);
|
||
Disp_WriteAlarm(0);
|
||
Disp_WriteError(0);
|
||
if(!dcBuff.configDisplay.op_ANTI_NORM_OPEN)
|
||
Disp_WriteFill(Charge_Enabled || (Manual_Charing && Truck_Matched));
|
||
else
|
||
Disp_WriteFill(IS_NORM_OPEN_ENABLED());
|
||
Disp_WritePower(VCC_POWER_STATUS());
|
||
Disp_WriteGPS(dcBuff.dtuData.posState);
|
||
Disp_WriteRF(RF_initStatus);
|
||
}
|
||
|
||
void Meter_DispData()
|
||
{
|
||
if(!dcBuff.configDisplay.op_DISP_MMWC_ONLY)
|
||
{
|
||
Meter_DispNeedle();
|
||
|
||
if(dcBuff.configDisplay.L_Unit == UNIT_KPA)
|
||
Meter_DispDiffData();
|
||
else if(dcBuff.configDisplay.L_Unit == UNIT_KG)
|
||
Meter_DispQualityData();
|
||
else if(dcBuff.configDisplay.L_Unit == UNIT_L)
|
||
Meter_DispVolumeData();
|
||
else if(dcBuff.configDisplay.L_Unit == UNIT_MMH2O)
|
||
Meter_DispmmH2OData();
|
||
else
|
||
Meter_DispPercentData();
|
||
}
|
||
else
|
||
Meter_DispmmH2OData();
|
||
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
{
|
||
Meter_DispVacuData();
|
||
if(dcBuff.sampleData.staPress.notConnect && !dcBuff.sampleData.staExtTempr[1].notConnect)
|
||
Meter_DispTemp2Data();
|
||
else
|
||
Meter_DispPres1Data();
|
||
if(dcBuff.sampleData.staExtTempr[0].notConnect && !dcBuff.sampleData.staExtPress[0].notConnect)
|
||
Meter_DispPres2Data();
|
||
else
|
||
Meter_DispTemp1Data();
|
||
}
|
||
}
|
||
|
||
void Meter_Disp()
|
||
{
|
||
s8 text[7] = "";
|
||
u8 i;
|
||
|
||
// 清屏
|
||
Disp_Clear();
|
||
|
||
Meter_RefreshStatus();
|
||
if(formParam.meterPage == 0)
|
||
{
|
||
if(!dcBuff.configDisplay.op_DISP_MMWC_ONLY)
|
||
Disp_SwitchSource(dcBuff.configBottle.source); // 显示液源
|
||
|
||
if(dcBuff.configDisplay.op_DISP_MMWC_ONLY)
|
||
Disp_SwitchDiffUnit(UNIT_MMH2O); // 显示单位
|
||
else
|
||
Disp_SwitchDiffUnit(dcBuff.configDisplay.L_Unit); // 显示单位
|
||
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
{
|
||
Disp_Fld2UnitOff();
|
||
if(dcBuff.sampleData.staExtTempr[0].notConnect && !dcBuff.sampleData.staExtPress[0].notConnect)
|
||
Disp_Fld3UnitOn(UNIT_PT_MPA);
|
||
else
|
||
Disp_Fld3UnitOn(UNIT_PT_C);
|
||
if(dcBuff.sampleData.staPress.notConnect && !dcBuff.sampleData.staExtTempr[1].notConnect)
|
||
Disp_Fld4UnitOn(UNIT_PT_C);
|
||
else
|
||
Disp_Fld4UnitOn(UNIT_PT_MPA);
|
||
}
|
||
Meter_DispData();
|
||
}
|
||
else if(formParam.meterPage == 1)
|
||
{
|
||
// 发送成功次数
|
||
sprintf(text, "%d", dcBuff.powerInfo.gprsSuccCount % 10000);
|
||
// sprintf(text, "%d %d", Motion_Detected, Motion_Status);
|
||
Disp_Fld1Text(text);
|
||
// 定位时间
|
||
sprintf(text, "%02d%02d%02d", dcBuff.dtuData.sysTime.hour, dcBuff.dtuData.sysTime.minute,
|
||
dcBuff.dtuData.sysTime.second);
|
||
for(i = 0; i < 6; i++)
|
||
Disp_DispChar(8 + i, text[i]);
|
||
Disp_Fld3PointOn(1);
|
||
Disp_Fld4PointOn(2);
|
||
// 电池电压
|
||
sprintf(text, "%03d", dcBuff.dtuData.batVoltage / 10);
|
||
Disp_Fld2Text(text);
|
||
Disp_Fld2PointOn(2);
|
||
}
|
||
else if(formParam.meterPage == 2)
|
||
{
|
||
// GPRS错误代码
|
||
Disp_Fld1Text(dcBuff.powerInfo.gprsFailCode);
|
||
// sprintf(text, "%d", SYS_RSTSTS); // 复位原因;
|
||
// Disp_Fld1Text(text);
|
||
// 定位日期
|
||
sprintf(text, "%02d%02d%02d", dcBuff.dtuData.sysTime.year, dcBuff.dtuData.sysTime.month,
|
||
dcBuff.dtuData.sysTime.day);
|
||
for(i = 0; i < 6; i++)
|
||
Disp_DispChar(8 + i, text[i]);
|
||
Disp_Fld3PointOn(1);
|
||
Disp_Fld4PointOn(2);
|
||
// 发送失败次数
|
||
sprintf(text, "%d", (dcBuff.powerInfo.gprsSendCount - dcBuff.powerInfo.gprsSuccCount) % 10000);
|
||
Disp_Fld2Text(text);
|
||
}
|
||
else // 显示测量值
|
||
{
|
||
// 显示KPa
|
||
Disp_SwitchDiffUnit(UNIT_KPA);
|
||
Meter_DispDiffData();
|
||
// 显示温度和压力
|
||
if(dcBuff.sampleData.staExtTempr[0].notConnect && !dcBuff.sampleData.staExtPress[0].notConnect)
|
||
{
|
||
Disp_Fld3UnitOn(UNIT_PT_MPA);
|
||
Meter_DispPres2Data();
|
||
}
|
||
else
|
||
{
|
||
Disp_Fld3UnitOn(UNIT_PT_C);
|
||
Meter_DispTemp1Data();
|
||
}
|
||
if(dcBuff.sampleData.staPress.notConnect && !dcBuff.sampleData.staExtTempr[1].notConnect)
|
||
{
|
||
Disp_Fld4UnitOn(UNIT_PT_C);
|
||
Meter_DispTemp2Data();
|
||
}
|
||
else
|
||
{
|
||
Disp_Fld4UnitOn(UNIT_PT_MPA);
|
||
Meter_DispPres1Data();
|
||
}
|
||
// 提示测试界面
|
||
Disp_WriteAlarm(1);
|
||
Disp_WriteError(1);
|
||
Disp_WriteFill(0);
|
||
}
|
||
}
|
||
|
||
void Meter_Write_Bat_Volt(float volt)
|
||
{
|
||
if(volt < 3.74) // 20%
|
||
Disp_WriteBattery(0);
|
||
else if(volt < 3.79) // 40%
|
||
Disp_WriteBattery(1);
|
||
else if(volt < 3.87) // 60%
|
||
Disp_WriteBattery(2);
|
||
else if(volt < 3.98) // 80%
|
||
Disp_WriteBattery(3);
|
||
else
|
||
Disp_WriteBattery(4);
|
||
}
|
||
|
||
// ********************************************
|
||
// 以下为窗口界面实现
|
||
// ********************************************
|
||
|
||
// 查询菜单
|
||
const char menu_000_items[][5] =
|
||
{
|
||
"PSN", "PARA", "PERI", "CALI", "RANG", "INFO",
|
||
};
|
||
|
||
// 设置菜单
|
||
const char menu_001_items[][5] =
|
||
{
|
||
"PARA",
|
||
};
|
||
|
||
// 标定菜单
|
||
const char menu_002_items[][5] =
|
||
{
|
||
"PSN", "PERI", "CALI", "RANG",
|
||
};
|
||
|
||
// 储罐信息菜单
|
||
const char menu_200_items[][12][5] =
|
||
{
|
||
{"TYPE", "SRC", "LEN", "DIE", "PCT", "LPCT", "DENS", "ALAR", "ALAH", "VOL", "4-20", "ADDR"},
|
||
{"TYPE", "SRC", "LEN", "DIE", "PCT", "LPCT", "DENS", "VOL", "4-20", "ADDR"}
|
||
};
|
||
|
||
// 储罐类型选项
|
||
const char menu_210_items[][5] =
|
||
{
|
||
"STAN", "LIE", "BALL"
|
||
};
|
||
|
||
// 介质选项
|
||
const char menu_220_items[][5] =
|
||
{
|
||
"LNG", "O2", "N2", "AR", "CO2", "H2", "CNG", "HE", "C2H4", "LPG", "NH3", "PENT", "POPO"
|
||
};
|
||
|
||
// 4-20mA输出方式选项
|
||
const char menu_285_items[][5] =
|
||
{
|
||
"RANG", "PCT"
|
||
};
|
||
|
||
// 上报周期菜单
|
||
const char menu_300_items[][5] =
|
||
{
|
||
"CAPT", "SEND"
|
||
};
|
||
|
||
// 标定菜单
|
||
const char menu_400_items[][5][5] =
|
||
{
|
||
{"DIFF", "PRS1", "PRS2", "TEP1", "TEP2"},
|
||
//{"CAP", "PRS1", "PRS2", "TEP1", "TEP2"}
|
||
{"PRS1", "PRS2", "TEP1", "TEP2"}
|
||
};
|
||
|
||
// 电容标定菜单
|
||
const char menu_410_items[][3][5] =
|
||
{
|
||
{"LO", "HIGH", "OFFS"}, // 低点、高点、偏移(零点)
|
||
{"C1", "C2"}
|
||
};
|
||
|
||
// 压力标定菜单
|
||
const char menu_420_items[][5] =
|
||
{
|
||
"LO", "HIGH"
|
||
};
|
||
|
||
// 温度标定菜单
|
||
const char menu_430_items[][2][5] =
|
||
{
|
||
{"LO", "HIGH"},
|
||
{"CALT", "CALR"}
|
||
};
|
||
|
||
// 量程菜单
|
||
const char menu_500_items[][4][5] =
|
||
{
|
||
{"DIFF", "PRS1", "PRS2", "TEP1"},
|
||
{"CAP", "PRS1", "PRS2", "TEP1"}
|
||
};
|
||
|
||
// 电容量程菜单
|
||
const char menu_510_items[][2][5] =
|
||
{
|
||
{"LO", "HIGH"},
|
||
{"BASE", "REF"}
|
||
};
|
||
|
||
// 压力量程菜单
|
||
const char menu_520_items[][5] =
|
||
{
|
||
"LO", "HIGH"
|
||
};
|
||
|
||
// 温度量程菜单
|
||
const char menu_530_items[][5] =
|
||
{
|
||
"LO", "HIGH"
|
||
};
|
||
|
||
// 函数类型定义:事件
|
||
typedef void (*TEvent)(void);
|
||
typedef void (*TKeyEvent)(u8);
|
||
|
||
// 窗口控件结构
|
||
typedef struct
|
||
{
|
||
// 控件
|
||
TButton Button1; // 按钮:自动测量
|
||
TEditBox Edit2; // 编辑框:输入(与选择框二选一)
|
||
TSelectBox Select3; // 选择框:输入(与编辑框二选一)
|
||
TButton Button4; // 按钮:YES
|
||
TButton Button5; // 按钮:ESC
|
||
|
||
// 事件
|
||
TEvent OnButton1; // 按钮1回调函数
|
||
TEvent OnButton4; // 按钮4回调函数
|
||
TEvent OnButton5; // 按钮5回调函数
|
||
TEvent OnTimeOut; // 超时回调函数(自动返回主界面)
|
||
TEvent OnDrawOthers;// 绘制屏幕上除控件以外的其它文字或符号,直接调用底层函数实现
|
||
TKeyEvent OnKey; // 默认按键处理
|
||
|
||
// 属性
|
||
u8 cursorId; // 当前控件:0-无,1-Button1,2-Edit2, 3-Select3,4-Button4, 5-Button5
|
||
} TForm;
|
||
|
||
volatile u32 Form_timer = 0; // 最近动作时间,用于超时处理
|
||
volatile u16 Form_timeout = 4; // 超时时间
|
||
volatile u8 Form_timeouted = 0; // 是否已执行超时动作
|
||
|
||
// 窗口结构
|
||
TForm form;
|
||
|
||
void Form_ResetTimer()
|
||
{
|
||
S_RTC_TIME_DATA_T sRTC;
|
||
|
||
// 获取当前时间
|
||
RTC_GetDateAndTime(&sRTC);
|
||
// 计算自上次gps定位以来的时间
|
||
Form_timer = Calc_SecondsFromYear(INITIAL_YEAR, sRTC.u32Year, sRTC.u32Month, sRTC.u32Day,
|
||
sRTC.u32Hour, sRTC.u32Minute, sRTC.u32Second);
|
||
Form_timeouted = 0;
|
||
}
|
||
|
||
// 设置焦点控件
|
||
void Form_SetFocus()
|
||
{
|
||
if(form.cursorId == 1)
|
||
Button_SetFocus(&form.Button1);
|
||
else if(form.cursorId == 2)
|
||
EditBox_SetFocus(&form.Edit2);
|
||
else if(form.cursorId == 3)
|
||
SelectBox_SetFocus(&form.Select3);
|
||
else if(form.cursorId == 4)
|
||
Button_SetFocus(&form.Button4);
|
||
else if(form.cursorId == 5)
|
||
Button_SetFocus(&form.Button5);
|
||
else
|
||
Disp_ClearCursor();
|
||
}
|
||
|
||
// 切换到第一个控件
|
||
void Form_FocusFirst()
|
||
{
|
||
if(!form.Button1.hide)
|
||
form.cursorId = 1;
|
||
else if(!form.Edit2.hide)
|
||
form.cursorId = 2;
|
||
else if(!form.Select3.hide)
|
||
form.cursorId = 3;
|
||
else if(!form.Button4.hide)
|
||
form.cursorId = 4;
|
||
else if(!form.Button5.hide)
|
||
form.cursorId = 5;
|
||
else
|
||
form.cursorId = 0;
|
||
|
||
// 设置焦点控件
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 切换到下一个控件
|
||
void Form_FocusNext()
|
||
{
|
||
if(form.cursorId == 1)
|
||
{
|
||
if(!form.Edit2.hide)
|
||
form.cursorId = 2;
|
||
else if(!form.Select3.hide)
|
||
form.cursorId = 3;
|
||
else if(!form.Button4.hide)
|
||
form.cursorId = 4;
|
||
else if(!form.Button5.hide)
|
||
form.cursorId = 5;
|
||
}
|
||
else if(form.cursorId == 2)
|
||
{
|
||
if(!form.Select3.hide)
|
||
form.cursorId = 3;
|
||
else if(!form.Button4.hide)
|
||
form.cursorId = 4;
|
||
else if(!form.Button5.hide)
|
||
form.cursorId = 5;
|
||
else if(!form.Button1.hide)
|
||
form.cursorId = 1;
|
||
}
|
||
else if(form.cursorId == 3)
|
||
{
|
||
if(!form.Button4.hide)
|
||
form.cursorId = 4;
|
||
else if(!form.Button5.hide)
|
||
form.cursorId = 5;
|
||
else if(!form.Button1.hide)
|
||
form.cursorId = 1;
|
||
else if(!form.Edit2.hide)
|
||
form.cursorId = 2;
|
||
}
|
||
else if(form.cursorId == 4)
|
||
{
|
||
if(!form.Button5.hide)
|
||
form.cursorId = 5;
|
||
else if(!form.Button1.hide)
|
||
form.cursorId = 1;
|
||
else if(!form.Edit2.hide)
|
||
form.cursorId = 2;
|
||
else if(!form.Select3.hide)
|
||
form.cursorId = 3;
|
||
}
|
||
else if(form.cursorId == 5)
|
||
{
|
||
if(!form.Button1.hide)
|
||
form.cursorId = 1;
|
||
else if(!form.Edit2.hide)
|
||
form.cursorId = 2;
|
||
else if(!form.Select3.hide)
|
||
form.cursorId = 3;
|
||
else if(!form.Button4.hide)
|
||
form.cursorId = 4;
|
||
}
|
||
|
||
// 设置焦点控件
|
||
Form_SetFocus();
|
||
}
|
||
|
||
void Form_OnKey(u8 key)
|
||
{
|
||
if(form.cursorId == 1 && Button_OnKey(&form.Button1, key) != KEY_INVALID)
|
||
{
|
||
if(key == KEY_FUNC)
|
||
Form_FocusNext();
|
||
else if(key == KEY_SET && form.OnButton1 != NULL)
|
||
form.OnButton1();
|
||
|
||
return;
|
||
}
|
||
if(form.cursorId == 2 && EditBox_OnKey(&form.Edit2, key) != KEY_INVALID)
|
||
{
|
||
if(key == KEY_FUNC)
|
||
Form_FocusNext();
|
||
|
||
return;
|
||
}
|
||
if(form.cursorId == 3 && SelectBox_OnKey(&form.Select3, key) != KEY_INVALID)
|
||
{
|
||
if(key == KEY_FUNC)
|
||
Form_FocusNext();
|
||
|
||
return;
|
||
}
|
||
if(form.cursorId == 4 && Button_OnKey(&form.Button4, key) != KEY_INVALID)
|
||
{
|
||
if(key == KEY_FUNC)
|
||
Form_FocusNext();
|
||
else if(key == KEY_SET && form.OnButton4 != NULL)
|
||
form.OnButton4();
|
||
|
||
return;
|
||
}
|
||
if(form.cursorId == 5 && Button_OnKey(&form.Button5, key) != KEY_INVALID)
|
||
{
|
||
if(key == KEY_FUNC)
|
||
Form_FocusNext();
|
||
else if(key == KEY_SET && form.OnButton5 != NULL)
|
||
form.OnButton5();
|
||
|
||
return;
|
||
}
|
||
|
||
if(form.OnKey != NULL)
|
||
form.OnKey(key);
|
||
}
|
||
|
||
// 刷新控件
|
||
void Form_RefreshCtrls()
|
||
{
|
||
if(!form.Button1.hide)
|
||
Button_Refresh(&form.Button1);
|
||
if(!form.Edit2.hide)
|
||
EditBox_Refresh(&form.Edit2);
|
||
if(!form.Select3.hide)
|
||
SelectBox_Refresh(&form.Select3);
|
||
if(!form.Button4.hide)
|
||
Button_Refresh(&form.Button4);
|
||
if(!form.Button5.hide)
|
||
Button_Refresh(&form.Button5);
|
||
}
|
||
|
||
void Form_Refresh()
|
||
{
|
||
if(form.OnDrawOthers != NULL)
|
||
form.OnDrawOthers();
|
||
Form_RefreshCtrls();
|
||
|
||
// 实际写屏
|
||
HT1621_Refresh();
|
||
}
|
||
|
||
void Form_OnTimer()
|
||
{
|
||
S_RTC_TIME_DATA_T sRTC;
|
||
|
||
// 切换闪烁状态
|
||
formParam.blinkVisible = !formParam.blinkVisible;
|
||
Disp_SetBlinkVisible(formParam.blinkVisible);
|
||
|
||
// 处理超时
|
||
if(form.OnTimeOut != NULL && !Form_timeouted)
|
||
{
|
||
// 获取当前时间
|
||
RTC_GetDateAndTime(&sRTC);
|
||
// 计算自上次gps定位以来的时间
|
||
if(Calc_SecondsFromYear(INITIAL_YEAR, sRTC.u32Year, sRTC.u32Month, sRTC.u32Day,
|
||
sRTC.u32Hour, sRTC.u32Minute, sRTC.u32Second) >= Form_timer + Form_timeout)
|
||
{
|
||
Form_timeouted = 1;
|
||
form.OnTimeOut();
|
||
}
|
||
}
|
||
|
||
Form_Refresh();
|
||
}
|
||
// ********************************************
|
||
// 以下为各个功能界面函数
|
||
// ********************************************
|
||
|
||
// 默认超时:查看30秒,设置60秒,标定120秒
|
||
#define OPERATE_TIMEOUT (formParam.privilege == 0 ? 30 : (formParam.privilege == 1 ? 60 : 120))
|
||
#define METER_DISP_TIMEOUT 4 // 正常界面:4秒钟休眠
|
||
#define METER_TEST_TIMEOUT 60 // 测试界面:1分钟休眠
|
||
|
||
// 超时:进入主界面
|
||
void Form_Return2Meter()
|
||
{
|
||
formParam.menuIdx[0] = 0;
|
||
formParam.menuIdx[1] = 0;
|
||
formParam.menuIdx[2] = 0;
|
||
formParam.meterPage = 0;
|
||
Change_Form(FORM_ID_METER);
|
||
}
|
||
|
||
// 启动界面进入,或功能界面返回到设置菜单
|
||
void Form_Return2_000()
|
||
{
|
||
formParam.menuIdx[1] = 0;
|
||
formParam.menuIdx[2] = 0;
|
||
Change_Form(FORM_ID_000);
|
||
}
|
||
|
||
// ********************************************
|
||
// 启动界面
|
||
// ********************************************
|
||
void Form_Start_OnDrawOthers()
|
||
{
|
||
char psn[20];
|
||
u8 i;
|
||
|
||
// 显示13位PSN号
|
||
sprintf(psn, "20%02d%02d%02d%02d%03d", dcBuff.configBottle.PSN[0], dcBuff.configBottle.PSN[1],
|
||
dcBuff.configBottle.PSN[2], dcBuff.configBottle.PSN[3],
|
||
(dcBuff.configBottle.PSN[4] << 8) | dcBuff.configBottle.PSN[5]);
|
||
for(i = 0; i < 13; i++)
|
||
Disp_DispChar(i, psn[i]);
|
||
}
|
||
|
||
// 无控件,4秒超时
|
||
void Form_Start_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Hide(&form.Select3);
|
||
Button_Hide(&form.Button4);
|
||
Button_Hide(&form.Button5);
|
||
|
||
Form_timeout = 4; // 4秒超时
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_Start_OnDrawOthers;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 主界面
|
||
// ********************************************
|
||
|
||
void Form_Meter_OnDrawOthers()
|
||
{
|
||
// 显示表盘全部数据
|
||
Meter_Disp();
|
||
|
||
// 贴片厂测试软件打开
|
||
// Disp_WriteAlarm(1);
|
||
// Disp_WriteError(1);
|
||
// Disp_WriteFill(1);
|
||
// Disp_WritePower(1);
|
||
// Disp_WriteGPS(1);
|
||
// Disp_WriteRF(1);
|
||
}
|
||
|
||
// 主界面超时
|
||
void Form_Meter_OnTimeOut()
|
||
{
|
||
if(formParam.meterPage == 3)
|
||
{
|
||
formParam.meterPage = 0;
|
||
Form_timeout = METER_DISP_TIMEOUT;
|
||
|
||
// 刷新屏幕
|
||
xSemaphoreGive(Key_Semaphore);
|
||
}
|
||
// 允许休眠
|
||
LCD_Disabled = 1;
|
||
}
|
||
|
||
void Form_Meter_OnKey(u8 key)
|
||
{
|
||
// 按FUNC键进入查询或设置界面
|
||
if(key == KEY_FUNC)
|
||
{
|
||
formParam.privilege = 0;
|
||
Change_Form(FORM_ID_PWD);
|
||
}
|
||
// 防过充
|
||
else if(key == KEY_SET)
|
||
{
|
||
if(IS_ALARM_ON() && formParam.meterPage == 0)
|
||
{
|
||
// 手动关闭报警
|
||
KZ_ALARM_OFF();
|
||
|
||
if(dcBuff.configDisplay.op_ALARM_OUTPUT && Alarm_Output)
|
||
Alarm_Enabled = 0;
|
||
if(dcBuff.configDisplay.op_LOW_ALARM_OUTPUT && Low_Alarm_Output)
|
||
Low_Alarm_Enabled = 0;
|
||
if(dcBuff.configDisplay.op_LEAK_ALARM_OUTPUT && Leak_Alarm_Output)
|
||
Leak_Alarm_Enabled = 0;
|
||
if(dcBuff.configDisplay.op_PRESS_ALARM_OUTPUT && Press_Alarm_Output)
|
||
Press_Alarm_Enabled = 0;
|
||
if(dcBuff.configDisplay.op_LOW_PRESS_ALARM_OUTPUT && Low_Press_Alarm_Output)
|
||
Low_Press_Alarm_Enabled = 0;
|
||
if(dcBuff.powerInfo.hardVer.major == 232 && ExtPress_Alarm_Output)
|
||
ExtPress_Alarm_Enabled = 0;
|
||
if(dcBuff.powerInfo.hardVer.major == 232 && Low_ExtPress_Alarm_Output)
|
||
Low_ExtPress_Alarm_Enabled = 0;
|
||
|
||
Alarm_Output = 0;
|
||
Low_Alarm_Output = 0;
|
||
Leak_Alarm_Output = 0;
|
||
Press_Alarm_Output = 0;
|
||
Low_Press_Alarm_Output = 0;
|
||
ExtPress_Alarm_Output = 0;
|
||
Low_ExtPress_Alarm_Output = 0;
|
||
}
|
||
|
||
if(dcBuff.configDisplay.op_LOW_ALARM_OUTPUT && formParam.meterPage == 0)
|
||
{
|
||
// 手动关闭报警
|
||
if(Low_Alarm_Enabled && IS_ALARM_ON())
|
||
{
|
||
Low_Alarm_Enabled = 0;
|
||
KZ_ALARM_OFF();
|
||
}
|
||
}
|
||
if(dcBuff.configDisplay.op_LEAK_ALARM_OUTPUT && formParam.meterPage == 0)
|
||
{
|
||
// 手动关泄露报警
|
||
if(Leak_Alarm_Enabled && IS_ALARM_ON())
|
||
{
|
||
Leak_Alarm_Enabled = 0;
|
||
KZ_ALARM_OFF();
|
||
}
|
||
}
|
||
if(dcBuff.configDisplay.op_ANTI_OVERFILL && formParam.meterPage == 0)
|
||
{
|
||
// 手动开关充装
|
||
Charge_Enabled = !Charge_Enabled;
|
||
if(Charge_Enabled)
|
||
Wakeup_SetAlarm(1);
|
||
|
||
// 采集数据
|
||
Sample_Notify();
|
||
}
|
||
if(dcBuff.configDisplay.op_ANTI_NORM_OPEN && formParam.meterPage == 0)
|
||
{
|
||
// 手动断电,常开电磁阀打开
|
||
KZ_NORM_OPEN_ENABLE();
|
||
}
|
||
|
||
if(RF_initStatus && !dcBuff.configDisplay.op_SEND_GPS_DATA && !dcBuff.configDisplay.op_BOX_VER && formParam.meterPage == 0)
|
||
{
|
||
printf("********* Manual_Charing = 1 ****\r\n");
|
||
Manual_Charing = 1;
|
||
Wakeup_SetAlarm(1);
|
||
// 采集数据
|
||
Sample_Notify();
|
||
}
|
||
}
|
||
else if(key == KEY_DOWN)
|
||
{
|
||
if(formParam.meterPage >= 3)
|
||
formParam.meterPage = 0;
|
||
else
|
||
formParam.meterPage++;
|
||
if(formParam.meterPage == 3)
|
||
Form_timeout = METER_TEST_TIMEOUT;
|
||
else
|
||
Form_timeout = METER_DISP_TIMEOUT;
|
||
|
||
}
|
||
else if(key == KEY_UP)
|
||
{
|
||
if(formParam.meterPage == 0)
|
||
{
|
||
if(dcBuff.configDisplay.L_Unit == UNIT_PCT)
|
||
dcBuff.configDisplay.L_Unit = UNIT_CAL;
|
||
else
|
||
dcBuff.configDisplay.L_Unit++;
|
||
// 保存
|
||
Config_SaveConfig();
|
||
// 检查合法性
|
||
Check_L_Unit(key);
|
||
}
|
||
else if((formParam.meterPage == 1 || formParam.meterPage == 2) && Key_Wakeup)
|
||
{
|
||
// 清除错误代码
|
||
strcpy(dcBuff.powerInfo.gprsFailCode, "");
|
||
dcBuff.powerInfo.gprsSuccCount = 0;
|
||
dcBuff.powerInfo.gprsSendCount = 0;
|
||
if(formParam.meterPage == 1)
|
||
{
|
||
// 强制上传
|
||
DTU_dataConn = 1;
|
||
}
|
||
else
|
||
{
|
||
// 强制连接维护平台
|
||
DTU_ldmsConn = 1;
|
||
// 强制定位
|
||
GPS_Located = 0;
|
||
GPS_Locate = 1;
|
||
}
|
||
// 并发送
|
||
DTU_semSync = 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 无控件
|
||
void Form_Meter_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Hide(&form.Select3);
|
||
Button_Hide(&form.Button4);
|
||
Button_Hide(&form.Button5);
|
||
|
||
Form_timeout = METER_DISP_TIMEOUT;
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_Meter_OnDrawOthers;
|
||
form.OnTimeOut = Form_Meter_OnTimeOut;
|
||
form.OnKey = Form_Meter_OnKey;
|
||
}
|
||
|
||
// ********************************************
|
||
// 输密码界面
|
||
// ********************************************
|
||
// 休眠按钮
|
||
void Form_Pwd_OnButton1()
|
||
{
|
||
if(strcmp(form.Edit2.text, "0ooo") == 0)
|
||
Wakeup_SleepDown();
|
||
else
|
||
Form_Return2Meter();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_Pwd_OnButton4()
|
||
{
|
||
// 不输入密码,进入查询界面
|
||
if(strcmp(form.Edit2.text, "oooo") == 0)
|
||
{
|
||
formParam.privilege = 0;
|
||
Form_Return2_000();
|
||
}
|
||
// 输入密码1:设置储罐参数
|
||
else if(strcmp(form.Edit2.text, dcBuff.configDisplay.pwd1) == 0)
|
||
{
|
||
formParam.privilege = 1;
|
||
//Form_Return2_000();
|
||
Change_Form(FORM_ID_200); // 一级菜单只有一项,直接进入二级菜单(储罐参数设置)
|
||
}
|
||
// 输入密码2:设置标定等参数
|
||
else if(strcmp(form.Edit2.text, dcBuff.configDisplay.pwd2) == 0)
|
||
{
|
||
formParam.privilege = 2;
|
||
Form_Return2_000();
|
||
}
|
||
// 输入密码3:查看真空度
|
||
else if(strcmp(form.Edit2.text, "2323") == 0)
|
||
{
|
||
formParam.privilege = 0;
|
||
Change_Form(FORM_ID_700);
|
||
}
|
||
// 输入错误密码:返回主界面
|
||
else
|
||
Form_Return2Meter();
|
||
}
|
||
|
||
void Form_Pwd_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Create(&form.Button1, 4, 3, "SLP");
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, "oooo");
|
||
SelectBox_Hide(&form.Select3);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
// 设置焦点到输入框
|
||
form.cursorId = 2;
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_Pwd_OnButton1;
|
||
form.OnButton4 = Form_Pwd_OnButton4;
|
||
form.OnButton5 = Form_Return2Meter;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 设置菜单界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_000_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[0] = form.Select3.idx;
|
||
|
||
if(formParam.privilege == 0)
|
||
{
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 设置PSN
|
||
Change_Form(FORM_ID_100);
|
||
break;
|
||
case 1: // 设置储罐参数
|
||
Change_Form(FORM_ID_200);
|
||
break;
|
||
case 2: // 设置上报周期
|
||
Change_Form(FORM_ID_300);
|
||
break;
|
||
case 3: // 标定
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_400);
|
||
else
|
||
Change_Form(FORM_ID_410);
|
||
break;
|
||
case 4: // 量程
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_500);
|
||
else
|
||
Change_Form(FORM_ID_510);
|
||
break;
|
||
case 5: // 信息
|
||
Change_Form(FORM_ID_600);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else if(formParam.privilege == 1) // 这个地方不会执行到,因为一级菜单只有一项,故直接进入二级菜单
|
||
{
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 设置储罐参数
|
||
Change_Form(FORM_ID_200);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 设置PSN
|
||
Change_Form(FORM_ID_100);
|
||
break;
|
||
case 1: // 设置上报周期
|
||
Change_Form(FORM_ID_300);
|
||
break;
|
||
case 2: // 标定
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_400);
|
||
else
|
||
Change_Form(FORM_ID_410);
|
||
break;
|
||
case 3: // 量程
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_500);
|
||
else
|
||
Change_Form(FORM_ID_510);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
void Form_000_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
if(formParam.privilege == 0)
|
||
SelectBox_Create(&form.Select3, 0, 4, 6, menu_000_items, formParam.menuIdx[0]);
|
||
else if(formParam.privilege == 1)
|
||
SelectBox_Create(&form.Select3, 0, 4, 1, menu_001_items, formParam.menuIdx[0]);
|
||
else
|
||
SelectBox_Create(&form.Select3, 0, 4, 4, menu_002_items, formParam.menuIdx[0]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_000_OnButton4;
|
||
form.OnButton5 = Form_Return2Meter;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 设置PSN界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_100_OnButton4()
|
||
{
|
||
char psn[20];
|
||
u16 serial;
|
||
|
||
// 保存PSN
|
||
strcpy(psn, form.Edit2.text);
|
||
|
||
serial = atoi(psn + 10);
|
||
dcBuff.configBottle.PSN[5] = serial & 0xFF;
|
||
dcBuff.configBottle.PSN[4] = serial >> 8;
|
||
|
||
psn[10] = 0;
|
||
dcBuff.configBottle.PSN[3] = atoi(psn + 8);
|
||
psn[8] = 0;
|
||
dcBuff.configBottle.PSN[2] = atoi(psn + 6);
|
||
psn[6] = 0;
|
||
dcBuff.configBottle.PSN[1] = atoi(psn + 4);
|
||
psn[4] = 0;
|
||
dcBuff.configBottle.PSN[0] = atoi(psn + 2);
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_000();
|
||
}
|
||
|
||
void Form_100_Create()
|
||
{
|
||
char psn[20];
|
||
|
||
// 显示13位PSN号
|
||
sprintf(psn, "20%02d%02d%02d%02d%03d", dcBuff.configBottle.PSN[0], dcBuff.configBottle.PSN[1],
|
||
dcBuff.configBottle.PSN[2], dcBuff.configBottle.PSN[3],
|
||
(dcBuff.configBottle.PSN[4] << 8) | dcBuff.configBottle.PSN[5]);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 0, 4, 13, psn);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_100_OnButton4;
|
||
form.OnButton5 = Form_Return2_000;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 储罐参数设置界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_200_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[1] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 类型
|
||
Change_Form(FORM_ID_210);
|
||
break;
|
||
case 1: // 液源
|
||
Change_Form(FORM_ID_220);
|
||
break;
|
||
case 2: // 长度
|
||
Change_Form(FORM_ID_230);
|
||
break;
|
||
case 3: // 直径
|
||
Change_Form(FORM_ID_240);
|
||
break;
|
||
case 4: // 充装比
|
||
Change_Form(FORM_ID_250);
|
||
break;
|
||
case 5: // 低液位百分比
|
||
Change_Form(FORM_ID_251);
|
||
break;
|
||
case 6: // 密度
|
||
Change_Form(FORM_ID_260);
|
||
break;
|
||
case 7: // 压力报警低点
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_270);
|
||
else// 容积
|
||
Change_Form(FORM_ID_280);
|
||
break;
|
||
case 8: // 压力报警高点
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_271);
|
||
else // 4~20mA输出液位高度
|
||
Change_Form(FORM_ID_285);
|
||
break;
|
||
case 9: // 容积
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_280);
|
||
else // Modbus通信地址
|
||
Change_Form(FORM_ID_290);
|
||
break;
|
||
case 10:// 4~20mA输出液位高度
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_285);
|
||
break;
|
||
case 11: // Modbus通信地址
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
Change_Form(FORM_ID_290);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_200_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY ? 10 : 12,
|
||
menu_200_items[dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY], formParam.menuIdx[1]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_200_OnButton4;
|
||
if(formParam.privilege == 0)
|
||
form.OnButton5 = Form_Return2_000;
|
||
else // 无一级菜单
|
||
form.OnButton5 = Form_Return2Meter;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回上级菜单
|
||
void Form_Return2_200()
|
||
{
|
||
formParam.menuIdx[2] = 0;
|
||
Change_Form(FORM_ID_200);
|
||
}
|
||
|
||
// ********************************************
|
||
// 储罐类型设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_210_OnButton4()
|
||
{
|
||
// 保存类型
|
||
dcBuff.configBottle.type = form.Select3.idx;
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_210_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 3, menu_210_items, dcBuff.configBottle.type);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
SelectBox_ReadOnly(&form.Select3);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_210_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 液源设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_220_OnButton4()
|
||
{
|
||
// 保存液源
|
||
dcBuff.configBottle.source = form.Select3.idx;
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_220_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 13, menu_220_items, dcBuff.configBottle.source);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
SelectBox_ReadOnly(&form.Select3);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_220_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 储罐长度设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_230_OnButton4()
|
||
{
|
||
// 保存长度
|
||
dcBuff.configBottle.len = atoi(form.Edit2.text);
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_230_Create()
|
||
{
|
||
char len[8];
|
||
sprintf(len, "%05d", dcBuff.configBottle.len);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 0, 4, 5, len);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_230_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 储罐直径设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_240_OnButton4()
|
||
{
|
||
// 保存直径
|
||
dcBuff.configBottle.diameter = atoi(form.Edit2.text);
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_240_Create()
|
||
{
|
||
char diameter[8];
|
||
sprintf(diameter, "%05d", dcBuff.configBottle.diameter);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 0, 4, 5, diameter);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_240_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 充装比设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_250_OnButton4()
|
||
{
|
||
// 保存充装比
|
||
dcBuff.configBottle.fullPct = atoi(form.Edit2.text) * 100;
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_250_Create()
|
||
{
|
||
char fullPct[8];
|
||
sprintf(fullPct, "%02d", dcBuff.configBottle.fullPct / 100);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 2, 2, fullPct);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_250_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 低液位百分比设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_251_OnButton4()
|
||
{
|
||
// 保存充装比
|
||
dcBuff.configBottle.emptyPct = atoi(form.Edit2.text) * 100;
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_251_Create()
|
||
{
|
||
char emptyPct[8];
|
||
sprintf(emptyPct, "%02d", dcBuff.configBottle.emptyPct / 100);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 2, 2, emptyPct);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_251_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 液体密度设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_260_OnButton4()
|
||
{
|
||
// 保存密度
|
||
Config_SetDensity(dcBuff.configBottle.source, atoi(form.Edit2.text) * 0.001);
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_260_Create()
|
||
{
|
||
char density[8];
|
||
sprintf(density, "%04d", (uint16_t) (Config_GetDensity(dcBuff.configBottle.source) * 1000));
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, density);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_260_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 压力报警低点设置界面
|
||
// ********************************************
|
||
void Form_DispPoint2()
|
||
{
|
||
Disp_Fld1MultiOff();
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
|
||
void Form_DispPoint1()
|
||
{
|
||
Disp_Fld1MultiOff();
|
||
Disp_Fld1PointOn(1);
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_270_OnButton4()
|
||
{
|
||
// 保存报警参数
|
||
dcBuff.configBottle.warnPress = atoi(form.Edit2.text) * 10;
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_270_Create()
|
||
{
|
||
char warnPress[8];
|
||
sprintf(warnPress, "%03d", dcBuff.configBottle.warnPress / 10);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 3, 3, warnPress);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_DispPoint2;
|
||
form.OnButton4 = Form_270_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 压力报警高点设置界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_271_OnButton4()
|
||
{
|
||
// 保存报警参数
|
||
dcBuff.configBottle.warnPressH = atoi(form.Edit2.text) * 10;
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_271_Create()
|
||
{
|
||
char warnPressH[8];
|
||
sprintf(warnPressH, "%03d", dcBuff.configBottle.warnPressH / 10);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 3, 3, warnPressH);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_DispPoint2;
|
||
form.OnButton4 = Form_271_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 储罐容积显示界面
|
||
// ********************************************
|
||
void Form_280_Create()
|
||
{
|
||
char volumeTotal[8];
|
||
|
||
Calculate_Theoretical_Params();
|
||
sprintf(volumeTotal, "%06d", Theoretical_Param.v);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 0, 4, 6, volumeTotal);
|
||
SelectBox_Hide(&form.Select3);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_Return2_200;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
#if 0
|
||
// ********************************************
|
||
// 4~20mA输出液位高度设置界面
|
||
// ********************************************
|
||
|
||
void Form_285_OnButton1()
|
||
{
|
||
// 自动采集差压值
|
||
if(Comm_Sample())
|
||
{
|
||
sprintf(form.Edit2.text, "%05d", (uint16_t) KPa2mmH2O(dcBuff.sampleData.diff));
|
||
form.cursorId = 4; // 光标到确认按钮
|
||
}
|
||
else
|
||
form.cursorId = 5; // 光标到返回按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_285_OnButton4()
|
||
{
|
||
dcBuff.configSensor.levelOutMMWC = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_285_Create()
|
||
{
|
||
char mmWC[10];
|
||
|
||
sprintf(mmWC, "%05d", dcBuff.configSensor.levelOutMMWC);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 5, mmWC);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
{
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_285_OnButton1;
|
||
form.OnButton4 = Form_285_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
#else
|
||
// ********************************************
|
||
// 4~20mA输出液位输出方式设置界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_285_OnButton4()
|
||
{
|
||
dcBuff.configDisplay.op_420MA_OUT_PCT = form.Select3.idx;
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_285_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_285_items, dcBuff.configDisplay.op_420MA_OUT_PCT);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
SelectBox_ReadOnly(&form.Select3);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_285_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
#endif
|
||
|
||
// ********************************************
|
||
// Modbus通信地址设置界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_290_OnButton4()
|
||
{
|
||
int16_t addr = atoi(form.Edit2.text);
|
||
|
||
if(addr < 1 || addr > 247)
|
||
{
|
||
form.cursorId = 2;
|
||
Form_SetFocus();
|
||
return;
|
||
}
|
||
dcBuff.configBottle.addr = addr;
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_200();
|
||
}
|
||
|
||
void Form_290_Create()
|
||
{
|
||
char addr[10];
|
||
|
||
sprintf(addr, "%03d", dcBuff.configBottle.addr);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 3, 3, addr);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 1)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_290_OnButton4;
|
||
form.OnButton5 = Form_Return2_200;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 周期设置界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_300_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[1] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 采集周期
|
||
Change_Form(FORM_ID_310);
|
||
break;
|
||
case 1: // 发送周期
|
||
Change_Form(FORM_ID_320);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_300_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_300_items, formParam.menuIdx[1]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_300_OnButton4;
|
||
form.OnButton5 = Form_Return2_000;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
void Form_Return2_300()
|
||
{
|
||
formParam.menuIdx[2] = 0;
|
||
Change_Form(FORM_ID_300);
|
||
}
|
||
|
||
// ********************************************
|
||
// 采集周期设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_310_OnButton4()
|
||
{
|
||
// 保存周期
|
||
dcBuff.configData.intervalSample = atoi(form.Edit2.text);
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_300();
|
||
}
|
||
|
||
void Form_310_Create()
|
||
{
|
||
char intervalSample[8];
|
||
sprintf(intervalSample, "%04d", dcBuff.configData.intervalSample);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, intervalSample);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_310_OnButton4;
|
||
form.OnButton5 = Form_Return2_300;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 上报周期设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_320_OnButton4()
|
||
{
|
||
// 保存周期
|
||
dcBuff.configData.intervalTrans = atoi(form.Edit2.text);
|
||
dcBuff.configBottle.updateFlag = 1; // 参数更新标志
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_300();
|
||
}
|
||
|
||
void Form_320_Create()
|
||
{
|
||
char intervalTrans[8];
|
||
sprintf(intervalTrans, "%06d", dcBuff.configData.intervalTrans);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 0, 4, 6, intervalTrans);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_320_OnButton4;
|
||
form.OnButton5 = Form_Return2_300;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 标定界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_400_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[1] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0:
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR) // 差压标定
|
||
Change_Form(FORM_ID_410);
|
||
else // 压力1标定
|
||
{
|
||
formParam.caliIdx = 0;
|
||
Change_Form(FORM_ID_420);
|
||
}
|
||
break;
|
||
case 1:
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR) // 压力1标定
|
||
{
|
||
formParam.caliIdx = 0;
|
||
Change_Form(FORM_ID_420);
|
||
}
|
||
else // 压力2标定
|
||
{
|
||
formParam.caliIdx = 1;
|
||
Change_Form(FORM_ID_420);
|
||
}
|
||
break;
|
||
case 2:
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR) // 压力2标定
|
||
{
|
||
formParam.caliIdx = 1;
|
||
Change_Form(FORM_ID_420);
|
||
}
|
||
else // 温度1标定
|
||
{
|
||
formParam.caliIdx = 0;
|
||
Change_Form(FORM_ID_430);
|
||
}
|
||
break;
|
||
case 3:
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR) // 温度1标定
|
||
{
|
||
formParam.caliIdx = 0;
|
||
Change_Form(FORM_ID_430);
|
||
}
|
||
else // 温度2标定
|
||
{
|
||
formParam.caliIdx = 1;
|
||
Change_Form(FORM_ID_430);
|
||
}
|
||
break;
|
||
case 4:
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR) // 温度2标定
|
||
{
|
||
formParam.caliIdx = 1;
|
||
Change_Form(FORM_ID_430);
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_400_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
// 3线制温度传感器无须标定(从v84开始,不区分2线/3线制)
|
||
// SelectBox_Create(&form.Select3, 0, 4, dcBuff.configDisplay.op_PT100_3LINE ? 3 : 5, menu_400_items[dcBuff.configDisplay.op_USE_CAPACITY_SENSOR], formParam.menuIdx[1]);
|
||
SelectBox_Create(&form.Select3, 0, 4, dcBuff.configDisplay.op_USE_CAPACITY_SENSOR ? 4 : 5, menu_400_items[dcBuff.configDisplay.op_USE_CAPACITY_SENSOR], formParam.menuIdx[1]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_400_OnButton4;
|
||
form.OnButton5 = Form_Return2_000;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_400()
|
||
{
|
||
formParam.menuIdx[2] = 0;
|
||
Change_Form(FORM_ID_400);
|
||
}
|
||
|
||
// ********************************************
|
||
// 电容标定界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_410_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[2] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // C1电容标定
|
||
Change_Form(FORM_ID_411);
|
||
break;
|
||
case 1: // C2电容标定
|
||
Change_Form(FORM_ID_412);
|
||
break;
|
||
case 2: // 偏移(零点)标定
|
||
Change_Form(FORM_ID_413);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_410_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, dcBuff.configDisplay.op_USE_CAPACITY_SENSOR ? 2 : 3,
|
||
menu_410_items[dcBuff.configDisplay.op_USE_CAPACITY_SENSOR], formParam.menuIdx[2]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_410_OnButton4;
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
form.OnButton5 = Form_Return2_400;
|
||
else
|
||
form.OnButton5 = Form_Return2_000;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_410()
|
||
{
|
||
Change_Form(FORM_ID_410);
|
||
}
|
||
|
||
// ********************************************
|
||
// C1电容标定界面
|
||
// ********************************************
|
||
|
||
void Form_411_OnButton1()
|
||
{
|
||
// 自动采集电容AD值
|
||
if(Comm_Sample())
|
||
{
|
||
sprintf(form.Edit2.text, "%04d", dcBuff.sampleData.adDPress);
|
||
form.cursorId = 4; // 光标到确认按钮
|
||
}
|
||
else
|
||
form.cursorId = 5; // 光标到返回按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_411_OnButton4()
|
||
{
|
||
// 保存C1
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
dcBuff.configSensor.sensorDPress.zeroValue = atoi(form.Edit2.text);
|
||
else
|
||
dcBuff.configSensor.sensorCap.c1ADC = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_410();
|
||
}
|
||
|
||
void Form_411_Create()
|
||
{
|
||
char c1[10];
|
||
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
sprintf(c1, "%04d", dcBuff.configSensor.sensorDPress.zeroValue);
|
||
else
|
||
sprintf(c1, "%04d", dcBuff.configSensor.sensorCap.c1ADC);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, c1);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_411_OnButton1;
|
||
form.OnButton4 = Form_411_OnButton4;
|
||
form.OnButton5 = Form_Return2_410;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// C2电容标定界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_412_OnButton4()
|
||
{
|
||
// 保存C2
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
dcBuff.configSensor.sensorDPress.fullValue = atoi(form.Edit2.text);
|
||
else
|
||
dcBuff.configSensor.sensorCap.c2ADC = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_410();
|
||
}
|
||
|
||
void Form_412_Create()
|
||
{
|
||
char c2[10];
|
||
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
sprintf(c2, "%04d", dcBuff.configSensor.sensorDPress.fullValue);
|
||
else
|
||
sprintf(c2, "%04d", dcBuff.configSensor.sensorCap.c2ADC);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, c2);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_411_OnButton1;
|
||
form.OnButton4 = Form_412_OnButton4;
|
||
form.OnButton5 = Form_Return2_410;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 偏移(零点)标定界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_413_OnButton4()
|
||
{
|
||
int32_t range = dcBuff.configSensor.sensorDPress.fullValue - dcBuff.configSensor.sensorDPress.zeroValue;
|
||
dcBuff.configSensor.sensorDPress.zeroValue = atoi(form.Edit2.text);
|
||
dcBuff.configSensor.sensorDPress.fullValue = dcBuff.configSensor.sensorDPress.zeroValue + range;
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_410();
|
||
}
|
||
|
||
void Form_413_Create()
|
||
{
|
||
char c1[10];
|
||
|
||
sprintf(c1, "%04d", dcBuff.configSensor.sensorDPress.zeroValue);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, c1);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_411_OnButton1;
|
||
form.OnButton4 = Form_413_OnButton4;
|
||
form.OnButton5 = Form_Return2_410;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 压力标定界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_420_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[2] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 低压力标定
|
||
Change_Form(FORM_ID_421);
|
||
break;
|
||
case 1: // 高压力标定
|
||
Change_Form(FORM_ID_422);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_420_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_420_items, formParam.menuIdx[2]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_420_OnButton4;
|
||
form.OnButton5 = Form_Return2_400;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_420()
|
||
{
|
||
Change_Form(FORM_ID_420);
|
||
}
|
||
|
||
// ********************************************
|
||
// 低压力标定界面
|
||
// ********************************************
|
||
|
||
void Form_421_OnButton1()
|
||
{
|
||
// 自动采集压力AD值
|
||
if(Comm_Sample())
|
||
{
|
||
if(formParam.caliIdx == 0)
|
||
sprintf(form.Edit2.text, "%04d", dcBuff.sampleData.adPress);
|
||
else
|
||
sprintf(form.Edit2.text, "%04d", dcBuff.sampleData.adExtPress[0]);
|
||
form.cursorId = 4; // 光标到确认按钮
|
||
}
|
||
else
|
||
form.cursorId = 5; // 光标到返回按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_421_OnButton4()
|
||
{
|
||
// 保存低压力
|
||
if(formParam.caliIdx == 0)
|
||
dcBuff.configSensor.sensorPress.zeroValue = atoi(form.Edit2.text);
|
||
else
|
||
dcBuff.configSensor.sensorEPress[0].zeroValue = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_420();
|
||
}
|
||
|
||
void Form_421_Create()
|
||
{
|
||
char press[10];
|
||
|
||
if(formParam.caliIdx == 0)
|
||
sprintf(press, "%04d", dcBuff.configSensor.sensorPress.zeroValue);
|
||
else
|
||
sprintf(press, "%04d", dcBuff.configSensor.sensorEPress[0].zeroValue);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, press);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_421_OnButton1;
|
||
form.OnButton4 = Form_421_OnButton4;
|
||
form.OnButton5 = Form_Return2_420;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 高压力标定界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_422_OnButton4()
|
||
{
|
||
// 保存高压力
|
||
if(formParam.caliIdx == 0)
|
||
dcBuff.configSensor.sensorPress.fullValue = atoi(form.Edit2.text);
|
||
else
|
||
dcBuff.configSensor.sensorEPress[0].fullValue = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_420();
|
||
}
|
||
|
||
void Form_422_Create()
|
||
{
|
||
char press[10];
|
||
|
||
if(formParam.caliIdx == 0)
|
||
sprintf(press, "%04d", dcBuff.configSensor.sensorPress.fullValue);
|
||
else
|
||
sprintf(press, "%04d", dcBuff.configSensor.sensorEPress[0].fullValue);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, press);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_421_OnButton1;
|
||
form.OnButton4 = Form_422_OnButton4;
|
||
form.OnButton5 = Form_Return2_420;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 温度标定界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_430_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[2] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 低温标定
|
||
Change_Form(FORM_ID_431);
|
||
break;
|
||
case 1: // 高温标定
|
||
Change_Form(FORM_ID_432);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_430_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
if(formParam.caliIdx == 0)
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_430_items[dcBuff.configDisplay.op_USE_PT100_SENSOR], formParam.menuIdx[2]);
|
||
else
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_430_items[1], formParam.menuIdx[2]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_430_OnButton4;
|
||
form.OnButton5 = Form_Return2_400;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_430()
|
||
{
|
||
Change_Form(FORM_ID_430);
|
||
}
|
||
|
||
// ********************************************
|
||
// 低温标定界面
|
||
// ********************************************
|
||
|
||
void Form_431_OnButton1()
|
||
{
|
||
// 自动采集温度AD值
|
||
if(Comm_Sample())
|
||
{
|
||
sprintf(form.Edit2.text, "%04d", dcBuff.sampleData.adExtTempr[formParam.caliIdx]);
|
||
form.cursorId = 4; // 光标到确认按钮
|
||
}
|
||
else
|
||
form.cursorId = 5; // 光标到返回按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_431_OnButton4()
|
||
{
|
||
if(formParam.caliIdx == 0 && !dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
// 保存低温度
|
||
dcBuff.configSensor.sensorMTempr[formParam.caliIdx].zeroValue = atoi(form.Edit2.text);
|
||
else
|
||
// 保存校准温度
|
||
dcBuff.configSensor.sensorPTempr[formParam.caliIdx].calibrateT = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_430();
|
||
}
|
||
|
||
void Form_431_Create()
|
||
{
|
||
char tempr[10];
|
||
|
||
if(formParam.caliIdx == 0 && !dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
sprintf(tempr, "%04d", dcBuff.configSensor.sensorMTempr[formParam.caliIdx].zeroValue);
|
||
else
|
||
sprintf(tempr, "%04d", dcBuff.configSensor.sensorPTempr[formParam.caliIdx].calibrateT);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, tempr);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
if(formParam.caliIdx == 0 && !dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
else
|
||
Button_Hide(&form.Button1);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
if(formParam.caliIdx == 0 && !dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
form.OnButton1 = Form_431_OnButton1;
|
||
else
|
||
form.OnDrawOthers = Form_DispPoint1;
|
||
form.OnButton4 = Form_431_OnButton4;
|
||
form.OnButton5 = Form_Return2_430;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 高温标定界面
|
||
// ********************************************
|
||
|
||
void Form_432_OnButton1()
|
||
{
|
||
// 自动采集温度AD值
|
||
if(Comm_Sample())
|
||
{
|
||
if(formParam.caliIdx == 0 && !dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
sprintf(form.Edit2.text, "%04d", dcBuff.sampleData.adExtTempr[formParam.caliIdx]);
|
||
else
|
||
{
|
||
if(dcBuff.configDisplay.op_DIFF_RESIST)
|
||
sprintf(form.Edit2.text, "%04d", (int16_t) dcBuff.sampleData.adExtTempr[formParam.caliIdx]); // 显示:Ω
|
||
else
|
||
sprintf(form.Edit2.text, "%04d", (int16_t) PT100_CalResit(dcBuff.sampleData.adExtTempr[formParam.caliIdx], 0)); // 显示:Ω
|
||
}
|
||
form.cursorId = 4; // 光标到确认按钮
|
||
}
|
||
else
|
||
form.cursorId = 5; // 光标到返回按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_432_OnButton4()
|
||
{
|
||
if(formParam.caliIdx == 0 && !dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
// 保存高温度
|
||
dcBuff.configSensor.sensorMTempr[formParam.caliIdx].fullValue = atoi(form.Edit2.text);
|
||
else
|
||
// 保存校准电阻
|
||
dcBuff.configSensor.sensorPTempr[formParam.caliIdx].calibrateR = atoi(form.Edit2.text) * 10; // 保存:0.1Ω
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_430();
|
||
}
|
||
|
||
void Form_432_Create()
|
||
{
|
||
char tempr[10];
|
||
|
||
if(formParam.caliIdx == 0 && !dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
sprintf(tempr, "%04d", dcBuff.configSensor.sensorMTempr[formParam.caliIdx].fullValue);
|
||
else
|
||
sprintf(tempr, "%04d", dcBuff.configSensor.sensorPTempr[formParam.caliIdx].calibrateR / 10); // 显示:Ω
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, tempr);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
if(formParam.caliIdx == 0 && dcBuff.configDisplay.op_USE_PT100_SENSOR)
|
||
{
|
||
//form.OnDrawOthers = Form_DispPoint1; // 不显示小数点
|
||
}
|
||
form.OnButton1 = Form_432_OnButton1;
|
||
form.OnButton4 = Form_432_OnButton4;
|
||
form.OnButton5 = Form_Return2_430;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 量程设置界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_500_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[1] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 电容量程
|
||
Change_Form(FORM_ID_510);
|
||
break;
|
||
case 1: // 压力量程
|
||
case 2:
|
||
formParam.caliIdx = form.Select3.idx - 1;
|
||
Change_Form(FORM_ID_520);
|
||
break;
|
||
case 3: // 温度量程
|
||
formParam.caliIdx = form.Select3.idx - 3;
|
||
Change_Form(FORM_ID_530);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_500_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
// PT100温度传感器不设置量程
|
||
SelectBox_Create(&form.Select3, 0, 4, dcBuff.configDisplay.op_USE_PT100_SENSOR ? 3 : 4, menu_500_items[dcBuff.configDisplay.op_USE_CAPACITY_SENSOR], formParam.menuIdx[1]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_500_OnButton4;
|
||
form.OnButton5 = Form_Return2_000;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_500()
|
||
{
|
||
formParam.menuIdx[2] = 0;
|
||
Change_Form(FORM_ID_500);
|
||
}
|
||
|
||
// ********************************************
|
||
// 电容设置界面
|
||
// ********************************************
|
||
|
||
// 确认按钮
|
||
void Form_510_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[2] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 底电容设置
|
||
Change_Form(FORM_ID_511);
|
||
break;
|
||
case 1: // 增长电容设置
|
||
Change_Form(FORM_ID_512);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_510_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_510_items[dcBuff.configDisplay.op_USE_CAPACITY_SENSOR], formParam.menuIdx[2]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_510_OnButton4;
|
||
if(!dcBuff.configDisplay.op_LEVEL_SENSOR_ONLY)
|
||
form.OnButton5 = Form_Return2_500;
|
||
else
|
||
form.OnButton5 = Form_Return2_000;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_510()
|
||
{
|
||
Change_Form(FORM_ID_510);
|
||
}
|
||
|
||
// ********************************************
|
||
// 底电容设置界面
|
||
// ********************************************
|
||
|
||
void Form_511_OnButton1()
|
||
{
|
||
// 自动采集电容值
|
||
if(Comm_Sample())
|
||
{
|
||
sprintf(form.Edit2.text, "%04d", (int16_t) (dcBuff.sampleData.diff * 10));
|
||
form.cursorId = 4; // 光标到确认按钮
|
||
}
|
||
else
|
||
form.cursorId = 5; // 光标到返回按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_511_OnButton4()
|
||
{
|
||
// 保存底电容
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
dcBuff.configSensor.sensorDPress.lowRange = atoi(form.Edit2.text);
|
||
else
|
||
dcBuff.configSensor.sensorCap.baseC = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_510();
|
||
}
|
||
|
||
void Form_511_Create()
|
||
{
|
||
char baseC[10];
|
||
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
sprintf(baseC, "%04d", dcBuff.configSensor.sensorDPress.lowRange);
|
||
else
|
||
sprintf(baseC, "%04d", dcBuff.configSensor.sensorCap.baseC);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, baseC);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
Button_Hide(&form.Button1);
|
||
else
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_511_OnButton1;
|
||
form.OnButton4 = Form_511_OnButton4;
|
||
form.OnButton5 = Form_Return2_510;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
if(dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
form.OnDrawOthers = Form_DispPoint1;
|
||
}
|
||
|
||
// ********************************************
|
||
// 增长电容设置界面
|
||
// ********************************************
|
||
|
||
void Form_512_OnButton1()
|
||
{
|
||
const float e = e_Src[dcBuff.configBottle.source];
|
||
uint32_t d = dcBuff.configBottle.diameter;
|
||
uint16_t refC;
|
||
|
||
if(dcBuff.configBottle.type == BOTTLE_TYPE_STAND)
|
||
d = dcBuff.configBottle.len + dcBuff.configBottle.lenExtra * 2 + dcBuff.configBottle.diameter / 2;
|
||
|
||
// 自动计算增长电容
|
||
refC = (uint16_t) (Adc_Sensor_Tables[0].k * (d - Adc_Sensor_Tables[0].nl_len) * (e - 1) * 10);
|
||
sprintf(form.Edit2.text, "%04d", refC);
|
||
|
||
form.cursorId = 4; // 光标到确认按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_512_OnButton4()
|
||
{
|
||
// 保存底电容
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
dcBuff.configSensor.sensorDPress.highRangeX10 = atoi(form.Edit2.text);
|
||
else
|
||
dcBuff.configSensor.sensorCap.refC = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_510();
|
||
}
|
||
|
||
void Form_512_Create()
|
||
{
|
||
char refC[10];
|
||
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
sprintf(refC, "%04d", dcBuff.configSensor.sensorDPress.highRangeX10);
|
||
else
|
||
sprintf(refC, "%04d", dcBuff.configSensor.sensorCap.refC);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
EditBox_Create(&form.Edit2, 0, 4, 4, refC);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
{
|
||
if(!dcBuff.configDisplay.op_USE_CAPACITY_SENSOR)
|
||
Button_Hide(&form.Button1);
|
||
else
|
||
Button_Create(&form.Button1, 4, 3, "AUT");
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
}
|
||
else
|
||
{
|
||
Button_Hide(&form.Button1);
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton1 = Form_512_OnButton1;
|
||
form.OnButton4 = Form_512_OnButton4;
|
||
form.OnButton5 = Form_Return2_510;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
if(dcBuff.configDisplay.op_USE_CAPACITY_SENSOR || dcBuff.configSensor.sensorDPress.ishighRangeX10)
|
||
form.OnDrawOthers = Form_DispPoint1;
|
||
}
|
||
|
||
// ********************************************
|
||
// 压力量程设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_520_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[2] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 压力低量程设置
|
||
Change_Form(FORM_ID_521);
|
||
break;
|
||
case 1: // 压力高量程设置
|
||
Change_Form(FORM_ID_522);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_520_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_520_items, formParam.menuIdx[2]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_520_OnButton4;
|
||
form.OnButton5 = Form_Return2_500;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_520()
|
||
{
|
||
Change_Form(FORM_ID_520);
|
||
}
|
||
|
||
// ********************************************
|
||
// 压力低量程设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_521_OnButton4()
|
||
{
|
||
// 保存压力低量程
|
||
if(formParam.caliIdx == 0)
|
||
dcBuff.configSensor.sensorPress.lowRange = atoi(form.Edit2.text) * 10;
|
||
else
|
||
dcBuff.configSensor.sensorEPress[0].lowRange = atoi(form.Edit2.text) * 10;
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_520();
|
||
}
|
||
|
||
void Form_521_Create()
|
||
{
|
||
char range[10];
|
||
|
||
if(formParam.caliIdx == 0)
|
||
sprintf(range, "%03d", dcBuff.configSensor.sensorPress.lowRange / 10);
|
||
else
|
||
sprintf(range, "%03d", dcBuff.configSensor.sensorEPress[0].lowRange / 10);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 3, 3, range);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_DispPoint2;
|
||
form.OnButton4 = Form_521_OnButton4;
|
||
form.OnButton5 = Form_Return2_520;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 压力高量程设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_522_OnButton4()
|
||
{
|
||
// 保存压力高量程
|
||
if(formParam.caliIdx == 0)
|
||
dcBuff.configSensor.sensorPress.highRange = atoi(form.Edit2.text) * 10;
|
||
else
|
||
dcBuff.configSensor.sensorEPress[0].highRange = atoi(form.Edit2.text) * 10;
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_520();
|
||
}
|
||
|
||
void Form_522_Create()
|
||
{
|
||
char range[10];
|
||
|
||
if(formParam.caliIdx == 0)
|
||
sprintf(range, "%03d", dcBuff.configSensor.sensorPress.highRange / 10);
|
||
else
|
||
sprintf(range, "%03d", dcBuff.configSensor.sensorEPress[0].highRange / 10);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 3, 3, range);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_DispPoint2;
|
||
form.OnButton4 = Form_522_OnButton4;
|
||
form.OnButton5 = Form_Return2_520;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 温度量程设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_530_OnButton4()
|
||
{
|
||
// 保存选项序号
|
||
formParam.menuIdx[2] = form.Select3.idx;
|
||
|
||
switch(form.Select3.idx)
|
||
{
|
||
case 0: // 温度低量程设置
|
||
Change_Form(FORM_ID_531);
|
||
break;
|
||
case 1: // 温度高量程设置
|
||
Change_Form(FORM_ID_532);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Form_530_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Create(&form.Select3, 0, 4, 2, menu_530_items, formParam.menuIdx[2]);
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_530_OnButton4;
|
||
form.OnButton5 = Form_Return2_500;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// 返回按钮
|
||
void Form_Return2_530()
|
||
{
|
||
Change_Form(FORM_ID_530);
|
||
}
|
||
|
||
// ********************************************
|
||
// 温度低量程设置界面
|
||
// ********************************************
|
||
void Form_531_OnDrawOthers()
|
||
{
|
||
Disp_DispChar(0, '-');
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_531_OnButton4()
|
||
{
|
||
// 保存温度低量程
|
||
dcBuff.configSensor.sensorMTempr[formParam.caliIdx].lowRange = -atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_530();
|
||
}
|
||
|
||
void Form_531_Create()
|
||
{
|
||
char range[10];
|
||
|
||
sprintf(range, "%03d", -dcBuff.configSensor.sensorMTempr[formParam.caliIdx].lowRange);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 3, 3, range);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_531_OnDrawOthers;
|
||
form.OnButton4 = Form_531_OnButton4;
|
||
form.OnButton5 = Form_Return2_530;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 温度高量程设置界面
|
||
// ********************************************
|
||
// 确认按钮
|
||
void Form_532_OnButton4()
|
||
{
|
||
// 保存温度高量程
|
||
dcBuff.configSensor.sensorMTempr[formParam.caliIdx].highRange = atoi(form.Edit2.text);
|
||
|
||
// 保存
|
||
Config_SaveConfig();
|
||
|
||
// 返回上级菜单
|
||
Form_Return2_530();
|
||
}
|
||
|
||
void Form_532_Create()
|
||
{
|
||
char range[10];
|
||
|
||
sprintf(range, "%03d", dcBuff.configSensor.sensorMTempr[formParam.caliIdx].highRange);
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Create(&form.Edit2, 1, 3, 3, range);
|
||
SelectBox_Hide(&form.Select3);
|
||
if(formParam.privilege == 2)
|
||
Button_Create(&form.Button4, 8, 3, "YES");
|
||
else
|
||
{
|
||
Button_Hide(&form.Button4);
|
||
EditBox_ReadOnly(&form.Edit2);
|
||
}
|
||
Button_Create(&form.Button5, 11, 3, "ESC");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnButton4 = Form_532_OnButton4;
|
||
form.OnButton5 = Form_Return2_530;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 系统信息界面
|
||
// ********************************************
|
||
void Form_600_OnDrawOthers()
|
||
{
|
||
char version[8];
|
||
if(formParam.infoPage == 0)
|
||
{
|
||
sprintf(version, "%02d%02d", dcBuff.displayInfo.softDate.month, dcBuff.displayInfo.softDate.day);
|
||
Disp_Fld1Text(version);
|
||
sprintf(version, "%3d", dcBuff.displayInfo.softVer.minor);
|
||
Disp_Fld2Text(version);
|
||
}
|
||
else
|
||
{
|
||
sprintf(version, "%4d", dcBuff.displayInfo.hardVer.major);
|
||
Disp_Fld1Text(version);
|
||
sprintf(version, "%3d", dcBuff.displayInfo.hardVer.minor);
|
||
Disp_Fld2Text(version);
|
||
}
|
||
}
|
||
|
||
// 确认按钮
|
||
void Form_600_OnButton5()
|
||
{
|
||
// 复位
|
||
VCC_GSM_OFF();
|
||
delay_ms(200);
|
||
NVIC_SystemReset();
|
||
}
|
||
|
||
void Form_600_OnKey(u8 key)
|
||
{
|
||
if(key == KEY_DOWN)
|
||
{
|
||
if(formParam.infoPage >= 1)
|
||
formParam.infoPage = 0;
|
||
else
|
||
formParam.infoPage++;
|
||
}
|
||
}
|
||
|
||
void Form_600_Create()
|
||
{
|
||
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 默认显示软件版本
|
||
formParam.infoPage = 0;
|
||
|
||
// 控件
|
||
Button_Create(&form.Button1, 11, 3, "ESC");
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Hide(&form.Select3);
|
||
Button_Hide(&form.Button4);
|
||
Button_Create(&form.Button5, 8, 3, "RST");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_600_OnDrawOthers;
|
||
form.OnButton1 = Form_Return2_000;
|
||
form.OnButton5 = Form_600_OnButton5;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
form.OnKey = Form_600_OnKey;
|
||
}
|
||
|
||
// ********************************************
|
||
// 查看真空度界面
|
||
// ********************************************
|
||
void Form_700_OnDrawOthers()
|
||
{
|
||
s8 text[10];
|
||
|
||
Disp_Fld1MultiOff();
|
||
// 如无真空计则不显示
|
||
if(dcBuff.sampleData.vacuum[0].staVacuum == VACUUM_STATUS_COMM_FAULT)
|
||
Disp_Fld1Text("---");
|
||
else if(dcBuff.sampleData.vacuum[0].staVacuum == VACUUM_STATUS_FAULT || dcBuff.sampleData.vacuum[0].vacuum > 99.99999999)
|
||
Disp_Fld1Text("+EE");
|
||
else if(dcBuff.sampleData.vacuum[0].vacuum > 0.00999999)
|
||
{
|
||
sprintf(text, "%04d", (uint16_t) (dcBuff.sampleData.vacuum[0].vacuum * 100));
|
||
// 至少要显示3位数字
|
||
if(text[0] == '0')
|
||
Disp_Fld1Text(text + 1);
|
||
else
|
||
Disp_Fld1Text(text);
|
||
Disp_Fld1PointOn(2);
|
||
}
|
||
else
|
||
Disp_Fld1Text("-EE");
|
||
|
||
// 提示真空度
|
||
Disp_Fld2Text("vac");
|
||
Disp_Fld2UnitOn(UNIT_PV_PA);
|
||
}
|
||
|
||
void Form_700_OnButton5()
|
||
{
|
||
while(Sample_Busy())
|
||
osDelay(1);
|
||
|
||
Config_Vacuum_Request = 1; // 强制测量真空度
|
||
Config_Sample_Request = 1;
|
||
// 采集数据
|
||
Sample_Notify();
|
||
while(Config_Sample_Request)
|
||
osDelay(1);
|
||
|
||
form.cursorId = 4; // 光标到返回按钮
|
||
Form_SetFocus();
|
||
}
|
||
|
||
void Form_700_Create()
|
||
{
|
||
memset(&form, 0, sizeof(form));
|
||
|
||
// 控件
|
||
Button_Hide(&form.Button1);
|
||
EditBox_Hide(&form.Edit2);
|
||
SelectBox_Hide(&form.Select3);
|
||
Button_Create(&form.Button4, 11, 3, "ESC");
|
||
Button_Create(&form.Button5, 8, 3, "AUT");
|
||
|
||
Form_timeout = OPERATE_TIMEOUT;
|
||
|
||
// 事件回调
|
||
form.OnDrawOthers = Form_700_OnDrawOthers;
|
||
form.OnButton4 = Form_Return2Meter;
|
||
form.OnButton5 = Form_700_OnButton5;
|
||
form.OnTimeOut = Form_Return2Meter;
|
||
}
|
||
|
||
// ********************************************
|
||
// 切换各个功能界面
|
||
// ********************************************
|
||
void Change_Form(TForm_Id formId)
|
||
{
|
||
// 清屏
|
||
Disp_Clear();
|
||
|
||
switch(formId)
|
||
{
|
||
case FORM_ID_START: // 启动界面
|
||
Form_Start_Create();
|
||
break;
|
||
case FORM_ID_METER: // 表盘显示
|
||
Form_Meter_Create();
|
||
break;
|
||
case FORM_ID_PWD: // 输入密码
|
||
Form_Pwd_Create();
|
||
break;
|
||
case FORM_ID_000: // 设置菜单
|
||
Form_000_Create();
|
||
break;
|
||
case FORM_ID_100: // PSN设置
|
||
Form_100_Create();
|
||
break;
|
||
case FORM_ID_200: // 储罐信息设置
|
||
Form_200_Create();
|
||
break;
|
||
case FORM_ID_210: // 储罐类型设置
|
||
Form_210_Create();
|
||
break;
|
||
case FORM_ID_220: // 介质设置
|
||
Form_220_Create();
|
||
break;
|
||
case FORM_ID_230: // 长度设置
|
||
Form_230_Create();
|
||
break;
|
||
case FORM_ID_240: // 直径设置
|
||
Form_240_Create();
|
||
break;
|
||
case FORM_ID_250: // 充装比设置
|
||
Form_250_Create();
|
||
break;
|
||
case FORM_ID_251: // 低液位百分比设置
|
||
Form_251_Create();
|
||
break;
|
||
case FORM_ID_260: // 密度设置
|
||
Form_260_Create();
|
||
break;
|
||
case FORM_ID_270: // 压力报警低点设置
|
||
Form_270_Create();
|
||
break;
|
||
case FORM_ID_271: // 压力报警高点设置
|
||
Form_271_Create();
|
||
break;
|
||
case FORM_ID_280: // 容积显示
|
||
Form_280_Create();
|
||
break;
|
||
case FORM_ID_285: // 4~20mA输出液位高度
|
||
Form_285_Create();
|
||
break;
|
||
case FORM_ID_290: // Modbus通信地址
|
||
Form_290_Create();
|
||
break;
|
||
case FORM_ID_300: // 上报周期设置
|
||
Form_300_Create();
|
||
break;
|
||
case FORM_ID_310: // 采集周期设置
|
||
Form_310_Create();
|
||
break;
|
||
case FORM_ID_320: // 发送周期设置
|
||
Form_320_Create();
|
||
break;
|
||
case FORM_ID_400: // 标定界面
|
||
Form_400_Create();
|
||
break;
|
||
case FORM_ID_410: // 电容标定
|
||
Form_410_Create();
|
||
break;
|
||
case FORM_ID_411: // C1(100pF)标定
|
||
Form_411_Create();
|
||
break;
|
||
case FORM_ID_412: // C2(400pF)标定
|
||
Form_412_Create();
|
||
break;
|
||
case FORM_ID_413: // 偏移(零点)标定
|
||
Form_413_Create();
|
||
break;
|
||
case FORM_ID_420: // 压力标定
|
||
Form_420_Create();
|
||
break;
|
||
case FORM_ID_421: // 低压力标定
|
||
Form_421_Create();
|
||
break;
|
||
case FORM_ID_422: // 高压力标定
|
||
Form_422_Create();
|
||
break;
|
||
case FORM_ID_430: // 温度标定
|
||
Form_430_Create();
|
||
break;
|
||
case FORM_ID_431: // 低温度标定
|
||
Form_431_Create();
|
||
break;
|
||
case FORM_ID_432: // 高温度标定
|
||
Form_432_Create();
|
||
break;
|
||
case FORM_ID_500: // 量程设置
|
||
Form_500_Create();
|
||
break;
|
||
case FORM_ID_510: // 电容量程
|
||
Form_510_Create();
|
||
break;
|
||
case FORM_ID_511: // 底电容设置
|
||
Form_511_Create();
|
||
break;
|
||
case FORM_ID_512: // 增长电容设置
|
||
Form_512_Create();
|
||
break;
|
||
case FORM_ID_520: // 压力量程
|
||
Form_520_Create();
|
||
break;
|
||
case FORM_ID_521: // 压力低量程设置
|
||
Form_521_Create();
|
||
break;
|
||
case FORM_ID_522: // 压力高量程设置
|
||
Form_522_Create();
|
||
break;
|
||
case FORM_ID_530: // 温度量程
|
||
Form_530_Create();
|
||
break;
|
||
case FORM_ID_531: // 温度低量程设置
|
||
Form_531_Create();
|
||
break;
|
||
case FORM_ID_532: // 温度高量程设置
|
||
Form_532_Create();
|
||
break;
|
||
case FORM_ID_600: // 系统信息
|
||
Form_600_Create();
|
||
break;
|
||
case FORM_ID_700: // 查看真空度
|
||
Form_700_Create();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
if(form.cursorId != 0)
|
||
{
|
||
// 指定控件设置焦点
|
||
Form_SetFocus();
|
||
}
|
||
else
|
||
{
|
||
// 第一个控件设置焦点
|
||
Form_FocusFirst();
|
||
}
|
||
|
||
// 重置超时计数
|
||
Form_ResetTimer();
|
||
}
|
||
|
||
void Form_Start()
|
||
{
|
||
// 初始化
|
||
memset(&formParam, 0, sizeof(formParam));
|
||
|
||
// 检查合法性
|
||
Check_L_Unit(KEY_UP);
|
||
|
||
// 启动界面
|
||
Change_Form(FORM_ID_START);
|
||
}
|
||
|
||
uint32_t Comm_Sample()
|
||
{
|
||
while(Sample_Busy())
|
||
osDelay(1);
|
||
|
||
Config_Sample_Request = 1;
|
||
// 采集数据
|
||
Sample_Notify();
|
||
|
||
while(Config_Sample_Request)
|
||
osDelay(1);
|
||
|
||
return TRUE;
|
||
}
|