Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HEV - High Energy Ventilator
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
HEV - High Energy Ventilator
Commits
937b62d5
Commit
937b62d5
authored
5 years ago
by
Adam Abed Abud
Browse files
Options
Downloads
Patches
Plain Diff
Automatic update of the parameters
parent
0d5f3f0c
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
raspberry-backend/app.py
+1
-1
1 addition, 1 deletion
raspberry-backend/app.py
raspberry-backend/templates/index_v3.html
+22
-10
22 additions, 10 deletions
raspberry-backend/templates/index_v3.html
with
23 additions
and
11 deletions
raspberry-backend/app.py
+
1
−
1
View file @
937b62d5
...
...
@@ -22,7 +22,7 @@ def hello_world():
def
hello_worlds
():
return
render_template
(
'
index_v3.html
'
,
result
=
live_data
())
@WEBAPP.route
(
'
/live-data
'
)
@WEBAPP.route
(
'
/live-data
'
,
methods
=
[
'
GET
'
]
)
def
live_data
():
"""
Query the sqlite3 table
...
...
This diff is collapsed.
Click to expand it.
raspberry-backend/templates/index_v3.html
+
22
−
10
View file @
937b62d5
...
...
@@ -214,23 +214,35 @@ function checkTime(i) {
}
</script>
<script>
<script>
// Example for parsing Json
//var txt = '{ "fruit": "pineapple", "fingers": 10 }';
//var obj = JSON.parse(txt);
//console.log(obj.fruit);
var
txt
=
{{
result
.
data
|
tojson
|
safe
}}
;
//var obj = JSON.stringify(txt)
var
obj
=
JSON
.
parse
(
txt
);
document
.
getElementById
(
"
pressure
"
).
innerHTML
=
obj
.
pressure
;
document
.
getElementById
(
"
temperature
"
).
innerHTML
=
obj
.
temperature
;
document
.
getElementById
(
"
pressure2
"
).
innerHTML
=
obj
.
pressure
;
document
.
getElementById
(
"
temperature2
"
).
innerHTML
=
obj
.
temperature
;
//document.getElementById("pressure").innerHTML = obj.pressure;
//document.getElementById("temperature").innerHTML = obj.temperature;
//document.getElementById("pressure2").innerHTML = obj.pressure;
//document.getElementById("temperature2").innerHTML = obj.temperature;
</script>
<script
type=
text/javascript
>
function
update_variables
()
{
$
.
getJSON
(
"
live-data
"
,
function
(
data
)
{
document
.
getElementById
(
"
pressure
"
).
innerHTML
=
data
.
pressure
;
document
.
getElementById
(
"
temperature
"
).
innerHTML
=
data
.
temperature
;
document
.
getElementById
(
"
pressure2
"
).
innerHTML
=
data
.
pressure
;
document
.
getElementById
(
"
temperature2
"
).
innerHTML
=
data
.
temperature
;
}
);
}
setInterval
(
'
update_variables()
'
,
2000
);
</script>
</body>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment