Init revision - tnx Stephane

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2680 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.10
Martin Ewing, AA6E 2009-03-21 18:17:30 +00:00
rodzic 672c9fca85
commit d6b03e41ea
1 zmienionych plików z 9 dodań i 15 usunięć

Wyświetl plik

@ -232,29 +232,23 @@ int tt565_cleanup(RIG *rig)
*/ */
int tt565_open(RIG *rig) int tt565_open(RIG *rig)
{ {
int current_size, min_size;
cal_table_t cal1 = TT565_STR_CAL_V1, cal2 = TT565_STR_CAL_V2; cal_table_t cal1 = TT565_STR_CAL_V1, cal2 = TT565_STR_CAL_V2;
char *buf; char *buf;
/* Detect version 1 or version 2 firmware. V2 is default. */ /* Detect version 1 or version 2 firmware. V2 is default. */
/* The only difference from Hamlib's viewpoint is the S-meter cal table */ /* The only difference for us is the S-meter cal table */
/* The rig caps size value was set at initialization in orion.h */
/* Get Orion's Version string (?V command response) */ /* Get Orion's Version string (?V command response) */
buf = (char *)tt565_get_info(rig); buf = (char *)tt565_get_info(rig);
current_size = rig->caps->str_cal.size; /* Is Orion firmware version 1.* or 2.*? */
if (!strstr(buf, "1.")) { /* Version 1.xxx ? */ if (!strstr(buf, "1.")) {
/* Not version 1 -> probably version 2 */ /* Not v1 means probably v2 */
/* Need to be sure we aren't exceeding initialized memory */ memcpy(&rig->state.str_cal, &cal2, sizeof(cal_table_t));
min_size = current_size < cal2.size ? current_size : cal2.size; }
memcpy(&rig->caps->str_cal, &cal2, sizeof(int)*(2*min_size+1)); else {
} memcpy(&rig->state.str_cal, &cal1, sizeof(cal_table_t));
else { }
/* Version 1 */
min_size = current_size < cal1.size ? current_size : cal1.size;
memcpy(&rig->caps->str_cal, &cal1, sizeof(int)*(2*min_size+1));
}
return RIG_OK; return RIG_OK;
} }