Move set point spec validation into Regulator
This commit is contained in:
parent
302d93638d
commit
bbd0835a8f
2 changed files with 16 additions and 11 deletions
|
|
@ -120,6 +120,19 @@ pub struct Regulator {
|
|||
pub set_point_spec: Signal<String>
|
||||
}
|
||||
|
||||
impl Regulator {
|
||||
pub fn try_specify_set_point(&self, spec: String) -> bool {
|
||||
match spec.parse::<f64>() {
|
||||
Err(_) if !spec.is_empty() => false,
|
||||
set_pt => {
|
||||
self.set_point.set(set_pt.ok());
|
||||
self.set_point_spec.set(spec);
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the velocity is expressed in uniform coordinates
|
||||
pub struct ElementMotion<'a> {
|
||||
pub key: ElementKey,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue