75 ML1_CONNECT, ///< Connect WiFi |
75 ML1_CONNECT, ///< Connect WiFi |
76 ML1_MQTT_CONNECT, ///< Connect MQTT if WiFi |
76 ML1_MQTT_CONNECT, ///< Connect MQTT if WiFi |
77 ML1_WAITCON, ///< Wait for connection and measurements |
77 ML1_WAITCON, ///< Wait for connection and measurements |
78 ML1_SEND, ///< Send MQTT node and units messages |
78 ML1_SEND, ///< Send MQTT node and units messages |
79 ML1_WAITACK, ///< MQTT messages received |
79 ML1_WAITACK, ///< MQTT messages received |
|
80 ML1_STATUS, ///< Update status |
|
81 ML1_SCAN, ///< Scan AP's for better one |
80 ML1_DONE ///< All done |
82 ML1_DONE ///< All done |
81 } ML1; |
83 } ML1; |
82 |
84 |
83 |
85 |
84 |
86 |
104 ML2_ZERO_UNIT2, ///< Unit 2 set zero |
106 ML2_ZERO_UNIT2, ///< Unit 2 set zero |
105 ML2_ZERO_UNIT3, ///< Unit 3 set zero |
107 ML2_ZERO_UNIT3, ///< Unit 3 set zero |
106 ML2_SEL_SENSOR1, ///< Unit 1 select sensor |
108 ML2_SEL_SENSOR1, ///< Unit 1 select sensor |
107 ML2_SEL_SENSOR2, ///< Unit 2 select sensor |
109 ML2_SEL_SENSOR2, ///< Unit 2 select sensor |
108 ML2_SEL_SENSOR3, ///< Unit 3 select sensor |
110 ML2_SEL_SENSOR3, ///< Unit 3 select sensor |
109 ML2_SETUP_NETWORK, ///< Network setup |
|
110 ML2_SETUP_MQTT, ///< MQTT setup |
|
111 ML2_SETUP_WIFI, ///< WiFi setup |
|
112 ML2_LIST_APS, ///< WiFi list APs |
|
113 ML2_EDIT_AP, ///< WiFi edit AP |
|
114 ML2_INACTIVE, ///< Inactive reached, cleanup |
111 ML2_INACTIVE, ///< Inactive reached, cleanup |
115 ML2_DONE ///< All done |
112 ML2_DONE ///< All done |
116 } ML2; |
113 } ML2; |
117 |
|
118 |
|
119 |
|
120 /** |
|
121 * @brief Global configuration. File /spiffs/config.conf |
|
122 */ |
|
123 typedef struct { |
|
124 uint8_t Version; ///< Record version number for updates. |
|
125 char ntp_server[32]; ///< Preffered NTP server. |
|
126 char hostname[32]; ///< Our hostname. |
|
127 char uuid[37]; ///< Sort of uuid code. |
|
128 char xlastSSID[32]; ///< Not used anymore. |
|
129 char mqtt_server[32]; ///< MQTT server. |
|
130 uint16_t mqtt_port; ///< MQTT TCP port. |
|
131 char mqtt_user[32]; ///< MQTT user name if needed. |
|
132 char mqtt_pwd[62]; ///< MQTT password. |
|
133 } strConfig_t; ///< Config record. |
|
134 |
|
135 |
|
136 /** |
|
137 * @brief Write configuration to disk. |
|
138 */ |
|
139 void write_config(void); |
|
140 |
|
141 /** |
|
142 * @brief Read configuration file. If it doesn't exist create and |
|
143 * write a new configuration file with sane defaults. |
|
144 */ |
|
145 void read_config(void); |
|
146 |
114 |
147 |
115 |
148 |
116 |
149 /** |
117 /** |
150 * @brief Records with WiFi stations we have succesfully connected. |
118 * @brief Records with WiFi stations we have succesfully connected. |