OSDN Git Service

[UI][FM][MENU] Add tune pitch.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 24 Sep 2013 03:15:10 +0000 (12:15 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 24 Sep 2013 03:15:10 +0000 (12:15 +0900)
helps.c
menu.c
menu.h
menu_defs.c
ui_display.c
ui_updown.c

diff --git a/helps.c b/helps.c
index 6c84978..59e39fe 100644 (file)
--- a/helps.c
+++ b/helps.c
@@ -60,7 +60,7 @@ const char *setup_helpstr[14] = {
         "0: Power OFF",  " ",
         "3: BL Level", "E: BL time",
         "A: Load", "D: Reset default",
-        "C: Save status", " ",
+        "C: Save status", "E: FM PITCH",
         "7: FM CNR", "8: AM CNR"
         "9: FM STEREO", "4: FM BW",
         "5: Cancel", "f: (Exit) Help",
diff --git a/menu.c b/menu.c
index bf89e82..c84bd8f 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -161,6 +161,25 @@ void menu_poweroff(void)
     }
 }
 
+void menu_setfmresolution(void)
+{
+   unsigned char c;
+    if(setup.fm != 0){
+       _CLS();
+       _LOCATE(0,0);
+        c = akc6955_get_scanrate_fm();
+        printstr("FM pitch:");
+        c = pollkey_numeric(c);
+        setup.fm_tunepitch = c & 3;
+        akc6955_set_scanrate_fm(c);
+        _CLS();
+        _LOCATE(0,0);
+    }
+}
+
+        
+
+
 void setup_akc6955(void)
 {
     akc6955_writecmd(AKC6955_POWER, 0xc0);  // You musto *not* mute, set b2 to '0".
@@ -186,6 +205,7 @@ void setup_akc6955(void)
     akc6955_set_thresh_fmstereo(setup.threshold_fmstereo);
     akc6955_setvolumemode(0);
     akc6955_set_lowboost(setup.lowboost);
+    akc6955_set_scanrate_fm(setup.fm_tunepitch & 3);
     set_stereomode();
 }
 
@@ -244,7 +264,10 @@ void main_menu(void)
         case charcode_d:
             input_userband();
             break;
-        case charcode_f:
+        case charcode_e:
+            menu_setfmresolution();
+            break;
+     case charcode_f:
             mainmenu_help();
             // HELP
             break;
diff --git a/menu.h b/menu.h
index 5c025e5..3cf9d40 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -112,6 +112,7 @@ typedef struct {
     int backlight_level;
     unsigned int ui_idlecount;
     unsigned int memorynum;
+    unsigned char fm_tunepitch;
     _memoryfreq_t memoryfreqs[USER_MEMORY_NUM];
 } __radioset_t;
 
index 6fe7763..7f6ce62 100644 (file)
@@ -155,6 +155,7 @@ void valinit(void)
     setup.volume = 36;
     setup.prevolume = 3;
     setup.fmbandwidth = 0;
+    setup.fm_tunepitch = 2;
 //    setup.pagenum = setup.memorynum / USER_MEMORY_NUM;
     diffstat = 0;
     cnrlevel = 103;
index b3ffa1c..b1be147 100644 (file)
@@ -139,7 +139,7 @@ void update_display(void)
     _PUTCHAR(' ');
     set_amfmlamp(~setup.fm);
     _PUTCHAR('W');
-    print_numeric_nosupress(setup.threshold_width & 3, 1);
+    print_numeric_nosupress((setup.threshold_width & 3) * 10 + (setup.fm_tunepitch & 3), 2);
      // vol = volume * 1.5 + prevolume * 3.5[dB]
 #if 0
      if(volume > 24) {
index 2d247d2..250d001 100644 (file)
@@ -175,7 +175,26 @@ void setfreq_updown(unsigned char ctlword)
         case charcode_3: // Up Slow;
         case charcode_1: // Down Slow;
             if(setup.fm != 0){
-                freq = 4; // DOWN 100KHz
+               unsigned char bw;
+               bw = akc6955_get_scanrate_fm();
+                switch(bw) {
+                case 0: // 25KHz
+                  freq = 1;
+                  break;
+                case 1: // 50KHz
+                  freq = 2;
+                  break;
+                case 2:
+                  freq = 4; // 100KHz
+                  break;
+                default:
+                  freq = 8; // 200KHz except TV1/TV2.
+                  if((setup.fmband == AKC6955_BAND_TV1) || (setup.fmband == AKC6955_BAND_TV2)) { 
+                       freq = 4;
+                  }
+                  break;
+               }
+              
             } else {
                 freq = 1; // 5KHz or 3KHz
                 if(setup.amband == AKC6955_BAND_MW2) {