Skip to content
Snippets Groups Projects
Commit ba6cafc3 authored by Martin's avatar Martin
Browse files

made magic number into constant

parent ceb6742f
No related branches found
No related tags found
1 merge request!23Added slots to non-gui modules
Pipeline #132066 failed
......@@ -28,6 +28,7 @@ class GrxGraphicsItem(ModuleGraphicsItem):
REGISTER_MARGIN = 10
LINE_LENGTH = 30
MUX_WIDTH = 80
REGISTER_LENGTH = 4
def __init__(self, module: GRX):
self.register_text_labels = []
......@@ -45,7 +46,7 @@ class GrxGraphicsItem(ModuleGraphicsItem):
name = "Gr" + str(index)
# Mia uses 4 hex numbers to represent the registers
hex_length = 4
hex_length = self.REGISTER_LENGTH
value_text = f"0x{register_value:0{hex_length}x}"
full_text = name + ": " + value_text[2:]
......@@ -149,7 +150,7 @@ class GrxGraphicsItem(ModuleGraphicsItem):
name = "Gr" + str(index)
# Mia uses 4 hex numbers for each register
hex_length = 4
hex_length = self.REGISTER_LENGTH
value_text = f"0x{register_value:0{hex_length}x}"
full_text = name + ": " + value_text[2:]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment