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
c42f6208
Commit
c42f6208
authored
May 28, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Elphel/meta-elphel393
parents
f7f238b6
8cbee985
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
hwmon.js
recipes-core/apps-web/files/hwmon.js
+20
-7
hwmon.php
recipes-core/apps-web/files/hwmon.php
+11
-1
No files found.
recipes-core/apps-web/files/hwmon.js
View file @
c42f6208
...
@@ -7,7 +7,10 @@ var interval_read_temperature;
...
@@ -7,7 +7,10 @@ var interval_read_temperature;
var
d0
=
Array
(
600
);
var
d0
=
Array
(
600
);
var
d1
=
Array
(
600
);
var
d1
=
Array
(
600
);
var
d2
=
Array
(
600
);
var
d2
=
Array
(
600
);
var
d3
=
Array
(
600
);
var
ds
=
[
Array
(
600
),
Array
(
600
)];
var
labels
=
[
"CPU"
,
"389"
];
var
t
=
Array
();
var
t
=
Array
();
var
level_shutdown
;
var
level_shutdown
;
...
@@ -25,7 +28,7 @@ var options = {
...
@@ -25,7 +28,7 @@ var options = {
min
:
0
,
min
:
0
,
max
:
100
max
:
100
},
},
colors
:
[
'rgba(255,100,100,0.5)'
,
'rgba(255,150,20,0.5)'
,
'rgba(100,255,100,0.5)'
,
'
black
'
],
colors
:
[
'rgba(255,100,100,0.5)'
,
'rgba(255,150,20,0.5)'
,
'rgba(100,255,100,0.5)'
,
'
rgba(0,0,0,1)'
,
'rgba(100,100,200,1)
'
],
legend
:{
legend
:{
position
:
"nw"
position
:
"nw"
},
},
...
@@ -109,6 +112,9 @@ function read_core_temp(){
...
@@ -109,6 +112,9 @@ function read_core_temp(){
url
:
"hwmon.php?cmd=t"
,
url
:
"hwmon.php?cmd=t"
,
complete
:
function
(
data
){
complete
:
function
(
data
){
console
.
log
(
data
.
responseText
);
console
.
log
(
data
.
responseText
);
temps
=
data
.
responseText
.
trim
().
split
(
" "
);
//t.push(d1.length);
//t.push(d1.length);
d0
.
splice
(
0
,
1
);
d0
.
splice
(
0
,
1
);
d0
.
push
(
level_shutdown
);
d0
.
push
(
level_shutdown
);
...
@@ -116,15 +122,22 @@ function read_core_temp(){
...
@@ -116,15 +122,22 @@ function read_core_temp(){
d1
.
push
(
level_fan_on
);
d1
.
push
(
level_fan_on
);
d2
.
splice
(
0
,
1
);
d2
.
splice
(
0
,
1
);
d2
.
push
(
level_fan_on
-
level_fan_hyst
);
d2
.
push
(
level_fan_on
-
level_fan_hyst
);
d3
.
splice
(
0
,
1
);
d3
.
push
(
data
.
responseText
);
options
.
xaxis
.
tickSize
=
Math
.
max
(
1
,
Math
.
round
(
d1
.
length
)
/
10
);
options
.
xaxis
.
tickSize
=
Math
.
max
(
1
,
Math
.
round
(
d1
.
length
)
/
10
);
$
.
plot
(
$
(
"#t_chart"
),
[
points
=
[
{
label
:
"Shutdown level"
,
data
:
get_data
(
t
,
d0
)},
{
label
:
"Shutdown level"
,
data
:
get_data
(
t
,
d0
)},
{
label
:
"Fan-On level"
,
data
:
get_data
(
t
,
d1
)},
{
label
:
"Fan-On level"
,
data
:
get_data
(
t
,
d1
)},
{
label
:
"Fan-Off level"
,
data
:
get_data
(
t
,
d2
)},
{
label
:
"Fan-Off level"
,
data
:
get_data
(
t
,
d2
)},
{
label
:
"CPU"
,
data
:
get_data
(
t
,
d3
)},
];
],
options
);
for
(
var
i
=
0
;
i
<
temps
.
length
;
i
++
){
ds
[
i
].
splice
(
0
,
1
);
ds
[
i
].
push
(
temps
[
i
]);
points
.
push
({
label
:
labels
[
i
],
data
:
get_data
(
t
,
ds
[
i
])});
}
$
.
plot
(
$
(
"#t_chart"
),
points
,
options
);
}
}
});
});
}
}
...
...
recipes-core/apps-web/files/hwmon.php
View file @
c42f6208
...
@@ -6,7 +6,17 @@ else
...
@@ -6,7 +6,17 @@ else
$cmd
=
"t"
;
$cmd
=
"t"
;
if
(
$cmd
==
"t"
){
if
(
$cmd
==
"t"
){
echo
file_get_contents
(
"/tmp/core_temp"
);
$t_cpu
=
file_get_contents
(
"/tmp/core_temp"
);
$t_10389
=
""
;
$temp1_input
=
"/sys/devices/soc0/amba@0/e0004000.ps7-i2c/i2c-0/0-001a/hwmon/hwmon0/temp1_input"
;
if
(
is_file
(
$temp1_input
)){
$t_10389
=
trim
(
file_get_contents
(
$temp1_input
));
$t_10389
=
intval
(
$t_10389
)
/
1000
;
}
echo
"
$t_cpu
$t_10389
"
;
}
}
if
(
$cmd
==
"read"
){
if
(
$cmd
==
"read"
){
...
...
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