diff --git a/Makefile b/Makefile index fea9d9d..fcf1573 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ ENABLE_BYP_RAW_DEMODULATORS ?= 0 ENABLE_BLMIN_TMP_OFF ?= 0 ENABLE_SCAN_RANGES ?= 1 ENABLE_FEAT_F4HWN ?= 1 +ENABLE_FEAT_F4HWN_FIXED_PWR ?= 0 # ---- DEBUGGING ---- ENABLE_AM_FIX_SHOW_DATA ?= 0 @@ -210,7 +211,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v2.4 + VERSION_STRING_2 ?= v2.5 AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) @@ -399,6 +400,9 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) CFLAGS += -DAUTHOR_STRING_1=\"$(AUTHOR_STRING_1)\" -DVERSION_STRING_1=\"$(VERSION_STRING_1)\" CFLAGS += -DAUTHOR_STRING_2=\"$(AUTHOR_STRING_2)\" -DVERSION_STRING_2=\"$(VERSION_STRING_2)\" endif +ifeq ($(ENABLE_FEAT_F4HWN_FIXED_PWR),1) + CFLAGS += -DENABLE_FEAT_F4HWN_FIXED_PWR +endif LDFLAGS = LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld -Wl,--gc-sections diff --git a/app/action.c b/app/action.c index d3ccb61..c91879b 100644 --- a/app/action.c +++ b/app/action.c @@ -504,7 +504,7 @@ void ACTION_BackLightOnDemand(void) if(gBackLight == false) { gBacklightTimeOriginal = gEeprom.BACKLIGHT_TIME; - gEeprom.BACKLIGHT_TIME = 7; + gEeprom.BACKLIGHT_TIME = 61; gBackLight = true; } else @@ -515,7 +515,7 @@ void ACTION_BackLightOnDemand(void) } else { - gEeprom.BACKLIGHT_TIME = 7; + gEeprom.BACKLIGHT_TIME = 61; } } diff --git a/app/app.c b/app/app.c index f438d83..65d8a56 100644 --- a/app/app.c +++ b/app/app.c @@ -894,7 +894,7 @@ void APP_Update(void) APP_EndTransmission(); - AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); + AUDIO_PlayBeep(BEEP_880HZ_60MS_DOUBLE_BEEP); RADIO_SetVfoState(VFO_STATE_TIMEOUT); @@ -1253,12 +1253,6 @@ void APP_TimeSlice10ms(void) gNextTimeslice = false; gFlashLightBlinkCounter++; -#ifdef ENABLE_BOOT_BEEPS - if (boot_counter_10ms > 0 && (boot_counter_10ms % 25) == 0) { - AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL); - } -#endif - #ifdef ENABLE_AM_FIX if (gRxVfo->Modulation == MODULATION_AM) { AM_fix_10ms(gEeprom.RX_VFO); @@ -1489,7 +1483,7 @@ void APP_TimeSlice500ms(void) // don't turn off backlight if user is in backlight menu option && !(gScreenToDisplay == DISPLAY_MENU && (UI_MENU_GetCurrentMenuId() == MENU_ABR || UI_MENU_GetCurrentMenuId() == MENU_ABR_MAX)) && --gBacklightCountdown_500ms == 0 - && gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1) + && gEeprom.BACKLIGHT_TIME < 61 ) { BACKLIGHT_TurnOff(); } diff --git a/app/menu.c b/app/menu.c index b8d8724..de8eb1e 100644 --- a/app/menu.c +++ b/app/menu.c @@ -129,7 +129,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_ABR: //*pMin = 0; - *pMax = ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1; + *pMax = 61; break; case MENU_ABR_MIN: @@ -269,7 +269,8 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_TOT: //*pMin = 0; - *pMax = ARRAY_SIZE(gSubMenu_TOT) - 1; + *pMin = 5; + *pMax = 179; break; #ifdef ENABLE_VOX diff --git a/app/spectrum.c b/app/spectrum.c index 6979afb..6d28028 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -248,6 +248,10 @@ static void RestoreRegisters() { for (uint32_t i = 0; i < ARRAY_SIZE(registers_to_save); i++){ BK4819_WriteRegister(registers_to_save[i], registers_stack[i]); } + +#ifdef ENABLE_FEAT_F4HWN + gVfoConfigureMode = VFO_CONFIGURE; +#endif } static void ToggleAFDAC(bool on) { diff --git a/archive/f4hwn.fixed.packed.v2.4.bin b/archive/f4hwn.fixed.packed.v2.4.bin new file mode 100644 index 0000000..6fb2086 Binary files /dev/null and b/archive/f4hwn.fixed.packed.v2.4.bin differ diff --git a/archive/f4hwn.unfixed.packed.v2.4.bin b/archive/f4hwn.unfixed.packed.v2.4.bin new file mode 100644 index 0000000..1223352 Binary files /dev/null and b/archive/f4hwn.unfixed.packed.v2.4.bin differ diff --git a/audio.c b/audio.c index 1ac21a8..f14a6a4 100644 --- a/audio.c +++ b/audio.c @@ -37,11 +37,11 @@ BEEP_Type_t gBeepToPlay = BEEP_NONE; void AUDIO_PlayBeep(BEEP_Type_t Beep) { - if (Beep != BEEP_880HZ_60MS_TRIPLE_BEEP && + if (Beep != BEEP_880HZ_60MS_DOUBLE_BEEP && Beep != BEEP_500HZ_60MS_DOUBLE_BEEP && Beep != BEEP_440HZ_500MS && - Beep != BEEP_880HZ_200MS && #ifndef ENABLE_FEAT_F4HWN + Beep != BEEP_880HZ_200MS && Beep != BEEP_880HZ_500MS && #endif #ifdef ENABLE_FEAT_F4HWN @@ -91,14 +91,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) case BEEP_500HZ_60MS_DOUBLE_BEEP: ToneFrequency = 500; break; - case BEEP_440HZ_40MS_OPTIONAL: case BEEP_440HZ_500MS: ToneFrequency = 440; break; - case BEEP_880HZ_40MS_OPTIONAL: - case BEEP_880HZ_60MS_TRIPLE_BEEP: - case BEEP_880HZ_200MS: + case BEEP_880HZ_60MS_DOUBLE_BEEP: #ifndef ENABLE_FEAT_F4HWN + case BEEP_880HZ_200MS: case BEEP_880HZ_500MS: #endif ToneFrequency = 880; @@ -106,19 +104,21 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) #ifdef ENABLE_FEAT_F4HWN case BEEP_400HZ_30MS: ToneFrequency = 400; - BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); break; case BEEP_500HZ_30MS: ToneFrequency = 500; - BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); break; case BEEP_600HZ_30MS: ToneFrequency = 600; - BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); break; #endif } + if(Beep == BEEP_400HZ_30MS || Beep == BEEP_500HZ_30MS || Beep == BEEP_600HZ_30MS) + { + BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((1 & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); + } + BK4819_PlayTone(ToneFrequency, true); SYSTEM_DelayMs(2); @@ -130,7 +130,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) uint16_t Duration; switch (Beep) { - case BEEP_880HZ_60MS_TRIPLE_BEEP: + case BEEP_880HZ_60MS_DOUBLE_BEEP: BK4819_ExitTxMute(); SYSTEM_DelayMs(60); BK4819_EnterTxMute(); @@ -147,15 +147,6 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) BK4819_ExitTxMute(); Duration = 60; break; - case BEEP_880HZ_40MS_OPTIONAL: - case BEEP_440HZ_40MS_OPTIONAL: - BK4819_ExitTxMute(); - Duration = 40; - break; - case BEEP_880HZ_200MS: - BK4819_ExitTxMute(); - Duration = 200; - break; #ifdef ENABLE_FEAT_F4HWN case BEEP_400HZ_30MS: case BEEP_500HZ_30MS: @@ -166,6 +157,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep) #endif case BEEP_440HZ_500MS: #ifndef ENABLE_FEAT_F4HWN + case BEEP_880HZ_200MS: + BK4819_ExitTxMute(); + Duration = 200; + break; case BEEP_880HZ_500MS: #endif default: diff --git a/audio.h b/audio.h index 1e5d001..98161a0 100644 --- a/audio.h +++ b/audio.h @@ -29,19 +29,17 @@ enum BEEP_Type_t BEEP_1KHZ_60MS_OPTIONAL, BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL, BEEP_440HZ_500MS, - BEEP_880HZ_200MS, #ifndef ENABLE_FEAT_F4HWN + BEEP_880HZ_200MS, BEEP_880HZ_500MS, #endif BEEP_500HZ_60MS_DOUBLE_BEEP, - BEEP_440HZ_40MS_OPTIONAL, - BEEP_880HZ_40MS_OPTIONAL, #ifdef ENABLE_FEAT_F4HWN BEEP_400HZ_30MS, BEEP_500HZ_30MS, BEEP_600HZ_30MS, #endif - BEEP_880HZ_60MS_TRIPLE_BEEP + BEEP_880HZ_60MS_DOUBLE_BEEP }; typedef enum BEEP_Type_t BEEP_Type_t; @@ -49,96 +47,6 @@ typedef enum BEEP_Type_t BEEP_Type_t; extern BEEP_Type_t gBeepToPlay; void AUDIO_PlayBeep(BEEP_Type_t Beep); - -enum -{ - VOICE_ID_CHI_BASE = 0x10U, - VOICE_ID_ENG_BASE = 0x60U, -}; - -enum VOICE_ID_t -{ - VOICE_ID_0 = 0x00U, - VOICE_ID_1 = 0x01U, - VOICE_ID_2 = 0x02U, - VOICE_ID_3 = 0x03U, - VOICE_ID_4 = 0x04U, - VOICE_ID_5 = 0x05U, - VOICE_ID_6 = 0x06U, - VOICE_ID_7 = 0x07U, - VOICE_ID_8 = 0x08U, - VOICE_ID_9 = 0x09U, - VOICE_ID_10 = 0x0AU, - VOICE_ID_100 = 0x0BU, - VOICE_ID_WELCOME = 0x0CU, - VOICE_ID_LOCK = 0x0DU, - VOICE_ID_UNLOCK = 0x0EU, - VOICE_ID_SCANNING_BEGIN = 0x0FU, - VOICE_ID_SCANNING_STOP = 0x10U, - VOICE_ID_SCRAMBLER_ON = 0x11U, - VOICE_ID_SCRAMBLER_OFF = 0x12U, - VOICE_ID_FUNCTION = 0x13U, - VOICE_ID_CTCSS = 0x14U, - VOICE_ID_DCS = 0x15U, - VOICE_ID_POWER = 0x16U, - VOICE_ID_SAVE_MODE = 0x17U, - VOICE_ID_MEMORY_CHANNEL = 0x18U, - VOICE_ID_DELETE_CHANNEL = 0x19U, - VOICE_ID_FREQUENCY_STEP = 0x1AU, - VOICE_ID_SQUELCH = 0x1BU, - VOICE_ID_TRANSMIT_OVER_TIME = 0x1CU, - VOICE_ID_BACKLIGHT_SELECTION = 0x1DU, - VOICE_ID_VOX = 0x1EU, - VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION = 0x1FU, - VOICE_ID_TX_OFFSET_FREQUENCY = 0x20U, - VOICE_ID_TRANSMITING_MEMORY = 0x21U, - VOICE_ID_RECEIVING_MEMORY = 0x22U, - VOICE_ID_EMERGENCY_CALL = 0x23U, - VOICE_ID_LOW_VOLTAGE = 0x24U, - VOICE_ID_CHANNEL_MODE = 0x25U, - VOICE_ID_FREQUENCY_MODE = 0x26U, - VOICE_ID_VOICE_PROMPT = 0x27U, - VOICE_ID_BAND_SELECTION = 0x28U, - VOICE_ID_DUAL_STANDBY = 0x29U, - VOICE_ID_CHANNEL_BANDWIDTH = 0x2AU, - VOICE_ID_OPTIONAL_SIGNAL = 0x2BU, - VOICE_ID_MUTE_MODE = 0x2CU, - VOICE_ID_BUSY_LOCKOUT = 0x2DU, - VOICE_ID_BEEP_PROMPT = 0x2EU, - VOICE_ID_ANI_CODE = 0x2FU, - VOICE_ID_INITIALISATION = 0x30U, - VOICE_ID_CONFIRM = 0x31U, - VOICE_ID_CANCEL = 0x32U, - VOICE_ID_ON = 0x33U, - VOICE_ID_OFF = 0x34U, - VOICE_ID_2_TONE = 0x35U, - VOICE_ID_5_TONE = 0x36U, - VOICE_ID_DIGITAL_SIGNAL = 0x37U, - VOICE_ID_REPEATER = 0x38U, - VOICE_ID_MENU = 0x39U, - VOICE_ID_11 = 0x3AU, - VOICE_ID_12 = 0x3BU, - VOICE_ID_13 = 0x3CU, - VOICE_ID_14 = 0x3DU, - VOICE_ID_15 = 0x3EU, - VOICE_ID_16 = 0x3FU, - VOICE_ID_17 = 0x40U, - VOICE_ID_18 = 0x41U, - VOICE_ID_19 = 0x42U, - VOICE_ID_20 = 0x43U, - VOICE_ID_30 = 0x44U, - VOICE_ID_40 = 0x45U, - VOICE_ID_50 = 0x46U, - VOICE_ID_60 = 0x47U, - VOICE_ID_70 = 0x48U, - VOICE_ID_80 = 0x49U, - VOICE_ID_90 = 0x4AU, - VOICE_ID_END = 0x4BU, - - VOICE_ID_INVALID = 0xFFU, -}; - -typedef enum VOICE_ID_t VOICE_ID_t; static inline void AUDIO_AudioPathOn(void) { GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH); @@ -149,6 +57,96 @@ static inline void AUDIO_AudioPathOff(void) { } #ifdef ENABLE_VOICE + typedef enum VOICE_ID_t VOICE_ID_t; + + enum + { + VOICE_ID_CHI_BASE = 0x10U, + VOICE_ID_ENG_BASE = 0x60U, + }; + + enum VOICE_ID_t + { + VOICE_ID_0 = 0x00U, + VOICE_ID_1 = 0x01U, + VOICE_ID_2 = 0x02U, + VOICE_ID_3 = 0x03U, + VOICE_ID_4 = 0x04U, + VOICE_ID_5 = 0x05U, + VOICE_ID_6 = 0x06U, + VOICE_ID_7 = 0x07U, + VOICE_ID_8 = 0x08U, + VOICE_ID_9 = 0x09U, + VOICE_ID_10 = 0x0AU, + VOICE_ID_100 = 0x0BU, + VOICE_ID_WELCOME = 0x0CU, + VOICE_ID_LOCK = 0x0DU, + VOICE_ID_UNLOCK = 0x0EU, + VOICE_ID_SCANNING_BEGIN = 0x0FU, + VOICE_ID_SCANNING_STOP = 0x10U, + VOICE_ID_SCRAMBLER_ON = 0x11U, + VOICE_ID_SCRAMBLER_OFF = 0x12U, + VOICE_ID_FUNCTION = 0x13U, + VOICE_ID_CTCSS = 0x14U, + VOICE_ID_DCS = 0x15U, + VOICE_ID_POWER = 0x16U, + VOICE_ID_SAVE_MODE = 0x17U, + VOICE_ID_MEMORY_CHANNEL = 0x18U, + VOICE_ID_DELETE_CHANNEL = 0x19U, + VOICE_ID_FREQUENCY_STEP = 0x1AU, + VOICE_ID_SQUELCH = 0x1BU, + VOICE_ID_TRANSMIT_OVER_TIME = 0x1CU, + VOICE_ID_BACKLIGHT_SELECTION = 0x1DU, + VOICE_ID_VOX = 0x1EU, + VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION = 0x1FU, + VOICE_ID_TX_OFFSET_FREQUENCY = 0x20U, + VOICE_ID_TRANSMITING_MEMORY = 0x21U, + VOICE_ID_RECEIVING_MEMORY = 0x22U, + VOICE_ID_EMERGENCY_CALL = 0x23U, + VOICE_ID_LOW_VOLTAGE = 0x24U, + VOICE_ID_CHANNEL_MODE = 0x25U, + VOICE_ID_FREQUENCY_MODE = 0x26U, + VOICE_ID_VOICE_PROMPT = 0x27U, + VOICE_ID_BAND_SELECTION = 0x28U, + VOICE_ID_DUAL_STANDBY = 0x29U, + VOICE_ID_CHANNEL_BANDWIDTH = 0x2AU, + VOICE_ID_OPTIONAL_SIGNAL = 0x2BU, + VOICE_ID_MUTE_MODE = 0x2CU, + VOICE_ID_BUSY_LOCKOUT = 0x2DU, + VOICE_ID_BEEP_PROMPT = 0x2EU, + VOICE_ID_ANI_CODE = 0x2FU, + VOICE_ID_INITIALISATION = 0x30U, + VOICE_ID_CONFIRM = 0x31U, + VOICE_ID_CANCEL = 0x32U, + VOICE_ID_ON = 0x33U, + VOICE_ID_OFF = 0x34U, + VOICE_ID_2_TONE = 0x35U, + VOICE_ID_5_TONE = 0x36U, + VOICE_ID_DIGITAL_SIGNAL = 0x37U, + VOICE_ID_REPEATER = 0x38U, + VOICE_ID_MENU = 0x39U, + VOICE_ID_11 = 0x3AU, + VOICE_ID_12 = 0x3BU, + VOICE_ID_13 = 0x3CU, + VOICE_ID_14 = 0x3DU, + VOICE_ID_15 = 0x3EU, + VOICE_ID_16 = 0x3FU, + VOICE_ID_17 = 0x40U, + VOICE_ID_18 = 0x41U, + VOICE_ID_19 = 0x42U, + VOICE_ID_20 = 0x43U, + VOICE_ID_30 = 0x44U, + VOICE_ID_40 = 0x45U, + VOICE_ID_50 = 0x46U, + VOICE_ID_60 = 0x47U, + VOICE_ID_70 = 0x48U, + VOICE_ID_80 = 0x49U, + VOICE_ID_90 = 0x4AU, + VOICE_ID_END = 0x4BU, + + VOICE_ID_INVALID = 0xFFU, + }; + extern VOICE_ID_t gVoiceID[8]; extern uint8_t gVoiceReadIndex; extern uint8_t gVoiceWriteIndex; diff --git a/compile-with-docker.bat b/compile-with-docker.bat index e1c888b..8c3cf90 100644 --- a/compile-with-docker.bat +++ b/compile-with-docker.bat @@ -1,4 +1,4 @@ @echo off docker build -t uvk5 . -docker run --rm -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp firmware* compiled-firmware/" +docker run --rm -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp f4hwn* compiled-firmware/" pause \ No newline at end of file diff --git a/driver/backlight.c b/driver/backlight.c index 7186d4c..c072ef5 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -62,8 +62,8 @@ static void BACKLIGHT_Sound(void) { if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) { - AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); - AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); + AUDIO_PlayBeep(BEEP_880HZ_60MS_DOUBLE_BEEP); + AUDIO_PlayBeep(BEEP_880HZ_60MS_DOUBLE_BEEP); gK5startup = false; } else @@ -110,17 +110,10 @@ void BACKLIGHT_TurnOn(void) switch (gEeprom.BACKLIGHT_TIME) { default: - case 1: // 5 sec - case 2: // 10 sec - case 3: // 20 sec - gBacklightCountdown_500ms = 1 + (2 << (gEeprom.BACKLIGHT_TIME - 1)) * 5; + case 1 ... 60: // 5 sec * value + gBacklightCountdown_500ms = 1 + (gEeprom.BACKLIGHT_TIME * 5) * 2; break; - case 4: // 1 min - case 5: // 2 min - case 6: // 4 min - gBacklightCountdown_500ms = 1 + (2 << (gEeprom.BACKLIGHT_TIME - 4)) * 60; - break; - case 7: // always on + case 61: // always on gBacklightCountdown_500ms = 0; break; } diff --git a/driver/st7565.c b/driver/st7565.c index d3680fb..af17e24 100644 --- a/driver/st7565.c +++ b/driver/st7565.c @@ -46,31 +46,79 @@ void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const u SPI_ToggleMasterMode(&SPI0->CR, true); } -void ST7565_BlitFullScreen(void) -{ - SPI_ToggleMasterMode(&SPI0->CR, false); - ST7565_WriteByte(0x40); - for (unsigned line = 0; line < FRAME_LINES; line++) { - DrawLine(0, line+1, gFrameBuffer[line], LCD_WIDTH); + +#ifdef ENABLE_FEAT_F4HWN + // Optimization + // + // ST7565_BlitScreen(0) = ST7565_BlitStatusLine() + // ST7565_BlitScreen(1..7) = ST7565_BlitLine() + // ST7565_BlitScreen(8) = ST7565_BlitFullScreen() + // + + static void ST7565_BlitScreen(uint8_t line) + { + SPI_ToggleMasterMode(&SPI0->CR, false); + ST7565_WriteByte(0x40); + + if(line == 0) + { + DrawLine(0, 0, gStatusLine, LCD_WIDTH); + } + else if(line <= FRAME_LINES) + { + DrawLine(0, line, gFrameBuffer[line - 1], LCD_WIDTH); + } + else + { + for (line = 1; line <= FRAME_LINES; line++) { + DrawLine(0, line, gFrameBuffer[line - 1], LCD_WIDTH); + } + } + + SPI_ToggleMasterMode(&SPI0->CR, true); } - SPI_ToggleMasterMode(&SPI0->CR, true); -} -void ST7565_BlitLine(unsigned line) -{ - SPI_ToggleMasterMode(&SPI0->CR, false); - ST7565_WriteByte(0x40); // start line ? - DrawLine(0, line+1, gFrameBuffer[line], LCD_WIDTH); - SPI_ToggleMasterMode(&SPI0->CR, true); -} + void ST7565_BlitFullScreen(void) + { + ST7565_BlitScreen(8); + } -void ST7565_BlitStatusLine(void) -{ // the top small text line on the display - SPI_ToggleMasterMode(&SPI0->CR, false); - ST7565_WriteByte(0x40); // start line ? - DrawLine(0, 0, gStatusLine, LCD_WIDTH); - SPI_ToggleMasterMode(&SPI0->CR, true); -} + void ST7565_BlitLine(unsigned line) + { + ST7565_BlitScreen(line + 1); + } + + void ST7565_BlitStatusLine(void) + { + ST7565_BlitScreen(0); + } +#else + void ST7565_BlitFullScreen(void) + { + SPI_ToggleMasterMode(&SPI0->CR, false); + ST7565_WriteByte(0x40); + for (unsigned line = 0; line < FRAME_LINES; line++) { + DrawLine(0, line+1, gFrameBuffer[line], LCD_WIDTH); + } + SPI_ToggleMasterMode(&SPI0->CR, true); + } + + void ST7565_BlitLine(unsigned line) + { + SPI_ToggleMasterMode(&SPI0->CR, false); + ST7565_WriteByte(0x40); // start line ? + DrawLine(0, line+1, gFrameBuffer[line], LCD_WIDTH); + SPI_ToggleMasterMode(&SPI0->CR, true); + } + + void ST7565_BlitStatusLine(void) + { // the top small text line on the display + SPI_ToggleMasterMode(&SPI0->CR, false); + ST7565_WriteByte(0x40); // start line ? + DrawLine(0, 0, gStatusLine, LCD_WIDTH); + SPI_ToggleMasterMode(&SPI0->CR, true); + } +#endif void ST7565_FillScreen(uint8_t value) { diff --git a/font.c b/font.c index 74fcfc9..8d1192b 100644 --- a/font.c +++ b/font.c @@ -133,7 +133,7 @@ const uint8_t gFontBig[95 - 1][16 - 2] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '-' {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // '.' {0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00}, // '/' - {0xF8, 0xFC, 0x84, 0xC4, 0x64, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x09, 0x08, 0x08, 0x0F, 0x07}, // '0' + {0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '0' {0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08}, // '1' {0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // '2' {0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '3' @@ -254,7 +254,7 @@ const uint8_t gFontBig[95 - 1][16 - 2] = const uint8_t gFontBigDigits[11][26 - 6] = { - {/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x86, 0xC6, 0xE6, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x67, 0x63, 0x61, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/}, + {/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/}, {/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x00, /*0x00*/}, {/*0x00, 0x00,*/ 0x1C, 0x1E, 0x1E, 0x06, 0x06, 0x06, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x60, 0x70, 0x78, 0x7C, 0x6E, 0x67, 0x63, 0x61, 0x60, 0x60, /*0x00*/}, {/*0x00, 0x00,*/ 0x0C, 0x0E, 0x0E, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3E, /*0x00*/}, diff --git a/frequencies.c b/frequencies.c index df3a193..c435dbe 100644 --- a/frequencies.c +++ b/frequencies.c @@ -222,6 +222,13 @@ int32_t TX_freq_check(const uint32_t Frequency) return 0; break; +#ifdef ENABLE_FEAT_F4HWN + case F_LOCK_PMR: + if (Frequency >= 44600625 && Frequency <= 44619375) + return 0; + break; +#endif + case F_LOCK_ALL: break; diff --git a/helper/battery.c b/helper/battery.c index 6267c16..c5ee465 100644 --- a/helper/battery.c +++ b/helper/battery.c @@ -219,7 +219,7 @@ void BATTERY_TimeSlice500ms(void) ST7565_HardwareReset(); - if (gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) { + if (gEeprom.BACKLIGHT_TIME < 61) { BACKLIGHT_TurnOff(); } } diff --git a/main.c b/main.c index bbbf5e8..68de643 100644 --- a/main.c +++ b/main.c @@ -151,7 +151,7 @@ void Main(void) { FUNCTION_Select(FUNCTION_POWER_SAVE); - if (gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) // backlight is not set to be always on + if (gEeprom.BACKLIGHT_TIME < 61) // backlight is not set to be always on BACKLIGHT_TurnOff(); // turn the backlight OFF else BACKLIGHT_TurnOn(); // turn the backlight ON @@ -177,11 +177,8 @@ void Main(void) boot_counter_10ms = 0; break; } -#ifdef ENABLE_BOOT_BEEPS - if ((boot_counter_10ms % 25) == 0) - AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL); -#endif } + RADIO_SetupRegisters(true); } #ifdef ENABLE_PWRON_PASSWORD diff --git a/radio.c b/radio.c index 1d0db46..c4c0c9f 100644 --- a/radio.c +++ b/radio.c @@ -473,105 +473,111 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3); #ifdef ENABLE_FEAT_F4HWN - // make low and mid even lower - // and fix values - // because of toxic fucking closed firmwares + #ifdef ENABLE_FEAT_F4HWN_FIXED_PWR + // make low and mid even lower + // and fix values + // because of toxic fucking closed firmwares - uint8_t shift[] = {0, 0, 0, 0, 0, 0, 0}; + uint8_t shift[] = {0, 0, 0, 0, 0, 0, 0}; - if(Band == 5) - { - shift[0] = 2; - shift[1] = 1; - shift[2] = 2; - shift[3] = 2; - shift[4] = 2; - shift[5] = 2; - shift[6] = 2; - } - - if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { - for(uint8_t p = 0; p < 3; p++ ) + if(Band == 5) { - switch (gSetting_set_low) { - case 0: - Txp[p] = 16 - shift[gSetting_set_low]; - break; - case 1: - Txp[p] = 21 + shift[gSetting_set_low]; - break; - case 2: - Txp[p] = 29 + shift[gSetting_set_low]; - break; - case 3: - Txp[p] = 37 + shift[gSetting_set_low]; - break; - case 4: - Txp[p] = 50 + shift[gSetting_set_low]; - break; - } - + shift[0] = 2; + shift[1] = 1; + shift[2] = 2; + shift[3] = 2; + shift[4] = 2; + shift[5] = 2; + shift[6] = 2; } - } - else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_MID){ - Txp[0] = 77 + shift[5]; - Txp[1] = 77 + shift[5]; - Txp[2] = 77 + shift[5]; - } - // increase high - else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_HIGH){ - Txp[0] = 165 + shift[6]; - Txp[1] = 165 + shift[6]; - Txp[2] = 165 + shift[6]; - } - // uint8_t shift[] = {0, 0, 0, 0, 0}; + if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { + for(uint8_t p = 0; p < 3; p++ ) + { + switch (gSetting_set_low) { + case 0: + Txp[p] = 16 - shift[gSetting_set_low]; + break; + case 1: + Txp[p] = 21 + shift[gSetting_set_low]; + break; + case 2: + Txp[p] = 29 + shift[gSetting_set_low]; + break; + case 3: + Txp[p] = 37 + shift[gSetting_set_low]; + break; + case 4: + Txp[p] = 50 + shift[gSetting_set_low]; + break; + } - // /* - // if(Band == 5) - // { - // shift[0] = 3; - // shift[1] = 3; - // shift[2] = 4; - // shift[3] = 7; - // shift[4] = 8; - // } - // */ - - // if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { - // for(uint8_t p = 0; p < 3; p++ ) - // { - // switch (gSetting_set_low) { - // case 0: - // Txp[p] = (Txp[p] * 4) / 25 + shift[gSetting_set_low]; - // break; - // case 1: - // Txp[p] = (Txp[p] * 4) / 19 + shift[gSetting_set_low]; - // break; - // case 2: - // Txp[p] = (Txp[p] * 4) / 13 + shift[gSetting_set_low]; - // break; - // case 3: - // Txp[p] = (Txp[p] * 4) / 10 + shift[gSetting_set_low]; - // break; - // case 4: - // Txp[p] = (Txp[p] * 4) / 7 + shift[gSetting_set_low]; - // break; - // } + } + } + else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_MID){ + Txp[0] = 77 + shift[5]; + Txp[1] = 77 + shift[5]; + Txp[2] = 77 + shift[5]; + } + // increase high + else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_HIGH){ + Txp[0] = 165 + shift[6]; + Txp[1] = 165 + shift[6]; + Txp[2] = 165 + shift[6]; + } + #else + // make low and mid even lower + // and use calibration values + // be aware with toxic fucking closed firmwares - // } - // } - // else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_MID){ - // Txp[0] = (Txp[0] * 3) / 4; - // Txp[1] = (Txp[1] * 3) / 4; - // Txp[2] = (Txp[2] * 3) / 4; - // } - // // increase high - // else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_HIGH){ - // Txp[0] = Txp[0] + 30; - // Txp[1] = Txp[1] + 30; - // Txp[2] = Txp[2] + 30; - // } + uint8_t shift[] = {0, 0, 0, 0, 0}; + + /* + if(Band == 5) // UHF + { + shift[0] = 0; + shift[1] = 0; + shift[2] = 0; + shift[3] = 0; + shift[4] = 0; + } + */ + + if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { + for(uint8_t p = 0; p < 3; p++ ) + { + switch (gSetting_set_low) { + case 0: + Txp[p] = (Txp[p] * 4) / 25 + shift[gSetting_set_low]; + break; + case 1: + Txp[p] = (Txp[p] * 4) / 19 + shift[gSetting_set_low]; + break; + case 2: + Txp[p] = (Txp[p] * 4) / 13 + shift[gSetting_set_low]; + break; + case 3: + Txp[p] = (Txp[p] * 4) / 10 + shift[gSetting_set_low]; + break; + case 4: + Txp[p] = (Txp[p] * 4) / 7 + shift[gSetting_set_low]; + break; + } + + } + } + else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_MID){ + Txp[0] = (Txp[0] * 3) / 4; + Txp[1] = (Txp[1] * 3) / 4; + Txp[2] = (Txp[2] * 3) / 4; + } + // increase high + else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_HIGH){ + Txp[0] = Txp[0] + 30; + Txp[1] = Txp[1] + 30; + Txp[2] = Txp[2] + 30; + } + #endif #else #ifdef ENABLE_REDUCE_LOW_MID_TX_POWER // make low and mid even lower @@ -1107,12 +1113,17 @@ void RADIO_PrepareTX(void) if (gAlarmState == ALARM_STATE_OFF) #endif { + + gTxTimerCountdown_500ms = ((gEeprom.TX_TIMEOUT_TIMER + 1) * 5) * 2; + + /* if (gEeprom.TX_TIMEOUT_TIMER == 0) gTxTimerCountdown_500ms = 60; // 30 sec else if (gEeprom.TX_TIMEOUT_TIMER < (ARRAY_SIZE(gSubMenu_TOT) - 1)) gTxTimerCountdown_500ms = 120 * gEeprom.TX_TIMEOUT_TIMER; // minutes else gTxTimerCountdown_500ms = 120 * 15; // 15 minutes + */ #ifdef ENABLE_FEAT_F4HWN gTxTimerCountdownAlert_500ms = gTxTimerCountdown_500ms; diff --git a/settings.c b/settings.c index 06dbdfe..5524f8e 100644 --- a/settings.c +++ b/settings.c @@ -45,7 +45,7 @@ void SETTINGS_InitEEPROM(void) EEPROM_ReadBuffer(0x0E70, Data, 8); gEeprom.CHAN_1_CALL = IS_MR_CHANNEL(Data[0]) ? Data[0] : MR_CHANNEL_FIRST; gEeprom.SQUELCH_LEVEL = (Data[1] < 10) ? Data[1] : 1; - gEeprom.TX_TIMEOUT_TIMER = (Data[2] < 11) ? Data[2] : 1; + gEeprom.TX_TIMEOUT_TIMER = (Data[2] > 4 && Data[2] < 180) ? Data[2] : 11; #ifdef ENABLE_NOAA gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false; #endif @@ -67,7 +67,7 @@ void SETTINGS_InitEEPROM(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_TIME = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3; + gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12; gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false; gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true; diff --git a/settings.h b/settings.h index 374c3c5..e91cb1d 100644 --- a/settings.h +++ b/settings.h @@ -45,6 +45,9 @@ enum TxLockModes_t { F_LOCK_GB, F_LOCK_430, F_LOCK_438, +#ifdef ENABLE_FEAT_F4HWN + F_LOCK_PMR, +#endif F_LOCK_ALL, // disable TX on all frequencies F_LOCK_NONE, // enable TX on all frequencies F_LOCK_LEN diff --git a/ui/menu.c b/ui/menu.c index 6f7fbfe..191af19 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -39,125 +39,125 @@ const t_menu_item MenuList[] = { -// text, voice ID, menu ID - {"Step", VOICE_ID_FREQUENCY_STEP, MENU_STEP }, - {"TxPwr", VOICE_ID_POWER, MENU_TXP }, // was "TXP" - {"RxDCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS" - {"RxCTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS" - {"TxDCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS" - {"TxCTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS" - {"TxODir", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D" - {"TxOffs", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET" - {"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N }, +// text, menu ID + {"Step", MENU_STEP }, + {"TxPwr", MENU_TXP }, // was "TXP" + {"RxDCS", MENU_R_DCS }, // was "R_DCS" + {"RxCTCS", MENU_R_CTCS }, // was "R_CTCS" + {"TxDCS", MENU_T_DCS }, // was "T_DCS" + {"TxCTCS", MENU_T_CTCS }, // was "T_CTCS" + {"TxODir", MENU_SFT_D }, // was "SFT_D" + {"TxOffs", MENU_OFFSET }, // was "OFFSET" + {"W/N", MENU_W_N }, #ifndef ENABLE_FEAT_F4HWN - {"Scramb", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR" + {"Scramb", MENU_SCR }, // was "SCR" #endif - {"BusyCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL" - {"Compnd", VOICE_ID_INVALID, MENU_COMPAND }, - {"Demodu", VOICE_ID_INVALID, MENU_AM }, // was "AM" - {"ScAdd1", VOICE_ID_INVALID, MENU_S_ADD1 }, - {"ScAdd2", VOICE_ID_INVALID, MENU_S_ADD2 }, - {"ChSave", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH" - {"ChDele", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH" - {"ChName", VOICE_ID_INVALID, MENU_MEM_NAME }, + {"BusyCL", MENU_BCL }, // was "BCL" + {"Compnd", MENU_COMPAND }, + {"Demodu", MENU_AM }, // was "AM" + {"ScAdd1", MENU_S_ADD1 }, + {"ScAdd2", MENU_S_ADD2 }, + {"ChSave", MENU_MEM_CH }, // was "MEM-CH" + {"ChDele", MENU_DEL_CH }, // was "DEL-CH" + {"ChName", MENU_MEM_NAME }, - {"SList", VOICE_ID_INVALID, MENU_S_LIST }, - {"SList1", VOICE_ID_INVALID, MENU_SLIST1 }, - {"SList2", VOICE_ID_INVALID, MENU_SLIST2 }, - {"ScnRev", VOICE_ID_INVALID, MENU_SC_REV }, + {"SList", MENU_S_LIST }, + {"SList1", MENU_SLIST1 }, + {"SList2", MENU_SLIST2 }, + {"ScnRev", MENU_SC_REV }, #ifdef ENABLE_NOAA - {"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S }, + {"NOAA-S", MENU_NOAA_S }, #endif - {"F1Shrt", VOICE_ID_INVALID, MENU_F1SHRT }, - {"F1Long", VOICE_ID_INVALID, MENU_F1LONG }, - {"F2Shrt", VOICE_ID_INVALID, MENU_F2SHRT }, - {"F2Long", VOICE_ID_INVALID, MENU_F2LONG }, - {"M Long", VOICE_ID_INVALID, MENU_MLONG }, + {"F1Shrt", MENU_F1SHRT }, + {"F1Long", MENU_F1LONG }, + {"F2Shrt", MENU_F2SHRT }, + {"F2Long", MENU_F2LONG }, + {"M Long", MENU_MLONG }, - {"KeyLck", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk" - {"TxTOut", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT" - {"BatSav", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE" - {"Mic", VOICE_ID_INVALID, MENU_MIC }, + {"KeyLck", MENU_AUTOLK }, // was "AUTOLk" + {"TxTOut", MENU_TOT }, // was "TOT" + {"BatSav", MENU_SAVE }, // was "SAVE" + {"Mic", MENU_MIC }, #ifdef ENABLE_AUDIO_BAR - {"MicBar", VOICE_ID_INVALID, MENU_MIC_BAR }, + {"MicBar", MENU_MIC_BAR }, #endif - {"ChDisp", VOICE_ID_INVALID, MENU_MDF }, // was "MDF" - {"POnMsg", VOICE_ID_INVALID, MENU_PONMSG }, - {"BatTxt", VOICE_ID_INVALID, MENU_BAT_TXT }, - {"BackLt", VOICE_ID_INVALID, MENU_ABR }, // was "ABR" - {"BLMin", VOICE_ID_INVALID, MENU_ABR_MIN }, - {"BLMax", VOICE_ID_INVALID, MENU_ABR_MAX }, - {"BltTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX }, - {"Beep", VOICE_ID_BEEP_PROMPT, MENU_BEEP }, + {"ChDisp", MENU_MDF }, // was "MDF" + {"POnMsg", MENU_PONMSG }, + {"BatTxt", MENU_BAT_TXT }, + {"BackLt", MENU_ABR }, // was "ABR" + {"BLMin", MENU_ABR_MIN }, + {"BLMax", MENU_ABR_MAX }, + {"BltTRX", MENU_ABR_ON_TX_RX }, + {"Beep", MENU_BEEP }, #ifdef ENABLE_VOICE - {"Voice", VOICE_ID_VOICE_PROMPT, MENU_VOICE }, + {"Voice", MENU_VOICE }, #endif - {"Roger", VOICE_ID_INVALID, MENU_ROGER }, - {"STE", VOICE_ID_INVALID, MENU_STE }, - {"RP STE", VOICE_ID_INVALID, MENU_RP_STE }, - {"1 Call", VOICE_ID_INVALID, MENU_1_CALL }, + {"Roger", MENU_ROGER }, + {"STE", MENU_STE }, + {"RP STE", MENU_RP_STE }, + {"1 Call", MENU_1_CALL }, #ifdef ENABLE_ALARM - {"AlarmT", VOICE_ID_INVALID, MENU_AL_MOD }, + {"AlarmT", MENU_AL_MOD }, #endif #ifdef ENABLE_DTMF_CALLING - {"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID }, + {"ANI ID", MENU_ANI_ID }, #endif - {"UPCode", VOICE_ID_INVALID, MENU_UPCODE }, - {"DWCode", VOICE_ID_INVALID, MENU_DWCODE }, - {"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID }, - {"D ST", VOICE_ID_INVALID, MENU_D_ST }, + {"UPCode", MENU_UPCODE }, + {"DWCode", MENU_DWCODE }, + {"PTT ID", MENU_PTT_ID }, + {"D ST", MENU_D_ST }, #ifdef ENABLE_DTMF_CALLING - {"D Resp", VOICE_ID_INVALID, MENU_D_RSP }, - {"D Hold", VOICE_ID_INVALID, MENU_D_HOLD }, + {"D Resp", MENU_D_RSP }, + {"D Hold", MENU_D_HOLD }, #endif - {"D Prel", VOICE_ID_INVALID, MENU_D_PRE }, + {"D Prel", MENU_D_PRE }, #ifdef ENABLE_DTMF_CALLING - {"D Decd", VOICE_ID_INVALID, MENU_D_DCD }, - {"D List", VOICE_ID_INVALID, MENU_D_LIST }, + {"D Decd", MENU_D_DCD }, + {"D List", MENU_D_LIST }, #endif - {"D Live", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder + {"D Live", MENU_D_LIVE_DEC }, // live DTMF decoder #ifdef ENABLE_AM_FIX - {"AM Fix", VOICE_ID_INVALID, MENU_AM_FIX }, + {"AM Fix", MENU_AM_FIX }, #endif #ifdef ENABLE_VOX - {"VOX", VOICE_ID_VOX, MENU_VOX }, + {"VOX", MENU_VOX }, #endif #ifdef ENABLE_FEAT_F4HWN - {"SysInf", VOICE_ID_INVALID, MENU_VOL }, // was "VOL" + {"SysInf", MENU_VOL }, // was "VOL" #else - {"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL" + {"BatVol", MENU_VOL }, // was "VOL" #endif - {"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR }, - {"Sql", VOICE_ID_SQUELCH, MENU_SQL }, + {"RxMode", MENU_TDR }, + {"Sql", MENU_SQL }, #ifdef ENABLE_FEAT_F4HWN - {"SetLow", VOICE_ID_INVALID, MENU_SET_LOW }, - {"SetPtt", VOICE_ID_INVALID, MENU_SET_PTT }, - {"SetTot", VOICE_ID_INVALID, MENU_SET_TOT }, - {"SetEot", VOICE_ID_INVALID, MENU_SET_EOT }, - {"SetCtr", VOICE_ID_INVALID, MENU_SET_CTR }, - {"SetInv", VOICE_ID_INVALID, MENU_SET_INV }, - {"SetLck", VOICE_ID_INVALID, MENU_SET_LCK }, - {"SetMet", VOICE_ID_INVALID, MENU_SET_MET }, - {"SetGui", VOICE_ID_INVALID, MENU_SET_GUI }, + {"SetLow", MENU_SET_LOW }, + {"SetPtt", MENU_SET_PTT }, + {"SetTot", MENU_SET_TOT }, + {"SetEot", MENU_SET_EOT }, + {"SetCtr", MENU_SET_CTR }, + {"SetInv", MENU_SET_INV }, + {"SetLck", MENU_SET_LCK }, + {"SetMet", MENU_SET_MET }, + {"SetGui", MENU_SET_GUI }, #endif // hidden menu items from here on // enabled if pressing both the PTT and upper side button at power-on - {"F Lock", VOICE_ID_INVALID, MENU_F_LOCK }, - {"Tx 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX" - {"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX" - {"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX" - {"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN" + {"F Lock", MENU_F_LOCK }, + {"Tx 200", MENU_200TX }, // was "200TX" + {"Tx 350", MENU_350TX }, // was "350TX" + {"Tx 500", MENU_500TX }, // was "500TX" + {"350 En", MENU_350EN }, // was "350EN" #ifndef ENABLE_FEAT_F4HWN - {"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN" + {"ScraEn", MENU_SCREN }, // was "SCREN" #endif #ifdef ENABLE_F_CAL_MENU - {"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration + {"FrCali", MENU_F_CALI }, // reference xtal calibration #endif - {"BatCal", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration - {"BatTyp", VOICE_ID_INVALID, MENU_BATTYP }, // battery type 1600/2200mAh - {"Reset", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ? + {"BatCal", MENU_BATCAL }, // battery voltage calibration + {"BatTyp", MENU_BATTYP }, // battery type 1600/2200mAh + {"Reset", MENU_RESET }, // might be better to move this to the hidden menu items ? - {"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this + {"", 0xff } // end of list - DO NOT delete or move this this }; const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK; @@ -197,21 +197,6 @@ const char gSubMenu_SAVE[][4] = "1:4" }; -const char gSubMenu_TOT[][7] = -{ - "30 sec", - "1 min", - "2 min", - "3 min", - "4 min", - "5 min", - "6 min", - "7 min", - "8 min", - "9 min", - "15 min" -}; - const char* const gSubMenu_RXMode[] = { "MAIN\nONLY", // TX and RX on main only @@ -305,22 +290,13 @@ const char * const gSubMenu_F_LOCK[] = "GB HAM\n144-148\n430-440", "137-174\n400-430", "137-174\n400-438", +#ifdef ENABLE_FEAT_F4HWN + "PMR 446", +#endif "DISABLE\nALL", "UNLOCK\nALL", }; -const char gSubMenu_BACKLIGHT[][7] = -{ - "OFF", - "5 sec", - "10 sec", - "20 sec", - "1 min", - "2 min", - "4 min", - "ON" -}; - const char gSubMenu_RX_TX[][6] = { "OFF", @@ -542,10 +518,11 @@ void UI_DisplayMenu(void) // draw the menu index number/count #ifdef ENABLE_FEAT_F4HWN sprintf(String, "%02u/%u", 1 + gMenuCursor, gMenuListCount); + UI_PrintStringSmallNormal(String, 6, 0, 6); #else sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount); -#endif UI_PrintStringSmallNormal(String, 2, 0, 6); +#endif } else if (menu_index >= 0 && menu_index < (int)gMenuListCount) { // current menu item @@ -665,7 +642,19 @@ void UI_DisplayMenu(void) #endif case MENU_ABR: - strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]); + if(gSubMenuSelection == 0) + { + sprintf(String, "%s", "OFF"); + } + else if(gSubMenuSelection < 61) + { + sprintf(String, "%02dm:%02ds", (((gSubMenuSelection) * 5) / 60), (((gSubMenuSelection) * 5) % 60)); + } + else + { + sprintf(String, "%s", "ON"); + } + if(BACKLIGHT_GetBrightness() < 4) BACKLIGHT_SetBrightness(4); break; @@ -784,7 +773,7 @@ void UI_DisplayMenu(void) break; case MENU_TOT: - strcpy(String, gSubMenu_TOT[gSubMenuSelection]); + sprintf(String, "%02dm:%02ds", (((gSubMenuSelection + 1) * 5) / 60), (((gSubMenuSelection + 1) * 5) % 60)); break; #ifdef ENABLE_VOICE diff --git a/ui/menu.h b/ui/menu.h index 04a808a..902c9e4 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -25,7 +25,6 @@ typedef struct { const char name[7]; // menu display area only has room for 6 characters - VOICE_ID_t voice_id; uint8_t menu_id; } t_menu_item; @@ -181,7 +180,6 @@ extern const char* const gSubMenu_PTT_ID[5]; extern const char gSubMenu_ROGER[3][6]; extern const char gSubMenu_RESET[2][4]; extern const char* const gSubMenu_F_LOCK[F_LOCK_LEN]; -extern const char gSubMenu_BACKLIGHT[8][7]; extern const char gSubMenu_RX_TX[4][6]; extern const char gSubMenu_BAT_TXT[3][8]; extern const char gSubMenu_BATTYP[2][9]; diff --git a/ui/status.c b/ui/status.c index 10f6d4f..6e1b8aa 100644 --- a/ui/status.c +++ b/ui/status.c @@ -181,7 +181,7 @@ void UI_DisplayStatus() for (uint8_t i = 71; i < 79; i++) { - gFrameBuffer[-1][i] ^= 0x7F; + gStatusLine[i] ^= 0x7F; } x1 = x; } diff --git a/ui/welcome.c b/ui/welcome.c index 6b1357f..5e8d89b 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -68,35 +68,28 @@ void UI_DisplayWelcome(void) memset(WelcomeString0, 0, sizeof(WelcomeString0)); memset(WelcomeString1, 0, sizeof(WelcomeString1)); - if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE) - { - strcpy(WelcomeString0, "VOLTAGE"); - sprintf(WelcomeString1, "%u.%02uV %u%%", + sprintf(WelcomeString1, "%u.%02uV %u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, BATTERY_VoltsToPercent(gBatteryVoltageAverage)); + + if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE) + { + strcpy(WelcomeString0, "VOLTAGE"); } -#ifdef ENABLE_FEAT_F4HWN - else if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_MESSAGE || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) -#else - else -#endif + else if(gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) + { + EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16); + } + else if(gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_MESSAGE) { EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16); EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16); -#ifdef ENABLE_FEAT_F4HWN - if(gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) + if(strlen(WelcomeString1) == 0) { - sprintf(WelcomeString1, "%u.%02uV %u%%", - gBatteryVoltageAverage / 100, - gBatteryVoltageAverage % 100, - BATTERY_VoltsToPercent(gBatteryVoltageAverage)); - } - else if(strlen(WelcomeString1) == 0) { - UI_PrintString("BIENVENUE", 0, 127, 2, 10); + strcpy(WelcomeString1, "BIENVENUE"); } -#endif } UI_PrintString(WelcomeString0, 0, 127, 0, 10); @@ -121,7 +114,7 @@ void UI_DisplayWelcome(void) UI_PrintStringSmallNormal(Version, 0, 127, 6); #endif - ST7565_BlitStatusLine(); // blank status line + //ST7565_BlitStatusLine(); // blank status line : I think it's useless ST7565_BlitFullScreen(); } }