New design Dual Watch

This commit is contained in:
Armel FAUVEAU
2024-02-17 05:01:13 +01:00
parent 04da5ae1dc
commit f4154dde3a
4 changed files with 158 additions and 40 deletions

View File

@@ -149,12 +149,14 @@ static void SetRegMenuValue(uint8_t st, bool add) {
// GUI functions
static void PutPixel(uint8_t x, uint8_t y, bool fill) {
UI_DrawPixelBuffer(gFrameBuffer, x, y, fill);
}
static void PutPixelStatus(uint8_t x, uint8_t y, bool fill) {
UI_DrawPixelBuffer(&gStatusLine, x, y, fill);
}
#ifndef ENABLE_FEAT_F4HWN
static void PutPixel(uint8_t x, uint8_t y, bool fill) {
UI_DrawPixelBuffer(gFrameBuffer, x, y, fill);
}
static void PutPixelStatus(uint8_t x, uint8_t y, bool fill) {
UI_DrawPixelBuffer(&gStatusLine, x, y, fill);
}
#endif
static void DrawVLine(int sy, int ey, int nx, bool fill) {
for (int i = sy; i <= ey; i++) {
@@ -164,29 +166,31 @@ static void DrawVLine(int sy, int ey, int nx, bool fill) {
}
}
static void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
bool statusbar, bool fill) {
uint8_t c;
uint8_t pixels;
const uint8_t *p = (const uint8_t *)pString;
#ifndef ENABLE_FEAT_F4HWN
static void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
bool statusbar, bool fill) {
uint8_t c;
uint8_t pixels;
const uint8_t *p = (const uint8_t *)pString;
while ((c = *p++) && c != '\0') {
c -= 0x20;
for (int i = 0; i < 3; ++i) {
pixels = gFont3x5[c][i];
for (int j = 0; j < 6; ++j) {
if (pixels & 1) {
if (statusbar)
PutPixelStatus(x + i, y + j, fill);
else
PutPixel(x + i, y + j, fill);
while ((c = *p++) && c != '\0') {
c -= 0x20;
for (int i = 0; i < 3; ++i) {
pixels = gFont3x5[c][i];
for (int j = 0; j < 6; ++j) {
if (pixels & 1) {
if (statusbar)
PutPixelStatus(x + i, y + j, fill);
else
PutPixel(x + i, y + j, fill);
}
pixels >>= 1;
}
pixels >>= 1;
}
x += 4;
}
x += 4;
}
}
#endif
// Utility functions

View File

@@ -218,6 +218,38 @@ static void sort(int16_t *a, int16_t *b)
}
}
}
void PutPixel(uint8_t x, uint8_t y, bool fill) {
UI_DrawPixelBuffer(gFrameBuffer, x, y, fill);
}
void PutPixelStatus(uint8_t x, uint8_t y, bool fill) {
UI_DrawPixelBuffer(&gStatusLine, x, y, fill);
}
void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y,
bool statusbar, bool fill) {
uint8_t c;
uint8_t pixels;
const uint8_t *p = (const uint8_t *)pString;
while ((c = *p++) && c != '\0') {
c -= 0x20;
for (int i = 0; i < 3; ++i) {
pixels = gFont3x5[c][i];
for (int j = 0; j < 6; ++j) {
if (pixels & 1) {
if (statusbar)
PutPixelStatus(x + i, y + j, fill);
else
PutPixel(x + i, y + j, fill);
}
pixels >>= 1;
}
}
x += 4;
}
}
#endif
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black)

View File

@@ -34,6 +34,9 @@ void UI_DisplayPopup(const char *string);
void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black);
#ifdef ENABLE_FEAT_F4HWN
void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
void PutPixel(uint8_t x, uint8_t y, bool fill);
void PutPixelStatus(uint8_t x, uint8_t y, bool fill);
void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y, bool statusbar, bool fill);
#endif
void UI_DrawLineBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);
void UI_DrawRectangleBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black);

111
ui/main.c
View File

