Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(pro): tap to talk on an agent's screen instead of holding (#1371)

0xdiego25d9f9a3829d55
diff --git a/devices/harness-pro/firmware/main/app/pod_glue.c b/devices/harness-pro/firmware/main/app/pod_glue.c
index 5797a717c..7f80c7a2d 100644
--- a/devices/harness-pro/firmware/main/app/pod_glue.c
+++ b/devices/harness-pro/firmware/main/app/pod_glue.c
@@ -238,14 +238,14 @@ static bool swipes(const pod_ui_t *u)
return f && (f->view == POD_V_AGENT || f->view == POD_V_RECAP || f->view == POD_V_TALK ||
f->view == POD_V_TABS || f->view == POD_V_INBOX); // Home pages, the Inbox goes back
}
-// Hold to talk: only on the agent's own screens (Agent, Recap). Not on a Tab tile or a Recent row (a long press there is
-// a tap: its lift opens the agent), not in the top band, not on an agent that asks (voice stays refused
-// there, so the hold does not arm and no notice fires). Returns the agent id the hold would talk to, or NULL.
-static const char *hold_target(const pod_ui_t *u)
+// Tap to talk: only on the agent's own screens (Agent, Recap). Not in the top band, not on the back crumb or the
+// Notices hit, not on an agent that asks (voice stays refused there, so the tap does not arm and no notice fires).
+// Returns the agent id the tap would talk to, or NULL.
+static const char *talk_target(const pod_ui_t *u)
{
const pod_frame_t *f = top(u);
if (!f || u->ban_touch) return NULL;
- if (u->start_y < POD_BAR_H) return NULL; // nothing in the top band holds
+ if (u->start_y < POD_BAR_H) return NULL; // nothing in the top band talks
if (u->hit_valid && (u->hit.action == POD_A_BACK || u->hit.action == POD_A_INBOX)) return NULL;
const char *id = f->view == POD_V_AGENT || f->view == POD_V_RECAP ? f->agent : NULL;
const pod_agent_t *a = id ? pod_model_find(&u->model, id) : NULL;
@@ -287,21 +287,17 @@ static pod_out_t banner_open(pod_ui_t *u, uint32_t now_ms)
return pod_nav_act(&u->nav, &u->model, POD_A_INBOX, 0, now_ms); // the toast opens Notices, which lists the entry
}
-// The hold's deadline passed with the finger still: talk to the agent on screen. An offline
-// machine gets the notice instead. The contact is the hold's from here on, tap or not. It runs from the touch samples
-// (pod_ui_touch), the one task that also ends or aborts the recording, so a begin can never be overtaken by its end.
-static pod_out_t hold_fire(pod_ui_t *u, uint32_t now_ms)
+// The tap's lift: talk to the agent on screen. An offline machine gets the notice instead. It runs from the touch
+// samples (pod_ui_touch), the one task that also ends or aborts the recording, so a begin can never be overtaken by its end.
+static pod_out_t talk_fire(pod_ui_t *u, uint32_t now_ms)
{
pod_out_t none;
memset(&none, 0, sizeof none);
- u->hold_armed = false;
const pod_frame_t *t = top(u);
- if (!t || u->nav.depth != u->hold_depth || t->view != u->hold_view || strcmp(t->agent, u->hold_agent))
- return none; // the screen or the agent changed under the finger since the DOWN: not this hold's any more
- u->hold_fired = true;
- u->hit_valid = false;
+ if (!t || u->nav.depth != u->talk_depth || t->view != u->talk_view || strcmp(t->agent, u->talk_agent))
+ return none; // the screen or the agent changed under the finger since the DOWN: not this tap's any more
char id[ID_MAX];
- pod_copy_str(id, sizeof id, u->hold_agent);
+ pod_copy_str(id, sizeof id, u->talk_agent);
const pod_agent_t *ag = pod_model_find(&u->model, id);
if (!ag || pod_model_eff(&u->model, ag) == POD_ASKING) return none;
if (ag->state == POD_OFFLINE) {
@@ -313,8 +309,7 @@ static pod_out_t hold_fire(pod_ui_t *u, uint32_t now_ms)
u->dirty = true;
return none;
}
- u->hold_voice = true;
- u->hands_free = true; // the lift of this contact does nothing; a later tap sends
+ u->hands_free = true; // a later tap sends
u->dirty = true;
return o;
}
@@ -335,9 +330,8 @@ pod_out_t pod_ui_touch(pod_ui_t *u, bool down, int x, int y, uint32_t now_ms, bo
u->last_touch_ms = now_ms;
u->cancelled = u->dragging = u->hit_valid = u->ban_touch = false;
memset(&u->hit, 0, sizeof u->hit); // a DOWN on nothing carries nothing over from the last contact
- if (u->hands_free && !pod_ui_talking(u)) u->hands_free = u->hold_voice = false; // Talk ended some other way
- u->hold_armed = u->hold_fired = false;
- if (!u->hands_free) u->hold_voice = false; // a hands-free recording keeps its owner for this tap
+ if (u->hands_free && !pod_ui_talking(u)) u->hands_free = false; // Talk ended some other way
+ u->talk_armed = false;
u->bar = !u->hands_free && y < POD_BAR_H && top(u)->view != POD_V_TALK;
u->rows_moved = false;
u->start_x = x;
@@ -371,24 +365,18 @@ pod_out_t pod_ui_touch(pod_ui_t *u, bool down, int x, int y, uint32_t now_ms, bo
u->ban_touch = true;
u->sw_ok = false;
}
- const char *target = hold_target(u);
- if (target) { // the hold belongs to this screen and this agent: if either changes before it fires, it does not
- u->hold_armed = true;
- u->hold_due_ms = now_ms + POD_HOLD_MS;
- u->hold_depth = u->nav.depth;
- u->hold_view = top(u)->view;
- pod_copy_str(u->hold_agent, sizeof u->hold_agent, target);
+ const char *target = talk_target(u);
+ if (target) { // the tap belongs to this screen and this agent: if either changes before its lift, it does not talk
+ u->talk_armed = true;
+ u->talk_depth = u->nav.depth;
+ u->talk_view = top(u)->view;
+ pod_copy_str(u->talk_agent, sizeof u->talk_agent, target);
}
return none;
}
if (down) {
if (!u->down || u->cancelled || u->ban_touch) return none;
- if (u->hold_armed && (iabs(x - u->start_x) > POD_TAP_SLOP || iabs(y - u->start_y) > POD_TAP_SLOP)) u->hold_armed = false;
- if (u->hold_armed && (int32_t)(now_ms - u->hold_due_ms) >= 0) { // the still finger's sample that finds the deadline passed
- pod_out_t held = hold_fire(u, now_ms);
- if (u->hold_fired) { *changed = true; return held; }
- }
- if (u->hold_fired) return none; // after the hold the contact only waits for its lift: never a scroll, a swipe or a tap
+ if (iabs(x - u->start_x) > POD_TAP_SLOP || iabs(y - u->start_y) > POD_TAP_SLOP) u->talk_armed = false;
if (iabs(x - u->start_x) > POD_TAP_SLOP || iabs(y - u->start_y) > POD_TAP_SLOP) u->hit_valid = false;
if (u->sw_ok) {
if ((int32_t)(now_ms - u->sw_last_ms) > 0) {
@@ -421,11 +409,8 @@ pod_out_t pod_ui_touch(pod_ui_t *u, bool down, int x, int y, uint32_t now_ms, bo
if (u->down) { u->touched = true; u->last_touch_ms = now_ms; }
if (was) u->started = true; // the person is driving: a later model feed never starts over them
u->down = false;
- u->hold_armed = false;
- if (u->hold_fired) { // the hold already took this contact: its lift does nothing (a recording stays open, hands free)
- u->hold_fired = false;
- return none;
- }
+ const bool talk = u->talk_armed && iabs(x - u->start_x) <= POD_TAP_SLOP && iabs(y - u->start_y) <= POD_TAP_SLOP;
+ u->talk_armed = false;
if (u->scroll_begun) { // the lift carries the rest of the travel and the speed it left at
ht_scroll_end(&u->scroll, x, y, now_ms);
u->scroll_begun = false;
@@ -484,6 +469,10 @@ pod_out_t pod_ui_touch(pod_ui_t *u, bool down, int x, int y, uint32_t now_ms, bo
return pod_nav_act(&u->nav, &u->model, dx < 0 ? POD_A_NEXT : POD_A_PREV, 0, now_ms);
}
}
+ if (was && talk && !u->dragging) { // a tap on the agent's own screen: talk to it
+ *changed = true;
+ return talk_fire(u, now_ms);
+ }
if (!was || u->dragging || !u->hit_valid || !inside(&u->hit, x, y)) return none;
// The list can have changed since the scene was drawn: a hit that names its agent or tab is resolved now.
int arg = u->hit.arg;
@@ -519,7 +508,7 @@ pod_out_t pod_ui_touch(pod_ui_t *u, bool down, int x, int y, uint32_t now_ms, bo
}
pod_out_t out = pod_nav_act(&u->nav, &u->model, u->hit.action, arg, now_ms);
*changed = true;
- if (u->hands_free && out.fx == POD_FX_VOICE_END) u->hands_free = u->hold_voice = false; // sent
+ if (u->hands_free && out.fx == POD_FX_VOICE_END) u->hands_free = false; // sent
return out;
}
@@ -532,29 +521,10 @@ pod_out_t pod_ui_touch_cancel(pod_ui_t *u)
u->cancelled = true;
u->hit_valid = false;
u->ban_touch = false;
- // The hold fired and a recording may be open: the finger is gone, so end it (and Talk).
- pod_out_t o = none;
- if (u->hands_free && pod_ui_talking(u)) { // hands free: the recording does not depend on this contact
- u->hold_armed = u->hold_fired = u->bar = false;
- return none;
- }
- if (u->hold_voice && pod_ui_talking(u)) {
- o.fx = POD_FX_VOICE_ABORT;
- pod_copy_str(o.agent, sizeof o.agent, top(u)->agent);
- pod_nav_talk_over(&u->nav);
- u->dirty = true;
- }
- u->hold_armed = u->hold_fired = u->hold_voice = u->bar = u->hands_free = false;
- return o;
-}
-
-// Fires the hold for a deadline passed outside a touch sample (tests; the device reaches it through pod_ui_touch only).
-pod_out_t pod_ui_tick(pod_ui_t *u, uint32_t now_ms)
-{
- pod_out_t none;
- memset(&none, 0, sizeof none);
- if (!u->hold_armed || !u->down || u->cancelled || (int32_t)(now_ms - u->hold_due_ms) < 0) return none;
- return hold_fire(u, now_ms);
+ // A recording a tap started does not depend on this contact: it stays open, and the next tap sends it.
+ u->talk_armed = u->bar = false;
+ if (!pod_ui_talking(u)) u->hands_free = false;
+ return none;
}
// ---- voice and clock ---------------------------------------------------------------------------------------
@@ -570,7 +540,7 @@ bool pod_ui_talking(const pod_ui_t *u)
void pod_ui_talk_over(pod_ui_t *u)
{
pod_nav_talk_over(&u->nav); // back on the screen TALK came from, same stack; no ABORT: nothing records
- u->hold_voice = u->hands_free = false;
+ u->hands_free = false;
}
void pod_ui_unsend(pod_ui_t *u, uint32_t now_ms)
diff --git a/devices/harness-pro/firmware/main/app/pod_glue.h b/devices/harness-pro/firmware/main/app/pod_glue.h
index e37b5fae9..1c909c07c 100644
--- a/devices/harness-pro/firmware/main/app/pod_glue.h
+++ b/devices/harness-pro/firmware/main/app/pod_glue.h
@@ -15,9 +15,9 @@
enum { POD_MEMBERS_MAX = 24 }; // == POD_PANES_MAX == SWARM_MEMBERS_MAX
enum { POD_TAP_SLOP = 24 }; // px: farther than this from the DOWN and the contact is a drag, not a tap
-// Gestures: hold this long to talk; the top band's height (a swipe down from it opens Notices) and the travel of that
+// Gestures: the top band's height (a swipe down from it opens Notices) and the travel of that
// swipe; the travel of a swipe up (Home).
-enum { POD_HOLD_MS = 400, POD_BAR_H = 72, POD_BAR_SWIPE = 80, POD_EDGE_SWIPE = 80, POD_BOTTOM_Y = 620 }; // POD_BOTTOM_Y: a swipe up that starts at or below it goes Home from a room or a recap
+enum { POD_BAR_H = 72, POD_BAR_SWIPE = 80, POD_EDGE_SWIPE = 80, POD_BOTTOM_Y = 620 }; // POD_BOTTOM_Y: a swipe up that starts at or below it goes Home from a room or a recap
typedef struct { const char *id, *name, *engine, *machine; } pod_roster_row_t;
@@ -77,14 +77,12 @@ typedef struct {
void *scroll_ctx;
bool scroll_reversed, scroll_begun;
uint32_t down_ms;
- // Hold to talk: armed at a DOWN that may talk, fired by the first still sample at or after hold_due_ms (pod_ui_touch, on the touch task); hold_voice is a recording
- // under way for this contact. bar: the contact began in the top band.
- bool hold_armed, hold_fired, hold_voice, bar, edge; // bar: the contact began in the top edge (y < POD_BAR_H) of a non-Talk screen: a swipe down opens the Inbox; edge: the contact began in the bottom zone (y >= POD_BOTTOM_Y) of a room or a recap: a swipe up goes Home, and it scrolls nothing
- bool hands_free; // the hold started a recording that outlives the finger; the next new tap sends it (cleared by END, ABORT, talk_over)
- uint32_t hold_due_ms;
- uint8_t hold_depth;
- pod_view_t hold_view; // the screen (nav depth and view) and agent the hold was armed on: it fires only there
- char hold_agent[ID_MAX];
+ // Tap to talk: armed at a DOWN that may talk, fired by its lift if the finger stayed within POD_TAP_SLOP (pod_ui_touch, on the touch task).
+ bool talk_armed, bar, edge; // bar: the contact began in the top edge (y < POD_BAR_H) of a non-Talk screen: a swipe down opens the Inbox; edge: the contact began in the bottom zone (y >= POD_BOTTOM_Y) of a room or a recap: a swipe up goes Home, and it scrolls nothing
+ bool hands_free; // a tap started a recording; the next new tap sends it (cleared by END, ABORT, talk_over)
+ uint8_t talk_depth;
+ pod_view_t talk_view; // the screen (nav depth and view) and agent the tap was armed on: it fires only there
+ char talk_agent[ID_MAX];
// Following the host (see pod_ui_focus): the last contact, and a focus whose agent the model does not know yet.
bool touched;
uint32_t last_touch_ms;
@@ -188,10 +186,7 @@ bool pod_ui_take_changed(pod_ui_t *);
// Where Recap drags are reported (NULL: nowhere) and which way the person's setting reads them. Cheap: call before each contact.
void pod_ui_scroll_sink(pod_ui_t *, ht_scroll_emit_t emit, void *ctx, bool reversed);
pod_out_t pod_ui_touch(pod_ui_t *, bool down, int x, int y, uint32_t now_ms, bool *changed);
-pod_out_t pod_ui_touch_cancel(pod_ui_t *); // a recording the hold had open comes back as VOICE_ABORT: perform it
-// Fires the hold once its deadline has passed. The device never calls it: the hold fires from pod_ui_touch's held
-// samples, on the task that also ends the recording. Kept for tests that drive a deadline without a sample.
-pod_out_t pod_ui_tick(pod_ui_t *, uint32_t now_ms);
+pod_out_t pod_ui_touch_cancel(pod_ui_t *); // the contact is dropped; an open recording does not depend on it and stays
// ---- voice and clock ---------------------------------------------------------------------------------------
bool pod_ui_talking(const pod_ui_t *);
diff --git a/devices/harness-pro/firmware/main/app/pro_app.c b/devices/harness-pro/firmware/main/app/pro_app.c
index c599ed1bc..064383651 100644
--- a/devices/harness-pro/firmware/main/app/pro_app.c
+++ b/devices/harness-pro/firmware/main/app/pro_app.c
@@ -676,7 +676,7 @@ static void flush_scroll(void)
static void cancel_locked(void)
{
pod_ui_scroll_sink(&s_pod, scroll_emit, NULL, false);
- settle(pod_ui_touch_cancel(&s_pod)); // a cancelled drag ends with a zero UP (P4); a recording the hold opened is aborted
+ settle(pod_ui_touch_cancel(&s_pod)); // a cancelled drag ends with a zero UP (P4); an open recording stays (the next tap sends it)
}
bool pro_app_touch(bool down, int x, int y)
diff --git a/devices/harness-pro/firmware/test/test_ph_glue.c b/devices/harness-pro/firmware/test/test_ph_glue.c
index cc43f6992..ef2a8e922 100644
--- a/devices/harness-pro/firmware/test/test_ph_glue.c
+++ b/devices/harness-pro/firmware/test/test_ph_glue.c
@@ -1,4 +1,4 @@
-// Pets gestures in the glue (pod_glue.c): hold to talk (hands free: a later tap sends), the bar's swipe down, tab swipes.
+// Pets gestures in the glue (pod_glue.c): tap to talk (hands free: a later tap sends), the bar's swipe down, tab swipes.
// Synthetic times; the hits come from a real render of the Pets views.
#include <assert.h>
#include <stdio.h>
@@ -62,46 +62,38 @@ static void calm(void) { pod_model_turn(&U.model, "a1", "done", NULL, 0, 30); }
// A new contact (DOWN then UP) at x,y: the hands-free send.
static pod_out_t tap_(int x, int y, uint32_t t) { t_(true, x, y, t); return t_(false, x, y, t + 50); }
-static void hold_agent(void) {
+static void tap_agent(void) {
fresh();
to_agent(0, 0); // a1, working: Agent
CHECK(top()->view == POD_V_AGENT);
render(1000);
- CHECK(t_(true, MID_X, MID_Y, 1000).fx == POD_FX_NONE);
- CHECK(pod_ui_tick(&U, 1399).fx == POD_FX_NONE);
- pod_out_t o = pod_ui_tick(&U, 1400);
- CHECK(o.fx == POD_FX_VOICE_BEGIN && !strcmp(o.agent, "a1") && top()->view == POD_V_TALK);
- CHECK(pod_ui_tick(&U, 1500).fx == POD_FX_NONE); // once
- // v2: the lift does nothing; the next new tap sends.
- CHECK(t_(false, MID_X, MID_Y, 1600).fx == POD_FX_NONE && top()->view == POD_V_TALK && !U.nav.sending && U.hands_free);
+ CHECK(t_(true, MID_X, MID_Y, 1000).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
+ CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_NONE && top()->view == POD_V_AGENT); // a still finger alone does nothing
+ pod_out_t o = t_(false, MID_X, MID_Y, 1450); // the lift talks
+ CHECK(o.fx == POD_FX_VOICE_BEGIN && !strcmp(o.agent, "a1") && top()->view == POD_V_TALK && !U.nav.sending && U.hands_free);
render(1700);
- o = tap_(MID_X, MID_Y, 2000);
+ o = tap_(MID_X, MID_Y, 2000); // the next tap sends
CHECK(o.fx == POD_FX_VOICE_END && top()->view == POD_V_TALK && U.nav.sending && !U.hands_free);
+ // A tap on a recap talks too.
+ fresh();
+ to_agent(0, 2);
+ CHECK(top()->view == POD_V_RECAP);
+ render(1000);
+ o = tap_(MID_X, MID_Y, 1000);
+ CHECK(o.fx == POD_FX_VOICE_BEGIN && !strcmp(o.agent, "a3") && top()->view == POD_V_TALK);
}
-// v1 hold_then_cancel (slide down 120 px aborts) became: a slide does nothing.
-static void hold_slide_does_nothing(void) {
+// A drag past the slop is never a tap: it scrolls (or swipes) and does not talk, even if it comes back to the DOWN.
+static void drag_is_not_a_tap(void) {
fresh();
to_agent(0, 0);
render(1000);
t_(true, MID_X, MID_Y, 1000);
- CHECK(pod_ui_tick(&U, 1400).fx == POD_FX_VOICE_BEGIN);
- CHECK(t_(true, MID_X, MID_Y + 119, 1450).fx == POD_FX_NONE && top()->view == POD_V_TALK);
- CHECK(t_(true, MID_X, MID_Y + 200, 1500).fx == POD_FX_NONE && top()->view == POD_V_TALK);
- CHECK(t_(false, MID_X, MID_Y + 200, 1700).fx == POD_FX_NONE && top()->view == POD_V_TALK && U.hands_free);
- // Held on a recap, moved up and down before the lift: never a scroll.
- fresh();
- to_agent(0, 2);
- CHECK(top()->view == POD_V_RECAP);
- render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(pod_ui_tick(&U, 1400).fx == POD_FX_VOICE_BEGIN);
- t_(true, MID_X, MID_Y - 90, 1500);
- CHECK(sc_events == 0 && top()->scroll == 0);
- CHECK(t_(false, MID_X, MID_Y - 90, 1600).fx == POD_FX_NONE); // the lift does nothing
- CHECK(sc_events == 0);
- render(1700);
- CHECK(tap_(MID_X, MID_Y, 2000).fx == POD_FX_VOICE_END);
+ t_(true, MID_X, MID_Y + 60, 1100);
+ CHECK(t_(false, MID_X, MID_Y, 1200).fx == POD_FX_NONE && top()->view == POD_V_AGENT && !U.hands_free);
+ // A lift farther than the slop from the DOWN, with no sample in between.
+ t_(true, MID_X, MID_Y, 2000);
+ CHECK(t_(false, MID_X + 40, MID_Y, 2050).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
}
static void drift_cancels(void) {
@@ -110,7 +102,7 @@ static void drift_cancels(void) {
render(1000);
t_(true, MID_X, MID_Y, 1000);
t_(true, MID_X, MID_Y + 30, 1200);
- CHECK(pod_ui_tick(&U, 1500).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
+ CHECK(top()->view == POD_V_AGENT && !U.talk_armed);
t_(true, MID_X, MID_Y + 60, 1550);
t_(false, MID_X, MID_Y + 60, 1600);
CHECK(sc_events > 0 && top()->view == POD_V_AGENT && U.nav.depth == 3); // Pets: a drag on the room scrolls the host's pane and changes nothing else
@@ -120,17 +112,10 @@ static void drift_cancels(void) {
render(1000);
t_(true, MID_X, MID_Y, 1000);
t_(true, MID_X, MID_Y - 30, 1200);
- CHECK(pod_ui_tick(&U, 1500).fx == POD_FX_NONE);
+ CHECK(!U.talk_armed);
t_(true, MID_X, MID_Y - 60, 1550);
t_(false, MID_X, MID_Y - 60, 1600);
CHECK(sc_events > 0 && top()->view == POD_V_RECAP && U.nav.depth == 3); // the host pane scrolls; the nav stays
- // A contact lifted before the deadline is a tap/no hold: a late tick does nothing.
- fresh();
- to_agent(0, 0);
- render(1000);
- t_(true, MID_X, MID_Y, 1000);
- t_(false, MID_X, MID_Y, 1100);
- CHECK(pod_ui_tick(&U, 1500).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
}
static void bar_swipe(void) {
@@ -159,18 +144,17 @@ static void bar_swipe(void) {
CHECK(U.nav.depth == 2 && top()->view == POD_V_INBOX);
}
-static void no_hold_views(void) {
+static void no_talk_views(void) {
fresh();
- render(1000); // Overview
- t_(true, MID_X, MID_Y, 1000);
- CHECK(pod_ui_tick(&U, 1400).fx == POD_FX_NONE && top()->view == POD_V_TABS);
- t_(false, MID_X, MID_Y, 1500);
+ calm(); // Home on tab 0
+ render(1000);
+ U.frame.hit_count = 0; // a tap on nothing on Home
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_NONE && top()->view == POD_V_TABS && !pod_ui_talking(&U));
act(POD_A_INBOX, 0);
CHECK(top()->view == POD_V_INBOX);
render(3000);
- t_(true, MID_X, MID_Y, 3000);
- CHECK(pod_ui_tick(&U, 3400).fx == POD_FX_NONE && top()->view == POD_V_INBOX);
- t_(false, MID_X, MID_Y, 3500);
+ U.frame.hit_count = 0;
+ CHECK(tap_(MID_X, MID_Y, 3000).fx == POD_FX_NONE && top()->view == POD_V_INBOX);
}
static void offline(void) {
@@ -178,78 +162,64 @@ static void offline(void) {
to_agent(0, 0);
((pod_agent_t *)pod_model_find(&U.model, "a1"))->state = POD_OFFLINE;
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(pod_ui_tick(&U, 1400).fx == POD_FX_NONE);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_NONE);
CHECK(U.notice_on && !strcmp(U.notice, "That machine is offline") && top()->view == POD_V_AGENT);
- CHECK(t_(false, MID_X, MID_Y, 1500).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
}
-// H1: the hold fires on the touch path. The touch task reports a still finger every few ms, and that sample is what
-// finds the deadline passed: the begin and the end/abort then run on the one task, and no render wake is needed.
-static void hold_fires_on_held_samples(void) {
+// The tap talks on the touch path: its lift begins the recording, on the task that also ends or aborts it.
+static void tap_talks_on_its_lift(void) {
fresh();
to_agent(0, 0);
render(1000);
CHECK(t_(true, MID_X, MID_Y, 1000).fx == POD_FX_NONE);
- for (uint32_t t = 1004; t < 1400; t += 4) CHECK(t_(true, MID_X, MID_Y, t).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
- pod_out_t o = t_(true, MID_X, MID_Y, 1400);
+ for (uint32_t t = 1004; t < 2000; t += 4) CHECK(t_(true, MID_X, MID_Y, t).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
+ pod_out_t o = t_(false, MID_X, MID_Y, 2000);
CHECK(o.fx == POD_FX_VOICE_BEGIN && !strcmp(o.agent, "a1") && top()->view == POD_V_TALK);
- CHECK(t_(true, MID_X, MID_Y, 1404).fx == POD_FX_NONE); // once
- CHECK(t_(false, MID_X, MID_Y, 1500).fx == POD_FX_NONE);
// A move inside the slop keeps it armed.
fresh();
to_agent(0, 0);
render(1000);
t_(true, MID_X, MID_Y, 1000);
- CHECK(t_(true, MID_X + 5, MID_Y, 1200).fx == POD_FX_NONE);
- o = t_(true, MID_X + 5, MID_Y, 1400);
+ CHECK(t_(true, MID_X + 5, MID_Y, 1100).fx == POD_FX_NONE);
+ o = t_(false, MID_X + 5, MID_Y, 1150);
CHECK(o.fx == POD_FX_VOICE_BEGIN && !strcmp(o.agent, "a1") && top()->view == POD_V_TALK);
- // Home's still samples never begin voice: the hold is the agent screens' own.
- fresh();
- render(1000);
- t_(true, MID_X, MID_Y, 1000);
- for (uint32_t t = 1004; t <= 2000; t += 4) CHECK(t_(true, MID_X, MID_Y, t).fx == POD_FX_NONE && top()->view == POD_V_TABS);
}
-// H2 (v2): a contact cancelled after the hold fired (an untrusted sample, a second finger, the glass turning, sleep) no
-// longer ends a hands-free recording: it does not depend on the finger.
-static void hold_cancel_keeps_recording(void) {
+// A cancelled contact (an untrusted sample, a second finger, sleep) never talks, and never ends a hands-free recording.
+static void cancel_keeps_recording(void) {
fresh();
to_agent(0, 0);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_VOICE_BEGIN);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
+ render(1100);
+ t_(true, MID_X, MID_Y, 1200);
pod_out_t o = pod_ui_touch_cancel(&U);
CHECK(o.fx == POD_FX_NONE && top()->view == POD_V_TALK && U.hands_free);
- CHECK(t_(false, MID_X, MID_Y, 1500).fx == POD_FX_NONE);
+ CHECK(t_(false, MID_X, MID_Y, 1300).fx == POD_FX_NONE);
render(1600);
CHECK(tap_(MID_X, MID_Y, 1700).fx == POD_FX_VOICE_END); // still sends with a new tap
- // A cancel before the hold fires, or after the lift, has nothing to abort.
+ // A cancel before the lift: the contact never talks.
fresh();
to_agent(0, 0);
render(1000);
t_(true, MID_X, MID_Y, 1000);
CHECK(pod_ui_touch_cancel(&U).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_NONE); // the cancelled contact never talks
- // A refused start (the glue already left Talk): the cancel has no recording to abort.
+ CHECK(t_(false, MID_X, MID_Y, 1100).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
+ // A refused start (the glue already left Talk): the cancel has nothing to abort.
fresh();
to_agent(0, 0);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_VOICE_BEGIN);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
pod_ui_talk_over(&U);
CHECK(pod_ui_touch_cancel(&U).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
}
-// Hands free: any new tap on Talk sends, even over the bar crumb or the chip; the first lift does not; the holding
-// contact's cancel, a slide, and a swipe from the bar do nothing.
+// Hands free: any new tap on Talk sends, even over the bar crumb or the chip; a swipe from the bar does nothing.
static void hands_free_taps_anywhere(void) {
fresh();
to_agent(0, 0);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_VOICE_BEGIN);
- CHECK(t_(false, MID_X, MID_Y, 1500).fx == POD_FX_NONE);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
render(1600);
CHECK(U.frame.hit_count >= 1 && U.frame.hits[U.frame.hit_count - 1].action == POD_A_TALK); // the topmost hit
CHECK(U.frame.hits[U.frame.hit_count - 1].w == POD_W && U.frame.hits[U.frame.hit_count - 1].y == 0);
@@ -262,9 +232,7 @@ static void hands_free_taps_anywhere(void) {
fresh();
to_agent(0, 0);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- t_(true, MID_X, MID_Y, 1400);
- t_(false, MID_X, MID_Y, 1500);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
render(1600);
t_(true, 300, 20, 2000);
t_(true, 300, 70, 2050);
@@ -274,16 +242,14 @@ static void hands_free_taps_anywhere(void) {
CHECK(!U.hands_free);
}
-// The send tap right after the hold fires, before Talk is drawn: whatever the old Agent frame had at that point (it had a back crumb) must not apply.
+// The send tap right after the talk tap, before Talk is drawn: whatever the old Agent frame had at that point (it had a back crumb) must not apply.
static void send_before_talk_drawn(void) {
fresh();
to_agent(0, 0);
render(1000);
CHECK(!find(POD_A_BACK)); // the room has no bar and no back crumb: the tap lands where the bar was
int bx = 100, by = 36;
- t_(true, MID_X, MID_Y, 1000);
- CHECK(pod_ui_tick(&U, 1400).fx == POD_FX_VOICE_BEGIN);
- t_(false, MID_X, MID_Y, 1500);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
pod_out_t o = tap_(bx, by, 1600); // no render in between
CHECK(o.fx == POD_FX_VOICE_END && top()->view == POD_V_TALK && U.nav.sending);
}
@@ -293,9 +259,7 @@ static void offline_tap_aborts(void) {
fresh();
to_agent(0, 0);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(pod_ui_tick(&U, 1400).fx == POD_FX_VOICE_BEGIN);
- t_(false, MID_X, MID_Y, 1500);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
render(1600);
((pod_agent_t *)pod_model_find(&U.model, "a1"))->state = POD_OFFLINE;
pod_out_t o = tap_(MID_X, MID_Y, 2000);
@@ -340,50 +304,47 @@ static void animation_rates(void) {
CHECK(most > 33 || most == 33); // the pet's own animation sets the beat: there is no wave
}
-// M9: voice on an asking agent stays refused, so the hold does not arm there (no notice either).
-static void asking_agents_do_not_hold(void) {
+// M9: voice on an asking agent stays refused, so the tap does not arm there (no notice either).
+static void asking_agents_do_not_talk(void) {
fresh();
to_agent(1, 0); // a4, asking
CHECK(top()->view == POD_V_AGENT && !strcmp(top()->agent, "a4"));
render(1000);
t_(true, MID_X, MID_Y, 1000);
- CHECK(!U.hold_armed);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_NONE && top()->view == POD_V_AGENT && !U.notice_on);
- t_(false, MID_X, MID_Y, 1500);
+ CHECK(!U.talk_armed);
+ CHECK(t_(false, MID_X, MID_Y, 1050).fx == POD_FX_NONE && top()->view == POD_V_AGENT && !U.notice_on);
}
-// L10: the hold belongs to the screen and agent it was armed on; a contact on nothing carries no stale hit.
-static void hold_stays_with_its_target(void) {
+// L10: the tap belongs to the screen and agent it was armed on; a contact on nothing carries no stale hit.
+static void talk_stays_with_its_target(void) {
fresh();
to_agent(0, 0);
render(1000);
t_(true, MID_X, MID_Y, 1000);
- pod_nav_act(&U.nav, &U.model, POD_A_NEXT, 0, 1100); // a pane swipe's effect, a notification or a host focus change the agent
+ pod_nav_act(&U.nav, &U.model, POD_A_NEXT, 0, 1010); // a pane swipe's effect, a notification or a host focus change the agent
CHECK(strcmp(top()->agent, "a1") != 0);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
+ CHECK(t_(false, MID_X, MID_Y, 1050).fx == POD_FX_NONE && top()->view != POD_V_TALK);
fresh();
to_agent(0, 0);
render(1000);
t_(true, MID_X, MID_Y, 1000);
act(POD_A_BACK, 0); // the screen changed under the finger: Home
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_NONE && top()->view == POD_V_TABS);
+ CHECK(t_(false, MID_X, MID_Y, 1050).fx == POD_FX_NONE && top()->view != POD_V_TALK);
}
-// L11: a refused start (the gate refused the recording) leaves the hold's agent screen where it was.
-static void refused_hold_stays_on_the_agent(void) {
+// L11: a refused start (the gate refused the recording) leaves the tap's agent screen where it was.
+static void refused_talk_stays_on_the_agent(void) {
fresh();
to_agent(0, 0);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_VOICE_BEGIN);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
pod_ui_talk_over(&U);
CHECK(top()->view == POD_V_AGENT);
fresh(); // and on a Recap
to_agent(0, 2);
CHECK(top()->view == POD_V_RECAP);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_VOICE_BEGIN);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
pod_ui_talk_over(&U);
CHECK(top()->view == POD_V_RECAP);
}
@@ -542,9 +503,7 @@ static void bottom_up_goes_back(void) {
fresh();
to_agent(0, 0);
render(1000);
- t_(true, MID_X, MID_Y, 1000);
- CHECK(t_(true, MID_X, MID_Y, 1400).fx == POD_FX_VOICE_BEGIN);
- t_(false, MID_X, MID_Y, 1500);
+ CHECK(tap_(MID_X, MID_Y, 1000).fx == POD_FX_VOICE_BEGIN);
render(1600);
int d = U.nav.depth;
swipe(360, 690, 360, 500, 2000);
@@ -663,7 +622,7 @@ static void recap_and_agent_host_scroll(void) {
CHECK(U.nav.depth == 1 && top()->view == POD_V_TABS && sc_events == 0);
}
-// A Pets RECAP frame has no hit: a tap on it changes nothing (no tap-to-open, no close), and it read the entry when it opened.
+// A Pets RECAP frame has no hit: a tap on it talks to its agent (no tap-to-open, no close), and it read the entry when it opened.
static void recap_has_no_tap_and_reads(void) {
fresh();
pod_model_unread_add(&U.model, "a3", "Gamma", "It works.", 20, 21);
@@ -671,10 +630,8 @@ static void recap_has_no_tap_and_reads(void) {
CHECK(top()->view == POD_V_RECAP && U.model.unread_count == 0);
render(1000);
CHECK(U.frame.hit_count == 0 || !find(POD_A_NONE));
- for (int i = 0; i < 3; i++) {
- pod_out_t o = tap_(360, 300 + i * 100, 1000 + (uint32_t)i * 200);
- CHECK(o.fx == POD_FX_NONE && U.nav.depth == 3 && top()->view == POD_V_RECAP);
- }
+ pod_out_t t = tap_(360, 400, 1000);
+ CHECK(t.fx == POD_FX_VOICE_BEGIN && !strcmp(t.agent, "a3") && top()->view == POD_V_TALK);
// Notices: a row opens the agent on its recap, read
fresh();
pod_model_unread_add(&U.model, "a3", "Gamma", "It works.", 20, 21);
@@ -1002,14 +959,11 @@ static void bottom_start_sideways_is_a_pane_swipe(void) {
t_(true, 380, 680, 1040);
t_(false, 450, 660, 1080); // dx 150, dy -30
CHECK(U.nav.depth == 3 && (top()->view == POD_V_AGENT || top()->view == POD_V_RECAP) && strcmp(top()->agent, "a1") != 0); // NEXT pane, not BACK
- // A hold that starts in the bottom zone still talks, and its lift is not a back.
+ // A tap in the bottom zone still talks, and is not a back.
fresh();
to_agent(0, 0);
render(1000);
- t_(true, 360, 690, 1000);
- CHECK(pod_ui_tick(&U, 1400).fx == POD_FX_VOICE_BEGIN && top()->view == POD_V_TALK);
- t_(false, 360, 690, 1500);
- CHECK(top()->view == POD_V_TALK && U.nav.depth == 3);
+ CHECK(tap_(360, 690, 1000).fx == POD_FX_VOICE_BEGIN && top()->view == POD_V_TALK && U.nav.depth == 3);
}
static void bar_down_opens_inbox(void) {
@@ -1079,14 +1033,14 @@ static void toast_tap_opens_notices(void) {
CHECK(pod_model_unread_find(&U.model, "a1")); // still unread: Notices lists it
render(1200);
CHECK(!U.frame.banner);
- // a tap beside the toast reaches the room (nothing there to open: the room stays)
+ // a tap beside the toast reaches the room: it talks to the room's agent, not to the toast's
fresh();
calm();
to_agent(0, 2);
pod_ui_notify(&U, "a1", true, 1000);
render(1000);
- tap_(360, 300, 1100);
- CHECK(U.ban_on && top()->view == POD_V_RECAP);
+ o = tap_(360, 300, 1100);
+ CHECK(o.fx == POD_FX_VOICE_BEGIN && !strcmp(o.agent, "a3") && top()->view == POD_V_TALK);
}
static void toast_swipe_up_dismisses(void) {
fresh();
@@ -1095,9 +1049,9 @@ static void toast_swipe_up_dismisses(void) {
pod_ui_notify(&U, "a1", true, 1000);
render(1000);
const int depth = U.nav.depth;
- CHECK(!U.hold_armed);
+ CHECK(!U.talk_armed);
t_(true, 360, 110, 1100);
- CHECK(!U.hold_armed); // a contact on the toast never holds to talk
+ CHECK(!U.talk_armed); // a contact on the toast never talks
t_(true, 360, 80, 1140);
t_(false, 360, 40, 1180);
CHECK(!U.ban_on && U.nav.depth == depth && top()->view == POD_V_RECAP && pod_model_unread_find(&U.model, "a1"));
@@ -1324,19 +1278,18 @@ static void overview_scroll_follows_tab_removal(void) {
CHECK(top()->scroll == 7);
}
-// L3: the hold does not arm anywhere in the bar's band.
-static void hold_not_in_bar(void) {
+// L3: the tap does not arm anywhere in the bar's band.
+static void talk_not_in_bar(void) {
// a DOWN anywhere in the bar (no hit there) does not arm either
fresh();
to_agent(0, 0);
render(1000);
t_(true, 330, 10, 1000);
- CHECK(!U.hold_armed);
- t_(false, 330, 10, 1100);
+ CHECK(!U.talk_armed);
+ CHECK(t_(false, 330, 10, 1100).fx == POD_FX_NONE && top()->view == POD_V_AGENT);
// and the body still arms
t_(true, MID_X, MID_Y, 2000);
- CHECK(U.hold_armed);
- t_(false, MID_X, MID_Y, 2100);
+ CHECK(U.talk_armed);
}
// L4: no bar swipe on Talk.
@@ -1530,14 +1483,14 @@ int main(void) {
bottom_start_sideways_is_a_pane_swipe();
bar_down_opens_inbox();
toast_and_edges();
- hold_agent();
- hold_slide_does_nothing();
+ tap_agent();
+ drag_is_not_a_tap();
drift_cancels();
bar_swipe();
- no_hold_views();
+ no_talk_views();
offline();
- hold_fires_on_held_samples();
- hold_cancel_keeps_recording();
+ tap_talks_on_its_lift();
+ cancel_keeps_recording();
hands_free_taps_anywhere();
send_before_talk_drawn();
offline_tap_aborts();
@@ -1548,14 +1501,14 @@ int main(void) {
home_page();
recent_swipe_steps_tabs();
overview_scroll_follows_tab_removal();
- hold_not_in_bar();
+ talk_not_in_bar();
talk_ignores_bar_swipe();
toast_cap_only_when_drawn();
wake_rates();
agent_screen_wakes();
- asking_agents_do_not_hold();
- hold_stays_with_its_target();
- refused_hold_stays_on_the_agent();
+ asking_agents_do_not_talk();
+ talk_stays_with_its_target();
+ refused_talk_stays_on_the_agent();
printf("test_ph_glue: %d checks ok\n", checks);
return 0;
}
diff --git a/devices/harness-pro/firmware/test/test_pro_app.py b/devices/harness-pro/firmware/test/test_pro_app.py
index fdc4d5dae..04b79c7e4 100644
--- a/devices/harness-pro/firmware/test/test_pro_app.py
+++ b/devices/harness-pro/firmware/test/test_pro_app.py
@@ -197,25 +197,20 @@ static pod_out_t tap_by_nav(pod_action_t a, int arg) {
render();
return effect_of();
}
-// No screen draws a Talk button: a still press on an agent or its recap starts the recording and the lift keeps it (hands free).
-static pod_out_t hold_talk(void) {
+// No screen draws a Talk button: a tap on an agent or its recap starts the recording (hands free; the next tap sends).
+static pod_out_t tap_talk(void) {
bool c = false;
CHECK(contact(true, 360, 400, &c).fx == POD_FX_NONE);
- now += 450;
- pod_out_t begin = contact(true, 360, 400, &c); // the still sample that finds the deadline
- unsigned char at_begin[sizeof R];
- memcpy(at_begin, &R, sizeof R);
- pod_out_t lift = contact(false, 360, 400, &c);
+ pod_out_t o = contact(false, 360, 400, &c);
render();
- if (begin.fx != POD_FX_NONE) { memcpy(&R, at_begin, sizeof R); return begin; } // what the begin made the app do, not the lift's nothing
- return lift;
+ return o;
}
static pod_out_t nav_act(pod_action_t a);
static pod_out_t tap(pod_action_t a, int arg) {
const pod_hit_t *h = hit(a, arg);
if (!h && (a == POD_A_BACK || a == POD_A_TABS || a == POD_A_PANES || a == POD_A_PREV || a == POD_A_NEXT)) return nav_act(a); // the side button's path
if (!h && (a == POD_A_OPEN_TAB || a == POD_A_OPEN_AGENT)) return tap_by_nav(a, arg);
- if (!h && a == POD_A_TALK && (top() == POD_V_AGENT || top() == POD_V_RECAP)) return hold_talk();
+ if (!h && a == POD_A_TALK && (top() == POD_V_AGENT || top() == POD_V_RECAP)) return tap_talk();
CHECK(h);
CHECK(h->w >= 1 && h->h >= 1);
return tap_at(h->x + h->w / 2, h->y + h->h / 2);
@@ -1235,10 +1230,11 @@ static void recap_drag_scrolls_the_host(void) {
total = 0;
for (int i = 0; i < SC.n; i++) if (SC.phase[i] != HT_SCROLL_DOWN) total += SC.dy[i];
CHECK(total == 180 && SC.v[SC.n - 1] > 100);
- // A tap, or a cancelled contact, closes cleanly: nothing for a tap; a cancelled drag ends with a zero UP.
+ // A tap, or a cancelled contact, closes cleanly: nothing for a tap (it talks); a cancelled drag ends with a zero UP.
open_recap_for_scroll(false);
contact(true, 360, 300, &c); now += 40; contact(false, 360, 300, &c);
- CHECK(SC.n == 0);
+ CHECK(SC.n == 0 && pod_ui_talking(&U));
+ open_recap_for_scroll(false);
contact(true, 360, 300, &c);
for (int y = 300; y >= 220; y -= 20) { now += 16; contact(true, 360, y, &c); }
pro_app_touch_cancel();
@@ -1745,17 +1741,14 @@ static void side_button_console(void) {
CHECK(top() == POD_V_TABS && U.nav.depth == 1 && LOCK_DEPTH == 0 && U.started);
}
-// Pets hands free: the hold opens the recording, the lift keeps it, a cancel keeps it, the side button discards it.
+// Pets hands free: a tap opens the recording, a cancel keeps it, the side button discards it.
static void side_button_discards_hands_free(void) {
setup();
render();
tap(POD_A_ENTER_TAB, 0); // Pets Home: a tap on the tab walks straight to its first agent
bool c;
contact(true, 360, 400, &c);
- now += 450;
- expect(contact(true, 360, 400, &c), POD_FX_VOICE_BEGIN, "a1");
- CHECK(top() == POD_V_TALK);
- expect(contact(false, 360, 400, &c), POD_FX_NONE, NULL); // the lift does nothing
+ expect(contact(false, 360, 400, &c), POD_FX_VOICE_BEGIN, "a1"); // the lift talks
CHECK(top() == POD_V_TALK && R.end_abort == 0 && R.end_send == 0);
contact(true, 360, 400, &c); // a second contact, cancelled: still recording
pro_app_touch_cancel();
@@ -2022,7 +2015,7 @@ static void voice_refused_while_updating(void) {
const int tx = 360, ty = 400;
fw_update_ui_begin("0.1.2", "0.1.3");
CHECK(!strcmp(pro_app_voice_block_reason("a1"), "Updating"));
- // A still press where the hold records, and the side button: no recording starts and none is left open.
+ // A tap where it would record, and the side button: no recording starts and none is left open.
memset(&R, 0, sizeof R);
bool changed;
contact(true, tx, ty, &changed); contact(false, tx, ty, &changed);
@@ -2057,7 +2050,7 @@ static void update_gate(void) {
// The race: the gate lands inside a start that already passed its own check. The start is cancelled, not recorded.
memset(&R, 0, sizeof R);
GATE_IN_BEGIN = true;
- (void)hold_talk();
+ (void)tap_talk();
GATE_IN_BEGIN = false;
CHECK(R.begins == 1 && R.end_abort == 1 && !V.open && !pod_ui_talking(&U));
fw_update_ui_failed(); // an accepted transfer that failed also lets go
@@ -2150,67 +2143,52 @@ static void updated_notice(void) {
WAS_UPDATED = false;
}
-// H1/H2/L11: the Pets hold runs on the touch path. The still finger's samples find the deadline (no render, no tick), so
-// the begin and the end or abort share the touch task; a contact cancelled after the hold ends the recording with it.
-static void console_agent_for_hold(void) {
+// The Pets tap to talk runs on the touch path: the lift begins the recording (no render, no tick), so the begin and
+// the end or abort share the touch task; a later contact's cancel leaves the recording open.
+static void console_agent_for_talk(void) {
setup();
render();
tap(POD_A_ENTER_TAB, 0);
CHECK(top() == POD_V_AGENT && !pod_ui_talking(&U));
}
-// DOWN, then still samples 16 ms apart until the recorder is asked; returns the sample's index (the DOWN is 0), or -1.
-static int hold_until_begin(void) {
+static void console_tap_talks_on_the_touch_path(void) {
+ console_agent_for_talk();
bool c;
contact(true, 360, 400, &c);
- for (int i = 1; i <= 60; i++) {
- contact(true, 360, 400, &c);
- if (R.begins) return i;
- }
- return -1;
-}
-static void console_hold_fires_on_the_touch_path(void) {
- console_agent_for_hold();
- const int at = hold_until_begin();
- CHECK(at == 25); // 25 * 16 ms = 400 ms: the first sample at the deadline, with no pro_app_tick and no render between
- CHECK(V.open && !strcmp(V.agent, "a1") && pod_ui_talking(&U) && LOCK_DEPTH == 0);
- bool c;
- expect(contact(false, 360, 400, &c), POD_FX_NONE, NULL); // v2: the lift does nothing, the recording stays open
- CHECK(V.open && R.end_send == 0 && pod_ui_talking(&U));
+ for (int i = 0; i < 60; i++) contact(true, 360, 400, &c); // a long still press: nothing until the lift
+ CHECK(R.begins == 0 && !V.open && top() == POD_V_AGENT);
+ contact(false, 360, 400, &c); // the lift talks, with no pro_app_tick and no render between
+ CHECK(R.begins == 1 && V.open && !strcmp(V.agent, "a1") && pod_ui_talking(&U) && LOCK_DEPTH == 0);
render(); // the Talk frame, whose full-screen hit is topmost
contact(true, 20, 20, &c); // a new tap anywhere (here over the bar) sends
contact(false, 20, 20, &c);
CHECK(R.end_send == 1 && V.waiting);
- // A tick while the finger is still down never starts it: a tap-length contact does not talk.
- console_agent_for_hold();
+ // A drag is not a tap: it never starts it.
+ console_agent_for_talk();
contact(true, 360, 400, &c);
- now += 1000;
+ contact(true, 360, 480, &c);
+ contact(false, 360, 480, &c);
pro_app_tick();
CHECK(R.begins == 0 && !V.open && top() == POD_V_AGENT);
}
-// v2: a contact cancel no longer ends a hands-free recording (it was: abort); the side button / tap end it.
-static void console_hold_cancel_keeps_the_recording(void) {
- console_agent_for_hold();
- CHECK(hold_until_begin() == 25 && V.open);
+// A contact cancel never ends a hands-free recording; the side button / tap end it.
+static void console_cancel_keeps_the_recording(void) {
+ console_agent_for_talk();
+ CHECK(tap_talk().fx == POD_FX_VOICE_BEGIN && V.open);
memset(&R, 0, sizeof R);
- pro_app_touch_cancel(); // a second finger, an untrusted sample, the glass turning or sleep
- CHECK(R.end_abort == 0 && V.open && pod_ui_talking(&U) && LOCK_DEPTH == 0);
bool c;
- contact(false, 360, 400, &c);
- CHECK(R.end_send == 0 && V.open);
- // The finger task's own rule: an untrusted sample mid-hold.
- console_agent_for_hold();
- CHECK(hold_until_begin() == 25 && V.open);
+ contact(true, 360, 400, &c);
+ pro_app_touch_cancel(); // a second finger, an untrusted sample, the glass turning or sleep
+ CHECK(R.end_abort == 0 && R.end_send == 0 && V.open && pod_ui_talking(&U) && LOCK_DEPTH == 0);
+ // The finger task's own rule: an untrusted sample mid-contact.
+ console_agent_for_talk();
+ CHECK(tap_talk().fx == POD_FX_VOICE_BEGIN && V.open);
memset(&R, 0, sizeof R);
+ contact(true, 360, 400, &c);
pro_touch_feed(&TCH, PRO_TOUCH_BAD, 360, 400);
CHECK(R.end_abort == 0 && V.open && pod_ui_talking(&U));
- // A slide down 200 px while the hold is still down does nothing either.
- console_agent_for_hold();
- CHECK(hold_until_begin() == 25 && V.open);
- memset(&R, 0, sizeof R);
- contact(true, 360, 600, &c);
- CHECK(R.end_abort == 0 && V.open && pod_ui_talking(&U));
}
-// The hold to talk is the agent screens' own: a long still press on Home never asks the recorder, and its lift
+// Tap to talk is the agent screens' own: a long still press on Home never asks the recorder, and its lift
// walks into the tab as a tap does.
static void console_tile_long_press_is_a_tap(void) {
setup();
@@ -2272,7 +2250,7 @@ int main(int argc, char **argv) {
{"ota_screen_and_touch", ota_screen_and_touch}, {"voice_refused_while_updating", voice_refused_while_updating},
{"update_gate", update_gate}, {"ota_failed_returns", ota_failed_returns}, {"ota_keeps_awake", ota_keeps_awake},
{"ota_notifications_quiet", ota_notifications_quiet}, {"updated_notice", updated_notice},
- {"console_hold_fires_on_the_touch_path", console_hold_fires_on_the_touch_path}, {"console_hold_cancel_keeps_the_recording", console_hold_cancel_keeps_the_recording},
+ {"console_tap_talks_on_the_touch_path", console_tap_talks_on_the_touch_path}, {"console_cancel_keeps_the_recording", console_cancel_keeps_the_recording},
{"console_tile_long_press_is_a_tap", console_tile_long_press_is_a_tap},
};
if (argc > 1 && !strcmp(argv[1], "--each")) { // every replay in its own process: which ones fail, not just the first