Minor fixes
This commit is contained in:
parent
a03404381c
commit
d7a47ce9f4
8 changed files with 33 additions and 19 deletions
|
@ -50,4 +50,9 @@ Want to support development? Make a donation* (see below):
|
||||||
*Legal information:
|
*Legal information:
|
||||||
|
|
||||||
* [EN] Please note! This is non-commercial application. Any received money considered as a gift.
|
* [EN] Please note! This is non-commercial application. Any received money considered as a gift.
|
||||||
* [RU] Пожалуйста обратите внимание! Это некоммерческое приложение. Перечисляя средства вы совершаете дарение.
|
* [RU] Пожалуйста обратите внимание! Это некоммерческое приложение. Перечисляя средства вы совершаете дарение.
|
||||||
|
|
||||||
|
#### TODO
|
||||||
|
[ ] Tray support
|
||||||
|
[ ] Headless mode (CLI)
|
||||||
|
[ ] Dark theme
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>loper</groupId>
|
<groupId>loper</groupId>
|
||||||
<artifactId>LogiLed</artifactId>
|
<artifactId>LogiLed</artifactId>
|
||||||
<version>0.2-SNAPSHOT</version>
|
<version>0.3-SNAPSHOT</version>
|
||||||
|
|
||||||
<!-- <url></url> -->
|
<!-- <url></url> -->
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package logiled.Controllers;
|
package logiled.Controllers;
|
||||||
|
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
|
@ -52,20 +53,25 @@ public class MainController implements Initializable {
|
||||||
HashMap<String, List<byte[][]>> rules = KeysLedsController.getRules();
|
HashMap<String, List<byte[][]>> rules = KeysLedsController.getRules();
|
||||||
if (rules == null)
|
if (rules == null)
|
||||||
return;
|
return;
|
||||||
|
applyBtn.setDisable(true);
|
||||||
KeyLedThread keyLedThread = new KeyLedThread(rules);
|
KeyLedThread keyLedThread = new KeyLedThread(rules);
|
||||||
|
keyLedThread.setOnSucceeded(EventHandler -> applyBtn.setDisable(false)); // <- I guess this shit never fails
|
||||||
Thread commThread = new Thread(keyLedThread);
|
Thread commThread = new Thread(keyLedThread);
|
||||||
commThread.setDaemon(true);
|
commThread.setDaemon(true);
|
||||||
commThread.start();
|
commThread.start();
|
||||||
}
|
}
|
||||||
else if (MainTabPane.getSelectionModel().getSelectedItem().getId().equals("EffectsTab")) {
|
else if (MainTabPane.getSelectionModel().getSelectedItem().getId().equals("EffectsTab")) {
|
||||||
|
applyBtn.setDisable(true);
|
||||||
EffectsThread effectsThread = new EffectsThread(EffectsController.getEffect());
|
EffectsThread effectsThread = new EffectsThread(EffectsController.getEffect());
|
||||||
|
effectsThread.setOnSucceeded(EventHandler -> applyBtn.setDisable(false));
|
||||||
Thread commThread = new Thread(effectsThread);
|
Thread commThread = new Thread(effectsThread);
|
||||||
commThread.setDaemon(true);
|
commThread.setDaemon(true);
|
||||||
commThread.start();
|
commThread.start();
|
||||||
}
|
}
|
||||||
else { // Consider as GameMode; refactor in case more tabs added.
|
else { // Consider as GameMode; refactor in case more tabs added.
|
||||||
List<Byte> disKeysList = GameModeController.getKeys();
|
applyBtn.setDisable(true);
|
||||||
GameModeThread gameModeThread = new GameModeThread(disKeysList);
|
GameModeThread gameModeThread = new GameModeThread(GameModeController.getKeys());
|
||||||
|
gameModeThread.setOnSucceeded(EventHandler -> applyBtn.setDisable(false));
|
||||||
Thread commThread = new Thread(gameModeThread);
|
Thread commThread = new Thread(gameModeThread);
|
||||||
commThread.setDaemon(true);
|
commThread.setDaemon(true);
|
||||||
commThread.start();
|
commThread.start();
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Locale;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class MainFx extends Application {
|
public class MainFx extends Application {
|
||||||
public static final String appVersion = "v0.2";
|
public static final String appVersion = "v0.3";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception{
|
public void start(Stage primaryStage) throws Exception{
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logiled.MessagesConsumer;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class EffectsThread extends LoThread implements Runnable{
|
public class EffectsThread extends LoThread {
|
||||||
|
|
||||||
private byte[] command;
|
private byte[] command;
|
||||||
|
|
||||||
|
@ -49,16 +49,15 @@ public class EffectsThread extends LoThread implements Runnable{
|
||||||
command = effectWaveEdgeToCenter(effectData);
|
command = effectWaveEdgeToCenter(effectData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
protected Void call() throws Exception {
|
||||||
if (command == null)
|
if (command == null)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
UsbConnect usbConnect = new UsbConnect();
|
UsbConnect usbConnect = new UsbConnect();
|
||||||
|
|
||||||
if (!usbConnect.isConnected())
|
if (!usbConnect.isConnected())
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
handler = usbConnect.getHandlerKbrd();
|
handler = usbConnect.getHandlerKbrd();
|
||||||
|
|
||||||
|
@ -66,6 +65,7 @@ public class EffectsThread extends LoThread implements Runnable{
|
||||||
MessagesConsumer.getInstance().inform("Complete!");
|
MessagesConsumer.getInstance().inform("Complete!");
|
||||||
|
|
||||||
usbConnect.close();
|
usbConnect.close();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] effectDisable(){
|
private byte[] effectDisable(){
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GameModeThread extends LoThread implements Runnable{
|
public class GameModeThread extends LoThread{
|
||||||
|
|
||||||
private static final byte[] game_key_prepare = {
|
private static final byte[] game_key_prepare = {
|
||||||
0x11, (byte) 0xff, 0x03, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x11, (byte) 0xff, 0x03, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
@ -48,11 +48,11 @@ public class GameModeThread extends LoThread implements Runnable{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
protected Void call() throws Exception {
|
||||||
UsbConnect usbConnect = new UsbConnect();
|
UsbConnect usbConnect = new UsbConnect();
|
||||||
|
|
||||||
if (!usbConnect.isConnected())
|
if (!usbConnect.isConnected())
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
handler = usbConnect.getHandlerKbrd();
|
handler = usbConnect.getHandlerKbrd();
|
||||||
|
|
||||||
|
@ -68,5 +68,6 @@ public class GameModeThread extends LoThread implements Runnable{
|
||||||
MessagesConsumer.getInstance().inform("Complete!");
|
MessagesConsumer.getInstance().inform("Complete!");
|
||||||
|
|
||||||
usbConnect.close();
|
usbConnect.close();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package logiled.USB;
|
package logiled.USB;
|
||||||
|
|
||||||
|
import javafx.concurrent.Task;
|
||||||
import logiled.MessagesConsumer;
|
import logiled.MessagesConsumer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -7,7 +8,7 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class KeyLedThread extends LoThread implements Runnable{
|
public class KeyLedThread extends LoThread {
|
||||||
// Keys and indicators individual settings
|
// Keys and indicators individual settings
|
||||||
private static final byte[] commit = {
|
private static final byte[] commit = {
|
||||||
0x11, (byte) 0xff, 0x0c, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x11, (byte) 0xff, 0x0c, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
@ -77,15 +78,15 @@ public class KeyLedThread extends LoThread implements Runnable{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
protected Void call() throws Exception {
|
||||||
// If no commands in the query, then nothing to do
|
// If no commands in the query, then nothing to do
|
||||||
if (keyLedCommands.size() == 0)
|
if (keyLedCommands.size() == 0)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
UsbConnect usbConnect = new UsbConnect();
|
UsbConnect usbConnect = new UsbConnect();
|
||||||
|
|
||||||
if (!usbConnect.isConnected())
|
if (!usbConnect.isConnected())
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
handler = usbConnect.getHandlerKbrd();
|
handler = usbConnect.getHandlerKbrd();
|
||||||
|
|
||||||
|
@ -101,6 +102,6 @@ public class KeyLedThread extends LoThread implements Runnable{
|
||||||
MessagesConsumer.getInstance().inform("Complete!");
|
MessagesConsumer.getInstance().inform("Complete!");
|
||||||
|
|
||||||
usbConnect.close();
|
usbConnect.close();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package logiled.USB;
|
package logiled.USB;
|
||||||
|
|
||||||
|
import javafx.concurrent.Task;
|
||||||
import logiled.MessagesConsumer;
|
import logiled.MessagesConsumer;
|
||||||
import org.usb4java.DeviceHandle;
|
import org.usb4java.DeviceHandle;
|
||||||
import org.usb4java.LibUsb;
|
import org.usb4java.LibUsb;
|
||||||
|
@ -7,7 +8,7 @@ import org.usb4java.LibUsb;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
abstract class LoThread {
|
abstract class LoThread extends Task<Void> {
|
||||||
|
|
||||||
DeviceHandle handler;
|
DeviceHandle handler;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue