ids.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package ids
  2. const (
  3. Fan1 = "fan.chamber.1"
  4. Fan2 = "fan.chamber.2"
  5. Fan3 = "fan.chamber.3"
  6. Fan4 = "fan.chamber.4"
  7. PTC1 = "ptc.chamber.1"
  8. PTC2 = "ptc.chamber.2"
  9. PTC3 = "ptc.chamber.3"
  10. PTC4 = "ptc.chamber.4"
  11. DoorX = "door.x.close_percent"
  12. DoorY = "door.y.close_percent"
  13. DoorZ = "door.z.close_percent"
  14. DoorXEst = "door.x.estimated_close_percent"
  15. DoorYEst = "door.y.estimated_close_percent"
  16. DoorZEst = "door.z.estimated_close_percent"
  17. DoorXOpenLimit = "door.x.open_limit"
  18. DoorYOpenLimit = "door.y.open_limit"
  19. DoorZOpenLimit = "door.z.open_limit"
  20. DoorXCloseLimit = "door.x.close_limit"
  21. DoorYCloseLimit = "door.y.close_limit"
  22. DoorZCloseLimit = "door.z.close_limit"
  23. )
  24. func TempChannel(i int) string {
  25. return "temperature.channel." + twoDigit(i)
  26. }
  27. func twoDigit(i int) string {
  28. if i < 0 {
  29. i = 0
  30. }
  31. if i > 99 {
  32. i = 99
  33. }
  34. return string([]byte{'0' + byte(i/10), '0' + byte(i%10)})
  35. }
  36. func IsDoor(id string) bool {
  37. return id == DoorX || id == DoorY || id == DoorZ
  38. }
  39. func IsFan(id string) bool {
  40. return id == Fan1 || id == Fan2 || id == Fan3 || id == Fan4
  41. }
  42. func IsPTC(id string) bool {
  43. return id == PTC1 || id == PTC2 || id == PTC3 || id == PTC4
  44. }