Skip to content

Commit 6cd44fc

Browse files
committed
LSL Green button issue resolved
1 parent 5ee39a2 commit 6cd44fc

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

templates/index.html

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,26 @@ <h1>Chords-Python Applications</h1>
114114
}
115115
}
116116

117+
function checkStatus1() {
118+
fetch("/app_status")
119+
.then(response => response.json())
120+
.then(data => {
121+
const lslButton = document.getElementById("start_lsl_button");
122+
if (data.lsl_started) {
123+
lslButton.classList.remove("lsl-not-running");
124+
lslButton.classList.add("lsl-running");
125+
lslButton.textContent = "LSL Stream Running";
126+
lslButton.disabled = true;
127+
} else {
128+
lslButton.classList.remove("lsl-running");
129+
lslButton.classList.add("lsl-not-running");
130+
lslButton.textContent = "Start LSL Stream";
131+
lslButton.disabled = false;
132+
}
133+
})
134+
.catch(error => console.error("Error fetching LSL status:", error));
135+
}
136+
117137
function checkStatus() {
118138
fetch("/app_status")
119139
.then(response => response.json())
@@ -132,17 +152,15 @@ <h1>Chords-Python Applications</h1>
132152
npgButton.disabled = false;
133153
}
134154
});
135-
}
136-
137-
setInterval(checkStatus, 20);
155+
}
138156

139157
function updateAppStatus() {
140158
fetch('/app_status')
141159
.then(response => response.json())
142160
.then(statuses => {
143161
const lslStarted = statuses.lsl_started || false;
144162
const npgStarted = statuses.npg_started || false;
145-
console.log(npgStarted);
163+
console.log(lslStarted, npgStarted);
146164
updateButtons(lslStarted, npgStarted);
147165

148166
Object.keys(statuses).forEach(app => {
@@ -160,8 +178,11 @@ <h1>Chords-Python Applications</h1>
160178
})
161179
.catch(error => console.error("Error fetching app statuses:", error));
162180
}
163-
181+
182+
setInterval(checkStatus, 50);
183+
setInterval(checkStatus1, 50);
164184
setInterval(updateAppStatus, 100); // 100 ms checking
185+
165186
document.addEventListener("DOMContentLoaded", updateAppStatus);
166187
</script>
167188
</body>

0 commit comments

Comments
 (0)