Compare commits
6
Commits
34b851fab7
...
8c12c0e755
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c12c0e755 | ||
|
|
1e5f8052e5 | ||
|
|
10c72585de | ||
|
|
c3e47b0fae | ||
|
|
60033f36a7 | ||
|
|
582cbd57af |
+12
-12
@@ -41,7 +41,7 @@ class Plugin(Plugin_Base):
|
||||
{
|
||||
"caption": "Config - FLJ Low Power",
|
||||
"icon": "fa5.play-circle",
|
||||
"data": "5A 54 E3 DD 88 11 00 00 00 59 06 5A FE"
|
||||
"data": "5A 54 E3 DD 77 11 00 00 00 48 06 5A FE"
|
||||
},{
|
||||
"caption": "Config - FLJ Full Power",
|
||||
"icon": "fa5.play-circle",
|
||||
@@ -49,11 +49,11 @@ class Plugin(Plugin_Base):
|
||||
}, {
|
||||
"caption": "Config - FLJ Silent",
|
||||
"icon": "fa5.play-circle",
|
||||
"data": "5A 54 E3 DD 00 11 00 00 00 D1 06 5A FE"
|
||||
"data": "5A 54 E3 DD 88 11 00 00 00 59 06 5A FE"
|
||||
},{
|
||||
"caption": "Config - LJ Low Power",
|
||||
"icon": "fa5.play-circle",
|
||||
"data": "5A 54 E3 DD 88 00 00 00 00 48 06 5A FE"
|
||||
"data": "5A 54 E3 DD 77 00 00 00 00 37 06 5A FE"
|
||||
},{
|
||||
"caption": "Config - LJ Full Power",
|
||||
"icon": "fa5.play-circle",
|
||||
@@ -61,7 +61,7 @@ class Plugin(Plugin_Base):
|
||||
},{
|
||||
"caption": "Config - LJ Silent",
|
||||
"icon": "fa5.play-circle",
|
||||
"data": "5A 54 E3 DD 00 00 00 00 00 C0 06 5A FE"
|
||||
"data": "5A 54 E3 DD 88 00 00 00 00 48 06 5A FE"
|
||||
},{
|
||||
"caption": "StatusCheck - FLJ",
|
||||
"icon": "fa5.play-circle",
|
||||
@@ -226,7 +226,7 @@ class Plugin(Plugin_Base):
|
||||
elif data[0] == 0xE6 or data[0] == 0xF6:
|
||||
self.showReceiveDataSignal.emit(self.evalStatusCheckRsp(data) + "\n")
|
||||
elif data[0] == 0xE5 or data[0] == 0xF5:
|
||||
self.showReceiveDataSignal.emit(self.printFrame(data) + "\n")
|
||||
self.showReceiveDataSignal.emit('Retrieved Data Frame:\n' + self.printFrame(data) + "\n")
|
||||
else:
|
||||
self.showReceiveDataSignal.emit(f"\n### Unexpected response code 0x{data[0]:02x}.\n")
|
||||
|
||||
@@ -258,10 +258,10 @@ class Plugin(Plugin_Base):
|
||||
ret += f"MGC 3~4: {payload[hwOffset+10] & 0x0f:>2d} - {payload[hwOffset+10] >> 4:>2d}\n"
|
||||
ret += "--------------------------------\n"
|
||||
|
||||
return ret
|
||||
return ret + '\n' + printFrame(data)
|
||||
|
||||
def printFrame(self, data: bytes):
|
||||
ret = 'Retrieved Data Frame:\n'
|
||||
ret = ''
|
||||
for i in range(len(data)):
|
||||
ret += f'{data[i]:02X}'
|
||||
ret += '\n' if i%16 == 15 else ' '
|
||||
@@ -323,13 +323,13 @@ class Plugin(Plugin_Base):
|
||||
ret += f"通信波位号: {payload[linkOffset + 6]:>2d}\n"
|
||||
|
||||
ret += "通信波束宽度: "
|
||||
if payload[linkOffset + 7] == 0x00:
|
||||
if payload[linkOffset + 7] == 0x04:
|
||||
ret += f"8° 窄波束 (0x{payload[linkOffset + 7]:02X})\n"
|
||||
elif payload[linkOffset + 7] == 0x10:
|
||||
elif payload[linkOffset + 7] == 0x03:
|
||||
ret += f"25° 次波束 (0x{payload[linkOffset + 7]:02X})\n"
|
||||
elif payload[linkOffset + 7] == 0x20:
|
||||
elif payload[linkOffset + 7] == 0x02:
|
||||
ret += f"60° 次波束 (0x{payload[linkOffset + 7]:02X})\n"
|
||||
elif payload[linkOffset + 7] == 0x30:
|
||||
elif payload[linkOffset + 7] == 0x01:
|
||||
ret += f"120° 宽波束 (0x{payload[linkOffset + 7]:02X})\n"
|
||||
else:
|
||||
ret += f"【未知错误】(0x{payload[linkOffset + 7]:02X})\n"
|
||||
@@ -377,7 +377,7 @@ class Plugin(Plugin_Base):
|
||||
ret += f"MGC 3~4: {payload[hwOffset+10] & 0x0f:>2d} - {payload[hwOffset+10] >> 4:>2d}\n"
|
||||
|
||||
ret += "--------------------------------\n"
|
||||
return ret
|
||||
return ret + '\n' + printFrame(data)
|
||||
|
||||
def onSent(self, ok, msg, length, path):
|
||||
if ok:
|
||||
|
||||
@@ -1137,15 +1137,17 @@ static int32_t Linklayer_Routine(L2_INST *instPtr)
|
||||
L2_IterEditNode(instPtr->nodeList, &increment, IntcNodeTTL);
|
||||
|
||||
#ifdef DATALINK_ENABLE_AUTORECONNECT
|
||||
L2_IterDeleteNode(instPtr->nodeList, IsNodeConnected);
|
||||
if (L2_GetNodeListLen(instPtr->nodeList) < instPtr->config.netScale - 1)
|
||||
{
|
||||
// reset scan process
|
||||
L2_EVENT l2Event;
|
||||
// Assert Net-Setup Done.
|
||||
l2Event.event = (L2_GetNodeType(instPtr) == L2_NODE_HEAD) ? L2_EV_LOST_NODE : L2_EV_LOST_CXN;
|
||||
l2Event.msg = NULL;
|
||||
AssertL2Event(instPtr, &l2Event);
|
||||
if(L2_GetMainState(instPtr) != L2_INIT_STATE){
|
||||
L2_IterDeleteNode(instPtr->nodeList, IsNodeConnected);
|
||||
if (L2_GetNodeListLen(instPtr->nodeList) < instPtr->config.netScale - 1)
|
||||
{
|
||||
// reset scan process
|
||||
L2_EVENT l2Event;
|
||||
// Assert Net-Setup Done.
|
||||
l2Event.event = (L2_GetNodeType(instPtr) == L2_NODE_HEAD) ? L2_EV_LOST_NODE : L2_EV_LOST_CXN;
|
||||
l2Event.msg = NULL;
|
||||
AssertL2Event(instPtr, &l2Event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Status;
|
||||
|
||||
@@ -134,7 +134,6 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
||||
// L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD_ID, L2_MSG_SVC_PAYLOAD_ID_LEN, &dataId);
|
||||
// L2_FrameInsertChunk(buff, L2_MSG_SVC_PAYLOAD, L2_MSG_SVC_PAYLOAD_LEN, testData);
|
||||
|
||||
|
||||
Status = L2_CrcAppend(buff, L2_SVC_PACK_LEN - L2_MSG_SVC_CRC_LEN, L2_MSG_SVC_CRC, L2_CRC16_1021);
|
||||
if (Status != SUCCESS)
|
||||
{
|
||||
@@ -410,6 +409,7 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
||||
memcpy(instPtr->sendPktData, testData, L2_SVC_PACK_LEN);
|
||||
#endif
|
||||
}
|
||||
L2_SetupNextSlot(instPtr, torState, L2_SVC_FRAME);
|
||||
break;
|
||||
default:
|
||||
DBG_ERROR("UNKNOWN slot type [%" PRIu8 "].\n", rtneEntry->slotType);
|
||||
|
||||
@@ -101,7 +101,8 @@
|
||||
// -- Request
|
||||
#define WD_EN_CMD 0x02
|
||||
#define EN_CMD_ON_HIGH_POWER 0x66
|
||||
#define EN_CMD_ON_LOW_POWER 0x88
|
||||
#define EN_CMD_ON_LOW_POWER 0x77
|
||||
#define EN_CMD_SILENT 0x88
|
||||
|
||||
#define WD_MODE_CMD 0x03
|
||||
#define MODE_CMD_HEAD 0x11
|
||||
@@ -392,6 +393,7 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
{
|
||||
PHY_INST *phyRef = linkInstPtr->config.phyInstPtr;
|
||||
TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr;
|
||||
bool reconfig = false;
|
||||
|
||||
if (data[WD_MODE_CMD] == MODE_CMD_HEAD)
|
||||
{
|
||||
@@ -401,6 +403,7 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
// head node config
|
||||
linkConfig.myType = L2_NODE_HEAD;
|
||||
linkConfig.myId = 1;
|
||||
reconfig = true;
|
||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||
}
|
||||
}
|
||||
@@ -412,15 +415,14 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
{
|
||||
// member node config
|
||||
linkConfig.myType = L2_NODE_MEMBER;
|
||||
linkConfig.myId = 2;
|
||||
linkConfig.myId = 2
|
||||
reconfig = true;
|
||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: to confirm
|
||||
// Halt linklayer
|
||||
Linklayer_Halt(linkInstPtr);
|
||||
// Do not response
|
||||
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
||||
WD_MODE_CMD, data[WD_MODE_CMD]);
|
||||
Status = EPARAM;
|
||||
@@ -437,10 +439,9 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
// low power config
|
||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_LOW_POWER);
|
||||
}
|
||||
else
|
||||
else if(data[WD_EN_CMD] == EN_CMD_SILENT)
|
||||
{
|
||||
// silence config
|
||||
// FIXME: confirm
|
||||
// TODO: better approach?
|
||||
Linklayer_Halt(linkInstPtr);
|
||||
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_SILENT);
|
||||
@@ -454,8 +455,19 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_10MS_FRAME, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
Linklayer_Start(linkInstPtr);
|
||||
else
|
||||
{
|
||||
// Do not response
|
||||
DBG_ERROR("Unexpected config command 0x%02X:0x%02X",
|
||||
WD_EN_CMD, data[WD_EN_CMD]);
|
||||
Status = EPARAM;
|
||||
break;
|
||||
}
|
||||
if (reconfig == true)
|
||||
{
|
||||
Linklayer_Reconfig(linkInstPtr, &linkConfig);
|
||||
Linklayer_Start(linkInstPtr);
|
||||
}
|
||||
instPtr->sysbusLog.lastConfig[0] = data[WD_MODE_CMD];
|
||||
instPtr->sysbusLog.lastConfig[1] = data[WD_EN_CMD];
|
||||
Status = SUCCESS;
|
||||
@@ -579,7 +591,7 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
TIME_WORD tmWord;
|
||||
uint64_t time;
|
||||
TimeCtrl_GetCurrentTime(linkInstPtr->config.tmcInstPtr, &tmWord);
|
||||
time = tmWord.int_part * TIME_FRAC_MAX + tmWord.frac_part;
|
||||
time = (uint64_t)tmWord.int_part * TIME_FRAC_MAX + tmWord.frac_part;
|
||||
memcpy(sysbusRsp->data + WD_FLJ_TIME_STAMP, &time, WD_FLJ_TIME_STAMP_LEN);
|
||||
SysMonitor_GetLinklayerLog(&(instPtr->linkLog));
|
||||
SysMonitor_GetPhysicalLayerLog(&(instPtr->phyLog));
|
||||
@@ -622,7 +634,7 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
|
||||
TIME_WORD tmWord;
|
||||
uint64_t time;
|
||||
TimeCtrl_GetCurrentTime(linkInstPtr->config.tmcInstPtr, &tmWord);
|
||||
time = tmWord.int_part * TIME_FRAC_MAX + tmWord.frac_part;
|
||||
time = (uint64_t)tmWord.int_part * TIME_FRAC_MAX + tmWord.frac_part;
|
||||
memcpy(sysbusRsp->data + WD_LJ_TIME_STAMP, &time, WD_LJ_TIME_STAMP_LEN);
|
||||
SysMonitor_GetLinklayerLog(&(instPtr->linkLog));
|
||||
SysMonitor_GetPhysicalLayerLog(&(instPtr->phyLog));
|
||||
|
||||
Reference in New Issue
Block a user