12 Commits
v0.9 ... v0.11

Author SHA1 Message Date
Krzysiek Egzmont
d817ff7e6a Fixed RSSI calibration 2023-10-16 13:01:24 +02:00
Krzysiek Egzmont
ec4bec5b1f Flashlight SOS function 2023-10-16 00:15:04 +02:00
Krzysiek Egzmont
d7c458839c Change menu items names 2023-10-15 22:07:55 +02:00
Krzysiek Egzmont
cff2f25e56 Consolidate "T VFO" and "DUALRX" into one "RXMODE" 2023-10-15 21:52:42 +02:00
Krzysiek Egzmont
63ac84883e add execute rights to compile-with-docker.sh 2023-10-15 21:12:06 +02:00
wrobepio
f8252df281 fixed: "compiled-firmware" folder missing under linux - fixed shell variable $PWD 2023-10-14 20:26:29 +02:00
Krzysiek Egzmont
be00bb99ad FIX #28: After entering item 51(BATVOL) of the menu, the automatic lock screen cannot be unlocked 2023-10-12 20:45:26 +02:00
Krzysiek Egzmont
7e6a78ab6c FIX #26: vfo state (TX DISABLE label) update issue when FM radio disabled in Makefile 2023-10-12 00:44:52 +02:00
Krzysiek Egzmont
06c2ddf543 BUG FIX: power save never activated 2023-10-10 19:36:12 +02:00
Krzysiek Egzmont
47f1e80252 Fix #25: When you stop the scan with the PTT the Walkie stays in permanent TX 2023-10-10 17:32:58 +02:00
Krzysiek Egzmont
64bc29d362 FIX #24: lock/unlock doesn't work when FM radio active 2023-10-10 14:29:51 +02:00
Krzysiek Egzmont
8d17f5922c FIX #21: Battery symbol fix of a fix 2023-10-10 02:39:02 +02:00
21 changed files with 283 additions and 371 deletions

View File

@@ -25,7 +25,7 @@ ENABLE_F_CAL_MENU := 0
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
ENABLE_BOOT_BEEPS := 0 ENABLE_BOOT_BEEPS := 0
ENABLE_SHOW_CHARGE_LEVEL := 1 ENABLE_SHOW_CHARGE_LEVEL := 1
ENABLE_REVERSE_BAT_SYMBOL := 1 ENABLE_REVERSE_BAT_SYMBOL := 0
ENABLE_CODE_SCAN_TIMEOUT := 0 ENABLE_CODE_SCAN_TIMEOUT := 0
ENABLE_AM_FIX := 1 ENABLE_AM_FIX := 1
ENABLE_AM_FIX_SHOW_DATA := 0 ENABLE_AM_FIX_SHOW_DATA := 0

View File

@@ -45,6 +45,7 @@ static void ACTION_FlashLight(void)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
break; break;
case 1: case 1:
case 2:
gFlashLightState++; gFlashLightState++;
break; break;
default: default:

148
app/app.c
View File

