Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbmhunter committed Nov 1, 2018
2 parents a3d96cc + 5ea6f26 commit 402c5f2
Show file tree
Hide file tree
Showing 14 changed files with 252 additions and 100 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ NinjaTerm

- Maintainer/Primary Author: Geoffrey Hunter <[email protected]> (http://www.mbedded.ninja)
- Created: 2015-07-15
- Last Modified: 2018-05-16
- Version: v0.9.0
- Last Modified: 2018-10-31
- Version: v0.9.1
- Company: mbedded.ninja
- Project: NinjaTerm
- Language: Java, JavaFX
Expand Down
22 changes: 22 additions & 0 deletions arduino-serial/Baud027123Test/Baud027123Test.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* This code checks that NinjaTerm can handle custom baud rates.
*
* @author Geoffrey Hunter <[email protected]> (www.mbedded.ninja)
* @since 2018-10-31
* @last-modified 2018-10-31
*/

// the setup routine runs once when you press reset:
void setup() {
// Initialize serial communication
Serial.begin(27123);
}

void loop() {
Serial.println("custom");
// Wait until data is sent
Serial.flush();
}



2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ group = 'NinjaTerm'
// This version number is the master version number which needs to be updated
// manually. This version number is used to automatically set the one in the README,
// index.html, and also the one install4j uses (which in turn is the one the app uses at runtime).
version = '0.9.0'
version = '0.9.1'

// Project description, shown when
// "gradle -q projects" is called
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [v0.9.1] - 2018-10-31

### Added
- NinjaTerm now supports custom (non-standard) baud rates (as long as the underlying OS/hardware also supports it), closes #222.

## [v0.9.0] - 2018-05-17

### Changed
Expand Down
3 changes: 2 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<!-- UPDATE THE VERSION ON THE LINE BELOW -->
<!-- This will automatically all the vX.X.X's scattered through-out this page -->
<body onload="updateVersionNumber('v0.9.0')">
<body onload="updateVersionNumber('v0.9.1')">


<section class="page-header">
Expand Down Expand Up @@ -106,6 +106,7 @@ <h2>Plus more handy stuff!</h2>
<li><i>RX Freeze - </i>The incoming RX data can be "frozen" (paused) without disconnecting from the COM port.</li>
<li><i>Adjustable Wrapping Width - </i>The number of characters per line on the TX/RX displays can be adjusted.</li>
<li><i>"Always On Top" Feature - </i>The NinjaTerm window stays on top of other windows, even if it loses focus.</li>
<li><i>Custom Baud Rates - </i>NinjaTerm supports non-standard (custom) baud rates (as long as the underlying OS/hardware also supports it).</li>
</ul>

<h1><a name="installation">Installation</a></h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class ComPortSettings {

public SimpleObjectProperty<String> selComPortName = new SimpleObjectProperty<>("");
public SimpleObjectProperty<BaudRates> selBaudRate = new SimpleObjectProperty<>(BaudRates.BAUD_9600);
public SimpleObjectProperty<Integer> selBaudRate = new SimpleObjectProperty<>(9600);
public SimpleObjectProperty<NumDataBits> selNumDataBits = new SimpleObjectProperty<>(NumDataBits.EIGHT);
public SimpleObjectProperty<Parities> selParity = new SimpleObjectProperty<>(Parities.NONE);
public SimpleObjectProperty<NumStopBits> selNumStopBits = new SimpleObjectProperty<>(NumStopBits.ONE);
Expand Down
19 changes: 17 additions & 2 deletions src/main/java/ninja/mbedded/ninjaterm/resources/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @author Geoffrey Hunter <[email protected]> (www.mbedded.ninja)
* @since 2016-07-15
* @last-modified 2017-02-20
* @last-modified 2018-10-31
**/

/* ============================================================================================= */
Expand Down Expand Up @@ -110,7 +110,8 @@ tab design has no other form of indication) */

/* Makes the width of the COM port parameter comboboxes all equal. */
.comSettings .comPortParameters .combo-box {
-fx-min-width: 100px;
-fx-min-width: 150px;
-fx-max-width: 150px;
}

/* ============================================================================================= */
Expand Down Expand Up @@ -250,4 +251,18 @@ tab design has no other form of indication) */
.about Hyperlink {
-fx-fill: -colour-about-link;
-glyph-size: 30;
}

