Skip to content

Commit

Permalink
Merge pull request #173 from ligenxxxx/add-E1-and-F1
Browse files Browse the repository at this point in the history
add channel E1 and F1
  • Loading branch information
ligenxxxx authored Nov 6, 2023
2 parents a7461cb + 617e107 commit e35e9ea
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 214 deletions.
2 changes: 2 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@
#define FREQ_R6 (uint16_t)5843
#define FREQ_R7 (uint16_t)5880
#define FREQ_R8 (uint16_t)5917
#define FREQ_E1 (uint16_t)5705
#define FREQ_F1 (uint16_t)5740
#define FREQ_F2 (uint16_t)5760
#define FREQ_F4 (uint16_t)5800
#define FREQ_L1 (uint16_t)5362
Expand Down
67 changes: 46 additions & 21 deletions src/dm6300.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ uint8_t dm6300_init_done = 0;
uint8_t dm6300_lost = 0;
#if defined HDZERO_FREESTYLE_V1 || HDZERO_FREESTYLE_V2
uint8_t table_power[FREQ_NUM_EXTERNAL][POWER_MAX + 1] = {
// race band
{0x70, 0x68, 0x5c, 0x60},
{0x70, 0x68, 0x5c, 0x60},
{0x70, 0x68, 0x60, 0x60},
Expand All @@ -34,9 +35,12 @@ uint8_t table_power[FREQ_NUM_EXTERNAL][POWER_MAX + 1] = {
{0x78, 0x74, 0x64, 0x5b},
{0x7a, 0x77, 0x64, 0x5b},
{0x7a, 0x77, 0x64, 0x5b},
// e band
{0x70, 0x68, 0x5c, 0x60}, // E1
// fatshark band
{0x72, 0x6d, 0x60, 0x60},
{0x74, 0x70, 0x62, 0x5c},
{0x70, 0x68, 0x60, 0x60}, // F1
{0x72, 0x6d, 0x60, 0x60}, // F2
{0x74, 0x70, 0x62, 0x5c}, // F4
// low band
{0x70, 0x68, 0x5c, 0x60},
{0x70, 0x68, 0x5c, 0x60},
Expand All @@ -58,9 +62,12 @@ uint8_t table_power[FREQ_NUM_EXTERNAL][POWER_MAX + 1] = {
{0x70, 0x7B},
{0x72, 0x7E},
{0x71, 0x7C},
// e band
{0x79, 0x83}, // E1
// fatshark band
{0x73, 0x7E},
{0x72, 0x7C},
{0x75, 0x80}, // F1
{0x73, 0x7E}, // F2
{0x72, 0x7C}, // F4
// low band
{0x79, 0x83},
{0x79, 0x83},
Expand All @@ -84,9 +91,15 @@ const uint32_t tab[3][FREQ_NUM_EXTERNAL] = {
0x3A3F,
0x3A9E,
0x3AFC,

// E band
0x38DF, // E1

// fatshark bank
0x3840,
0x38A4,
0x3938, // F1
0x3840, // F2
0x38A4, // F4

// low band
0x3574,
0x35D2,
Expand All @@ -107,9 +120,15 @@ const uint32_t tab[3][FREQ_NUM_EXTERNAL] = {
0x98,
0x99,
0x9a,

// E band
0x94, // E1

// fatshark bank
0x96,
0x97,
0x95, // F1
0x96, // F2
0x97, // F4

// low band
0x8B,
0x8C,
Expand All @@ -130,9 +149,14 @@ const uint32_t tab[3][FREQ_NUM_EXTERNAL] = {
0x52AAAB,
0x400000,
0x2D5555,
// E band
0x122AAAB, // E1

// fatshark bank
0x000000,
0x155555,
0xF55555, // F1
0x000000, // F2
0x155555, // F4

// low band
0x1455555,
0x132AAAB,
Expand All @@ -155,9 +179,15 @@ const uint32_t freq_tab[FREQ_NUM_EXTERNAL] = {
116780,
117560,
118280,

// e band
114100, // E1

// fatshark bank
115200,
116000,
114800, // F1
115200, // F2
116000, // F4

// low band
107240,
107980,
Expand All @@ -178,6 +208,8 @@ const uint16_t frequencies[] = {
FREQ_R6,
FREQ_R7,
FREQ_R8,
FREQ_E1,
FREQ_F1,
FREQ_F2,
FREQ_F4,
FREQ_L1,
Expand Down Expand Up @@ -241,14 +273,7 @@ void DM6300_SetChannel(uint8_t ch) {

if (ch >= FREQ_NUM)
ch = 0;
/*#ifndef _RF_CALIB
#ifndef _DEBUG_MODE
else if(ch == 5) ch = 7;
else if(ch == 6) ch = 5;
else if(ch == 7) ch = 6;
#endif
#endif
*/

dm6300_set_channel_regs[12].dat = 0x00008000 + (init6300_fcnt & 0xFF);
dm6300_set_channel_regs[13].dat = init6300_fnum[ch];

Expand Down Expand Up @@ -290,7 +315,7 @@ void DM6300_SetPower(uint8_t pwr, uint8_t freq, uint8_t offset) {
#ifdef _DEBUG_MODE
debugf("\r\nDM6300 set power:%x, offset:%x", (uint16_t)pwr, (uint16_t)offset);
#endif
if (freq > 9)
if (freq >= FREQ_NUM)
freq = 0;
SPI_Write(0x6, 0xFF0, 0x00000018);

Expand Down
36 changes: 26 additions & 10 deletions src/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ CODE_SEG const uint8_t BPLED[] = {
0x8E, // F
0x0E, // F.
0x47, // L.
0x06, // E.
};

uint8_t dispE_cnt = 0xff;
uint8_t dispF_cnt = 0xff;
uint8_t dispL_cnt = 0xff;

Expand Down Expand Up @@ -1158,9 +1160,11 @@ void Button1_SP() {
switch (cfg_step) {
case 0:
cfg_step = 1;
if ((RF_FREQ == 8) || (RF_FREQ == 9))
if (RF_FREQ == 8)
dispE_cnt = 0;
else if ((RF_FREQ == 9) || (RF_FREQ == 10) || (RF_FREQ == 11))
dispF_cnt = 0;
else if (RF_FREQ > 9)
else if (RF_FREQ > 11)
dispL_cnt = 0;
CFG_Back();

Expand All @@ -1170,9 +1174,11 @@ void Button1_SP() {
if (RF_FREQ == FREQ_NUM)
RF_FREQ = 0;

if ((RF_FREQ == 8) || (RF_FREQ == 9))
if (RF_FREQ == 8)
dispE_cnt = 0;
else if ((RF_FREQ == 9) || (RF_FREQ == 10) || (RF_FREQ == 11))
dispF_cnt = 0;
else if (RF_FREQ > 9)
else if (RF_FREQ > 11)
dispL_cnt = 0;
Imp_RF_Param();
Setting_Save();
Expand Down Expand Up @@ -1291,10 +1297,16 @@ void Flicker_MAX(uint8_t ch, uint8_t cnt) {
void BlinkPhase() {
uint8_t bp = 0;

if (cfg_step == 1 && dispF_cnt < DISP_TIME) { // display 'F' band
if (cfg_step == 1 && dispE_cnt < DISP_TIME) {
// display 'E' band
bp = BPLED[16];
set_segment(bp);
} else if (cfg_step == 1 && dispF_cnt < DISP_TIME) {
// display 'F' band
bp = BPLED[14];
set_segment(bp);
} else if (cfg_step == 1 && dispL_cnt < DISP_TIME) { // display 'L' band
} else if (cfg_step == 1 && dispL_cnt < DISP_TIME) {
// display 'L' band
bp = BPLED[15];
set_segment(bp);
} else {
Expand All @@ -1306,14 +1318,18 @@ void BlinkPhase() {
#endif

case 1:
if (RF_FREQ <= 7)
if (RF_FREQ < 8)
bp = BPLED[RF_FREQ + 1];
else if (RF_FREQ == 8) // F2
else if (RF_FREQ == 8) // E1
bp = BPLED[1];
else if (RF_FREQ == 9) // F1
bp = BPLED[1];
else if (RF_FREQ == 10) // F2
bp = BPLED[2];
else if (RF_FREQ == 9) // F4
else if (RF_FREQ == 11) // F4
bp = BPLED[4];
else
bp = BPLED[RF_FREQ - 9];
bp = BPLED[RF_FREQ - 11];
set_segment(bp);
break;

Expand Down
5 changes: 3 additions & 2 deletions src/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ typedef enum {
#define EEP_ADDR_EEP_VLD 0xFF

#define FREQ_NUM_INTERNAL 8
#define FREQ_NUM_EXTERNAL 18
#define FREQ_NUM_EXTERNAL 20
extern uint8_t lowband_lock;
#define FREQ_NUM (lowband_lock ? 10 : 18)
#define FREQ_NUM (lowband_lock ? 12 : 20)
#if defined HDZERO_FREESTYLE_V1 || HDZERO_FREESTYLE_V2
#define POWER_MAX 3
#else
Expand Down Expand Up @@ -136,6 +136,7 @@ extern uint8_t ch_init;

extern uint8_t led_status;

extern uint8_t dispE_cnt;
extern uint8_t dispF_cnt;
extern uint8_t dispL_cnt;
extern uint8_t temp_err;
Expand Down
Loading

0 comments on commit e35e9ea

Please sign in to comment.