Instrument Neutral Distributed Interface INDI  1.9.5
teenastro.cpp
Go to the documentation of this file.
1 /*
2  TeenAstro Focuser
3  Copyright (C) 2021 Markus Noga
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 */
20 
21 #include "teenastro.h"
22 #include "indicom.h"
23 #include "indicontroller.h"
24 
25 #include <unistd.h> // for sleep()
26 #include <termios.h> // for tcflush
27 
28 // Default, minimal and maximal values for focuser configuration properties
29 // In absolute units (not device units, where e.g. current is /10 and microsteps are log_2)
30 //
31 
32 #define TAF_curr_default 500
33 #define TAF_curr_min 100
34 #define TAF_curr_max 1600
35 #define TAF_micro_default (1<<4)
36 #define TAF_micro_min (1<<2)
37 #define TAF_micro_max (1<<7)
38 #define TAF_steprot_default 200
39 #define TAF_steprot_min 10
40 #define TAF_steprot_max 800
41 #define TAF_pos_default 0
42 #define TAF_pos_min 0
43 #define TAF_pos_max 2000000000UL
44 #define TAF_speed_default 20
45 #define TAF_speed_min 1
46 #define TAF_speed_max 999
47 #define TAF_acc_default 30
48 #define TAF_acc_min 1
49 #define TAF_acc_max 99
50 #define TAF_res_default 16
51 #define TAF_res_min 1
52 #define TAF_res_max 512
53 
54 #define TAF_UI_STEPS 100.0
55 #define TAF_STEP(min,max) (((max)-(min))/(TAF_UI_STEPS))
56 
57 
58 #define TAF_FOCUSER_TIMEOUT 2
59 #define TAF_FOCUSER_BUFSIZE 128
60 
61 // Focuser singleton
62 std::unique_ptr<TeenAstroFocuser> teenAstroFocuser(new TeenAstroFocuser());
63 
64 // Public methods
65 //
66 
68 {
71 }
72 
74 {
75 }
76 
78 {
79  return "TeenAstroFocuser";
80 }
81 
83 {
84  char resp[TAF_FOCUSER_BUFSIZE];
85 
86  // Issue handshake challenge for TeenAstro focuser
87  if(!sendAndReceive(":FV#", resp, TAF_FOCUSER_BUFSIZE))
88  return false;
89  if (strncmp(resp, "$ TeenAstro Focuser ",20))
90  {
91  DEBUGF(INDI::Logger::DBG_ERROR, "Handshake response: %s", resp);
92  return false;
93  }
94 
95  // TeenAstro mounts internally forward focuser commands via a
96  // serial connection. When mount & focuser are both on USB,
97  // and scanning for devices, a race condition can occur. The
98  // focuser device driver may probe the USB connection of the
99  // mount first, and receive a correct response to the focuser
100  // handshake challenge. Then the focuser driver would block
101  // the USB port of the mount. And the scan performed by
102  // mount driver would fail. To avoid this race condition,
103  // we issue the handshake challenge for a LX200 mount and
104  // abort if it is answered.
105  if(!sendAndExpectTimeout(":GR#", resp, TAF_FOCUSER_BUFSIZE))
106  {
107  DEBUGF(INDI::Logger::DBG_DEBUG, "Device responded to focuser and mount handshake (%s), skipping.", resp);
108  return false;
109  }
110 
111  DEBUGF(INDI::Logger::DBG_DEBUG, "TeenAstroFocuser %s found", &resp[20]);
112  return true;
113 }
114 
116 {
118 
119  strcpy(FocusSyncN[0].label, "Ticks"); // Rename unit of measure to ticks, to avoid confusion with motor steps,
120  strcpy(FocusMaxPosN[0].label,"Ticks"); // motor microsteps and the effect of the resolution setting.
121  strcpy(FocusRelPosN[0].label,"Ticks"); // Ticks are resolution units.
122  strcpy(FocusAbsPosN[0].label,"Ticks");
123 
124  strcpy(FocusReverseSP.group, FOCUS_TAB);
125 
126  strcpy(FocusSpeedNP.label, "Go-to speed");
127  strcpy(FocusSpeedNP.group, FOCUS_TAB);
128  strcpy(FocusSpeedN[0].label,"Steps/s");
129  FocusSpeedN[0].min=TAF_speed_min;
130  FocusSpeedN[0].max=TAF_speed_max;
132 
133  // Main control tab
134  //
135 
136  IUFillNumber(&CfgParkPosN[0], "VAL", "Ticks", "%.f", 0, 100000, 1000, 0);
137  IUFillNumberVector(&CfgParkPosNP, CfgParkPosN, 1, getDeviceName(), "PARK_POS", "Park position", MAIN_CONTROL_TAB, IP_RW, 60, IPS_IDLE );
138 
139  IUFillSwitch(&GoToParkS[0], "VAL", "Park", ISS_OFF);
140  IUFillSwitchVector(&GoToParkSP, GoToParkS, 1, getDeviceName(), "GOTO_PARK", "Go-to park", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE );
141 
143  IUFillNumberVector(&CurSpeedNP, CurSpeedN, 1, getDeviceName(), "CUR_SPEED", "Current Speed", MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE );
144 
145  IUFillNumber(&TempN[0], "VAL", "Celsius", "%+.1f°", -50., 50., 0, 0);
146  IUFillNumberVector(&TempNP, TempN, 1, getDeviceName(), "TEMP", "Temperature", MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE );
147 
148  // Focuser tab
149  //
150 
151  IUFillText(&DeviceVersionT[0], "VAL", "Version", "unknown");
152  IUFillTextVector(&DeviceVersionTP, DeviceVersionT, 1, getDeviceName(), "DEVICE_VERSION", "Device version", FOCUS_TAB, IP_RO, 60, IPS_IDLE);
153 
154  // Focuser tab: Motor configuration
155  //
156 
159 
167 
170 
172  IUFillNumberVector(&CfgMotorCurrentNP, CfgMotorCurrentN, 1, getDeviceName(), "MOT_CUR", "Motor current", FOCUS_TAB, IP_RW, 60, IPS_IDLE );
173 
174  // Focuser tab: Motion configuration
175  //
176 
178  IUFillNumberVector(&CfgGoToAccNP, CfgGoToAccN, 1, getDeviceName(), "GOTO_ACCEL", "Go-to accel.", FOCUS_TAB, IP_RW, 60, IPS_IDLE );
179 
181  IUFillNumberVector(&CfgManualSpeedNP, CfgManualSpeedN, 1, getDeviceName(), "MAN_SPEED", "Manual speed", FOCUS_TAB, IP_RW, 60, IPS_IDLE );
182 
184  IUFillNumberVector(&CfgManualAccNP, CfgManualAccN, 1, getDeviceName(), "MAN_ACCEL", "Manual accel.", FOCUS_TAB, IP_RW, 60, IPS_IDLE );
185 
187  IUFillNumberVector(&CfgManualDecNP, CfgManualDecN, 1, getDeviceName(), "MAN_DECEL", "Manual decel.", FOCUS_TAB, IP_RW, 60, IPS_IDLE );
188 
189  // Focuser tab: Device actions
190  //
191 
192  IUFillSwitch(&RebootDeviceS[0], "VAL", "Reboot", ISS_OFF);
193  IUFillSwitchVector(&RebootDeviceSP, RebootDeviceS, 1, getDeviceName(), "REBOOT_DEVICE", "Reboot device", FOCUS_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE );
194 
195  IUFillSwitch(&EraseEEPROMS[0], "VAL", "Erase", ISS_OFF);
196  IUFillSwitchVector(&EraseEEPROMSP, EraseEEPROMS, 1, getDeviceName(), "ERASE_EEPROM", "Erase EEPROM", FOCUS_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE );
197 
198  addDebugControl();
199 
200  return true;
201 }
202 
204 {
205  FocusAbsPosN[0].max = FocusRelPosN[0].max = FocusSyncN[0].max = CfgParkPosN[0].max = maxPos;
206  FocusAbsPosN[0].step = FocusRelPosN[0].step = FocusSyncN[0].step = CfgParkPosN[0].step = maxPos / TAF_UI_STEPS;
207 }
208 
210 {
212  return false;
213 
214  if (isConnected())
215  {
216  // Update values from device before defining UI controls.
217  // This minimizes flicker as changes to FocuserMaxPosNP
218  // must redraw all positional controls to update their range.
220  return false;
221 
224 
225  DEBUG(INDI::Logger::DBG_DEBUG, "TeenAstroFocuser ready for use.");
226  }
227  else
228  {
231  }
232 
233  return true;
234 }
235 
237 {
238  deleteProperty(FocusSyncNP.name); // remove superclass controls to improve ordering of UI elements
243 
253 }
254 
256 {
261 }
262 
264 {
265  deleteProperty(FocusReverseSP.name); // Place this on the focuser tab to avoid clutter
267 
269 
275 
281 
284 }
285 
287 {
289 
294 
299 
302 }
303 
304 bool TeenAstroFocuser::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
305 {
306  if(dev==NULL || strcmp(dev,getDeviceName()))
307  return INDI::Focuser::ISNewSwitch(dev, name, states, names, n);
308 
309  if(!strcmp(name, GoToParkSP.name)) {
311  IDSetSwitch(&GoToParkSP, NULL);
312  bool res=goToPark();
313  GoToParkS[0].s=ISS_OFF;
314  GoToParkSP.s= res ? IPS_OK : IPS_ALERT;
315  IDSetSwitch(&GoToParkSP, NULL);
316  return res;
317  }
318  else if(!strcmp(name, CfgMotorMicrostepsSP.name))
319  {
320  // parse selected number of usteps from states and labels. Labels are "Vxxx" where xxx is a number
321  uint32_t usteps=0;
322  for(int i=0; i<n; i++)
323  if(states[i]==ISS_ON)
324  usteps=atoi(names[i]);
325 
326  bool res=setMotorMicrosteps(usteps);
327  if(res)
328  IUUpdateSwitch(&CfgMotorMicrostepsSP, states, names, n);
331  return res;
332  }
333  else if(!strcmp(name, RebootDeviceSP.name))
334  {
336  IDSetSwitch(&RebootDeviceSP, NULL);
337  bool res=rebootDevice();
338  RebootDeviceS[0].s=ISS_OFF;
339  RebootDeviceSP.s= res ? IPS_OK : IPS_ALERT;
340  IDSetSwitch(&RebootDeviceSP, NULL);
341  return res;
342  }
343  else if(!strcmp(name, EraseEEPROMSP.name))
344  {
346  IDSetSwitch(&EraseEEPROMSP, NULL);
347  bool res=eraseDeviceEEPROM();
348  EraseEEPROMS[0].s=ISS_OFF;
349  EraseEEPROMSP.s= res ? IPS_OK : IPS_ALERT;
350  IDSetSwitch(&EraseEEPROMSP, NULL);
351  return res;
352  } else
353  return INDI::Focuser::ISNewSwitch(dev, name, states, names, n);
354 }
355 
356 bool TeenAstroFocuser::ISNewNumberHelper(INumberVectorProperty *NP, double values[], char *names[], int n, bool res)
357 {
358  if(res)
359  IUUpdateNumber(NP, values, names, n);
360  NP->s=res ? IPS_OK : IPS_ALERT;
361  IDSetNumber(NP, NULL);
362  return res;
363 }
364 
365 bool TeenAstroFocuser::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
366 {
367  if(dev==NULL || strcmp(dev,getDeviceName()))
368  return INDI::Focuser::ISNewNumber(dev, name, values, names, n);
369 
370  if(!strcmp(name, FocusSyncNP.name))
371  {
372  bool res=SyncFocuser((uint32_t) rint(values[0]));
373  return ISNewNumberHelper(&FocusSyncNP, values, names, n, res);
374  }
375  else if(!strcmp(name, CfgParkPosNP.name))
376  {
377  bool res=setParkPos((uint32_t) rint(values[0]));
378  return ISNewNumberHelper(&CfgParkPosNP, values, names, n, res);
379  }
380  else if(!strcmp(name, FocusMaxPosNP.name))
381  {
382  uint32_t val=(uint32_t) rint(values[0]);
383  bool res=SetFocuserMaxPosition(val);
384  if(res && FocusMaxPosN[0].value!=val) {
386  deleteMainControlProperties(); // Force redraw of UI controls as IUUpdateMinMax
387  defineMainControlProperties(); // does not reliably update the step size.
388  }
389  return ISNewNumberHelper(&FocusMaxPosNP, values, names, n, res);
390  }
391  else if(!strcmp(name, CfgManualSpeedNP.name))
392  {
393  bool res=setManualSpeed((uint32_t) rint(values[0]));
394  return ISNewNumberHelper(&CfgManualSpeedNP, values, names, n, res);
395  }
396  else if(!strcmp(name, FocusSpeedNP.name))
397  {
398  bool res=SetFocuserSpeed(rint(values[0]));
399  return ISNewNumberHelper(&FocusSpeedNP, values, names, n, res);
400  }
401  else if(!strcmp(name, CfgGoToAccNP.name))
402  {
403  bool res=setGoToAcc((uint32_t) rint(values[0]));
404  return ISNewNumberHelper(&CfgGoToAccNP, values, names, n, res);
405  }
406  else if(!strcmp(name, CfgManualAccNP.name))
407  {
408  bool res=setManualAcc((uint32_t) rint(values[0]));
409  return ISNewNumberHelper(&CfgManualAccNP, values, names, n, res);
410  }
411  else if(!strcmp(name, CfgManualDecNP.name))
412  {
413  bool res=setManualDec((uint32_t) rint(values[0]));
414  return ISNewNumberHelper(&CfgManualDecNP, values, names, n, res);
415  }
416  else if(!strcmp(name, CfgMotorStepsPerRevolutionNP.name))
417  {
418  bool res=setMotorStepsPerRevolution((uint32_t) rint(values[0]));
419  return ISNewNumberHelper(&CfgMotorStepsPerRevolutionNP, values, names, n, res);
420  }
421  else if(!strcmp(name, CfgMotorResolutionNP.name))
422  {
423  bool res=setMotorResolution((uint32_t) rint(values[0]));
424  return ISNewNumberHelper(&CfgMotorResolutionNP, values, names, n, res);
425  }
426  else if(!strcmp(name, CfgMotorCurrentNP.name))
427  {
428  bool res=setMotorCurrent((uint32_t) rint(values[0]));
429  return ISNewNumberHelper(&CfgMotorCurrentNP, values, names, n, res);
430  }
431  else
432  return INDI::Focuser::ISNewNumber(dev, name, values, names, n);
433 }
434 
435 
437 {
439  IDSetNumber(&FocusAbsPosNP, NULL);
441  IDSetNumber(&FocusRelPosNP, NULL);
442 
443  if(!goTo(pos)) {
445  IDSetNumber(&FocusAbsPosNP, NULL);
447  IDSetNumber(&FocusRelPosNP, NULL);
448 
449  return IPS_ALERT;
450  }
451  return IPS_BUSY;
452 }
453 
455 {
456  FocusRelPosN[0].value = ticks;
457 
458  uint32_t pos=uint32_t(FocusAbsPosN[0].value);
459  if (dir == FOCUS_INWARD)
460  pos -= ticks;
461  else
462  pos += ticks;
463 
464  return MoveAbsFocuser(pos);
465 }
466 
468 {
469  if(!isConnected())
470  return;
471 
472  updateState();
474 }
475 
477 {
479  IDSetSwitch(&FocusAbortSP, NULL);
480 
481  if(!stop()) {
483  IDSetSwitch(&FocusAbortSP, NULL);
484  return false;
485  }
487  IDSetSwitch(&FocusAbortSP, NULL);
488 
489  return updateState();
490 }
491 
492 
493 // Protected methods
494 //
495 
496 bool TeenAstroFocuser::send(const char *const msg) {
497  DEBUGF(INDI::Logger::DBG_DEBUG, "send(\"%s\")", msg);
498 
499  tcflush(PortFD, TCIOFLUSH);
500 
501  int nbytes_written=0, rc=-1;
502  if ( (rc = tty_write(PortFD, msg, strlen(msg), &nbytes_written)) != TTY_OK)
503  {
504  char errstr[MAXRBUF];
505  tty_error_msg(rc, errstr, MAXRBUF);
506  DEBUGF(INDI::Logger::DBG_ERROR, "send(\"%s\"): %s.", msg, errstr);
507  return false;
508  }
509  return true;
510 }
511 
512 
513 bool TeenAstroFocuser::sendAndReceive(const char *const msg, char *resp, int bufsize) {
514  if(!send(msg))
515  return false;
516 
517  int nbytes_read=0;
518  int rc = tty_nread_section(PortFD, resp, bufsize, '#', TAF_FOCUSER_TIMEOUT, &nbytes_read);
519  resp[nbytes_read]='\0';
520  if(rc!=TTY_OK || nbytes_read==0 || resp[nbytes_read-1]!='#')
521  {
522  char errstr[MAXRBUF];
523  tty_error_msg(rc, errstr, MAXRBUF);
524  DEBUGF(INDI::Logger::DBG_ERROR, "sendAndReceive(\"%s\") received \"%s\": %s.", msg, resp, errstr);
525  return false;
526  }
527  DEBUGF(INDI::Logger::DBG_DEBUG, "sendAndReceive(\"%s\") received \"%s\".", msg, resp);
528  return true;
529 }
530 
531 bool TeenAstroFocuser::sendAndReceiveBool(const char *const msg) {
532  if(!send(msg))
533  return false;
534 
535  char resp[2];
536  int nbytes_read=0;
537  int rc = tty_read(PortFD, resp, 1, TAF_FOCUSER_TIMEOUT, &nbytes_read);
538  resp[nbytes_read]='\0';
539  if(rc!=TTY_OK || resp[0]!='1')
540  {
541  char errstr[MAXRBUF];
542  tty_error_msg(rc, errstr, MAXRBUF);
543  DEBUGF(INDI::Logger::DBG_ERROR, "sendAndReceiveBool(\"%s\") received \"%s\": %s.", msg, resp, errstr);
544  return false;
545  }
546  DEBUGF(INDI::Logger::DBG_DEBUG, "sendAndReceiveBool(\"%s\") received \"%s\".", msg, resp);
547  return resp[0]=='1';
548 }
549 
550 
551 bool TeenAstroFocuser::sendAndExpectTimeout(const char *const msg, char *resp, int bufsize) {
552  if(!send(msg))
553  return false;
554 
555  int nbytes_read=0;
556  int rc = tty_nread_section(PortFD, resp, bufsize, '#', TAF_FOCUSER_TIMEOUT, &nbytes_read);
557  resp[nbytes_read]='\0';
558  if(rc!=TTY_TIME_OUT || nbytes_read!=0)
559  {
560  char errstr[MAXRBUF];
561  tty_error_msg(rc, errstr, MAXRBUF);
562  DEBUGF(INDI::Logger::DBG_ERROR, "sendAndExpectTimeout(\"%s\") received \"%s\".", msg, resp);
563  return false;
564  }
565  DEBUGF(INDI::Logger::DBG_DEBUG, "sendAndExpectTimeout(\"%s\") got timeout.", msg, resp);
566  return true;
567 }
568 
569 
571 {
572  char resp[TAF_FOCUSER_BUFSIZE];
573  if(!sendAndReceive(":FV#", resp, TAF_FOCUSER_BUFSIZE))
574  return false;
575  int len=strlen(resp);
576  resp[len-1]=0;
577  IUSaveText(&DeviceVersionT[0], resp+2);
579  IDSetText(&DeviceVersionTP, NULL);
580  return true;
581 }
582 
584 {
585  char resp[TAF_FOCUSER_BUFSIZE];
586  int pos=-1, speed=-1;
587  float temp=-1;
588 
589  if(!sendAndReceive(":F?#", resp, TAF_FOCUSER_BUFSIZE))
590  return false;
591 
592  if(sscanf(resp, "?%d %d %f#", &pos, &speed, &temp)<=0)
593  {
594  DEBUGF(INDI::Logger::DBG_ERROR, "Invalid format: focuser state (%s)", resp);
595  return false;
596  }
597 
598  if(FocusAbsPosNP.s==IPS_BUSY && speed==0)
599  DEBUG(INDI::Logger::DBG_SESSION, "Focuser reached target position.");
600 
601  FocusAbsPosN[0].value = pos;
602  FocusAbsPosNP.s = speed>0 ? IPS_BUSY : IPS_OK;
603  IDSetNumber(&FocusAbsPosNP, NULL);
604 
605  FocusRelPosNP.s = speed>0 ? IPS_BUSY : IPS_OK;
606  IDSetNumber(&FocusRelPosNP, NULL);
607 
608  CurSpeedN[0].value = speed;
609  CurSpeedNP.s = speed>0 ? IPS_BUSY : IPS_OK;
610  IDSetNumber(&CurSpeedNP, NULL);
611 
612  TempN[0].value = temp;
613  TempNP.s = (temp==-99) ? IPS_ALERT : IPS_OK;
614  IDSetNumber(&TempNP, NULL);
615 
616  return true;
617 }
618 
620 {
621  if(!updateState())
622  return false;
623  return CurSpeedN[0].value > 0;
624 }
625 
626 
628 {
629  char resp[TAF_FOCUSER_BUFSIZE];
630  int parkPos=-1, maxPos=-1, manualSpeed=-1, goToSpeed=-1, gotoAcc=-1, manAcc=-1, manDec=-1;
631 
632  if(!sendAndReceive(":F~#", resp, TAF_FOCUSER_BUFSIZE))
633  return false;
634 
635  if(sscanf(resp, "~%d %d %d %d %d %d %d#", &parkPos, &maxPos, &manualSpeed, &goToSpeed, &gotoAcc, &manAcc, &manDec)<=0)
636  {
637  DEBUGF(INDI::Logger::DBG_ERROR, "Invalid format: focuser motion config (%s)", resp);
638  return false;
639  }
640 
641  if(maxPos!=FocusMaxPosN[0].value)
643 
644  CfgParkPosN[0].value = parkPos;
646  IDSetNumber(&CfgParkPosNP, NULL);
647  FocusMaxPosN[0].value = maxPos;
649  IDSetNumber(&FocusMaxPosNP, NULL);
650  CfgManualSpeedN[0].value = manualSpeed;
653  FocusSpeedN[0].value = goToSpeed;
655  IDSetNumber(&FocusSpeedNP, NULL);
656  CfgGoToAccN[0].value = gotoAcc;
658  IDSetNumber(&CfgGoToAccNP, NULL);
659  CfgManualAccN[0].value = manAcc;
661  IDSetNumber(&CfgManualAccNP, NULL);
662  CfgManualDecN[0].value = manDec;
664  IDSetNumber(&CfgManualDecNP, NULL);
665 
666  return true;
667 }
668 
669 bool TeenAstroFocuser::setConfigItem(char item, uint32_t deviceValue)
670 {
671  char cmd[64];
672  snprintf(cmd, 64, ":F%c,%d#", item, deviceValue);
673  return sendAndReceiveBool(cmd);
674 }
675 
676 bool TeenAstroFocuser::setParkPos(uint32_t value)
677 {
678  return setConfigItem('0', value);
679 }
680 
682 {
683  return setConfigItem('1', value);
684 }
685 
687 {
688  return setConfigItem('2', value);
689 }
690 
692 {
693  return setConfigItem('3', (uint32_t) value);
694 }
695 
696 bool TeenAstroFocuser::setGoToAcc(uint32_t value)
697 {
698  return setConfigItem('4', value);
699 }
700 
701 bool TeenAstroFocuser::setManualAcc(uint32_t value)
702 {
703  return setConfigItem('5', value);
704 }
705 
706 bool TeenAstroFocuser::setManualDec(uint32_t value)
707 {
708  return setConfigItem('6', value);
709 }
710 
711 
713 {
714  char resp[TAF_FOCUSER_BUFSIZE];
715  int reverse=-1, log2_micro=-1, resolution=-1, curr_10ma=-1, steprot=-1;
716 
717  if(!sendAndReceive(":FM#", resp, TAF_FOCUSER_BUFSIZE))
718  return false;
719 
720  if(sscanf(resp, "M%d %d %d %d %d#", &reverse, &log2_micro, &resolution, &curr_10ma, &steprot)<=0)
721  {
722  DEBUGF(INDI::Logger::DBG_ERROR, "Invalid format: focuser motor config (%s)", resp);
723  return false;
724  }
725 
726  FocusReverseS[0].s=(reverse==0) ? ISS_OFF : ISS_ON;
727  FocusReverseS[1].s=(reverse==0) ? ISS_ON : ISS_OFF;
729  IDSetSwitch(&FocusReverseSP, NULL);
730 
731  uint32_t micro=(1<<log2_micro); // TeenAstro device returns and expects log_2(microsteps)
732  bool microFound=false;
733  for(int i=0; i<TAF_MICROS_N; i++)
734  {
735  uint32_t thisMicro=(uint32_t) atoi(CfgMotorMicrostepsS[i].name);
736  CfgMotorMicrostepsS[i].s= (micro==thisMicro) ? ISS_ON : ISS_OFF;
737  if(micro==thisMicro)
738  microFound=true;
739  }
740  CfgMotorMicrostepsSP.s = microFound ? IPS_OK : IPS_ALERT;
742 
743  CfgMotorResolutionN[0].value = resolution;
746  CfgMotorCurrentN[0].value = curr_10ma * 10; // TeenAstro device returns and expects units of 10 mA
749  CfgMotorStepsPerRevolutionN[0].value = steprot;
752 
753  return true;
754 }
755 
757 {
758  return setConfigItem('7', enable ? 1 : 0);
759 }
760 
762 {
763  uint32_t bitPos=0;
764  value>>=1;
765  for(; value!=0; bitPos++)
766  value>>=1;
767  return setConfigItem('m', bitPos); // TeenAstro device returns and expects log_2(microsteps)
768 }
769 
771 {
772  return setConfigItem('8', value);
773 }
774 
776 {
777  return setConfigItem('c', value / 10); // TeenAstro device returns and expects units of 10 mA
778 }
779 
781 {
782  return setConfigItem('r', value);
783 }
784 
785 bool TeenAstroFocuser::SyncFocuser(uint32_t value)
786 {
787  char cmd[64];
788  snprintf(cmd, 64, ":FS,%d#", value);
789  return send(cmd); // no confirmation via "0" or "1"
790 }
791 
792 
793 bool TeenAstroFocuser::goTo(uint32_t position)
794 {
795  char cmd[64];
796  snprintf(cmd, 64, ":FG,%d#", position);
797  return send(cmd);
798 }
799 
801 {
802  return send(":FP#");
803 }
804 
806 {
807  return send(":FQ#");
808 }
809 
811 {
812  if(!send(":F!#"))
813  return false;
814  sleep(3);
816 }
817 
819 {
820  if(!send(":F$#"))
821  return false;
822  sleep(1);
824 }
825 
827 {
828  // This is a verbatim copy of Focuser::saveConfigItems except one override
829  //
830 
831  DefaultDevice::saveConfigItems(fp);
832 
833  // Do not save focuser configuration items on INDI host, as they are stored on the focuser device.
834  // FI::saveConfigItems(fp);
835 
837  this->controller->saveConfigItems(fp);
838 
839  return true;
840 }
TeenAstroFocuser::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
Definition: teenastro.cpp:304
INDI::FocuserInterface::FOCUSER_CAN_ABS_MOVE
@ FOCUSER_CAN_ABS_MOVE
Definition: indifocuserinterface.h:74
TeenAstroFocuser::setParkPos
bool setParkPos(uint32_t value)
Definition: teenastro.cpp:676
TeenAstroFocuser::ReverseFocuser
bool ReverseFocuser(bool enable)
ReverseFocuser Reverse focuser motion direction.
Definition: teenastro.cpp:756
IP_RO
@ IP_RO
Definition: indiapi.h:183
INDI::FocuserInterface::FOCUSER_CAN_SYNC
@ FOCUSER_CAN_SYNC
Definition: indifocuserinterface.h:78
TAF_res_max
#define TAF_res_max
Definition: teenastro.cpp:52
INDI::FocuserInterface::FOCUSER_CAN_REL_MOVE
@ FOCUSER_CAN_REL_MOVE
Definition: indifocuserinterface.h:75
INDI::FocuserInterface::FocusAbsPosNP
INumberVectorProperty FocusAbsPosNP
Definition: indifocuserinterface.h:282
INDI::Focuser::controller
Controller * controller
Definition: indifocuser.h:111
TeenAstroFocuser
Definition: teenastro.h:26
TTY_TIME_OUT
@ TTY_TIME_OUT
Definition: indicom.h:98
cmd
__u8 cmd[4]
Definition: pwc-ioctl.h:4
TeenAstroFocuser::CfgManualSpeedN
INumber CfgManualSpeedN[1]
Definition: teenastro.h:160
INDI::FocuserInterface::FocusMaxPosNP
INumberVectorProperty FocusMaxPosNP
Definition: indifocuserinterface.h:290
TAF_curr_default
#define TAF_curr_default
Definition: teenastro.cpp:32
TeenAstroFocuser::DeviceVersionTP
ITextVectorProperty DeviceVersionTP
Definition: teenastro.h:155
TeenAstroFocuser::CfgMotorStepsPerRevolutionN
INumber CfgMotorStepsPerRevolutionN[1]
Definition: teenastro.h:198
TeenAstroFocuser::getDefaultName
const char * getDefaultName()
Definition: teenastro.cpp:77
IPState
IPState
Property state.
Definition: indiapi.h:158
tty_nread_section
int tty_nread_section(int fd, char *buf, int nsize, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
Definition: indicom.c:657
INDI::Focuser::PresetNP
INumberVectorProperty PresetNP
Definition: indifocuser.h:105
TeenAstroFocuser::CfgManualAccNP
INumberVectorProperty CfgManualAccNP
Definition: teenastro.h:169
TeenAstroFocuser::CfgMotorResolutionN
INumber CfgMotorResolutionN[1]
Definition: teenastro.h:190
IPS_OK
@ IPS_OK
Definition: indiapi.h:161
INDI::FocuserInterface::FocusSyncNP
INumberVectorProperty FocusSyncNP
Definition: indifocuserinterface.h:294
_INumberVectorProperty::s
IPState s
Definition: indiapi.h:332
INDI::Controller::saveConfigItems
virtual bool saveConfigItems(FILE *fp)
Definition: indicontroller.cpp:302
ISS_OFF
@ ISS_OFF
Definition: indiapi.h:150
indicom.h
Implementations for common driver routines.
TeenAstroFocuser::setManualSpeed
bool setManualSpeed(uint32_t value)
Definition: teenastro.cpp:686
IDSetText
void IDSetText(const ITextVectorProperty *t, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing text vector property.
IPS_ALERT
@ IPS_ALERT
Definition: indiapi.h:163
TeenAstroFocuser::CfgManualSpeedNP
INumberVectorProperty CfgManualSpeedNP
Definition: teenastro.h:161
TeenAstroFocuser::CfgMotorCurrentN
INumber CfgMotorCurrentN[1]
Definition: teenastro.h:194
IUFillNumber
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
Definition: indidriver.c:348
TeenAstroFocuser::CfgGoToAccN
INumber CfgGoToAccN[1]
Definition: teenastro.h:164
INDI::DefaultDevice::defineProperty
void defineProperty(INumberVectorProperty *property)
Definition: defaultdevice.cpp:997
MAIN_CONTROL_TAB
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
Definition: defaultdevice.cpp:34
TeenAstroFocuser::CfgMotorMicrostepsS
ISwitch CfgMotorMicrostepsS[TAF_MICROS_N]
Definition: teenastro.h:186
TeenAstroFocuser::updateMotorConfig
bool updateMotorConfig()
Definition: teenastro.cpp:712
TeenAstroFocuser::AbortFocuser
virtual bool AbortFocuser()
AbortFocuser all focus motion.
Definition: teenastro.cpp:476
TeenAstroFocuser::initProperties
virtual bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
Definition: teenastro.cpp:115
TeenAstroFocuser::updateProperties
virtual bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: teenastro.cpp:209
TeenAstroFocuser::setManualAcc
bool setManualAcc(uint32_t value)
Definition: teenastro.cpp:701
TeenAstroFocuser::RebootDeviceSP
ISwitchVectorProperty RebootDeviceSP
Definition: teenastro.h:203
INDI::Logger::DBG_ERROR
@ DBG_ERROR
Definition: indilogger.h:192
IUFillTextVector
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
Definition: indidriver.c:477
INDI::FocuserInterface::FOCUSER_HAS_VARIABLE_SPEED
@ FOCUSER_HAS_VARIABLE_SPEED
Definition: indifocuserinterface.h:79
INDI::FocuserInterface::FocusAbortSP
ISwitchVectorProperty FocusAbortSP
Definition: indifocuserinterface.h:298
INDI::BaseDevice::getDeviceName
const char * getDeviceName() const
Definition: basedevice.cpp:799
TeenAstroFocuser::sendAndReceiveBool
bool sendAndReceiveBool(const char *const msg)
Definition: teenastro.cpp:531
FOCUS_TAB
const char * FOCUS_TAB
FOCUS_TAB Where all the properties for focuser are located.
Definition: defaultdevice.cpp:41
TeenAstroFocuser::setMotorResolution
bool setMotorResolution(uint32_t value)
Definition: teenastro.cpp:770
TeenAstroFocuser::CfgManualDecN
INumber CfgManualDecN[1]
Definition: teenastro.h:172
INDI::Logger::DBG_SESSION
@ DBG_SESSION
Definition: indilogger.h:194
TeenAstroFocuser::setGoToAcc
bool setGoToAcc(uint32_t value)
Definition: teenastro.cpp:696
INDI::FocuserInterface::FOCUSER_CAN_ABORT
@ FOCUSER_CAN_ABORT
Definition: indifocuserinterface.h:76
IUSaveConfigNumber
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
Definition: indicom.c:1455
IUFillText
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
Definition: indidriver.c:369
INDI::FocuserInterface::FocusReverseSP
ISwitchVectorProperty FocusReverseSP
Definition: indifocuserinterface.h:302
TeenAstroFocuser::send
bool send(const char *const msg)
Definition: teenastro.cpp:496
TeenAstroFocuser::CfgMotorCurrentNP
INumberVectorProperty CfgMotorCurrentNP
Definition: teenastro.h:195
TAF_curr_min
#define TAF_curr_min
Definition: teenastro.cpp:33
TeenAstroFocuser::updateDeviceVersion
bool updateDeviceVersion()
Definition: teenastro.cpp:570
TeenAstroFocuser::EraseEEPROMS
ISwitch EraseEEPROMS[1]
Definition: teenastro.h:206
MAXRBUF
#define MAXRBUF
Definition: indidriver.c:52
TAF_steprot_default
#define TAF_steprot_default
Definition: teenastro.cpp:38
DEBUG
#define DEBUG(priority, msg)
Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
Definition: indilogger.h:56
tty_error_msg
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
Definition: indicom.c:1156
TeenAstroFocuser::EraseEEPROMSP
ISwitchVectorProperty EraseEEPROMSP
Definition: teenastro.h:207
teenastro.h
TAF_acc_max
#define TAF_acc_max
Definition: teenastro.cpp:49
INDI::Logger::DBG_DEBUG
@ DBG_DEBUG
Definition: indilogger.h:195
TeenAstroFocuser::CfgMotorMicrostepsSP
ISwitchVectorProperty CfgMotorMicrostepsSP
Definition: teenastro.h:187
TeenAstroFocuser::CfgManualDecNP
INumberVectorProperty CfgManualDecNP
Definition: teenastro.h:173
INDI::DefaultDevice::getCurrentPollingPeriod
uint32_t getCurrentPollingPeriod() const
getCurrentPollingPeriod Return the current polling period.
Definition: defaultdevice.cpp:1139
TAF_res_min
#define TAF_res_min
Definition: teenastro.cpp:51
tty_read
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
Definition: indicom.c:473
TeenAstroFocuser::eraseDeviceEEPROM
bool eraseDeviceEEPROM()
Definition: teenastro.cpp:818
TAF_speed_default
#define TAF_speed_default
Definition: teenastro.cpp:44
TeenAstroFocuser::MoveRelFocuser
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks)
MoveFocuser the focuser to an relative position.
Definition: teenastro.cpp:454
TeenAstroFocuser::TempNP
INumberVectorProperty TempNP
Definition: teenastro.h:145
TeenAstroFocuser::RebootDeviceS
ISwitch RebootDeviceS[1]
Definition: teenastro.h:202
TeenAstroFocuser::CfgMotorStepsPerRevolutionNP
INumberVectorProperty CfgMotorStepsPerRevolutionNP
Definition: teenastro.h:199
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::DefaultDevice::SetTimer
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
Definition: defaultdevice.cpp:865
INDI::Focuser::PortFD
int PortFD
Definition: indifocuser.h:116
TeenAstroFocuser::setManualDec
bool setManualDec(uint32_t value)
Definition: teenastro.cpp:706
TeenAstroFocuser::CurSpeedNP
INumberVectorProperty CurSpeedNP
Definition: teenastro.h:141
TAF_speed_min
#define TAF_speed_min
Definition: teenastro.cpp:45
TeenAstroFocuser::updateMotionConfig
bool updateMotionConfig()
Definition: teenastro.cpp:627
TeenAstroFocuser::CurSpeedN
INumber CurSpeedN[1]
Definition: teenastro.h:140
teenAstroFocuser
std::unique_ptr< TeenAstroFocuser > teenAstroFocuser(new TeenAstroFocuser())
TeenAstroFocuser::TAF_MICROS_8
@ TAF_MICROS_8
Definition: teenastro.h:184
tty_write
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
Definition: indicom.c:415
INDI::FocuserInterface::FOCUS_INWARD
@ FOCUS_INWARD
Definition: indifocuserinterface.h:68
IUFillSwitchVector
void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
Definition: indidriver.c:412
TAF_STEP
#define TAF_STEP(min, max)
Definition: teenastro.cpp:55
TeenAstroFocuser::TAF_MICROS_N
@ TAF_MICROS_N
Definition: teenastro.h:184
IUFillNumberVector
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
Definition: indidriver.c:455
IPS_BUSY
@ IPS_BUSY
Definition: indiapi.h:162
IPS_IDLE
@ IPS_IDLE
Definition: indiapi.h:160
TAF_acc_default
#define TAF_acc_default
Definition: teenastro.cpp:47
TAF_FOCUSER_BUFSIZE
#define TAF_FOCUSER_BUFSIZE
Definition: teenastro.cpp:59
TeenAstroFocuser::saveConfigItems
bool saveConfigItems(FILE *fp)
saveConfigItems Saves the Device Port and Focuser Presets in the configuration file
Definition: teenastro.cpp:826
INDI::FocuserInterface::FocusRelPosN
INumber FocusRelPosN[1]
Definition: indifocuserinterface.h:287
TeenAstroFocuser::CfgManualAccN
INumber CfgManualAccN[1]
Definition: teenastro.h:168
TeenAstroFocuser::deleteMainControlProperties
void deleteMainControlProperties()
Definition: teenastro.cpp:255
TAF_FOCUSER_TIMEOUT
#define TAF_FOCUSER_TIMEOUT
Definition: teenastro.cpp:58
TeenAstroFocuser::TAF_MICROS_64
@ TAF_MICROS_64
Definition: teenastro.h:184
INDI::FocuserInterface::FOCUSER_CAN_REVERSE
@ FOCUSER_CAN_REVERSE
Definition: indifocuserinterface.h:77
ISR_ATMOST1
@ ISR_ATMOST1
Definition: indiapi.h:173
INDI::Focuser::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indifocuser.cpp:120
_INumberVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:322
IUUpdateSwitch
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
Definition: indidriver.c:171
INDI::FocuserInterface::FocusRelPosNP
INumberVectorProperty FocusRelPosNP
Definition: indifocuserinterface.h:286
TeenAstroFocuser::ISNewNumberHelper
bool ISNewNumberHelper(INumberVectorProperty *NP, double values[], char *names[], int n, bool res)
Definition: teenastro.cpp:356
TAF_acc_min
#define TAF_acc_min
Definition: teenastro.cpp:48
_ITextVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:249
INDI::BaseDevice::isConnected
bool isConnected() const
Definition: basedevice.cpp:518
TeenAstroFocuser::updateState
bool updateState()
Definition: teenastro.cpp:583
TeenAstroFocuser::CfgParkPosN
INumber CfgParkPosN[1]
Definition: teenastro.h:129
TeenAstroFocuser::defineMainControlProperties
void defineMainControlProperties()
Definition: teenastro.cpp:236
TeenAstroFocuser::TAF_MICROS_32
@ TAF_MICROS_32
Definition: teenastro.h:184
TAF_speed_max
#define TAF_speed_max
Definition: teenastro.cpp:46
TeenAstroFocuser::isMoving
bool isMoving()
Definition: teenastro.cpp:619
indicontroller.h
TeenAstroFocuser::GoToParkS
ISwitch GoToParkS[1]
Definition: teenastro.h:133
TAF_res_default
#define TAF_res_default
Definition: teenastro.cpp:50
INDI::FocuserInterface::SetCapability
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
Definition: indifocuserinterface.h:95
TeenAstroFocuser::TimerHit
virtual void TimerHit()
Callback function to be called once SetTimer duration elapses.
Definition: teenastro.cpp:467
TeenAstroFocuser::setMotorCurrent
bool setMotorCurrent(uint32_t value)
Definition: teenastro.cpp:775
TeenAstroFocuser::deleteOtherProperties
void deleteOtherProperties()
Definition: teenastro.cpp:286
TeenAstroFocuser::goToPark
bool goToPark()
Definition: teenastro.cpp:800
TeenAstroFocuser::sendAndExpectTimeout
bool sendAndExpectTimeout(const char *const msg, char *resp, int bufsize)
Definition: teenastro.cpp:551
TeenAstroFocuser::SyncFocuser
virtual bool SyncFocuser(uint32_t value)
SyncFocuser Set current position to ticks without moving the focuser.
Definition: teenastro.cpp:785
IUSaveText
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
Definition: indicom.c:1449
TeenAstroFocuser::SetFocuserSpeed
bool SetFocuserSpeed(int value)
SetFocuserSpeed Set Focuser speed.
Definition: teenastro.cpp:691
_INumberVectorProperty::label
char label[MAXINDILABEL]
Definition: indiapi.h:324
name
const char * name
Definition: indiserver.c:116
TeenAstroFocuser::TeenAstroFocuser
TeenAstroFocuser()
Definition: teenastro.cpp:67
_ISwitchVectorProperty::s
IPState s
Definition: indiapi.h:382
TAF_curr_max
#define TAF_curr_max
Definition: teenastro.cpp:34
INDI::FocuserInterface::FocusReverseS
ISwitch FocusReverseS[2]
Definition: indifocuserinterface.h:303
INDI::FocuserInterface::FocusMaxPosN
INumber FocusMaxPosN[1]
Definition: indifocuserinterface.h:291
TeenAstroFocuser::defineOtherProperties
void defineOtherProperties()
Definition: teenastro.cpp:263
_ITextVectorProperty::s
IPState s
Definition: indiapi.h:259
TeenAstroFocuser::sendAndReceive
bool sendAndReceive(const char *const msg, char *resp, int bufsize)
Definition: teenastro.cpp:513
TeenAstroFocuser::initPositionPropertiesRanges
void initPositionPropertiesRanges(uint32_t maxPos)
Definition: teenastro.cpp:203
TeenAstroFocuser::TAF_MICROS_4
@ TAF_MICROS_4
Definition: teenastro.h:184
TeenAstroFocuser::CfgMotorResolutionNP
INumberVectorProperty CfgMotorResolutionNP
Definition: teenastro.h:191
TeenAstroFocuser::setConfigItem
bool setConfigItem(char item, uint32_t deviceValue)
Definition: teenastro.cpp:669
IUUpdateNumber
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
Definition: indidriver.c:225
TAF_UI_STEPS
#define TAF_UI_STEPS
Definition: teenastro.cpp:54
TeenAstroFocuser::TAF_MICROS_16
@ TAF_MICROS_16
Definition: teenastro.h:184
DEBUGF
#define DEBUGF(priority, msg,...)
Definition: indilogger.h:57
TeenAstroFocuser::rebootDevice
bool rebootDevice()
Definition: teenastro.cpp:810
INDI::FocuserInterface::FocusDirection
FocusDirection
Definition: indifocuserinterface.h:66
TAF_steprot_min
#define TAF_steprot_min
Definition: teenastro.cpp:39
TeenAstroFocuser::stop
bool stop()
Definition: teenastro.cpp:805
IP_RW
@ IP_RW
Definition: indiapi.h:185
TeenAstroFocuser::setMotorStepsPerRevolution
bool setMotorStepsPerRevolution(uint32_t value)
Definition: teenastro.cpp:780
INDI::FocuserInterface::FocusSpeedNP
INumberVectorProperty FocusSpeedNP
Definition: indifocuserinterface.h:268
TeenAstroFocuser::CfgParkPosNP
INumberVectorProperty CfgParkPosNP
Definition: teenastro.h:130
TeenAstroFocuser::~TeenAstroFocuser
~TeenAstroFocuser()
Definition: teenastro.cpp:73
TeenAstroFocuser::GoToParkSP
ISwitchVectorProperty GoToParkSP
Definition: teenastro.h:134
ISState
ISState
Switch state.
Definition: indiapi.h:148
TeenAstroFocuser::TempN
INumber TempN[1]
Definition: teenastro.h:144
_INumberVectorProperty::group
char group[MAXINDIGROUP]
Definition: indiapi.h:326
TeenAstroFocuser::setMotorMicrosteps
bool setMotorMicrosteps(uint32_t value)
Definition: teenastro.cpp:761
TeenAstroFocuser::goTo
bool goTo(uint32_t position)
Definition: teenastro.cpp:793
TeenAstroFocuser::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
Definition: teenastro.cpp:365
INDI::FocuserInterface::FocusSyncN
INumber FocusSyncN[1]
Definition: indifocuserinterface.h:295
TeenAstroFocuser::TAF_MICROS_128
@ TAF_MICROS_128
Definition: teenastro.h:184
INDI::DefaultDevice::addDebugControl
void addDebugControl()
Add Debug control to the driver.
Definition: defaultdevice.cpp:639
TeenAstroFocuser::Handshake
virtual bool Handshake()
perform handshake with device to check communication
Definition: teenastro.cpp:82
INDI::Focuser::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: indifocuser.cpp:58
TTY_OK
@ TTY_OK
Definition: indicom.h:94
INDI::DefaultDevice::deleteProperty
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
Definition: defaultdevice.cpp:965
INDI::Focuser::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: indifocuser.cpp:168
TeenAstroFocuser::SetFocuserMaxPosition
bool SetFocuserMaxPosition(uint32_t value)
SetFocuserMaxPosition Update focuser maximum position. It only updates the PresetNP property limits.
Definition: teenastro.cpp:681
_ISwitchVectorProperty::group
char group[MAXINDIGROUP]
Definition: indiapi.h:374
INDI::FocuserInterface::FocusAbsPosN
INumber FocusAbsPosN[1]
Definition: indifocuserinterface.h:283
TeenAstroFocuser::CfgGoToAccNP
INumberVectorProperty CfgGoToAccNP
Definition: teenastro.h:165
TeenAstroFocuser::MoveAbsFocuser
virtual IPState MoveAbsFocuser(uint32_t ticks)
MoveFocuser the focuser to an absolute position.
Definition: teenastro.cpp:436
IDSetNumber
void void void IDSetNumber(const INumberVectorProperty *n, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing number vector property.
IDSetSwitch
void void void void void IDSetSwitch(const ISwitchVectorProperty *s, const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(2
Tell client to update an existing switch vector property.
TeenAstroFocuser::DeviceVersionT
IText DeviceVersionT[1]
Definition: teenastro.h:154
IUFillSwitch
void IUFillSwitch(ISwitch *sp, const char *name, const char *label, ISState s)
Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
Definition: indidriver.c:320
INDI::Focuser::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: indifocuser.cpp:145
INDI::FocuserInterface::FocusSpeedN
INumber FocusSpeedN[1]
Definition: indifocuserinterface.h:269
_ISwitchVectorProperty::name
char name[MAXINDINAME]
Definition: indiapi.h:370
TAF_steprot_max
#define TAF_steprot_max
Definition: teenastro.cpp:40
ISS_ON
@ ISS_ON
Definition: indiapi.h:151