@@ -363,8 +363,16 @@ void DisplayRSSIBar(const bool now)
#endif
#ifdef ENABLE_FEAT_F4HWN
sprintf(str, "% 4d", -rssi_dBm);
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
{
sprintf(str, "%3d", -rssi_dBm);
UI_PrintStringSmallNormal(str, LCD_WIDTH + 8, 0, line - 1);
}
else
{
sprintf(str, "%04d %s", -rssi_dBm, "dBm");
GUI_DisplaySmallest(str, 2, 25, false, true);
}
if(overS9Bars == 0) {
sprintf(str, "S%d", s_level);
@@ -372,10 +380,8 @@ void DisplayRSSIBar(const bool now)
else {
sprintf(str, "+%02d", overS9dBm);
}
if(gSetting_set_met)
UI_PrintStringSmallNormal(str, LCD_WIDTH + 38, 0, line - 1);
else
UI_PrintStringSmallBold(str, LCD_WIDTH + 38, 0, line - 1);
UI_PrintStringSmallNormal(str, LCD_WIDTH + 38, 0, line - 1);
#else
if(overS9Bars == 0) {
sprintf(str, "% 4d S%d", -rssi_dBm, s_level);
@@ -992,28 +998,93 @@ void UI_DisplayMain(void)
s = gModulationStr[mod];
break;
}
#if ENABLE_FEAT_F4HWN
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
{
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
}
else
{
GUI_DisplaySmallest(s, 24, line == 0 ? 17 : 49, false, true);
}
#else
UI_PrintStringSmallNormal(s, LCD_WIDTH + 24, 0, line + 1);
#endif
if (state == VFO_STATE_NORMAL || state == VFO_STATE_ALARM)
{ // show the TX power
const char pwr_list[][2] = {"L","M","H"};
int i = vfoInfo->OUTPUT_POWER % 3;
#if ENABLE_FEAT_F4HWN
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
{
const char pwr_list[][2] = {"L","M","H"};
UI_PrintStringSmallNormal(pwr_list[i], LCD_WIDTH + 46, 0, line + 1);
}
else
{
const char *powerNames[] = {"LOW", "MID", "HIGH"};
GUI_DisplaySmallest(powerNames[i], 37, line == 0 ? 17 : 49, false, true);
}
#else
const char pwr_list[][2] = {"L","M","H"};
UI_PrintStringSmallNormal(pwr_list[i], LCD_WIDTH + 46, 0, line + 1);
#endif
}
if (vfoInfo->freq_config_RX.Frequency != vfoInfo->freq_config_TX.Frequency)
{ // show the TX offset symbol
const char dir_list[][2] = {"", "+", "-"};
int i = vfoInfo->TX_OFFSET_FREQUENCY_DIRECTION % 3;
#if ENABLE_FEAT_F4HWN
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
{
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
}
else
{
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 60, 0, line + 1);
}
#else
UI_PrintStringSmallNormal(dir_list[i], LCD_WIDTH + 54, 0, line + 1);
#endif
}
// show the TX/RX reverse symbol
if (vfoInfo->FrequencyReverse)
#if ENABLE_FEAT_F4HWN
{
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
{
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
}
else
{
GUI_DisplaySmallest("R", 62, line == 0 ? 17 : 49, false, true);
}
}
#else
UI_PrintStringSmallNormal("R", LCD_WIDTH + 62, 0, line + 1);
#endif
#if ENABLE_FEAT_F4HWN
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
{
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
}
else
{
const char *bandWidthNames[] = {"WIDE", "NARROW"};
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
GUI_DisplaySmallest(bandWidthNames[1], 76, line == 0 ? 17 : 49, false, true);
else
GUI_DisplaySmallest(bandWidthNames[0], 76, line == 0 ? 17 : 49, false, true);
}
#else
if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW)
UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1);
#endif
#ifdef ENABLE_DTMF_CALLING
// show the DTMF decoding symbol
@@ -1030,22 +1101,30 @@ void UI_DisplayMain(void)
#ifdef ENABLE_FEAT_F4HWN
if(isMainVFO)
{
if(gMonitor)
{
sprintf(String, "%s", "MON");
}
else
{
sprintf(String, "SQL %d", gEeprom.SQUELCH_LEVEL);
}
if ((gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2 == 0)
{
if(gMonitor)
{
sprintf(String, "%s", "MON");
}
else
{
sprintf(String, "SQL %d", gEeprom.SQUELCH_LEVEL);
}
UI_PrintStringSmallNormal(String, 91, 0, 2);
}
else
{
UI_PrintStringSmallNormal(String, 91, 0, line + 2);
if(gMonitor)
{
sprintf(String, "%s", "MONIT");
}
else
{
sprintf(String, "SQL %d", gEeprom.SQUELCH_LEVEL);
}
GUI_DisplaySmallest(String, 106, line == 0 ? 17 : 49, false, true);
}
}
#endif