Skip to content

Commit

Permalink
Merge pull request #235: Issue_231: Fix logging of card data (bad order)
Browse files Browse the repository at this point in the history
  • Loading branch information
boerge1 authored Sep 5, 2024
2 parents 5c05ebe + 73c83de commit e6284fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
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

0 comments on commit e6284fa

Please sign in to comment.