Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc6352a3de | |||
| 765fe784f2 | |||
| 7e55f4cb1b | |||
| 28b612dd28 | |||
| 7b80a04f4f | |||
| 44aa2116aa | |||
| c7315ae6f9 | |||
| 6158a92b6d | |||
| 8f1630d7ab | |||
| ce77d9eaf6 |
+354
-77
@@ -1,4 +1,5 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "bsp.h"
|
||||||
#include "CatOneTask.h"
|
#include "CatOneTask.h"
|
||||||
#include "RS485Task.h"
|
#include "RS485Task.h"
|
||||||
#include "Public.h"
|
#include "Public.h"
|
||||||
@@ -8,7 +9,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 +260,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,9 +302,9 @@ void DebugCmdRS485Ctrl(int argc, char *argv[])
|
|||||||
if(idx == 1) {
|
if(idx == 1) {
|
||||||
GateWay->ConfigPara.Rs485Ch1.CommUnitEnable = true;
|
GateWay->ConfigPara.Rs485Ch1.CommUnitEnable = true;
|
||||||
GateWay->ConfigPara.Rs485Ch1.QuerySensorFlag = true;
|
GateWay->ConfigPara.Rs485Ch1.QuerySensorFlag = true;
|
||||||
GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorN = 0;
|
GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorN = 0;
|
||||||
memset(GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorType, 0x00, SENSOR_NUM_MAX * 2);
|
memset(GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorType, 0x00, SENSOR_NUM_MAX * 2);
|
||||||
GateWay->ConfigPara.Rs485Ch1.CUData.Para.CommStatus = true;
|
GateWay->ConfigPara.Rs485Ch1.CUPara.Para.CommStatus = true;
|
||||||
RS485Ch1_Config(9600);
|
RS485Ch1_Config(9600);
|
||||||
GateWay->ConfigPara.Rs485Ch1.BaudRate = 9600;
|
GateWay->ConfigPara.Rs485Ch1.BaudRate = 9600;
|
||||||
SComm1Para.SensorCnt = 0;
|
SComm1Para.SensorCnt = 0;
|
||||||
@@ -311,9 +312,9 @@ void DebugCmdRS485Ctrl(int argc, char *argv[])
|
|||||||
else if(idx == 2) {
|
else if(idx == 2) {
|
||||||
GateWay->ConfigPara.Rs485Ch2.CommUnitEnable = true;
|
GateWay->ConfigPara.Rs485Ch2.CommUnitEnable = true;
|
||||||
GateWay->ConfigPara.Rs485Ch2.QuerySensorFlag = true;
|
GateWay->ConfigPara.Rs485Ch2.QuerySensorFlag = true;
|
||||||
GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorN = 0;
|
GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorN = 0;
|
||||||
memset(GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorType, 0x00, SENSOR_NUM_MAX * 2);
|
memset(GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorType, 0x00, SENSOR_NUM_MAX * 2);
|
||||||
GateWay->ConfigPara.Rs485Ch2.CUData.Para.CommStatus = true;
|
GateWay->ConfigPara.Rs485Ch2.CUPara.Para.CommStatus = true;
|
||||||
RS485Ch2_Config(9600);
|
RS485Ch2_Config(9600);
|
||||||
GateWay->ConfigPara.Rs485Ch2.BaudRate = 9600;
|
GateWay->ConfigPara.Rs485Ch2.BaudRate = 9600;
|
||||||
SComm2Para.SensorCnt = 0;
|
SComm2Para.SensorCnt = 0;
|
||||||
@@ -323,11 +324,11 @@ void DebugCmdRS485Ctrl(int argc, char *argv[])
|
|||||||
else if(strstr(argv[3], "off") != NULL){
|
else if(strstr(argv[3], "off") != NULL){
|
||||||
if(idx == 1) {
|
if(idx == 1) {
|
||||||
GateWay->ConfigPara.Rs485Ch1.CommUnitEnable = false;
|
GateWay->ConfigPara.Rs485Ch1.CommUnitEnable = false;
|
||||||
GateWay->ConfigPara.Rs485Ch1.CUData.Para.CommStatus = false;
|
GateWay->ConfigPara.Rs485Ch1.CUPara.Para.CommStatus = false;
|
||||||
}
|
}
|
||||||
else if(idx == 2) {
|
else if(idx == 2) {
|
||||||
GateWay->ConfigPara.Rs485Ch2.CommUnitEnable = false;
|
GateWay->ConfigPara.Rs485Ch2.CommUnitEnable = false;
|
||||||
GateWay->ConfigPara.Rs485Ch2.CUData.Para.CommStatus = false;
|
GateWay->ConfigPara.Rs485Ch2.CUPara.Para.CommStatus = false;
|
||||||
}
|
}
|
||||||
DBG_LOG("RS485Ch%d Disable!\r\n", idx);
|
DBG_LOG("RS485Ch%d Disable!\r\n", idx);
|
||||||
}
|
}
|
||||||
@@ -452,11 +453,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
|
||||||
* 功能描述: 查看通讯单元信息
|
* 功能描述: 查看通讯单元信息
|
||||||
@@ -476,10 +476,10 @@ void DebugCmdLsCommUnit(int argc, char *argv[])
|
|||||||
if(GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) {
|
if(GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) {
|
||||||
DBG_LOG("DevType: 8001\r\n");
|
DBG_LOG("DevType: 8001\r\n");
|
||||||
DBG_LOG("DevMac: 01-80-02-00-00-01\r\n");
|
DBG_LOG("DevMac: 01-80-02-00-00-01\r\n");
|
||||||
DBG_LOG("SensorNum: %d\r\n", GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorN);
|
DBG_LOG("SensorNum: %d\r\n", GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorN);
|
||||||
DBG_LOG("SensorType: ");
|
DBG_LOG("SensorType: ");
|
||||||
for(int i = 0; i < GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorN; i++) {
|
for(int i = 0; i < GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorN; i++) {
|
||||||
DBG_LOG("%04X ", GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorType[i]);
|
DBG_LOG("%04X ", GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorType[i]);
|
||||||
}
|
}
|
||||||
DBG_LOG("\r\n\r\n");
|
DBG_LOG("\r\n\r\n");
|
||||||
}
|
}
|
||||||
@@ -487,10 +487,10 @@ void DebugCmdLsCommUnit(int argc, char *argv[])
|
|||||||
if(GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) {
|
if(GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) {
|
||||||
DBG_LOG("DevType: 8002\r\n");
|
DBG_LOG("DevType: 8002\r\n");
|
||||||
DBG_LOG("DevMac: 01-80-02-00-00-02\r\n");
|
DBG_LOG("DevMac: 01-80-02-00-00-02\r\n");
|
||||||
DBG_LOG("SensorNum: %d\r\n", GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorN);
|
DBG_LOG("SensorNum: %d\r\n", GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorN);
|
||||||
DBG_LOG("SensorType: ");
|
DBG_LOG("SensorType: ");
|
||||||
for(int i = 0; i < GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorN; i++) {
|
for(int i = 0; i < GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorN; i++) {
|
||||||
DBG_LOG("%04X ", GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorType[i]);
|
DBG_LOG("%04X ", GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorType[i]);
|
||||||
}
|
}
|
||||||
DBG_LOG("\r\n\r\n");
|
DBG_LOG("\r\n\r\n");
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,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("Exclude 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,14 +672,16 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(argv[1], "cat1") == 0) {
|
if(strcmp(argv[1], "cat1") == 0) {
|
||||||
|
GateWay->SvrRegFlag = false;
|
||||||
GateWay->ConfigPara.Comm = CATONE_COMM;
|
GateWay->ConfigPara.Comm = CATONE_COMM;
|
||||||
|
ETHStop();
|
||||||
CAT1_ON();
|
CAT1_ON();
|
||||||
CatOneReset();
|
CatOneReset();
|
||||||
DBG_LOG("Set the communication method to Cat1.\r\n");
|
DBG_LOG("Set the communication method to Cat1.\r\n");
|
||||||
@@ -557,12 +695,12 @@ void DebugCmdSetComm(int argc, char *argv[])
|
|||||||
rt_thread_delay(3000);
|
rt_thread_delay(3000);
|
||||||
CAT1_PWR_KEY_SET();
|
CAT1_PWR_KEY_SET();
|
||||||
}
|
}
|
||||||
|
GateWay->SvrRegFlag = false;
|
||||||
GateWay->ConfigPara.Comm = ETH_COMM;
|
GateWay->ConfigPara.Comm = ETH_COMM;
|
||||||
ETH_ON();
|
ETH_ON();
|
||||||
|
ETHReset();
|
||||||
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
WritePara((uint8_t *)&GateWay->ConfigPara, sizeof(GWConfigPara_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
@@ -747,18 +885,94 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************************
|
||||||
|
* 函数名称: DebugCmdUpload
|
||||||
|
* 功能描述: 上传当前网关状态
|
||||||
|
* 参 数: argc, 输入参数数量
|
||||||
|
argv, 输入参数
|
||||||
|
* 返 回 值: 无
|
||||||
|
*****************************************************************************************/
|
||||||
|
static void DebugCmdUpload(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
DBG_LOG("\r\n");
|
||||||
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
|
DBG_LOG("Debug Cmd: up\r\n");
|
||||||
|
DBG_LOG(" brief --> Upload current gateway status to server.\r\n\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GateWay->SvrRegFlag == false) {
|
||||||
|
DBG_LOG("Server not registered, please register first.\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t MegData[6];
|
||||||
|
uint8_t len = sizeof(GateWayAlarmType_t);
|
||||||
|
MegData[0] = len & 0x00ff;
|
||||||
|
MegData[1] = (len >> 8) & 0x00ff;
|
||||||
|
MegData[2] = NET_COMM_CMD_ALARM;
|
||||||
|
|
||||||
|
MegData[3] = 0x00;
|
||||||
|
MegData[4] = GateWay->ConfigPara.OutageFlag ? 1 : 0;
|
||||||
|
MegData[5] = GateWay->Battery;
|
||||||
|
|
||||||
|
if(CatOneEthSendQueue(MegData, 6) == true) {
|
||||||
|
DBG_LOG("Gateway status uploaded.\r\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DBG_LOG("Gateway status upload failed.\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************************
|
||||||
|
* 函数名称: DebugCmdRegister
|
||||||
|
* 功能描述: 重新向上位机发起注册
|
||||||
|
* 参 数: argc, 输入参数数量
|
||||||
|
argv, 输入参数
|
||||||
|
* 返 回 值: 无
|
||||||
|
*****************************************************************************************/
|
||||||
|
static void DebugCmdRegister(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
DBG_LOG("\r\n");
|
||||||
|
if(strcmp(argv[1], "?") == 0) {
|
||||||
|
DBG_LOG("Debug Cmd: reg\r\n");
|
||||||
|
DBG_LOG(" brief --> Re-register to the server.\r\n\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GateWay->SvrRegFlag = false;
|
||||||
|
|
||||||
|
if(GateWay->ConfigPara.Comm == CATONE_COMM) {
|
||||||
|
CatOneTriggerRegister();
|
||||||
|
DBG_LOG("Trigger Cat1 re-registration immediately.\r\n");
|
||||||
|
}
|
||||||
|
else if(GateWay->ConfigPara.Comm == ETH_COMM) {
|
||||||
|
ETHTriggerRegister();
|
||||||
|
DBG_LOG("Trigger ETH re-registration immediately.\r\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DBG_LOG("Unknown communication type.\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
* 函数名称: DebugCmdRestoreFactory
|
* 函数名称: DebugCmdRestoreFactory
|
||||||
* 功能描述: 恢复出厂设置
|
* 功能描述: 恢复出厂设置
|
||||||
@@ -863,7 +1077,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;
|
||||||
@@ -910,15 +1124,15 @@ void DebugCmdQuerySensor(int argc, char *argv[])
|
|||||||
if(GateWay->ConfigPara.Rs485Ch1.Enable == true && GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) {
|
if(GateWay->ConfigPara.Rs485Ch1.Enable == true && GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) {
|
||||||
DBG_LOG("Query Rs485Ch1...\r\n");
|
DBG_LOG("Query Rs485Ch1...\r\n");
|
||||||
GateWay->ConfigPara.Rs485Ch1.QuerySensorFlag = true;
|
GateWay->ConfigPara.Rs485Ch1.QuerySensorFlag = true;
|
||||||
GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorN = 0;
|
GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorN = 0;
|
||||||
memset(GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorType, 0x00, sizeof(GateWay->ConfigPara.Rs485Ch1.CUData.Para.SensorType));
|
memset(GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorType, 0x00, sizeof(GateWay->ConfigPara.Rs485Ch1.CUPara.Para.SensorType));
|
||||||
SComm1Para.SensorCnt = 0;
|
SComm1Para.SensorCnt = 0;
|
||||||
}
|
}
|
||||||
if(GateWay->ConfigPara.Rs485Ch2.Enable == true && GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) {
|
if(GateWay->ConfigPara.Rs485Ch2.Enable == true && GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) {
|
||||||
DBG_LOG("Query Rs485Ch2...\r\n");
|
DBG_LOG("Query Rs485Ch2...\r\n");
|
||||||
GateWay->ConfigPara.Rs485Ch2.QuerySensorFlag = true;
|
GateWay->ConfigPara.Rs485Ch2.QuerySensorFlag = true;
|
||||||
GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorN = 0;
|
GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorN = 0;
|
||||||
memset(GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorType, 0x00, sizeof(GateWay->ConfigPara.Rs485Ch2.CUData.Para.SensorType));
|
memset(GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorType, 0x00, sizeof(GateWay->ConfigPara.Rs485Ch2.CUPara.Para.SensorType));
|
||||||
SComm2Para.SensorCnt = 0;
|
SComm2Para.SensorCnt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -938,7 +1152,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 +1207,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 +1263,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;
|
||||||
}
|
}
|
||||||
@@ -1106,24 +1325,25 @@ static void DebugCmdGetPara(int argc, char *argv[])
|
|||||||
DBG_LOG("Svr Port: %d\r\n", GateWay->ConfigPara.SvrPort);
|
DBG_LOG("Svr Port: %d\r\n", GateWay->ConfigPara.SvrPort);
|
||||||
DBG_LOG("Register Status: %d\r\n", GateWay->SvrRegFlag);
|
DBG_LOG("Register Status: %d\r\n", GateWay->SvrRegFlag);
|
||||||
DBG_LOG("RS485Ch1 Mac: %02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
DBG_LOG("RS485Ch1 Mac: %02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
||||||
GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0][0],GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0][1],
|
GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][0],GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][1],
|
||||||
GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0][2],GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0][3],
|
GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][2],GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][3],
|
||||||
GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0][4],GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0][5]);
|
GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][4],GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0][5]);
|
||||||
DBG_LOG("RS485Ch1: %s, ", (GateWay->ConfigPara.Rs485Ch1.Enable == true) ? "Enable" : "Disable");
|
DBG_LOG("RS485Ch1: %s, ", (GateWay->ConfigPara.Rs485Ch1.Enable == true) ? "Enable" : "Disable");
|
||||||
DBG_LOG("InCommUnit %s, ", (GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) ? "Enable" : "Disable");
|
DBG_LOG("InCommUnit %s, ", (GateWay->ConfigPara.Rs485Ch1.CommUnitEnable == true) ? "Enable" : "Disable");
|
||||||
DBG_LOG("Vout %s, ", (GateWay->ConfigPara.Rs485Ch1.Power == true) ? "Enable" : "Disable");
|
DBG_LOG("Vout %s, ", (GateWay->ConfigPara.Rs485Ch1.Power == true) ? "Enable" : "Disable");
|
||||||
DBG_LOG("Baudrate %d\r\n", GateWay->ConfigPara.Rs485Ch1.BaudRate);
|
DBG_LOG("Baudrate %d\r\n", GateWay->ConfigPara.Rs485Ch1.BaudRate);
|
||||||
DBG_LOG("RS485Ch2 Mac: %02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
DBG_LOG("RS485Ch2 Mac: %02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
||||||
GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0][0],GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0][1],
|
GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0][0],GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0][1],
|
||||||
GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0][2],GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0][3],
|
GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0][2],GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0][3],
|
||||||
GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0][4],GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0][5]);
|
GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0][4],GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0][5]);
|
||||||
DBG_LOG("RS485Ch2: %s, ", (GateWay->ConfigPara.Rs485Ch2.Enable == true) ? "Enable" : "Disable");
|
DBG_LOG("RS485Ch2: %s, ", (GateWay->ConfigPara.Rs485Ch2.Enable == true) ? "Enable" : "Disable");
|
||||||
DBG_LOG("InCommUnit %s, ", (GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) ? "Enable" : "Disable");
|
DBG_LOG("InCommUnit %s, ", (GateWay->ConfigPara.Rs485Ch2.CommUnitEnable == true) ? "Enable" : "Disable");
|
||||||
DBG_LOG("Vout %s, ", (GateWay->ConfigPara.Rs485Ch2.Power == true) ? "Enable" : "Disable");
|
DBG_LOG("Vout %s, ", (GateWay->ConfigPara.Rs485Ch2.Power == true) ? "Enable" : "Disable");
|
||||||
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 +1353,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 +1376,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");
|
||||||
@@ -1212,7 +1432,7 @@ static void DebugCmdCali(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0], 6) == 0) {
|
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0], 6) == 0) {
|
||||||
if(!GateWay->ConfigPara.Rs485Ch1.Enable || !GateWay->ConfigPara.Rs485Ch1.CommUnitEnable) {
|
if(!GateWay->ConfigPara.Rs485Ch1.Enable || !GateWay->ConfigPara.Rs485Ch1.CommUnitEnable) {
|
||||||
DBG_LOG("Internal communication unit 1 is turned off!\r\n");
|
DBG_LOG("Internal communication unit 1 is turned off!\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -1222,7 +1442,7 @@ static void DebugCmdCali(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0], 6) == 0) {
|
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0], 6) == 0) {
|
||||||
if(!GateWay->ConfigPara.Rs485Ch2.Enable || !GateWay->ConfigPara.Rs485Ch2.CommUnitEnable) {
|
if(!GateWay->ConfigPara.Rs485Ch2.Enable || !GateWay->ConfigPara.Rs485Ch2.CommUnitEnable) {
|
||||||
DBG_LOG("Internal communication unit 2 is turned off!\r\n");
|
DBG_LOG("Internal communication unit 2 is turned off!\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -1285,8 +1505,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");
|
||||||
@@ -1311,7 +1531,7 @@ static void DebugLaserConfig(int argc, char *argv[])
|
|||||||
|
|
||||||
if(strcmp(argv[2], "on") == 0 || strcmp(argv[2], "off") == 0)
|
if(strcmp(argv[2], "on") == 0 || strcmp(argv[2], "off") == 0)
|
||||||
{
|
{
|
||||||
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch1.CUData.Para.Mac[0], 6) == 0) {
|
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch1.CUPara.Para.Mac[0], 6) == 0) {
|
||||||
if(!GateWay->ConfigPara.Rs485Ch1.Enable || !GateWay->ConfigPara.Rs485Ch1.CommUnitEnable) {
|
if(!GateWay->ConfigPara.Rs485Ch1.Enable || !GateWay->ConfigPara.Rs485Ch1.CommUnitEnable) {
|
||||||
DBG_LOG("Internal communication unit 1 is turned off!\r\n");
|
DBG_LOG("Internal communication unit 1 is turned off!\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -1321,7 +1541,7 @@ static void DebugLaserConfig(int argc, char *argv[])
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch2.CUData.Para.Mac[0], 6) == 0) {
|
if(memcmp(mac, GateWay->ConfigPara.Rs485Ch2.CUPara.Para.Mac[0], 6) == 0) {
|
||||||
if(!GateWay->ConfigPara.Rs485Ch2.Enable || !GateWay->ConfigPara.Rs485Ch2.CommUnitEnable) {
|
if(!GateWay->ConfigPara.Rs485Ch2.Enable || !GateWay->ConfigPara.Rs485Ch2.CommUnitEnable) {
|
||||||
DBG_LOG("Internal communication unit 2 is turned off!\r\n");
|
DBG_LOG("Internal communication unit 2 is turned off!\r\n");
|
||||||
return;
|
return;
|
||||||
@@ -1410,10 +1630,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 +1680,7 @@ static void DebugCmdLPConfig(int argc, char *argv[])
|
|||||||
|
|
||||||
/*****************************************************************************************
|
/*****************************************************************************************
|
||||||
* 函数名称: DebugCmdLPConfig
|
* 函数名称: DebugCmdLPConfig
|
||||||
* 功能描述: 低功耗参数配置
|
* 功能描述: Lora参数配置
|
||||||
* 参 数: argc, 输入参数数量
|
* 参 数: argc, 输入参数数量
|
||||||
argv, 输入参数
|
argv, 输入参数
|
||||||
* 返 回 值: 无
|
* 返 回 值: 无
|
||||||
@@ -1472,7 +1692,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 +1700,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 +1791,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");
|
||||||
@@ -1610,6 +1842,18 @@ void DebugCmdHelp(int argc, char *argv[])
|
|||||||
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 +1874,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 +1890,63 @@ 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);
|
||||||
|
|
||||||
|
len = strlen("up ?\r\n");
|
||||||
|
memcpy(Data, "up ?\r\n", len);
|
||||||
|
DebugAnalyze(GateWay, Data, len);
|
||||||
|
|
||||||
|
len = strlen("reg ?\r\n");
|
||||||
|
memcpy(Data, "reg ?\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 +1954,10 @@ 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,
|
||||||
|
"up", DebugCmdUpload,
|
||||||
|
"reg", DebugCmdRegister,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user