Skip to content

Commit

Permalink
✨ Adds continuous relay mode to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
donatmarko committed Jan 9, 2019
1 parent d979f92 commit c651c46
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 119 deletions.
16 changes: 8 additions & 8 deletions src/webh/esprfid.htm.gz.h

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/webh/esprfid.js.gz.h

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/webh/index.html.gz.h

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions src/webh/required.css.gz.h

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions src/webh/required.js.gz.h

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions src/websrc/esprfid.htm
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,25 @@ <h6 class="text-muted">Please refer the <a href="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/esprfid/esp-
</select>
</span>
<span class="col-xs-3">
<button id="testb" type="button" class="btn btn-primary btn-xs" onclick="testRelay()">Test</button><i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="left" data-content="Test previous relay setting. Keep in mind that this is actually triggers the relay."></i>
</span>
<button id="testb" type="button" class="btn btn-primary btn-xs" onclick="testRelay()">Test</button><i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="left" data-content="Test previous relay setting. Keep in mind that this is actually triggers the relay."></i>
</span>
</div>
<div class="row form-group">
<label class="col-xs-3">Lock Type<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right" data-content="Use momentary method for door lock counterparts, and the continuous one for electromagnetic locks."></i></label>
<span class="col-xs-9 col-md-5">
<select class="form-control input-sm" id="lockType" onchange="handleLock();">
<option selected="selected" value="0">Momentary</option>
<option value="1">Continuous</option>
</select>
</span>
</div>
<div class="row form-group" id="activateTimeForm">
<label class="col-xs-3">Activate Time<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign" aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right" data-content="Relay Toggle time in Microseconds, usually 300ms is enough for the most electric door locks"></i></label>
<span class="col-xs-9 col-md-5">
<input class="form-control input-sm" value="300" placeholder="in Microsecond" id="delay" type="text" name="hightime">
</span>
<input class="form-control input-sm" value="300" placeholder="in Microsecond" id="delay" type="text" name="hightime">
</span>
</div>
<div class="row form-group">
<br>
<br>
<div class="col-xs-9 col-md-8">
Expand Down
25 changes: 19 additions & 6 deletions src/websrc/js/esprfid.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var config = {
"rfidgain": 32,
"wifipin": 255,
"rtype": 1,
"ltype": 0,
"rpin": 4,
"rtime": 400
},
Expand Down Expand Up @@ -113,7 +114,17 @@ function handleReader() {
}
}

function handleLock() {
var lType = parseInt(document.getElementById("lockType").value);
if (lType === 0) {
document.getElementById("activateTimeForm").style.display = "block";
} else if (lType === 1) {
document.getElementById("activateTimeForm").style.display = "none";
}
}

function listhardware() {
document.getElementById("lockType").value = config.hardware.ltype;
document.getElementById("typerly").value = config.hardware.rtype;
document.getElementById("delay").value = config.hardware.rtime;
document.getElementById("wifipin").value = config.hardware.wifipin;
Expand All @@ -128,14 +139,15 @@ function listhardware() {
document.getElementById("readerType").disabled = true;
}
else {
document.getElementById("readerType").value = config.hardware.readerType;
document.getElementById("wg0pin").value = config.hardware.wgd0pin;
document.getElementById("wg1pin").value = config.hardware.wgd1pin;
document.getElementById("gpioss").value = config.hardware.sspin;
document.getElementById("gain").value = config.hardware.rfidgain;
document.getElementById("gpiorly").value = config.hardware.rpin;
document.getElementById("readerType").value = config.hardware.readerType;
document.getElementById("wg0pin").value = config.hardware.wgd0pin;
document.getElementById("wg1pin").value = config.hardware.wgd1pin;
document.getElementById("gpioss").value = config.hardware.sspin;
document.getElementById("gain").value = config.hardware.rfidgain;
document.getElementById("gpiorly").value = config.hardware.rpin;
}
handleReader();
handleLock();
}


Expand Down Expand Up @@ -177,6 +189,7 @@ function savehardware() {
config.hardware.sspin = parseInt(document.getElementById("gpioss").value);
config.hardware.rfidgain = parseInt(document.getElementById("gain").value);
config.hardware.rtype = parseInt(document.getElementById("typerly").value);
config.hardware.ltype = parseInt(document.getElementById("lockType").value);
config.hardware.rpin = parseInt(document.getElementById("gpiorly").value);
config.hardware.rtime = parseInt(document.getElementById("delay").value);
config.hardware.wifipin = parseInt(document.getElementById("wifipin").value);
Expand Down

0 comments on commit c651c46

Please sign in to comment.