--- a/main/config.h Mon Feb 19 15:07:28 2024 +0100 +++ b/main/config.h Mon Jun 24 17:05:20 2024 +0200 @@ -4,8 +4,8 @@ * spiffs filesystem in a flash partition. */ -#ifndef _CONFIG_H -#define _CONFIG_H +#ifndef _G_CONFIG_H +#define _G_CONFIG_H // Global includes for the project @@ -14,6 +14,7 @@ #include <string.h> #include <stdbool.h> #include <time.h> +#include <inttypes.h> #include <errno.h> #include <sys/unistd.h> #include <sys/fcntl.h> @@ -24,38 +25,32 @@ #include "freertos/semphr.h" #include "freertos/event_groups.h" #include "freertos/queue.h" +#include "driver/gpio.h" #include "driver/i2c.h" #include "driver/ledc.h" #include "esp_log.h" #include "esp_spiffs.h" -#include "esp_event.h" +#include "esp_vfs.h" +#include "esp_system.h" +#include "esp_chip_info.h" +#include "esp_netif.h" +#include "esp_mac.h" #include "esp_wifi.h" -#include "esp_wifi_types.h" -#include "esp_system.h" - +#include "esp_wpa2.h" +#include "esp_event.h" +#include "esp_timer.h" #include "esp_ota_ops.h" #include "esp_http_client.h" -#include "esp_https_ota.h" - -#include "esp_vfs.h" -#include "esp_vfs_fat.h" -#include "nvs.h" +#include "esp_app_format.h" +#include "esp_sntp.h" #include "nvs_flash.h" -#include "esp32/rom/crc.h" -#include "mdns.h" #include "lwip/sockets.h" -#include "lwip/api.h" -#include "lwip/err.h" +#include "lwip/dns.h" #include "lwip/netdb.h" -#include "lwip/dns.h" -#include "lwip/opt.h" -#include "lwip/memp.h" -#include "lwip/ip.h" -#include "lwip/raw.h" -#include "lwip/udp.h" -#include "sdkconfig.h" -#include "esp_sntp.h" -#include "expat.h" + +#include <expat.h> + +#include "esp32/rom/crc.h" #include "tftspi.h" #include "tft.h" @@ -157,7 +152,7 @@ /** * @brief Global configuration. File /spiffs/config.conf */ -struct strConfig { +typedef struct { uint8_t Version; ///< Record version number for updates. uint8_t Unit; ///< Celsius or Farenheit (not used yet). float BoilTemperature; ///< The temperature when water boils. @@ -180,7 +175,7 @@ int RecipeRec; ///< Current recipe record. char uuid[37]; ///< Sort of uuid code. char lastSSID[32]; ///< Last connected station. -} config; ///< Config record. +} my_config_t; /** * @brief Write configuration to disk. @@ -198,13 +193,13 @@ /** * @brief Equipment configuration. File /spiffs/equipments.conf */ -struct hdrEquipment { +typedef struct { uint32_t version; ///< Structure version. uint32_t hdrsize; ///< Size of this header. uint32_t recsize; ///< Size of a record. -} equipment_hdr; +} my_equipment_hdr_t; -struct strEquipment { +typedef struct { int MLT_watt; ///< MLT watts. int HLT_watt; ///< HLT watts. char Name[32]; ///< Equipment name. @@ -228,7 +223,7 @@ bool Hendi; ///< HendiControl in use. int RampPower; ///< The power percentage to ramp to boil. int Max_watt; ///< MLT plus HLT peak, shut off HLT if higher. -} equipment; ///< Equipment record. +} my_equipment_t; ///< Equipment record. /** * @brief Append equipments record to disk. @@ -260,11 +255,11 @@ /** * @brief Records with WiFi stations we have succesfully connected. */ -struct strStations { +typedef struct { char SSID[32]; ///< Station SSID char Password[64]; ///< Station password bool hide; ///< Hide from AP scan. -} wifiStation; ///< Station record. +} my_wifiStation_t; ///< Station record. /** * @brief Add a new station record. @@ -292,7 +287,7 @@ /** * @brief Runtime configuration. File /spiffs/runtime.conf */ -struct strRuntime { +typedef struct { uint8_t Version; ///< Record version number for updates. bool AutoModeStarted; ///< Running automode. int StageResume; ///< Current Resume Stage. @@ -309,7 +304,7 @@ bool MaltAdded; ///< If malt was added. TickType_t MLT_usage; ///< MLT usage counter. TickType_t HLT_usage; ///< HLT usage counter. -} runtime; ///< Runtime record. +} my_runtime_t; ///< Runtime record. /** @@ -356,7 +351,7 @@ /** * @brief Mash steps */ -typedef struct strMashStep { +typedef struct { char Name[32]; ///< Step name. uint8_t Type; ///< Step Type. float Step_temp; ///< Step start temperature. @@ -370,7 +365,7 @@ /** * @brief Hop and other additions */ -typedef struct strAddition { +typedef struct { uint16_t Time; ///< Time for addition. uint8_t Type; ///< Addition type, Hop, Syrop ... char Name[64]; ///< Addition name. @@ -380,15 +375,15 @@ * @brief Recipes database. Starts with a header block for future upgrades, * followed by the actual recpie records. */ -struct hdrRecipe { +typedef struct { uint32_t version; ///< Structure version. uint32_t hdrsize; ///< Size of this header. uint32_t recsize; ///< Size of a record. uint8_t mashmax; ///< Maximum mash steps. uint8_t additionmax; ///< Maximum additions. -} recipe_hdr; +} my_recipe_hdr_t; -struct strRecipe { +typedef struct { char Name[128]; ///< Recipe name. char Code[32]; ///< Recipe code. uint16_t BoilTime; ///< Boil time. @@ -402,7 +397,7 @@ float SpargeTemp; ///< Sparge water temperature. mashstep_t MashStep[MASH_MAX]; ///< Mash steps. addition_t Addition[ADDITION_MAX]; ///< Additions. -} recipe; ///< Recipe record. +} my_recipe_t; ///< Recipe record. /** * @brief Append a recipe record. Create file if it doesn't exist.