BugFix v trace_dump - spravne pouziti flashString

This commit is contained in:
Pavel Brychta 2019-01-16 18:41:49 +01:00
parent 031da04f36
commit 76d19c8ccd

View File

@ -229,14 +229,18 @@ void trace_dump(uint8_t severity, const char *prefix, uint8_t *address, size_t s
print(severity, buffer, idx); print(severity, buffer, idx);
} }
// TODO: POZOR!!! tady si nejsem jisty, zda je spravne pouziti __FlashStringHelperu v snprintf_P !!!!
void trace_dump(uint8_t severity, const __FlashStringHelper *prefix, uint8_t *address, size_t size) void trace_dump(uint8_t severity, const __FlashStringHelper *prefix, uint8_t *address, size_t size)
{ {
char buffer[MAX_LINE_LEN + 1 + 3]; char buffer[MAX_LINE_LEN + 1 + 3];
int idx = 0; int idx = 0;
if (prefix) if (prefix)
idx = snprintf_P(buffer, MAX_LINE_LEN, PSTR("%s"), prefix); {
char dummy[64];
strcpy_P(dummy, (const char *)prefix);
idx = snprintf_P(buffer, MAX_LINE_LEN, PSTR("%s"), dummy);
}
while ((idx < MAX_LINE_LEN) && size) while ((idx < MAX_LINE_LEN) && size)
{ {