From 0daf21d35cf99d515ff31031f8a92bf41f067ff3 Mon Sep 17 00:00:00 2001 From: muramura Date: Sun, 28 Apr 2024 21:44:06 +0900 Subject: [PATCH] sbf: Change to SWITCH statement --- src/sbf.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/sbf.cpp b/src/sbf.cpp index 98de007..602648a 100755 --- a/src/sbf.cpp +++ b/src/sbf.cpp @@ -463,17 +463,27 @@ int GPSDriverSBF::payloadRxDone() if (_buf.payload_pvt_geodetic.mode_type < 1) { _gps_position->fix_type = 1; - } else if (_buf.payload_pvt_geodetic.mode_type == 6) { - _gps_position->fix_type = 4; - - } else if (_buf.payload_pvt_geodetic.mode_type == 5 || _buf.payload_pvt_geodetic.mode_type == 8) { - _gps_position->fix_type = 5; - - } else if (_buf.payload_pvt_geodetic.mode_type == 4 || _buf.payload_pvt_geodetic.mode_type == 7) { - _gps_position->fix_type = 6; - } else { - _gps_position->fix_type = 3; + + switch (_buf.payload_pvt_geodetic.mode_type) { + case 6: + _gps_position->fix_type = 4; + break; + + case 5: + case 8: + _gps_position->fix_type = 5; + break; + + case 4: + case 7: + _gps_position->fix_type = 6; + break; + + default: + _gps_position->fix_type = 3; + break; + } } // Check fix and error code