mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user