-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodule.js
More file actions
49 lines (37 loc) · 1.09 KB
/
module.js
File metadata and controls
49 lines (37 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Module JavaScript for UI elements
// Main Scripts
$(window).load(function(){
$(function() {
// Get Saved Settings from server
var moduleSettingsJSON = $('#moduleSettingsArray').text();
var moduleSettings = JSON.parse(moduleSettingsJSON);
// Mode Functions
$("#mode").val(moduleSettings.mode);
function selectMode() {
if( $("#mode").val() == 'FOLLOW_PTT' ) {
$(".countDownOptions").hide();
console.log('hide');
} else {
$(".countDownOptions").show();
console.log('show');
}
}
$( "#mode" ).change( selectMode );
selectMode(); // Check on Load
// PTT Pin Functions
$("#ptt1_gpio").val(moduleSettings.ptt1_gpio);
$("#ptt2_gpio").val(moduleSettings.ptt2_gpio);
var numberOfPTTs = $('#ptt1_gpio option').length;
function setPTTs() {
if( numberOfPTTs <= 1 ) {
// Only one PTT available
$("#ptt2_gpio").hide();
$("#ptt2_gpio").val( $("#ptt1_gpio").val() ); //set PTT2 to same as PTT1
} else {
$("#ptt2_gpio").show();
}
}
$( "#ptt1_gpio" ).change( setPTTs );
setPTTs(); // Check on Load
});
});//]]>