Skip to content

Commit a2ee28f

Browse files
author
Stanisław
committed
refactor restart on reload
1 parent 5582d5d commit a2ee28f

File tree

3 files changed

+14
-42
lines changed

3 files changed

+14
-42
lines changed

assets/js/linux.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var linux = (function () {
3535

3636
if (DEBUG) console.log("Image resolution: " + res);
3737

38-
$.get("assets/python/server/run_server.php",
38+
$.get("assets/python/server/starter.php",
3939
{ resolution: res },
4040
function(data) {
4141
if (DEBUG) console.log("AJAX request sent");
@@ -48,16 +48,19 @@ var linux = (function () {
4848
* 2 - mjpeg streamer process pid
4949
*/
5050

51-
var numberOfClients = data[0];
51+
// var numberOfClients = data[0];
52+
var numberOfClients = 0;
5253
if (DEBUG) console.log("numberOfClients: " + numberOfClients);
5354

5455
/*
5556
* connect only if there is no more clients connected
5657
* TODO: should be numberOfClients == 0. Does not work properly
5758
*/
5859
if (numberOfClients >= 0 || document.domain.includes("localhost")) {
59-
serverProcessPID = data[1];
60-
mjpegStreamPID = data[2];
60+
serverProcessPID = -1;
61+
mjpegStreamPID = -1;
62+
// serverProcessPID = data[1];
63+
// mjpegStreamPID = data[2];
6164
// if the returned value is numeric (pid of the process) continue with camera
6265
if ($.isNumeric(serverProcessPID) || $.isNumeric(mjpegStreamPID)) {
6366
isCameraAvailable = true;

assets/python/server/run_server.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

turtle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
#!/bin/sh
2+
3+
# restart STM
4+
echo "Restarting STM..."
5+
sudo gpio mode 1 out
6+
sudo gpio write 1 0
7+
sleep 0.25
8+
sudo gpio write 1 1
29
exec "sudo" "/usr/bin/python3" "/home/pi/Turtle-Rover-Mission-Control/assets/python/server/server.new.py"

0 commit comments

Comments
 (0)