POC Setpoints
@@ -30,8 +40,19 @@
{% endblock content %}
diff --git a/src/main/java/com/henrypump/poc/WebServer.java b/src/main/java/com/henrypump/poc/WebServer.java
index a5af539..897faee 100644
--- a/src/main/java/com/henrypump/poc/WebServer.java
+++ b/src/main/java/com/henrypump/poc/WebServer.java
@@ -213,13 +213,13 @@ public class WebServer{
if ((user.length() > 0) && (action.length() > 0)) {
switch (action) {
case "manual":
- attachedPOC.thisWell.setRunMode("MANUAL");
+ attachedPOC.thisWell.setRunModeString("MANUAL");
break;
case "poc":
- attachedPOC.thisWell.setRunMode("POC");
+ attachedPOC.thisWell.setRunModeString("POC");
break;
case "timer":
- attachedPOC.thisWell.setRunMode("TIMER");
+ attachedPOC.thisWell.setRunModeString("TIMER");
break;
default:
respJSON.put(action, "not implemented");
diff --git a/src/main/java/com/henrypump/poc/Well.java b/src/main/java/com/henrypump/poc/Well.java
index db589e1..707a09d 100644
--- a/src/main/java/com/henrypump/poc/Well.java
+++ b/src/main/java/com/henrypump/poc/Well.java
@@ -106,7 +106,7 @@ public class Well {
private boolean permissiveOK;
private long strokesSinceStart = 0;
- private long startupStrokes = 1;
+ private long startupStrokes = 10;
private long strokesToday = 0;
private long strokesLifetime;
private int pointCounter =0;
@@ -305,6 +305,16 @@ public class Well {
} else {
fluidGasRatio = dbFluidGasRatio;
}
+
+ double dbRunMode = db.getSetpoint("runMode");
+ if (dbRunMode == Double.MIN_VALUE){
+ runMode = RUNMODE_MANUAL; // DEFAULT VALUE
+ System.out.println("Using default value of " + runMode + " for runMode.");
+ db.storeSetpoint("runMode", (double) runMode);
+ } else {
+ setRunMode((int) dbRunMode);
+ System.out.println("Run Mode set to " + getRunModeString());
+ }
}
private void initializeMeasurements(){
@@ -521,7 +531,7 @@ public class Well {
}
}
- public void setRunMode(String runModeString){
+ public void setRunModeString(String runModeString){
switch (runModeString){
case "POC":
runMode = RUNMODE_POC;
@@ -540,6 +550,10 @@ public class Well {
}
}
+ public void setRunMode(int runMode) {
+ this.runMode = runMode;
+ }
+
public double getCurrentSurfacePosition() {
return currentSurfacePosition;
}