Skip to content

Commit

Permalink
MasterTrack: Fix weak region running to the very end of the track
Browse files Browse the repository at this point in the history
This is seen in some weird HFEv3 images in issue #346

Refs #346
  • Loading branch information
keirf committed Sep 5, 2023
1 parent 8d5080d commit f32e843
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/greaseweazle/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _flux(self, for_writeout, cue_at_index) -> Union[Flux, WriteoutFlux]:
# Weak regions need special processing for correct flux representation.
for s,n in self.weak:
e = s + n
assert 0 < s < e < bitlen
assert 0 < s < e <= bitlen
pattern = bitarray(endian="big")
if n < 400 or self.force_random_weak:
# Short weak regions are written with no flux transitions.
Expand All @@ -194,7 +194,7 @@ def _flux(self, for_writeout, cue_at_index) -> Union[Flux, WriteoutFlux]:
# clocked out a 0.
bits[s] = not bits[s-1]
# Similarly modify the last bit of the weak region.
bits[e-1] = not(bits[e-2] or bits[e])
bits[e-1] = not(bits[e-2] or bits[e % bitlen])

if cue_at_index:
# Rotate data to start at the index.
Expand Down

0 comments on commit f32e843

Please sign in to comment.