omit unnecessary reconfiguration

This commit is contained in:
Gatsby Van
2024-02-01 13:45:03 +08:00
parent d0aad73ce5
commit e81be59bbb
+19 -12
View File
@@ -378,21 +378,28 @@ int32_t SystemBus_HandleCmd(SYSBUS *instPtr)
PHY_INST *phyRef = linkInstPtr->config.phyInstPtr; PHY_INST *phyRef = linkInstPtr->config.phyInstPtr;
TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr; TMC_INST *tmcRef = linkInstPtr->config.tmcInstPtr;
if (data[WD_MODE_CMD] == MODE_CMD_HEAD if (data[WD_MODE_CMD] == MODE_CMD_HEAD)
&& L2_GetNodeType(linkInstPtr) != L2_NODE_HEAD)
{ {
// head node config // omit unnecessary reconfiguration
linkConfig.myType = L2_NODE_HEAD; if (L2_GetNodeType(linkInstPtr) != L2_NODE_HEAD)
linkConfig.myId = 1; {
Linklayer_Reconfig(linkInstPtr, &linkConfig); // head node config
linkConfig.myType = L2_NODE_HEAD;
linkConfig.myId = 1;
Linklayer_Reconfig(linkInstPtr, &linkConfig);
}
} }
else if (data[WD_MODE_CMD] == MODE_CMD_MEMBER
&& L2_GetNodeType(linkInstPtr) != L2_NODE_MEMBER) else if (data[WD_MODE_CMD] == MODE_CMD_MEMBER )
{ {
// member node config // omit unnecessary reconfiguration
linkConfig.myType = L2_NODE_MEMBER; if (L2_GetNodeType(linkInstPtr) != L2_NODE_MEMBER)
linkConfig.myId = 2; {
Linklayer_Reconfig(linkInstPtr, &linkConfig); // member node config
linkConfig.myType = L2_NODE_MEMBER;
linkConfig.myId = 2;
Linklayer_Reconfig(linkInstPtr, &linkConfig);
}
} }
else else
{ {