Skip to content

Commit

Permalink
reset config
Browse files Browse the repository at this point in the history
  • Loading branch information
ligenxxxx committed Sep 20, 2023
1 parent f9da7c0 commit a1d6887
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
// #define REV_UART
// #define VIDEO_PAT
// #define FIX_EEP
#define RESET_CONFIG

#ifndef _RF_CALIB
// #define _DEBUG_MODE
Expand Down
18 changes: 17 additions & 1 deletion src/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void GetVtxParameter() {
}

// VTX Setting
lowband_lock = 0x01 & I2C_Read8_Wait(10, ADDR_EEPROM, EEP_ADDR_LOWBAND_LOCK);
lowband_lock = I2C_Read8_Wait(10, ADDR_EEPROM, EEP_ADDR_LOWBAND_LOCK);
RF_FREQ = I2C_Read8(ADDR_EEPROM, EEP_ADDR_RF_FREQ);
RF_POWER = I2C_Read8(ADDR_EEPROM, EEP_ADDR_RF_POWER);
LP_MODE = I2C_Read8(ADDR_EEPROM, EEP_ADDR_LPMODE);
Expand All @@ -404,6 +404,22 @@ void GetVtxParameter() {
BAUDRATE = I2C_Read8(ADDR_EEPROM, EEP_ADDR_BAUDRATE);
#endif
CFG_Back();
#ifdef RESET_CONFIG
RF_FREQ = 0;
RF_POWER = 0;
LP_MODE = 0;
PIT_MODE = 0;
OFFSET_25MW = 0;
TEAM_RACE = 0;
BAUDRATE = 0;
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_RF_FREQ, RF_FREQ);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_RF_POWER, RF_POWER);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_LPMODE, LP_MODE);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_PITMODE, PIT_MODE);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_25MW, OFFSET_25MW);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_TEAM_RACE, TEAM_RACE);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_BAUDRATE, BAUDRATE);
#endif
#ifdef _DEBUG_MODE
debugf("\r\nUSE EEPROM for VTX setting:RF_FREQ=%d, RF_POWER=%d, LPMODE=%d PIT_MODE=%d", (uint16_t)RF_FREQ, (uint16_t)RF_POWER, (uint16_t)LP_MODE, (uint16_t)PIT_MODE);
#endif
Expand Down

0 comments on commit a1d6887

Please sign in to comment.