6#include "roo_logging.h"
8#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
37 bool isUnknown()
const {
return std::isnan(charge_); }
42 return charge_ == other.charge_;
48 return !(other.charge_ < charge_);
52 return !(charge_ < other.charge_);
56 return !(charge_ == other.charge_);
79#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
81 std::string asString()
const;
85 String asArduinoString()
const;
93 explicit Charge(
float charge) : charge_(charge) {}
152roo_logging::Stream&
operator<<(roo_logging::Stream& os,
const Charge& val);
Representation of charge, internally stored as floating-point Coulombs.
bool operator>=(const Charge &other) const
bool operator!=(const Charge &other) const
bool isUnknown() const
Returns whether the object represents an unknown charge.
Charge & operator*=(float multi)
Charge & operator-=(const Charge &other)
float inMilliCoulombs() const
Returns the charge in milliCoulombs.
bool operator==(const Charge &other) const
Charge & operator+=(const Charge &other)
Charge & operator/=(float div)
float inCoulombs() const
Returns the charge in Coulombs.
Charge()
Creates a charge object representing an 'unknown' charge.
bool operator<=(const Charge &other) const
float inKiloCoulombs() const
Returns the charge in kiloCoulombs.
bool operator<(const Charge &other) const
friend Charge ChargeInCoulombs(float)
Returns a charge object equivalent to the specified charge expressed in Coulombs.
friend Charge UnknownCharge()
Returns a charge object representing an unknown charge.
bool operator>(const Charge &other) const
float inMicroCoulombs() const
Returns the charge in microCoulombs.
For convenience conversion from roo_time::Duration.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Charge ChargeInKiloCoulombs(float charge)
Returns a charge object equivalent to the specified charge expressed in kiloCoulombs.
Charge ChargeInMicroCoulombs(float charge)
Returns a charge object equivalent to the specified charge expressed in microCoulombs.
Area operator+(Area a, Area b)
Charge ChargeInMilliCoulombs(float charge)
Returns a charge object equivalent to the specified charge expressed in milliCoulombs.
Area operator-(Area a, Area b)
Area operator/(Area a, float b)
Charge UnknownCharge()
Returns a charge object representing an unknown charge.
Area operator*(Area a, float b)
Charge ChargeInCoulombs(float charge)
Returns a charge object equivalent to the specified charge expressed in Coulombs.