@@ -1189,8 +1189,7 @@ void APP_Update(void)
{ {
gBatterySaveCountdown_10ms = battery_save_count_10ms; gBatterySaveCountdown_10ms = battery_save_count_10ms;
} }
else else if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode)
{ {
//if (gCurrentFunction != FUNCTION_POWER_SAVE) //if (gCurrentFunction != FUNCTION_POWER_SAVE)
FUNCTION_Select(FUNCTION_POWER_SAVE); FUNCTION_Select(FUNCTION_POWER_SAVE);
@@ -1288,16 +1287,15 @@ void APP_Update(void)
// called every 10ms // called every 10ms
void APP_CheckKeys(void) void APP_CheckKeys(void)
{ {
KEY_Code_t Key; #ifdef ENABLE_AIRCOPY
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY))
#ifdef ENABLE_AIRCOPY return;
if (gSetting_KILLED || (gScreenToDisplay == DISPLAY_AIRCOPY && gAircopyState != AIRCOPY_READY)) #else
return; if (gSetting_KILLED)
#else return;
if (gSetting_KILLED) #endif
return;
#endif
// -------------------- PTT ------------------------
if (gPttIsPressed) if (gPttIsPressed)
{ {
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || gSerialConfigCountDown_500ms > 0) if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) || gSerialConfigCountDown_500ms > 0)
@@ -1313,8 +1311,7 @@ void APP_CheckKeys(void)
else else
gPttDebounceCounter = 0; gPttDebounceCounter = 0;
} }
else else if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && gSerialConfigCountDown_500ms == 0)
{ // PTT pressed { // PTT pressed
if (++gPttDebounceCounter >= 3) // 30ms if (++gPttDebounceCounter >= 3) // 30ms
{ // start transmitting { // start transmitting
@@ -1327,16 +1324,16 @@ void APP_CheckKeys(void)
else else
gPttDebounceCounter = 0; gPttDebounceCounter = 0;
// ***************** // --------------------- OTHER KEYS ----------------------------
// scan the hardware keys // scan the hardware keys
Key = KEYBOARD_Poll(); KEY_Code_t Key = KEYBOARD_Poll();
if (Key != KEY_INVALID) if (Key != KEY_INVALID) // any key pressed
boot_counter_10ms = 0; // cancel boot screen/beeps if any key pressed boot_counter_10ms = 0; // cancel boot screen/beeps if any key pressed
if (gKeyReading0 != Key) if (gKeyReading0 != Key) // new key pressed
{ // new key pressed {
if (gKeyReading0 != KEY_INVALID && Key != KEY_INVALID) if (gKeyReading0 != KEY_INVALID && Key != KEY_INVALID)
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // key pressed without releasing previous key APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // key pressed without releasing previous key
@@ -1346,18 +1343,19 @@ void APP_CheckKeys(void)
return; return;
} }
if (++gDebounceCounter == key_debounce_10ms) gDebounceCounter++;
{ // debounced new key pressed
if (Key == KEY_INVALID) if (gDebounceCounter == key_debounce_10ms) // debounced new key pressed
{
if (Key == KEY_INVALID) //all PTT keys released
{ {
if (gKeyReading1 != KEY_INVALID) if (gKeyReading1 != KEY_INVALID) // some button was pressed before
{ {
APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); APP_ProcessKey(gKeyReading1, false, gKeyBeingHeld); // process last button released event
gKeyReading1 = KEY_INVALID; gKeyReading1 = KEY_INVALID;
} }
} }
else else // process new key pressed
{ {
gKeyReading1 = Key; gKeyReading1 = Key;
APP_ProcessKey(Key, true, false); APP_ProcessKey(Key, true, false);
@@ -1367,21 +1365,19 @@ void APP_CheckKeys(void)
return; return;
} }
if (gDebounceCounter < key_repeat_delay_10ms) if (gDebounceCounter < key_repeat_delay_10ms || Key == KEY_INVALID) // the button is not held long enough for repeat yet, or not really pressed
return; return;
// key is being held pressed if (gDebounceCounter == key_repeat_delay_10ms) //initial key repeat with longer delay
{
if (gDebounceCounter == key_repeat_delay_10ms)
{ // initial key repeat delay after pressed
if (Key != KEY_PTT) if (Key != KEY_PTT)
{ {
gKeyBeingHeld = true; gKeyBeingHeld = true;
APP_ProcessKey(Key, true, true); APP_ProcessKey(Key, true, true);
} }
} }
else else //subsequent fast key repeats
{ // key repeat {
if (Key == KEY_UP || Key == KEY_DOWN) if (Key == KEY_UP || Key == KEY_DOWN)
{ {
gKeyBeingHeld = true; gKeyBeingHeld = true;
@@ -1392,7 +1388,7 @@ void APP_CheckKeys(void)
if (gDebounceCounter < 0xFFFF) if (gDebounceCounter < 0xFFFF)
return; return;
gDebounceCounter = key_repeat_delay_10ms; gDebounceCounter = key_repeat_delay_10ms+1;
} }
} }
@@ -1451,6 +1447,35 @@ void APP_TimeSlice10ms(void)
if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0)
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
else if(gFlashLightState == FLASHLIGHT_SOS) {
const uint16_t u = 15;
static uint8_t c;
static uint16_t next;
if(gFlashLightBlinkCounter - next > 7*u) {
c = 0;
next = gFlashLightBlinkCounter+1;
}
else if(gFlashLightBlinkCounter == next) {
if(c==0) {
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
}
else
GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
if(c == 18) {
next += 7*u;
c = 0;
}
else if(c==7 || c==9 || c==11)
next += 3*u;
else
next += u;
c++;
}
}
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
if (gVoxResumeCountdown > 0) if (gVoxResumeCountdown > 0)
@@ -1827,7 +1852,7 @@ void APP_TimeSlice500ms(void)
if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND)) if (gScanStateDir == SCAN_OFF && (gScreenToDisplay != DISPLAY_SCANNER || gScanCssState >= SCAN_CSS_STATE_FOUND))
#endif #endif
{ {
if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode) if (gEeprom.AUTO_KEYPAD_LOCK && gKeyLockCountdown > 0 && !gDTMF_InputMode && gScreenToDisplay != DISPLAY_MENU)
{ {
if (--gKeyLockCountdown == 0) if (--gKeyLockCountdown == 0)
gEeprom.KEY_LOCK = true; // lock the keyboard gEeprom.KEY_LOCK = true; // lock the keyboard
@@ -1899,24 +1924,24 @@ void APP_TimeSlice500ms(void)
if (gCurrentFunction != FUNCTION_POWER_SAVE && gCurrentFunction != FUNCTION_TRANSMIT) if (gCurrentFunction != FUNCTION_POWER_SAVE && gCurrentFunction != FUNCTION_TRANSMIT)
updateRSSI(gEeprom.RX_VFO); updateRSSI(gEeprom.RX_VFO);
#ifdef ENABLE_FMRADIO if (!gPttIsPressed && gVFOStateResumeCountdown_500ms > 0)
if (!gPttIsPressed && gFM_ResumeCountdown_500ms > 0) {
if (--gVFOStateResumeCountdown_500ms == 0)
{ {
if (--gFM_ResumeCountdown_500ms == 0) RADIO_SetVfoState(VFO_STATE_NORMAL);
{ #ifdef ENABLE_FMRADIO
RADIO_SetVfoState(VFO_STATE_NORMAL); if (gCurrentFunction != FUNCTION_RECEIVE &&
gCurrentFunction != FUNCTION_TRANSMIT &&
if (gCurrentFunction != FUNCTION_RECEIVE && gCurrentFunction != FUNCTION_MONITOR &&
gCurrentFunction != FUNCTION_TRANSMIT && gFmRadioMode)
gCurrentFunction != FUNCTION_MONITOR && { // switch back to FM radio mode
gFmRadioMode) FM_Start();
{ // switch back to FM radio mode GUI_SelectNextDisplay(DISPLAY_FM);
FM_Start();
GUI_SelectNextDisplay(DISPLAY_FM);
}
} }
#endif
} }
#endif }
if (gLowBattery) if (gLowBattery)
{ {
@@ -2226,8 +2251,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
} }
} }
else else if (gPttWasReleased)
if (gPttWasReleased)
{ {
if (bKeyHeld) if (bKeyHeld)
bFlag = true; bFlag = true;
@@ -2249,9 +2273,9 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting { // transmitting
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (gAlarmState == ALARM_STATE_OFF) if (gAlarmState == ALARM_STATE_OFF)
#endif #endif
{ {
char Code; char Code;
@@ -2306,7 +2330,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
BK4819_PlayDTMFEx(gEeprom.DTMF_SIDE_TONE, Code); BK4819_PlayDTMFEx(gEeprom.DTMF_SIDE_TONE, Code);
} }
} }
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
else else
if ((!bKeyHeld && bKeyPressed) || (gAlarmState == ALARM_STATE_TX1750 && bKeyHeld && !bKeyPressed)) if ((!bKeyHeld && bKeyPressed) || (gAlarmState == ALARM_STATE_TX1750 && bKeyHeld && !bKeyPressed))
{ {
@@ -2323,7 +2347,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (!bKeyHeld) if (!bKeyHeld)
gPttWasReleased = true; gPttWasReleased = true;
} }
#endif #endif
} }
else else
if (Key != KEY_SIDE1 && Key != KEY_SIDE2) if (Key != KEY_SIDE1 && Key != KEY_SIDE2)
@@ -2331,6 +2355,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
switch (gScreenToDisplay) switch (gScreenToDisplay)
{ {
case DISPLAY_MAIN: case DISPLAY_MAIN:
MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld); MAIN_ProcessKeys(Key, bKeyPressed, bKeyHeld);
// bKeyHeld = false; // allow the channel setting to be saved // bKeyHeld = false; // allow the channel setting to be saved
break; break;
@@ -2361,16 +2386,15 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
} }
} }
else else
#ifdef ENABLE_AIRCOPY #ifdef ENABLE_AIRCOPY
if (gScreenToDisplay != DISPLAY_SCANNER && gScreenToDisplay != DISPLAY_AIRCOPY) if (gScreenToDisplay != DISPLAY_SCANNER && gScreenToDisplay != DISPLAY_AIRCOPY)
#else #else
if (gScreenToDisplay != DISPLAY_SCANNER) if (gScreenToDisplay != DISPLAY_SCANNER)
#endif #endif
{ {
ACTION_Handle(Key, bKeyPressed, bKeyHeld); ACTION_Handle(Key, bKeyPressed, bKeyHeld);
} }
else else if (!bKeyHeld && bKeyPressed)
if (!bKeyHeld && bKeyPressed)
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
} }

