Skip to content

Commit d8ef425

Browse files
committed
update for actual build
1 parent e12b023 commit d8ef425

File tree

1 file changed

+9
-3
lines changed
  • CircuitPython_Knob_Sketcher/feather_sketcher

1 file changed

+9
-3
lines changed

CircuitPython_Knob_Sketcher/feather_sketcher/code.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
PEN_DOWN_COLOR = 0x00FF00
2323
KNOB_READS = 10
2424
KNOB_DELAY = 0.001
25+
REVERSE_X = True
26+
REVERSE_Y = True
2527
#--| User Config |---------------------------------------------------
2628

2729
# Feather M4 + 2.4" TFT FeatherWing setup
@@ -94,9 +96,13 @@ def read_knobs(reads, delay):
9496
time.sleep(delay)
9597
avg_x /= reads
9698
avg_y /= reads
97-
xx = map_range(avg_x, 0, 65535, 0, SKETCH_WIDTH - 1)
98-
yy = map_range(avg_y, 0, 65535, 0, SKETCH_HEIGHT - 1)
99-
return int(xx), int(yy)
99+
xx = int(map_range(avg_x, 0, 65535, 0, SKETCH_WIDTH - 1))
100+
yy = int(map_range(avg_y, 0, 65535, 0, SKETCH_HEIGHT - 1))
101+
if REVERSE_X:
102+
xx = SKETCH_WIDTH - xx
103+
if REVERSE_Y:
104+
yy = SKETCH_HEIGHT - yy
105+
return xx, yy
100106

101107
#-------
102108
# MAIN

0 commit comments

Comments
 (0)