diff -Naur indi/drivers/focuser/hitecastrodcfocuser.cpp indi-new/drivers/focuser/hitecastrodcfocuser.cpp --- indi/drivers/focuser/hitecastrodcfocuser.cpp 2020-03-25 11:02:13.548172682 +0000 +++ indi-new/drivers/focuser/hitecastrodcfocuser.cpp 2020-04-03 16:29:39.814514801 +0100 @@ -22,10 +22,12 @@ #include #include +#include #define HID_TIMEOUT 10000 /* 10s */ #define FUDGE_FACTOR_H 1000 #define FUDGE_FACTOR_L 885 +#define PI 3.14159265 #define FOCUS_SETTINGS_TAB "Settings" @@ -146,6 +148,14 @@ IUFillNumberVector(&SlewSpeedNP, SlewSpeedN, 1, getDeviceName(), "SLEW_SPEED", "Slew speed", MAIN_CONTROL_TAB, IP_RW, 0, IPS_IDLE); + IUFillNumber(&OutFocusFactorN[0], "Out Focus Factor", "", "%.2f", 0, 1, 0.05, 0.50); + IUFillNumberVector(&OutFocusFactorNP, OutFocusFactorN, 1, getDeviceName(), "OUT_FOCUS_FACTOR", "Out Focus Factor", MAIN_CONTROL_TAB, + IP_RW, 0, IPS_IDLE); + + IUFillNumber(&TelescopeAltN[0], "Telescope Altitude", "", "%.1f", 0, 90, 0.5, 45); + IUFillNumberVector(&TelescopeAltNP, TelescopeAltN, 1, getDeviceName(), "TELESCOPE_ALT", "Telescope Altitude", MAIN_CONTROL_TAB, + IP_RW, 0, IPS_IDLE); + // IUFillSwitch(&ReverseDirectionS[0], "ENABLED", "Reverse direction", ISS_OFF); // IUFillSwitchVector(&ReverseDirectionSP, ReverseDirectionS, 1, getDeviceName(), "REVERSE_DIRECTION", // "Reverse direction", OPTIONS_TAB, IP_RW, ISR_NOFMANY, 0, IPS_IDLE); @@ -173,12 +183,16 @@ { //defineNumber(&MaxPositionNP); defineNumber(&SlewSpeedNP); + defineNumber(&OutFocusFactorNP); + defineNumber(&TelescopeAltNP); //defineSwitch(&ReverseDirectionSP); } else { //deleteProperty(MaxPositionNP.name); deleteProperty(SlewSpeedNP.name); + deleteProperty(OutFocusFactorNP.name); + deleteProperty(TelescopeAltNP.name); //deleteProperty(ReverseDirectionSP.name); } @@ -231,6 +245,31 @@ IDSetNumber(&SlewSpeedNP, nullptr); return true; } + if (strcmp(name, OutFocusFactorNP.name) == 0) + { + if (values[0] > 1) + { + OutFocusFactorNP.s = IPS_ALERT; + return false; + } + IUUpdateNumber(&OutFocusFactorNP, values, names, n); + OutFocusFactorNP.s = IPS_OK; + IDSetNumber(&OutFocusFactorNP, nullptr); + return true; + } + if (strcmp(name, TelescopeAltNP.name) == 0) + { + if (values[0] > 90) + { + TelescopeAltNP.s = IPS_ALERT; + return false; + } + IUUpdateNumber(&TelescopeAltNP, values, names, n); + TelescopeAltNP.s = IPS_OK; + IDSetNumber(&TelescopeAltNP, nullptr); + return true; + } + } return INDI::Focuser::ISNewNumber(dev, name, values, names, n); } @@ -250,6 +289,15 @@ return IPS_ALERT; } + if (dir == FOCUS_INWARD) + { + speed = SlewSpeedN[0].value; + } + if (dir == FOCUS_OUTWARD) + { + speed = int(SlewSpeedN[0].value-(SlewSpeedN[0].value*(1-OutFocusFactorN[0].value)*sin(TelescopeAltN[0].value*PI/180))); + } + // FocusRelPosNP.s = IPS_BUSY; // IDSetNumber(&FocusRelPosNP, nullptr); @@ -380,6 +428,8 @@ //IUSaveConfigNumber(fp, &MaxPositionNP); IUSaveConfigNumber(fp, &SlewSpeedNP); + IUSaveConfigNumber(fp, &OutFocusFactorNP); + IUSaveConfigNumber(fp, &TelescopeAltNP); //IUSaveConfigSwitch(fp, &ReverseDirectionSP); return true; diff -Naur indi/drivers/focuser/hitecastrodcfocuser.h indi-new/drivers/focuser/hitecastrodcfocuser.h --- indi/drivers/focuser/hitecastrodcfocuser.h 2020-03-25 11:02:13.548172682 +0000 +++ indi-new/drivers/focuser/hitecastrodcfocuser.h 2020-04-03 16:29:39.814514801 +0100 @@ -64,6 +64,10 @@ INumber SlewSpeedN[1]; INumberVectorProperty SlewSpeedNP; + INumber OutFocusFactorN[1]; + INumberVectorProperty OutFocusFactorNP; + INumber TelescopeAltN[1]; + INumberVectorProperty TelescopeAltNP; // ISwitch ReverseDirectionS[1]; // ISwitchVectorProperty ReverseDirectionSP;