-
Notifications
You must be signed in to change notification settings - Fork 2
/
tools.php
151 lines (136 loc) · 5.58 KB
/
tools.php
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
echo('<!DOCTYPE html>
<html>
<head>
<title>Astro Pi Cam - Live</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="google" content="notranslate" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="topnav">
<a href="index.html">Live</a>
<a href="archive.php">Archive</a>
<a class="active" href="tools.php">Tools</a>
<a class="shutdown" href="shutdown.html">Shutdown</a>
<a id="topbarVersion" style="float:right;">AstroPiCam V1.0</a>
</div>
<div style="padding-left:16px">
<h2>System</h2>
<p>' . shell_exec("sudo /usr/bin/python3 /home/pi/INA219.py") . '<br>Temperature: ' . str_replace("temp=", "", shell_exec("sudo /opt/vc/bin/vcgencmd measure_temp")) . '</p>
<h2>Specifications</h2>
<p>Omegon N 130/920 EQ-2</p>
<table>
<tr>
<td>Type of build</td>
<td>Newton</td>
</tr>
<tr>
<td>Tube aperture diameter</td>
<td>130mm</td>
</tr>
<tr>
<td>Focal length</td>
<td>920mm</td>
</tr>
<tr>
<td>Aperture ratio (f/)</td>
<td>7,1</td>
</tr>
<tr>
<td>Resolving capacity</td>
<td>0,88</td>
</tr>
<tr>
<td>Limit value</td>
<td>12,4 mag</td>
</tr>
<tr>
<td>Light gathering capacity (compared to the eye)</td>
<td>350</td>
</tr>
<tr>
<td>Max. useful magnification</td>
<td>260</td>
</tr>
<tr>
<td>Eyepice aperture diameter</td>
<td>1,25"</td>
</tr>
</table><br>
<i>AstroPiCam Software V1.0</i> <a href="https://github.com/louis-e/astropicam">https://github.com/louis-e/astropicam</a><br><br>
<h2>Tools</h2>
<p>Magnification Calculator</p>
<input type="number" id="magcalc-fl" name="magcalc" value="920">
<label>mm / (K</label>
<input type="number" id="magcalc-em" name="magcalc" value="25">
<label>mm / </label>
<input type="number" id="magcalc-bm" name="magcalc" value="2">
<label>x) = </label>
<input type="number" id="magcalc-res" name="magcalc" readonly="true">
<label>x magnification</label><br>
<i style="font-size:75%;">Focal length / (Eyepiece magnification / Barlow magnification) = Total magnification</i><br><br><br>
<button class="button button3" id="stopMicroserverButton" onclick="stopMicroserver()">Stop microserver backend</button><br>
<button class="button button3" id="restartStreamButton" onclick="restartStream()">Restart stream backend</button><br>
<button class="button button2" id="deleteButton" onclick="deleteAllFiles()">Reset system</button>
<br><i id="infotext" style="font-size:80%;"></i><br>
</div>
<script>
document.getElementById("magcalc-fl").addEventListener ("change", function () {
calculateMagnification();
});
document.getElementById("magcalc-em").addEventListener ("change", function () {
calculateMagnification();
});
document.getElementById("magcalc-bm").addEventListener ("change", function () {
calculateMagnification();
});
function deleteAllFiles() {
document.getElementById("infotext").innerHTML = "Are you sure that you want to reset the <b>entire system</b>? Click <b><a onclick=\"confirmedDeletion()\">here</a></b> to confirm.";
setTimeout(function() {
document.getElementById("infotext").innerText = "";
}, 7500);
}
function confirmedDeletion() {
xmlReq = new XMLHttpRequest();
xmlReq.open("POST","deleteAllFiles.php",true);
xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlReq.send();
document.getElementById("infotext").innerHTML = "System reset successful.";
setTimeout(function() {
document.getElementById("infotext").innerText = "";
}, 7500);
}
function restartStream() {
xmlReq = new XMLHttpRequest();
xmlReq.open("POST","restartStream.php",true);
xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlReq.send();
document.getElementById("infotext").innerHTML = "Restarting stream backend...";
setTimeout(function() {
document.getElementById("infotext").innerText = "";
}, 7500);
}
function stopMicroserver() {
xmlReq = new XMLHttpRequest();
xmlReq.open("POST","restartStream.php?action=stop",true);
xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlReq.send();
document.getElementById("infotext").innerHTML = "Stopping microserver backend...";
setTimeout(function() {
document.getElementById("infotext").innerText = "";
}, 7500);
}
function calculateMagnification() {
document.getElementById("magcalc-res").value = Math.round(document.getElementById("magcalc-fl").value / (document.getElementById("magcalc-em").value / document.getElementById("magcalc-bm").value));
if (document.getElementById("magcalc-res").value > 260) {
document.getElementById("magcalc-res").style = "background-color: #ff0000;";
} else {
document.getElementById("magcalc-res").style = "background-color: #ffffff;";
}
}
</script>
</body>
</html>');
?>