ModularSensors > Classes > Sensor > ProcessorStats
ModularSensors > Modules > Processor Metadata > ProcessorStats


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 ) override
Get the pin or connection location between the mcu and the sensor.
bool addSingleMeasurementResult(void ) override
Get the results from a single measurement.

Function documentation

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", or "v0.5b." There is a difference between the versions!

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


StringgetSensorLocation(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.


booladdSingleMeasurementResult(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.