Common out the high-density flag too.

This commit is contained in:
David Given
2021-05-07 00:27:10 +02:00
parent d00681f623
commit e912152784
10 changed files with 12 additions and 47 deletions

View File

@@ -4,9 +4,12 @@
FlagGroup fluxSourceSinkFlags;
BoolFlag fluxSourceSinkFortyTrack(
SettableFlag fluxSourceSinkFortyTrack(
{ "--40-track" },
"indicates a 40 track drive",
false);
"indicates a 40 track drive");
SettableFlag fluxSourceSinkHighDensity(
{ "--high-density", "-H" },
"set the drive to high density mode");

View File

@@ -5,7 +5,8 @@
extern FlagGroup fluxSourceSinkFlags;
extern BoolFlag fluxSourceSinkFortyTrack;
extern SettableFlag fluxSourceSinkFortyTrack;
extern SettableFlag fluxSourceSinkHighDensity;
#endif

View File

@@ -23,7 +23,6 @@ public:
virtual void writeFlux(int track, int side, Fluxmap& fluxmap) = 0;
};
extern void setHardwareFluxSinkDensity(bool high_density);
extern void setHardwareFluxSinkHardSectorCount(int sectorCount);
#endif

View File

@@ -11,8 +11,6 @@ FlagGroup hardwareFluxSinkFlags = {
&usbFlags,
};
static bool high_density = false;
static IntFlag indexMode(
{ "--write-index-mode" },
"index pulse source (0=drive, 1=300 RPM fake source, 2=360 RPM fake source",
@@ -23,11 +21,6 @@ static IntFlag hardSectorCount(
"number of hard sectors on the disk (0=soft sectors)",
0);
void setHardwareFluxSinkDensity(bool high_density)
{
::high_density = high_density;
}
void setHardwareFluxSinkHardSectorCount(int sectorCount)
{
::hardSectorCount.setDefaultValue(sectorCount);
@@ -41,7 +34,7 @@ public:
{
if (hardSectorCount != 0)
{
usbSetDrive(_drive, high_density, indexMode);
usbSetDrive(_drive, fluxSourceSinkHighDensity, indexMode);
std::cerr << "Measuring rotational speed... " << std::flush;
nanoseconds_t oneRevolution = usbGetRotationalPeriod(hardSectorCount);
_hardSectorThreshold = oneRevolution * 3 / (4 * hardSectorCount);
@@ -58,7 +51,7 @@ public:
public:
void writeFlux(int track, int side, Fluxmap& fluxmap)
{
usbSetDrive(_drive, high_density, indexMode);
usbSetDrive(_drive, fluxSourceSinkHighDensity, indexMode);
if (fluxSourceSinkFortyTrack)
{
if (track & 1)

View File

@@ -28,7 +28,6 @@ public:
};
extern void setHardwareFluxSourceRevolutions(double revolutions);
extern void setHardwareFluxSourceDensity(bool high_density);
extern void setHardwareFluxSourceSynced(bool synced);
extern void setHardwareFluxSourceHardSectorCount(int sectorCount);

View File

@@ -31,20 +31,13 @@ static IntFlag hardSectorCount(
"number of hard sectors on the disk (0=soft sectors)",
0);
static bool high_density = false;
void setHardwareFluxSourceDensity(bool high_density)
{
::high_density = high_density;
}
class HardwareFluxSource : public FluxSource
{
public:
HardwareFluxSource(unsigned drive):
_drive(drive)
{
usbSetDrive(_drive, high_density, indexMode);
usbSetDrive(_drive, fluxSourceSinkHighDensity, indexMode);
std::cerr << "Measuring rotational speed... " << std::flush;
_oneRevolution = usbGetRotationalPeriod(hardSectorCount);
if (hardSectorCount != 0)
@@ -61,7 +54,7 @@ public:
public:
std::unique_ptr<Fluxmap> readFlux(int track, int side)
{
usbSetDrive(_drive, high_density, indexMode);
usbSetDrive(_drive, fluxSourceSinkHighDensity, indexMode);
if (fluxSourceSinkFortyTrack)
{
if (track & 1)

View File

@@ -58,10 +58,6 @@ static IntFlag retries(
"How many times to retry each track in the event of a read failure.",
5);
static SettableFlag highDensityFlag(
{ "--high-density", "--hd" },
"set the drive to high density mode");
static StringFlag csvFile(
{ "--write-csv" },
"write a CSV report of the disk state",
@@ -117,8 +113,6 @@ std::vector<std::unique_ptr<Track>> readTracks()
std::cout << "Reading from: " << source << std::endl;
setHardwareFluxSourceDensity(highDensityFlag);
if (!destination.get().empty())
{
std::cout << "Writing a copy of the flux to " << destination.get() << std::endl;

View File

@@ -27,10 +27,6 @@ static DataSpecFlag input(
"input image file to read from",
"");
static SettableFlag highDensityFlag(
{ "--high-density", "-H" },
"set the drive to high density mode");
static sqlite3* outdb;
void setWriterDefaultDest(const std::string& dest)
@@ -60,9 +56,6 @@ void writeTracks(
std::cout << "Writing to: " << dest << std::endl;
setHardwareFluxSourceDensity(highDensityFlag);
setHardwareFluxSinkDensity(highDensityFlag);
std::shared_ptr<FluxSink> fluxSink = FluxSink::create(spec);
for (const auto& location : spec.locations)

View File

@@ -22,10 +22,6 @@ static StringFlag output(
"output AU file to write",
"output.au");
static SettableFlag highDensityFlag(
{ "--high-density", "--hd" },
"set the drive to high density mode");
static SettableFlag withIndex(
{ "--with-index" },
"place index markers in the right hand channel");
@@ -41,7 +37,6 @@ int mainConvertFluxToAu(int argc, const char* argv[])
const auto& location = *(locations.begin());
std::cerr << "Reading source flux...\n";
setHardwareFluxSourceDensity(highDensityFlag);
std::shared_ptr<FluxSource> fluxsource = FluxSource::create(spec);
const auto& fluxmap = fluxsource->readFlux(location.track, location.side);
unsigned totalTicks = fluxmap->ticks() + 2;

View File

@@ -22,10 +22,6 @@ static StringFlag output(
"output VCD file to write",
"output.vcd");
static SettableFlag highDensityFlag(
{ "--high-density", "--hd" },
"set the drive to high density mode");
int mainConvertFluxToVcd(int argc, const char* argv[])
{
flags.parseFlags(argc, argv);
@@ -37,7 +33,6 @@ int mainConvertFluxToVcd(int argc, const char* argv[])
const auto& location = *(locations.begin());
std::cerr << "Reading source flux...\n";
setHardwareFluxSourceDensity(highDensityFlag);
std::shared_ptr<FluxSource> fluxsource = FluxSource::create(spec);
const auto& fluxmap = fluxsource->readFlux(location.track, location.side);