Skip to content

Commit 1150bb7

Browse files
committed
refactor: reorganize MAX_REASONABLE_VBAT_RAW constant placement
Move MAX_REASONABLE_VBAT_RAW constant to after predictor constants for better organization. Groups domain-specific constants together and improves code clarity by placing the constant near related corruption detection logic.
1 parent ed5bc26 commit 1150bb7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/parser/decoder.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ pub const ENCODING_TAG2_3SVARIABLE: u8 = 10;
1313

1414
// Predictor constants - directly from JavaScript reference
1515
pub const PREDICT_0: u8 = 0;
16-
17-
// Maximum reasonable raw vbatLatest value before considering it corrupted
18-
const MAX_REASONABLE_VBAT_RAW: i32 = 1000;
1916
pub const PREDICT_PREVIOUS: u8 = 1;
2017
pub const PREDICT_STRAIGHT_LINE: u8 = 2;
2118
pub const PREDICT_AVERAGE_2: u8 = 3;
@@ -28,6 +25,10 @@ pub const PREDICT_VBATREF: u8 = 9;
2825
pub const PREDICT_LAST_MAIN_FRAME_TIME: u8 = 10;
2926
pub const PREDICT_MINMOTOR: u8 = 11;
3027

28+
// Domain-specific constants for corruption detection
29+
// Maximum reasonable raw vbatLatest value before considering it corrupted
30+
const MAX_REASONABLE_VBAT_RAW: i32 = 1000;
31+
3132
/// Decode a field value using the specified encoding
3233
pub fn decode_field_value(
3334
stream: &mut BBLDataStream,

0 commit comments

Comments
 (0)