OSDN Git Service

[UI][LCD] Fix flicking LCD display.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 11 Sep 2013 16:22:43 +0000 (01:22 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 11 Sep 2013 16:22:43 +0000 (01:22 +0900)
lcd_acm1602.c
menu.c
menu_scan.c
menu_setup.c
ui.c
ui_display.c

index 7c830fd..422bd6e 100644 (file)
@@ -449,9 +449,9 @@ void acm1602_cursordir(unsigned char addr, unsigned char right)
 {
     unsigned char cmd;
 
-    cmd = 0x1c;
+    cmd = 0x14;
     if(right == 0)  {
-        cmd = 0x18;
+        cmd = 0x10;
     }
     sendcmd(addr, cmd, 0xff);
 }
diff --git a/menu.c b/menu.c
index 577f19c..bf89e82 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -201,44 +201,55 @@ void main_menu(void)
 
     printhelp_2lines("Menu:F=HELP", "B=CANCEL");
     c = pollkey_single(); // 1012ms
-        if(c == charcode_1){
+    switch(c) {
+        case charcode_1:
             // Band
             setband_direct();
-        } else if(c == charcode_3){
+            break;
+        case charcode_3:
             // Band
             setfreq_direct();
-        }else if(c == charcode_4){
+            break;
+        case charcode_4:
             on_call_userfreq();
+            break;
             // Scan
-        }else if(c == charcode_5){
-         //   scan_start();
-            // Scan
-        }else if(c == charcode_6){
+        case charcode_5:
+            break;
+        case charcode_6:
             on_set_userfreq();
+            break;
             // Scan
-        } else if(c == charcode_7){
+        case charcode_7:
             menu_poweroff();
-        } else if(c == charcode_8){
+            break;
+        case charcode_8:
             // Set volume
             set_volume();
-        } else if(c == charcode_9){
-            unsigned int freq;
+            break;
+        case charcode_9:
             freq = akc6955_get_freq();
             akc6955_set_freq(freq);
-        } else if(c == charcode_0){
+            break;
+        case charcode_0:
             // Setup Menu
             setup_menu();
-        } else if(c == charcode_a){
+            break;
+        case charcode_a:
             toggle_amfm();
-        } else if(c == charcode_c){
-            // Set userband
+            break;
+        case charcode_c:
             set_userband();
-        } else if(c == charcode_d){
-            // Call userband
+            break;
+        case charcode_d:
             input_userband();
-        } else if (c == charcode_f){
+            break;
+        case charcode_f:
             mainmenu_help();
             // HELP
+            break;
+        default:
+            break;
         }
        _CLS();
        _LOCATE(0,0);
index 0ac9062..9488b04 100644 (file)
@@ -48,6 +48,7 @@ void scan_start(void)
                 cc = '>';
             }
             _PUTCHAR(cc);
+            _LOCATE(0,0);
             printstr("Scan A/4/6/F");
             print_freq(1);
             _HOME();
index 3d94bb7..1755f54 100644 (file)
@@ -77,7 +77,7 @@ void setup_menu(void)
             val = read_numeric(setup.backlight_level, 3, 0,1);
             if((val & 0x80000000) == 0) {
                 if(val > 255) val = 255;
-                if(val < 10) val = 15;
+                if(val < 15) val = 15;
                 setup.backlight_level = (unsigned char)val;
             }
             break;
diff --git a/ui.c b/ui.c
index ef51ed9..1e42ec5 100644 (file)
--- a/ui.c
+++ b/ui.c
@@ -193,7 +193,7 @@ unsigned long read_numeric(unsigned int initial, unsigned char digit,
     val =(unsigned long) initial;
     i = d;
     do {
-        _CURSOR_OFF();
+//        _CURSOR_OFF();
        ClrWdt();
         _LOCATE(startx, starty);
         print_numeric_nosupress(val, digit);
@@ -217,6 +217,7 @@ unsigned long read_numeric(unsigned int initial, unsigned char digit,
             i++;
         } else if(c == charcode_b) {
             // cancel
+           _CURSOR_OFF();
             return 0xffffffff;
         }  else if(c == charcode_e) {
             i++;
index 5d3120b..b3ffa1c 100644 (file)
@@ -56,6 +56,7 @@ void print_freq(unsigned char y)
     int freq;
     int freq_lo;
     int freq_hi;
+//    _HOME();
     _LOCATE(0,y);
     if(setup.fm != 0){ // FM
         if(setup.fmband < AKC6955_BAND_TV1) {
@@ -120,6 +121,7 @@ void print_freq(unsigned char y)
      } else {
          printstr("KHz");
      }
+     _HOME();
 }
 
 void update_display(void)
@@ -129,7 +131,7 @@ void update_display(void)
     int sig;
     int lv;
     unsigned int batlv;
-//    _HOME();
+ //   _CLS();
     _LOCATE(0,0);
     printstr("S");
     sig = recv_signal + 40;
@@ -149,12 +151,10 @@ void update_display(void)
          printstr("MUTE");
      }
 #endif
-     _LOCATE(16-5,0);
+     _LOCATE(15-4,0);
      print_numeric_nosupress(battlevel / 100, 1);
      _PUTCHAR('.');
      print_numeric_nosupress(battlevel % 100, 2);
      _PUTCHAR('V');
      print_freq(1);
-//    _PUTCHAR(' ');
-    _HOME();
 }