static void buildDefaults( void ) { section_size def_sections[] = DEFAULT_STATUSSECTIONS; ReplaceString( &EditVars.StatusString, DEFAULT_STATUSSTRING ); EditVars.NumStatusSections = NARRAY( def_sections ); EditVars.StatusSections = MemReAlloc( EditVars.StatusSections, sizeof( def_sections ) ); memcpy( EditVars.StatusSections, def_sections, sizeof( def_sections ) ); totalRedraw(); }
bool GPhotoCCD::initProperties() { // Init parent properties first INDI::CCD::initProperties(); initFocuserProperties(getDeviceName(), FOCUS_TAB); IUFillText(&mPortT[0], "PORT" , "Port", ""); IUFillTextVector(&PortTP, mPortT, NARRAY(mPortT), getDeviceName(), "DEVICE_PORT" , "Shutter Release", MAIN_CONTROL_TAB, IP_RW, 0, IPS_IDLE); IUFillNumber(&mMirrorLockN[0], "MIRROR_LOCK_SECONDS" , "Seconds", "%1.0f", 0, 10, 1, 0); IUFillNumberVector(&mMirrorLockNP, mMirrorLockN, 1, getDeviceName(), "MIRROR_LOCK" , "Mirror Lock", MAIN_CONTROL_TAB, IP_RW, 60, IPS_IDLE); //We don't know how many items will be in the switch yet IUFillSwitchVector(&mIsoSP, NULL, 0, getDeviceName(), "CCD_ISO", "ISO", IMAGE_SETTINGS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); IUFillSwitchVector(&mFormatSP, NULL, 0, getDeviceName(), "CAPTURE_FORMAT", "Capture Format", IMAGE_SETTINGS_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); IUFillSwitch(&autoFocusS[0], "Set", "", ISS_OFF); IUFillSwitchVector(&autoFocusSP, autoFocusS, 1, getDeviceName(), "Auto Focus", "", FOCUS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); IUFillSwitch(&transferFormatS[0], "FITS", "", ISS_ON); IUFillSwitch(&transferFormatS[1], "Native", "", ISS_OFF); IUFillSwitchVector(&transferFormatSP, transferFormatS, 2, getDeviceName(), "Transfer Format", "", IMAGE_SETTINGS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); IUFillSwitch(&livePreviewS[0], "Enable", "", ISS_OFF); IUFillSwitch(&livePreviewS[1], "Disable", "", ISS_ON); IUFillSwitchVector(&livePreviewSP, livePreviewS, 2, getDeviceName(), "VIDEO_STREAM", "Preview", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 0.001, 3600, 1, false); // Most cameras have this by default, so let's set it as default. IUSaveText(&BayerT[2], "RGGB"); SetCCDCapability(CCD_CAN_SUBFRAME | CCD_HAS_BAYER); SetFocuserCapability(FOCUSER_HAS_VARIABLE_SPEED); FocusSpeedN[0].min=0; FocusSpeedN[0].max=3; FocusSpeedN[0].step=1; FocusSpeedN[0].value=1; /* JM 2014-05-20 Make PrimaryCCD.ImagePixelSizeNP writable since we can't know for now the pixel size and bit depth from gphoto */ PrimaryCCD.getCCDInfo()->p = IP_RW; setDriverInterface(getDriverInterface() | FOCUSER_INTERFACE); gphoto_set_debug(getDeviceName()); gphoto_read_set_debug(getDeviceName()); return true; }
int main(int argc, char *argv[]) { int idx[3] = {285,165,143}; long val[3]; pfunc_t func[3] = {func_t, func_p, func_h}; int i; /* initialize T(2),P(2),H(2) */ for (i = 0; i < 3; i++) val[i] = func[i](idx[i]); while (1) { i = min_index(val, NARRAY(val)); idx[i]++; val[i] = func[i](idx[i]); if (equal(val, NARRAY(val))) break; } printf("%ld\n", val[0]); return 0; }
void touchSample(int *x, int *y){ int xsampleval[5],ysampleval[5]; //GPIOSetValue(3, 0, 1); //to debug for(int i=0;i<5;i++){ xsampleval[i] = touchXsample(); } bubbleSortAscend(xsampleval,NARRAY(xsampleval)); for(int i=0;i<5;i++){ ysampleval[i] = touchYsample(); } bubbleSortAscend(ysampleval,NARRAY(ysampleval)); //GPIOSetValue(3, 0, 0); //to debug *y = sum(ysampleval+1,NARRAY(ysampleval)-2)/(NARRAY(ysampleval)-2); *x = sum(xsampleval+1,NARRAY(xsampleval)-2)/(NARRAY(xsampleval)-2); //debugbufx[debugbufindex] = *x; //debugbufy[debugbufindex++] = *y; }
bool MaxDomeII::initProperties() { INDI::Dome::initProperties(); IUFillNumber(&HomeAzimuthN[0], "HOME_AZIMUTH", "Home azimuth", "%5.2f", 0., 360., 0., nHomeAzimuth); IUFillNumberVector(&HomeAzimuthNP, HomeAzimuthN, NARRAY(HomeAzimuthN), getDeviceName(), "HOME_AZIMUTH" , "Home azimuth", OPTIONS_TAB, IP_RW, 0, IPS_IDLE); // Ticks per turn IUFillNumber(&TicksPerTurnN[0], "TICKS_PER_TURN", "Ticks per turn", "%5.2f", 0., 360., 0., nTicksPerTurn); IUFillNumberVector(&TicksPerTurnNP, TicksPerTurnN, NARRAY(TicksPerTurnN), getDeviceName(), "TICKS_PER_TURN" , "Ticks per turn", OPTIONS_TAB, IP_RW, 0, IPS_IDLE); // Park position IUFillNumber(&ShutterOperationAzimuthN[0], "SOp_AZIMUTH", "Azimuth", "%5.2f", 0., 360., 0., nParkPosition); IUFillNumberVector(&ShutterOperationAzimuthNP, ShutterOperationAzimuthN, NARRAY(ShutterOperationAzimuthN), getDeviceName(), "SHUTTER_OPERATION_AZIMUTH" , "Shutter operation azimuth", OPTIONS_TAB, IP_RW, 0, IPS_IDLE); // Park on shutter IUFillSwitch(&ShutterConflictS[0], "MOVE", "Move", ISS_ON); IUFillSwitch(&ShutterConflictS[1], "NO_MOVE", "No move", ISS_OFF); IUFillSwitchVector(&ShutterConflictSP, ShutterConflictS, NARRAY(ShutterConflictS), getDeviceName(), "AZIMUTH_ON_SHUTTER", "Azimuth on operating shutter", OPTIONS_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); // Shutter mode IUFillSwitch(&ShutterModeS[0], "FULL", "Open full", ISS_ON); IUFillSwitch(&ShutterModeS[1], "UPPER", "Open upper only", ISS_OFF); IUFillSwitchVector(&ShutterModeSP, ShutterModeS, NARRAY(ShutterModeS), getDeviceName(), "SHUTTER_MODE", "Shutter open mode", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 0, IPS_IDLE); // Home - Home command IUFillSwitch(&HomeS[0], "HOME", "Home", ISS_OFF); IUFillSwitchVector(&HomeSP, HomeS, NARRAY(HomeS), getDeviceName(), "HOME_MOTION", "Home dome", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 0, IPS_IDLE); // Watch Dog IUFillNumber(&WatchDogN[0], "WATCH_DOG_TIME", "Watch dog time", "%5.2f", 0., 3600., 0., 0.); IUFillNumberVector(&WatchDogNP, WatchDogN, NARRAY(WatchDogN), getDeviceName(), "WATCH_DOG_TIME_SET" , "Watch dog time set", OPTIONS_TAB, IP_RW, 0, IPS_IDLE); // Set default baud rate to 19200 serialConnection->setDefaultBaudRate(Connection::Serial::B_19200); return true; }
@returns true if object's azimuth is successfully set. */ // bool setObjAz(int degrees, int minutes); static ISwitch FanStatusS[] = { {"On", "", ISS_OFF, 0, 0}, {"Off", "", ISS_OFF, 0, 0}}; static ISwitch HomeSearchS[] = { {"Save home", "", ISS_OFF, 0, 0} , {"Set home", "", ISS_OFF, 0, 0}}; static ISwitch FieldDeRotatorS[] = { {"On", "", ISS_OFF, 0, 0}, {"Off", "", ISS_OFF,0 ,0}}; //static ISwitch SlewAltAzS[] = { {"Slew To Alt/Az", ISS_ON}}; #define MAXINDINAME 32 #define MAXINDILABEL 32 #define MAXINDIDEVICE 32 #define MAXINDIGROUP 32 #define MAXINDIFORMAT 32 static ISwitchVectorProperty FanStatusSw = { mydev, "Fan", "", LX16GROUP, IP_RW, ISR_1OFMANY, 0, IPS_IDLE, FanStatusS, NARRAY(FanStatusS), "", 0}; static ISwitchVectorProperty HomeSearchSw = { mydev, "Park", "", LX16GROUP, IP_RW, ISR_1OFMANY, 0, IPS_IDLE, HomeSearchS, NARRAY(HomeSearchS), "", 0}; static ISwitchVectorProperty FieldDeRotatorSw = { mydev, "Field De-rotator", "", LX16GROUP, IP_RW, ISR_1OFMANY, 0, IPS_IDLE, FieldDeRotatorS, NARRAY(FieldDeRotatorS), "", 0}; //static ISwitches SlewAltAzSw = { mydev, "AltAzSet", "On Alt/Az Set", SlewAltAzS, NARRAY(SlewAltAzS), ILS_IDLE, 0, LX16Group}; /* horizontal position */ static INumber hor[] = { {"ALT", "Alt D:M:S", "%10.6m", -90., 90., 0., 0., 0, 0, 0}, {"AZ", "Az D:M:S", "%10.6m", 0., 360., 0., 0., 0, 0, 0}}; static INumberVectorProperty horNum = { mydev, "HORIZONTAL_COORD", "Horizontal Coords", LX16GROUP, IP_RW, 0, IPS_IDLE, hor, NARRAY(hor), "", 0};