1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 16:25:16 +03:00

Compilation fix

This commit is contained in:
Bertrand Songis 2020-10-03 11:42:23 +02:00
parent a07fb2bb5a
commit 41bb035ce5
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
3 changed files with 11 additions and 11 deletions

View file

@ -170,11 +170,11 @@ char * strAppendStringWithIndex(char * dest, const char * s, int idx)
return strAppendUnsigned(strAppend(dest, s), abs(idx)); return strAppendUnsigned(strAppend(dest, s), abs(idx));
} }
constexpr int32_t secondsPerDay = 24 * 3600; constexpr int secondsPerDay = 24 * 3600;
constexpr int32_t secondsPer99Hours = 99*3600 + 59*60 + 59; constexpr int secondsPer99Hours = 99*3600 + 59*60 + 59;
constexpr int32_t secondsPerYear = 365 * secondsPerDay; constexpr int secondsPerYear = 365 * secondsPerDay;
char * getTimerString(char * dest, int32_t tme, uint8_t hours) char * getTimerString(char * dest, int tme, uint8_t hours)
{ {
char * s = dest; char * s = dest;
div_t qr; div_t qr;
@ -208,7 +208,7 @@ char * getTimerString(char * dest, int32_t tme, uint8_t hours)
*s = '\0'; *s = '\0';
} }
else if (tme < secondsPer99Hours) { else if (tme < secondsPer99Hours) {
qr = div((int) tme, 3600); qr = div(tme, 3600);
div_t qr2 = div(qr.rem, 60); div_t qr2 = div(qr.rem, 60);
*s++ = '0' + (qr.quot / 10); *s++ = '0' + (qr.quot / 10);
*s++ = '0' + (qr.quot % 10); *s++ = '0' + (qr.quot % 10);
@ -218,7 +218,7 @@ char * getTimerString(char * dest, int32_t tme, uint8_t hours)
*s = '\0'; *s = '\0';
} }
else if (tme < secondsPerYear) { else if (tme < secondsPerYear) {
qr = div((int) tme, secondsPerDay); qr = div(tme, secondsPerDay);
div_t qr2 = div(qr.rem, 60); div_t qr2 = div(qr.rem, 60);
*s++ = '0' + (qr.quot / 100); *s++ = '0' + (qr.quot / 100);
*s++ = '0' + (qr.quot / 10); *s++ = '0' + (qr.quot / 10);
@ -230,7 +230,7 @@ char * getTimerString(char * dest, int32_t tme, uint8_t hours)
*s = '\0'; *s = '\0';
} }
else { else {
qr = div((int) tme, secondsPerYear); qr = div(tme, secondsPerYear);
div_t qr2 = div(qr.rem, secondsPerDay); div_t qr2 = div(qr.rem, secondsPerDay);
*s++ = '0' + (qr.quot / 10); *s++ = '0' + (qr.quot / 10);
*s++ = '0' + (qr.quot % 10); *s++ = '0' + (qr.quot % 10);

View file

@ -32,7 +32,7 @@ char * strAppendFilename(char * dest, const char * filename, const int size);
char * getStringAtIndex(char * dest, const char * s, int idx); char * getStringAtIndex(char * dest, const char * s, int idx);
char * strAppendStringWithIndex(char * dest, const char * s, int idx); char * strAppendStringWithIndex(char * dest, const char * s, int idx);
#define LEN_TIMER_STRING 10 // "-00:00:00" #define LEN_TIMER_STRING 10 // "-00:00:00"
char * getTimerString(char * dest, int32_t tme, uint8_t hours=0); char * getTimerString(char * dest, int tme, uint8_t hours=0);
char * getCurveString(char * dest, int idx); char * getCurveString(char * dest, int idx);
char * getGVarString(char * dest, int idx); char * getGVarString(char * dest, int idx);
char * getSwitchPositionName(char * dest, swsrc_t idx); char * getSwitchPositionName(char * dest, swsrc_t idx);

View file

@ -763,9 +763,9 @@ bool TelemetrySensor::isSameInstance(TelemetryProtocol protocol, uint8_t instanc
return true; return true;
#else #else
if (((this->instance ^ instance) & 0x9F) == 0 && (this->instance >> 5) != TELEMETRY_ENDPOINT_SPORT && (instance >> 5) != TELEMETRY_ENDPOINT_SPORT) { if (((this->instance ^ instance) & 0x9F) == 0 && (this->instance >> 5) != TELEMETRY_ENDPOINT_SPORT && (instance >> 5) != TELEMETRY_ENDPOINT_SPORT) {
this->instance = instance; // update the instance in case we had telemetry switching this->instance = instance; // update the instance in case we had telemetry switching
return true; return true;
} }
#endif #endif
} }