Merge pull request #6558 from Domppari/fdd_seek_times_set_to_default_10ms_when_audio_profile_not_selected

Setting default seek time (10ms) for fdd seeks
This commit is contained in:
Miran Grča
2025-12-14 14:55:56 +01:00
committed by GitHub
3 changed files with 8 additions and 3 deletions

View File

@@ -365,7 +365,7 @@ void
fdd_seek(int drive, int track_diff)
{
fdd_log("fdd_seek(drive=%d, track_diff=%d)\n", drive, track_diff);
if (!track_diff)
if (track_diff == 0)
return;
if (fdd_seek_in_progress[drive]) {
@@ -411,6 +411,10 @@ fdd_seek(int drive, int track_diff)
/* Get seek timings from audio profile configuration with direction awareness */
double seek_time_us = fdd_audio_get_seek_time(drive, actual_track_diff, is_seek_down);
if (seek_time_us < 1) {
seek_time_us = DEFAULT_SEEK_TIME_MS * 1000;
}
fdd_log("Seek timing for drive %d: %.2f µs (%s)\n",
drive, seek_time_us, is_seek_down ? "DOWN" : "UP");
uint64_t seek_delay_us = seek_time_us * TIMER_USEC;

View File

@@ -291,7 +291,7 @@ fdd_audio_load_profiles(void)
void
load_profile_samples(int profile_id)
{
if (profile_id <= 0 || profile_id >= audio_profile_count)
if (profile_id < 0 || profile_id >= audio_profile_count)
return;
fdd_audio_profile_config_t *config = &audio_profiles[profile_id];
@@ -444,7 +444,7 @@ double
fdd_audio_get_seek_time(int drive, int track_count, int is_seek_down)
{
int profile_id = fdd_get_audio_profile(drive);
if (profile_id <= 0 || profile_id >= audio_profile_count) {
if (profile_id < 0 || profile_id >= audio_profile_count) {
return 0;
}

View File

@@ -24,6 +24,7 @@
#define FDD_NUM 4
#define FLOPPY_IMAGE_HISTORY 10
#define SEEK_RECALIBRATE -999
#define DEFAULT_SEEK_TIME_MS 10.0
#ifdef __cplusplus
extern "C" {