I'm adding some functionality to an old sketch, which is the 'brains' of the DCC controller I built for my model railroad. It uses the CmdrArduino library to generate the DCC packets, and I've added Servo.h to control a servo which animates a water tower on the layout. Both of these libraries have worked fine previously, and the CmdrArduino library hasn't been updated since the last time I ran it.
However, now, when I try to compile the sketch, I get the below errors, all of which seemingly relate to the libraries:
Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
D:\Daniel B\Documents\Arduino\libraries\CmdrArduino\DCCPacketScheduler.cpp: In member function 'bool DCCPacketScheduler::setBasicAccessory(uint16_t, uint8_t)':
D:\Daniel B\Documents\Arduino\libraries\CmdrArduino\DCCPacketScheduler.cpp:391:28: warning: narrowing conversion of '(((((int)function) & 3) << 1) | 1)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t data[] = { 0x01 | ((function & 0x03) << 1) };
^
D:\Daniel B\Documents\Arduino\libraries\CmdrArduino\DCCPacketScheduler.cpp: In member function 'bool DCCPacketScheduler::unsetBasicAccessory(uint16_t, uint8_t)':
D:\Daniel B\Documents\Arduino\libraries\CmdrArduino\DCCPacketScheduler.cpp:403:41: warning: narrowing conversion of '((((int)function) & 3) << 1)' from 'int' to 'uint8_t {aka unsigned char}' inside { } [-Wnarrowing]
uint8_t data[] = { ((function & 0x03) << 1) };
^
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount':
(.text+0x0): multiple definition of `__vector_17'
libraries\CmdrArduino\DCCHardware.c.o (symbol from plugin):(.text+0x0): first defined here
c:/users/daniel b/appdata/local/arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Changing the CmdrArduino library is not an option, and it appears that this library is only getting warnings anyway, which can be ignored. But the servo library errors are new, and appear to be preventing the sketch from compiling. Why has this changed, and what do I need to do to fix it?
Update: It appears to specifically be the servo.h library that's causing the problem. Is there an alternate servo library I could use?