forked from DottoreTozzi/iSpindel-TCP-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbattery.php
executable file
·141 lines (126 loc) · 3.21 KB
/
battery.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
<?php
// Show battery status as a chart
// GET Parameters:
// name = iSpindle name
include_once("include/common_db.php");
include_once("include/common_db_query.php");
// Check GET parameters (for now: Spindle name and Timeframe to display)
if(!isset($_GET['name'])) $_GET['name'] = 'iSpindel000'; else $_GET['name'] = $_GET['name'];
list($time, $temperature, $angle, $battery) = getCurrentValues($conn, $_GET['name']);
?>
<!DOCTYPE html>
<html>
<head>
<title>iSpindle Current Data</title>
<meta http-equiv="refresh" content="120">
<meta name="Keywords" content="iSpindle, iSpindel, status, current, genericTCP">
<meta name="Description" content="iSpindle Current Status">
<script src="include/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(function ()
{
var chart_battery;
$(document).ready(function()
{
chart_battery = new Highcharts.Chart(
{
chart:
{
type: 'gauge',
plotBackgroundColor: null,
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false,
renderTo: 'battery'
},
title:
{
text: 'Aktueller Ladezustand: <?php echo $_GET['name'];?>'
},
pane: {
startAngle: -150,
endAngle: 150,
background: [{
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#FFF'],
[1, '#333']
]
},
borderWidth: 0,
outerRadius: '109%'
}, {
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#333'],
[1, '#FFF']
]
},
borderWidth: 1,
outerRadius: '107%'
}, {
// default background
}, {
backgroundColor: '#DDD',
borderWidth: 0,
outerRadius: '105%',
innerRadius: '103%'
}]
},
// the value axis
yAxis: {
min: 2.7,
max: 4.5,
minorTickInterval: 'auto',
minorTickWidth: 1,
minorTickLength: 10,
minorTickPosition: 'inside',
minorTickColor: '#666',
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'inside',
tickLength: 10,
tickColor: '#666',
labels: {
step: 2,
rotation: 'auto'
},
title: {
text: 'Volt'
},
plotBands: [{
from: 3.5,
to: 4.5,
color: '#55BF3B' // green
}, {
from: 3.1,
to: 3.6,
color: '#DDDF0D' // yellow
}, {
from: 2.7,
to: 3.1,
color: '#DF5353' // red
}]
},
series: [{
name: 'battery',
data: [<?php echo $battery;?>],
tooltip: {
valueSuffix: ' Volt'
}
}]
}); // chart
});
});
</script>
</head>
<body>
<div id="wrapper">
<script src="include/highcharts.js"></script>
<script src="include/highcharts-more.js"></script>
<div id="battery" style="width: 98%; height: 98%; position: absolute"></div>
</div>
</body>
</html>