Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue_231: Fix logging of card data (bad order) #235

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ Die SD Karte (Ordner mp3 und advert) hat sich gegenüber der Version 3.1.11 geä

# Change Log

## Version 3.2.0 (28.08.2024)
## Version 3.2.0 (05.09.2024)
- [Issue 231](https://github.com/tonuino/TonUINO-TNG/issues/231): Fix logging of card data (bad order)
- [Issue 229](https://github.com/tonuino/TonUINO-TNG/issues/229): playAdvertisement does not work for some DF Player
- [Issue 228](https://github.com/tonuino/TonUINO-TNG/issues/228): NeoPixel for two Rings with Sleep modification card: no update on one ring
- [Issue 226](https://github.com/tonuino/TonUINO-TNG/issues/226): Use MegaCoreX as Board package for Nano Every instead of Arduino megaAVR Boards
Expand Down
2 changes: 1 addition & 1 deletion TonUINO-TNG.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void setup()
LOG(init_log, s_error, F("TonUINO Version 3.1 - refactored by Boerge1\n"));
LOG(init_log, s_error, F("created by Thorsten Voß and licensed under GNU/GPL."));
LOG(init_log, s_error, F("Information and contribution at https://tonuino.de.\n"));
LOG(init_log, s_error, F("V3.2.0 28.08.24\n"));
LOG(init_log, s_error, F("V3.2.0 05.09.24\n"));

#ifdef TonUINO_Classic
LOG(init_log, s_error, F("C "), lf_no);
Expand Down
25 changes: 12 additions & 13 deletions src/chip_card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,25 @@ const __FlashStringHelper *str_MIFARE_Write() { return F("MIFARE_Write "); }
/**
Helper routine to dump a byte array as hex values to Serial.
*/
constexpr size_t maxBuffferLogSize = 10;
char n16_hex(uint8_t number) {
if (number >=16)
return '?';
return (number > 9) ? (number - 10) + 'a' : number + '0';
}
void u8toa_hex(uint8_t number, char *arr) {
int pos = 0;
if (number < 16)
arr[pos++] = '0';
do {
const int r = number % 16;
arr[pos++] = (r > 9) ? (r - 10) + 'a' : r + '0';
number /= 16;
} while (number != 0);
arr[0] = n16_hex(number/16);
arr[1] = n16_hex(number%16);
}
const char* dump_byte_array(byte * buffer, uint8_t bufferSize) {
static char ret[3*10+1];
ret[0] = '\0';
if (bufferSize > 10)
return ret;
static char ret[3*maxBuffferLogSize+1];
if (bufferSize > maxBuffferLogSize)
bufferSize = maxBuffferLogSize;
uint8_t pos = 0;
for (uint8_t i = 0; i < bufferSize; ++i) {
ret[pos++] = ' ';
u8toa_hex(buffer[i], &ret[pos]);
pos +=2;
ret[pos++] = ' ';
}
ret[pos] = '\0';
return ret;
Expand Down