diff --git a/src/camera.cpp b/src/camera.cpp
index 5848d08..16becd8 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -19,7 +19,7 @@ Camera::Camera(QObject *parent) : QObject(parent)
shared.camName.clear();
shared.retCode = 0;
- shared.imgThresh = 15000;
+ shared.imgThresh = 10000;
shared.maxEvents = 100;
shared.maxLogSize = 100000;
shared.skipCmd = false;
@@ -231,42 +231,21 @@ bool Upkeep::exec()
enforceMaxLogSize(QString("logs/") + REC_LOG_NAME, shared);
enforceMaxLogSize(QString("logs/") + DET_LOG_NAME, shared);
- enforceMaxLogSize(QString("logs/") + UPK_LOG_NAME, shared);
dumpLogs(QString("logs/") + REC_LOG_NAME, shared->recLog);
dumpLogs(QString("logs/") + DET_LOG_NAME, shared->detLog);
- dumpLogs(QString("logs/") + UPK_LOG_NAME, shared->upkLog);
shared->recLog.clear();
shared->detLog.clear();
- shared->upkLog.clear();
- initLogFrontPages(shared);
+ initLogFrontPages();
enforceMaxEvents(shared);
enforceMaxImages();
genHTMLul(".", shared->camName, shared);
- upkLog("camera specific webroot page updated: " + shared->outDir + "/index.html", shared);
- QFile tmp("/tmp/mow-lock");
-
- if (!tmp.exists())
- {
- tmp.open(QFile::WriteOnly);
- tmp.write(QByteArray());
-
- genCSS(shared);
- genHTMLul(shared->webRoot, QString(APP_NAME) + " " + QString(APP_VER), shared);
-
- tmp.close();
- tmp.remove();
-
- upkLog("webroot page updated: " + QDir::cleanPath(shared->webRoot) + "/index.html", shared);
- }
- else
- {
- upkLog("skipping update of the webroot page, it is busy.", shared);
- }
+ genCSS(shared);
+ genHTMLul(shared->webRoot, QString(APP_NAME) + " " + QString(APP_VER), shared);
return Loop::exec();
}
@@ -419,6 +398,9 @@ void DetectLoop::pcBreak()
}
else
{
+ if (delayCycles == 0) delayCycles = 1;
+ else delayCycles += 1;
+
detLog("no motion detected, running post command: " + shared->postCmd, shared);
system(shared->postCmd.toUtf8().data());
}
@@ -432,13 +414,15 @@ bool DetectLoop::exec()
if (delayCycles > 0)
{
delayCycles -= 1;
+
+ detLog("spec: detection cycle skipped. cycles left to be skipped: " + QString::number(delayCycles), shared);
}
else
{
auto curDT = QDateTime::currentDateTime();
- auto images = backwardFacingFiles("img", ".bmp", curDT, 10);
+ auto images = backwardFacingFiles("img", ".bmp", curDT, 5);
- if (images.size() < 3)
+ if (images.size() < 2)
{
detLog("wrn: didn't pick up enough image files from the image stream. number of files: " + QString::number(images.size()), shared);
detLog(" will try again on the next loop.", shared);
@@ -452,8 +436,8 @@ bool DetectLoop::exec()
args << "compare";
args << "-metric" << "FUZZ";
- args << images[pos - 2];
args << images[pos - 1];
+ args << images[pos];
args << "/dev/null";
extComp.start("magick", args);
diff --git a/src/common.h b/src/common.h
index 0411165..5674b7e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -28,7 +28,7 @@
using namespace std;
-#define APP_VER "3.0.t7"
+#define APP_VER "3.0.t8"
#define APP_NAME "Motion Watch"
#define APP_BIN "mow"
#define REC_LOG_NAME "rec_log_lines.html"
diff --git a/src/logger.cpp b/src/logger.cpp
index bfc77e0..293b64b 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -22,11 +22,6 @@ void detLog(const QString &line, shared_t *share)
share->detLog += QDateTime::currentDateTime().toString("[yyyy-MM-dd-hh-mm-ss] ") + line + "
\n";
}
-void upkLog(const QString &line, shared_t *share)
-{
- share->upkLog += QDateTime::currentDateTime().toString("[yyyy-MM-dd-hh-mm-ss] ") + line + "
\n";
-}
-
void enforceMaxLogSize(const QString &filePath, shared_t *share)
{
QFile file(filePath);
@@ -115,9 +110,8 @@ void initLogFrontPage(const QString &filePath, const QString &logLinesFile)
}
}
-void initLogFrontPages(shared_t *share)
+void initLogFrontPages()
{
initLogFrontPage("logs/recording_log.html", REC_LOG_NAME);
initLogFrontPage("logs/detection_log.html", DET_LOG_NAME);
- initLogFrontPage("logs/upkeep_log.html", UPK_LOG_NAME);
}
diff --git a/src/logger.h b/src/logger.h
index 5af1d28..7c2d6bd 100644
--- a/src/logger.h
+++ b/src/logger.h
@@ -17,9 +17,8 @@
void recLog(const QString &line, shared_t *share);
void detLog(const QString &line, shared_t *share);
-void upkLog(const QString &line, shared_t *share);
void dumpLogs(const QString &fileName, const QString &lines);
void enforceMaxLogSize(const QString &filePath, shared_t *share);
-void initLogFrontPages(shared_t *share);
+void initLogFrontPages();
#endif // lOGGER_H