diff options
| author | manuel <manuel@mausz.at> | 2013-12-25 22:17:56 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-12-25 22:17:56 +0100 |
| commit | 6af233354bdf42918b45a4a79831c8e54173300f (patch) | |
| tree | b1f0ed9293297370ba87dd339dc2f65d678abb19 /htdocs | |
| parent | e3394561c91920e6d04efb1a732363ba6700b560 (diff) | |
| download | webiopi-6af233354bdf42918b45a4a79831c8e54173300f.tar.gz webiopi-6af233354bdf42918b45a4a79831c8e54173300f.tar.bz2 webiopi-6af233354bdf42918b45a4a79831c8e54173300f.zip | |
add updateValue-trigger
Diffstat (limited to 'htdocs')
| -rw-r--r-- | htdocs/webiopi.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/htdocs/webiopi.js b/htdocs/webiopi.js index f893618..568bbb0 100644 --- a/htdocs/webiopi.js +++ b/htdocs/webiopi.js | |||
| @@ -211,9 +211,12 @@ WebIOPi.prototype.addALT = function (alt, gpio, name) { | |||
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | WebIOPi.prototype.updateValue = function (gpio, value) { | 213 | WebIOPi.prototype.updateValue = function (gpio, value) { |
| 214 | old_value = w().GPIO[gpio].value | ||
| 214 | w().GPIO[gpio].value = value; | 215 | w().GPIO[gpio].value = value; |
| 215 | var style = (value == 1) ? "HIGH" : "LOW"; | 216 | var style = (value == 1) ? "HIGH" : "LOW"; |
| 216 | $("#gpio"+gpio).attr("class", style); | 217 | $("#gpio"+gpio).attr("class", style); |
| 218 | if (old_value != value) | ||
| 219 | $("#gpio"+gpio).trigger("updateValue", [ gpio, old_value, value ]) | ||
| 217 | } | 220 | } |
| 218 | 221 | ||
| 219 | WebIOPi.prototype.updateFunction = function (gpio, func) { | 222 | WebIOPi.prototype.updateFunction = function (gpio, func) { |
