Guide the enrolment, and take the sample total from the config
Two problems from a real attempt, one mine and one the tool failing to explain itself. A sample is taken on the RISING edge only. Holding the finger down produces no further touch events however long it stays there, so a run with the finger almost permanently down collects one sample: 55 finger frames across 60, three touch events, two samples accepted. The loop now says which state it is in on every line -- press, hold, or LIFT -- shows accepted-of-total as it goes, and calls out a finger that has been held for several frames, because that is the state where nothing is happening and nothing on screen said so. And the total is now read from the config instead of inferred. `rem` is reported after the sample is processed, so the first reading of a healthy enrolment is already 9, and a session that takes the first reading as its total is permanently off by one -- it reported "1 of 9 accepted" when two samples had been accepted out of ten. common.max_enrolling_samples is stated explicitly in the generated config so both sides agree on the number rather than one of them guessing. Also recorded: not every press is accepted. The third touch of that run reported the same count as the second, which is the algorithm rejecting a sample, and is normal.
This commit is contained in:
parent
c785aad653
commit
bdd5de21b3
3 changed files with 48 additions and 18 deletions
|
|
@ -138,16 +138,18 @@ int main() {
|
|||
|
||||
// ---- Enrolment progress, read from the response
|
||||
{
|
||||
EnrolSession e;
|
||||
EnrolSession e(10);
|
||||
Check(!e.Started(), "not started");
|
||||
e.Observe(-1, true);
|
||||
Check(!e.Started(), "an unpopulated field does not start the session");
|
||||
e.Observe(10, true);
|
||||
Check(e.Started() && e.Total() == 10 && e.Stages() == 10, "first response sets the total");
|
||||
Check(e.Accepted() == 0 && !e.Complete(), "nothing accepted yet");
|
||||
Check(e.Total() == 10 && e.Stages() == 10, "the total comes from the config");
|
||||
e.Observe(9, true);
|
||||
Check(e.Accepted() == 1, "rem 10 -> 9 is one accepted sample");
|
||||
// rem is reported AFTER the sample is processed, so the first reading
|
||||
// of a healthy enrolment is already 9 and one sample is in.
|
||||
Check(e.Started() && e.Accepted() == 1, "a first reading of 9 means one accepted");
|
||||
Check(!e.Complete(), "not complete");
|
||||
for (std::int32_t r : {8, 7, 6, 5, 4, 3, 2, 1}) e.Observe(r, true);
|
||||
Check(e.Accepted() == 9, "nine accepted at one remaining");
|
||||
Check(!e.Complete() && e.Remaining() == 1, "not complete at one remaining");
|
||||
e.Observe(0, true);
|
||||
Check(e.Complete() && e.Accepted() == 10, "complete at zero");
|
||||
|
|
@ -160,33 +162,34 @@ int main() {
|
|||
// itself finished after ONE press. SAVE_DATA is then called on an
|
||||
// algorithm holding no template and answers -1.
|
||||
{
|
||||
EnrolSession e;
|
||||
e.Observe(10, true); // touch: ten to go
|
||||
EnrolSession e(10);
|
||||
e.Observe(9, true); // touch: one accepted, nine to go
|
||||
e.Observe(0, false); // release: reads zero, means nothing
|
||||
Check(!e.Complete(), "a release reading of 0 does NOT complete the enrolment");
|
||||
Check(e.Remaining() == 10, "and does not move the count");
|
||||
Check(e.Accepted() == 0, "nothing was accepted");
|
||||
Check(e.Remaining() == 9, "and does not move the count");
|
||||
Check(e.Accepted() == 1, "the touch's one sample still stands");
|
||||
}
|
||||
|
||||
// A first reading of 0 is an unpopulated field, not a finished enrolment.
|
||||
{
|
||||
EnrolSession e;
|
||||
EnrolSession e(10);
|
||||
e.Observe(0, true);
|
||||
Check(!e.Started(), "a leading zero does not start a session");
|
||||
Check(!e.Complete(), "and certainly does not finish one");
|
||||
e.Observe(10, true);
|
||||
e.Observe(9, true);
|
||||
Check(e.Started() && e.Total() == 10, "a real count still starts it");
|
||||
}
|
||||
|
||||
// The count only falls; a jump back up is noise, not progress.
|
||||
{
|
||||
EnrolSession e;
|
||||
e.Observe(10, true);
|
||||
EnrolSession e(10);
|
||||
e.Observe(9, true);
|
||||
e.Observe(8, true);
|
||||
e.Observe(7, true);
|
||||
Check(e.Remaining() == 7, "decreases are taken");
|
||||
e.Observe(9, true);
|
||||
Check(e.Remaining() == 7, "an increase is ignored");
|
||||
Check(e.Accepted() == 3, "three accepted, counted against the real total");
|
||||
}
|
||||
|
||||
// ---- The three recorded runs, replayed in order
|
||||
|
|
|
|||
Loading…
Reference in a new issue