Advertisement
drabont

Stationeers -SeCoDoLa

Mar 8th, 2021
2,113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #= SeCoDoLa = v0.1 =================== by swagman =#
  2. #  __         __           ___         _           #
  3. # / _|___    / _|___      |   \ ___   | |  __ _    #
  4. # \_ / -_)  | (_/ _ ntrols| |) / _ \  | |_/ _` |   #
  5. # |__\___nsor\__\___rridor|___/\___ors&___\__,_mps #
  6. #==================================================#
  7. # + Automatic control of lighting and doors in
  8. #   corridors or rooms with one or two entrances
  9. #   by means of presence (motion) sensors
  10. # + All devices are optional, i will do what is
  11. #   possible depending on the available devices
  12. # + If there is a Solar sensor, it will be used
  13. #   the solar sensor must be oriented face down!
  14. # + Full installation diagram: SDSLLLLLLLLSDS
  15. #   mean: S-motion sensor; D-door; L-lamp
  16. # + see the video instructions at the link
  17. #= 2020.00.00 00:00  https://youtu.be/da73flIl_iQ =#
  18. # + and set lamp hash below
  19. define lamps -1860064656 #lamp hash (press F1)
  20.  
  21. alias Sens1Ot d0
  22. alias Sens1In d1
  23. alias Door1 d2
  24. alias Sens2Ot d3
  25. alias Sens2In d4
  26. alias Door2 d5
  27.  
  28. alias Count r15
  29. alias Prev1Ot r14
  30. alias Prev1In r13
  31. alias Prev2Ot r12
  32. alias Prev2In r11
  33. alias State r10
  34.  
  35. move Count 0
  36. loop:
  37. move r0 0
  38. brdns Sens1Ot 2
  39. l r0 Sens1Ot Activate
  40. select r2 r0 Prev1In 0
  41. sub Count Count r2
  42.  
  43. move r1 0
  44. brdns Sens1In 2
  45. l r1 Sens1In Activate
  46. select r2 r1 Prev1Ot 0
  47. add Count Count r2
  48.  
  49. move Prev1Ot r0
  50. move Prev1In r1
  51.  
  52. move r0 0
  53. brdns Sens2Ot 2
  54. l r0 Sens2Ot Activate
  55. select r2 r0 Prev2In 0
  56. sub Count Count r2
  57.  
  58. move r1 0
  59. brdns Sens2In 2
  60. l r1 Sens2In Activate
  61. select r2 r1 Prev2Ot 0
  62. add Count Count r2
  63.  
  64. move Prev2Ot r0
  65. move Prev2In r1
  66.  
  67. max Count Count 0
  68. s db Setting Count
  69.  
  70. #---
  71. or r0 Prev1Ot Prev1In
  72. brdns Door1 2
  73. s Door1 Open r0
  74.  
  75. or r0 Prev2Ot Prev2In
  76. brdns Door2 2
  77. s Door2 Open r0
  78.  
  79. #---
  80. sgtz r0 Count
  81. lb r1 1076425094 Vertical Minimum
  82. slt r1 r1 100
  83. and r0 r0 r1
  84. breq State r0 2
  85. sb lamps On r0
  86. move State r0
  87.  
  88. lb r1 lamps On Average
  89. round r2 r1
  90. brne r1 r2 3
  91. xor r2 r2 1
  92. sb lamps On r2
  93.  
  94. yield
  95. j loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement