Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbmhunter committed Mar 27, 2016
2 parents 74e62e7 + df39398 commit 675bab2
Show file tree
Hide file tree
Showing 57 changed files with 2,888 additions and 695 deletions.
2 changes: 1 addition & 1 deletion .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .idea/libraries/com_proudapes_jlatexmathfx_0_3_2.xml

This file was deleted.

16 changes: 16 additions & 0 deletions .idea/libraries/org_testfx_testfx_core_4_0_2_alpha.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/libraries/org_testfx_testfx_junit_4_0_2_alpha.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,057 changes: 719 additions & 338 deletions .idea/workspace.xml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions NinjaCalc.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="org.testfx:testfx-core:4.0.2-alpha" level="project" />
<orderEntry type="library" name="org.testfx:testfx-junit:4.0.2-alpha" level="project" />
</component>
</module>
2 changes: 1 addition & 1 deletion NinjaCalc.install4j
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<install4j version="6.0.4" transformSequenceNumber="5">
<directoryPresets config="C:/Users/gbmhunter/GoogleDrive/Projects/NinjaCalc/img/logo" />
<application name="NinjaCalc" distributionSourceDir="" applicationId="7231-2225-0472-1196" mediaDir="C:/Users/gbmhunter/GoogleDrive/Projects/NinjaCalc/install" mediaFilePattern="${compiler:sys.shortName}_v${compiler:sys.version}_${compiler:sys.platform}" compression="6" lzmaCompression="false" pack200Compression="false" excludeSignedFromPacking="true" commonExternalFiles="false" createMd5Sums="true" shrinkRuntime="true" shortName="NinjaCalc" publisher="Geoffrey Hunter" publisherWeb="http://mbedded-ninja.github.io/NinjaCalc/" version="1.0.0" allPathsRelative="false" backupOnSave="false" autoSave="false" convertDotsToUnderscores="false" macSignature="????" macVolumeId="8b8be1286580b078" javaMinVersion="1.8" javaMaxVersion="" allowBetaVM="false" jdkMode="runtimeJre" jdkName="">
<application name="NinjaCalc" distributionSourceDir="" applicationId="7231-2225-0472-1196" mediaDir="C:/Users/gbmhunter/GoogleDrive/Projects/NinjaCalc/install" mediaFilePattern="${compiler:sys.shortName}_v${compiler:sys.version}_${compiler:sys.platform}" compression="6" lzmaCompression="false" pack200Compression="false" excludeSignedFromPacking="true" commonExternalFiles="false" createMd5Sums="true" shrinkRuntime="true" shortName="NinjaCalc" publisher="Geoffrey Hunter" publisherWeb="http://mbedded-ninja.github.io/NinjaCalc/" version="1.1.0" allPathsRelative="false" backupOnSave="false" autoSave="false" convertDotsToUnderscores="false" macSignature="????" macVolumeId="8b8be1286580b078" javaMinVersion="1.8" javaMaxVersion="" allowBetaVM="false" jdkMode="runtimeJre" jdkName="">
<languages skipLanguageSelection="false" languageSelectionInPrincipalLanguage="false">
<principalLanguage id="en" customLocalizationFile="" />
<additionalLanguages />
Expand Down
47 changes: 37 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ A embedded engineering calculator suite for doing calculations in a breeze.

- Author: gbmhunter <[email protected]> (http://www.mbedded.ninja)
- Created: 2015-11-02
- Last Modified: 2016-01-31
- Version: v1.0.0
- Last Modified: 2016-03-27
- Version: v1.1.0
- Company: mbedded.ninja
- Project: NinjaTerm
- Language: Java
Expand All @@ -24,14 +24,15 @@ A embedded engineering calculator suite for doing calculations in a breeze.
Motivation
==========

The goal of this is to provide a easy-to-use desktop application to help you with all those small, frequent calculations you do while doing embedded engineering (or other forms of engineering). Whether it be a low-pass LC filter, a resistor divider, or even just Ohm's law (o.k., I hope you don't forget that one, but it is included none-the-less), this app makes them easy to find, use, and have confidence in the answers.
The goal of this is to provide a easy-to-use desktop application to help you with all those small, frequent calculations you do while doing embedded engineering (or other forms of engineering). Whether it be a low-pass LC filter, a resistor divider, trying to find PCB track current, or even just Ohm's law (o.k., I hope you don't forget that one, but it is included none-the-less), this app makes them easy to find, use, and have confidence in the answers.


