Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: config.cpp
- Revision:
- 6:a50e6d3924f1
- Parent:
- 4:4060309b9cc0
- Child:
- 8:1db19b529b22
diff -r 7b02775787a9 -r a50e6d3924f1 config.cpp
--- a/config.cpp Fri Oct 17 03:56:56 2014 +0000
+++ b/config.cpp Tue Feb 24 09:28:29 2015 +0000
@@ -4,6 +4,7 @@
#include "config.h"
#include "PulseWidthCounter.h"
#include "SerialLcd.h"
+#include "Limiter.h"
//#include "PID.h"
//Serial pc(USBTX, USBRX);
@@ -58,12 +59,13 @@
extern volatile int Stick[6];
extern volatile float Press;
extern volatile float interval;
+extern Limiter throLimit;
//extern bool tick_flag;
//extern PID pid[4];
//extern PID height;
//extern int pid_reg[4];
const char steering[3][6]= {"Roll ","Pitch","Yaw "};
-const char ModelName[5][9] = { "Quad-X ","Quad-H ","Delta ","Delta-TW","AirPlane" };
+const char ModelName[6][9] = { "Quad-X ","Quad-VP ","Quad-3D ","Delta ","Delta-TW","AirPlane" };
int mode;//
char sw,ret_mode;
int vnum,hnum,vmax,hmax;//
@@ -96,7 +98,23 @@
LCD_printf(str);
LCD_locate(4,1);
LCD_printf("By AZUKITEN");
- hmax = 0;
+ hmax = 1;
+ break;
+ case 1: //モデルタイプの設定
+ LCD_locate(0,0);
+ LCD_printf("Model Type");
+ LCD_locate(0,1);
+ switch ( sw ) {
+ case 'D':
+ if ( conf.Model_Type > 0 ) conf.Model_Type -= 1;
+ else conf.Model_Type = 4;
+ break;
+ case 'U':
+ if ( conf.Model_Type < 5 ) conf.Model_Type += 1;
+ else conf.Model_Type = 0;
+ }
+ LCD_printf( (char*)ModelName[conf.Model_Type] );
+ Set_Arrow(2);
break;
//送信機信号のキャリブレーション
@@ -137,7 +155,7 @@
case GYROGAIN*10: //Set Gyro Gain
LCD_printf("Set Gyro Gain");
Set_Arrow(1);
- hmax = 4;
+ hmax = 5;
break;
case GYROGAIN*10+1: //Set Gyro Gain Roll
if ( conf.Gyro_Gain_Setting == 1 )
@@ -158,6 +176,9 @@
Param_Set_Prompt1("GyroGain>Yaw",&conf.Gyro_Gain[5],2,-1.00f,1.00f,0.01f,sw);
break;
case GYROGAIN*10+4:
+ Param_Set_Prompt1("Active Gyro Gain",&conf.Active_Gyro_Gain,3,0.0f,1.0f,0.01f,sw);
+ break;
+ case GYROGAIN*10+5:
// ret_mode = 'R';
LCD_printf("GyroGain>setting");
LCD_locate(0,1);
@@ -279,7 +300,6 @@
LCD_printf("Disp Pulse Width");
Set_Arrow(1);
hmax = 3;
- x = conf.ESC_Low;
break;
case DISPPULSE*10+1: //Display Pulse Width
// DisplayPulseWidth(THR,AIL,ELE,RUD,AUX);
@@ -405,20 +425,18 @@
case DISPPWM*10+1: //Display PWM Width
ret_mode = 'R';
PWM_Out(false);
- i = conf.ESC_Low;
LCD_locate(0,0);
- sprintf(str,"M1=%4d,M2=%4d",i+M1,i+M2);
+ sprintf(str,"M1=%4d,M2=%4d",M1,M2);
LCD_printf(str);
LCD_locate(0,1);
- sprintf(str,"M4=%4d,M3=%4d",i+M4,i+M3);
+ sprintf(str,"M4=%4d,M3=%4d",M4,M3);
LCD_printf(str);
break;
case DISPPWM*10+2: //Display PWM Width
ret_mode = 'R';
PWM_Out(false);
- i = conf.ESC_Low;
LCD_locate(0,0);
- sprintf(str,"M5=%4d,M6=%4d",i+M5,i+M6);
+ sprintf(str,"M5=%4d,M6=%4d",M5,M6);
LCD_printf(str);
break;
@@ -426,7 +444,7 @@
case PARMSET*10: //パラメーター設定
LCD_printf("Parameter Set");
Set_Arrow(1);
- hmax = 8;
+ hmax = 9;
break;
case PARMSET*10+1:
Param_Set_Prompt1("LCD>Contrast",&conf.LCD_Contrast,2,0,63,1,sw);
@@ -453,12 +471,23 @@
Param_Set_Prompt1("Gyro>CutoffFreq",&conf.Cutoff_Freq,2,0.00f,10.0f,0.01f,sw);
break;
case PARMSET*10+5:
- Param_Set_Prompt1("ESC>Low Position",&conf.ESC_Low,2,Pulse_Min,Pulse_Max,1,sw);
+ Param_Set_Prompt1("ESC>Throttl Trim",&conf.Throttl_Trim,2,Pulse_Min,Pulse_Max,1,sw);
break;
case PARMSET*10+6:
+ Param_Set_Prompt1("ESC>ReversePoint",&conf.Reverse_Point,2,1000,2000,1,sw);
+ break;
+ case PARMSET*10+7:
Param_Set_Prompt1("Flight Timer",&conf.Flight_Time,2,0,600,10,sw);
break;
- case PARMSET*10+7:
+ case PARMSET*10+8:
+ Param_Set_Prompt1("Thro Limit val",&conf.Thro_Limit_Val,2,0,200,1,sw);
+ throLimit.differential(conf.Thro_Limit_Val);
+ break;
+ case PARMSET*10+9:
+ Param_Set_Prompt1("Thro Limit Rate",&conf.Thro_Limit_Rate,3,0,1,0.01,sw);
+ throLimit.rate(conf.Thro_Limit_Rate);
+ break;
+/* case PARMSET*10+7:
LCD_locate(0,0);
LCD_printf("Model Type");
LCD_locate(0,1);
@@ -475,9 +504,9 @@
Set_Arrow(2);
break;
case PARMSET*10+8:
- Param_Set_Prompt1("Active Gyro Gain",&conf.Active_Jyro_Gain,3,0.0f,1.0f,0.01f,sw);
+ Param_Set_Prompt1("Active Gyro Gain",&conf.Active_Gyro_Gain,3,0.0f,1.0f,0.01f,sw);
break;
-
+*/
//設定データの保存
case CONFSTORE*10: //E2PROM Store
LCD_printf("Config Save");
@@ -547,6 +576,10 @@
}
break;
case 'E':
+ while ( conf.Model_Type == Quad_3D && Stick[GAIN] < 0 ) {
+ FlashLED(2);
+ wait(0.5);
+ }
LCD_cls(); //Clear LCD
LCD_locate(0,0);
LCD_printf("PWM Started");
@@ -676,3 +709,4 @@
LCD_printf(" <<");
}
};
+