diff --git a/App/app/spectrum.c b/App/app/spectrum.c index 0661dc13..37fa393e 100644 --- a/App/app/spectrum.c +++ b/App/app/spectrum.c @@ -1728,17 +1728,23 @@ static uint8_t GetScanStepTextWidth() 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) { if (settings.rssiTriggerLevel == RSSI_MAX_VALUE || monitorMode) return; uint8_t scanStepTextWidth = GetScanStepTextWidth(); + uint8_t bwTextWidth = GetBwTextWidth(); uint8_t y = Rssi2Y(settings.rssiTriggerLevel); for (uint8_t x = 0; x < 128; x += 2) { if (SpectrumColumnAtOrAboveY(topY, x, y)) continue; - if (y <= 12 && (x < scanStepTextWidth + 2 || x >= 114)) + if (y <= 12 && (x < scanStepTextWidth + 2 || x >= 128 - bwTextWidth - 2)) continue; if (gFrameBuffer[y / 8][x] & (1 << (y % 8))) continue; diff --git a/App/settings.c b/App/settings.c index 56a051f0..4878c802 100644 --- a/App/settings.c +++ b/App/settings.c @@ -149,15 +149,11 @@ void SETTINGS_InitEEPROM(void) #ifdef ENABLE_NOAA gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false; #endif + gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0; + gEeprom.SET_NAV = (Data[4] & 0x40) != 0; #ifdef ENABLE_FEAT_F4HWN_RESCUE_OPS - gEeprom.KEY_LOCK = (Data[4] & 0x01) != 0; gEeprom.MENU_LOCK = (Data[4] & 0x02) != 0; 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 #ifdef ENABLE_VOX gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false; @@ -753,30 +749,31 @@ void SETTINGS_FactoryReset(bool bIsAll) PY25Q16_SectorErase(0x00A000); } - // Prevent reset to restart in RO mode... + // Reset navigation in every edition and lock controls in RescueOps editions. + uint8_t Data8[0x10]; + PY25Q16_ReadBuffer(0x00A000, Data8, sizeof(Data8)); + + // 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 - // Bloc 0x0E70..0x0E7F -> offset 0x00A000 - uint8_t Data8[0x10]; - PY25Q16_ReadBuffer(0x00A000, Data8, sizeof(Data8)); - // MENU_LOCK & KEY_LOCK to 0 - Data8[4] &= (uint8_t)~0x01; Data8[4] &= (uint8_t)~0x02; // SET_KEY to 0 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 Data8[7] = (1 & 0x01); #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; #endif @@ -901,11 +898,12 @@ void SETTINGS_SaveSettings(void) ((gEeprom.SET_KEY & 0x0F) << 2) | (gEeprom.SET_NAV ? 0x40 : 0); #else - // A non-RescueOps preset owns KEY_LOCK only. Preserve Set RescueOps, - // SetKEY, SetNav and reserved bits from a config created by another - // preset while updating bit 0. + // A non-RescueOps preset owns KEY_LOCK and SET_NAV. Preserve the + // RescueOps-only MENU_LOCK and SET_KEY fields plus the reserved bit. 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 #ifdef ENABLE_VOX diff --git a/archive/f4hwn.fieldops.v6.0.0.bin b/archive/f4hwn.fieldops.v6.0.0.bin index ddbcef14..2838cc21 100755 Binary files a/archive/f4hwn.fieldops.v6.0.0.bin and b/archive/f4hwn.fieldops.v6.0.0.bin differ diff --git a/archive/f4hwn.fusion.v6.0.0.bin b/archive/f4hwn.fusion.v6.0.0.bin index ab08c9ad..a49413ca 100755 Binary files a/archive/f4hwn.fusion.v6.0.0.bin and b/archive/f4hwn.fusion.v6.0.0.bin differ diff --git a/archive/f4hwn.labs.v6.0.0.bin b/archive/f4hwn.labs.v6.0.0.bin index a117881d..ba10e26e 100755 Binary files a/archive/f4hwn.labs.v6.0.0.bin and b/archive/f4hwn.labs.v6.0.0.bin differ diff --git a/archive/f4hwn.transfer.v6.0.0.bin b/archive/f4hwn.transfer.v6.0.0.bin index b7b61bdc..d582808b 100755 Binary files a/archive/f4hwn.transfer.v6.0.0.bin and b/archive/f4hwn.transfer.v6.0.0.bin differ