Greying out of the option buttons now works; but the whole way configs are

handled is pretty unsatisfactory and needs work.
This commit is contained in:
dg
2023-05-13 23:29:34 +00:00
parent dd8cc7bfd4
commit 4daaec46a7
10 changed files with 190 additions and 176 deletions

View File

@@ -14,54 +14,48 @@ private:
class HardwareFluxSourceIterator : public FluxSourceIterator
{
public:
HardwareFluxSourceIterator(
const HardwareFluxSource& fluxsource, int track, int head):
_fluxsource(fluxsource),
HardwareFluxSourceIterator(int track, int head):
_track(track),
_head(head)
{
}
bool hasNext() const
bool hasNext() const override
{
return true;
}
std::unique_ptr<const Fluxmap> next()
std::unique_ptr<const Fluxmap> next() override
{
usbSetDrive(globalConfig()->drive().drive(),
globalConfig()->drive().high_density(),
globalConfig()->drive().index_mode());
const auto& drive = globalConfig()->drive();
usbSetDrive(
drive.drive(), drive.high_density(), drive.index_mode());
usbSeek(_track);
Bytes data = usbRead(_head,
globalConfig()->drive().sync_with_index(),
globalConfig()->drive().revolutions() *
_fluxsource._oneRevolution,
_fluxsource._hardSectorThreshold);
drive.sync_with_index(),
drive.revolutions() * drive.rotational_period_ms() * 1e6,
drive.hard_sector_threshold_ns());
auto fluxmap = std::make_unique<Fluxmap>();
fluxmap->appendBytes(data);
return fluxmap;
}
private:
const HardwareFluxSource& _fluxsource;
int _track;
int _head;
};
public:
HardwareFluxSource(const HardwareFluxSourceProto& conf): _config(conf)
{
measureDiskRotation(_oneRevolution, _hardSectorThreshold);
}
HardwareFluxSource(const HardwareFluxSourceProto& conf): _config(conf) {}
~HardwareFluxSource() {}
public:
std::unique_ptr<FluxSourceIterator> readFlux(int track, int head) override
{
return std::make_unique<HardwareFluxSourceIterator>(*this, track, head);
return std::make_unique<HardwareFluxSourceIterator>(track, head);
}
void recalibrate() override
@@ -81,8 +75,7 @@ public:
private:
const HardwareFluxSourceProto& _config;
nanoseconds_t _oneRevolution;
nanoseconds_t _hardSectorThreshold;
bool _measured;
};
std::unique_ptr<FluxSource> FluxSource::createHardwareFluxSource(