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.
Fork of 1TEST_Flight_Protocol by
Diff: main.cpp
- Revision:
- 1:e8a99f19604e
- Parent:
- 0:c466d770ffa7
--- a/main.cpp Wed May 17 11:02:27 2017 +0000
+++ b/main.cpp Mon May 22 06:10:35 2017 +0000
@@ -1,20 +1,28 @@
#include "mbed.h"
#include "ROBOFRIEN_GUI.h"
+#include "ROBOFRIEN_LED.h"
#include <math.h>
#define PI 3.14159265359 // This value will be used when calculating angles
Timer MainTimer;
-DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
-DigitalOut myled4(LED4);
ROBOFRIEN_GUI GUI;
+ROBOFRIEN_LED LED;
int cnt;
int main() {
- GUI.Configuration_init();
+ GUI.Init();
+ LED.Init();
+
+ LED.HeadlightPeriod = GUI.headlight_period;
+ LED.HeadlightDutyrate = GUI.headlight_dutyrate;
+ LED.SidelightPeriod = GUI.sidelight_period;
+ LED.SidelightDutyrate = GUI.sidelight_dutyrate;
+
while(1) {
GUI.pc_rx_update();
+ LED.Update();
if(GUI.rx_bool() == true){
cnt ++;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -26,30 +34,26 @@
GUI.CurrentMarker = 11 * cos( PI/180 + cnt/100.0) + 10;
GUI.Bat1 = 50 * sin(PI/180 + cnt/50.0) + 50; // 21.6 ~ 24.6 ( 6cell )
GUI.Bat2 = 50 * cos(PI/180 + cnt/50.0) + 50; // 11.1 ~ 12.6 ( 3cell )
- // Button State is change automatically in "ROBOFRIEN_GUI.cpp" //
+ // [ Button State & Home Point Chksum & Marker Chksum ] is change automatically in "ROBOFRIEN_GUI.cpp" //
// You Can not change this setting, just use it ///
- if(GUI.button[0] == true) myled1 = 1;
- else myled1 = 0;
- if(GUI.button[1] == true) myled2 = 1;
- else myled2 = 0;
- if(GUI.button[2] == true) myled3 = 1;
- else myled3 = 0;
- if(GUI.button[3] == true) myled4 = 1;
- else myled4 = 0;
-// if(GUI.button[4] == true) myled5 = 1;
-// else myled5 = 0;
+ if(GUI.button[0] == true) {}
+ else {}
+ if(GUI.button[1] == true) {}
+ else {}
+ if(GUI.button[2] == true) {}
+ else {}
+ if(GUI.button[3] == true) {}
+ else {}
+ if(GUI.button[4] == true) {}
+ else {}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////// [GPS] GPS //////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
-// GUI.utc_time = cnt * 10;
-// GUI.latitude = 35117030 + 10000 * sin( PI/180 + cnt/50.0);
-// GUI.longitude = 129087896 + 10000 * cos( PI/180 + cnt/50.0);
-// GUI.altitude = 22768 + 32768 * sin( PI/180 + cnt/50.0);
- GUI.utc_time = GUI.Marker_Speed[0];
- GUI.latitude = GUI.Marker_Lat[0];
- GUI.longitude = GUI.Marker_Lng[0];
- GUI.altitude = GUI.Marker_Alt[0];
+ GUI.utc_time = cnt * 10;
+ GUI.latitude = 35117030 + 10000 * sin( PI/180 + cnt/50.0);
+ GUI.longitude = 129087896 + 10000 * cos( PI/180 + cnt/50.0);
+ GUI.altitude = 22768 + 32768 * sin( PI/180 + cnt/50.0);
GUI.SatNum = 10 + 10 * sin( PI/180 + cnt/50.0);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -99,8 +103,60 @@
GUI.DEBUGx100[7] = 55555;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////// Configuration ///////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ ///////////////////////////// -----------------DPN 1-------------------- ////////////////////////////////
+ // You can set the this value from "Config.h" ( EEPROM_MODEL_TYPE1, EEPROM_MODEL_TYPE2_UP, EEPROM_MODEL_TYPE2_DOWN ) //
+
+ ///////////////////////////// -----------------DPN 2-------------------- ////////////////////////////////
+ // You can set the this value from "Config.h" ( MODEL_INFO, FIRMWARE_INFO ) //
+
+ ///////////////////////////// -----------------DPN 3-------------------- ////////////////////////////////
+ /// You can set the original value of receiver to [raw_cap] with scale down ( -127 ~ 127 ) ///
+ /// You can use the [cap_min[8], cap_neu[8], cap_max[8]] for calibration of RC receiver value //
+ GUI.raw_cap[0] = 0;
+ GUI.raw_cap[1] = 0;
+ GUI.raw_cap[2] = 0;
+ GUI.raw_cap[3] = 0;
+ GUI.raw_cap[4] = 0;
+ GUI.raw_cap[5] = 0;
+ GUI.raw_cap[6] = 0;
+ GUI.raw_cap[7] = 0;
+
+ ///////////////////////////// -----------------DPN 4-------------------- ////////////////////////////////
+ /// You can use the [motor_min[4]] for calibration of motor pwm value //
+
+ ///////////////////////////// -----------------DPN 5-------------------- ////////////////////////////////
+ LED.HeadlightPeriod = GUI.headlight_period;
+ LED.HeadlightDutyrate = GUI.headlight_dutyrate;
+ LED.SidelightPeriod = GUI.sidelight_period;
+ LED.SidelightDutyrate = GUI.sidelight_dutyrate;
+
+ ///////////////////////////// -----------------DPN 6-------------------- ////////////////////////////////
+ /// You can set the original value of receiver to [raw_cap] with scale down ( -127 ~ 127 ) ///
+ /// You can use the [cap_min[8], cap_neu[8], cap_max[8]] for calibration of RC receiver value //
+ if(GUI.attitude_configuration_bool == true){
+ GUI.attitude_configuration_bool = false;
+ // You can calibration of attitude (Roll, Pitch) //
+ }
+ if(GUI.Compass_Calibration_Mode == 1){
+ // You can calibration of compass (Yaw)//
+ }else if(GUI.Compass_Calibration_Mode == 2){
+ // You can finish the calibration of compass
+ }
+
+ ///////////////////////////// -----------------DPN 7-------------------- ////////////////////////////////
+ /// You can use the [limit_rollx100, limit_pitchx100, limit_roll_rate, limit_pitch_rate, limit_yaw_rate] for limit the angle and angular velocity //
+
+ ///////////////////////////// -----------------DPN 8-------------------- ////////////////////////////////
+ /// You can use the [gain_px100[20], gain_dx100[20], gain_ix100[20]] for gain tuning //
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////// Refresh ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
GUI.Refresh();
}
