-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathisolatedBox_common.h
More file actions
116 lines (96 loc) · 2.35 KB
/
isolatedBox_common.h
File metadata and controls
116 lines (96 loc) · 2.35 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*****************************************************************//**
* \file isolatedBox_common.h
* \brief: Common types, define and class to be used
* in the ISOBOX component
*
* \author F.Morani
* \date May 2023
***********************************************************************/
#ifndef _ISO_COMMON_H_
#define _ISO_COMMON_H_
#include <chrono>
#include <cstdint>
#include <ctime>
#include <list>
#include <string>
#include <utility>
// Add Here any GPIO BASE ADDRESS
// Add here offsets of GPIO registers
//
// Add here the timeout for the event loop.
#define ISO_SCAN_RATE 5 // milliseconds
// Maximum and minimum temperatures are in celsius
#define ISO_TEMP_MAX_SP 100
#define ISO_TEMP_MIN_SP 20
#define ISO_TEMP_SP_DEFAULT 20
/******************************************************************************
* SOME TYPEDEF
*****************************************************************************/
typedef float temp_t;
typedef std::chrono::milliseconds timeProcess_t;
typedef uint32_t freq_t;
enum EquipmentState
{
DISABLED,
ENABLED
};
/***********************************************
* A structure for holding a single data point *
* of temperature in degrees celsius, as well *
* as the temp probe ID and a time stamp. *
************************************************/
struct TempStruct
{
time_t ts;
std::string id;
float temp;
};
enum TScale_E
{
CELSIUS,
FARENHEIT,
KELVIN,
MAX_VALUE_TSCALE
};
#define ISO_DEFAULT_TEMP_SCALE FARENHEIT
enum InputMode_E
{
SETPOINT,
SET_SCALE,
LOAD_PROFILE,
PID_TUNE,
INPUT_MODE_MAX_VALUE
};
struct PidDataStruct
{
std::string name;
std::string description;
float kP;
float kI;
float kD;
float volume;
};
/**
* @brief Used to define min/max/default values for a given parameter
*
*/
class ParameterLimits
{
public:
ParameterLimits(temp_t _min, temp_t _max, temp_t _defaultValue)
: min(_min), max(_max), defaultValue(_defaultValue)
{
}
temp_t validate(const temp_t _value)
{
temp_t returnValue = this->defaultValue;
if (_value <= this->max && _value >= this->min)
returnValue = _value;
return returnValue;
}
private:
temp_t min;
temp_t max;
temp_t defaultValue;
};
#endif /* _ISO_COMMON_H_ */