Skip to content

Commit 7c83ece

Browse files
committed
Unit: Added farad
1 parent 27e0926 commit 7c83ece

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

scopehal/Unit.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ Unit::Unit(const string& rhs)
112112
m_type = UNIT_W_M2;
113113
else if(rhs == "μA")
114114
m_type = UNIT_MICROAMPS;
115+
else if(rhs == "F")
116+
m_type = UNIT_FARADS;
115117
else
116118
LogWarning("Unrecognized unit \"%s\"\n", rhs.c_str());
117119
}
@@ -213,6 +215,9 @@ string Unit::ToString() const
213215
case UNIT_W_M2:
214216
return "W/m²";
215217

218+
case UNIT_FARADS:
219+
return "F";
220+
216221
default:
217222
return "unknown";
218223
}
@@ -491,6 +496,10 @@ void Unit::GetUnitSuffix(UnitType type, double num, double& scaleFactor, string&
491496
suffix = "RPM";
492497
break;
493498

499+
case UNIT_FARADS:
500+
suffix = "F";
501+
break;
502+
494503
//Angular degrees do not use SI prefixes
495504
case UNIT_DEGREES:
496505
suffix = "°";

scopehal/Unit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ class Unit
102102

103103
UNIT_MICROAMPS, //Another hack for current in the X axis
104104

105+
UNIT_FARADS, //Capacitance in farads
106+
105107
//TODO: more here
106108
};
107109

0 commit comments

Comments
 (0)