ModularSensors > Files > sensors / ProcessorStats.h

ProcessorStats.h file

Contains the ProcessorStats sensor subclass and the variable subclasses ProcessorStats_Battery, ProcessorStats_FreeRam, and ProcessorStats_SampleNumber.

These are for metadata on the processor functionality.

Classes

class ProcessorStats
The main class to use the main processor (MCU) as a sensor.
class ProcessorStats_Battery
The Variable sub-class used for the battery voltage output measured by the processor's on-board ADC.
class ProcessorStats_FreeRam
The Variable sub-class used for the free RAM measured by the MCU.
class ProcessorStats_SampleNumber
The Variable sub-class used for the sample number output from the main processor.

Defines

#define PROCESSOR_NUM_VARIABLES = 3
Sensor::_numReturnedValues; the processor can report 3 values.

Sensor Timing

The sensor timing for the processor/mcu

  • Timing variables do not apply to the processor in the same way they do to other sensors.
#define PROCESSOR_WARM_UP_TIME_MS = 0
Sensor::_warmUpTime_ms; the processor is never powered down - there is no waiting for the processor to warmup.
#define PROCESSOR_STABILIZATION_TIME_MS = 0
Sensor::_stabilizationTime_ms; the processor is never powered down - there is no waiting for the processor to stabilize.
#define PROCESSOR_MEASUREMENT_TIME_MS = 0
Sensor::_measurementTime_ms; the processor measurement times aren't measurable.

Battery Voltage

The battery voltage variable from the processor/mcu This is the voltage as measured on the battery attached to the MCU using the inbuilt ADC, if applicable.

  • Range is assumed to be 0 to 5V
  • Accuracy is processor dependent
#define PROCESSOR_BATTERY_RESOLUTION = 3
Decimals places in string representation; battery voltage should have 3.
#define PROCESSOR_BATTERY_VAR_NUM = 0
Battery voltage is stored in sensorValues[0].
#define PROCESSOR_BATTERY_VAR_NAME = "batteryVoltage"
Variable name in ODM2 controlled vocabulary; batteryVoltage.
#define PROCESSOR_BATTERY_UNIT_NAME = "volt"
Variable unit name in ODM2 controlled vocabulary; "volt".
#define PROCESSOR_BATTERY_DEFAULT_CODE = "Battery"
Default variable short code; "Battery".

Available RAM

The RAM variable from the processor/mcu This is the amount of free space on the processor when running the program. This is just a diagnostic value. This number should always remain the same for a single logger program. If this number is not constant over time, there is a memory leak and something wrong with your logging program.

  • Range is 0 to full RAM available on processor

ProcessorStats_FreeRam(ProcessorStats* parentSense, const char* uuid = "", const char* varCode = PROCESSOR_RAM_DEFAULT_CODE) explicit

Construct a new ProcessorStats_FreeRam object.

Parameters
parentSense The parent ProcessorStats providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "FreeRam".

#define PROCESSOR_RAM_RESOLUTION = 0
Decimals places in string representation; ram should have 0 - resolution is 1 bit.
#define PROCESSOR_RAM_VAR_NUM = 1
Free RAM is stored in sensorValues[1].
#define PROCESSOR_RAM_VAR_NAME = "freeSRAM"
Variable name in ODM2 controlled vocabulary; freeSRAM.
#define PROCESSOR_RAM_UNIT_NAME = "Bit"
Variable unit name in ODM2 controlled vocabulary; "Bit".
#define PROCESSOR_RAM_DEFAULT_CODE = "FreeRam"
Default variable short code; "FreeRam".

Sample Number

The sample number variable from the processor/mcu

ProcessorStats_SampleNumber(ProcessorStats* parentSense, const char* uuid = "", const char* varCode = PROCESSOR_SAMPNUM_DEFAULT_CODE) explicit

Construct a new ProcessorStats_SampleNumber object.

Parameters
parentSense The parent ProcessorStats providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "SampNum".

#define PROCESSOR_SAMPNUM_RESOLUTION = 0
Decimals places in string representation; sample number should have 0 - resolution is 1.
#define PROCESSOR_SAMPNUM_VAR_NUM = 2
Sample number is stored in sensorValues[2].
#define PROCESSOR_SAMPNUM_VAR_NAME = "sequenceNumber"
Variable name in ODM2 controlled vocabulary; sequenceNumber.
#define PROCESSOR_SAMPNUM_UNIT_NAME = "Dimensionless"
Variable unit name in ODM2 controlled vocabulary; "Dimensionless" (sequence number)
#define PROCESSOR_SAMPNUM_DEFAULT_CODE = "SampNum"
Default variable short code; "SampNum".