Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 committed Aug 11, 2023
1 parent 8cdcfd0 commit cb888b4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018-2022 Apollon77
Copyright (c) 2018-2023 Apollon77

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ When you try to read data while communication is in progress your callback is ca
* Also build the libmbus binaries and tools? (if needed)

## Changelog

### __WORK IN PROGRESS__
* (JKRhb) add support for Node.js 20.x
* (hasanheroglu) add context aware support
* (sjlongland) make device ping configurable and add TCP timeout documentation

### 2.0.0 (2022-06-29)
* IMPORTANT: Minimum node.js version is not 12.x and all LTS supported up to 18.x
* Add promisified methods with Async at the end of the name (e.g. `connectAsync`)
Expand Down
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,13 @@ class MbusMaster {
// pingFirst: Work-around buggy behaviour with some M-Bus devices,
// notably Sontex Supercal531
// https://github.com/rscada/libmbus/pull/95
let pingFirst = true;

if (typeof(options) === "function") {
callback = options;
options = null;
}

if (options) {
// de-structure
({pingFirst} = options);
}
const pingFirst = (options && options.pingFirst !== undefined) ? options.pingFirst : true;

if (!this.mbusMaster.connected && !this.options.autoConnect) {
if (callback) callback(new Error('Not connected and autoConnect is false'));
Expand Down Expand Up @@ -181,7 +177,7 @@ class MbusMaster {
});
}

getDataAsync(address, options=null) {
getDataAsync(address, options = null) {
return new Promise((resolve, reject) => {
this.getData(address, options, (err, data) => {
if (err) {
Expand Down
13 changes: 5 additions & 8 deletions src/mbus-master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,12 @@ class RecieveWorker : public Nan::AsyncWorker {

memset((void *)&reply, 0, sizeof(mbus_frame));

if (ping_first)
if (ping_first && init_slaves(handle) == 0)
{
if (init_slaves(handle) == 0)
{
sprintf(error, "Failed to init slaves.");
SetErrorMessage(error);
uv_rwlock_wrunlock(lock);
return;
}
sprintf(error, "Failed to init slaves.");
SetErrorMessage(error);
uv_rwlock_wrunlock(lock);
return;
}

if (mbus_is_secondary_address(addr_str))
Expand Down

0 comments on commit cb888b4

Please sign in to comment.