Skip to content

Commit

Permalink
Attempt to fix format and lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
et312 committed Jun 25, 2024
1 parent a69760f commit b0dfbbd
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 30 deletions.
49 changes: 42 additions & 7 deletions projects/GUI/src/BatteryGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@

def initialize(command):
try:
result = subprocess.run(command, shell=True, check=True, text=True, capture_output=True)
result = subprocess.run(
command,
shell=True,
check=True,
text=True,
capture_output=True)
return result.stdout
except subprocess.CalledProcessError as e:
print(f"Error ocurred while running command: {command}")
Expand Down Expand Up @@ -94,11 +99,39 @@ def initialize(command):
highlightthickness=BorderThickness).place(
x=533,
y=0)
tk.Label(VoltBox, text='VOLT.', font='Montserrat 20', bg='#000000', fg='white').place(x=549, y=18)
tk.Label(
VoltBox,
text='VOLT.',
font='Montserrat 20',
bg='#000000',
fg='white').place(
x=549,
y=18)

tk.Label(root, text='AFE1.', font='Montserrat 20', bg='#000000', fg='white').place(x=5, y=57)
tk.Label(root, text='AFE2.', font='Montserrat 20', bg='#000000', fg='white').place(x=5, y=191)
tk.Label(root, text='AFE3.', font='Montserrat 20', bg='#000000', fg='white').place(x=5, y=326)
tk.Label(
root,
text='AFE1.',
font='Montserrat 20',
bg='#000000',
fg='white').place(
x=5,
y=57)
tk.Label(
root,
text='AFE2.',
font='Montserrat 20',
bg='#000000',
fg='white').place(
x=5,
y=191)
tk.Label(
root,
text='AFE3.',
font='Montserrat 20',
bg='#000000',
fg='white').place(
x=5,
y=326)

for y in range(2): # AFE1
for x in range(3):
Expand Down Expand Up @@ -351,10 +384,12 @@ def handle_message(msg):
try:
decoded_message = db.decode_message(msg.arbitration_id, msg.data)
if msg.arbitration_id in DISPLAY_MSG_AFES:
afe_index = DISPLAY_MSG_AFES.index(msg.arbitration_id) # Figures out which AFE
afe_index = DISPLAY_MSG_AFES.index(
msg.arbitration_id) # Figures out which AFE
if decoded_message["id"] < 3: # only need 3 temperatures
# which AFE, temp/voltage, index in that array
AFE_Data[afe_index]["Temp"][decoded_message["id"]] = decoded_message["temp"]
AFE_Data[afe_index]["Temp"][decoded_message["id"]
] = decoded_message["temp"]
AFE_Data[afe_index]["Voltages"][3 * decoded_message["id"]
] = round(decoded_message["v1"] / 10000, 2)
AFE_Data[afe_index]["Voltages"][3 * decoded_message["id"] +
Expand Down
122 changes: 99 additions & 23 deletions projects/GUI/src/CameraGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,89 @@ def open_camera():
highlightthickness=BorderThickness).place(x=34 + (x * 137),
y=40 + (y * 50))

tk.Label(Box, text='AFE1', font='Montserrat 15', bg='#000000', fg='white').place(x=75, y=6)
tk.Label(Box, text='AFE2', font='Montserrat 15', bg='#000000', fg='white').place(x=209, y=6)
tk.Label(Box, text='AFE3', font='Montserrat 15', bg='#000000', fg='white').place(x=342, y=6)
tk.Label(
Box,
text='AFE1',
font='Montserrat 15',
bg='#000000',
fg='white').place(
x=75,
y=6)
tk.Label(
Box,
text='AFE2',
font='Montserrat 15',
bg='#000000',
fg='white').place(
x=209,
y=6)
tk.Label(
Box,
text='AFE3',
font='Montserrat 15',
bg='#000000',
fg='white').place(
x=342,
y=6)

for y in range(3):
Box = tk.Canvas(root, width=34, height=50, bg='#000000', highlightbackground='white',
highlightthickness=BorderThickness).place(x=0, y=40 + (y * 50))

tk.Label(Box, text='MAX\nTEMP', font='Montserrat 8', bg='#000000', fg='white').place(x=3, y=52)
tk.Label(Box, text='MAX\nVOLT', font='Montserrat 8', bg='#000000', fg='white').place(x=3, y=106)
tk.Label(Box, text='MIN\nVOLT', font='Montserrat 8', bg='#000000', fg='white').place(x=3, y=153)
Box = tk.Canvas(root,
width=34,
height=50,
bg='#000000',
highlightbackground='white',
highlightthickness=BorderThickness).place(x=0,
y=40 + (y * 50))

