1、命令数量增加到23个
2、恢复出厂设置函数增加了密码判定,出厂设置后参数全为0xFF 3、设置服务器地址、端口函数增加密码判定 4、Lora参数配置函数增加修改中心频率功能 5、修复了help指令输出提升信息不全的问题
This commit is contained in:
+70
-27
@@ -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 23
|
||||||
#define DEBUG_BUFF_SIZE_MAX 512
|
#define DEBUG_BUFF_SIZE_MAX 512
|
||||||
|
|
||||||
#define DEBUG_BUFSIZE 200
|
#define DEBUG_BUFSIZE 200
|
||||||
@@ -747,13 +747,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((uint8_t *)&GateWay->ConfigPara, 0x00, sizeof(GWConfigPara_t));
|
if(strcmp(argv[1], "gxjt") != 0) {
|
||||||
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
DBG_LOG("Password Error\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DBG_LOG("Restore factory settings, GateWay Restart...\r\n");
|
DBG_LOG("Restore factory settings, GateWay Restart...\r\n");
|
||||||
|
memset((uint8_t *)&GateWay->ConfigPara, 0xFF, sizeof(GWConfigPara_t));
|
||||||
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
rt_thread_delay(1000);
|
rt_thread_delay(1000);
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
while(1);
|
while(1);
|
||||||
@@ -997,22 +1003,27 @@ static void DebugCmdSetSvr(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(strcmp(argv[1], "?") == 0) {
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
DBG_LOG("Debug Cmd: arg1 arg2\r\n");
|
DBG_LOG("Debug Cmd: 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 +1055,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;
|
||||||
}
|
}
|
||||||
@@ -1286,7 +1297,7 @@ 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\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");
|
||||||
@@ -1460,7 +1471,7 @@ static void DebugCmdLPConfig(int argc, char *argv[])
|
|||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
* 函数名称: DebugCmdLPConfig
|
* 函数名称: DebugCmdLPConfig
|
||||||
* 功能描述: 低功耗参数配置
|
* 功能描述: Lora参数配置
|
||||||
* 参 数: argc, 输入参数数量
|
* 参 数: argc, 输入参数数量
|
||||||
argv, 输入参数
|
argv, 输入参数
|
||||||
* 返 回 值: 无
|
* 返 回 值: 无
|
||||||
@@ -1472,7 +1483,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 +1491,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,6 +1582,17 @@ static void DebugLoraConfig(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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)
|
if(GateWay->ConfigPara.Lora.OnOff)
|
||||||
LoraInit();
|
LoraInit();
|
||||||
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
@@ -1630,22 +1653,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,9 +1669,37 @@ 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] = {
|
||||||
@@ -1668,10 +1711,10 @@ const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
|||||||
"culs", DebugCmdLsCommUnit,
|
"culs", DebugCmdLsCommUnit,
|
||||||
"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,
|
||||||
|
|||||||
Reference in New Issue
Block a user