6#include "roo_logging.h"
10#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
42 bool isUnknown()
const {
return std::isnan(current_); }
45 return current_ < other.current_;
49 return current_ == other.current_;
53 return other.current_ < current_;
57 return !(other.current_ < current_);
61 return !(current_ < other.current_);
65 return !(current_ == other.current_);
88#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
90 std::string asString()
const;
94 String asArduinoString()
const;
102 explicit Current(
float current) : current_(current) {}
185roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Current& val);
Representation of charge, internally stored as floating-point Coulombs.
float inCoulombs() const
Returns the charge in Coulombs.
Representation of current, internally stored as floating-point Amperes.
Current & operator-=(const Current &other)
bool operator<(const Current &other) const
float inKiloAmperes() const
Returns the current in kiloAmperes.
float inMegaAmperes() const
Returns the current in megaAmperes.
Current & operator/=(float div)
bool isUnknown() const
Returns whether the object represents an unknown current.
bool operator!=(const Current &other) const
friend Current UnknownCurrent()
Returns a current object representing an unknown current.
bool operator==(const Current &other) const
Current & operator*=(float multi)
float inMicroAmperes() const
Returns the current in microAmperes.
float inAmperes() const
Returns the current in Amperes.
friend Current CurrentInAmperes(float)
Returns a current object equivalent to the specified current expressed in Amperes.
Current()
Creates a current object representing an 'unknown' current.
bool operator>(const Current &other) const
Current & operator+=(const Current &other)
bool operator>=(const Current &other) const
bool operator<=(const Current &other) const
float inMilliAmperes() const
Returns the current in milliAmperes.
Representation of elapsed, internally stored as floating-point seconds.
float inSeconds() const
Returns the time in seconds.
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.
Current CurrentInKiloAmperes(float current)
Returns a current object equivalent to the specified current expressed in kiloAmperes.
Area operator+(Area a, Area b)
Time TimeInSeconds(float time)
Returns a time object equivalent to the specified time expressed in seconds.
Current CurrentInMicroAmperes(float current)
Returns a current object equivalent to the specified current expressed in microAmperes.
Current CurrentInMilliAmperes(float current)
Returns a current object equivalent to the specified current expressed in milliAmperes.
Area operator-(Area a, Area b)
Area operator/(Area a, float b)
Current CurrentInMegaAmperes(float current)
Returns a current object equivalent to the specified current expressed in megaAmperes.
Area operator*(Area a, float b)
Current UnknownCurrent()
Returns a current object representing an unknown current.
Charge ChargeInCoulombs(float charge)
Returns a charge object equivalent to the specified charge expressed in Coulombs.