53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
"""
|
|
On-device test for Presets.fill_n() using mpremote.
|
|
|
|
Usage (from pico/ dir or project root with adjusted paths):
|
|
|
|
mpremote connect <device> cp src/*.py :
|
|
mpremote connect <device> cp src/patterns/*.py :patterns
|
|
mpremote connect <device> cp lib/*.py :
|
|
mpremote connect <device> cp test/test_fill_n.py :
|
|
mpremote connect <device> run test_fill_n.py
|
|
|
|
This script:
|
|
- Instantiates Presets
|
|
- Calls fill_n() with a simple range
|
|
- Lets you visually confirm that all strips show the same proportional segment
|
|
and that equal-length strip pairs have identical lit indices.
|
|
"""
|
|
|
|
from presets import Presets
|
|
|
|
|
|
def main():
|
|
presets = Presets()
|
|
presets.load()
|
|
|
|
# Choose a simple test range on the reference strip (strip 0).
|
|
ref_len = presets.strip_length(0)
|
|
if ref_len <= 0:
|
|
print("No strips or invalid length; aborting fill_n test.")
|
|
return
|
|
|
|
# Use a central segment so it's easy to see.
|
|
start = ref_len // 4
|
|
end = 3 * ref_len // 4
|
|
print("Running fill_n test from", start, "to", end, "on reference strip 0.")
|
|
|
|
color = (0, 50, 0) # dim green
|
|
|
|
# First, clear everything
|
|
for strip in presets.strips:
|
|
strip.fill((0, 0, 0))
|
|
strip.show()
|
|
|
|
# Apply fill_n, which will use scale() internally.
|
|
presets.fill_n(color, start, end)
|
|
|
|
print("fill_n test applied; visually inspect strips.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|