diff --git a/modules/modbus/modbus.class.php b/modules/modbus/modbus.class.php index 0bd7827..cc277b8 100644 --- a/modules/modbus/modbus.class.php +++ b/modules/modbus/modbus.class.php @@ -439,8 +439,8 @@ function poll_device($id) if ($rec['RESPONSE_CONVERT'] == 'hex') { $result = $rec['DATA_ORIGINAL']; } - - $rec['DATA'] = $result; + + $rec['DATA'] = round($result, $rec['ROUND']); SQLUpdate('modbusdevices', $rec); if ($rec['LINKED_OBJECT'] && $rec['LINKED_PROPERTY'] && !$writing_request) { @@ -534,6 +534,7 @@ function dbInstall($data) modbusdevices: REQUEST_START int(10) NOT NULL DEFAULT '0' modbusdevices: REQUEST_TOTAL int(10) NOT NULL DEFAULT '0' modbusdevices: MULTIPLIER varchar(50) NOT NULL DEFAULT '' + modbusdevices: ROUND tinyint(10) NOT NULL DEFAULT '' modbusdevices: RESPONSE_CONVERT varchar(10) NOT NULL DEFAULT '' modbusdevices: DATA text modbusdevices: DATA_ORIGINAL text @@ -554,4 +555,4 @@ function dbInstall($data) * TW9kdWxlIGNyZWF0ZWQgSnVsIDI0LCAyMDE0IHVzaW5nIFNlcmdlIEouIHdpemFyZCAoQWN0aXZlVW5pdCBJbmMgd3d3LmFjdGl2ZXVuaXQuY29tKQ== * */ -?> \ No newline at end of file +?> diff --git a/modules/modbus/modbusdevices_edit.inc.php b/modules/modbus/modbusdevices_edit.inc.php index 39006c1..5fd57ee 100644 --- a/modules/modbus/modbusdevices_edit.inc.php +++ b/modules/modbus/modbusdevices_edit.inc.php @@ -72,6 +72,9 @@ $rec['MULTIPLIER'] = gr('multiplier'); if (!$rec['MULTIPLIER']) $rec['MULTIPLIER'] = ''; + $rec['ROUND'] = gr('round'); + if (!$rec['ROUND']=='') $rec['ROUND'] = '2'; + $rec['CHECK_NEXT'] = date('Y-m-d H:i:s'); //updating 'POLLPERIOD' (int) global $pollperiod; diff --git a/templates/modbus/modbusdevices_edit.html b/templates/modbus/modbusdevices_edit.html index 50b4ada..a8ab1ff 100644 --- a/templates/modbus/modbusdevices_edit.html +++ b/templates/modbus/modbusdevices_edit.html @@ -96,6 +96,14 @@ +
+ +
+ +
Кол-во знаков после запятой: 0,1,2 и т.д. (по умолчанию: 2)
+
+
+