Skip to content

Commit 2126edc

Browse files
committed
fix(vl53l1x): Fix gauge/title draw order and subtitle label in radar_screen.
Address Copilot review comments on #391: 1. Call screen.gauge() before screen.title() so the title text layers on top of the arc, as documented in gauge()'s docstring. 2. Change subtitle from "Distance" to "Proximity" — the gauge shows proximity (inverted distance: arc grows as object gets closer), so labelling it "Distance" was misleading.
1 parent ccdce32 commit 2126edc

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

lib/vl53l1x/examples/radar_screen.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,23 @@ def compute_display(distance):
5252
distance = tof.read()
5353

5454
screen.clear()
55-
screen.title("RADAR")
5655

5756
proximity, color = compute_display(distance)
5857

58+
# Draw gauge first so that title/value text layers on top of the arc
5959
if proximity is None:
6060
screen.gauge(0, min_val=0, max_val=MAX_DISTANCE_MM, color=DARK)
61+
else:
62+
screen.gauge(proximity, min_val=0, max_val=MAX_DISTANCE_MM, color=color)
63+
64+
screen.title("RADAR")
65+
66+
if proximity is None:
6167
screen.value("----", unit="mm")
6268
screen.subtitle("Out of range")
6369
else:
64-
screen.gauge(proximity, min_val=0, max_val=MAX_DISTANCE_MM, color=color)
6570
screen.value(str(distance), unit="mm")
66-
screen.subtitle("Distance")
71+
screen.subtitle("Proximity")
6772

6873
screen.show()
6974
sleep_ms(50)

0 commit comments

Comments
 (0)