View File

@@ -45,7 +45,6 @@ bool gFM_AutoScan;
uint8_t gFM_ChannelPosition; uint8_t gFM_ChannelPosition;
bool gFM_FoundFrequency; bool gFM_FoundFrequency;
bool gFM_AutoScan; bool gFM_AutoScan;
uint8_t gFM_ResumeCountdown_500ms;
uint16_t gFM_RestoreCountdown_10ms; uint16_t gFM_RestoreCountdown_10ms;
bool FM_CheckValidChannel(uint8_t Channel) bool FM_CheckValidChannel(uint8_t Channel)

View File

@@ -39,7 +39,6 @@ extern uint8_t gFM_ChannelPosition;
extern uint16_t gFM_FrequencyDeviation; extern uint16_t gFM_FrequencyDeviation;
extern bool gFM_FoundFrequency; extern bool gFM_FoundFrequency;
extern bool gFM_AutoScan; extern bool gFM_AutoScan;
extern uint8_t gFM_ResumeCountdown_500ms;
extern uint16_t gFM_RestoreCountdown_10ms; extern uint16_t gFM_RestoreCountdown_10ms;
bool FM_CheckValidChannel(uint8_t Channel); bool FM_CheckValidChannel(uint8_t Channel);

View File

@@ -37,26 +37,22 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
{ {
if (gInputBoxIndex > 0) if (gInputBoxIndex > 0)
{ {
if (!bKeyHeld && bKeyPressed) if (!bKeyHeld && bKeyPressed) // short pressed
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return; return;
} }
if (bKeyHeld || !bKeyPressed) if (bKeyHeld || !bKeyPressed) // held or released
{ {
if (bKeyHeld || bKeyPressed) if (bKeyHeld || bKeyPressed) // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
{ {
if (!bKeyHeld) if (!bKeyHeld) // won't ever pass
return; return;
if (!bKeyPressed) if (!bKeyPressed) // won't ever pass
return; return;
if (gScreenToDisplay != DISPLAY_MENU && if (gScreenToDisplay != DISPLAY_MENU &&
gScreenToDisplay != DISPLAY_FM &&
#ifdef ENABLE_FMRADIO
!gFmRadioMode &&
#endif
gCurrentFunction != FUNCTION_TRANSMIT) gCurrentFunction != FUNCTION_TRANSMIT)
{ // toggle the keyboad lock { // toggle the keyboad lock
@@ -69,7 +65,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
gRequestSaveSettings = true; gRequestSaveSettings = true;
} }
} }
else else // released
{ {
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM) if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
@@ -79,7 +75,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
return; return;
#endif #endif
gWasFKeyPressed = !gWasFKeyPressed; gWasFKeyPressed = !gWasFKeyPressed; // toggle F function
if (gWasFKeyPressed) if (gWasFKeyPressed)
gKeyInputCountdown = key_input_timeout_500ms; gKeyInputCountdown = key_input_timeout_500ms;
@@ -92,7 +88,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
gUpdateStatus = true; gUpdateStatus = true;
} }
} }
else else // short pressed
{ {
if (gScreenToDisplay != DISPLAY_FM) if (gScreenToDisplay != DISPLAY_FM)
{ {
@@ -101,7 +97,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
} }
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFM_ScanState == FM_SCAN_OFF) if (gFM_ScanState == FM_SCAN_OFF) // not scanning
{ {
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
return; return;
@@ -120,7 +116,6 @@ void GENERIC_Key_PTT(bool bKeyPressed)
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0) if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
{ // PTT released { // PTT released
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // we are transmitting .. stop { // we are transmitting .. stop
@@ -185,22 +180,22 @@ void GENERIC_Key_PTT(bool bKeyPressed)
goto cancel_tx; goto cancel_tx;
} }
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gFM_ScanState != FM_SCAN_OFF) if (gFM_ScanState != FM_SCAN_OFF)
{ // FM radio is scanning .. stop { // FM radio is scanning .. stop
FM_PlayAndUpdate(); FM_PlayAndUpdate();
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = VOICE_ID_SCANNING_STOP; gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
#endif #endif
gRequestDisplayScreen = DISPLAY_FM; gRequestDisplayScreen = DISPLAY_FM;
goto cancel_tx; goto cancel_tx;
} }
#endif #endif
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
if (gScreenToDisplay == DISPLAY_FM) if (gScreenToDisplay == DISPLAY_FM)
goto start_tx; // listening to the FM radio .. start TX'ing goto start_tx; // listening to the FM radio .. start TX'ing
#endif #endif
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0) if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
{ // already transmitting { // already transmitting
@@ -259,7 +254,6 @@ start_tx:
cancel_tx: cancel_tx:
if (gPttIsPressed) if (gPttIsPressed)
{ {
gPttIsPressed = false;
gPttWasPressed = true; gPttWasPressed = true;
} }

View File

@@ -139,12 +139,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
case MENU_TDR: case MENU_TDR:
*pMin = 0; *pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_CHAN) - 1; *pMax = ARRAY_SIZE(gSubMenu_RXMode) - 1;
break;
case MENU_XB:
*pMin = 0;
*pMax = ARRAY_SIZE(gSubMenu_XB) - 1;
break; break;
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -510,7 +505,7 @@ void MENU_AcceptSetting(void)
gEeprom.VOX_SWITCH = gSubMenuSelection != 0; gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
if (gEeprom.VOX_SWITCH) if (gEeprom.VOX_SWITCH)
gEeprom.VOX_LEVEL = gSubMenuSelection - 1; gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
BOARD_EEPROM_LoadMoreSettings(); BOARD_EEPROM_LoadCalibration();
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
gUpdateStatus = true; gUpdateStatus = true;
break; break;
@@ -525,24 +520,13 @@ void MENU_AcceptSetting(void)
break; break;
case MENU_TDR: case MENU_TDR:
gEeprom.DUAL_WATCH = gSubMenuSelection; gEeprom.DUAL_WATCH = (gEeprom.TX_VFO + 1) * (gSubMenuSelection & 1);
gEeprom.CROSS_BAND_RX_TX = (gEeprom.TX_VFO + 1) * ((gSubMenuSelection & 2) > 0);
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
gUpdateStatus = true; gUpdateStatus = true;
break; break;
case MENU_XB:
#ifdef ENABLE_NOAA
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
return;
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
return;
#endif
gEeprom.CROSS_BAND_RX_TX = gSubMenuSelection;
gFlagReconfigureVfos = true;
gUpdateStatus = true;
break;
case MENU_BEEP: case MENU_BEEP:
gEeprom.BEEP_CONTROL = gSubMenuSelection; gEeprom.BEEP_CONTROL = gSubMenuSelection;
break; break;
@@ -595,7 +579,7 @@ void MENU_AcceptSetting(void)
case MENU_MIC: case MENU_MIC:
gEeprom.MIC_SENSITIVITY = gSubMenuSelection; gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
BOARD_EEPROM_LoadMoreSettings(); BOARD_EEPROM_LoadCalibration();
gFlagReconfigureVfos = true; gFlagReconfigureVfos = true;
break; break;
@@ -956,11 +940,7 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_TDR: case MENU_TDR:
gSubMenuSelection = gEeprom.DUAL_WATCH; gSubMenuSelection = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
break;
case MENU_XB:
gSubMenuSelection = gEeprom.CROSS_BAND_RX_TX;
break; break;
case MENU_BEEP: case MENU_BEEP:

