mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
Disable scan timeout compile option, updated win_make.bat to help path problems
This commit is contained in:
73
ui/battery.c
73
ui/battery.c
@ -15,28 +15,73 @@
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bitmaps.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "functions.h"
|
||||
#include "ui/battery.h"
|
||||
|
||||
void UI_DisplayBattery(uint8_t Level)
|
||||
void UI_DisplayBattery(const uint8_t level, const uint8_t blink)
|
||||
{
|
||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
// if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||
{
|
||||
const unsigned int x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel5);
|
||||
const uint8_t *pBitmap = NULL;
|
||||
switch (Level)
|
||||
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
|
||||
|
||||
#if 1
|
||||
|
||||
if (level >= 2)
|
||||
{
|
||||
default:
|
||||
case 0: break;
|
||||
case 1: pBitmap = BITMAP_BatteryLevel1; break;
|
||||
case 2: pBitmap = BITMAP_BatteryLevel2; break;
|
||||
case 3: pBitmap = BITMAP_BatteryLevel3; break;
|
||||
case 4: pBitmap = BITMAP_BatteryLevel4; break;
|
||||
case 5: pBitmap = BITMAP_BatteryLevel5; break;
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
uint8_t *pb = bitmap + sizeof(BITMAP_BatteryLevel1);
|
||||
if (level >= 2)
|
||||
memmove(pb - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 5)
|
||||
memmove(pb - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 7)
|
||||
memmove(pb - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 9)
|
||||
memmove(pb - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#else
|
||||
if (level >= 2)
|
||||
memmove(bitmap + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 5)
|
||||
memmove(bitmap + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 7)
|
||||
memmove(bitmap + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (level >= 9)
|
||||
memmove(bitmap + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#endif
|
||||
}
|
||||
// col lne, siz, bm
|
||||
ST7565_DrawLine(x, 0, 18, pBitmap);
|
||||
else
|
||||
if (blink == 1)
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
else
|
||||
memset(bitmap, 0, sizeof(bitmap));
|
||||
|
||||
#else
|
||||
|
||||
if (level > 0)
|
||||
{
|
||||
const uint8_t lev = (level <= 11) ? level : 11;
|
||||
|
||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
|
||||
#ifdef ENABLE_REVERSE_BAT_SYMBOL
|
||||
for (uint8_t i = 0; i < lev; i++)
|
||||
bitmap[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#else
|
||||
for (uint8_t i = 0; i < lev; i++)
|
||||
bitmap[sizeof(bitmap) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
memset(bitmap, 0, sizeof(bitmap));
|
||||
|
||||
#endif
|
||||
|
||||
// col lne, siz, bm
|
||||
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void UI_DisplayBattery(uint8_t Level);
|
||||
void UI_DisplayBattery(const uint8_t Level, const uint8_t blink);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -504,8 +504,11 @@ void UI_DisplayMain(void)
|
||||
case FUNCTION_TRANSMIT:
|
||||
case FUNCTION_BAND_SCOPE:
|
||||
case FUNCTION_POWER_SAVE:
|
||||
break;
|
||||
|
||||
case FUNCTION_FOREGROUND:
|
||||
break;
|
||||
|
||||
case FUNCTION_RECEIVE:
|
||||
case FUNCTION_MONITOR:
|
||||
case FUNCTION_INCOMING:
|
||||
|
@ -433,12 +433,6 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, (gSubMenuSelection == 0) ? "FM" : "AM");
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "YES'ish");
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
||||
@ -455,6 +449,9 @@ void UI_DisplayMenu(void)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
#endif
|
||||
case MENU_BCL:
|
||||
case MENU_BEEP:
|
||||
case MENU_S_ADD1:
|
||||
|
59
ui/status.c
59
ui/status.c
@ -171,6 +171,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
{
|
||||
const uint16_t voltage = (gBatteryVoltageAverage < gMin_bat_v) ? gMin_bat_v : gBatteryVoltageAverage;
|
||||
const uint16_t percent = (100 * (voltage - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v);
|
||||
// const uint16_t percent = gBatteryDisplayLevel;
|
||||
sprintf(s, "%u%%", percent);
|
||||
space_needed = (7 * strlen(s));
|
||||
if (x2 >= (x1 + space_needed))
|
||||
@ -181,7 +182,7 @@ void UI_DisplayStatus(const bool test_display)
|
||||
}
|
||||
|
||||
// move to right side of the screen
|
||||
x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel5) - sizeof(BITMAP_USB_C);
|
||||
x = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - sizeof(BITMAP_USB_C);
|
||||
|
||||
// USB-C charge indicator
|
||||
if (gChargingWithTypeC || test_display)
|
||||
@ -189,20 +190,54 @@ void UI_DisplayStatus(const bool test_display)
|
||||
x += sizeof(BITMAP_USB_C);
|
||||
|
||||
// BATTERY LEVEL indicator
|
||||
if (gBatteryDisplayLevel >= 5 || test_display)
|
||||
memmove(line + x, BITMAP_BatteryLevel5, sizeof(BITMAP_BatteryLevel5));
|
||||
else
|
||||
if (gBatteryDisplayLevel >= 4)
|
||||
memmove(line + x, BITMAP_BatteryLevel4, sizeof(BITMAP_BatteryLevel4));
|
||||
else
|
||||
if (gBatteryDisplayLevel >= 3)
|
||||
memmove(line + x, BITMAP_BatteryLevel3, sizeof(BITMAP_BatteryLevel3));
|
||||
else
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memmove(line + x, BITMAP_BatteryLevel2, sizeof(BITMAP_BatteryLevel2));
|
||||
#if 1
|
||||
if (gBatteryDisplayLevel >= 2 && !gLowBattery)
|
||||
{
|
||||
line += x;
|
||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||
line += sizeof(BITMAP_BatteryLevel1);
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 7)
|
||||
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 9)
|
||||
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#else
|
||||
if (gBatteryDisplayLevel >= 2)
|
||||
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 5)
|
||||
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 7)
|
||||
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
if (gBatteryDisplayLevel >= 9)
|
||||
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if (gLowBatteryBlink == 1)
|
||||
memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#else
|
||||
// UI_DisplayBattery(gBatteryDisplayLevel);
|
||||
|
||||
line += x;
|
||||
if (gBatteryDisplayLevel > 0)
|
||||
{
|
||||
const uint8_t level = (gBatteryDisplayLevel <= 11) ? gBatteryDisplayLevel : 11;
|
||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||
#ifdef ENABLE_REVERSE_BAT_SYMBOL
|
||||
for (uint8_t i = 0; i < level; i++)
|
||||
line[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#else
|
||||
for (uint8_t i = 0; i < level; i++)
|
||||
line[sizeof(BITMAP_BatteryLevel1) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
memset(line, 0, sizeof(BITMAP_BatteryLevel1));
|
||||
#endif
|
||||
|
||||
// **************
|
||||
|
||||
|
Reference in New Issue
Block a user