clean up signal change code a bit, using new event notesetmap update function. So now when we lose signal, the event will close but it will have signal change :Lost added to it's notes. A new event will only be created if in RECORD/MOCORD.

This commit is contained in:
Isaac Connor 2022-01-03 19:04:21 -05:00
parent 7215756fed
commit b1353823cf
1 changed files with 10 additions and 14 deletions

View File

@ -1769,29 +1769,25 @@ bool Monitor::Analyse() {
// FIXME this snap might not be the one that caused the signal change. Need to store that in the packet. // FIXME this snap might not be the one that caused the signal change. Need to store that in the packet.
if (signal_change) { if (signal_change) {
Debug(2, "Signal change, new signal is %d", signal); Debug(2, "Signal change, new signal is %d", signal);
const char *signalText = "Unknown";
if (!signal) { if (!signal) {
signalText = "Lost";
if (event) { if (event) {
event->addNote(SIGNAL_CAUSE, "Lost");
Info("%s: %03d - Closing event %" PRIu64 ", signal loss", name.c_str(), analysis_image_count, event->Id()); Info("%s: %03d - Closing event %" PRIu64 ", signal loss", name.c_str(), analysis_image_count, event->Id());
closeEvent(); closeEvent();
last_section_mod = 0; last_section_mod = 0;
} }
} else { } else if (function == MOCORD or function == RECORD) {
signalText = "Reacquired"; if (!event) {
score += 100; if (cause.length()) cause += ", ";
cause += SIGNAL_CAUSE + std::string(": Reacquired");
} else {
event->addNote(SIGNAL_CAUSE, "Reacquired");
}
if (snap->image)
ref_image.Assign(*(snap->image));
} }
if (!event) {
if (cause.length()) cause += ", ";
cause += SIGNAL_CAUSE;
}
Event::StringSet noteSet;
noteSet.insert(signalText);
noteSetMap[SIGNAL_CAUSE] = noteSet;
shared_data->state = state = IDLE; shared_data->state = state = IDLE;
shared_data->active = signal; shared_data->active = signal;
if ((function == MODECT or function == MOCORD) and snap->image)
ref_image.Assign(*(snap->image));
} // end if signal change } // end if signal change
if (signal) { if (signal) {