0,0 → 1,259 |
/*#######################################################################################*/ |
/* !!! 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 "MobileMenu.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 MobileDispPtr = 0; |
|
MobileDataRequest_t MobileDataRequest; |
MobileDataInfo_t MobileDataInfo; |
Mobile_t Mobile; |
|
#define ML_SEND 0x0001 // show sendbutton |
#define ML_SLIDER 0x0002 |
#define ML_WHEEL 0x0004 |
#define ML_EDIT 0x0008 |
|
|
MobileLabel_t MobileLabel[MOBILE_MAX_MENU] = |
{ |
//{ 123456789012345678901 Min Max Default Decimals 1234567890123456 |
{ "Status " , 0, 1000, 200, 0, " ", {"SAT ","CAMERA","MAGNET"," "," "},0,0}, // 0 |
{ "Second Menu " , -100, 100, 50, 1, "Slider + Send ", {"-10 ","+10 ","-1 ","+1 ","Store "},2,ML_SEND | ML_SLIDER}, // 1 |
{ "Third Menu " , 10, 40, 20, 2, "Wheel ", {" "," "," "," ","Take "},1,ML_WHEEL}, // 2 |
{ "All Characters " , 0, 256, 20, 3, "Edit + Send ", {" "," "," "," "," "},3,ML_EDIT |ML_SEND} // 3 |
}; |
|
|
|
void Mobile_Putchar(char c) |
{ |
if(MobileDispPtr < M_DISPLAYBUFFSIZE) Mobile.DisplayBuff[MobileDispPtr++] = c; |
} |
|
|
void Mobile_Putchar_INV(char c) |
{ |
if(MobileDispPtr < M_DISPLAYBUFFSIZE) Mobile.DisplayBuff[MobileDispPtr++] = c | 0x80; |
} |
|
void Mobile_Putchar_BLINK(char c) |
{ |
if(MenuBlinkBit) Mobile_Putchar_INV(c); else Mobile_Putchar(c); |
} |
|
void Mobile_Clear(void) |
{ |
u8 i; |
for( i = 0; i < M_DISPLAYBUFFSIZE; i++) Mobile.DisplayBuff[i] = ' '; |
} |
|
// Display with 20 characters in 4 lines |
void MobileMenuUpdate(u8 item, u8 Keys, s16 Value) |
{ |
static u32 tmp,tmp2,tmp3; |
s32 i1,i2; |
u8 sign; |
Mobile_Clear(); |
switch(item) |
{ |
// Version Info |
case 0: |
{ |
static u8 show = 0; |
// Mobile_printfxy(0,0,"++ Mobile Menu ++"); |
|
// Mobile_printfxy_BLINK(10,3,"BLINK"); |
|
// Mobile_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) Mobile_printfxy(19,1,"R"); |
/* |
NaviData.Current |
s16 Altimeter_5cm; // hight according to air pressure |
s16 Variometer; // climb(+) and sink(-) rate |
u16 FlyingTime; // in seconds |
u16 GroundSpeed; // speed over ground in cm/s (2D) |
s16 Heading; // current flight direction in ° as angle to north |
s8 AngleNick; // current Nick angle in 1° |
s8 AngleRoll; // current Rick angle in 1° |
u8 FCStatusFlags; // Flags from FC see main.c FC_STATUS_xxx |
u8 NCFlags; // Flags from NC see main.h NC_FLAG_xxx |
u8 Errorcode; // 0 --> okay |
u8 WP_OperatingRadius; // current WP operation radius around the Home Position in m |
s16 TopSpeed; // velocity in vertical direction in cm/s |
u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
u8 FCStatusFlags2; // StatusFlags2 (since version 5 added) |
s16 SetpointAltitude; // setpoint for altitude |
u8 Gas; // current gas (thrust) |
|
NaviData.GroundSpeed |
NaviData. |
NaviData. |
NaviData. |
|
NaviData. |
NaviData.SatsInUse |
|
|
*/ |
if(FC.StatusFlags & FC_STATUS_LOWBAT) |
{ |
Mobile_printfxy_BLINK(0,0," %2i.%1iV ",FC.BAT_Voltage/10, FC.BAT_Voltage%10) |
Mobile_printfxy_BLINK(0,1," %2i:%02i ",NaviData.FlyingTime/60,NaviData.FlyingTime%60) |
Mobile_printfxy_BLINK(0,2," %5i ",NaviData.UsedCapacity) |
} |
else |
{ |
Mobile_printfxy(0,0," %2i.%1iV ",FC.BAT_Voltage/10, FC.BAT_Voltage%10) |
Mobile_printfxy(0,1," %2i:%02i ",NaviData.FlyingTime/60,NaviData.FlyingTime%60); |
Mobile_printfxy(0,2," %5i ",NaviData.UsedCapacity); |
} |
if(Parameter.GlobalConfig & FC_CFG_HOEHENREGELUNG) |
{ |
if(FC.StatusFlags2 & FC_STATUS2_ALTITUDE_CONTROL) Mobile_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(NaviData.Altimeter_5cm/20),FromFC_VarioCharacter) |
else Mobile_printfxy(10,0,"ALT:%4im ", (int16_t)(NaviData.Altimeter_5cm/20)) |
} |
else Mobile_printfxy(10,0,"ALT:---- "); |
|
Mobile_printfxy(10,1,"DIR: %3d%c",NaviData.CompassHeading,'`'); |
if(FC.StatusFlags2 & FC_STATUS2_CAREFREE) Mobile_printfxy_INV(20,1,"C") else Mobile_printfxy(20,1," "); |
|
Mobile_printfxy(12,2,"I:%2i.%1iA ",NaviData.Current/10, NaviData.Current%10); |
|
Mobile_printfxy(8,0,":"); |
Mobile_printfxy(8,1,":"); |
Mobile_printfxy(8,2,":"); |
|
if(Keys & KEY1) show = 0; |
if(Keys & KEY2) show = 1; |
if(Keys & KEY3) show = 2; |
switch(show) |
{ |
case 0: |
Mobile_printfxy(0,3,"S:%2d %2im/s HM:%3dm %c",NaviData.SatsInUse,NaviData.GroundSpeed/100,NaviData.HomePositionDeviation.Distance_dm/10,NC_GPS_ModeCharacter); |
break; |
case 1: |
if(TrigLogging.CountExternal) Mobile_printfxy(0,3,"HotShoe:%4u ",TrigLogging.CountExternal-1) |
else Mobile_printfxy(0,3,"No HotShoe"); |
break; |
case 2: |
Mobile_printfxy(0,3,"MAG:%3u%% incl:%2d`(%2i)",EarthMagneticField,EarthMagneticInclination,EarthMagneticInclinationTheoretic); |
break; |
} |
|
Mobile_printfxy_BLINK(0,4,"%s",NaviData_HoTT_Text.HoTT_DisplayText); |
} |
break; |
case 1: |
Mobile_printfxy(0,0,"Testpage %i ",item); |
Mobile_printfxy(0,1," KEY: 0x%02x ",Keys); |
Mobile_printfxy(0,2," Load: %5i ",tmp2); |
Mobile_printfxy(0,3," Temp: %5i ",tmp); |
|
if(Keys & KEY5) tmp2 = tmp; |
if(Keys & KEY4) tmp++; |
if(Keys & KEY3) tmp--; |
if(Keys & KEY2) tmp += 10; |
if(Keys & KEY1) tmp -= 10; |
if(Keys & COPY) tmp2 = Value; |
Mobile.ReturnValue = tmp2; |
break; |
case 2: |
Mobile_printfxy(0,0,"Testpage %i ",item); |
Mobile_printfxy(0,1,"CNT: %5u ",tmp3++); |
Mobile_printfxy(0,2,"KEY: %02x ",Keys); |
Mobile_printfxy(0,4,"VALUE: %5i ",Value); |
if(Keys & COPY) tmp3 = Value; |
Mobile.ReturnValue = tmp3; |
break; |
case 3: |
{ |
static u16 offset = 20, tmp; |
// Mobile_printfxy(0,0,"Testpage %i %c",item,33); |
for(sign = 0; sign < 21*5; sign++) Mobile.DisplayBuff[sign] = sign + ' '; |
|
// if(Keys & COPY) offset = Value; |
} |
break; |
|
default: |
Mobile_printfxy(0,0,"Not used "); |
//MaxMenuItem = MenuItem - 1; |
break; |
} |
Mobile.Index = item; // this menu item was processed |
|
} |