Site Guide

Find your way around the Engineering Club.

Know what you need? Search for a component, concept or project.

Around the site

Start

Labs

TestingExperimental

Build

Club

LearnExperimental

Go a little deeper

Entry points to larger collections. Use Search for individual records.

Learning paths & reference

Inside PiCrawlerExperimental

Inside Inventory

Touchscreen Interface / Stage 1 of 3

Hit box and touch edge

Run the host test for half-open rectangles and a touch-down event.

Host software model · physical driver still required

Download stage 1 host modelRead code & run steps ↓

What changes now?

Initial isolated observation

Expected model result: Holding produces one action; the far edge is excluded.

What you need

A computer with VS Code, PlatformIO and a working native C++ toolchain. No display hardware is needed for this model.

Connections / current hardware gate

This stage runs on your computer. Leave display hardware disconnected; the host model does not send data to the physical screen.

Use this complete project

Target: native · Environment: checkpoint1 · Stage branch: DISPLAY_STAGE=1

  1. Open the complete project. Download the stage ZIP, extract it and open the folder containing platformio.ini and src in VS Code. Keep its supporting headers and libraries together.
  2. Build stage 1. Select checkpoint1 in PlatformIO Project Tasks → General → Build, or use a PlatformIO terminal:
    pio run -e checkpoint1
    A successful Build compiles the program; it does not upload it or approve electrical connections.
  3. Run the host model. In Windows PowerShell, from the extracted project folder:
    .\.pio\build\checkpoint1\program.exe

    On Linux/macOS use .pio/build/checkpoint1/program. This needs a working native compiler/toolchain; it is not a microcontroller upload.

Complete source

The viewer starts at src/main.cpp. Use Source file for the board profile, PlatformIO configuration and supporting code. Keep the complete ZIP together.

workspaces/touch-interface/src/main.cpp

main.cpp
#include <DisplayCore.h>
#include <iostream>
#include <cassert>
int main(){displaylab::Rect button{10,20,80,40};displaylab::Touch touch;unsigned actions=0;
const bool inside=button.contains(30,30);if(inside&&touch.press(true))++actions;
if(inside&&touch.press(true))++actions;
touch.press(false);
assert(actions==1);assert(!button.contains(90,30));assert(!button.contains(-1,30));
std::cout<<"one action per touch-down; half-open hit box verified\n";
#if DISPLAY_STAGE >= 2
int x=30,y=40;const int rotatedX=319-y,rotatedY=x;assert(rotatedX==279&&rotatedY==30);
std::cout<<"portrait-to-landscape transform: 279,30; hardware orientation must be measured\n";
#endif
}
Source integrity · SHA-256c992215f5574db709af7fd329d06daedc75ab8b331c068f374b8f09d71c22785

Raw downloads and standalone ZIPs retain the canonical bytes and supporting files. Copy follows the selected Comments setting.

Check the result

Holding produces one action; the far edge is excluded.

Compare the program's output with the stated model result. It does not establish physical display behavior.

Original verification checklist
  1. Build the exact selected environment; distinguish dependency resolution from source compilation.
  2. Observe the stated output and record actual behavior; expected result is not an observed transcript.
  3. Test the named failure mode before proceeding.

Troubleshooting

Pixels work but touch does not

Inspect the touch I²C device/driver separately from LCD SPI. A visible screen does not prove the input path.

Touch reversed or offset

Log raw corner samples, establish orientation and apply one tested transform. Avoid trial-and-error multiple rotations in separate layers.

Cannot build C6 target

Confirm framework support and actual board family. The supplied native test is not an ESP32-C6 executable.

Technical explanation / original guide

Read the complete original stage guide

Original source/research wording is preserved. The stage's dated build evidence above supersedes earlier blanket compile-status wording; no physical results are implied.

Build it

Run the host test for half-open rectangles and a touch-down event.

Open workspaces/touch-interface in VS Code/PlatformIO. Select checkpoint1 and run pio run -e checkpoint1. This is SOFTWARE_MODEL_AUTHORED. Run .pio/build/checkpoint1/program after building; no hardware or upload is required.

Understand it

A touch-level is not a click event. The Touch model produces an event only on a transition into contact. A rectangular widget includes its near edges and excludes far edges, avoiding adjacent widgets both claiming a shared boundary. The real port must update contact state even when a touch is outside a widget so releases are not lost. Standard PlatformIO’s C6 board page lists ESP-IDF, so an ordinary classic-ESP32 Arduino environment is not mislabeled as a tested C6 build.

Source review precision: The fixture uses a half-open rectangle and a touch-down edge, then checkpoint2 tests x′=319−y, y′=x for (30,40)→(279,30). It does not sample AXS5106L, initialize JD9853, measure a corner, or establish the installed panel orientation.

Expected result and verification

Holding produces one action; the far edge is excluded.

This is software-only assertion/output evidence; it does not establish physical behavior.

Check the selected source branch and named failure conditions. Record actual build or software output separately from future physical observations.

Likely failures

Pixels work but touch does not: Inspect the touch I²C device/driver separately from LCD SPI. A visible screen does not prove the input path.

Touch reversed or offset: Log raw corner samples, establish orientation and apply one tested transform. Avoid trial-and-error multiple rotations in separate layers.

Cannot build C6 target: Confirm framework support and actual board family. The supplied native test is not an ESP32-C6 executable.

Build evidence, target and remaining verification

Original status: not applicable host model.

No successful build for this stage is recorded in the dated embedded compile ledger.

No compile was attempted in this pass under the user's testing limit. Upload and physical bench observation remain untested.

native@1.2.1 · native C++