Skip to content

Commit dff8df3

Browse files
committed
move uart parts to define
1 parent b48aeb7 commit dff8df3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

weight_predict/weight_predict.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
MAX_ITEM_REMOVALS_TO_CHECK = 3
1212
THRESHOLD_WEIGHT_PROBABILITY = 30
1313

14+
ESP_SERIAL_PORT = "/dev/ttyTHS1"
15+
PI_SERIAL_PORT = ""
16+
1417
class Slot:
1518

1619
_previous_weight_value: float
@@ -124,15 +127,15 @@ def main():
124127

125128
# Set up uart ports
126129
esp_uart_port = serial.Serial(
127-
port="/dev/ttyTHS1",
130+
port=ESP_SERIAL_PORT,
128131
baudrate=115200,
129132
bytesize=serial.EIGHTBITS,
130133
parity=serial.PARITY_NONE,
131134
stopbits=serial.STOPBITS_ONE,
132135
timeout=1
133136
)
134137
pi_uart_port = serial.Serial(
135-
port="/dev/ttyTHS0",
138+
port=PI_SERIAL_PORT,
136139
baudrate=9600,
137140
bytesize=serial.EIGHTBITS,
138141
parity=serial.PARITY_NONE,
@@ -174,7 +177,7 @@ def main():
174177
'quantity': item_change.quantity
175178
}
176179
json_str = json.dumps(json_data) + "\n"
177-
180+
178181
# Send it to pi
179182
pi_uart_port.write(json_str.encode('utf-8'))
180183

0 commit comments

Comments
 (0)