Skip to content

Commit

Permalink
Merge pull request #158 from ligenxxxx/reset-config
Browse files Browse the repository at this point in the history
reset config
  • Loading branch information
ligenxxxx authored Sep 25, 2023
2 parents 9711a67 + e0cf00f commit ecc4e06
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ void camera_setting_read(void) {
return;

camera_type_last = camera_reg_read_eep(EEP_ADDR_CAM_TYPE);
#ifdef RESET_CONFIG
camera_type_last = CAMERA_TYPE_UNKNOW;
#endif
if (camera_type_last != camera_type) {
camera_profile_reset();
camera_profile_write();
Expand Down
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 ecc4e06

Please sign in to comment.