Skip to content

Commit 34f0bb9

Browse files
committed
fix: simplify PREDICT_MINMOTOR logic (remove dead code)
Remove nonsensical string parsing of i32 values in PREDICT_MINMOTOR. Since sysconfig is HashMap<String, i32>, the values are already integers and don't need comma-separated string parsing. Addresses CodeRabbit review feedback.
1 parent 1dca257 commit 34f0bb9

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

src/parser/decoder.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,21 +216,11 @@ pub fn apply_predictor_with_debug(
216216
}
217217

218218
PREDICT_MINMOTOR => {
219-
// Get the min motor value from motorOutput or motorOutput[0]
219+
// Get the min motor value from motorOutput[0] or motorOutput
220220
let minmotor = sysconfig
221221
.get("motorOutput[0]")
222+
.or_else(|| sysconfig.get("motorOutput"))
222223
.copied()
223-
.or_else(|| {
224-
sysconfig.get("motorOutput").and_then(|&val| {
225-
// Parse "48,2047" format to get first value
226-
let motor_output_str = val.to_string();
227-
if let Some(comma_pos) = motor_output_str.find(',') {
228-
motor_output_str[..comma_pos].parse().ok()
229-
} else {
230-
motor_output_str.parse().ok()
231-
}
232-
})
233-
})
234224
.unwrap_or(48);
235225
raw_value + minmotor
236226
}

0 commit comments

Comments
 (0)