61 AccuracyNP[0].
fill(
"ACCURACY",
"Degree (0=off)",
"%.2f", 0, 10, 0.1, 0);
101 LOG_INFO(
"Virtual Mechanical Angle is set to zero.");
105 return Rotator::ISNewSwitch(dev, name, states, names, n);
120 snprintf(
cmd, 16,
"%d", (
int)(
backlash * 10 + 1600000));
142 return Rotator::ISNewNumber(dev, name, values, names, n);
155 tcflush(
PortFD, TCIOFLUSH);
156 int nbytes_read_name = 0, nbytes_written = 0, rc = -1;
163 LOGF_ERROR(
"Serial write error: %s", errorMessage);
170 tcflush(
PortFD, TCIOFLUSH);
175 LOGF_ERROR(
"Serial write error: %s", errorMessage);
182 LOG_INFO(
"No data received, the device may not be WandererRotator, please check the serial port!");
183 LOGF_ERROR(
"Device read error: %s", errorMessage);
187 name[nbytes_read_name - 1] =
'\0';
195 int nbytes_read_version = 0;
196 char version[64] = {0};
199 version[nbytes_read_version - 1] =
'\0';
200 LOGF_INFO(
"Firmware Version:%s", version);
204 LOG_ERROR(
"The firmware is outdated, please upgrade to the latest firmware!");
210 char M_angle[64] = {0};
211 int nbytes_read_M_angle = 0;
213 M_angle[nbytes_read_M_angle - 1] =
'\0';
219 LOG_WARN(
"Virtual Mechanical Angle is too large, it is now set to zero!");
224 M_angle[nbytes_read_M_angle - 1] =
'\0';
229 char M_backlash[64] = {0};
230 int nbytes_read_M_backlash = 0;
232 M_backlash[nbytes_read_M_backlash - 1] =
'\0';
239 char M_reverse[64] = {0};
240 int nbytes_read_M_reverse = 0;
242 M_reverse[nbytes_read_M_reverse - 1] =
'\0';
253 tcflush(
PortFD, TCIOFLUSH);
273 int position = steps + 1000000;
275 snprintf(
cmd, 16,
"%d", position);
289 int nbytes_written = 0, rc = -1;
290 tcflush(
PortFD, TCIOFLUSH);
295 LOGF_ERROR(
"Serial write error: %s", errorMessage);
315 snprintf(
cmd, 16,
"%d", position);
330 snprintf(
cmd, 16,
"%d", 1700001);
342 snprintf(
cmd, 16,
"%d", 1700000);
375 char M_angle[64] = {0};
376 int nbytes_read_M_angle = 0;
388 M_angle[nbytes_read_M_angle - 1] =
'\0';
406 int nbytes_written = 0, rc = -1;
412 LOGF_ERROR(
"Serial write error: %s", errorMessage);
424 int nbytes_written = 0, rc = -1;
425 std::string command_termination =
"\n";
431 LOGF_ERROR(
"Serial write error: %s", errorMessage);
void setDefaultBaudRate(BaudRate newRate)
setDefaultBaudRate Set default baud rate. The default baud rate is 9600 unless otherwise changed by t...
bool updateProperty(PropertyType &property, ValueType *values, char *names[], int n, std::function< bool()> updater, bool saveConfig=false)
Generic helper function to update an INDI property based on an external operation.
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
bool load()
load Attempt to load property values from configuration file.
void save(FILE *f) const
save Save property to configuration file.
bool isNameMatch(const char *otherName) const
bool update(const double values[], const char *const names[], int n)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
void fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, ISRule rule, double timeout, IPState state)
void SetCapability(uint32_t cap)
SetRotatorCapability sets the Rotator capabilities. All capabilities must be initialized.
INDI::PropertyNumber GotoRotatorNP
Connection::Serial * serialConnection
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the reverse direction property in the configuration file
INDI::PropertyNumber BacklashNP
bool saveConfigItems(FILE *fp) override
saveConfigItems Saves the reverse direction property in the configuration file
bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
bool Handshake() override
perform handshake with device to check communication
bool ReverseRotator(bool enabled) override
ReverseRotator Reverse the direction of the rotator. CW is usually the normal direction,...
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual const char * getRotatorHandshakeName()=0
bool AbortRotator() override
AbortRotator Abort all motion.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
IPState MoveRotator(double angle) override
MoveRotator Go to specific angle.
INDI::PropertyNumber AccuracyNP
IPState HomeRotator() override
WandererRotatorBase::HomeRotator.
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual const char * getDefaultName() override=0
virtual int getMinimumCompatibleFirmwareVersion()=0
virtual int getStepsPerDegree()=0
bool Move(const char *cmd)
bool sendCommand(std::string command)
INDI::PropertySwitch SetZeroSP
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Implementations for common driver routines.
#define LOGF_INFO(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)