Add drivers for gpio and piface
This commit is contained in:
parent
61a3c6093b
commit
4ed1cd3182
14 changed files with 259 additions and 17 deletions
emgauwa-controller/src
|
@ -5,6 +5,7 @@ use emgauwa_lib::errors::EmgauwaError;
|
|||
use emgauwa_lib::models::{Controller, FromDbModel};
|
||||
use emgauwa_lib::types::ControllerUid;
|
||||
use emgauwa_lib::utils::{drop_privileges, init_logging};
|
||||
use rppal_pfd::PiFaceDigital;
|
||||
use sqlx::pool::PoolConnection;
|
||||
use sqlx::Sqlite;
|
||||
|
||||
|
@ -64,6 +65,9 @@ async fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
init_logging(&settings.logging.level)?;
|
||||
|
||||
let mut pfd: Option<PiFaceDigital> = None;
|
||||
let drivers = settings.relays_make_drivers(&mut pfd)?;
|
||||
|
||||
let pool = db::init(&settings.database)
|
||||
.await
|
||||
.map_err(EmgauwaError::from)?;
|
||||
|
@ -109,7 +113,7 @@ async fn main() -> Result<(), std::io::Error> {
|
|||
settings.server.host, settings.server.port
|
||||
);
|
||||
|
||||
let app_state = app_state::AppState::new(pool.clone(), this, settings).start();
|
||||
let app_state = app_state::AppState::new(pool.clone(), this, settings, drivers).start();
|
||||
|
||||
let _ = tokio::join!(
|
||||
tokio::spawn(run_relays_loop(app_state.clone())),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue