diff --git a/Makefile b/Makefile index 6e35cc5bd..31013ba7e 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # ---- STOCK QUANSHENG FERATURES ---- ENABLE_FMRADIO ?= 0 ENABLE_UART ?= 1 -ENABLE_AIRCOPY ?= 1 +ENABLE_AIRCOPY ?= 0 ENABLE_NOAA ?= 0 ENABLE_VOICE ?= 0 ENABLE_VOX ?= 1 @@ -17,7 +17,7 @@ ENABLE_DTMF_CALLING ?= 0 ENABLE_FLASHLIGHT ?= 1 # ---- CUSTOM MODS ---- -ENABLE_SPECTRUM ?= 1 +ENABLE_SPECTRUM ?= 0 ENABLE_BIG_FREQ ?= 1 ENABLE_SMALL_BOLD ?= 1 ENABLE_CUSTOM_MENU_LAYOUT ?= 1 @@ -48,6 +48,8 @@ ENABLE_FEAT_F4HWN_CHARGING_C ?= 1 ENABLE_FEAT_F4HWN_SLEEP ?= 1 ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1 ENABLE_FEAT_F4HWN_NARROWER ?= 1 +ENABLE_FEAT_F4HWN_CONTRAST ?= 1 +ENABLE_FEAT_F4HWN_MENU_LOCK ?= 0 ENABLE_FEAT_F4HWN_VOL ?= 0 ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0 ENABLE_FEAT_F4HWN_PMR ?= 0 @@ -222,7 +224,9 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v3.6 + VERSION_STRING_2 ?= v3.7 + + EDITION_STRING ?= Custom AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) @@ -411,6 +415,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) CFLAGS += -DSQL_TONE=550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open 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)\" + CFLAGS += -DEDITION_STRING=\"$(EDITION_STRING)\" else CFLAGS += -DSQL_TONE=550 endif @@ -435,6 +440,12 @@ endif ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1) CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER endif +ifeq ($(ENABLE_FEAT_F4HWN_CONTRAST),1) + CFLAGS += -DENABLE_FEAT_F4HWN_CONTRAST +endif +ifneq ($(filter $(ENABLE_FEAT_F4HWN_MENU_LOCK),1 2),) + CFLAGS += -DENABLE_FEAT_F4HWN_MENU_LOCK=$(ENABLE_FEAT_F4HWN_MENU_LOCK) +endif ifeq ($(ENABLE_FEAT_F4HWN_VOL),1) CFLAGS += -DENABLE_FEAT_F4HWN_VOL endif diff --git a/README.md b/README.md index 5a6aa4e40..27e2027e7 100644 --- a/README.md +++ b/README.md @@ -216,9 +216,14 @@ This is the least demanding option as you don't have to install enything on your -5. Open `Makefile` -1. Edit build options, save `Makefile` changes -1. Run `./compile-with-docker.sh` in terminal window +5. Open `Makefile`, edit build options and save changes +1. If necessary, open `compile-with-docker.sh`, edit build versions and save changes +1. Run in terminal window + - `./compile-with-docker.sh bandscope` to compile bandscope version + - `./compile-with-docker.sh broadcast` to compile broadcast version + - `./compile-with-docker.sh voxless` to compile voxless version + - `./compile-with-docker.sh all` to compile all versions + - `./compile-with-docker.sh custom` to compile only with Makefile build options 1. Open folder `compiled-firmware` 1. Right click `firmware.packed.bin` 1. Click `Download`, now you should have a firmware on your computer that you can proceed to flash on your radio. You can use [online flasher](https://egzumer.github.io/uvtools) diff --git a/app/action.c b/app/action.c index 4d33bb5e3..9fe229e88 100644 --- a/app/action.c +++ b/app/action.c @@ -229,6 +229,10 @@ void ACTION_Scan(bool bRestart) gScanPauseDelayIn_10ms = 1; gScheduleScanListen = false; } else { + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + gEeprom.CURRENT_STATE = 1; + SETTINGS_WriteCurrentState(); + #endif // start scanning CHFRSCANNER_Start(true, SCAN_FWD); diff --git a/app/app.c b/app/app.c index dd2c50201..32ec4e603 100644 --- a/app/app.c +++ b/app/app.c @@ -1398,7 +1398,7 @@ void APP_TimeSlice10ms(void) return; #endif -#ifndef ENABLE_FEAT_F4HWN +#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK) #ifdef ENABLE_FLASHLIGHT FlashlightTimeSlice(); #endif diff --git a/app/flashlight.c b/app/flashlight.c index 28a48b958..fad618b1d 100644 --- a/app/flashlight.c +++ b/app/flashlight.c @@ -5,7 +5,7 @@ #include "flashlight.h" -#ifndef ENABLE_FEAT_F4HWN +#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK) enum FlashlightMode_t gFlashLightState; void FlashlightTimeSlice() diff --git a/app/flashlight.h b/app/flashlight.h index 9c0a7c4c3..feca80a06 100644 --- a/app/flashlight.h +++ b/app/flashlight.h @@ -5,7 +5,7 @@ #include -#ifndef ENABLE_FEAT_F4HWN +#if !defined(ENABLE_FEAT_F4HWN) || defined(ENABLE_FEAT_F4HWN_MENU_LOCK) enum FlashlightMode_t { FLASHLIGHT_OFF = 0, FLASHLIGHT_ON, diff --git a/app/main.c b/app/main.c index f69e3a604..422304624 100644 --- a/app/main.c +++ b/app/main.c @@ -84,6 +84,12 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) { uint8_t Vfo = gEeprom.TX_VFO; +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if(gEeprom.MENU_LOCK == true) { + return; // prevent F function if MENU LOCK is true + } +#endif + if (gScreenToDisplay == DISPLAY_MENU) { gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; return; @@ -427,7 +433,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number - gKeyInputCountdown = (key_input_timeout_500ms / 5); // short time... + gKeyInputCountdown = (key_input_timeout_500ms / 4); // short time... #ifdef ENABLE_VOICE gAnotherVoiceID = (VOICE_ID_t)Key; @@ -454,8 +460,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) // do nothing return; } - - gKeyInputCountdown = (key_input_timeout_500ms / 5); // short time... + + gKeyInputCountdown = (gInputBoxIndex == totalDigits) ? (key_input_timeout_500ms / 16) : (key_input_timeout_500ms / 3); const char *inputStr = INPUTBOX_GetAscii(); uint8_t inputLength = gInputBoxIndex; @@ -680,11 +686,19 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) return; } + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if(gEeprom.MENU_LOCK == false) { + #endif + gFlagRefreshSetting = true; gRequestDisplayScreen = DISPLAY_MENU; #ifdef ENABLE_VOICE gAnotherVoiceID = VOICE_ID_MENU; #endif + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + } + #endif } else { gRequestDisplayScreen = DISPLAY_MAIN; @@ -694,6 +708,13 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) { + +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if(gEeprom.MENU_LOCK == true) { + return; // prevent F function if MENU LOCK is true + } +#endif + if (gCurrentFunction == FUNCTION_TRANSMIT) return; @@ -927,7 +948,13 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) MAIN_Key_STAR(bKeyPressed, bKeyHeld); break; case KEY_F: - GENERIC_Key_F(bKeyPressed, bKeyHeld); + #ifndef ENABLE_FEAT_F4HWN_MENU_LOCK + GENERIC_Key_F(bKeyPressed, bKeyHeld); + #else + if(gEeprom.MENU_LOCK == false) { + GENERIC_Key_F(bKeyPressed, bKeyHeld); + } + #endif break; case KEY_PTT: GENERIC_Key_PTT(bKeyPressed); diff --git a/app/menu.c b/app/menu.c index f5edf3284..03e725282 100644 --- a/app/menu.c +++ b/app/menu.c @@ -400,10 +400,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1; break; +#ifdef ENABLE_FEAT_F4HWN_CONTRAST case MENU_SET_CTR: *pMin = 1; *pMax = 15; break; +#endif case MENU_TX_LOCK: case MENU_SET_INV: //*pMin = 0; @@ -430,6 +432,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) *pMax = 63; break; #endif + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + case MENU_SET_KEY: + //*pMin = 0; + *pMax = 4; + break; + #endif #endif default: @@ -914,9 +922,11 @@ void MENU_AcceptSetting(void) case MENU_SET_EOT: gSetting_set_eot = gSubMenuSelection; break; +#ifdef ENABLE_FEAT_F4HWN_CONTRAST case MENU_SET_CTR: gSetting_set_ctr = gSubMenuSelection; break; +#endif case MENU_SET_INV: gSetting_set_inv = gSubMenuSelection; break; @@ -941,6 +951,11 @@ void MENU_AcceptSetting(void) gEeprom.VOLUME_GAIN = gSubMenuSelection; break; #endif + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + case MENU_SET_KEY: + gEeprom.SET_KEY = gSubMenuSelection; + break; + #endif case MENU_SET_TMR: gSetting_set_tmr = gSubMenuSelection; break; @@ -1360,9 +1375,11 @@ void MENU_ShowCurrentSetting(void) case MENU_SET_EOT: gSubMenuSelection = gSetting_set_eot; break; +#ifdef ENABLE_FEAT_F4HWN_CONTRAST case MENU_SET_CTR: gSubMenuSelection = gSetting_set_ctr; break; +#endif case MENU_SET_INV: gSubMenuSelection = gSetting_set_inv; break; @@ -1385,6 +1402,11 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gEeprom.VOLUME_GAIN; break; #endif + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + case MENU_SET_KEY: + gSubMenuSelection = gEeprom.SET_KEY; + break; + #endif case MENU_SET_TMR: gSubMenuSelection = gSetting_set_tmr; break; diff --git a/app/spectrum.c b/app/spectrum.c index ef05597dd..d09491db6 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -867,17 +867,37 @@ uint8_t Rssi2Y(uint16_t rssi) return DrawingEndY - Rssi2PX(rssi, 0, DrawingEndY); } -static void DrawSpectrum() -{ - for (uint8_t x = 0; x < 128; ++x) +#ifdef ENABLE_FEAT_F4HWN_SPECTRUM + static void DrawSpectrum() { - uint16_t rssi = rssiHistory[x >> settings.stepsCount]; - if (rssi != RSSI_MAX_VALUE) + uint8_t ox = 0; + for (uint8_t i = 0; i < 128; ++i) { - DrawVLine(Rssi2Y(rssi), DrawingEndY, x, true); + uint16_t rssi = rssiHistory[i >> settings.stepsCount]; + if (rssi != RSSI_MAX_VALUE) + { + uint8_t x = i * 128 / GetStepsCount(); + for (uint8_t xx = ox; xx < x; xx++) + { + DrawVLine(Rssi2Y(rssi), DrawingEndY, xx, true); + } + ox = x; + } } } -} +#else + static void DrawSpectrum() + { + for (uint8_t x = 0; x < 128; ++x) + { + uint16_t rssi = rssiHistory[x >> settings.stepsCount]; + if (rssi != RSSI_MAX_VALUE) + { + DrawVLine(Rssi2Y(rssi), DrawingEndY, x, true); + } + } + } +#endif static void DrawStatus() { diff --git a/archive/f4hwn.bandscope.packed.v3.7.bin b/archive/f4hwn.bandscope.packed.v3.7.bin new file mode 100644 index 000000000..8f56b9a1e Binary files /dev/null and b/archive/f4hwn.bandscope.packed.v3.7.bin differ diff --git a/archive/f4hwn.bandscope.packed.v3.7.sa818.bin b/archive/f4hwn.bandscope.packed.v3.7.sa818.bin new file mode 100644 index 000000000..5b3683627 Binary files /dev/null and b/archive/f4hwn.bandscope.packed.v3.7.sa818.bin differ diff --git a/archive/f4hwn.broadcast.packed.v3.7.bin b/archive/f4hwn.broadcast.packed.v3.7.bin new file mode 100644 index 000000000..4eb1c8115 Binary files /dev/null and b/archive/f4hwn.broadcast.packed.v3.7.bin differ diff --git a/archive/f4hwn.broadcast.packed.v3.7.sa818.bin b/archive/f4hwn.broadcast.packed.v3.7.sa818.bin new file mode 100644 index 000000000..c99ebcf1f Binary files /dev/null and b/archive/f4hwn.broadcast.packed.v3.7.sa818.bin differ diff --git a/archive/f4hwn.rescueops.packed.v3.7.bin b/archive/f4hwn.rescueops.packed.v3.7.bin new file mode 100644 index 000000000..e5b56dc22 Binary files /dev/null and b/archive/f4hwn.rescueops.packed.v3.7.bin differ diff --git a/archive/f4hwn.rescueops.packed.v3.7.sa818.bin b/archive/f4hwn.rescueops.packed.v3.7.sa818.bin new file mode 100644 index 000000000..387dc129e Binary files /dev/null and b/archive/f4hwn.rescueops.packed.v3.7.sa818.bin differ diff --git a/archive/f4hwn.voxless.packed.v3.7.bin b/archive/f4hwn.voxless.packed.v3.7.bin new file mode 100644 index 000000000..a54369bb6 Binary files /dev/null and b/archive/f4hwn.voxless.packed.v3.7.bin differ diff --git a/archive/f4hwn.voxless.packed.v3.7.sa818.bin b/archive/f4hwn.voxless.packed.v3.7.sa818.bin new file mode 100644 index 000000000..cee1045c1 Binary files /dev/null and b/archive/f4hwn.voxless.packed.v3.7.sa818.bin differ diff --git a/bitmaps.c b/bitmaps.c index 0a2253a67..942860027 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -22,19 +22,40 @@ const uint8_t gFontPttClassic[2][6] = {0x00, 0x7f, 0x40, 0x40, 0x40, 0x40}, }; -const uint8_t gFontF[1][8] = +const uint8_t gFontF[8] = { - {0x7f, 0x00, 0x76, 0x76, 0x76, 0x76, 0x7e, 0x7f}, // 'F' + 0b01111111, + 0b00000000, + 0b01110110, + 0b01110110, + 0b01110110, + 0b01110110, + 0b01111110, + 0b01111111 }; -const uint8_t gFontS[1][6] = +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + const uint8_t gFontR[8] = + { + 0b01111111, + 0b00000000, + 0b01110110, + 0b01110110, + 0b01100110, + 0b01010110, + 0b00111001, + 0b01111111 + }; +#endif + +const uint8_t gFontS[6] = { - {0x26, 0x49, 0x49, 0x49, 0x49, 0x32}, // 'S' + 0x26, 0x49, 0x49, 0x49, 0x49, 0x32 // 'S' }; -const uint8_t gFontKeyLock[1][9] = +const uint8_t gFontKeyLock[9] = { - {0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c} + 0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c }; const uint8_t gFontLight[9] = @@ -280,6 +301,7 @@ const uint8_t BITMAP_compand[6] = 0b00100100 }; +/* const uint8_t BITMAP_Ready[7] = { 0b00001000, @@ -291,6 +313,18 @@ const uint8_t BITMAP_Ready[7] = 0b00000010, }; +const uint8_t BITMAP_NotReady[7] = +{ + 0b00000000, + 0b01000010, + 0b00100100, + 0b00011000, + 0b00100100, + 0b01000010, + 0b00000000, +}; +*/ + const uint8_t BITMAP_PowerUser[3] = { // 'arrow' symbol 0b00111110, diff --git a/bitmaps.h b/bitmaps.h index a7853ec5c..92b6629b1 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -7,10 +7,15 @@ extern const uint8_t gFontPowerSave[2][6]; extern const uint8_t gFontPttOnePush[2][6]; extern const uint8_t gFontPttClassic[2][6]; -extern const uint8_t gFontF[1][8]; -extern const uint8_t gFontS[1][6]; +extern const uint8_t gFontF[8]; -extern const uint8_t gFontKeyLock[1][9]; +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + extern const uint8_t gFontR[8]; +#endif + +extern const uint8_t gFontS[6]; + +extern const uint8_t gFontKeyLock[9]; extern const uint8_t gFontLight[9]; extern const uint8_t gFontXB[2][6]; @@ -21,7 +26,11 @@ extern const uint8_t gFontHold[2][5]; extern const uint8_t BITMAP_BatteryLevel[2]; extern const uint8_t BITMAP_BatteryLevel1[17]; extern const uint8_t BITMAP_USB_C[9]; + +/* extern const uint8_t BITMAP_Ready[7]; +extern const uint8_t BITMAP_NotReady[7]; +*/ #ifdef ENABLE_VOX extern const uint8_t gFontVox[2][6]; diff --git a/compile-with-docker-all.sh b/compile-with-docker-all.sh deleted file mode 100755 index 0dcba60c5..000000000 --- a/compile-with-docker-all.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -#export DOCKER_DEFAULT_PLATFORM=linux/amd64 -IMAGE_NAME="uvk5" -rm "${PWD}/compiled-firmware/*" -docker build -t $IMAGE_NAME . - -bandscope() { - echo "Bandscope compilation..." - docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ - ENABLE_SPECTRUM=1 \ - ENABLE_FMRADIO=0 \ - ENABLE_AIRCOPY=1 \ - ENABLE_NOAA=0 \ - TARGET=f4hwn.bandscope \ - && cp f4hwn.bandscope* compiled-firmware/" -} - -broadcast() { - echo "Broadcast compilation..." - docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ - ENABLE_SPECTRUM=0 \ - ENABLE_FMRADIO=1 \ - ENABLE_AIRCOPY=1 \ - ENABLE_NOAA=0 \ - TARGET=f4hwn.broadcast \ - && cp f4hwn.broadcast* compiled-firmware/" -} - -voxless() { - echo "Voxless compilation..." - docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ - ENABLE_SPECTRUM=1 \ - ENABLE_FMRADIO=1 \ - ENABLE_VOX=0 \ - ENABLE_AIRCOPY=0 \ - ENABLE_AUDIO_BAR=0 \ - ENABLE_FEAT_F4HWN_SPECTRUM=0 \ - ENABLE_NOAA=0 \ - ENABLE_FEAT_F4HWN_RESTORE_SCAN=0 \ - ENABLE_FEAT_F4HWN_CHARGING_C=0 \ - ENABLE_FEAT_F4HWN_NARROWER=0 \ - TARGET=f4hwn.voxless \ - && cp f4hwn.voxless* compiled-firmware/" -} - -case "$1" in - bandscope) - bandscope - ;; - broadcast) - broadcast - ;; - voxless) - voxless - ;; - all) - bandscope - broadcast - voxless - ;; - *) - echo "Usage: $0 {bandscope|broadcast|voxless|all}" - exit 1 - ;; -esac \ No newline at end of file diff --git a/compile-with-docker.sh b/compile-with-docker.sh index 7ad8490e8..6e69a04a1 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -1,5 +1,114 @@ #!/bin/sh #export DOCKER_DEFAULT_PLATFORM=linux/amd64 IMAGE_NAME="uvk5" +rm "${PWD}/compiled-firmware/*" docker build -t $IMAGE_NAME . -docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make && cp f4hwn* compiled-firmware/" \ No newline at end of file + +custom() { + echo "Custom compilation..." + docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ + EDITION_STRING=Custom \ + TARGET=f4hwn.custom \ + && cp f4hwn.custom* compiled-firmware/" +} + +standard() { + echo "Standard compilation..." + docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ + ENABLE_SPECTRUM=0 \ + ENABLE_FMRADIO=0 \ + ENABLE_AIRCOPY=0 \ + ENABLE_NOAA=0 \ + EDITION_STRING=Standard \ + TARGET=f4hwn.standard \ + && cp f4hwn.standard* compiled-firmware/" +} + +bandscope() { + echo "Bandscope compilation..." + docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ + ENABLE_SPECTRUM=1 \ + ENABLE_FMRADIO=0 \ + ENABLE_AIRCOPY=1 \ + ENABLE_NOAA=0 \ + ENABLE_FEAT_F4HWN_MENU_LOCK=0 \ + EDITION_STRING=Bandscope \ + TARGET=f4hwn.bandscope \ + && cp f4hwn.bandscope* compiled-firmware/" +} + +broadcast() { + echo "Broadcast compilation..." + docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ + ENABLE_SPECTRUM=0 \ + ENABLE_FMRADIO=1 \ + ENABLE_AIRCOPY=1 \ + ENABLE_NOAA=0 \ + EDITION_STRING=Broadcast \ + ENABLE_FEAT_F4HWN_MENU_LOCK=0 \ + TARGET=f4hwn.broadcast \ + && cp f4hwn.broadcast* compiled-firmware/" +} + +voxless() { + echo "Voxless compilation..." + docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ + ENABLE_SPECTRUM=1 \ + ENABLE_FMRADIO=1 \ + ENABLE_VOX=0 \ + ENABLE_AIRCOPY=0 \ + ENABLE_AUDIO_BAR=0 \ + ENABLE_FEAT_F4HWN_SPECTRUM=0 \ + ENABLE_NOAA=0 \ + ENABLE_FEAT_F4HWN_RESTORE_SCAN=0 \ + ENABLE_FEAT_F4HWN_CHARGING_C=0 \ + ENABLE_FEAT_F4HWN_NARROWER=0 \ + ENABLE_FEAT_F4HWN_MENU_LOCK=0 \ + EDITION_STRING=Voxless \ + TARGET=f4hwn.voxless \ + && cp f4hwn.voxless* compiled-firmware/" +} + +rescueops() { + echo "RescueOps compilation..." + docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ + ENABLE_SPECTRUM=0 \ + ENABLE_FMRADIO=0 \ + ENABLE_AIRCOPY=1 \ + ENABLE_NOAA=1 \ + ENABLE_FEAT_F4HWN_MENU_LOCK=1 \ + EDITION_STRING=RescueOps \ + TARGET=f4hwn.rescueops \ + && cp f4hwn.rescueops* compiled-firmware/" +} + +case "$1" in + custom) + custom + ;; + standard) + standard + ;; + bandscope) + bandscope + ;; + broadcast) + broadcast + ;; + voxless) + voxless + ;; + rescueops) + rescueops + ;; + all) + bandscope + broadcast + voxless + rescueops + ;; + *) + echo "Usage: $0 {custom|bandscope|broadcast|voxless|standard|all}" + exit 1 + ;; +esac \ No newline at end of file diff --git a/helper/boot.c b/helper/boot.c index 9f6973598..049cc40f4 100644 --- a/helper/boot.c +++ b/helper/boot.c @@ -44,6 +44,13 @@ BOOT_Mode_t BOOT_GetMode(void) SYSTEM_DelayMs(20); } + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if (Keys[0] == (10 + gEeprom.SET_KEY)) + { + return BOOT_MODE_MENU_LOCK; // Secret KEY pressed + } + #endif + if (Keys[0] == Keys[1]) { gKeyReading0 = Keys[0]; diff --git a/helper/boot.h b/helper/boot.h index e04c46293..3222d4063 100644 --- a/helper/boot.h +++ b/helper/boot.h @@ -24,6 +24,9 @@ enum BOOT_Mode_t { BOOT_MODE_NORMAL = 0, BOOT_MODE_F_LOCK, + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + BOOT_MODE_MENU_LOCK, + #endif #ifdef ENABLE_AIRCOPY BOOT_MODE_AIRCOPY #endif diff --git a/main.c b/main.c index 95d5e497d..32539768d 100644 --- a/main.c +++ b/main.c @@ -129,7 +129,30 @@ void Main(void) AM_fix_init(); #endif - const BOOT_Mode_t BootMode = BOOT_GetMode(); + BOOT_Mode_t BootMode = BOOT_GetMode(); + +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if (BootMode == BOOT_MODE_MENU_LOCK) + { + gEeprom.MENU_LOCK = !gEeprom.MENU_LOCK; + SETTINGS_SaveSettings(); + } + + if(gEeprom.MENU_LOCK == true) // Force Main Only + { + gEeprom.DUAL_WATCH = 0; + gEeprom.CROSS_BAND_RX_TX = 0; + //gFlagReconfigureVfos = true; + //gUpdateStatus = true; + } +#endif + +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if (BootMode == BOOT_MODE_F_LOCK && gEeprom.MENU_LOCK == true) + { + BootMode = BOOT_MODE_NORMAL; + } +#endif if (BootMode == BOOT_MODE_F_LOCK) { @@ -139,13 +162,16 @@ void Main(void) gEeprom.KEY_LOCK = 0; SETTINGS_SaveSettings(); #ifndef ENABLE_VOX - gMenuCursor = 64; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar + gMenuCursor = 65; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar #else - #ifdef ENABLE_FEAT_F4HWN_SLEEP - gMenuCursor = 67; // move to hidden section, fix me if change... !!! - #else - gMenuCursor = 66; // move to hidden section, fix me if change... !!! - #endif + gMenuCursor = 68; // move to hidden section, fix me if change... !!! + #endif + + #ifdef ENABLE_NOAA + gMenuCursor += 1; // move to hidden section, fix me if change... !!! + #endif + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + gMenuCursor += 1; // move to hidden section, fix me if change... !!! #endif gSubMenuSelection = gSetting_F_LOCK; #endif diff --git a/settings.c b/settings.c index 1aa2afb60..d54cf7b8d 100644 --- a/settings.c +++ b/settings.c @@ -51,7 +51,13 @@ void SETTINGS_InitEEPROM(void) #ifdef ENABLE_NOAA gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false; #endif - gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false; + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + 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; + #else + gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false; + #endif #ifdef ENABLE_VOX gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false; gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1; @@ -590,7 +596,13 @@ void SETTINGS_SaveSettings(void) #else State[3] = false; #endif - State[4] = gEeprom.KEY_LOCK; + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + State[4] = (gEeprom.KEY_LOCK ? 0x01 : 0) | (gEeprom.MENU_LOCK ? 0x02 :0) | ((gEeprom.SET_KEY & 0x0F) << 2); + #else + State[4] = gEeprom.KEY_LOCK; + #endif + #ifdef ENABLE_VOX State[5] = gEeprom.VOX_SWITCH; State[6] = gEeprom.VOX_LEVEL; @@ -987,6 +999,9 @@ State[1] = 0 #ifdef ENABLE_SPECTRUM | (1 << 5) #endif +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + | (1 << 6) +#endif ; EEPROM_WriteBuffer(0x1FF0, State); } diff --git a/settings.h b/settings.h index d104b2b19..e2859daf4 100644 --- a/settings.h +++ b/settings.h @@ -185,6 +185,10 @@ typedef struct { bool KEY_LOCK; #ifdef ENABLE_FEAT_F4HWN bool KEY_LOCK_PTT; +#endif +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + bool MENU_LOCK; + uint8_t SET_KEY; #endif bool VOX_SWITCH; uint8_t VOX_LEVEL; diff --git a/ui/menu.c b/ui/menu.c index 7a4d2d23e..f7534355a 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -141,7 +141,9 @@ const t_menu_item MenuList[] = {"SetPTT", MENU_SET_PTT }, {"SetTOT", MENU_SET_TOT }, {"SetEOT", MENU_SET_EOT }, +#ifdef ENABLE_FEAT_F4HWN_CONTRAST {"SetCtr", MENU_SET_CTR }, +#endif {"SetInv", MENU_SET_INV }, {"SetLck", MENU_SET_LCK }, {"SetMet", MENU_SET_MET }, @@ -156,6 +158,9 @@ const t_menu_item MenuList[] = #ifdef ENABLE_FEAT_F4HWN_VOL {"SetVol", MENU_SET_VOL }, #endif +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + {"SetKey", MENU_SET_KEY }, +#endif #endif // hidden menu items from here on // enabled if pressing both the PTT and upper side button at power-on @@ -395,6 +400,17 @@ const char gSubMenu_SCRAMBLER[][7] = "NARROWER" }; #endif + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + const char gSubMenu_SET_KEY[][9] = + { + "KEY_MENU", + "KEY_UP", + "KEY_DOWN", + "KEY_EXIT", + "KEY_STAR" + }; + #endif #endif const t_sidefunction gSubMenu_SIDEFUNCTIONS[] = @@ -1013,11 +1029,13 @@ void UI_DisplayMenu(void) strcpy(String, gSubMenu_SET_TOT[gSubMenuSelection]); // Same as SET_TOT break; +#ifdef ENABLE_FEAT_F4HWN_CONTRAST case MENU_SET_CTR: sprintf(String, "%d", gSubMenuSelection); gSetting_set_ctr = gSubMenuSelection; ST7565_ContrastAndInv(); break; +#endif case MENU_SET_INV: strcpy(String, gSubMenu_OFF_ON[gSubMenuSelection]); @@ -1061,6 +1079,12 @@ void UI_DisplayMenu(void) (gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2) break; #endif + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + case MENU_SET_KEY: + strcpy(String, gSubMenu_SET_KEY[gSubMenuSelection]); + break; + #endif #endif } diff --git a/ui/menu.h b/ui/menu.h index b7efb209b..5379204f7 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -147,6 +147,9 @@ enum #ifdef ENABLE_FEAT_F4HWN_VOL MENU_SET_VOL, #endif + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + MENU_SET_KEY, + #endif #endif MENU_BATCAL, // battery voltage calibration MENU_F1SHRT, @@ -187,6 +190,9 @@ extern const char gSubMenu_D_RSP[4][11]; #ifdef ENABLE_FEAT_F4HWN_NARROWER extern const char gSubMenu_SET_NFM[2][9]; #endif + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + extern const char gSubMenu_SET_KEY[][9]; + #endif #endif extern const char* const gSubMenu_PTT_ID[5]; diff --git a/ui/status.c b/ui/status.c index f3b1272ae..fb25df67e 100644 --- a/ui/status.c +++ b/ui/status.c @@ -213,6 +213,11 @@ void UI_DisplayStatus() } */ } +#ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + else if(gEeprom.MENU_LOCK == true) { + memcpy(line + x + 1, gFontR, sizeof(gFontR)); + } +#endif else if (gBackLight) { memcpy(line + x + 1, gFontLight, sizeof(gFontLight)); diff --git a/ui/welcome.c b/ui/welcome.c index 48cd088d2..fcc65ab1e 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -48,6 +48,7 @@ void UI_DisplayWelcome(void) char WelcomeString0[16]; char WelcomeString1[16]; char WelcomeString2[16]; + char WelcomeString3[20]; memset(gStatusLine, 0, sizeof(gStatusLine)); @@ -128,6 +129,43 @@ void UI_DisplayWelcome(void) gFrameBuffer[4][i] ^= 0xFF; } + + sprintf(WelcomeString3, "%s Edition", Edition); + UI_PrintStringSmallNormal(WelcomeString3, 0, 127, 6); + + /* + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + #if ENABLE_FEAT_F4HWN_MENU_LOCK > 1 + UI_PrintStringSmallNormal(Edition, 18, 0, 6); + if(gEeprom.MENU_LOCK == true) { + memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready)); + } + else + { + memcpy(gFrameBuffer[6] + 103, BITMAP_NotReady, sizeof(BITMAP_NotReady)); + } + #else + UI_PrintStringSmallNormal(Edition, 18, 0, 5); + memcpy(gFrameBuffer[5] + 103, BITMAP_Ready, sizeof(BITMAP_Ready)); + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + UI_PrintStringSmallNormal("RescueOps", 18, 0, 6); + if(gEeprom.MENU_LOCK == true) { + memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready)); + } + else + { + memcpy(gFrameBuffer[6] + 103, BITMAP_NotReady, sizeof(BITMAP_NotReady)); + } + #endif + #endif + #else + UI_PrintStringSmallNormal(Edition, 18, 0, 6); + memcpy(gFrameBuffer[6] + 103, BITMAP_Ready, sizeof(BITMAP_Ready)); + #endif + */ + + /* #ifdef ENABLE_SPECTRUM #ifdef ENABLE_FMRADIO UI_PrintStringSmallNormal(Based, 0, 127, 5); @@ -135,13 +173,29 @@ void UI_DisplayWelcome(void) #else UI_PrintStringSmallNormal("Bandscope ", 0, 127, 5); memcpy(gFrameBuffer[5] + 95, BITMAP_Ready, sizeof(BITMAP_Ready)); - UI_PrintStringSmallNormal("Broadcast ", 0, 127, 6); + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + UI_PrintStringSmallNormal("RescueOps ", 0, 127, 6); + if(gEeprom.MENU_LOCK == true) { + memcpy(gFrameBuffer[6] + 95, BITMAP_Ready, sizeof(BITMAP_Ready)); + } + #else + UI_PrintStringSmallNormal("Broadcast ", 0, 127, 6); + #endif #endif #else - UI_PrintStringSmallNormal("Bandscope ", 0, 127, 5); + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + UI_PrintStringSmallNormal("RescueOps ", 0, 127, 5); + if(gEeprom.MENU_LOCK == true) { + memcpy(gFrameBuffer[5] + 95, BITMAP_Ready, sizeof(BITMAP_Ready)); + } + #else + UI_PrintStringSmallNormal("Bandscope ", 0, 127, 5); + #endif UI_PrintStringSmallNormal("Broadcast ", 0, 127, 6); memcpy(gFrameBuffer[6] + 95, BITMAP_Ready, sizeof(BITMAP_Ready)); #endif + */ #else UI_PrintStringSmallNormal(Version, 0, 127, 6); #endif diff --git a/version.c b/version.c index f9c28ad49..4fd592936 100644 --- a/version.c +++ b/version.c @@ -7,8 +7,7 @@ #ifdef ENABLE_FEAT_F4HWN const char Version[] = AUTHOR_STRING_2 " " VERSION_STRING_2; - const char Based[] = "based on"; - const char Credits[] = AUTHOR_STRING_1 " " VERSION_STRING_1; + const char Edition[] = EDITION_STRING; #else const char Version[] = AUTHOR_STRING VER; #endif diff --git a/version.h b/version.h index a19174f5f..0af7d1c2c 100644 --- a/version.h +++ b/version.h @@ -23,6 +23,5 @@ extern const char UART_Version[]; #endif #ifdef ENABLE_FEAT_F4HWN - extern const char Credits[]; - extern const char Based[]; +extern const char Edition[]; #endif