Skip to content

Commit

Permalink
[wpilib] ADIS IMUs: Add back null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Sep 22, 2024
1 parent 809271a commit 4f29ce0
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions wpilibc/src/main/native/cpp/ADIS16448_IMU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ ADIS16448_IMU::ADIS16448_IMU(IMUAxis yaw_axis, SPI::Port port,

ConfigCalTime(cal_time);

// Configure standard SPI
if (!SwitchToStandardSPI()) {
return;
}
Expand Down Expand Up @@ -174,7 +173,6 @@ ADIS16448_IMU::ADIS16448_IMU(IMUAxis yaw_axis, SPI::Port port,
"required!");
}

// Configure and enable auto SPI
if (!SwitchToAutoSPI()) {
return;
}
Expand Down Expand Up @@ -366,7 +364,6 @@ bool ADIS16448_IMU::SwitchToStandardSPI() {
}
}
}
// There doesn't seem to be a SPI port active. Let's try to set one up
if (m_spi == nullptr) {
m_spi = new SPI(m_spi_port);
m_spi->SetClockRate(1000000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ public ADIS16448_IMU(final IMUAxis yaw_axis, SPI.Port port, CalibrationTime cal_
"ADIS16448: Flash and RAM configuration consistent. No flash update required!", false);
}

// Configure standard SPI
if (!switchToAutoSPI()) {
return;
}
Expand Down Expand Up @@ -418,9 +417,7 @@ private boolean switchToStandardSPI() {
System.out.println("Paused auto SPI successfully.");
}
}
// There doesn't seem to be a SPI port active. Let's try to set one up
if (m_spi == null) {
System.out.println("Setting up a new SPI port.");
m_spi = new SPI(m_spi_port);
m_spi.setClockRate(1000000);
m_spi.setMode(SPI.Mode.kMode3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ public ADIS16470_IMU(
// Write offset calibration command to IMU
writeRegister(GLOB_CMD, 0x0001);

// Configure and enable auto SPI
if (!switchToAutoSPI()) {
return;
}
Expand Down Expand Up @@ -472,9 +471,7 @@ private boolean switchToStandardSPI() {
System.out.println("Paused auto SPI successfully.");
}
}
// There doesn't seem to be a SPI port active. Let's try to set one up
if (m_spi == null) {
System.out.println("Setting up a new SPI port.");
m_spi = new SPI(m_spi_port);
m_spi.setClockRate(2000000);
m_spi.setMode(SPI.Mode.kMode3);
Expand Down

0 comments on commit 4f29ce0

Please sign in to comment.