Skip to content

RF SquareWave: single scope trace, grid, X/Y axes and scrollable - #2881

Open
vnxdtzip wants to merge 1 commit into
BruceDevices:devfrom
vnxdtzip:ui/rf-squarewave-scope
Open

RF SquareWave: single scope trace, grid, X/Y axes and scrollable#2881
vnxdtzip wants to merge 1 commit into
BruceDevices:devfrom
vnxdtzip:ui/rf-squarewave-scope

Conversation

@vnxdtzip

Copy link
Copy Markdown

Proposed Changes

The SquareWave view never cleared between captures. Each poll appended the new
edges to the right of the last, wrapped to a fresh row when it hit the right
margin (line_h += traceH + 4) and only wiped the band once it had filled the
screen top to bottom. The result was a flood of stacked square-wave rows rather
than a single readable trace, and the only signal you could see was whatever
happened to fit on screen while it was being captured. There was no border-safe
layout, no grid and no axis numbering.

It is now an oscilloscope-style single trace on the shared plot geometry:

  • each capture repaints one trace on a fresh reference grid instead of
    stacking rows, so the "flood" is gone
  • a grid with two logic rails (HIGH/LOW) and vertical time divisions, all in
    theme-derived colours
  • Y numbering (1 / 0 logic levels) in a left gutter and X numbering (elapsed
    time in ms) along the bottom, both clear of the trace
  • the full capture is retained, so the whole signal can be inspected, not just
    the slice that fit while it arrived

The capture is longer than the screen far more often than not, so it is now
scrollable. NextPress / PrevPress pan the visible window from the start of the
capture to the end in quarter-screen steps, the X labels track the visible time
window, and a scrollbar at the top shows where that window sits within the whole
capture (shown only when there is more than one screen of data). NextPress and
PrevPress are the portable navigation events, so this works with the Cardputer
arrow keys, the two-button pads and the rotary encoder without per-device code.
setMHZMenu still opens on the select key, so panning never triggers it, and a
frequency change clears the stale capture.

Types of Changes

Bugfix (the display flooded with stacked rows and could not show a capture wider
than the screen) plus a UI rework: grid, axis numbering and scrolling.

Verification

pio run -e m5stack-cardputer

Flash and open RF -> SquareWave with a CC1101. Transmit a signal on the tuned
frequency. Expect:

  • a single square-wave trace on a grid, HIGH and LOW rails labelled 1 / 0 on
    the left, elapsed time in ms along the bottom - not a screen filling up with
    stacked rows
  • for a capture longer than the screen, a scrollbar at the top, and LEFT/RIGHT
    (Cardputer arrows) panning the trace from the start of the capture to the
    end, with the time labels following the window
  • the select key still opens the frequency menu

Testing

No unit test harness exists for this layer. Compiled clean for m5stack-cardputer.
Not yet verified on hardware by me - a reviewer with a CC1101 should confirm a
known capture pans end to end and that the timing labels read sensibly.

Linked Issues

None. Touches only rf_SquareWave; the other views in the file are unchanged.

User-Facing Change

RF SquareWave now draws a single oscilloscope-style trace with a grid and X/Y axis labels, keeps the whole capture, and lets you scroll left/right through it with the arrow keys (or the equivalent navigation on other devices).

Further Comments

Each pixel is TIME_DIVIDER microseconds, so the scroll step and the ms labels
are both derived from that; nothing is hardcoded to a single screen size.

image

…pture

#### Proposed Changes ####

The SquareWave view never cleared between captures. Each poll appended the new
edges to the right of the last, wrapped to a fresh row when it hit the right
margin (line_h += traceH + 4) and only wiped the band once it had filled the
screen top to bottom. The result was a flood of stacked square-wave rows rather
than a single readable trace, and the only signal you could see was whatever
happened to fit on screen while it was being captured. There was no border-safe
layout, no grid and no axis numbering.

It is now an oscilloscope-style single trace on the shared plot geometry:

  - each capture repaints one trace on a fresh reference grid instead of
    stacking rows, so the "flood" is gone
  - a grid with two logic rails (HIGH/LOW) and vertical time divisions, all in
    theme-derived colours
  - Y numbering (1 / 0 logic levels) in a left gutter and X numbering (elapsed
    time in ms) along the bottom, both clear of the trace
  - the FULL capture is retained, so the whole signal can be inspected, not
    just the slice that fit while it arrived

The capture is longer than the screen far more often than not, so it is now
scrollable. NextPress / PrevPress pan the visible window from the start of the
capture to the end in quarter-screen steps, the X labels track the visible time
window, and a scrollbar at the top shows where that window sits within the whole
capture (shown only when there is more than one screen of data). NextPress and
PrevPress are the portable navigation events, so this works with the Cardputer
arrow keys, the two-button pads and the rotary encoder without per-device code.
setMHZMenu still opens on the select key, so panning never triggers it, and a
frequency change clears the stale capture.

#### Types of Changes ####

Bugfix (the display flooded with stacked rows and could not show a capture wider
than the screen) plus a UI rework: grid, axis numbering and scrolling.

#### Verification ####

Flash and open RF -> SquareWave with a CC1101. Transmit a signal on the tuned
frequency. Expect:

  - a single square-wave trace on a grid, HIGH and LOW rails labelled 1 / 0 on
    the left, elapsed time in ms along the bottom - not a screen filling up with
    stacked rows
  - for a capture longer than the screen, a scrollbar at the top, and LEFT/RIGHT
    (Cardputer arrows) panning the trace from the start of the capture to the
    end, with the time labels following the window
  - the select key still opens the frequency menu

#### Testing ####

No unit test harness exists for this layer. rf_spectrum.cpp compiles clean for
m5stack-cardputer. Not yet verified on hardware by me - a reviewer with a CC1101
should confirm a known capture pans end to end and that the timing labels read
sensibly.

#### Linked Issues ####

None. Touches only rf_SquareWave; the other views in the file are unchanged.

#### User-Facing Change ####
```release-note
RF SquareWave now draws a single oscilloscope-style trace with a grid and X/Y axis labels, keeps the whole capture, and lets you scroll left/right through it with the arrow keys (or the equivalent navigation on other devices).
```

#### Further Comments ####

Each pixel is TIME_DIVIDER microseconds, so the scroll step and the ms labels
are both derived from that; nothing is hardcoded to a single screen size.

Co-authored-by: Vinicius <discoestudio5@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant