Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meta-elphel393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
meta-elphel393
Commits
53913a6e
Commit
53913a6e
authored
May 19, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temperatures monitor page
parent
95466801
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
211 additions
and
0 deletions
+211
-0
apps-web_1.0.bb
recipes-core/apps-web/apps-web_1.0.bb
+6
-0
hwmon.html
recipes-core/apps-web/files/hwmon.html
+44
-0
hwmon.js
recipes-core/apps-web/files/hwmon.js
+132
-0
hwmon.php
recipes-core/apps-web/files/hwmon.php
+27
-0
libsjs.bb
recipes-support/libsjs/libsjs.bb
+2
-0
No files found.
recipes-core/apps-web/apps-web_1.0.bb
View file @
53913a6e
...
@@ -14,6 +14,9 @@ PR = "r0"
...
@@ -14,6 +14,9 @@ PR = "r0"
SRC_URI = "file://controls.html \
SRC_URI = "file://controls.html \
file://controls.js \
file://controls.js \
file://hwmon.html \
file://hwmon.js \
file://hwmon.php \
"
"
S = "${WORKDIR}/"
S = "${WORKDIR}/"
...
@@ -26,6 +29,9 @@ do_install_append() {
...
@@ -26,6 +29,9 @@ do_install_append() {
install -d ${D}/www/pages
install -d ${D}/www/pages
install -m 0644 ${WORKDIR}/controls.html ${D}/www/pages
install -m 0644 ${WORKDIR}/controls.html ${D}/www/pages
install -m 0644 ${WORKDIR}/controls.js ${D}/www/pages
install -m 0644 ${WORKDIR}/controls.js ${D}/www/pages
install -m 0644 ${WORKDIR}/hwmon.html ${D}/www/pages
install -m 0644 ${WORKDIR}/hwmon.js ${D}/www/pages
install -m 0644 ${WORKDIR}/hwmon.php ${D}/www/pages
}
}
PACKAGES = " apps-web"
PACKAGES = " apps-web"
...
...
recipes-core/apps-web/files/hwmon.html
0 → 100644
View file @
53913a6e
<html>
<head>
<script
src=
"js/jquery-2.2.3.min.js"
></script>
<script
src=
"js/flot/jquery.flot.min.js"
></script>
<script
src=
"hwmon.js"
></script>
<style>
input
{
width
:
50px
;
text-align
:
right
;
}
</style>
</head>
<body
onload=
'init()'
>
<table>
<tr>
<td
valign=
'top'
>
<table>
<tr>
<td>
T
<sub>
shutdown
</sub>
</td>
<td><input
type=
'text'
id=
't_shutdown'
value=
'0'
class=
'pars'
/></td>
<td>
°
C
</td>
</tr>
<tr>
<td>
T
<sub>
fan
</sub>
</td>
<td><input
type=
'text'
id=
't_fan_on'
value=
'0'
class=
'pars'
/></td>
<td>
°
C
</td>
</tr>
<tr>
<td>
Δ
T
<sub>
fan hyst
</sub>
</td>
<td><input
type=
'text'
id=
't_fan_hyst'
value=
'0'
class=
'pars'
/></td>
<td>
°
C
</td>
</tr>
<tr>
<td>
t
<sub>
scan period
</sub>
</td>
<td><input
type=
'text'
id=
'scan_period'
value=
'1'
class=
'pars'
/></td>
<td>
s
</td>
</tr>
</table>
</td>
<td><div
id=
"t_chart"
></div></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
recipes-core/apps-web/files/hwmon.js
0 → 100644
View file @
53913a6e
$
(
function
(){
//init();
});
var
interval_read_temperature
;
var
d0
=
Array
();
var
d1
=
Array
();
var
d2
=
Array
();
var
d3
=
Array
();
var
t
=
Array
();
var
level_shutdown
;
var
level_fan_on
;
var
level_fan_hyst
;
var
options
=
{
lines
:
{
show
:
true
},
points
:
{
show
:
false
},
xaxis
:
{
tickDecimals
:
0
,
tickSize
:
1
},
yaxis
:
{
min
:
0
,
max
:
100
},
colors
:
[
'rgba(255,100,100,0.5)'
,
'rgba(255,150,20,0.5)'
,
'rgba(100,255,100,0.5)'
,
'black'
]
};
function
init
(){
console
.
log
(
"hwmon init()"
);
var
tc
=
$
(
"#t_chart"
);
tc
.
css
({
width
:
"800px"
,
height
:
"600px"
,
background
:
"rgba(100,100,100,0.0)"
});
read_params
(
init_fields
);
}
function
init_fields
(){
$
(
"#t_shutdown"
).
val
(
level_shutdown
);
$
(
"#t_fan_on"
).
val
(
level_fan_on
);
$
(
"#t_fan_hyst"
).
val
(
level_fan_hyst
);
$
(
"#scan_period"
).
val
(
scan_period
);
$
(
".pars"
).
change
(
function
(){
update_params
();
});
interval_read_temperature
=
setInterval
(
read_core_temp
,
scan_period
*
1000
);
}
function
update_params
(){
level_shutdown
=
parseFloat
(
$
(
"#t_shutdown"
).
val
());
level_fan_on
=
parseFloat
(
$
(
"#t_fan_on"
).
val
());
level_fan_hyst
=
parseFloat
(
$
(
"#t_fan_hyst"
).
val
());
scan_period
=
parseFloat
(
$
(
"#scan_period"
).
val
());
$
.
ajax
({
url
:
"hwmon.php?cmd=write&temp_sampling_time="
+
scan_period
+
"&temp_major="
+
level_shutdown
+
"&temp_minor="
+
level_fan_on
+
"&temp_hyst="
+
level_fan_hyst
,
complete
:
function
(){
console
.
log
(
"parameters updated"
);
clearInterval
(
interval_read_temperature
);
interval_read_temperature
=
setInterval
(
read_core_temp
,
scan_period
*
1000
);
}
});
}
function
read_params
(
callback
){
$
.
ajax
({
url
:
"hwmon.php?cmd=read"
,
complete
:
function
(
data
){
var
tmp_str
=
data
.
responseText
;
tmp_str
=
tmp_str
.
trim
();
var
tmp_arr
=
tmp_str
.
split
(
/
\n
|: /
);
for
(
var
i
=
0
;
i
<
tmp_arr
.
length
;
i
++
){
switch
(
tmp_arr
[
i
]){
case
"temp_sampling_time"
:
scan_period
=
parseFloat
(
tmp_arr
[
i
+
1
]);
break
;
case
"temp_major"
:
level_shutdown
=
parseFloat
(
tmp_arr
[
i
+
1
]);
break
;
case
"temp_minor"
:
level_fan_on
=
parseFloat
(
tmp_arr
[
i
+
1
]);
break
;
case
"temp_hyst"
:
level_fan_hyst
=
parseFloat
(
tmp_arr
[
i
+
1
]);
break
;
default
:
break
;
}
}
callback
();
}
});
}
function
read_core_temp
(){
$
.
ajax
({
url
:
"hwmon.php?cmd=t"
,
complete
:
function
(
data
){
console
.
log
(
data
.
responseText
);
t
.
push
(
d1
.
length
);
d0
.
push
(
level_shutdown
);
d1
.
push
(
level_fan_on
);
d2
.
push
(
level_fan_on
-
level_fan_hyst
);
d3
.
push
(
data
.
responseText
);
options
.
xaxis
.
tickSize
=
Math
.
max
(
1
,
Math
.
round
(
d1
.
length
)
/
10
);
$
.
plot
(
$
(
"#t_chart"
),
[
{
label
:
"Shutdown level"
,
data
:
get_data
(
t
,
d0
)},
{
label
:
"Fan-On level"
,
data
:
get_data
(
t
,
d1
)},
{
label
:
"Fan-Off level"
,
data
:
get_data
(
t
,
d2
)},
{
label
:
"CPU"
,
data
:
get_data
(
t
,
d3
)},
],
options
);
}
});
}
function
get_data
(
x
,
y
){
var
d
=
Array
();
for
(
var
i
=
0
;
i
<
x
.
length
;
i
++
){
d
.
push
([
x
[
i
],
y
[
i
]]);
}
return
d
;
}
\ No newline at end of file
recipes-core/apps-web/files/hwmon.php
0 → 100644
View file @
53913a6e
<?php
if
(
isset
(
$_GET
[
'cmd'
]))
$cmd
=
$_GET
[
'cmd'
];
else
$cmd
=
"t"
;
if
(
$cmd
==
"t"
){
echo
file_get_contents
(
"/tmp/core_temp"
);
}
if
(
$cmd
==
"read"
){
echo
file_get_contents
(
"/tmp/core_temp_params"
);
}
if
(
$cmd
==
"write"
){
$cstr
=
""
;
foreach
(
$_GET
as
$key
=>
$val
){
if
(
strpos
(
$key
,
"temp"
)
===
0
){
$cstr
.=
"
$key
:
$val
\n
"
;
}
}
file_put_contents
(
"/tmp/core_temp_params"
,
$cstr
);
echo
"
$cstr
"
;
}
?>
recipes-support/libsjs/libsjs.bb
View file @
53913a6e
...
@@ -11,6 +11,7 @@ PR = "r0"
...
@@ -11,6 +11,7 @@ PR = "r0"
SRC_URI = "http://mirror.elphel.com/elphel393_mirror/jquery-2.2.3.min.js;md5sum=33cabfa15c1060aaa3d207c653afb1ee \
SRC_URI = "http://mirror.elphel.com/elphel393_mirror/jquery-2.2.3.min.js;md5sum=33cabfa15c1060aaa3d207c653afb1ee \
http://mirror.elphel.com/elphel393_mirror/jquery-ui-1.11.4.custom.zip;md5sum=ee19e783272a4fc4a04ff78e92694df2 \
http://mirror.elphel.com/elphel393_mirror/jquery-ui-1.11.4.custom.zip;md5sum=ee19e783272a4fc4a04ff78e92694df2 \
http://mirror.elphel.com/elphel393_mirror/bootstrap-3.3.6-dist.zip;md5sum=229936b042baadfc9f167244575ffe12 \
http://mirror.elphel.com/elphel393_mirror/bootstrap-3.3.6-dist.zip;md5sum=229936b042baadfc9f167244575ffe12 \
http://mirror.elphel.com/elphel393_mirror/flot-0.8.3.zip;md5sum=229936b042baadfc9f167244575ffe12 \
"
"
#SRC_URI[md5sum] = "33cabfa15c1060aaa3d207c653afb1ee"
#SRC_URI[md5sum] = "33cabfa15c1060aaa3d207c653afb1ee"
...
@@ -25,5 +26,6 @@ do_install() {
...
@@ -25,5 +26,6 @@ do_install() {
install -m 644 ${WORKDIR}/jquery-2.2.3.min.js ${D}/www/pages/js/
install -m 644 ${WORKDIR}/jquery-2.2.3.min.js ${D}/www/pages/js/
cp -r ${WORKDIR}/jquery-ui-1.11.4.custom ${D}/www/pages/js/jquery-ui/
cp -r ${WORKDIR}/jquery-ui-1.11.4.custom ${D}/www/pages/js/jquery-ui/
cp -r ${WORKDIR}/bootstrap-3.3.6-dist ${D}/www/pages/js/bootstrap/
cp -r ${WORKDIR}/bootstrap-3.3.6-dist ${D}/www/pages/js/bootstrap/
cp -r ${WORKDIR}/flot-0.8.3 ${D}/www/pages/js/flot/
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment