Files
OrbitTv/docs/orbi-fax-stage1.md
T
2026-11-08 19:22:08 +00:00

10 KiB
Raw Blame History

Orbi-Fax Stage 1 (branch orbi-fax-stage1, 8 November 2026)

This is Orbit's own teletext, entirely offline. Paul approved it on 8 November 2026 as a separate feature track, so it doesn't hold up the provider work or the public launch.

Status: built and tested on this branch only. It has not been installed on either TV, the live TV experience is unchanged, and nothing has been merged.

What it does

  • Opening it:
    • Dial 000 on the channel number entry while watching. Back returns to the channel you were on.
    • Or choose Text at the end of the TV guide's category row. Back returns to the guide.
  • The screen: a 40 x 25 teletext page in the eight teletext colours, with 2x3 mosaics and double-height titles. The 4:3 page sits in the middle, with Orbit Classic margins either side. It follows the concept previews in design/orbi-fax/.
  • Remote (simpler controls after the first downstairs trial, 8 November 2026; the key hints sit in the right-hand margin, not on the page):
    • Up / Down moves the yellow highlight between the links on the page: the sections on page 100, then the coloured links and Go to page along the bottom.
    • OK opens the highlighted link. Go to page opens a three-digit picker: Up/Down sets a digit, Left/Right moves between digits, OK goes and Back cancels.
    • Left / Right turns sub-pages while there are some, then moves to the next or previous page. Page 999 is never turned to: it has to be keyed.
    • Number keys key a page directly. The red, green and yellow keys follow the coloured links and the blue key opens Go to page.
    • Back always returns to the TV or the guide.
  • Pages:
Page What it shows Source (all on the box)
100 Index, with "coming later" for News 101, Sport 300, Weather 400 and House and Rooms 800 –
500 Now and next, six channels a sub-page each channel's own schedule
501 Full listings, one channel a sub-page, the next 17 programmes the same
510 Tonight's highlights What's On's own picks
520 The Drive-In's coming bills the Drive-In plan
600 New in your library, first seen in the last 14 days the daily arrivals record
700 Arcade records, today's single best per game on this TV Arcade settings (no new score storage)
999 The wizard, with "You have gone too far, young traveller. Return at once!" –

Any other number shows a short "no page" message, or "coming later" for 101, 300, 400 and 800.

Profiles, Reduce motion and quiet

  • Kids profiles:
    • Only the channels ticked for the profile appear.
    • After Dark and the late show never appear, even if ticked, and the After Dark PIN lock is honoured.
    • The library page (600) is never shown, because arrivals carry no rating.
    • The Drive-In (520) and Arcade (700) appear only when the profile allows them.
    • Pages a profile can't see drop out of the index, the Fastext links and Up/Down. Keyed directly, they say "This page isn't on this profile."
  • Reduce motion: the sub-page carousel doesn't turn on its own, and 999's warning appears at once instead of typing itself out. Orbi-Fax has no static or other animation.
  • Quiet: Orbi-Fax makes no sound at all.

Under the hood

  • New files:
    • OrbiFaxPage.kt: the page model and renderer
    • OrbiFaxNav.kt: numbering and navigation
    • OrbiFaxPages.kt: the page builders
    • OrbiFaxScreen.kt: data reading and the screen
    • OrbiFaxArt.kt: glyphs, mark and wizard, generated by design/orbi-fax/export-kotlin-art.py
  • Hooks in existing code:
    • EmbyConnectionScreen.kt: one state field, the 000 check in onNumber, the screen call and the guide's onText
    • GuideGrid.kt: the optional onText parameter and the Text chip
  • Memory: fixed and made once per visit. The page is five arrays of 1,000 cells, the dot buffer is a 240 x 250 IntArray (240 KB), and the bitmap is 240 x 250 ARGB (240 KB). Drawing a frame allocates nothing. The pages are rebuilt (small allocations) only when the page, sub-page or minute changes. The header is redrawn once a second. The records are read again once a minute while Orbi-Fax is open. Lists are capped (18 programmes a channel, 64 arrivals, 4 Drive-In bills).
  • Saved data: nothing. Orbi-Fax saves no state, so there's nothing that needs an atomic write.
  • Reading the records: done on one low-priority thread of Orbi-Fax's own, a channel at a time with a short pause between. Now and next come first, the full listings 1.5 s later, then a refresh every minute. Each read is logged (OrbiFax load), and so is each page shown (OrbiFax page=… sub=…), so the TV's numbers can be split by page.
  • Drawing: the whole page is built and drawn only when it changes. Each second only the header row is redrawn, for the clock.
  • Glyphs: the original 5x9 dot-matrix set drawn for the concept, not Bedstead, which still needs Paul's OK. The page is drawn at 240 x 250 dots and scaled without smoothing.
  • Not built:
    • entering pages from the phone (the Companion)
    • per-profile score tables
    • news, sport and weather sources (they need the licensing, attribution and privacy investigation first)
    • House and Rooms (800)
  • Tests: OrbiFaxTest (19 tests) covers the page model, the renderer, numbering and navigation, the profile filter and 999.