View File

@@ -197,26 +197,27 @@ const uint8_t BITMAP_F_Key[6] =
}; };
#endif #endif
const uint8_t BITMAP_TDR1[12] = const uint8_t BITMAP_TDR1[15] =
{ // "DW" { // "DWR"
0b00000000,
0b01111111, 0b01111111,
0b01000001, 0b01000001,
0b01000001, 0b01000001,
0b01000001,
0b00111110, 0b00111110,
0b00000000, 0b00000000,
0b01111111, 0b01111111,
0b00100000, 0b00100000,
0b00011000, 0b00011000,
0b00100000, 0b00100000,
0b01111111 0b01111111,
0b00000000,
0b01111111,
0b00011001,
0b00101001,
0b01000110
}; };
const uint8_t BITMAP_TDR2[12] = const uint8_t BITMAP_TDR2[9] =
{ // "><" .. DW on hold { // "><" .. DW on hold
0b00000000,
0b00000000,
0b00100010, 0b00100010,
0b00110110, 0b00110110,
0b00011100, 0b00011100,
@@ -226,7 +227,6 @@ const uint8_t BITMAP_TDR2[12] =
0b00011100, 0b00011100,
0b00110110, 0b00110110,
0b00100010, 0b00100010,
0b00000000
}; };
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -244,27 +244,8 @@ const uint8_t BITMAP_TDR2[12] =
}; };
#endif #endif
#ifdef ENABLE_FMRADIO
const uint8_t BITMAP_FM[12] =
{ // "FM"
0b00000000,
0b01111111,
0b00001001,
0b00001001,
0b00001001,
0b00000001,
0b00000000,
0b01111111,
0b00000010,
0b00001100,
0b00000010,
0b01111111
};
#endif
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
const uint8_t BITMAP_NOAA[12] = const uint8_t BITMAP_NOAA[11] =
{ // "NS" { // "NS"
0b00000000, 0b00000000,
0b01111111, 0b01111111,
@@ -272,12 +253,10 @@ const uint8_t BITMAP_TDR2[12] =
0b00001000, 0b00001000,
0b00010000, 0b00010000,
0b01111111, 0b01111111,
0b00000000, 0b00000000,
0b01000110, 0b01000110,
0b01001001, 0b01001001,
0b01001001, 0b01001001,
0b01001001,
0b00110001 0b00110001
}; };
#endif #endif

View File

@@ -25,25 +25,17 @@ extern const uint8_t BITMAP_F_Key[6];
extern const uint8_t BITMAP_VOX[18]; extern const uint8_t BITMAP_VOX[18];
#endif #endif
#if 0 extern const uint8_t BITMAP_XB[12];
extern const uint8_t BITMAP_WX[12];
#else
extern const uint8_t BITMAP_XB[12];
#endif
extern const uint8_t BITMAP_TDR1[12]; extern const uint8_t BITMAP_TDR1[15];
extern const uint8_t BITMAP_TDR2[12]; extern const uint8_t BITMAP_TDR2[9];
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
extern const uint8_t BITMAP_VoicePrompt[9]; extern const uint8_t BITMAP_VoicePrompt[9];
#endif #endif
#ifdef ENABLE_FMRADIO
extern const uint8_t BITMAP_FM[12];
#endif
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
extern const uint8_t BITMAP_NOAA[12]; extern const uint8_t BITMAP_NOAA[11];
#endif #endif
extern const uint8_t BITMAP_Antenna[5]; extern const uint8_t BITMAP_Antenna[5];

10
board.c
View File

@@ -739,14 +739,14 @@ void BOARD_EEPROM_Init(void)
} }
} }
void BOARD_EEPROM_LoadMoreSettings(void) void BOARD_EEPROM_LoadCalibration(void)
{ {
// uint8_t Mic; // uint8_t Mic;
EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8); EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8);
memmove(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8); memcpy(gEEPROM_RSSI_CALIB[4], gEEPROM_RSSI_CALIB[3], 8);
memmove(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8); memcpy(gEEPROM_RSSI_CALIB[5], gEEPROM_RSSI_CALIB[3], 8);
memmove(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8); memcpy(gEEPROM_RSSI_CALIB[6], gEEPROM_RSSI_CALIB[3], 8);
// 8 * 16-bit values // 8 * 16-bit values
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[0], 8); EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[0], 8);

