Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 28b612dd28 | |||
| 7b80a04f4f | |||
| 44aa2116aa | |||
| c7315ae6f9 | |||
| 6158a92b6d | |||
| 8f1630d7ab | |||
| ce77d9eaf6 |
+243
-49
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#define DBG_RX_LEN_MAX 128
|
#define DBG_RX_LEN_MAX 128
|
||||||
//#define DBG_LOG(...) rt_kprintf(__VA_ARGS__)
|
//#define DBG_LOG(...) rt_kprintf(__VA_ARGS__)
|
||||||
#define DEBUG_CMD_CNT 22
|
#define DEBUG_CMD_CNT 30
|
||||||
#define DEBUG_BUFF_SIZE_MAX 512
|
#define DEBUG_BUFF_SIZE_MAX 512
|
||||||
|
|
||||||
#define DEBUG_BUFSIZE 200
|
#define DEBUG_BUFSIZE 200
|
||||||
@@ -259,15 +259,15 @@ void DebugCmdRS485Ctrl(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: rs485 arg1 arg2 arg3 arg4\r\n");
|
DBG_LOG("Debug Cmd: rs485 arg1 arg2 arg3\r\n");
|
||||||
DBG_LOG(" brief --> RS485 control command.\r\n");
|
DBG_LOG(" brief --> RS485 control command.\r\n");
|
||||||
DBG_LOG(" arg1 --> idx: (1, 2) RS485 channel selection.\r\n");
|
DBG_LOG(" arg1 --> idx: (1, 2) RS485 channel selection.\r\n");
|
||||||
DBG_LOG(" arg2 --> scmd:(o, c, v, b)Rs485 subcommand.\r\n");
|
DBG_LOG(" arg2 --> scmd:(o, c, v, b, u)Rs485 subcommand.\r\n");
|
||||||
DBG_LOG(" scmd = o, arg3 = (on, off) RS485 Channel On-OFF.\r\n");
|
DBG_LOG(" scmd = o, arg3 = (on, off) RS485 Channel On-OFF.\r\n");
|
||||||
DBG_LOG(" scmd = c, arg3 = (on, off) Enable the internal communication unit function.\r\n");
|
DBG_LOG(" scmd = c, arg3 = (on, off) Enable the internal communication unit function.\r\n");
|
||||||
DBG_LOG(" scmd = v, arg3 = (on, off) Set output voltage.\r\n");
|
DBG_LOG(" scmd = v, arg3 = (on, off) Set output voltage.\r\n");
|
||||||
DBG_LOG(" scmd = b, arg3 = (2400~500000) Set baud rate.\r\n\r\n");
|
DBG_LOG(" scmd = b, arg3 = (2400~500000) Set baud rate.\r\n");
|
||||||
DBG_LOG(" scmd = u, arg4 = (on, off) Set Upgrade symbol.\r\n\r\n");
|
DBG_LOG(" scmd = u, arg3 = (on, off) Set Upgrade symbol.\r\n\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,11 +452,10 @@ void DebugCmdDelCommUnit(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GateWay->ConfigPara.CommUnitArray[ret].RegFlag = false;
|
GateWay->ConfigPara.CommUnitArray[ret].RegFlag = false;
|
||||||
//memset(&GateWay->ConfigPara.CommUnitArray[ret], 0x00, sizeof(CommUnitData_t));
|
|
||||||
DBG_LOG("Device has been deleted!\r\n");
|
DBG_LOG("Device has been deleted!\r\n");
|
||||||
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
* 函数名称: DebugCmdLsCommUnit
|
* 函数名称: DebugCmdLsCommUnit
|
||||||
* 功能描述: 查看通讯单元信息
|
* 功能描述: 查看通讯单元信息
|
||||||
@@ -521,7 +520,143 @@ void DebugCmdLsCommUnit(int argc, char *argv[])
|
|||||||
DBG_LOG("No device is registered.\r\n");
|
DBG_LOG("No device is registered.\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*****************************************************************************************
|
||||||
|
* 函数名称: DebugCmdExclCommUnit
|
||||||
|
* 功能描述: 排除指定的通讯单元MAC
|
||||||
|
* 参 数: argc, 输入参数数量
|
||||||
|
argv, 输入参数
|
||||||
|
* 返 回 值: 无
|
||||||
|
*****************************************************************************************/
|
||||||
|
void DebugCmdExclCommUnit(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
DBG_LOG("\r\n");
|
||||||
|
uint8_t mac[6];
|
||||||
|
|
||||||
|
if(argc < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
|
DBG_LOG("Debug Cmd: excu arg1\r\n");
|
||||||
|
DBG_LOG(" brief --> Exclude communication unit.\r\n");
|
||||||
|
DBG_LOG(" arg1 --> mac: communication unit Mac address.\r\n");
|
||||||
|
DBG_LOG(" mac = (XX-XX-XX-XX-XX-XX), Exclude the MAC of the specified communication unit.\r\n\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = sscanf(argv[1], "%x-%x-%x-%x-%x-%x",
|
||||||
|
(int *)&mac[0], (int *)&mac[1], (int *)&mac[2], (int *)&mac[3], (int *)&mac[4], (int *)&mac[5]);
|
||||||
|
if(ret != 6) {
|
||||||
|
DBG_LOG("cuex Cmd Para Error!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckCommUnitExcl(GateWay, mac);
|
||||||
|
if(ret > -1) {
|
||||||
|
DBG_LOG("This device has been tested and eliminated at this gateway!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < COMMUNIT_NUM_MAX; i++) {//寻找空位
|
||||||
|
if(GateWay->ConfigPara.ExclCommUnit[i].ExclFlag == false){
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclFlag = true;
|
||||||
|
memcpy(&GateWay->ConfigPara.ExclCommUnit[i].ExclMac, &mac[0], 6);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckCommUnitReg(GateWay, mac);//删除注册信息
|
||||||
|
if(ret > -1) {
|
||||||
|
GateWay->ConfigPara.CommUnitArray[ret].RegFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG_LOG("Equipment removal was successful!\r\n");
|
||||||
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
|
}
|
||||||
|
/*****************************************************************************************
|
||||||
|
* 函数名称: DebugCmdDelExclCommUnit
|
||||||
|
* 功能描述: 删除指定的被排除的通信单元MAC
|
||||||
|
* 参 数: argc, 输入参数数量
|
||||||
|
argv, 输入参数
|
||||||
|
* 返 回 值: 无
|
||||||
|
*****************************************************************************************/
|
||||||
|
void DebugCmdDelExclCommUnit(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
DBG_LOG("\r\n");
|
||||||
|
uint8_t mac[6];
|
||||||
|
|
||||||
|
if(argc < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
|
DBG_LOG("Debug Cmd: exdel arg1\r\n");
|
||||||
|
DBG_LOG(" brief --> Delete the excluded communication units.\r\n");
|
||||||
|
DBG_LOG(" arg1 --> mac: communication unit Mac address.\r\n");
|
||||||
|
DBG_LOG(" mac = (XX-XX-XX-XX-XX-XX), Delete the MAC address of the specified excluded communication unit.\r\n\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strcmp(argv[1], "all") == 0) {
|
||||||
|
for(uint8_t i = 0; i < COMMUNIT_NUM_MAX; i++)
|
||||||
|
{
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclFlag = false;
|
||||||
|
}
|
||||||
|
DBG_LOG("All excluded devices have been deleted!\r\n");
|
||||||
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = sscanf(argv[1], "%x-%x-%x-%x-%x-%x",
|
||||||
|
(int *)&mac[0], (int *)&mac[1], (int *)&mac[2], (int *)&mac[3], (int *)&mac[4], (int *)&mac[5]);
|
||||||
|
if(ret != 6) {
|
||||||
|
DBG_LOG("exdel Cmd Para Error!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = CheckCommUnitExcl(GateWay, mac);
|
||||||
|
if(ret < 0) {
|
||||||
|
DBG_LOG("This equipment has not been ruled out!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[ret].ExclFlag = false;
|
||||||
|
DBG_LOG("The exclusion for this equipment has been cancelled!\r\n");
|
||||||
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************************
|
||||||
|
* 函数名称: DebugCmdLsExclCommUnit
|
||||||
|
* 功能描述: 查看被排除的通讯单元信息
|
||||||
|
* 参 数: argc, 输入参数数量
|
||||||
|
argv, 输入参数
|
||||||
|
* 返 回 值: 无
|
||||||
|
*****************************************************************************************/
|
||||||
|
void DebugCmdLsExclCommUnit(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
DBG_LOG("\r\n");
|
||||||
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
|
DBG_LOG("Debug Cmd: exls\r\n\
|
||||||
|
brief --> View the information of the excluded communication units.\r\n\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CUCnt = 0;
|
||||||
|
for(int i = 0; i < COMMUNIT_NUM_MAX; i++) {
|
||||||
|
if(GateWay->ConfigPara.ExclCommUnit[i].ExclFlag == true) {
|
||||||
|
CUCnt++;
|
||||||
|
DBG_LOG("DevMac: %02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclMac[0],
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclMac[1],
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclMac[2],
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclMac[3],
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclMac[4],
|
||||||
|
GateWay->ConfigPara.ExclCommUnit[i].ExclMac[5]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(CUCnt ==0) {
|
||||||
|
DBG_LOG("No device is exclude.\r\n");
|
||||||
|
}
|
||||||
|
DBG_LOG("\r\n\r\n");
|
||||||
|
}
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
* 函数名称: DebugCmdSetComm
|
* 函数名称: DebugCmdSetComm
|
||||||
* 功能描述: 设置网关与服务通讯方式
|
* 功能描述: 设置网关与服务通讯方式
|
||||||
@@ -536,7 +671,7 @@ void DebugCmdSetComm(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: comm arg1\r\n");
|
DBG_LOG("Debug Cmd: comm arg1\r\n");
|
||||||
DBG_LOG(" brief --> Set gateway and service communication methods.\r\n");
|
DBG_LOG(" brief --> Set gateway and service communication methods.\r\n");
|
||||||
DBG_LOG(" arg1 --> para: (cat1, eth),Cat1 or ETH communication.\r\n\r\n");
|
DBG_LOG(" arg1 --> para: (cat1, eth),Cat1 or ETH communication.\r\n\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -747,13 +882,19 @@ void DebugCmdRestoreFactory(int argc, char *argv[])
|
|||||||
DBG_LOG("\r\n");
|
DBG_LOG("\r\n");
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: res\r\n\
|
DBG_LOG("Debug Cmd: res\r\n\
|
||||||
brief --> Restore to factory.\r\n\r\n");
|
brief --> Restore to factory.\r\n");
|
||||||
|
DBG_LOG(" arg1 --> password\r\n\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(strcmp(argv[1], "gxjt") != 0) {
|
||||||
|
DBG_LOG("Password Error\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG_LOG("Restore factory settings, GateWay Restart...\r\n");
|
||||||
memset((uint8_t *)&GateWay->ConfigPara, 0x00, sizeof(GWConfigPara_t));
|
memset((uint8_t *)&GateWay->ConfigPara, 0x00, sizeof(GWConfigPara_t));
|
||||||
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
DBG_LOG("Restore factory settings, GateWay Restart...\r\n");
|
|
||||||
rt_thread_delay(1000);
|
rt_thread_delay(1000);
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
while(1);
|
while(1);
|
||||||
@@ -863,7 +1004,7 @@ void DebugCmdTimeSync(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: time\r\n");
|
DBG_LOG("Debug Cmd: time args\r\n");
|
||||||
DBG_LOG(" brief --> Time synchronization.\r\n");
|
DBG_LOG(" brief --> Time synchronization.\r\n");
|
||||||
DBG_LOG(" args --> (time YYYY-MM-DD,hh:mm:ss)Set system time.\r\n\r\n");
|
DBG_LOG(" args --> (time YYYY-MM-DD,hh:mm:ss)Set system time.\r\n\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -938,7 +1079,7 @@ void DebugCmdSelDebugChannel(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: dch\r\n");
|
DBG_LOG("Debug Cmd: dch args\r\n");
|
||||||
DBG_LOG(" brief --> Debug information output channel selection.\r\n");
|
DBG_LOG(" brief --> Debug information output channel selection.\r\n");
|
||||||
DBG_LOG(" args --> (dbg|ch1|ch2) default: dbg\r\n");
|
DBG_LOG(" args --> (dbg|ch1|ch2) default: dbg\r\n");
|
||||||
DBG_LOG(" dbg: On board debugging serial port.\r\n");
|
DBG_LOG(" dbg: On board debugging serial port.\r\n");
|
||||||
@@ -993,26 +1134,31 @@ static void DebugCmdSetSvr(int argc, char *argv[])
|
|||||||
int IP[4];
|
int IP[4];
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
if(argc < 3)
|
if(argc < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: arg1 arg2\r\n");
|
DBG_LOG("Debug Cmd: svr arg1 arg2 arg3\r\n");
|
||||||
DBG_LOG(" brief --> Set the server IP address and port for 4G communication.\r\n");
|
DBG_LOG(" brief --> Set the server IP address and port for 4G communication.\r\n");
|
||||||
DBG_LOG(" arg1 --> (xx.xx.xx.xx) ip\r\n");
|
DBG_LOG(" arg1 --> password\r\n");
|
||||||
DBG_LOG(" arg2 --> port\r\n\r\n");
|
DBG_LOG(" arg2 --> (xx.xx.xx.xx) ip\r\n");
|
||||||
|
DBG_LOG(" arg3 --> port\r\n\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *IpStr = argv[1];
|
if(strcmp(argv[1], "gxjt") != 0) {
|
||||||
|
DBG_LOG("Password Error\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *IpStr = argv[2];
|
||||||
int ret = sscanf(IpStr, "%d.%d.%d.%d", &IP[0], &IP[1], &IP[2], &IP[3]);
|
int ret = sscanf(IpStr, "%d.%d.%d.%d", &IP[0], &IP[1], &IP[2], &IP[3]);
|
||||||
if(ret != 4)
|
if(ret != 4)
|
||||||
return;
|
return;
|
||||||
if(IP[0] > 0xff || IP[1] > 0xff || IP[2] > 0xff || IP[3] > 0xff)
|
if(IP[0] > 0xff || IP[1] > 0xff || IP[2] > 0xff || IP[3] > 0xff)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
port = atoi(argv[2]);
|
port = atoi(argv[3]);
|
||||||
if(port > 0xffff)
|
if(port > 0xffff)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1044,7 +1190,7 @@ static void DebugCmdSetMac(int argc, char *argv[])
|
|||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: mac arg1 arg2\r\n");
|
DBG_LOG("Debug Cmd: mac arg1 arg2\r\n");
|
||||||
DBG_LOG(" brief --> Set the server IP address and port for 4G communication.\r\n");
|
DBG_LOG(" brief --> Set the server IP address and port for 4G communication.\r\n");
|
||||||
DBG_LOG(" arg1 --> psw\r\n");
|
DBG_LOG(" arg1 --> password\r\n");
|
||||||
DBG_LOG(" arg2 --> mac(xx-xx-xx-xx-xx-xx)\r\n\r\n");
|
DBG_LOG(" arg2 --> mac(xx-xx-xx-xx-xx-xx)\r\n\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1123,7 +1269,8 @@ static void DebugCmdGetPara(int argc, char *argv[])
|
|||||||
DBG_LOG("Baudrate %d\r\n", GateWay->ConfigPara.Rs485Ch2.BaudRate);
|
DBG_LOG("Baudrate %d\r\n", GateWay->ConfigPara.Rs485Ch2.BaudRate);
|
||||||
|
|
||||||
DBG_LOG("Lora: ch %d, rp %d, fc %d\r\n", GateWay->ConfigPara.Lora.ucChannel, GateWay->ConfigPara.Lora.RegPreamble, GateWay->ConfigPara.Lora.FreqCent);
|
DBG_LOG("Lora: ch %d, rp %d, fc %d\r\n", GateWay->ConfigPara.Lora.ucChannel, GateWay->ConfigPara.Lora.RegPreamble, GateWay->ConfigPara.Lora.FreqCent);
|
||||||
|
DBG_LOG("LpCfg: CI:%dsec, RI:%dmin, EI:%dmin, ET:%dmin\r\n",
|
||||||
|
LW_DEV_COLLECT_INTERVAL_MAX, LW_DEV_REPORT_INTERVAL_MAX, LW_DEV_ER_INTERVAL_MAX, LW_DEV_ER_TIME_MAX);
|
||||||
struct tm *stime;
|
struct tm *stime;
|
||||||
uint32_t dwStamp = TimeTs();
|
uint32_t dwStamp = TimeTs();
|
||||||
stime = localtime(&dwStamp);
|
stime = localtime(&dwStamp);
|
||||||
@@ -1133,7 +1280,7 @@ static void DebugCmdGetPara(int argc, char *argv[])
|
|||||||
DBG_LOG("%d:",stime->tm_hour);
|
DBG_LOG("%d:",stime->tm_hour);
|
||||||
DBG_LOG("%d:",stime->tm_min);
|
DBG_LOG("%d:",stime->tm_min);
|
||||||
DBG_LOG("%d\r\n",stime->tm_sec);
|
DBG_LOG("%d\r\n",stime->tm_sec);
|
||||||
DBG_LOG("**********************************************************\r\n");
|
DBG_LOG("**********************************************************\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
@@ -1156,7 +1303,7 @@ static void DebugCmdCali(int argc, char *argv[])
|
|||||||
|
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: cali\r\n");
|
DBG_LOG("Debug Cmd: cali arg1\r\n");
|
||||||
DBG_LOG(" brief --> Calibrate the sensor.\r\n\r\n");
|
DBG_LOG(" brief --> Calibrate the sensor.\r\n\r\n");
|
||||||
DBG_LOG(" arg1 --> mac: communication unit Mac address.\r\n");
|
DBG_LOG(" arg1 --> mac: communication unit Mac address.\r\n");
|
||||||
DBG_LOG(" mac = (XX-XX-XX-XX-XX-XX), Calibrate specified MAC communication unit.\r\n");
|
DBG_LOG(" mac = (XX-XX-XX-XX-XX-XX), Calibrate specified MAC communication unit.\r\n");
|
||||||
@@ -1285,8 +1432,8 @@ static void DebugLaserConfig(int argc, char *argv[])
|
|||||||
|
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: laser\r\n");
|
DBG_LOG("Debug Cmd: laser arg1 arg2\r\n");
|
||||||
DBG_LOG(" brief --> Control laser cutting.\r\n\r\n");
|
DBG_LOG(" brief --> Control laser cutting.\r\n");
|
||||||
DBG_LOG(" arg1 --> mac: communication unit Mac address.\r\n");
|
DBG_LOG(" arg1 --> mac: communication unit Mac address.\r\n");
|
||||||
DBG_LOG(" mac = (XX-XX-XX-XX-XX-XX), Control specified MAC communication unit.\r\n");
|
DBG_LOG(" mac = (XX-XX-XX-XX-XX-XX), Control specified MAC communication unit.\r\n");
|
||||||
DBG_LOG(" arg2 --> state: on/off, Turn on or off the laser.\r\n\r\n");
|
DBG_LOG(" arg2 --> state: on/off, Turn on or off the laser.\r\n\r\n");
|
||||||
@@ -1410,10 +1557,10 @@ static void DebugCmdLPConfig(int argc, char *argv[])
|
|||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: lpcfg arg1 arg2 arg3 arg4\r\n");
|
DBG_LOG("Debug Cmd: lpcfg arg1 arg2 arg3 arg4\r\n");
|
||||||
DBG_LOG(" brief --> Configure low-power device parameters.\r\n");
|
DBG_LOG(" brief --> Configure low-power device parameters.\r\n");
|
||||||
DBG_LOG(" arg1 --> Collect interval\r\n");
|
DBG_LOG(" arg1 --> Collect interval(30~7200 second)\r\n");
|
||||||
DBG_LOG(" arg2 --> Report interval\r\n");
|
DBG_LOG(" arg2 --> Report interval(5~720 minute)\r\n");
|
||||||
DBG_LOG(" arg3 --> Emergency reporting interval\r\n");
|
DBG_LOG(" arg3 --> Emergency reporting interval(1~5 minute)\r\n");
|
||||||
DBG_LOG(" arg4 --> Emergency reporting time\r\n\r\n");
|
DBG_LOG(" arg4 --> Emergency reporting time(10~120 minute)\r\n\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1460,7 +1607,7 @@ static void DebugCmdLPConfig(int argc, char *argv[])
|
|||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
* 函数名称: DebugCmdLPConfig
|
* 函数名称: DebugCmdLPConfig
|
||||||
* 功能描述: 低功耗参数配置
|
* 功能描述: Lora参数配置
|
||||||
* 参 数: argc, 输入参数数量
|
* 参 数: argc, 输入参数数量
|
||||||
argv, 输入参数
|
argv, 输入参数
|
||||||
* 返 回 值: 无
|
* 返 回 值: 无
|
||||||
@@ -1472,7 +1619,7 @@ static void DebugLoraConfig(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: Lora arg1 arg2\r\n");
|
DBG_LOG("Debug Cmd: lora arg1 arg2\r\n");
|
||||||
DBG_LOG(" brief --> Configure Lora parameters.\r\n");
|
DBG_LOG(" brief --> Configure Lora parameters.\r\n");
|
||||||
DBG_LOG(" arg1 --> ch: Channel--para=(0~16)\r\n");
|
DBG_LOG(" arg1 --> ch: Channel--para=(0~16)\r\n");
|
||||||
DBG_LOG(" pw: Power--para=(0~20)\r\n");
|
DBG_LOG(" pw: Power--para=(0~20)\r\n");
|
||||||
@@ -1480,6 +1627,7 @@ static void DebugLoraConfig(int argc, char *argv[])
|
|||||||
DBG_LOG(" sf: SpreadFactor--para=(6~12)\r\n");
|
DBG_LOG(" sf: SpreadFactor--para=(6~12)\r\n");
|
||||||
DBG_LOG(" ec: ErrorCoding--para=(1~4)\r\n");
|
DBG_LOG(" ec: ErrorCoding--para=(1~4)\r\n");
|
||||||
DBG_LOG(" rp: RegPreamble--para=(1~32)\r\n");
|
DBG_LOG(" rp: RegPreamble--para=(1~32)\r\n");
|
||||||
|
DBG_LOG(" fc: FreqCent--para=(410000000~525000000)\r\n");
|
||||||
DBG_LOG(" o: on/off\r\n");
|
DBG_LOG(" o: on/off\r\n");
|
||||||
DBG_LOG(" arg2 --> para\r\n");
|
DBG_LOG(" arg2 --> para\r\n");
|
||||||
|
|
||||||
@@ -1570,7 +1718,18 @@ static void DebugLoraConfig(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(GateWay->ConfigPara.Lora.OnOff)
|
if(strcmp(argv[1], "fc") == 0){
|
||||||
|
uint32_t fc = atoi(argv[2]);
|
||||||
|
if(LoraSetFreqCent(fc)) {
|
||||||
|
GateWay->ConfigPara.Lora.FreqCent = fc;
|
||||||
|
DBG_LOG(" Lora FreqCent is configured successfully!\r\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DBG_LOG("Lora Para Error!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(GateWay->ConfigPara.Lora.OnOff == true)
|
||||||
LoraInit();
|
LoraInit();
|
||||||
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
DBG_LOG("Lora reinitializes.\r\n");
|
DBG_LOG("Lora reinitializes.\r\n");
|
||||||
@@ -1609,7 +1768,19 @@ void DebugCmdHelp(int argc, char *argv[])
|
|||||||
len = strlen("culs ?\r\n");
|
len = strlen("culs ?\r\n");
|
||||||
memcpy(Data, "culs ?\r\n", len);
|
memcpy(Data, "culs ?\r\n", len);
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("excu ?\r\n");
|
||||||
|
memcpy(Data, "excu ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("exdel ?\r\n");
|
||||||
|
memcpy(Data, "exdel ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("exls ?\r\n");
|
||||||
|
memcpy(Data, "exls ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
len = strlen("comm ?\r\n");
|
len = strlen("comm ?\r\n");
|
||||||
memcpy(Data, "comm ?\r\n", len);
|
memcpy(Data, "comm ?\r\n", len);
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
@@ -1630,22 +1801,14 @@ void DebugCmdHelp(int argc, char *argv[])
|
|||||||
memcpy(Data, "hinf ?\r\n", len);
|
memcpy(Data, "hinf ?\r\n", len);
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
// len = strlen("res ?\r\n");
|
len = strlen("res ?\r\n");
|
||||||
// memcpy(Data, "res ?\r\n", len);
|
memcpy(Data, "res ?\r\n", len);
|
||||||
// DebugAnalyze(GateWay, Data, len);
|
|
||||||
|
|
||||||
len = strlen("sct ?\r\n");
|
|
||||||
memcpy(Data, "sct ?\r\n", len);
|
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
len = strlen("time ?\r\n");
|
len = strlen("time ?\r\n");
|
||||||
memcpy(Data, "time ?\r\n", len);
|
memcpy(Data, "time ?\r\n", len);
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
len = strlen("svr ?\r\n");
|
|
||||||
memcpy(Data, "svr ?\r\n", len);
|
|
||||||
DebugAnalyze(GateWay, Data, len);
|
|
||||||
|
|
||||||
len = strlen("qs ?\r\n");
|
len = strlen("qs ?\r\n");
|
||||||
memcpy(Data, "qs ?\r\n", len);
|
memcpy(Data, "qs ?\r\n", len);
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
@@ -1654,24 +1817,55 @@ void DebugCmdHelp(int argc, char *argv[])
|
|||||||
memcpy(Data, "dch ?\r\n", len);
|
memcpy(Data, "dch ?\r\n", len);
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("svr ?\r\n");
|
||||||
|
memcpy(Data, "svr ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("mac ?\r\n");
|
||||||
|
memcpy(Data, "mac ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
len = strlen("para ?\r\n");
|
len = strlen("para ?\r\n");
|
||||||
memcpy(Data, "para ?\r\n", len);
|
memcpy(Data, "para ?\r\n", len);
|
||||||
DebugAnalyze(GateWay, Data, len);
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("cali ?\r\n");
|
||||||
|
memcpy(Data, "cali ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("laser ?\r\n");
|
||||||
|
memcpy(Data, "laser ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("lpcfg ?\r\n");
|
||||||
|
memcpy(Data, "lpcfg ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("lora ?\r\n");
|
||||||
|
memcpy(Data, "lora ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("reboot ?\r\n");
|
||||||
|
memcpy(Data, "reboot ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
||||||
"help", DebugCmdHelp,
|
"help", DebugCmdHelp,
|
||||||
"main", DebugCmdMainOnOff,
|
"main", DebugCmdMainOnOff,
|
||||||
"cat1", DebugCmdCat1OnOff,
|
"cat1", DebugCmdCat1OnOff,
|
||||||
"rs485", DebugCmdRS485Ctrl,
|
"rs485", DebugCmdRS485Ctrl,
|
||||||
"cudel", DebugCmdDelCommUnit,
|
"cudel", DebugCmdDelCommUnit,
|
||||||
"culs", DebugCmdLsCommUnit,
|
"culs", DebugCmdLsCommUnit,
|
||||||
|
"excu", DebugCmdExclCommUnit,
|
||||||
|
"exdel", DebugCmdDelExclCommUnit,
|
||||||
|
"exls", DebugCmdLsExclCommUnit,
|
||||||
"comm", DebugCmdSetComm,
|
"comm", DebugCmdSetComm,
|
||||||
"sct", DebugCmdSetCollectTime,
|
"sct", DebugCmdSetCollectTime,
|
||||||
// "his", DebugCmdReadHisData,
|
"his", DebugCmdReadHisData,
|
||||||
"fmt", DebugCmdDelHisData,
|
"fmt", DebugCmdDelHisData,
|
||||||
"hinf", DebugCmdGetHisInfo,
|
"hinf", DebugCmdGetHisInfo,
|
||||||
// "res", DebugCmdRestoreFactory,
|
"res", DebugCmdRestoreFactory,
|
||||||
"time", DebugCmdTimeSync,
|
"time", DebugCmdTimeSync,
|
||||||
"qs", DebugCmdQuerySensor,
|
"qs", DebugCmdQuerySensor,
|
||||||
"dch", DebugCmdSelDebugChannel,
|
"dch", DebugCmdSelDebugChannel,
|
||||||
@@ -1679,8 +1873,8 @@ const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
|||||||
"mac", DebugCmdSetMac,
|
"mac", DebugCmdSetMac,
|
||||||
"para", DebugCmdGetPara,
|
"para", DebugCmdGetPara,
|
||||||
"cali", DebugCmdCali,
|
"cali", DebugCmdCali,
|
||||||
"laser", DebugLaserConfig,
|
"laser", DebugLaserConfig,
|
||||||
"lpcfg", DebugCmdLPConfig,
|
"lpcfg", DebugCmdLPConfig,
|
||||||
"lora", DebugLoraConfig,
|
"lora", DebugLoraConfig,
|
||||||
"reboot", DebugCmdReboot,
|
"reboot", DebugCmdReboot,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user