Partial conversion to do automatic scaling of flux based on the disk rotation

speed. Although, something seems to have broken for 5.25" disks.
This commit is contained in:
David Given
2022-03-27 23:50:32 +02:00
parent 0da3d8b231
commit adff739a5d
51 changed files with 291 additions and 302 deletions

View File

@@ -31,7 +31,6 @@ message Fl2FluxSourceProto {
}
message FluxSourceProto {
optional double rescale = 9 [ default = 1.0, (help) = "amount to divide pulse periods by" ];
oneof source {
HardwareFluxSourceProto drive = 2;
TestPatternFluxSourceProto test_pattern = 3;

View File

@@ -54,18 +54,23 @@ public:
usbSetDrive(config.drive().drive(), config.drive().high_density(), config.drive().index_mode());
Logger() << BeginSpeedOperationLogMessage();
do
{
_oneRevolution =
usbGetRotationalPeriod(config.drive().hard_sector_count());
if (config.drive().hard_sector_count() != 0)
_hardSectorThreshold =
_oneRevolution * 3 / (4 * config.drive().hard_sector_count());
else
_hardSectorThreshold = 0;
_oneRevolution = config.drive().rotational_period_ms() * 1e6;
if (_oneRevolution == 0)
{
do
{
_oneRevolution =
usbGetRotationalPeriod(config.drive().hard_sector_count());
if (config.drive().hard_sector_count() != 0)
_hardSectorThreshold =
_oneRevolution * 3 / (4 * config.drive().hard_sector_count());
else
_hardSectorThreshold = 0;
retries--;
} while ((_oneRevolution == 0) && (retries > 0));
retries--;
} while ((_oneRevolution == 0) && (retries > 0));
config.mutable_drive()->set_rotational_period_ms(_oneRevolution / 1e6);
}
if (_oneRevolution == 0)
Error() << "Failed\nIs a disk in the drive?";