Przeglądaj źródła

Fixed some merge conflicts. Backlight still doesn't work.

jancoow 9 lat temu
rodzic
commit
425dcdfa32
2 zmienionych plików z 18 dodań i 23 usunięć
  1. 1 1
      alarm.c
  2. 17 22
      main.c

+ 1 - 1
alarm.c

@@ -102,7 +102,7 @@ void deleteAlarm(int idx){
 }
 
 void handleAlarm(int idx){
-	alarm[idx].time.tm_min = alarm[idx].time.tm_min + 1;
+	alarm[idx].time.tm_mday = alarm[idx].time.tm_mday + 1;
 	alarm[idx].state = 0;
 }
 

+ 17 - 22
main.c

@@ -180,9 +180,7 @@ static void SysControlMainBeat(u_char OnOff)
 /*-------------------------------------------------------------------------*/
 int isAlarmSyncing;
 int initialized;
-int VOL2;
-time_t start;
-time_t startVolumeTime;
+
 
 /*-------------------------------------------------------------------------*/
 /* local variable definitions                                              */
@@ -197,9 +195,6 @@ THREAD(StartupInit, arg)
 
     NtpSync();
 
-    start = time(0);
-    startVolumeTime = time(0);
-
     initialized = 1;
     NutThreadExit();
 }
@@ -232,7 +227,7 @@ int timer(time_t start){
 }
 
 int checkOffPressed(){
-    if (KbGetKey() > 1){
+    if (KbGetKey() == KEY_POWER){
         LcdBackLight(LCD_BACKLIGHT_ON);
         return 1;
     } else {
@@ -245,9 +240,12 @@ int checkOffPressed(){
 int main(void)
 {
 	initialized = 0;
+    int VOL2;
+    time_t start;
+    time_t startVolumeTime;
 	int idx = 0;
 
-	int running = 0;
+	int running;
 
     WatchDogDisable();
 
@@ -289,19 +287,18 @@ int main(void)
 
 	/* Enable global interrupts */
 	sei();
+
+    //struct _tm tm;
+	//tm = GetRTCTime();
+	//tm.tm_sec += 10;
+    //setAlarm(tm,"    test1234      ", "0.0.0.0", 8001,1,0,0);
+	//tm.tm_sec +=20;
+	//setAlarm(tm,"    test5678      ", "0.0.0.0", 8001,1,0,1);
+
+    start = time(0) - 10;
     unsigned char VOL = 64;
-    displayDate(1);
-    displayTime(0);
-
-    struct _tm tm;
-	tm = GetRTCTime();
-	tm.tm_sec += 10;
-    setAlarm(tm,"    test1234      ", "0.0.0.0", 8001,1,0,0);
-	tm.tm_sec +=20;
-	setAlarm(tm,"    test5678      ", "0.0.0.0", 8001,1,0,1);
-
-    start = time(0);
-    startVolumeTime = time(0);
+    startVolumeTime = time(0) - 5;
+
     running = 1;
 
     for (;;)
@@ -361,8 +358,6 @@ int main(void)
             displayTime(0);
             displayDate(1);
 		}
-        printf("%d", timer(startVolumeTime));
-
 
         VOL2 = VOL;
         WatchDogRestart();