use lager::LagerBox;let lager = LagerBox::from_env()?;let supply = lager.supply("supply1");supply.set_voltage(3.3)?;supply.set_current(0.5)?;supply.enable()?;std::thread::sleep(std::time::Duration::from_millis(200));let s = supply.state()?;assert_eq!(s.enabled, Some(true));let v = s.voltage.expect("output is on, so a measurement exists");assert!((v - 3.3).abs() < 0.05, "rail at {v:.4} V");supply.disable()?;
supply.set_voltage(3.3)?;supply.set_ocp(0.25)?; // trip rather than let it draw moresupply.enable()?;std::thread::sleep(std::time::Duration::from_secs(5));let s = supply.state()?;assert_eq!(s.ocp_tripped, Some(false), "DUT tripped the 250 mA budget");supply.disable()?;