@@ -18,6 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include "opentx.h"
|
||||
|
||||
display_t displayBuf[DISPLAY_BUFFER_SIZE] __DMA;
|
||||
@@ -465,7 +466,19 @@ void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t le
|
||||
int idx = 0;
|
||||
int mode = MODE(flags);
|
||||
bool neg = false;
|
||||
|
||||
if (val == INT_MAX) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MAX", flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (val < 0) {
|
||||
if (val == INT_MIN) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MIN", flags);
|
||||
return;
|
||||
}
|
||||
val = -val;
|
||||
neg = true;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include "opentx.h"
|
||||
#include "timers.h"
|
||||
|
||||
@@ -402,7 +403,19 @@ void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t le
|
||||
int idx = 0;
|
||||
int mode = MODE(flags);
|
||||
bool neg = false;
|
||||
|
||||
if (val == INT_MAX) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MAX", flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (val < 0) {
|
||||
if (val == INT_MIN) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MIN", flags);
|
||||
return;
|
||||
}
|
||||
val = -val;
|
||||
neg = true;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include "opentx.h"
|
||||
#include "strhelpers.h"
|
||||
|
||||
@@ -165,7 +166,19 @@ void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t le
|
||||
int idx = 0;
|
||||
int mode = MODE(flags);
|
||||
bool neg = false;
|
||||
|
||||
if (val == INT_MAX) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MAX", flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (val < 0) {
|
||||
if (val == INT_MIN) {
|
||||
flags &= ~(LEADING0 | PREC1 | PREC2);
|
||||
lcdDrawText(x, y, "INT_MIN", flags);
|
||||
return;
|
||||
}
|
||||
val = -val;
|
||||
neg = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user