diff --git a/app/src/processing/app/AbstractTextMonitor.java b/app/src/processing/app/AbstractTextMonitor.java index d6d256b1c..00eabb206 100644 --- a/app/src/processing/app/AbstractTextMonitor.java +++ b/app/src/processing/app/AbstractTextMonitor.java @@ -190,14 +190,9 @@ public abstract class AbstractTextMonitor extends AbstractMonitor { textArea.setBackground(new Color(238, 238, 238)); } textArea.invalidate(); - clearButton.setEnabled(enable); scrollPane.setEnabled(enable); textField.setEnabled(enable); sendButton.setEnabled(enable); - autoscrollBox.setEnabled(enable); - addTimeStampBox.setEnabled(enable); - lineEndings.setEnabled(enable); - serialRates.setEnabled(enable); } public void onSendCommand(ActionListener listener) { diff --git a/app/src/processing/app/SerialMonitor.java b/app/src/processing/app/SerialMonitor.java index 9af95d8d4..b2656ca65 100644 --- a/app/src/processing/app/SerialMonitor.java +++ b/app/src/processing/app/SerialMonitor.java @@ -48,14 +48,16 @@ public class SerialMonitor extends AbstractTextMonitor { String rateString = wholeString.substring(0, wholeString.indexOf(' ')); serialRate = Integer.parseInt(rateString); PreferencesData.set("serial.debug_rate", rateString); - try { - close(); - Thread.sleep(100); // Wait for serial port to properly close - open(); - } catch (InterruptedException e) { - // noop - } catch (Exception e) { - System.err.println(e); + if (serial != null) { + try { + close(); + Thread.sleep(100); // Wait for serial port to properly close + open(); + } catch (InterruptedException e) { + // noop + } catch (Exception e) { + System.err.println(e); + } } }); diff --git a/app/src/processing/app/SerialPlotter.java b/app/src/processing/app/SerialPlotter.java index 45a52a454..035005ac3 100644 --- a/app/src/processing/app/SerialPlotter.java +++ b/app/src/processing/app/SerialPlotter.java @@ -242,12 +242,14 @@ public class SerialPlotter extends AbstractMonitor { String rateString = wholeString.substring(0, wholeString.indexOf(' ')); serialRate = Integer.parseInt(rateString); PreferencesData.set("serial.debug_rate", rateString); - try { - close(); - Thread.sleep(100); // Wait for serial port to properly close - open(); - } catch (Exception e) { - // ignore + if (serial != null) { + try { + close(); + Thread.sleep(100); // Wait for serial port to properly close + open(); + } catch (Exception e) { + // ignore + } } }); @@ -379,10 +381,8 @@ public class SerialPlotter extends AbstractMonitor { } protected void onEnableWindow(boolean enable) { - serialRates.setEnabled(enable); textField.setEnabled(enable); sendButton.setEnabled(enable); - lineEndings.setEnabled(enable); } private void onSerialRateChange(ActionListener listener) {