0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

101 lines
2.6 KiB
C
Raw Normal View History

2023-09-09 08:03:56 +01: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>
#include "driver/eeprom.h"
#include "driver/st7565.h"
#include "external/printf/printf.h"
#include "helper/battery.h"
#include "settings.h"
2023-09-09 10:17:58 +01:00
#include "misc.h"
2023-09-09 08:03:56 +01:00
#include "ui/helper.h"
#include "ui/welcome.h"
2023-09-14 09:56:30 +01:00
#include "ui/status.h"
2023-09-09 08:03:56 +01:00
#include "version.h"
void UI_DisplayReleaseKeys(void)
{
memset(gStatusLine, 0, sizeof(gStatusLine));
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
UI_PrintString("RELEASE", 0, 127, 1, 10);
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
ST7565_BlitStatusLine(); // blank status line
ST7565_BlitFullScreen();
}
2023-09-09 08:03:56 +01:00
void UI_DisplayWelcome(void)
{
char WelcomeString0[16];
char WelcomeString1[16];
2023-09-14 09:56:30 +01:00
char WelcomeString2[16];
2023-09-09 08:03:56 +01:00
memset(gStatusLine, 0, sizeof(gStatusLine));
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
2023-10-08 17:14:13 +01:00
if (g_eeprom.pwr_on_display_mode == PWR_ON_DISPLAY_MODE_NONE)
{
ST7565_FillScreen(0xFF);
}
else
2023-10-08 17:14:13 +01:00
if (g_eeprom.pwr_on_display_mode == PWR_ON_DISPLAY_MODE_FULL_SCREEN)
2023-09-09 08:03:56 +01:00
{
ST7565_FillScreen(0xFF);
}
else
{
memset(WelcomeString0, 0, sizeof(WelcomeString0));
memset(WelcomeString1, 0, sizeof(WelcomeString1));
2023-09-14 09:56:30 +01:00
memset(WelcomeString2, 0, sizeof(WelcomeString2));
2023-09-09 08:03:56 +01:00
2023-10-08 17:14:13 +01:00
if (g_eeprom.pwr_on_display_mode == PWR_ON_DISPLAY_MODE_VOLTAGE)
2023-09-09 08:03:56 +01:00
{
2023-09-13 02:01:35 +01:00
strcpy(WelcomeString0, "VOLTAGE");
sprintf(WelcomeString1, "%u.%02uV %u%%",
gBatteryVoltageAverage / 100,
gBatteryVoltageAverage % 100,
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
2023-09-14 09:56:30 +01:00
#if 0
sprintf(WelcomeString2, "Current %u", gBatteryCurrent); // needs scaling into mA
#endif
2023-09-09 08:03:56 +01:00
}
else
{
EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16);
EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);
}
2023-09-12 15:31:37 +01:00
UI_PrintString(WelcomeString0, 0, 127, 0, 10);
UI_PrintString(WelcomeString1, 0, 127, 2, 10);
2023-09-14 09:56:30 +01:00
#if 0
UI_PrintStringSmall(WelcomeString2, 0, 127, 4);
#endif
2023-09-12 15:31:37 +01:00
UI_PrintString(Version, 0, 127, 5, 10);
2023-09-09 08:03:56 +01:00
2023-09-14 09:56:30 +01:00
#if 1
ST7565_BlitStatusLine(); // blank status line
#else
UI_DisplayStatus(true); // show all status line symbols (test)
#endif
2023-09-09 08:03:56 +01:00
ST7565_BlitFullScreen();
}
}