Attached is a patch to add a trace message to the xbee_xbr.py driver similiar to the one in xbee_sensor.py
Couldn’t upload the file…
Index: xbee_xbr.py
— xbee_xbr.py (revision 51)
+++ xbee_xbr.py (working copy)
@@ -37,6 +37,10 @@
would like to monitor.
sample_rate_ms: the sample rate of the XBee Wall Router.
- trace: On/Off; On prints trace line for every sample, Off makes quiet
-
Defaults to On/True.
“”"
imports
@@ -46,6 +50,7 @@
from devices.xbee.xbee_devices.xbee_base import XBeeBase
from settings.settings_base import SettingsBase, Setting
from channels.channel_source_device_property import *
+from common.types.boolean import Boolean, STYLE_ONOFF
from devices.xbee.xbee_config_blocks.xbee_config_block_ddo
import XBeeConfigBlockDDO
@@ -83,6 +88,13 @@
name=‘sample_rate_ms’, type=int, required=False,
default_value=1000,
verify_function=lambda x: x > 0 and x < 0xffff),
+
-
# These settings are provided for advanced users, they
-
# are not required:
-
Setting(
-
name='trace', type=Boolean, required=False,
-
default_value=Boolean("On", STYLE_ONOFF)), ] ## Channel Properties Definition:
@@ -217,6 +229,7 @@
## Locally defined functions:
def sample_indication(self, buf, addr):
-
# Parse the I/O sample: io_sample = parse_is(buf)
@@ -225,11 +238,23 @@
map(lambda cn: sample_to_mv(io_sample[cn]), (“AD1”, “AD2”))
light = round(light_mv)
temperature = round((temperature_mv - 500.0) / 10.0 - 4.0, 2)
-
scale = "C" # Update channels: self.property_set("light", Sample(0, light, "brightness"))
-
self.property_set("temperature", Sample(0, temperature, "C"))
-
self.property_set("temperature", Sample(0, temperature, scale))
-
# check if we want to scroll a trace line or not
-
do_trace = SettingsBase.get_setting(self, "trace")
-
if do_trace:
-
msg = ['XBeeXBR (%s): ' % self.__name]
-
msg.append( "%d %s" % (temperature, scale))
-
msg.append( ", %d brightness" % light)
-
# try to keep memory use from dragging out
-
msg = "".join( msg)
-
print msg
-
del msg