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.

fix(pro): draw and read the glass in the panel's own orientation, no 180 turn (#1366)

0xdiego2555b03f489068
diff --git a/devices/harness-pro/README.md b/devices/harness-pro/README.md
index a2b468507..3e9ec9290 100644
--- a/devices/harness-pro/README.md
+++ b/devices/harness-pro/README.md
@@ -14,7 +14,7 @@ idf.py -B build -DPROJECT_VER=0.0.99-pod build
```
- `PROJECT_VER=0.0.99-pod` keeps a dev build from being overwritten by the daemon's OTA update.
-- Every panel is mounted turned 180 degrees, so the picture and touch are always turned; there is no setting.
+- The picture and touch are drawn in the panel's own orientation; there is no turn and no setting.
## Flash
diff --git a/devices/harness-pro/docs/port-inventory.md b/devices/harness-pro/docs/port-inventory.md
index fc2b7850e..4bf65c994 100644
--- a/devices/harness-pro/docs/port-inventory.md
+++ b/devices/harness-pro/docs/port-inventory.md
@@ -32,7 +32,7 @@ Destination key: `pro_app_*` = callbacks in `app/pro_app.c`; `pro_cable` = `cabl
| R14 | UH:6087-6129 (`ui_player_library`, POD) | **Library sweep.** For every `player.library` page: rows mapped to `pod_library_row_t{id,name,engine,machine,status,age_s}`; status names `idle,working,question,finished,failed,paused,offline` by enum index (`>= 7` -> "idle"); `machine` = the machine NAME if the id is in `s.machines`, else `""`. If `s.connected && pod_ui_sweeping && page->request == s.player_library.request`: `pod_ui_library_page(...)` returns the next offset (-1 when done), stored in `pod_sweep_offset`; else `pod_ui_library_rows` (rows only). Settle; if next >= 0, `pro_player_request(next)`. | `pro_app_library(page)`. pro_cable parses `player.library` strictly (id/machineId/name/engine/status/ageSeconds, request, offset, total, machines; rows <= 6; offset <= max(total-6,0); `count == min(6,total-offset)`; no duplicate id; a bad field rejects the whole page). |
| R15 | UH:5279-5294 (`habitat_tick`), UH:2313-2324 (`pro_player_request`) | Sweep driver: when `connected && PLAYER_LIBRARY feature`: if sweeping and (`!pending ? now - try_ms >= 1000 : now - requested_ms > 3000`) re-request `pod_sweep_offset`; if `pod_ui_sweep_due(now)` -> `pod_ui_sweep_begin`, offset 0, request 0. Due on link up, swarm change (glue's `restart`), every `POD_SWEEP_MS` = 30000, stalled sweep restarts. Request = `player.library.get{offset,request}` with request id = last+1; only `queue()`d OK sets `pending`. Sweep aborts on link drop: `pod_ui_link(false)`. | `pro_app_tick()` (driver), `pro_cable_request_library(offset, request)`, `pro_app_link(false)` aborts. `pending/request/requested_ms` become pro_app state. |
| R16 | UH:2683-2686 and 4684-4691 (`habitat_touch`), cable_scroll.c, UH:2887 | **Recap scroll emit.** Before each contact `pod_ui_scroll_sink(&pod, scroll_emit, NULL, scroll_reversed)`; `pod_ui_touch` calls the sink for DOWN/MOVE/UP(+velocity) when a Recap vertical drag begins. `scroll_emit` queues `A_SCROLL`; the worker sends `scroll{phase:down\|move\|up, dy, v (up only)}` (`cable_client_send_scroll`). `scroll_emit` refuses when the queue has < 2 free slots (< 1 for UP) and asserts that UP is never dropped. `scroll_reversed` = the person's setting. | `pro_app_touch()` sets the sink; `pro_cable_send_scroll(phase, dy, v)`. Queue-slot rule must be kept (UP reserves a slot). `scroll_reversed` default false unless the Pro keeps the setting. |
-| R17 | touch_habitat.c:25-30, 131-135; pod_turn.h; display_habitat.c:303-326 (paint) | **The 180 deg touch turn.** Contacts: `data[i].x/y = pod_turn_coord(v)` = `719 - v`, applied only to trusted in-range points (before the track-id duplicate check). Picture: each damage strip's pixel buffer is reversed (`a++, b--`) and drawn at `(HT_WIDTH - x - w, HT_HEIGHT - y - h, HT_WIDTH - x, HT_HEIGHT - y)`. Damage and scene stay in upright coordinates, so `pod_ui_touch` and hits are unchanged. | `pro_touch` (`pod_turn_coord`) and `pro_frame` (paint). Since 2026-10-15 the turn is always on for every unit (main/display/pro_turn.h); there is no setting. |
+| R17 | touch_habitat.c:25-30, 131-135; pod_turn.h; display_habitat.c:303-326 (paint) | **The 180 deg touch turn.** Contacts: `data[i].x/y = pod_turn_coord(v)` = `719 - v`, applied only to trusted in-range points (before the track-id duplicate check). Picture: each damage strip's pixel buffer is reversed (`a++, b--`) and drawn at `(HT_WIDTH - x - w, HT_HEIGHT - y - h, HT_WIDTH - x, HT_HEIGHT - y)`. Damage and scene stay in upright coordinates, so `pod_ui_touch` and hits are unchanged. | `pro_touch` (`pod_turn_coord`) and `pro_frame` (paint). Since 2026-10-16 there is no turn: the panel is drawn and read in its own orientation, no setting. |
| R18 | display_habitat.c:59-66 | **PSRAM scenes.** `static EXT_RAM_BSS_ATTR ht_scene_t scenes[2]` (non-Pod: internal `static ht_scene_t scenes[2]`). Reason in the comment: two scenes of 128 runs are ~53 KB, more than the internal heap left. Also PSRAM: `pod_ui_t pod` (UH:2671, ~130 KB), `rows[POD_AGENTS_MAX]` in `pod_roster_sync` (UH:2731, "not on the 6 KB cable_link stack"), `s_swarm_members` (cable_client.c:727, 27 KB), `s` (UH:246) and `swap` in `ui_project_apply_order`. | `pro_frame.c` scenes, `pro_app.c` `pod`, `pro_cable.c` members. All `EXT_RAM_BSS_ATTR`. |
| R19 | terminal.h:18-27 | **HT_RUNS 128** under `DEVICE_POD` (64 for Pro companion, 40 for the dial). A pet scene alone can take 40 runs next to the status bar and transport. `ht_scene_t` is `HT_RUNS * sizeof(ht_run_t)` and the run has the Pro fields (`pro_kind`, `radius`, `pro_height`, `pro_font`, `bitmap`). | `display/terminal.h` fixed at 128, `HT_FACE_PX` = 720 fixed. Keep the PRO fields of `ht_run_t` (needed by `pro_canvas`/`pod_draw_raster`). |
diff --git a/devices/harness-pro/firmware/CMakeLists.txt b/devices/harness-pro/firmware/CMakeLists.txt
index a06844e8a..bd3c40d25 100644
--- a/devices/harness-pro/firmware/CMakeLists.txt
+++ b/devices/harness-pro/firmware/CMakeLists.txt
@@ -4,7 +4,6 @@
# . ~/esp/esp-idf-5.5.4/export.sh
# idf.py -B build -DPROJECT_VER=0.0.99-pod build
#
-# Every panel is mounted turned 180 degrees; the picture and touch are always turned (display/pro_turn.h).
# Dev builds are safe from the daemon's OTA: a `-pod` version fails its plain X.Y.Z rule, so it is never offered an image.
cmake_minimum_required(VERSION 3.16)
diff --git a/devices/harness-pro/firmware/main/app/pod_turn.h b/devices/harness-pro/firmware/main/app/pod_turn.h
deleted file mode 100644
index ce5666406..000000000
--- a/devices/harness-pro/firmware/main/app/pod_turn.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#pragma once
-// The screen turn (always on: every panel is mounted turned 180 degrees). It happens ONCE, in
-// display/pro_display.c (rules in display/pro_turn.h): the strips are reversed and pro_touch_poll() hands back upright
-// coordinates. Everything above it (pro_touch.c, pro_app.c, Pod) sees an upright 720 x 720 glass, so nothing
-// in main/app may apply this turn again. pod_turn_coord() is the panel layer's rule written down; the host
-// tests use it to play the part of the controller (a contact reported on the controller's axes).
-#include "pro_turn.h" // display/: the panel layer's own rule, shared so the tests play the real one
-
-// A contact coordinate on the controller's axes -> on the upright glass.
-static inline int pod_turn_coord(int v) { return pro_turn_coord(v); }
diff --git a/devices/harness-pro/firmware/main/display/pro_display.c b/devices/harness-pro/firmware/main/display/pro_display.c
index 071a27e34..c984d7012 100644
--- a/devices/harness-pro/firmware/main/display/pro_display.c
+++ b/devices/harness-pro/firmware/main/display/pro_display.c
@@ -1,5 +1,4 @@
#include "pro_display.h"
-#include "pro_turn.h"
#include <assert.h>
#include <string.h>
@@ -23,7 +22,7 @@ static const char *TAG = "pro_display";
_Static_assert(PRO_DISPLAY_PX == BSP_LCD_H_RES && PRO_DISPLAY_PX == BSP_LCD_V_RES, "square 720 glass");
/* Two internal DMA-capable strip buffers (PRO_STRIP_PX pixels each): the renderer fills one while the other is on the
- * wire, and the turn is done in place, so nothing is copied. */
+ * wire. */
static esp_lcd_panel_handle_t s_panel;
static SemaphoreHandle_t s_dma_done;
@@ -65,24 +64,17 @@ void pro_display_init(void)
s_touch_retry_at = esp_timer_get_time() + 5000000;
ESP_LOGW(TAG, "touch not up; pro_touch_read() will retry");
}
- ESP_LOGI(TAG, "%dx%d glass up, turn=%d", PRO_DISPLAY_PX, PRO_DISPLAY_PX, 180);
+ ESP_LOGI(TAG, "%dx%d glass up", PRO_DISPLAY_PX, PRO_DISPLAY_PX);
}
uint16_t *pro_panel_strip(int which) { return s_strip[which & 1]; }
-void pro_panel_prepare(uint16_t *buf, int w, int h)
-{
- pro_turn_pixels(buf, (size_t)w * (size_t)h); /* the panel is mounted upside down: reverse the block */
-}
-
void pro_panel_submit(int x, int y, int w, int h, const uint16_t *buf)
{
assert(s_panel && w > 0 && h > 0 && x >= 0 && y >= 0 && x + w <= PRO_DISPLAY_PX && y + h <= PRO_DISPLAY_PX);
assert(buf == s_strip[0] || buf == s_strip[1]);
- int px, py;
- pro_turn_rect(x, y, w, h, &px, &py);
xSemaphoreTake(s_dma_done, 0); /* drop a stale give from an earlier timed-out push */
- ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(s_panel, px, py, px + w, py + h, buf));
+ ESP_ERROR_CHECK(esp_lcd_panel_draw_bitmap(s_panel, x, y, x + w, y + h, buf));
s_in_flight = true;
}
@@ -134,7 +126,6 @@ pro_touch_sample_t pro_touch_poll(int *x, int *y)
if (count != 1) return PRO_TOUCH_BAD;
int tx = data[0].x, ty = data[0].y;
if (tx < 0 || ty < 0 || tx >= PRO_DISPLAY_PX || ty >= PRO_DISPLAY_PX) return PRO_TOUCH_BAD;
- pro_turn_point(&tx, &ty); /* the contact is turned here, once */
if (x) *x = tx;
if (y) *y = ty;
return PRO_TOUCH_ONE;
diff --git a/devices/harness-pro/firmware/main/display/pro_display.h b/devices/harness-pro/firmware/main/display/pro_display.h
index a82e4a215..a584d5d35 100644
--- a/devices/harness-pro/firmware/main/display/pro_display.h
+++ b/devices/harness-pro/firmware/main/display/pro_display.h
@@ -1,7 +1,4 @@
-// The Pro's glass: a 720 x 720 RGB565 panel and its GT911 touch, upright to the caller.
-//
-// Every panel is mounted turned 180 degrees (pro_turn.h). The picture is turned where strips are written and the contact where it is read, so callers
-// always see an upright PRO_DISPLAY_PX x PRO_DISPLAY_PX glass.
+// The Pro's glass: a 720 x 720 RGB565 panel and its GT911 touch, in the panel's own orientation (no turn).
#pragma once
#include <stdbool.h>
@@ -14,7 +11,7 @@
// touch controller is logged and retried by pro_touch_read().
void pro_display_init(void);
-// One contact, in upright glass coordinates. False when nothing touches the glass or the controller is
+// One contact, in glass coordinates. False when nothing touches the glass or the controller is
// absent or returned something untrustworthy (out of range, or more than one finger).
bool pro_touch_read(int *x, int *y);
@@ -22,7 +19,7 @@ bool pro_touch_read(int *x, int *y);
// BAD: fingers the caller must not act on (more than one, or a point off the glass): cancel the contact and
// ignore it until every finger is up. ERROR: the read itself failed (a stale or lost sample, not a lift).
typedef enum { PRO_TOUCH_NONE, PRO_TOUCH_ONE, PRO_TOUCH_BAD, PRO_TOUCH_ERROR } pro_touch_sample_t;
-// Upright glass coordinates in *x, *y on ONE. This is where the screen turn is applied to the contact (once).
+// Glass coordinates in *x, *y on ONE.
pro_touch_sample_t pro_touch_poll(int *x, int *y);
// Backlight level 0..255, floored at 20 so the glass never goes dark by a setting. Off keeps the picture and
@@ -36,11 +33,9 @@ void pro_display_power(bool on);
#define PRO_STRIP_PX (PRO_DISPLAY_PX * PRO_STRIP_LINES)
uint16_t *pro_panel_strip(int which); // 0 or 1
-// Push the w*h pixels in strip buffer `buf` (a pro_panel_strip() buffer, rows packed at width w) to the upright
-// rectangle (x, y). Applies the panel turn exactly once: pro_panel_prepare() reverses the buffer in place (call it
-// right after rasterising, before waiting), and the submit maps the rectangle. Asynchronous: the buffer belongs to the
+// Push the w*h pixels in strip buffer `buf` (a pro_panel_strip() buffer, rows packed at width w) to the
+// rectangle (x, y). Asynchronous: the buffer belongs to the
// DMA until pro_panel_wait() returns. Waiting for the previous submit before the next one is the caller's job.
-void pro_panel_prepare(uint16_t *buf, int w, int h);
void pro_panel_submit(int x, int y, int w, int h, const uint16_t *buf);
// Block until the last submit has landed in the panel's framebuffer (250 ms; a timeout aborts to the reboot path).
void pro_panel_wait(void);
diff --git a/devices/harness-pro/firmware/main/display/pro_frame.c b/devices/harness-pro/firmware/main/display/pro_frame.c
index 1e38386d1..da0ec91a4 100644
--- a/devices/harness-pro/firmware/main/display/pro_frame.c
+++ b/devices/harness-pro/firmware/main/display/pro_frame.c
@@ -1,5 +1,5 @@
// The frame path: ht_damage() between two scenes, then each damage rectangle (at its own width, no widening to full
-// rows) is rasterised in strips straight into one of two internal DMA buffers, turned in place by the panel layer, and
+// rows) is rasterised in strips straight into one of two internal DMA buffers and
// handed to the panel. While the DMA of strip n runs, strip n+1 is rasterised into the other buffer (A/B).
#include "pro_frame.h"
@@ -31,7 +31,6 @@ uint32_t pro_frame_present(const ht_scene_t *prev, const ht_scene_t *next, uint3
uint16_t *px = pro_panel_strip(buffer);
const int64_t t = esp_timer_get_time();
ht_raster(next, (ht_rect_t){rect.x, (int16_t)y, rect.w, (int16_t)h}, px);
- pro_panel_prepare(px, rect.w, h);
raster_us += (uint32_t)(esp_timer_get_time() - t);
if (pending) pro_panel_wait(); // the other buffer's DMA overlapped the raster above
pro_panel_submit(rect.x, y, rect.w, h, px);
diff --git a/devices/harness-pro/firmware/main/display/pro_frame.h b/devices/harness-pro/firmware/main/display/pro_frame.h
index 5f22b37cf..903716fa4 100644
--- a/devices/harness-pro/firmware/main/display/pro_frame.h
+++ b/devices/harness-pro/firmware/main/display/pro_frame.h
@@ -1,5 +1,5 @@
// Paints Pod's scenes onto the glass: damage between two scenes, then the damaged rectangles rasterised in strips
-// into two DMA buffers and pushed through pro_panel_submit(). Upright coordinates; the panel turn is pro_turn.h's.
+// into two DMA buffers and pushed through pro_panel_submit(). Glass coordinates.
#pragma once
#include <stdbool.h>
diff --git a/devices/harness-pro/firmware/main/display/pro_turn.h b/devices/harness-pro/firmware/main/display/pro_turn.h
deleted file mode 100644
index 7ad2b70ef..000000000
--- a/devices/harness-pro/firmware/main/display/pro_turn.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// The 180 degree panel turn. THE one place it is written down; the panel layer (pro_display.c) applies each helper once,
-// and the host tests call these same functions to play the glass. Callers above the panel layer see an upright
-// PRO_DISPLAY_PX x PRO_DISPLAY_PX glass and must never turn anything.
-//
-// Every unit's panel is mounted turned 180 degrees, so the turn is always on.
-#pragma once
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define PRO_TURN_PX 720
-
-// A coordinate on the controller's axes <-> on the upright glass (the turn is its own inverse).
-static inline int pro_turn_coord(int v) { return PRO_TURN_PX - 1 - v; }
-// A contact (x, y) on the controller's axes -> on the upright glass.
-static inline void pro_turn_point(int *x, int *y)
-{
- *x = PRO_TURN_PX - 1 - *x;
- *y = PRO_TURN_PX - 1 - *y;
-}
-
-// Reverse a w*h block of pixels in place: with the rectangle mapped by pro_turn_rect this is a 180 degree turn.
-static inline void pro_turn_pixels(uint16_t *px, size_t count)
-{
- if (count < 2) return;
- for (uint16_t *a = px, *b = px + count - 1; a < b; a++, b--) {
- const uint16_t v = *a;
- *a = *b;
- *b = v;
- }
-}
-
-// The rectangle (x, y, w, h) of the upright glass -> its top-left corner on the panel.
-static inline void pro_turn_rect(int x, int y, int w, int h, int *panel_x, int *panel_y)
-{
- *panel_x = PRO_TURN_PX - x - w;
- *panel_y = PRO_TURN_PX - y - h;
-}
diff --git a/devices/harness-pro/firmware/main/sys/config_store.h b/devices/harness-pro/firmware/main/sys/config_store.h
index c589b9fae..34d97a24f 100644
--- a/devices/harness-pro/firmware/main/sys/config_store.h
+++ b/devices/harness-pro/firmware/main/sys/config_store.h
@@ -24,8 +24,6 @@ void config_save_brightness(uint8_t level);
bool config_load_muted(void);
bool config_save_muted(bool muted);
-// The screen turned 180 degrees. `fallback` is the answer when nothing was saved (the build's default).
-
// The voice language the device captures in. The daemon PROPOSES one from the computer's locale on every
// `welcome`; once the user has picked here, this wins — the person holding the device may well speak
// something other than the laptop is set to.
diff --git a/devices/harness-pro/firmware/test/run.sh b/devices/harness-pro/firmware/test/run.sh
index d88294358..7d93cbf30 100755
--- a/devices/harness-pro/firmware/test/run.sh
+++ b/devices/harness-pro/firmware/test/run.sh
@@ -72,8 +72,8 @@ echo "pets home: pixel (10,690) = #221F1D"
# Pets render time: every screen within 85% of its pre-change host time (test_ph_perf.sh; opt-in: runs only with PH_PERF=1, since absolute host microseconds are flaky on CI machines).
bash "$here/test_ph_perf.sh"
-# pro_frame: the strip and turn math against a fake 720 x 720 panel with the 180 degree turn. Same objects
-# as the Pod tests (terminal.c, pro_canvas.c, the fonts); the turn rules are display/pro_turn.h, shared with the panel.
+# pro_frame: the strip math against a fake 720 x 720 panel. Same objects
+# as the Pod tests (terminal.c, pro_canvas.c, the fonts).
cc "${cflags[@]}" -Wframe-larger-than=2048 -I"$fw/test/host_esp" -c -o "$out/pro_frame.o" "$disp/pro_frame.c"
cc "${cflags[@]}" -I"$fw/test/host_esp" -o "$out/test_pro_frame" "$fw/test/test_pro_frame.c" "$out/pro_frame.o" "${objs[@]}"
"$out/test_pro_frame"
@@ -114,7 +114,7 @@ cc "${cc_flags[@]}" -I"$fw/main/sys" -o "$out/test_fw_update" "$here/test_fw_upd
"$out/test_fw_update"
# The app layer: pro_app.c, pod_glue.c and pro_touch.c with the cable, the recorder and the clock as host stubs,
-# replayed with the 180 degree turn. It builds its own fonts and objects.
+# replayed. It builds its own fonts and objects.
python3 "$here/test_pro_app.py"
python3 "$here/test_pro_hello.py"
diff --git a/devices/harness-pro/firmware/test/test_pro_app.py b/devices/harness-pro/firmware/test/test_pro_app.py
index ab6a5e7fe..fdc4d5dae 100644
--- a/devices/harness-pro/firmware/test/test_pro_app.py
+++ b/devices/harness-pro/firmware/test/test_pro_app.py
@@ -4,10 +4,10 @@
Ported from the round firmware's test_pod_touch_ui.py (every test keeps its name). The production glue, the app layer
and the finger task's contact rules are compiled here as they are, with Pod's views, the Pro canvas and the generated
fonts. Below pro_app the host plays the device: a fake clock, the cable and the recorder as recorders (every send
-checks that pro_app's mutex is NOT held), and the GT911 whose contacts pro_display.c turns upright. The effects Pod
+checks that pro_app's mutex is NOT held), and the GT911, whose contacts reach pro_app as they are. The effects Pod
returns are performed by pro_app and read back from those recorders.
-The panel is turned 180: a contact at (700, 700) on the controller's axes hits what (19, 19) hits on the glass,
-and the turn is applied exactly once (see test_turn_is_applied_once). No USB, hardware writes or microphone.
+The panel is not turned: a contact on the controller's axes is that point on the glass (see test_no_turn).
+No USB, hardware writes or microphone.
"""
from pathlib import Path
import os
@@ -36,7 +36,6 @@ code = r'''
#include "app/pro_app.h"
#include "app/pro_touch.h"
#include "app/pro_voice.h"
-#include "app/pod_turn.h"
#include "cable/pro_cable.h"
#include "pro_app_api.h"
#include "pro_canvas.h"
@@ -68,8 +67,8 @@ static const pod_hit_t *hit(pod_action_t a, int arg) {
return NULL;
}
// ---- the host plays the parts the device has below pro_app ------------------------------------------------------
-// The clock is `now`. The GT911 reports a contact on its own axes; pro_display.c's pro_touch_poll() turns it upright
-// (once), which is what pod_turn_coord() states, and pro_touch_feed() hands it to pro_app_touch(). The cable and the
+// The clock is `now`. The GT911 reports a contact on its own axes; pro_display.c's pro_touch_poll() hands it on as
+// is, and pro_touch_feed() hands it to pro_app_touch(). The cable and the
// recorder are recorders, and every send checks that pro_app's mutex is NOT held (nothing leaves under the lock).
static int LOCK_DEPTH;
struct host_mutex { int unused; };
@@ -164,7 +163,7 @@ static pod_out_t contact(bool down, int x, int y, bool *changed) {
(void)pod_ui_take_changed(&U);
(void)pro_app_test_take_dirty();
memset(&R, 0, sizeof R);
- const int ux = pod_turn_coord(x), uy = pod_turn_coord(y);
+ const int ux = x, uy = y;
// The controller reports no position on a lift, so the task hands Pod the last held point. SRC's replays name a
// lift point of their own (to test the tap's hit and slop), so those go to pro_app_touch directly.
if (!down && TCH.prev && (ux != TCH.last_x || uy != TCH.last_y)) {
@@ -180,16 +179,12 @@ static pod_out_t contact(bool down, int x, int y, bool *changed) {
CHECK(LOCK_DEPTH == 0);
return effect_of();
}
-// The same, for a point on the upright glass: the panel reports it turned 180.
-static pod_out_t ucontact(bool down, int x, int y, bool *changed) {
- return contact(down, pod_turn_coord(x), pod_turn_coord(y), changed);
-}
// A tap on the rendered hit: DOWN and UP at its centre, as the GT911 reports it, then the redraw a change causes.
static pod_out_t tap_at(int x, int y) {
bool c1 = false, c2 = false;
- pod_out_t d = ucontact(true, x, y, &c1);
+ pod_out_t d = contact(true, x, y, &c1);
CHECK(d.fx == POD_FX_NONE);
- pod_out_t u = ucontact(false, x, y, &c2);
+ pod_out_t u = contact(false, x, y, &c2);
render();
return u;
}
@@ -205,12 +200,12 @@ static pod_out_t tap_by_nav(pod_action_t a, int arg) {
// 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) {
bool c = false;
- CHECK(ucontact(true, 360, 400, &c).fx == POD_FX_NONE);
+ CHECK(contact(true, 360, 400, &c).fx == POD_FX_NONE);
now += 450;
- pod_out_t begin = ucontact(true, 360, 400, &c); // the still sample that finds the deadline
+ 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 = ucontact(false, 360, 400, &c);
+ pod_out_t lift = 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;
@@ -234,9 +229,9 @@ static pod_out_t nav_act(pod_action_t a) {
// A drag from (x0,y0) to (x1,y1) in n MOVEs of 16 ms each, then the lift. Returns the effect of the lift.
static pod_out_t drag(int x0, int y0, int x1, int y1, int n) {
bool c = false;
- ucontact(true, x0, y0, &c);
- for (int i = 1; i <= n; i++) ucontact(true, x0 + (x1 - x0) * i / n, y0 + (y1 - y0) * i / n, &c);
- pod_out_t o = ucontact(false, x1, y1, &c);
+ contact(true, x0, y0, &c);
+ for (int i = 1; i <= n; i++) contact(true, x0 + (x1 - x0) * i / n, y0 + (y1 - y0) * i / n, &c);
+ pod_out_t o = contact(false, x1, y1, &c);
render();
return o;
}
@@ -478,7 +473,7 @@ static void tap_resolves_by_id(void) {
CHECK(h && !strcmp(h->id, "s0"));
int cx = h->x + h->w / 2, cy = h->y + h->h / 2;
bool c;
- ucontact(true, cx, cy, &c);
+ contact(true, cx, cy, &c);
static cable_swarm_t sw[2]; // the tabs swap places before the finger lifts
memset(sw, 0, sizeof sw);
snprintf(sw[0].id, sizeof sw[0].id, "s1"); snprintf(sw[0].name, sizeof sw[0].name, "Frontend"); sw[0].panes = sw[0].agents = 1;
@@ -488,7 +483,7 @@ static void tap_resolves_by_id(void) {
mem.count[0] = 1; snprintf(mem.id[0][0], ID_MAX, "a3");
mem.count[1] = 2; snprintf(mem.id[1][0], ID_MAX, "a1"); snprintf(mem.id[1][1], ID_MAX, "a2");
pod_ui_swarms(&U, sw, 2, &mem, "s0", NULL, 0);
- pod_out_t o = ucontact(false, cx, cy, &c);
+ pod_out_t o = contact(false, cx, cy, &c);
expect(o, POD_FX_AGENT_OPEN, "a1"); // Backend's first agent: the card is found by its id, not its old place
// and a tab that is gone opens nothing
setup();
@@ -496,7 +491,7 @@ static void tap_resolves_by_id(void) {
h = hit(POD_A_ENTER_TAB, 0);
CHECK(h && !strcmp(h->id, "s0"));
cx = h->x + h->w / 2; cy = h->y + h->h / 2;
- ucontact(true, cx, cy, &c);
+ contact(true, cx, cy, &c);
static cable_swarm_t only[1];
memset(only, 0, sizeof only);
snprintf(only[0].id, sizeof only[0].id, "s1"); snprintf(only[0].name, sizeof only[0].name, "Frontend"); only[0].panes = only[0].agents = 1;
@@ -504,7 +499,7 @@ static void tap_resolves_by_id(void) {
memset(&mem1, 0, sizeof mem1);
mem1.count[0] = 1; snprintf(mem1.id[0][0], ID_MAX, "a3");
pod_ui_swarms(&U, only, 1, &mem1, "s1", NULL, 0); // Backend closes
- o = ucontact(false, cx, cy, &c);
+ o = contact(false, cx, cy, &c);
CHECK(o.fx == POD_FX_NONE && top() == POD_V_TABS && U.nav.depth == 1);
render();
h = hit(POD_A_ENTER_TAB, 0);
@@ -564,28 +559,27 @@ static void release_off_the_hit_cancels(void) {
bool c;
const pod_hit_t *h = hit(POD_A_ENTER_TAB, 0);
CHECK(h);
- ucontact(true, h->x + 5, h->y + h->h - 5, &c);
- pod_out_t o = ucontact(false, h->x + 5, h->y + h->h + 3, &c); // inside the slop, outside the hit
+ contact(true, h->x + 5, h->y + h->h - 5, &c);
+ pod_out_t o = contact(false, h->x + 5, h->y + h->h + 3, &c); // inside the slop, outside the hit
CHECK(o.fx == POD_FX_NONE && top() == POD_V_TABS);
pro_app_touch_cancel();
- ucontact(true, h->x + 5, h->y + 5, &c);
+ contact(true, h->x + 5, h->y + 5, &c);
pro_app_touch_cancel();
- o = ucontact(false, h->x + 5, h->y + 5, &c);
+ o = contact(false, h->x + 5, h->y + 5, &c);
CHECK(o.fx == POD_FX_NONE && top() == POD_V_TABS); // a cancelled contact never taps
}
static void panel_turn(void) {
setup();
- const pod_hit_t *h = hit(POD_A_ENTER_TAB, 0); // Home's tab card, (90, 56) 540 x 560 upright
+ const pod_hit_t *h = hit(POD_A_ENTER_TAB, 0); // Home's tab card, (90, 56) 540 x 560
CHECK(h && h->x == 90 && h->y == 56 && h->y + h->h == 616);
- // The raw contact (100, 70) is inside the card upright; turned 180 it is (619, 649) on the glass: below the card.
+ // No turn: the raw contact (619, 649) is below the card on the glass and misses it; the raw (100, 70) is inside.
bool c;
+ contact(true, 619, 649, &c);
+ contact(false, 619, 649, &c);
+ CHECK(top() == POD_V_TABS);
contact(true, 100, 70, &c);
contact(false, 100, 70, &c);
- CHECK(top() == POD_V_TABS); // the turned contact missed the card
- CHECK(pod_turn_coord(700) == 19 && pod_turn_coord(19) == 700);
- contact(true, 619, 649, &c); // while the raw (619, 649) is (100, 70) on the glass: inside the card
- contact(false, 619, 649, &c);
CHECK(top() != POD_V_TABS);
}
@@ -1079,7 +1073,7 @@ static void follow_waits_out_the_users_touch(void) {
// A finger that is still down is driving too.
bool c;
now += 10000;
- ucontact(true, 360, 360, &c);
+ contact(true, 360, 360, &c);
now += 5000;
pod_ui_focus(&U, "a1", now);
CHECK(!strcmp(frame_at(2)->agent, "a2"));
@@ -1152,7 +1146,7 @@ static void follow_waits_for_a_finger_on_tabs(void) {
setup();
now += 5000;
bool c;
- ucontact(true, 360, 360, &c);
+ contact(true, 360, 360, &c);
pod_ui_focus(&U, "a2", now + 100);
CHECK(U.nav.depth == 1);
pro_app_touch_cancel();
@@ -1220,11 +1214,11 @@ static void open_recap_for_scroll(bool reversed) {
static void recap_drag_scrolls_the_host(void) {
open_recap_for_scroll(false);
bool c;
- ucontact(true, 360, 300, &c);
+ contact(true, 360, 300, &c);
CHECK(SC.n == 0); // a finger that only landed is not yet a scroll
- for (int y = 300; y >= 120; y -= 20) { now += 16; ucontact(true, 360, y, &c); } // up the glass
+ for (int y = 300; y >= 120; y -= 20) { now += 16; contact(true, 360, y, &c); } // up the glass
now += 16;
- ucontact(false, 360, 120, &c);
+ contact(false, 360, 120, &c);
CHECK(SC.n >= 4 && SC.phase[0] == HT_SCROLL_DOWN && SC.phase[SC.n - 1] == HT_SCROLL_UP);
int total = 0;
for (int i = 0; i < SC.n; i++) {
@@ -1235,18 +1229,18 @@ static void recap_drag_scrolls_the_host(void) {
CHECK(SC.v[SC.n - 1] < -100); // the fling carries the speed, signed with the finger
// Down the glass is positive (the Pro has no reversed setting).
open_recap_for_scroll(false);
- ucontact(true, 360, 150, &c);
- for (int y = 150; y <= 330; y += 20) { now += 16; ucontact(true, 360, y, &c); }
- now += 16; ucontact(false, 360, 330, &c);
+ contact(true, 360, 150, &c);
+ for (int y = 150; y <= 330; y += 20) { now += 16; contact(true, 360, y, &c); }
+ now += 16; contact(false, 360, 330, &c);
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.
open_recap_for_scroll(false);
- ucontact(true, 360, 300, &c); now += 40; ucontact(false, 360, 300, &c);
+ contact(true, 360, 300, &c); now += 40; contact(false, 360, 300, &c);
CHECK(SC.n == 0);
- ucontact(true, 360, 300, &c);
- for (int y = 300; y >= 220; y -= 20) { now += 16; ucontact(true, 360, y, &c); }
+ contact(true, 360, 300, &c);
+ for (int y = 300; y >= 220; y -= 20) { now += 16; contact(true, 360, y, &c); }
pro_app_touch_cancel();
CHECK(SC.n >= 3 && SC.phase[SC.n - 1] == HT_SCROLL_UP && SC.dy[SC.n - 1] == 0 && SC.v[SC.n - 1] == 0);
}
@@ -1266,11 +1260,11 @@ static void pets_recap_and_agent_drag_scrolls_the_host(void) {
CHECK(pod_scroll_pitch(&U.nav) == 0 && pod_scroll_max(&U.nav, &U.model) == 0);
SC.n = 0;
bool c;
- ucontact(true, 360, 520, &c);
+ contact(true, 360, 520, &c);
CHECK(SC.n == 0);
- for (int y = 520; y >= 240; y -= 20) { now += 16; ucontact(true, 360, y, &c); }
+ for (int y = 520; y >= 240; y -= 20) { now += 16; contact(true, 360, y, &c); }
now += 16;
- ucontact(false, 360, 240, &c);
+ contact(false, 360, 240, &c);
CHECK(SC.n >= 4 && SC.phase[0] == HT_SCROLL_DOWN && SC.phase[SC.n - 1] == HT_SCROLL_UP);
int total = 0;
for (int i = 0; i < SC.n; i++) if (SC.phase[i] != HT_SCROLL_DOWN) total += SC.dy[i];
@@ -1278,17 +1272,17 @@ static void pets_recap_and_agent_drag_scrolls_the_host(void) {
CHECK(top() == want && U.nav.depth == depth && U.nav.stack[U.nav.depth - 1].scroll == 0);
// and the drag down
SC.n = 0;
- ucontact(true, 360, 240, &c);
- for (int y = 240; y <= 500; y += 20) { now += 16; ucontact(true, 360, y, &c); }
+ contact(true, 360, 240, &c);
+ for (int y = 240; y <= 500; y += 20) { now += 16; contact(true, 360, y, &c); }
now += 16;
- ucontact(false, 360, 500, &c);
+ contact(false, 360, 500, &c);
CHECK(SC.n >= 4 && SC.phase[SC.n - 1] == HT_SCROLL_UP && top() == want && U.nav.depth == depth);
// a swipe up from the bottom zone: Home, nothing sent
SC.n = 0;
- ucontact(true, 360, 690, &c);
- for (int y = 690; y >= 500; y -= 20) { now += 16; ucontact(true, 360, y, &c); }
+ contact(true, 360, 690, &c);
+ for (int y = 690; y >= 500; y -= 20) { now += 16; contact(true, 360, y, &c); }
now += 16;
- ucontact(false, 360, 500, &c);
+ contact(false, 360, 500, &c);
CHECK(SC.n == 0 && U.nav.depth == 1 && top() == POD_V_TABS);
}
}
@@ -1297,17 +1291,17 @@ static void pets_recap_and_agent_drag_scrolls_the_host(void) {
static void swipe_sends_no_host_scroll(void) {
open_recap_for_scroll(false);
bool c;
- ucontact(true, 520, 300, &c);
- for (int x = 520; x >= 300; x -= 20) { now += 16; ucontact(true, x, 300 + (520 - x) / 10, &c); }
+ contact(true, 520, 300, &c);
+ for (int x = 520; x >= 300; x -= 20) { now += 16; contact(true, x, 300 + (520 - x) / 10, &c); }
now += 16;
- pod_out_t o = ucontact(false, 300, 322, &c);
+ pod_out_t o = contact(false, 300, 322, &c);
CHECK(SC.n == 0);
CHECK(o.fx == POD_FX_AGENT_OPEN);
open_recap_for_scroll(false);
- ucontact(true, 360, 300, &c);
- for (int y = 300; y >= 120; y -= 20) { now += 16; ucontact(true, 360, y, &c); }
+ contact(true, 360, 300, &c);
+ for (int y = 300; y >= 120; y -= 20) { now += 16; contact(true, 360, y, &c); }
now += 16;
- o = ucontact(false, 360, 120, &c);
+ o = contact(false, 360, 120, &c);
CHECK(SC.n >= 4 && SC.phase[SC.n - 1] == HT_SCROLL_UP && o.fx == POD_FX_NONE); // A_SCROLL path intact
}
// Only Recap reports: a drag on the Tab list moves that list, not the host.
@@ -1317,9 +1311,9 @@ static void tab_drag_does_not_scroll_the_host(void) {
memset(&SC, 0, sizeof SC);
tap(POD_A_OPEN_TAB, 0);
bool c;
- ucontact(true, 360, 400, &c);
- for (int y = 400; y >= 200; y -= 20) { now += 16; ucontact(true, 360, y, &c); }
- ucontact(false, 360, 200, &c);
+ contact(true, 360, 400, &c);
+ for (int y = 400; y >= 200; y -= 20) { now += 16; contact(true, 360, y, &c); }
+ contact(false, 360, 200, &c);
CHECK(SC.n == 0);
}
@@ -1757,13 +1751,13 @@ static void side_button_discards_hands_free(void) {
render();
tap(POD_A_ENTER_TAB, 0); // Pets Home: a tap on the tab walks straight to its first agent
bool c;
- ucontact(true, 360, 400, &c);
+ contact(true, 360, 400, &c);
now += 450;
- expect(ucontact(true, 360, 400, &c), POD_FX_VOICE_BEGIN, "a1");
+ expect(contact(true, 360, 400, &c), POD_FX_VOICE_BEGIN, "a1");
CHECK(top() == POD_V_TALK);
- expect(ucontact(false, 360, 400, &c), POD_FX_NONE, NULL); // the lift does nothing
+ expect(contact(false, 360, 400, &c), POD_FX_NONE, NULL); // the lift does nothing
CHECK(top() == POD_V_TALK && R.end_abort == 0 && R.end_send == 0);
- ucontact(true, 360, 400, &c); // a second contact, cancelled: still recording
+ contact(true, 360, 400, &c); // a second contact, cancelled: still recording
pro_app_touch_cancel();
CHECK(top() == POD_V_TALK);
memset(&R, 0, sizeof R);
@@ -1884,9 +1878,9 @@ static void notify_tap_opens_and_swipe_dismisses(void) {
CHECK(b);
cx = b->x + b->w / 2; cy = b->y + b->h / 2;
bool c;
- CHECK(ucontact(true, cx, cy, &c).fx == POD_FX_NONE);
- ucontact(true, cx, cy - 30, &c); ucontact(true, cx, cy - 60, &c);
- pod_out_t up = ucontact(false, cx, cy - 60, &c);
+ CHECK(contact(true, cx, cy, &c).fx == POD_FX_NONE);
+ contact(true, cx, cy - 30, &c); contact(true, cx, cy - 60, &c);
+ pod_out_t up = contact(false, cx, cy - 60, &c);
render();
CHECK(up.fx == POD_FX_NONE && banner() == NULL && U.model.unread_count == 1 && top() == POD_V_AGENT);
// A drag down or sideways on the toast is neither a tap nor a dismissal.
@@ -1895,8 +1889,8 @@ static void notify_tap_opens_and_swipe_dismisses(void) {
render();
b = banner();
cx = b->x + b->w / 2; cy = b->y + b->h / 2;
- ucontact(true, cx, cy, &c); ucontact(true, cx, cy + 60, &c);
- up = ucontact(false, cx, cy + 60, &c);
+ contact(true, cx, cy, &c); contact(true, cx, cy + 60, &c);
+ up = contact(false, cx, cy + 60, &c);
render();
CHECK(up.fx == POD_FX_NONE && banner() != NULL && top() == POD_V_AGENT);
}
@@ -1997,12 +1991,12 @@ static void ota_screen_and_touch(void) {
bool changed = false;
static const int pts[][2] = {{360, 640}, {360, 360}, {30, 27}};
for (unsigned i = 0; i < 3; i++) {
- pod_out_t d = ucontact(true, pts[i][0], pts[i][1], &changed);
+ pod_out_t d = contact(true, pts[i][0], pts[i][1], &changed);
CHECK(d.fx == POD_FX_NONE && !changed);
- pod_out_t u = ucontact(false, pts[i][0], pts[i][1], &changed);
+ pod_out_t u = contact(false, pts[i][0], pts[i][1], &changed);
CHECK(u.fx == POD_FX_NONE && !changed);
}
- ucontact(true, 600, 360, &changed); ucontact(true, 100, 365, &changed); ucontact(false, 100, 365, &changed);
+ contact(true, 600, 360, &changed); contact(true, 100, 365, &changed); contact(false, 100, 365, &changed);
CHECK(R.opens == 0 && R.begins == 0 && R.end_abort == 0 && top() == POD_V_AGENT && U.nav.depth == depth && !changed);
// Progress redraws the same screen (the bar's fill moves; the run count does not shrink) and the button does not go home.
fw_update_ui_pct(42);
@@ -2031,7 +2025,7 @@ static void voice_refused_while_updating(void) {
// A still press where the hold records, and the side button: no recording starts and none is left open.
memset(&R, 0, sizeof R);
bool changed;
- ucontact(true, tx, ty, &changed); ucontact(false, tx, ty, &changed);
+ contact(true, tx, ty, &changed); contact(false, tx, ty, &changed);
pro_app_button_press();
CHECK(R.begins == 0 && !V.open && !pod_ui_talking(&U) && top() == POD_V_AGENT);
// A start that was already on its way (Pod returned the effect before the update began) is refused at the gate.
@@ -2167,9 +2161,9 @@ static void console_agent_for_hold(void) {
// 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) {
bool c;
- ucontact(true, 360, 400, &c);
+ contact(true, 360, 400, &c);
for (int i = 1; i <= 60; i++) {
- ucontact(true, 360, 400, &c);
+ contact(true, 360, 400, &c);
if (R.begins) return i;
}
return -1;
@@ -2180,15 +2174,15 @@ static void console_hold_fires_on_the_touch_path(void) {
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(ucontact(false, 360, 400, &c), POD_FX_NONE, NULL); // v2: the lift does nothing, the recording stays open
+ 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));
render(); // the Talk frame, whose full-screen hit is topmost
- ucontact(true, 20, 20, &c); // a new tap anywhere (here over the bar) sends
- ucontact(false, 20, 20, &c);
+ 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();
- ucontact(true, 360, 400, &c);
+ contact(true, 360, 400, &c);
now += 1000;
pro_app_tick();
CHECK(R.begins == 0 && !V.open && top() == POD_V_AGENT);
@@ -2201,7 +2195,7 @@ static void console_hold_cancel_keeps_the_recording(void) {
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;
- ucontact(false, 360, 400, &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();
@@ -2213,7 +2207,7 @@ static void console_hold_cancel_keeps_the_recording(void) {
console_agent_for_hold();
CHECK(hold_until_begin() == 25 && V.open);
memset(&R, 0, sizeof R);
- ucontact(true, 360, 600, &c);
+ 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
@@ -2226,10 +2220,10 @@ static void console_tile_long_press_is_a_tap(void) {
CHECK(tile);
const int x = tile->x + tile->w / 2, y = tile->y + tile->h / 2;
bool c;
- ucontact(true, x, y, &c);
- for (int i = 0; i < 60; i++) ucontact(true, x, y, &c);
+ contact(true, x, y, &c);
+ for (int i = 0; i < 60; i++) contact(true, x, y, &c);
CHECK(R.begins == 0 && !V.open && top() == POD_V_TABS && !pod_ui_talking(&U) && !U.notice_on);
- ucontact(false, x, y, &c);
+ contact(false, x, y, &c);
CHECK(top() == POD_V_AGENT && R.begins == 0 && !pod_ui_talking(&U));
}
@@ -2301,26 +2295,14 @@ int main(int argc, char **argv) {
'''
-def test_turn_is_applied_once():
- """The 180 turn lives in pro_turn.h/.c (rules) and pro_display.c (applied once to picture and touch). Nothing in main/app turns a contact again."""
- display = (DISP / "pro_display.c").read_text()
- turn = (DISP / "pro_turn.h").read_text()
- frame = (DISP / "pro_frame.c").read_text()
- assert display.count("pro_turn_point(&tx, &ty)") == 1 and "pro_turn_coord(" not in display, \
- "pro_display.c must turn the contact once, both axes together"
- assert display.count("pro_turn_pixels(") == 1 and display.count("pro_turn_rect(") == 1, \
- "pro_display.c must turn the picture once (pixels in place, rectangle mapped)"
- assert "PRO_TURN_PX - 1 - v" in turn and "pro_turn_get" not in turn and "POD_PANEL_TURN" not in turn, "pro_turn.h holds the turn rules, always on"
- assert "pro_turn" not in frame, "the turn rules live in pro_turn.h only; pro_frame.c paints upright"
- for source in list(APP.glob("*.c")) + list(APP.glob("*.h")):
- if source.name == "pod_turn.h":
- continue
+def test_no_turn():
+ """The panel is not turned: nothing under main/ turns the picture or a contact."""
+ for source in (FW / "main").rglob("*.[ch]"):
text = source.read_text()
- assert "pod_turn_coord" not in text and "POD_PANEL_TURN" not in text and "pro_turn_coord" not in text, \
- f"{source.name} must not turn the glass: pro_display.c does, once"
+ assert "pro_turn" not in text and "pod_turn_coord" not in text and "POD_PANEL_TURN" not in text, f"{source.name} turns the glass"
-test_turn_is_applied_once()
+test_no_turn()
cc = os.environ.get("CC", "cc")
sanitize = "-fsanitize=" + os.environ.get("SANITIZERS", "undefined,bounds")
@@ -2339,7 +2321,7 @@ with tempfile.TemporaryDirectory(prefix="harness-pro-app-") as directory:
source.write_text(code)
modules = sorted(POD.glob("*.c")) + sorted(POD.glob("*/*.c")) + [APP / "pod_glue.c", APP / "pro_app.c", APP / "pro_touch.c", DISP / "scroll.c",
DISP / "pro_canvas.c", DISP / "terminal.c", fonts]
- for label, extra in (("turned 180", []),):
+ for label, extra in (("upright", []),):
# The callbacks run on the cable_link task's 6 KB stack, the touch task's contact path on 10 KB: no frame of
# pro_app.c, pro_touch.c or the glue may pass 1 KB.
for guarded in (APP / "pod_glue.c", APP / "pro_app.c", APP / "pro_touch.c"):
@@ -2357,4 +2339,4 @@ with tempfile.TemporaryDirectory(prefix="harness-pro-app-") as directory:
failures.append(label)
print(f"FAIL {label}: {result.stderr.strip()}")
assert not failures, f"pro_app regressions: {', '.join(failures)}"
-print("pro_app: production-glue replays passed (panel turned 180)")
+print("pro_app: production-glue replays passed (panel not turned)")
diff --git a/devices/harness-pro/firmware/test/test_pro_frame.c b/devices/harness-pro/firmware/test/test_pro_frame.c
index ed68f729a..6038a8ef0 100644
--- a/devices/harness-pro/firmware/test/test_pro_frame.c
+++ b/devices/harness-pro/firmware/test/test_pro_frame.c
@@ -1,7 +1,6 @@
-// pro_frame.c's strip and turn math: whatever the damage, every damaged pixel reaches the panel exactly as a direct
-// full raster of the new scene would draw it (turned 180), and every pixel of a damage
-// rectangle is written once. The panel is a host fake: it keeps a 720 x 720 "glass" and applies the real pro_turn.h
-// rules (the same inline functions pro_display.c calls once), and it checks the A/B overlap discipline.
+// pro_frame.c's strip math: whatever the damage, every damaged pixel reaches the panel exactly as a direct
+// full raster of the new scene would draw it, and every pixel of a damage rectangle is written once. The panel is a
+// host fake: it keeps a 720 x 720 "glass", and it checks the A/B overlap discipline.
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -10,7 +9,6 @@
#include "pro_canvas.h"
#include "pro_display.h"
#include "pro_frame.h"
-#include "pro_turn.h"
static int checks;
#define CHECK(c) do { if (!(c)) { fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, #c); exit(1); } checks++; } while (0)
@@ -18,29 +16,26 @@ static int checks;
int64_t esp_timer_get_time(void) { static int64_t t; return t += 3; }
enum { N = PRO_DISPLAY_PX };
-static uint16_t glass[N * N]; // the panel's framebuffer, in panel (turned) coordinates
+static uint16_t glass[N * N]; // the panel's framebuffer, in glass coordinates
static unsigned char writes[N * N]; // how often each panel pixel was written during one present
static uint16_t strips[2][PRO_STRIP_PX];
static int in_flight_buf = -1, overlaps, submits;
-uint16_t *pro_panel_strip(int which) { return strips[which & 1]; }
-void pro_panel_prepare(uint16_t *buf, int w, int h)
+uint16_t *pro_panel_strip(int which)
{
- // The raster of the next strip is done while the previous DMA may still own the other buffer: never this one.
- if (in_flight_buf >= 0) { CHECK(buf != strips[in_flight_buf]); overlaps++; }
- pro_turn_pixels(buf, (size_t)w * h);
+ // The next strip is rasterised while the previous DMA may still own the other buffer: never this one.
+ if (in_flight_buf >= 0) { CHECK((which & 1) != in_flight_buf); overlaps++; }
+ return strips[which & 1];
}
void pro_panel_submit(int x, int y, int w, int h, const uint16_t *buf)
{
CHECK(in_flight_buf < 0); // the caller waited for the previous submit first
CHECK(buf == strips[0] || buf == strips[1]);
CHECK(x >= 0 && y >= 0 && w > 0 && h > 0 && x + w <= N && y + h <= N && (size_t)w * h <= PRO_STRIP_PX);
- int px, py;
- pro_turn_rect(x, y, w, h, &px, &py);
for (int r = 0; r < h; r++)
for (int c = 0; c < w; c++) {
- glass[(py + r) * N + px + c] = buf[r * w + c];
- writes[(py + r) * N + px + c]++;
+ glass[(y + r) * N + x + c] = buf[r * w + c];
+ writes[(y + r) * N + x + c]++;
}
in_flight_buf = buf == strips[0] ? 0 : 1;
submits++;
@@ -52,7 +47,7 @@ static void paint_all(const ht_scene_t *s) // put a whole scene on the glass a
{
ht_raster(s, (ht_rect_t){0, 0, N, N}, full);
for (int y = 0; y < N; y++)
- for (int x = 0; x < N; x++) glass[pro_turn_coord(y) * N + pro_turn_coord(x)] = full[y * N + x];
+ for (int x = 0; x < N; x++) glass[y * N + x] = full[y * N + x];
}
static void scene(ht_scene_t *s, int n, const int (*r)[5]) // r: x, y, w, h, colour
@@ -78,8 +73,8 @@ static void replay(const ht_scene_t *prev, const ht_scene_t *next, int expect_ov
ht_raster(next, (ht_rect_t){0, 0, N, N}, full);
for (int y = 0; y < N; y++)
for (int x = 0; x < N; x++) {
- const int g = pro_turn_coord(y) * N + pro_turn_coord(x);
- CHECK(glass[g] == full[y * N + x]); // the turn is applied exactly once
+ const int g = y * N + x;
+ CHECK(glass[g] == full[y * N + x]);
int covered = 0;
for (int i = 0; i < damage.count; i++) {
const ht_rect_t d = damage.rect[i];
@@ -120,13 +115,12 @@ int main(void)
// 6. Identical scenes: nothing is pushed.
replay(&a, &a, 0);
CHECK(submits == 0);
- // 7. The glass is turned 180: a full paint lands at (N-1-x, N-1-y), exactly.
- CHECK(pro_turn_coord(0) == N - 1 && pro_turn_coord(N - 1) == 0);
+ // 7. No turn: a full paint lands at (x, y), exactly.
replay(NULL, &a, 1);
replay(&a, &b, 1); // and a damage repaint on top of a glass drawn that way
ht_raster(&b, (ht_rect_t){0, 0, N, N}, full);
for (int y = 0; y < N; y += 7)
- for (int x = 0; x < N; x += 5) CHECK(glass[(N - 1 - y) * N + (N - 1 - x)] == full[y * N + x]);
- printf("test_pro_frame (turned 180): %d checks passed\n", checks);
+ for (int x = 0; x < N; x += 5) CHECK(glass[y * N + x] == full[y * N + x]);
+ printf("test_pro_frame: %d checks passed\n", checks);
return 0;
}