diff --git a/src/core/osd.c b/src/core/osd.c index 22ffdddd..c56aeb3b 100644 --- a/src/core/osd.c +++ b/src/core/osd.c @@ -263,9 +263,9 @@ uint8_t channel_osd_mode; char *channel2str(uint8_t band, uint8_t channel) // channel=[1:18] { - static char *ChannelName[2][10] = { - {"R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "F2", "F4"}, - {"L1", "L2", "L3", "L4", "L5", "L6", "L7", "L8", " ", " "}, + static char *ChannelName[2][12] = { + {"R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "E1", "F1", "F2", "F4"}, + {"L1", "L2", "L3", "L4", "L5", "L6", "L7", "L8", " ", " ", " ", " "}, }; if ((channel > 0) && (channel <= CHANNEL_NUM)) diff --git a/src/driver/dm6302.c b/src/driver/dm6302.c index cb3e70b5..acbbd3cd 100644 --- a/src/driver/dm6302.c +++ b/src/driver/dm6302.c @@ -14,7 +14,7 @@ #include "i2c.h" #include "uart.h" -#define WAIT(ms) usleep((ms)*1000) +#define WAIT(ms) usleep((ms) * 1000) // DM6302: RF receiver /* �����ź�: @@ -135,7 +135,8 @@ void SPI_Write(uint8_t sel, uint8_t page, uint16_t addr, uint32_t dat) { } // ����Ƶ�� -uint32_t tab[3][18] = { +uint32_t tab[3][20] = { + // 0x120 { // race band 0x3741, @@ -146,9 +147,15 @@ uint32_t tab[3][18] = { 0x390F, 0x396C, 0x39C8, - // fatshark band - 0x3840, - 0x38A4, + + // e band + 0x38DF, // E1 + + // fatshark band + 0x3938, // F1 + 0x3840, // F2 + 0x38A4, // F4 + // low band 0x3574, 0x35D2, @@ -159,6 +166,7 @@ uint32_t tab[3][18] = { 0x37AA, 0x3809, }, + // 0x104 { // race band 0x93, @@ -169,9 +177,15 @@ uint32_t tab[3][18] = { 0x98, 0x99, 0x9A, + + // e band + 0x94, // E1 + // fatshark band - 0x96, - 0x97, + 0x95, // F1 + 0x96, // F2 + 0x97, // F4 + // low band 0x8B, 0x8C, @@ -182,6 +196,7 @@ uint32_t tab[3][18] = { 0x91, 0x92, }, + // 0x108 { // race band 0xB00000, @@ -192,9 +207,15 @@ uint32_t tab[3][18] = { 0x52AAAB, 0x400000, 0x2D5555, + + // e band + 0X122AAAB, // E1 + // fatshark band - 0x000000, - 0x155555, + 0XF55555, // F1 + 0x000000, // F2 + 0x155555, // F4 + // low band 0x1455555, 0x132AAAB, @@ -208,28 +229,31 @@ uint32_t tab[3][18] = { }; void DM6302_SetChannel(uint8_t band, uint8_t ch) { + // band + // 1: lowband + // 0: race band if (band == 1) - ch = ch + 10; + ch = ch + 12; SPI_Write(0, 0x6, 0xFF0, 0x00000018); SPI_Write(0, 0x3, 0x130, 0x00000013); SPI_Write(0, 0x3, 0x134, 0x00000013); SPI_Write(0, 0x3, 0x138, 0x00000370); SPI_Write(0, 0x3, 0x13C, 0x00000410); SPI_Write(0, 0x3, 0x140, 0x00000000); - if (band == 1) { + if (band == 1 || ch == 8 || ch == 9) { SPI_Write(0, 0x3, 0x144, 0x15240735); } else { SPI_Write(0, 0x3, 0x144, 0x0D640735); } SPI_Write(0, 0x3, 0x148, 0x01017F03); - if (band == 1) { + if (band == 1 || ch == 8 || ch == 9) { SPI_Write(0, 0x3, 0x14C, 0x021288A2); } else { SPI_Write(0, 0x3, 0x14C, 0x022288A2); } SPI_Write(0, 0x3, 0x150, 0x00FFCF33); - if (band == 1) { + if (band == 1 || ch == 8 || ch == 9) { SPI_Write(0, 0x3, 0x154, 0x1F2C3840); SPI_Write(0, 0x3, 0x128, 0x00008031); } else { @@ -241,7 +265,7 @@ void DM6302_SetChannel(uint8_t band, uint8_t ch) { SPI_Write(0, 0x3, 0x11C, 0x00000002); SPI_Write(0, 0x3, 0x118, 0x00000001); SPI_Write(0, 0x3, 0x118, 0x00000000); - if (band == 1) { + if (band == 1 || ch == 8 || ch == 9) { SPI_Write(0, 0x3, 0x128, 0x00008031); } else { SPI_Write(0, 0x3, 0x128, 0x00008030); @@ -256,7 +280,7 @@ void DM6302_SetChannel(uint8_t band, uint8_t ch) { SPI_Write(0, 0x3, 0x100, 0x00000000); SPI_Write(0, 0x3, 0x100, 0x00000003); SPI_Write(0, 0x3, 0x150, 0x000333B3); - if (band == 1) { + if (band == 1 || ch == 8 || ch == 9) { SPI_Write(0, 0x3, 0x140, 0x07070002); } else { SPI_Write(0, 0x3, 0x140, 0x07070000); diff --git a/src/driver/dm6302.h b/src/driver/dm6302.h index 915f0006..382e0550 100644 --- a/src/driver/dm6302.h +++ b/src/driver/dm6302.h @@ -6,7 +6,6 @@ // #define _DEBUG_DM6300 -#define FREQ_NUM 18 typedef enum { DM5680_L = 0, DM5680_R, diff --git a/src/ui/page_scannow.c b/src/ui/page_scannow.c index cc5080eb..e75dd2d0 100644 --- a/src/ui/page_scannow.c +++ b/src/ui/page_scannow.c @@ -59,11 +59,12 @@ typedef struct { lv_obj_t *img1; } channel_t; -channel_t channel_tb[10]; -channel_status_t channel_status_tb[10]; +#define SCAN_CH_NUM 12 +channel_t channel_tb[SCAN_CH_NUM]; +channel_status_t channel_status_tb[SCAN_CH_NUM]; //////////////////////////////////////////////////////////////////////////////////////////////////// -int valid_channel_tb[10]; +int valid_channel_tb[SCAN_CH_NUM]; int user_select_index = 0; // local @@ -77,7 +78,7 @@ static lv_coord_t col_dsc2[] = {120, 80, 80, 180, 100, 80, 80, 180, LV_GRID_TEMP static lv_coord_t row_dsc2[] = {60, 60, 60, 60, 60, 60, 60, 60, 60, 60, LV_GRID_TEMPLATE_LAST}; static void select_signal(channel_t *channel) { - for (int i = 0; i < 10; i++) { + for (int i = 0; i < SCAN_CH_NUM; i++) { if (channel_status_tb[i].is_valid) { lv_img_set_src(channel_tb[i].img0, &img_signal_status2); } else { @@ -156,35 +157,32 @@ static void create_channel_switch(lv_obj_t *parent, int col, int row, channel_t } void page_scannow_set_channel_label(void) { - static const char *race_band_channel_str[] = {"R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8"}; - static const char *fatshark_band_channel_str[] = {"F2", "F4"}; + static const char *race_band_channel_str[] = {"R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "E1", "F1", "F2", "F4"}; static const char *low_band_channel_str[] = {"L1", "L2", "L3", "L4", "L5", "L6", "L7", "L8"}; uint8_t i; // set channel label if (g_setting.source.hdzero_band == RACE_BAND) { - for (i = 0; i < 8; i++) { + // race band + for (i = 0; i < SCAN_CH_NUM; i++) { lv_label_set_text(channel_tb[i].label, race_band_channel_str[i]); } - lv_label_set_text(channel_tb[8].label, fatshark_band_channel_str[0]); - lv_label_set_text(channel_tb[9].label, fatshark_band_channel_str[1]); - - lv_obj_clear_flag(channel_tb[8].img0, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(channel_tb[8].label, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(channel_tb[8].img1, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(channel_tb[9].img0, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(channel_tb[9].label, LV_OBJ_FLAG_HIDDEN); - lv_obj_clear_flag(channel_tb[9].img1, LV_OBJ_FLAG_HIDDEN); + + for (i = 8; i < SCAN_CH_NUM; i++) { + lv_obj_clear_flag(channel_tb[i].img0, LV_OBJ_FLAG_HIDDEN); + lv_obj_clear_flag(channel_tb[i].label, LV_OBJ_FLAG_HIDDEN); + lv_obj_clear_flag(channel_tb[i].img1, LV_OBJ_FLAG_HIDDEN); + } } else { + // lowband for (i = 0; i < 8; i++) { lv_label_set_text(channel_tb[i].label, low_band_channel_str[i]); } - lv_obj_add_flag(channel_tb[8].img0, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag(channel_tb[8].label, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag(channel_tb[8].img1, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag(channel_tb[9].img0, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag(channel_tb[9].label, LV_OBJ_FLAG_HIDDEN); - lv_obj_add_flag(channel_tb[9].img1, LV_OBJ_FLAG_HIDDEN); + for (i = 8; i < SCAN_CH_NUM; i++) { + lv_obj_add_flag(channel_tb[i].img0, LV_OBJ_FLAG_HIDDEN); + lv_obj_add_flag(channel_tb[i].label, LV_OBJ_FLAG_HIDDEN); + lv_obj_add_flag(channel_tb[i].img1, LV_OBJ_FLAG_HIDDEN); + } } } @@ -254,12 +252,16 @@ static lv_obj_t *page_scannow_create(lv_obj_t *parent, panel_arr_t *arr) { lv_obj_set_style_grid_row_dsc_array(cont2, row_dsc2, 0); // create channel - uint8_t i; + uint8_t col_offset = 1; + uint8_t row_offset = 0; + for (int i = 0; i < 8; i++) { - create_channel_switch(cont2, ((i >> 2) << 2) + 1, i & 0x03, &channel_tb[i]); + create_channel_switch(cont2, ((i >> 2) << 2) + col_offset, i & 0x03, &channel_tb[i]); } - for (int i = 0; i < 2; i++) { - create_channel_switch(cont2, (i << 2) + 1, 4, &channel_tb[8 + i]); + + row_offset = 4; + for (int i = 0; i < 4; i++) { + create_channel_switch(cont2, ((i >> 1) << 2) + col_offset, row_offset + (i & 0x01), &channel_tb[8 + i]); } page_scannow_set_channel_label(); @@ -276,7 +278,7 @@ static void user_select_signal(void) { static void user_clear_signal(void) { user_select_index = 0; - for (int i = 0; i < 10; i++) { + for (int i = 0; i < SCAN_CH_NUM; i++) { lv_img_set_src(channel_tb[i].img0, &img_signal_status); lv_img_set_src(channel_tb[i].img1, &img_ant1); } @@ -320,7 +322,7 @@ int8_t scan_now(void) { lv_timer_handler(); // clear - for (ch = 0; ch < 10; ch++) { + for (ch = 0; ch < SCAN_CH_NUM; ch++) { valid_channel_tb[ch] = -1; channel_status_tb[ch].is_valid = 0; } diff --git a/src/ui/page_scannow.h b/src/ui/page_scannow.h index 83bc1ba9..5f35be8c 100644 --- a/src/ui/page_scannow.h +++ b/src/ui/page_scannow.h @@ -4,7 +4,7 @@ #include "ui/ui_main_menu.h" #include -#define CHANNEL_NUM (g_setting.source.hdzero_band == RACE_BAND ? 10 : 8) +#define CHANNEL_NUM (g_setting.source.hdzero_band == RACE_BAND ? 12 : 8) typedef enum { RACE_BAND = 0,