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:
8
main.py
8
main.py
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user