Skip to content

Commit 08f2d6c

Browse files
committed
Merge branch 'master' into develop
2 parents 17eb989 + d7a89e4 commit 08f2d6c

10 files changed

Lines changed: 472 additions & 27 deletions

File tree

sources/plugins/EnOcean/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ set(ENOCEAN_SOURCES ${ENOCEAN_SOURCES}
325325

326326
profiles/hardCoded/Profile_A5_20_01.cpp
327327
profiles/hardCoded/Profile_A5_20_01.h
328+
profiles/hardCoded/Profile_A5_20_06.cpp
329+
profiles/hardCoded/Profile_A5_20_06.h
328330

329331
profiles/hardCoded/Profile_A5_30_01.cpp
330332
profiles/hardCoded/Profile_A5_30_01.h

sources/plugins/EnOcean/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### 2.2.2
2+
* Fix first command on A5-20-01 profile
3+
* Fix "Actuator Set Output" command on D2-01-0E profile
4+
* Add A5-20-06 profile support
5+
16
### 2.2.1
27
* Fixes on A5-20-01 profile :
38
* External sensor sent value

sources/plugins/EnOcean/locales.in/en.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@
6464
}
6565
}
6666
},
67+
"A5-20-06": {
68+
"content": {
69+
"useInternalSensor": {
70+
"name": "Sensor-based control",
71+
"values": {
72+
"internal": "internal",
73+
"external": "external"
74+
}
75+
},
76+
"communicationInterval": {
77+
"name": "Communication interval",
78+
"values": {
79+
"auto": "auto",
80+
"_2_minutes": "2 minutes",
81+
"_5_minutes": "5 minutes",
82+
"_10_minutes": "10 minutes",
83+
"_20_minutes": "20 minutes",
84+
"_30_minutes": "30 minutes",
85+
"_60_minutes": "60 minutes",
86+
"_120_minutes": "120 minutes"
87+
}
88+
}
89+
}
90+
},
6791
"D2-00-01": {
6892
"content": {
6993
"setPointEnable": {

sources/plugins/EnOcean/locales.in/fr.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@
6464
}
6565
}
6666
},
67+
"A5-20-06": {
68+
"content": {
69+
"useInternalSensor": {
70+
"name": "Régulation basée sur le capteur",
71+
"values": {
72+
"internal": "interne",
73+
"external": "externe"
74+
}
75+
},
76+
"communicationInterval": {
77+
"name": "Intervale de communication",
78+
"values": {
79+
"auto": "auto",
80+
"_2_minutes": "2 minutes",
81+
"_5_minutes": "5 minutes",
82+
"_10_minutes": "10 minutes",
83+
"_20_minutes": "20 minutes",
84+
"_30_minutes": "30 minutes",
85+
"_60_minutes": "60 minutes",
86+
"_120_minutes": "120 minutes"
87+
}
88+
}
89+
}
90+
},
6791
"D2-00-01": {
6892
"content": {
6993
"setPointEnable": {

sources/plugins/EnOcean/package.in.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,35 @@
6464
}
6565
}
6666
},
67+
"A5-20-06": {
68+
"type": "section",
69+
"content": {
70+
"useInternalSensor": {
71+
"name": "Use internal sensor",
72+
"type": "enum",
73+
"values": {
74+
"internal": "internal",
75+
"external": "external"
76+
},
77+
"defaultValue": "internal"
78+
},
79+
"communicationInterval": {
80+
"name": "Communication Interval",
81+
"type": "enum",
82+
"values": {
83+
"auto": "auto",
84+
"_2_minutes": "2_minutes",
85+
"_5_minutes": "5_minutes",
86+
"_10_minutes": "10_minutes",
87+
"_20_minutes": "20_minutes",
88+
"_30_minutes": "30_minutes",
89+
"_60_minutes": "60_minutes",
90+
"_120_minutes": "120_minutes"
91+
},
92+
"defaultValue": "auto"
93+
}
94+
}
95+
},
6796
"D2-00-01": {
6897
"type": "section",
6998
"content": {

sources/plugins/EnOcean/profiles/hardCoded/Profile_A5_20_01.cpp

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ CProfile_A5_20_01::CProfile_A5_20_01(const std::string& deviceId,
2525
m_externalSensorTemperature, m_summerMode
2626
})
2727
{
28+
// We always must send a command as answer, init first command
29+
updatePendingCommand();
2830
}
2931

3032
const std::string& CProfile_A5_20_01::profile() const
@@ -92,20 +94,6 @@ std::vector<boost::shared_ptr<const yApi::historization::IHistorizable>> CProfil
9294
m_actuatorObstructed->set(aco);
9395
m_internalSensorTemperature->set(byteToCelciusDegrees(tmp));
9496

95-
if (m_pendingCommand.empty())
96-
{
97-
// We always must send a command as answer. Init first command from received message.
98-
m_pendingCommand.resize(4 * 8);
99-
100-
bitset_insert(m_pendingCommand, 0, 8, 50); // Valve default position to 50%
101-
bitset_insert(m_pendingCommand, 21, 1, false); // Set Point Selection (false = valve position)
102-
bitset_insert(m_pendingCommand, 8, 8, 0); // Use internal sensor
103-
bitset_insert(m_pendingCommand, 20, 1, false); // Summer bit (false = not in summer mode)
104-
bitset_insert(m_pendingCommand, 22, 1, false); // Set Point inversed (false = not inversed)
105-
106-
bitset_insert(m_pendingCommand, 28, 1, true); // Data telegram
107-
}
108-
10997
message::CMessageHelpers::sendMessage(CRorgs::k4BS_Telegram,
11098
messageHandler,
11199
senderId,
@@ -114,14 +102,14 @@ std::vector<boost::shared_ptr<const yApi::historization::IHistorizable>> CProfil
114102
"send command");
115103

116104
YADOMS_LOG(trace) << "Message sent to " + m_deviceId + " (A5-20-01) :";
117-
YADOMS_LOG(trace) << " - SP , Valve Position or Temperature Set Point: " << bitset_extract(m_pendingCommand, 0, 8) << " => " <<
105+
YADOMS_LOG(trace) << " - SP , Valve Position or Temperature Set Point: " << bitset_extract(m_pendingCommand, 0, 8) << " => " <<
118106
(bitset_extract(m_pendingCommand, 21, 1)
119107
? (std::to_string(byteToCelciusDegrees(bitset_extract(m_pendingCommand, 0, 8))) + "°C")
120108
: (std::to_string(bitset_extract(m_pendingCommand, 0, 8)) + "%"));
121109
YADOMS_LOG(trace) << " - TMP , Temperature from RCU : " << bitset_extract(m_pendingCommand, 8, 8) << " => " <<
122110
(bitset_extract(m_pendingCommand, 8, 8) == 0
123111
? "Internal sensor used"
124-
: (std::to_string(byteToCelciusDegrees(bitset_extract(m_pendingCommand, 8, 8))) + "°C"));
112+
: (std::to_string(byteToCelciusDegrees(255 - bitset_extract(m_pendingCommand, 8, 8))) + "°C"));
125113
YADOMS_LOG(trace) << " - SB , Summer bit : " << (bitset_extract(m_pendingCommand, 20, 1) ? true : false);
126114
YADOMS_LOG(trace) << " - SPS , SetPoint Selection : " << (bitset_extract(m_pendingCommand, 21, 1) ? true : false) << " => " <<
127115
(bitset_extract(m_pendingCommand, 21, 1)
@@ -155,8 +143,23 @@ void CProfile_A5_20_01::sendCommand(const std::string& keyword,
155143
if (keyword == m_summerMode->getKeyword())
156144
m_summerMode->setCommand(commandBody);
157145

146+
updatePendingCommand();
147+
}
148+
149+
void CProfile_A5_20_01::sendConfiguration(const shared::CDataContainer& deviceConfiguration,
150+
const std::string& senderId,
151+
boost::shared_ptr<IMessageHandler> messageHandler)
152+
{
153+
m_useInternalSensor = deviceConfiguration.get<std::string>("useInternalSensor") == "internal";
154+
m_setPointInverse = deviceConfiguration.get<bool>("setPointInverse");
155+
156+
updatePendingCommand();
157+
}
158+
159+
void CProfile_A5_20_01::updatePendingCommand()
160+
{
161+
std::lock_guard<std::mutex> guard(m_pendingCommandMutex);
158162

159-
// Create message to send at next device wakeup
160163
m_pendingCommand.resize(4 * 8);
161164
m_pendingCommand.reset();
162165

@@ -174,14 +177,6 @@ void CProfile_A5_20_01::sendCommand(const std::string& keyword,
174177
bitset_insert(m_pendingCommand, 28, 1, true); // Data telegram
175178
}
176179

177-
void CProfile_A5_20_01::sendConfiguration(const shared::CDataContainer& deviceConfiguration,
178-
const std::string& senderId,
179-
boost::shared_ptr<IMessageHandler> messageHandler)
180-
{
181-
m_useInternalSensor = deviceConfiguration.get<std::string>("useInternalSensor") == "internal";
182-
m_setPointInverse = deviceConfiguration.get<bool>("setPointInverse");
183-
}
184-
185180
double CProfile_A5_20_01::byteToCelciusDegrees(const unsigned int byte)
186181
{
187182
// Rounded to 1 decimal

sources/plugins/EnOcean/profiles/hardCoded/Profile_A5_20_01.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class CProfile_A5_20_01 : public IType
3232
// [END] IType implementation
3333

3434
private:
35+
void updatePendingCommand();
3536
[[nodiscard]] double byteToCelciusDegrees(const unsigned int byte);
3637
[[nodiscard]] std::uint8_t celciusDegreesToByte(const double degrees);
3738

@@ -53,6 +54,6 @@ class CProfile_A5_20_01 : public IType
5354
bool m_useInternalSensor = true;
5455
bool m_setPointInverse = false;
5556

56-
57+
std::mutex m_pendingCommandMutex;
5758
boost::dynamic_bitset<> m_pendingCommand;
5859
};

0 commit comments

Comments
 (0)