Skip to content

Commit 281d291

Browse files
committed
Merge pull request #4 from Sermus/esp8266_disable_SerialMonitor_RTSDTR
Add option to disable DTR and RTS in serial monitor
2 parents 422a446 + 7b9afd1 commit 281d291

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().get("serial.disableRTS") == null,
62+
BaseNoGui.getBoardPreferences().get("serial.disableDTR") == null);
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().get("serial.disableRTS") == null,
71+
BaseNoGui.getBoardPreferences().get("serial.disableDTR") == null);
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().get("serial.disableRTS") == null,
79+
BaseNoGui.getBoardPreferences().get("serial.disableDTR") == null);
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().get("serial.disableRTS") == null,
88+
BaseNoGui.getBoardPreferences().get("serial.disableDTR") == null);
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
@@ -8,6 +8,8 @@ esp01.upload.speed=115200
88
esp01.upload.resetmethod=none
99
esp01.upload.maximum_size=524288
1010
esp01.upload.wait_for_upload_port=true
11+
esp01.serial.disableDTR=true
12+
esp01.serial.disableRTS=true
1113

1214
esp01.build.mcu=esp8266
1315
esp01.build.f_cpu=80000000L

0 commit comments

Comments
 (0)