OSDN Git Service

[IDLE] Maybe correct time.
[openi2cradio/OpenI2CRadio.git] / main.c
diff --git a/main.c b/main.c
index 85c0d00..af5cd39 100644 (file)
--- a/main.c
+++ b/main.c
@@ -73,7 +73,7 @@
 
 #pragma stack 0x200 256
 #pragma config FOSC=HS,FCMEN=ON,PWRT=ON,BOREN=NOSLP,BORV=27, \
-               WDTEN=ON,WDTPS=32768,PBADEN=OFF,HFOFST=ON,LPT1OSC=OFF, \
+               WDTEN=ON,WDTPS=32768,PBADEN=OFF,HFOFST=OFF,LPT1OSC=OFF, \
                MCLRE=ON,STVREN=ON,DEBUG=ON, \
                XINST=OFF
 //#pragma config CP0=OFF,CP1=OFF,CP2=OFF,CP3=OFF
@@ -254,6 +254,7 @@ int main(void)
     
 #ifdef __SDCC
     OSCCON =  (0x80 & 0b11111100) | 0b00111000;
+//    OSCCON =  (0x80 & 0b11111100) | 0b00110010; // 8MHz 
 #else
     OSCCON = (_OSCCON_IDLEN_MASK & 0b11111100 ) | 0b00111000;
 #endif
@@ -276,11 +277,11 @@ int main(void)
             power_off(0); // Save and halt on BOR.
             break;
         case RESET_SOFTWARE: //
-            do {
-                pbutton = chk_powerbutton();
-                ClrWdt();
-                if(pbutton == 0) power_off(0); // Button not pressed.
-            } while(pbutton == 0);
+//            do {
+//                pbutton = chk_powerbutton();
+//                ClrWdt();
//               if(pbutton == 0) power_off(0); // Button not pressed.
+//            } while(pbutton == 0);
             break;
         default:
             break;
@@ -318,12 +319,12 @@ int main(void)
 //    printstr("OK");
    lcd_setbacklight(0xff, 255);
     do {
-//            if(battlevel <= 408) { // 4.80*0.85
- //               lowbatt();
- //            }
+//        set_powerlamp(0);
+            if(battlevel <= 340) { // 3.4V
+               lowbatt();
+            }
         /* Main routine*/
-#if 1
-       c = pollkeys(pollkeybuf, 60, 1);
+       c = pollkeys(pollkeybuf, 10, 1); // 23*10=230ms
        p = 0;
        while(c > 0) {
            ClrWdt();
@@ -331,10 +332,7 @@ int main(void)
            c--;
            p++;
        }
-#else
-       c = pollkey_single();
-       setfreq_updown(c);
-#endif
+//       set_powerlamp(1);
 //       idle_time_ms(ui_idlecount);
         // Putstring to LCD.
         _LOCATE(0,0);
@@ -348,7 +346,7 @@ int main(void)
             lcd_setbacklight(0x00, 0); // Turn OFF
        }
         update_status();
-        ClrWdt();
+//        ClrWdt();
         update_display();
         ClrWdt();
     } while(1);