-the test cameras are picking up motion as post command is running.
 added a delay increment to DetectLoop in hope to fix this.

-removed the upkeep log since it doesn't really provide any useful
 information.

-adjusted the default motion score again.

-reduced the amount of image files DetectLoop needs from 3 to 2.
This commit is contained in:
Zii 2023-05-29 17:43:31 -04:00
parent b445906403
commit de24a94bd4
4 changed files with 15 additions and 38 deletions

View File

@ -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);

View File

@ -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"

View File

@ -22,11 +22,6 @@ void detLog(const QString &line, shared_t *share)
share->detLog += QDateTime::currentDateTime().toString("[yyyy-MM-dd-hh-mm-ss] ") + line + "<br>\n";
}
void upkLog(const QString &line, shared_t *share)
{
share->upkLog += QDateTime::currentDateTime().toString("[yyyy-MM-dd-hh-mm-ss] ") + line + "<br>\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);
}

View File

@ -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