0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 22:58:04 +03:00

Fixed button/ptt being ignored, re-wrote a keyboard function as well.

This commit is contained in:
OneOfEleven
2023-10-09 22:49:29 +01:00
parent fe77e62fe0
commit c76891be6d
19 changed files with 387 additions and 359 deletions

View File

@ -22,23 +22,24 @@
#include "functions.h"
#include "ui/battery.h"
void UI_DrawBattery(uint8_t* bitmap, const unsigned int level, const unsigned int blink)
void UI_DrawBattery(uint8_t *bitmap, const unsigned int level, const unsigned int blink)
{
memmove(bitmap, BITMAP_BATTERY_LEVEL, sizeof(BITMAP_BATTERY_LEVEL));
if (level >= 1)
{
unsigned int i;
uint8_t bars = level > 0 ? level - 1 : 0;
if(bars>4) bars = 4;
unsigned int bars = (level > 0) ? level - 1 : 0;
if (bars > 4)
bars = 4;
for (i = 0; i < bars; i++)
{
#ifndef ENABLE_REVERSE_BAT_SYMBOL
bitmap[sizeof(bitmap) - 3 - (i * 3) - 0] = 0b01011101;
bitmap[sizeof(bitmap) - 3 - (i * 3) - 1] = 0b01011101;
#else
#ifdef ENABLE_REVERSE_BAT_SYMBOL
bitmap[3 + (i * 3) + 0] = 0b01011101;
bitmap[3 + (i * 3) + 1] = 0b01011101;
#else
bitmap[sizeof(bitmap) - 3 - (i * 3) - 0] = 0b01011101;
bitmap[sizeof(bitmap) - 3 - (i * 3) - 1] = 0b01011101;
#endif
}
}
@ -50,7 +51,6 @@ void UI_DrawBattery(uint8_t* bitmap, const unsigned int level, const unsigned in
void UI_DisplayBattery(const unsigned int level, const unsigned int blink)
{
uint8_t bitmap[sizeof(BITMAP_BATTERY_LEVEL)];
UI_DrawBattery(bitmap, level, blink);
memmove(bitmap, BITMAP_BATTERY_LEVEL, sizeof(BITMAP_BATTERY_LEVEL));
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);

View File

@ -18,6 +18,7 @@
#define UI_BATTERY_H
#include <stdint.h>
void UI_DrawBattery(uint8_t* bitmap, const unsigned int level, const unsigned int blink);
void UI_DisplayBattery(const unsigned int Level, const unsigned int blink);

View File

@ -164,21 +164,21 @@ void UI_DisplayStatus(const bool test_display)
x1 = x;
}
else
if (g_f_key_was_pressed)
if (g_fkey_pressed)
{
memmove(line + x, BITMAP_F_KEY, sizeof(BITMAP_F_KEY));
x += sizeof(BITMAP_F_KEY);
x1 = x;
}
{ // battery voltage or percentage
{ // battery voltage or percentage text
char s[8];
unsigned int space_needed;
unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BATTERY_LEVEL) - 3;
if (g_charging_with_type_c)
x2 -= sizeof(BITMAP_USB_C); // the radio is on charge
x2 -= sizeof(BITMAP_USB_C); // the radio is on USB charge
switch (g_setting_battery_text)
{
@ -192,9 +192,7 @@ void UI_DisplayStatus(const bool test_display)
sprintf(s, "%u.%02uV", voltage / 100, voltage % 100);
space_needed = (7 * strlen(s));
if (x2 >= (x1 + space_needed))
{
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
}
break;
}

View File

@ -43,6 +43,8 @@ bool g_ask_to_delete;
void GUI_DisplayScreen(void)
{
g_update_display = false;
switch (g_screen_to_display)
{
case DISPLAY_MAIN:
@ -93,7 +95,7 @@ void GUI_SelectNextDisplay(gui_display_type_t Display)
g_ask_for_confirmation = 0;
g_ask_to_save = false;
g_ask_to_delete = false;
g_f_key_was_pressed = false;
g_fkey_pressed = false;
g_update_status = true;
}