Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra #24

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading