mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
More readable conversion from number to ASCII character
This commit is contained in:
parent
2182ec9a97
commit
98b3fec50a
1 changed files with 2 additions and 4 deletions
6
SPP.cpp
6
SPP.cpp
|
@ -795,8 +795,7 @@ void SPP::printNumber(uint16_t n) {
|
||||||
else {
|
else {
|
||||||
uint8_t buf[digits];
|
uint8_t buf[digits];
|
||||||
for(uint8_t i = 1; i < digits+1; i++) {
|
for(uint8_t i = 1; i < digits+1; i++) {
|
||||||
buf[digits-i] = n%10; // Get number and convert to ASCII Character
|
buf[digits-i] = n%10 + '0'; // Get number and convert to ASCII Character
|
||||||
buf[digits-i] += 48;
|
|
||||||
n /= 10;
|
n /= 10;
|
||||||
}
|
}
|
||||||
print(buf,digits);
|
print(buf,digits);
|
||||||
|
@ -814,8 +813,7 @@ void SPP::printNumberln(uint16_t n) {
|
||||||
else {
|
else {
|
||||||
uint8_t buf[digits+2];
|
uint8_t buf[digits+2];
|
||||||
for(uint8_t i = 1; i < digits+1; i++) {
|
for(uint8_t i = 1; i < digits+1; i++) {
|
||||||
buf[digits-i] = n%10; // Get number and convert to ASCII Character
|
buf[digits-i] = n%10 + '0'; // Get number and convert to ASCII Character
|
||||||
buf[digits-i] += 48;
|
|
||||||
n /= 10;
|
n /= 10;
|
||||||
}
|
}
|
||||||
buf[digits] = '\r';
|
buf[digits] = '\r';
|
||||||
|
|
Loading…
Reference in a new issue