fix case in mocord where cause would not contain motion

This commit is contained in:
Isaac Connor 2020-10-08 15:50:12 -04:00 committed by Isaac Connor
parent cc24df9593
commit df2f5f814b
1 changed files with 4 additions and 3 deletions

View File

@ -1458,11 +1458,12 @@ bool Monitor::Analyse() {
}
if ( last_motion_score ) {
score += last_motion_score;
if ( !event ) {
// cause is calculated every frame,
//if ( !event ) {
if ( cause.length() )
cause += ", ";
cause += MOTION_CAUSE;
}
//}
noteSetMap[MOTION_CAUSE] = zoneSet;
} // end if motion_score
//shared_data->active = signal; // unneccessary active gets set on signal change
@ -1560,7 +1561,7 @@ bool Monitor::Analyse() {
alarm_cause = alarm_cause + "," + std::string(zones[i]->Label());
}
}
if ( !alarm_cause.empty() ) alarm_cause[0] = ' ';
if ( !alarm_cause.empty() ) alarm_cause[0] = ' '; // replace leading , with a space
alarm_cause = cause + alarm_cause;
strncpy(shared_data->alarm_cause, alarm_cause.c_str(), sizeof(shared_data->alarm_cause)-1);
Info("%s: %03d - Gone into alarm state PreAlarmCount: %u > AlarmFrameCount:%u Cause:%s",