Commit ccea0f3f authored by markus's avatar markus

Fix azimuth rotation and 0 destination

parent fb78804d
......@@ -66,7 +66,7 @@ Control::hamlibError Control::executeCommandString(String *command_string, Commu
}
else if ( substring == "getpos" ) {
// GNAAAARRR
communicator->sendMessage(String(rotor_->getAzimuth()) + ";" + String(rotor_->getElevation()) + ";");
communicator->sendMessage(String(360-rotor_->getAzimuth()) + ";" + String(rotor_->getElevation()) + ";");
}
else {
if(executeActiveCommandSubstring(substring) == HAMLIB_OK)
......@@ -90,10 +90,10 @@ Control::hamlibError Control::executeActiveCommandSubstring(String substring)
if( substring.length() < 6 )
return HAMLIB_NOK;
dst = substring.substring(5).toFloat();
if ( dst == 0 && (substring.substring(5) != "0"))
if ( dst == 0 && (!substring.substring(5).startsWith("0")))
return HAMLIB_NOK;
if(substring.startsWith("setaz"))
err = rotor_->setAzimuth(dst);
err = rotor_->setAzimuth(360-dst);
else
err = rotor_->setElevation(dst);
if(err == Motor::ROT_VAL_OUT_OF_RANGE)
......
......@@ -24,7 +24,7 @@
#define ELEV_SPAN 1
// Max Values
#define AZIM_MIN 0.0
#define AZIM_MAX 359.0
#define AZIM_MAX 360.0
#define ELEV_MIN 0.0
#define ELEV_MAX 180.0
// Resolution values in degree
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment