diff --git a/libraries/AP_HAL_AVR_SITL/Console.cpp b/libraries/AP_HAL_AVR_SITL/Console.cpp index 569d27dbd2..b563681c8d 100644 --- a/libraries/AP_HAL_AVR_SITL/Console.cpp +++ b/libraries/AP_HAL_AVR_SITL/Console.cpp @@ -6,7 +6,7 @@ #include #include #include "Console.h" -#include "vprintf.h" +#include "print_vprintf.h" using namespace AVR_SITL; @@ -57,18 +57,28 @@ void SITLConsoleDriver::printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - vprintf((AP_HAL::Print*)this, 0, fmt, ap); + vprintf(fmt, ap); va_end(ap); } +void SITLConsoleDriver::vprintf(const char *fmt, va_list ap) +{ + print_vprintf((AP_HAL::Print*)this, 0, fmt, ap); +} + void SITLConsoleDriver::_printf_P(const prog_char *fmt, ...) { va_list ap; va_start(ap, fmt); - vprintf((AP_HAL::Print*)this, 1, fmt, ap); + vprintf_P(fmt, ap); va_end(ap); } +void SITLConsoleDriver::vprintf_P(const prog_char *fmt, va_list ap) +{ + print_vprintf((AP_HAL::Print*)this, 1, fmt, ap); +} + // Stream method implementations ///////////////////////////////////////// int16_t SITLConsoleDriver::available(void) { diff --git a/libraries/AP_HAL_AVR_SITL/Console.h b/libraries/AP_HAL_AVR_SITL/Console.h index f4669a6218..024db60078 100644 --- a/libraries/AP_HAL_AVR_SITL/Console.h +++ b/libraries/AP_HAL_AVR_SITL/Console.h @@ -25,6 +25,9 @@ public: void _printf_P(const prog_char *s, ...) __attribute__ ((format(__printf__, 2, 3))); + void vprintf(const char *s, va_list ap); + void vprintf_P(const prog_char *s, va_list ap); + /* Implementations of Stream virtual methods */ int16_t available(); int16_t txspace(); diff --git a/libraries/AP_HAL_AVR_SITL/UARTDriver.cpp b/libraries/AP_HAL_AVR_SITL/UARTDriver.cpp index dc50c403f4..97711c0e2b 100644 --- a/libraries/AP_HAL_AVR_SITL/UARTDriver.cpp +++ b/libraries/AP_HAL_AVR_SITL/UARTDriver.cpp @@ -25,7 +25,7 @@ #include #include -#include "vprintf.h" +#include "print_vprintf.h" #include "UARTDriver.h" #include "SITL_State.h" @@ -182,18 +182,25 @@ void SITLUARTDriver::printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - vprintf((AP_HAL::Print*)this, 0, fmt, ap); + vprintf(fmt, ap); va_end(ap); } +void SITLUARTDriver::vprintf(const char *fmt, va_list ap) { + print_vprintf((AP_HAL::Print*)this, 0, fmt, ap); +} + void SITLUARTDriver::_printf_P(const prog_char *fmt, ...) { va_list ap; va_start(ap, fmt); - vprintf((AP_HAL::Print*)this, 1, fmt, ap); + vprintf_P(fmt, ap); va_end(ap); } +void SITLUARTDriver::vprintf_P(const prog_char *fmt, va_list ap) { + print_vprintf((AP_HAL::Print*)this, 1, fmt, ap); +} /* start a TCP connection for the serial port. If wait_for_connection is true then block until a client connects diff --git a/libraries/AP_HAL_AVR_SITL/UARTDriver.h b/libraries/AP_HAL_AVR_SITL/UARTDriver.h index 822c01d0ba..e379148c85 100644 --- a/libraries/AP_HAL_AVR_SITL/UARTDriver.h +++ b/libraries/AP_HAL_AVR_SITL/UARTDriver.h @@ -46,6 +46,8 @@ public: __attribute__ ((format(__printf__, 2, 3))); void _printf_P(const prog_char *s, ...) __attribute__ ((format(__printf__, 2, 3))); + void vprintf(const char *s, va_list ap); + void vprintf_P(const prog_char *s, va_list ap); /* Implementations of Stream virtual methods */ int16_t available(); diff --git a/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.cpp b/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.cpp index 5e11d857e4..3b2d2515bc 100644 --- a/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.cpp +++ b/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.cpp @@ -14,11 +14,11 @@ #include #include #include -#include "vprintf.h" +#include "print_vprintf.h" #include #include -void vprintf(AP_HAL::Print *s, unsigned char in_progmem, const char *fmt, va_list ap) +void print_vprintf(AP_HAL::Print *s, unsigned char in_progmem, const char *fmt, va_list ap) { char *str = NULL; int i; diff --git a/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.h b/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.h index 6131d78392..0344abaea6 100644 --- a/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.h +++ b/libraries/AP_HAL_AVR_SITL/utility/print_vprintf.h @@ -5,7 +5,7 @@ #include #include -void vprintf (AP_HAL::Print *s, unsigned char in_progmem, const char *fmt, va_list ap); +void print_vprintf (AP_HAL::Print *s, unsigned char in_progmem, const char *fmt, va_list ap); #endif //__AP_HAL_AVR_SITL_UTILITY_VPRINTF_H__