/*ARGSUSED*/ void wn_free_vect(double *vect,int len) { wn_free((ptr)vect); }
/*----------------------------------------------------------------------------*/ int three_point_cal(FORMPTR fmp) { WINDOWPTR wnp; DFORMPTR dfmp; DFIELDPTR fldp; int status,done; int score,count; double heading; char cal_msg[81]; char serial_nbr[8],unit_type[5],cal_date[9]; char hardware_rev,software_rev; latt_rpl(L_BLINK,NORMAL|BLINK,BLUE|BLINK,WHITE,LATT_SYS); latt_rpl(L_ERROR,REVERSE, RED|BLINK, WHITE,LATT_SYS); wnp = wn_def(CENTER_WN,CENTER_WN,12,60,LREVERSE,BDR_DLNP); sw_shad(TRANSPARENT,LSHADOW,BOTTOMRIGHT,wnp); sw_updnfp(wn_expset,wn_expunset,wnp); wn_up(wnp); dfmp = fm_def(12,CENTER_WN,3,25,LNORMAL,BDR_DLNP); sw_shad(TRANSPARENT,LSHADOW,BOTTOMRIGHT,dfmp->wnp); sw_updnfp(wn_expset,wn_expunset,dfmp->wnp); fldp = fld_def(0,1,"Actual Heading: ",FADJACENT,"###@#", F_DOUBLE,&heading,dfmp); sf_msg("Enter actual compass heading and press ENTER.",fldp); status = c100_open_channel(dflt_port,dflt_baud); if (status != 0) { v_printf(wnp,"Error: unable to open compass channel - %s", c100_error_name(status)); goto END; } /* if */ status = c100_halt_data(); if (status != 0) { v_printf(wnp,"Error: unable to halt data messages - %s", c100_error_name(status)); goto END; } /* if */ status = c100_get_who(serial_nbr,&software_rev,&hardware_rev, unit_type,cal_date); if (status != 0) { v_printf(wnp,"Error: unable to read software revision level. %s", c100_error_name(status)); goto END; } /* if */ if (software_rev < 'C') { v_st("\nThree Point Cal requires software revision C or higher.",wnp); v_printf(wnp,"\nThis C100 has rev %c software.",software_rev); v_st("\n\nCalibration aborted.",wnp); goto END; } /* if */ v_st("Three-Point Calibration started.\n",wnp); done = FALSE; heading = 0.0; while (!done) { status = c100_cal_mode(THREE_POINT_CAL,&heading,cal_msg); switch (status) { case OK: v_printf(wnp,"\nPosition compass to about %.0fø and enter actual" " heading.",heading); if (fm_proc(0,dfmp) != AC_EXIT) { c100_cal_mode(ABORT_CAL,NULL,NULL); v_st("\n\nCalibration aborted by user.",wnp); done = TRUE; } /* if */ break; case DONE: v_st("\n\nThree-Point calibration complete!",wnp); status = c100_get_cal_score(SHORT_SCORE,&score,&count,NULL); if (status != 0) v_printf(wnp,"\nError: unable to read cal score - %s", c100_error_name(status)); else v_printf(wnp,"\nCal score = %d, count = %d.", score,count); done = TRUE; break; case MSG_NAKKED: v_printf(wnp,"\n\nError: %s",cal_msg); c100_cal_mode(ABORT_CAL,NULL,NULL); done = TRUE; break; default: v_printf(wnp,"\n\nError: unable to complete calibration - %s", c100_error_name(status)); c100_cal_mode(ABORT_CAL,NULL,NULL); done = TRUE; break; } /* switch */ } /* while */ END: if (c100_mode == SENDING) { c100_send_data(); } /* if */ sw_title("[Press any key...]",L_BLINK,BOTTOMCENTER,wnp); v_bdr(BDR_DLNP,wnp); beep_vv(BPMEDIUM,BPLOW); beep_vv(BPMEDIUM,BPMIDDLE); beep_vv(BPMEDIUM,BPHIGH); flush_keybuf(); ki(); c100_close_channel(); fm_free(dfmp); wn_dn(wnp); wn_free(wnp); return(SAMELEVEL); } /* three_point_cal() */
void wn_freeptrarray(ptr *ptrarray) { wn_free((ptr)ptrarray); }