|
@@ -420,6 +420,7 @@ impl RandomizePen {
|
|
setting.pulse_width = Some(*width);
|
|
setting.pulse_width = Some(*width);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Check for duplicates
|
|
if !generated.contains(&setting) {
|
|
if !generated.contains(&setting) {
|
|
generated.push(setting);
|
|
generated.push(setting);
|
|
setting.apply(pen);
|
|
setting.apply(pen);
|
|
@@ -432,6 +433,7 @@ impl RandomizePen {
|
|
debug!("Duplicate random setting");
|
|
debug!("Duplicate random setting");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Fail out if max attempts reached (insufficient search space)
|
|
if attempt == MAX_ATTEMPTS {
|
|
if attempt == MAX_ATTEMPTS {
|
|
panic!(
|
|
panic!(
|
|
"Exceeded maximum number of {} randommization attempts",
|
|
"Exceeded maximum number of {} randommization attempts",
|