View File

@@ -27,7 +27,7 @@ void BOARD_ADC_Init(void);
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent); void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
void BOARD_Init(void); void BOARD_Init(void);
void BOARD_EEPROM_Init(void); void BOARD_EEPROM_Init(void);
void BOARD_EEPROM_LoadMoreSettings(void); void BOARD_EEPROM_LoadCalibration(void);
uint32_t BOARD_fetchChannelFrequency(const int channel); uint32_t BOARD_fetchChannelFrequency(const int channel);
void BOARD_fetchChannelName(char *s, const int channel); void BOARD_fetchChannelName(char *s, const int channel);
void BOARD_FactoryReset(bool bIsAll); void BOARD_FactoryReset(bool bIsAll);

2
compile-with-docker.sh Normal file → Executable file
View File

@@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
docker build -t uvk5 . docker build -t uvk5 .
docker run -v $(PWD)/compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/" docker run -v ${PWD}/compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/"

2
main.c
View File

@@ -84,7 +84,7 @@ void Main(void)
BOARD_EEPROM_Init(); BOARD_EEPROM_Init();
BOARD_EEPROM_LoadMoreSettings(); BOARD_EEPROM_LoadCalibration();
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD); RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);

12
misc.c
View File

@@ -19,12 +19,13 @@
#include "misc.h" #include "misc.h"
#include "settings.h" #include "settings.h"
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
const uint8_t vfo_state_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
@@ -109,12 +110,7 @@ bool bHasCustomAesKey;
uint32_t gChallenge[4]; uint32_t gChallenge[4];
uint8_t gTryCount; uint8_t gTryCount;
uint8_t gEEPROM_1EC0_0[8]; uint16_t gEEPROM_RSSI_CALIB[7][4];
uint8_t gEEPROM_1EC0_1[8];
uint8_t gEEPROM_1EC0_2[8];
uint8_t gEEPROM_1EC0_3[8];
uint16_t gEEPROM_RSSI_CALIB[2][4];
uint16_t gEEPROM_1F8A; uint16_t gEEPROM_1F8A;
uint16_t gEEPROM_1F8C; uint16_t gEEPROM_1F8C;
@@ -141,6 +137,8 @@ volatile bool gTxTimeoutReached;
volatile uint16_t gTailNoteEliminationCountdown_10ms; volatile uint16_t gTailNoteEliminationCountdown_10ms;
volatile uint8_t gVFOStateResumeCountdown_500ms;
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
volatile uint16_t gNOAA_Countdown_10ms; volatile uint16_t gNOAA_Countdown_10ms;
#endif #endif

14
misc.h
View File

@@ -52,7 +52,8 @@ enum {
enum { enum {
FLASHLIGHT_OFF = 0, FLASHLIGHT_OFF = 0,
FLASHLIGHT_ON, FLASHLIGHT_ON,
FLASHLIGHT_BLINK FLASHLIGHT_BLINK,
FLASHLIGHT_SOS
}; };
enum { enum {
@@ -93,12 +94,13 @@ enum scan_next_chan_t {
}; };
typedef enum scan_next_chan_t scan_next_chan_t; typedef enum scan_next_chan_t scan_next_chan_t;
extern const uint8_t fm_resume_countdown_500ms;
extern const uint8_t fm_radio_countdown_500ms; extern const uint8_t fm_radio_countdown_500ms;
extern const uint16_t fm_play_countdown_scan_10ms; extern const uint16_t fm_play_countdown_scan_10ms;
extern const uint16_t fm_play_countdown_noscan_10ms; extern const uint16_t fm_play_countdown_noscan_10ms;
extern const uint16_t fm_restore_countdown_10ms; extern const uint16_t fm_restore_countdown_10ms;
extern const uint8_t vfo_state_resume_countdown_500ms;
extern const uint8_t menu_timeout_500ms; extern const uint8_t menu_timeout_500ms;
extern const uint16_t menu_timeout_long_500ms; extern const uint16_t menu_timeout_long_500ms;
@@ -182,12 +184,7 @@ extern bool bHasCustomAesKey;
extern uint32_t gChallenge[4]; extern uint32_t gChallenge[4];
extern uint8_t gTryCount; extern uint8_t gTryCount;
extern uint8_t gEEPROM_1EC0_0[8]; extern uint16_t gEEPROM_RSSI_CALIB[7][4];
extern uint8_t gEEPROM_1EC0_1[8];
extern uint8_t gEEPROM_1EC0_2[8];
extern uint8_t gEEPROM_1EC0_3[8];
extern uint16_t gEEPROM_RSSI_CALIB[2][4];
extern uint16_t gEEPROM_1F8A; extern uint16_t gEEPROM_1F8A;
extern uint16_t gEEPROM_1F8C; extern uint16_t gEEPROM_1F8C;
@@ -319,6 +316,7 @@ extern volatile bool gNextTimeslice40ms;
extern volatile bool gScheduleNOAA; extern volatile bool gScheduleNOAA;
#endif #endif
extern volatile bool gFlagTailNoteEliminationComplete; extern volatile bool gFlagTailNoteEliminationComplete;
extern volatile uint8_t gVFOStateResumeCountdown_500ms;
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
extern volatile bool gScheduleFM; extern volatile bool gScheduleFM;
#endif #endif

View File

@@ -898,10 +898,7 @@ void RADIO_SetVfoState(VfoState_t State)
{ {
VfoState[0] = VFO_STATE_NORMAL; VfoState[0] = VFO_STATE_NORMAL;
VfoState[1] = VFO_STATE_NORMAL; VfoState[1] = VFO_STATE_NORMAL;
gVFOStateResumeCountdown_500ms = 0;
#ifdef ENABLE_FMRADIO
gFM_ResumeCountdown_500ms = 0;
#endif
} }
else else
{ {
@@ -916,9 +913,7 @@ void RADIO_SetVfoState(VfoState_t State)
VfoState[vfo] = State; VfoState[vfo] = State;
} }
#ifdef ENABLE_FMRADIO gVFOStateResumeCountdown_500ms = vfo_state_resume_countdown_500ms;
gFM_ResumeCountdown_500ms = fm_resume_countdown_500ms;
#endif
} }
gUpdateDisplay = true; gUpdateDisplay = true;

View File

