Merge from master.

This commit is contained in:
David Given
2021-05-27 23:39:53 +02:00
8 changed files with 53 additions and 17 deletions

View File

@@ -33,7 +33,7 @@ jobs:
steps:
- uses: msys2/setup-msys2@v2
with:
update: false
update: true
msystem: MINGW32
install: >-
make

View File

@@ -14,7 +14,7 @@ jobs:
steps:
- uses: msys2/setup-msys2@v2
with:
update: false
update: true
msystem: MINGW32
install: >-
make

View File

@@ -20,7 +20,7 @@ export AR = /mingw32/bin/ar rcs
export STRIP = /mingw32/bin/strip
export CFLAGS += -I/mingw32/include/libusb-1.0 -I/mingw32/include
export LDFLAGS +=
export LIBS += -L/mingw32/lib -lz -lsqlite3 -lusb-1.0 -lprotobuf
export LIBS += -L/mingw32/lib -static -lz -lsqlite3 -lusb-1.0 -lprotobuf
export EXTENSION = .exe
else

View File

@@ -188,7 +188,8 @@ install some support packages.
`libudev-dev`.
- For OSX with Homebrew: `ninja`, `libusb`, `pkg-config`, `sqlite`.
- For Windows with MSYS2: `make`, `ninja`, `mingw-w64-i686-libusb`,
`mingw-w64-i686-sqlite3`, `mingw-w64-i686-zlib`, `mingw-w64-i686-gcc`.
`mingw-w64-i686-protobuf`, `mingw-w64-i686-sqlite3`, `mingw-w64-i686-zlib`,
`mingw-w64-i686-gcc`.
These lists are not necessarily exhaustive --- please [get in
touch](https://github.com/davidgiven/fluxengine/issues/new) if I've missed

View File

@@ -14,11 +14,22 @@ public:
{
if (config.has_hard_sector_count())
{
int rotationalSpeedMs;
int retries = 5;
usbSetDrive(_config.drive(), _config.high_density(), _config.index_mode());
std::cerr << "Measuring rotational speed... " << std::flush;
nanoseconds_t oneRevolution = usbGetRotationalPeriod(_config.hard_sector_count());
_hardSectorThreshold = oneRevolution * 3 / (4 * _config.hard_sector_count());
std::cerr << fmt::format("{}ms\n", oneRevolution / 1e6);
std::cout << "Measuring rotational speed... " << std::flush;
do {
nanoseconds_t oneRevolution = usbGetRotationalPeriod(_config.hard_sector_count());
_hardSectorThreshold = oneRevolution * 3 / (4 * _config.hard_sector_count());
rotationalSpeedMs = oneRevolution / 1e6;
retries--;
} while ((rotationalSpeedMs == 0) && (retries > 0));
if (rotationalSpeedMs == 0) {
Error() << "Failed\nIs a disk in the drive?";
}
std::cout << fmt::format("{}ms\n", rotationalSpeedMs);
}
else
_hardSectorThreshold = 0;

View File

@@ -12,14 +12,27 @@ public:
HardwareFluxSource(const HardwareFluxSourceProto& config):
_config(config)
{
int rotationalSpeedMs;
int retries = 5;
usbSetDrive(_config.drive(), _config.high_density(), _config.index_mode());
std::cerr << "Measuring rotational speed... " << std::flush;
_oneRevolution = usbGetRotationalPeriod(_config.hard_sector_count());
if (_config.hard_sector_count() != 0)
_hardSectorThreshold = _oneRevolution * 3 / (4 * _config.hard_sector_count());
else
_hardSectorThreshold = 0;
std::cerr << fmt::format("{}ms\n", _oneRevolution / 1e6);
std::cout << "Measuring rotational speed... " << std::flush;
do {
_oneRevolution = usbGetRotationalPeriod(_config.hard_sector_count());
if (_config.hard_sector_count() != 0)
_hardSectorThreshold = _oneRevolution * 3 / (4 * _config.hard_sector_count());
else
_hardSectorThreshold = 0;
rotationalSpeedMs = _oneRevolution / 1e6;
retries--;
} while ((rotationalSpeedMs == 0) && (retries > 0));
if (rotationalSpeedMs == 0) {
Error() << "Failed\nIs a disk in the drive?";
}
std::cout << fmt::format("{}ms\n", rotationalSpeedMs);
}
~HardwareFluxSource()

View File

@@ -119,7 +119,18 @@ void ImageWriter::printMap(const SectorSet& sectors)
int badSectors = 0;
int missingSectors = 0;
int totalSectors = 0;
std::cout << "H.SS Tracks --->" << std::endl;
std::cout << " Tracks -> 1 2 3 ";
if (numCylinders > 40) {
std::cout << "4 5 6 7 8";
}
std::cout << std::endl;
std::cout << "H.SS 0123456789012345678901234567890123456789";
if (numCylinders > 40) {
std::cout << "01234567890123456789012345678901234567890123";
}
std::cout << std::endl;
for (int head = 0; head < numHeads; head++)
{
for (int sectorId = 0; sectorId < numSectors; sectorId++)

View File

@@ -52,7 +52,7 @@ public:
}
}
std::cout << fmt::format("written {} tracks, {} sides, {} kB total\n",
std::cout << fmt::format("wrote {} tracks, {} sides, {} kB total\n",
tracks, sides,
outputFile.tellp() / 1024);
}