kopia lustrzana https://github.com/jgromes/RadioLib
[Print] Chore: uncrustify formatting
rodzic
b2963ef232
commit
45cc32b50a
|
@ -22,8 +22,11 @@ size_t RadioLibPrint::println(ITA2String& ita2) {
|
|||
size_t RadioLibPrint::write(const uint8_t* buffer, size_t size) {
|
||||
size_t n = 0;
|
||||
while(size--) {
|
||||
if (write(*buffer++)) n++;
|
||||
else break;
|
||||
if(write(*buffer++)) {
|
||||
n++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
@ -246,11 +249,19 @@ size_t RadioLibPrint::printFloat(double number, uint8_t digits) {
|
|||
size_t n = 0;
|
||||
|
||||
char code[] = {0x00, 0x00, 0x00, 0x00};
|
||||
if (isnan(number)) strcpy(code, "nan");
|
||||
if (isinf(number)) strcpy(code, "inf");
|
||||
if (number > (double)4294967040.0) strcpy(code, "ovf"); // constant determined empirically
|
||||
if (number < (double)-4294967040.0) strcpy(code, "ovf"); // constant determined empirically
|
||||
if(isnan(number)) {
|
||||
strcpy(code, "nan");
|
||||
}
|
||||
if(isinf(number)) {
|
||||
strcpy(code, "inf");
|
||||
}
|
||||
if(number > (double)4294967040.0) {
|
||||
strcpy(code, "ovf"); // constant determined empirically
|
||||
}
|
||||
if(number < (double)-4294967040.0) {
|
||||
strcpy(code, "ovf"); // constant determined empirically
|
||||
|
||||
}
|
||||
if(code[0] != 0x00) {
|
||||
if(this->encoding == RADIOLIB_ITA2) {
|
||||
ITA2String ita2 = ITA2String(code);
|
||||
|
|
|
@ -18,7 +18,9 @@ class RadioLibPrint {
|
|||
public:
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
size_t write(const char* str) {
|
||||
if (str == NULL) return 0;
|
||||
if(str == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return write(reinterpret_cast<const uint8_t*>(str), strlen(str));
|
||||
}
|
||||
virtual size_t write(const uint8_t* buffer, size_t size);
|
||||
|
|
Ładowanie…
Reference in New Issue