Move set point spec validation into Regulator

This commit is contained in:
Aaron Fenyes 2025-02-18 12:28:55 -08:00
parent 302d93638d
commit bbd0835a8f
2 changed files with 16 additions and 11 deletions

View file

@ -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,