// ============================================================================================= */
// GENERAL COMBO-BOX STYLING
// ============================================================================================= */

/* text-input targets editable combo-boxes only (e.g. baud rate combo-box) */

.combo-box.error .text-input {
-fx-background-color: #FFCCCC; /* Light red */
}

.combo-box.warning .text-input {
-fx-background-color: #FFCC99; /* Light orange */
}
78 changes: 50 additions & 28 deletions src/main/java/ninja/mbedded/ninjaterm/util/comPort/BaudRates.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package ninja.mbedded.ninjaterm.util.comPort;

import java.util.ArrayList;
import java.util.List;

/**
* Enumerates most of the popular baud rates. These will be shown by default
* in the baud rate selection combobox.
Expand All @@ -8,33 +11,52 @@
* @since 2016-07-16
* @last-modified 2016-07-17
*/
public enum BaudRates {

BAUD_110("110"),
BAUD_300("300"),
BAUD_600("600"),
BAUD_1200("1200"),
BAUD_2400("2400"),
BAUD_4800("4800"),
BAUD_9600("9600"),
BAUD_14400("14400"),
BAUD_19200("19200"),
BAUD_38400("38400"),
BAUD_57600("57600"),
BAUD_115200("115200"),
BAUD_128000("128000"),
BAUD_256000("256000"),
;

private String label;

BaudRates(String label) {
this.label = label;
}
//public enum BaudRates {
//
// BAUD_110("110"),
// BAUD_300("300"),
// BAUD_600("600"),
// BAUD_1200("1200"),
// BAUD_2400("2400"),
// BAUD_4800("4800"),
// BAUD_9600("9600"),
// BAUD_14400("14400"),
// BAUD_19200("19200"),
// BAUD_38400("38400"),
// BAUD_57600("57600"),
// BAUD_115200("115200"),
// BAUD_128000("128000"),
// BAUD_256000("256000"),
// ;
//
// private String label;
//
// BaudRates(String label) {
// this.label = label;
// }
//
// @Override
// public String toString() {
// return label;
// }
//
//}

@Override
public String toString() {
return label;
}
public class BaudRates {

}
public static final List<Integer> baudRates = new ArrayList<Integer>() {{
add(300);
add(600);
add(1200);
add(2400);
add(4800);
add(9600);
add(14400);
add(19200);
add(38400);
add(57600);
add(115200);
add(128000);
add(256000);
}};
}
102 changes: 51 additions & 51 deletions src/main/java/ninja/mbedded/ninjaterm/util/comPort/ComPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public boolean isPortOpen() {
*/
private SerialPort serialPort;

private BaudRates baudRate;
private Integer baudRate;

public BaudRates getBaudRate() {
public Integer getBaudRate() {
return baudRate;
}

Expand Down Expand Up @@ -145,7 +145,7 @@ public void open() throws ComPortException {
}

public void setParams(
BaudRates baudRate,
Integer baudRate,
NumDataBits numDataBits,
Parities parity,
NumStopBits numStopBits) {
Expand All @@ -158,53 +158,53 @@ public void setParams(
//==============================================//
//====== APP BAUD RATE -> jSSC BAUD RATE =======//
//==============================================//
int jsscBaudRate;
switch (baudRate) {
case BAUD_110:
jsscBaudRate = 110;
break;
case BAUD_300:
jsscBaudRate = 300;
break;
case BAUD_600:
jsscBaudRate = 600;
break;
case BAUD_1200:
jsscBaudRate = 1200;
break;
case BAUD_2400:
jsscBaudRate = 2400;
break;
case BAUD_4800:
jsscBaudRate = 4800;
break;
case BAUD_9600:
jsscBaudRate = 9600;
break;
case BAUD_14400:
jsscBaudRate = 14400;
break;
case BAUD_19200:
jsscBaudRate = 19200;
break;
case BAUD_38400:
jsscBaudRate = 38400;
break;
case BAUD_57600:
jsscBaudRate = 57600;
break;
case BAUD_115200:
jsscBaudRate = 115200;
break;
case BAUD_128000:
jsscBaudRate = 128000;
break;
case BAUD_256000:
jsscBaudRate = 256000;
break;
default:
throw new RuntimeException("Baud rate unrecognised!");
}
// int jsscBaudRate;
// switch (this.baudRate) {
// case BAUD_110:
// jsscBaudRate = 110;
// break;
// case BAUD_300:
// jsscBaudRate = 300;
// break;
// case BAUD_600:
// jsscBaudRate = 600;
// break;
// case BAUD_1200:
// jsscBaudRate = 1200;
// break;
// case BAUD_2400:
// jsscBaudRate = 2400;
// break;
// case BAUD_4800:
// jsscBaudRate = 4800;
// break;
// case BAUD_9600:
// jsscBaudRate = 9600;
// break;
// case BAUD_14400:
// jsscBaudRate = 14400;
// break;
// case BAUD_19200:
// jsscBaudRate = 19200;
// break;
// case BAUD_38400:
// jsscBaudRate = 38400;
// break;
// case BAUD_57600:
// jsscBaudRate = 57600;
// break;
// case BAUD_115200:
// jsscBaudRate = 115200;
// break;
// case BAUD_128000:
// jsscBaudRate = 128000;
// break;
// case BAUD_256000:
// jsscBaudRate = 256000;
// break;
// default:
// throw new RuntimeException("Baud rate unrecognised!");
// }

//==============================================//
//====== APP DATA BITS -> jSSC DATA BITS =======//
Expand Down Expand Up @@ -274,7 +274,7 @@ public void setParams(

try {
serialPort.setParams(
jsscBaudRate,
baudRate,
jsscDataBits,
jsscNumStopBits,
jsscParity);
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/ninja/mbedded/ninjaterm/util/javafx/CssTools.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package ninja.mbedded.ninjaterm.util.javafx;

import javafx.scene.control.Control;

/**
* Contains a bunch of useful functions for manipulating the styles of javafx components.
*
* @author Geoffrey Hunter <[email protected]> (www.mbedded.ninja)
* @last-modified 2018-10-31
* @since 2018-10-31
*/
public class CssTools {

public static void addClass(Control control, String className) {
if (!control.getStyleClass().contains(className)) {
control.getStyleClass().add(className);
}
}

public static void removeClass(Control control, String className) {
if (control.getStyleClass().contains(className)) {
control.getStyleClass().remove(className);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static void hackStartTiming(javafx.scene.control.Tooltip tooltip, double
}
}

public static void addDefaultTooltip(Node node, String tooltipText) {
public static Tooltip addDefaultTooltip(Node node, String tooltipText) {

/*Tooltip tooltip = new Tooltip();
tooltip.setText(tooltipText);
Expand Down Expand Up @@ -69,6 +69,12 @@ public static void addDefaultTooltip(Node node, String tooltipText) {
hackStartTiming(tooltip, 100.0);

Tooltip.install(node, tooltip);

return tooltip;
}

public static void removeTooltip(Node node) {
Tooltip.uninstall(node, null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Label GridPane.rowIndex="0" GridPane.columnIndex="0">COM Port:</Label>
<ComboBox GridPane.rowIndex="0" GridPane.columnIndex="1" fx:id="foundComPortsComboBox"></ComboBox>
<Label GridPane.rowIndex="1" GridPane.columnIndex="0">Baud Rate:</Label>
<ComboBox GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="baudRateComboBox"/>
<ComboBox GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="baudRateComboBox" editable="true"/>
<Label GridPane.rowIndex="2" GridPane.columnIndex="0">Num. Data Bits:</Label>
<ComboBox GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="numDataBitsComboBox"/>
<Label GridPane.rowIndex="3" GridPane.columnIndex="0">Parity:</Label>
Expand Down
Loading

0 comments on commit 402c5f2

Please sign in to comment.