Add temperature compensation and webcam mic noise sensing

- Temperature: dynamic compensation using CPU temp (factor=1.85, calibrated for eye1)
- Noise: uses arecord from webcam mic instead of broken MEMS HAT mic
- Config: added sensors section for temp_factor and noise_device
- API: now returns raw_temp and cpu_temp alongside compensated temp

Calibration: 69°F actual ambient
🦊 Christmas Eve 2025
This commit is contained in:
Alex Kazaiev
2025-12-24 12:38:49 -06:00
parent 524c37a8c4
commit baf7e417c1
3 changed files with 184 additions and 41 deletions

View File

@@ -46,6 +46,7 @@ def load_config(config_path: str = "config.yaml") -> dict:
"server": {"host": "0.0.0.0", "port": 8767},
"database": {"path": "enviro_history.db", "retention_hours": 168},
"sampling": {"interval_seconds": 60},
"sensors": {"temp_compensation_factor": 1.85, "noise_device": "default"},
"lcd": {"enabled": True, "brightness": 0.5, "default_message": "🦊 Vixy"},
"mock_mode": False
}
@@ -154,7 +155,12 @@ async def lifespan(app: FastAPI):
mock_mode = config.get("mock_mode", False)
# Initialize components
sensors = get_sensors(mock_mode=mock_mode)
sensor_config = config.get("sensors", {})
sensors = get_sensors(
mock_mode=mock_mode,
temp_factor=sensor_config.get("temp_compensation_factor", 1.85),
noise_device=sensor_config.get("noise_device", "default")
)
db = await get_database(
db_path=config["database"]["path"],
retention_hours=config["database"]["retention_hours"]