mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Moving serial error messages into the serial monitor (out of the editor).
This commit is contained in:
@ -101,8 +101,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
static SerialMenuListener serialMenuListener;
|
static SerialMenuListener serialMenuListener;
|
||||||
static SerialMonitor serialMonitor;
|
static SerialMonitor serialMonitor;
|
||||||
|
|
||||||
static Editor activeEditor;
|
|
||||||
|
|
||||||
EditorHeader header;
|
EditorHeader header;
|
||||||
EditorStatus status;
|
EditorStatus status;
|
||||||
EditorConsole console;
|
EditorConsole console;
|
||||||
@ -162,8 +160,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
// When bringing a window to front, let the Base know
|
// When bringing a window to front, let the Base know
|
||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
public void windowActivated(WindowEvent e) {
|
public void windowActivated(WindowEvent e) {
|
||||||
activeEditor = Editor.this;
|
|
||||||
|
|
||||||
base.handleActivated(Editor.this);
|
base.handleActivated(Editor.this);
|
||||||
|
|
||||||
// re-add the sub-menus that are shared by all windows
|
// re-add the sub-menus that are shared by all windows
|
||||||
@ -856,7 +852,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
//System.out.println(item.getLabel());
|
//System.out.println(item.getLabel());
|
||||||
Preferences.set("serial.port", name);
|
Preferences.set("serial.port", name);
|
||||||
//System.out.println("set to " + get("serial.port"));
|
//System.out.println("set to " + get("serial.port"));
|
||||||
activeEditor.handleSerial(false);
|
handleSerial(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2215,17 +2211,10 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
|
|
||||||
public void handleSerial(boolean showSerialMonitor) {
|
public void handleSerial(boolean showSerialMonitor) {
|
||||||
statusEmpty();
|
|
||||||
|
|
||||||
if (!showSerialMonitor && !serialMonitor.isVisible()) return;
|
if (!showSerialMonitor && !serialMonitor.isVisible()) return;
|
||||||
|
|
||||||
try {
|
|
||||||
serialMonitor.openSerialPort(Preferences.get("serial.port"));
|
|
||||||
serialMonitor.setVisible(true);
|
serialMonitor.setVisible(true);
|
||||||
} catch (SerialException e) {
|
serialMonitor.openSerialPort(Preferences.get("serial.port"));
|
||||||
statusError(e.getMessage());
|
|
||||||
serialMonitor.setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
|||||||
private JTextField textField;
|
private JTextField textField;
|
||||||
private JButton sendButton;
|
private JButton sendButton;
|
||||||
private JComboBox serialRates;
|
private JComboBox serialRates;
|
||||||
|
private JLabel statusLabel;
|
||||||
|
|
||||||
public SerialMonitor() {
|
public SerialMonitor() {
|
||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
@ -73,7 +74,12 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
|||||||
|
|
||||||
getContentPane().add(pane, BorderLayout.NORTH);
|
getContentPane().add(pane, BorderLayout.NORTH);
|
||||||
|
|
||||||
pane = new JPanel(new FlowLayout(FlowLayout.TRAILING, 4, 4));
|
pane = new JPanel(new BorderLayout(4, 0));
|
||||||
|
pane.setBorder(new EmptyBorder(4, 4, 4, 4));
|
||||||
|
|
||||||
|
statusLabel = new JLabel();
|
||||||
|
|
||||||
|
pane.add(statusLabel, BorderLayout.CENTER);
|
||||||
|
|
||||||
String[] serialRateStrings = {
|
String[] serialRateStrings = {
|
||||||
"300","1200","2400","4800","9600","14400",
|
"300","1200","2400","4800","9600","14400",
|
||||||
@ -91,11 +97,12 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
|||||||
String rateString = wholeString.substring(0, wholeString.indexOf(' '));
|
String rateString = wholeString.substring(0, wholeString.indexOf(' '));
|
||||||
int rate = Integer.parseInt(rateString);
|
int rate = Integer.parseInt(rateString);
|
||||||
Preferences.set("serial.debug_rate", rateString);
|
Preferences.set("serial.debug_rate", rateString);
|
||||||
|
String port = SerialMonitor.this.port;
|
||||||
closeSerialPort();
|
closeSerialPort();
|
||||||
Editor.activeEditor.handleSerial(true);
|
openSerialPort(port);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
pane.add(serialRates);
|
pane.add(serialRates, BorderLayout.EAST);
|
||||||
|
|
||||||
getContentPane().add(pane, BorderLayout.SOUTH);
|
getContentPane().add(pane, BorderLayout.SOUTH);
|
||||||
|
|
||||||
@ -107,25 +114,32 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
|||||||
serial.write(s);
|
serial.write(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openSerialPort(String port) throws SerialException {
|
public void openSerialPort(String port) {
|
||||||
if (port.equals(this.port))
|
if (port.equals(this.port))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
closeSerialPort();
|
closeSerialPort();
|
||||||
|
|
||||||
|
try {
|
||||||
|
statusLabel.setText("opening...");
|
||||||
serial = new Serial(port);
|
serial = new Serial(port);
|
||||||
serial.addListener(this);
|
serial.addListener(this);
|
||||||
setTitle(port);
|
setTitle(port);
|
||||||
this.port = port;
|
this.port = port;
|
||||||
|
statusLabel.setText("");
|
||||||
|
} catch (SerialException e) {
|
||||||
|
statusLabel.setText(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeSerialPort() {
|
public void closeSerialPort() {
|
||||||
if (serial != null) {
|
if (serial != null) {
|
||||||
setTitle("closing...");
|
statusLabel.setText("closing...");
|
||||||
textArea.setText("");
|
textArea.setText("");
|
||||||
serial.dispose();
|
serial.dispose();
|
||||||
serial = null;
|
serial = null;
|
||||||
port = null;
|
port = null;
|
||||||
|
statusLabel.setText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
todo.txt
13
todo.txt
@ -3,22 +3,20 @@
|
|||||||
|
|
||||||
PROCESSING 5503 SYNC
|
PROCESSING 5503 SYNC
|
||||||
|
|
||||||
Modify the compilation process according the descriptions below.
|
Serial monitor errors should appear in serial monitor.
|
||||||
|
|
||||||
Test compilation when the avr-gcc or whatever isn't found.
|
Don't require save before upload.
|
||||||
|
|
||||||
Add the Serial monitor.
|
|
||||||
|
|
||||||
Add library keyword highlighting.
|
Add library keyword highlighting.
|
||||||
|
|
||||||
|
Get rid of unused preferences in the preferences dialog.
|
||||||
|
|
||||||
Don't allow in-place modification of user-installed library examples.
|
Don't allow in-place modification of user-installed library examples.
|
||||||
|
|
||||||
Test the FTDI drivers in the arduino.dmg.
|
Test the FTDI drivers in the arduino.dmg.
|
||||||
|
|
||||||
Test bootloader burning w/ an AVRISP and a parallel programmer.
|
Test bootloader burning w/ an AVRISP and a parallel programmer.
|
||||||
|
|
||||||
Change the colors.
|
|
||||||
|
|
||||||
Revise the icon.
|
Revise the icon.
|
||||||
|
|
||||||
Check that I'm not requiring the JDK (as opposed to JRE) unnecessarily.
|
Check that I'm not requiring the JDK (as opposed to JRE) unnecessarily.
|
||||||
@ -38,8 +36,6 @@ Test the upload.using parameter to upload with a programmer.
|
|||||||
Re-enable (and fix) the Commander.
|
Re-enable (and fix) the Commander.
|
||||||
|
|
||||||
Compiler.java
|
Compiler.java
|
||||||
- Collect the target object files (.o) into a static library (.a) and link the other object files (from the sketch and libraries) against it.
|
|
||||||
- Build each library separately, with its own include path and destination (for .o files) so they don't collide with each other.
|
|
||||||
- Eliminate the need to pass a Target into the compiler by having the Compiler determine the current target (by checking the preferences directly)?
|
- Eliminate the need to pass a Target into the compiler by having the Compiler determine the current target (by checking the preferences directly)?
|
||||||
- Delete the unneeded static functions (for classpath translation, etc.) from the bottom of the file.
|
- Delete the unneeded static functions (for classpath translation, etc.) from the bottom of the file.
|
||||||
|
|
||||||
@ -54,7 +50,6 @@ PreProcessor.java
|
|||||||
|
|
||||||
Base.java
|
Base.java
|
||||||
- add keywords from libraries to the syntax coloring
|
- add keywords from libraries to the syntax coloring
|
||||||
- remove "examples" folder from the examples and toolbar menus for the libraries.
|
|
||||||
|
|
||||||
Editor.java
|
Editor.java
|
||||||
- allow the Board and Serial port to differ across editor windows. This will require creating a separate instance of the menu for each window, and passing the selections into the sketch when compiling or uploading.
|
- allow the Board and Serial port to differ across editor windows. This will require creating a separate instance of the menu for each window, and passing the selections into the sketch when compiling or uploading.
|
||||||
|
Reference in New Issue
Block a user