Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.4 KiB

  1. /*
  2. WIFI MODULE CONFIG
  3. Copyright (C) 2020 by Maxim Prokhorov <prokhorov dot max at outlook dot com>
  4. */
  5. #pragma once
  6. #include "espurna.h"
  7. constexpr bool _wifiHasSSID(unsigned char index) {
  8. return (
  9. (index == 0) ? (strlen(WIFI1_SSID) > 0) :
  10. (index == 1) ? (strlen(WIFI2_SSID) > 0) :
  11. (index == 2) ? (strlen(WIFI3_SSID) > 0) :
  12. (index == 3) ? (strlen(WIFI4_SSID) > 0) :
  13. (index == 4) ? (strlen(WIFI5_SSID) > 0) : false
  14. );
  15. }
  16. constexpr bool _wifiHasIP(unsigned char index) {
  17. return (
  18. (index == 0) ? (strlen(WIFI1_IP) > 0) :
  19. (index == 1) ? (strlen(WIFI2_IP) > 0) :
  20. (index == 2) ? (strlen(WIFI3_IP) > 0) :
  21. (index == 3) ? (strlen(WIFI4_IP) > 0) :
  22. (index == 4) ? (strlen(WIFI5_IP) > 0) : false
  23. );
  24. }
  25. const __FlashStringHelper* _wifiSSID(unsigned char index) {
  26. return (
  27. (index == 0) ? F(WIFI1_SSID) :
  28. (index == 1) ? F(WIFI2_SSID) :
  29. (index == 2) ? F(WIFI3_SSID) :
  30. (index == 3) ? F(WIFI4_SSID) :
  31. (index == 4) ? F(WIFI5_SSID) : nullptr
  32. );
  33. }
  34. const __FlashStringHelper* _wifiPass(unsigned char index) {
  35. return (
  36. (index == 0) ? F(WIFI1_PASS) :
  37. (index == 1) ? F(WIFI2_PASS) :
  38. (index == 2) ? F(WIFI3_PASS) :
  39. (index == 3) ? F(WIFI4_PASS) :
  40. (index == 4) ? F(WIFI5_PASS) : nullptr
  41. );
  42. }
  43. const __FlashStringHelper* _wifiIP(unsigned char index) {
  44. return (
  45. (index == 0) ? F(WIFI1_IP) :
  46. (index == 1) ? F(WIFI2_IP) :
  47. (index == 2) ? F(WIFI3_IP) :
  48. (index == 3) ? F(WIFI4_IP) :
  49. (index == 4) ? F(WIFI5_IP) : nullptr
  50. );
  51. }
  52. const __FlashStringHelper* _wifiGateway(unsigned char index) {
  53. return (
  54. (index == 0) ? F(WIFI1_GW) :
  55. (index == 1) ? F(WIFI2_GW) :
  56. (index == 2) ? F(WIFI3_GW) :
  57. (index == 3) ? F(WIFI4_GW) :
  58. (index == 4) ? F(WIFI5_GW) : nullptr
  59. );
  60. }
  61. const __FlashStringHelper* _wifiNetmask(unsigned char index) {
  62. return (
  63. (index == 0) ? F(WIFI1_MASK) :
  64. (index == 1) ? F(WIFI2_MASK) :
  65. (index == 2) ? F(WIFI3_MASK) :
  66. (index == 3) ? F(WIFI4_MASK) :
  67. (index == 4) ? F(WIFI5_MASK) : nullptr
  68. );
  69. }
  70. const __FlashStringHelper* _wifiDNS(unsigned char index) {
  71. return (
  72. (index == 0) ? F(WIFI1_DNS) :
  73. (index == 1) ? F(WIFI2_DNS) :
  74. (index == 2) ? F(WIFI3_DNS) :
  75. (index == 3) ? F(WIFI4_DNS) :
  76. (index == 4) ? F(WIFI5_DNS) : nullptr
  77. );
  78. }