2026-08-26 07:26:58 +08:00
|
|
|
|
#include "includes.h"
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t CurrentMode = 0;
|
|
|
|
|
|
|
|
|
|
|
|
void RGB_Y_TO_R()
|
|
|
|
|
|
{
|
|
|
|
|
|
app_tm1629_all_on(LED_COLOR_YELL);
|
|
|
|
|
|
rt_thread_delay(1000);
|
|
|
|
|
|
app_tm1629_all_on(LED_COLOR_R);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RGB_Y_TO_G()
|
|
|
|
|
|
{
|
|
|
|
|
|
app_tm1629_all_on(LED_COLOR_YELL);
|
|
|
|
|
|
rt_thread_delay(1000);
|
|
|
|
|
|
app_tm1629_all_on(LED_COLOR_G);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define UI_MODE_SCREEN_WIDTH 240
|
|
|
|
|
|
#define UI_MODE_SCREEN_HEIGHT 320
|
|
|
|
|
|
|
|
|
|
|
|
#define UI_MODE_BG_COLOR 0x1925
|
|
|
|
|
|
#define UI_MODE_LINE_COLOR DARKBLUE
|
|
|
|
|
|
#define UI_MODE_TEXT_COLOR 0xFFFF
|
2026-08-31 08:20:24 +08:00
|
|
|
|
/* PDF 标注 MiSans-Medium 21;字库无 21,用 28 与 40x30 图标比例接近标注稿 */
|
|
|
|
|
|
#define UI_MODE_FONT_SIZE 28
|
|
|
|
|
|
#define UI_MODE_ICON_W 40
|
|
|
|
|
|
#define UI_MODE_ICON_H 30
|
|
|
|
|
|
#define UI_MODE_ICON_TEXT_GAP 8
|
|
|
|
|
|
/* 汉字墨心略偏上;下移与图标光心平齐(过大易显得文字偏下) */
|
|
|
|
|
|
#define UI_MODE_TEXT_OPTICAL_DY 2
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-08-31 06:10:13 +08:00
|
|
|
|
/* 模式选择页焦点:0=万能 1=普通 2=专业,默认选中万能(与规范一致) */
|
|
|
|
|
|
static uint8_t s_mode_select_focus = 0;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-08-31 06:10:13 +08:00
|
|
|
|
static void UI_DrawModeSelectButton(uint16_t y, const uint8_t *text,
|
|
|
|
|
|
const uint8_t *icon, uint8_t focused)
|
|
|
|
|
|
{
|
2026-08-26 07:26:58 +08:00
|
|
|
|
const uint16_t btn_w = 220;
|
|
|
|
|
|
const uint16_t btn_h = 87;
|
|
|
|
|
|
const uint16_t btn_r = 10;
|
2026-08-31 06:10:13 +08:00
|
|
|
|
const uint16_t btn_x = (240 - btn_w) / 2;
|
2026-08-31 08:20:24 +08:00
|
|
|
|
const uint16_t text_w = (uint16_t)(4 * UI_MODE_FONT_SIZE);
|
|
|
|
|
|
const uint16_t group_w = (uint16_t)(UI_MODE_ICON_W + UI_MODE_ICON_TEXT_GAP + text_w);
|
|
|
|
|
|
const uint16_t group_x = (uint16_t)(btn_x + (btn_w - group_w) / 2);
|
|
|
|
|
|
const uint16_t mid_y = (uint16_t)(y + btn_h / 2);
|
|
|
|
|
|
const uint16_t icon_y = (uint16_t)(mid_y - UI_MODE_ICON_H / 2);
|
|
|
|
|
|
const uint16_t text_y = (uint16_t)(mid_y - UI_MODE_FONT_SIZE / 2 + UI_MODE_TEXT_OPTICAL_DY);
|
|
|
|
|
|
const uint16_t text_x = (uint16_t)(group_x + UI_MODE_ICON_W + UI_MODE_ICON_TEXT_GAP);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-08-31 06:10:13 +08:00
|
|
|
|
if (focused)
|
|
|
|
|
|
{
|
|
|
|
|
|
LCD_FillRoundRectGradient(btn_x, y, btn_w, btn_h, btn_r,
|
|
|
|
|
|
START_COLOR, END_COLOR);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
LCD_FillRoundRect(btn_x, y, btn_w, btn_h, btn_r, COLOR_NORMAL_BG);
|
|
|
|
|
|
}
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-08-31 08:20:24 +08:00
|
|
|
|
LCD_WR_PIC_Trans(group_x, icon_y, UI_MODE_ICON_W, UI_MODE_ICON_H, icon, BLACK);
|
|
|
|
|
|
LCD_ShowChinese_AutoAlign(
|
|
|
|
|
|
text_x, (uint16_t)(text_x + text_w - 1),
|
2026-08-31 06:10:13 +08:00
|
|
|
|
text_y,
|
|
|
|
|
|
text,
|
2026-08-31 08:20:24 +08:00
|
|
|
|
LCD_ALIGN_LEFT,
|
2026-08-26 07:26:58 +08:00
|
|
|
|
UI_MODE_TEXT_COLOR,
|
2026-08-31 06:10:13 +08:00
|
|
|
|
BLACK,
|
|
|
|
|
|
1,
|
|
|
|
|
|
UI_MODE_FONT_SIZE
|
2026-08-26 07:26:58 +08:00
|
|
|
|
);
|
2026-08-31 06:10:13 +08:00
|
|
|
|
}
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-08-31 06:10:13 +08:00
|
|
|
|
void UI_DrawModeSelectScreen(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
UI_ClearFocus();
|
|
|
|
|
|
s_mode_select_focus = 0;
|
2026-08-31 08:20:24 +08:00
|
|
|
|
pCurrentTouch_Area = Touch_ModeSelect_Areas;
|
2026-08-31 06:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
LCD_FillByColor(0, 0, 240, 320, BLACK);
|
|
|
|
|
|
label_top();
|
2026-08-26 07:26:58 +08:00
|
|
|
|
|
2026-08-31 06:10:13 +08:00
|
|
|
|
UI_DrawModeSelectButton(40,
|
|
|
|
|
|
(const uint8_t *)"\xCD\xF2\xC4\xDC\xC4\xA3\xCA\xBD",
|
|
|
|
|
|
gImage_FreeMode_Icon_40_30,
|
|
|
|
|
|
s_mode_select_focus == 0);
|
|
|
|
|
|
UI_DrawModeSelectButton(132,
|
|
|
|
|
|
(const uint8_t *)"\xC6\xD5\xCD\xA8\xC4\xA3\xCA\xBD",
|
|
|
|
|
|
gImage_NormalMode_Icon_40_30,
|
|
|
|
|
|
s_mode_select_focus == 1);
|
|
|
|
|
|
UI_DrawModeSelectButton(224,
|
|
|
|
|
|
(const uint8_t *)"\xD7\xA8\xD2\xB5\xC4\xA3\xCA\xBD",
|
|
|
|
|
|
gImage_ExpressMode_Icon_40_30,
|
|
|
|
|
|
s_mode_select_focus == 2);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const Touch_AreaTypeDef Touch_ModeSelect_Areas[] = {
|
2026-08-31 08:21:58 +08:00
|
|
|
|
/* Xmin,Xmax,Ymin,Ymax, Flag, Value, ID, action
|
|
|
|
|
|
* Flag=按钮序号;ID=进入的 TAB(0万能Song / 1专业Expert / 2普通Free) */
|
|
|
|
|
|
{ 10, 229, 40, 126, 0, 0, 0, NULL }, /* 万能模式 → SongMode */
|
|
|
|
|
|
{ 10, 229, 132, 218, 1, 0, 2, NULL }, /* 普通模式 → FreeMode */
|
|
|
|
|
|
{ 10, 229, 224, 310, 2, 0, 1, NULL }, /* 专业模式 → ExpertMode */
|
2026-08-26 07:26:58 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define TOUCH_AREA_MODE_SELECT_NUM (sizeof(Touch_ModeSelect_Areas)/sizeof(Touch_AreaTypeDef))
|
|
|
|
|
|
|
|
|
|
|
|
/* Timbre_index <20><><EFBFBD><EFBFBD> midi_tables.h <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
|
extern uint8_t channel;
|
|
|
|
|
|
extern uint8_t level;
|
|
|
|
|
|
extern bool powon;
|
|
|
|
|
|
extern bool InModeFlag;
|
|
|
|
|
|
extern int16_t MIC_VOL_MAP[10];
|
|
|
|
|
|
extern int8_t delta;
|
|
|
|
|
|
extern STRING_MIDI USE_MIDI;
|
|
|
|
|
|
void LoadConfig()
|
|
|
|
|
|
{
|
|
|
|
|
|
SendProgramChangeMidiEvent(0,Timbre_index[mGuiData[GUI_TIMBRE_SELECT].Current]);
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t val_127 = (faders[0].val * 127) / 20;
|
|
|
|
|
|
SendVolumeChangeMidiEvent(1,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(2,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(3,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(4,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(5,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(6,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(7,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(8,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(9,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(10,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(11,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(12,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(13,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(14,val_127);
|
|
|
|
|
|
SendVolumeChangeMidiEvent(15,val_127);
|
|
|
|
|
|
|
|
|
|
|
|
SendVolumeChangeMidiEvent(0,faders[1].val);
|
|
|
|
|
|
|
|
|
|
|
|
AW816_Set_Volume(MIC_VOL_MAP[faders[2].val]);
|
|
|
|
|
|
|
|
|
|
|
|
AW816_Set_Reverb(faders[3].val * 10);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Touch_Mode_Select_Action(int8_t FLAG, uint8_t ID, uint8_t areaIndex)
|
|
|
|
|
|
{
|
2026-08-31 08:21:58 +08:00
|
|
|
|
(void)areaIndex;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
StartTask();
|
2026-08-31 06:10:13 +08:00
|
|
|
|
s_mode_select_focus = (uint8_t)FLAG;
|
2026-08-31 08:21:58 +08:00
|
|
|
|
/* ID 为 TAB 索引:0=万能(Song) 1=专业(Expert) 2=普通(Free) */
|
2026-08-26 07:26:58 +08:00
|
|
|
|
mGuiData[GUI_TAB_INDEX].Current = ID;
|
|
|
|
|
|
InModeFlag = true;
|
2026-08-31 08:21:58 +08:00
|
|
|
|
|
|
|
|
|
|
switch (ID)
|
2026-08-26 07:26:58 +08:00
|
|
|
|
{
|
2026-08-31 08:21:58 +08:00
|
|
|
|
case 0: /* 万能 */
|
|
|
|
|
|
if (mGuiData[GUI_AUTOBAND_SW].Current)
|
2026-08-26 07:26:58 +08:00
|
|
|
|
ADDRESS = 0x0009EB5F;
|
|
|
|
|
|
else
|
2026-08-31 08:21:58 +08:00
|
|
|
|
ADDRESS = 0x0001B8F0;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
MenuPage_SongMode_Proc();
|
2026-08-31 08:21:58 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 1: /* 专业 */
|
|
|
|
|
|
if (mGuiData[GUI_AUTOBAND_SW].Current)
|
2026-08-26 07:26:58 +08:00
|
|
|
|
ADDRESS = 0x0009EB5F;
|
|
|
|
|
|
else
|
2026-08-31 08:21:58 +08:00
|
|
|
|
ADDRESS = 0x00000000;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
MenuPage_ExpertMode_Proc();
|
2026-08-31 08:21:58 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 2: /* 普通 */
|
2026-08-26 07:26:58 +08:00
|
|
|
|
ADDRESS = 0x0009598F;
|
|
|
|
|
|
MenuPage_FreeMode_Proc();
|
2026-08-31 08:21:58 +08:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
2026-08-26 07:26:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern uint8_t bat_init_done;
|
|
|
|
|
|
void IdleProcess(DisplayTaskMessage_Type msg)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t vol;
|
|
|
|
|
|
switch (msg.MessageType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case MSG_ID_POWER_ON :
|
|
|
|
|
|
LCD_BLK_Set();
|
|
|
|
|
|
LCD_FillByColor(0, 0, 240, 320, WHITE);
|
|
|
|
|
|
LCD_WR_PIC_FROM_FLASH(40, 80, 168, 155, 0x00000000);
|
|
|
|
|
|
BSP_SelectAdcChannel(6);
|
|
|
|
|
|
wk_delay_ms(1000);
|
|
|
|
|
|
LoadConfig();
|
|
|
|
|
|
vol = ADC_ReadChannel(ADC_CHANNEL_1)>>5;
|
|
|
|
|
|
if (vol <= 5) level = 0;
|
|
|
|
|
|
else if (vol <= 35) level = 1;
|
|
|
|
|
|
else if (vol <= 65) level = 2;
|
|
|
|
|
|
else if (vol <= 95) level = 3;
|
|
|
|
|
|
else if (vol <= 115) level = 4;
|
|
|
|
|
|
else level = 5;
|
|
|
|
|
|
Send_volume(vol);
|
|
|
|
|
|
|
|
|
|
|
|
UI_DrawModeSelectScreen();
|
|
|
|
|
|
TM1629D_AllLedOn(LED_COLOR_G);
|
|
|
|
|
|
TM1629D_UpdateDisplay(0);
|
|
|
|
|
|
StartTouchTask();
|
|
|
|
|
|
StartScanTask();
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case MSG_ID_POWER_OFF:
|
|
|
|
|
|
/* 关机:熄屏 + 关背光 */
|
|
|
|
|
|
LCD_BLK_Clr();
|
|
|
|
|
|
LCD_FillByColor(0, 0, 240, 320, BLACK);
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case MSG_ID_CHARG:
|
|
|
|
|
|
Show_Battery_Icon(msg.ID);
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case MSG_ID_TOUCH:
|
|
|
|
|
|
for(uint8_t k=0; k<TOUCH_AREA_MODE_SELECT_NUM; k++)
|
|
|
|
|
|
{
|
2026-08-31 08:20:24 +08:00
|
|
|
|
if( msg.HiByte >= Touch_ModeSelect_Areas[k].x_min && msg.HiByte <= Touch_ModeSelect_Areas[k].x_max &&
|
|
|
|
|
|
msg.LoByte >= Touch_ModeSelect_Areas[k].y_min && msg.LoByte <= Touch_ModeSelect_Areas[k].y_max )
|
2026-08-26 07:26:58 +08:00
|
|
|
|
{
|
2026-08-31 08:20:24 +08:00
|
|
|
|
Touch_Mode_Select_Action(Touch_ModeSelect_Areas[k].Flag,Touch_ModeSelect_Areas[k].ID,k);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case MSG_ID_BATTERY_VALUE:
|
2026-08-28 10:34:27 +08:00
|
|
|
|
Draw_Status_Battery_Icon(msg.ID);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case MSG_ID_POWOFF_CHARG:
|
|
|
|
|
|
{
|
|
|
|
|
|
static bool flag = 0;
|
|
|
|
|
|
if(flag == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
BSP_MainPowerEnable(1);
|
|
|
|
|
|
LCD_WR_REG(0x29); //Display on
|
|
|
|
|
|
|
|
|
|
|
|
LCD_WR_PIC_FROM_FLASH(40, 50, 160, 190, 0x0000CB70);
|
|
|
|
|
|
LCD_BLK_Set();
|
|
|
|
|
|
flag = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(usb_charging_state)
|
|
|
|
|
|
{
|
|
|
|
|
|
uint8_t Info[10] = {0,};
|
|
|
|
|
|
sprintf ((char*)Info, "%d%%", msg.ID);
|
2026-08-28 11:24:06 +08:00
|
|
|
|
LCD_ShowString_AutoAlign(0,240,250,Info,LCD_ALIGN_CENTER,WHITE,BLACK,0,28);
|
2026-08-26 07:26:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//BSP_MainPowerEnable(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case MSG_ID_EC_VOL:
|
|
|
|
|
|
{
|
|
|
|
|
|
//LCD_ShowString(200, 0, Num_To_String(msg.DataU16[1],buff,3), RED, WHITE, 16, 0);
|
|
|
|
|
|
uint8_t vol = msg.ID;
|
|
|
|
|
|
if (vol <= 5) level = 0;
|
|
|
|
|
|
else if (vol <= 35) level = 1;
|
|
|
|
|
|
else if (vol <= 65) level = 2;
|
|
|
|
|
|
else if (vol <= 95) level = 3;
|
|
|
|
|
|
else if (vol <= 115) level = 4;
|
|
|
|
|
|
else level = 5;
|
|
|
|
|
|
Draw_Volume_Bar(5, 5, level, 1, WHITE, GRAY);
|
|
|
|
|
|
uint8_t mMasterSysExVolume[12] = { 0xF0, 0x41, 0x00, 0x42, 0x12, 0x40, 0x00, 0x04, 0x64, 0x00, 0x00,0xF7};
|
|
|
|
|
|
memset(mMasterSysExVolume+8,msg.ID,1);
|
|
|
|
|
|
SendMidiDataToDreamDSP(mMasterSysExVolume,12);
|
|
|
|
|
|
ResetAutoPowerCount();
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|