stm32/serialno: Fixed a small regression that made it in with #1041 resulting in a transposition of alpha characters in serial numbers
This commit is contained in:
parent
2673e34ddd
commit
4a0e373b49
|
@ -30,7 +30,7 @@ char *serial_no_read(char *s)
|
||||||
s[7U - i] = ((unique_id >> (i * 4U)) & 0x0FU) + '0';
|
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 the character is something above 9, then add the offset to make it ASCII A-F */
|
||||||
if (s[7U - i] > '9')
|
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
|
#elif DFU_SERIAL_LENGTH == 13
|
||||||
/* Use the same serial number as the ST DFU Bootloader.*/
|
/* 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 the character is something above 9, then add the offset to make it ASCII A-F */
|
||||||
if (s[chunk + (7U - nibble)] > '9')
|
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
|
#else
|
||||||
# WARNING "Unhandled DFU_SERIAL_LENGTH"
|
# WARNING "Unhandled DFU_SERIAL_LENGTH"
|
||||||
|
|
Loading…
Reference in New Issue