diff --git a/Makefile b/Makefile index 78a246d..9514d4b 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ ENABLE_AM_FIX := 1 ENABLE_AM_FIX_SHOW_DATA := 1 ENABLE_SQUELCH1_LOWER := 0 ENABLE_RSSI_BAR := 1 -ENABLE_AUDIO_BAR := 0 +ENABLE_AUDIO_BAR := 1 #ENABLE_COPY_CHAN_TO_VFO := 1 #ENABLE_SINGLE_VFO_CHAN := 1 #ENABLE_BAND_SCOPE := 1 diff --git a/app/app.c b/app/app.c index c716868..c8be9fb 100644 --- a/app/app.c +++ b/app/app.c @@ -114,7 +114,8 @@ static void APP_CheckForIncoming(void) if (gCurrentFunction != FUNCTION_INCOMING) { FUNCTION_Select(FUNCTION_INCOMING); - gUpdateDisplay = true; + //gUpdateDisplay = true; + gUpdateRSSI = true; } return; @@ -127,7 +128,8 @@ static void APP_CheckForIncoming(void) if (gCurrentFunction != FUNCTION_INCOMING) { FUNCTION_Select(FUNCTION_INCOMING); - gUpdateDisplay = true; + //gUpdateDisplay = true; + gUpdateRSSI = true; } return; } @@ -146,7 +148,8 @@ static void APP_CheckForIncoming(void) if (gCurrentFunction != FUNCTION_INCOMING) { FUNCTION_Select(FUNCTION_INCOMING); - gUpdateDisplay = true; + //gUpdateDisplay = true; + gUpdateRSSI = true; } return; } @@ -160,7 +163,8 @@ static void APP_CheckForIncoming(void) if (gCurrentFunction != FUNCTION_INCOMING) { FUNCTION_Select(FUNCTION_INCOMING); - gUpdateDisplay = true; + //gUpdateDisplay = true; + gUpdateRSSI = true; } } @@ -937,7 +941,8 @@ static void APP_HandleVox(void) { if (gFlagEndTransmission) { - FUNCTION_Select(FUNCTION_FOREGROUND); + //if (gCurrentFunction != FUNCTION_FOREGROUND) + FUNCTION_Select(FUNCTION_FOREGROUND); } else { @@ -945,12 +950,14 @@ static void APP_HandleVox(void) if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) { - FUNCTION_Select(FUNCTION_FOREGROUND); + //if (gCurrentFunction != FUNCTION_FOREGROUND) + FUNCTION_Select(FUNCTION_FOREGROUND); } else gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; } + gUpdateStatus = true; gUpdateDisplay = true; gFlagEndTransmission = false; } @@ -1128,7 +1135,8 @@ void APP_Update(void) else if ((IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]) && IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1])) || !gIsNoaaMode) { - FUNCTION_Select(FUNCTION_POWER_SAVE); + //if (gCurrentFunction != FUNCTION_POWER_SAVE) + FUNCTION_Select(FUNCTION_POWER_SAVE); } else { @@ -1151,7 +1159,8 @@ void APP_Update(void) } else { - FUNCTION_Select(FUNCTION_POWER_SAVE); + //if (gCurrentFunction != FUNCTION_POWER_SAVE) + FUNCTION_Select(FUNCTION_POWER_SAVE); } gSchedulePowerSave = false; @@ -1490,8 +1499,10 @@ void APP_TimeSlice10ms(void) { if (--gRTTECountdown == 0) { - FUNCTION_Select(FUNCTION_FOREGROUND); + //if (gCurrentFunction != FUNCTION_FOREGROUND) + FUNCTION_Select(FUNCTION_FOREGROUND); + gUpdateStatus = true; gUpdateDisplay = true; } } @@ -1843,7 +1854,8 @@ void APP_TimeSlice500ms(void) gReducedService = true; - FUNCTION_Select(FUNCTION_POWER_SAVE); + //if (gCurrentFunction != FUNCTION_POWER_SAVE) + FUNCTION_Select(FUNCTION_POWER_SAVE); ST7565_Configure_GPIO_B11(); @@ -2203,7 +2215,10 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) ALARM_Off(); if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0) - FUNCTION_Select(FUNCTION_FOREGROUND); + { + //if (gCurrentFunction != FUNCTION_FOREGROUND) + FUNCTION_Select(FUNCTION_FOREGROUND); + } else gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10; diff --git a/firmware.bin b/firmware.bin index 3eddf29..52959d8 100644 Binary files a/firmware.bin and b/firmware.bin differ diff --git a/firmware.packed.bin b/firmware.packed.bin index d6bbebf..dff4129 100644 Binary files a/firmware.packed.bin and b/firmware.packed.bin differ diff --git a/ui/main.c b/ui/main.c index a28e5ab..42e3bc0 100644 --- a/ui/main.c +++ b/ui/main.c @@ -62,47 +62,52 @@ { if (gSetting_mic_bar) { - const unsigned int line = 3; - const unsigned int lcd_width = sizeof(gFrameBuffer[line]) - 2; - + const unsigned int line = 3; + const unsigned int bar_x = 2; + const unsigned int bar_width = LCD_WIDTH - 2 - bar_x; + unsigned int i; + #if 1 // TX audio level - + if (gCurrentFunction != FUNCTION_TRANSMIT) return; - + const unsigned int voice_amp = BK4819_GetVoiceAmplitudeOut(); // 15:0 - + // const unsigned int max = 65535; -// const unsigned int level = ((voice_amp * lcd_width) + (max / 2)) / max; // with rounding -// const unsigned int len = (level <= lcd_width) ? level : lcd_width; - +// const unsigned int level = ((voice_amp * bar_width) + (max / 2)) / max; // with rounding +// const unsigned int len = (level <= bar_width) ? level : bar_width; + // make non-linear to make more sensitive at low values const unsigned int level = voice_amp * 8; const unsigned int sqrt_level = sqrt16((level < 65535) ? level : 65535); - const unsigned int len = (sqrt_level <= lcd_width) ? sqrt_level : lcd_width; - + const unsigned int len = (sqrt_level <= bar_width) ? sqrt_level : bar_width; + #else // TX/RX AF input level (dB) - + const uint8_t af_tx_rx = BK4819_GetAfTxRx(); // 6:0 const unsigned int max = 63; - const unsigned int level = (((uint16_t)af_tx_rx * lcd_width) + (max / 2)) / max; // with rounding - const unsigned int len = (level <= lcd_width) ? level : lcd_width; - + const unsigned int level = (((uint16_t)af_tx_rx * bar_width) + (max / 2)) / max; // with rounding + const unsigned int len = (level <= bar_width) ? level : bar_width; + #endif - + uint8_t *pLine = gFrameBuffer[line]; - memset(pLine, 0, lcd_width); - #if 0 + + memset(pLine, 0, LCD_WIDTH); + + #if 1 // solid bar - memset(pLine, 0x3e, len); + for (i = 0; i < bar_width; i++) + pLine[bar_x + i] = (i <= len) ? 0x7f : ((i & 1) == 0) ? 0x41 : 0x00; #else - for (unsigned int i = 0; i < len; i += 2) - pLine[i] = 0x3e; + // knuled bar + for (i = 0; i < bar_width; i += 2) + pLine[bar_x + i] = (i <= len) ? 0x7f : 0x41; #endif - - + if (gCurrentFunction == FUNCTION_TRANSMIT) ST7565_BlitFullScreen(); } @@ -152,8 +157,15 @@ sprintf(s, "%-4d +%2u", dBm, s_level); // S9+ UI_PrintStringSmall(s, 2, 0, line); - for (i = 0; i < bar_width; i += 2) - pLine[bar_x + i] = ((i & 1) == 0 && i <= len) ? 0x7f : 0x41; + #if 1 + // solid bar + for (i = 0; i < bar_width; i++) + pLine[bar_x + i] = (i <= len) ? 0x7f : ((i & 1) == 0) ? 0x41 : 0x00; + #else + // knuled bar + for (i = 0; i < bar_width; i += 2) + pLine[bar_x + i] = (i <= len) ? 0x7f : 0x41; + #endif if (now) ST7565_BlitFullScreen(); @@ -670,10 +682,13 @@ void UI_DisplayMain(void) gCurrentFunction == FUNCTION_INCOMING); #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) - if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix) + if (gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix) { - AM_fix_print_data(gEeprom.RX_CHANNEL, String); - UI_PrintStringSmall(String, 0, 0, 3); + if (rx) + { + AM_fix_print_data(gEeprom.RX_CHANNEL, String); + UI_PrintStringSmall(String, 0, 0, 3); + } } else #endif @@ -684,35 +699,35 @@ void UI_DisplayMain(void) else #endif - { - #ifdef ENABLE_AUDIO_BAR + #ifdef ENABLE_AUDIO_BAR + if (gSetting_mic_bar && gCurrentFunction == FUNCTION_TRANSMIT) UI_DisplayAudioBar(); + else + #endif -// if (!gSetting_mic_bar) - #endif - if (rx || gCurrentFunction == FUNCTION_FOREGROUND) - { - if (gSetting_live_DTMF_decoder && gDTMF_ReceivedSaved[0] >= 32) - { // show live DTMF decode - const unsigned int len = strlen(gDTMF_ReceivedSaved); - unsigned int idx = 0; - while ((len - idx) > (17 - 5)) // display the last 'n' on-screen fittable chars - idx++; - strcpy(String, "DTMF "); - strcat(String, gDTMF_ReceivedSaved + idx); - UI_PrintStringSmall(String, 2, 0, 3); - } + if (rx || gCurrentFunction == FUNCTION_FOREGROUND) + { + if (gSetting_live_DTMF_decoder && gDTMF_ReceivedSaved[0] >= 32) + { // show live DTMF decode + const unsigned int len = strlen(gDTMF_ReceivedSaved); + unsigned int idx = 0; + while ((len - idx) > (17 - 5)) // display the last 'n' on-screen fittable chars + idx++; + strcpy(String, "DTMF "); + strcat(String, gDTMF_ReceivedSaved + idx); + UI_PrintStringSmall(String, 2, 0, 3); + } + + #ifdef ENABLE_SHOW_CHARGE_LEVEL else if (gChargingWithTypeC) { // charging .. show the battery state - #ifdef ENABLE_SHOW_CHARGE_LEVEL - const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage; - const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v); - sprintf(String, "Charge %u.%02uV %u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, percent); - UI_PrintStringSmall(String, 2, 0, 3); - #endif + const uint16_t volts = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage; + const uint16_t percent = (100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v); + sprintf(String, "Charge %u.%02uV %u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, percent); + UI_PrintStringSmall(String, 2, 0, 3); } - } + #endif } }