Skip to content

Commit fa6af6e

Browse files
authored
Fix print of extra 0 when floats have only zeroes as decimals (#26)
Fixes #25
1 parent cc069fe commit fa6af6e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Nokia 5110 LCD library
2-
version=2.7.0
2+
version=2.7.1
33
author=Dimitris Platis
44
maintainer=Dimitris Platis <dimitris@plat.is>
55
sentence=Arduino library for driving the Nokia 5110 LCD

src/Nokia_LCD.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ bool Nokia_LCD::print(double number, unsigned short decimals) {
379379
}
380380
}
381381

382+
if (fractional == 0) {
383+
// If the fractional part is 0, then we have already printed it
384+
return out_of_bounds;
385+
}
382386
// prints the rest of the fractional
383387
return (out_of_bounds || print(fractional));
384388
}

0 commit comments

Comments
 (0)