30#define FIRMWARE_TAB "Firmware data"
51 return "LX200 esp32go";
64 GuideRateNP[0].
fill(
"GUIDE_RATE_WE",
"W/E Rate",
"%g", 0, 2, 0.05, 0.5);
65 GuideRateNP[1].
fill(
"GUIDE_RATE_NS",
"N/S Rate",
"%g", 0, 2, 0.05, 0.5);
150 LOG_WARN(
"Parking is not implemented in PicGoto mode. Consider upgrading to ESP32go.");
167 bool longPoll =
false;
168 bool _checkTracking =
false;
195 LOG_INFO(
"Slew is complete. Tracking...");
211 _checkTracking =
true;
231 if (error_or_fail > 1)
234 if (strstr(statusData,
"S"))
238 _checkTracking =
false;
241 if (strstr(statusData,
"P"))
251 _checkTracking =
false;
255 if (strstr(statusData,
"W"))
269 if (strstr(statusData,
"4"))
271 else if (strstr(statusData,
"3"))
273 else if (strstr(statusData,
"2"))
276 if(_TrackingMode != _PreviousTrackingMode)
287 auto nowTracking =
ISS_ON;
288 if(strstr(statusData,
"t"))
290 if (wasTracking != nowTracking)
296 LOG_ERROR(
"Error reading mount status.");
312 LOG_WARN(
"SetTrackMode not supported in this mode. Please consider upgrading. Back to Sidereal");
326 if(!strcmp(resp,
"EAST"))
328 else if (!strcmp(resp,
"WEST"))
343 double pulseguiderate = 0.0;
346 LOG_ERROR(
"Error reading GuideRate for RA.");
352 LOG_ERROR(
"Error reading GuideRate for DEC.");
364 LOG_WARN(
"Communication error on Focuser Update, this update aborted, will try again...");
381 int nbytes_write = 0, nbytes_read = 0;
388 tcflush(
fd, TCIFLUSH);
395 timeout = timeout / 4;
398 tcflush(
fd, TCIFLUSH);
400 term = strchr(data,
'#');
405 data[nbytes_read] =
'\0';
409 LOG_DEBUG(
"got RBB_MAX_LEN bytes back, last byte set to null and possible overflow");
427 tcflush(
fd, TCIOFLUSH);
431 tcflush(
fd, TCIOFLUSH);
438 LOGF_DEBUG(
"flushIO: Information in buffer: Bytes: %u, string: %s", nbytes_read, discard_data);
442 while (error_type > 0);
451 int nbytes_write = 0, nbytes_read = 0;
463 tcflush(
fd, TCIFLUSH);
468 term = strchr(data,
'#');
473 data[nbytes_read] =
'\0';
477 LOG_DEBUG(
"got RB_MAX_LEN bytes back (which should never happen), last byte set to null and possible overflow");
488 const char *start = str;
492 while ((end = strchr(start,
'\n')) != NULL) {
493 size_t length = end - start;
494 strncpy(array[*count], start, length);
495 array[*count][length] =
'\0';
501 strcpy(array[*count], start);
551 snprintf(buffer,
sizeof(buffer),
"TrackMode: %d not supported",mode);
576 LOG_WARN(
"Going Home is not implemented in PicGoto mode. Consider upgrading to ESP32go.");
587 LOG_WARN(
"Home reset is not implemented in PicGoto mode. Consider upgrading to ESP32go.");
590 LOG_INFO(
"Resetting current position to Home");
602 LOG_WARN(
"Finding home position is not supported.");
615 bool _MountTypeSP_Apply =
false;
616 bool _TrackStateSP_Apply =
false;
617 bool _VersionTP_Apply =
false;
618 bool _GuideRateNP_Apply =
false;
619 bool _SetParked =
false;
632 if (error_or_fail > 1)
643 _GuideRateNP_Apply=
true;
652 else if(*lines[18]==
'2')
662 _MountTypeSP_Apply=
true;
666 LOG_WARN(
"Cannot check configuration. Activating limited PicGoto mode");
672 if(MountAlign[0] ==
'A')
682 _MountTypeSP_Apply=
true;
684 double version = 0.0;
688 LOG_WARN(
"Cannot check FW version. Activating limited PicGoto mode");
703 if (error_or_fail > 1)
708 if (strstr(statusData,
"T"))
720 _TrackStateSP_Apply=
true;
722 if (strstr(statusData,
"P"))
732 LOG_INFO(
"Status and TrackMode NOT supported. Consider updating FW.");
738 LOG_INFO(
"Pre v06.3 FW. Dectivating guidePulse periodic check");
740 char buffer[128] = {0};
749 _VersionTP_Apply=
true;
757 LOG_ERROR(
"Error reading tracking status.");
773 _TrackStateSP_Apply=
true;
781 if(_MountTypeSP_Apply)
783 if(_TrackStateSP_Apply)
785 if(_GuideRateNP_Apply)
798 int nbytes_write = 0;
805 tcflush(
PortFD, TCIFLUSH);
810 LOGF_ERROR(
"CHECK CONNECTION: Error sending command %s",
cmd);
827 char read_buffer[32];
828 snprintf(read_buffer,
sizeof(read_buffer),
":FA+%05d#",
int(targetTicks));
835 LOG_INFO(
"Unable to move focuser, out of range");
845 char read_buffer[32];
847 snprintf(read_buffer,
sizeof(read_buffer),
":FP%c%05d#", s, ticks);
859 strncpy(
cmd,
":FQ#",
sizeof(
cmd));
873 LOG_ERROR(
"Error reading focuser status.");
888 LOG_ERROR(
"Error reading focuser position.");
void setDefaultHost(const char *addressHost)
void setDefaultPort(uint32_t addressPort)
void setActiveConnection(Connection::Interface *existingConnection)
setActiveConnection Switch the active connection to the passed connection plugin
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
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)
bool isSimulation() const
uint32_t getDriverInterface() const
INDI::PropertyNumber FocusRelPosNP
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
void initProperties(const char *groupName)
Initialize focuser properties. It is recommended to call this function within initProperties() of you...
INDI::PropertyNumber FocusAbsPosNP
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
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 fill(const char *device, const char *name, const char *label, const char *group, IPerm permission, double timeout, IPState state)
TelescopeStatus TrackState
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
Connection::TCP * tcpConnection
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_HAS_TRACK_MODE
@ TELESCOPE_CAN_CONTROL_TRACK
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
void setPierSide(TelescopePierSide side)
virtual bool initProperties() override
Called to initialize basic properties required all the time.
@ LX200_HAS_PULSE_GUIDING
virtual bool Park() override
Park the telescope to its home position.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool isSlewComplete()
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual void getBasicData()
void setLX200Capability(uint32_t cap)
void splitString(const char *str, char array[][100], int *count)
IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
const char * getDefaultName() override
IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
bool initProperties() override
Called to initialize basic properties required all the time.
long int OSTimeoutMicroSeconds
INDI::PropertyText VersionTP
bool sendCommandBlind(const char *cmd)
int getCommandSingleCharResponse(int fd, char *data, const char *cmd)
virtual void getBasicData() override
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
bool AbortFocuser() override
AbortFocuser all focus motion.
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
int getCommandSingleCharErrorOrLongResponse(int fd, char *data, const char *cmd, bool shortTimeout)
virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override
Execute a homing action.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool UnPark() override
Unpark the telescope if already parked.
INDI::PropertyNumber GuideRateNP
bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
long int OSTimeoutSeconds
virtual bool Park() override
Park the telescope to its home position.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of the device are located.
const char * FOCUS_TAB
FOCUS_TAB Where all the properties for focuser are located.
INDI::PropertyNumber EqNP
INDI::PropertySwitch TrackStateSP
INDI::PropertySwitch HomeSP
INDI::PropertySwitch SlewRateSP
INDI::PropertySwitch TrackModeSP
INDI::PropertySwitch MountTypeSP
int tty_write_string(int fd, const char *buf, int *nbytes_written)
Writes a null terminated string to fd.
int tty_read_expanded(int fd, char *buf, int nbytes, long timeout_seconds, long timeout_microseconds, int *nbytes_read)
read buffer from terminal with a delimiter
int tty_nread_section_expanded(int fd, char *buf, int nsize, char stop_char, long timeout_seconds, long timeout_microseconds, int *nbytes_read)
read buffer from terminal with a delimiter
#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,...)
#define DEBUGF(priority, msg,...)
std::mutex lx200CommsLock
int getCommandInt(int fd, int *value, const char *cmd)
int getCommandSexa(int fd, double *value, const char *cmd)
int getCommandString(int fd, char *data, const char *cmd)
#define getVersionDate(fd, x)
#define getVersionTime(fd, x)
#define getLX200DEC(fd, x)
#define getVersionNumber(fd, x)
#define getLX200RA(fd, x)
#define getProductName(fd, x)