GroPointParent class

The Sensor sub-class for all the GroPoint sensors.

Base classes

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

Derived classes

class GroPointGPLP8
The Sensor sub-class for the GroPoint Profile GPLP8 probe.

Constructors, destructors, conversion operators

GroPointParent(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, gropointModel model = GPLPX, const char* sensName = "GroPoint-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, uint32_t stabilizationTime_ms = 100, uint32_t measurementTime_ms = 200, uint8_t incCalcValues = 0)
Construct a new GroPoint Parent object. This is only intended to be used within this library.
GroPointParent(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, gropointModel model = GPLPX, const char* sensName = "GroPoint-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, uint32_t stabilizationTime_ms = 100, uint32_t measurementTime_ms = 200, uint8_t incCalcValues = 0)
Construct a new GroPoint Parent object. This is only intended to be used within this library.
~GroPointParent() virtual
Destroy the GroPoint Parent object - no action taken.

Public functions

String getSensorLocation(void) -> String override
Get the pin or connection location between the mcu and the sensor.
bool setup(void) -> bool override
Do any one-time preparations needed before the sensor will be able to take readings.
bool wake(void) -> bool override
Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.
bool sleep(void) -> bool override
Puts the sensor to sleep, if necessary.
void powerUp(void) override
Turn on the sensor power, if applicable.
void powerDown(void) override
Turn off the sensor power, if applicable.
bool addSingleMeasurementResult(void) -> bool override
Get the results from a single measurement.

Function documentation

GroPointParent::GroPointParent(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, gropointModel model = GPLPX, const char* sensName = "GroPoint-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, uint32_t stabilizationTime_ms = 100, uint32_t measurementTime_ms = 200, uint8_t incCalcValues = 0)

Construct a new GroPoint Parent object. This is only intended to be used within this library.

Parameters
modbusAddress The modbus address of the sensor.
stream An Arduino data stream for modbus communication. See notes for more information on what streams can be used.
powerPin The pin on the mcu controlling power to the GroPoint. Use -1 if it is continuously powered.
powerPin2 The pin on the mcu controlling power to the RS485 adapter, if it is different from that used to power the sensor. Use -1 or omit if not applicable.
enablePin The pin on the mcu controlling the direction enable on the RS485 adapter, if necessary; use -1 or omit if not applicable. An RS485 adapter with integrated flow control is strongly recommended.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
model The model of GroPoint sensor.
sensName The name of the sensor. Defaults to "SDI12-Sensor".
numVariables The number of variable results returned by the sensor. Defaults to 2.
warmUpTime_ms The time in ms between when the sensor is powered on and when it is ready to receive a wake command. Defaults to 1500.
stabilizationTime_ms The time in ms between when the sensor receives a wake command and when it is able to return stable values. Defaults to 20,000 (20s).
measurementTime_ms The time in ms between when a measurement is started and when the result value is available. Defaults to 2000.
incCalcValues The number of included calculated variables from the sensor, if any. These are used for values that we would always calculate for a sensor and depend only on the raw results of that single sensor; optional with a default value of 0.

GroPointParent::GroPointParent(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, gropointModel model = GPLPX, const char* sensName = "GroPoint-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, uint32_t stabilizationTime_ms = 100, uint32_t measurementTime_ms = 200, uint8_t incCalcValues = 0)

Construct a new GroPoint Parent object. This is only intended to be used within this library.

Parameters
modbusAddress The modbus address of the sensor.
stream An Arduino data stream for modbus communication. See notes for more information on what streams can be used.
powerPin The pin on the mcu controlling power to the GroPoint. Use -1 if it is continuously powered.
powerPin2 The pin on the mcu controlling power to the RS485 adapter, if it is different from that used to power the sensor. Use -1 or omit if not applicable.
enablePin The pin on the mcu controlling the direction enable on the RS485 adapter, if necessary; use -1 or omit if not applicable. An RS485 adapter with integrated flow control is strongly recommended.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
model The model of GroPoint sensor.
sensName The name of the sensor. Defaults to "SDI12-Sensor".
numVariables The number of variable results returned by the sensor. Defaults to 2.
warmUpTime_ms The time in ms between when the sensor is powered on and when it is ready to receive a wake command. Defaults to 1500.
stabilizationTime_ms The time in ms between when the sensor receives a wake command and when it is able to return stable values. Defaults to 20,000 (20s).
measurementTime_ms The time in ms between when a measurement is started and when the result value is available. Defaults to 2000.
incCalcValues The number of included calculated variables from the sensor, if any. These are used for values that we would always calculate for a sensor and depend only on the raw results of that single sensor; optional with a default value of 0.

String GroPointParent::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.

bool GroPointParent::setup(void) override

Do any one-time preparations needed before the sensor will be able to take readings.

Returns bool True if the setup was successful.

This sets pin modes on the _powerPin, adapter power, and adapter enable pins. It also sets the expected stream timeout for modbus and updates the _sensorStatus. No sensor power is required. This will always return true.


bool GroPointParent::wake(void) override

Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.

Returns bool True if the wake function completed successfully.

Verifies that the power is on and updates the _sensorStatus. This also sets the _millisSensorActivated timestamp.


bool GroPointParent::sleep(void) override

Puts the sensor to sleep, if necessary.

Returns bool True if the sleep function completed successfully.

This also un-sets the _millisSensorActivated timestamp (sets it to 0). This does NOT power down the sensor!


void GroPointParent::powerUp(void) override

Turn on the sensor power, if applicable.

Generally this is done by setting the _powerPin HIGH. Also sets the _millisPowerOn timestamp and updates the _sensorStatus.


void GroPointParent::powerDown(void) override

Turn off the sensor power, if applicable.

Generally this is done by setting the _powerPin LOW. Also un-sets the _millisPowerOn timestamp (sets _millisPowerOn to 0) and updates the _sensorStatus.


bool GroPointParent::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.