From 44b5bb78c9459597b24577db6c0e8cef39c6f42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Tue, 4 May 2010 21:42:13 +0000 Subject: [PATCH] Bug report from Chris (G3WIE), with fix in ars_set_position(az), and fresh acquisition in ars_get_position. git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2905 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- ars/ars.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ars/ars.c b/ars/ars.c index 17df3ccf6..4d788b19a 100644 --- a/ars/ars.c +++ b/ars/ars.c @@ -333,7 +333,7 @@ ars_set_position(ROT *rot, azimuth_t az, elevation_t el) if (curr_az < (az-AZ_RANGE)) az_move = ROT_MOVE_RIGHT; else if (curr_az > (az+AZ_RANGE)) - az_move = ROT_MOVE_RIGHT; + az_move = ROT_MOVE_LEFT; else az_move = 0; @@ -388,6 +388,23 @@ ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el) par_lock (pport); + /* flush last sampled value, with a "short" read */ + CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK)); + usleep (PP_IO_PERIOD); + + CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CS)); + usleep (PP_IO_PERIOD); + + CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CLK)); + usleep (PP_IO_PERIOD); + + CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK)); + usleep (PP_IO_PERIOD); + + CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CS)); + /* end of "short" read */ + + for (num_sample=0; num_sample < NUM_SAMPLES; num_sample++) { /* read ADC value TLC(1)549 (8/10 bits), by SPI bitbanging */