smithtek-mako-rf 3.3.3 → 3.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -153,7 +153,9 @@ After Bit 15, the next row moves to the next register.
153
153
 
154
154
  ## Scale
155
155
 
156
- Optional value transformation applied after the Modbus register is read.
156
+ Optional value transformation applied after the Modbus register is read.
157
+
158
+ Decoded numeric readings are rounded to a maximum of six decimal places after Math or Range scaling. Values remain numbers, without added trailing zeros. Very small values may round to zero. Raw data in `msg.modbus.raw` is unchanged.
157
159
  The Scale field lets you adjust raw register data into meaningful engineering values without needing extra function nodes. Think of it as lightweight post-processing built directly into the driver.
158
160
 
159
161
  Choose a scaling mode for each row:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smithtek-mako-rf",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "description": "Smithtek dedicated node for communicating with the Mako PLC over RS485 or RF",
5
5
  "keywords": [
6
6
  "node-red",
@@ -678,7 +678,7 @@
678
678
  <script type="text/markdown" data-help-name="smithtek-mako-rf">
679
679
  Smithtek Mako RF / RS485.
680
680
 
681
- Read mode outputs decoded JSON in msg.payload using the Decoder map rows. Digital points (coils, discrete inputs and register bits) output numeric 1 for on and 0 for off.
681
+ Read mode outputs decoded JSON in msg.payload using the Decoder map rows. Numeric readings are rounded to at most six decimal places after Math or Range scaling, and remain numbers. Digital points (coils, discrete inputs and register bits) output numeric 1 for on and 0 for off.
682
682
  Raw modbus response is kept in msg.modbus.raw.
683
683
 
684
684
  Prefix adds text and one space before each decoder name. Leave blank to preserve names.
@@ -308,6 +308,8 @@ function toNum(v, fallback) {
308
308
  // Digital points are numeric at the output boundary. Keep the internal
309
309
  // boolean until here so saved math/masks cannot change a bit into another value.
310
310
  if (typeof val === 'boolean') val = val ? 1 : 0;
311
+ // Round final readings, including Math/Range results, without stringifying them.
312
+ if (typeof val === 'number' && Number.isFinite(val)) val = Number(val.toFixed(6)) || 0;
311
313
  setObjectProperty(decoded, name, val, "=>", prefix);
312
314
  }
313
315