%D \module %D [ file=s-squid.mkxl, %D version2025.05.20, %D title=\CONTEXT\ Style File, %D subtitle=Squid Colors and Graphics, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \startmodule[squid] \pushoverloadmode \logo [PHILIPS] {Philips} \logo [PHOSCOM] {Phoscom} \logo [HUE] {hue} \logo [DECONZ] {deconz} \logo [CONBEE] {ConBee} \logo [EVOHOME] {EvoHome} \logo [WIFI] {WiFi} \logo [SQUID] {Squid} \logo [QRCODE] {QR\nbsp code} \logo [RASPBERRYPICO] {RPI Pico} \logo [ARDUINO] {Arduino} \popoverloadmode \definepalet [squid] [reset=black, busy=blue, done=yellow, finished=green, % problem=magenta, problem=orange, error=red] \startMPdefinitions vardef signal_led(expr n) = (0,100) rotated - ((n - 1) * (360/24)) enddef ; vardef signal_segment(expr n) = for i = (n - 1) * 3 + 1 upto n * 3 : signal_led(i) && endfor nocycle enddef ; vardef signal_segments(expr n) = for i = 1 upto (n - 1) * 3 + 3 : signal_led(i) && endfor nocycle enddef ; vardef signal_quadrant(expr n) = for i = (n - 1) * 6 + 1 upto n * 6 : signal_led(i) && endfor nocycle enddef ; vardef signal_quadrants(expr n) = for i = 1 upto n * 6 : signal_led(i) && endfor nocycle enddef ; vardef signal_leds = for i = 1 upto 24 : signal_led(i) && endfor nocycle enddef ; vardef signal_range(expr n) = for i = 1 upto n : signal_led(i) && endfor nocycle enddef ; def signal_all_leds = drawdot signal_leds withpen pencircle scaled 20 withcolor .5white ; enddef ; def signal_more_leds(expr n, c) = drawdot signal_range(n) withpen pencircle scaled 20 withcolor c ; enddef ; def signal_one_segment(expr n, c) = drawdot signal_segment(n) withpen pencircle scaled 20 withcolor c ; enddef ; def signal_more_segments(expr n, c) = drawdot signal_segments(n) withpen pencircle scaled 20 withcolor c ; enddef ; def signal_one_quadrant(expr n, c) = drawdot signal_quadrant(n) withpen pencircle scaled 20 withcolor c ; enddef ; def signal_more_quadrants(expr n, c) = drawdot signal_quadrants(n) withpen pencircle scaled 20 withcolor c ; enddef ; def signal_one_led(expr n, c) = drawdot signal_led(n) withpen pencircle scaled 20 withcolor c ; enddef ; def signal_one_thread(expr n, m, c) = drawdot signal_led((n-1)*3+m) withpen pencircle scaled 20 withcolor c ; enddef ; def signal_set_bounds = setbounds currentpicture to fullsquare scaled 200; enddef ; \stopMPdefinitions \startuniqueMPgraphic{signalled}{color} draw image ( drawdot signal_led(1) ) ysized (.6LineHeight) withcolor \MPvar{color} ; \stopuniqueMPgraphic \protected\def\SignalLed#1% {\hpack ymove -.3sd {\uniqueMPgraphic{signalled}{color=#1}}} \protected\def\SignalBusy {\SignalLed{squid:busy}} \protected\def\SignalDone {\SignalLed{squid:done}} \protected\def\SignalFinished{\SignalLed{squid:finished}} \protected\def\SignalProblem {\SignalLed{squid:problem}} \protected\def\SignalError {\SignalLed{squid:error}} \startbuffer[squid-001] \startcombination [nx=4,ny=1] \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(1, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 1 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(1, "squid:done"); signal_one_segment(2, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 2 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(2, "squid:done"); signal_one_segment(3, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 3 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(3, "squid:finished"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption okay \stopcaption \stopcombination \stopbuffer \startbuffer[squid-002] \startcombination [nx=1,ny=1] \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(1, "squid:error"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption error \stopcaption \stopcombination \stopbuffer \startbuffer[squid-003] \startcombination [nx=5,ny=2] \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(1, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 1 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(1, "squid:done"); signal_one_segment(2, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 2 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(2, "squid:done"); signal_one_segment(3, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 3 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(3, "squid:done"); signal_one_segment(4, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 4 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(4, "squid:done"); signal_one_segment(5, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 5 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(5, "squid:done"); signal_one_segment(6, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 6 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(6, "squid:done"); signal_one_segment(7, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 7 \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_segments(7, "squid:done"); signal_one_segment(8, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 8 \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_segments(7, "squid:done"); signal_one_segment(8, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 9 \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_segments(8, "squid:problem"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption problem \stopcaption \stopcombination \stopbuffer \startbuffer[squid-004] \startcombination [nx=5,ny=1] \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(1, "squid:done"); signal_one_thread(1, 1, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption thread 1 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(2, "squid:done"); signal_one_thread(2, 2, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption thread 2 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(3, "squid:done"); signal_one_thread(3, 1, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption thread 3 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(4, "squid:done"); signal_one_thread(4, 3, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption thread 4 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_one_segment(5, "squid:done"); signal_one_thread(5, 3, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption thread 5 \stopcaption \stopcombination \stopbuffer \startbuffer[squid-005] \startcombination [nx=5,ny=1] \startcontent \startMPcode draw image ( signal_all_leds; signal_more_segments(5, "squid:done"); signal_one_thread(1, 1, "squid:busy"); signal_one_thread(2, 2, "squid:busy"); signal_one_thread(3, 1, "squid:busy"); signal_one_thread(4, 3, "squid:busy"); signal_one_thread(5, 3, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption 5 threads \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_segments(8, "squid:done"); signal_one_thread(1, 1, "squid:busy"); signal_one_thread(2, 2, "squid:busy"); signal_one_thread(3, 1, "squid:busy"); signal_one_thread(4, 3, "squid:busy"); signal_one_thread(5, 3, "squid:busy"); signal_one_thread(6, 1, "squid:busy"); signal_one_thread(7, 2, "squid:busy"); signal_one_thread(8, 2, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption 8 threads \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_segments(8, red); signal_one_thread(1, 1, "squid:busy"); signal_one_thread(2, 2, "squid:busy"); signal_one_thread(3, 1, "squid:busy"); signal_one_thread(4, 3, "squid:busy"); signal_one_thread(5, 3, "squid:busy"); signal_one_thread(6, 1, "squid:busy"); signal_one_thread(7, 2, "squid:busy"); signal_one_thread(8, 2, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption issues \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_segments(8, "squid:finished"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption okay \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_segments(8, "squid:error"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption errors \stopcaption \stopcombination \stopbuffer \startbuffer[squid-006] \startcombination [nx=5,ny=1] \startcontent \startMPcode draw image ( signal_all_leds; signal_more_leds(6, "squid:done"); signal_one_led(7, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption page 7 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_leds(16, "squid:done"); signal_one_led(17, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption page 17 \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_leds(24, "squid:done"); signal_one_led(13, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption page 37 \stopcaption \startcontent \startMPcode draw image ( % signal_all_leds; signal_more_leds(24, "squid:finished"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption okay \stopcaption \stopcombination \stopbuffer \startbuffer[squid-007] \startcombination [nx=5,ny=1] \startcontent \startMPcode draw image ( signal_all_leds; signal_one_quadrant(1, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 1 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_one_quadrant(1, "squid:done"); signal_one_quadrant(2, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 2 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_quadrants(2, "squid:done"); signal_one_quadrant(3, "squid:busy"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption run 3 \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_quadrants(3, "squid:finished"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption okay \stopcaption \startcontent \startMPcode draw image ( signal_all_leds; signal_more_quadrants(3, "squid:error"); ) ysized 20mm ; \stopMPcode \stopcontent \startcaption error \stopcaption \stopcombination \stopbuffer \stopmodule