void InputEquatSlewDat( void) { /* read (rb) slew.dat where: R <Ra degrees> D <Dec degrees> p <Alt degrees> q <Az degrees> ... t <time()> <JD> L <lat> <long> */ Input = fopen( FullyQualifiedSlewFile, "r"); if( Input == NULL) PressKeyToContMsg( "Could not read slew file"); else { do fscanf( Input, "%s", Name); while( strcmpi( Name, "R") != 0); FReadDouble( Input, &In.Ra); In.Ra /= RadToDeg; do fscanf( Input, "%s", Name); while( strcmpi( Name, "D") != 0); FReadDouble( Input, &In.Dec); In.Dec /= RadToDeg; fclose( Input); DisplayIn( "from guide (Ra, Dec)", NameBlanks); } }
void ReadGuideStartup( void) { double RaDeg, DecDeg; struct HMSH RaHMSH; struct DMS DecDMS; Flag RaFlag = No; Flag DecFlag = No; Input = fopen( GuideStartupMarFilePtr, "r"); if( Input == NULL) BadExit( strcat( "ReadGuideStartup(): Could not open ", GuideStartupMarFilePtr)); fscanf( Input, "%s", Name); while( !feof( Input) && !RaFlag || !DecFlag) { if( (strncmpi( Name, "ra", sizeof( Name))) == 0) { FReadDouble( Input, &RaDeg); RaDeg = 360. - RaDeg; RaFlag = Yes; } else if( (strncmpi( Name, "dec", sizeof( Name))) == 0) { FReadDouble( Input, &DecDeg); DecFlag = Yes; } fscanf( Input, "%s", Name); } fclose( Input); if( RaFlag && DecFlag) { In.Ra = RaDeg*DegToRad; In.Dec = DecDeg*DegToRad; DisplayIn( "from Guide", NameBlanks); /* write to OutGuideFile, preserving a record of all positions returned from Guide */ GetHMSH( In.Ra*RadToHundSec + .5, &RaHMSH); GetDMS( In.Dec*RadToArcsec + .5, &DecDMS); if( In.Dec < 0) if( DecDMS.Deg > 0) DecDMS.Deg = -DecDMS.Deg; else if( DecDMS.Min > 0) DecDMS.Min = -DecDMS.Min; else DecDMS.Sec = -DecDMS.Sec; fprintf( OutGuideFilePtr, "%3d %3d %3d %3d %3d %3d from_guide\n", RaHMSH.Hr, RaHMSH.Min, RaHMSH.Sec, DecDMS.Deg, DecDMS.Min, DecDMS.Sec); } }
void ReadConfig( void) { char C; int I; char StrCompare[MaxStr]; /* defaults */ DefaultBackground = 0; DefaultColor = 7; TitleColor = 9; BorderColor = 1; MenuColor = 12; DisplayColor = 12; SelectColor = 0; CurrentColor = 14; SelectBackground = 4; ConfirmQuit = 0; DisplayOpeningMsgs = 1; HorizonLimitFlag = 0; MoveHsMsgDeg = 10; HotkeyF9 = HotkeyF10 = HotkeyF11 = HotkeyF12 = 0; HotkeyF9Set = HotkeyF10Set = HotkeyF11Set = HotkeyF12Set = False; InterfacePath = "C:\\GUIDE\\"; UseMouseFlag = 0; IACA_Flag = 0; WriteInitHistoryFlag = 1; GEMFlipPossible = 0; AutoGEMFlip = 0; AutoGEMFlipOnFuzzDeg = 0; AutoGEMFlipOffFuzzDeg = 0; Siderostat = 0; HomeAltDeg = 0; HomeAzDeg = 0; MsArcsecSec = 300; precessionNutationAberration = 0; RefractFlag = 0; UseAltAzECFlag = 0; UseAltAltECFlag = 0; UseAzAzECFlag = 0; PointingModelFlag = 0; HandpadPresentFlag = 1; StartingHandpadMode = HandpadOff; HandpadDesign = StandardHandpad; UpDownButtonsReversedFlag = Off; HandpadFlipUpDownWithGEMFlip = Off; AltBacklashArcmin = 0; AzBacklashArcmin = 0; ABacklashSignalPPortPin17 = 0; AltLowLimitDeg = 0; AltHighLimitDeg = 0; AzLowLimitDeg = 0; AzHighLimitDeg = 0; GuideArcsecSec = 5; GuideDragAltArcsecPerMin = 10; GuideDragAzArcsecPerMin = 10; GuideDragRaArcsecPerMin = 10; GuideDragDecArcsecPerMin = 10; HPUpdateDriftFlag = Yes; DriftAltArcsecPerMin = 0; DriftAzArcsecPerMin = 0; DriftRaDegPerHr = 0; DriftDecDegPerHr = 0; PECFlag = 0; AutoAltPECPin = 17; AutoAltPECSyncOnFlag = 0; AutoAltPECSyncLowHighFlag = 1; AutoAltPECSyncDirFlag = 0; AutoAltPECDeBounce = 0; AutoAzPECPin = 15; AutoAzPECSyncOnFlag = 0; AutoAzPECSyncLowHighFlag = 1; AutoAzPECSyncDirFlag = 0; AutoAzPECDeBounce = 0; FullstepsPerPECArray = 200; PECIxOffset.A = 0; PECIxOffset.Z = 0; FRStepSizeArcsec = 60; SectoredFRDrive = 1; FRStepSpeedMilliSec = 20; ReverseFRMotor = 0; FocusMethod = 0; ReverseFocusMotor = 0; FocusFastStepsSec = 2; FocusSlowStepsSec = 1; FocusPosition = 0; MotorControlMethod = 0; MotorWindings = 4; InvertOutput = 1; KeepAlivePPortPin = 0; AltFullStepSizeArcsec = 3; AzFullStepSizeArcsec = 3; AzFullStepSizeArcsecCW = 0; AzFullStepSizeArcsecCCW = 0; ReverseAMotor = 0; ReverseZMotor = 0; HsRampStyle = 1; HsTimerFlag = 1; MaxDelay = 1000; MinDelay = 300; HsDelayX = 2; HsRampX = 5; InterruptHs = 100; HoldReps = 20; HsOverVoltageControl = 0; MaxConsecutiveSlews = 5; MsPowerDownSec = 5; PWMRepsTick = 35; AvgPWMRepsTickOnFlag = 1; MsDelayX = 6; MsPause = 500; Ms = 10; MaxIncrMsPerPWMWasRead = False; MsHsToggleIncrMsPerPWMWasRead = False; MaxPWM = 100; UseComplexPWMFlag = UseComplexPWMZFlag = No; /* zero out PWM[] arrays */ for( Ix = 0; Ix < MaxMs; Ix++) { PWM[Ix].A = 0; PWM[Ix].Z = 0; PWMZ[Ix].A = 0; PWMZ[Ix].Z = 0; } PWM[0].A = 100; PWM[1].A = 100; PWM[2].A = 100; PWM[3].A = 100; PWM[4].A = 100; PWM[5].A = 100; PWM[6].A = 85; PWM[7].A = 70; PWM[8].A = 55; PWM[9].A = 35; UsePWMZFlag = No; SavePWMComp = No; /* 5 is max # of motor windings */ for( Ix = 0; Ix < 5; Ix++) PWM_A_Comp[Ix] = PWM_Z_Comp[Ix] = 1.; UseQSC = No; for( Ix = 0; Ix < sizeofQSC; Ix++) QSCvalues[Ix].A = QSCvalues[Ix].Z = 0; PPortAddr = 1; // add a couple of default eyepieces: must be <= MAX_EYEPIECES Eyepieces = 2; EPFocusPosition[0].Position = 100; strcpy( EPFocusPosition[0].Name, "EyePiece20mm"); EPFocusPosition[1].Position = 200; strcpy( EPFocusPosition[1].Name, "EyePiece9mm"); CommPort[Com3].Base = 0x3E8; CommPort[Com4].Base = 0x2E8; CommPort[Com3].IRQ = 4; CommPort[Com4].IRQ = 3; EncoderString = "NoEncoders"; EncoderComPort = 0; EncoderBaudRate = 9600; SerialWriteDelayMs = 50; AltEncoderCountsPerRev = 8192; AzEncoderCountsPerRev = 8192; AltEncoderDir = 1; AzEncoderDir = 0; EncoderErrorThresholdDeg = 0; TrackEncoderErrorThresholdDeg = 0; MakeEncoderResetLogFile = No; EncoderOffset.A = 0; EncoderOffset.Z = 0; LX200ComPort = 0; LX200BaudRate = 9600; LX200MotionTimeoutSec = 5; LX200SlewHs = 10000L; LX200_LongFormat = 0; Current.Alt = 0; Current.Az = 0; AccumMs.A = 0; AccumMs.Z = 0; StartInitState = 0; One.Init = No; Two.Init = No; Three.Init = No; Z1Deg = 0; Z2Deg = 0; Z3Deg = 0; DataFileCoordYear = 2000; LatitudeDeg = 44; CMOS_RTC_Access = 0; LongitudeDeg = 123; Height = 0; Tz = 8; DST = 1; TestString = "NoTest"; MaxPWMFoundFlag = No; Input = fopen( ConfigFile, "r"); if( Input == NULL) if( DisplayOpeningMsgs) { printf( "Warning: no %s found, using default values.\n", ConfigFile); ContMsgRoutine(); } else BadExit( strcat( "Could not open ", ConfigFile)); else fscanf( Input, "%s", Name); while( Input!=NULL && !feof( Input)) { /* if 1st char is ';' or '[' then goto next line */ if( Name[0] == ';' || Name[0] == '[') FReadToNewLine( Input); if( (strncmpi( Name, "DefaultBackground", sizeof( Name))) == 0) FReadInt( Input, &DefaultBackground); if( (strncmpi( Name, "DefaultColor", sizeof( Name))) == 0) FReadInt( Input, &DefaultColor); if( (strncmpi( Name, "TitleColor", sizeof( Name))) == 0) FReadInt( Input, &TitleColor); if( (strncmpi( Name, "BorderColor", sizeof( Name))) == 0) FReadInt( Input, &BorderColor); if( (strncmpi( Name, "MenuColor", sizeof( Name))) == 0) FReadInt( Input, &MenuColor); if( (strncmpi( Name, "DisplayColor", sizeof( Name))) == 0) FReadInt( Input, &DisplayColor); if( (strncmpi( Name, "SelectColor", sizeof( Name))) == 0) FReadInt( Input, &SelectColor); if( (strncmpi( Name, "CurrentColor", sizeof( Name))) == 0) FReadInt( Input, &CurrentColor); if( (strncmpi( Name, "SelectBackground", sizeof( Name))) == 0) FReadInt( Input, &SelectBackground); if( (strncmpi( Name, "ConfirmQuit", sizeof( Name))) == 0) FReadFlag( Input, &ConfirmQuit); if( (strncmpi( Name, "DisplayOpeningMsgs", sizeof( Name))) == 0) FReadFlag( Input, &DisplayOpeningMsgs); if( (strncmpi( Name, "HorizonLimitFlag", sizeof( Name))) == 0) FReadFlag( Input, &HorizonLimitFlag); if( (strncmpi( Name, "MoveHsMsgDeg", sizeof( Name))) == 0) FReadDouble( Input, &MoveHsMsgDeg); if( (strncmpi( Name, "HotkeyF9", sizeof( Name))) == 0) { FReadInt( Input, &HotkeyF9); HotkeyF9Set = True; } if( (strncmpi( Name, "HotkeyF10", sizeof( Name))) == 0) { FReadInt( Input, &HotkeyF10); HotkeyF10Set = True; } if( (strncmpi( Name, "HotkeyF11", sizeof( Name))) == 0) { FReadInt( Input, &HotkeyF11); HotkeyF11Set = True; } if( (strncmpi( Name, "HotkeyF12", sizeof( Name))) == 0) { FReadInt( Input, &HotkeyF12); HotkeyF12Set = True; } if( (strncmpi( Name, "InterfacePath", sizeof( Name))) == 0) FReadStringToCharCountOrNewLine( Input, InterfacePath, sizeof( Name)); if( (strncmpi( Name, "UseMouseFlag", sizeof( Name))) == 0) FReadFlag( Input, &UseMouseFlag); if( (strncmpi( Name, "IACA_Flag", sizeof( Name))) == 0) FReadFlag( Input, &IACA_Flag); if( (strncmpi( Name, "WriteInitHistoryFlag", sizeof( Name))) == 0) FReadFlag( Input, &WriteInitHistoryFlag); if( (strncmpi( Name, "GEMFlipPossible", sizeof( Name))) == 0) FReadFlag( Input, &GEMFlipPossible); if( (strncmpi( Name, "AutoGEMFlip", sizeof( Name))) == 0) FReadFlag( Input, &AutoGEMFlip); if( (strncmpi( Name, "AutoGEMFlipOnFuzzDeg", sizeof( Name))) == 0) FReadDouble( Input, &AutoGEMFlipOnFuzzDeg); if( (strncmpi( Name, "AutoGEMFlipOffFuzzDeg", sizeof( Name))) == 0) FReadDouble( Input, &AutoGEMFlipOffFuzzDeg); if( (strncmpi( Name, "Siderostat", sizeof( Name))) == 0) FReadFlag( Input, &Siderostat); if( (strncmpi( Name, "HomeAltDeg", sizeof( Name))) == 0) FReadDouble( Input, &HomeAltDeg); if( (strncmpi( Name, "HomeAzDeg", sizeof( Name))) == 0) FReadDouble( Input, &HomeAzDeg); if( (strncmpi( Name, "MsArcsecSec", sizeof( Name))) == 0) FReadInt( Input, &MsArcsecSec); if( (strncmpi( Name, "precessionNutationAberration", sizeof( Name))) == 0) FReadFlag( Input, &precessionNutationAberration); if( (strncmpi( Name, "RefractFlag", sizeof( Name))) == 0) FReadInt( Input, &RefractFlag); if( (strncmpi( Name, "UseAltAzECFlag", sizeof( Name))) == 0) FReadFlag( Input, &UseAltAzECFlag); if( (strncmpi( Name, "UseAltAltECFlag", sizeof( Name))) == 0) FReadFlag( Input, &UseAltAltECFlag); if( (strncmpi( Name, "UseAzAzECFlag", sizeof( Name))) == 0) FReadFlag( Input, &UseAzAzECFlag); if( (strncmpi( Name, "PointingModelFlag", sizeof( Name))) == 0) FReadFlag( Input, &PointingModelFlag); if( (strncmpi( Name, "HandpadPresentFlag", sizeof( Name))) == 0) FReadFlag( Input, &HandpadPresentFlag); if( (strncmpi( Name, "StartingHandpadMode", sizeof( Name))) == 0) FReadInt( Input, &StartingHandpadMode); if( (strncmpi( Name, "HandpadDesign", sizeof( Name))) == 0) FReadInt( Input, &HandpadDesign); if( (strncmpi( Name, "UpDownButtonsReversedFlag", sizeof( Name))) == 0) FReadFlag( Input, &UpDownButtonsReversedFlag); if( (strncmpi( Name, "HandpadFlipUpDownWithGEMFlip", sizeof( Name))) == 0) FReadFlag( Input, &HandpadFlipUpDownWithGEMFlip); if( (strncmpi( Name, "AltBacklashArcmin", sizeof( Name))) == 0) FReadDouble( Input, &AltBacklashArcmin); if( (strncmpi( Name, "AzBacklashArcmin", sizeof( Name))) == 0) FReadDouble( Input, &AzBacklashArcmin); if( (strncmpi( Name, "ABacklashSignalPPortPin17", sizeof( Name))) == 0) FReadFlag( Input, &ABacklashSignalPPortPin17); if( (strncmpi( Name, "AltLowLimitDeg", sizeof( Name))) == 0) FReadDouble( Input, &AltLowLimitDeg); if( (strncmpi( Name, "AltHighLimitDeg", sizeof( Name))) == 0) FReadDouble( Input, &AltHighLimitDeg); if( (strncmpi( Name, "AzLowLimitDeg", sizeof( Name))) == 0) FReadDouble( Input, &AzLowLimitDeg); if( (strncmpi( Name, "AzHighLimitDeg", sizeof( Name))) == 0) FReadDouble( Input, &AzHighLimitDeg); if( (strncmpi( Name, "GuideArcsecSec", sizeof( Name))) == 0) FReadInt( Input, &GuideArcsecSec); if( (strncmpi( Name, "GuideDragAltArcsecPerMin", sizeof( Name))) == 0) FReadDouble( Input, &GuideDragAltArcsecPerMin); if( (strncmpi( Name, "GuideDragAzArcsecPerMin", sizeof( Name))) == 0) FReadDouble( Input, &GuideDragAzArcsecPerMin); if( (strncmpi( Name, "GuideDragRaArcsecPerMin", sizeof( Name))) == 0) FReadDouble( Input, &GuideDragRaArcsecPerMin); if( (strncmpi( Name, "GuideDragDecArcsecPerMin", sizeof( Name))) == 0) FReadDouble( Input, &GuideDragDecArcsecPerMin); if( (strncmpi( Name, "HPUpdateDriftFlag", sizeof( Name))) == 0) FReadFlag( Input, &HPUpdateDriftFlag); if( (strncmpi( Name, "DriftAltArcsecPerMin", sizeof( Name))) == 0) FReadDouble( Input, &DriftAltArcsecPerMin); if( (strncmpi( Name, "DriftAzArcsecPerMin", sizeof( Name))) == 0) FReadDouble( Input, &DriftAzArcsecPerMin); if( (strncmpi( Name, "DriftRaDegPerHr", sizeof( Name))) == 0) FReadDouble( Input, &DriftRaDegPerHr); if( (strncmpi( Name, "DriftDecDegPerHr", sizeof( Name))) == 0) FReadDouble( Input, &DriftDecDegPerHr); if( (strncmpi( Name, "PECFlag", sizeof( Name))) == 0) FReadFlag( Input, &PECFlag); if( (strncmpi( Name, "AutoAltPECPin", sizeof( Name))) == 0) FReadLong( Input, &AutoAltPECPin); if( (strncmpi( Name, "AutoAltPECSyncOnFlag", sizeof( Name))) == 0) FReadFlag( Input, &AutoAltPECSyncOnFlag); if( (strncmpi( Name, "AutoAltPECSyncLowHighFlag", sizeof( Name))) == 0) FReadFlag( Input, &AutoAltPECSyncLowHighFlag); if( (strncmpi( Name, "AutoAltPECSyncDirFlag", sizeof( Name))) == 0) FReadFlag( Input, &AutoAltPECSyncDirFlag); if( (strncmpi( Name, "AutoAltPECDeBounce", sizeof( Name))) == 0) FReadFlag( Input, &AutoAltPECDeBounce); if( (strncmpi( Name, "AutoAzPECPin", sizeof( Name))) == 0) FReadLong( Input, &AutoAzPECPin); if( (strncmpi( Name, "AutoAzPECSyncOnFlag", sizeof( Name))) == 0) FReadFlag( Input, &AutoAzPECSyncOnFlag); if( (strncmpi( Name, "AutoAzPECSyncLowHighFlag", sizeof( Name))) == 0) FReadFlag( Input, &AutoAzPECSyncLowHighFlag); if( (strncmpi( Name, "AutoAzPECSyncDirFlag", sizeof( Name))) == 0) FReadFlag( Input, &AutoAzPECSyncDirFlag); if( (strncmpi( Name, "AutoAzPECDeBounce", sizeof( Name))) == 0) FReadFlag( Input, &AutoAzPECDeBounce); if( (strncmpi( Name, "FullstepsPerPECArray", sizeof( Name))) == 0) FReadLong( Input, &FullstepsPerPECArray); if( (strncmpi( Name, "PECIxOffset.A", sizeof( Name))) == 0) FReadInt( Input, &PECIxOffset.A); if( (strncmpi( Name, "PECIxOffset.Z", sizeof( Name))) == 0) FReadInt( Input, &PECIxOffset.Z); if( (strncmpi( Name, "FRStepSizeArcsec", sizeof( Name))) == 0) FReadDouble( Input, &FRStepSizeArcsec); if( (strncmpi( Name, "SectoredFRDrive", sizeof( Name))) == 0) FReadFlag( Input, &SectoredFRDrive); if( (strncmpi( Name, "FRStepSpeedMilliSec", sizeof( Name))) == 0) FReadInt( Input, &FRStepSpeedMilliSec); if( (strncmpi( Name, "ReverseFRMotor", sizeof( Name))) == 0) FReadFlag( Input, &ReverseFRMotor); /* FocusMethod and MotorControlMethods are defined as enum */ if( (strncmpi( Name, "FocusMethod", sizeof( Name))) == 0) { FReadInt( Input, &I); FocusMethod = I; } if( (strncmpi( Name, "AltFullStepSizeArcsec", sizeof( Name))) == 0) FReadDouble( Input, &AltFullStepSizeArcsec); if( (strncmpi( Name, "AzFullStepSizeArcsec", sizeof( Name))) == 0) FReadDouble( Input, &AzFullStepSizeArcsec); if( (strncmpi( Name, "AzFullStepSizeArcsecCW", sizeof( Name))) == 0) FReadDouble( Input, &AzFullStepSizeArcsecCW); if( (strncmpi( Name, "AzFullStepSizeArcsecCCW", sizeof( Name))) == 0) FReadDouble( Input, &AzFullStepSizeArcsecCCW); if( (strncmpi( Name, "ReverseFocusMotor", sizeof( Name))) == 0) FReadFlag( Input, &ReverseFocusMotor); if( (strncmpi( Name, "FocusFastStepsSec", sizeof( Name))) == 0) FReadInt( Input, &FocusFastStepsSec); if( (strncmpi( Name, "FocusSlowStepsSec", sizeof( Name))) == 0) FReadInt( Input, &FocusSlowStepsSec); if( (strncmpi( Name, "FocusPosition", sizeof( Name))) == 0) FReadInt( Input, &FocusPosition); if( (strncmpi( Name, "MotorControlMethod", sizeof( Name))) == 0) { FReadInt( Input, &I); MotorControlMethod = I; } if( (strncmpi( Name, "MotorWindings", sizeof( Name))) == 0) FReadInt( Input, &MotorWindings); if( (strncmpi( Name, "InvertOutput", sizeof( Name))) == 0) FReadFlag( Input, &InvertOutput); if( (strncmpi( Name, "KeepAlivePPortPin", sizeof( Name))) == 0) FReadInt( Input, &KeepAlivePPortPin); if( (strncmpi( Name, "ReverseAMotor", sizeof( Name))) == 0) FReadFlag( Input, &ReverseAMotor); if( (strncmpi( Name, "ReverseZMotor", sizeof( Name))) == 0) FReadFlag( Input, &ReverseZMotor); if( (strncmpi( Name, "HsRampStyle", sizeof( Name))) == 0) FReadFlag( Input, &HsRampStyle); if( (strncmpi( Name, "HsTimerFlag", sizeof( Name))) == 0) FReadFlag( Input, &HsTimerFlag); if( (strncmpi( Name, "MaxDelay", sizeof( Name))) == 0) FReadInt( Input, &MaxDelay); if( (strncmpi( Name, "MinDelay", sizeof( Name))) == 0) FReadInt( Input, &MinDelay); if( (strncmpi( Name, "HsDelayX", sizeof( Name))) == 0) FReadInt( Input, &HsDelayX); if( (strncmpi( Name, "HsRampX", sizeof( Name))) == 0) FReadInt( Input, &HsRampX); if( (strncmpi( Name, "InterruptHs", sizeof( Name))) == 0) FReadInt( Input, &InterruptHs); if( (strncmpi( Name, "HoldReps", sizeof( Name))) == 0) FReadInt( Input, &HoldReps); if( (strncmpi( Name, "HsOverVoltageControl", sizeof( Name))) == 0) FReadInt( Input, &HsOverVoltageControl); if( (strncmpi( Name, "MaxConsecutiveSlews", sizeof( Name))) == 0) FReadInt( Input, &MaxConsecutiveSlews); if( (strncmpi( Name, "MsPowerDownSec", sizeof( Name))) == 0) FReadInt( Input, &MsPowerDownSec); if( (strncmpi( Name, "PWMRepsTick", sizeof( Name))) == 0) FReadInt( Input, &PWMRepsTick); if( (strncmpi( Name, "AvgPWMRepsTickOnFlag", sizeof( Name))) == 0) FReadFlag( Input, &AvgPWMRepsTickOnFlag); if( (strncmpi( Name, "MsDelayX", sizeof( Name))) == 0) FReadInt( Input, &MsDelayX); if( (strncmpi( Name, "MsPause", sizeof( Name))) == 0) FReadInt( Input, &MsPause); if( (strncmpi( Name, "Ms", sizeof( Name))) == 0) FReadInt( Input, &Ms); if( (strncmpi( Name, "MaxIncrMsPerPWM", sizeof( Name))) == 0) { FReadInt( Input, &MaxIncrMsPerPWM); MaxIncrMsPerPWMWasRead = True; } if( (strncmpi( Name, "MsHsToggleIncrMsPerPWM", sizeof( Name))) == 0) { FReadInt( Input, &MsHsToggleIncrMsPerPWM); MsHsToggleIncrMsPerPWMWasRead = True; } if( (strncmpi( Name, "MaxPWM", sizeof( Name))) == 0) { MaxPWMFoundFlag = Yes; FReadInt( Input, &MaxPWM); } if( (strncmpi( Name, "PWM[", 4)) == 0) ReadPWMValue(); if( (strncmpi( Name, "PWMZ[", 5)) == 0) { UsePWMZFlag = Yes; ReadPWMValue(); } if( (strncmpi( Name, "PWM_A", 5)) == 0) { Ix = Name[6] - 'a'; if( Ix >= 0 && Ix < 4) { FReadDouble( Input, &PWM_A_Comp[Ix]); SavePWMComp = Yes; } else BadExit( strcat( "Bad PWM_A_? char in ", ConfigFile)); } if( (strncmpi( Name, "PWM_Z", 5)) == 0) { Ix = Name[6] - 'a'; if( Ix >= 0 && Ix < 4) { FReadDouble( Input, &PWM_Z_Comp[Ix]); SavePWMComp = Yes; } else BadExit( strcat( "Bad PWM_Z_? char in ", ConfigFile)); } if( (strncmpi( Name, "QSC_", 4)) == 0) if( Name[4] >= 'a' && Name[4] <= 'd') { UseQSC = True; Ix = (Name[4] - 'a') * 4; if( Name[5] >= '0' && Name[5] <= '3') Ix += Name[5] - '0'; FReadDouble( Input, &QSCvalues[Ix].A); do { C = Blank; FReadChar( Input, &C); } while( C != '\n' && C != ':'); if( C == ':') FReadDouble( Input, &QSCvalues[Ix].Z); } if( (strncmpi( Name, "PPortAddr", sizeof( Name))) == 0) { FReadUnsigned( Input, &PPortAddr); StartPPortAddr = PPortAddr; } if( (strncmpi( Name, "Eyepieces", sizeof( Name))) == 0) FReadInt( Input, &Eyepieces); if( Eyepieces > MAX_EYEPIECES) Eyepieces = MAX_EYEPIECES; for (Ix=0; Ix < Eyepieces; Ix++) { sprintf( StrCompare, "EPFocusPosition[%d].Position", Ix); if( (strncmpi( Name, StrCompare, sizeof( Name))) == 0) FReadInt( Input, &EPFocusPosition[Ix].Position); sprintf( StrCompare, "EPFocusPosition[%d].Name", Ix); if( (strncmpi( Name, StrCompare, sizeof( Name))) == 0) FReadStringToCharCountOrNewLine( Input, EPFocusPosition[Ix].Name, sizeof( Name)); }; if( (strncmpi( Name, "COM3Base", sizeof( Name))) == 0) FReadUnsigned( Input, &CommPort[Com3].Base); if( (strncmpi( Name, "COM3IRQ", sizeof( Name))) == 0) FReadInt( Input, &CommPort[Com3].IRQ); if( (strncmpi( Name, "COM4Base", sizeof( Name))) == 0) FReadUnsigned( Input, &CommPort[Com4].Base); if( (strncmpi( Name, "COM4IRQ", sizeof( Name))) == 0) FReadInt( Input, &CommPort[Com4].IRQ); if( (strncmpi( Name, "EncoderString", sizeof( Name))) == 0) FReadStringToCharCountOrNewLine( Input, EncoderString, sizeof( Name)); if( (strncmpi( Name, "EncoderComPort", sizeof( Name))) == 0) FReadInt( Input, &EncoderComPort); if( (strncmpi( Name, "EncoderBaudRate", sizeof( Name))) == 0) FReadLong( Input, &EncoderBaudRate); if( (strncmpi( Name, "SerialWriteDelayMs", sizeof( Name))) == 0) FReadInt( Input, &SerialWriteDelayMs); if( (strncmpi( Name, "AltEncoderCountsPerRev", sizeof( Name))) == 0) FReadLong( Input, &AltEncoderCountsPerRev); if( (strncmpi( Name, "AzEncoderCountsPerRev", sizeof( Name))) == 0) FReadLong( Input, &AzEncoderCountsPerRev); if( (strncmpi( Name, "AltEncoderDir", sizeof( Name))) == 0) FReadFlag( Input, &AltEncoderDir); if( (strncmpi( Name, "AzEncoderDir", sizeof( Name))) == 0) FReadFlag( Input, &AzEncoderDir); if( (strncmpi( Name, "EncoderErrorThresholdDeg", sizeof( Name))) == 0) FReadDouble( Input, &EncoderErrorThresholdDeg); if( (strncmpi( Name, "TrackEncoderErrorThresholdDeg", sizeof( Name))) == 0) FReadDouble( Input, &TrackEncoderErrorThresholdDeg); if( (strncmpi( Name, "MakeEncoderResetLogFile", sizeof( Name))) == 0) FReadFlag( Input, &MakeEncoderResetLogFile); if( (strncmpi( Name, "EncoderOffset.A", sizeof( Name))) == 0) FReadDouble( Input, &EncoderOffset.A); if( (strncmpi( Name, "EncoderOffset.Z", sizeof( Name))) == 0) FReadDouble( Input, &EncoderOffset.Z); if( (strncmpi( Name, "LX200ComPort", sizeof( Name))) == 0) FReadInt( Input, &LX200ComPort); if( (strncmpi( Name, "LX200BaudRate", sizeof( Name))) == 0) FReadLong( Input, &LX200BaudRate); if( (strncmpi( Name, "LX200MotionTimeoutSec", sizeof( Name))) == 0) FReadInt( Input, &LX200MotionTimeoutSec); if( (strncmpi( Name, "LX200SlewHs", sizeof( Name))) == 0) FReadLong( Input, &LX200SlewHs); if( (strncmpi( Name, "LX200_LongFormat", sizeof( Name))) == 0) FReadFlag( Input, &LX200_LongFormat); if( (strncmpi( Name, "Current.Alt", sizeof( Name))) == 0) { FReadDouble( Input, &Current.Alt); Current.Alt *= DegToRad; } if( (strncmpi( Name, "Current.Az", sizeof( Name))) == 0) { FReadDouble( Input, &Current.Az); Current.Az *= DegToRad; } if( (strncmpi( Name, "AccumMs.A", sizeof( Name))) == 0) FReadLong( Input, &AccumMs.A); if( (strncmpi( Name, "AccumMs.Z", sizeof( Name))) == 0) FReadLong( Input, &AccumMs.Z); if( (strncmpi( Name, "StartInitState", sizeof( Name))) == 0) FReadInt( Input, &StartInitState); if( (strncmpi( Name, "InitOne", sizeof( Name))) == 0) FReadPositionToNewLine( Input, &One); if( (strncmpi( Name, "InitTwo", sizeof( Name))) == 0) FReadPositionToNewLine( Input, &Two); if( (strncmpi( Name, "InitThree", sizeof( Name))) == 0) FReadPositionToNewLine( Input, &Three); if( (strncmpi( Name, "Z1Deg", sizeof( Name))) == 0) FReadDouble( Input, &Z1Deg); if( (strncmpi( Name, "Z2Deg", sizeof( Name))) == 0) FReadDouble( Input, &Z2Deg); if( (strncmpi( Name, "Z3Deg", sizeof( Name))) == 0) FReadDouble( Input, &Z3Deg); if( (strncmpi( Name, "DataFileCoordYear", sizeof( Name))) == 0) FReadDouble( Input, &DataFileCoordYear); if( (strncmpi( Name, "LatitudeDeg", sizeof( Name))) == 0) FReadDouble( Input, &LatitudeDeg); if( (strncmpi( Name, "CMOS_RTC_Access", sizeof( Name))) == 0) FReadFlag( Input, &CMOS_RTC_Access); if( (strncmpi( Name, "LongitudeDeg", sizeof( Name))) == 0) FReadDouble( Input, &LongitudeDeg); if( (strncmpi( Name, "Height", sizeof( Name))) == 0) FReadDouble( Input, &Height); if( (strncmpi( Name, "Tz", sizeof( Name))) == 0) FReadDouble( Input, &Tz); if( (strncmpi( Name, "DST", sizeof( Name))) == 0) FReadInt( Input, &DST); if( (strncmpi( Name, "TestString", sizeof( Name))) == 0) FReadStringToCharCountOrNewLine( Input, TestString, sizeof( Name)); fscanf( Input, "%s", Name); } fclose( Input); if( !MaxIncrMsPerPWMWasRead) MaxIncrMsPerPWM = Ms/2; if( !MsHsToggleIncrMsPerPWMWasRead) MsHsToggleIncrMsPerPWM = Ms/4; if( LongitudeDeg < 0) LongitudeDeg = 360. + LongitudeDeg; if( AutoGEMFlip) GEMFlipPossible = True; if( AutoAltPECDeBounce) AutoAltPECDeBounce = 1; if( AutoAzPECDeBounce) AutoAzPECDeBounce = 1; }