@@ -18,6 +18,63 @@ class CommQueue {
18
18
static constexpr uint8_t MoreAttemptsAlarmData = 3 ;
19
19
static constexpr uint8_t MoreAttemptsGridProfile = 0 ;
20
20
21
+ protected:
22
+ struct QueueElement {
23
+ Inverter<> *iv;
24
+ uint8_t cmd;
25
+ uint8_t attempts;
26
+ uint8_t attemptsMax;
27
+ uint32_t ts;
28
+ bool isDevControl;
29
+
30
+ QueueElement ()
31
+ : iv {nullptr }
32
+ , cmd {0 }
33
+ , attempts {0 }
34
+ , attemptsMax {0 }
35
+ , ts {0 }
36
+ , isDevControl {false }
37
+ {}
38
+
39
+ QueueElement (Inverter<> *iv, uint8_t cmd, bool devCtrl)
40
+ : iv {iv}
41
+ , cmd {cmd}
42
+ , attempts {DefaultAttempts}
43
+ , attemptsMax {DefaultAttempts}
44
+ , ts {0 }
45
+ , isDevControl {devCtrl}
46
+ {}
47
+
48
+ QueueElement (const QueueElement &other) // copy constructor
49
+ : iv {other.iv }
50
+ , cmd {other.cmd }
51
+ , attempts {other.attempts }
52
+ , attemptsMax {other.attemptsMax }
53
+ , ts {other.ts }
54
+ , isDevControl {other.isDevControl }
55
+ {}
56
+
57
+ void changeCmd (uint8_t cmd) {
58
+ this ->cmd = cmd;
59
+ this ->isDevControl = false ;
60
+ }
61
+
62
+ void setTs (const uint32_t ts) {
63
+ this ->ts = ts;
64
+ }
65
+
66
+ void setAttempt () {
67
+ if (this ->attempts )
68
+ this ->attempts --;
69
+ }
70
+
71
+ void incrAttempt (uint8_t attempts = 1 ) {
72
+ this ->attempts += attempts;
73
+ if (this ->attempts > this ->attemptsMax )
74
+ this ->attemptsMax = this ->attempts ;
75
+ }
76
+ };
77
+
21
78
public:
22
79
CommQueue ()
23
80
: wrPtr {0 }
@@ -123,63 +180,6 @@ class CommQueue {
123
180
return false ;
124
181
}
125
182
126
- protected:
127
- struct QueueElement {
128
- Inverter<> *iv;
129
- uint8_t cmd;
130
- uint8_t attempts;
131
- uint8_t attemptsMax;
132
- uint32_t ts;
133
- bool isDevControl;
134
-
135
- QueueElement ()
136
- : iv {nullptr }
137
- , cmd {0 }
138
- , attempts {0 }
139
- , attemptsMax {0 }
140
- , ts {0 }
141
- , isDevControl {false }
142
- {}
143
-
144
- QueueElement (Inverter<> *iv, uint8_t cmd, bool devCtrl)
145
- : iv {iv}
146
- , cmd {cmd}
147
- , attempts {DefaultAttempts}
148
- , attemptsMax {DefaultAttempts}
149
- , ts {0 }
150
- , isDevControl {devCtrl}
151
- {}
152
-
153
- QueueElement (const QueueElement &other) // copy constructor
154
- : iv {other.iv }
155
- , cmd {other.cmd }
156
- , attempts {other.attempts }
157
- , attemptsMax {other.attemptsMax }
158
- , ts {other.ts }
159
- , isDevControl {other.isDevControl }
160
- {}
161
-
162
- void changeCmd (uint8_t cmd) {
163
- this ->cmd = cmd;
164
- this ->isDevControl = false ;
165
- }
166
-
167
- void setTs (const uint32_t ts) {
168
- this ->ts = ts;
169
- }
170
-
171
- void setAttempt () {
172
- if (this ->attempts )
173
- this ->attempts --;
174
- }
175
-
176
- void incrAttempt (uint8_t attempts = 1 ) {
177
- this ->attempts += attempts;
178
- if (this ->attempts > this ->attemptsMax )
179
- this ->attemptsMax = this ->attempts ;
180
- }
181
- };
182
-
183
183
protected:
184
184
std::array<QueueElement, N> mQueue ;
185
185
0 commit comments