Skip to content

Commit

Permalink
docs: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Apr 4, 2024
1 parent 8270a94 commit f1213db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions manualtest/test-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const connection = new KnxClient({
console.log('Connected!');
console.log('----------');
// define a datapoint:
var dp = new Datapoint({
const dp = new Datapoint({
ga: process.argv[2],
dpt: 'DPT1.001'
}, connection);
if (process.argv[3]) {
var status_ga = new Datapoint({
const status_ga = new Datapoint({
ga: process.argv[3],
dpt: 'DPT1.001'
}, connection);
Expand All @@ -36,14 +36,13 @@ const connection = new KnxClient({
console.log('\n\n\n');
console.log('PRESS ANY KEY TO TOGGLE %s AND "q" TO QUIT.', process.argv[2]);
console.log('\n\n\n');
var dpVal = false;
let dpVal = false;
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on('data', (data) => {
console.log(JSON.stringify(data));
if (data[0] === 113) {
process.exit(0);
return;
}
dpVal = !dpVal;
console.log("Sending " + dpVal);
Expand Down
8 changes: 4 additions & 4 deletions manualtest/test-writestorm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ if (process.argv.length < 2) {
process.exit(1);
}

function setupSwitch(groupaddress, statusga) {
var sw = new Devices.BinarySwitch({ga: groupaddress, status_ga: statusga}, connection);
function setupSwitch(groupaddress: string, statusga: string) {
const sw = new Devices.BinarySwitch({ga: groupaddress, status_ga: statusga}, connection);
sw.on('change', (oldvalue: boolean, newvalue: boolean, ga: string) => {
console.log(" %s: **** %s current value: %j", Date.now(), ga, newvalue);
});
return sw;
}

var connection = new KnxClient({
const connection = new KnxClient({
//debug: true,
//minimumDelay: 10,
handlers: {
connected: function() {
console.log('===========\nConnected! %s \n===========', Date.now());
var v = parseInt(process.argv[2]);
const v = parseInt(process.argv[2]);
console.log('---- Writing %d ---', v);
setupSwitch('1/1/0', '1/1/100').write(v);
setupSwitch('1/1/1', '1/1/101').write(v);
Expand Down

0 comments on commit f1213db

Please sign in to comment.