OSDN Git Service

[v2.0][BACKPORT] Backport from v1.0, fix up/down and add helps.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 5 Sep 2013 16:23:15 +0000 (01:23 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 5 Sep 2013 16:23:15 +0000 (01:23 +0900)
helps.c
helps.h
menu.c
ui_updown.c

diff --git a/helps.c b/helps.c
index 480f284..aa508a5 100644 (file)
--- a/helps.c
+++ b/helps.c
 #include "power.h"
 #include "commondef.h"
 
-const char *updown_helpstr[20] = {
-        "Help", "F=exit any=continue",
+#if 1
+const char *userfreq_helpstr[16] = {
+#else
+const char *userfreq_helpstr[10] = {
+#endif
+       "5: Reload", " ",
+        "1: -1", "7: +1",
+        "4: Call direct", "6: Set",
+#if 1
+        "2: -28", "8: +28",
+        "3: -100", "9: +100",
+#endif
+        "A: Exit",  "D: Reset",
+        "E: Backlight", "F: (Exit) Help",
+    };
+
+const char *updown_helpstr[18] = {
         "5: Menu", " ",
         "1: Slow Down", "3: Slow Up",
         "4: Down", "6: Up",
         "7: Fast Down", "9: Fast Up",
         "2: Band Down", "8: Band Up",
-        "0: Mode3K", " ",
-        "a: AM/FM", "b: Volume",
-        "c: Scan", "d: Stereo mode",
-        "e: Backlight", "f: (Exit) Help",
+        "0: Narrow/Broad", " ",
+        "A: AM/FM", "B: User freq",
+        "C Scan", "D: Stereo mode",
+        "E: Backlight", "F: (Exit) Help",
     };
 
 const char *setup_helpstr[14] = {
-        "Help", "F=exit any=continue",
-        "0: Power OFF", "C: Save status",
-        "d: Reset default", "E: BL time",
-        "A: Load", "",
-        "1: FM CNR", "2: AM CNR"
-        "3: FM STEREO", "4: Reserve"
+        "0: Power OFF",  " ",
+        "3: BL Level", "E: BL time",
+        "A: Load", "D: Reset default",
+        "C: Save status", " ",
+        "7: FM CNR", "8: AM CNR"
+        "9: FM STEREO", "4: FM BW",
         "5: Cancel", "f: (Exit) Help",
     };
 
-const char *mainmenu_helpstr[16] = {
-        "Help", "F=exit any=continue",
+const char *mainmenu_helpstr[14] = {
         "0: Setup", "1: Band",
-        "3: Freq", ""
+        "3: Freq", " "
         "4: Call user", "6: Set user",
         "7: Power Off", "8: Volume",
         "9: Width", "a: AM/FM",
@@ -73,18 +87,25 @@ const char *numeric_helpstr[10] = {
 };
 
 
+static unsigned char help_header(void)
+{
+    return printhelp_2lines("Help", "F=exit any=continue");
+}
+
 void setup_help(void)
 {
     unsigned char c;
     char l;
     l = 0;
+    if(help_header() == charcode_f) return;
     do {
         c = printhelp_2lines(setup_helpstr[l], setup_helpstr[l + 1]);
         if(c == charcode_f) return;
         l += 2;
-        if(l >= 16) {
+        if(l >= 14) {
             c = numeric_help();
             if(c == charcode_f) return;
+            if(help_header() == charcode_f) return;
             l = 0;
         }
     } while(1);
@@ -125,7 +146,7 @@ void mainmenu_help(void)
         c = printhelp_2lines(mainmenu_helpstr[l], mainmenu_helpstr[l + 1]);
         if(c == charcode_f) return;
         l += 2;
-        if(l >= 16) {
+        if(l >= 14) {
             c = numeric_help();
             if(c == charcode_f) return;
             l = 0;
@@ -139,14 +160,38 @@ void updown_help(void)
     char l;
 
     l = 0;
+    if(help_header() == charcode_f) return;
     do {
         c = printhelp_2lines(updown_helpstr[l], updown_helpstr[l + 1]);
         if(c == charcode_f) return;
         l += 2;
-        if(l >= 20) {
+        if(l >= 18) {
             c = numeric_help();
             if(c == charcode_f) return;
+           if(help_header() == charcode_f) return;
             l = 0;
         }
     } while(1);
 }
+
+
+void userfreq_help(void)
+{
+    unsigned char c;
+    char l;
+
+    l = 0;
+    if(help_header() == charcode_f) return;
+    do {
+        c = printhelp_2lines(userfreq_helpstr[l], userfreq_helpstr[l + 1]);
+        if(c == charcode_f) return;
+        l += 2;
+        if(l >= 16) {
+            c = numeric_help();
+            if(c == charcode_f) return;
+            if(help_header() == charcode_f) return;
+            l = 0;
+        }
+    } while(1);
+}
+
diff --git a/helps.h b/helps.h
index bbb866d..bb40645 100644 (file)
--- a/helps.h
+++ b/helps.h
@@ -41,7 +41,8 @@ extern "C" {
     extern unsigned char numeric_help(void);
     extern void updown_help(void);
     extern void mainmenu_help(void);
-    extern void  setup_help(void);
+    extern void setup_help(void);
+    extern void userfreq_help(void);
 
 
 
diff --git a/menu.c b/menu.c
index 11f3f9c..74f038e 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -252,6 +252,20 @@ void setband_direct(void)
         setup.amfreq_bank[setup.amband] = setup.amfreq;
         setup.amband = read_numeric(band, 2, 7, 1);
         setup.amfreq = setup.amfreq_bank[setup.amband];
+        switch(band) {
+        case AKC6955_BAND_LW:
+        case AKC6955_BAND_MW2:
+          setup.am_mode3k = 0xff;
+          break;
+        case AKC6955_BAND_MW1:
+        case AKC6955_BAND_MW3:
+        case AKC6955_BAND_MW4:
+          setup.am_mode3k = 0x00;
+          break;
+        default:
+          break;
+       }
+       
         akc6955_set_amband(setup.amband);
         freq = setup.amfreq;
     }
index a51cec5..de4c682 100644 (file)
@@ -93,6 +93,22 @@ static void setband_updown(unsigned char updown)
             band -= 2;
         }
         setup.amband = band;
+        switch(setup.amband) {
+        case AKC6955_BAND_LW:
+        case AKC6955_BAND_MW2:
+          setup.am_mode3k = 0xff;
+          break;
+        case AKC6955_BAND_MW1:
+        case AKC6955_BAND_MW3:
+        case AKC6955_BAND_MW4:
+          setup.am_mode3k = 0x00;
+          break;
+        case AKC6955_BAND_AMUSER:
+           call_userband(setup.am_userbandnum);
+          break;
+        default:
+          break;
+       }
         if(setup.amband == AKC6955_BAND_AMUSER){
 //            amfreq = am_usrbands[am_userbandnum].freq;
             call_userband(setup.am_userbandnum);
@@ -156,7 +172,7 @@ void setfreq_updown(unsigned char ctlword)
             freq = 33; // 99KHz@3K/9KStep.
             if(setup.fm != 0){
                 freq = 40; // 1MHz
-            } else if(setup.am_mode3k != 0){
+            } else if(setup.am_mode3k == 0){
                 freq = 20; // 100KHz
             }
             akc6955_up_freq(freq); // 825 or 90 or 165KHz
@@ -165,7 +181,7 @@ void setfreq_updown(unsigned char ctlword)
             freq = 33; // 99KHz@3K/9KStep.
             if(setup.fm != 0){
                 freq = 40; // 1MHz
-            } else if(setup.am_mode3k != 0){
+            } else if(setup.am_mode3k == 0){
                 freq = 20; // 100KHz
             }
             akc6955_down_freq(freq); // 825 or 90 or 165KHz
@@ -177,8 +193,6 @@ void setfreq_updown(unsigned char ctlword)
                 freq = 1; // 5KHz or 3KHz
                 if(setup.amband == AKC6955_BAND_MW2) {
                     freq = 3; // 9KHz
-                } else if(setup.amband == AKC6955_BAND_MW3) {
-                    freq = 2; // 10KHz
                 }
             }
             akc6955_down_freq(freq);
@@ -190,8 +204,6 @@ void setfreq_updown(unsigned char ctlword)
                 freq = 1; // 5KHz or 3KHz
                 if(setup.amband == AKC6955_BAND_MW2) {
                     freq = 3; // 9KHz
-                } else if(setup.amband == AKC6955_BAND_MW3) {
-                    freq = 2; // 10KHz
                 }
             }
             akc6955_up_freq(freq);