@ -57,6 +57,7 @@ pub fn pump_water(water_mass_g: u16, program_state: &mut ProgramState) -> Generi
.history
.watering_records
.push(WateringRecord::new(water_mass_g.into()));
program_state.history.save()?;
Ok(())
}
@ -11,7 +11,7 @@ pub struct ProgramState {
pub fn init_state(config: Configuration) -> GenericResult<ProgramStateShared> {
let relay = io::Relay::new(&config)?;
let history = History::load()?;
let history = History::load().unwrap_or_default();
Ok(Arc::new(Mutex::new(ProgramState {
config,
relay,