ProcessorStats class

The main class to use the main processor (MCU) as a sensor.

Base classes

class Sensor
The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.

Constructors, destructors, conversion operators

ProcessorStats(const char* version) explicit
Construct a new Processor Stats object.
~ProcessorStats()
Destroy the Processor Stats object.

Public functions

String getSensorLocation(void) -> String override
Get the pin or connection location between the mcu and the sensor.
bool addSingleMeasurementResult(void) -> bool override
Get the results from a single measurement.

Function documentation

ProcessorStats::ProcessorStats(const char* version) explicit

Construct a new Processor Stats object.

Parameters
version

The version of the MCU, if applicable.

  • For an EnviroDIY Mayfly, the version should be one of "v0.3", "v0.4", "v0.5", "v0.5b", "v1.0", or "v1.1". There is a difference between some of the versions!

Need to know the Mayfly version because the battery resistor depends on it


String ProcessorStats::getSensorLocation(void) override

Get the pin or connection location between the mcu and the sensor.

Returns String Text describing how the sensor is attached to the mcu.

This returns the processor name as read from the compiler variable.


bool ProcessorStats::addSingleMeasurementResult(void) override

Get the results from a single measurement.

Returns bool True if the function completed successfully.

This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.

This also un-sets the _millisMeasurementRequested timestamp (sets _millisMeasurementRequested to 0) and updates the _sensorStatus.