Measurement plan for the Xiaomi TV (needs Paul's approval to install, downstairs TV first)

  1. Build the release APK on this branch, record its SHA-256, and install with adb install -r on the downstairs TV only. That's the step that needs approval.
  2. Baseline, before Orbi-Fax: adb shell dumpsys meminfo tv.orbit.classic. Record TOTAL PSS, Java heap, Native heap and Graphics.
  3. adb shell dumpsys gfxinfo tv.orbit.classic reset, then open Orbi-Fax with 000. For about two minutes:
    • step through every page with Up/Down
    • key 501 and turn ten sub-pages
    • open the Fastext row and the digit picker
    • key 999 and let the warning type out
    • leave 500 on its carousel for a minute
  4. adb shell dumpsys gfxinfo tv.orbit.classic: record total frames, janky frames (%), and the 50th, 90th and 99th percentile frame times.
  5. adb logcat -s OrbiFax: record the render avgUs / maxUs lines. The app logs one every 30 renders.
  6. dumpsys meminfo again after five minutes in Orbi-Fax, and again after Back to the TV.
  7. Pass if:
    • render average is under 2 ms and maximum under 8 ms
    • the 90th percentile frame is under 16 ms while keying
    • Java heap doesn't grow over the five minutes
    • PSS returns to within about 1 MB of the baseline after leaving
  8. Report the numbers to Paul before anything goes upstairs. tools/restore-tv.sh puts the previous build back if needed.

Downstairs trial, 8 November 2026 (Paul approved the install)

  • Build: 0.110.5-orbi-fax-trial is 0.110.5 (commit 84b28b6) plus Orbi-Fax. It keeps versionCode 280, so the 0.110.5 APK reinstalls over it.
  • Install: install -r on the downstairs TV (192.168.0.252) only. The APK SHA-256 is f801bdbcb068189e969b11eafdcb7e5c58a1cbd70c2e8c991e2d3a264105bb29, signed with the same key as the installed app.
  • Checks after install:
    • One Orbit MainActivity is running.
    • Bookings went from 2,368 to 2,370, none lost.
    • Profiles, settings and the Taste events are unchanged.
    • The schedule and progress files and the connection file were rewritten on launch, as at the 0.110.5 install.
  • Backups: the before and after snapshots, the measurements and rollback-0.110.5.apk are in backups/install-0.110.5-orbi-fax-trial-20261108-1837.
  • Render time (the app's own log, 120 renders):
    • average 1.7 to 2.4 ms a render, maximum 6.4 ms
    • a render happens only when the page changes and once a second for the clock, not every frame
  • Frames:
    • The guide alone ran at 50th/90th/99th percentiles of 8/12/26 ms.
    • The two minutes in Orbi-Fax ran at 20/40–81/150–200 ms, with 33 to 79 janky frames per 30 seconds.
    • That window also held the first page loads and the planner's background rounds after a fresh start.
  • Memory: about 128 MB in the guide after the restart, 174 MB at most in Orbi-Fax (Java heap 27.5 MB), and back to 149–150 MB after leaving. It stayed flat for seven minutes, so nothing was left behind growing. The earlier 214–227 MB baseline was a process that had been running for a long time, so it isn't directly comparable.
  • Not captured: the per-page key timeline. getevent can't read several devices at once that way, so the frames can't be split by page.
  • To follow up:
    • The jank on opening and turning pages needs a closer look. Likely candidates are reading every channel's listings in one go, and rebuilding the whole page when only the clock changes.
    • The render average is right at the 2 ms target.

Second downstairs trial, 8 November 2026 (simpler controls)

  • Install: 0.110.5-orbi-fax-trial2, updated in place (8ca4d7773edee20b5aa72a81f363950630eba883b0785410c8dcc34d9ea4aad5). One MainActivity is running and all 2,370 bookings were kept. Profiles and settings are unchanged. Backups and measurements are in backups/install-0.110.5-orbi-fax-trial2-20261108-1909.

  • Paul's verdict on the controls: "feels good".

  • Measurements:

    Where Frames 50th / 90th / 99th percentile Janky Memory (PSS)
    Guide 9 / 40 / 200 ms 14% 116–138 MB
    Orbi-Fax, 19:12:09 to 19:13:02 18 / 26 / 53 ms 46% 144–160 MB (Java heap 15–27 MB)
    First trial, Orbi-Fax 20 / 40–81 / 150–200 ms

    Pages visited: 100, 520, 510, 501 (nine sub-pages), 600, 500 (six sub-pages).

  • Reading the records: now and next for 38 channels took 202–218 ms on the background thread. The full listings took 411–416 ms.

  • Render time: a full page averages 1.8 ms, at most 3.0 ms.

  • Still to do: Orbi-Fax frames now sit just over 16 ms (the 50th percentile is 18 ms), so many still count as janky. The 90th and 99th percentiles are much better than in the first trial. A next step would be drawing the page with a single image upload instead of setPixels on each change, and measuring whether the scaled drawImage costs more than it should on this TV.