firmware: add I2S MEMS microphone driver; fix missing essence migration

Mic: confirmed via its pinout (L/R, WS, SCK, SD, VCC, GND) that the third
target module is a standard I2S digital MEMS mic (INMP441-family). Added
mems_mic.c/h using ESP-IDF's current driver/i2s_std.h API — reports RMS
audio level in dBFS as sensor_type "evp" rather than attempting on-device
voice-band FFT (the browser EVP mode's approach); the backend's existing
statistical anomaly detector handles spike detection from the raw level,
same as it already does for temperature/pressure/presence.

Also fixes a real gap Workstream B's report flagged: User.essence (a live
model column used throughout merged code — /auth/me, inventory purchases,
summon trickle) had no migration line in main.py's lifespan, which would
have broken on the actual production Postgres database.
This commit is contained in:
Indiana
2026-07-24 21:52:03 +00:00
parent 7ebedf363b
commit f09e077199
6 changed files with 288 additions and 6 deletions

View File

@@ -11,6 +11,7 @@
#include "sensor_registry.h"
#include "bmp280.h"
#include "rd03e.h"
#include "mems_mic.h"
#include "esp_log.h"
static const char *TAG = "sensor_registry";
@@ -21,6 +22,7 @@ static const char *TAG = "sensor_registry";
static const sensor_driver_t s_drivers[] = {
{ .name = "bmp280", .init = bmp280_init, .read = bmp280_read },
{ .name = "rd03e", .init = rd03e_init, .read = rd03e_read },
{ .name = "mems_mic", .init = mems_mic_init, .read = mems_mic_read },
// Add new drivers here, e.g.:
// { .name = "my_sensor", .init = my_sensor_init, .read = my_sensor_read },
};