rpi-io 1.2.0 → 1.2.1

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
@@ -406,7 +406,7 @@ console.log(Rio.os())
406
406
 
407
407
  To check if device is supported by **rpi-io** (device, model, os, middleware). It returns *true/false* and displays details in console.
408
408
 
409
- #### Rio.log(level)
409
+ #### Rio.logCfg(level)
410
410
  To set the level of console used in the module:
411
411
 
412
412
  - 0: no console
@@ -417,9 +417,9 @@ To set the level of console used in the module:
417
417
 
418
418
  ```javascript
419
419
  import {Rio} from "rpi-io";
420
- Rio.log(0)
420
+ Rio.logCfg(0)
421
421
  Rio.isSystemSupported() // Nothing displayed in console
422
- Rio.log(2)
422
+ Rio.logCfg(2)
423
423
  Rio.isSystemSupported() // See console below
424
424
  // 08:15:16.506 🔎 👍 Hardware is Raspberry Pi
425
425
  // 08:15:16.539 🔎 👍 Raspberry Pi 5 Model B Rev 1.0 is supported
package/esm/dev.mjs CHANGED
@@ -9,11 +9,11 @@ let debug = {
9
9
  // -------------------------------------------------------------------
10
10
  // FUNCTIONS
11
11
  /** ------------------------------------------------------------------
12
- * @function now
12
+ * @function nowStr
13
13
  * @description Return timestamp as formatted string
14
14
  * @return {String}
15
15
  */
16
- export const now = () => {
16
+ export const nowStr = () => {
17
17
  const date = new Date()
18
18
  return date.toLocaleTimeString() + "." + date.getMilliseconds().toLocaleString('en', {
19
19
  minimumIntegerDigits: 3,
@@ -29,7 +29,7 @@ export const now = () => {
29
29
  */
30
30
  export const log = function () {
31
31
  if (debug.log)
32
- console.log.apply(console, Array.prototype.concat.apply([now(), "🔎 "], arguments))
32
+ console.log.apply(console, Array.prototype.concat.apply([nowStr(), "🔎 "], arguments))
33
33
  }
34
34
 
35
35
  /** ------------------------------------------------------------------
@@ -38,15 +38,15 @@ export const log = function () {
38
38
  */
39
39
  export const trap = function () {
40
40
  if (debug.trap)
41
- console.log.apply(console, Array.prototype.concat.apply([now(), "⚠️", "\x1b[38;2;255;80;0m", ...arguments, "\x1b[0m"]))
41
+ console.log.apply(console, Array.prototype.concat.apply([nowStr(), "⚠️", "\x1b[38;2;255;80;0m", ...arguments, "\x1b[0m"]))
42
42
  }
43
43
 
44
44
  /** ------------------------------------------------------------------
45
- * @function cfgLog
45
+ * @function logCfg
46
46
  * @description Set log configuration
47
47
  * @param {Number} level 0: no log, 1: trap only, 2: trap and log
48
48
  */
49
- export const cfgLog = level => {
49
+ export const logCfg = level => {
50
50
  debug = {
51
51
  log: false,
52
52
  trap: false
package/esm/rio.mjs CHANGED
@@ -6,7 +6,7 @@
6
6
  import {spawn} from "child_process";
7
7
  import {writeFileSync, readFileSync} from "fs"
8
8
  import {exeFile, exeShell, wait} from "./utl.mjs"
9
- import {cfgLog, log, trap} from "./dev.mjs"
9
+ import {logCfg, log, trap} from "./dev.mjs"
10
10
 
11
11
  // -------------------------------------------------------------------
12
12
  // CLASS RIO AND FURTHER
@@ -628,10 +628,14 @@ Rio.isSystemSupported = () => {
628
628
  log("👍 Systems requirements for rpi-io are met")
629
629
  return true
630
630
  }
631
+ /** ------------------------------------------------------------------
632
+ * @function Rio.logCfg
633
+ */
634
+ Rio.logCfg = logCfg
631
635
  /** ------------------------------------------------------------------
632
636
  * @function Rio.log
633
637
  */
634
- Rio.log = cfgLog
638
+ Rio.log = log
635
639
  // -------------------------------------------------------------------
636
640
  // EoF
637
641
  // -------------------------------------------------------------------
package/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ 1.2.1 - Nov 10, 2025
2
+ ===================
3
+ * Change utility API function name from `Rio.log` to `Rio.logCfg`.
4
+
1
5
  1.2.0 - Nov 07, 2025
2
6
  ===================
3
7
  * New option parameter for method `monitor` to take care of bias and bounces.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rpi-io",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Nodejs module to control Raspberry Pi GPIO",
5
5
  "keywords": [
6
6
  "raspberry",
package/scr/test.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // -------------------------------------------------------------------
2
2
  // RPi GPIO CONTROL TEST SCRIPT
3
3
  // -------------------------------------------------------------------
4
- import {log, trap, now} from "../esm/dev.mjs"
4
+ import {log, trap, nowStr} from "../esm/dev.mjs"
5
5
  import {ctrlC} from "../esm/utl.mjs"
6
6
  import {Rio} from "../esm/rio.mjs"
7
7
 
@@ -12,7 +12,7 @@ import {Rio} from "../esm/rio.mjs"
12
12
  * @param {String} txt
13
13
  */
14
14
  function info(cmd, txt) {
15
- console.log(now(), "🔎", "\x1b[38;2;0;160;16m", cmd, "\x1b[0m", txt)
15
+ console.log(nowStr(), "🔎", "\x1b[38;2;0;160;16m", cmd, "\x1b[0m", txt)
16
16
  }
17
17
 
18
18
  /** ------------------------------------------------------------------
@@ -35,7 +35,7 @@ function isNumber(str) {
35
35
  // TOP LEVEL TEST
36
36
  // -------------------------------------------------------------------
37
37
  (function () {
38
- Rio.log(2)
38
+ Rio.logCfg(2)
39
39
  ctrlC(Rio.stopMonitoring)
40
40
 
41
41
  if (process.argv.length < 3) {