diff --git a/Makefile b/Makefile index 63b1147..86583cf 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # 1 = enable # ENABLE_SWD := 0 -ENABLE_OVERLAY := 1 +ENABLE_OVERLAY := 0 ENABLE_LTO := 0 ENABLE_UART := 1 ENABLE_AIRCOPY := 0 @@ -12,6 +12,7 @@ ENABLE_FMRADIO := 1 ENABLE_NOAA := 0 ENABLE_VOICE := 0 ENABLE_ALARM := 0 +#ENABLE_1750HZ := 0 ENABLE_BIG_FREQ := 0 ENABLE_SMALL_BOLD := 1 ENABLE_KEEP_MEM_NAME := 1 @@ -28,10 +29,10 @@ ENABLE_AM_FIX := 1 ENABLE_AM_FIX_SHOW_DATA := 1 ENABLE_SQUELCH_LOWER := 1 ENABLE_RSSI_BAR := 1 -ENABLE_AUDIO_BAR := 1 -#ENABLE_COPY_CHAN_TO_VFO := 1 -#ENABLE_SINGLE_VFO_CHAN := 1 -#ENABLE_BAND_SCOPE := 1 +ENABLE_AUDIO_BAR := 0 +#ENABLE_COPY_CHAN_TO_VFO := 1 +#ENABLE_SINGLE_VFO_CHAN := 1 +#ENABLE_BAND_SCOPE := 1 ############################################################# @@ -197,6 +198,9 @@ endif ifeq ($(ENABLE_ALARM),1) CFLAGS += -DENABLE_ALARM endif +ifeq ($(ENABLE_1750HZ),1) + CFLAGS += -DENABLE_1750HZ +endif ifeq ($(ENABLE_KEEP_MEM_NAME),1) CFLAGS += -DKEEP_MEM_NAME endif diff --git a/README.md b/README.md index e28e5c2..1e67852 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ ENABLE_FMRADIO := 1 WBFM VHF band 2 RX ENABLE_NOAA := 0 everything NOAA ENABLE_VOICE := 0 want to hear voices ? ENABLE_ALARM := 0 TX alarms +#ENABLE_1750HZ := 0 not not implemented .. side key 1750Hz TX tone ENABLE_BIG_FREQ := 0 big font frequencies ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode) ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel diff --git a/app/app.c b/app/app.c index b440648..20724d8 100644 --- a/app/app.c +++ b/app/app.c @@ -2181,9 +2181,6 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) gUpdateStatus = true; } - if (gF_LOCK && (Key == KEY_PTT || Key == KEY_SIDE2 || Key == KEY_SIDE1)) - return; - if (!bFlag) { if (gCurrentFunction == FUNCTION_TRANSMIT) diff --git a/app/scanner.c b/app/scanner.c index 4002e38..d4038b0 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -224,7 +224,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld) case 2: if (!gScanSingleFrequency) { - RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency); + RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, gScanFrequency); if (gScanUseCssResult) { @@ -367,7 +367,7 @@ void SCANNER_Start(void) BackupStep = gRxVfo->STEP_SETTING; BackupFrequency = gRxVfo->StepFrequency; - RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->Band, gRxVfo->pRX->Frequency); + RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->pRX->Frequency); gRxVfo->STEP_SETTING = BackupStep; gRxVfo->StepFrequency = BackupFrequency; diff --git a/bitmaps.c b/bitmaps.c index 0e20602..3f5a105 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -324,7 +324,7 @@ const uint8_t BITMAP_AntennaLevel6[3] = 0b00000000 }; -const uint8_t BITMAP_CurrentIndicator[8] = +const uint8_t BITMAP_MARKER[8] = { 0b11111111, 0b11111111, diff --git a/bitmaps.h b/bitmaps.h index 7e3163e..96b984a 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -52,7 +52,7 @@ extern const uint8_t BITMAP_AntennaLevel4[3]; extern const uint8_t BITMAP_AntennaLevel5[3]; extern const uint8_t BITMAP_AntennaLevel6[3]; -extern const uint8_t BITMAP_CurrentIndicator[8]; +extern const uint8_t BITMAP_MARKER[8]; extern const uint8_t BITMAP_VFO_Default[8]; extern const uint8_t BITMAP_VFO_NotDefault[8]; diff --git a/board.c b/board.c index 288214f..2b5f729 100644 --- a/board.c +++ b/board.c @@ -861,7 +861,7 @@ void BOARD_FactoryReset(bool bIsAll) if (bIsAll) { - RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, BAND6_400MHz, 43350000); + RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000); // set the first few memory channels for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) diff --git a/driver/keyboard.c b/driver/keyboard.c index 6f5f0d9..ad02454 100644 --- a/driver/keyboard.c +++ b/driver/keyboard.c @@ -29,12 +29,14 @@ KEY_Code_t KEYBOARD_Poll(void) { KEY_Code_t Key = KEY_INVALID; +// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT)) +// return KEY_PTT; + GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4); GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5); GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6); GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7); - - SYSTICK_DelayUs(1); + SYSTICK_DelayUs(2); // ***************** // Keys connected to gnd @@ -51,13 +53,11 @@ KEY_Code_t KEYBOARD_Poll(void) goto Bye; } - // Original doesn't do PTT - // ***************** // First row GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4); - SYSTICK_DelayUs(1); + SYSTICK_DelayUs(2); if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0)) { @@ -87,10 +87,8 @@ KEY_Code_t KEYBOARD_Poll(void) // Second row GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5); - SYSTICK_DelayUs(1); - GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4); - SYSTICK_DelayUs(1); + SYSTICK_DelayUs(2); if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0)) { @@ -120,16 +118,10 @@ KEY_Code_t KEYBOARD_Poll(void) // Third row GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4); - SYSTICK_DelayUs(1); - GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5); - SYSTICK_DelayUs(1); - GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4); - SYSTICK_DelayUs(1); - GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6); - SYSTICK_DelayUs(1); + SYSTICK_DelayUs(2); if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0)) { @@ -159,10 +151,8 @@ KEY_Code_t KEYBOARD_Poll(void) // Fourth row GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7); - SYSTICK_DelayUs(1); - GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6); - SYSTICK_DelayUs(1); + SYSTICK_DelayUs(2); if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0)) { diff --git a/firmware.bin b/firmware.bin index b084737..9304648 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index c2a0eee..4c6b888 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/helper/boot.c b/helper/boot.c index b5a0c1e..c65d7a4 100644 --- a/helper/boot.c +++ b/helper/boot.c @@ -48,8 +48,8 @@ BOOT_Mode_t BOOT_GetMode(void) if (Keys[0] == Keys[1]) { - gKeyReading0 = Keys[0]; - gKeyReading1 = Keys[0]; + gKeyReading0 = Keys[0]; + gKeyReading1 = Keys[0]; gDebounceCounter = 2; @@ -69,18 +69,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode) { if (Mode == BOOT_MODE_F_LOCK) { -/* // enable all the menu items - gMenuListCount = 0; -// while (MenuList[gMenuListCount].name != NULL) - while (MenuList[gMenuListCount].name[0] != '\0') - gMenuListCount++; - - gMenuCursor = MENU_350TX; - gSubMenuSelection = gSetting_350TX; -*/ GUI_SelectNextDisplay(DISPLAY_MENU); - - gF_LOCK = true; } #ifdef ENABLE_AIRCOPY else @@ -91,15 +80,15 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode) gEeprom.VOX_SWITCH = false; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; gEeprom.AUTO_KEYPAD_LOCK = false; - gEeprom.KEY_1_SHORT_PRESS_ACTION = 0; - gEeprom.KEY_1_LONG_PRESS_ACTION = 0; - gEeprom.KEY_2_SHORT_PRESS_ACTION = 0; - gEeprom.KEY_2_LONG_PRESS_ACTION = 0; + gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE; + gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE; + gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE; + gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE; - RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 5, 41002500); + RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 41002500); - gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW; - gRxVfo->OUTPUT_POWER = 0; + gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_WIDE; + gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW; RADIO_ConfigureSquelchAndOutputPower(gRxVfo); @@ -110,6 +99,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode) BK4819_ResetFSK(); gAircopyState = AIRCOPY_READY; + GUI_SelectNextDisplay(DISPLAY_AIRCOPY); } #endif diff --git a/main.c b/main.c index b39081f..40203e0 100644 --- a/main.c +++ b/main.c @@ -109,9 +109,8 @@ void Main(void) while (MenuList[gMenuListCount].name[0] != '\0') gMenuListCount++; - gMenuCursor = MENU_350TX; gSubMenuSelection = gSetting_350TX; - gF_LOCK = true; + gMenuCursor = MENU_350TX; } else { // hide the hidden menu items diff --git a/misc.c b/misc.c index ce567a1..9132342 100644 --- a/misc.c +++ b/misc.c @@ -216,7 +216,7 @@ uint8_t gNeverUsed; #endif bool gUpdateDisplay; -bool gF_LOCK; + uint8_t gShowChPrefix; volatile bool gNextTimeslice; diff --git a/misc.h b/misc.h index a27ba72..c216898 100644 --- a/misc.h +++ b/misc.h @@ -280,7 +280,6 @@ extern bool gUpdateDisplay; #ifdef ENABLE_FMRADIO extern uint8_t gFM_ChannelPosition; #endif -extern bool gF_LOCK; extern uint8_t gShowChPrefix; extern volatile uint8_t gFoundCDCSSCountdown_10ms; extern volatile uint8_t gFoundCTCSSCountdown_10ms; diff --git a/radio.c b/radio.c index c817da9..9d779d9 100644 --- a/radio.c +++ b/radio.c @@ -114,25 +114,24 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan return 0xFF; } -void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32_t Frequency) +void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency) { memset(pInfo, 0, sizeof(*pInfo)); - pInfo->Band = Band; - pInfo->SCANLIST1_PARTICIPATION = true; - pInfo->SCANLIST2_PARTICIPATION = true; - pInfo->STEP_SETTING = STEP_12_5kHz; - pInfo->StepFrequency = 2500; - pInfo->CHANNEL_SAVE = ChannelSave; - pInfo->FrequencyReverse = false; - pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW; - pInfo->freq_config_RX.Frequency = Frequency; - pInfo->freq_config_TX.Frequency = Frequency; - pInfo->pRX = &pInfo->freq_config_RX; - pInfo->pTX = &pInfo->freq_config_TX; - pInfo->TX_OFFSET_FREQUENCY = 1000000; + pInfo->Band = FREQUENCY_GetBand(Frequency); + pInfo->SCANLIST1_PARTICIPATION = true; + pInfo->SCANLIST2_PARTICIPATION = true; + pInfo->STEP_SETTING = STEP_12_5kHz; + pInfo->StepFrequency = 2500; + pInfo->CHANNEL_SAVE = ChannelSave; + pInfo->FrequencyReverse = false; + pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW; + pInfo->freq_config_RX.Frequency = Frequency; + pInfo->freq_config_TX.Frequency = Frequency; + pInfo->pRX = &pInfo->freq_config_RX; + pInfo->pTX = &pInfo->freq_config_TX; #ifdef ENABLE_COMPANDER - pInfo->Compander = 0; // off + pInfo->Compander = 0; // off #endif if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz)) @@ -167,7 +166,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure #ifdef ENABLE_NOAA if (Channel >= NOAA_CHANNEL_FIRST) { - RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], 2, NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]); + RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]); if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) return; @@ -211,7 +210,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure Index = Channel - FREQ_CHANNEL_FIRST; - RADIO_InitInfo(pRadio, Channel, Index, LowerLimitFrequencyBandTable[Index]); + RADIO_InitInfo(pRadio, Channel, LowerLimitFrequencyBandTable[Index]); return; } diff --git a/radio.h b/radio.h index 1b85136..ecfe98a 100644 --- a/radio.h +++ b/radio.h @@ -159,7 +159,7 @@ extern VfoState_t VfoState[2]; bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum); uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum); -void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t ChIndex, uint32_t Frequency); +void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency); void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure); void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo); void RADIO_ApplyOffset(VFO_Info_t *pInfo); diff --git a/ui/main.c b/ui/main.c index fc798c3..f3873f2 100644 --- a/ui/main.c +++ b/ui/main.c @@ -319,7 +319,7 @@ void UI_DisplayMain(void) for (vfo_num = 0; vfo_num < 2; vfo_num++) { const unsigned int rx_line = (gEeprom.RX_CHANNEL == 0) ? line0 : line1; - const unsigned int tx_line = (gEeprom.TX_CHANNEL == 0) ? line0 : line1; +// const unsigned int tx_line = (gEeprom.TX_CHANNEL == 0) ? line0 : line1; const unsigned int line = (vfo_num == 0) ? line0 : line1; uint8_t channel = gEeprom.TX_CHANNEL; const bool same_vfo = (channel == vfo_num) ? true : false; @@ -483,7 +483,7 @@ void UI_DisplayMain(void) { const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"}; if (state >= 0 && state < ARRAY_SIZE(state_list)) - UI_PrintString(state_list[state], 31, 0, tx_line, 8); + UI_PrintString(state_list[state], 31, 0, line, 8); } else if (gInputBoxIndex > 0 && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num]) && gEeprom.TX_CHANNEL == vfo_num) diff --git a/ui/menu.c b/ui/menu.c index 26461f7..664875c 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -352,7 +352,7 @@ void UI_DisplayMenu(void) // draw the left menu list #if 0 - + for (i = 0; i < 3; i++) if (gMenuCursor > 0 || i > 0) if ((gMenuListCount - 1) != gMenuCursor || i != 2) @@ -368,49 +368,69 @@ void UI_DisplayMenu(void) // draw vertical separating dotted line for (i = 0; i < 7; i++) gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA; + + // draw the little triangle marker if we're in the sub-menu + if (gIsInSubMenu) + memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator)); + + // draw the menu index number/count + sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount); + UI_PrintStringSmall(String, 2, 0, 6); #else { const int menu_index = gMenuCursor; // current selected menu item i = 1; - while (i < 2) - { // leading menu items - const int k = menu_index + i - 2; - if (k < 0) - UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round - else - if (k >= 0 && k < (int)gMenuListCount) - UI_PrintStringSmall(MenuList[k].name, 0, 0, i); - i++; - } - { // current menu item + + if (!gIsInSubMenu) + { + while (i < 2) + { // leading menu items + const int k = menu_index + i - 2; + if (k < 0) + UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round + else + if (k >= 0 && k < (int)gMenuListCount) + UI_PrintStringSmall(MenuList[k].name, 0, 0, i); + i++; + } + + // current menu item if (menu_index >= 0 && menu_index < (int)gMenuListCount) UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8); i++; + + while (i < 4) + { // trailing menu item + const int k = menu_index + i - 2; + if (k >= 0 && k < (int)gMenuListCount) + UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i); + else + if (k >= (int)gMenuListCount) + UI_PrintStringSmall(MenuList[gMenuListCount - k].name, 0, 0, 1 + i); // wrap-a-round + i++; + } + + // draw the menu index number/count + sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount); + UI_PrintStringSmall(String, 2, 0, 6); } - while (i < 4) - { // trailing menu item - const int k = menu_index + i - 2; - if (k >= 0 && k < (int)gMenuListCount) - UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i); - else - if (k >= (int)gMenuListCount) - UI_PrintStringSmall(MenuList[gMenuListCount - k].name, 0, 0, 1 + i); // wrap-a-round - i++; + else + if (menu_index >= 0 && menu_index < (int)gMenuListCount) + { // current menu item + strcpy(String, MenuList[menu_index].name); +// strcat(String, ":"); + UI_PrintStringSmall(String, 0, 0, 6); + + // invert pixels +// for (i = 0; i < (7 * strlen(String)); i++) +// gFrameBuffer[6][i] ^= 0xFF; } } #endif - // draw the menu index number/count - sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount); - UI_PrintStringSmall(String, 8, 0, 6); - - // draw the little triangle marker if we're in the sub-menu - if (gIsInSubMenu) - memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator)); - // ************** - + memset(String, 0, sizeof(String)); bool already_printed = false; diff --git a/ui/ui.c b/ui/ui.c index db1142e..750a7ca 100644 --- a/ui/ui.c +++ b/ui/ui.c @@ -91,7 +91,6 @@ void GUI_SelectNextDisplay(GUI_DisplayType_t Display) gAskForConfirmation = 0; gDTMF_InputMode = false; gDTMF_InputIndex = 0; - gF_LOCK = false; gAskToSave = false; gAskToDelete = false;