Skip to content

Commit 0dabb25

Browse files
author
Andrey Filimonov
committed
Added to configuration options to disable ArduinoIDE SerialMonitor to set DTR and RTS active when the Monitor is opened
1 parent 3278e1a commit 0dabb25

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Diff for: arduino-core/src/processing/app/Serial.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,35 @@ public Serial() throws SerialException {
5757
PreferencesData.getInteger("serial.debug_rate"),
5858
PreferencesData.get("serial.parity").charAt(0),
5959
PreferencesData.getInteger("serial.databits"),
60-
new Float(PreferencesData.get("serial.stopbits")).floatValue());
60+
new Float(PreferencesData.get("serial.stopbits")).floatValue(),
61+
!BaseNoGui.getBoardPreferences().has("serial.disableRTS"),
62+
!BaseNoGui.getBoardPreferences().has("serial.disableDTR"));
6163
}
6264

6365
public Serial(int irate) throws SerialException {
6466
this(PreferencesData.get("serial.port"), irate,
6567
PreferencesData.get("serial.parity").charAt(0),
6668
PreferencesData.getInteger("serial.databits"),
67-
new Float(PreferencesData.get("serial.stopbits")).floatValue());
69+
new Float(PreferencesData.get("serial.stopbits")).floatValue(),
70+
!BaseNoGui.getBoardPreferences().has("serial.disableRTS"),
71+
!BaseNoGui.getBoardPreferences().has("serial.disableDTR"));
6872
}
6973

7074
public Serial(String iname, int irate) throws SerialException {
7175
this(iname, irate, PreferencesData.get("serial.parity").charAt(0),
7276
PreferencesData.getInteger("serial.databits"),
73-
new Float(PreferencesData.get("serial.stopbits")).floatValue());
77+
new Float(PreferencesData.get("serial.stopbits")).floatValue(),
78+
!BaseNoGui.getBoardPreferences().has("serial.disableRTS"),
79+
!BaseNoGui.getBoardPreferences().has("serial.disableDTR"));
7480
}
7581

7682
public Serial(String iname) throws SerialException {
7783
this(iname, PreferencesData.getInteger("serial.debug_rate"),
7884
PreferencesData.get("serial.parity").charAt(0),
7985
PreferencesData.getInteger("serial.databits"),
80-
new Float(PreferencesData.get("serial.stopbits")).floatValue());
86+
new Float(PreferencesData.get("serial.stopbits")).floatValue(),
87+
!BaseNoGui.getBoardPreferences().has("serial.disableRTS"),
88+
!BaseNoGui.getBoardPreferences().has("serial.disableDTR"));
8189
}
8290

8391
public static boolean touchPort(String iname, int irate) throws SerialException {
@@ -100,7 +108,7 @@ public static boolean touchPort(String iname, int irate) throws SerialException
100108
}
101109
}
102110

103-
public Serial(String iname, int irate, char iparity, int idatabits, float istopbits) throws SerialException {
111+
public Serial(String iname, int irate, char iparity, int idatabits, float istopbits, boolean setRTS, boolean setDTR) throws SerialException {
104112
//if (port != null) port.close();
105113
//this.parent = parent;
106114
//parent.attach(this);
@@ -120,7 +128,7 @@ public Serial(String iname, int irate, char iparity, int idatabits, float istopb
120128
try {
121129
port = new SerialPort(iname);
122130
port.openPort();
123-
port.setParams(rate, databits, stopbits, parity, true, true);
131+
port.setParams(rate, databits, stopbits, parity, setRTS, setDTR);
124132
port.addEventListener(this);
125133
} catch (Exception e) {
126134
throw new SerialException(I18n.format(_("Error opening serial port ''{0}''."), iname), e);

Diff for: hardware/esp8266com/esp8266/boards.txt

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ esp01.upload.speed=115200
66
esp01.upload.resetmethod=none
77
esp01.upload.maximum_size=524288
88
esp01.upload.wait_for_upload_port=true
9+
esp01.serial.disableDTR=true
10+
esp01.serial.disableRTS=true
911

1012
esp01.build.mcu=esp8266
1113
esp01.build.f_cpu=80000000L

0 commit comments

Comments
 (0)