mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
Slightly optimized method by removing redundant boolean flag
This commit is contained in:
parent
80fb9a0b38
commit
5bc96652e6
@ -162,19 +162,18 @@ public class SerialDiscovery implements Discovery, Runnable {
|
|||||||
Map<String, Object> boardData = platform.resolveDeviceByVendorIdProductId(port, BaseNoGui.packages);
|
Map<String, Object> boardData = platform.resolveDeviceByVendorIdProductId(port, BaseNoGui.packages);
|
||||||
|
|
||||||
BoardPort boardPort = null;
|
BoardPort boardPort = null;
|
||||||
boolean updatingInfos = false;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
// create new board or update existing
|
// create new board or update existing
|
||||||
for (BoardPort board : boardPorts) {
|
for (BoardPort board : boardPorts) {
|
||||||
if (board.toString().equals(newPort)) {
|
if (board.toString().equals(newPort)) {
|
||||||
updatingInfos = true;
|
|
||||||
boardPort = boardPorts.get(i);
|
boardPort = boardPorts.get(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (!updatingInfos) {
|
if (boardPort == null) {
|
||||||
boardPort = new BoardPort();
|
boardPort = new BoardPort();
|
||||||
|
boardPorts.add(boardPort);
|
||||||
}
|
}
|
||||||
boardPort.setAddress(port);
|
boardPort.setAddress(port);
|
||||||
boardPort.setProtocol("serial");
|
boardPort.setProtocol("serial");
|
||||||
@ -216,9 +215,6 @@ public class SerialDiscovery implements Discovery, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boardPort.setLabel(label);
|
boardPort.setLabel(label);
|
||||||
if (!updatingInfos) {
|
|
||||||
boardPorts.add(boardPort);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setSerialBoardPorts(boardPorts);
|
setSerialBoardPorts(boardPorts);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user