-
Notifications
You must be signed in to change notification settings - Fork 0
/
phSensor.h
59 lines (51 loc) · 1.54 KB
/
phSensor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <mutex>
class phSensor
{
public:
phSensor(int position);
~phSensor();
float getNewPHReading();
float getPHReading();
int getBusAddress();
int getSlotPosition();
float getTempCompensation();
bool setTempCompensation(float newTemp);
int getCalibrationStatus();
bool clearCalibration();
bool lowpointCalibration(float phVal);
bool midpointCalibration(float phVal);
bool highpointCalibration(float phVal);
bool startSleepmode();
std::string getDeviceInfo();
bool getSlope(float &acidCalibration, float &baseCalibration); //fehlerhaft. manchal z.B.90% aber auch 100% m�glich
bool setNewBusAddress(int newAddr);
bool checkDeviceModell();
bool isDisconnected();
bool isOperating();
void setOperatingStatus(bool running);
private:
bool calibration(std::string cmd, float phVal);
float phValue;
int deviceID;
int busAddress;
int slotPosition;
bool running;
bool disconnected;
std::mutex phMtx;
};
extern std::vector<phSensor*> phSensors;
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary>Initialises the ph module.</summary>
///
/// <param name="addr"> The i2c address</param>
/// <param name="slotPosition">The slot position in the water sensor array (1-16)</param>
////////////////////////////////////////////////////////////////////////////////////////////////////
static int initPhModule(int slotPosition)
{
phSensors.push_back(new phSensor(slotPosition));
return (phSensors.size() - 1);
}