From 79c5ec3e29545c4db95bf2813c58e8048db04bb4 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Thu, 17 Feb 2022 14:41:04 -0600 Subject: Maybe, possibly, maybe, fix things Signed-off-by: Matt Strapp --- .gitignore | 3 +++ System/system.py | 14 +++++++------- Web | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 3949b62..b6d803e 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,6 @@ venv.bak/ Results/*.csv # Uploads Uploads/* + +# Snyk (security analysis) +.dccache diff --git a/System/system.py b/System/system.py index ff7c778..826aa9b 100644 --- a/System/system.py +++ b/System/system.py @@ -6,7 +6,7 @@ from datetime import datetime from time import sleep import RPi.GPIO as GPIO import sys -import os +# import os count2 = 0 ## import cmath @@ -41,7 +41,7 @@ limit_positive_pin = 19 system_max_x = 16.5 system_min_x = -16.5 downloads_reference_dest = "." -default_results_fileName = "results.csv" +default_results_fileName = "results" # System Class @@ -89,12 +89,12 @@ class System: # Create and setup results file (to be sent back to the server and displayed/downloaded to the user) # Results file is a CSV with the following entries: angle, position, speed - self.result_filename = downloads_reference_dest + "/Downloads/" + default_results_fileName + self.result_filename = f"{sys.argv[0].split('.')[0]}.csv" print("self.result_filename") print(self.result_filename) - # Open the file for write mode. The file contents will get cleared and overwritten - result_file = open(self.result_filename, "w") - result_file.write("timestamp,angle(" + angular_units + "),position(inches),speed(percentage)\n") + # Open the file for write mode. The file will get created, assuming it does not already exist. + result_file = open(self.result_filename, "x") + result_file.write(f"timestamp,angle({angular_units}),position(inches),speed(percentage)\n") result_file.close() # Setup a thread to constantly be measuring encoder positions @@ -264,7 +264,7 @@ class System: # Write the log result_file.write("%s\n" % message) # re-write the csv headers for next logging - result_file.write("timestamp,angle(" + self.angular_units + "),position(inches),speed(percentage)\n") + result_file.write(f"timestamp,angle({self.angular_units}),position(inches),speed(percentage)\n") # Close the results file result_file.close() diff --git a/Web b/Web index ebfa5e5..260d0d1 160000 --- a/Web +++ b/Web @@ -1 +1 @@ -Subproject commit ebfa5e541c873dcbdaff3a82bbdc86c1997036b1 +Subproject commit 260d0d1039673bf231270bef2bd9fe30f81cd52c -- cgit v1.2.3