mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
6 files changed
+23
-19
No files matched your search
+7
-1
@@ -1728,17 +1728,23 @@ static uint8_t GetScanStepTextWidth()
|
|||||||
return (sprintf(NULL, "%u", GetScanStep() / 100) + 4) * 4; // "%u.%02uk", 4 px advance per char
|
return (sprintf(NULL, "%u", GetScanStep() / 100) + 4) * 4; // "%u.%02uk", 4 px advance per char
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint8_t GetBwTextWidth()
|
||||||
|
{
|
||||||
|
return (strlen(bwOptions[settings.listenBw]) * 4) + 4; // 4 px advance per char
|
||||||
|
}
|
||||||
|
|
||||||
static void DrawRssiTriggerLevel(const uint8_t *topY)
|
static void DrawRssiTriggerLevel(const uint8_t *topY)
|
||||||
{
|
{
|
||||||
if (settings.rssiTriggerLevel == RSSI_MAX_VALUE || monitorMode)
|
if (settings.rssiTriggerLevel == RSSI_MAX_VALUE || monitorMode)
|
||||||
return;
|
return;
|
||||||
uint8_t scanStepTextWidth = GetScanStepTextWidth();
|
uint8_t scanStepTextWidth = GetScanStepTextWidth();
|
||||||
|
uint8_t bwTextWidth = GetBwTextWidth();
|
||||||
uint8_t y = Rssi2Y(settings.rssiTriggerLevel);
|
uint8_t y = Rssi2Y(settings.rssiTriggerLevel);
|
||||||
for (uint8_t x = 0; x < 128; x += 2)
|
for (uint8_t x = 0; x < 128; x += 2)
|
||||||
{
|
{
|
||||||
if (SpectrumColumnAtOrAboveY(topY, x, y))
|
if (SpectrumColumnAtOrAboveY(topY, x, y))
|
||||||
continue;
|
continue;
|
||||||
if (y <= 12 && (x < scanStepTextWidth + 2 || x >= 114))
|
if (y <= 12 && (x < scanStepTextWidth + 2 || x >= 128 - bwTextWidth - 2))
|
||||||
continue;
|
continue;
|
||||||
if (gFrameBuffer[y / 8][x] & (1 << (y % 8)))
|
if (gFrameBuffer[y / 8][x] & (1 << (y % 8)))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+16
-18
@@ -149,15 +149,11 @@ void SETTINGS_InitEEPROM(void)
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
|
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
|
||||||
|
gEeprom.SET_NAV = (Data[4] & 0x40) != 0;
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
|
gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0;
|
||||||
gEeprom.SET_KEY = ((Data[4] >> 2) & 0x0F) > 4 ? 0 : (Data[4] >> 2) & 0x0F;
|
gEeprom.SET_KEY = ((Data[4] >> 2) & 0x0F) > 4 ? 0 : (Data[4] >> 2) & 0x0F;
|
||||||
gEeprom.SET_NAV = (Data[4] & 0x40) != 0;
|
|
||||||
#else
|
|
||||||
// RescueOps fields can be present in a config bank shared with another
|
|
||||||
// preset. Read only KEY_LOCK here and leave the other bits untouched.
|
|
||||||
gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0;
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||||
@@ -753,30 +749,31 @@ void SETTINGS_FactoryReset(bool bIsAll)
|
|||||||
PY25Q16_SectorErase(0x00A000);
|
PY25Q16_SectorErase(0x00A000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent reset to restart in RO mode...
|
// Reset navigation in every edition and lock controls in RescueOps editions.
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
|
||||||
// Bloc 0x0E70..0x0E7F -> offset 0x00A000
|
|
||||||
uint8_t Data8[0x10];
|
uint8_t Data8[0x10];
|
||||||
PY25Q16_ReadBuffer(0x00A000, Data8, sizeof(Data8));
|
PY25Q16_ReadBuffer(0x00A000, Data8, sizeof(Data8));
|
||||||
|
|
||||||
// MENU_LOCK & KEY_LOCK to 0
|
// SET_NAV to false
|
||||||
|
Data8[4] &= (uint8_t)~0x40; // Clear bit 6 (SET_NAV) for UV-K1 by default
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
|
// MENU_LOCK & KEY_LOCK to 0
|
||||||
Data8[4] &= (uint8_t)~0x01;
|
Data8[4] &= (uint8_t)~0x01;
|
||||||
Data8[4] &= (uint8_t)~0x02;
|
Data8[4] &= (uint8_t)~0x02;
|
||||||
|
|
||||||
// SET_KEY to 0
|
// SET_KEY to 0
|
||||||
Data8[4] &= (uint8_t)~0x3C; // Clear bits 2-5 (SET_KEY)
|
Data8[4] &= (uint8_t)~0x3C; // Clear bits 2-5 (SET_KEY)
|
||||||
|
|
||||||
// SET_NAV to false
|
|
||||||
Data8[4] &= (uint8_t)~0x40; // Clear bit 6 (SET_NAV) for UV-K1 by default
|
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN_RESET_VFO
|
#ifdef ENABLE_FEAT_F4HWN_RESET_VFO
|
||||||
Data8[7] = (1 & 0x01);
|
Data8[7] = (1 & 0x01);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
PY25Q16_WriteBuffer(0x00A000, Data8, sizeof(Data8), false);
|
PY25Q16_WriteBuffer(0x00A000, Data8, sizeof(Data8), false);
|
||||||
|
|
||||||
// cohérence RAM
|
// Keep RAM consistent with the persisted defaults.
|
||||||
|
gEeprom.SET_NAV = false;
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS
|
||||||
gEeprom.MENU_LOCK = 0;
|
gEeprom.MENU_LOCK = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -901,11 +898,12 @@ void SETTINGS_SaveSettings(void)
|
|||||||
((gEeprom.SET_KEY & 0x0F) << 2) |
|
((gEeprom.SET_KEY & 0x0F) << 2) |
|
||||||
(gEeprom.SET_NAV ? 0x40 : 0);
|
(gEeprom.SET_NAV ? 0x40 : 0);
|
||||||
#else
|
#else
|
||||||
// A non-RescueOps preset owns KEY_LOCK only. Preserve Set RescueOps,
|
// A non-RescueOps preset owns KEY_LOCK and SET_NAV. Preserve the
|
||||||
// SetKEY, SetNav and reserved bits from a config created by another
|
// RescueOps-only MENU_LOCK and SET_KEY fields plus the reserved bit.
|
||||||
// preset while updating bit 0.
|
|
||||||
PY25Q16_ReadBuffer(0x00A004, &State[4], 1);
|
PY25Q16_ReadBuffer(0x00A004, &State[4], 1);
|
||||||
State[4] = (State[4] & 0xFEu) | (gEeprom.KEY_LOCK ? 0x01u : 0u);
|
State[4] = (State[4] & 0xBEu) |
|
||||||
|
(gEeprom.KEY_LOCK ? 0x01u : 0u) |
|
||||||
|
(gEeprom.SET_NAV ? 0x40u : 0u);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VOX
|
#ifdef ENABLE_VOX
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user