Modified the behavior of the current track location on Arduino boot. #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modified the behavior of the current track location on Arduino boot to better support other floppy drives, like SONY MPF920.
Hi Rob,
First I'd like to thank for this project. I can tell you put a lot of effort on it and it's great that you have shared it.
I've found some small issues with my floppy drive (SONY MPF920) using the current firmware code. After some trial and error I managed to drill down to the fact that my drive doesn't report track zero correctly unless the PIN_MOTOR_STEP is set to HIGH for some time. The effect of that is the goToTrack0 method keep trying to decrease the position even when the head is already at track 0 forcing the step motor. Making PIN_MOTOR_STEP HIGH at the Arduino setup solves the issue. This also seems more correct to me as after each call of stepDirectionHead the PIN_MOTOR_STEP is left at HIGH, so this could avoid potential issues (like skipping the first head move) with some floppy driver if the implementation expects the step motor to moving on the falling edge of the PIN_MOTOR_STEP pulse to low.
Another change I applied was to change the initial value of currentTrack from 0 to -1 and use this to identify an unknown head position. If a call to gotoTrackX is made with this state I've added a check to go to track 0 first, making sure the current head position is reliable. This would not affect the windows tools you provided as they always seems to call goToTrack0 before doing any of the read/write operations. But while I was playing directly with a serial terminal and with my attempts of writing my own read/write code I've realised that if you reboot the Arduino and the head is not at track 0, calling gotoTrackX is not reliable until you call goToTrack0, so I think adding this extra check will make the firmware more reliable.
Both changes are very simple and should not have any unwanted side-effects. I'd be glad if you could add mine contribution to the main project as it may benefit others suffering from similar issues.
Regards,
Paulo Duarte