Skip to content

Commit f450f0b

Browse files
committed
PR review: fix posix-only code
1 parent 8116fb7 commit f450f0b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/usr/bin/env python3
22
# A simple Python manager for "Turing Smart Screen" 3.5" IPS USB-C display
33
# https://github.com/mathoudebine/turing-smart-screen-python
4+
5+
import os
46
import signal
5-
from datetime import datetime
67
import struct
8+
from datetime import datetime
79
from time import sleep
10+
811
import serial # Install pyserial : pip install pyserial
912
from PIL import Image, ImageDraw, ImageFont # Install PIL or Pillow
1013

@@ -129,8 +132,10 @@ def sighandler(signum, frame):
129132

130133
# Set the signal handlers, to send a complete frame to the LCD before exit
131134
signal.signal(signal.SIGINT, sighandler)
132-
signal.signal(signal.SIGQUIT, sighandler)
133135
signal.signal(signal.SIGTERM, sighandler)
136+
is_posix = os.name == 'posix'
137+
if is_posix:
138+
signal.signal(signal.SIGQUIT, sighandler)
134139

135140
# Do not change COM port settings unless you know what you are doing
136141
lcd_comm = serial.Serial(COM_PORT, 115200, timeout=1, rtscts=1)

0 commit comments

Comments
 (0)