diff --git a/README.md b/README.md index c222b87..35c44c7 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,14 @@ POST http://XXX.XXX.XXX.XXX:3009/shutdown } ``` + + +### Debug + +#### Check PJLINK Connection + +To check if pjlink reacts on the projector you can use a simple netcat command: `echo '%1POWR ?' | nc 192.168.XXX.XXX 4352`. There should be a response like `POWR=0`. + ### Screenshot 📸 Enable `public device url`. Make sure you also have [xserver](https://github.com/wirewirewirewire/xserver) running. This will allow you to get a screenshot of the application currently running on the public device url. diff --git a/app/hwcontrol.js b/app/hwcontrol.js index 8dfc464..77d0281 100644 --- a/app/hwcontrol.js +++ b/app/hwcontrol.js @@ -108,26 +108,37 @@ function getBalenaName() { function pjlinkSet(ip, command) { return new Promise(async (resolve, reject) => { const projector = new PJLink(ip, 4352); + var timeout = setTimeout(() => { + console.log("[PJLINK] ERROR timeout sendig command: " + command + " to: " + ip); + resolve(false); + return; + }, 10000); if (command == "on") { projector.powerOn(function (err) { if (err) { console.log("[PJLINK] error turning on", err); + clearTimeout(timeout); resolve(false); return; } console.log("[PJLINK] turned on: " + ip); + clearTimeout(timeout); resolve(true); + return; }); } if (command == "off") { projector.powerOff(function (err) { if (err) { console.log("[PJLINK] error turning on", err); + clearTimeout(timeout); resolve(false); return; } - console.log("[PJLINK] turned on: " + ip); + console.log("[PJLINK] turned off: " + ip); + clearTimeout(timeout); resolve(true); + return; }); } });