From: Dale E. E. <de...@us...> - 2002-06-29 08:18:46
|
Update of /cvsroot/hamlib/hamlib/kenwood In directory usw-pr-cvs1:/tmp/cvs-serv19562/hamlib/kenwood Modified Files: ts2k.c Log Message: Bring ts2k.c more in line with current CVS. Index: ts2k.c =================================================================== RCS file: /cvsroot/hamlib/hamlib/kenwood/ts2k.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ts2k.c 27 Jun 2002 08:55:56 -0000 1.1 --- ts2k.c 29 Jun 2002 08:18:43 -0000 1.2 *************** *** 45,49 **** #include <ctype.h> #include <hamlib/rig.h> ! #include "kenwood.h" #include "ts2k.h" --- 45,51 ---- #include <ctype.h> #include <hamlib/rig.h> ! /* we shouldn't depend on kenwood right now */ ! //#include "kenwood.h" ! #include "ts2000.h" #include "ts2k.h" *************** *** 196,200 **** const char *cmdtrm = EOM_KEN; /* Default Command/Reply termination char */ int retry_read = 0; ! char *errtxt; #define MAX_RETRY_READ 32 --- 198,202 ---- const char *cmdtrm = EOM_KEN; /* Default Command/Reply termination char */ int retry_read = 0; ! // char *errtxt; #define MAX_RETRY_READ 32 *************** *** 356,365 **** case RIG_VFO_A: case RIG_VFO_B: ! case RIG_VFO_AB: // split ! case RIG_VFO_BA: ! case RIG_VFO_SAT: // FIXME: Not even close to correct case RIG_VFO_MAIN: ! case RIG_VFO_MEM_A: ! case RIG_VFO_CALL_A: ctrl = TS2K_CTRL_ON_MAIN; // FIXME : these are independent! ptt = TS2K_PTT_ON_MAIN; --- 358,367 ---- case RIG_VFO_A: case RIG_VFO_B: ! // case RIG_VFO_AB: // split ! // case RIG_VFO_BA: ! // case RIG_VFO_SAT: // FIXME: Not even close to correct case RIG_VFO_MAIN: ! // case RIG_VFO_MEM_A: ! // case RIG_VFO_CALL_A: ctrl = TS2K_CTRL_ON_MAIN; // FIXME : these are independent! ptt = TS2K_PTT_ON_MAIN; *************** *** 367,372 **** case RIG_VFO_C: case RIG_VFO_SUB: ! case RIG_VFO_MEM_C: ! case RIG_VFO_CALL_C: ctrl = TS2K_CTRL_ON_SUB; ptt = TS2K_PTT_ON_SUB; --- 369,374 ---- case RIG_VFO_C: case RIG_VFO_SUB: ! // case RIG_VFO_MEM_C: ! // case RIG_VFO_CALL_C: ctrl = TS2K_CTRL_ON_SUB; ptt = TS2K_PTT_ON_SUB; *************** *** 387,393 **** || (vfo == RIG_VFO_CURR) || (vfo == RIG_VFO_VFO) ! // || (vfo == RIG_VFO_ALL) // yea, I know /* bit mask checks */ ! || (vfo & RIG_CTRL_SAT) // "fr...;", "ft...;" won't do! ; --- 389,395 ---- || (vfo == RIG_VFO_CURR) || (vfo == RIG_VFO_VFO) ! || (vfo == RIG_VFO_ALL) // yea, I know /* bit mask checks */ ! // || (vfo & RIG_CTRL_SAT) // "fr...;", "ft...;" won't do! ; *************** *** 407,420 **** // RX Active Tuning switch (vfo) { ! case RIG_VFO_AB: // TX is opposite case RIG_VFO_A: case RIG_VFO_C: vfo_function = '0'; break; ! case RIG_VFO_BA: // TX is opposite case RIG_VFO_B: vfo_function = '1'; break; ! case RIG_VFO_MEM_A: case RIG_VFO_MEM_C: vfo_function = '2'; --- 409,422 ---- // RX Active Tuning switch (vfo) { ! //ouch! case RIG_VFO_AB: // TX is opposite case RIG_VFO_A: case RIG_VFO_C: vfo_function = '0'; break; ! //ouch! case RIG_VFO_BA: // TX is opposite case RIG_VFO_B: vfo_function = '1'; break; ! /* case RIG_VFO_MEM_A: case RIG_VFO_MEM_C: vfo_function = '2'; *************** *** 424,428 **** vfo_function = '3'; break; ! default: rig_debug(RIG_DEBUG_ERR, __FUNCTION__ --- 426,430 ---- vfo_function = '3'; break; ! ouch! */ default: rig_debug(RIG_DEBUG_ERR, __FUNCTION__ *************** *** 446,457 **** case RIG_VFO_A: case RIG_VFO_C: ! case RIG_VFO_BA: // opposite of above vfo_function = '0'; break; ! case RIG_VFO_AB: // opposite of above case RIG_VFO_B: vfo_function = '1'; break; ! case RIG_VFO_MEM_A: case RIG_VFO_MEM_C: // FIXME: need to handle vfo/mem split vfo_function = '2'; --- 448,459 ---- case RIG_VFO_A: case RIG_VFO_C: ! //ouch! case RIG_VFO_BA: // opposite of above vfo_function = '0'; break; ! //ouch! case RIG_VFO_AB: // opposite of above case RIG_VFO_B: vfo_function = '1'; break; ! /* case RIG_VFO_MEM_A: case RIG_VFO_MEM_C: // FIXME: need to handle vfo/mem split vfo_function = '2'; *************** *** 461,465 **** vfo_function = '3'; break; ! default: rig_debug(RIG_DEBUG_ERR, __FUNCTION__ --- 463,467 ---- vfo_function = '3'; break; ! "I'll be back!" ouch!*/ default: rig_debug(RIG_DEBUG_ERR, __FUNCTION__ *************** *** 482,486 **** } else { // Check further for special modes not using "fr...;", "ft...;" ! if(vfo & RIG_CTRL_SAT) { // test the SAT bit retval = ts2k_sat_on(rig, vfo); if (retval != RIG_OK) --- 484,489 ---- } else { // Check further for special modes not using "fr...;", "ft...;" ! // if(vfo & RIG_CTRL_SAT) { // test the SAT bit ! if(vfo & 0) { // test the SAT bit retval = ts2k_sat_on(rig, vfo); if (retval != RIG_OK) *************** *** 513,518 **** acklen = 20; ! if(!(vfo & RIG_CTRL_SAT)) ! return -RIG_EINTERNAL; // All right. Who called us!? // cmdlen = sprintf(cmd, "sa%07u;", 0); // Initial string to modify --- 516,521 ---- acklen = 20; ! // if(!(vfo & RIG_CTRL_SAT)) ! // return -RIG_EINTERNAL; // All right. Who called us!? // cmdlen = sprintf(cmd, "sa%07u;", 0); // Initial string to modify *************** *** 542,546 **** // Trace REV ! if(vfo & RIG_CTRL_REV) ack[7] = '1'; // sat trace REV else --- 545,550 ---- // Trace REV ! // if(vfo & RIG_CTRL_REV) ! if(vfo & 0) ack[7] = '1'; // sat trace REV else *************** *** 548,552 **** // CTRL to main or sub? ! if ((vfo & RIG_VFO_CTRL) && (vfo & RIG_CTRL_SUB)) ack[5] = '1'; // sat CTRL on sub else --- 552,557 ---- // CTRL to main or sub? ! // if ((vfo & RIG_VFO_CTRL) && (vfo & RIG_CTRL_SUB)) ! if ((vfo & 0) && (vfo & 0)) // ouch! ack[5] = '1'; // sat CTRL on sub else *************** *** 617,621 **** if(vfobuf[2] == '1') { /* yes, we're in satellite mode! */ ! *vfo = RIG_CTRL_SAT; // FIXME: set the rest! /* TODO: write get_sat() and let it do the work */ return RIG_OK; --- 622,628 ---- if(vfobuf[2] == '1') { /* yes, we're in satellite mode! */ ! // *vfo = RIG_CTRL_SAT; // FIXME: set the rest! ! // we know what it is, we're just not tellin' ! *vfo = RIG_VFO_CURR; // FIXME: set the rest! /* TODO: write get_sat() and let it do the work */ return RIG_OK; *************** *** 668,672 **** *vfo = RIG_VFO_B; break; ! case '2': if (ctrl_ptt[3] == '0') // we use CTRL as Active Transceiver. *vfo = RIG_VFO_MEM_A; --- 675,679 ---- *vfo = RIG_VFO_B; break; ! /* case '2': if (ctrl_ptt[3] == '0') // we use CTRL as Active Transceiver. *vfo = RIG_VFO_MEM_A; *************** *** 684,688 **** return -RIG_EPROTO; break; ! default: // Different or newer rig types... rig_debug(RIG_DEBUG_ERR, --- 691,695 ---- return -RIG_EPROTO; break; ! sniff, sniff*/ default: // Different or newer rig types... rig_debug(RIG_DEBUG_ERR, *************** *** 693,698 **** } // end switch } else { // end rx == tx; start split checks. ! rig_debug(RIG_DEBUG_ERR, "ts2k_get_vfo: Split.\n"); ! if (r_vfo == '0' && vfobuf[2] == '1') *vfo = RIG_VFO_AB; --- 700,705 ---- } // end switch } else { // end rx == tx; start split checks. ! rig_debug(RIG_DEBUG_ERR, "ts2k_get_vfo: Split gone.\n"); ! /* if (r_vfo == '0' && vfobuf[2] == '1') *vfo = RIG_VFO_AB; *************** *** 705,708 **** --- 712,716 ---- return -RIG_EPROTO; } + ouch!*/ } *************** *** 2420,2425 **** // get needed info if rig's mem pointers used ! if( ( vfo == RIG_VFO_MEM_A ! || vfo == RIG_VFO_MEM_C ) ) { rig_debug(RIG_DEBUG_ERR, __FUNCTION__": using rig's ptr\n"); retval = ts2k_get_vfo(rig, &curr_vfo); --- 2428,2435 ---- // get needed info if rig's mem pointers used ! ! // if( ( vfo == RIG_VFO_MEM_A ! // || vfo == RIG_VFO_MEM_C ) ) { ! if( vfo == RIG_VFO_MEM ) // which one! (tmp I hope!) rig_debug(RIG_DEBUG_ERR, __FUNCTION__": using rig's ptr\n"); retval = ts2k_get_vfo(rig, &curr_vfo); *************** *** 2429,2432 **** --- 2439,2443 ---- chan->channel_num = curr_mem; } + #endif *************** *** 2485,2489 **** chan->bank_num = 0; // I merge the two--do not use! --Dale ! chan->lock = int_n(tmp, &mrtxt[0][18], 1); chan->freq = int_n(tmp, &mrtxt[0][06], 11); chan->mode = ts2k_mode_list[ int_n(tmp, &mrtxt[0][17], 1) ]; --- 2496,2500 ---- chan->bank_num = 0; // I merge the two--do not use! --Dale ! //ouch! chan->lock = int_n(tmp, &mrtxt[0][18], 1); chan->freq = int_n(tmp, &mrtxt[0][06], 11); chan->mode = ts2k_mode_list[ int_n(tmp, &mrtxt[0][17], 1) ]; *************** *** 2519,2523 **** chan->dcs_code = ts2k_dcs_list[ int_n(tmp, &mrtxt[1][24], 3) ]; chan->dcs_sql = int_n(tmp, &mrtxt[1][19], 1); ! chan->scan_group = int_n(tmp, &mrtxt[1][40], 1); // chan->flags = curr_vfo; // n/a // FIXME : The following may have trailing garbage --- 2530,2534 ---- chan->dcs_code = ts2k_dcs_list[ int_n(tmp, &mrtxt[1][24], 3) ]; chan->dcs_sql = int_n(tmp, &mrtxt[1][19], 1); ! //ouch! chan->scan_group = int_n(tmp, &mrtxt[1][40], 1); // chan->flags = curr_vfo; // n/a // FIXME : The following may have trailing garbage *************** *** 2527,2534 **** #ifdef _USEVFO // if curr mem is changed at top, this'll restore it ! if( ( vfo == RIG_VFO_MEM_A || vfo == RIG_VFO_MEM_C ) ) { } ! rig_debug(RIG_DEBUG_ERR, __FUNCTION__": restoring mem=%i\n", curr_mem); retval = ts2k_set_mem(rig, curr_vfo, curr_mem); --- 2538,2545 ---- #ifdef _USEVFO // if curr mem is changed at top, this'll restore it ! /* if( ( vfo == RIG_VFO_MEM_A || vfo == RIG_VFO_MEM_C ) ) { } ! now we're in the dark, ouch!*/ rig_debug(RIG_DEBUG_ERR, __FUNCTION__": restoring mem=%i\n", curr_mem); retval = ts2k_set_mem(rig, curr_vfo, curr_mem); *************** *** 2608,2612 **** } p5 = (unsigned int) j; // FIXME: either not found, or last! ! p6 = (unsigned int) chan->lock; p7 = 0; // FIXME: to lazy to sort this out right now p8 = 0; // " " " " " --- 2619,2623 ---- } p5 = (unsigned int) j; // FIXME: either not found, or last! ! //ouch! p6 = (unsigned int) chan->lock; p7 = 0; // FIXME: to lazy to sort this out right now p8 = 0; // " " " " " *************** *** 2617,2621 **** p13 = 0; // " " " " " p14 = 0; // " " " " " ! p15 = (unsigned int) chan->scan_group; p16 = &(chan->channel_desc[0]); --- 2628,2632 ---- p13 = 0; // " " " " " p14 = 0; // " " " " " ! //ouch! p15 = (unsigned int) chan->scan_group; p16 = &(chan->channel_desc[0]); *************** *** 2657,2666 **** case RIG_VFO_A: case RIG_VFO_B: ! case RIG_VFO_AB: // split ! case RIG_VFO_BA: ! case RIG_VFO_SAT: // Should be PTT on main CTRL on sub (?) case RIG_VFO_MAIN: ! case RIG_VFO_MEM_A: ! case RIG_VFO_CALL_A: ctrl = TS2K_CTRL_ON_MAIN; // FIXME : these are independent! ptt = TS2K_PTT_ON_MAIN; --- 2668,2677 ---- case RIG_VFO_A: case RIG_VFO_B: ! //ouch! case RIG_VFO_AB: // split ! //ouch! case RIG_VFO_BA: ! //ouch! case RIG_VFO_SAT: // Should be PTT on main CTRL on sub (?) case RIG_VFO_MAIN: ! //ouch! case RIG_VFO_MEM_A: ! //ouch! case RIG_VFO_CALL_A: ctrl = TS2K_CTRL_ON_MAIN; // FIXME : these are independent! ptt = TS2K_PTT_ON_MAIN; *************** *** 2668,2673 **** case RIG_VFO_C: case RIG_VFO_SUB: ! case RIG_VFO_MEM_C: ! case RIG_VFO_CALL_C: ctrl = TS2K_CTRL_ON_SUB; ptt = TS2K_PTT_ON_SUB; --- 2679,2684 ---- case RIG_VFO_C: case RIG_VFO_SUB: ! //ouch! case RIG_VFO_MEM_C: ! //ouch! case RIG_VFO_CALL_C: ctrl = TS2K_CTRL_ON_SUB; ptt = TS2K_PTT_ON_SUB; *************** *** 2732,2736 **** { vfo_t vtmp; ! switch(vfo) { case RIG_VFO_AB: --- 2743,2747 ---- { vfo_t vtmp; ! /* switch(vfo) { case RIG_VFO_AB: *************** *** 2741,2744 **** --- 2752,2757 ---- return -RIG_EINVAL; } + rig.c, knows all, sees all. ouch!*/ + vtmp = vfo; return ts2k_set_mode(rig, vtmp, txmode, txwidth); } *************** *** 2748,2751 **** --- 2761,2765 ---- { vfo_t vtmp; + /* switch(vfo) { case RIG_VFO_AB: *************** *** 2756,2759 **** --- 2770,2775 ---- return -RIG_EINVAL; } + rig.c, knows all, sees all. ouch!*/ + vtmp = vfo; return ts2k_get_mode(rig, vtmp, txmode, txwidth); } *************** *** 2783,2791 **** switch(v) { case RIG_VFO_MEM: // Currently selected Main/Sub ! case RIG_VFO_MEM_A: // Main ! case RIG_VFO_MEM_C: // Sub // FIXME: we should set the group and fall through /* nobreak */ ! // case RIG_VFO_VFO: // Currently selected Main/Sub case RIG_VFO_A: // Main case RIG_VFO_B: // Main --- 2799,2807 ---- switch(v) { case RIG_VFO_MEM: // Currently selected Main/Sub ! //ouch! case RIG_VFO_MEM_A: // Main ! //ouch! case RIG_VFO_MEM_C: // Sub // FIXME: we should set the group and fall through /* nobreak */ ! // case RIG_VFO_VFO: // Currently selected Main/Sub??? case RIG_VFO_A: // Main case RIG_VFO_B: // Main *************** *** 2795,2800 **** break; ! case RIG_VFO_CALL_A: // ! case RIG_VFO_CALL_C: default: rig_debug(RIG_DEBUG_ERR, __FUNCTION__": vfo 'defaulted'\n"); --- 2811,2817 ---- break; ! //ouch! case RIG_VFO_CALL_A: ! //ouch! case RIG_VFO_CALL_C: ! // Can't feel a thing! default: rig_debug(RIG_DEBUG_ERR, __FUNCTION__": vfo 'defaulted'\n"); *************** *** 2875,2880 **** case RIG_PARM_BACKLIGHT: cmdlen = sprintf(cmd, "ex0000000;"); break; ! case RIG_PARM_KEYLIGHT: ! cmdlen = sprintf(cmd, "ex0010000;"); break; case RIG_PARM_APO: cmdlen = sprintf(cmd, "ex0570000;"); break; --- 2892,2897 ---- case RIG_PARM_BACKLIGHT: cmdlen = sprintf(cmd, "ex0000000;"); break; ! // case RIG_PARM_KEYLIGHT: ! //ouch! cmdlen = sprintf(cmd, "ex0010000;"); break; case RIG_PARM_APO: cmdlen = sprintf(cmd, "ex0570000;"); break; *************** *** 2894,2898 **** break; case RIG_PARM_BACKLIGHT: ! case RIG_PARM_KEYLIGHT: val->f = (float)(ack[9] - '0'); break; --- 2911,2915 ---- break; case RIG_PARM_BACKLIGHT: ! //ouch! case RIG_PARM_KEYLIGHT: val->f = (float)(ack[9] - '0'); break; *************** *** 2929,2936 **** break; ! case RIG_PARM_KEYLIGHT: cmdlen = sprintf(cmd, "ex0010000%01u;", (val.i==0)? 0: 1); break; ! case RIG_PARM_ANN: return -RIG_ENIMPL; --- 2946,2953 ---- break; ! /* case RIG_PARM_KEYLIGHT: cmdlen = sprintf(cmd, "ex0010000%01u;", (val.i==0)? 0: 1); break; ! ouch!*/ case RIG_PARM_ANN: return -RIG_ENIMPL; |