mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Remove version writes (#8003)
This will use a much different mechanism in the future.
This commit is contained in:
@@ -70,27 +70,6 @@ class PneumaticHub::DataStore {
|
||||
|
||||
auto version = m_moduleObject.GetVersion();
|
||||
|
||||
if (version.FirmwareMajor > 0 && RobotBase::IsReal()) {
|
||||
// Write PH firmware version to roboRIO
|
||||
std::FILE* file = nullptr;
|
||||
file = std::fopen(
|
||||
fmt::format("/tmp/frc_versions/REV_PH_{:0>2}_WPILib_Version.ini",
|
||||
module)
|
||||
.c_str(),
|
||||
"w");
|
||||
if (file != nullptr) {
|
||||
std::fputs("[Version]\n", file);
|
||||
std::fputs(fmt::format("model=REV PH\n").c_str(), file);
|
||||
std::fputs(fmt::format("deviceID={:x}\n", (0x9052600 | module)).c_str(),
|
||||
file);
|
||||
std::fputs(fmt::format("currentVersion={}.{}.{}", version.FirmwareMajor,
|
||||
version.FirmwareMinor, version.FirmwareFix)
|
||||
.c_str(),
|
||||
file);
|
||||
std::fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
// Check PH firmware version
|
||||
if (version.FirmwareMajor > 0 && version.FirmwareMajor < 22) {
|
||||
throw FRC_MakeError(
|
||||
|
||||
@@ -216,17 +216,6 @@ RobotBase::RobotBase() {
|
||||
|
||||
SmartDashboard::init();
|
||||
|
||||
if constexpr (!IsSimulation()) {
|
||||
std::FILE* file = nullptr;
|
||||
file = std::fopen("/tmp/frc_versions/FRC_Lib_Version.ini", "w");
|
||||
|
||||
if (file != nullptr) {
|
||||
std::fputs("C++ ", file);
|
||||
std::fputs(GetWPILibVersion(), file);
|
||||
std::fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
// Call DriverStation::RefreshData() to kick things off
|
||||
DriverStation::RefreshData();
|
||||
}
|
||||
|
||||
@@ -10,11 +10,6 @@ import edu.wpi.first.hal.REVPHFaults;
|
||||
import edu.wpi.first.hal.REVPHJNI;
|
||||
import edu.wpi.first.hal.REVPHStickyFaults;
|
||||
import edu.wpi.first.hal.REVPHVersion;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -40,32 +35,6 @@ public class PneumaticHub implements PneumaticsBase {
|
||||
final String fwVersion =
|
||||
version.firmwareMajor + "." + version.firmwareMinor + "." + version.firmwareFix;
|
||||
|
||||
if (version.firmwareMajor > 0 && RobotBase.isReal()) {
|
||||
// Write PH firmware version to roboRIO
|
||||
final String fileName = "REV_PH_" + String.format("%02d", module) + "_WPILib_Version.ini";
|
||||
final File file = new File("/tmp/frc_versions/" + fileName);
|
||||
try {
|
||||
if (file.exists() && !file.delete()) {
|
||||
throw new IOException("Failed to delete " + fileName);
|
||||
}
|
||||
|
||||
if (!file.createNewFile()) {
|
||||
throw new IOException("Failed to create new " + fileName);
|
||||
}
|
||||
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
output.write("[Version]\n".getBytes(StandardCharsets.UTF_8));
|
||||
output.write("model=REV PH\n".getBytes(StandardCharsets.UTF_8));
|
||||
output.write(
|
||||
("deviceID=" + Integer.toHexString(0x9052600 | module) + "\n")
|
||||
.getBytes(StandardCharsets.UTF_8));
|
||||
output.write(("currentVersion=" + fwVersion).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
DriverStation.reportError("Could not write " + fileName + ": " + ex, ex.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
// Check PH firmware version
|
||||
if (version.firmwareMajor > 0 && version.firmwareMajor < 22) {
|
||||
throw new IllegalStateException(
|
||||
|
||||
@@ -15,11 +15,6 @@ import edu.wpi.first.networktables.NetworkTableEvent;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.util.WPIUtilJNI;
|
||||
import edu.wpi.first.wpilibj.util.WPILibVersion;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -297,26 +292,6 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
m_robotCopy = robot;
|
||||
m_runMutex.unlock();
|
||||
|
||||
if (!isSimulation()) {
|
||||
final File file = new File("/tmp/frc_versions/FRC_Lib_Version.ini");
|
||||
try {
|
||||
if (file.exists() && !file.delete()) {
|
||||
throw new IOException("Failed to delete FRC_Lib_Version.ini");
|
||||
}
|
||||
|
||||
if (!file.createNewFile()) {
|
||||
throw new IOException("Failed to create new FRC_Lib_Version.ini");
|
||||
}
|
||||
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
output.write("Java ".getBytes(StandardCharsets.UTF_8));
|
||||
output.write(WPILibVersion.Version.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
DriverStation.reportError("Could not write FRC_Lib_Version.ini: " + ex, ex.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
boolean errorOnExit = false;
|
||||
try {
|
||||
robot.startCompetition();
|
||||
|
||||
Reference in New Issue
Block a user