application: minor, redability
This commit is contained in:
parent
d27eff0882
commit
a58df32707
|
@ -1386,24 +1386,17 @@ void main(void)
|
|||
// start cable detection
|
||||
cable_clear(cable_next); // clear definition
|
||||
cable_detect(cable_next); // detect connected connectors
|
||||
if (NULL == cable_next->connections && cable_next->connections_nb > 0) {
|
||||
printf("EOMEM\n");
|
||||
while (true);
|
||||
}
|
||||
// if there is a cable, we need to identify it further
|
||||
if (0 != cable_next->connections_nb) {
|
||||
if (cable_next->connections && 0 != cable_next->connections_nb) {
|
||||
cable_connectors(cable_next); // first identify the connectors
|
||||
cable_cables(cable_next); // find cables with matching connector set
|
||||
cable_issues_nb(cable_next); // calculate score for cables (updates the connections)
|
||||
if (NULL == cable_next->connections || 0 == cable_next->connections_nb) {
|
||||
printf("EOMEM\n");
|
||||
while (true);
|
||||
}
|
||||
}
|
||||
// compare next to current cable
|
||||
if (cable_current->connections_nb != cable_next->connections_nb) {
|
||||
cable_changed = true; // note it changed, but don't do anything until change is confirmed a second time
|
||||
} else { // same number of connections
|
||||
// check if they are all the same connections (the search order is the same)
|
||||
bool match = true;
|
||||
for (uint16_t i = 0; i < cable_current->connections_nb && i < cable_next->connections_nb && match; i++) {
|
||||
if (cable_current->connections[i][0] != cable_next->connections[i][0] || cable_current->connections[i][1] != cable_next->connections[i][1]) {
|
||||
|
|
Loading…
Reference in New Issue