0,0 → 1,856 |
/*#######################################################################################*/ |
/* !!! THIS IS NOT FREE SOFTWARE !!! */ |
/*#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 2008 Ingo Busker, Holger Buss |
// + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
// + FOR NON COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
// |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include <stdlib.h> |
#include "91x_lib.h" |
#include "main.h" |
#include "led.h" |
#include "ubx.h" |
#include "GPS.h" |
#include "timer1.h" |
#include "compass.h" |
#include "spi_slave.h" |
#include "menu.h" |
#include "uart0.h" |
#include "uart1.h" |
#include "ncmag.h" |
#include "logging.h" |
#include "settings.h" |
#include "sdc.h" |
#include "analog.h" |
#include "canbus.h" |
#include "triggerlog.h" |
#include "CamCtrl.h" |
#include "eeprom.h" |
|
u8 DispPtr = 0; |
s8 DisplayBuff[DISPLAYBUFFSIZE]; |
|
|
u8 MenuItem = 0; |
u8 MaxMenuItem = 34; |
|
void Menu_Putchar(char c) |
{ |
if(DispPtr < DISPLAYBUFFSIZE) DisplayBuff[DispPtr++] = c; ; |
} |
|
void Menu_Clear(void) |
{ |
u8 i; |
for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
} |
|
// Display with 20 characters in 4 lines |
void Menu_Update(u8 Keys) |
{ |
s32 i1,i2; |
u8 sign; |
|
if(Keys & KEY1) { if(MenuItem > 0) MenuItem--; else MenuItem = MaxMenuItem;} |
if(Keys & KEY2) { if(MenuItem == MaxMenuItem) MenuItem = 0; else MenuItem++;} |
if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0; |
if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
Menu_Clear(); |
// print menu item number in the upper right corner |
if(MenuItem < 10) |
{ |
LCD_printfxy(17,0,"[%i]",MenuItem); |
} |
else // Menuitem >= 10 |
{ |
LCD_printfxy(16,0,"[%i]",MenuItem); |
} |
|
switch(MenuItem) |
{ |
// Version Info |
case 0: |
if(IamMaster == SLAVE) LCD_printfxy(0,0,"+ Navi-Ctrl (S) +") |
else |
if(IamMaster == MASTER)LCD_printfxy(0,0,"+ Navi-Ctrl (M) +") |
else LCD_printfxy(0,0,"++ Navi-Ctrl ++") |
|
LCD_printfxy(0,1,"HW V%d.%d SW V%d.%02d%c", UART_VersionInfo.HWMajor/10, UART_VersionInfo.HWMajor%10, VERSION_MAJOR, VERSION_MINOR, 'a'+ VERSION_PATCH); |
if(FC.StatusFlags3 & FC_STATUS3_REDUNDANCE_AKTIVE) LCD_printfxy(19,1,"R"); |
if(ErrorCode) |
{ |
LCD_printfxy(0,2,"Error: %d",ErrorCode); |
LCD_printfxy(0,3,"%s",ErrorMSG); |
} |
else |
if(Partner.ErrorCode) |
{ |
if(IamMaster == SLAVE) LCD_printfxy(0,2,"Master Err: %d",Partner.ErrorCode) |
else LCD_printfxy(0,2,"Slave Err: %d",Partner.ErrorCode); |
LCD_printfxy(0,3,"%s",PartnerErrorMSG); |
} |
else |
{ |
LCD_printfxy(0,2,"Set:%d %s", Parameter.ActiveSetting,EE_Parameter.Name); |
LCD_printfxy(0,3,"%s",ErrorMSG); |
// LCD_printfxy(0,3,"(c) HiSystems GmbH"); |
} |
if(FC.StatusFlags3 & FC_STATUS3_BOAT) LCD_printfxy(16,2,"BOAT"); |
//if(NC_To_FC_Flags & NC_TO_FC_SWITCHOFF_IF_LANDED) LCD_printfxy(16,2,"Off"); |
break; |
case 1: |
if(IamMaster == SLAVE) LCD_printfxy(0,0,"++ Master - NC ++") |
else LCD_printfxy(0,0,"++ Slave - NC ++"); |
|
if(CanRxMessage[CAN_ID_VERSION].D.Byte[3]) |
{ |
LCD_printfxy(0,1,"HW V%d.%d SW V%d.%02d%c", CanRxMessage[CAN_ID_VERSION].D.Byte[3]/10, CanRxMessage[CAN_ID_VERSION].D.Byte[3]%10, CanRxMessage[CAN_ID_VERSION].D.Byte[7], CanRxMessage[CAN_ID_VERSION].D.Byte[6], 'a'+ CanRxMessage[CAN_ID_VERSION].D.Byte[5]); |
if(Partner.ErrorCode) |
{ |
if(IamMaster == SLAVE) LCD_printfxy(0,2,"Master Err: %d",Partner.ErrorCode) |
else LCD_printfxy(0,2,"Slave Err: %d",Partner.ErrorCode); |
} |
else |
{ |
LCD_printfxy(0,2,"Set:%d", CanRxMessage[CAN_ID_VERSION].D.Byte[1]); |
} |
LCD_printfxy(0,3,"%s",PartnerErrorMSG); |
if(Partner.StatusFlags3 & FC_STATUS3_BOAT) LCD_printfxy(16,2,"BOAT"); |
} |
else |
LCD_printfxy(0,2,"not connected", CanTxMessage[CAN_ID_VERSION].D.Byte[1]); |
/* |
LCD_printfxy(0,2,"%2u",NaviData_HoTT_Text.HoTT_TextLevel); |
LCD_printfxy(0,3,"%s",NaviData_HoTT_Text.HoTT_DisplayText); |
if(NaviData_Home.OSDStatusFlags3 & OSD3_FLAG_MK_IS_READY) LCD_printfxy(5,2,"ready") else LCD_printfxy(5,2," -- "); |
*/ |
break; |
case 2: |
if (GPSData.Status == INVALID) |
{ |
LCD_printfxy(0,0,"No GPS data"); |
LCD_printfxy(0,1,"Lon: "); |
LCD_printfxy(0,2,"Lat: "); |
LCD_printfxy(0,3,"Alt: "); |
} |
else // newdata or processed |
{ |
LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
switch (GPSData.SatFix) |
{ |
case SATFIX_NONE: |
LCD_printfxy(7,0,"NoFix"); |
break; |
case SATFIX_2D: |
LCD_printfxy(7,0,"2DFix"); |
break; |
case SATFIX_3D: |
LCD_printfxy(7,0,"3DFix"); |
break; |
default: |
LCD_printfxy(7,0,"??Fix"); |
break; |
} |
if(GPSData.Flags & FLAG_DIFFSOLN) |
{ |
LCD_printfxy(12,0,"/DGPS"); |
} |
else |
{ |
LCD_printfxy(12,0," "); |
} |
|
if(GPSData.Position.Longitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(GPSData.Position.Longitude)/10000000L; |
i2 = abs(GPSData.Position.Longitude)%10000000L; |
LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
if(GPSData.Position.Latitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(GPSData.Position.Latitude)/10000000L; |
i2 = abs(GPSData.Position.Latitude)%10000000L; |
LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
if(GPSData.Position.Altitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(GPSData.Position.Altitude)/1000L; |
i2 = abs(GPSData.Position.Altitude)%1000L; |
LCD_printfxy(0,3,"Alt:%c%04ld.%03ldm V%d", sign, i1, i2, GPS_Version/1000); |
} |
break; |
case 3: |
if (GPSData.Status == INVALID) |
{ |
LCD_printfxy(0,0,"No GPS data"); |
LCD_printfxy(0,1,"Speed N: "); |
LCD_printfxy(0,2,"Speed E: "); |
LCD_printfxy(0,3,"Speed T: "); |
} |
else // newdata or processed |
{ |
LCD_printfxy(0,0,"Sat:%02d ", GPSData.NumOfSats); |
switch (GPSData.SatFix) |
{ |
case SATFIX_NONE: |
LCD_printfxy(7,0,"NoFix"); |
break; |
case SATFIX_2D: |
LCD_printfxy(7,0,"2DFix"); |
break; |
case SATFIX_3D: |
LCD_printfxy(7,0,"3DFix"); |
break; |
default: |
LCD_printfxy(7,0,"??Fix"); |
break; |
} |
if(GPSData.Flags & FLAG_DIFFSOLN) |
{ |
LCD_printfxy(12,0,"/DGPS"); |
} |
else |
{ |
LCD_printfxy(12,0," "); |
} |
|
LCD_printfxy(0,1,"Speed N: %+4ld cm/s",GPSData.Speed_North); |
LCD_printfxy(0,2,"Speed E: %+4ld cm/s",GPSData.Speed_East); |
LCD_printfxy(0,3,"Speed T: %+4ld cm/s",GPSData.Speed_Top); |
} |
break; |
case 4: |
LCD_printfxy(0,0,"GPS UTC Time"); |
if (!SystemTime.Valid) |
{ |
LCD_printfxy(0,1," "); |
LCD_printfxy(0,2," No time data! "); |
LCD_printfxy(0,3," "); |
} |
else // newdata or processed |
{ |
LCD_printfxy(0,1," "); |
LCD_printfxy(0,2,"Date: %02i/%02i/%04i",SystemTime.Month, SystemTime.Day, SystemTime.Year); |
LCD_printfxy(0,3,"Time: %02i:%02i:%02i.%03i", SystemTime.Hour, SystemTime.Min, SystemTime.Sec, SystemTime.mSec); |
} |
break; |
case 5: // Navi Params 1 from FC |
LCD_printfxy(0,0,"NaviMode: %3i" , Parameter.NaviGpsModeControl); |
LCD_printfxy(0,1,"G :%3i P :%3i ",Parameter.NaviGpsGain, Parameter.NaviGpsP); |
LCD_printfxy(0,2,"I :%3i D :%3i ",Parameter.NaviGpsI, Parameter.NaviGpsD); |
LCD_printfxy(0,3,"ACC:%3i SAT:%3i ",Parameter.NaviGpsACC, Parameter.NaviGpsMinSat); |
break; |
case 6: // Navi Params 2 from FC |
LCD_printfxy(0,0,"Stick TS: %3i", Parameter.NaviStickThreshold); |
LCD_printfxy(0,1,"WP_Radius: %3im",MaxWP_Radius_in_m); |
LCD_printfxy(0,2,"WindCorr: %3i", Parameter.NaviWindCorrection); |
LCD_printfxy(0,3,"AccComp: %3i", Parameter.NaviSpeedCompensation); |
break; |
case 7: // Navi Params 3 from FC |
LCD_printfxy(0,0,"Angle-Limit: %3i", Parameter.NaviAngleLimitation); |
LCD_printfxy(0,1," P-Limit: %3i", Parameter.NaviGpsPLimit); |
LCD_printfxy(0,2," I-Limit: %3i", Parameter.NaviGpsILimit); |
LCD_printfxy(0,3," D-Limit: %3i", Parameter.NaviGpsDLimit); |
break; |
case 8: // Max Ranges |
LCD_printfxy(0,0,"Maximum flying "); |
LCD_printfxy(0,1,"Range: %4im ", AbsoluteFlyingRange_m); |
LCD_printfxy(0,2,"Descend: %4im ", AutoDescendRange_m); |
LCD_printfxy(0,3,"Altitude:%4im ", AbsoluteFlyingAltitude); |
if(!AbsoluteFlyingRange_m) LCD_printfxy(9,1,"disabled"); |
if(!AutoDescendRange_m) LCD_printfxy(9,2,"disabled"); |
if(!AbsoluteFlyingAltitude) LCD_printfxy(9,3,"disabled"); |
break; |
case 9: |
LCD_printfxy(0,0,"Home Position"); |
if(NaviData.HomePosition.Status == INVALID) |
{ |
LCD_printfxy(0,1," "); |
LCD_printfxy(0,2," Is not set. "); |
LCD_printfxy(0,3," "); |
} |
else |
{ |
if(NaviData.HomePosition.Longitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(NaviData.HomePosition.Longitude)/10000000L; |
i2 = abs(NaviData.HomePosition.Longitude)%10000000L; |
LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
if(NaviData.HomePosition.Latitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(NaviData.HomePosition.Latitude)/10000000L; |
i2 = abs(NaviData.HomePosition.Latitude)%10000000L; |
LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(NaviData.HomePosition.Altitude)/1000L; |
i2 = abs(NaviData.HomePosition.Altitude)%1000L; |
LCD_printfxy(0,3,"Alt:%c%04ld.%1dm",sign, i1, i2/1000); |
switch(Parameter.HomeYawMode) |
{ |
case NO_CHANGE: LCD_printfxy(17,3,"(-)"); break; |
case FRONT_TO_HOME: LCD_printfxy(17,3,"(F)"); break; |
case REAR_TO_HOME: LCD_printfxy(17,3,"(R)"); break; |
case LIKE_AT_START: LCD_printfxy(17,3,"(S)"); break; |
} |
} |
break; |
case 10: |
LCD_printfxy(0,0,"Target Position"); |
if(NaviData.TargetPosition.Status == INVALID) |
{ |
LCD_printfxy(0,1," "); |
LCD_printfxy(0,2," Is not set. "); |
LCD_printfxy(0,3," "); |
} |
else |
{ |
if(NaviData.TargetPosition.Longitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(NaviData.TargetPosition.Longitude)/10000000L; |
i2 = abs(NaviData.TargetPosition.Longitude)%10000000L; |
LCD_printfxy(0,1,"Lon:%c%03ld.%07ld deg",sign, i1, i2); |
if(NaviData.TargetPosition.Latitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(NaviData.TargetPosition.Latitude)/10000000L; |
i2 = abs(NaviData.TargetPosition.Latitude)%10000000L; |
LCD_printfxy(0,2,"Lat:%c%03ld.%07ld deg",sign, i1, i2); |
if(NaviData.HomePosition.Altitude < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(NaviData.TargetPosition.Altitude)/1000L; |
i2 = abs(NaviData.TargetPosition.Altitude)%1000L; |
LCD_printfxy(0,3,"Alt:%c%04ld.%03ldm",sign, i1, i2); |
} |
break; |
case 11: // RC stick controls from FC |
LCD_printfxy(0,0,"RC-Sticks" ); |
LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",FC.StickNick, FC.StickRoll); |
LCD_printfxy(0,2,"Gs:%4i Ya:%4i ",FC.StickGas, FC.StickYaw); |
LCD_printfxy(0,3,"RC-Level: %3i", FC.RC_Quality); // Remote Control Level from FC |
break; |
case 12: // RC stick controls from FC |
LCD_printfxy(0,0,"External-Ctrl" ); |
|
if(!EE_Parameter.ExternalControl) |
{ |
LCD_printfxy(0,2,"not used" ); |
} |
else |
if((EE_Parameter.ExternalControl >= 248) && (FC.Poti[255 - EE_Parameter.ExternalControl] < 128)) |
{ |
LCD_printfxy(0,2,"Switch is off"); |
} |
else |
{ |
if(FromFC_ExternalCtrlCfg) |
{ |
LCD_printfxy(0,1,"Nick:%4i Roll:%4i ",ExternControl.Nick, ExternControl.Roll); |
LCD_printfxy(0,2,"Gas: %4i Yaw: %4i ",ExternControl.Gas, ExternControl.Gier); |
LCD_printfxy(0,3,"Cfg:0x%02x SW:0x%02x",FromFC_ExternalCtrlCfg,FromFC_ExternalCtrlSwitch); |
} |
else |
LCD_printfxy(0,2,"No Data"); |
} |
break; |
|
case 13: // RC poti controls from FC |
LCD_printfxy(0,0,"RC-Potis 1" ); |
LCD_printfxy(0,1,"Po1:%3i Po2:%3i ",FC.Poti[0], FC.Poti[1]); |
LCD_printfxy(0,2,"Po3:%3i Po4:%3i ",FC.Poti[2], FC.Poti[3]); |
break; |
case 14: // RC poti controls from FC |
LCD_printfxy(0,0,"RC-Potis 2" ); |
LCD_printfxy(0,1,"Po5:%3i Po6:%3i ",FC.Poti[4], FC.Poti[5]); |
LCD_printfxy(0,2,"Po7:%3i Po8:%3i ",FC.Poti[6], FC.Poti[7]); |
break; |
case 15: // attitude from FC |
if(FromFlightCtrl.AngleNick < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(FromFlightCtrl.AngleNick)/10; |
i2 = abs(FromFlightCtrl.AngleNick)%10; |
LCD_printfxy(0,0,"GyroNick:%c%03ld.%01ld", sign, i1, i2); |
if(FromFlightCtrl.AngleRoll < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(FromFlightCtrl.AngleRoll)/10; |
i2 = abs(FromFlightCtrl.AngleRoll)%10; |
LCD_printfxy(0,1,"GyroRoll:%c%03ld.%01ld", sign, i1, i2); |
if(FromFlightCtrl_AccNick < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(FromFlightCtrl_AccNick)/10; |
i2 = abs(FromFlightCtrl_AccNick)%10; |
LCD_printfxy(0,2," AccNick:%c%03ld.%01ld", sign, i1, i2); |
if(FromFlightCtrl_AccRoll < 0) sign = '-'; |
else sign = '+'; |
i1 = abs(FromFlightCtrl_AccRoll)/10; |
i2 = abs(FromFlightCtrl_AccRoll)%10; |
LCD_printfxy(0,3," AccRoll:%c%03ld.%01ld", sign, i1, i2); |
break; |
case 16: |
LCD_printfxy(0,0,"Analog inputs"); |
LCD_printfxy(0,1,"A5:%3i ",AnalogData.Ch5); |
LCD_printfxy(0,2,"A6:%3i ",AnalogData.Ch6); |
LCD_printfxy(0,3,"A7:%3i ",AnalogData.Ch7); |
break; |
case 17: |
LCD_printfxy(0,0,"Compass: %3i", FromFlightCtrl.GyroHeading / 10); |
LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10); |
if(FC.FromFC_DisableDeclination) |
{ |
LCD_printfxy(0,2,"Mag.Declinat.:disabl"); |
} |
else |
{ |
if(GeoMagDec < 0) sign = '-'; |
else sign = '+'; |
LCD_printfxy(0,2,"Mag.Declinat.:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
} |
LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10); |
break; |
case 18: // User Parameter |
LCD_printfxy(0,0,"UP1:%3i UP2:%3i",Parameter.User1,Parameter.User2); |
LCD_printfxy(0,1,"UP3:%3i UP4:%3i",Parameter.User3,Parameter.User4); |
LCD_printfxy(0,2,"UP5:%3i UP6:%3i",Parameter.User5,Parameter.User6); |
LCD_printfxy(0,3,"UP7:%3i UP8:%3i",Parameter.User7,Parameter.User8); |
break; |
case 19: // User Parameter |
LCD_printfxy(0,0,"SD-Card Logs"); |
if(SDCardInfo.Valid == 1) |
{ |
LCD_printfxy(0,1,"GPX: %4i (%3ims) ",Logged_GPX_Counter,LogCfg.GPX_Interval); |
LCD_printfxy(0,2,"KML: %4i (%3ims) ",Logged_KML_Counter,LogCfg.KML_Interval); |
LCD_printfxy(0,3,"Trig:%4i ",Logged_TRIG_Counter); |
} |
else |
LCD_printfxy(0,1,"no card in slot "); |
break; |
case 20: // magnetic field |
if(Compass_CalState) |
{ |
LCD_printfxy(0,0,"Calibration:"); |
LCD_printfxy(0,1,"Step %d/", Compass_CalState); |
LCD_printfxy(0,2,"X %4i Y %4i Z %4i",MagVector.X,MagVector.Y,MagVector.Z); |
LCD_printfxy(9,3,"(ESC)(NEXT)"); |
switch(Compass_CalState) |
{ |
case 1: |
case 3: |
LCD_printfxy(7,1,"pause"); |
break; |
|
case 2: |
LCD_printfxy(7,1,"horizontal"); |
break; |
|
case 4: |
LCD_printfxy(7,1,"vertical"); |
break; |
|
case 5: |
LCD_printfxy(7,1,"data saved"); |
LCD_printfxy(8,3," (END) "); |
break; |
|
default: |
break; |
} |
} |
else |
{ |
if(GeoMagDec < 0) sign = '-'; |
else sign = '+'; |
LCD_printfxy(0,0,"Magnetic Field"); |
LCD_printfxy(0,1,"X:%5i",MagVector.X); |
LCD_printfxy(0,2,"Y:%5i",MagVector.Y); |
LCD_printfxy(0,3,"Z:%5i",MagVector.Z); |
LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5); |
if(Compass_I2CPort == NCMAG_PORT_EXTERN) LCD_printfxy(11,2,"Extern") |
else LCD_printfxy(11,2,"Intern"); |
// LCD_printfxy(8,2,"Dec:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
// LCD_printfxy(8,3,"Inc:%2i", EarthMagneticInclination); |
LCD_printfxy(15,3,"(CAL)"); |
} |
if(Keys & KEY4) // next step |
{ |
if(Compass_CalState <5) Compass_SetCalState(Compass_CalState+1); |
else Compass_SetCalState(0); |
} |
if(Keys & KEY3)Compass_SetCalState(0); // cancel |
break; |
case 21: |
if(GeoMagDec < 0) sign = '-'; |
else sign = '+'; |
LCD_printfxy(0,0,"Magnetic Field"); |
LCD_printfxy(0,1,"Field:%3i (Percent)",EarthMagneticField/5); |
LCD_printfxy(0,2,"Declination:%c%i.%1i ", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10); |
LCD_printfxy(0,3,"Inclination:%2i (%2i)", EarthMagneticInclination, EarthMagneticInclinationTheoretic); |
break; |
case 22: |
LCD_printfxy(0,0,"SD-Setting "); |
LCD_printfxy(0,2,"WP-Dynamic:%4i ",WaypointAcceleration); |
break; |
case 23: |
LCD_printfxy(0,0,"CPU Processing "); |
LCD_printfxy(0,2,"GPS-Data: %2i.%iHz ",FreqNewGpsData/10, FreqNewGpsData%10); |
LCD_printfxy(0,3,"GPS-Update:%2i.%iHz ",FreqGpsNavProcessed/10, FreqGpsNavProcessed%10); |
if(FreqNewGpsData >= 48 && FreqNewGpsData <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!"); |
if(FreqGpsNavProcessed >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!"); |
break; |
case 24: |
LCD_printfxy(0,0,"BL Current" ); |
LCD_printfxy(11,3,"(in 0.1A)" ); |
for(i1 = 0; i1 < 3; i1++) |
{ |
LCD_printfxy(0,i1+1,"%3d %3d %3d %3d ",BL3_Current(i1*4),BL3_Current(i1*4+1),BL3_Current(i1*4+2),BL3_Current(i1*4+3)); |
if(Motor[4 + i1 * 4].State == 0) break; |
} |
break; |
|
case 25: |
LCD_printfxy(0,0,"Ext. Compass" ); |
if(NCMAG_Compass_use_Orientation) |
{ |
u8 tmp; |
LCD_printfxy(0,1,"ACC X Y Z"); |
LCD_printfxy(0,2," %5d %5d %5d", AccVector.X/40, AccVector.Y/40, AccVector.Z/40); |
tmp = NCMAG_GetOrientationFromAcc(); |
LCD_printfxy(0,3,"Orientat.: "); |
if(!tmp) LCD_printfxy(11,3,"??") else LCD_printfxy(11,3,"%2d",tmp); |
LCD_printfxy(15,3,"(%d)",NCMAG_Orientation); |
} |
else |
{ |
LCD_printfxy(0,1,"Not connected"); |
} |
break; |
case 26: |
{ |
static u8 index = 1; |
if(Keys & KEY3) // next step |
{ |
if(index < ToFC_MaxWpListIndex) index++; |
else index = 1; |
} |
if(Keys & KEY4) FromFC_LoadWP_List = index; |
LCD_printfxy(0,0,"Load WPL (fix)" ); |
LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
// 12345678901234567890 |
LCD_printfxy(0,2,"Points Index "); |
LCD_printfxy(0,3," %3d %3d LOAD", PointList_GetCount(), index); |
} |
break; |
case 27: |
{ |
static u8 index = 1; |
if(Keys & KEY3) |
{ |
if(index < ToFC_MaxWpListIndex) index++; |
else index = 1; |
} |
LCD_printfxy(0,0,"Load WPL (Rel)" ); |
LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
// 12345678901234567890 |
LCD_printfxy(0,2,"Points Index "); |
if(GPSData.SatFix == SATFIX_3D) |
{ |
LCD_printfxy(0,3," %3d %3d LOAD", PointList_GetCount(), index); |
if(Keys & KEY4) FromFC_LoadWP_List = index | 0x80; |
} |
else LCD_printfxy(0,3," No Satfix ! ", index); |
|
} |
break; |
case 28: |
{ |
static u8 index = 1; |
if(Keys & KEY3) |
{ |
if(index < ToFC_MaxWpListIndex) index++; |
else index = 1; |
} |
if(Keys & KEY4) FromFC_Load_SinglePoint = index; |
LCD_printfxy(0,0,"Load Point" ); |
LCD_printfxy(0,1,"Name: %s", WPL_Store.Name); |
// 12345678901234567890 |
// LCD_printfxy(0,2,"Points Index "); |
LCD_printfxy(0,3,"Number: %3d (LOAD)", index); |
} |
break; |
case 29: |
{ |
static u8 index = 1; |
if(Keys & KEY3) |
{ |
if(index < ToFC_MaxWpListIndex) index++; |
else index = 1; |
} |
LCD_printfxy(0,0,"Save Point" ); |
LCD_printfxy(0,1,"Alt: %3dm", NaviData.Altimeter_5cm/20); |
// 12345678901234567890 |
LCD_printfxy(0,2,"Dir: %3d ", CompassSetpointCorrected/10); |
if(GPSData.SatFix == SATFIX_3D) |
{ |
LCD_printfxy(0,3,"Number: %3d (SAVE)", index); |
if(Keys & KEY4) FromFC_Save_SinglePoint = index; |
} |
else LCD_printfxy(0,3," No Satfix ! ", index); |
} |
break; |
/* case 28: |
LCD_printfxy(0,0,"Analog inputs"); |
LCD_printfxy(0,0,"A0:%3i A1:%3i",AnalogData.Ch0,AnalogData.Ch1); |
LCD_printfxy(0,1,"A2:%3i A3:%3i",AnalogData.Ch2,AnalogData.Ch3); |
LCD_printfxy(0,2,"A4:%3i A5:%3i",AnalogData.Ch4,AnalogData.Ch5); |
LCD_printfxy(0,3,"A6:%3i A7:%3i",AnalogData.Ch6,AnalogData.Ch7); |
break; |
*/ |
|
case 30: |
LCD_printfxy(0,0,"Trigger Input"); |
if(UART_VersionInfo.HWMajor >= 30) |
{ |
if(BlitzSchuhConnected) LCD_printfxy(0,1,"External") |
else LCD_printfxy(0,1,"Internal"); |
LCD_printfxy(0,2,"Counter:%4d ",TrigLogging.Count); |
LCD_printfxy(0,3,"Logfile:%4i ",Logged_TRIG_Counter); |
} |
else |
{ |
LCD_printfxy(0,1,"Not Supported in "); |
LCD_printfxy(0,2,"Hardware V%d ", UART_VersionInfo.HWMajor/10); |
LCD_printfxy(0,3,"(V3 required)"); |
} |
break; |
case 31: |
LCD_printfxy(0,0,"CamCtrl"); |
if(!(FromCamCtrl.CamStatus & CAM_STATE_I2C_OK)) |
{ |
LCD_printfxy(0,2,"Not connected"); |
if(CamCtrlTimeout < 10) LCD_printfxy(14,3,"(conn)"); // connect manually |
if(Keys & KEY4) CamCtrlTimeout = 31000; |
} |
else |
{ |
LCD_printfxy(8,0,"V%i.%02i",1 + FromCamCtrl.Version / 100, FromCamCtrl.Version % 100); |
|
switch(FromCamCtrl.Type) |
{ |
case TYPE_LANC: LCD_printfxy(13,0,"L"); break; |
case TYPE_IR: LCD_printfxy(13,0,"I"); break; |
case TYPE_MULTI: LCD_printfxy(13,0,"M"); break; |
} |
LCD_printfxy(0,0,"CamCtrl"); |
LCD_printfxy(0,1,"Stat:"); |
if(FromCamCtrl.CamStatus & CAM_STATE_RDY) LCD_printfxy(5,1,"RDY") |
if(FromCamCtrl.CamStatus & CAM_STATE_REC_ACTIVE) LCD_printfxy(10,1,"REC"); |
if(FromCamCtrl.CamStatus & CAM_STATE_PHOTO_MODE) LCD_printfxy(14,1,"PHOTO"); |
if(FromCamCtrl.CamStatus & CAM_STATE_ZOOM) LCD_printfxy(5,1,"ZOOM "); |
if(!(FromCamCtrl.CamStatus & CAM_STATE_RDY)) LCD_printfxy(5,1," ---"); |
|
LCD_printfxy(17,1,"(%c)",CamCtrlCharacter); |
|
if(FromCamCtrl.CamStatus & CAM_STATE_CAM_DISCONN) LCD_printfxy(0,2,"Disconn.") |
else |
{ |
if(FromCamCtrl.CamStatus & CAM_STATE_OFF) LCD_printfxy(1,2,"Cam:OFF") else LCD_printfxy(1,2,"Cam:ON"); |
} |
LCD_printfxy(11,2,"Pics:%3d ",FromCamCtrl.PhotoCount); |
//LCD_printfxy(5,2,"x%2x ",FromCamCtrl.CamStatus); |
if(FromCamCtrl.PPM1Okay) LCD_printfxy(0,3,"Zoom:%3i",FromCamCtrl.PPM1Data); |
if(!FromCamCtrl.PPM2Okay) // there is PPM Input connected to the CamCtrl |
{ |
LCD_printfxy(14,3,"(TRIG)"); |
if(EE_Parameter.CamCtrlModeChannel == 0) |
{ |
if(FromCamCtrl.CamStatus & CAM_STATE_REC_ACTIVE) LCD_printfxy(9,3,"(off)") |
else LCD_printfxy(9,3,"(REC)"); // Control only possible if no switch is assigned |
} |
else LCD_printfxy(2,3,"CH:%3i",127+PPM_In[EE_Parameter.CamCtrlModeChannel]); |
|
if(Keys & KEY3) |
{ |
ToCamCtrl.CamCommand &= ~(CAM_CMD_REC_OFF|CAM_CMD_REC_ON); |
if(FromCamCtrl.CamStatus & CAM_STATE_REC_ACTIVE) ToCamCtrl.CamCommand |= CAM_CMD_REC_OFF; |
else ToCamCtrl.CamCommand |= CAM_CMD_REC_ON; |
} |
if(Keys & KEY4) ToCamCtrl.CamCommand |= CAM_CMD_SHUTTER; |
//if(Keys & KEY4) ToCamCtrl.CamCommand |= CAM_CMD_RESET_CAM; |
//if(Keys & KEY4) ToCamCtrl.CamCommand |= CAM_CMD_SWITCH_ON; |
//if(Keys & KEY4) ToCamCtrl.CamCommand |= CAM_CMD_SWITCH_OFF; |
} |
else |
{ |
if(FromCamCtrl.PPM2Okay) LCD_printfxy(10,3,"PPM:%3i",FromCamCtrl.PPM2Data); |
} |
} |
break; |
case 32: |
LCD_printfxy(0,0,"LaserCtrl"); |
if(!(FromLaserCtrl.LaserStatus & LASER_I2C_OK)) |
{ |
LCD_printfxy(0,2,"Not connected"); |
if(LaserCtrlTimeout < 10) LCD_printfxy(14,3,"(conn)"); // connect manually |
if(Keys & KEY4) LaserCtrlTimeout = 25000; |
} |
else |
{ |
LCD_printfxy(10,0,"V%i.%02i",1 + FromLaserCtrl.Version / 100, FromLaserCtrl.Version % 100); |
LCD_printfxy(0,1,"Stat:"); |
if(FromLaserCtrl.LaserStatus & LASER_DATA_OK) LCD_printfxy(8,1,"OK") else LCD_printfxy(5,1,"No Laser"); |
LCD_printfxy(0,2,"Dist:%5dcm",FromLaserCtrl.Distance); |
} |
break; |
case 33: |
LCD_printfxy(0,0,"GimbalCtrl"); |
if(!(FromGimbalCtrl.GimbalStatus & GIMBAL_I2C_OK)) |
{ |
LCD_printfxy(0,2,"Not connected"); |
if(GimbalCtrlTimeout < 10) LCD_printfxy(14,3,"(conn)"); // connect manually |
if(Keys & KEY4) GimbalCtrlTimeout = 30000; |
} |
else |
{ |
LCD_printfxy(11,0,"V%i.%02i",1 + FromGimbalCtrl.Version / 100, FromGimbalCtrl.Version % 100); |
LCD_printfxy(0,1,"Stat:"); |
if(FromGimbalCtrl.GimbalStatus & GIMBAL_DATA_OK) LCD_printfxy(8,1,"OK") else LCD_printfxy(5,1,"No Gimbal"); |
LCD_printfxy(0,2,"Nick:%3i Roll:%3i",FromGimbalCtrl.Nick,FromGimbalCtrl.Roll); |
LCD_printfxy(0,3,"Yaw: %3i [0,1 Deg]",FromGimbalCtrl.Yaw); |
if(Keys & KEY4) { ToGimbalCtrl.BitCmd |= (GIMBAL_CMD_YW_ZERO); MenuNickGimbalOffset = 0;} |
//if(PPM_In[EE_Parameter.GimbalOut1Channel] > 10) LCD_printfxy(18,1,"1") else LCD_printfxy(18,1,"0") |
//if(PPM_In[EE_Parameter.GimbalOut2Channel] > 10) LCD_printfxy(19,1,"1") else LCD_printfxy(19,1,"0") |
//if(ToGimbalCtrl.BitCmd & GIMBAL_CMD_OUT_TRIGGER) LCD_printfxy(16,1,"1") else LCD_printfxy(16,1,"0") |
} |
break; |
case 34: // Temperaturecompensation of the Barosensor |
{ |
static s32 dT = 0, tAlt = 0, faktor = 0; |
static s32 dP = 0, pAlt = 0; |
static u8 stored = 0, heateroff_msg = 0; |
|
if(BaroCalState) |
{ |
dP = NaviData.Altimeter_5cm/2 - pAlt; |
dT = FC_Temperatur - tAlt; |
faktor = (dP * 100) / dT; |
|
if(abs(dT) < 130) LCD_printfxy(0,0,"Warm up slowly") |
else |
if(FC.StatusFlags & FC_STATUS_MOTOR_RUN) LCD_printfxy(0,0,"Motors off! ") |
else LCD_printfxy(0,0,"Wait... "); |
|
if((abs(FC_Temperatur_raw/10 - tAlt) >= 250)) heateroff_msg = 1; |
if((abs(FC_Temperatur_raw/10 - tAlt) <= 150)) heateroff_msg = 0; |
if(heateroff_msg) LCD_printfxy(0,0,"Heater off! "); |
|
LCD_printfxy(0,1,"T=%4dC dT=%3dC ",FC_Temperatur_raw/100,dT/10 ); |
LCD_printfxy(0,2,"P=%4dm dP=%3dm ",NaviData.Altimeter_5cm/20,dP/10 ); |
|
if(dT > 30) LCD_printfxy(0,3,"K=%4dcm/C ",faktor) |
else LCD_printfxy(0,3," (cancel)",faktor); |
|
if(abs(dT) > 120 && (abs(FC_Temperatur_raw/10 - FC_Temperatur) <= 5)) // kein Temperaturgradient und mehr als 12°C erwärmt |
{ |
heateroff_msg = 0; |
LCD_printfxy(12,3,"(save)"); |
LCD_printfxy(0,0,"Okay "); |
|
if(Keys & KEY4) // Store |
{ |
LuftdruckTemperaturKompensation = faktor; |
WriteBaroCalibrationToEEprom(); |
BaroCalState = 0; |
stored = 1; |
} |
} |
else LCD_printfxy(15,3,"(--) "); |
} |
else |
if(UART_VersionInfo.HWMajor >= 30) |
{ |
LCD_printfxy(0,0,"Barometer"); |
LCD_printfxy(0,1,"Temperat.= %4d.%1dC ",FC_Temperatur_raw/100,abs(FC_Temperatur_raw%100)/10); |
LCD_printfxy(0,2,"Faktor = %4dcm/C ",LuftdruckTemperaturKompensation); |
//LCD_printfxy(0,3,"Offset =%4dcm ",LuftdruckTemperaturOffset); |
if(stored) LCD_printfxy(0,3,"Stored "); |
|
if((abs(FC_Temperatur_raw/10 - FC_Temperatur) <= 5)) // kein Temperaturgradient |
{ |
LCD_printfxy(15,3,"(CAL)"); |
if(Keys & KEY4) // next step |
{ |
pAlt = NaviData.Altimeter_5cm/2; |
tAlt = FC_Temperatur_raw/10; |
FC_Temperatur = FC_Temperatur_raw/10; |
BaroCalState = 1; |
stored = 0; |
} |
|
} |
else LCD_printfxy(15,3,"(---)"); |
} |
else |
{ |
LCD_printfxy(0,0,"Barometer"); |
LCD_printfxy(0,1,"Temperat = ??C "); |
LCD_printfxy(0,2,"Faktor = ?? cm/C"); |
LCD_printfxy(0,3,"Not supported"); |
} |
|
if(Keys & KEY3) BaroCalState = 0; // cancel |
} |
break; |
|
|
|
default: |
//MaxMenuItem = MenuItem - 1; |
MenuItem = 0; |
break; |
} |
} |