Skip to content

Commit 035de5e

Browse files
author
Ana Vuletić
authored
Merge pull request #76 from Wolkabout/bugfix/mappings-copying
Fixed up the bug, so mappings are now properly copied for every device
2 parents 341ab86 + 72d86d3 commit 035de5e

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/pre-commit/mirrors-clang-format
12+
rev: v10.0.1
13+
hooks:
14+
- id: clang-format

RELEASE_NOTES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
WolkGateway module for connecting Modbus devices to WolkAbout IoT Platform by communicating with WolkGateway.
77

8+
**Version 1.1.0**
9+
- [BUGFIX] - Copying the mappings is now properly done.
10+
811
**Version 1.0.2**
912
- [IMPROVEMENT] - Added a new version of `MoreModbus` that introduces a lot of small improvements.
1013

debian/changelog

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
wolkgatewaymodule-modbus (1.0.2) stable; urgency=medium
1+
wolkgatewaymodule-modbus (1.1.0) stable; urgency=medium
22

3-
* Added a new version of `MoreModbus` that introduces a lot of small improvements.
3+
* Copying the mappings is now properly done.
44

5-
-- Wolkabout ELab <elab@wolkabout.com> Mon, 8 Aug 2022 00:00:00 +0100
5+
-- Wolkabout ELab <elab@wolkabout.com> Thu, 6 Apr 2023 00:00:00 +0100

modbus/module/ModbusBridge.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ void ModbusBridge::initialize(const std::map<std::string, std::unique_ptr<Device
139139
}();
140140

141141
const auto device = std::make_shared<more_modbus::ModbusDevice>(key, slaveAddress);
142-
device->createGroups(mappings);
142+
143+
auto mappingsCopy = std::vector<std::shared_ptr<more_modbus::RegisterMapping>>{};
144+
for (const auto& mapping : mappings)
145+
mappingsCopy.emplace_back(std::make_shared<more_modbus::RegisterMapping>(*mapping));
146+
device->createGroups(mappingsCopy);
143147
modbusDevices.emplace_back(device);
144148

145149
m_deviceKeyBySlaveAddress.emplace(slaveAddress, key);

0 commit comments

Comments
 (0)