Features
--------
========

See the `project home page`_ for a list of features.


Installation
============

Expand All @@ -45,7 +46,7 @@ Developing
==========

#. Download/clone this repository into a folder on your computer.
#. Open the project in Visual Studio.
#. Open the project in IntelliJ (:code:`.idea/workspace.xml` file included in repo).
#. Develop!

Making Your Own Calculators
Expand All @@ -63,8 +64,8 @@ Creating a static diagram image and laying the calculator variable UI elements o

All calculators that use static images for their background diagrams have a Visio file called :code:`diagram.vsd` in their respective folder. Microsoft Visio is used to create the diagram, which is then exported as an image and used inside the NinjaCalc application.

Creating An Installable Package
-------------------------------
Creating Installable Packages
-----------------------------

The team at `ej-technologies <https://www.ej-technologies.com/>`_ have graciously donated me an open-source licensed version of |install4j|, `the multi-platform installer builder for Java applications
<http://www.ej-technologies.com/products/install4j/overview.html>`_.
Expand All @@ -75,16 +76,33 @@ The install4j script is located at :code:`/NinjaCalc.install4j`.

.. |install4j| image:: https://www.ej-technologies.com/images/product_banners/install4j_small.png

#. Open the :code:`/NinjaCalc.install4j` file in "install4j Multi-Platform Edition".
#. Update the "Version" field as appropriate.
#. Click the "Build Project" button.
#. Wait until build completes. install4j should have created installer files for each supported platform (currently Windows and Mac OS) in the :code:`install` directory.
#. Upload the installable packages to GitHub as a new release (if appropriate).
#. Update the download button links on the homepage in the :code:`gh-pages` branch of the repo to point to the new release files.


File Structure
==============

Sorted by alphabetical order.

(root level)
------------

Contains the install4j script for generating single-file installable packages for the various operating systems.

install/
--------

Contains the Inno Setup script for generating a single-file installable package (.exe). When this .exe is generated, it is placed into :code:`install/Output/` by the setup script.
The install4j script in the repo's root directory will instruct install4j to place deployment-ready NinjaCalc installers for the various operating systems here.

out/
----

IntelliJ IDEA will place output Java files when debugging/building in this directory.

src/
----
Expand All @@ -93,11 +111,20 @@ Contains the source code. This is split into the following sub-directories:

calculators/ - Contains all of the data to create each calculator type.

core/ - Contains all the "core", non-calculator specific classes that make up the Calculator app.
Core/ - Contains all the "core", non-calculator specific classes that make up the backend calculator engine and front-end visual elements.

Img/ - Contains images which are incorporated into the app.

img/ - Contains images which are incorporated into the app.
MainWindow/ - Contains the Java code and .fxml file describing the main window of NinjaCalc.

test/ - Unit tests for each of the calculators, core modules and utility modules. The unit tests include the testing of the UI (more on this below).

Utility/ - Contains helper Java classes which are not considered "core", but still used by multiple calculators. This includes things such as a library to help you find the closest standard E-series resistance (preferred value), and a library to convert from doubles to strings with metric prefixes and back again.

Unit Tests
==========

Unit tests are under the :code:`src/test/` directory. They use the `TestFX library<https://github.com/TestFX/TestFX>`_ to test the JavaFX UI for each calculator.

Changelog
=========
Expand Down
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
v1.1.0
------

- Fixed position of track thickness and plane proximity variables in the IPC-2152 track thickness calculator, closes #82.
- Fixed bug where capacitance and frequency UI elements were swapped in the Low-Pass RC Filter calculator, closes #80.
- Grid images can now be passed as a relative path to a calculators constructor, closes #86.
- Added "Standard Resistance Finder" calculator, closes #87.
- Closest values from all available series are listed all at once in the standard resistance calculator, closes #88.
- Added "metric-prefix" capability so that the user can use standard metric prefixes in the calculator variable textfields directly, closes #84.

