1、增加ExclCommUint_t结构体,用于排除指定通讯单元的MAC
2、修复了复位后重复定义各项参数的bug。只有从flash读取到的出厂标志位错误时,才会进入配置默认参数判断,否则会以从flash读取到的数据为配置参数 3、增加CheckCommUnitExcl函数,用于查询mac是否被排除 GateWay_Debug: 1、rs485配置函数增加了boot升级使能功能 2、增加了excu、exdel、exls命令,用于配置排除设备的增、删、查 3、para命令增加显示LpCfg参数 sx127x: 1、lora通道选择取消,通过修改频率来修改通道
This commit is contained in:
@@ -134,12 +134,11 @@ void GateWayInit(void)
|
||||
memset((uint8_t *)&GateWay.ConfigPara, 0x00, sizeof(GWConfigPara_t));
|
||||
GateWay.ConfigPara.SavFlag = LOG_SAV_FLAG;
|
||||
GateWay.ConfigPara.Comm = CATONE_COMM;
|
||||
// memcpy(GateWay.ConfigPara.GwMac, GateWayMac, 6);
|
||||
GateWay.ConfigPara.SvrAddr[0] = 8;
|
||||
GateWay.ConfigPara.SvrAddr[1] = 137;
|
||||
GateWay.ConfigPara.SvrAddr[2] = 104;
|
||||
GateWay.ConfigPara.SvrAddr[3] = 4;
|
||||
GateWay.ConfigPara.SvrPort = 8007;
|
||||
GateWay.ConfigPara.SvrAddr[0] = 103;
|
||||
GateWay.ConfigPara.SvrAddr[1] = 217;
|
||||
GateWay.ConfigPara.SvrAddr[2] = 192;
|
||||
GateWay.ConfigPara.SvrAddr[3] = 248;
|
||||
GateWay.ConfigPara.SvrPort = 12111;
|
||||
GateWay.ConfigPara.CommUnitReadInterval = COMMUNIT_READ_SENSOR_INTERVAL_MAX;//非低功耗设备
|
||||
memset(GateWay.ConfigPara.CommUnitArray, 0x00, sizeof(CommUnitData_t) * COMMUNIT_NUM_MAX);
|
||||
GateWay.ConfigPara.Rs485Ch1.Enable = true;
|
||||
@@ -151,7 +150,9 @@ void GateWayInit(void)
|
||||
GateWay.ConfigPara.Rs485Ch2.BaudRate = 500000;
|
||||
GateWay.ConfigPara.Rs485Ch2.UpgradeEnable = false;
|
||||
GateWay.ConfigPara.Rs485Ch2.CommUnitEnable = false;
|
||||
GateWay.ConfigPara.Rs485Ch2.Power = true;
|
||||
GateWay.ConfigPara.Rs485Ch2.Power = false;
|
||||
GateWay.ConfigPara.Rs485Ch1.RS485Send = RS485Ch1UartSend;
|
||||
GateWay.ConfigPara.Rs485Ch2.RS485Send = RS485Ch2UartSend;
|
||||
|
||||
GateWay.ConfigPara.Lora.OnOff = true;
|
||||
GateWay.ConfigPara.Lora.ucChannel = 8;
|
||||
@@ -161,38 +162,10 @@ void GateWayInit(void)
|
||||
GateWay.ConfigPara.Lora.ErrorCoding = 2;
|
||||
GateWay.ConfigPara.Lora.RegPreamble = 10;
|
||||
GateWay.ConfigPara.Lora.FreqCent = FREQ_CENT;
|
||||
|
||||
GateWay.ConfigPara.OutageFlag = false;
|
||||
GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;
|
||||
}
|
||||
|
||||
if(GateWay.ConfigPara.OutageFlag != true && GateWay.ConfigPara.OutageFlag != false)
|
||||
GateWay.ConfigPara.OutageFlag = false;
|
||||
|
||||
GateWay.SvrRegFlag = false;
|
||||
memset(GateWay.SvrMac, 0x00, 6);
|
||||
GateWay.ConfigPara.Rs485Ch1.RS485Send = RS485Ch1UartSend;
|
||||
GateWay.ConfigPara.Rs485Ch2.RS485Send = RS485Ch2UartSend;
|
||||
|
||||
GateWay.ConfigPara.Rs485Ch1.Enable = true;
|
||||
GateWay.ConfigPara.Rs485Ch1.CommUnitEnable = false;
|
||||
GateWay.ConfigPara.Rs485Ch1.UpgradeEnable = true;
|
||||
GateWay.ConfigPara.Rs485Ch1.BaudRate = 500000;
|
||||
GateWay.ConfigPara.Rs485Ch1.Power = false;
|
||||
GateWay.ConfigPara.Rs485Ch2.Enable = true;
|
||||
GateWay.ConfigPara.Rs485Ch2.BaudRate = 500000;
|
||||
GateWay.ConfigPara.Rs485Ch2.CommUnitEnable = false;
|
||||
GateWay.ConfigPara.Rs485Ch2.UpgradeEnable = false;
|
||||
GateWay.ConfigPara.Rs485Ch2.Power = false;
|
||||
|
||||
GateWay.ConfigPara.Lora.OnOff = true;
|
||||
GateWay.ConfigPara.Lora.ucChannel = 8;
|
||||
GateWay.ConfigPara.Lora.ucPower = 20;
|
||||
GateWay.ConfigPara.Lora.SignalBw = 8;
|
||||
GateWay.ConfigPara.Lora.SpreadFactor = 9;
|
||||
GateWay.ConfigPara.Lora.ErrorCoding = 2;
|
||||
GateWay.ConfigPara.Lora.RegPreamble = 10;
|
||||
GateWay.ConfigPara.Lora.FreqCent = FREQ_CENT;
|
||||
|
||||
|
||||
#if MAC_ADDR_TYPE == 0
|
||||
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_Test, 6);
|
||||
GateWay.ConfigPara.DebugChannel = DEBUG_CH_DBG;
|
||||
@@ -229,7 +202,7 @@ void GateWayInit(void)
|
||||
memcpy(GateWay.ConfigPara.GwMac, GateWayMac_BL10, 6);
|
||||
GateWay.ConfigPara.DebugChannel = DEBUG_CH_RS485_1;
|
||||
#endif
|
||||
|
||||
|
||||
#if MAC_ADDR_TYPE == 0//测试服务器
|
||||
GateWay.ConfigPara.SvrAddr[0] = 39;
|
||||
GateWay.ConfigPara.SvrAddr[1] = 106;
|
||||
@@ -248,7 +221,14 @@ void GateWayInit(void)
|
||||
GateWay.ConfigPara.SvrAddr[3] = 248;
|
||||
GateWay.ConfigPara.SvrPort = 12111;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if(GateWay.ConfigPara.OutageFlag != true && GateWay.ConfigPara.OutageFlag != false)
|
||||
GateWay.ConfigPara.OutageFlag = false;
|
||||
|
||||
GateWay.SvrRegFlag = false;
|
||||
memset(GateWay.SvrMac, 0x00, 6);
|
||||
|
||||
if(GateWay.ConfigPara.DebugChannel == DEBUG_CH_RS485_1) {
|
||||
GateWay.ConfigPara.Rs485Ch1.Enable = true;
|
||||
GateWay.ConfigPara.Rs485Ch1.BaudRate = 500000;
|
||||
@@ -289,6 +269,11 @@ void GateWayInit(void)
|
||||
LoraSetChannel(GateWay.ConfigPara.Lora.ucChannel);
|
||||
//WritePara((uint8_t *)&GateWay.ConfigPara, sizeof(GWConfigPara_t));
|
||||
}
|
||||
if(LoraSetFreqCent(GateWay.ConfigPara.Lora.FreqCent) == false)
|
||||
{
|
||||
GateWay.ConfigPara.Lora.FreqCent = 433100000;
|
||||
LoraSetFreqCent(GateWay.ConfigPara.Lora.ucChannel);
|
||||
}
|
||||
if(LoraSetPower(GateWay.ConfigPara.Lora.ucPower) == false) {
|
||||
GateWay.ConfigPara.Lora.ucPower = 20;
|
||||
LoraSetPower(GateWay.ConfigPara.Lora.ucPower);
|
||||
@@ -311,9 +296,9 @@ void GateWayInit(void)
|
||||
}
|
||||
if(GateWay.ConfigPara.Lora.RegPreamble > 0xFE) {
|
||||
GateWay.ConfigPara.Lora.RegPreamble = 10;
|
||||
LoraSetRegPreamble(GateWay.ConfigPara.Lora.RegPreamble);
|
||||
//WritePara((uint8_t *)&GateWay.ConfigPara, sizeof(GWConfigPara_t));
|
||||
}
|
||||
LoraSetRegPreamble(GateWay.ConfigPara.Lora.RegPreamble);
|
||||
|
||||
WritePara((uint8_t *)&GateWay.ConfigPara, sizeof(GWConfigPara_t));
|
||||
|
||||
@@ -373,7 +358,7 @@ int main(void)
|
||||
uint8_t AlarmType = 0;
|
||||
|
||||
GateWayInit();
|
||||
|
||||
|
||||
rt_kprintf("\r\n\r\n");
|
||||
rt_kprintf("****************************************************\r\n");
|
||||
rt_kprintf("** **\r\n");
|
||||
|
||||
Reference in New Issue
Block a user