Kaynağa Gözat

Moved network and ntp init to thread

jancoow 9 yıl önce
ebeveyn
işleme
c401e4a668
2 değiştirilmiş dosya ile 10 ekleme ve 12 silme
  1. 9 3
      main.c
  2. 1 9
      ntp.c

+ 9 - 3
main.c

@@ -217,6 +217,14 @@ int checkOffPressed(){
  * \return \b never returns
  */
 /* ����������������������������������������������������������������������� */
+
+THREAD(StartupInit, arg)
+{
+    NetworkInit();
+    NtpInit();
+    NutThreadExit();
+}
+
 int main(void)
 {
 	time_t start;
@@ -245,9 +253,7 @@ int main(void)
 
     X12Init();
 
-    NetworkInit();
-
-    NtpInit();
+    NutThreadCreate("Bg", StartupInit, NULL, 512);
 
 	/*
 	 * Kroeske: sources in rtc.c en rtc.h

+ 1 - 9
ntp.c

@@ -56,12 +56,4 @@ void GetTime(){
     X12RtcSetClock(ntp_datetime);
 
 
-    NutDelay(100);
-
-
-    // for logging purposes
-    tm gmt;
-    X12RtcGetClock(&gmt);
-    LogMsg_P(LOG_INFO, PSTR("RTC time [%02d:%02d:%02d]"), gmt.tm_hour, gmt.tm_min, gmt.tm_sec );
-}
-
+}