oled printf

This commit is contained in:
2020-11-19 20:40:30 +01:00
parent 33fcf6c080
commit b122d836ed
3 changed files with 15 additions and 3 deletions

View File

@ -35,6 +35,6 @@ void oled_PrintLine(void);
void oledClear();
void oledPrint(char msg[]);
void oledPrintf(const char *format, ...);
#endif /* OLED_H_ */

View File

@ -9,6 +9,8 @@
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <oled.h>
#include <oled-fonts.h>
@ -561,4 +563,14 @@ void oledPrint(char msg[]) {
lines[MAX_LINES - 1][MAX_CHARS - 1] = 0;
oled_P6x8Str(1, MAX_LINES - 1, lines[MAX_LINES - 1]);
}
}
}
void oledPrintf(const char *format, ...) {
va_list vl;
va_start(vl, format);
char buf[MAX_CHARS+1];
vsnprintf(buf, MAX_CHARS, format, vl);
va_end(vl);
oledPrint(buf);
}

View File

@ -77,7 +77,7 @@ static void wizDHCPAssign() {
show(LED_GREEN, ON);
coloredMsg(LOG_BLUE, false, "wizda, network is available");
oledPrint("Address available");
oledPrintf("Address: %d.%d.%d.%d", netInfo.ip[0], netInfo.ip[1], netInfo.ip[2], netInfo.ip[3]);
}
static void wizDHCPUpdate() {