Skip to content

Commit 530405c

Browse files
committed
Log duration of held watcher
1 parent b5bdcba commit 530405c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

SerialPrograms/Source/CommonTools/VisualDetector.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ class DetectorToFinder : public Detector, public VisualInferenceCallback{
110110
m_start_of_detection = timestamp;
111111
}
112112

113+
m_end_of_detection = timestamp;
114+
113115
if (timestamp - m_start_of_detection >= m_duration){
114116
this->commit_state();
115117
return true;
@@ -154,14 +156,16 @@ class DetectorToFinder : public Detector, public VisualInferenceCallback{
154156
virtual void reset_state() override {
155157
Detector::reset_state();
156158
m_start_of_detection = WallClock::min();
159+
m_end_of_detection = WallClock::min();
157160
m_last_detected = 0;
158161
m_consistent_result = false;
159162
}
160163

161-
private:
164+
protected:
162165
std::chrono::milliseconds m_duration; // duration of frames to decide detection outcome
163166
FinderType m_finder_type;
164167
WallClock m_start_of_detection = WallClock::min();
168+
WallClock m_end_of_detection = WallClock::min();
165169
int8_t m_last_detected = 0; // 0: no prior detection, 1: last detected positive, -1: last detected negative
166170
bool m_consistent_result = false;
167171
};

SerialPrograms/Source/PokemonLZA/Inference/PokemonLZA_OverworldPartySelectionDetector.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "PokemonLZA/Inference/PokemonLZA_ButtonDetector.h"
1616

1717
#include <array>
18+
#include <iostream>
1819

1920
namespace PokemonAutomation{
2021
namespace NintendoSwitch{
@@ -90,6 +91,11 @@ class OverworldPartySelectionOverWatcher : public DetectorToFinder<OverworldPart
9091
)
9192
: DetectorToFinder("OverworldPartySelectionOverWatcher", FinderType::GONE, hold_duration, color, overlay)
9293
{}
94+
95+
~OverworldPartySelectionOverWatcher()
96+
{
97+
std::cout << "OverworldPartySelectionOverWatcher destroyed. m_start_of_detection:" << m_start_of_detection << " m_end_of_detection:" << m_end_of_detection << " duration:" << m_end_of_detection - m_start_of_detection << std::endl;
98+
}
9399
};
94100

95101

0 commit comments

Comments
 (0)