mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Moving serial error messages into the serial monitor (out of the editor).
This commit is contained in:
parent
a258042deb
commit
678e09896f
@ -101,8 +101,6 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
static SerialMenuListener serialMenuListener;
|
||||
static SerialMonitor serialMonitor;
|
||||
|
||||
static Editor activeEditor;
|
||||
|
||||
EditorHeader header;
|
||||
EditorStatus status;
|
||||
EditorConsole console;
|
||||
@ -162,8 +160,6 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
// When bringing a window to front, let the Base know
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowActivated(WindowEvent e) {
|
||||
activeEditor = Editor.this;
|
||||
|
||||
base.handleActivated(Editor.this);
|
||||
|
||||
// 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());
|
||||
Preferences.set("serial.port", name);
|
||||
//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) {
|
||||
statusEmpty();
|
||||
|
||||
if (!showSerialMonitor && !serialMonitor.isVisible()) return;
|
||||
|
||||
try {
|
||||
serialMonitor.openSerialPort(Preferences.get("serial.port"));
|
||||
serialMonitor.setVisible(true);
|
||||
} catch (SerialException e) {
|
||||
statusError(e.getMessage());
|
||||
serialMonitor.setVisible(false);
|
||||
}
|
||||
serialMonitor.setVisible(true);
|
||||
serialMonitor.openSerialPort(Preferences.get("serial.port"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,6 +33,7 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
||||
private JTextField textField;
|
||||
private JButton sendButton;
|
||||
private JComboBox serialRates;
|
||||
private JLabel statusLabel;
|
||||
|
||||
public SerialMonitor() {
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@ -73,7 +74,12 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
||||
|
||||
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 = {
|
||||
"300","1200","2400","4800","9600","14400",
|
||||
@ -91,11 +97,12 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
||||
String rateString = wholeString.substring(0, wholeString.indexOf(' '));
|
||||
int rate = Integer.parseInt(rateString);
|
||||
Preferences.set("serial.debug_rate", rateString);
|
||||
String port = SerialMonitor.this.port;
|
||||
closeSerialPort();
|
||||
Editor.activeEditor.handleSerial(true);
|
||||
openSerialPort(port);
|
||||
}});
|
||||
|
||||
pane.add(serialRates);
|
||||
pane.add(serialRates, BorderLayout.EAST);
|
||||
|
||||
getContentPane().add(pane, BorderLayout.SOUTH);
|
||||
|
||||
@ -107,25 +114,32 @@ public class SerialMonitor extends JFrame implements MessageConsumer {
|
||||
serial.write(s);
|
||||
}
|
||||
|
||||
public void openSerialPort(String port) throws SerialException {
|
||||
public void openSerialPort(String port) {
|
||||
if (port.equals(this.port))
|
||||
return;
|
||||
|
||||
closeSerialPort();
|
||||
|
||||
serial = new Serial(port);
|
||||
serial.addListener(this);
|
||||
setTitle(port);
|
||||
this.port = port;
|
||||
try {
|
||||
statusLabel.setText("opening...");
|
||||
serial = new Serial(port);
|
||||
serial.addListener(this);
|
||||
setTitle(port);
|
||||
this.port = port;
|
||||
statusLabel.setText("");
|
||||
} catch (SerialException e) {
|
||||
statusLabel.setText(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void closeSerialPort() {
|
||||
if (serial != null) {
|
||||
setTitle("closing...");
|
||||
statusLabel.setText("closing...");
|
||||
textArea.setText("");
|
||||
serial.dispose();
|
||||
serial = null;
|
||||
port = null;
|
||||
statusLabel.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
|
13
todo.txt
13
todo.txt
@ -3,22 +3,20 @@
|
||||
|
||||
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.
|
||||
|
||||
Add the Serial monitor.
|
||||
Don't require save before upload.
|
||||
|
||||
Add library keyword highlighting.
|
||||
|
||||
Get rid of unused preferences in the preferences dialog.
|
||||
|
||||
Don't allow in-place modification of user-installed library examples.
|
||||
|
||||
Test the FTDI drivers in the arduino.dmg.
|
||||
|
||||
Test bootloader burning w/ an AVRISP and a parallel programmer.
|
||||
|
||||
Change the colors.
|
||||
|
||||
Revise the icon.
|
||||
|
||||
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.
|
||||
|
||||
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)?
|
||||
- Delete the unneeded static functions (for classpath translation, etc.) from the bottom of the file.
|
||||
|
||||
@ -54,7 +50,6 @@ PreProcessor.java
|
||||
|
||||
Base.java
|
||||
- add keywords from libraries to the syntax coloring
|
||||
- remove "examples" folder from the examples and toolbar menus for the libraries.
|
||||
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user