diff --git a/.gitignore b/.gitignore index cfca2eb..c83fb2b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ secrets.h arduino/MQTT/secret.h arduino/MQTT/secrets.h venv -rule-listener/secrets.py \ No newline at end of file +rule-listener/secrets.py +visualiser/secrets.el \ No newline at end of file diff --git a/README.md b/README.md index dfb3237..bb9847b 100644 --- a/README.md +++ b/README.md @@ -6,30 +6,13 @@ date: Tuesday, October 22, 2024 # Listening Daemon -Current structure of the repository +Communication between things in this room goes via a server running a +Message Queuing Telemetry Transport (MQTT) broker. MQTT is a protocol +for communication in which participants publish and subscribe to +so-called topics. The broker acts a centralised point of exchange in +this process, ensuring messages reach their intended targets. -``` -. -├── arduino -│ ├── motor_shield_one -│ │ ├── makefile -│ │ └── motor_shield_one.ino -│ ├── motor_shield_two -│ │ ├── makefile -│ │ └── motor_shield_two.ino -│ ├── relay_shield -│ │ ├── makefile -│ │ └── relay_shield.ino -│ └── sensors -│ ├── makefile -│ └── sensors.ino -└── tidal - ├── boot - └── compositions -``` - -The `arduino` directory contains code for each microcontroller. - - -The `tidal` directory features a combination of boot files and -compositions. +The server is also hosting the webpage displayed on the screen. The +server is the Klankschool server. Klankschool are a growing community +of people working with sound in and around Rotterdam, which both of us +are part of. \ No newline at end of file diff --git a/arduino/motor_shield_two/makefile b/arduino/motor_shield_two/makefile deleted file mode 100644 index e69de29..0000000 diff --git a/arduino/motor_shield_two/motor_shield_two.ino b/arduino/motor_shield_two/motor_shield_two.ino deleted file mode 100644 index e69de29..0000000 diff --git a/arduino/relay_shield/makefile b/arduino/relay_shield/makefile deleted file mode 100644 index e69de29..0000000 diff --git a/arduino/relay_shield/relay_shield.ino b/arduino/relay_shield/relay_shield.ino deleted file mode 100644 index e69de29..0000000 diff --git a/arduino/sensors/makefile b/arduino/sensors/makefile deleted file mode 100644 index e69de29..0000000 diff --git a/arduino/sensors/sensors.ino b/arduino/sensors/sensors.ino deleted file mode 100644 index e69de29..0000000 diff --git a/graphviz/map_1.dot b/graphviz/map_1.dot deleted file mode 100644 index 57df8ec..0000000 --- a/graphviz/map_1.dot +++ /dev/null @@ -1,121 +0,0 @@ -digraph map { - graph [fontname = "Cantarell-VF"]; - node [fontname = "Cantarell-VF", fontsize="18"]; - edge [fontname = "Cantarell"] - - "door two" [style=filled, fillcolor=brown] - "door one" [style=filled, fillcolor=brown] - - "magnet one" [style=filled, fillcolor=yellow] - "magnet two" [style=filled, fillcolor=yellow] - "ldr one" [style=filled, fillcolor=yellow] - "ldr two" [style=filled, fillcolor=yellow] - "ldr three" [style=filled, fillcolor=yellow] - - "piezo one" [style=filled, fillcolor=yellow] - "piezo two" [style=filled, fillcolor=yellow] - "piezo three" [style=filled, fillcolor=yellow] - - "printer one" [style=filled, fillcolor=magenta] - "printer two" [style=filled, fillcolor=magenta] - "printer three" [style=filled, fillcolor=magenta] - - "lamp one" [style=filled, fillcolor=tomato] - "lamp two" [style=filled, fillcolor=tomato] - "lamp three" [style=filled, fillcolor=tomato] - - "ventilator one" [style=filled, fillcolor=tomato] - "ventilator two" [style=filled, fillcolor=tomato] - "ventilator three" [style=filled, fillcolor=tomato] - - "motor shield one" [style=filled, fillcolor=gray] - "motor shield two" [style=filled, fillcolor=gray] - "relay shield" [style=filled,fillcolor=gray] - - subgraph tidal_ports { - 8001 [style=filled, fillcolor=cyan] - 8002 [style=filled, fillcolor=cyan] - 8003 [style=filled, fillcolor=cyan] - 8004 [style=filled, fillcolor=cyan] - 8005 [style=filled, fillcolor=cyan] - 8006 [style=filled, fillcolor=cyan] - 8007 [style=filled, fillcolor=cyan] - 8008 [style=filled, fillcolor=cyan] - 8009 [style=filled, fillcolor=cyan] - 8010 [style=filled, fillcolor=cyan] - 8011 [style=filled, fillcolor=cyan] - 8012 [style=filled, fillcolor=cyan] - 8013 [style=filled, fillcolor=cyan] - 8014 [style=filled, fillcolor=cyan] - 8015 [style=filled, fillcolor=cyan] - 8016 [style=filled, fillcolor=cyan] - } - - subgraph relay { - "relay shield" -> {"lamp one" "lamp two" "lamp three" "ventilator one" "ventilator two" "ventilator three" } - } - - subgraph ports { - 8005 -> "printer one" [label="slow(er)",color=orange] - 8006 -> "printer one" [label="fast(er)",color=orange] - 8007 -> "printer two" [label="slow(er)",color=orange] - 8008 -> "printer two" [label="fast(er)",color=orange] - 8009 -> "printer three" [label="slow(er)",color=orange] - 8010 -> "printer three" [label="fast(er)",color=orange] - 8011 -> "printer one" [label="go", color=orange] - 8012 -> "printer one" [label="stop",color=orange] - 8013 -> "printer two" [label="go", color=orange] - 8014 -> "printer two" [label="stop",color=orange] - 8015 -> "printer three"[label="go", color=orange] - 8016 -> "printer three" [label="stop",color=orange] - - } - - subgraph fans { - "ventilator one" -> "piezo one" - "ventilator two" -> "piezo two" - "ventilator three" -> "piezo three" - - } - - subgraph motor_shields { - "motor shield one" -> "printer one" - "motor shield two" -> {"printer two" "printer three"} - } - - subgraph sensors { - //"esp32 one" -> {"magnet one" "magnet two" "ldr one" "ldr two"} - "magnet one" -> 8001 [color=red,label="off"] - "magnet one" -> 8002 [color=green,label="on"] - "magnet two" -> 8003 [color=red,label="off"] - "magnet two" -> 8004 [color=green,label="on"] - "ldr one" -> 8005 [color=red,label="off"] - "ldr one" -> 8006 [color=green,label="on"] - "ldr two" -> 8007 [color=red,label="off"] - "ldr two" -> 8008 [color=green,label="on"] - "ldr three" -> 8015 [color=red,label="off"] - "ldr three" -> 8016 [color=green,label="on"] - "piezo one" -> 8009 [label="low",color="green"] - "piezo one" -> 8010 [label="high",color="red"] - "piezo two" -> 8011 [label="low",color="green"] - "piezo two" -> 8012 [label="high",color="red"] - "piezo three" -> 8013 [label="high",color="red"] - "piezo three" -> 8014 [label="low",color="green"] - } - - subgraph lamps { - "lamp one" -> "ldr one" - "lamp two" -> "ldr two" - "lamp three" -> "ldr three" - 8001 -> "lamp one" [color=red,label="off"] - 8002 -> "lamp one" [color=green,label="on"] - 8003 -> "lamp two" [color=red,label="off"] - 8004 -> "lamp two" [color=green,label="on"] - - } - subgraph doors { - "door one" -> "magnet one" - "door two" -> "magnet two" - } - -} diff --git a/graphviz/map_1.png b/graphviz/map_1.png deleted file mode 100644 index 589dc64..0000000 Binary files a/graphviz/map_1.png and /dev/null differ diff --git a/tidal/boot/2024-10-22.hs b/tidal/boot/2024-10-22.hs deleted file mode 100644 index 62d23a5..0000000 --- a/tidal/boot/2024-10-22.hs +++ /dev/null @@ -1,173 +0,0 @@ -:set -XOverloadedStrings -:set prompt "" - -import Sound.Tidal.Context - -import System.IO (hSetEncoding, stdout, utf8) - -hSetEncoding stdout utf8 - -listenPortOne = 8001 -listenPortTwo = 8002 -listenPortThree = 8003 -listenPortFour = 8004 -listenPortFive = 8005 -listenPortSix = 8006 -listenPortSeven = 8007 -listenPortEight = 8008 -listenPortNine = 8009 -listenPortTen = 8010 -listenPortEleven = 8011 -listenPortTwelve = 8012 -listenPortThriteen = 8013 -listenPortFourteen = 8014 -listenPortFifteen = 8015 -listenPortSixteen = 8016 -listenPortSeventeen = 8017 -listenPortEighteen = 8018 -listenPortNineteen = 8019 -listenPortTwenty = 8020 -listenPortTwentyOne = 8021 -listenPortTwentyTwo = 8022 -listenPortTwentyThree = 8023 -listenPortTwentyFour = 8024 -listenPortTwentyFive = 8025 -listenPortTwentySix = 8026 -listenPortTwentySeven = 8027 -listenPortTwentyEight = 8028 -listenPortTwentyNine = 8029 -listenPortThirty = 8030 -listenPortThirtyOne = 8031 -listenPortThirtyTwo = 8032 - -:{ - let lolinTarget = - Target {oName = "lolin", - oAddress = "192.168.1.110", - oPort = 7000, - oLatency = 0.15, - oSchedule = Live, - oWindow = Nothing, - oHandshake = False, - oBusPort = Nothing - } - - lolinLedAnalog = [("intensity", Just $ VF 0)] - lolinLedDigital = [("blink", Just $ VS "off")] - - lolinFormats = [(OSC "/led/analog" $ ArgList lolinLedAnalog), - (OSC "/led/digital" $ ArgList lolinLedDigital) - ] - lolinMap = [(lolinTarget, lolinFormats)] -:} - -lolinStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6010}) lolinMap - -h1 = streamReplace lolinStream 1 - -:{ - let devkitTarget = - Target {oName = "devkit", - oAddress = "192.168.1.111", - oPort = 7000, - oLatency = 0.15, - oSchedule = Live, - oWindow = Nothing, - oHandshake = False, - oBusPort = Nothing - } - - devkitLedAnalog = [("intensity", Just $ VF 0)] - devkitLedDigital = [("blink", Just $ VS "off")] - - devkitFormats = [(OSC "/led/analog" $ ArgList devkitLedAnalog), - (OSC "/led/digital" $ ArgList devkitLedDigital) - ] - devkitMap = [(devkitTarget, devkitFormats)] -:} - -devkitStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6020}) devkitMap - -h2 = streamReplace devkitStream 1 - - -:{ - let intensity = pF "intensity" - blink = pS "blink" -:} - - -tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20, cCtrlAddr = "0.0.0.0", cCtrlPort = 6030}) - -:{ -let only = (hush >>) - p = streamReplace tidal - hush = streamHush tidal - panic = do hush - once $ sound "superpanic" - list = streamList tidal - mute = streamMute tidal - unmute = streamUnmute tidal - unmuteAll = streamUnmuteAll tidal - unsoloAll = streamUnsoloAll tidal - solo = streamSolo tidal - unsolo = streamUnsolo tidal - once = streamOnce tidal - first = streamFirst tidal - asap = once - nudgeAll = streamNudgeAll tidal - all = streamAll tidal - resetCycles = streamResetCycles tidal - setCycle = streamSetCycle tidal - setcps = asap . cps - getcps = streamGetcps tidal - getnow = streamGetnow tidal - xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i - xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i - histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i - wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i - waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i - jump i = transition tidal True (Sound.Tidal.Transition.jump) i - jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i - jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i - jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i - jumpMod' i t p = transition tidal True (Sound.Tidal.Transition.jumpMod' t p) i - mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i - interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i - interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i - clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i - clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i - anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i - anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i - forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i - d1 = p 1 . (|< orbit 0) - d2 = p 2 . (|< orbit 1) - d3 = p 3 . (|< orbit 2) - d4 = p 4 . (|< orbit 3) - d5 = p 5 . (|< orbit 4) - d6 = p 6 . (|< orbit 5) - d7 = p 7 . (|< orbit 6) - d8 = p 8 . (|< orbit 7) - d9 = p 9 . (|< orbit 8) - d10 = p 10 . (|< orbit 9) - d11 = p 11 . (|< orbit 10) - d12 = p 12 . (|< orbit 11) - d13 = p 13 - d14 = p 14 - d15 = p 15 - d16 = p 16 -:} - -:{ -let getState = streamGet tidal - setI = streamSetI tidal - setF = streamSetF tidal - setS = streamSetS tidal - setR = streamSetR tidal - setB = streamSetB tidal -:} - -:set prompt "> " -:set prompt-cont "" - -default (Pattern String, Integer, Double) diff --git a/tidal/boot/MotorShieldOne.hs b/tidal/boot/MotorShieldOne.hs deleted file mode 100644 index 03ca8f6..0000000 --- a/tidal/boot/MotorShieldOne.hs +++ /dev/null @@ -1,217 +0,0 @@ -:set -XOverloadedStrings -:set prompt "" - -import Sound.Tidal.Context - -import System.IO (hSetEncoding, stdout, utf8) - -hSetEncoding stdout utf8 - -listenPortOne = 8001 -listenPortTwo = 8002 -listenPortThree = 8003 -listenPortFour = 8004 -listenPortFive = 8005 -listenPortSix = 8006 -listenPortSeven = 8007 -listenPortEight = 8008 -listenPortNine = 8009 -listenPortTen = 8010 -listenPortEleven = 8011 -listenPortTwelve = 8012 -listenPortThriteen = 8013 -listenPortFourteen = 8014 -listenPortFifteen = 8015 -listenPortSixteen = 8016 -listenPortSeventeen = 8017 -listenPortEighteen = 8018 -listenPortNineteen = 8019 -listenPortTwenty = 8020 -listenPortTwentyOne = 8021 -listenPortTwentyTwo = 8022 -listenPortTwentyThree = 8023 -listenPortTwentyFour = 8024 -listenPortTwentyFive = 8025 -listenPortTwentySix = 8026 -listenPortTwentySeven = 8027 -listenPortTwentyEight = 8028 -listenPortTwentyNine = 8029 -listenPortThirty = 8030 -listenPortThirtyOne = 8031 -listenPortThirtyTwo = 8032 - -:{ - let lolinTarget = - Target {oName = "lolin", - oAddress = "192.168.1.110", - oPort = 7000, - oLatency = 0.15, - oSchedule = Live, - oWindow = Nothing, - oHandshake = False, - oBusPort = Nothing - } - - lolinLedAnalog = [("intensity", Just $ VF 0)] - lolinLedDigital = [("blink", Just $ VS "off")] - - lolinFormats = [(OSC "/led/analog" $ ArgList lolinLedAnalog), - (OSC "/led/digital" $ ArgList lolinLedDigital) - ] - lolinMap = [(lolinTarget, lolinFormats)] -:} - -lolinStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6010}) lolinMap - -h1 = streamReplace lolinStream 1 - -:{ - let devkitTarget = - Target {oName = "devkit", - oAddress = "192.168.1.111", - oPort = 7000, - oLatency = 0.15, - oSchedule = Live, - oWindow = Nothing, - oHandshake = False, - oBusPort = Nothing - } - - devkitLedAnalog = [("intensity", Just $ VF 0)] - devkitLedDigital = [("blink", Just $ VS "off")] - - devkitFormats = [(OSC "/led/analog" $ ArgList devkitLedAnalog), - (OSC "/led/digital" $ ArgList devkitLedDigital) - ] - devkitMap = [(devkitTarget, devkitFormats)] -:} - -devkitStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6020}) devkitMap - -h2 = streamReplace devkitStream 1 - - -:{ - let intensity = pF "intensity" - blink = pS "blink" -:} - - -:{ - let motorShieldOneTarget = - Target {oName = "motorShieldOne", - oAddress = "192.168.1.100", - oPort = 7000, - oLatency = 0.15, - oSchedule = Live, - oWindow = Nothing, - oHandshake = False, - oBusPort = Nothing - } - - motorShieldOneSpeed = [("speed", Just $ VI 150)] - motorShieldOneDirection = [("direction", Just $ VS "r")] - - motorShieldOneFeedFormats = [(OSC "/feed/direction" $ ArgList motorShieldOneDirection), - (OSC "/feed/speed" $ ArgList motorShieldOneSpeed) - ] - - motorShieldOneHeadFormats = [(OSC "/head/speed" $ ArgList motorShieldOneSpeed), - (OSC "/head/direction" $ ArgList motorShieldOneDirection) - ] - - motorShieldOneFeedMap = [(motorShieldOneTarget, motorShieldOneFeedFormats)] - motorShieldOneHeadMap = [(motorShieldOneTarget, motorShieldOneHeadFormats)] -:} - -motorShieldOneFeedStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6040}) motorShieldOneFeedMap - -m1f = streamReplace motorShieldOneFeedStream - -motorShieldOneHeadStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6040}) motorShieldOneHeadMap - -m1h = streamReplace motorShieldOneHeadStream - -m1 = m1f 1 -m2 = m1h 1 - -:{ - let speed = pI "speed" - direction = pS "direction" -:} - - -tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20, cCtrlAddr = "0.0.0.0", cCtrlPort = 6030}) - -:{ -let only = (hush >>) - p = streamReplace tidal - hush = streamHush tidal - panic = do hush - once $ sound "superpanic" - list = streamList tidal - mute = streamMute tidal - unmute = streamUnmute tidal - unmuteAll = streamUnmuteAll tidal - unsoloAll = streamUnsoloAll tidal - solo = streamSolo tidal - unsolo = streamUnsolo tidal - once = streamOnce tidal - first = streamFirst tidal - asap = once - nudgeAll = streamNudgeAll tidal - all = streamAll tidal - resetCycles = streamResetCycles tidal - setCycle = streamSetCycle tidal - setcps = asap . cps - getcps = streamGetcps tidal - getnow = streamGetnow tidal - xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i - xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i - histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i - wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i - waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i - jump i = transition tidal True (Sound.Tidal.Transition.jump) i - jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i - jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i - jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i - jumpMod' i t p = transition tidal True (Sound.Tidal.Transition.jumpMod' t p) i - mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i - interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i - interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i - clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i - clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i - anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i - anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i - forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i - d1 = p 1 . (|< orbit 0) - d2 = p 2 . (|< orbit 1) - d3 = p 3 . (|< orbit 2) - d4 = p 4 . (|< orbit 3) - d5 = p 5 . (|< orbit 4) - d6 = p 6 . (|< orbit 5) - d7 = p 7 . (|< orbit 6) - d8 = p 8 . (|< orbit 7) - d9 = p 9 . (|< orbit 8) - d10 = p 10 . (|< orbit 9) - d11 = p 11 . (|< orbit 10) - d12 = p 12 . (|< orbit 11) - d13 = p 13 - d14 = p 14 - d15 = p 15 - d16 = p 16 -:} - -:{ -let getState = streamGet tidal - setI = streamSetI tidal - setF = streamSetF tidal - setS = streamSetS tidal - setR = streamSetR tidal - setB = streamSetB tidal -:} - -:set prompt "> " -:set prompt-cont "" - -default (Pattern String, Integer, Double) diff --git a/tidal/compositions/2024-10-22.tidal b/tidal/compositions/2024-10-22.tidal deleted file mode 100644 index b3edb2d..0000000 --- a/tidal/compositions/2024-10-22.tidal +++ /dev/null @@ -1,80 +0,0 @@ --- (setq tidal-boot-script-path "~/.config/tidal/LolinAndDevkit.hs") --- (setq tidal-boot-script-path "~/.config/tidal/example_1.hs") - - - -p1 $ blink "off" - -p2 $ blink "off" - -import Data.Maybe - -import Sound.Osc.Fd as O - -import Control.Concurrent - -actOne :: Udp -> Maybe O.Message -> IO () -actOne _ _ = do - h1 $ slow 8 $ blink "on" - -- d1 $ fast 4 $ sound "sn" # pan (range 0 1 square) - -actTwo :: Udp -> Maybe O.Message -> IO () -actTwo _ _ = do - h1 $ slow 4 $ blink "off" - -listenOne :: IO () -listenOne = do udp <- udpServer "0.0.0.0" listenPortOne - loop udp - where - loop udp = - do m <- recvMessage udp - actOne udp m - loop udp - -listenTwo :: IO () -listenTwo = do udp <- udpServer "0.0.0.0" listenPortTwo - loop udp - where - loop udp = - do m <- recvMessage udp - actTwo udp m - loop udp - - -actThree :: Udp -> Maybe O.Message -> IO () -actThree _ _ = do - h2 $ slow 8 $ blink "off" - -- d1 $ fast 4 $ sound "sn" # pan (range 0 1 square) - -actFour :: Udp -> Maybe O.Message -> IO () -actFour _ _ = do - h2 $ slow 4 $ blink "on" - -listenThree :: IO () -listenThree = do udp <- udpServer "0.0.0.0" listenPortThree - loop udp - where - loop udp = - do m <- recvMessage udp - actOne udp m - loop udp - -listenFour :: IO () -listenFour = do udp <- udpServer "0.0.0.0" listenPortFour - loop udp - where - loop udp = - do m <- recvMessage udp - actTwo udp m - loop udp - - -office = do - forkIO listenOne - forkIO listenTwo - forkIO listenThree - forkIO listenFour - -office - - diff --git a/tidal/compositions/motor-shield-one.tidal b/tidal/compositions/motor-shield-one.tidal deleted file mode 100644 index 6400267..0000000 --- a/tidal/compositions/motor-shield-one.tidal +++ /dev/null @@ -1,7 +0,0 @@ -(setq tidal-boot-script-path "~/.config/tidal/MotorShieldOne.hs") - -m1 $ slow 6 $ speed 125 # direction "f b f b" - -m2 $ slow 4 $ speed 150 # direction "f b r f b r" - - hush diff --git a/visualiser/graphs/graph10000.dot b/visualiser/graphs/graph10000.dot new file mode 100644 index 0000000..4601a71 --- /dev/null +++ b/visualiser/graphs/graph10000.dot @@ -0,0 +1,37 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=invis,label="",color=invis] + fan_two [shape=circle, style=filled, fillcolor=invis,label="",color=invis] + radio_one [shape=invtrapezium,style=filled,fillcolor=invis,label="",color=invis] + lamp_one [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + lamp_two [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + printer_one [shape=box,style=filled,fillcolor=invis,label="",color=invis] + printer_two [shape=box,style=filled,fillcolor=invis,label="",color=invis] + + fan_one -- fan_two [color=invis] + fan_one -- radio_one [color=invis] + fan_one -- lamp_one [color=invis] + fan_one -- lamp_two [color=invis] + fan_one -- printer_one [color=invis] + fan_one -- printer_two [color=invis] + + fan_two -- radio_one [color=invis] + fan_two -- lamp_one [color=invis] + fan_two -- lamp_two [color=invis] + fan_two -- printer_one [color=invis] + fan_two -- printer_two [color=invis] + + radio_one -- lamp_one [color=invis] + radio_one -- lamp_two [color=invis] + radio_one -- printer_one [color=invis] + radio_one -- printer_two [color=invis] + + lamp_one -- lamp_two [color=invis] + lamp_one -- printer_one [color=invis] + lamp_one -- printer_two [color=invis] + + lamp_two -- printer_one [color=invis] + lamp_two -- printer_two [color=invis] + + printer_one -- printer_two [color=invis] +# 63 "/root/Applications/listeningdaemon/visualiser/main.dot" +} diff --git a/visualiser/graphs/graph10001.dot b/visualiser/graphs/graph10001.dot new file mode 100644 index 0000000..1f87e09 --- /dev/null +++ b/visualiser/graphs/graph10001.dot @@ -0,0 +1,37 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=green,label="",color=green] + fan_two [shape=circle, style=filled, fillcolor=invis,label="",color=invis] + radio_one [shape=invtrapezium,style=filled,fillcolor=invis,label="",color=invis] + lamp_one [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + lamp_two [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + printer_one [shape=box,style=filled,fillcolor=invis,label="",color=invis] + printer_two [shape=box,style=filled,fillcolor=invis,label="",color=invis] + + fan_one -- fan_two [color=invis] + fan_one -- radio_one [color=invis] + fan_one -- lamp_one [color=invis] + fan_one -- lamp_two [color=invis] + fan_one -- printer_one [color=invis] + fan_one -- printer_two [color=invis] + + fan_two -- radio_one [color=invis] + fan_two -- lamp_one [color=invis] + fan_two -- lamp_two [color=invis] + fan_two -- printer_one [color=invis] + fan_two -- printer_two [color=invis] + + radio_one -- lamp_one [color=invis] + radio_one -- lamp_two [color=invis] + radio_one -- printer_one [color=invis] + radio_one -- printer_two [color=invis] + + lamp_one -- lamp_two [color=invis] + lamp_one -- printer_one [color=invis] + lamp_one -- printer_two [color=invis] + + lamp_two -- printer_one [color=invis] + lamp_two -- printer_two [color=invis] + + printer_one -- printer_two [color=invis] +# 63 "/root/Applications/listeningdaemon/visualiser/main.dot" +} diff --git a/visualiser/graphs/graph10002.dot b/visualiser/graphs/graph10002.dot new file mode 100644 index 0000000..410f6f3 --- /dev/null +++ b/visualiser/graphs/graph10002.dot @@ -0,0 +1,37 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=green,label="",color=green] + fan_two [shape=circle, style=filled, fillcolor=blue,label="",color=blue] + radio_one [shape=invtrapezium,style=filled,fillcolor=invis,label="",color=invis] + lamp_one [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + lamp_two [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + printer_one [shape=box,style=filled,fillcolor=invis,label="",color=invis] + printer_two [shape=box,style=filled,fillcolor=invis,label="",color=invis] + + fan_one -- fan_two [color=invis] + fan_one -- radio_one [color=invis] + fan_one -- lamp_one [color=invis] + fan_one -- lamp_two [color=invis] + fan_one -- printer_one [color=invis] + fan_one -- printer_two [color=invis] + + fan_two -- radio_one [color=invis] + fan_two -- lamp_one [color=invis] + fan_two -- lamp_two [color=invis] + fan_two -- printer_one [color=invis] + fan_two -- printer_two [color=invis] + + radio_one -- lamp_one [color=invis] + radio_one -- lamp_two [color=invis] + radio_one -- printer_one [color=invis] + radio_one -- printer_two [color=invis] + + lamp_one -- lamp_two [color=invis] + lamp_one -- printer_one [color=invis] + lamp_one -- printer_two [color=invis] + + lamp_two -- printer_one [color=invis] + lamp_two -- printer_two [color=invis] + + printer_one -- printer_two [color=invis] +# 63 "/root/Applications/listeningdaemon/visualiser/main.dot" +} diff --git a/visualiser/graphs/graph10003.dot b/visualiser/graphs/graph10003.dot new file mode 100644 index 0000000..10f0864 --- /dev/null +++ b/visualiser/graphs/graph10003.dot @@ -0,0 +1,37 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=green,label="",color=green] + fan_two [shape=circle, style=filled, fillcolor=blue,label="",color=blue] + radio_one [shape=invtrapezium,style=filled,fillcolor=invis,label="",color=invis] + lamp_one [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + lamp_two [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + printer_one [shape=box,style=filled,fillcolor=yellow,label="",color=yellow] + printer_two [shape=box,style=filled,fillcolor=invis,label="",color=invis] + + fan_one -- fan_two [color=invis] + fan_one -- radio_one [color=invis] + fan_one -- lamp_one [color=invis] + fan_one -- lamp_two [color=invis] + fan_one -- printer_one [color=invis] + fan_one -- printer_two [color=invis] + + fan_two -- radio_one [color=invis] + fan_two -- lamp_one [color=invis] + fan_two -- lamp_two [color=invis] + fan_two -- printer_one [color=invis] + fan_two -- printer_two [color=invis] + + radio_one -- lamp_one [color=invis] + radio_one -- lamp_two [color=invis] + radio_one -- printer_one [color=invis] + radio_one -- printer_two [color=invis] + + lamp_one -- lamp_two [color=invis] + lamp_one -- printer_one [color=invis] + lamp_one -- printer_two [color=invis] + + lamp_two -- printer_one [color=invis] + lamp_two -- printer_two [color=invis] + + printer_one -- printer_two [color=invis] +# 63 "/root/Applications/listeningdaemon/visualiser/main.dot" +} diff --git a/visualiser/graphs/graph10004.dot b/visualiser/graphs/graph10004.dot new file mode 100644 index 0000000..5c8d303 --- /dev/null +++ b/visualiser/graphs/graph10004.dot @@ -0,0 +1,37 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=green,label="",color=green] + fan_two [shape=circle, style=filled, fillcolor=blue,label="",color=blue] + radio_one [shape=invtrapezium,style=filled,fillcolor=invis,label="",color=invis] + lamp_one [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + lamp_two [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + printer_one [shape=box,style=filled,fillcolor=yellow,label="",color=yellow] + printer_two [shape=box,style=filled,fillcolor=invis,label="",color=invis] + + fan_one -- fan_two [color=green] + fan_one -- radio_one [color=invis] + fan_one -- lamp_one [color=invis] + fan_one -- lamp_two [color=invis] + fan_one -- printer_one [color=invis] + fan_one -- printer_two [color=invis] + + fan_two -- radio_one [color=invis] + fan_two -- lamp_one [color=invis] + fan_two -- lamp_two [color=invis] + fan_two -- printer_one [color=invis] + fan_two -- printer_two [color=invis] + + radio_one -- lamp_one [color=invis] + radio_one -- lamp_two [color=invis] + radio_one -- printer_one [color=invis] + radio_one -- printer_two [color=invis] + + lamp_one -- lamp_two [color=invis] + lamp_one -- printer_one [color=invis] + lamp_one -- printer_two [color=invis] + + lamp_two -- printer_one [color=invis] + lamp_two -- printer_two [color=invis] + + printer_one -- printer_two [color=invis] +# 63 "/root/Applications/listeningdaemon/visualiser/main.dot" +} diff --git a/visualiser/graphs/graph10005.dot b/visualiser/graphs/graph10005.dot new file mode 100644 index 0000000..10f0864 --- /dev/null +++ b/visualiser/graphs/graph10005.dot @@ -0,0 +1,37 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=green,label="",color=green] + fan_two [shape=circle, style=filled, fillcolor=blue,label="",color=blue] + radio_one [shape=invtrapezium,style=filled,fillcolor=invis,label="",color=invis] + lamp_one [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + lamp_two [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + printer_one [shape=box,style=filled,fillcolor=yellow,label="",color=yellow] + printer_two [shape=box,style=filled,fillcolor=invis,label="",color=invis] + + fan_one -- fan_two [color=invis] + fan_one -- radio_one [color=invis] + fan_one -- lamp_one [color=invis] + fan_one -- lamp_two [color=invis] + fan_one -- printer_one [color=invis] + fan_one -- printer_two [color=invis] + + fan_two -- radio_one [color=invis] + fan_two -- lamp_one [color=invis] + fan_two -- lamp_two [color=invis] + fan_two -- printer_one [color=invis] + fan_two -- printer_two [color=invis] + + radio_one -- lamp_one [color=invis] + radio_one -- lamp_two [color=invis] + radio_one -- printer_one [color=invis] + radio_one -- printer_two [color=invis] + + lamp_one -- lamp_two [color=invis] + lamp_one -- printer_one [color=invis] + lamp_one -- printer_two [color=invis] + + lamp_two -- printer_one [color=invis] + lamp_two -- printer_two [color=invis] + + printer_one -- printer_two [color=invis] +# 63 "/root/Applications/listeningdaemon/visualiser/main.dot" +} diff --git a/visualiser/graphs/graph10006.dot b/visualiser/graphs/graph10006.dot new file mode 100644 index 0000000..48637e3 --- /dev/null +++ b/visualiser/graphs/graph10006.dot @@ -0,0 +1,37 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=green,label="",color=green] + fan_two [shape=circle, style=filled, fillcolor=blue,label="",color=blue] + radio_one [shape=invtrapezium,style=filled,fillcolor=invis,label="",color=invis] + lamp_one [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + lamp_two [shape=cylinder,style=filled,fillcolor=invis,label="",color=invis] + printer_one [shape=box,style=filled,fillcolor=yellow,label="",color=yellow] + printer_two [shape=box,style=filled,fillcolor=invis,label="",color=invis] + + fan_one -- fan_two [color=magenta] + fan_one -- radio_one [color=invis] + fan_one -- lamp_one [color=invis] + fan_one -- lamp_two [color=invis] + fan_one -- printer_one [color=invis] + fan_one -- printer_two [color=invis] + + fan_two -- radio_one [color=invis] + fan_two -- lamp_one [color=invis] + fan_two -- lamp_two [color=invis] + fan_two -- printer_one [color=invis] + fan_two -- printer_two [color=invis] + + radio_one -- lamp_one [color=invis] + radio_one -- lamp_two [color=invis] + radio_one -- printer_one [color=invis] + radio_one -- printer_two [color=invis] + + lamp_one -- lamp_two [color=invis] + lamp_one -- printer_one [color=invis] + lamp_one -- printer_two [color=invis] + + lamp_two -- printer_one [color=invis] + lamp_two -- printer_two [color=invis] + + printer_one -- printer_two [color=invis] +# 63 "/root/Applications/listeningdaemon/visualiser/main.dot" +} diff --git a/visualiser/main.dot b/visualiser/main.dot new file mode 100644 index 0000000..68f26fa --- /dev/null +++ b/visualiser/main.dot @@ -0,0 +1,63 @@ +graph { + fan_one [shape=circle, style=filled, fillcolor=FAN_ONE,label="",color=FAN_ONE] + fan_two [shape=circle, style=filled, fillcolor=FAN_TWO,label="",color=FAN_TWO] + radio_one [shape=invtrapezium,style=filled,fillcolor=RADIO_ONE,label="",color=RADIO_ONE] + lamp_one [shape=cylinder,style=filled,fillcolor=LAMP_ONE,label="",color=LAMP_ONE] + lamp_two [shape=cylinder,style=filled,fillcolor=LAMP_TWO,label="",color=LAMP_TWO] + printer_one [shape=box,style=filled,fillcolor=PRINTER_ONE,label="",color=PRINTER_ONE] + printer_two [shape=box,style=filled,fillcolor=PRINTER_TWO,label="",color=PRINTER_TWO] + + fan_one -- fan_two [color=FAN_ONE_FAN_TWO] + fan_one -- radio_one [color=FAN_ONE_RADIO_ONE] + fan_one -- lamp_one [color=FAN_ONE_LAMP_ONE] + fan_one -- lamp_two [color=FAN_ONE_LAMP_TWO] + fan_one -- printer_one [color=FAN_ONE_PRINTER_ONE] + fan_one -- printer_two [color=FAN_ONE_PRINTER_TWO] + + fan_two -- radio_one [color=FAN_TWO_RADIO_ONE] + fan_two -- lamp_one [color=FAN_TWO_LAMP_ONE] + fan_two -- lamp_two [color=FAN_TWO_LAMP_TWO] + fan_two -- printer_one [color=FAN_TWO_PRINTER_ONE] + fan_two -- printer_two [color=FAN_TWO_PRINTER_TWO] + + radio_one -- lamp_one [color=RADIO_ONE_LAMP_ONE] + radio_one -- lamp_two [color=RADIO_ONE_LAMP_TWO] + radio_one -- printer_one [color=RADIO_ONE_PRINTER_ONE] + radio_one -- printer_two [color=RADIO_ONE_PRINTER_TWO] + + lamp_one -- lamp_two [color=LAMP_ONE_LAMP_TWO] + lamp_one -- printer_one [color=LAMP_ONE_PRINTER_ONE] + lamp_one -- printer_two [color=LAMP_ONE_PRINTER_TWO] + + lamp_two -- printer_one [color=LAMP_TWO_PRINTER_ONE] + lamp_two -- printer_two [color=LAMP_TWO_PRINTER_TWO] + + printer_one -- printer_two [color=PRINTER_ONE_PRINTER_TWO] + + // printer_two -- printer_one [color=PRINTER_ONE_PRINTER_TWO] + // printer_two -- lamp_two [color=LAMP_TWO_PRINTER_TWO] + // printer_two -- lamp_one [color=LAMP_ONE_PRINTER_TWO] + // printer_two -- radio_one [color=RADIO_ONE_PRINTER_TWO] + // printer_two -- fan_two [color=FAN_TWO_PRINTER_TWO] + // printer_two -- fan_one [color=FAN_ONE_PRINTER_TWO] + + // printer_one -- lamp_two [color=LAMP_TWO_PRINTER_ONE] + // printer_one -- lamp_one [color=LAMP_ONE_PRINTER_ONE] + // printer_one -- radio_one [color=RADIO_ONE_PRINTER_ONE] + // printer_one -- fan_two [color=FAN_TWO_PRINTER_ONE] + // printer_one -- fan_one [color=FAN_ONE_PRINTER_ONE] + + // lamp_two -- lamp_one [color=LAMP_ONE_LAMP_TWO] + // lamp_two -- radio_one [color=RADIO_ONE_LAMP_TWO] + // lamp_two -- fan_two [color=FAN_TWO_LAMP_TWO] + // lamp_two -- fan_one [color=FAN_ONE_LAMP_TWO] + + // lamp_one -- radio_one [color=RADIO_ONE_LAMP_ONE] + // lamp_one -- fan_two [color=FAN_TWO_LAMP_ONE] + // lamp_one -- fan_one [color=FAN_ONE_LAMP_ONE] + + // radio_one -- fan_two [color=FAN_TWO_RADIO_ONE] + // radio_one -- fan_one [color=FAN_ONE_RADIO_ONE] + + // fan_two -- fan_one [color=FAN_ONE_FAN_TWO] +} diff --git a/visualiser/svgs/graph10000.svg b/visualiser/svgs/graph10000.svg new file mode 100644 index 0000000..c71ec02 --- /dev/null +++ b/visualiser/svgs/graph10000.svg @@ -0,0 +1,154 @@ + + + + + + + + + +fan_one + + + + +fan_two + + + + +fan_one--fan_two + + + + +radio_one + + + + +fan_one--radio_one + + + + +lamp_one + + + + + +fan_one--lamp_one + + + + +lamp_two + + + + + +fan_one--lamp_two + + + + +printer_one + + + + +fan_one--printer_one + + + + +printer_two + + + + +fan_one--printer_two + + + + +fan_two--radio_one + + + + +fan_two--lamp_one + + + + +fan_two--lamp_two + + + + +fan_two--printer_one + + + + +fan_two--printer_two + + + + +radio_one--lamp_one + + + + +radio_one--lamp_two + + + + +radio_one--printer_one + + + + +radio_one--printer_two + + + + +lamp_one--lamp_two + + + + +lamp_one--printer_one + + + + +lamp_one--printer_two + + + + +lamp_two--printer_one + + + + +lamp_two--printer_two + + + + +printer_one--printer_two + + + + diff --git a/visualiser/svgs/graph10001.svg b/visualiser/svgs/graph10001.svg new file mode 100644 index 0000000..2296d0c --- /dev/null +++ b/visualiser/svgs/graph10001.svg @@ -0,0 +1,154 @@ + + + + + + + + + +fan_one + + + + +fan_two + + + + +fan_one--fan_two + + + + +radio_one + + + + +fan_one--radio_one + + + + +lamp_one + + + + + +fan_one--lamp_one + + + + +lamp_two + + + + + +fan_one--lamp_two + + + + +printer_one + + + + +fan_one--printer_one + + + + +printer_two + + + + +fan_one--printer_two + + + + +fan_two--radio_one + + + + +fan_two--lamp_one + + + + +fan_two--lamp_two + + + + +fan_two--printer_one + + + + +fan_two--printer_two + + + + +radio_one--lamp_one + + + + +radio_one--lamp_two + + + + +radio_one--printer_one + + + + +radio_one--printer_two + + + + +lamp_one--lamp_two + + + + +lamp_one--printer_one + + + + +lamp_one--printer_two + + + + +lamp_two--printer_one + + + + +lamp_two--printer_two + + + + +printer_one--printer_two + + + + diff --git a/visualiser/svgs/graph10002.svg b/visualiser/svgs/graph10002.svg new file mode 100644 index 0000000..4399575 --- /dev/null +++ b/visualiser/svgs/graph10002.svg @@ -0,0 +1,154 @@ + + + + + + + + + +fan_one + + + + +fan_two + + + + +fan_one--fan_two + + + + +radio_one + + + + +fan_one--radio_one + + + + +lamp_one + + + + + +fan_one--lamp_one + + + + +lamp_two + + + + + +fan_one--lamp_two + + + + +printer_one + + + + +fan_one--printer_one + + + + +printer_two + + + + +fan_one--printer_two + + + + +fan_two--radio_one + + + + +fan_two--lamp_one + + + + +fan_two--lamp_two + + + + +fan_two--printer_one + + + + +fan_two--printer_two + + + + +radio_one--lamp_one + + + + +radio_one--lamp_two + + + + +radio_one--printer_one + + + + +radio_one--printer_two + + + + +lamp_one--lamp_two + + + + +lamp_one--printer_one + + + + +lamp_one--printer_two + + + + +lamp_two--printer_one + + + + +lamp_two--printer_two + + + + +printer_one--printer_two + + + + diff --git a/visualiser/svgs/graph10003.svg b/visualiser/svgs/graph10003.svg new file mode 100644 index 0000000..edbf59c --- /dev/null +++ b/visualiser/svgs/graph10003.svg @@ -0,0 +1,154 @@ + + + + + + + + + +fan_one + + + + +fan_two + + + + +fan_one--fan_two + + + + +radio_one + + + + +fan_one--radio_one + + + + +lamp_one + + + + + +fan_one--lamp_one + + + + +lamp_two + + + + + +fan_one--lamp_two + + + + +printer_one + + + + +fan_one--printer_one + + + + +printer_two + + + + +fan_one--printer_two + + + + +fan_two--radio_one + + + + +fan_two--lamp_one + + + + +fan_two--lamp_two + + + + +fan_two--printer_one + + + + +fan_two--printer_two + + + + +radio_one--lamp_one + + + + +radio_one--lamp_two + + + + +radio_one--printer_one + + + + +radio_one--printer_two + + + + +lamp_one--lamp_two + + + + +lamp_one--printer_one + + + + +lamp_one--printer_two + + + + +lamp_two--printer_one + + + + +lamp_two--printer_two + + + + +printer_one--printer_two + + + + diff --git a/visualiser/svgs/graph10004.svg b/visualiser/svgs/graph10004.svg new file mode 100644 index 0000000..e922a2b --- /dev/null +++ b/visualiser/svgs/graph10004.svg @@ -0,0 +1,154 @@ + + + + + + + + + +fan_one + + + + +fan_two + + + + +fan_one--fan_two + + + + +radio_one + + + + +fan_one--radio_one + + + + +lamp_one + + + + + +fan_one--lamp_one + + + + +lamp_two + + + + + +fan_one--lamp_two + + + + +printer_one + + + + +fan_one--printer_one + + + + +printer_two + + + + +fan_one--printer_two + + + + +fan_two--radio_one + + + + +fan_two--lamp_one + + + + +fan_two--lamp_two + + + + +fan_two--printer_one + + + + +fan_two--printer_two + + + + +radio_one--lamp_one + + + + +radio_one--lamp_two + + + + +radio_one--printer_one + + + + +radio_one--printer_two + + + + +lamp_one--lamp_two + + + + +lamp_one--printer_one + + + + +lamp_one--printer_two + + + + +lamp_two--printer_one + + + + +lamp_two--printer_two + + + + +printer_one--printer_two + + + + diff --git a/visualiser/svgs/graph10005.svg b/visualiser/svgs/graph10005.svg new file mode 100644 index 0000000..edbf59c --- /dev/null +++ b/visualiser/svgs/graph10005.svg @@ -0,0 +1,154 @@ + + + + + + + + + +fan_one + + + + +fan_two + + + + +fan_one--fan_two + + + + +radio_one + + + + +fan_one--radio_one + + + + +lamp_one + + + + + +fan_one--lamp_one + + + + +lamp_two + + + + + +fan_one--lamp_two + + + + +printer_one + + + + +fan_one--printer_one + + + + +printer_two + + + + +fan_one--printer_two + + + + +fan_two--radio_one + + + + +fan_two--lamp_one + + + + +fan_two--lamp_two + + + + +fan_two--printer_one + + + + +fan_two--printer_two + + + + +radio_one--lamp_one + + + + +radio_one--lamp_two + + + + +radio_one--printer_one + + + + +radio_one--printer_two + + + + +lamp_one--lamp_two + + + + +lamp_one--printer_one + + + + +lamp_one--printer_two + + + + +lamp_two--printer_one + + + + +lamp_two--printer_two + + + + +printer_one--printer_two + + + + diff --git a/visualiser/svgs/graph10006.svg b/visualiser/svgs/graph10006.svg new file mode 100644 index 0000000..6eb50db --- /dev/null +++ b/visualiser/svgs/graph10006.svg @@ -0,0 +1,154 @@ + + + + + + + + + +fan_one + + + + +fan_two + + + + +fan_one--fan_two + + + + +radio_one + + + + +fan_one--radio_one + + + + +lamp_one + + + + + +fan_one--lamp_one + + + + +lamp_two + + + + + +fan_one--lamp_two + + + + +printer_one + + + + +fan_one--printer_one + + + + +printer_two + + + + +fan_one--printer_two + + + + +fan_two--radio_one + + + + +fan_two--lamp_one + + + + +fan_two--lamp_two + + + + +fan_two--printer_one + + + + +fan_two--printer_two + + + + +radio_one--lamp_one + + + + +radio_one--lamp_two + + + + +radio_one--printer_one + + + + +radio_one--printer_two + + + + +lamp_one--lamp_two + + + + +lamp_one--printer_one + + + + +lamp_one--printer_two + + + + +lamp_two--printer_one + + + + +lamp_two--printer_two + + + + +printer_one--printer_two + + + + diff --git a/visualiser/visualiser.el b/visualiser/visualiser.el new file mode 100644 index 0000000..4602367 --- /dev/null +++ b/visualiser/visualiser.el @@ -0,0 +1,287 @@ +;; visualiser.el +(load-file "~/.emacs.d/elpa/dash-20240510.1327/dash.elc") +(load-file "~/.emacs.d/elpa/mqtt-mode-20180611.1735/mqtt-mode.elc") + + +(require 'dash) +(require 'mqtt-mode) +(toggle-debug-on-error) + +;; directory variables +(defconst graphviz-command "circo") +(defconst graphviz-graph-output-format "svg") +(defconst graphviz-graph-output-dir "graphs/") +(defconst graphviz-image-output-dir (concat graphviz-graph-output-format "s/")) +(defconst working-directory "~/Applications/listeningdaemon/visualiser/") + +(load-file (concat working-directory "secrets.el")) + +;; colors +;; (defconst on-color "black" "The default color for objects which are active") +(defconst off-color "invis" "The default color for objects which are not active") +(defvar colors '("black" "red" "green" "blue" "magenta" "yellow" "orange" "purple" "cyan") + "colors for the nodes and edges to choose from") + + +;;; nodes +;; default colors +(defvar fan-one-color off-color) +(defvar fan-two-color off-color) +(defvar radio-one-color off-color) +(defvar lamp-one-color off-color) +(defvar lamp-two-color off-color) +(defvar printer-one-color off-color) +(defvar printer-two-color off-color) + +;;; edges +;; default colors +(defvar fan-one-fan-two-color off-color) +(defvar fan-one-radio-one-color off-color) +(defvar fan-one-lamp-one-color off-color) +(defvar fan-one-lamp-two-color off-color) +(defvar fan-one-printer-one-color off-color) +(defvar fan-one-printer-two-color off-color) + +(defvar fan-two-radio-one-color off-color) +(defvar fan-two-lamp-one-color off-color) +(defvar fan-two-lamp-two-color off-color) +(defvar fan-two-printer-one-color off-color) +(defvar fan-two-printer-two-color off-color) + +(defvar radio-one-lamp-one-color off-color) +(defvar radio-one-lamp-two-color off-color) +(defvar radio-one-printer-one-color off-color) +(defvar radio-one-printer-two-color off-color) + +(defvar lamp-one-lamp-two-color off-color) +(defvar lamp-one-printer-one-color off-color) +(defvar lamp-one-printer-two-color off-color) + +(defvar lamp-two-printer-one-color off-color) +(defvar lamp-two-printer-two-color off-color) + +(defvar printer-one-printer-two-color off-color) + +(setq snapshot 10000) + +(defun turn-object-on (object) + "Turn an object on" + nil + nil + (setq on-color (elt colors (random (length colors)))) + (cond ((equal object 'fan-one) + (setq fan-one-color on-color) + (format-graph)) + ((equal object 'fan-two) + (setq fan-two-color on-color) + (format-graph)) + ((equal object 'lamp-one) + (setq lamp-one-color on-color) + (format-graph)) + ((equal object 'lamp-two) + (setq lamp-two-color on-color) + (format-graph)) + ((equal object 'radio-one) + (setq radio-one-color on-color) + (format-graph)) + ((equal object 'printer-one) + (setq printer-one-color on-color) + (format-graph)) + ((equal object 'printer-two) + (setq printer-two-color on-color) + (format-graph)))) + +(defun turn-object-off (object) + "Turn an object off" + nil + nil + (cond ((equal object 'fan-one) + (setq fan-one-color off-color) + (format-graph)) + ((equal object 'fan-two) + (setq fan-two-color off-color) + (format-graph)) + ((equal object 'lamp-one) + (setq lamp-one-color off-color) + (format-graph)) + ((equal object 'lamp-two) + (setq lamp-two-color off-color) + (format-graph)) + ((equal object 'radio-one) + (setq radio-one-color off-color) + (format-graph)) + ((equal object 'printer-one) + (setq printer-one-color off-color) + (format-graph)) + ((equal object 'printer-two) + (setq printer-one-color off-color) + (format-graph)))) + + +(defun graph-write-file-quietly () + "Write the graph buffer to a graphviz file quietly" + (let ((inhibit-message t)) + (write-file (concat working-directory graphviz-graph-output-dir "graph" (number-to-string snapshot) ".dot") t))) + +(defun format-graph-image-numbered () + "format the numbered image of the graph quietly, for the .gif" + (let ((inhibit-message t)) + (shell-command + (concat graphviz-command " -T" graphviz-graph-output-format " " + working-directory graphviz-graph-output-dir (concat "graph" (number-to-string snapshot) ".dot") + " -o " + working-directory graphviz-image-output-dir + (concat "graph" (number-to-string snapshot) "." graphviz-graph-output-format))))) + +(defun format-graph-image-main () + "format the image of the main graph quietly" + nil + nil + (let ((inhibit-message t)) + (shell-command + (concat graphviz-command " -T" graphviz-graph-output-format " " + working-directory graphviz-graph-output-dir (concat "graph" (number-to-string snapshot) ".dot") + " -o " + ;; working-directory "main." graphviz-graph-output-format + ;; output the generated image to /var/www/ so that the webpage stays updated + "/var/www/img/main." graphviz-graph-output-format + )))) + +(defun format-graph () + "Series of functions to format the graph to display in the browser +and ultimately turn into a .gif" + nil + nil + ;; preprocess graph + (shell-command (concat "cpp -DFAN_ONE=" fan-one-color " " + "-DFAN_TWO=" fan-two-color " " + "-DRADIO_ONE=" radio-one-color " " + "-DLAMP_ONE=" lamp-one-color " " + "-DLAMP_TWO=" lamp-two-color " " + "-DPRINTER_ONE=" printer-one-color " " + "-DPRINTER_TWO=" printer-two-color " " + "-DFAN_ONE_FAN_TWO=" fan-one-fan-two-color " " + "-DFAN_ONE_RADIO_ONE=" fan-one-radio-one-color " " + "-DFAN_ONE_LAMP_ONE=" fan-one-lamp-one-color " " + "-DFAN_ONE_LAMP_TWO=" fan-one-lamp-two-color " " + "-DFAN_ONE_PRINTER_ONE=" fan-one-printer-one-color " " + "-DFAN_ONE_PRINTER_TWO=" fan-one-printer-two-color " " + "-DFAN_TWO_RADIO_ONE=" fan-two-radio-one-color " " + "-DFAN_TWO_LAMP_ONE=" fan-two-lamp-one-color " " + "-DFAN_TWO_LAMP_TWO=" fan-two-lamp-two-color " " + "-DFAN_TWO_PRINTER_ONE=" fan-two-printer-one-color " " + "-DFAN_TWO_PRINTER_TWO=" fan-two-printer-two-color " " + "-DRADIO_ONE_LAMP_ONE=" radio-one-lamp-one-color " " + "-DRADIO_ONE_LAMP_TWO=" radio-one-lamp-two-color " " + "-DRADIO_ONE_PRINTER_ONE=" radio-one-printer-one-color " " + "-DRADIO_ONE_PRINTER_TWO=" radio-one-printer-two-color " " + "-DLAMP_ONE_LAMP_TWO=" lamp-one-lamp-two-color " " + "-DLAMP_ONE_PRINTER_ONE=" lamp-one-printer-one-color " " + "-DLAMP_ONE_PRINTER_TWO=" lamp-one-printer-two-color " " + "-DLAMP_TWO_PRINTER_ONE=" lamp-two-printer-one-color " " + "-DLAMP_TWO_PRINTER_TWO=" lamp-two-printer-two-color " " + "-DPRINTER_ONE_PRINTER_TWO=" printer-one-printer-two-color " " + working-directory "main.dot") + (concat "graph" (number-to-string snapshot) ".dot") "*Error*") + (switch-to-buffer-other-window + (concat "graph" (number-to-string snapshot) ".dot")) + (set-mark (point)) + (forward-line 6) + (kill-region 0 (point) t) + (graph-write-file-quietly) + ;; create a backup of the graph, for the .gif + (format-graph-image-numbered) + ;; change main.png for displaying in the browser + (format-graph-image-main) + (setq snapshot (+ snapshot 1))) + + +;; (illuminate-edges '("transform" "printer" "one" "fan" "two") "1") +(defun illuminate-edges (topic payload) + "Function to illuminate the edges of the graph" + nil + nil + (setq on-color (elt colors (random (length colors)))) + (let ((payload (string-limit payload 1))) + (let ((from-object (string-join (list (cadr topic) (caddr topic)) "-")) + (to-object (string-join (list (cadddr topic) (car (last topic))) "-"))) + (message "From: %s" from-object) + (message "To: %s" to-object) + (when (string-equal payload "1") + (set (intern (concat from-object "-" to-object "-color")) on-color) + (set (intern (concat to-object "-" from-object "-color")) on-color)) + (when (string-equal payload "0") + (set (intern (concat from-object "-" to-object "-color")) off-color) + (set (intern (concat to-object "-" from-object "-color")) off-color)) + (format-graph)))) + +(defun illuminate-nodes (topic payload) + "Function to illuminate the nodes on the graph, a decision tree" + nil + nil + (setq on-color (elt colors (random (length colors)))) + (let ((payload (string-limit payload 1))) + ;;(message "Topic: %s. Payload %s." topic payload) + (cond ((and (member "fan" topic) (member "one" topic) (string-equal "1" payload)) + (turn-object-on 'fan-one) + (message "Fan one turns on")) + ((and (member "fan" topic) (member "one" topic) (string-equal "0" payload)) + (message "Fan one turns off") + (turn-object-off 'fan-one)) + ((and (member "fan" topic) (member "two" topic) (string-equal "1" payload)) + (message "Fan two turns on") + (turn-object-on 'fan-two)) + ((and (member "fan" topic) (member "two" topic) (string-equal "0" payload)) + (message "Fan two turns off") + (turn-object-off 'fan-two)) + ((and (member "lamp" topic) (member "one" topic) (string-equal "1" payload)) + (message "Lamp one turns on") + (turn-object-on 'lamp-one)) + ((and (member "lamp" topic) (member "one" topic) (string-equal "0" payload)) + (message "Lamp one turns off") + (turn-object-off 'lamp-one)) + ((and (member "lamp" topic) (member "two" topic) (string-equal "1" payload)) + (message "lamp two turns on") + (turn-object-on 'lamp-two)) + ((and (member "lamp" topic) (member "two" topic) (string-equal "0" payload)) + (message "lamp two turns off") + (turn-object-off 'lamp-two)) + ((and (member "radio" topic) (member "one" topic) (string-equal "1" payload)) + (turn-object-on 'radio-one)) + ((and (member "radio" topic) (member "one" topic) (string-equal "0" payload)) + (turn-object-off 'radio-one)) + ((and (member "printer" topic) (member "one" topic) (string-equal "2" payload)) + (turn-object-on 'printer-one)) + ((and (member "printer" topic) (member "one" topic) (string-equal "1" payload)) + (turn-object-on 'printer-one)) + ((and (member "printer" topic) (member "one" topic) (string-equal "0" payload)) + (turn-object-off 'printer-one)) + ((and (member "printer" topic) (member "two" topic) (string-equal "2" payload)) + (turn-object-on 'printer-two)) + ((and (member "printer" topic) (member "two" topic) (string-equal "1" payload)) + (turn-object-on 'printer-two)) + ((and (member "printer" topic) (member "two" topic) (string-equal "0" payload)) + (turn-object-off 'printer-two))))) + ;; printers + + +(add-to-list 'mqtt-message-receive-functions + (lambda (msg) + "Functions to execute on recieving a message" + nil + (let ((m (string-split msg " "))) + (let ((msg-car (car m)) + (payload (cdr m))) + (let ((topic (string-split msg-car "/"))) + ;; (message "Topic: %s. Payload %s" topic payload) + (cond ((member "transform" topic) + (illuminate-edges topic (car payload))) + ((member "main" topic) + (illuminate-nodes topic (car payload))) + ;; ((member "gesture" topic) + ;; (display-gesture)) + )))))) + +(format-graph) +;; (start-process-shell-command "browser" nil (concat "firefox " working-directory "main.html --kiosk")) +(mqtt-start-consumer) diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..cb5ac3a --- /dev/null +++ b/web/index.html @@ -0,0 +1,17 @@ + + + + + + + + free / abandoned / open / obsolete + + + + + + + diff --git a/web/refreshImage.js b/web/refreshImage.js new file mode 100644 index 0000000..78637fc --- /dev/null +++ b/web/refreshImage.js @@ -0,0 +1,10 @@ +var newImage = new Image(); +newImage.src = "img/main.svg"; + +function updateImage() { + if(newImage.complete) { + document.getElementById("dynamicImage").src = newImage.src; + newImage = new Image(); + newImage.src = "img/main.svg#" + new Date().getTime(); + } +} diff --git a/web/style.css b/web/style.css new file mode 100644 index 0000000..7fbf4d5 --- /dev/null +++ b/web/style.css @@ -0,0 +1,8 @@ +.center { + display: block; + margin-left: auto; + margin-top: auto; + margin-bottom: auto; + margin-right: auto; + height: 100vh; +}