diff --git a/app/app.c b/app/app.c index 3f4515c..104fb9c 100644 --- a/app/app.c +++ b/app/app.c @@ -98,7 +98,7 @@ static void APP_CheckForIncoming(void) return; } - gDualWatchCountdown = dual_watch_count_after_rx; + gDualWatchCountdown = dual_watch_count_after_rx_10ms; gScheduleDualWatch = false; } else @@ -163,7 +163,7 @@ static void APP_HandleIncoming(void) { if (gRxReceptionMode == RX_MODE_DETECTED) { - gDualWatchCountdown = dual_watch_count_after_1; + gDualWatchCountdown = dual_watch_count_after_1_10ms; gScheduleDualWatch = false; gRxReceptionMode = RX_MODE_LISTENING; return; @@ -442,7 +442,7 @@ void APP_StartListening(FUNCTION_Type_t Function) { gRxVfoIsActive = true; - gDualWatchCountdown = dual_watch_count_after_2; + gDualWatchCountdown = dual_watch_count_after_2_10ms; gScheduleDualWatch = false; } @@ -607,9 +607,9 @@ static void DUALWATCH_Alternate(void) RADIO_SetupRegisters(false); #ifdef ENABLE_NOAA - gDualWatchCountdown = gIsNoaaMode ? dual_watch_count_noaa : dual_watch_count_toggle; + gDualWatchCountdown = gIsNoaaMode ? dual_watch_count_noaa_10ms : dual_watch_count_toggle_10ms; #else - gDualWatchCountdown = dual_watch_count_toggle; + gDualWatchCountdown = dual_watch_count_toggle_10ms; #endif } @@ -687,9 +687,9 @@ void APP_CheckRadioInterrupts(void) gBatterySaveCountdownExpired = false; } - if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gScheduleDualWatch || gDualWatchCountdown < dual_watch_count_after_vox)) + if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && (gScheduleDualWatch || gDualWatchCountdown < dual_watch_count_after_vox_10ms)) { - gDualWatchCountdown = dual_watch_count_after_vox; + gDualWatchCountdown = dual_watch_count_after_vox_10ms; gScheduleDualWatch = false; } } @@ -975,12 +975,12 @@ void APP_Update(void) gCssScanMode != CSS_SCAN_MODE_OFF || gScreenToDisplay != DISPLAY_MAIN || gDTMF_CallState != DTMF_CALL_STATE_NONE) - gBatterySaveCountdown = battery_save_count; + gBatterySaveCountdown = battery_save_count_10ms; else if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode) FUNCTION_Select(FUNCTION_POWER_SAVE); else - gBatterySaveCountdown = battery_save_count; + gBatterySaveCountdown = battery_save_count_10ms; #else if ( #ifdef ENABLE_FMRADIO @@ -993,7 +993,7 @@ void APP_Update(void) gCssScanMode != CSS_SCAN_MODE_OFF || gScreenToDisplay != DISPLAY_MAIN || gDTMF_CallState != DTMF_CALL_STATE_NONE) - gBatterySaveCountdown = battery_save_count; + gBatterySaveCountdown = battery_save_count_10ms; else FUNCTION_Select(FUNCTION_POWER_SAVE); #endif @@ -1135,7 +1135,7 @@ void APP_CheckKeys(void) return; } - if (++gDebounceCounter == key_debounce) + if (++gDebounceCounter == key_debounce_10ms) { // debounced new key pressed if (Key == KEY_INVALID) @@ -1158,7 +1158,7 @@ void APP_CheckKeys(void) // key is being held pressed - if (gDebounceCounter == key_repeat_delay) + if (gDebounceCounter == key_repeat_delay_10ms) { // initial delay after pressed if (Key == KEY_STAR || Key == KEY_F || @@ -1178,19 +1178,19 @@ void APP_CheckKeys(void) return; } - if (gDebounceCounter > key_repeat_delay) + if (gDebounceCounter > key_repeat_delay_10ms) { // key repeat if (Key == KEY_UP || Key == KEY_DOWN) { gKeyBeingHeld = true; - if ((gDebounceCounter % key_repeat) == 0) + if ((gDebounceCounter % key_repeat_10ms) == 0) APP_ProcessKey(Key, true, true); } if (gDebounceCounter < 0xFFFF) return; - gDebounceCounter = key_repeat_delay; + gDebounceCounter = key_repeat_delay_10ms; return; } } @@ -1374,7 +1374,7 @@ void APP_TimeSlice10ms(void) GUI_SelectNextDisplay(DISPLAY_SCANNER); } - gScanDelay = g_scan_delay; + gScanDelay = scan_delay_10ms; break; case SCAN_CSS_STATE_SCANNING: @@ -1420,7 +1420,7 @@ void APP_TimeSlice10ms(void) if (gScanCssState < SCAN_CSS_STATE_FOUND) { BK4819_SetScanFrequency(gScanFrequency); - gScanDelay = g_scan_delay; + gScanDelay = scan_delay_10ms; break; } @@ -1753,7 +1753,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) if (gCurrentFunction == FUNCTION_POWER_SAVE) FUNCTION_Select(FUNCTION_FOREGROUND); - gBatterySaveCountdown = battery_save_count; + gBatterySaveCountdown = battery_save_count_10ms; if (gEeprom.AUTO_KEYPAD_LOCK) gKeyLockCountdown = 30; // 15 seconds @@ -1792,7 +1792,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) else { if (Key != KEY_PTT) - gVoltageMenuCountdown = g_menu_timeout; + gVoltageMenuCountdown = menu_timeout_10ms; BACKLIGHT_TurnOn(); diff --git a/app/main.c b/app/main.c index 43ed84e..e6402ca 100644 --- a/app/main.c +++ b/app/main.c @@ -266,7 +266,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) uint8_t Vfo = gEeprom.TX_CHANNEL; - gKeyInputCountdown = key_input_timeout; + gKeyInputCountdown = key_input_timeout_500ms; INPUTBOX_Append(Key); gRequestDisplayScreen = DISPLAY_MAIN; @@ -413,7 +413,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) return; gInputBox[--gInputBoxIndex] = 10; - gKeyInputCountdown = key_input_timeout; + gKeyInputCountdown = key_input_timeout_500ms; #ifdef ENABLE_VOICE if (gInputBoxIndex == 0) @@ -507,7 +507,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) if (gScanState == SCAN_OFF) #endif { - gKeyInputCountdown = key_input_timeout; + gKeyInputCountdown = key_input_timeout_500ms; gDTMF_InputMode = true; memcpy(gDTMF_InputBox, gDTMF_String, 15); gDTMF_InputIndex = 0; @@ -657,7 +657,7 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { // add key to DTMF string DTMF_Append(Character); - gKeyInputCountdown = key_input_timeout; + gKeyInputCountdown = key_input_timeout_500ms; gRequestDisplayScreen = DISPLAY_MAIN; gPttWasReleased = true; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; diff --git a/app/menu.c b/app/menu.c index d287ec5..ee53fd3 100644 --- a/app/menu.c +++ b/app/menu.c @@ -1444,5 +1444,5 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } if (gScreenToDisplay == DISPLAY_MENU && gMenuCursor == MENU_VOL) - gVoltageMenuCountdown = g_menu_timeout; + gVoltageMenuCountdown = menu_timeout_10ms; } diff --git a/app/scanner.c b/app/scanner.c index cc914f1..b673e8d 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -391,7 +391,7 @@ void SCANNER_Start(void) BK4819_EnableFrequencyScan(); } - gScanDelay = g_scan_delay; + gScanDelay = scan_delay_10ms; gScanCssResultCode = 0xFF; gScanCssResultType = 0xFF; gScanHitCount = 0; diff --git a/bitmaps.c b/bitmaps.c index 225c96f..a22bd90 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -5,7 +5,7 @@ // turn your monitor 90deg anti-clockwise to see the images const uint8_t BITMAP_PowerSave[] = -{ +{ // "S" 0b00000000, 0b00100110, 0b01001001, @@ -127,7 +127,7 @@ const uint8_t BITMAP_BatteryLevel5[] = }; const uint8_t BITMAP_USB_C[] = -{ +{ // USB symbol 0b00000000, 0b00011100, 0b00100111, @@ -140,7 +140,7 @@ const uint8_t BITMAP_USB_C[] = }; const uint8_t BITMAP_KeyLock[] = -{ +{ // padlock symbol 0b00000000, 0b01111100, 0b01000110, @@ -153,7 +153,7 @@ const uint8_t BITMAP_KeyLock[] = }; const uint8_t BITMAP_F_Key[] = -{ +{ // F-Key symbol 0b11111111, 0b10000001, 0b10111101, @@ -167,7 +167,7 @@ const uint8_t BITMAP_F_Key[] = }; const uint8_t BITMAP_VOX[] = -{ +{ // "VOX" 0b00000000, 0b00011111, 0b00100000, @@ -192,7 +192,7 @@ const uint8_t BITMAP_VOX[] = #if 0 const uint8_t BITMAP_WX[] = - { + { // "WX" 0b00000000, 0b01111111, 0b00100000, @@ -210,7 +210,7 @@ const uint8_t BITMAP_VOX[] = #else // 'XB' (cross-band) const uint8_t BITMAP_XB[] = - { + { // "XB" 0b00000000, 0b01100011, 0b00010100, @@ -228,7 +228,7 @@ const uint8_t BITMAP_VOX[] = #endif const uint8_t BITMAP_TDR[] = -{ +{ // "DW" 0b00000000, 0b01111111, 0b01000001, @@ -261,7 +261,7 @@ const uint8_t BITMAP_TDR[] = #ifdef ENABLE_FMRADIO const uint8_t BITMAP_FM[] = - { + { // "FM" 0b00000000, 0b01111111, 0b00001001, @@ -280,7 +280,7 @@ const uint8_t BITMAP_TDR[] = #ifdef ENABLE_NOAA const uint8_t BITMAP_NOAA[] = - { + { // "NS" 0b00000000, 0b01111111, 0b00000100, @@ -384,280 +384,8 @@ const uint8_t BITMAP_VFO_NotDefault[] = 0b00001000 }; -const uint8_t BITMAP_TX[] = -{ - 0b00000000, - 0b00000001, - 0b00000001, - 0b00000001, - 0b01111111, - 0b00000001, - 0b00000001, - 0b00000001, - - 0b00000000, - 0b01100011, - 0b00100010, - 0b00010100, - 0b00001000, - 0b00010100, - 0b00100010, - 0b01100011 -}; - -const uint8_t BITMAP_RX[] = -{ - 0b00000000, - 0b01111111, - 0b00001001, - 0b00001001, - 0b00001001, - 0b00011001, - 0b00101001, - 0b01000110, - - 0b00000000, - 0b01100011, - 0b00100010, - 0b00010100, - 0b00001000, - 0b00010100, - 0b00100010, - 0b01100011 -}; - -const uint8_t BITMAP_M[] = -{ - 0b00000000, - 0b01111111, - 0b00000010, - 0b00000100, - 0b00011000, - 0b00000100, - 0b00000010, - 0b01111111 -}; - -const uint8_t BITMAP_FB[] = -{ - 0b00000000, - 0b01111111, - 0b00001001, - 0b00001001, - 0b00001001, - 0b00001001, - 0b00001001, - 0b00000001, - - 0b00000000, - 0b01111111, - 0b01001001, - 0b01001001, - 0b01001001, - 0b01001001, - 0b01001001, - 0b00110110 -}; - -const uint8_t BITMAP_ReverseMode[] = -{ - 0b00000000, - 0b01111111, - 0b00001001, - 0b00001001, - 0b00001001, - 0b00011001, - 0b00101001, - 0b01000110 -}; - -const uint8_t BITMAP_NarrowBand[] = -{ - 0b00000000, - 0b01111111, - 0b00000010, - 0b00000100, - 0b00001000, - 0b00010000, - 0b00100000, - 0b01111111 -}; - -const uint8_t BITMAP_DTMF[] = -{ - 0b00000000, - 0b01111111, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00111110, - - 0b00000000, - 0b00000001, - 0b00000001, - 0b01111111, - 0b00000001, - 0b00000001, - - 0b00000000, - 0b01111111, - 0b00000010, - 0b00001100, - 0b00000010, - 0b01111111, - - 0b00000000, - 0b01111111, - 0b00001001, - 0b00001001, - 0b00001001, - 0b00000001 -}; - -const uint8_t BITMAP_Scramble[] = -{ - 0b00000000, - 0b00100110, - 0b01001001, - 0b01001001, - 0b01001001, - 0b00110010, - - 0b00000000, - 0b00111110, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00100010, - - 0b00000000, - 0b01111111, - 0b00001001, - 0b00011001, - 0b00101001, - 0b01000110 -}; - -const uint8_t BITMAP_Add[] = -{ - 0b00000000, - 0b00011000, - 0b00011000, - 0b01111110, - 0b01111110, - 0b01111110, - 0b00011000, - 0b00011000 -}; - -const uint8_t BITMAP_Sub[] = -{ - 0b00000000, - 0b00001100, - 0b00001100, - 0b00001100, - 0b00001100, - 0b00001100, - 0b00001100, - 0b00001100 -}; - -const uint8_t BITMAP_PowerHigh[] = -{ - 0b00000000, - 0b01111111, - 0b00001000, - 0b00001000, - 0b00001000, - 0b00001000, - 0b00001000, - 0b01111111 -}; - -const uint8_t BITMAP_PowerMid[] = -{ - 0b00000000, - 0b01111111, - 0b00000010, - 0b00000100, - 0b00011000, - 0b00000100, - 0b00000010, - 0b01111111 -}; - -const uint8_t BITMAP_PowerLow[] = -{ - 0b00000000, - 0b01111111, - 0b01000000, - 0b01000000, - 0b01000000, - 0b01000000, - 0b01000000, - 0b01000000 -}; - -const uint8_t BITMAP_AM[] = -{ - 0b00000000, - 0b01111100, - 0b00010010, - 0b00010001, - 0b00010010, - 0b01111100, - - 0b00000000, - 0b01111111, - 0b00000010, - 0b00001100, - 0b00000010, - 0b01111111 -}; - -const uint8_t BITMAP_CT[] = -{ - 0b00000000, - 0b00111110, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00100010, - - 0b00000000, - 0b00000001, - 0b00000001, - 0b01111111, - 0b00000001, - 0b00000001 -}; - -const uint8_t BITMAP_DCS[] = -{ - 0b00000000, - 0b01111111, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00111110, - - 0b00000000, - 0b00111110, - 0b01000001, - 0b01000001, - 0b01000001, - 0b00100010, - - 0b00000000, - 0b00100110, - 0b01001001, - 0b01001001, - 0b01001001, - 0b00110010 -}; - const uint8_t BITMAP_ScanList[] = -{ +{ // diamond symbol 0b00001000, 0b00011100, 0b00111110, diff --git a/bitmaps.h b/bitmaps.h index 6c3a282..082b386 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -53,32 +53,6 @@ extern const uint8_t BITMAP_CurrentIndicator[8]; extern const uint8_t BITMAP_VFO_Default[8]; extern const uint8_t BITMAP_VFO_NotDefault[8]; -extern const uint8_t BITMAP_TX[16]; -extern const uint8_t BITMAP_RX[16]; - -extern const uint8_t BITMAP_M[8]; -extern const uint8_t BITMAP_FB[16]; - -extern const uint8_t BITMAP_ReverseMode[8]; - -extern const uint8_t BITMAP_NarrowBand[8]; - -extern const uint8_t BITMAP_DTMF[24]; - -extern const uint8_t BITMAP_Scramble[18]; - -extern const uint8_t BITMAP_Add[8]; -extern const uint8_t BITMAP_Sub[8]; - -extern const uint8_t BITMAP_PowerHigh[8]; -extern const uint8_t BITMAP_PowerMid[8]; -extern const uint8_t BITMAP_PowerLow[8]; - -extern const uint8_t BITMAP_AM[12]; - -extern const uint8_t BITMAP_CT[12]; -extern const uint8_t BITMAP_DCS[18]; - extern const uint8_t BITMAP_ScanList[6]; #endif diff --git a/driver/st7565.c b/driver/st7565.c index b5a1df9..e0f0f42 100644 --- a/driver/st7565.c +++ b/driver/st7565.c @@ -63,8 +63,7 @@ void ST7565_DrawLine(uint8_t Column, uint8_t Line, uint16_t Size, const uint8_t void ST7565_BlitFullScreen(void) { - uint8_t Line; - uint8_t Column; + unsigned int Line; SPI_ToggleMasterMode(&SPI0->CR, false); @@ -72,6 +71,7 @@ void ST7565_BlitFullScreen(void) for (Line = 0; Line < 7; Line++) { + unsigned int Column; ST7565_SelectColumnAndLine(4, Line + 1); GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_A0); for (Column = 0; Column < 128; Column++) diff --git a/firmware b/firmware index 380988e..8f81a49 100644 Binary files a/firmware and b/firmware differ diff --git a/firmware.bin b/firmware.bin index 44a068c..0b7228f 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index daed101..a43b82f 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/functions.c b/functions.c index cfcea61..64ae626 100644 --- a/functions.c +++ b/functions.c @@ -183,7 +183,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function) break; } - gBatterySaveCountdown = battery_save_count; + gBatterySaveCountdown = battery_save_count_10ms; gSchedulePowerSave = false; #if defined(ENABLE_FMRADIO) gFM_RestoreCountdown = 0; diff --git a/misc.c b/misc.c index e08a2dc..a7bacb9 100644 --- a/misc.c +++ b/misc.c @@ -18,33 +18,33 @@ #include "misc.h" -const uint8_t key_input_timeout = 10; // 5 seconds +const uint8_t menu_timeout_10ms = 20 * 2; // 20 seconds -const uint16_t key_repeat_delay = 40; // 400ms -const uint16_t key_repeat = 8; // was 15 (150ms) .. MUST be less than 'key_repeat_delay' -const uint16_t key_debounce = 2; // 20ms +const uint8_t key_input_timeout_500ms = 8 * 2; // 8 seconds -const uint8_t g_scan_delay = 21; // 210ms +const uint16_t key_repeat_delay_10ms = 400 / 10; // 400ms +const uint16_t key_repeat_10ms = 80 / 10; // 80ms .. MUST be less than 'key_repeat_delay' +const uint16_t key_debounce_10ms = 20 / 10; // 20ms -const uint8_t g_menu_timeout = 2 * 15; // 15 seconds - -const uint16_t gMax_bat_v = 843; // 8.43V -const uint16_t gMin_bat_v = 660; // 6.6V - -const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92}; - -const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31}; - -const uint16_t battery_save_count = 10000 / 10; // 10 seconds +const uint8_t scan_delay_10ms = 210 / 10; // 210ms // 10ms count down resolution -const uint16_t dual_watch_count_after_tx = 3600 / 10; // 3.6 sec after TX ends -const uint16_t dual_watch_count_after_rx = 1000 / 10; // 1 sec after RX ends ? -const uint16_t dual_watch_count_after_1 = 5000 / 10; // 5 sec -const uint16_t dual_watch_count_after_2 = 3600 / 10; // 3.6 sec -const uint16_t dual_watch_count_toggle = 100 / 10; // 100ms between VFO toggles -const uint16_t dual_watch_count_noaa = 70 / 10; // 70ms -const uint16_t dual_watch_count_after_vox = 200 / 10; // 200ms +const uint16_t dual_watch_count_after_tx_10ms = 3600 / 10; // 3.6 sec after TX ends +const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec after RX ends ? +const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec +const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec +const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles +const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms +const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms + +const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds + +const uint16_t gMax_bat_v = 843; // 8.43V +const uint16_t gMin_bat_v = 660; // 6.6V + +const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BBA7F92}; + +const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31}; bool gSetting_350TX; bool gSetting_KILLED; @@ -65,14 +65,14 @@ uint8_t gEEPROM_1EC0_2[8]; uint8_t gEEPROM_1EC0_3[8]; uint16_t gEEPROM_RSSI_CALIB[3][4]; - + uint16_t gEEPROM_1F8A; uint16_t gEEPROM_1F8C; uint8_t gMR_ChannelAttributes[207]; volatile bool gNextTimeslice500ms; -volatile uint16_t gBatterySaveCountdown = battery_save_count; +volatile uint16_t gBatterySaveCountdown = battery_save_count_10ms; volatile uint16_t gDualWatchCountdown; volatile uint16_t gTxTimerCountdown; volatile uint16_t gTailNoteEliminationCountdown; diff --git a/misc.h b/misc.h index fd09a2a..2ab92ee 100644 --- a/misc.h +++ b/misc.h @@ -74,31 +74,31 @@ enum CssScanMode_t typedef enum CssScanMode_t CssScanMode_t; -extern const uint8_t key_input_timeout; +extern const uint8_t key_input_timeout_500ms; -extern const uint16_t key_repeat_delay; -extern const uint16_t key_repeat; -extern const uint16_t key_debounce; +extern const uint16_t key_repeat_delay_10ms; +extern const uint16_t key_repeat_10ms; +extern const uint16_t key_debounce_10ms; -extern const uint8_t g_scan_delay; +extern const uint8_t scan_delay_10ms; -extern const uint8_t g_menu_timeout; +extern const uint8_t menu_timeout_10ms; + +extern const uint16_t battery_save_count_10ms; + +extern const uint16_t dual_watch_count_after_tx_10ms; +extern const uint16_t dual_watch_count_after_rx_10ms; +extern const uint16_t dual_watch_count_after_1_10ms; +extern const uint16_t dual_watch_count_after_2_10ms; +extern const uint16_t dual_watch_count_toggle_10ms; +extern const uint16_t dual_watch_count_noaa_10ms; +extern const uint16_t dual_watch_count_after_vox_10ms; extern const uint16_t gMax_bat_v; extern const uint16_t gMin_bat_v; extern const uint8_t gMicGain_dB2[5]; -extern const uint16_t battery_save_count; - -extern const uint16_t dual_watch_count_after_tx; -extern const uint16_t dual_watch_count_after_rx; -extern const uint16_t dual_watch_count_after_1; -extern const uint16_t dual_watch_count_after_2; -extern const uint16_t dual_watch_count_toggle; -extern const uint16_t dual_watch_count_noaa; -extern const uint16_t dual_watch_count_after_vox; - extern bool gSetting_350TX; extern bool gSetting_KILLED; extern bool gSetting_200TX; diff --git a/radio.c b/radio.c index e3bf3a4..3104f91 100644 --- a/radio.c +++ b/radio.c @@ -842,7 +842,7 @@ void RADIO_PrepareTX(void) { if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) { - gDualWatchCountdown = dual_watch_count_after_tx; + gDualWatchCountdown = dual_watch_count_after_tx_10ms; gScheduleDualWatch = false; if (!gRxVfoIsActive) diff --git a/ui/lock.c b/ui/lock.c index a094a2d..ea5e87f 100644 --- a/ui/lock.c +++ b/ui/lock.c @@ -67,7 +67,7 @@ void UI_DisplayLock(void) if (gKeyReading0 == Key) { - if (++gDebounceCounter == key_debounce) + if (++gDebounceCounter == key_debounce_10ms) { if (Key == KEY_INVALID) { diff --git a/ui/main.c b/ui/main.c index 245a8b1..272c016 100644 --- a/ui/main.c +++ b/ui/main.c @@ -68,9 +68,7 @@ void UI_DisplayMain(void) if (!bIsSameVfo) continue; // skip the unused vfo - //Line = 1; - //pLine0 = gFrameBuffer[Line + 0]; - //pLine1 = gFrameBuffer[Line + 1]; + } if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) @@ -151,7 +149,7 @@ void UI_DisplayMain(void) if (Channel == vfo_num) { // show the TX symbol SomeValue = 1; - memcpy(pLine0 + 14, BITMAP_TX, sizeof(BITMAP_TX)); + UI_PrintStringSmall("TX", 14, 0, Line); } } } @@ -159,7 +157,7 @@ void UI_DisplayMain(void) { // receiving .. show the RX symbol SomeValue = 2; if ((gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR) && gEeprom.RX_CHANNEL == vfo_num) - memcpy(pLine0 + 14, BITMAP_RX, sizeof(BITMAP_RX)); + UI_PrintStringSmall("RX", 14, 0, Line); } if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) @@ -168,23 +166,21 @@ void UI_DisplayMain(void) const unsigned int x = 2; // show the memory channel symbol - memcpy(pLine1 + x, BITMAP_M, sizeof(BITMAP_M)); + UI_PrintStringSmall("M", x, 0, Line + 1); if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != vfo_num) NUMBER_ToDigits(gEeprom.ScreenChannel[vfo_num] + 1, String); // show the memory channel number else memcpy(String + 5, gInputBox, 3); // show the input text - UI_DisplaySmallDigits(3, String + 5, x + sizeof(BITMAP_M), Line + 1, false); + UI_DisplaySmallDigits(3, String + 5, x + 7, Line + 1, false); } else if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { const unsigned int x = 2; // was 14 // show the frequency band number - char c; - memcpy(pLine1 + x, BITMAP_FB, sizeof(BITMAP_FB)); - c = (gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST) + 1; - UI_DisplaySmallDigits(1, &c, x + sizeof(BITMAP_FB), Line + 1, false); + sprintf(String, "FB%u", 1 + gEeprom.ScreenChannel[vfo_num] - FREQ_CHANNEL_FIRST); + UI_PrintStringSmall(String, x, 0, Line + 1); } else { @@ -405,7 +401,7 @@ void UI_DisplayMain(void) if (gEeprom.VfoInfo[vfo_num].IsAM) { // show the AM symbol - memcpy(pLine1 + display_width + 27, BITMAP_AM, sizeof(BITMAP_AM)); + UI_PrintStringSmall("AM", display_width + 27, 0, Line + 1); } else { // show the CTCSS or DCS symbol @@ -416,51 +412,52 @@ void UI_DisplayMain(void) case CODE_TYPE_OFF: break; case CODE_TYPE_CONTINUOUS_TONE: // CTCSS - memcpy(pLine1 + display_width + 27, BITMAP_CT, sizeof(BITMAP_CT)); + UI_PrintStringSmall("CT", display_width + 24, 0, Line + 1); break; case CODE_TYPE_DIGITAL: case CODE_TYPE_REVERSE_DIGITAL: // DCS - memcpy(pLine1 + display_width + 24, BITMAP_DCS, sizeof(BITMAP_DCS)); + UI_PrintStringSmall("DCS", display_width + 24, 0, Line + 1); break; } } + String[0] = '?'; switch (gEeprom.VfoInfo[vfo_num].OUTPUT_POWER) { // show the TX power level symbol - case OUTPUT_POWER_LOW: - memcpy(pLine1 + display_width + 44, BITMAP_PowerLow, sizeof(BITMAP_PowerLow)); - break; - case OUTPUT_POWER_MID: - memcpy(pLine1 + display_width + 44, BITMAP_PowerMid, sizeof(BITMAP_PowerMid)); - break; - case OUTPUT_POWER_HIGH: - memcpy(pLine1 + display_width + 44, BITMAP_PowerHigh, sizeof(BITMAP_PowerHigh)); - break; + case OUTPUT_POWER_LOW: String[0] = 'L'; break; + case OUTPUT_POWER_MID: String[0] = 'M'; break; + case OUTPUT_POWER_HIGH: String[0] = 'H'; break; } + String[1] = '\0'; + UI_PrintStringSmall(String, display_width + 46, 0, Line + 1); if (gEeprom.VfoInfo[vfo_num].ConfigRX.Frequency != gEeprom.VfoInfo[vfo_num].ConfigTX.Frequency) { // show the TX offset symbol - if (gEeprom.VfoInfo[vfo_num].TX_OFFSET_FREQUENCY_DIRECTION == TX_OFFSET_FREQUENCY_DIRECTION_ADD) - memcpy(pLine1 + display_width + 54, BITMAP_Add, sizeof(BITMAP_Add)); - if (gEeprom.VfoInfo[vfo_num].TX_OFFSET_FREQUENCY_DIRECTION == TX_OFFSET_FREQUENCY_DIRECTION_SUB) - memcpy(pLine1 + display_width + 54, BITMAP_Sub, sizeof(BITMAP_Sub)); + String[0] = '\0'; + switch (gEeprom.VfoInfo[vfo_num].TX_OFFSET_FREQUENCY_DIRECTION) + { + case TX_OFFSET_FREQUENCY_DIRECTION_ADD: String[0] = '+'; break; + case TX_OFFSET_FREQUENCY_DIRECTION_SUB: String[0] = '-'; break; + } + String[1] = '\0'; + UI_PrintStringSmall(String, display_width + 54, 0, Line + 1); } // show the TX/RX reverse symbol if (gEeprom.VfoInfo[vfo_num].FrequencyReverse) - memcpy(pLine1 + display_width + 64, BITMAP_ReverseMode, sizeof(BITMAP_ReverseMode)); + UI_PrintStringSmall("R", display_width + 62, 0, Line + 1); // show the narrow band symbol if (gEeprom.VfoInfo[vfo_num].CHANNEL_BANDWIDTH == BANDWIDTH_NARROW) - memcpy(pLine1 + display_width + 74, BITMAP_NarrowBand, sizeof(BITMAP_NarrowBand)); + UI_PrintStringSmall("N", display_width + 70, 0, Line + 1); // show the DTMF decoding symbol if (gEeprom.VfoInfo[vfo_num].DTMF_DECODING_ENABLE || gSetting_KILLED) - memcpy(pLine1 + display_width + 84, BITMAP_DTMF, sizeof(BITMAP_DTMF)); + UI_PrintStringSmall("DTMF", display_width + 78, 0, Line + 1); // show the audio scramble symbol if (gEeprom.VfoInfo[vfo_num].SCRAMBLING_TYPE && gSetting_ScrambleEnable) - memcpy(pLine1 + display_width + 110, BITMAP_Scramble, sizeof(BITMAP_Scramble)); + UI_PrintStringSmall("SCR", display_width + 106, 0, Line + 1); } ST7565_BlitFullScreen(); diff --git a/ui/status.c b/ui/status.c index bf6aa6f..af633ff 100644 --- a/ui/status.c +++ b/ui/status.c @@ -26,6 +26,7 @@ #include "helper/battery.h" #include "misc.h" #include "settings.h" +//#include "ui/helper.h" #include "ui/status.h" void UI_DisplayStatus(const bool test_display)