Browse Source

Added support for grabbing the correct zone from ECP failures.

pyserial_fix
Scott Petersen 11 years ago
parent
commit
0e0ef9273c
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      pyad2usb/zonetracking.py

+ 14
- 0
pyad2usb/zonetracking.py View File

@@ -2,6 +2,7 @@
Provides zone tracking functionality for the AD2USB device family.
"""

import re
import time
from .event import event
from . import messages
@@ -109,6 +110,19 @@ class Zonetracker(object):
except ValueError:
zone = int(message.numeric_code, 16)

# NOTE: Odd case for ECP failures. Apparently they report as zone 191 (0xBF) regardless
# of whether or not the 3-digit mode is enabled... so we have to pull it out of the
# alpha message.
if zone == 191:
# TODO: parse message text.
zone_regex = re.compile('^CHECK (\d+).*$')

m = zone_regex.match(message.text)
if m is None:
return

zone = m.group(1)

# Add new zones and clear expired ones.
if zone in self._zones_faulted:
self._update_zone(zone)


Loading…
Cancel
Save