Commit 4b08b578 authored by markus's avatar markus
Browse files

Refactor commands

parent 53882e88
......@@ -42,7 +42,7 @@ void Control::doControl()
if(debugTime_ > 100)
{
//hamlib.debugOut();
rotor_->debugOut();
//rotor_->debugOut();
debugTime_ = 0;
}
debugTime_++;
......@@ -64,25 +64,25 @@ Control::hamlibError Control::executeCommandString(String *command_string, Commu
// GNAAAARRR
communicator->sendMessage(String(String(AZIM_MIN) + "/" + String(AZIM_MAX) + " " + String(ELEV_MIN) + "/" + String(ELEV_MAX)));
}
else if ( substring == "get position" ) {
else if ( substring == "getpos" ) {
// GNAAAARRR
communicator->sendMessage(String(rotor_->getActualAzimuth()) + " " + String(rotor_->getActualElevation()));
communicator->sendMessage(String(rotor_->getActualAzimuth()) + ".00;" + String(rotor_->getActualElevation()) + ".00;");
}
else if ( substring.startsWith("set az") ) {
if( substring.length() < 8 )
else if ( substring.startsWith("setaz") ) {
if( substring.length() < 7 )
return HAMLIB_NOK;
dst = substring.substring(7).toInt();
if ( dst == 0 && substring.substring(7) != "0" )
dst = (int)substring.substring(5).toFloat();
if ( dst == 0 && substring.substring(5) != "0" )
return HAMLIB_NOK;
if ( dst < AZIM_MIN or dst > AZIM_MAX )
return HAMLIB_NOK;
rotor_->setAzimuth(dst);
}
else if ( substring.startsWith("set el") ) {
if( substring.length() < 8 )
else if ( substring.startsWith("setel") ) {
if( substring.length() < 7 )
return HAMLIB_NOK;
dst = substring.substring(7).toInt();
if ( dst == 0 && substring.substring(7) != "0" )
dst = (int)substring.substring(5).toFloat();
if ( dst == 0 && substring.substring(5) != "0" )
return HAMLIB_NOK;
if ( dst < ELEV_MIN or dst > ELEV_MAX )
return HAMLIB_NOK;
......
......@@ -52,8 +52,8 @@ void setup()
//rotor.releaseBreakAzimuth();
//rotor.releaseBreakElevation();
//rotor.rotateUp();
control.setElevation(23);
control.setAzimuth(42);
//control.setElevation(23);
//control.setAzimuth(42);
}
void loop()
......
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