improve serial hotplug (#389)

* - disable device when error indecates that the problem is not solvable on reconnect
- introduce a preOpenDelay of 2 seconds (currently value is hardcoded)

* rs232:
- make preOpenDelay available via webui
- fix preOpenDelay
- add basic usb serial detection

* - revert 3819ae7
- fix schema files

* make json checks compat with utf8+bom

* make shutdown effect a bit more flexible
This commit is contained in:
redPanther
2017-02-09 20:10:57 +01:00
committed by GitHub
parent 3819ae72ca
commit 170ad4f5db
26 changed files with 712 additions and 294 deletions

View File

@@ -13,21 +13,25 @@ sleepTime = float(hyperion.args.get('speed', 1.0))*0.5
alarmColor = hyperion.args.get('alarm-color', (255,0,0))
postColor = hyperion.args.get('post-color', (255,174,11))
off = bool(hyperion.args.get('shutdown-enabled', False))
initialBlink = bool(hyperion.args.get('initial-blink', True))
setPostColor = bool(hyperion.args.get('set-post-color', True))
width = 12
height = 10
imageData = bytearray(height * width * (0,0,0))
# Start the write data loop
for i in range(6):
if hyperion.abort():
off = False
break
if i % 2:
hyperion.setColor(alarmColor[0], alarmColor[1], alarmColor[2])
else:
hyperion.setColor(0, 0, 0)
time.sleep(sleepTime)
if initialBlink:
for i in range(6):
if hyperion.abort():
off = False
break
if i % 2:
hyperion.setColor(alarmColor[0], alarmColor[1], alarmColor[2])
else:
hyperion.setColor(0, 0, 0)
time.sleep(sleepTime)
for y in range(height,0,-1):
if hyperion.abort():
@@ -39,11 +43,12 @@ for y in range(height,0,-1):
time.sleep(sleepTime)
time.sleep(1)
for y in range(height):
for x in range(width):
setPixel(x, y, postColor)
hyperion.setImage(width, height, imageData)
time.sleep(2)
if setPostColor:
for y in range(height):
for x in range(width):
setPixel(x, y, postColor)
hyperion.setImage(width, height, imageData)
time.sleep(2)
if off and not hyperion.abort():
subprocess.call("halt")