Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TFT_eSPI
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
TFT_eSPI
Commits
032e54dd
Commit
032e54dd
authored
Feb 16, 2022
by
Bodmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow drawFloat with decimal places = 0
See #1639
parent
86101770
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
3 deletions
+10
-3
TFT_eSPI.cpp
TFT_eSPI.cpp
+7
-0
TFT_eSPI.h
TFT_eSPI.h
+1
-1
library.json
library.json
+1
-1
library.properties
library.properties
+1
-1
No files found.
TFT_eSPI.cpp
View file @
032e54dd
...
...
@@ -5105,6 +5105,7 @@ int16_t TFT_eSPI::drawFloat(float floatNumber, uint8_t dp, int32_t poX, int32_t
uint8_t
ptr
=
0
;
// Initialise pointer for array
int8_t
digits
=
1
;
// Count the digits to avoid array overflow
float
rounding
=
0.5
;
// Round up down delta
bool
negative
=
false
;
if
(
dp
>
7
)
dp
=
7
;
// Limit the size of decimal portion
...
...
@@ -5116,10 +5117,16 @@ int16_t TFT_eSPI::drawFloat(float floatNumber, uint8_t dp, int32_t poX, int32_t
str
[
ptr
]
=
0
;
// Put a null in the array as a precaution
digits
=
0
;
// Set digits to 0 to compensate so pointer value can be used later
floatNumber
=
-
floatNumber
;
// Make positive
negative
=
true
;
}
floatNumber
+=
rounding
;
// Round up or down
if
(
dp
==
0
)
{
if
(
negative
)
floatNumber
=
-
floatNumber
;
return
drawNumber
((
long
)
floatNumber
,
poX
,
poY
,
font
);
}
// For error put ... in string and return (all TFT_eSPI library fonts contain . character)
if
(
floatNumber
>=
2147483647
)
{
strcpy
(
str
,
"..."
);
...
...
TFT_eSPI.h
View file @
032e54dd
...
...
@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.4.3
8
"
#define TFT_ESPI_VERSION "2.4.3
9
"
// Bit level feature flags
// Bit 0 set: viewport capability
...
...
library.json
View file @
032e54dd
{
"name"
:
"TFT_eSPI"
,
"version"
:
"2.4.3
8
"
,
"version"
:
"2.4.3
9
"
,
"keywords"
:
"Arduino, tft, ePaper, display, Pico, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, RM68140, SSD1351, SSD1963, ILI9225, HX8357D"
,
"description"
:
"A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, ESP8266, ESP32 and STM32"
,
"repository"
:
...
...
library.properties
View file @
032e54dd
name
=
TFT_eSPI
version
=
2.4.3
8
version
=
2.4.3
9
author
=
Bodmer
maintainer
=
Bodmer
sentence
=
TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment