Don't retry reads if we're not talking to actual hardware.

Fixes #18.
This commit is contained in:
David Given
2019-02-24 23:57:46 +01:00
parent 58c4f14f3e
commit 75a321beef
4 changed files with 17 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ public:
public:
virtual std::unique_ptr<Fluxmap> readFlux(int track, int side) = 0;
virtual void recalibrate() {}
virtual bool retryable() { return false; }
};
extern void setHardwareFluxReaderRevolutions(int revolutions);

View File

@@ -29,10 +29,16 @@ public:
return usbRead(side, revolutions);
}
void recalibrate() {
void recalibrate()
{
usbRecalibrate();
}
bool retryable()
{
return true;
}
private:
unsigned _drive;
unsigned _revolutions;

View File

@@ -65,6 +65,11 @@ void Track::recalibrate()
_fluxReader->recalibrate();
}
bool Track::retryable()
{
return _fluxReader->retryable();
}
std::vector<std::unique_ptr<Track>> readTracks()
{
const DataSpec& dataSpec = source.value;
@@ -172,6 +177,9 @@ void readDiskCommand(AbstractDecoder& decoder, const std::string& outputFilename
std::cout << std::endl
<< " ";
if (!track->retryable())
break;
if (retry == 0)
std::cout << "giving up" << std::endl
<< " ";

View File

@@ -20,6 +20,7 @@ public:
public:
std::unique_ptr<Fluxmap> read();
void recalibrate();
bool retryable();
unsigned track;
unsigned side;