Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

per-board generic option in config file boards.txt for disabling control of dtr+rts ... #4102

Merged
merged 1 commit into from
Jul 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions arduino-core/src/processing/app/Serial.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,35 @@ public Serial() throws SerialException {
PreferencesData.getInteger("serial.debug_rate", 9600),
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
PreferencesData.getInteger("serial.databits", 8),
PreferencesData.getFloat("serial.stopbits", 1));
PreferencesData.getFloat("serial.stopbits", 1),
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
}

public Serial(int irate) throws SerialException {
this(PreferencesData.get("serial.port"), irate,
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
PreferencesData.getInteger("serial.databits", 8),
PreferencesData.getFloat("serial.stopbits", 1));
PreferencesData.getFloat("serial.stopbits", 1),
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
}

public Serial(String iname, int irate) throws SerialException {
this(iname, irate, PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
PreferencesData.getInteger("serial.databits", 8),
PreferencesData.getFloat("serial.stopbits", 1));
PreferencesData.getFloat("serial.stopbits", 1),
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
}

public Serial(String iname) throws SerialException {
this(iname, PreferencesData.getInteger("serial.debug_rate", 9600),
PreferencesData.getNonEmpty("serial.parity", "N").charAt(0),
PreferencesData.getInteger("serial.databits", 8),
PreferencesData.getFloat("serial.stopbits", 1));
PreferencesData.getFloat("serial.stopbits", 1),
!BaseNoGui.getBoardPreferences().get("serial.disableRTS").equalsIgnoreCase("true"),
!BaseNoGui.getBoardPreferences().get("serial.disableDTR").equalsIgnoreCase("true"));
}

public static boolean touchForCDCReset(String iname) throws SerialException {
Expand All @@ -96,7 +104,7 @@ public static boolean touchForCDCReset(String iname) throws SerialException {
}
}

private Serial(String iname, int irate, char iparity, int idatabits, float istopbits) throws SerialException {
private Serial(String iname, int irate, char iparity, int idatabits, float istopbits, boolean setRTS, boolean setDTR) throws SerialException {
//if (port != null) port.close();
//this.parent = parent;
//parent.attach(this);
Expand All @@ -112,7 +120,7 @@ private Serial(String iname, int irate, char iparity, int idatabits, float istop
try {
port = new SerialPort(iname);
port.openPort();
boolean res = port.setParams(irate, idatabits, stopbits, parity, true, true);
boolean res = port.setParams(irate, idatabits, stopbits, parity, setRTS, setDTR);
if (!res) {
System.err.println(format(tr("Error while setting serial port parameters: {0} {1} {2} {3}"),
irate, iparity, idatabits, istopbits));
Expand Down