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

Refactor commands

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