Skip to content

Commit

Permalink
Merge pull request #24 from J-MaFf/extra
Browse files Browse the repository at this point in the history
extra
  • Loading branch information
J-MaFf committed Dec 13, 2023
2 parents a62702c + 1603f6d commit 6903882
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ class RocketView:

def display_data(self, data):
# Print the headers
<<<<<<< HEAD
self.write_data(data)
print("{:<15} {:<15} \t\t {:<15}".format("Sensor type", "Timestamp", "Sensor data"))
=======
print(data)
print(
"{:<15} {:<15} \t\t {:<15}".format(
"Sensor type", "Timestamp", "Sensor data"
)
)
>>>>>>> 5c1abdc9c0852defc974838c4fb5025b56e5d746
# Loop through the data and print each item
sensors = [
"Temp1",
Expand All @@ -38,24 +33,15 @@ def display_data(self, data):
i += 1
j += 1
while i < 7:
<<<<<<< HEAD
print(sensors[i] + "\t" + str(data[0]) + "\t",
'{0:.1f}'.format(data[j]),
'\t{0:.1f}'.format(data[j+1]),
'\t{0:.1f}'.format(data[j+2]), end="\n")
i+=1
j+=3
=======
print(
sensors[i] + "\t" + str(data[0]) + "\t",
"{0:.2f}".format(data[j]),
"\t{0:.2f}".format(data[j + 1]),
"\t{0:.2f}".format(data[j + 2]),
"{0:.1f}".format(data[j]),
"\t{0:.1f}".format(data[j + 1]),
"\t{0:.1f}".format(data[j + 2]),
end="\n",
)
i += 1
j += 3
>>>>>>> 5c1abdc9c0852defc974838c4fb5025b56e5d746
"""
print(sensors[i] + "\t" + str(data[0]),
'{0:.2f}'.format(data[j]),
Expand Down Expand Up @@ -84,6 +70,6 @@ def display_data(self, data):

def write_data(self, data):
with open(self.csv_file_name, mode="a", newline="") as file:
writer = csv.writer(file, delimiter = ',', quoting = csv.QUOTE_MINIMAL)
writer = csv.writer(file, delimiter=",", quoting=csv.QUOTE_MINIMAL)
# Write the data
writer.writerow(data)

0 comments on commit 6903882

Please sign in to comment.