📄 main.c
字号:
#include "includes.h"
/****************************************************************************
* Function: void main(void)
*
* The program entry point. Termination occurs by either uses a call to exit
* to exit (before the environment has been altered) or to QuitGpsBuilder
* (which restores the PC environment to the pre-existing state).
*
* Input: None.
*
* Output: None.
*
* Return Value: None.
****************************************************************************/
void main(void)
{
MStkSS = _SS; /* Store the stack pointers. */
MStkSP = MStkHwm = _SP;
GpsBuilder2(); /* Call the main routine. */
}
/****************************************************************************
* Function: void GpsBuilder2(void)
*
* Initialize the GPS Builder-2 hardware and software, then initiate
* multitasking and run the program until it is terminated.
*
* Input: None.
*
* Output: None.
*
* Return Value: None.
****************************************************************************/
void GpsBuilder2(void)
{
int CurrentPredictSV; /* The SV number for which predict are made. */
int highest[MAXCHANNELS]; /* Satellites ordered by elevation. */
Checkpoint("GpsBuilder2",1);
SuppressCursor();
Checkpoint("GpsBuilder2",2);
ClearScreen();
Checkpoint("GpsBuilder2",3);
SetFPErrorHandler();
Checkpoint("GpsBuilder2",4);
SetUpCorrelators();
Checkpoint("GpsBuilder2",5);
ConfigureInterrupt();
Checkpoint("GpsBuilder2",6);
TestingInterface = TRUE;
HardwareTest();
TestingInterface = FALSE;
Checkpoint("GpsBuilder2",7);
InstallControlBreakHandler();
if(setjmp(cbrkjmp))
QuitGpsBuilder(); /* Terminate gracefully */
Checkpoint("GpsBuilder2",8);
AllocateMemory();
Checkpoint("GpsBuilder2",9);
InitialiseTasks();
Checkpoint("GpsBuilder2",10);
InitialiseGP2021();
Checkpoint("GpsBuilder2",11);
SetUpGlobals();
Checkpoint("GpsBuilder2",12);
SetClockModel();
Checkpoint("GpsBuilder2",13);
ReadAlmanacs();
printf("\n\nPlease Wait - Initialising System....");
printf("\nInitialisation Time Is Dependent Upon PC Speed.\n");
printf("\n***** WARNING *****");
printf("\nIf you can still read this message then it is likely that "
"your PC is too slow\nto support the number of channels currently "
"active. Try adjusting the channel\nnumber (CH x) in CMD.INI "
"starting from 3 and incrementing by 1 each time.\n\n\n");
Checkpoint("GpsBuilder2",14);
PredictAll(); /* Do predicts for all satellites. */
Checkpoint("GpsBuilder2",15);
DisplayFunc=3;
Activate("TDisplay");
Checkpoint("GpsBuilder2",16);
ProcessCommandFile(); /* Process commands from CMD.INI file. */
/* Since some misses can occur during initialization */
misso = missa = missm = 0;
CurrentPredictSV = 0;
/* Initialization is complete. Start multitasking and begin normal
operation. */
PROTECT = 0;
for(;;)
{
Keyboard();
Checkpoint("GpsBuilder2",17);
ValidateEphemerides();
/* Predicts are done for only 1 satellite per iteration of this
loop to reduce loading. */
Checkpoint("GpsBuilder2",18);
CurrentPredictSV++;
if(CurrentPredictSV>MAXSATELLITES)
CurrentPredictSV = 1;
AzimuthElevationAndDoppler(CurrentPredictSV-1);
Checkpoint("GpsBuilder2",19);
OscillatorAccuracy(); /* Update the clock model. */
Checkpoint("GpsBuilder2",20);
NumberOfDopplerBins(); /* Get the new number of Doppler bins. */
Checkpoint("GpsBuilder2",21);
ElevationList(highest); /* Order satellites by elevation. */
Checkpoint("GpsBuilder2",22);
UpdateSatelliteAllocation(highest); /* Update according to Mode. */
Checkpoint("GpsBuilder2",23);
UpdateNavigation(); /* Do navigation if possible. */
/* If a data logging file is open, or COM1 output is active, and the
log interval is non-zero then go to the save data routine. */
Checkpoint("GpsBuilder2",24);
if((fpDataLog!=NULL || DataLogSerial==TRUE) && DataLogInterval!=0)
SaveData();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -