diff --git a/cpp/examples/MinOZW/Main.cpp b/cpp/examples/MinOZW/Main.cpp index 07b494f866..fecdcdfe93 100644 --- a/cpp/examples/MinOZW/Main.cpp +++ b/cpp/examples/MinOZW/Main.cpp @@ -318,7 +318,8 @@ int main( int argc, char* argv[] ) #elif WIN32 string port = "\\\\.\\COM6"; #else - string port = "/dev/ttyUSB0"; + // string port = "/dev/ttyUSB0"; + string port = "/dev/ttyACM0"; #endif if ( argc > 1 ) { diff --git a/cpp/src/Driver.cpp b/cpp/src/Driver.cpp index 84124da920..e4047244cb 100644 --- a/cpp/src/Driver.cpp +++ b/cpp/src/Driver.cpp @@ -4082,9 +4082,8 @@ bool Driver::EnablePoll(ValueID const &_valueId, uint8 const _intensity) // Not in the list, so we add it PollEntry pe; pe.m_id = _valueId; - pe.m_pollCounter = value->GetPollIntensity(); + pe.m_pollCounter = 1; // poll immediately m_pollList.push_back(pe); - value->Release(); m_pollMutex->Unlock(); // send notification to indicate polling is enabled @@ -4092,8 +4091,9 @@ bool Driver::EnablePoll(ValueID const &_valueId, uint8 const _intensity) notification->SetHomeAndNodeIds(m_homeId, _valueId.GetNodeId()); notification->SetValueId(_valueId); QueueNotification(notification); - Log::Write(LogLevel_Info, nodeId, "EnablePoll for HomeID 0x%.8x, value(cc=0x%02x,in=0x%02x,id=0x%02x)--poll list has %d items", _valueId.GetHomeId(), _valueId.GetCommandClassId(), _valueId.GetIndex(), _valueId.GetInstance(), m_pollList.size()); + Log::Write(LogLevel_Info, nodeId, "EnablePoll for HomeID 0x%.8x, value(cc=0x%02x,in=0x%02x,id=0x%02x,int=%d)--poll list has %d items", _valueId.GetHomeId(), _valueId.GetCommandClassId(), _valueId.GetIndex(), _valueId.GetInstance(), value->GetPollIntensity(),m_pollList.size()); WriteCache(); + value->Release(); return true; } @@ -4282,6 +4282,19 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent) while (1) { int32 pollInterval = m_pollInterval; + // If the polling interval is for the whole poll list, calculate the time before the next poll, + // so that all polls can take place within the user-specified interval. + if (!m_bIntervalBetweenPolls) + { + if (pollInterval < 100) + { + Log::Write(LogLevel_Info, "The pollInterval setting is only %d, which appears to be a legacy setting. Multiplying by 1000 to convert to ms.", pollInterval); + pollInterval *= 1000; + } + if (m_pollList.size() != 0) + pollInterval /= (int32) m_pollList.size(); + } + if (m_awakeNodesQueried && !m_pollList.empty()) { @@ -4299,6 +4312,14 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent) pe.m_pollCounter--; m_pollList.push_back(pe); m_pollMutex->Unlock(); + // ready for next poll...insert the pollInterval delay + int i32; + i32 = Internal::Platform::Wait::Single(_exitEvent, pollInterval); + if (i32 == 0) + { + // Exit has been called + return; + } continue; } @@ -4314,18 +4335,6 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent) m_pollList.push_back(pe); value->Release(); } - // If the polling interval is for the whole poll list, calculate the time before the next poll, - // so that all polls can take place within the user-specified interval. - if (!m_bIntervalBetweenPolls) - { - if (pollInterval < 100) - { - Log::Write(LogLevel_Info, "The pollInterval setting is only %d, which appears to be a legacy setting. Multiplying by 1000 to convert to ms.", pollInterval); - pollInterval *= 1000; - } - pollInterval /= (int32) m_pollList.size(); - } - { Internal::LockGuard LG(m_nodeMutex); // Request the state of the value from the node to which it belongs @@ -4399,7 +4408,7 @@ void Driver::PollThreadProc(Internal::Platform::Event* _exitEvent) else // poll list is empty or awake nodes haven't been fully queried yet { // don't poll just yet, wait for the pollInterval or exit before re-checking to see if the pollList has elements - int32 i32 = Internal::Platform::Wait::Single(_exitEvent, 500); + int32 i32 = Internal::Platform::Wait::Single(_exitEvent, pollInterval); if (i32 == 0) { // Exit has been called @@ -6986,7 +6995,7 @@ bool Driver::startConfigDownload(uint16 _manufacturerId, uint16 _productType, ui ss << std::hex << std::setw(4) << std::setfill('0') << _productId << "."; ss << std::hex << std::setw(4) << std::setfill('0') << _productType << "."; ss << std::hex << std::setw(4) << std::setfill('0') << _manufacturerId << ".xml"; - download->url = "http://download.db.openzwave.com/" + ss.str(); + download->url = "https://github.com/OpenZWave/open-zwave/tree/master/config/" + ss.str(); download->filename = configfile; download->operation = Internal::HttpDownload::Config; download->node = node; @@ -6998,7 +7007,7 @@ bool Driver::startConfigDownload(uint16 _manufacturerId, uint16 _productType, ui bool Driver::startMFSDownload(string configfile) { Internal::HttpDownload *download = new Internal::HttpDownload(); - download->url = "http://download.db.openzwave.com/mfs.xml"; + download->url = "https://github.com/OpenZWave/open-zwave/tree/master/config/mfs.xml"; download->filename = configfile; download->operation = Internal::HttpDownload::MFSConfig; download->node = 0; @@ -7010,7 +7019,7 @@ bool Driver::startMFSDownload(string configfile) bool Driver::startDownload(string target, string file) { Internal::HttpDownload *download = new Internal::HttpDownload(); - download->url = "http://download.db.openzwave.com/" + file; + download->url = "https://github.com/OpenZWave/open-zwave/tree/master/config/" + file; download->filename = target; download->operation = Internal::HttpDownload::Image; Log::Write(LogLevel_Info, "Queuing download for %s (Node %d)", download->url.c_str(), download->node); diff --git a/cpp/src/command_classes/AssociationCommandConfiguration.cpp b/cpp/src/command_classes/AssociationCommandConfiguration.cpp index 576441250b..63ff69f0a7 100644 --- a/cpp/src/command_classes/AssociationCommandConfiguration.cpp +++ b/cpp/src/command_classes/AssociationCommandConfiguration.cpp @@ -182,8 +182,7 @@ namespace OpenZWave if (Node* node = GetNodeUnsafe()) { - Group* group = node->GetGroup(groupIdx); - if ( NULL == group) + if (Group* group = node->GetGroup(groupIdx)) { if (firstReports) {