application: add load check to intra connection test

This commit is contained in:
King Kévin 2019-12-26 17:13:24 +01:00
parent 4fd46c1133
commit 6b228c18af
1 changed files with 10 additions and 6 deletions

View File

@ -942,22 +942,26 @@ static void command_connections(void* argument)
if (intra) {
printf("= testing internal connections =\n");
for (uint8_t i = 0; i < LENGTH(usb_connectors); i++) {
// test pin connections
const struct usb_connector_t* connector = usb_connectors[i];
connections = (uint8_t (*)[2])usb_cables_test_connections(&connector, 1, true, false, &connections_nb);
if (NULL == connections) {
if (connections_nb) {
printf("no memory available\n");
}
if (NULL == connections && connections_nb) {
printf("no memory available\n");
}
// check if there is a load on the cable
bool load = usb_cables_test_load(connector);
if (0 == connections_nb && !load) {
continue;
}
printf("%s ", connector->name);
printf("%s", connector->name);
if (connector->variant) {
printf("(%s) ", connector->variant);
printf(" (%s)", connector->variant);
}
printf(": %u connection(s)\n", connections_nb);
for (uint16_t connection = 0; connection < connections_nb; connection++) {
printf("- %s to %s\n", usb_pins[connections[connection][0]].name, usb_pins[connections[connection][1]].name);
}
printf("there is %s load on the connector\n", load ? "a" : "no");
if (connections) {
free(connections);
connections = NULL;