MCPcopy Index your code
hub / github.com/FrameworkComputer/inputmodule-rs / pattern

Function pattern

python/inputmodule/inputmodule/ledmatrix.py:373–418  ·  view source on GitHub ↗

Display a pattern that's already programmed into the firmware

(dev, p)

Source from the content-addressed store, hash-verified

371
372
373def pattern(dev, p):
374 """Display a pattern that's already programmed into the firmware"""
375 if p == "All LEDs on":
376 send_command(dev, CommandVals.Pattern, [PatternVals.FullBrightness])
377 elif p == "Gradient (0-13% Brightness)":
378 send_command(dev, CommandVals.Pattern, [PatternVals.Gradient])
379 elif p == "Double Gradient (0-7-0% Brightness)":
380 send_command(dev, CommandVals.Pattern, [PatternVals.DoubleGradient])
381 elif p == '"LOTUS" sideways':
382 send_command(dev, CommandVals.Pattern, [PatternVals.DisplayLotus])
383 elif p == "Zigzag":
384 send_command(dev, CommandVals.Pattern, [PatternVals.ZigZag])
385 elif p == '"PANIC"':
386 send_command(dev, CommandVals.Pattern, [PatternVals.DisplayPanic])
387 elif p == '"LOTUS" Top Down':
388 send_command(dev, CommandVals.Pattern, [PatternVals.DisplayLotus2])
389 elif p == "All brightness levels (1 LED each)":
390 all_brightnesses(dev)
391 elif p == "Every Second Row":
392 every_nth_row(dev, 2)
393 elif p == "Every Third Row":
394 every_nth_row(dev, 3)
395 elif p == "Every Fourth Row":
396 every_nth_row(dev, 4)
397 elif p == "Every Fifth Row":
398 every_nth_row(dev, 5)
399 elif p == "Every Sixth Row":
400 every_nth_row(dev, 6)
401 elif p == "Every Second Col":
402 every_nth_col(dev, 2)
403 elif p == "Every Third Col":
404 every_nth_col(dev, 3)
405 elif p == "Every Fourth Col":
406 every_nth_col(dev, 4)
407 elif p == "Every Fifth Col":
408 every_nth_col(dev, 4)
409 elif p == "Checkerboard":
410 checkerboard(dev, 1)
411 elif p == "Double Checkerboard":
412 checkerboard(dev, 2)
413 elif p == "Triple Checkerboard":
414 checkerboard(dev, 3)
415 elif p == "Quad Checkerboard":
416 checkerboard(dev, 4)
417 else:
418 print("Invalid pattern")
419
420
421def show_string(dev, s):

Callers 2

main_cliFunction · 0.90
run_guiFunction · 0.90

Calls 5

send_commandFunction · 0.90
all_brightnessesFunction · 0.85
every_nth_rowFunction · 0.85
checkerboardFunction · 0.85
every_nth_colFunction · 0.70

Tested by

no test coverage detected