Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public String toString() {

final String[] prefixes = new String[]{"n","\u03bc","m","","k","M","G"};
float lval = value;
if(Math.abs(lval) > 1.2*max) {
if(Math.abs(lval) > 1.1*max) {
return "OUT OF RANGE";
}
StringBuilder retval = new StringBuilder();
Expand All @@ -110,4 +110,14 @@ public static MeterReading mult(MeterReading m0, MeterReading m1) {
}
return rval;
}
public static MeterReading ohmUI(MeterReading m0, MeterReading m1) {//for Ω UI method
float res=1e9f;
if (m0.value!=0) {res=(m1.value-m0.value*.09029f)//shunt + fuse + wire
/m0.value;}
return new MeterReading(res ,
(m0.n_digits+m1.n_digits)/2,
Math.abs(res*2),
"Ω"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,24 @@ public MeterReading calculate() {
}
};
l.add(mid);
mid = new MathInputDescriptor("RESISTANCE (UI METHOD)","Ω") {
@Override
public void onChosen() {}
@Override
public boolean meterSettingsAreValid() {
InputDescriptor id0 = (InputDescriptor)getSelectedDescriptor(Channel.CH1);
InputDescriptor id1 = (InputDescriptor)getSelectedDescriptor(Channel.CH2);
boolean valid = true;
valid &= id0.units.equals("A");
valid &= id1.units.equals("V");
return valid;
}
@Override
public MeterReading calculate() {
return MeterReading.ohmUI(getValue(Channel.CH1),getValue(Channel.CH2));
}
};
l.add(mid);
mid = new MathInputDescriptor("THERMOCOUPLE K","C") {
@Override
public void onChosen() {
Expand Down