()
| 2103 | } |
| 2104 | |
| 2105 | private void resumeOrCloseSerialMonitor() { |
| 2106 | // Return the serial monitor window to its initial state |
| 2107 | if (serialMonitor != null) { |
| 2108 | try { |
| 2109 | Thread.sleep(200); |
| 2110 | } catch (InterruptedException e) { |
| 2111 | // noop |
| 2112 | } |
| 2113 | BoardPort boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port")); |
| 2114 | long sleptFor = 0; |
| 2115 | while (boardPort == null && sleptFor < MAX_TIME_AWAITING_FOR_RESUMING_SERIAL_MONITOR) { |
| 2116 | try { |
| 2117 | Thread.sleep(100); |
| 2118 | sleptFor += 100; |
| 2119 | boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port")); |
| 2120 | } catch (InterruptedException e) { |
| 2121 | // noop |
| 2122 | } |
| 2123 | } |
| 2124 | try { |
| 2125 | if (serialMonitor != null) { |
| 2126 | serialMonitor.resume(boardPort); |
| 2127 | if (boardPort == null) { |
| 2128 | serialMonitor.close(); |
| 2129 | handleSerial(); |
| 2130 | } else { |
| 2131 | serialMonitor.resume(boardPort); |
| 2132 | } |
| 2133 | } |
| 2134 | } catch (Exception e) { |
| 2135 | statusError(e); |
| 2136 | } |
| 2137 | } |
| 2138 | } |
| 2139 | |
| 2140 | private void resumeOrCloseSerialPlotter() { |
| 2141 | // Return the serial plotter window to its initial state |
no test coverage detected