Skip to content

Commit

Permalink
Fixed Pylint error
Browse files Browse the repository at this point in the history
  • Loading branch information
DrakBoul committed Aug 23, 2024
1 parent e7a206b commit e1336bd
Showing 1 changed file with 31 additions and 48 deletions.
79 changes: 31 additions & 48 deletions UHF/simulated_uhf.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,63 +146,46 @@ def process_cmd(cmd):
return ret


if system == 'UHF':
match request:
case 'GET_MODE':
if DEBUG:
print("Getting mode...")

ret = str(uhf_params['MODE'])

case 'SET_MODE':
if DEBUG:
print(f"set mode to: {val}")

try:
print("this ran")
uhf_params['MODE'] = int(val)
ret = f"set UHF mode to: {val}"

except ValueError as e:
print("This should run instead")
print(e)
ret = str(e)

case 'GET_BEACON':
if DEBUG:
print("Getting beacon...")
if system != 'UHF':
ret = "Invalid system type. Please send valid command."
return ret

ret = {uhf_params['BEACON']}
match request:
case 'GET_MODE':
ret = str(uhf_params['MODE'])

case 'SET_BEACON':
if DEBUG:
print(f"set mode to: {val}")
case 'SET_MODE':
try:
print("this ran")
uhf_params['MODE'] = int(val)
ret = f"set UHF mode to: {val}"

uhf_params['BEACON'] = val
ret = f"Set beacon to: {val}"
except ValueError as e:
print("This should run instead")
print(e)
ret = str(e)

case 'GET_BAUD_RATE':
if DEBUG:
print("Getting baud rate")
case 'GET_BEACON':
ret = {uhf_params['BEACON']}

ret = str(uhf_params['BAUD_RATE'])
case 'SET_BEACON':
uhf_params['BEACON'] = val
ret = f"Set beacon to: {val}"

case 'SET_BAUD_RATE':
if DEBUG:
print(f"Set baud rate to: {val}")
case 'GET_BAUD_RATE':
ret = str(uhf_params['BAUD_RATE'])

try:
uhf_params['BAUD_RATE'] = int(val)
ret = f"Set UHF baud rate to: {val}"
case 'SET_BAUD_RATE':
try:
uhf_params['BAUD_RATE'] = int(val)
ret = f"Set UHF baud rate to: {val}"

except ValueError as e:
print(e)
ret = str(e)
except ValueError as e:
print(e)
ret = str(e)

case _:
ret = "Bad system request"
else:
ret = "Invalid system type. Please send valid command."
case _:
ret = "Bad system request"

return ret

Expand Down

0 comments on commit e1336bd

Please sign in to comment.