Move a lot of drive parameters into a toplevel drive{} config rather than

leaving them in the source/sink configs (which means they have to be set
twice).
This commit is contained in:
David Given
2022-03-13 21:13:56 +01:00
parent 9e4d99faca
commit ba3f806616
32 changed files with 87 additions and 179 deletions

View File

@@ -2,6 +2,7 @@
#include "flags.h"
#include "fluxmap.h"
#include "logger.h"
#include "proto.h"
#include "usb/usb.h"
#include "fluxsink/fluxsink.h"
#include "lib/fluxsink/fluxsink.pb.h"
@@ -10,19 +11,19 @@
class HardwareFluxSink : public FluxSink
{
public:
HardwareFluxSink(const HardwareFluxSinkProto& config):
_config(config)
HardwareFluxSink(const HardwareFluxSinkProto& conf):
_config(conf)
{
if (config.has_hard_sector_count())
if (config.drive().has_hard_sector_count())
{
nanoseconds_t oneRevolution;
int retries = 5;
usbSetDrive(_config.drive(), _config.high_density(), _config.index_mode());
usbSetDrive(config.drive().drive(), config.drive().high_density(), config.drive().index_mode());
Logger() << BeginSpeedOperationLogMessage();
do {
oneRevolution = usbGetRotationalPeriod(_config.hard_sector_count());
_hardSectorThreshold = oneRevolution * 3 / (4 * _config.hard_sector_count());
oneRevolution = usbGetRotationalPeriod(config.drive().hard_sector_count());
_hardSectorThreshold = oneRevolution * 3 / (4 * config.drive().hard_sector_count());
retries--;
} while ((oneRevolution == 0) && (retries > 0));
@@ -43,7 +44,7 @@ public:
public:
void writeFlux(int track, int side, const Fluxmap& fluxmap) override
{
usbSetDrive(_config.drive(), _config.high_density(), _config.index_mode());
usbSetDrive(config.drive().drive(), config.drive().high_density(), config.drive().index_mode());
#if 0
if (fluxSourceSinkFortyTrack)
{
@@ -60,7 +61,7 @@ public:
operator std::string () const
{
return fmt::format("drive {}", _config.drive());
return fmt::format("drive {}", config.drive().drive());
}
private: