mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
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"
This commit is contained in:
parent
2cc107842a
commit
cea4db8e60
@ -30,7 +30,7 @@ LedSpiDevice::~LedSpiDevice()
|
|||||||
|
|
||||||
bool LedSpiDevice::setConfig(const Json::Value &deviceConfig)
|
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();
|
_baudRate_Hz = deviceConfig.get("rate",1000000).asInt();
|
||||||
_latchTime_ns = deviceConfig.get("latchtime",0).asInt();
|
_latchTime_ns = deviceConfig.get("latchtime",0).asInt();
|
||||||
_spiMode = deviceConfig.get("spimode",SPI_MODE_0).asInt();
|
_spiMode = deviceConfig.get("spimode",SPI_MODE_0).asInt();
|
||||||
|
@ -30,10 +30,10 @@ LedUdpDevice::~LedUdpDevice()
|
|||||||
|
|
||||||
bool LedUdpDevice::setConfig(const Json::Value &deviceConfig)
|
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())
|
if (info.addresses().isEmpty())
|
||||||
{
|
{
|
||||||
throw("invalid target address");
|
throw std::runtime_error("invalid target address");
|
||||||
}
|
}
|
||||||
_address = info.addresses().first();
|
_address = info.addresses().first();
|
||||||
_port = deviceConfig["port"].asUInt();
|
_port = deviceConfig["port"].asUInt();
|
||||||
|
Loading…
Reference in New Issue
Block a user