From 790799a3fa2692bfd3f3f1bac927bb0ef016a096 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 16 Nov 2018 08:04:06 +0100 Subject: esp8266 stdout: partialle respect base, output unsigned char as number --- src/arch/esp8266/driver/stdout.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/arch/esp8266') diff --git a/src/arch/esp8266/driver/stdout.cc b/src/arch/esp8266/driver/stdout.cc index 4471672..d8e07a8 100644 --- a/src/arch/esp8266/driver/stdout.cc +++ b/src/arch/esp8266/driver/stdout.cc @@ -9,7 +9,11 @@ void os_printf_plus(const char *s, ...); StandardOutput & StandardOutput::operator<<(unsigned char c) { - put(c); + if (base == 16) { + os_printf("%02x", c); + } else { + os_printf("%d", c); + } return *this; } @@ -33,13 +37,21 @@ StandardOutput & StandardOutput::operator<<(short number) StandardOutput & StandardOutput::operator<<(unsigned int number) { - os_printf("%u", number); + if (base == 16) { + os_printf("%08x", number); + } else { + os_printf("%u", number); + } return *this; } StandardOutput & StandardOutput::operator<<(int number) { - os_printf("%d", number); + if (base == 16) { + os_printf("%08x", number); + } else { + os_printf("%d", number); + } return *this; } -- cgit v1.2.3