Browse Source

Merge branch 'ntp_fix' into streamer_fix

Jordy Sipkema 9 năm trước cách đây
mục cha
commit
ab50eefbbe
3 tập tin đã thay đổi với 12 bổ sung3 xóa
  1. 2 2
      main.c
  2. 7 1
      ntp.c
  3. 3 0
      ntp.h

+ 2 - 2
main.c

@@ -224,8 +224,8 @@ THREAD(AlarmSync, arg)
         if((initialized == true) && (hasNetworkConnection() == true))
         {
             isAlarmSyncing = true;
-            char url[43];
-            sprintf(url, "%s%s", "/getAlarmen.php?radiomac=", getMacAdress());
+            char url[49];
+            sprintf(url, "/getAlarmen.php?radiomac=%s&tz=%d", getMacAdress(), getTimeZone());
             httpGet(url, parseAlarmJson);
             isAlarmSyncing = false;
 

+ 7 - 1
ntp.c

@@ -104,6 +104,7 @@ void NtpSync(void){
     /* Ophalen van pool.ntp.org */
     isSyncing = true;
     httpGet("/gettimezone.php", parsetimezone);
+    _daylight = 0;
     printf(TIME_ZONE);
     NutDelay(100);
     //puts("Tijd ophalen van pool.ntp.org (213.154.229.24)");
@@ -144,5 +145,10 @@ void NtpWriteTimeToEeprom(tm time_struct){
 }
 
 void setTimeZone(int timezone){
-    _timezone = -timezone * 3600;
+    TIME_ZONE = timezone;
+    _timezone = -1*timezone * 3600;
+}
+
+int getTimeZone(){
+    return TIME_ZONE;
 }

+ 3 - 0
ntp.h

@@ -16,4 +16,7 @@ extern bool NtpTimeIsValid(void);
 void NtpCheckValidTime(void);
 void NtpWriteTimeToEeprom(tm);
 bool NtpCompareTime(tm, tm);
+
+void setTimeZone(int timezone);
+int getTimeZone();
 #endif /* _Ntp_H */