tj30_test check id

This commit is contained in:
Chinky 2024-03-15 17:22:27 +08:00
parent 750fc89ebb
commit 1bdff2341d
2 changed files with 20 additions and 13 deletions

View File

@ -7,5 +7,6 @@
"random": "c",
"logn.h": "c",
"timesize.h": "c"
}
},
"cmake.configureOnOpen": true
}

View File

@ -444,6 +444,15 @@ void tj30_test(char *ifname)
goto __exit;
}
printf("%d slaves found and configured.\n", ec_slavecount);
/* check for TJ30-1616DN */
for (cnt = 1; cnt <= ec_slavecount; cnt++)
{
if (ec_slave[cnt].eep_id != 0x00010200)
{
printf("Slave %i: ID (%u) 不匹配!\n", cnt, ec_slave[cnt].eep_id);
goto __exit;
}
}
/* wait for all slaves to reach SAFE_OP state */
ec_statecheck(0, EC_STATE_SAFE_OP, EC_TIMEOUTSTATE);
@ -456,18 +465,15 @@ void tj30_test(char *ifname)
{
int32_t sn = ecEepromGetSN(cnt);
logn(F_B_BLUE,
"Slave:%d Name:%s SN:" CSI_START B_B_WHITE "%d" CSI_END CSI_START F_B_BLUE
" Output size:%3dbits Input size:%3dbits State:%2d delay:%3d\n",
cnt, ec_slave[cnt].name, sn, ec_slave[cnt].Obits, ec_slave[cnt].Ibits,
ec_slave[cnt].state, (int)ec_slave[cnt].pdelay);
logn(F_B_BLUE, "DC:%2d Out:%p,%4d In:%p,%4d\n", ec_slave[cnt].hasdc,
ec_slave[cnt].outputs, ec_slave[cnt].Obytes, ec_slave[cnt].inputs,
ec_slave[cnt].Ibytes);
// /* check for TJ30-1616DN */
// if (!digout && (ec_slave[cnt].eep_id == 85301616))
// {
// digout = ec_slave[cnt].outputs;
// }
"Slave:%d Name:%s ID: " CSI_START B_B_WHITE "%u/0x%08x" CSI_END CSI_START F_B_BLUE
" SN:" CSI_START B_B_WHITE "%d" CSI_END CSI_START F_B_BLUE
" Output size:%3dbits Input size:%3dbits\n",
cnt, ec_slave[cnt].name, ec_slave[cnt].eep_id, ec_slave[cnt].eep_id, sn,
ec_slave[cnt].Obits, ec_slave[cnt].Ibits);
logn(F_B_BLUE, "State:%2d delay:%3d DC:%2d Out:%p,%4d In:%p,%4d\n", ec_slave[cnt].state,
(int)ec_slave[cnt].pdelay, ec_slave[cnt].hasdc, ec_slave[cnt].outputs,
ec_slave[cnt].Obytes, ec_slave[cnt].inputs, ec_slave[cnt].Ibytes);
io_test[cnt].input_bytes = ec_slave[cnt].Ibytes;
if (io_test[cnt].input_bytes == 0 && ec_slave[cnt].Ibits > 0)
{