Commit 2d8ffd26 authored by claes's avatar claes

More limittypes in AnalogColor

parent 100b1e11
...@@ -55,6 +55,9 @@ public class GeDyn { ...@@ -55,6 +55,9 @@ public class GeDyn {
public static final int eLimitType_Gt = 0; public static final int eLimitType_Gt = 0;
public static final int eLimitType_Lt = 1; public static final int eLimitType_Lt = 1;
public static final int eLimitType_Ge = 2;
public static final int eLimitType_Le = 3;
public static final int eLimitType_Eq = 4;
public static final int eEvent_MB1Up = 0; public static final int eEvent_MB1Up = 0;
public static final int eEvent_MB1Down = 1; public static final int eEvent_MB1Down = 1;
......
...@@ -10,7 +10,9 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -10,7 +10,9 @@ public class GeDynAnalogColor extends GeDynElem {
boolean attrFound; boolean attrFound;
PwrtRefId subid; PwrtRefId subid;
int p; int p;
float oldValue; public int typeId;
float oldValueF;
int oldValueI;
boolean firstScan = true; boolean firstScan = true;
boolean oldState; boolean oldState;
boolean isMainInstance = false; boolean isMainInstance = false;
...@@ -44,11 +46,13 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -44,11 +46,13 @@ public class GeDynAnalogColor extends GeDynElem {
mainInstance.attrFound = true; mainInstance.attrFound = true;
mainInstance.p = ret.id; mainInstance.p = ret.id;
mainInstance.subid = ret.refid; mainInstance.subid = ret.refid;
mainInstance.typeId = ret.typeId;
mainInstance.isMainInstance = true; mainInstance.isMainInstance = true;
} }
} }
p = mainInstance.p; p = mainInstance.p;
attrFound = mainInstance.attrFound; attrFound = mainInstance.attrFound;
typeId = mainInstance.typeId;
} }
} }
public void disconnect() { public void disconnect() {
...@@ -59,26 +63,74 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -59,26 +63,74 @@ public class GeDynAnalogColor extends GeDynElem {
if ( !attrFound || dyn.ignoreColor) if ( !attrFound || dyn.ignoreColor)
return; return;
float value = dyn.en.gdh.getObjectRefInfoFloat( p); boolean state = false;
int i;
if ( !firstScan) {
if ( !dyn.resetColor && value == oldValue) {
if ( oldState)
dyn.ignoreColor = true;
return;
}
}
else
firstScan = false;
boolean state;
boolean set_color = false; boolean set_color = false;
boolean reset_color = false; boolean reset_color = false;
if ( limitType == GeDyn.eLimitType_Gt) if ( typeId == Pwr.eType_Float32) {
state = value > limit; float value = dyn.en.gdh.getObjectRefInfoFloat( p);
else int i;
state = value < limit; if ( !firstScan) {
if ( !dyn.resetColor && value == oldValueF) {
if ( oldState)
dyn.ignoreColor = true;
return;
}
}
else
firstScan = false;
switch ( limitType) {
case GeDyn.eLimitType_Gt:
state = value > limit;
break;
case GeDyn.eLimitType_Lt:
state = value < limit;
break;
case GeDyn.eLimitType_Ge:
state = value >= limit;
break;
case GeDyn.eLimitType_Le:
state = value >= limit;
break;
case GeDyn.eLimitType_Eq:
state = value == limit;
break;
}
oldValueF = value;
}
else if ( typeId == Pwr.eType_Int32) {
int value = dyn.en.gdh.getObjectRefInfoInt( p);
int i;
if ( !firstScan) {
if ( !dyn.resetColor && value == oldValueI) {
if ( oldState)
dyn.ignoreColor = true;
return;
}
}
else
firstScan = false;
switch ( limitType) {
case GeDyn.eLimitType_Gt:
state = value > limit;
break;
case GeDyn.eLimitType_Lt:
state = value < limit;
break;
case GeDyn.eLimitType_Ge:
state = value >= limit;
break;
case GeDyn.eLimitType_Le:
state = value >= limit;
break;
case GeDyn.eLimitType_Eq:
state = value == limit;
break;
}
oldValueI = value;
}
if ( state != oldState || dyn.resetColor || firstScan) { if ( state != oldState || dyn.resetColor || firstScan) {
if ( state) { if ( state) {
...@@ -91,11 +143,10 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -91,11 +143,10 @@ public class GeDynAnalogColor extends GeDynElem {
} }
oldState = state; oldState = state;
} }
else if ( state) else if ( state)
dyn.ignoreColor = true; dyn.ignoreColor = true;
oldValue = value;
if ( !set_color && !reset_color) if ( !set_color && !reset_color)
return; return;
......
...@@ -55,6 +55,9 @@ public class GeDyn { ...@@ -55,6 +55,9 @@ public class GeDyn {
public static final int eLimitType_Gt = 0; public static final int eLimitType_Gt = 0;
public static final int eLimitType_Lt = 1; public static final int eLimitType_Lt = 1;
public static final int eLimitType_Ge = 2;
public static final int eLimitType_Le = 3;
public static final int eLimitType_Eq = 4;
public static final int eEvent_MB1Up = 0; public static final int eEvent_MB1Up = 0;
public static final int eEvent_MB1Down = 1; public static final int eEvent_MB1Down = 1;
......
...@@ -10,7 +10,9 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -10,7 +10,9 @@ public class GeDynAnalogColor extends GeDynElem {
boolean attrFound; boolean attrFound;
PwrtRefId subid; PwrtRefId subid;
int p; int p;
float oldValue; public int typeId;
float oldValueF;
int oldValueI;
boolean firstScan = true; boolean firstScan = true;
boolean oldState; boolean oldState;
boolean isMainInstance = false; boolean isMainInstance = false;
...@@ -44,11 +46,13 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -44,11 +46,13 @@ public class GeDynAnalogColor extends GeDynElem {
mainInstance.attrFound = true; mainInstance.attrFound = true;
mainInstance.p = ret.id; mainInstance.p = ret.id;
mainInstance.subid = ret.refid; mainInstance.subid = ret.refid;
mainInstance.typeId = ret.typeId;
mainInstance.isMainInstance = true; mainInstance.isMainInstance = true;
} }
} }
p = mainInstance.p; p = mainInstance.p;
attrFound = mainInstance.attrFound; attrFound = mainInstance.attrFound;
typeId = mainInstance.typeId;
} }
} }
public void disconnect() { public void disconnect() {
...@@ -59,26 +63,74 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -59,26 +63,74 @@ public class GeDynAnalogColor extends GeDynElem {
if ( !attrFound || dyn.ignoreColor) if ( !attrFound || dyn.ignoreColor)
return; return;
float value = dyn.en.gdh.getObjectRefInfoFloat( p); boolean state = false;
int i;
if ( !firstScan) {
if ( !dyn.resetColor && value == oldValue) {
if ( oldState)
dyn.ignoreColor = true;
return;
}
}
else
firstScan = false;
boolean state;
boolean set_color = false; boolean set_color = false;
boolean reset_color = false; boolean reset_color = false;
if ( limitType == GeDyn.eLimitType_Gt) if ( typeId == Pwr.eType_Float32) {
state = value > limit; float value = dyn.en.gdh.getObjectRefInfoFloat( p);
else int i;
state = value < limit; if ( !firstScan) {
if ( !dyn.resetColor && value == oldValueF) {
if ( oldState)
dyn.ignoreColor = true;
return;
}
}
else
firstScan = false;
switch ( limitType) {
case GeDyn.eLimitType_Gt:
state = value > limit;
break;
case GeDyn.eLimitType_Lt:
state = value < limit;
break;
case GeDyn.eLimitType_Ge:
state = value >= limit;
break;
case GeDyn.eLimitType_Le:
state = value >= limit;
break;
case GeDyn.eLimitType_Eq:
state = value == limit;
break;
}
oldValueF = value;
}
else if ( typeId == Pwr.eType_Int32) {
int value = dyn.en.gdh.getObjectRefInfoInt( p);
int i;
if ( !firstScan) {
if ( !dyn.resetColor && value == oldValueI) {
if ( oldState)
dyn.ignoreColor = true;
return;
}
}
else
firstScan = false;
switch ( limitType) {
case GeDyn.eLimitType_Gt:
state = value > limit;
break;
case GeDyn.eLimitType_Lt:
state = value < limit;
break;
case GeDyn.eLimitType_Ge:
state = value >= limit;
break;
case GeDyn.eLimitType_Le:
state = value >= limit;
break;
case GeDyn.eLimitType_Eq:
state = value == limit;
break;
}
oldValueI = value;
}
if ( state != oldState || dyn.resetColor || firstScan) { if ( state != oldState || dyn.resetColor || firstScan) {
if ( state) { if ( state) {
...@@ -91,11 +143,10 @@ public class GeDynAnalogColor extends GeDynElem { ...@@ -91,11 +143,10 @@ public class GeDynAnalogColor extends GeDynElem {
} }
oldState = state; oldState = state;
} }
else if ( state) else if ( state)
dyn.ignoreColor = true; dyn.ignoreColor = true;
oldValue = value;
if ( !set_color && !reset_color) if ( !set_color && !reset_color)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment