From a522b4c9b17fbfa3c72ea9bb3f519f9fdce657d1 Mon Sep 17 00:00:00 2001 From: Ben Coombs <bencoombs@protonmail.com> Date: Wed, 6 Jan 2021 11:51:53 +1300 Subject: [PATCH] Removed Flask and used python3 -m http.server to not break previous file structure. Added basic show/hide controls feature. --- app.py | 26 ------------------- .../breath_plot.html => breath_plot.html | 22 +++++++++++++--- {static/js => js}/respiration_math.js | 0 simple_serial/simple_serial.ino | 18 ------------- 4 files changed, 19 insertions(+), 47 deletions(-) delete mode 100644 app.py rename templates/breath_plot.html => breath_plot.html (98%) rename {static/js => js}/respiration_math.js (100%) delete mode 100644 simple_serial/simple_serial.ino diff --git a/app.py b/app.py deleted file mode 100644 index e0dc8a6..0000000 --- a/app.py +++ /dev/null @@ -1,26 +0,0 @@ -from flask import Flask, render_template; -import serial; -import time; - -app = Flask(__name__) - -@app.route('/') -def index(): - return render_template('breath_plot.html') - -if __name__ == '__main__': - app.run(debug=True, host='0.0.0.0') - -#ser = serial.Serial('COM4', 112500, timeout=1) -#print(ser.name) -#ser.flushInput() - -#while True: -# try: -# ser.write(b'A') -# time.sleep(0.1) -# ser_bytes = ser.readline() -# print(ser_bytes) -# except KeyboardInterrupt: -# print("Keyboard Interrupt") -# break diff --git a/templates/breath_plot.html b/breath_plot.html similarity index 98% rename from templates/breath_plot.html rename to breath_plot.html index 3cc59a7..1c7caaa 100644 --- a/templates/breath_plot.html +++ b/breath_plot.html @@ -28,7 +28,7 @@ Breath Plot: COVID-19 Respiration Analysis Software <!-- Load plotly.js into the DOM --> <script src='https://cdn.plot.ly/plotly-latest.min.js'></script> - <script src='./static/js/respiration_math.js'></script> + <script src='./js/respiration_math.js'></script> <title>Public Invention Respiration Analysis</title> @@ -189,7 +189,10 @@ an interactive or static analysis of a respiration. It's primary purpose is <!-- CONTROL PANEL START --> <div class="container-fluid" id="control_area"> - <div class="row"> + <div class="row" id="control-panel-hidden"> + <button type="button" class="btn btn-primary">SHOW CONTROLS</button> + </div> + <div class="row" id="control-panel-expanded"> <div class="col-6"> <div class="control-wrapper row"> <label class="col-2" for="control-mode">Mode:</label> @@ -579,7 +582,7 @@ var intervalID = null; // CONTROL PANEL VARIABLES START - +var controlsVisible = false; // CONTROL PANEL VARIABLES END @@ -1490,6 +1493,19 @@ $( document ).ready(function() { }); + $("#control-panel-hidden button").click(()=> { + console.log("show panel"); + if (controlsVisible){ + $("#control-panel-expanded").hide(); + controlsVisible = false; + } else { + $("#control-panel-expanded").show(); + controlsVisible = true; + } + }); + + $("#control-panel-expanded").hide(); + $("#control-mode").on("input", () => { var m = $("#control-mode").val(); if (m === "0"){ diff --git a/static/js/respiration_math.js b/js/respiration_math.js similarity index 100% rename from static/js/respiration_math.js rename to js/respiration_math.js diff --git a/simple_serial/simple_serial.ino b/simple_serial/simple_serial.ino deleted file mode 100644 index 59197af..0000000 --- a/simple_serial/simple_serial.ino +++ /dev/null @@ -1,18 +0,0 @@ -int incomingByte = 0; // for incoming serial data - -void setup() { - Serial.begin(112500); -} - -void loop() { - // put your main code here, to run repeatedly: - // reply only when you receive data: - if (Serial.available() > 0) { - // read the incoming byte: - incomingByte = Serial.read(); - - // say what you got: - Serial.print("I received: "); - Serial.println(incomingByte, DEC); - } -} -- GitLab