feat(comm): 1.6.22 稀疏写 ESC + 1.6.23~24 pmDrive 电源管理; LAN9252 性能审计报告
This commit is contained in:
@@ -154,6 +154,37 @@ void EthercatPdo::writeInputs(uint8_t *esc)
|
||||
++s_inputCycles;
|
||||
}
|
||||
|
||||
bool EthercatPdo::sparseEscWritePlan(uint16_t *off0, uint16_t *len0,
|
||||
uint16_t *off1, uint16_t *len1)
|
||||
{
|
||||
if (off0 == nullptr || len0 == nullptr || off1 == nullptr || len1 == nullptr) {
|
||||
return false;
|
||||
}
|
||||
#if !CONFIG_ECAT_SPARSE_ESC_WRITE
|
||||
return false;
|
||||
#else
|
||||
/* 仅 1.6.21 密排布局:count 有效且两段之间确有空洞才分段。
|
||||
* magic 不对 / count 越界 / count 撑满到与段3相接 → 整包,避免陈旧空洞被误读。 */
|
||||
if (s_in[ECAT_MOTW_OFF_MAGIC] != kEcatMotLayoutMagic) {
|
||||
return false;
|
||||
}
|
||||
const uint8_t count = s_in[ECAT_MOTW_OFF_COUNT];
|
||||
if (count > kEcatMotSlotsPerPdo) {
|
||||
return false;
|
||||
}
|
||||
const uint16_t headEnd =
|
||||
(uint16_t)(ECAT_MOTW_OFF_SLOTS + (uint16_t)count * kEcatMotSlotSize);
|
||||
if (headEnd >= ECAT_XRX_OFF_CH) {
|
||||
return false; /* 9 电机满配:A+B 无缝,整包更省一次 EXMC 事务 */
|
||||
}
|
||||
*off0 = 0U;
|
||||
*len0 = headEnd;
|
||||
*off1 = ECAT_XRX_OFF_CH;
|
||||
*len1 = (uint16_t)(kPdoInBytes - ECAT_XRX_OFF_CH);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void EthercatPdo::snapshotOutput(uint8_t *dst)
|
||||
{
|
||||
if (dst == nullptr) {
|
||||
@@ -186,4 +217,12 @@ void EcatPdo_WriteInputs(uint8_t *esc)
|
||||
EthercatPdo::writeInputs(esc);
|
||||
}
|
||||
|
||||
/* 1.6.22 稀疏写计划:SSC PDO_InputMapping 据此决定 HW_EscWriteIsr 写几段。
|
||||
* 返回 1=两段有效;0=回退整包。 */
|
||||
uint8_t EcatPdo_SparseEscPlan(uint16_t *off0, uint16_t *len0,
|
||||
uint16_t *off1, uint16_t *len1)
|
||||
{
|
||||
return EthercatPdo::sparseEscWritePlan(off0, len0, off1, len1) ? 1U : 0U;
|
||||
}
|
||||
|
||||
} /* extern "C" */
|
||||
|
||||
Reference in New Issue
Block a user