fix(duch,laser): duch cat1网络指令解析+LaserOnOff状态更新
- Cat1Rev_Thread +LIPURC拦截去dLen<24限制, 全量DebugAnalyze(Task网络指令) - COMM_UNIT_CMD_CONT_LASER回应处置LaserOnOff真实值(设备自动关/开)
This commit is contained in:
@@ -428,7 +428,40 @@
|
|||||||
<Name></Name>
|
<Name></Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint/>
|
<Breakpoint>
|
||||||
|
<Bp>
|
||||||
|
<Number>0</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>643</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>55060</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>..\source\User\Src\CatOneTask.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\GateWay\../source/User/Src/CatOneTask.c\643</Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>1</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>569</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>54386</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>..\source\User\Src\CatOneTask.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\GateWay\../source/User/Src/CatOneTask.c\569</Expression>
|
||||||
|
</Bp>
|
||||||
|
</Breakpoint>
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
@@ -460,6 +493,16 @@
|
|||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>cat1Active</ItemText>
|
<ItemText>cat1Active</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>6</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>CatOne.Cat1Status</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>7</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>CatOne.AtCmd</ItemText>
|
||||||
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<WatchWindow2>
|
<WatchWindow2>
|
||||||
<Ww>
|
<Ww>
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ void rt_hw_board_init(void)
|
|||||||
static int uart_init(void)
|
static int uart_init(void)
|
||||||
{
|
{
|
||||||
//#error "TODO 2: Enable the hardware uart and config baudrate."
|
//#error "TODO 2: Enable the hardware uart and config baudrate."
|
||||||
DbgOrCat1Uart_Config(500000);
|
//DbgOrCat1Uart_Config(500000);
|
||||||
// RS485Ch1_Config(500000);
|
RS485Ch1_Config(500000);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(uart_init);
|
INIT_BOARD_EXPORT(uart_init);
|
||||||
@@ -86,15 +86,16 @@ INIT_BOARD_EXPORT(uart_init);
|
|||||||
void rt_hw_console_output(const char *str)
|
void rt_hw_console_output(const char *str)
|
||||||
{
|
{
|
||||||
rt_enter_critical();
|
rt_enter_critical();
|
||||||
switch(GateWay.ConfigPara.Duch) {
|
RS485Ch1UartSend((uint8_t *)str, strlen(str));
|
||||||
case CH_RS485_1: RS485Ch1UartSend((uint8_t *)str, strlen(str)); break;
|
// switch(GateWay.ConfigPara.Duch) {
|
||||||
case CH_RS485_2: RS485Ch2UartSend((uint8_t *)str, strlen(str)); break;
|
// case CH_RS485_1: RS485Ch1UartSend((uint8_t *)str, strlen(str)); break;
|
||||||
case CH_ETH: EthUartSend((uint8_t *)str, strlen(str)); break;
|
// case CH_RS485_2: RS485Ch2UartSend((uint8_t *)str, strlen(str)); break;
|
||||||
case CH_LORA: Sx1276LoRaSendBuffer((uint8_t *)str, strlen(str)); break;
|
// case CH_ETH: EthUartSend((uint8_t *)str, strlen(str)); break;
|
||||||
case CH_CAT1: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
|
// case CH_LORA: Sx1276LoRaSendBuffer((uint8_t *)str, strlen(str)); break;
|
||||||
case CH_DBG: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
|
// case CH_CAT1: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
|
||||||
default: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
|
// case CH_DBG: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
|
||||||
}
|
// default: DebugOrCat1UartSend((uint8_t *)str, strlen(str)); break;
|
||||||
|
// }
|
||||||
rt_exit_critical();
|
rt_exit_critical();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Public.h"
|
#include "Public.h"
|
||||||
#include "DebugCmd.h"
|
#include "DebugCmd.h"
|
||||||
|
|
||||||
#define MAC_ADDR_TYPE 0//0为测试服务器
|
#define MAC_ADDR_TYPE 3//0为测试服务器
|
||||||
|
|
||||||
extern bool MainDispEn;
|
extern bool MainDispEn;
|
||||||
#define MAIN_DBG_LOG(...) { if(MainDispEn) Debug_Printf(__VA_ARGS__);}
|
#define MAIN_DBG_LOG(...) { if(MainDispEn) Debug_Printf(__VA_ARGS__);}
|
||||||
|
|||||||
@@ -636,13 +636,10 @@ void CatOneRev_Thread_Entry(void *parameter)
|
|||||||
CatOneRxLen = 0;
|
CatOneRxLen = 0;
|
||||||
char *urc = strstr(RxBuffTemp, "+LIPURC: 0,1,");
|
char *urc = strstr(RxBuffTemp, "+LIPURC: 0,1,");
|
||||||
if(urc) {
|
if(urc) {
|
||||||
int dLen;
|
char *data = strchr(strchr(strchr(urc, ',')+1, ',')+1, ',') + 1;
|
||||||
if(sscanf(urc, "+LIPURC: 0,1,%d", &dLen) == 1 && dLen < 24) {
|
char *end = strchr(data, '\r');
|
||||||
char *data = strchr(strchr(strchr(urc, ',')+1, ',')+1, ',') + 1;
|
if(end) *end = 0;
|
||||||
char *end = strchr(data, '\r');
|
DebugAnalyze(GateWay, (uint8_t *)data, strlen(data));
|
||||||
if(end) *end = 0;
|
|
||||||
DebugAnalyze(GateWay, (uint8_t *)data, strlen(data));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CatOneAtCmdAnalyze(RxBuffTemp);
|
CatOneAtCmdAnalyze(RxBuffTemp);
|
||||||
memset(CatOneRxBuff, 0x00, CAT_ONE_REV_LEN_MAX);
|
memset(CatOneRxBuff, 0x00, CAT_ONE_REV_LEN_MAX);
|
||||||
|
|||||||
@@ -801,6 +801,7 @@ int CommUnitAnalyze(GateWayPara GateWay, uint8_t *rData, uint16_t rLen, SendData
|
|||||||
MegData[9] = PayLoad[0];
|
MegData[9] = PayLoad[0];
|
||||||
UploadSend(MegData, 10);
|
UploadSend(MegData, 10);
|
||||||
rt_free(MegData);
|
rt_free(MegData);
|
||||||
|
GateWay->ConfigPara.CommUnitArray[CommUnitIdx].LaserOnOff = false;
|
||||||
GateWay->ConfigPara.CommUnitArray[CommUnitIdx].ContLaser = false;
|
GateWay->ConfigPara.CommUnitArray[CommUnitIdx].ContLaser = false;
|
||||||
MAIN_DBG_LOG("CommUnit The laser has been turned off! Mac:%02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
MAIN_DBG_LOG("CommUnit The laser has been turned off! Mac:%02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
||||||
CUHeader->DevMac[0], CUHeader->DevMac[1], CUHeader->DevMac[2], CUHeader->DevMac[3], CUHeader->DevMac[4], CUHeader->DevMac[5]);
|
CUHeader->DevMac[0], CUHeader->DevMac[1], CUHeader->DevMac[2], CUHeader->DevMac[3], CUHeader->DevMac[4], CUHeader->DevMac[5]);
|
||||||
@@ -820,6 +821,7 @@ int CommUnitAnalyze(GateWayPara GateWay, uint8_t *rData, uint16_t rLen, SendData
|
|||||||
MegData[9] = PayLoad[0];
|
MegData[9] = PayLoad[0];
|
||||||
UploadSend(MegData, 10);
|
UploadSend(MegData, 10);
|
||||||
rt_free(MegData);
|
rt_free(MegData);
|
||||||
|
GateWay->ConfigPara.CommUnitArray[CommUnitIdx].LaserOnOff = true;
|
||||||
GateWay->ConfigPara.CommUnitArray[CommUnitIdx].ContLaser = false;
|
GateWay->ConfigPara.CommUnitArray[CommUnitIdx].ContLaser = false;
|
||||||
MAIN_DBG_LOG("CommUnit The laser has been activated! Mac:%02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
MAIN_DBG_LOG("CommUnit The laser has been activated! Mac:%02X-%02X-%02X-%02X-%02X-%02X\r\n",
|
||||||
CUHeader->DevMac[0], CUHeader->DevMac[1], CUHeader->DevMac[2], CUHeader->DevMac[3], CUHeader->DevMac[4], CUHeader->DevMac[5]);
|
CUHeader->DevMac[0], CUHeader->DevMac[1], CUHeader->DevMac[2], CUHeader->DevMac[3], CUHeader->DevMac[4], CUHeader->DevMac[5]);
|
||||||
|
|||||||
@@ -105,12 +105,60 @@ void GateWayInit(void)
|
|||||||
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
GateWay.ConfigPara.LTENet.DestPort = 8080;
|
GateWay.ConfigPara.LTENet.DestPort = 8080;
|
||||||
#elif MAC_ADDR_TYPE > 0
|
#elif MAC_ADDR_TYPE == 1
|
||||||
GateWay.ConfigPara.LTENet.DestAddr[0] = 103;
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
GateWay.ConfigPara.LTENet.DestAddr[1] = 217;
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
GateWay.ConfigPara.LTENet.DestAddr[2] = 192;
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
GateWay.ConfigPara.LTENet.DestAddr[3] = 248;
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
GateWay.ConfigPara.LTENet.DestPort = 12111;
|
GateWay.ConfigPara.LTENet.DestPort = 8081;
|
||||||
|
#elif MAC_ADDR_TYPE == 2
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8082;
|
||||||
|
#elif MAC_ADDR_TYPE == 3
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8083;
|
||||||
|
#elif MAC_ADDR_TYPE == 4
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8084;
|
||||||
|
#elif MAC_ADDR_TYPE == 5
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8085;
|
||||||
|
#elif MAC_ADDR_TYPE == 6
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8086;
|
||||||
|
#elif MAC_ADDR_TYPE == 7
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8087;
|
||||||
|
#elif MAC_ADDR_TYPE == 8
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8088;
|
||||||
|
#elif MAC_ADDR_TYPE == 9
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[0] = 39;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[1] = 106;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[2] = 103;
|
||||||
|
GateWay.ConfigPara.LTENet.DestAddr[3] = 147;
|
||||||
|
GateWay.ConfigPara.LTENet.DestPort = 8089;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GateWay.ConfigPara.CommUnitReadInterval = COMMUNIT_READ_SENSOR_INTERVAL_MAX;//非低功耗设备
|
GateWay.ConfigPara.CommUnitReadInterval = COMMUNIT_READ_SENSOR_INTERVAL_MAX;//非低功耗设备
|
||||||
|
|||||||
Reference in New Issue
Block a user