@@ -24,34 +24,33 @@
void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink) void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink)
{ {
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1)); if (level < 2 && blink == 1) {
memset(bitmap, 0, sizeof(BITMAP_BatteryLevel1));
if (level >= 1)
{
unsigned int i;
uint8_t bars = level > 0 ? level - 1 : 0;
if(bars>4) bars = 4;
for (i = 0; i < bars; i++)
{
#ifndef ENABLE_REVERSE_BAT_SYMBOL
memcpy(bitmap + sizeof(bitmap) - 4 - (i * 3), BITMAP_BatteryLevel, 2);
#else
memcpy(bitmap + 3 + (i * 3) + 0, BITMAP_BatteryLevel, 2);
#endif
}
} }
else else
if (blink == 0) {
memset(bitmap, 0, sizeof(bitmap)); memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
if (level > 1)
{
unsigned int i;
uint8_t bars = level - 1;
if (bars > 4)
bars = 4;
for (i = 0; i < bars; i++)
{
#ifndef ENABLE_REVERSE_BAT_SYMBOL
memcpy(bitmap + sizeof(BITMAP_BatteryLevel1) - 4 - (i * 3), BITMAP_BatteryLevel, 2);
#else
memcpy(bitmap + 3 + (i * 3) + 0, BITMAP_BatteryLevel, 2);
#endif
}
}
}
} }
void UI_DisplayBattery(uint8_t level, uint8_t blink) void UI_DisplayBattery(uint8_t level, uint8_t blink)
{ {
if (gCurrentFunction != FUNCTION_TRANSMIT) { uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)]; UI_DrawBattery(bitmap, level, blink);
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
UI_DrawBattery(bitmap, level, blink);
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
}
} }

View File

@@ -58,8 +58,8 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3)); case 4: memmove(p + 11, BITMAP_AntennaLevel3, sizeof(BITMAP_AntennaLevel3));
case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2)); case 3: memmove(p + 8, BITMAP_AntennaLevel2, sizeof(BITMAP_AntennaLevel2));
case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1)); case 2: memmove(p + 5, BITMAP_AntennaLevel1, sizeof(BITMAP_AntennaLevel1));
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); break;
case 0: break; case 0: memset( p + 0, 0, sizeof(BITMAP_Antenna)); break;
} }
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@@ -218,24 +218,13 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
const uint8_t Line = (vfo == 0) ? 3 : 7; const uint8_t Line = (vfo == 0) ? 3 : 7;
uint8_t *p_line = gFrameBuffer[Line - 1]; uint8_t *p_line = gFrameBuffer[Line - 1];
// TODO: sort out all 8 values from the eeprom
#if 0 const unsigned int band = gRxVfo->Band;
// dBm -105 -100 -95 -90 -70 -65 -60 -55 const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
// RSSI 110 120 130 140 180 190 200 210 const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
// 0000C0 6E 00 78 00 82 00 8C 00 B4 00 BE 00 C8 00 D2 00 const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
// const int16_t level3 = gEEPROM_RSSI_CALIB[band][3];
const unsigned int band = 1;
const int16_t level0 = gEEPROM_RSSI_CALIB[band][0];
const int16_t level1 = gEEPROM_RSSI_CALIB[band][1];
const int16_t level2 = gEEPROM_RSSI_CALIB[band][2];
const int16_t level3 = gEEPROM_RSSI_CALIB[band][3];
#else
const int16_t level0 = (-115 + 160) * 2; // dB
const int16_t level1 = ( -89 + 160) * 2; // dB
const int16_t level2 = ( -64 + 160) * 2; // dB
const int16_t level3 = ( -39 + 160) * 2; // dB
#endif
const int16_t level01 = (level0 + level1) / 2; const int16_t level01 = (level0 + level1) / 2;
const int16_t level12 = (level1 + level2) / 2; const int16_t level12 = (level1 + level2) / 2;
const int16_t level23 = (level2 + level3) / 2; const int16_t level23 = (level2 + level3) / 2;
@@ -314,30 +303,23 @@ void UI_DisplayMain(void)
return; return;
} }
unsigned int activeTxVFO = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
for (vfo_num = 0; vfo_num < 2; vfo_num++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
{ {
const unsigned int line = (vfo_num == 0) ? line0 : line1; const unsigned int line = (vfo_num == 0) ? line0 : line1;
unsigned int channel = gEeprom.TX_VFO; const bool isTxVFO = (vfo_num == gEeprom.TX_VFO);
// unsigned int tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
const bool same_vfo = (channel == vfo_num) ? true : false;
uint8_t *p_line0 = gFrameBuffer[line + 0]; uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1]; uint8_t *p_line1 = gFrameBuffer[line + 1];
unsigned int mode = 0; unsigned int mode = 0;
unsigned int state;
if (single_vfo) if (single_vfo)
{ // we're in single VFO mode - screen is dedicated to just one VFO { // we're in single VFO mode - screen is dedicated to just one VFO
if (!isTxVFO)
if (!same_vfo)
continue; // skip the unused vfo continue; // skip the unused vfo
} }
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF && gRxVfoIsActive) if (activeTxVFO != vfo_num)
channel = gEeprom.RX_VFO; // we're currently monitoring the other VFO
if (channel != vfo_num)
{ {
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode) if (gDTMF_CallState != DTMF_CALL_STATE_NONE || gDTMF_IsTx || gDTMF_InputMode)
{ // show DTMF stuff { // show DTMF stuff
@@ -382,19 +364,14 @@ void UI_DisplayMain(void)
} }
// highlight the selected/used VFO with a marker // highlight the selected/used VFO with a marker
if (!single_vfo && same_vfo) if (!single_vfo && isTxVFO)
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
} }
else else if (!single_vfo)
if (!single_vfo)
{ // highlight the selected/used VFO with a marker { // highlight the selected/used VFO with a marker
if (same_vfo) if (isTxVFO)
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else else
//if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
} }
@@ -407,8 +384,8 @@ void UI_DisplayMain(void)
else else
#endif #endif
{ {
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO; activeTxVFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
if (channel == vfo_num) if (activeTxVFO == vfo_num)
{ // show the TX symbol { // show the TX symbol
mode = 1; mode = 1;
#ifdef ENABLE_SMALL_BOLD #ifdef ENABLE_SMALL_BOLD
@@ -472,7 +449,7 @@ void UI_DisplayMain(void)
// ************ // ************
state = VfoState[vfo_num]; unsigned int state = VfoState[vfo_num];
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM) if (gCurrentFunction == FUNCTION_TRANSMIT && gAlarmState == ALARM_STATE_ALARM)
@@ -501,8 +478,8 @@ void UI_DisplayMain(void)
uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency; uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency;
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT)
{ // transmitting { // transmitting
channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO; activeTxVFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
if (channel == vfo_num) if (activeTxVFO == vfo_num)
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency; frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
} }

