add try around read for UTF-8 issue

master-b-p-s
Alan Johnston 3 weeks ago committed by GitHub
parent 9518ba870e
commit e24cdc0724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,13 +27,14 @@ if __name__ == "__main__":
if ('d' == sys.argv[1]):
debug_mode = True
try:
for line in sys.stdin:
# if (debug_mode):
# if (debug_mode):
print(line, end =" ")
logging.warning(line)
# if '^c' == line.rstrip():
# break
# if '^c' == line.rstrip():
# break
if ((line.find("MODE=a")) > 0):
system("echo '\nAPRS Mode!!\n'")
@ -111,7 +112,7 @@ if __name__ == "__main__":
mode = 'o'
change_mode = True
# if ((debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice
# if ((debug_mode == False) and (change_mode == True) and (counter == 1): # skip every other APRS command since Direwolf prints them twice
if (debug_mode == False) and (change_mode == True): # skip every other APRS command since Direwolf prints them twice
if (mode == 'f'):
blink(2)
@ -158,20 +159,21 @@ if __name__ == "__main__":
print("Command_count: ")
print(command_count)
# GPIO.output(txLed, 0)
# GPIO.output(powerPin, 0)
# GPIO.output(txLed, 0)
# GPIO.output(powerPin, 0)
system("gpio write 27 1")
system("gpio write 0 0")
system("gpio write 2 0")
system("sudo systemctl stop transmit")
# system("sudo systemctl stop cubesatsim")
# system("sudo systemctl stop cubesatsim")
print("\n/home/pi/CubeSatSim/config -" + mode)
system("/home/pi/CubeSatSim/config -" + mode)
change_mode = False
except:
print("Error reading line (probably due to UTF-8 issue)")
print("Waiting 5 seconds to allow unplug and plug of soundcard")
sleep(5)

Loading…
Cancel
Save

Powered by TurnKey Linux.