Skip to content

Commit

Permalink
Bug fixing, new version, updated libraries, added debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocipriani01 committed Feb 18, 2021
1 parent 8650eb3 commit 32a4378
Show file tree
Hide file tree
Showing 33 changed files with 99 additions and 366 deletions.
17 changes: 9 additions & 8 deletions InnoSetup.iss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[Setup]
AppId={{863670cf-a7a6-4314-9479-c99e1c6fce06}
AppName=ThunderFocus
AppVersion=2.5
AppVerName=ThunderFocus v2.5
AppVersion=2.5.1
AppVerName=ThunderFocus v2.5.1
AppPublisher=marcocipriani01
AppPublisherURL=https://marcocipriani01.github.io/
AppSupportURL=https://marcocipriani01.github.io/
Expand All @@ -24,11 +24,11 @@ UninstallDisplayIcon="D:\ThunderFocus\ThunderFocusASCOM\Resources\icon.ico"
ChangesEnvironment=yes

[Languages]
;Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"

[Registry]
Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName: "thunderfok"; ValueData: "{app}"; Flags: preservestringtype
Root: "HKLM"; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "thunderfok"; ValueData: "{app}"; Flags: createvalueifdoesntexist preservestringtype

[Dirs]
Name: "{app}"
Expand All @@ -42,7 +42,8 @@ Source: "D:\ThunderFocus\ThunderFocusASCOM\bin\Release\ASCOM.ThunderFocus.Focuse

[Icons]
Name: "{group}\ThunderFocus"; Filename: "{app}\bin\javaw.exe"; IconFilename: "{app}\icon.ico"; Parameters: "-jar ""{app}\ThunderFocus.jar"""
Name: "{group}\{cm:UninstallProgram,ThunderFocus}"; Filename: "{uninstallexe}"
Name: "{group}\ThunderFocus debug"; Filename: "{app}\bin\java.exe"; IconFilename: "{app}\debug.ico"; Parameters: "-jar ""{app}\ThunderFocus.jar"""
Name: "{group}\{cm:UninstallProgram,ThunderFocus}"; IconFilename: "{app}\uninstall.ico"; Filename: "{uninstallexe}"
Name: "{autodesktop}\ThunderFocus"; Filename: "{app}\bin\javaw.exe"; Tasks: desktopicon; IconFilename: "{app}\icon.ico"; Parameters: "-jar ""{app}\ThunderFocus.jar"""

[Run]
Expand All @@ -53,9 +54,9 @@ Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\F
Filename: "{app}\bin\javaw.exe"; Parameters: "-jar ""{app}\ThunderFocus.jar"""; Description: "{cm:LaunchProgram,ThunderFocus}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: "{dotnet4032}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 32bit
Filename: "{dotnet4064}\regasm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 64bit; Check: IsWin64
Filename: "{dotnet4064}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 64bit; Check: IsWin64
Filename: "{dotnet4032}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 32bit; RunOnceId: "RemoveDDL1"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "/codebase ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL2"
Filename: "{dotnet4064}\regasm.exe"; Parameters: "-u ""{commoncf}\ASCOM\Focuser\ASCOM.ThunderFocus.Focuser.dll"""; Flags: runhidden 64bit; Check: IsWin64; RunOnceId: "RemoveDDL3"

[Code]
const
Expand Down
Binary file added JRE-bundle/debug.ico
Binary file not shown.
Binary file added JRE-bundle/uninstall.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions ThunderFocus-GUI/.idea/artifacts/ThunderFocus_debian_jar.xml

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

4 changes: 2 additions & 2 deletions ThunderFocus-GUI/.idea/artifacts/ThunderFocus_jar.xml

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

4 changes: 2 additions & 2 deletions ThunderFocus-GUI/.idea/artifacts/ThunderFocus_windows_jar.xml

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

10 changes: 10 additions & 0 deletions ThunderFocus-GUI/.idea/libraries/FlatLaf.xml

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

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

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

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

10 changes: 0 additions & 10 deletions ThunderFocus-GUI/.idea/libraries/com_formdev_flatlaf_0_43.xml

This file was deleted.

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

10 changes: 5 additions & 5 deletions ThunderFocus-GUI/ThunderFocus.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<orderEntry type="jdk" jdkName="15" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="SimpleSocket" exported="" />
<orderEntry type="library" exported="" name="com.google.code.gson:gson:2.8.6" level="project" />
<orderEntry type="library" exported="" name="com.formdev:flatlaf:0.43" level="project" />
<orderEntry type="library" exported="" name="org.jfree:jfreechart:1.5.1" level="project" />
<orderEntry type="library" exported="" name="io.github.java-native:jssc:2.9.2" level="project" />
<orderEntry type="library" exported="" name="INDIForJava.bundle-2.0-SNAPSHOT" level="project" />
<orderEntry type="library" exported="" name="FlatLaf" level="project" />
<orderEntry type="library" exported="" name="JFreeChart" level="project" />
<orderEntry type="library" exported="" name="Gson" level="project" />
<orderEntry type="library" exported="" name="INDIForJava" level="project" />
<orderEntry type="library" exported="" name="jSSC" level="project" />
</component>
</module>
3 changes: 1 addition & 2 deletions ThunderFocus-GUI/deb-builder/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ThunderFocus.deb
ThunderFocus/usr/share/ThunderFocus/ThunderFocus.jar
ThunderFocus.deb
2 changes: 1 addition & 1 deletion ThunderFocus-GUI/deb-builder/ThunderFocus/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Maintainer: marcocipriani01
Depends:
Suggests: openjdk-14-jre
Priority: optional
Version: 2.5
Version: 2.5.1
Description: ThunderFocus for Debian.
Binary file not shown.
Binary file modified ThunderFocus-GUI/libs/INDIForJava.bundle-2.0-SNAPSHOT.jar
Binary file not shown.
Binary file removed ThunderFocus-GUI/libs/flatlaf-0.43.jar
Binary file not shown.
Binary file added ThunderFocus-GUI/libs/flatlaf-1.0.jar
Binary file not shown.
Binary file removed ThunderFocus-GUI/libs/jfreechart-1.5.1.jar
Binary file not shown.
Binary file added ThunderFocus-GUI/libs/jfreechart-1.5.2.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion ThunderFocus-GUI/src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Specification-Vendor: marcocipriani01
Main-Class: marcocipriani01.thunderfocus.Main
Name: marcocipriani01/thunder/focus
Specification-Title: ThunderFocus
Specification-Version: 2.5
Specification-Version: 2.5.1
27 changes: 19 additions & 8 deletions ThunderFocus-GUI/src/marcocipriani01/thunderfocus/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

public class Main {

private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("marcocipriani01.thunderfocus.lang");
public static final ResourceBundle RES_BUNDLE = ResourceBundle.getBundle("marcocipriani01.thunderfocus.lang");
public static final String APP_NAME = i18n("app.name");
public static final Image APP_LOGO = Toolkit.getDefaultToolkit().getImage(
Main.class.getResource("/marcocipriani01/thunderfocus/res/ThunderFocus.png"));
public static final ThunderFocuser focuser = new ThunderFocuser();
public static final INDIServerCreator indiServerCreator = new INDIServerCreator();
public static final OperatingSystem OPERATING_SYSTEM = getOperatingSystem();
public static final Settings settings = Settings.load();
public static final String APP_NAME = i18n("app.name");
public static ASCOMFocuserBridge ascomFocuserBridge;
private static Path pidLock;

Expand All @@ -50,12 +50,23 @@ public static void main(String[] args) {
if (pidLock.toFile().exists()) {
try {
Optional<ProcessHandle> processHandle = ProcessHandle.of(Long.parseLong(Files.readString(pidLock).replace("\n", "").trim()));
if (processHandle.isPresent() && processHandle.get().isAlive()) {
JOptionPane.showMessageDialog(null, APP_NAME + i18n("is.already.running"),
APP_NAME, JOptionPane.ERROR_MESSAGE);
return;
if (processHandle.isPresent()) {
ProcessHandle presentHandle = processHandle.get();
if (presentHandle.isAlive()) {
Optional<String> command = presentHandle.info().command();
if (command.isPresent() && command.get().contains("java") &&
(JOptionPane.showConfirmDialog(null, APP_NAME + i18n("is.already.running"),
APP_NAME, JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE) == JOptionPane.CANCEL_OPTION)) {
try {
Thread.sleep(100);
} catch (InterruptedException ignored) {
}
return;
}
}
}
} catch (Exception ignored) {
} catch (Exception e) {
e.printStackTrace();
}
}
Files.write(pidLock, pid.getBytes());
Expand All @@ -66,7 +77,7 @@ public static void main(String[] args) {
}

public static String i18n(String id) {
return resourceBundle.getString(id);
return RES_BUNDLE.getString(id);
}

private static OperatingSystem getOperatingSystem() {
Expand Down
18 changes: 11 additions & 7 deletions ThunderFocus-GUI/src/marcocipriani01/thunderfocus/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,11 @@ public void mousePressed(MouseEvent e) {
String serialPort = Main.settings.getSerialPort();
for (String p : SerialPortImpl.scanSerialPorts()) {
serialPortComboBox.addItem(p);
if (p.equals(serialPort)) {
selectPort = true;
}
if (p.equals(serialPort)) selectPort = true;
}
if (selectPort) {
serialPortComboBox.setSelectedItem(serialPort);
if (autoConnect && (!Main.focuser.isConnected())) {
Main.settings.setSerialPort(serialPort, this);
try {
Main.focuser.connect(serialPort);
} catch (ConnectionException ex) {
Expand Down Expand Up @@ -466,6 +463,11 @@ public void actionPerformed(ActionEvent e) {
} catch (ConnectionException ex) {
connectionErr(ex);
}
try {
Main.settings.save();
} catch (IOException ioException) {
ioException.printStackTrace();
}
} else {
JOptionPane.showMessageDialog(this, i18n("serial.port.not.selected"),
APP_NAME, JOptionPane.ERROR_MESSAGE);
Expand Down Expand Up @@ -907,14 +909,16 @@ public void updateConnSate(ThunderFocuser.ConnState connState) {
}
if (powerBox.supportsAmbient()) {
tabPane.insertTab(i18n("sensors.tab"), AMBIENT_TAB, ambientTab, "", 2);
powerBoxLatSpinner.setValue(powerBox.getLatitude());
powerBoxLongSpinner.setValue(powerBox.getLongitude());
powerBoxConfigPanel.setVisible(true);
}
boolean supportsTime = powerBox.supportsTime();
sunElevationLabel.setVisible(supportsTime);
sunElevationField.setVisible(supportsTime);
sunElevationField.setText("?");
powerBoxConfigPanel.setVisible(supportsTime);
if (supportsTime) {
powerBoxLatSpinner.setValue(powerBox.getLatitude());
powerBoxLongSpinner.setValue(powerBox.getLongitude());
}
}
fokSpeedSlider.setValue(Main.focuser.getSpeed());
fokReverseDirBox.setSelected(Main.focuser.isReverseDir());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Settings {
private static String folder = null;
private final ArrayList<SettingsListener> listeners = new ArrayList<>();

@SerializedName("Theme")
@SerializedName("AppTheme")
@Expose
private Theme theme = Theme.LIGHT;
@SerializedName("Serial port")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.indilib.i4j.properties.INDIStandardProperty;
import org.indilib.i4j.protocol.api.INDIConnection;

import java.io.IOException;
import java.util.Date;
import java.util.HashMap;

Expand Down Expand Up @@ -91,14 +92,14 @@ public class INDIThunderFocuserDriver extends INDIFocuserDriver
public INDIThunderFocuserDriver(INDIConnection connection) {
super(connection);

connectionProp = newSwitchProperty().name(INDIStandardProperty.CONNECTION).label(INDIDriver.GROUP_CONNECTION).group(INDIDriver.GROUP_CONNECTION)
connectionProp = newSwitchProperty().name(INDIStandardProperty.CONNECTION).label(INDIDriver.GROUP_MAIN_CONTROL).group(INDIDriver.GROUP_MAIN_CONTROL)
.state(Constants.PropertyStates.OK).create();
connectElem = new INDIElementBuilder<>(INDISwitchElement.class, connectionProp).name(INDIStandardElement.CONNECT)
.label("Connect").switchValue(Constants.SwitchStatus.OFF).create();
disconnectElem = new INDIElementBuilder<>(INDISwitchElement.class, connectionProp).name(INDIStandardElement.DISCONNECT)
.label("Disconnect").switchValue(Constants.SwitchStatus.ON).create();
addProperty(connectionProp);
serialPortFieldProp = newTextProperty().name(INDIStandardProperty.DEVICE_PORT).label("Port").group(INDIDriver.GROUP_CONNECTION)
serialPortFieldProp = newTextProperty().name(INDIStandardProperty.DEVICE_PORT).label("Port").group(INDIDriver.GROUP_MAIN_CONTROL)
.state(Constants.PropertyStates.OK).create();
serialPortFieldElem = new INDIElementBuilder<>(INDITextElement.class, serialPortFieldProp)
.name(INDIStandardElement.PORT).label("Port").textValue(Main.settings.getSerialPort()).create();
Expand Down Expand Up @@ -218,7 +219,7 @@ private void refreshSerialPorts() {
if (portsListProp != null && getPropertiesAsList().contains(portsListProp)) {
removeProperty(portsListProp);
}
portsListProp = newSwitchProperty().name("AVAILABLE_PORTS").label("Available ports").group(INDIDriver.GROUP_CONNECTION)
portsListProp = newSwitchProperty().name("AVAILABLE_PORTS").label("Available ports").group(INDIDriver.GROUP_MAIN_CONTROL)
.state(Constants.PropertyStates.OK).create();
searchElem = new INDIElementBuilder<>(INDISwitchElement.class, portsListProp).name("REFRESH_PORTS").label("Refresh")
.switchValue(Constants.SwitchStatus.ON).create();
Expand Down Expand Up @@ -338,6 +339,11 @@ public void processNewTextValue(INDITextProperty property, Date timestamp, INDIT
if (element == serialPortFieldElem) {
Main.settings.setSerialPort(value, this);
element.setValue(value);
try {
Main.settings.save();
} catch (IOException ioException) {
ioException.printStackTrace();
}
break;
}
}
Expand Down Expand Up @@ -383,6 +389,11 @@ public void processNewSwitchValue(INDISwitchProperty property, Date timestamp, I
String serialPort = portsListElements.get(element);
Main.settings.setSerialPort(serialPort, this);
serialPortFieldElem.setValue(serialPort);
try {
Main.settings.save();
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ sensors.tab=Sensori
config.tab=Configurazione
info=Info
software.version=Versione del software
version.unknown=Versione sconosciuta!
version.unknown=Versione sconosciuta
browser.error=Errore durante l'apertura del browser!
temperature=Temperatura
humidity=Umidità
Expand Down
2 changes: 2 additions & 0 deletions ThunderFocus-firmware/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.pio
.clang_complete
.gcc-flags.json
.vscode
src/boards/nik_coli.h
Loading

0 comments on commit 32a4378

Please sign in to comment.