Skip to content

Commit 4daf226

Browse files
committed
Merge pull request #472 from szczukot/master
More logs for devices
2 parents 8749334 + 297b11e commit 4daf226

File tree

7 files changed

+69
-53
lines changed

7 files changed

+69
-53
lines changed

hardware/1Wire.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "../main/Helper.h"
1313
#include "../main/localtime_r.h"
1414
#include "../main/mainworker.h"
15+
#include "../main/SQLHelper.h"
1516

1617
#include <fcntl.h>
1718
#include <sys/stat.h>
@@ -25,12 +26,14 @@
2526

2627
#define round(a) ( int ) ( a + .5 )
2728

29+
extern CSQLHelper m_sql;
30+
2831
C1Wire::C1Wire(const int ID) :
2932
m_stoprequested(false),
3033
m_system(NULL)
3134
{
3235
m_HwdID=ID;
33-
DetectSystem();
36+
DetectSystem();
3437
}
3538

3639
C1Wire::~C1Wire()
@@ -182,12 +185,15 @@ void C1Wire::GetDeviceDetails()
182185
return;
183186

184187
// Get all devices
185-
std::vector<_t1WireDevice> devices;
186-
m_system->GetDevices(devices);
188+
if ((m_devices.size() == 0) || (m_sql.m_bAcceptNewHardware))
189+
{
190+
_log.Log(LOG_STATUS, "1-Wire: Searching devices...");
191+
m_system->GetDevices(m_devices);
192+
}
187193

188194
// Parse our devices (have to test m_stoprequested because it can take some time in case of big networks)
189195
std::vector<_t1WireDevice>::const_iterator itt;
190-
for (itt=devices.begin(); itt!=devices.end() && !m_stoprequested; ++itt)
196+
for (itt=m_devices.begin(); itt!=m_devices.end() && !m_stoprequested; ++itt)
191197
{
192198
const _t1WireDevice& device=*itt;
193199

hardware/1Wire.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "DomoticzHardware.h"
4+
#include "..\hardware\1Wire\1WireCommon.h"
45

56
class I_1WireSystem;
67
class C1Wire : public CDomoticzHardwareBase
@@ -17,6 +18,7 @@ class C1Wire : public CDomoticzHardwareBase
1718
boost::shared_ptr<boost::thread> m_thread;
1819
I_1WireSystem* m_system;
1920
std::map<std::string, bool> m_LastSwitchState;
21+
std::vector<_t1WireDevice> m_devices;
2022

2123
static void LogSystem();
2224
void DetectSystem();

hardware/1Wire/1WireByOWFS.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "stdafx.h"
22
#include "1WireByOWFS.h"
3+
#include "../../main/mainworker.h"
34

45
#include <fstream>
56
#include <algorithm>
@@ -214,6 +215,12 @@ void C1WireByOWFS::SetLightState(const std::string& sId,int unit,bool value)
214215
float C1WireByOWFS::GetTemperature(const _t1WireDevice& device) const
215216
{
216217
std::string readValue=readRawData(std::string(device.filename+"/temperature"));
218+
219+
if (m_mainworker.GetVerboseLevel() == EVBL_DEBUG)
220+
{
221+
_log.Log(LOG_STATUS, "1Wire (OWFS): Get Temperature from %s = %s", device.filename, readValue);
222+
}
223+
217224
if (readValue.empty())
218225
return -1000.0;
219226
return static_cast<float>(atof(readValue.c_str()));

hardware/SatelIntegra.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ void SatelIntegra::ReportZonesViolation(const unsigned long Idx, const bool viol
704704
zone.id = (unsigned char)Idx;
705705
zone.intval1 = violation ? 3 : 1;
706706

707-
if (m_mainworker.GetVerboseLevel() == EVBL_ALL)
707+
if (m_mainworker.GetVerboseLevel() >= EVBL_ALL)
708708
{
709709
_log.Log(LOG_STATUS, "Satel Integra: Report Zone %d = %d", zone.id, zone.intval1);
710710
}

main/domoticz.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const char *szHelp=
8888
"\t-userdata file_path (for example /opt/domoticz)\n"
8989
#endif
9090
"\t-webroot additional web root, useful with proxy servers (for example domoticz)\n"
91-
"\t-verbose x (where x=0 is none, x=1 is debug)\n"
91+
"\t-verbose x (where x=0 is none, x=1 is all important, x=2 is debug)\n"
9292
"\t-startupdelay seconds (default=0)\n"
9393
"\t-nowwwpwd (in case you forgot the web server username/password)\n"
9494
"\t-nocache (do not return appcache, use only when developing the web pages)\n"

0 commit comments

Comments
 (0)