Skip to content

Commit 651de9c

Browse files
committed
Update comment , and print statement with relevant message
1 parent 82096d2 commit 651de9c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
app = Flask(__name__)
1414
app.secret_key = '--'
1515

16-
lsl_process = None # Process for LSL
16+
lsl_process = None # Process Variable for LSL
1717
lsl_running = False # Flag to check if LSL is running
1818
npg_running = False # Flag to check if NPG is running
19-
npg_process = None # Process for NPG
19+
npg_process = None # Process Variable for NPG
2020
app_processes = {} # Dictionary to hold other app processes
2121
current_message = None # Message to display in the UI
2222
discovered_devices = [] # List for all discovered devices
@@ -29,7 +29,7 @@ def is_process_running(name):
2929
return True # Returns True if process found
3030
return False # Returns False if process not found
3131

32-
@app.route("/")
32+
@app.route("/") # Route for the Home page
3333
def home():
3434
"""Render the home page with the current status of LSL Stream , NPG stream, running applications, messages."""
3535
return render_template("index.html", lsl_started=lsl_running, npg_started=npg_running, running_apps=[k for k,v in app_processes.items() if v.poll() is None], message=current_message, devices=session.get('devices', []), selected_device=session.get('selected_device'))
@@ -255,7 +255,7 @@ def start_lsl():
255255
lsl_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, creationflags=creation_flags, text=True, bufsize=1)
256256

257257
output = lsl_process.stdout.readline().strip()
258-
if "No" in output: # Check for failure messages in output
258+
if "Serial Connection not established properly.Try Again" in output: # Check for failure messages in output
259259
current_message = "Failed to start LSL stream"
260260
lsl_running = False
261261
else:
@@ -348,7 +348,7 @@ def event_stream():
348348
last_state = None # Initialize last_state to None
349349

350350
while True:
351-
current_state = {"lsl_running": lsl_running, "npg_running": npg_running, "running_apps": [k for k,v in app_processes.items() if v.poll() is None], "message": current_message, "stream_interrupted": (("Data Interrupted (Bluetooth Disconnected)" or "Error while closing serial connection" in current_message) if current_message else False)}
351+
current_state = {"lsl_running": lsl_running, "npg_running": npg_running, "running_apps": [k for k,v in app_processes.items() if v.poll() is None], "message": current_message, "stream_interrupted": (current_message and ("Data Interrupted (Bluetooth Disconnected)" in current_message or "Error while closing serial connection" in current_message))}
352352
if current_state != last_state:
353353
yield f"data: {json.dumps(current_state)}\n\n"
354354
last_state = current_state.copy()
@@ -369,7 +369,7 @@ def cleanup_processes():
369369
""" Remove finished processes from the app_processes dictionary."""
370370
global app_processes
371371
app_processes = {
372-
k: v for k, v in app_processes.items()
372+
k: v for k, v in app_processes.items() # need to update
373373
if v.poll() is None # Only keep running processes
374374
}
375375

0 commit comments

Comments
 (0)