Fix DisableAlarms. Use signal when capture fails instead of erroneously using TRIGGER_OFF. Add status to DumpSettings so that we can query it with zmu.

This commit is contained in:
Isaac Connor 2021-04-09 17:46:11 -04:00
parent c3ce9913cf
commit d9dc61265d
1 changed files with 11 additions and 4 deletions

View File

@ -91,6 +91,10 @@ std::string CameraType_Strings[] = {
"CURL", "CURL",
}; };
std::string TriggerState_Strings[] = {
"Cancel", "On", "Off"
};
std::vector<std::string> split(const std::string &s, char delim) { std::vector<std::string> split(const std::string &s, char delim) {
std::vector<std::string> elems; std::vector<std::string> elems;
@ -1403,7 +1407,8 @@ bool Monitor::Analyse() {
bool signal = shared_data->signal; bool signal = shared_data->signal;
bool signal_change = (signal != last_signal); bool signal_change = (signal != last_signal);
Debug(3, "Motion detection is enabled signal(%d) signal_change(%d)", signal, signal_change); Debug(3, "Motion detection is enabled signal(%d) signal_change(%d) trigger_state %s",
signal, signal_change, TriggerState_Strings[trigger_data->trigger_state].c_str());
if ( trigger_data->trigger_state != TRIGGER_OFF ) { if ( trigger_data->trigger_state != TRIGGER_OFF ) {
unsigned int score = 0; unsigned int score = 0;
@ -1801,7 +1806,7 @@ bool Monitor::Analyse() {
closeEvent(); closeEvent();
} }
shared_data->state = state = IDLE; shared_data->state = state = IDLE;
trigger_data->trigger_state = TRIGGER_CANCEL; //trigger_data->trigger_state = TRIGGER_CANCEL;
} // end if ( trigger_data->trigger_state != TRIGGER_OFF ) } // end if ( trigger_data->trigger_state != TRIGGER_OFF )
if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) ) { if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) ) {
@ -2485,8 +2490,7 @@ int Monitor::Capture() {
if ( captureResult < 0 ) { if ( captureResult < 0 ) {
Info("Return from Capture (%d), signal loss", captureResult); Info("Return from Capture (%d), signal loss", captureResult);
// Tell zma to end the event. zma will reset TRIGGER shared_data->signal = false;
trigger_data->trigger_state = TRIGGER_OFF;
// Unable to capture image for temporary reason // Unable to capture image for temporary reason
// Fake a signal loss image // Fake a signal loss image
Rgb signalcolor; Rgb signalcolor;
@ -2886,6 +2890,9 @@ bool Monitor::DumpSettings(char *output, bool verbose) {
for ( int i = 0; i < n_zones; i++ ) { for ( int i = 0; i < n_zones; i++ ) {
zones[i]->DumpSettings(output+strlen(output), verbose); zones[i]->DumpSettings(output+strlen(output), verbose);
} }
sprintf(output+strlen(output), "Recording Enabled? %s\n", enabled ? "enabled" : "disabled");
sprintf(output+strlen(output), "Events Enabled (!TRIGGER_OFF)? %s\n", trigger_data->trigger_state == TRIGGER_OFF ? "disabled" : "enabled");
sprintf(output+strlen(output), "Motion Detection Enabled? %s\n", shared_data->active ? "enabled" : "disabled");
return true; return true;
} // bool Monitor::DumpSettings(char *output, bool verbose) } // bool Monitor::DumpSettings(char *output, bool verbose)