refactor + documentation

This commit is contained in:
2026-09-17 19:49:23 +02:00
parent a1dae20cbf
commit a89fc4b4b8
3 changed files with 21 additions and 10 deletions
+15 -4
View File
@@ -19,22 +19,33 @@ bmp280_t dev_bmp_280;
void main_loop(void *pvParameters) {
while (1) {
vTaskDelay(pdMS_TO_TICKS(10000));
ygg_bmp280_read_sensor(&dev_bmp_280);
ygg_send_sensor_readouts(SENSOR_NAME,
CURR_READOUT);
vTaskDelay(pdMS_TO_TICKS(10000));
}
}
void app_main()
{
// NVS - Non-Volatile Storage, this memory stays untouched
// after power off. It is key value memory stored
// in separate partition of flash. It takes about 20kB.
// Here it is not used directly. It is required by WiFi
// driver to store SSID and password.
// NVS is organized into pages. Single page is one flash
// sector - typically 4096B
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
// ESP_ERR_NVS_NEW_VERSION_FOUND - NVS header page is
// stored in newer version (newer IDF) than version
// it is used by this application
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
ESP_ERROR_CHECK(nvs_flash_init());
}
ESP_ERROR_CHECK(ret);
wifi_init_sta();
ygg_wifi_init_sta();
httpd_handle_t server = ygg_start_webserver();
httpd_register_uri_handler(server, &ygg_temp_uri);