bool ScopeSim::SetDefaultPark() { // By default set RA to HA SetAxis1Park(get_local_sidereal_time(LocationN[LOCATION_LONGITUDE].value)); // Set DEC to 90 or -90 depending on the hemisphere SetAxis2Park((LocationN[LOCATION_LATITUDE].value > 0) ? 90 : -90); return true; }
bool SynscanDriver::updateLocation(double latitude, double longitude, double elevation) { INDI_UNUSED(elevation); char cmd[SYN_RES] = {0}, res[SYN_RES] = {0}; bool IsWest = false; ln_lnlat_posn p1 { 0, 0 }; lnh_lnlat_posn p2; LocationN[LOCATION_LATITUDE].value = latitude; LocationN[LOCATION_LONGITUDE].value = longitude; IDSetNumber(&LocationNP, nullptr); if (isSimulation()) { if (!CurrentDE) { CurrentDE = latitude > 0 ? 90 : -90; CurrentRA = get_local_sidereal_time(longitude); } return true; } if (longitude > 180) { p1.lng = 360.0 - longitude; IsWest = true; } else { p1.lng = longitude; } p1.lat = latitude; ln_lnlat_to_hlnlat(&p1, &p2); LOGF_INFO("Update location to latitude %d:%d:%1.2f longitude %d:%d:%1.2f", p2.lat.degrees, p2.lat.minutes, p2.lat.seconds, p2.lng.degrees, p2.lng.minutes, p2.lng.seconds); cmd[0] = 'W'; cmd[1] = p2.lat.degrees; cmd[2] = p2.lat.minutes; cmd[3] = rint(p2.lat.seconds); cmd[4] = (p2.lat.neg == 0) ? 0 : 1; cmd[5] = p2.lng.degrees; cmd[6] = p2.lng.minutes; cmd[7] = rint(p2.lng.seconds); cmd[9] = IsWest ? 1 : 0; return sendCommand(cmd, res, 10); }
bool ScopeSim::initProperties() { /* Make sure to init parent properties first */ INDI::Telescope::initProperties(); /* Simulated periodic error in RA, DEC */ IUFillNumber(&EqPEN[RA_AXIS], "RA_PE", "RA (hh:mm:ss)", "%010.6m", 0, 24, 0, 15.); IUFillNumber(&EqPEN[DEC_AXIS], "DEC_PE", "DEC (dd:mm:ss)", "%010.6m", -90, 90, 0, 15.); IUFillNumberVector(&EqPENV, EqPEN, 2, getDeviceName(), "EQUATORIAL_PE", "Periodic Error", MOTION_TAB, IP_RO, 60, IPS_IDLE); /* Enable client to manually add periodic error northward or southward for simulation purposes */ IUFillSwitch(&PEErrNSS[DIRECTION_NORTH], "PE_N", "North", ISS_OFF); IUFillSwitch(&PEErrNSS[DIRECTION_SOUTH], "PE_S", "South", ISS_OFF); IUFillSwitchVector(&PEErrNSSP, PEErrNSS, 2, getDeviceName(), "PE_NS", "PE N/S", MOTION_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); /* Enable client to manually add periodic error westward or easthward for simulation purposes */ IUFillSwitch(&PEErrWES[DIRECTION_WEST], "PE_W", "West", ISS_OFF); IUFillSwitch(&PEErrWES[DIRECTION_EAST], "PE_E", "East", ISS_OFF); IUFillSwitchVector(&PEErrWESP, PEErrWES, 2, getDeviceName(), "PE_WE", "PE W/E", MOTION_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); /* How fast do we guide compared to sidereal rate */ IUFillNumber(&GuideRateN[RA_AXIS], "GUIDE_RATE_WE", "W/E Rate", "%g", 0, 1, 0.1, 0.3); IUFillNumber(&GuideRateN[DEC_AXIS], "GUIDE_RATE_NS", "N/S Rate", "%g", 0, 1, 0.1, 0.3); IUFillNumberVector(&GuideRateNP, GuideRateN, 2, getDeviceName(), "GUIDE_RATE", "Guiding Rate", MOTION_TAB, IP_RW, 0, IPS_IDLE); IUFillSwitch(&SlewRateS[SLEW_GUIDE], "SLEW_GUIDE", "Guide", ISS_OFF); IUFillSwitch(&SlewRateS[SLEW_CENTERING], "SLEW_CENTERING", "Centering", ISS_OFF); IUFillSwitch(&SlewRateS[SLEW_FIND], "SLEW_FIND", "Find", ISS_OFF); IUFillSwitch(&SlewRateS[SLEW_MAX], "SLEW_MAX", "Max", ISS_ON); IUFillSwitchVector(&SlewRateSP, SlewRateS, 4, getDeviceName(), "TELESCOPE_SLEW_RATE", "Slew Rate", MOTION_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); // Add Tracking Modes AddTrackMode("TRACK_SIDEREAL", "Sidereal", true); AddTrackMode("TRACK_CUSTOM", "Custom"); // Let's simulate it to be an F/7.5 120mm telescope ScopeParametersN[0].value = 120; ScopeParametersN[1].value = 900; ScopeParametersN[2].value = 120; ScopeParametersN[3].value = 900; TrackState = SCOPE_IDLE; SetParkDataType(PARK_RA_DEC); initGuiderProperties(getDeviceName(), MOTION_TAB); /* Add debug controls so we may debug driver if necessary */ addDebugControl(); setDriverInterface(getDriverInterface() | GUIDER_INTERFACE); double longitude=0, latitude=90; // Get value from config file if it exists. IUGetConfigNumber(getDeviceName(), "GEOGRAPHIC_COORD", "LONG", &longitude); currentRA = get_local_sidereal_time(longitude); IUGetConfigNumber(getDeviceName(), "GEOGRAPHIC_COORD", "LAT", &latitude); currentDEC = latitude > 0 ? 90 : -90; return true; }
bool Paramount::initProperties() { /* Make sure to init parent properties first */ INDI::Telescope::initProperties(); for (int i = 0; i < SlewRateSP.nsp-1; i++) { sprintf(SlewRateSP.sp[i].label, "%.fx", slewspeeds[i]); SlewRateSP.sp[i].aux = (void *)&slewspeeds[i]; } // Set 64x as default speed SlewRateSP.sp[5].s = ISS_ON; /* How fast do we guide compared to sidereal rate */ IUFillNumber(&JogRateN[RA_AXIS], "JOG_RATE_WE", "W/E Rate (arcmin)", "%g", 0, 600, 60, 30); IUFillNumber(&JogRateN[DEC_AXIS], "JOG_RATE_NS", "N/S Rate (arcmin)", "%g", 0, 600, 60, 30); IUFillNumberVector(&JogRateNP, JogRateN, 2, getDeviceName(), "JOG_RATE", "Jog Rate", MOTION_TAB, IP_RW, 0, IPS_IDLE); /* How fast do we guide compared to sidereal rate */ IUFillNumber(&GuideRateN[RA_AXIS], "GUIDE_RATE_WE", "W/E Rate", "%1.1f", 0.0, 1.0, 0.1, 0.5); IUFillNumber(&GuideRateN[DEC_AXIS], "GUIDE_RATE_NS", "N/S Rate", "%1.1f", 0.0, 1.0, 0.1, 0.5); IUFillNumberVector(&GuideRateNP, GuideRateN, 2, getDeviceName(), "GUIDE_RATE", "Guiding Rate", MOTION_TAB, IP_RW, 0, IPS_IDLE); // Tracking Mode #if 0 IUFillSwitch(&TrackModeS[TRACK_SIDEREAL], "TRACK_SIDEREAL", "Sidereal", ISS_OFF); IUFillSwitch(&TrackModeS[TRACK_SOLAR], "TRACK_SOLAR", "Solar", ISS_OFF); IUFillSwitch(&TrackModeS[TRACK_LUNAR], "TRACK_LUNAR", "Lunar", ISS_OFF); IUFillSwitch(&TrackModeS[TRACK_CUSTOM], "TRACK_CUSTOM", "Custom", ISS_OFF); IUFillSwitchVector(&TrackModeSP, TrackModeS, 4, getDeviceName(), "TELESCOPE_TRACK_MODE", "Track Mode", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE); #endif AddTrackMode("TRACK_SIDEREAL", "Sidereal", true); AddTrackMode("TRACK_SOLAR", "Solar"); AddTrackMode("TRACK_LUNAR", "Lunar"); AddTrackMode("TRACK_CUSTOM", "Custom"); // Custom Tracking Rate #if 0 IUFillNumber(&TrackRateN[0], "TRACK_RATE_RA", "RA (arcsecs/s)", "%.6f", -16384.0, 16384.0, 0.000001, 15.041067); IUFillNumber(&TrackRateN[1], "TRACK_RATE_DE", "DE (arcsecs/s)", "%.6f", -16384.0, 16384.0, 0.000001, 0); IUFillNumberVector(&TrackRateNP, TrackRateN, 2, getDeviceName(), "TELESCOPE_TRACK_RATE", "Track Rates", MAIN_CONTROL_TAB, IP_RW, 60, IPS_IDLE); #endif // Let's simulate it to be an F/7.5 120mm telescope with 50m 175mm guide scope ScopeParametersN[0].value = 120; ScopeParametersN[1].value = 900; ScopeParametersN[2].value = 50; ScopeParametersN[3].value = 175; TrackState = SCOPE_IDLE; SetParkDataType(PARK_RA_DEC); initGuiderProperties(getDeviceName(), MOTION_TAB); setDriverInterface(getDriverInterface() | GUIDER_INTERFACE); addAuxControls(); double longitude=0, latitude=90; // Get value from config file if it exists. IUGetConfigNumber(getDeviceName(), "GEOGRAPHIC_COORD", "LONG", &longitude); currentRA = get_local_sidereal_time(longitude); IUGetConfigNumber(getDeviceName(), "GEOGRAPHIC_COORD", "LAT", &latitude); currentDEC = latitude > 0 ? 90 : -90; return true; }