6#include "roo_logging.h"
10#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
27 float inGigaOhms()
const {
return resistance_ * 0.000000001f; }
30 float inMegaOhms()
const {
return resistance_ * 0.000001f; }
33 float inKiloOhms()
const {
return resistance_ * 0.001f; }
36 float inOhms()
const {
return resistance_; }
42 float inMicroOhms()
const {
return resistance_ * 1000000.0f; }
45 float inNanoOhms()
const {
return resistance_ * 1000000000.0f; }
48 bool isUnknown()
const {
return std::isnan(resistance_); }
51 return resistance_ < other.resistance_;
55 return resistance_ == other.resistance_;
59 return other.resistance_ < resistance_;
63 return !(other.resistance_ < resistance_);
67 return !(resistance_ < other.resistance_);
71 return !(resistance_ == other.resistance_);
75 resistance_ += other.
inOhms();
80 resistance_ -= other.
inOhms();
94#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
96 std::string asString()
const;
100 String asArduinoString()
const;
108 explicit Resistance(
float resistance) : resistance_(resistance) {}
207roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Resistance& val);
Representation of current, internally stored as floating-point Amperes.
float inAmperes() const
Returns the current in Amperes.
Representation of resistance, internally stored as floating-point Ohms.
friend Resistance ResistanceInOhms(float)
Returns a resistance object equivalent to the specified resistance expressed in Ohms.
float inNanoOhms() const
Returns the resistance in nanoOhms.
float inGigaOhms() const
Returns the resistance in GigaOhms.
float inMicroOhms() const
Returns the resistance in microOhms.
bool operator<(const Resistance &other) const
float inMilliOhms() const
Returns the resistance in milliOhms.
bool operator<=(const Resistance &other) const
bool operator>(const Resistance &other) const
bool isUnknown() const
Returns whether the object represents an unknown resistance.
Resistance & operator+=(const Resistance &other)
Resistance()
Creates a resistance object representing an 'unknown' resistance.
float inKiloOhms() const
Returns the resistance in kiloOhms.
float inMegaOhms() const
Returns the resistance in MegaOhms.
bool operator!=(const Resistance &other) const
float inOhms() const
Returns the resistance in Ohms.
Resistance & operator-=(const Resistance &other)
bool operator>=(const Resistance &other) const
bool operator==(const Resistance &other) const
friend Resistance UnknownResistance()
Returns a resistance object representing an unknown resistance.
Resistance & operator/=(float div)
Resistance & operator*=(float multi)
Representation of voltage, internally stored as floating-point Volts.
float inVolts() const
Returns the voltage in Volts.
For convenience conversion from roo_time::Duration.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Current CurrentInAmperes(float current)
Returns a current object equivalent to the specified current expressed in Amperes.
Voltage VoltageInVolts(float voltage)
Returns a voltage object equivalent to the specified voltage expressed in Volts.
Resistance ResistanceInNanoOhms(float resistance)
Returns a resistance object equivalent to the specified resistance expressed in microOhms.
Area operator+(Area a, Area b)
Resistance ResistanceInMegaOhms(float resistance)
Returns a resistance object equivalent to the specified resistance expressed in MegaOhms.
Resistance ResistanceInOhms(float resistance)
Returns a resistance object equivalent to the specified resistance expressed in Ohms.
Area operator-(Area a, Area b)
Resistance ResistanceInMilliOhms(float resistance)
Returns a resistance object equivalent to the specified resistance expressed in milliOhms.
Resistance ResistanceInMicroOhms(float resistance)
Returns a resistance object equivalent to the specified resistance expressed in microOhms.
Area operator/(Area a, float b)
Resistance UnknownResistance()
Returns a resistance object representing an unknown resistance.
Area operator*(Area a, float b)
Resistance ResistanceInKiloOhms(float resistance)
Returns a resistance object equivalent to the specified resistance expressed in kiloOhms.
Resistance ResistanceInGigaOhms(float resistance)
Returns a resistance object equivalent to the specified resistance expressed in GigaOhms.