6void VelocityToString(Velocity val,
char* out,
int maxlen) {
8 strncpy(out,
"? m/s", maxlen);
11 const char* sign =
"";
13 if (val.inMetersPerSecond() == 0.0f) {
14 snprintf(out, maxlen,
"0 m/s");
17 if (val.inMetersPerSecond() < 0) {
23 num = val.inKilometersPerSecond();
26 num = val.inMetersPerSecond();
29 num = val.inMillimetersPerSecond();
32 num = val.inMicrometersPerSecond();
34 snprintf(out, maxlen, format, sign, num);
40#if defined(ESP32) || defined(ESP8266) || defined(__linux__)
42std::string Velocity::asString()
const {
44 VelocityToString(*
this, out, 16);
52String Velocity::asArduinoString()
const {
54 VelocityToString(*
this, out, 16);
62 VelocityToString(val, out, 16);
Representation of velocity, internally stored as floating-point meters per second.
For convenience conversion from roo_time::Duration.
roo_logging::Stream & operator<<(roo_logging::Stream &os, const Area &val)
Velocity VelocityInMillimetersPerSecond(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in millimeters per second.
Velocity VelocityInMetersPerSecond(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in meters per second.
Velocity VelocityInKilometersPerSecond(float velocity)
Returns a velocity object equivalent to the specified velocity expressed in kilometers per second.