Aareschluchtje 9 gadi atpakaļ
vecāks
revīzija
be087b0ddd
2 mainītis faili ar 4 papildinājumiem un 5 dzēšanām
  1. 1 1
      main.c
  2. 3 4
      network.c

+ 1 - 1
main.c

@@ -290,7 +290,7 @@ int main(void)
     NtpInit();
 
     NutThreadCreate("BackgroundThread", StartupInit, NULL, 1024);
-    NutThreadCreate("BackgroundThread", AlarmSync, NULL, 1024);
+    NutThreadCreate("BackgroundThread", AlarmSync, NULL, 2000);
     NutThreadCreate("BackgroundThread", NTPSync, NULL, 1024);
     /** Quick fix for turning off the display after 10 seconds boot */
 

+ 3 - 4
network.c

@@ -115,7 +115,7 @@ void parseAlarmJson(char* content){
     int r;
     int i;
     jsmn_parser p;
-    jsmntok_t token[80]; /* We expect no more than 128 tokens */
+    jsmntok_t token[300]; /* We expect no more than 128 tokens */
 
     jsmn_init(&p);
     r = jsmn_parse(&p, content, strlen(content), token, sizeof(token)/sizeof(token[0]));
@@ -128,10 +128,10 @@ void parseAlarmJson(char* content){
 
 
 
-    for(i = 1; i > r; i++)
+    for(i = 1; i < r; i++)
     {
         struct _tm time = GetRTCTime();
-        for (i = i; i % 14 == 0; i++) {
+        for (i = i; !(i % 14 == 0); i++) {
             if (jsoneq(content, &token[i], "YYYY") == 0) {
                 time.tm_year= getIntegerToken(content, &token[i + 1]) - 1900;
                 i++;
@@ -157,7 +157,6 @@ void parseAlarmJson(char* content){
 
         X12RtcSetAlarm(0,&time,0b11111111);
         NutDelay(1000);
-
     }
 }