many improvement
This commit is contained in:
37
Core/App/Graphic/Images/icon.h
Normal file
37
Core/App/Graphic/Images/icon.h
Normal file
@@ -0,0 +1,37 @@
|
||||
const uint16_t mute[][16] = {
|
||||
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x05F8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x0000,0x0000,0x04E0,0x0000,},
|
||||
{0x0000,0x0000,0x05F8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x60FF,0x0000,0x05F0,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x05F8,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x04F0,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x05F8,0x0000,0x80FF,0x0000,0x0000,0x04F0,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x05F8,0x60FF,0x60FF,0x05F0,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x05F0,0x60FF,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x05F8,0x60FF,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x05F0,0x80FF,0x60FF,0x05F8,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x05F0,0x0000,0x60FF,0x0000,0x0000,0x05F8,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x05F0,0x0000,0x0000,0x0000,0x0000,0x80FF,0x0000,0x0000,0x60FF,0x04F8,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0xA210,0x04F0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x60FF,0x0000,0x05F8,0x0000,0x0000,},
|
||||
{0x0000,0x04F0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x60FF,0x0000,0x0000,0x05F8,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
|
||||
};
|
||||
|
||||
const uint16_t stereo[][16] = {
|
||||
{0x0000,0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x2000,0x4008,0x4008,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
|
||||
{0x0000,0x60FF,0x0000,0x8010,0x6010,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,},
|
||||
{0x0000,0x60FF,0x4008,0x4008,0x60FF,0x0000,0x0000,0x80FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x0000,},
|
||||
{0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,},
|
||||
{0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x60FF,0x60FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,},
|
||||
{0x0000,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x60FF,0x60FF,0x0000,0x0000,0x60FF,0x0000,0x0000,0x80FF,0x0000,},
|
||||
{0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,},
|
||||
{0x2000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x60FF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x60FF,0x0000,0x0000,},
|
||||
{0x2000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
|
||||
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,},
|
||||
};
|
10
Core/App/Graphic/Images/img_stereo.h
Normal file
10
Core/App/Graphic/Images/img_stereo.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
const uint8_t IMG_STEREO[] = {
|
||||
0x0F, 0x09, 0x30, 0xCC, 0x03, 0x30, 0x48, 0x00, 0x30, 0x78, 0x78, 0x30, 0x00, 0x48, 0x30, 0x03,
|
||||
0xCC, 0x30, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00,
|
||||
};
|
||||
const uint32_t DATA_SIZE_IMG_STEREO = 34;
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include "time.h"
|
||||
#include "st7735.h"
|
||||
#include "Images/digi18x32.h"
|
||||
#include "Images/img_stereo.h"
|
||||
#include "monoimg.h"
|
||||
#include "bmfont.h"
|
||||
#include "asciifont.h"
|
||||
@@ -150,22 +151,16 @@ void ui_com_fm_am(uint8_t clear) {
|
||||
}
|
||||
}
|
||||
|
||||
void ui_com_progress_bar(uint8_t clear, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t border_color, uint16_t fill_color, uint32_t current, uint32_t total) {
|
||||
if (clear) {
|
||||
ST7735_FillRectangle(x, y, w, h, ST7735_BLACK);
|
||||
}
|
||||
void ui_com_progress_bar(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t border_color, uint16_t fill_color, uint32_t current, uint32_t total) {
|
||||
// border
|
||||
ST7735_FillRectangle(x, y, w, 1, border_color);
|
||||
ST7735_FillRectangle(x, y + h - 1, w, 1, border_color);
|
||||
ST7735_FillRectangle(x, y, 1, h, border_color);
|
||||
ST7735_FillRectangle(x + w - 1, y, 1, h, border_color);
|
||||
// bar
|
||||
x += 1;
|
||||
y += 1;
|
||||
w -= 2;
|
||||
h -= 2;
|
||||
uint16_t bar_width = w * current / total;
|
||||
ST7735_FillRectangle(x, y, bar_width, h, fill_color);
|
||||
uint16_t bar_width = (w - 2) * current / total;
|
||||
ST7735_FillRectangle(x + 1, y + 1, bar_width, h - 2, fill_color);
|
||||
ST7735_FillRectangle(x + bar_width + 1, y + 1, (w - 2 - bar_width), h - 2, ST7735_BLACK);
|
||||
}
|
||||
|
||||
void ui_com_vol_bar(uint8_t clear) {
|
||||
@@ -180,7 +175,13 @@ void ui_com_vol_bar(uint8_t clear) {
|
||||
bmf_draw_text(font_unifont_8x16, u8str("VOL"), 3, off_x, off_y, 32, 16, color_skyblue);
|
||||
// bar
|
||||
off_x = 1 + 32;
|
||||
ui_com_progress_bar(clear, 33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, color_skyblue, global_data.volumn, 16);
|
||||
if (global_data.flag & G_FL_MUTE) {
|
||||
color_skyblue = ST7735_COLOR565(0x20, 0x20, 0x20);
|
||||
// ui_com_progress_bar(33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, ST7735_COLOR565(0x20, 0x20, 0x20), G_VOLUMN_MAX, G_VOLUMN_MAX);
|
||||
} else {
|
||||
// ui_com_progress_bar(33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, color_skyblue, global_data.volumn, G_VOLUMN_MAX);
|
||||
}
|
||||
ui_com_progress_bar(33, off_y + 2, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, color_skyblue, global_data.volumn, G_VOLUMN_MAX);
|
||||
}
|
||||
|
||||
void ui_com_sig_bar(uint8_t clear) {
|
||||
@@ -194,7 +195,18 @@ void ui_com_sig_bar(uint8_t clear) {
|
||||
bmf_draw_text(font_unifont_8x16, u8str("SIG"), 3, off_x, off_y, 32, 16, ST7735_GREEN);
|
||||
// bar
|
||||
off_x = 1 + 32;
|
||||
ui_com_progress_bar(clear, 33, off_y + 1, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, ST7735_GREEN, global_data.signal, 255);
|
||||
ui_com_progress_bar(33, off_y + 1, ST7735_WIDTH - 34 - 3, 13, ST7735_WHITE, ST7735_GREEN, global_data.signal, G_RSSI_MAX);
|
||||
}
|
||||
|
||||
/* 图标 */
|
||||
void icon_stereo() {
|
||||
mimg_Area area = mimg_get_tile_area(IMG_STEREO, 1, 1, 0);
|
||||
// margin 1px from left top border
|
||||
if (global_data.flag & G_FL_MONO) {
|
||||
ST7735_FillRectangle(8, 25, area.w, area.h, ST7735_BLACK);
|
||||
} else {
|
||||
mimg_draw_with_bg(ST7735_DrawPixel, 8, 25, ST7735_YELLOW, ST7735_BLACK, IMG_STEREO, area);
|
||||
}
|
||||
}
|
||||
|
||||
/* 供外部调用的方法 */
|
||||
@@ -206,6 +218,7 @@ void ui_screen_main() {
|
||||
ui_com_freq_digital(0, 0);
|
||||
ui_com_vol_bar(0);
|
||||
ui_com_sig_bar(0);
|
||||
icon_stereo();
|
||||
}
|
||||
|
||||
void ui_screen_main_animation() {
|
||||
|
@@ -11,6 +11,8 @@ void ui_com_freq_digital(uint8_t clear, uint8_t only_pointer);
|
||||
void ui_com_fm_am(uint8_t clear);
|
||||
void ui_com_vol_bar(uint8_t clear);
|
||||
void ui_com_sig_bar(uint8_t clear);
|
||||
/* 图标 */
|
||||
void icon_stereo();
|
||||
/* 绘制主界面 */
|
||||
void ui_screen_main();
|
||||
void ui_screen_main_animation();
|
||||
|
Reference in New Issue
Block a user