I have just committed change for serial connection poll period to be specified from 1 - 30s.
Regards, the commit that fills in the max and abs "set" points to be the same as the actual values just seems wrong to me. I think the change should have been to make sure these fields always be zeroed on connection.
Also things like reverse direction, max step, temp comp. should also be on the options page, as they are options and probably only need setting once, but this would require overrides and so perhaps should be applied in the base class? The abort button should also be more accessible and obvious, possibly next option after Direction, or better still when the Abs or Relative Set buttons are pressed, they toggle to Abort buttons?
The next thing in my sights is "Home Position" and "Backlash", both of which I need to understand a bit more before implementing.
I saw that the auto focus control in Ekos has a backlash tick box and value, but they are greyed out. I do not know why I cannot access them, but if I could it negates having to do it in the focuser driver?
I am nervous about implementing "Home Position" as I do not understand the logic behind it yet. Is it a button that triggers the focuser to move toward zero until the switch input is seen? If so is there any protection against just endlessly driving the focuser in, perhaps because the switch has fallen off, or does it get to maybe -10 and then stop, as a safety measure? Or is it just an option , that if selected causes the focuser to do the same as already described but on startup?
If Robert does not respond in this thread I will ask in his forums.
Hi Alan
In myFocuserPro2, home position is a method of going to position 0.
If no hardware switch is fitted, the focuser will stop when the focuser position is 0.
If a hardware switch is implemented, then myfocuserpro2 firmware will manage and find the 0 position based on the switch value. And yes there are limits and methods in firmware to prevent endlessly winding the motor to oblivion. But INDI shouldnt really know about this, its in firmware and that is where it is managed.
Thus is any case the end result of HOME POSITION is ending up at position 0.
This does not need to be managed by INDI, in fact it would not be a good thing in my opinion. INDI should not be concerned with exactly how that is done.
In terms of backlash, there are two ways to look at this.
1. Let the client application handle it [disable backlash in the firmware]
2. Let the firmware handle it [enable backlash in the firmware]. In this case the application should not handle backlash else you have two competing methods fighting against it.
If backlash is enabled in firmware, it really does not need to be changed/altered that much over time. It is not like tommorrow one wakes up and backlash has suddenly halved or doubled. Once set it is remembered by the controller in EEPROM, thus retored when the controller boots.
So if one used windows or even a serial terminal to configure the backlash in firmware it will be remmebered and thus INI would not be required to remember it. It depends if you want to place that capability in the INDI driver or leave it to a client app to manage.
Thanks for the reply Robert. It was not my intention to code anything clever, keep things simple, all I want to do is send a command to either Enable/Disable home or one shot command to say go to home position. I will have a look at the code and see what I need to do.
I think I will tackle backlash next, and add two fields in options tab, Backlash In, Backlash Out (0-512 range). A value of zero will be treated as disable, and I will send a disable command for the given input, otherwise I will send an enable and the value for the given input.
A useful feature that maybe you could add is a single return value of a bit mask to show what features have been enabled on the focuser,
i.e
Display = 1
Temp Sensor = 2
Backlash = 4
so a value of 5 would mean has Display and Backlash but no temp sensor.
I could then potentially use this value to show or hide the associated controls. What do you think?
Hi
You cant send a command to enable/disable home as that does not exist.
In Windows app when a user clicks HOME button all it does is send a command :28# which means goto position 0.
The firmware then decides whether to check for a home position switch (a physcially mounted switch which actives when focuser is fully in to 0) is available or not.
I already thought about a FEATURES value as outlined, it would need to be an int size, its probably easy enough to add one in the next fimware release.
I will have a play and get back to you on that.
//
// GLOBAL DATA - DO NOT CHANGE
//
int Features = 0;
#ifdef LCDDISPLAY
Features = Features + ENABLEDLCD;
#endif
#ifdef OLEDDISPLAY
Features = Features + ENABLEDOLED;
#endif
#ifdef TEMPERATUREPROBE
Features = Features + ENABLEDTEMPPROBE;
#endif
#ifdef HOMEPOSITIONSWITCH
Features = Features + ENABLEDHPSW;
#endif
#ifdef BLUETOOTH
Features = Features + ENABLEDBLUETOOTH;
#endif
#ifdef STEPPERPWRDETECT
Features = Features + ENABLEDSTEPPERPWR;
#endif
#ifdef PUSHBUTTONS
Features = Features + ENABLEDPUSHBUTTONS;
#endif
#ifdef ROTARYENCODE
Features = Features + ENABLEDROTARYENCODER;
#endif
#ifdef INFRARED
Features = Features + ENABLEDINFRARED;
#endif
#ifdef BACKLASH
Features = Features + ENABLEDBACKLASH;
#endif
#ifdef TFTDISPLAY
Features = Features + ENABLEDTFT;
#endif
#ifdef NOKIADISPLAY
Features = Features + ENABLENOKIA;
#endif
#if (DRVBRD == DRV8825HW203KEYPAD)
Features = Features + ENABLEKEYPAD;
#endif
#ifdef INOUTLEDS
Features = Features + ENABLEDINOUTLEDS;
#endif
#ifdef BUZZER
Features = Features + ENABLEDBUZZER;
#endif
case 58:
SendPacket('m' + String(Features) + '#');
break;
That was prompt, I won't be coding that up for a while though! Might need some advice from knro on how to hide or show controls, or just get connection read feature map and use to display certain controls.
However I have just committed the Goto Home Position, and made a minor change to allow change of position during a move. I have not done a pull request yet, as I want to add backlash values tomorrow.
HI Alan
re - and made a minor change to allow change of position during a move.
In ASCOM the protocol is check isMoving property before a move. As the focuser would be moving such a call would be denied.
In the myfp2 firmware, this is replicated and new moves while the focuser is already moving are not allowed.
Hi Robert, I actually had the change move during a move implemented, tested and working last night. I check IsMoving and if so send an abort, then the new position. Works very smoothly.
I have just spent the whole evening getting backlash support in, at least an hour wasted when my focuser stopped responding! Obviously assumed I had cocked up somewhere in code, so setting break points and debug messages.... eventually realised I had disturbed the stepper motor connector plug on the pcb when removing a jumper to reflash with backlash eneabled! Could really have done without that.
I have just made a pull request, new version 6, backlash, go home and interrupt move all now added.
I was only able to test backlash as far as setting the values and reading them back after power cycles. All read as expected. I assumed that whatever my abs or relative target position was, that the back lash would be added to the actual final position, but this does not appear to be the case. I need to think a bit more about how this works.
Backlash.
If enabled
When a move to a new position occurs and is in the opposite direction to the previous move
lets say current position is 4000 and move is to 5000 and the previous move was IN, then backlash will be applied if enabled
Backlash is applied (the number of steps to move) BEFORE the move is done. This does NOT change the focuser position as it it taking up the backlash in the gears getting ready to move - the draw tube would not have moved - so neither has the actual position - backlash is taking up the slack
Once backlash is done then the move is performed - in this instance from 4000 to 5000.
Adding backlash to the final position would be a mistake - Assuming 4000 to 5000 with backlash of 200, that would make the position 5200 - but technically the focuser is at 5000 because for the 200 backlash steps the drawtube did not actually move, hence myfp2 does not do it that way