Comments (16)
I can't initially reproduce this. Is there something special about the numbers or does this happen from any starting position?
from firmware.
from firmware.
OK thanks.
So looking at the code, it is difficult to see how the homing operation can fail to start.
void HomeSensor::findHome(int direction)
{
if (phase == Idle || phase == AtHome)
{
const auto distance = 2 * homeSettings->microstepsPerRotation; // Allow 2 full rotations only
setPhase(Detecting);
motor->moveToPosition(distance);
}
}
The only possibility I can really see there is that the phase
state variable must be in the correct state or homing will not start. Perhaps the state is getting left in a corrupt state from a previous operation. This will need further investigation.
Home detection is via an edge triggered interrupt from the home sensor. Even if this were happening immediately after starting the home operation before the motor has taken even a single step, then that could possibly look like nothing has happened. This seems unlikely though, with a nearly 20 degree movement away from home.
from firmware.
Nope, I can't make it happen. Is there any possibility of getting the customer to reproduce it in PuTTY or a dumb terminal emulator, so we can see the raw output from the rotator?
from firmware.
from firmware.
I believe it will be set to Idle
the next time there is an onMotorStopped
event...
/*
* Handles the onMotorStopped event. Action depends on the homing phase.
*/
void HomeSensor::onMotorStopped() const
{
std::cout << "Hstop " << phase << std::endl;
switch (phase)
{
case Reversing:
setPhase(AtHome);
break;
case Stopping:
setPhase(Reversing);
const auto target = commandProcessor.targetStepPosition(homeSettings->position);
motor->moveToPosition(target);
break;
default:
setPhase(Idle);
return;
}
}
Even if that were not the case, it is explicitly allowed to start another homing operation while already at home, so that would still work.
from firmware.
from firmware.
Ah yes. Thanks for doing that @rpineau , that's really helpful. I will have another go at reproducing it here.
from firmware.
OK, yes I can reproduce it now. It's pretty odd because the output doesn't seem to match what the code says should happen.
P47885
P47686
P47565
STOP
Hstop 4
:SER,47522,1,55080,0,50#
XB->Online
With this output, we can see STOP
(motor stopped event) and then HStop 4
. This is produced in the home sensor onMotorStopped
event handler. The 4
is "phase 4" which is AtHome
(this is expected at thsi point). However, a few lines later the switch statement should set the phase to Idle
(since it is known to be AtHome
and not Reversing
or Stopping
but it looks like that's not happening:
/*
* Handles the onMotorStopped event. Action depends on the homing phase.
*/
void HomeSensor::onMotorStopped() const
{
std::cout << "Hstop " << phase << std::endl;
switch (phase)
{
case Reversing:
setPhase(AtHome);
break;
case Stopping:
setPhase(Reversing);
const auto target = commandProcessor.targetStepPosition(homeSettings->position);
motor->moveToPosition(target);
break;
default:
setPhase(Idle);
return;
}
Is there some subtlety of C++ that I'm missing that could cause that default case not to execute?
from firmware.
from firmware.
If this is based on the homing phase (Action depends on the homing phase. in your comment), then what happen if we're not homing.
By design, the state should be AtHome
at the end of a FindHome operation and Idle
when no homing operation is in progress (it is actually cleared to Idle each time the motor stops, except if the previous state was Reversing
). Therefore, it follows that (by design) AtHome
will be true
at the end of a successful homing operation and false
at all other times.
However it looks like there may be a compiler bug that's causing it to generate incorrect code for switch statements. I had something similar elsewhere in the code and I had to re-order my case statements to get it to work. I've re-written it using if
statements and its working now. I'll send you a hotfix to test shortly.
Aside: I wouldn't recommend relying on the AtHome
flag for anything other than display purposes, because Find Home
is an operation, not a position. The AtHome
flag has no meaning outside of a Find Home
operation and it should never be true except at the end of a successful Find Home
operation. There is also no defined "home position" (from the firmware's point of view), there is only the azimuth of the home sensor, which is not quite the same thing, conceptually. The definition is in the FAQ under https://github.com/nexdome/ASCOM/wiki/Home,-Park-and-Home-Sensor-Magnet-Positioning#home-sensor-azimuth.
from firmware.
@rpineau could you give this a go please?
Rotator-3.2.1-Beta.1.zip
from firmware.
from firmware.
from firmware.
from firmware.
Fixed for firmware release 3.3.0, later today.
from firmware.
Related Issues (20)
- Telescope aperture vignetting caused by 1 degree dome azimuth command resolution HOT 4
- Shutter close sensor does not operate correctly if triggered multiple times HOT 1
- slipping sprocket won't close shutter HOT 5
- what is current version (3.2.1?) and is there a .hex for it HOT 2
- Changing slew destination without waiting for completion HOT 10
- Auto-close shutter on low battery volts HOT 1
- Incorrect values returned for `@RRS` HOT 2
- Shutter status after manual activation HOT 4
- ArduinoSTL library not compatible with AVR boards v1.8.3 HOT 2
- Dead Zone default is too high HOT 5
- Rotator loses pointing accuracy after many small nudges HOT 2
- Manual Rotator button no longer works with 4.0 HOT 9
- how to update to 4.0.1 firmware? HOT 2
- ASCOM Driver should warn the user if the firmware major version is higher than expected HOT 2
- close ( or stop) should immediately stop if the shutter is trying to open HOT 1
- Does the shutter firmware crash after some time? HOT 3
- Xbee S2C HOT 1
- ArduinoSTL library not compatible with AVR boards v1.8.3
- Req way to force close into the negative on the percent open HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firmware.