RF SquareWave: single scope trace, grid, X/Y axes and scrollable - #2881
Open
vnxdtzip wants to merge 1 commit into
Open
RF SquareWave: single scope trace, grid, X/Y axes and scrollable#2881vnxdtzip wants to merge 1 commit into
vnxdtzip wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
stacking rows, so the "flood" is gone
theme-derived colours
time in ms) along the bottom, both clear of the trace
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:
the left, elapsed time in ms along the bottom - not a screen filling up with
stacked rows
(Cardputer arrows) panning the trace from the start of the capture to the
end, with the time labels following the window
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
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.