Skip to content

Commit

Permalink
define BASE_CH_NUM is 12 (R1-R2 E1 F1 F2 F4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ligenxxxx committed Nov 6, 2023
1 parent 96af9ed commit e32961d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/core/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ uint8_t channel_osd_mode;

char *channel2str(uint8_t band, uint8_t channel) // channel=[1:18]
{
static char *ChannelName[2][12] = {
static char *ChannelName[2][BASE_CH_NUM] = {
{"R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "E1", "F1", "F2", "F4"},
{"L1", "L2", "L3", "L4", "L5", "L6", "L7", "L8", " ", " ", " ", " "},
};
Expand Down
4 changes: 2 additions & 2 deletions src/driver/dm6302.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
/* �����ź�:
Expand Down Expand Up @@ -233,7 +233,7 @@ void DM6302_SetChannel(uint8_t band, uint8_t ch) {
// 1: lowband
// 0: race band
if (band == 1)
ch = ch + 12;
ch = ch + BASE_CH_NUM;
SPI_Write(0, 0x6, 0xFF0, 0x00000018);
SPI_Write(0, 0x3, 0x130, 0x00000013);
SPI_Write(0, 0x3, 0x134, 0x00000013);
Expand Down
1 change: 1 addition & 0 deletions src/driver/dm6302.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdint.h>

// #define _DEBUG_DM6300
#define BASE_CH_NUM 12

typedef enum {
DM5680_L = 0,
Expand Down
19 changes: 9 additions & 10 deletions src/ui/page_scannow.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ typedef struct {
lv_obj_t *img1;
} channel_t;

#define SCAN_CH_NUM 12
channel_t channel_tb[SCAN_CH_NUM];
channel_status_t channel_status_tb[SCAN_CH_NUM];
channel_t channel_tb[BASE_CH_NUM];
channel_status_t channel_status_tb[BASE_CH_NUM];

////////////////////////////////////////////////////////////////////////////////////////////////////
int valid_channel_tb[SCAN_CH_NUM];
int valid_channel_tb[BASE_CH_NUM];
int user_select_index = 0;

// local
Expand All @@ -78,7 +77,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 < SCAN_CH_NUM; i++) {
for (int i = 0; i < BASE_CH_NUM; i++) {
if (channel_status_tb[i].is_valid) {
lv_img_set_src(channel_tb[i].img0, &img_signal_status2);
} else {
Expand Down Expand Up @@ -164,11 +163,11 @@ void page_scannow_set_channel_label(void) {
// set channel label
if (g_setting.source.hdzero_band == RACE_BAND) {
// race band
for (i = 0; i < SCAN_CH_NUM; i++) {
for (i = 0; i < BASE_CH_NUM; i++) {
lv_label_set_text(channel_tb[i].label, race_band_channel_str[i]);
}

for (i = 8; i < SCAN_CH_NUM; i++) {
for (i = 8; i < BASE_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);
Expand All @@ -178,7 +177,7 @@ void page_scannow_set_channel_label(void) {
for (i = 0; i < 8; i++) {
lv_label_set_text(channel_tb[i].label, low_band_channel_str[i]);
}
for (i = 8; i < SCAN_CH_NUM; i++) {
for (i = 8; i < BASE_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);
Expand Down Expand Up @@ -278,7 +277,7 @@ static void user_select_signal(void) {

static void user_clear_signal(void) {
user_select_index = 0;
for (int i = 0; i < SCAN_CH_NUM; i++) {
for (int i = 0; i < BASE_CH_NUM; i++) {
lv_img_set_src(channel_tb[i].img0, &img_signal_status);
lv_img_set_src(channel_tb[i].img1, &img_ant1);
}
Expand Down Expand Up @@ -322,7 +321,7 @@ int8_t scan_now(void) {
lv_timer_handler();

// clear
for (ch = 0; ch < SCAN_CH_NUM; ch++) {
for (ch = 0; ch < BASE_CH_NUM; ch++) {
valid_channel_tb[ch] = -1;
channel_status_tb[ch].is_valid = 0;
}
Expand Down

0 comments on commit e32961d

Please sign in to comment.