Skip to content

Commit 1340c35

Browse files
Reformat white space - no real changes here
1 parent 9c55077 commit 1340c35

File tree

1 file changed

+80
-81
lines changed

1 file changed

+80
-81
lines changed

app/src/processing/app/SerialMonitor.java

Lines changed: 80 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -367,24 +367,24 @@ public void actionPerformed(ActionEvent e) {
367367
}
368368

369369
class FakeSerial extends Serial {
370-
Socket sock=null;
371-
inputListener listener=null;
372-
int[] addrlist = {28541,4984,18924,16924,27183,31091};
373-
static Process gateway=null;
374-
static boolean gateway_shutdown_scheduled=false;
375-
376-
public FakeSerial(String name) throws SerialException {
377-
super("fake serial");
378-
int attempt=1;
379-
do {
380-
if (gateway_connect(name)) return;
381-
if (attempt <= 2 && !gateway_start(name)) {
382-
System.err.println("Error starting " + name);
383-
}
384-
delay_20ms();
385-
} while (++attempt < 4);
386-
throw new SerialException("no connection");
387-
}
370+
Socket sock=null;
371+
inputListener listener=null;
372+
int[] addrlist = {28541,4984,18924,16924,27183,31091};
373+
static Process gateway=null;
374+
static boolean gateway_shutdown_scheduled=false;
375+
376+
public FakeSerial(String name) throws SerialException {
377+
super("fake serial");
378+
int attempt=1;
379+
do {
380+
if (gateway_connect(name)) return;
381+
if (attempt <= 2 && !gateway_start(name)) {
382+
System.err.println("Error starting " + name);
383+
}
384+
delay_20ms();
385+
} while (++attempt < 4);
386+
throw new SerialException("no connection");
387+
}
388388

389389
private boolean gateway_connect(String name) {
390390
int namelen = name.length();
@@ -461,13 +461,12 @@ public void dispose() {
461461
dispose_gateway();
462462
}
463463

464-
public static void dispose_gateway() {
465-
if (gateway != null) {
466-
gateway.destroy();
467-
gateway = null;
468-
}
469-
}
470-
464+
public static void dispose_gateway() {
465+
if (gateway != null) {
466+
gateway.destroy();
467+
gateway = null;
468+
}
469+
}
471470

472471
private boolean gateway_start(String cmd) {
473472
String path = Base.getHardwarePath() + "/tools/";
@@ -488,66 +487,66 @@ public void run() {
488487
return true;
489488
}
490489

491-
public void addListener(MessageConsumer c) {
492-
if (sock == null) return;
493-
if (listener != null) listener.interrupt();
494-
listener = new inputListener();
495-
listener.input = input;
496-
listener.consumer = c;
497-
listener.start();
498-
}
499-
500-
public void write(byte bytes[]) {
501-
if (output == null) return;
502-
if (bytes.length > 0) {
503-
try {
504-
output.write(bytes, 0, bytes.length);
505-
} catch (IOException e) { }
506-
}
507-
}
508-
public void setDTR(boolean state) {
509-
}
510-
static public ArrayList<String> list() {
511-
return new ArrayList<String>();
512-
}
490+
public void addListener(MessageConsumer c) {
491+
if (sock == null) return;
492+
if (listener != null) listener.interrupt();
493+
listener = new inputListener();
494+
listener.input = input;
495+
listener.consumer = c;
496+
listener.start();
497+
}
498+
499+
public void write(byte bytes[]) {
500+
if (output == null) return;
501+
if (bytes.length > 0) {
502+
try {
503+
output.write(bytes, 0, bytes.length);
504+
} catch (IOException e) { }
505+
}
506+
}
507+
public void setDTR(boolean state) {
508+
}
509+
static public ArrayList<String> list() {
510+
return new ArrayList<String>();
511+
}
513512
}
514513

515514
class RestartCommand {
516-
private Process restarter=null;
517-
private Serial s=null;
518-
public RestartCommand(String port) {
519-
if (Base.getBoardMenuPreference("fake_serial") == null) {
520-
try {
521-
s = new Serial(port, 150);
522-
} catch (SerialException e) {
523-
s = null;
524-
}
525-
} else {
526-
String path = Base.getHardwarePath() + "/tools/";
527-
try {
528-
restarter = Runtime.getRuntime().exec(path + "teensy_restart");
529-
} catch (Exception e) {
530-
}
531-
}
532-
}
533-
public Serial getSerial() {
534-
return s;
535-
}
515+
private Process restarter=null;
516+
private Serial s=null;
517+
public RestartCommand(String port) {
518+
if (Base.getBoardMenuPreference("fake_serial") == null) {
519+
try {
520+
s = new Serial(port, 150);
521+
} catch (SerialException e) {
522+
s = null;
523+
}
524+
} else {
525+
String path = Base.getHardwarePath() + "/tools/";
526+
try {
527+
restarter = Runtime.getRuntime().exec(path + "teensy_restart");
528+
} catch (Exception e) {
529+
}
530+
}
531+
}
532+
public Serial getSerial() {
533+
return s;
534+
}
536535
}
537536

538537
class inputListener extends Thread {
539-
MessageConsumer consumer;
540-
InputStream input;
541-
542-
public void run() {
543-
byte[] buffer = new byte[1024];
544-
int num, errcount=0;
545-
try {
546-
while (true) {
547-
num = input.read(buffer);
548-
if (num <= 0) break;
549-
consumer.message(new String(buffer, 0, num));
550-
}
551-
} catch (Exception e) { }
552-
}
538+
MessageConsumer consumer;
539+
InputStream input;
540+
541+
public void run() {
542+
byte[] buffer = new byte[1024];
543+
int num, errcount=0;
544+
try {
545+
while (true) {
546+
num = input.read(buffer);
547+
if (num <= 0) break;
548+
consumer.message(new String(buffer, 0, num));
549+
}
550+
} catch (Exception e) { }
551+
}
553552
}

0 commit comments

Comments
 (0)