I spoke to you offline about the possibility of adding the option to construct an instance of MOVI() using an existing HardwareSerial * (useful for Arduino Mega with all its extra serial pins). At the time you were hopeful that there was already an existing #define that could be flipped easily. Unfortunately there doesn't seem to be a very straightforward way to do this as the API stands at version 1.03 because the Software/Hardware serial toggle is based on ARDUINO_ARCH_AVR. The Arduino API defines that macro for the Mega so it's stuck with SoftwareSerial.
I made what I believe is a pretty elegant enhancement to the API to allow for constructing MOVI with a HardwareSerial pointer and created a pull request on github in hopes that you would like to incorporate it. Basically it involves:
- Changing MOVI(uint8_t debugonoff) from MOVI(bool debugonoff) to avoid constructor overload conflict. You mention in a comment that "Arduino's' C++ does not allow for constructor overloading!". This may have been the issue you were finding.
- Changing the MOVI class to store only the base class Stream * for mySerial.
- Moving the #ifdef...#elif... for the various platforms from the the class specifiction to the body of init(...) where you call mySerial.begin. This is the only Serial specific method that you use that is not virtual from Stream.
I also added a small enhancement to the ask() methods to not call say() when the parameter to ask() is the empty string. This boosts the reaction time for ask() considerably when MOVI doesn't need to say anything first.
I hope you like these changes.
Login below to reply: