2023-09-09 07:03:56 +00:00
|
|
|
/* Copyright 2023 Dual Tachyon
|
|
|
|
* https://github.com/DualTachyon
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
#ifdef ENABLE_FMRADIO
|
|
|
|
#include "app/fm.h"
|
|
|
|
#endif
|
2023-09-09 07:03:56 +00:00
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "driver/keyboard.h"
|
|
|
|
#include "driver/st7565.h"
|
|
|
|
#include "functions.h"
|
|
|
|
#include "helper/battery.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "settings.h"
|
2023-09-16 16:16:36 +00:00
|
|
|
//#include "ui/helper.h"
|
2023-09-09 07:03:56 +00:00
|
|
|
#include "ui/status.h"
|
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
void UI_DisplayStatus(const bool test_display)
|
2023-09-09 07:03:56 +00:00
|
|
|
{
|
|
|
|
memset(gStatusLine, 0, sizeof(gStatusLine));
|
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
2023-09-09 07:03:56 +00:00
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
#ifdef ENABLE_NOAA
|
|
|
|
if (gIsNoaaMode || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 7, BITMAP_NOAA, sizeof(BITMAP_NOAA));
|
2023-09-14 08:56:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (gSetting_KILLED || test_display)
|
|
|
|
memset(gStatusLine + 21, 0xFF, 10);
|
|
|
|
#ifdef ENABLE_FMRADIO
|
2023-09-09 07:03:56 +00:00
|
|
|
else
|
2023-09-14 08:56:30 +00:00
|
|
|
if (gFmRadioMode || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 21, BITMAP_FM, sizeof(BITMAP_FM));
|
2023-09-14 08:56:30 +00:00
|
|
|
#endif
|
2023-09-09 07:03:56 +00:00
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
#ifdef ENABLE_VOICE
|
|
|
|
if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 34, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
2023-09-14 08:56:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 45, BITMAP_TDR, sizeof(BITMAP_TDR));
|
2023-09-14 08:56:30 +00:00
|
|
|
|
|
|
|
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 58, BITMAP_XB, sizeof(BITMAP_XB));
|
2023-09-14 08:56:30 +00:00
|
|
|
|
|
|
|
if (gEeprom.VOX_SWITCH || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 71, BITMAP_VOX, sizeof(BITMAP_VOX));
|
2023-09-09 07:03:56 +00:00
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
if (gEeprom.KEY_LOCK || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 90, BITMAP_KeyLock, sizeof(BITMAP_KeyLock));
|
2023-09-09 07:03:56 +00:00
|
|
|
else
|
|
|
|
if (gWasFKeyPressed)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 90, BITMAP_F_Key, sizeof(BITMAP_F_Key));
|
2023-09-09 07:03:56 +00:00
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
if (gChargingWithTypeC || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 100, BITMAP_USB_C, sizeof(BITMAP_USB_C));
|
2023-09-09 07:03:56 +00:00
|
|
|
|
2023-09-14 08:56:30 +00:00
|
|
|
if (gBatteryDisplayLevel >= 5 || test_display)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 110, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
|
2023-09-14 08:56:30 +00:00
|
|
|
else
|
|
|
|
if (gBatteryDisplayLevel >= 4)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 110, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
|
2023-09-14 08:56:30 +00:00
|
|
|
else
|
|
|
|
if (gBatteryDisplayLevel >= 3)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 110, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
|
2023-09-09 07:03:56 +00:00
|
|
|
else
|
2023-09-14 08:56:30 +00:00
|
|
|
if (gBatteryDisplayLevel >= 2)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 110, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
|
2023-09-14 08:56:30 +00:00
|
|
|
else
|
|
|
|
if (gLowBatteryBlink == 1)
|
2023-09-17 08:54:24 +00:00
|
|
|
memmove(gStatusLine + 110, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
2023-09-09 07:03:56 +00:00
|
|
|
|
|
|
|
ST7565_BlitStatusLine();
|
|
|
|
}
|