v1.0.0
------

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added lib/guava-18.0.jar
Binary file not shown.
Binary file added lib/hamcrest-all-1.3.jar
Binary file not shown.
Binary file added lib/hamcrest-core-1.3.jar
Binary file not shown.
Binary file added lib/junit-4.12-javadoc.jar
Binary file not shown.
Binary file added lib/junit-4.12-sources.jar
Binary file not shown.
Binary file added lib/junit-4.12.jar
Binary file not shown.
Binary file added lib/testfx-core-4.0.2-alpha-javadoc.jar
Binary file not shown.
Binary file added lib/testfx-core-4.0.2-alpha-sources.jar
Binary file not shown.
Binary file added lib/testfx-core-4.0.2-alpha.jar
Binary file not shown.
Binary file added lib/testfx-junit-4.0.2-alpha-javadoc.jar
Binary file not shown.
Binary file added lib/testfx-junit-4.0.2-alpha-sources.jar
Binary file not shown.
Binary file added lib/testfx-junit-4.0.2-alpha.jar
Binary file not shown.
42 changes: 24 additions & 18 deletions src/Calculators/Electronics/Basic/OhmsLaw/OhmsLawCalcModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*
* @author gbmhunter
* @since 2015-11-02
* @last-modified 2016-03-27
*/
public class OhmsLawCalcModel extends Calculator {

Expand All @@ -30,15 +31,12 @@ public class OhmsLawCalcModel extends Calculator {
//===============================================================================================//

@FXML private TextField textFieldVoltageValue;
@FXML private ComboBox comboBoxVoltageUnits;
@FXML private RadioButton radioButtonVoltageIO;

@FXML private TextField textFieldCurrentValue;
@FXML private ComboBox comboBoxCurrentUnits;
@FXML private RadioButton radioButtonCurrentIO;

@FXML private TextField textFieldResistanceValue;
@FXML private ComboBox comboBoxResistanceUnits;
@FXML private RadioButton radioButtonResistanceIO;

@FXML private WebView infoWebView;
Expand All @@ -59,10 +57,12 @@ public OhmsLawCalcModel() {

super( "Ohm's Law",
"The hammer in any electrical engineers toolbox. calculate voltage, resistance and current using Ohm's law.",
"/Calculators/Electronics/Basic/OhmsLaw/grid-icon.png",
new String[]{ "Electronics", "Basic" },
new String[]{"ohm, resistor, resistance, voltage, current, law, vir"});

super.setIconImagePath(getClass().getResource("grid-icon.png"));


//===============================================================================================//
//======================================== LOAD .FXML FILE ======================================//
//===============================================================================================//
Expand Down Expand Up @@ -101,7 +101,7 @@ public OhmsLawCalcModel() {
toggleGroup.selectToggle(radioButtonResistanceIO);

// Following code provides lambda function which listens to radiobuttons changes and modifies direction accordingly
System.out.println("Adding listener for radiobutton toggle change.");
//System.out.println("Adding listener for radiobutton toggle change.");
toggleGroup.selectedToggleProperty().addListener((ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) -> {
System.out.println("Listener called for radio button toggle group.");
// old_toggle might be null if it is the first time something has been selected
Expand All @@ -124,16 +124,16 @@ public OhmsLawCalcModel() {
this.voltage = new CalcVarNumerical(
"voltage",
textFieldVoltageValue,
comboBoxVoltageUnits,
null,
() -> {
Double current = this.current.getRawVal();
Double resistance = this.resistance.getRawVal();
return current * resistance;
},
new NumberUnit[]{
new NumberUnit("mV", 1e-3),
//new NumberUnit("mV", 1e-3),
new NumberUnit("V", 1e0, NumberPreference.DEFAULT),
new NumberUnit("kV", 1e3),
//new NumberUnit("kV", 1e3),
},
4,
() -> {
Expand All @@ -145,6 +145,8 @@ public OhmsLawCalcModel() {
"The voltage across the resistor." // Help text
);

this.voltage.setIsEngineeringNotationEnabled(true);

// Add validators
this.voltage.addValidator(Validator.IsNumber(CalcValidationLevels.Error));
this.voltage.addValidator(Validator.IsGreaterThanZero(CalcValidationLevels.Error));
Expand All @@ -159,17 +161,17 @@ public OhmsLawCalcModel() {
this.current = new CalcVarNumerical(
"current",
textFieldCurrentValue,
comboBoxCurrentUnits,
null,
() -> {
Double voltage = this.voltage.getRawVal();
Double resistance = this.resistance.getRawVal();
return voltage / resistance;
},
new NumberUnit[]{
new NumberUnit("pA", 1e-12),
new NumberUnit("nA", 1e-9),
new NumberUnit("uA", 1e-6),
new NumberUnit("mA", 1e-3),
//new NumberUnit("pA", 1e-12),
//new NumberUnit("nA", 1e-9),
//new NumberUnit("uA", 1e-6),
//new NumberUnit("mA", 1e-3),
new NumberUnit("A", 1e0, NumberPreference.DEFAULT),
},
4,
Expand All @@ -181,6 +183,8 @@ public OhmsLawCalcModel() {
"The current going through the resistor" // Help text
);

this.current.setIsEngineeringNotationEnabled(true);

this.current.addValidator(Validator.IsNumber(CalcValidationLevels.Error));
this.current.addValidator(Validator.IsGreaterThanZero(CalcValidationLevels.Error));

Expand All @@ -194,18 +198,18 @@ public OhmsLawCalcModel() {
this.resistance = new CalcVarNumerical(
"resistance",
textFieldResistanceValue,
comboBoxResistanceUnits,
null,
() -> {
Double voltage = this.voltage.getRawVal();
Double current = this.current.getRawVal();
return voltage / current;
},
new NumberUnit[]{
new NumberUnit("mΩ", 1e-3),
//new NumberUnit("mΩ", 1e-3),
new NumberUnit("Ω", 1e0, NumberPreference.DEFAULT),
new NumberUnit("kΩ", 1e3),
new NumberUnit("MΩ", 1e6),
new NumberUnit("GΩ", 1e9),
//new NumberUnit("kΩ", 1e3),
//new NumberUnit("MΩ", 1e6),
//new NumberUnit("GΩ", 1e9),
},
4,
() -> {
Expand All @@ -216,6 +220,8 @@ public OhmsLawCalcModel() {
"The resistance of the resistor (or other circuit component)." // Help text
);

this.resistance.setIsEngineeringNotationEnabled(true);

this.resistance.addValidator(Validator.IsNumber(CalcValidationLevels.Error));
this.resistance.addValidator(Validator.IsGreaterThanZero(CalcValidationLevels.Error));

Expand Down
19 changes: 13 additions & 6 deletions src/Calculators/Electronics/Basic/OhmsLaw/OhmsLawCalcView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<?import javafx.scene.Group?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.web.WebView?>
<?import javafx.scene.layout.HBox?>
<VBox fillWidth="true">
<ScrollPane
fitToWidth="true"
Expand All @@ -41,16 +42,22 @@
<Group>
<ImageView fitHeight="600.0" fitWidth="600.0"><image><Image url="@diagram.png" /></image></ImageView>

<TextField fx:id="textFieldVoltageValue" layoutX="14.0" layoutY="300.0" prefHeight="25" prefWidth="80" />
<ComboBox fx:id="comboBoxVoltageUnits" layoutX="99.0" layoutY="300.0" prefHeight="25" />
<HBox layoutX="14.0" layoutY="300.0" alignment="CENTER" spacing="5">
<TextField fx:id="textFieldVoltageValue" prefHeight="25" prefWidth="80" alignment="CENTER_RIGHT"/>
<Label>V</Label>
</HBox>
<RadioButton fx:id="radioButtonVoltageIO" layoutX="111.0" layoutY="258.0" />

<TextField fx:id="textFieldCurrentValue" layoutX="449.0" layoutY="431.0" prefHeight="25" prefWidth="80" />
<ComboBox fx:id="comboBoxCurrentUnits" layoutX="534.0" layoutY="431.0" prefHeight="25" />
<HBox layoutX="449.0" layoutY="431.0" alignment="CENTER" spacing="5">
<TextField fx:id="textFieldCurrentValue" prefHeight="25" prefWidth="80" alignment="CENTER_RIGHT"/>
<Label>A</Label>
</HBox>
<RadioButton fx:id="radioButtonCurrentIO" layoutX="489.0" layoutY="370.0" />

<TextField fx:id="textFieldResistanceValue" layoutX="448.0" layoutY="183.0" prefHeight="25" prefWidth="80" />
<ComboBox fx:id="comboBoxResistanceUnits" layoutX="536.0" layoutY="183.0" prefHeight="25" />
<HBox layoutX="448.0" layoutY="183.0" alignment="CENTER" spacing="5">
<TextField fx:id="textFieldResistanceValue" prefHeight="25" prefWidth="80" alignment="CENTER_RIGHT"/>
<Label>Ω</Label>
</HBox>
<RadioButton fx:id="radioButtonResistanceIO" layoutX="478.0" layoutY="128.0" />
</Group>
</AutoScalingStackPane>
Expand Down
Binary file not shown.
Loading

0 comments on commit 675bab2

Please sign in to comment.