145
ui/menu.c
View File

@@ -43,71 +43,70 @@ const t_menu_item MenuList[] =
{ {
// text, voice ID, menu ID // text, voice ID, menu ID
{"SQL", VOICE_ID_SQUELCH, MENU_SQL }, {"Sql", VOICE_ID_SQUELCH, MENU_SQL },
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP }, {"Step", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
{"T PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP" {"TxPwr", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
{"R DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS" {"RxDCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
{"R CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS" {"RxCTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
{"T DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS" {"TxDCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
{"T CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS" {"TxCTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
{"T DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D" {"TxODir", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
{"T OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET" {"TxOffs", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
{"T VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX" {"TxTOut", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
{"T TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N }, {"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR" {"Scramb", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL" {"BusyCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
{"CH SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH" {"ChSave", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
{"CH DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH" {"ChDele", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
{"CH NAM", VOICE_ID_INVALID, MENU_MEM_NAME }, {"ChName", VOICE_ID_INVALID, MENU_MEM_NAME },
{"CH DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF" {"ChDisp", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE" {"BatSav", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
{"VOX", VOICE_ID_VOX, MENU_VOX }, {"VOX", VOICE_ID_VOX, MENU_VOX },
#endif #endif
{"BLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR" {"BackLt", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
{"BLTTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX }, {"BltTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR" {"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR },
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP }, {"Beep", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE }, {"Voice", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
#endif #endif
{"SC REV", VOICE_ID_INVALID, MENU_SC_REV }, {"ScnRev", VOICE_ID_INVALID, MENU_SC_REV },
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk" {"KeyLck", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
{"S ADD1", VOICE_ID_INVALID, MENU_S_ADD1 }, {"ScAdd1", VOICE_ID_INVALID, MENU_S_ADD1 },
{"S ADD2", VOICE_ID_INVALID, MENU_S_ADD2 }, {"ScAdd2", VOICE_ID_INVALID, MENU_S_ADD2 },
{"STE", VOICE_ID_INVALID, MENU_STE }, {"STE", VOICE_ID_INVALID, MENU_STE },
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE }, {"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
{"MIC", VOICE_ID_INVALID, MENU_MIC }, {"Mic", VOICE_ID_INVALID, MENU_MIC },
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR }, {"MicBar", VOICE_ID_INVALID, MENU_MIC_BAR },
#endif #endif
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND }, {"Compnd", VOICE_ID_INVALID, MENU_COMPAND },
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL }, {"1 Call", VOICE_ID_INVALID, MENU_1_CALL },
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST }, {"SList", VOICE_ID_INVALID, MENU_S_LIST },
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 }, {"SList1", VOICE_ID_INVALID, MENU_SLIST1 },
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 }, {"SList2", VOICE_ID_INVALID, MENU_SLIST2 },
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD }, {"AlarmT", VOICE_ID_INVALID, MENU_AL_MOD },
#endif #endif
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID }, {"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE }, {"UPCode", VOICE_ID_INVALID, MENU_UPCODE },
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE }, {"DWCode", VOICE_ID_INVALID, MENU_DWCODE },
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID }, {"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
{"D ST", VOICE_ID_INVALID, MENU_D_ST }, {"D ST", VOICE_ID_INVALID, MENU_D_ST },
{"D RSP", VOICE_ID_INVALID, MENU_D_RSP }, {"D Resp", VOICE_ID_INVALID, MENU_D_RSP },
{"D HOLD", VOICE_ID_INVALID, MENU_D_HOLD }, {"D Hold", VOICE_ID_INVALID, MENU_D_HOLD },
{"D PRE", VOICE_ID_INVALID, MENU_D_PRE }, {"D Prel", VOICE_ID_INVALID, MENU_D_PRE },
{"D DCD", VOICE_ID_INVALID, MENU_D_DCD }, {"D Decd", VOICE_ID_INVALID, MENU_D_DCD },
{"D LIST", VOICE_ID_INVALID, MENU_D_LIST }, {"D List", VOICE_ID_INVALID, MENU_D_LIST },
{"D LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder {"D Live", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG }, {"POnMsg", VOICE_ID_INVALID, MENU_PONMSG },
{"ROGER", VOICE_ID_INVALID, MENU_ROGER }, {"Roger", VOICE_ID_INVALID, MENU_ROGER },
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL" {"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT }, {"BatTxt", VOICE_ID_INVALID, MENU_BAT_TXT },
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM" {"Demodu", VOICE_ID_INVALID, MENU_AM }, // was "AM"
#ifdef ENABLE_AM_FIX #ifdef ENABLE_AM_FIX
{"AM FIX", VOICE_ID_INVALID, MENU_AM_FIX }, {"AM Fix", VOICE_ID_INVALID, MENU_AM_FIX },
#endif #endif
#ifdef ENABLE_AM_FIX_TEST1 #ifdef ENABLE_AM_FIX_TEST1
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1 }, {"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1 },
@@ -115,23 +114,23 @@ const t_menu_item MenuList[] =
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S }, {"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
#endif #endif
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ? {"Reset", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
// hidden menu items from here on // hidden menu items from here on
// enabled if pressing both the PTT and upper side button at power-on // enabled if pressing both the PTT and upper side button at power-on
{"F LOCK", VOICE_ID_INVALID, MENU_F_LOCK }, {"F Lock", VOICE_ID_INVALID, MENU_F_LOCK },
{"TX 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX" {"Tx 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
{"TX 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX" {"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
{"TX 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX" {"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
{"350 EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN" {"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
{"SCR EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN" {"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
{"TX EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX {"TxEnab", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
#ifdef ENABLE_F_CAL_MENU #ifdef ENABLE_F_CAL_MENU
{"F CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration {"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
#endif #endif
{"BATCAL", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration {"BatCal", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this {"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
}; };
@@ -186,18 +185,12 @@ const char gSubMenu_TOT[11][7] =
"15 min" "15 min"
}; };
const char gSubMenu_CHAN[3][10] = const char* gSubMenu_RXMode[4] =
{ {
"OFF", "MAIN\nONLY", // TX and RX on main only
"UPPER\nVFO", "DUAL RX\nRESPOND", // Watch both and respond
"LOWER\nVFO" "CROSS\nBAND", // TX on main, RX on secondary
}; "MAIN TX\nDUAL RX" // always TX on main, but RX on both
const char gSubMenu_XB[3][10] =
{
"RX\nVFO",
"UPPER\nVFO",
"LOWER\nVFO"
}; };
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -209,14 +202,14 @@ const char gSubMenu_XB[3][10] =
}; };
#endif #endif
const char gSubMenu_SC_REV[3][13] = const char gSubMenu_SC_REV[3][8] =
{ {
"TIME", "TIME",
"CARRIER", "CARRIER",
"SEARCH" "SEARCH"
}; };
const char gSubMenu_MDF[4][15] = const char* gSubMenu_MDF[4] =
{ {
"FREQ", "FREQ",
"CHANNEL\nNUMBER", "CHANNEL\nNUMBER",
@@ -240,7 +233,7 @@ const char gSubMenu_D_RSP[4][11] =
"BOTH" "BOTH"
}; };
const char gSubMenu_PTT_ID[5][15] = const char* gSubMenu_PTT_ID[5] =
{ {
"OFF", "OFF",
"KEY\nUP", "KEY\nUP",
@@ -680,11 +673,7 @@ void UI_DisplayMenu(void)
break; break;
case MENU_TDR: case MENU_TDR:
strcpy(String, gSubMenu_CHAN[gSubMenuSelection]); strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
break;
case MENU_XB:
strcpy(String, gSubMenu_XB[gSubMenuSelection]);
break; break;
case MENU_TOT: case MENU_TOT:

View File

@@ -39,7 +39,6 @@ enum
MENU_T_CTCS, MENU_T_CTCS,
MENU_SFT_D, MENU_SFT_D,
MENU_OFFSET, MENU_OFFSET,
MENU_XB,
MENU_TOT, MENU_TOT,
MENU_W_N, MENU_W_N,
MENU_SCR, MENU_SCR,
@@ -128,18 +127,18 @@ extern const char gSubMenu_W_N[2][7];
extern const char gSubMenu_OFF_ON[2][4]; extern const char gSubMenu_OFF_ON[2][4];
extern const char gSubMenu_SAVE[5][4]; extern const char gSubMenu_SAVE[5][4];
extern const char gSubMenu_TOT[11][7]; extern const char gSubMenu_TOT[11][7];
extern const char gSubMenu_CHAN[3][10]; extern const char* gSubMenu_RXMode[4];
extern const char gSubMenu_XB[3][10];
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
extern const char gSubMenu_VOICE[3][4]; extern const char gSubMenu_VOICE[3][4];
#endif #endif
extern const char gSubMenu_SC_REV[3][13]; extern const char gSubMenu_SC_REV[3][8];
extern const char gSubMenu_MDF[4][15]; extern const char* gSubMenu_MDF[4];
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
extern const char gSubMenu_AL_MOD[2][5]; extern const char gSubMenu_AL_MOD[2][5];
#endif #endif
extern const char gSubMenu_D_RSP[4][11]; extern const char gSubMenu_D_RSP[4][11];
extern const char gSubMenu_PTT_ID[5][15]; extern const char* gSubMenu_PTT_ID[5];
extern const char gSubMenu_PONMSG[4][8]; extern const char gSubMenu_PONMSG[4][8];
extern const char gSubMenu_ROGER[3][9]; extern const char gSubMenu_ROGER[3][9];
extern const char gSubMenu_RESET[2][4]; extern const char gSubMenu_RESET[2][4];

View File

@@ -85,15 +85,6 @@ void UI_DisplayStatus(const bool test_display)
x1 = x + 10; x1 = x + 10;
} }
else else
#ifdef ENABLE_FMRADIO
// FM indicator
if (gFmRadioMode || test_display)
{
memmove(line + x, BITMAP_FM, sizeof(BITMAP_FM));
x1 = x + sizeof(BITMAP_FM);
}
else
#endif
// SCAN indicator // SCAN indicator
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display) if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
{ {
@@ -123,28 +114,23 @@ void UI_DisplayStatus(const bool test_display)
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
x1 = x + sizeof(BITMAP_VoicePrompt); x1 = x + sizeof(BITMAP_VoicePrompt);
} }
x += sizeof(BITMAP_VoicePrompt); x += sizeof(BITMAP_VoicePrompt) + 2;
#else #else
// hmmm, what to put in it's place // hmmm, what to put in it's place
#endif #endif
// DUAL-WATCH indicator uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display) if(dw == 1 || dw == 3 || test_display) { // DWR - dual watch + respond
{ if(gDualWatchActive || test_display)
if (gDualWatchActive || test_display) memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1));
else else
memmove(line + x, BITMAP_TDR2, sizeof(BITMAP_TDR2)); memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
} }
x += sizeof(BITMAP_TDR1); else if(dw == 2) { // XB - crossband
// CROSS-VFO indicator
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
{
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB)); memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
x1 = x + sizeof(BITMAP_XB);
} }
x += sizeof(BITMAP_XB);
x += sizeof(BITMAP_TDR1) + 2;
#ifdef ENABLE_VOX #ifdef ENABLE_VOX
// VOX indicator // VOX indicator
@@ -153,9 +139,12 @@ void UI_DisplayStatus(const bool test_display)
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX)); memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
x1 = x + sizeof(BITMAP_VOX); x1 = x + sizeof(BITMAP_VOX);
} }
x += sizeof(BITMAP_VOX); x += sizeof(BITMAP_VOX) + 2;
#endif #endif
x = MAX(x, 61);
x1 = x;
// KEY-LOCK indicator // KEY-LOCK indicator
if (gEeprom.KEY_LOCK || test_display) if (gEeprom.KEY_LOCK || test_display)
{ {
@@ -218,7 +207,7 @@ void UI_DisplayStatus(const bool test_display)
x += sizeof(BITMAP_USB_C); x += sizeof(BITMAP_USB_C);
// BATTERY LEVEL indicator // BATTERY LEVEL indicator
UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBattery); UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBatteryBlink);
// ************** // **************