RE TS plugin to have continues tune auto-upload feature #1605
This commit is contained in:
parent
51af1c00db
commit
f64fb2a02e
|
@ -21,6 +21,7 @@ import org.putgemin.VerticalFlowLayout;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -28,6 +29,9 @@ import java.util.function.Supplier;
|
||||||
* TsPlugin launcher creates an instance of this class via reflection.
|
* TsPlugin launcher creates an instance of this class via reflection.
|
||||||
*/
|
*/
|
||||||
public class PluginEntry implements TsPluginBody {
|
public class PluginEntry implements TsPluginBody {
|
||||||
|
// 2 seconds aggregation by default
|
||||||
|
private static final int AUTO_UPDATE_AGGREGATION = Integer.parseInt(System.getProperty("autoupload.aggregation", "2000"));
|
||||||
|
|
||||||
private static final String REO_URL = "https://rusefi.com/online/";
|
private static final String REO_URL = "https://rusefi.com/online/";
|
||||||
private final AuthTokenPanel tokenPanel = new AuthTokenPanel();
|
private final AuthTokenPanel tokenPanel = new AuthTokenPanel();
|
||||||
private final JComponent content = new JPanel(new VerticalFlowLayout());
|
private final JComponent content = new JPanel(new VerticalFlowLayout());
|
||||||
|
@ -42,10 +46,14 @@ public class PluginEntry implements TsPluginBody {
|
||||||
|
|
||||||
private UploaderStatus uploaderStatus = new UploaderStatus();
|
private UploaderStatus uploaderStatus = new UploaderStatus();
|
||||||
|
|
||||||
private final Timer timer = new Timer(1000 /* one second */, new AbstractAction() {
|
private final Timer timer = new Timer(AUTO_UPDATE_AGGREGATION, new AbstractAction() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
System.out.println("Timer! " + System.currentTimeMillis() + " " + timer + " " + e);
|
// System.out.println("Timer! " + System.currentTimeMillis() + " " + timer + " " + e);
|
||||||
|
if (UploadView.isAutoUpload()) {
|
||||||
|
System.out.println(new Date() + ": enqueue tune");
|
||||||
|
UploadQueue.enqueue(controllerAccessSupplier.get(), currentConfiguration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -67,10 +75,6 @@ public class PluginEntry implements TsPluginBody {
|
||||||
listener = parameterName -> {
|
listener = parameterName -> {
|
||||||
// System.out.println("Parameter value changed " + parameterName);
|
// System.out.println("Parameter value changed " + parameterName);
|
||||||
timer.restart();
|
timer.restart();
|
||||||
if (UploadView.isAutoUpload()) {
|
|
||||||
System.out.println("enqueue tune");
|
|
||||||
UploadQueue.enqueue(controllerAccessSupplier.get(), currentConfiguration);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
upload.setBackground(new Color(0x90EE90));
|
upload.setBackground(new Color(0x90EE90));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue