From cea4db8e60211b4c28c20df9ffd065434c5879c4 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Wed, 24 Aug 2016 14:05:00 +1000 Subject: [PATCH] Fix throw error in udp, fix default SPI device (#198) * Fix throw error so it correctly fails on invalid output hostnames * Fixed broken default /dev/spidev0.0 string * UDP devices now use "host" and "port" rather than "output" --- libsrc/leddevice/LedSpiDevice.cpp | 2 +- libsrc/leddevice/LedUdpDevice.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc/leddevice/LedSpiDevice.cpp b/libsrc/leddevice/LedSpiDevice.cpp index 7ff12a62..bc2e3b66 100644 --- a/libsrc/leddevice/LedSpiDevice.cpp +++ b/libsrc/leddevice/LedSpiDevice.cpp @@ -30,7 +30,7 @@ LedSpiDevice::~LedSpiDevice() bool LedSpiDevice::setConfig(const Json::Value &deviceConfig) { - _deviceName = deviceConfig.get("output","/dev/spidev.0.0").asString(); + _deviceName = deviceConfig.get("output","/dev/spidev0.0").asString(); _baudRate_Hz = deviceConfig.get("rate",1000000).asInt(); _latchTime_ns = deviceConfig.get("latchtime",0).asInt(); _spiMode = deviceConfig.get("spimode",SPI_MODE_0).asInt(); diff --git a/libsrc/leddevice/LedUdpDevice.cpp b/libsrc/leddevice/LedUdpDevice.cpp index 25e6d79b..b0db9fc9 100644 --- a/libsrc/leddevice/LedUdpDevice.cpp +++ b/libsrc/leddevice/LedUdpDevice.cpp @@ -30,10 +30,10 @@ LedUdpDevice::~LedUdpDevice() bool LedUdpDevice::setConfig(const Json::Value &deviceConfig) { - QHostInfo info = QHostInfo::fromName( QString::fromStdString(deviceConfig["output"].asString()) ); + QHostInfo info = QHostInfo::fromName( QString::fromStdString(deviceConfig["host"].asString()) ); if (info.addresses().isEmpty()) { - throw("invalid target address"); + throw std::runtime_error("invalid target address"); } _address = info.addresses().first(); _port = deviceConfig["port"].asUInt();