feat: load printer configuration from .env

Configure the 80 mm thermal printer (576 dots) via a committed .env file,
loaded at startup with dotenvy. Real environment variables take precedence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bankosegger
2026-11-11 15:00:03 +01:00
parent eae81bb052
commit a2b83744db
5 changed files with 27 additions and 1 deletions

View File

@@ -35,6 +35,13 @@ struct PreviewFrame {
}
fn main() -> Result<(), Box<dyn Error>> {
// Load `.env` before any thread starts, since it sets process variables.
// Values already present in the real environment take precedence.
match dotenvy::dotenv() {
Ok(path) => eprintln!("[config INFO] Loaded {}", path.display()),
Err(error) if error.not_found() => {}
Err(error) => eprintln!("[config ERROR] Could not load .env: {error}"),
}
// One OpenCV inference thread per worker leaves CPU time for the camera/UI
// on the dual-core kiosk instead of each model spawning two busy threads.
core::set_num_threads(1)?;