Skip to content

Commit 04ef11e

Browse files
committed
Multimeter: Added modes for resistance, capacitance, continuity and diode test
1 parent 7c83ece commit 04ef11e

File tree

2 files changed

+46
-9
lines changed

2 files changed

+46
-9
lines changed

scopehal/Multimeter.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ Unit Multimeter::GetMeterUnit()
5757
case Multimeter::AC_CURRENT:
5858
return Unit(Unit::UNIT_AMPS);
5959

60+
case Multimeter::RESISTANCE:
61+
case Multimeter::CONTINUITY:
62+
return Unit(Unit::UNIT_OHMS);
63+
64+
case Multimeter::CAPACITANCE:
65+
return Unit(Unit::UNIT_FARADS);
66+
67+
case Multimeter::DIODE:
6068
case Multimeter::DC_VOLTAGE:
6169
case Multimeter::DC_RMS_AMPLITUDE:
6270
case Multimeter::AC_RMS_AMPLITUDE:
@@ -79,6 +87,14 @@ Unit Multimeter::GetSecondaryMeterUnit()
7987
case Multimeter::AC_CURRENT:
8088
return Unit(Unit::UNIT_AMPS);
8189

90+
case Multimeter::RESISTANCE:
91+
case Multimeter::CONTINUITY:
92+
return Unit(Unit::UNIT_OHMS);
93+
94+
case Multimeter::CAPACITANCE:
95+
return Unit(Unit::UNIT_FARADS);
96+
97+
case Multimeter::DIODE:
8298
case Multimeter::DC_VOLTAGE:
8399
case Multimeter::DC_RMS_AMPLITUDE:
84100
case Multimeter::AC_RMS_AMPLITUDE:
@@ -108,6 +124,14 @@ string Multimeter::ModeToText(MeasurementTypes type)
108124
return "DC RMS Amplitude";
109125
case Multimeter::AC_RMS_AMPLITUDE:
110126
return "AC RMS Amplitude";
127+
case Multimeter::RESISTANCE:
128+
return "Resistance";
129+
case Multimeter::CAPACITANCE:
130+
return "Capacitance";
131+
case Multimeter::CONTINUITY:
132+
return "Continuity";
133+
case Multimeter::DIODE:
134+
return "Diode";
111135

112136
default:
113137
return "";
@@ -133,6 +157,14 @@ Multimeter::MeasurementTypes Multimeter::TextToMode(const string& mode)
133157
return Multimeter::DC_RMS_AMPLITUDE;
134158
else if(mode == "AC RMS Amplitude")
135159
return Multimeter::AC_RMS_AMPLITUDE;
160+
else if(mode == "Resistance")
161+
return Multimeter::RESISTANCE;
162+
else if(mode == "Capacitance")
163+
return Multimeter::CAPACITANCE;
164+
else if(mode == "Continuity")
165+
return Multimeter::CONTINUITY;
166+
else if(mode == "Diode")
167+
return Multimeter::DIODE;
136168

137169
//invalid / unknown
138170
return Multimeter::DC_VOLTAGE;

scopehal/Multimeter.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,20 @@ class Multimeter : public virtual Instrument
4545

4646
enum MeasurementTypes
4747
{
48-
NONE = 0x00,
49-
50-
DC_VOLTAGE = 0x01,
51-
DC_RMS_AMPLITUDE = 0x02,
52-
AC_RMS_AMPLITUDE = 0x04,
53-
FREQUENCY = 0x08,
54-
DC_CURRENT = 0x10,
55-
AC_CURRENT = 0x20,
56-
TEMPERATURE = 0x40
48+
NONE = 0x000,
49+
50+
DC_VOLTAGE = 0x001,
51+
DC_RMS_AMPLITUDE = 0x002,
52+
AC_RMS_AMPLITUDE = 0x004,
53+
FREQUENCY = 0x008,
54+
DC_CURRENT = 0x010,
55+
AC_CURRENT = 0x020,
56+
TEMPERATURE = 0x040,
57+
RESISTANCE = 0x080,
58+
CAPACITANCE = 0x100,
59+
CONTINUITY = 0x200,
60+
DIODE = 0x400
61+
5762

5863
//TODO: other types
5964
};

0 commit comments

Comments
 (0)