-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da4ad25
commit c949389
Showing
17 changed files
with
365 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use panduza_platform_core::std::prop::min_max::Settings as MinMaxSettings; | ||
use panduza_platform_core::{Error, InstanceSettings}; | ||
|
||
/// | ||
/// | ||
#[derive(Debug, Clone)] | ||
pub struct Settings { | ||
pub min_max_voltage: MinMaxSettings, | ||
pub min_max_current: MinMaxSettings, | ||
} | ||
|
||
impl Settings { | ||
/// | ||
/// | ||
pub fn new() -> Self { | ||
Self { | ||
min_max_voltage: MinMaxSettings::new("voltage", "voltage limit", 0, 30, None), | ||
min_max_current: MinMaxSettings::new("current", "current limit", 0, 3, None), | ||
} | ||
} | ||
|
||
pub fn min_voltage(&self) -> f64 { | ||
return self.min_max_voltage.min; | ||
} | ||
pub fn max_voltage(&self) -> f64 { | ||
return self.min_max_voltage.max; | ||
} | ||
pub fn min_current(&self) -> f64 { | ||
return self.min_max_current.min; | ||
} | ||
pub fn max_current(&self) -> f64 { | ||
return self.min_max_current.max; | ||
} | ||
|
||
/// | ||
/// | ||
pub fn override_with_instance_settings( | ||
&mut self, | ||
settings: &Option<InstanceSettings>, | ||
) -> Result<(), Error> { | ||
self.min_max_voltage | ||
.override_with_instance_settings(settings)?; | ||
self.min_max_current | ||
.override_with_instance_settings(settings)?; | ||
Ok(()) | ||
} | ||
} |
Oops, something went wrong.