Browse Source

add options for NONE values in switch

Juraj Ďuďák 1 year ago
parent
commit
9fa1b82af7
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/icm20948.cpp

+ 6 - 0
src/icm20948.cpp

@@ -511,6 +511,9 @@ void SensorAccel::SetRange(accel_full_scale full_scale)
 			new_val |= 0x06;
 			accel_scale_factor = 2048;
 			break;
+		default:
+			new_val |= 0x00;
+			accel_scale_factor = 16384; // 2g
 	}
 
 	this->SetScaleFactor(accel_scale_factor);
@@ -541,6 +544,9 @@ void SensorGyro::SetRange(gyro_full_scale full_scale)
 			new_val |= 0x06;
 			gyro_scale_factor = 16.4;
 			break;
+		default:
+			new_val |= 0x00;
+			gyro_scale_factor = 131.0;
 	}
 
 	this->SetScaleFactor(gyro_scale_factor);