main/config.h

changeset 17
f9eca4a55911
parent 16
e38ffa806e84
child 18
d969e0fe05dc
equal deleted inserted replaced
16:e38ffa806e84 17:f9eca4a55911
65 * @brief Mainloop 1 timed actions. 65 * @brief Mainloop 1 timed actions.
66 */ 66 */
67 typedef enum 67 typedef enum
68 { 68 {
69 ML1_INIT = 0, ///< Init fase 69 ML1_INIT = 0, ///< Init fase
70 ML1_CONNECT, ///< Connect WiFi 70 ML1_CONNECT, ///< Connect WiFi
71 ML1_MQTT_CONNECT, ///< Connect MQTT if WiFi 71 ML1_MQTT_CONNECT, ///< Connect MQTT if WiFi
72 ML1_WAITCON, ///< Wait for connection and measurements 72 ML1_WAITCON, ///< Wait for connection and measurements
73 ML1_SEND, ///< Send MQTT node and units messages 73 ML1_SEND, ///< Send MQTT node and units messages
74 ML1_WAITACK, ///< MQTT messages received 74 ML1_WAITACK, ///< MQTT messages received
75 ML1_MQTT_DISCONNECT, ///< MQTT disconnect 75 ML1_MQTT_DISCONNECT, ///< MQTT disconnect
76 ML1_DISCONNECT, ///< Disconnect WiFi 76 ML1_DISCONNECT, ///< Disconnect WiFi
77 ML1_WIFI_OFF, ///< WiFi power off 77 ML1_WIFI_OFF, ///< WiFi power off
78 ML1_DONE ///< All done 78 ML1_DONE ///< All done
79 } ML1; 79 } ML1;
80 80
109 struct strConfig { 109 struct strConfig {
110 uint8_t Version; ///< Record version number for updates. 110 uint8_t Version; ///< Record version number for updates.
111 char ntp_server[32]; ///< Preffered NTP server. 111 char ntp_server[32]; ///< Preffered NTP server.
112 char hostname[32]; ///< Our hostname. 112 char hostname[32]; ///< Our hostname.
113 char uuid[37]; ///< Sort of uuid code. 113 char uuid[37]; ///< Sort of uuid code.
114 char xlastSSID[32]; ///< Last connected station. 114 char xlastSSID[32]; ///< Not used anymore.
115 char mqtt_server[32]; ///< MQTT server. 115 char mqtt_server[32]; ///< MQTT server.
116 uint16_t mqtt_port; ///< MQTT TCP port. 116 uint16_t mqtt_port; ///< MQTT TCP port.
117 char mqtt_user[32]; ///< MQTT user name if needed. 117 char mqtt_user[32]; ///< MQTT user name if needed.
118 char mqtt_pwd[62]; ///< MQTT password. 118 char mqtt_pwd[62]; ///< MQTT password.
119 } config; ///< Config record. 119 } config; ///< Config record.
122 /** 122 /**
123 * @brief Write configuration to disk. 123 * @brief Write configuration to disk.
124 */ 124 */
125 void write_config(void); 125 void write_config(void);
126 126
127 /** @brief Read configuration file. If it doesn't exist create and 127 /**
128 * write a new configuration file with sane defaults. 128 * @brief Read configuration file. If it doesn't exist create and
129 * write a new configuration file with sane defaults.
129 */ 130 */
130 void read_config(void); 131 void read_config(void);
131 132
132 133
133 134

mercurial