Fix for the bug projectkk2glider noticed, thanks!
This commit is contained in:
@@ -70,10 +70,14 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t newVal, uin
|
|||||||
if (g_eeGeneral.adjustRTC) {
|
if (g_eeGeneral.adjustRTC) {
|
||||||
struct gtm t;
|
struct gtm t;
|
||||||
gettime(&t);
|
gettime(&t);
|
||||||
t.tm_hour = datetime.hour;
|
if (abs((t.tm_hour-datetime.hour)*3600 + (t.tm_min-datetime.min)*60 + (t.tm_sec-datetime.sec)) > 20) {
|
||||||
t.tm_min = datetime.min;
|
// we adjust RTC only if difference is > 20 seconds
|
||||||
t.tm_sec = datetime.sec;
|
t.tm_hour = datetime.hour;
|
||||||
rtcSetTime(&t);
|
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) {
|
if (datetime.year == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user