2025-04-03 15:59:48 +08:00
|
|
|
|
/*
|
|
|
|
|
|
*********************************************************************************************************
|
|
|
|
|
|
* IAR Development Kits
|
|
|
|
|
|
* on the
|
|
|
|
|
|
*
|
|
|
|
|
|
* Nano130
|
|
|
|
|
|
*
|
|
|
|
|
|
* Filename : def_data.c
|
|
|
|
|
|
* Version : V1.00
|
|
|
|
|
|
* Programmer(s) : Qian Xianghong
|
|
|
|
|
|
*********************************************************************************************************
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
*********************************************************************************************************
|
|
|
|
|
|
* INCLUDE FILES
|
|
|
|
|
|
*********************************************************************************************************
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ʯ<EFBFBD>汾
|
|
|
|
|
|
//#define _LANSHI_VER_
|
|
|
|
|
|
|
|
|
|
|
|
// Ӳ<><D3B2><EFBFBD>汾<EFBFBD><E6B1BE>
|
|
|
|
|
|
const uint8_t HARDWARE_VER_MAJOR = 1;
|
|
|
|
|
|
const uint8_t HARDWARE_VER_MINOR = 137; // <20><><EFBFBD><EFBFBD>RF<52><46><EFBFBD><EFBFBD>
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|
|
|
|
|
const uint8_t SOFTWARE_VER_MAJOR = 1;
|
|
|
|
|
|
const uint8_t SOFTWARE_VER_MINOR = 1; // <20><><EFBFBD><EFBFBD>RF<52><46><EFBFBD><EFBFBD>
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-05-21 14:04:38 +08:00
|
|
|
|
const uint8_t SOFTWARE_DATE_YEAR = 25;
|
|
|
|
|
|
const uint8_t SOFTWARE_DATE_MONTH = 5;
|
|
|
|
|
|
const uint8_t SOFTWARE_DATE_DAY = 16;
|
2025-04-03 15:59:48 +08:00
|
|
|
|
|
|
|
|
|
|
// <20>洢<EFBFBD><E6B4A2>ʽ<EFBFBD>汾<EFBFBD><E6B1BE>=1.1
|
|
|
|
|
|
const uint8_t CONFIG_FORMAT_VER_MAJOR = 1;
|
|
|
|
|
|
const uint8_t CONFIG_FORMAT_VER_MINOR = 1; // <20>½ṹ<C2BD><E1B9B9><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>˫<EFBFBD><CBAB>ͨ<EFBFBD><CDA8>
|
|
|
|
|
|
|
|
|
|
|
|
// Զ<><D4B6>Э<EFBFBD><D0AD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|
|
|
|
|
const uint8_t REPORT_PROTOCOL_VER_MAJOR = 0;
|
|
|
|
|
|
// 0: ѹ<><D1B9><EFBFBD><EFBFBD>λΪbar<61><72>1<EFBFBD><31>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>λΪKPa, 107: ֧<><D6A7><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD>
|
|
|
|
|
|
const uint8_t REPORT_PROTOCOL_VER_MINOR = 107;
|
|
|
|
|
|
|
|
|
|
|
|
// DTU<54><55><EFBFBD><EFBFBD>
|
|
|
|
|
|
const uint32_t DTU_BAUDRATE = 9600ul;
|
|
|
|
|
|
const uint8_t DTU_PARITY = PARITY_NONE;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|
|
|
|
|
const uint8_t BLUETOOTH_PROTOCOL_VER_MAJOR = 1;
|
|
|
|
|
|
const uint8_t BLUETOOTH_PROTOCOL_VER_MINOR = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
const uint32_t BLUETOOTH_BAUDRATE = 9600ul;
|
|
|
|
|
|
const uint8_t BLUETOOTH_PARITY = PARITY_NONE;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD>úͲɼ<CDB2><C9BC><EFBFBD><EFBFBD>ݵĽṹ<C4BD><E1B9B9>
|
|
|
|
|
|
data_buff_t dcBuff = {0};
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>ij<EFBFBD><C4B3><EFBFBD>
|
|
|
|
|
|
const uint8_t Config_DataLen[] =
|
|
|
|
|
|
{
|
|
|
|
|
|
sizeof(config_bottle_t),
|
|
|
|
|
|
sizeof(config_sensor_t),
|
|
|
|
|
|
sizeof(config_data_t),
|
|
|
|
|
|
sizeof(config_display_t),
|
|
|
|
|
|
sizeof(sysinfo_sample_t),
|
|
|
|
|
|
sizeof(sysinfo_power_t),
|
|
|
|
|
|
sizeof(sysinfo_display_t),
|
|
|
|
|
|
sizeof(sysinfo_bluetooth_t),
|
|
|
|
|
|
sizeof(data_dtu_t),
|
|
|
|
|
|
sizeof(data_sample_t),
|
|
|
|
|
|
sizeof(adc_sample_t),
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ
|
|
|
|
|
|
const void* Config_DataPtr[] =
|
|
|
|
|
|
{
|
|
|
|
|
|
&dcBuff.configBottle,
|
|
|
|
|
|
&dcBuff.configSensor,
|
|
|
|
|
|
&dcBuff.configData,
|
|
|
|
|
|
&dcBuff.configDisplay,
|
|
|
|
|
|
&dcBuff.sampleInfo,
|
|
|
|
|
|
&dcBuff.powerInfo,
|
|
|
|
|
|
&dcBuff.displayInfo,
|
|
|
|
|
|
&dcBuff.bluetoothInfo,
|
|
|
|
|
|
&dcBuff.dtuData,
|
|
|
|
|
|
&dcBuff.sampleData,
|
|
|
|
|
|
&dcBuff.adcData,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Һ<><D2BA><EFBFBD>ܶȣ<DCB6>LNG=0.42g/cm3=420kg/m3
|
|
|
|
|
|
// O2=1.143g/cm3=1143kg/m3
|
|
|
|
|
|
// N2=0.81g/cm3=810kg/m3
|
|
|
|
|
|
// AR=1.402g/cm3=1402kg/m3
|
|
|
|
|
|
// CO2=1.024g/cm3=1024kg/m3
|
|
|
|
|
|
const float LSrc_Density[] = {0.42, 1.143, 0.81, 1.402, 1.024}; // <20><>λkg/L
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ʽΪx16+x15+x2+1,LSB˳<42><CBB3>
|
|
|
|
|
|
uint16_t do_crc_16(unsigned short crc_reg, uint8_t *message, int16_t len)
|
|
|
|
|
|
{
|
|
|
|
|
|
int16_t i, j;
|
|
|
|
|
|
uint16_t current;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
current = message[i];
|
|
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((crc_reg ^ current) & 0x0001)
|
|
|
|
|
|
crc_reg = (crc_reg >> 1) ^ 0xA001;
|
|
|
|
|
|
else
|
|
|
|
|
|
crc_reg >>= 1;
|
|
|
|
|
|
current >>= 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return crc_reg;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
|
uint32_t Config_CheckValid(rd_buff_t *rdBuff, uint8_t DC)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(rdBuff->header.mark != CONFIG_MARK_LS)
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
if(rdBuff->header.product != CONFIG_PRODUCT_CY)
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
if(rdBuff->header.DC != DC)
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
if(rdBuff->header.ver.major != CONFIG_FORMAT_VER_MAJOR || rdBuff->header.ver.minor != CONFIG_FORMAT_VER_MINOR)
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
if(do_crc_16(0, rdBuff->buff, CONFIG_DATA_LEN(DC)) != 0)
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// д<><D0B4><EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
|
void Config_ForceValid(rd_buff_t *rdBuff, uint8_t DC)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t pos = CONFIG_DATA_LEN(DC) - 2;
|
|
|
|
|
|
|
|
|
|
|
|
rdBuff->header.mark = CONFIG_MARK_LS;
|
|
|
|
|
|
rdBuff->header.product = CONFIG_PRODUCT_CY;
|
|
|
|
|
|
rdBuff->header.DC = DC;
|
|
|
|
|
|
rdBuff->header.ver.major = CONFIG_FORMAT_VER_MAJOR;
|
|
|
|
|
|
rdBuff->header.ver.minor = CONFIG_FORMAT_VER_MINOR;
|
|
|
|
|
|
*(uint16_t *) (rdBuff->buff + pos) = do_crc_16(0, rdBuff->buff, pos);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><DEB2><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|
|
|
|
|
void Config_setBottleDefParam(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t i;
|
|
|
|
|
|
|
|
|
|
|
|
memset(&dataBuff->configBottle, 0, sizeof(dataBuff->configBottle));
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->configBottle.serverVer = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|
|
|
|
|
dataBuff->configBottle.updateFlag = 1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>־
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->configBottle.addr = 1;
|
|
|
|
|
|
dataBuff->configBottle.type = BOTTLE_TYPE_STAND;
|
|
|
|
|
|
dataBuff->configBottle.source = SOURCE_N2;
|
|
|
|
|
|
dataBuff->configBottle.len = 10000;
|
|
|
|
|
|
dataBuff->configBottle.diameter = 2650;
|
|
|
|
|
|
dataBuff->configBottle.lenExtra = 0;
|
|
|
|
|
|
for(i = 0; i < sizeof(dataBuff->configBottle.density) / sizeof(float); i++)
|
|
|
|
|
|
dataBuff->configBottle.density[i] = LSrc_Density[i];
|
|
|
|
|
|
dataBuff->configBottle.chargePct = 90;
|
|
|
|
|
|
dataBuff->configBottle.measureType = MEASURE_DPRESS;
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ч
|
|
|
|
|
|
dataBuff->configBottle.fullPct = dataBuff->configBottle.chargePct * 100; // <20><>Һλ<D2BA>ٷֱ<D9B7>
|
|
|
|
|
|
dataBuff->configBottle.priPct = 0; // <20>ؼ<EFBFBD>Һλ<D2BA>ٷֱ<D9B7>
|
|
|
|
|
|
dataBuff->configBottle.orderPct = 0; // <20><><EFBFBD><EFBFBD>Һλ<D2BA>ٷֱ<D9B7>
|
|
|
|
|
|
dataBuff->configBottle.emptyPct = 0; // <20><>Һλ<D2BA>ٷֱ<D9B7>
|
|
|
|
|
|
dataBuff->configBottle.planMount = 0; // ÿ<>ռƻ<D5BC><C6BB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
dataBuff->configBottle.predictMount = 0; // ÿ<><C3BF>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
dataBuff->configBottle.warnVolt = 0; // <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>: 10mV
|
|
|
|
|
|
dataBuff->configBottle.warnVoltH = 0; // <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>: 10mV
|
|
|
|
|
|
dataBuff->configBottle.warnPress = 300; // ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>: KPa
|
|
|
|
|
|
dataBuff->configBottle.warnPressH = 0; // ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>
|
|
|
|
|
|
dataBuff->configBottle.options = 0x0003; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
dataBuff->configBottle.ts = 0; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
|
dataBuff->configBottle.dispMode = DISP_MODE_ALL; // <20><>ʾģʽ
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>
|
|
|
|
|
|
dataBuff->configBottle.emptyPct = 0;
|
|
|
|
|
|
dataBuff->configBottle.fullPct = 9800;
|
|
|
|
|
|
dataBuff->configBottle.warnPress = 50;
|
|
|
|
|
|
dataBuff->configBottle.warnPressH = 650;
|
|
|
|
|
|
dataBuff->configBottle.warnTempr = -162;
|
|
|
|
|
|
dataBuff->configBottle.warnTemprH = 50;
|
|
|
|
|
|
dataBuff->configBottle.offlineSeconds = 14400;
|
2025-05-21 14:04:38 +08:00
|
|
|
|
dataBuff->configBottle.lora_freq=0;
|
2025-04-03 15:59:48 +08:00
|
|
|
|
Config_ForceValid((rd_buff_t *) &dataBuff->configBottle, CAN_DC_BOTTLE_CONFIG);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|
|
|
|
|
void Config_setSensorDefParam(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t i;
|
|
|
|
|
|
|
|
|
|
|
|
memset(&dataBuff->configSensor, 0, sizeof(dataBuff->configSensor));
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->configSensor.sensorWeight.lowRange = 0;
|
|
|
|
|
|
dataBuff->configSensor.sensorWeight.highRange = 100000ul; // 100000kg
|
|
|
|
|
|
dataBuff->configSensor.sensorWeight.zeroValue = 84030ul; // <20><><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
dataBuff->configSensor.sensorWeight.fullValue = 1613530ul; // <20><><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->configSensor.sensorDPress.lowRange = 0; // 0KPa
|
|
|
|
|
|
dataBuff->configSensor.sensorDPress.highRange = 50; // 50KPa
|
|
|
|
|
|
dataBuff->configSensor.sensorDPress.zeroValue = 683; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0.5v / 3.0v
|
|
|
|
|
|
dataBuff->configSensor.sensorDPress.fullValue = 3823; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>2.8v / 3.0v
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->configSensor.sensorPress.lowRange = 0; // 0MPa
|
|
|
|
|
|
dataBuff->configSensor.sensorPress.highRange = 4000; // 4MPa
|
|
|
|
|
|
dataBuff->configSensor.sensorPress.zeroValue = 683; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>0.5v / 3.0v
|
|
|
|
|
|
dataBuff->configSensor.sensorPress.fullValue = 3823; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>2.8v / 3.0v
|
|
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < sizeof(dataBuff->configSensor.sensorEPress) / sizeof(press_param_t); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
dataBuff->configSensor.sensorEPress[i].lowRange = 0; // 0MPa
|
|
|
|
|
|
dataBuff->configSensor.sensorEPress[i].highRange = 4000; // 4MPa
|
|
|
|
|
|
dataBuff->configSensor.sensorEPress[i].zeroValue = 710; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>4mA * 130<33><30> / 3.0v
|
|
|
|
|
|
dataBuff->configSensor.sensorEPress[i].fullValue = 3550; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>20mA * 130<33><30> / 3.0v
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < sizeof(dataBuff->configSensor.sensorETempr) / sizeof(tempr_param_t); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
dataBuff->configSensor.sensorETempr[i].lowRange = -200; // -200<30><30>
|
|
|
|
|
|
dataBuff->configSensor.sensorETempr[i].highRange = 80; // 80<38><30>
|
|
|
|
|
|
dataBuff->configSensor.sensorETempr[i].zeroValue = 710; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>4mA * 130<33><30> / 3.0v
|
|
|
|
|
|
dataBuff->configSensor.sensorETempr[i].fullValue = 3550; // <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>20mA * 130<33><30> / 3.0v
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Config_ForceValid((rd_buff_t *) &dataBuff->configSensor, CAN_DC_SENSOR_CONFIG);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|
|
|
|
|
void Config_setDataDefParam(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
memset(&dataBuff->configData, 0, sizeof(dataBuff->configData));
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _LANSHI_VER_
|
|
|
|
|
|
strcpy(dataBuff->configData.server, "data.ajhiot.com"); // 2021.03.31<EFBFBD><EFBFBD>
|
|
|
|
|
|
dataBuff->configData.port = 8088;
|
|
|
|
|
|
#else
|
|
|
|
|
|
strcpy(dataBuff->configData.server, "pazx.cd-ls.cn");
|
|
|
|
|
|
dataBuff->configData.port = 8088;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#ifndef _LANSHI_VER_
|
|
|
|
|
|
strcpy(dataBuff->configData.gpsServer, "track.ajhiot.com");
|
|
|
|
|
|
dataBuff->configData.gpsPort = 8070;
|
|
|
|
|
|
#else
|
|
|
|
|
|
strcpy(dataBuff->configData.gpsServer, "track.cd-ls.cn");
|
|
|
|
|
|
dataBuff->configData.gpsPort = 8070;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
dataBuff->configData.intervalSample = 300;
|
|
|
|
|
|
dataBuff->configData.intervalTrans = 3600;
|
|
|
|
|
|
dataBuff->configData.intervalGPS = 4;
|
|
|
|
|
|
dataBuff->configData.intervalGPSTrans = 60;
|
|
|
|
|
|
dataBuff->configData.timeLag = 8;
|
|
|
|
|
|
|
|
|
|
|
|
strcpy(dataBuff->configData.upgServer, "extra.cd-ls.cn");
|
|
|
|
|
|
dataBuff->configData.upgPort = 7006;
|
|
|
|
|
|
|
|
|
|
|
|
Config_ForceValid((rd_buff_t *) &dataBuff->configData, CAN_DC_DATA_CONFIG);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
|
|
|
|
|
void Config_setDisplayDefParam(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
memset(&dataBuff->configDisplay, 0, sizeof(dataBuff->configDisplay));
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->configDisplay.lightDelay = 0;
|
|
|
|
|
|
dataBuff->configDisplay.dispDelay = 30;
|
|
|
|
|
|
dataBuff->configDisplay.unit = DISP_UNIT_METRIC;
|
|
|
|
|
|
strcpy(dataBuff->configDisplay.pwd1, "2222"); // <20><><EFBFBD><EFBFBD><DEB2><EFBFBD><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
strcpy(dataBuff->configDisplay.pwd2, "3003"); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>궨<EFBFBD><EAB6A8><EFBFBD><EFBFBD>
|
|
|
|
|
|
strcpy(dataBuff->configDisplay.APN, "CMIOT");
|
|
|
|
|
|
|
|
|
|
|
|
Config_ForceValid((rd_buff_t *) &dataBuff->configDisplay, CAN_DC_DISPLAY_CONFIG);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>ϵͳ<CFB5><CDB3>Ϣ
|
|
|
|
|
|
void Config_fillSampleInfo(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
memset(&dataBuff->sampleInfo, 0, sizeof(dataBuff->sampleInfo));
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->sampleInfo.boardFlag = CONFIG_BOARD_SELF;
|
|
|
|
|
|
dataBuff->sampleInfo.hardVer.major = HARDWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->sampleInfo.hardVer.minor = HARDWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->sampleInfo.softVer.major = SOFTWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->sampleInfo.softVer.minor = SOFTWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->sampleInfo.softDate.year = SOFTWARE_DATE_YEAR;
|
|
|
|
|
|
dataBuff->sampleInfo.softDate.month = SOFTWARE_DATE_MONTH;
|
|
|
|
|
|
dataBuff->sampleInfo.softDate.day = SOFTWARE_DATE_DAY;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ϵͳ<CFB5><CDB3>Ϣ
|
|
|
|
|
|
void Config_fillPowerInfo(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
memset(&dataBuff->powerInfo, 0, sizeof(dataBuff->powerInfo));
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->powerInfo.boardFlag = CONFIG_BOARD_SELF;
|
|
|
|
|
|
dataBuff->powerInfo.hardVer.major = HARDWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->powerInfo.hardVer.minor = HARDWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->powerInfo.softVer.major = SOFTWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->powerInfo.softVer.minor = SOFTWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->powerInfo.softDate.year = SOFTWARE_DATE_YEAR;
|
|
|
|
|
|
dataBuff->powerInfo.softDate.month = SOFTWARE_DATE_MONTH;
|
|
|
|
|
|
dataBuff->powerInfo.softDate.day = SOFTWARE_DATE_DAY;
|
|
|
|
|
|
dataBuff->powerInfo.protocolVer.major = REPORT_PROTOCOL_VER_MAJOR;
|
|
|
|
|
|
dataBuff->powerInfo.protocolVer.minor = REPORT_PROTOCOL_VER_MINOR;
|
|
|
|
|
|
dataBuff->powerInfo.baudrate = DTU_BAUDRATE;
|
|
|
|
|
|
dataBuff->powerInfo.parity = DTU_PARITY;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ϵͳ<CFB5><CDB3>Ϣ
|
|
|
|
|
|
void Config_fillDisplayInfo(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
memset(&dataBuff->displayInfo, 0, sizeof(dataBuff->displayInfo));
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->displayInfo.boardFlag = CONFIG_BOARD_SELF;
|
|
|
|
|
|
dataBuff->displayInfo.hardVer.major = HARDWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->displayInfo.hardVer.minor = HARDWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->displayInfo.softVer.major = SOFTWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->displayInfo.softVer.minor = SOFTWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->displayInfo.softDate.year = SOFTWARE_DATE_YEAR;
|
|
|
|
|
|
dataBuff->displayInfo.softDate.month = SOFTWARE_DATE_MONTH;
|
|
|
|
|
|
dataBuff->displayInfo.softDate.day = SOFTWARE_DATE_DAY;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>Ϣ
|
|
|
|
|
|
void Config_fillBluetoothInfo(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
memset(&dataBuff->bluetoothInfo, 0, sizeof(dataBuff->bluetoothInfo));
|
|
|
|
|
|
|
|
|
|
|
|
dataBuff->bluetoothInfo.boardFlag = CONFIG_BOARD_SELF;
|
|
|
|
|
|
dataBuff->bluetoothInfo.hardVer.major = HARDWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->bluetoothInfo.hardVer.minor = HARDWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->bluetoothInfo.softVer.major = SOFTWARE_VER_MAJOR;
|
|
|
|
|
|
dataBuff->bluetoothInfo.softVer.minor = SOFTWARE_VER_MINOR;
|
|
|
|
|
|
dataBuff->bluetoothInfo.softDate.year = SOFTWARE_DATE_YEAR;
|
|
|
|
|
|
dataBuff->bluetoothInfo.softDate.month = SOFTWARE_DATE_MONTH;
|
|
|
|
|
|
dataBuff->bluetoothInfo.softDate.day = SOFTWARE_DATE_DAY;
|
|
|
|
|
|
dataBuff->bluetoothInfo.protocolVer.major = BLUETOOTH_PROTOCOL_VER_MAJOR;
|
|
|
|
|
|
dataBuff->bluetoothInfo.protocolVer.minor = BLUETOOTH_PROTOCOL_VER_MINOR;
|
|
|
|
|
|
dataBuff->bluetoothInfo.baudrate = BLUETOOTH_BAUDRATE;
|
|
|
|
|
|
dataBuff->bluetoothInfo.parity = BLUETOOTH_PARITY;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<DEB8>־
|
|
|
|
|
|
uint32_t Config_CheckUpdate(data_buff_t *dataBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t i;
|
|
|
|
|
|
|
|
|
|
|
|
if(!dataBuff->configBottle.updateFlag)
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < 6; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(dataBuff->configBottle.PSN[i] != 0)
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|