Skip to content

Commit

Permalink
+ tri servo params in lcd
Browse files Browse the repository at this point in the history
+ MY_PRIVATE_DEFAULTS (http://www.multiwii.com/forum/viewtopic.php?f=8&t=3987)
+ lcd.config: reset to defaults



git-svn-id: http://multiwii.googlecode.com/svn/trunk/MultiWii_shared@1559 02679b44-d973-9852-f2fa-63770883b36c
  • Loading branch information
[email protected] committed Aug 31, 2013
1 parent 9632ad2 commit 1538010
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
16 changes: 12 additions & 4 deletions EEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,21 @@ void update_constants() {
conf.governorP = GOVERNOR_P;
conf.governorD = GOVERNOR_D;
#endif
#if defined(MY_PRIVATE_DEFAULTS)
#include MY_PRIVATE_DEFAULTS
#endif
writeParams(0); // this will also (p)reset checkNewConf with the current version number again.
}

void LoadDefaults() {
uint8_t i;
#ifndef SUPPRESS_DEFAULTS_FROM_GUI
#if PID_CONTROLLER == 1
#ifdef SUPPRESS_DEFAULTS_FROM_GUI
// do nothing
#elif defined(MY_PRIVATE_DEFAULTS)
// #include MY_PRIVATE_DEFAULTS
// do that at the last possible moment, so we can override virtually all defaults and constants
#else
#if PID_CONTROLLER == 1
conf.pid[ROLL].P8 = 33; conf.pid[ROLL].I8 = 30; conf.pid[ROLL].D8 = 23;
conf.pid[PITCH].P8 = 33; conf.pid[PITCH].I8 = 30; conf.pid[PITCH].D8 = 23;
conf.pid[PIDLEVEL].P8 = 90; conf.pid[PIDLEVEL].I8 = 10; conf.pid[PIDLEVEL].D8 = 100;
Expand Down Expand Up @@ -160,7 +168,7 @@ void LoadDefaults() {
for(i=0;i<CHECKBOXITEMS;i++) {conf.activate[i] = 0;}
conf.angleTrim[0] = 0; conf.angleTrim[1] = 0;
conf.powerTrigger1 = 0;
#endif
#endif // SUPPRESS_DEFAULTS_FROM_GUI
#if defined(SERVO)
static int8_t sr[8] = SERVO_RATES;
#ifdef SERVO_MIN
Expand All @@ -185,7 +193,7 @@ void LoadDefaults() {
conf.dynThrPID = 50;
conf.rcExpo8 = 0;
#endif
update_constants();
update_constants(); // this will also write to eeprom
}

#ifdef LOG_PERMANENT
Expand Down
19 changes: 17 additions & 2 deletions LCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ void initLCD() {
// -------------------- configuration menu to LCD over serial/i2c ----------------------------------

#ifdef LCD_CONF
static uint8_t reset_to_defaults;

typedef void (*formatter_func_ptr)(void *, uint8_t, uint8_t);
typedef void (*inc_func_ptr)(void *, int16_t);
Expand Down Expand Up @@ -990,6 +991,8 @@ const char PROGMEM lcd_param_text37 [] = "SERvTRIM2";
#ifdef TRI // 0123456789
const char PROGMEM lcd_param_text38 [] = "SERvTRIMy";
const char PROGMEM lcd_param_text39 [] = "SERvINVy";
const char PROGMEM lcd_param_text152 [] = "SERvMINy";
const char PROGMEM lcd_param_text153 [] = "SERvMAXy";
#endif
//#ifdef LOG_VALUES
//const char PROGMEM lcd_param_text39 [] = "failsafes ";
Expand Down Expand Up @@ -1081,6 +1084,7 @@ const char PROGMEM lcd_param_text135 [] = "GovernRpm";
#ifdef MULTIPLE_CONFIGURATION_PROFILES
const char PROGMEM lcd_param_text150 [] = "writeCset";
#endif
const char PROGMEM lcd_param_text151 [] = "Reset (7)";
// 0123456789

PROGMEM const void * const lcd_param_ptr_table [] = {
Expand Down Expand Up @@ -1317,6 +1321,8 @@ PROGMEM const void * const lcd_param_ptr_table [] = {
&lcd_param_text37, &conf.servoConf[4].middle, &__SE,
#endif
#ifdef TRI
&lcd_param_text152, &conf.servoConf[5].min, &__SE,
&lcd_param_text153, &conf.servoConf[5].max, &__SE,
&lcd_param_text38, &conf.servoConf[5].middle, &__SE,
&lcd_param_text39, &conf.servoConf[5].rate, &__BITS,
#endif
Expand Down Expand Up @@ -1370,7 +1376,7 @@ PROGMEM const void * const lcd_param_ptr_table [] = {
#ifdef MULTIPLE_CONFIGURATION_PROFILES
&lcd_param_text150, &global_conf.currentSet, &__D,
#endif

&lcd_param_text151, &reset_to_defaults, &__D,
//#ifdef LOG_VALUES
// &lcd_param_text39, &failsafeEvents, &__L,
// &lcd_param_text40, &i2c_errors_count, &__L,
Expand Down Expand Up @@ -1539,6 +1545,7 @@ void configurationLoop() {
#if defined OLED_I2C_128x64LOGO_PERMANENT
LCDclear();
#endif
reset_to_defaults = 0;
p = 0;
while (LCD == 1) {
if (refreshLCD) {
Expand Down Expand Up @@ -1602,7 +1609,15 @@ void configurationLoop() {
#ifdef MULTIPLE_CONFIGURATION_PROFILES
writeGlobalSet(0);
#endif
writeParams(1);
if (reset_to_defaults == 7) {
// magic number lucky 7 hit, then do the reset to defaults
strcpy_P(line1,PSTR("RESET.."));
// 0123456789.12345
LCDprintChar(line1);
LoadDefaults(); // this invokes writeParams()
} else {
writeParams(1);
}
} else {
strcpy_P(line1,PSTR("Aborting"));
LCDprintChar(line1);
Expand Down
10 changes: 9 additions & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,20 @@
//#define HELI_USE_SERVO_FOR_THROTTLE

/*********************** your individual mixing ***********************/
/* if you want to override an existing entry in the mixing table, you may want to avoid esditing the
/* if you want to override an existing entry in the mixing table, you may want to avoid editing the
* mixTable() function for every version again and again.
* howto: http://www.multiwii.com/wiki/index.php?title=Config.h#Individual_Mixing
*/
//#define MY_PRIVATE_MIXING "filename.h"

/*********************** your individual defaults ***********************/
/* if you want to replace the hardcoded default values with your own (e.g. from a previous save to an .mwi file),
* you may want to avoid editing the LoadDefaults() function for every version again and again.
* howto: http://www.multiwii.com/forum/viewtopic.php?f=8&t=3987
*/
//#define MY_PRIVATE_DEFAULTS "filename.h"


/*************************************************************************************************/
/***************** ***************/
/**************** SECTION 3 - RC SYSTEM SETUP *******/
Expand Down

0 comments on commit 1538010

Please sign in to comment.