mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Show homologated DCS index in Rx/Tx DCS menus
This commit is contained in:
1 parent
9013f83734
commit
c1f8e945c9
3 files changed
+49
-1
No files matched your search
@@ -48,6 +48,13 @@ const uint16_t DCS_Options[104] = {
|
|||||||
0x01C3, 0x01CA, 0x01D3, 0x01D9, 0x01DA, 0x01DC, 0x01E3, 0x01EC,
|
0x01C3, 0x01CA, 0x01D3, 0x01D9, 0x01DA, 0x01DC, 0x01E3, 0x01EC,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Indices in DCS_Options for the 21 non-PMR446 DCS codes.
|
||||||
|
static const uint8_t DCS_ExtraIdx[21] = {
|
||||||
|
5, 9, 19, 25, 34, 36, 41, 43, 44, 48,
|
||||||
|
50, 54, 56, 60, 71, 72, 73, 74, 75, 82,
|
||||||
|
83
|
||||||
|
};
|
||||||
|
|
||||||
static uint32_t DCS_CalculateGolay(uint32_t CodeWord)
|
static uint32_t DCS_CalculateGolay(uint32_t CodeWord)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -141,3 +148,30 @@ uint8_t DCS_GetCtcssApprovedIndex(uint8_t Option)
|
|||||||
|
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t DCS_GetDcsApprovedIndex(uint8_t Option)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int extra_pos = 0;
|
||||||
|
uint8_t approved_index = 0;
|
||||||
|
|
||||||
|
if (Option >= ARRAY_SIZE(DCS_Options))
|
||||||
|
return 0xFF;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(DCS_Options); i++) {
|
||||||
|
const bool is_extra = extra_pos < ARRAY_SIZE(DCS_ExtraIdx) &&
|
||||||
|
i == DCS_ExtraIdx[extra_pos];
|
||||||
|
|
||||||
|
if (is_extra) {
|
||||||
|
extra_pos++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == Option)
|
||||||
|
return approved_index;
|
||||||
|
|
||||||
|
approved_index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
@@ -41,5 +41,6 @@ uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option);
|
|||||||
uint8_t DCS_GetCdcssCode(uint32_t Code);
|
uint8_t DCS_GetCdcssCode(uint32_t Code);
|
||||||
uint8_t DCS_GetCtcssCode(int Code);
|
uint8_t DCS_GetCtcssCode(int Code);
|
||||||
uint8_t DCS_GetCtcssApprovedIndex(uint8_t Option);
|
uint8_t DCS_GetCtcssApprovedIndex(uint8_t Option);
|
||||||
|
uint8_t DCS_GetDcsApprovedIndex(uint8_t Option);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+14
-1
@@ -1499,9 +1499,22 @@ void UI_DisplayMenu(void)
|
|||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
sprintf(top_right_badge, "00/00");
|
sprintf(top_right_badge, "00/00");
|
||||||
else if (approved_index != 0xFF)
|
else if (approved_index != 0xFF)
|
||||||
sprintf(top_right_badge, "%02u/%02u", (unsigned)gSubMenuSelection, approved_index + 1);
|
sprintf(top_right_badge, "%02u/%02u", (unsigned)gSubMenuSelection, (unsigned)approved_index + 1);
|
||||||
else
|
else
|
||||||
sprintf(top_right_badge, "%02u/--", (unsigned)gSubMenuSelection);
|
sprintf(top_right_badge, "%02u/--", (unsigned)gSubMenuSelection);
|
||||||
|
} else if (UI_MENU_GetCurrentMenuId() == MENU_R_DCS ||
|
||||||
|
UI_MENU_GetCurrentMenuId() == MENU_T_DCS) {
|
||||||
|
const bool is_normal_dcs =
|
||||||
|
gSubMenuSelection > 0 && gSubMenuSelection <= ARRAY_SIZE(DCS_Options);
|
||||||
|
const uint8_t approved_index =
|
||||||
|
is_normal_dcs ? DCS_GetDcsApprovedIndex(gSubMenuSelection - 1) : 0xFF;
|
||||||
|
|
||||||
|
if (gSubMenuSelection == 0)
|
||||||
|
sprintf(top_right_badge, "000/000");
|
||||||
|
else if (approved_index != 0xFF)
|
||||||
|
sprintf(top_right_badge, "%03u/%03u", (unsigned)gSubMenuSelection, (unsigned)approved_index + 1);
|
||||||
|
else
|
||||||
|
sprintf(top_right_badge, "%03u/---", (unsigned)gSubMenuSelection);
|
||||||
} else {
|
} else {
|
||||||
sprintf(top_right_badge, "%03d", gSubMenuSelection);
|
sprintf(top_right_badge, "%03d", gSubMenuSelection);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user