Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listen() ist missing #17

Open
sigmaeo opened this issue Mar 16, 2018 · 0 comments
Open

listen() ist missing #17

sigmaeo opened this issue Mar 16, 2018 · 0 comments

Comments

@sigmaeo
Copy link

sigmaeo commented Mar 16, 2018

I use this library with a MX-28R and with SoftwareSerial and a TriStateBuffer.

I could send commands to the servo, but always got 129 as reply (= DYN_STATUS_COM_ERROR + DYN_STATUS_TIMEOUT).

After a long search, I found a issue in DynamixelInterfaceArduinoImpl.cpp:
transaction(true) calls readMode() and writemode().
There the direction of the buffer changes, but the software serial is not switched from listen() to stopListening(). This happens only in setReadMode(), but this function is not called, when mDirectionPin is defined.

I changed the code to the following and now everything works very nice! :-)

template<class T>
void DynamixelInterfaceImpl<T>::readMode()
{
	if(mDirectionPin!=NO_DIR_PORT)
	{
		digitalWrite(mDirectionPin, LOW);
                //enable listen() here:
		setReadMode(mStream, mTxPin);  //new line
	}
	else
	{
		setReadMode(mStream, mTxPin);
	}
}

template<class T>
void DynamixelInterfaceImpl<T>::writeMode()
{
	if(mDirectionPin!=NO_DIR_PORT)
	{
		digitalWrite(mDirectionPin, HIGH);
                //disable listen() here:
		setWriteMode(mStream, mTxPin);  //new line
	}
	else
	{
		setWriteMode(mStream, mTxPin);
	}
}
sigmaeo added a commit to sigmaeo/ardyno that referenced this issue Mar 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant