Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/openlightingproject/ola i…
Browse files Browse the repository at this point in the history
…nto plugfest-rdm
  • Loading branch information
peternewman committed Aug 19, 2017
2 parents a237486 + 21d60a5 commit a53fb91
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 17 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Contributors:
Heikki Junnila, bug fixes for the debian packaging files
Laurent (Renzo), Debian packages, FreeBSD & RDM testing.
Lukas Erlinghagen, win32 port.
Johan Nilsson, Philips Hue trigger config
Johan Nilsson, Philips Hue, Osram Lightify & crelay trigger config
Joshua Moyerman, ArtNet fixes.
Masaki Muranaka, various patches
Nicolas, for the win32 port of libartnet
Expand Down
8 changes: 6 additions & 2 deletions plugins/usbpro/EnttecUsbProWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,12 @@ void EnttecPortImpl::HandleDMXDiff(const uint8_t *data, unsigned int length) {
uint8_t data[40];
} widget_data_changed;

if (length < sizeof(widget_data_changed)) {
OLA_WARN << "Change of state packet was too small: " << length;
// The minimum packet length is 1 byte start_pos, 5 bytes bitmap
// and one changed databyte. A length-6 packet would be valid (if
// no bits in the changed bitmap was set), but nonsensical to
// transmit. In any case, ignoring it would at least work.
if ((length < 7) || (length > sizeof(widget_data_changed))) {
OLA_WARN << "Change of state packet has an invalid length: " << length;
return;
}

Expand Down
8 changes: 6 additions & 2 deletions plugins/usbpro/GenericUsbProWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,12 @@ void GenericUsbProWidget::HandleDMXDiff(const uint8_t *data,
uint8_t data[40];
} widget_data_changed;

if (length < sizeof(widget_data_changed)) {
OLA_WARN << "Change of state packet was too small: " << length;
// The minimum packet length is 1 byte start_pos, 5 bytes bitmap
// and one changed databyte. A length-6 packet would be valid (if
// no bits in the changed bitmap was set), but nonsensical to
// transmit. In any case, ignoring it would at least work.
if ((length < 7) || (length > sizeof(widget_data_changed))) {
OLA_WARN << "Change of state packet has an invalid length: " << length;
return;
}

Expand Down
3 changes: 2 additions & 1 deletion tools/ola_trigger/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ EXTRA_DIST += \
tools/ola_trigger/config.ypp

dist_noinst_DATA += \
tools/ola_trigger/contrib/crelay.conf \
tools/ola_trigger/contrib/mac_itunes.conf \
tools/ola_trigger/contrib/mac_volume.conf \
tools/ola_trigger/contrib/philips_hue_osram_lightify.conf \
Expand Down Expand Up @@ -73,7 +74,7 @@ tools_ola_trigger_ActionTester_LDADD = $(COMMON_TESTING_LIBS) \
test_scripts += tools/ola_trigger/FileValidateTest.sh

tools/ola_trigger/FileValidateTest.sh: tools/ola_trigger/Makefile.mk
echo "for FILE in ${srcdir}/tools/ola_trigger/example.conf ${srcdir}/tools/ola_trigger/test_file.conf ${srcdir}/tools/ola_trigger/contrib/mac_volume.conf ${srcdir}/tools/ola_trigger/contrib/mac_itunes.conf ${srcdir}/tools/ola_trigger/contrib/philips_hue_osram_lightify.conf; do echo \"Checking \$$FILE\"; ${top_builddir}/tools/ola_trigger/ola_trigger${EXEEXT} --validate \$$FILE; STATUS=\$$?; if [ \$$STATUS -ne 0 ]; then echo \"FAIL: \$$FILE caused ola_trigger to exit with status \$$STATUS\"; exit \$$STATUS; fi; done; exit 0" > tools/ola_trigger/FileValidateTest.sh
echo "for FILE in ${srcdir}/tools/ola_trigger/example.conf ${srcdir}/tools/ola_trigger/test_file.conf ${srcdir}/tools/ola_trigger/contrib/crelay.conf ${srcdir}/tools/ola_trigger/contrib/mac_volume.conf ${srcdir}/tools/ola_trigger/contrib/mac_itunes.conf ${srcdir}/tools/ola_trigger/contrib/philips_hue_osram_lightify.conf; do echo \"Checking \$$FILE\"; ${top_builddir}/tools/ola_trigger/ola_trigger${EXEEXT} --validate \$$FILE; STATUS=\$$?; if [ \$$STATUS -ne 0 ]; then echo \"FAIL: \$$FILE caused ola_trigger to exit with status \$$STATUS\"; exit \$$STATUS; fi; done; exit 0" > tools/ola_trigger/FileValidateTest.sh
chmod +x tools/ola_trigger/FileValidateTest.sh

CLEANFILES += tools/ola_trigger/FileValidateTest.sh
38 changes: 38 additions & 0 deletions tools/ola_trigger/contrib/crelay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# OLA Trigger config to control relays using crelay - https://github.com/ondrej1024/crelay/
# Copyright (C) 2016-2017 Johan Nilsson. www.gobo.ws



# DMX protocol

###############################################################################

# Channel 1 relay 1 on/off. Value 0-114 off. 140-255 on
# Channel 2 relay 2 on/off. Value 0-114 off. 140-255 on
# Channel 3 relay 3 on/off. Value 0-114 off. 140-255 on
# Channel 4 relay 4 on/off. Value 0-114 off. 140-255 on



# Configuration

###############################################################################

hostname='127.0.0.1' # crelay hostname or IP address
port='8000' # crelay port



# Triggers

###############################################################################
# Slot Values Action

1 0-114 -`curl '--data' '"pin=1&status=0"' 'http://${hostname}:${port}/'`
1 140-255 +`curl '--data' '"pin=1&status=1"' 'http://${hostname}:${port}/'`
2 0-114 -`curl '--data' '"pin=2&status=0"' 'http://${hostname}:${port}/'`
2 140-255 +`curl '--data' '"pin=2&status=1"' 'http://${hostname}:${port}/'`
3 0-114 -`curl '--data' '"pin=3&status=0"' 'http://${hostname}:${port}/'`
3 140-255 +`curl '--data' '"pin=3&status=1"' 'http://${hostname}:${port}/'`
4 0-114 -`curl '--data' '"pin=4&status=0"' 'http://${hostname}:${port}/'`
4 140-255 +`curl '--data' '"pin=4&status=1"' 'http://${hostname}:${port}/'`
5 changes: 5 additions & 0 deletions tools/rdm/ModelCollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ def _HandleSensorData(self, data):
'description': data['name'],
'type': data['type'],
'supports_recording': data['supports_recording'],
'range_min': data['range_min'],
'range_max': data['range_max'],
'normal_min': data['normal_min'],
'normal_max': data['normal_max'],
'unit': data['unit'],
})
self._FetchNextSensor()

