mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-21 17:57:59 +00:00
Updated backlight menu options
This commit is contained in:
parent
1a626f83ae
commit
9cc84bd00b
2
board.c
2
board.c
@ -543,7 +543,7 @@ void BOARD_EEPROM_Init(void)
|
||||
gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF;
|
||||
gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4;
|
||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||
gEeprom.BACKLIGHT = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 4;
|
||||
gEeprom.BACKLIGHT = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3;
|
||||
gEeprom.TAIL_NOTE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "settings.h"
|
||||
|
||||
// this is decremented once every 500ms
|
||||
uint8_t gBacklightCountdown = 0;
|
||||
uint16_t gBacklightCountdown = 0;
|
||||
|
||||
void BACKLIGHT_TurnOn(void)
|
||||
{
|
||||
@ -34,22 +34,27 @@ void BACKLIGHT_TurnOn(void)
|
||||
{
|
||||
default:
|
||||
case 1: // 5 sec
|
||||
gBacklightCountdown = 2 * 5;
|
||||
gBacklightCountdown = 5;
|
||||
break;
|
||||
case 2: // 10 sec
|
||||
gBacklightCountdown = 2 * 10;
|
||||
gBacklightCountdown = 10;
|
||||
break;
|
||||
case 3: // 20 sec
|
||||
gBacklightCountdown = 2 * 20;
|
||||
gBacklightCountdown = 20;
|
||||
break;
|
||||
case 4: // 40 sec
|
||||
gBacklightCountdown = 2 * 40;
|
||||
case 4: // 1 min
|
||||
gBacklightCountdown = 60;
|
||||
break;
|
||||
case 5: // 80 sec
|
||||
gBacklightCountdown = 2 * 80;
|
||||
case 5: // 2 min
|
||||
gBacklightCountdown = 60 * 2;
|
||||
break;
|
||||
case 6: // always on
|
||||
case 6: // 4 min
|
||||
gBacklightCountdown = 60 * 4;
|
||||
break;
|
||||
case 7: // always on
|
||||
gBacklightCountdown = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
gBacklightCountdown *= 2;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint8_t gBacklightCountdown;
|
||||
extern uint16_t gBacklightCountdown;
|
||||
|
||||
void BACKLIGHT_TurnOn(void);
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -249,14 +249,15 @@ const char gSubMenu_F_LOCK[6][4] =
|
||||
"438"
|
||||
};
|
||||
|
||||
const char gSubMenu_BACKLIGHT[7][7] =
|
||||
const char gSubMenu_BACKLIGHT[8][7] =
|
||||
{
|
||||
"OFF",
|
||||
"5 sec",
|
||||
"10 sec",
|
||||
"20 sec",
|
||||
"40 sec",
|
||||
"80 sec",
|
||||
"1 min",
|
||||
"2 min",
|
||||
"4 min",
|
||||
"ON"
|
||||
};
|
||||
|
||||
|
@ -138,7 +138,7 @@ extern const char gSubMenu_PONMSG[4][5];
|
||||
extern const char gSubMenu_ROGER[3][6];
|
||||
extern const char gSubMenu_RESET[2][4];
|
||||
extern const char gSubMenu_F_LOCK[6][4];
|
||||
extern const char gSubMenu_BACKLIGHT[7][7];
|
||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||
#ifdef ENABLE_COMPANDER
|
||||
extern const char gSubMenu_Compand[4][6];
|
||||
#endif
|
||||
|
@ -68,10 +68,13 @@ typedef struct
|
||||
int16_t sum_dB;
|
||||
} t_gain_table;
|
||||
|
||||
void __fastcall create_gain_table(const char *filename)
|
||||
void create_gain_table(const char *filename)
|
||||
{
|
||||
std::vector <t_gain_table> gain_table;
|
||||
|
||||
if (filename == NULL)
|
||||
return;
|
||||
|
||||
// front end register dB values
|
||||
// const int16_t lna_short_dB[4] = { (-19), (-16), (-11), (0)}; // was
|
||||
const int16_t lna_short_dB[4] = { (-33), (-30), (-24), (0)}; // corrected
|
||||
@ -149,7 +152,7 @@ void __fastcall create_gain_table(const char *filename)
|
||||
}
|
||||
|
||||
// sort the table according top the sum dB
|
||||
for (unsigned int i = 0; i < gain_table.size() - 1; i++)
|
||||
for (unsigned int i = 0; i < (gain_table.size() - 1); i++)
|
||||
{
|
||||
t_gain_table entry1 = gain_table[i];
|
||||
for (unsigned int k = i + 1; k < gain_table.size(); k++)
|
||||
@ -196,7 +199,7 @@ void __fastcall create_gain_table(const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
// find the QS original index
|
||||
// find the index for the original Quansheng register settings
|
||||
for (int i = (int)gain_table.size() - 1; i >= 0; i--)
|
||||
{
|
||||
const t_gain_table entry = gain_table[i];
|
||||
@ -217,6 +220,25 @@ void __fastcall create_gain_table(const char *filename)
|
||||
// ***************************
|
||||
// save the table to a file
|
||||
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
#if 1
|
||||
// bitfields take up less flash bytes
|
||||
uint8_t lna_short:2; // 0 ~ 3
|
||||
uint8_t lna:3; // 0 ~ 7
|
||||
uint8_t mixer:2; // 0 ~ 3
|
||||
uint8_t pga:3; // 0 ~ 7
|
||||
#else
|
||||
uint8_t lna_short; // 0 ~ 3
|
||||
uint8_t lna; // 0 ~ 7
|
||||
uint8_t mixer; // 0 ~ 3
|
||||
uint8_t pga; // 0 ~ 7
|
||||
#endif
|
||||
} t_am_fix_gain_table;
|
||||
//} __attribute__((packed)) t_am_fix_gain_table;
|
||||
*/
|
||||
|
||||
FILE *file = fopen(filename, "w");
|
||||
if (file == NULL)
|
||||
return;
|
||||
@ -261,10 +283,13 @@ void __fastcall create_gain_table(const char *filename)
|
||||
// "rotate_font()" has nothing to do with this program at all, I just needed
|
||||
// to write a bit of code to rotate some fonts I've drawn
|
||||
|
||||
void __fastcall rotate_font(const char *filename1, const char *filename2)
|
||||
void rotate_font(const char *filename1, const char *filename2)
|
||||
{
|
||||
std::vector <uint8_t> data;
|
||||
|
||||
if (filename1 == NULL || filename2 == NULL)
|
||||
return;
|
||||
|
||||
// ****************************
|
||||
// load the file
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user