tk.Label(
Box,
text='MAX\nTEMP',
font='Montserrat 8',
bg='#000000',
fg='white').place(
x=3,
y=52)
tk.Label(
Box,
text='MAX\nVOLT',
font='Montserrat 8',
bg='#000000',
fg='white').place(
x=3,
y=106)
tk.Label(
Box,
text='MIN\nVOLT',
font='Montserrat 8',
bg='#000000',
fg='white').place(
x=3,
y=153)

for x in range(2):
Box = tk.Canvas(root, width=223, height=50, bg='#000000', highlightbackground='white',
highlightthickness=BorderThickness).place(x=0 + (x * 223), y=190)
tk.Label(Box, text='CURRENT', font='Montserrat 10', bg='#000000', fg='white').place(x=10, y=210)
tk.Label(Box, text='VOLT.', font='Montserrat 10', bg='#000000', fg='white').place(x=241, y=210)
Box = tk.Canvas(root,
width=223,
height=50,
bg='#000000',
highlightbackground='white',
highlightthickness=BorderThickness).place(x=0 + (x * 223),
y=190)
tk.Label(
Box,
text='CURRENT',
font='Montserrat 10',
bg='#000000',
fg='white').place(
x=10,
y=210)
tk.Label(
Box,
text='VOLT.',
font='Montserrat 10',
bg='#000000',
fg='white').place(
x=241,
y=210)


def redBox(message, num):
Expand All @@ -114,8 +180,12 @@ def orangeBox(message, num):
global listCount
if (listCount > 7):
listCount = 0
OrangeBox = tk.Canvas(root, width=357, height=40, bg=orange,
highlightthickness=0).place(x=448, y=List[listCount + 3])
OrangeBox = tk.Canvas(root,
width=357,
height=40,
bg=orange,
highlightthickness=0).place(x=448,
y=List[listCount + 3])
tk.Label(OrangeBox, text=message, font='Montserrat 10', bg=orange,
fg='black').place(x=450, y=(List[listCount + 3]))
tk.Label(OrangeBox, text=num, font='Montserrat 10', bg=orange,
Expand All @@ -127,8 +197,12 @@ def yellowBox(message, num):
global listCount
if (listCount > 7):
listCount = 0
YellowBox = tk.Canvas(root, width=357, height=40, bg=yellow,
highlightthickness=0).place(x=448, y=List[listCount + 3])
YellowBox = tk.Canvas(root,
width=357,
height=40,
bg=yellow,
highlightthickness=0).place(x=448,
y=List[listCount + 3])
tk.Label(YellowBox, text=message, font='Montserrat 10', bg=yellow,
fg='black').place(x=450, y=(List[listCount + 3]))
tk.Label(YellowBox, text=num, font='Montserrat 10', bg=yellow,
Expand Down Expand Up @@ -405,12 +479,14 @@ def handle_message(msg):
afe_index = DISPLAY_MSG_AFES.index(msg.arbitration_id)
if decoded_message["id"] < 3: # only need 3 temperatures
# which AFE, temp/voltage, index in that array
AFE_Data[afe_index]["Temp"][decoded_message["id"]] = decoded_message["temp"]
AFE_Data[afe_index]["Voltages"][3 * decoded_message["id"]] = decoded_message["v1"] / 1000
AFE_Data[afe_index]["Voltages"][3 *
decoded_message["id"] + 1] = decoded_message["v2"] / 1000
AFE_Data[afe_index]["Voltages"][3 *
decoded_message["id"] + 2] = decoded_message["v3"] / 1000
AFE_Data[afe_index]["Temp"][decoded_message["id"]
] = decoded_message["temp"]
AFE_Data[afe_index]["Voltages"][3 * \
decoded_message["id"]] = decoded_message["v1"] / 1000
AFE_Data[afe_index]["Voltages"][3 * \
decoded_message["id"] + 1] = decoded_message["v2"] / 1000
AFE_Data[afe_index]["Voltages"][3 * \
decoded_message["id"] + 2] = decoded_message["v3"] / 1000
AFE1FullUpdate()
AFE2FullUpdate()
AFE3FullUpdate()
Expand Down
Empty file added projects/GUI/src/__init__.py
Empty file.

0 comments on commit b0dfbbd

Please sign in to comment.