mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Add option to rescale flux sink pulses.
Note that this does not affect the decoder used for verify, but at least for tame rescaling the decoders are still able to lock. This is a precursor to automatic scaling via the disk speed measurement.
This commit is contained in:
@@ -108,3 +108,22 @@ std::vector<Fluxmap> Fluxmap::split() {
|
||||
maps.push_back(map);
|
||||
return maps;
|
||||
}
|
||||
|
||||
void Fluxmap::rescale(double scale) {
|
||||
if (scale != 1.0) {
|
||||
auto bytesOrig = _bytes;
|
||||
_bytes = Bytes();
|
||||
_duration = 0;
|
||||
_ticks = 0;
|
||||
int lastEvent = 0;
|
||||
for (unsigned i=0; i<bytesOrig.size(); i++)
|
||||
{
|
||||
lastEvent += bytesOrig[i] & 0x3f;
|
||||
if (bytesOrig[i] & 0xc0) {
|
||||
appendInterval(lastEvent * scale + 0.5);
|
||||
findLastByte() |= bytesOrig[i] & 0xc0;
|
||||
lastEvent = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
|
||||
void precompensate(int threshold_ticks, int amount_ticks);
|
||||
std::vector<Fluxmap> split();
|
||||
void rescale(double scale);
|
||||
|
||||
private:
|
||||
uint8_t& findLastByte();
|
||||
|
||||
@@ -29,6 +29,7 @@ message Fl2FluxSinkProto {
|
||||
}
|
||||
|
||||
message FluxSinkProto {
|
||||
optional double rescale = 7 [ default = 1.0, (help) = "amount to multiply pulse periods by" ];
|
||||
oneof dest {
|
||||
string fluxfile = 1 [(help) = "name of destination flux file"];
|
||||
HardwareFluxSinkProto drive = 2;
|
||||
|
||||
@@ -40,6 +40,7 @@ void writeTracks(
|
||||
}
|
||||
else
|
||||
{
|
||||
fluxmap->rescale(config.flux_sink().rescale());
|
||||
/* Precompensation actually seems to make things worse, so let's leave
|
||||
* it disabled for now. */
|
||||
//fluxmap->precompensate(PRECOMPENSATION_THRESHOLD_TICKS, 2);
|
||||
@@ -77,6 +78,7 @@ void writeTracksAndVerify(
|
||||
}
|
||||
else
|
||||
{
|
||||
fluxmap->rescale(config.flux_sink().rescale());
|
||||
std::sort(sectors.begin(), sectors.end(), sectorPointerSortPredicate);
|
||||
|
||||
for (int retry = 0;; retry++)
|
||||
|
||||
Reference in New Issue
Block a user