From 4a0e373b49abbbf1aefc4986b70b9b080c2101ff Mon Sep 17 00:00:00 2001 From: dragonmux Date: Sat, 25 Jun 2022 17:19:53 -0400 Subject: [PATCH] stm32/serialno: Fixed a small regression that made it in with #1041 resulting in a transposition of alpha characters in serial numbers --- src/platforms/stm32/serialno.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/stm32/serialno.c b/src/platforms/stm32/serialno.c index 67776cf..38492fc 100644 --- a/src/platforms/stm32/serialno.c +++ b/src/platforms/stm32/serialno.c @@ -30,7 +30,7 @@ char *serial_no_read(char *s) s[7U - i] = ((unique_id >> (i * 4U)) & 0x0FU) + '0'; /* If the character is something above 9, then add the offset to make it ASCII A-F */ if (s[7U - i] > '9') - s[7U - i] += 16; /* 'A' - '9' = 17, less 1 gives 16. */ + s[7U - i] += 7; /* 'A' - '9' = 8, less 1 gives 7. */ } #elif DFU_SERIAL_LENGTH == 13 /* Use the same serial number as the ST DFU Bootloader.*/ @@ -53,7 +53,7 @@ char *serial_no_read(char *s) /* If the character is something above 9, then add the offset to make it ASCII A-F */ if (s[chunk + (7U - nibble)] > '9') - s[chunk + (7U - nibble)] += 16; /* 'A' - '9' = 17, less 1 gives 16. */ + s[chunk + (7U - nibble)] += 7; /* 'A' - '9' = 8, less 1 gives 7. */ } #else # WARNING "Unhandled DFU_SERIAL_LENGTH"