From 1a626f83ae47c3964e7ab955e7a44d7dce056169 Mon Sep 17 00:00:00 2001 From: OneOfEleven Date: Sun, 24 Sep 2023 17:17:04 +0100 Subject: [PATCH] util/main.cpp update --- README.md | 14 ++++++------- utils/main.cpp | 57 +++++++++++++++++++------------------------------- 2 files changed, 28 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 9c56230..b9bf074 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up ENABLE_COMPANDER := 1 compander option (per channel) -ENABLE_SHOW_CHARGE_LEVEL := 1 show the charge level when the radio is on charge +ENABLE_SHOW_CHARGE_LEVEL := 1 show the charge level when the radio is on charge ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right) ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation - ignore the on-screen RSSI (for now) ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix @@ -39,20 +39,18 @@ ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level #ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter ``` -# Some other changes made +# Some changes made from the Quansheng firmware * Various Quansheng firmware bugs fixed * Added new bugs -* Finer RSSI bar steps * Mic menu includes max gain possible -* AM RX everywhere -* keypad-5/NOAA button now toggles scanlist-1 on/off for current channel when held down - IF NOAA is not used +* AM RX everywhere (left the TX as is) +* An attempt to improve the AM RX audio (demodulator getting saturated/overloaded) +* keypad-5/NOAA button now toggles scanlist-1 on/off for current channel when held down - IF NOAA not used * Better backlight times (inc always on) -* Nicer/cleaner big numeric font than original Quansheng big numeric font * Live DTMF decoder option, though the decoder needs some coeff tuning changes to decode other radios it seems * Various menu re-wordings (trying to reduce 'WTH does that mean ?') -* Extra menu items (including hidden ones) -* plus others +* .. # Compiler diff --git a/utils/main.cpp b/utils/main.cpp index d7d7943..bbfe7bd 100644 --- a/utils/main.cpp +++ b/utils/main.cpp @@ -25,9 +25,9 @@ // <9:8> = LNA Gain Short // 3 = 0dB < original value - // 2 = -11dB - // 1 = -16dB - // 0 = -19dB + // 2 = -24dB // was -11 + // 1 = -30dB // was -16 + // 0 = -33dB // was -19 // // <7:5> = LNA Gain // 7 = 0dB @@ -121,10 +121,7 @@ void __fastcall create_gain_table(const char *filename) entry.mixer_dB = mixer_dB[mixer]; entry.pga_dB = pga_dB[pga]; - entry.sum_dB = lna_short_dB[lna_short] + - lna_dB[lna] + - mixer_dB[mixer] + - pga_dB[pga]; + entry.sum_dB = lna_short_dB[lna_short] + lna_dB[lna] + mixer_dB[mixer] + pga_dB[pga]; if (entry.sum_dB != orig_gain_dB) gain_table.push_back(entry); @@ -176,9 +173,9 @@ void __fastcall create_gain_table(const char *filename) const t_gain_table entry1 = gain_table[i++]; if (entry1.lna_short == orig_lna_short && - entry1.lna == orig_lna && - entry1.mixer == orig_mixer && - entry1.pga == orig_pga) + entry1.lna == orig_lna && + entry1.mixer == orig_mixer && + entry1.pga == orig_pga) continue; // leave the original inplace while (i < gain_table.size()) @@ -186,9 +183,9 @@ void __fastcall create_gain_table(const char *filename) const t_gain_table entry2 = gain_table[i]; if (entry2.lna_short == orig_lna_short && - entry2.lna == orig_lna && - entry2.mixer == orig_mixer && - entry2.pga == orig_pga) + entry2.lna == orig_lna && + entry2.mixer == orig_mixer && + entry2.pga == orig_pga) break; // leave the original inplace if (entry2.sum_dB != entry1.sum_dB) @@ -208,9 +205,9 @@ void __fastcall create_gain_table(const char *filename) continue; if (entry.lna_short != orig_lna_short || - entry.lna != orig_lna || - entry.mixer != orig_mixer || - entry.pga != orig_pga) + entry.lna != orig_lna || + entry.mixer != orig_mixer || + entry.pga != orig_pga) continue; original_index = i; @@ -227,15 +224,13 @@ void __fastcall create_gain_table(const char *filename) fprintf(file, "\n"); fprintf(file, "\tconst t_am_fix_gain_table am_fix_gain_table[] =\n"); fprintf(file, "\t{\n"); - fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n"); - fprintf(file, "\n"); + fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n"); for (unsigned int i = 0; i < gain_table.size(); i++) { char s[1024]; - const t_gain_table entry = gain_table[i]; - // {0, 0, 0, 0}, // 00 -19dB -24dB -8dB -33dB .. -84dB + const t_gain_table entry = gain_table[i]; sprintf(s, "\t\t{%u, %u, %u, %u}, // %3u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB", entry.lna_short, @@ -252,13 +247,12 @@ void __fastcall create_gain_table(const char *filename) if (i == original_index) strcat(s, " original"); - strcat(s, "\n"); - - fprintf(file, "%s", s); + fprintf(file, "%s\n", s); } - fprintf(file, "\t};\n"); - fprintf(file, "\n\tconst unsigned int original_index = %u;\n", 1 + original_index); + fprintf(file, "\t};\n\n"); + + fprintf(file, "\tconst unsigned int original_index = %u;\n", 1 + original_index); fclose(file); } @@ -298,15 +292,10 @@ void __fastcall rotate_font(const char *filename1, const char *filename2) data.resize(file_size); const size_t bytes_loaded = fread(&data[0], 1, file_size, file); - if (bytes_loaded != file_size) - { - fclose(file); - return; - } fclose(file); - if (bytes_loaded != data.size()) + if (bytes_loaded != file_size) return; // *************************** @@ -332,14 +321,13 @@ void __fastcall rotate_font(const char *filename1, const char *filename2) } // *************************** - // save file + // save the file file = fopen(filename2, "wt"); if (file == NULL) return; fprintf(file, "const uint8_t gFontSmall[95][7] =\n"); -// fprintf(file, "const uint8_t gFontSmall[95][6] =\n"); fprintf(file, "{\n"); for (unsigned int i = 0; i < data.size(); ) @@ -370,7 +358,7 @@ void __fastcall rotate_font(const char *filename1, const char *filename2) } i++; - + fprintf(file, "%s", s); } @@ -391,4 +379,3 @@ int main(int argc, char* argv[]) return 0; } -