int main( const int argc, const char **argv) { ELEMENTS elem, earth_elem; double t_cen = 0.06, barbee_style_vel; memset( &elem, 0, sizeof( ELEMENTS)); if( argc == 6) setup_planet_elem( &earth_elem, 3, t_cen); else { memset( &earth_elem, 0, sizeof( ELEMENTS)); sscanf( argv[6], "%lf,%lf,%lf,%lf,%lf", &earth_elem.q, &earth_elem.ecc, &earth_elem.incl, &earth_elem.asc_node, &earth_elem.arg_per); earth_elem.incl *= PI / 180.; earth_elem.asc_node *= PI / 180.; earth_elem.arg_per *= PI / 180.; } elem.q = atof( argv[1]); elem.ecc = atof( argv[2]); if( elem.q < 0.) /* actually the semimajor axis was given; */ elem.q *= elem.ecc - 1.; /* cvt it to a perihelion distance */ elem.incl = atof( argv[3]) * PI / 180.; elem.asc_node = atof( argv[4]) * PI / 180.; elem.arg_per = atof( argv[5]) * PI / 180.; derive_quantities( &elem, SOLAR_GM); derive_quantities( &earth_elem, SOLAR_GM); printf( "MOID = %f\n", find_moid( &earth_elem, &elem, &barbee_style_vel)); printf( "Barbee-style encounter vel = %f\n", barbee_style_vel); show_elements( &elem); if( argc != 6) show_elements( &earth_elem); return( 0); }
/* * Main page * KEY_UP: Press once to start timers, press again to stop timers * KEY_DOWN: Press to rest timers * KEY_ENT: enter the main menu page */ void PAGE_MainInit(int page) { (void)page; (void)bar_cb; TGLICO_LoadFonts(); memset(mp, 0, sizeof(struct main_page));// Bug fix: must initialize this structure to avoid unpredictable issues in the PAGE_MainEvent memset(gui, 0, sizeof(struct mainpage_obj)); PAGE_SetModal(0); PAGE_SetActionCB(_action_cb); next_scan = CLOCK_getms()+BATTERY_SCAN_MSEC; GUI_CreateLabelBox(&gui->name, MODEL_NAME_X, MODEL_NAME_Y, //64, 12, LCD_WIDTH, LINE_HEIGHT, &MODELNAME_FONT, NULL, NULL, Model.name); show_elements(); //Battery mp->battery = PWR_ReadVoltage(); }
/* * Main page * KEY_UP: Press once to start timers, press again to stop timers * KEY_DOWN: Press to rest timers * KEY_ENT: enter the main menu page */ void PAGE_MainInit(int page) { (void)page; (void)bar_cb; memset(mp, 0, sizeof(struct main_page));// Bug fix: must initialize this structure to avoid unpredictable issues in the PAGE_MainEvent memset(gui, 0, sizeof(struct mainpage_obj)); PAGE_SetModal(0); PAGE_SetActionCB(_action_cb); PAGE_RemoveAllObjects(); next_scan = CLOCK_getms()+BATTERY_SCAN_MSEC; GUI_CreateLabelBox(&gui->name, 0, 1, //64, 12, 0, 0, &SMALL_FONT, NULL, NULL, Model.name); show_elements(); //Battery mp->battery = PWR_ReadVoltage(); }