From f1ea7da8fe18efa3324bb86d76f2f6994b7bbf47 Mon Sep 17 00:00:00 2001 From: FluffyCube9343 Date: Sat, 11 Mar 2023 15:08:04 -0500 Subject: [PATCH] >180 not allowed hehe :P --- app.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index a5eb5d1..4ae803b 100644 --- a/app.py +++ b/app.py @@ -35,24 +35,25 @@ def sendData(): rot = request.form.get("rot") try: - rot = int(rot) + rot = int(rot)%360 + rot = rot-360 if rot > 180 else rot print("Activated") import socket s=socket.socket() host="raspberrypi" #This is your Server IP! port=2345 - s.settimeout(5) + s.settimeout(10) s.connect((host,port)) s.send(str(rot).encode()) rece=s.recv(1024) print("Received",rece) s.close() rece = "Confirm Sent: "+rece.decode("ASCII") - return render_template("index.html", conf=rece) + return render_template("manual.html", conf=rece) except ValueError: - return render_template("index.html", conf='Invalid Input "'+rot+'"') + return render_template("manual.html", conf='Invalid Input "'+rot+'"') except: - return render_template("index.html", conf='Timeout: Unable to reach Pi') + return render_template("manual.html", conf='Timeout: Unable to reach Pi') if __name__ == "__main__": app.run(debug=True)