File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,11 @@ size_t Print::write(const uint8_t *buffer, size_t size)
4444 return n;
4545}
4646
47- size_t Print::printf (const char *format, ... )
47+ size_t Print::vprintf (const char *format, va_list arg )
4848{
4949 char loc_buf[64 ];
5050 char * temp = loc_buf;
51- va_list arg;
5251 va_list copy;
53- va_start (arg, format);
5452 va_copy (copy, arg);
5553 int len = vsnprintf (temp, sizeof (loc_buf), format, copy);
5654 va_end (copy);
@@ -74,6 +72,25 @@ size_t Print::printf(const char *format, ...)
7472 return len;
7573}
7674
75+ size_t Print::printf (const __FlashStringHelper *ifsh, ...)
76+ {
77+ va_list arg;
78+ va_start (arg, ifsh);
79+ const char * format = (reinterpret_cast <const char *>(ifsh));
80+ size_t ret = vprintf (format, arg);
81+ va_end (arg);
82+ return ret;
83+ }
84+
85+ size_t Print::printf (const char *format, ...)
86+ {
87+ va_list arg;
88+ va_start (arg, format);
89+ size_t ret = vprintf (format, arg);
90+ va_end (arg);
91+ return ret;
92+ }
93+
7794size_t Print::print (const String &s)
7895{
7996 return write (s.c_str (), s.length ());
Original file line number Diff line number Diff line change 2121#define Print_h
2222
2323#include < stdint.h>
24+ #include < stdio.h>
2425#include < stddef.h>
2526
2627#include " WString.h"
@@ -72,7 +73,10 @@ class Print
7273 return write ((const uint8_t *) buffer, size);
7374 }
7475
76+ size_t vprintf (const char *format, va_list arg);
77+
7578 size_t printf (const char * format, ...) __attribute__ ((format (printf, 2 , 3 )));
79+ size_t printf (const __FlashStringHelper *ifsh, ...);
7680
7781 // add availableForWrite to make compatible with Arduino Print.h
7882 // default to zero, meaning "a single write may block"
You can’t perform that action at this time.
0 commit comments