mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Fix for the bug projectkk2glider noticed, thanks!
This commit is contained in:
parent
01e6c60cf5
commit
0886873f54
1 changed files with 8 additions and 4 deletions
|
@ -70,12 +70,16 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t newVal, uin
|
|||
if (g_eeGeneral.adjustRTC) {
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
if (abs((t.tm_hour-datetime.hour)*3600 + (t.tm_min-datetime.min)*60 + (t.tm_sec-datetime.sec)) > 20) {
|
||||
// we adjust RTC only if difference is > 20 seconds
|
||||
t.tm_hour = datetime.hour;
|
||||
t.tm_min = datetime.min;
|
||||
t.tm_sec = datetime.sec;
|
||||
g_rtcTime = gmktime(&t); // update local timestamp and get wday calculated
|
||||
rtcSetTime(&t);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (datetime.year == 0) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue