perf(influx): batch measurements and reuse HTTP connections

This commit is contained in:
root
2026-11-11 22:57:12 +00:00
parent dde4736cc2
commit e88623cf6e
11 changed files with 782 additions and 325 deletions
@@ -2,6 +2,8 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
typedef enum {
@@ -28,15 +30,15 @@ typedef struct {
typedef struct {
const char* measurement; // z.B. "air"
const char* tags; // z.B. "device=xyz,location=lab" (optional, kann NULL sein)
uint64_t ts_ms; // 0 => server time
uint64_t ts_ms; // 0 => acquisition time aligned to the server HTTP Date (async API)
const net_influx_field_t* fields;
size_t num_fields;
} net_influx_point_t;
typedef struct {
// Task/Queue
uint16_t queue_len; // z.B. 16
uint32_t task_stack; // z.B. 6144
uint16_t queue_len; // Standard 32
uint32_t task_stack; // Standard 8192
UBaseType_t task_prio; // z.B. 5
// Init/Retry/Backoff
@@ -68,7 +70,9 @@ esp_err_t net_influx_init_from_nvs(const char* ca_cert_pem_opt, int timeout_ms);
esp_err_t net_influx_start(const net_influx_runtime_cfg_t* rt);
void net_influx_stop(void);
// Asynchron: kopiert point+felder intern und queued sie.
// Asynchron: serialisiert den Punkt sofort in eine feste RAM-Warteschlange.
// 1-Hz-Werte werden bis zu 10 Punkte / 10 s gesammelt, mit eigenen Zeitstempeln.
// Ohne gültige Serverzeit werden sichere Einzelpunkt-Schreibvorgänge verwendet.
// Rückgabe:
// - ESP_OK: queued
// - ESP_ERR_NO_MEM / ESP_ERR_INVALID_ARG / ESP_FAIL: sonst