Expand Down
17 changes: 10 additions & 7 deletions tools/rdm/TestDefinitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,6 @@ def _GetPersonality(self):
if self._current_index >= MAX_PERSONALITY_NUMBER:
# This should never happen because personality_count is a uint8
self.SetFailed('Could not find all personalities')
self.Stop()
return

self.AddIfGetSupported(self.AckGetResult(
Expand Down Expand Up @@ -2233,7 +2232,7 @@ def VerifyResult(self, response, fields):

class SetVendorcastDMXStartAddress(TestMixins.SetNonUnicastDMXStartAddressMixin,
ResponderTestFixture):
"""SET the dmx start address using the vendorcast address."""
"""SET the DMX start address using the vendorcast address."""
CATEGORY = TestCategory.DMX_SETUP
PID = 'DMX_START_ADDRESS'
REQUIRES = ['dmx_footprint', 'dmx_address', 'set_dmx_address_supported']
Expand All @@ -2257,7 +2256,8 @@ class SetOutOfRangeDMXStartAddress(ResponderTestFixture):
"""Check that the DMX address can't be set to > 512."""
CATEGORY = TestCategory.ERROR_CONDITIONS
PID = 'DMX_START_ADDRESS'
# We depend on dmx_address to make sure this runs after GetDMXStartAddress
# We depend on GetDMXStartAddress to make sure this runs after it, while
# still allowing this test to run if the other test fails.
DEPS = [GetDMXStartAddress]
REQUIRES = ['dmx_footprint']

Expand All @@ -2278,7 +2278,8 @@ class SetZeroDMXStartAddress(ResponderTestFixture):
"""Check the DMX address can't be set to 0."""
CATEGORY = TestCategory.ERROR_CONDITIONS
PID = 'DMX_START_ADDRESS'
# We depend on dmx_address to make sure this runs after GetDMXStartAddress
# We depend on GetDMXStartAddress to make sure this runs after it, while
# still allowing this test to run if the other test fails.
DEPS = [GetDMXStartAddress]
REQUIRES = ['dmx_footprint']

Expand All @@ -2299,7 +2300,8 @@ class SetDMXStartAddressWithNoData(TestMixins.SetWithNoDataMixin,
ResponderTestFixture):
"""Send a SET dmx start address with no data."""
PID = 'DMX_START_ADDRESS'
# We depend on dmx_address to make sure this runs after GetDMXStartAddress
# We depend on GetDMXStartAddress to make sure this runs after it, while
# still allowing this test to run if the other test fails.
DEPS = [GetDMXStartAddress]
REQUIRES = ['dmx_footprint']

Expand All @@ -2319,7 +2321,8 @@ class SetDMXStartAddressWithExtraData(TestMixins.SetWithDataMixin,
ResponderTestFixture):
"""Send a SET dmx start address with extra data."""
PID = 'DMX_START_ADDRESS'
# We depend on dmx_address to make sure this runs after GetDMXStartAddress
# We depend on GetDMXStartAddress to make sure this runs after it, while
# still allowing this test to run if the other test fails.
DEPS = [GetDMXStartAddress]
REQUIRES = ['dmx_footprint']

Expand Down Expand Up @@ -4031,7 +4034,7 @@ def ResetState(self):


class SetIdentifyDeviceWithExtraData(ResponderTestFixture):
"""Set the identify state with no data."""
"""Set the identify state with extra data."""
CATEGORY = TestCategory.ERROR_CONDITIONS
PID = 'IDENTIFY_DEVICE'
REQUIRES = ['identify_state']
Expand Down
8 changes: 4 additions & 4 deletions tools/rdm/TestMixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,12 +1037,12 @@ class GetZeroUInt8Mixin(GetZeroMixin):
DATA = struct.pack('!B', 0)


class GetZeroUInt16Mixin(GetZeroUInt8Mixin):
class GetZeroUInt16Mixin(GetZeroMixin):
"""Get a UInt16 parameter with value 0, expect NR_DATA_OUT_OF_RANGE"""
DATA = struct.pack('!H', 0)


class GetZeroUInt32Mixin(GetZeroUInt8Mixin):
class GetZeroUInt32Mixin(GetZeroMixin):
"""Get a UInt32 parameter with value 0, expect NR_DATA_OUT_OF_RANGE"""
DATA = struct.pack('!I', 0)

Expand All @@ -1066,12 +1066,12 @@ class SetZeroUInt8Mixin(SetZeroMixin):
DATA = struct.pack('!B', 0)


class SetZeroUInt16Mixin(SetZeroUInt8Mixin):
class SetZeroUInt16Mixin(SetZeroMixin):
"""Set a UInt16 parameter with value 0, expect NR_DATA_OUT_OF_RANGE"""
DATA = struct.pack('!H', 0)


class SetZeroUInt32Mixin(SetZeroUInt8Mixin):
class SetZeroUInt32Mixin(SetZeroMixin):
"""Set a UInt32 parameter with value 0, expect NR_DATA_OUT_OF_RANGE"""
DATA = struct.pack('!I', 0)

Expand Down

0 comments on commit a53fb91

Please sign in to comment.