diff options
| author | manuel <manuel@mausz.at> | 2013-12-26 14:55:56 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-12-26 14:55:56 +0100 |
| commit | 38a545eeb58de8aee169b9f99ca0adf3eed05bb3 (patch) | |
| tree | c8f7721ac914843876301f5ec410eb9c832328f8 | |
| parent | 4c8a650943a0e619526937543a6e4a45e12d0427 (diff) | |
| download | webiopi-38a545eeb58de8aee169b9f99ca0adf3eed05bb3.tar.gz webiopi-38a545eeb58de8aee169b9f99ca0adf3eed05bb3.tar.bz2 webiopi-38a545eeb58de8aee169b9f99ca0adf3eed05bb3.zip | |
fix fetching gas port
| -rw-r--r-- | htdocs/app/gas-control/index.html | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/htdocs/app/gas-control/index.html b/htdocs/app/gas-control/index.html index 0e9b3a1..45ad0c5 100644 --- a/htdocs/app/gas-control/index.html +++ b/htdocs/app/gas-control/index.html | |||
| @@ -7,24 +7,21 @@ | |||
| 7 | <script type="text/javascript" src="/webiopi.js"></script> | 7 | <script type="text/javascript" src="/webiopi.js"></script> |
| 8 | <script type="text/javascript"> | 8 | <script type="text/javascript"> |
| 9 | webiopi().ready(function() { | 9 | webiopi().ready(function() { |
| 10 | var GAS_PORT = 0; | ||
| 11 | webiopi().callMacro("gas_getPort", [ ], function(macro, args, data) { | 10 | webiopi().callMacro("gas_getPort", [ ], function(macro, args, data) { |
| 12 | GAS_PORT = parseInt(data) | 11 | var GAS_PORT = parseInt(data) |
| 12 | |||
| 13 | var valveButton = webiopi().createGPIOButton(GAS_PORT, "Gas Ventil: unbekannt"); | ||
| 14 | valveButton.unbind("click"); | ||
| 15 | valve_old_value = -1 | ||
| 16 | valveButton.on("updateValue", function(event, gpio, old_value, value) { | ||
| 17 | if (valve_old_value != value) { | ||
| 18 | valveButton.text(value == 0 ? "Gas Ventil auf" : "Gas Ventil zu"); | ||
| 19 | valve_old_value = value | ||
| 20 | } | ||
| 21 | }); | ||
| 22 | $("#valve").html(valveButton); | ||
| 13 | }); | 23 | }); |
| 14 | 24 | ||
| 15 | |||
| 16 | var valveButton = w().createGPIOButton(GAS_PORT, "Gas Ventil: unbekannt"); | ||
| 17 | valveButton.unbind("click"); | ||
| 18 | valve_old_value = -1 | ||
| 19 | valveButton.on("updateValue", function(event, gpio, old_value, value) { | ||
| 20 | if (valve_old_value != value) { | ||
| 21 | valveButton.text(value == 0 ? "Gas Ventil auf" : "Gas Ventil zu"); | ||
| 22 | valve_old_value = value | ||
| 23 | } | ||
| 24 | }); | ||
| 25 | $("#valve").html(valveButton); | ||
| 26 | |||
| 27 | |||
| 28 | var forceModes = [ "", "Online", "Offline" ]; | 25 | var forceModes = [ "", "Online", "Offline" ]; |
| 29 | var forceMode = forceModes[0]; | 26 | var forceMode = forceModes[0]; |
| 30 | var forceButton; | 27 | var forceButton; |
| @@ -61,7 +58,7 @@ | |||
| 61 | $("#force").html(forceButton); | 58 | $("#force").html(forceButton); |
| 62 | 59 | ||
| 63 | 60 | ||
| 64 | w().refreshGPIO(true); | 61 | webiopi().refreshGPIO(true); |
| 65 | 62 | ||
| 66 | var forceRefresh = function() { | 63 | var forceRefresh = function() { |
| 67 | webiopi().callMacro("gas_getForce", [ ], onForce); | 64 | webiopi().callMacro("gas_getForce", [ ], onForce); |
