Skip to content

Commit

Permalink
Issue #26: Follow-up to size delay amount within uint8_t.
Browse files Browse the repository at this point in the history
  • Loading branch information
quicksketch committed Jan 12, 2025
1 parent 65af2fd commit ed23b32
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/F_LSM6DS3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ int LSM6DS3::init(calData cal, uint8_t address)
//initialize address variable and calibration data.
IMUAddress = address;

if (cal.valid == false)
if (cal.valid == false)
{
calibration = { 0 };
}
else
{
calibration = cal;
}
uint8_t IMUWhoAmI = checkReady(IMUAddress, 500);

uint8_t IMUWhoAmI = checkReady(IMUAddress, 100);
if (!(IMUWhoAmI == LSM6DS3_WHOAMI_DEFAULT_VALUE)) {
if (!(IMUWhoAmI == LSM6DS3TR_C_WHOAMI_DEFAULT_VALUE)) {
return -1;
Expand All @@ -26,7 +26,7 @@ int LSM6DS3::init(calData cal, uint8_t address)
// reset device
writeByteI2C(wire, IMUAddress, LSM6DS3_CTRL3_C, 0x01); // Toggle softreset
while (!checkReady(IMUAddress, 100)); // wait for reset

writeByteI2C(wire, IMUAddress, LSM6DS3_CTRL1_XL, 0x47); // Start up accelerometer, set range to +-16g, set output data rate to 104hz, BW_XL bits to 11.
writeByteI2C(wire, IMUAddress, LSM6DS3_CTRL2_G, 0x4C); // Start up gyroscope, set range to -+2000dps, output data rate to 104hz.
writeByteI2C(wire, IMUAddress, LSM6DS3_CTRL4_C, 0x80); // Set XL_BW_SCAL_ODR;
Expand Down Expand Up @@ -260,4 +260,4 @@ void LSM6DS3::calibrateAccelGyro(calData* cal)
cal->gyroBias[1] = (float)gyro_bias[1];
cal->gyroBias[2] = (float)gyro_bias[2];
cal->valid = true;
}
}

0 comments on commit ed23b32

Please sign in to comment.