Documentation for ESP32 Data Logger
date
Jun 9, 2024
type
Post
AI summary
slug
documentation-esp32-datalogger
status
Published
tags
Documentation
designNotes
summary
This code is for an ESP32-based data logging system, utilizing various libraries and APIs for handling tasks such as data logging, wireless communication, and configuration management.
![Video preview](https://i.ytimg.com/vi/CaR1bvXQmzk/hqdefault.jpg)
Summary for Code Documentation
This code is for an ESP32-based data logging system, utilizing various libraries and APIs for handling tasks such as data logging, wireless communication, and configuration management. Here is an overview of the key components and functionalities:
Included Libraries
data_logging.h
: Handles data logging operations.
utils.h
: Utility functions for the system.
api_interface.h
: Manages API interfaces for the system.
vibrating_wire.h
: Specific to vibrating wire sensor management.
lora_init.h
: Handles LoRa initialization and communication.
configuration.h
: Manages system and data collection configurations.
Tasks
- SemaphoreHandle_t logMutex: Semaphore for managing access to shared resources.
- TaskHandle_t parsingTask: Task handle for the parsing task.
- TaskHandle_t wifimanagerTaskHandle: Task handle for managing WiFi connections.
- TaskHandle_t blinkTaskHandle: Task handle for managing the blink task.
Functions
- taskInitiNTP(void parameter)
- Purpose: Synchronizes NTP time and deletes the task upon completion.
- Key Operation: Calls
ntp_sync()
for NTP synchronization.
- logDataTask(void parameter)
- Purpose: Continuously logs data.
- Key Operation: Calls
logData()
to perform the logging operation in a loop.
Setup Function
- Serial.begin(115200): Initializes serial communication.
- external_rtc_init(): Initializes the external RTC, a prerequisite for NTP.
- oled_init(): Initializes the OLED display.
- esp_error_init_sd_oled(): Initializes error handling for SD and OLED.
- pinMode(TRIGGER_PIN, INPUT_PULLUP): Sets the WiFi manager push button pin.
- pinMode(LED, OUTPUT): Sets the onboard LED indicator pin.
- spiffs_init(): Initializes SPIFFS.
- sd_init(): Initializes the SD card.
- load_system_configuration(): Loads system configuration.
- load_data_collection_configuration(): Loads data collection configuration.
- lora_init(): Initializes LoRa communication.
- wifi_setting_reset(): Resets WiFi settings.
- wifi_init(): Initializes WiFi.
- start_http_server(): Starts the asynchronous HTTP server.
- ftp_server_init(): Initializes the FTP server.
- xTaskCreate(taskInitiNTP, "InitNTPTask", 4096, NULL, 1, NULL): Creates the NTP initialization task.
Loop Function
- ElegantOTA.loop(): Handles OTA updates.
- ftp.handle(): Handles FTP server operations.
This documentation provides an organized structure for understanding the different components and tasks of the code, facilitating easier navigation and comprehension for developers working on the project.