Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1299 → Rev 1300

/branches/V0.74d-acid/FlightCtrl.aps
0,0 → 1,0
<AVRStudio><MANAGEMENT><ProjectName>FlightCtrl</ProjectName><Created>15-May-2007 11:20:41</Created><LastEdit>01-Sep-2009 17:44:26</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>15-May-2007 11:20:41</Created><Version>4</Version><Build>4, 13, 0, 528</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\Flight-Ctrl_MEGA644_ctrl_mod.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>D:\Projects\devel\mksvn\FlightCtrl\tags\V0.74d\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega644P</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>uart.c</SOURCEFILE><SOURCEFILE>analog.c</SOURCEFILE><SOURCEFILE>fc.c</SOURCEFILE><SOURCEFILE>GPS.c</SOURCEFILE><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>menu.c</SOURCEFILE><SOURCEFILE>printf_P.c</SOURCEFILE><SOURCEFILE>rc.c</SOURCEFILE><SOURCEFILE>timer0.c</SOURCEFILE><SOURCEFILE>twimaster.c</SOURCEFILE><SOURCEFILE>led.c</SOURCEFILE><SOURCEFILE>spi.c</SOURCEFILE><SOURCEFILE>Spectrum.c</SOURCEFILE><SOURCEFILE>mymath.c</SOURCEFILE><HEADERFILE>uart.h</HEADERFILE><HEADERFILE>_Settings.h</HEADERFILE><HEADERFILE>analog.h</HEADERFILE><HEADERFILE>fc.h</HEADERFILE><HEADERFILE>gps.h</HEADERFILE><HEADERFILE>main.h</HEADERFILE><HEADERFILE>menu.h</HEADERFILE><HEADERFILE>old_macros.h</HEADERFILE><HEADERFILE>printf_P.h</HEADERFILE><HEADERFILE>rc.h</HEADERFILE><HEADERFILE>Settings.h</HEADERFILE><HEADERFILE>timer0.h</HEADERFILE><HEADERFILE>twimaster.h</HEADERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega644p</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>Flight-Ctrl_MEGA644_ctrl_mod.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS><OPTION><FILE>GPS.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>analog.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>eeprom.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>fc.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>main.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>menu.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>printf_P.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>rc.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>timer0.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>twimaster.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>uart.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS><LIB>libc.a</LIB><LIB>libm.a</LIB></LIBS><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -Wstrict-prototypes -std=gnu99 -DVERSION_MAJOR=0 -DVERSION_MINOR=74 -DVERSION_PATCH=3 -DVERSION_SERIAL_MAJOR=10 -DVERSION_SERIAL_MINOR=1 -Wa,-adhlns=ubx.lst -DNC_SPI_COMPATIBLE=6 -DF_CPU=20000000UL -O2 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>main.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>uart.c</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>menu.c</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>timer0.c</FileName><Status>1</Status></File00003><File00004><FileId>00004</FileId><FileName>fc.c</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>fc.h</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>TWIMASTER.C</FileName><Status>1</Status></File00006><File00007><FileId>00007</FileId><FileName>_Settings.h</FileName><Status>1</Status></File00007><File00008><FileId>00008</FileId><FileName>main.h</FileName><Status>1</Status></File00008><File00009><FileId>00009</FileId><FileName>analog.c</FileName><Status>1</Status></File00009><File00010><FileId>00010</FileId><FileName>GPS.c</FileName><Status>1</Status></File00010><File00011><FileId>00011</FileId><FileName>spi.c</FileName><Status>1</Status></File00011><File00012><FileId>00012</FileId><FileName>mymath.c</FileName><Status>1</Status></File00012></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
/branches/V0.74d-acid/GPS.c
0,0 → 1,32
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + only for non-profit use
// + www.MikroKopter.com
// + see the File "License.txt" for further Informations
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "main.h"
 
signed int GPS_Nick = 0;
signed int GPS_Roll = 0;
signed int GPS_Nick2 = 0;
signed int GPS_Roll2 = 0;
long GpsAktuell_X = 0;
long GpsAktuell_Y = 0;
long GpsZiel_X = 0;
long GpsZiel_Y = 0;
void GPS_Neutral(void)
{
GpsZiel_X = GpsAktuell_X;
GpsZiel_Y = GpsAktuell_Y;
}
 
void GPS_BerechneZielrichtung(void)
{
GPS_Nick = 0;
GPS_Roll = 0;
}
 
 
 
 
/branches/V0.74d-acid/Hex-Files/BootLoader_MEGA644_20MHZ_V0_1.hex
0,0 → 1,64
:10F8000011241FBECFEFD0E1DEBFCDBF11E0A0E0DD
:10F81000B1E0E0EEFBEF02C005900D92A030B10721
:10F82000D9F712E0A0E0B1E001C01D92A230B1070B
:10F83000E1F70C943B7C0C941D7C0895982F8091EB
:10F84000C00085FFFCCF9093C60008958091C00052
:10F850008823E4F78091C600992708958DE40E94DB
:10F860001E7C8BE40E941E7C82E40E941E7C8CE441
:10F870000E941E7C0895CFEFD0E1DEBFCDBFE0E057
:10F88000F0E014915F01772474BE98E10FB6F8940C
:10F8900090936000109260000FBE7092C5008AE2E3
:10F8A0008093C4008091C00082608093C0009093D8
:10F8B000C10086E08093C200EF01072D8091C00057
:10F8C00087FF0DC0013031F48091C6008A3AB1F152
:10F8D00000E005C08091C6008B3109F401E0CE0143
:10F8E00021968436910528F11F3F41F0112331F014
:10F8F000E0910001F091010109951BC01092C50033
:10F900008AE28093C4008AE00E941E7C8DE00E94FF
:10F910001E7C86E50E941E7C80E30E941E7C8EE297
:10F920000E941E7C81E30E941E7C8AE30E941E7C52
:10F9300005C080E593EC0197F1F7C0CF0E942E7CC3
:10F940000E94267C813611F489E547C1813471F427
:10F950000E94267CA82EBB24BA2CAA240E94267CB6
:10F960009927A82AB92AB694A79406C1823629F401
:10F9700089E50E941E7C81E00BC1823409F083C0BE
:10F980000E94267C9927D82FCC270E94267C992775
:10F99000C82BD92B0E94267C082F12E0812E11E063
:10F9A000912EEE24FF2464010894811C911CEC1616
:10F9B000FD0618F40E94267C01C08FEFD6018C93BF
:10F9C0000894E11CF11CBFEFEB16F10461F358F34E
:10F9D000E4E77E1609F0DEC0063409F03DC0FFEF13
:10F9E000AF16F7EFBF0608F033C0DE01A5016627AA
:10F9F0007727440F551F661F771F6A017B01C2E0FE
:10FA0000D1E001E08991992729913327322F2227CC
:10FA1000822B932B0C01FA0100935700E8951124D7
:10FA20004E5F5F4F6F4F7F4F129761F785E0F60192
:10FA300080935700E89507B600FCFDCF81E18093E5
:10FA40005700E89576956795579547955A0194C064
:10FA500080E00E941E7C90C0053409F08DC0F50145
:10FA60009E01A2E0B1E0E1BD8F2F992782BD8D916B
:10FA700080BD3196FA9AF99AF999FECF215030401B
:10FA800091F75F0179C0873609F047C00E94267C54
:10FA90009927D82ECC240E94267C9927C82AD92AB7
:10FAA0000E94267C863411F5E6016501EE24FF24D0
:10FAB000CC0CDD1CEE1CFF1CF60105911491802F6F
:10FAC0000E941E7C812F99270E941E7C82E090E07C
:10FAD000A0E0B0E0C80ED91EEA1EFB1E229761F717
:10FAE000F694E794D794C79456012ACF853409F049
:10FAF00027CF7501E1BC8F2D992782BDF89A089414
:10FB0000E11CF11C80B50E941E7C0894C108D1083C
:10FB1000C114D10479F7570113CF853601F594E765
:10FB2000791651F580E090E0A0E0B0E023E0FC0120
:10FB300020935700E89507B600FCFDCF80509F4FFB
:10FB4000AF4FBF4F8F3FE7EF9E07E0E0AE07E0E02B
:10FB5000BE0768F381E180935700E8950DC08534B6
:10FB600069F488E190E02CE00FB6F894A8958093B2
:10FB700060000FBE209360008DE02FC08035E1F360
:10FB80008C34D1F3803711F483E527C0843721F416
:10FB90000E941E7C80E021C0843521F40E94267CD6
:10FBA000782EEACF8B3109F4C9CE8A3A09F4C6CE51
:10FBB000863529F480E30E941E7C81E30EC08337E2
:10FBC00041F489E00E941E7C86E90E941E7C8EE141
:10FBD00004C08B3109F4B4CE8FE30E941E7CB0CEFA
:040000030000F80001
:00000001FF
/branches/V0.74d-acid/Hex-Files/Flight-Ctrl_MEGA644_acid_v4.hex
0,0 → 1,3164
:100000000C94F2030C940D040C940D040C940D0448
:100010000C940D040C940D040C940D040C940D041C
:100020000C940D040C94EE530C940D040C940D04DC
:100030000C9490510C940D040C940D040C940D042C
:100040000C940D040C940D040C9488520C940D0423
:100050000C9448040C940D040C940F040C940D049F
:100060000C94700D0C940D040C94DB570C940D043F
:100070000C94025E0C940D040C940D041C0E0F0ED7
:10008000030EE90DCF0DAB0DBD0DEB101F101C10B5
:10009000AB0D0910EF0FCF0FAF0F5D0F0B0F280E39
:1000A000505843589058745868580158125812586C
:1000B00019583558305815581D5819582C58395852
:1000C00015581D58195828583E581558A2582E0032
:1000D0000A0D20444143206F72204932432045528B
:1000E000524F522120436865636B204932432C20D4
:1000F00033567265662C2044414320616E64204271
:100100004C2D4374726C000A0D3D3D3D3D3D3D3D1F
:100110003D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D0F
:100120003D3D3D3D3D3D3D3D3D3D3D3D000A0D4696
:100130006C69676874436F6E74726F6C0A0D486106
:100140007264776172653A25642E25640A0D536FD7
:100150006674776172653A5625642E25642563209E
:10016000000A0D47656E65726174696E672064658B
:100170006661756C74204D69786572205461626C9B
:1001800065000A0D4D697865722D436F6E6669676B
:100190003A202725732720282575204D6F746F720C
:1001A0007329000A0D466F756E6420424C2D43740E
:1001B000726C3A2000256420000A0D0A0D212120CE
:1001C0004D495353494E4720424C2D4354524C3ACB
:1001D000202564202121000A0D3D3D3D3D3D3D3D52
:1001E0003D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3F
:1001F0003D3D3D3D3D3D3D3D3D3D3D3D000A0D49C3
:100200006E69742E20454550524F4D003A20476587
:100210006E65726174696E672044656661756C74A1
:100220002D506172616D65746572207573696E67BA
:10023000206F6C6420537469636B20536574746918
:100240006E6773000A0D414343206E6F7420636133
:100250006C696272617465642021000A0D557369CE
:100260006E6720706172616D65746572736574206C
:100270002564000A0D43616C6962726174696E677E
:100280002070726573737572652073656E736F721B
:100290002E2E004F4B0A0D000A0D436F6E74726FC5
:1002A0006C3A200048656164696E67486F6C640051
:1002B0004E6F726D616C20284143432D4D6F646514
:1002C00029000A0D3D3D3D3D3D3D3D3D3D3D3D3D12
:1002D0003D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D4E
:1002E0003D3D3D3D3D3D3D0A0D005B25695D005BAB
:1002F00025695D002B204D696B726F4B6F707465C3
:1003000072202B0048573A5625642E2564205357F7
:100310003A25642E256425630053657474696E67FD
:100320003A256420257300493243204552524F52EA
:10033000212121004D697373696E6720424C2D4362
:1003400074726C3A256421210028632920486F6C5F
:10035000676572204275737300486F6568653A205F
:100360002020202025356900536F6C6C486F65682C
:10037000653A20253569004C756674647275636B47
:100380003A20253569004F66662020202020203A3B
:1003900020253569004B65696E65200048F6686563
:1003A0006E726567656C756E6700616B742E204CAC
:1003B000616765004E69636B3A202020202020256C
:1003C000356900526F6C6C3A2020202020202535A2
:1003D00069004B6F6D706173733A20202025356979
:1003E000004B313A25346920204B323A25346920BC
:1003F000004B333A25346920204B343A25346920A8
:10040000004B353A25346920204B363A2534692093
:10041000004B373A25346920204B383A253469207F
:10042000004E693A2534692020526F3A25346920FC
:100430000047733A253469202047693A25346920FA
:100440000050313A253469202050323A2534692051
:100450000050333A253469202050343A253469203D
:10046000004779726F202D2053656E736F72004EB6
:1004700069636B2025346920282533692E25692975
:1004800000526F6C6C2025346920282533692E2595
:100490006929004769657220253469202825336958
:1004A00029004E69636B2025346920282533692E85
:1004B00025782900526F6C6C20253469202825335B
:1004C000692E25782900476965722025346920281E
:1004D00025336929004E69636B202534692028255E
:1004E000336929282533692900526F6C6C20253423
:1004F000692028253369292825336929004769653A
:100500007220253469202825336929282533692953
:1005100000414343202D2053656E736F72004E6976
:10052000636B2025346920282533692900526F6CBC
:100530006C2025346920282533692900486F6368B9
:1005400020253469202825336929005370616E6E97
:10055000756E673A202025356900456D70662E500E
:100560006567656C3A253569004B6F6D7061737313
:1005700020202020202020005269636874756E6757
:100580003A2020253569004D657373776572743A9A
:1005900020202535690053746172743A2020202090
:1005A0002025356900506F7469313A202025336960
:1005B00000506F7469323A202025336900506F74FF
:1005C00069333A202025336900506F7469343A202A
:1005D0002025336900536572766F202000536574BF
:1005E000706F696E742020253369005374656C6CDC
:1005F000756E673A202533690052616E67653A254A
:1006000033692D2533690045787465726E436F6ECA
:1006100074726F6C2020004E693A25346920205294
:100620006F3A253469200047733A25346920204702
:10063000693A253469200048693A25346920204305
:10064000663A2534692000424C2D4374726C204573
:1006500072726F727320002025336420202533646A
:100660002020253364202025336420002025336496
:100670002020253364202025336420202533642066
:100680000020253364202025336420202533642076
:10069000202533642000424C2D4374726C20666F19
:1006A000756E6420002025632020202563202020F3
:1006B000256320202025632000202563202020257D
:1006C000632020202563202020256320002025632F
:1006D0002020202D2020202D2020202D0031300012
:1006E0003131003132000A0D506C65617365206351
:1006F0006F6E6E656374205370656B7472756D20D8
:10070000726563656976657220666F722062696ED4
:1007100064696E67204E4F572E2E2E006F6B2E0A87
:100720000D0054696D656F75742E0A0D0000008F01
:10073000001E01AD013B02CA025803E60374040225
:10074000058F051B06A7063307BE074808D2085BBE
:1007500009E3096B0AF20A780BFD0B810C040D8684
:100760000D070E870E060F840F00107B10F5106E1C
:1007700011E5115B12CF124213B31323149214FE2E
:10078000146A15D3153B16A11605176717C8172746
:10079000188318DE1837198E19E319361A871AD6F6
:1007A0001A231B6E1BB61BFD1B411C831CC31C00A4
:1007B0001D3C1D751DAB1DE01D121E421E6F1E9AB5
:1007C0001EC31EE91E0D1F2E1F4D1F691F841F9B78
:1007D0001FB01FC31FD31FE11FEC1FF51FFB1FFF1F
:1007E0001F00200011241FBECFEFD0E1DEBFCDBF20
:1007F00013E0A0E0B1E0E6EDF2EC02C005900D924E
:10080000AE3CB107D9F719E0AEECB3E001C01D92E0
:10081000A139B107E1F70C943E420C9400001F92FD
:100820000F920FB60F9211248F939F93EF93FF9324
:10083000809105038823A9F48091E1039091E2035C
:100840000196FC01EE59FA4FE081ED3079F08639DE
:10085000910561F09093E2038093E103E093C60079
:100860000EC01092E2031092E10309C01092E2035D
:100870001092E10381E080930503E093C600FF91AD
:10088000EF919F918F910F900FBE0F901F90189531
:100890001F920F920FB60F9211242F933F934F93F5
:1008A0005F938F939F93AF93BF93EF93FF9390E0EA
:1008B0008091C6008093D9035091E703563910F018
:1008C0009093E8038091D9038D3091F02091E80353
:1008D000822F99278130910509F46AC082309105F1
:1008E0000CF48CC0029709F47DC01092E803A6C0F6
:1008F0002091E803223061F79093E803852F992730
:100900008154994FFC01329740812091E30330914B
:10091000E403241B3109DC0111978C91281B310958
:10092000C9019F709093E4038093E3030024880F30
:10093000991F001C880F991F001C892F902D982F3C
:10094000935C9093E5032F733070235C2093E60350
:100950008081891709F46CC090E08091D6038F5F85
:100960008093D6038091D803882309F067C0992328
:1009700009F464C081E08093D803580F5093D503E5
:100980005150E52FFF27E154F94F8DE0808380918E
:10099000C106823509F052C088E190E02CE00FB624
:1009A000F894A895809360000FBE2093600046C025
:1009B0002F5F2093E803E52FFF27E154F94F809143
:1009C000D90380835F5F5093E7032091D90380911F
:1009D000E3039091E403820F911D9093E4038093CD
:1009E000E3032CC0E52FFF27E154F94F8091D90391
:1009F0008083563938F31092E803E7CF892B09F04A
:100A000074CF8091D903833259F08091D9038093B8
:100A1000BF0681E08093E7038091D9039927DDCF5A
:100A20008091D803882389F781E08093E803EDCF94
:100A30008C91821709F090CF91E094CFFF91EF91C4
:100A4000BF91AF919F918F915F914F913F912F9166
:100A50000F900FBE0F901F901895AC01A0E0B0E072
:100A60009D01A817B90748F4E2E6F5E08191280F47
:100A7000311D1196A417B507C8F33F70FD01EE595B
:100A8000FA4FC9010024880F991F001C880F991F75
:100A9000001C892F902D835C80831196FD01EE59F7
:100AA000FA4F2F733070822F835C8083AD59BA4F19
:100AB0008DE08C9310920503809162058093C600AF
:100AC0000895BF92CF92DF92EF92FF920F931F9300
:100AD000CF93DF93CDB7DEB72C859D857E85BB2474
:100AE00083E2809362059F59909363052093640588
:100AF00003E010E0772309F4ADC0CF84D88843E148
:100B0000E42EF12CEC0EFD1EA989BA8971501097C4
:100B100009F4A0C0109709F43CC0F601EB0DF11DDB
:100B2000B3949081119789F47723A1F1F70122E022
:100B300030E0E20EF31ED701C080D180E20EF31E3A
:100B40000D90BC91A02DBB247150109719F1F601A6
:100B5000EB0DF11DB3944081119709F466C0109715
:100B6000D1F0F601EB0DF11DB39460811197A1F462
:100B7000772391F0F7013296D701CD90DC9032E0E7
:100B8000E32EF12CEE0EFF1EA081B181BB2471502B
:100B900003C090E040E060E0F801EE59FA4F892F81
:100BA00086958695835C80830F5F1F4FF801EE5911
:100BB000FA4F892F99278370907082959295907F34
:100BC0009827807F982755279A01329522952F7074
:100BD00023273F702327822B835C80830F5F1F4F67
:100BE000F801EE59FA4F4F705070440F551F440FE3
:100BF000551F862F99270024880F991F001C880FE6
:100C0000991F001C892F902D842B835C80830F5F9C
:100C10001F4FF801EE59FA4F6F73635C60830F5FEB
:100C20001F4F109709F076CF15C0772309F4B3CF83
:100C3000F701A2E0B0E0EA0EFB1ED701C080D18030
:100C400022E030E0E20EF31E0D90BC91A02DBB24FB
:100C5000715085CFC8010E942D05DF91CF911F9162
:100C60000F91FF90EF90DF90CF90BF900895A3E099
:100C70007A2F4091D503465009F45FC0E72FFF2734
:100C8000E154F94F80818D537F5FE72FFF27E154B7
:100C9000F94F20812D537F5FE72FFF27E154F94F54
:100CA00030813D537F5FE72FFF27E154F94F60818B
:100CB0006D537F5F9927880F991F880F991F522FB7
:100CC00052955F70582B822F99278F709070829564
:100CD0009295907F9827807F9827232F2695269599
:100CE000282B832F992783709070002496958795E1
:100CF0000794969587950794982F802D682B4150DF
:100D00004F3FD9F0EA2FFF27E154F94F5083AF5FEF
:100D100041504F3F91F0EA2FFF27E154F94F2083D4
:100D2000AF5F41504F3F49F0EA2FFF27E154F94FA1
:100D30006083AF5F442309F0A1CF82EC96E09093EB
:100D4000D4038093D303A350A093D2030895CF93E9
:100D5000DF93CDB7DEB722970FB6F894DEBF0FBE94
:100D6000CDBF8091D803882309F4A9C20E94370619
:100D70008091C006823609F471C08091C10699271E
:100D80008436910509F457C08536910584F581367E
:100D9000910509F44EC1823691050CF4C2C0823629
:100DA000910509F49AC183369105C1F48091CE036F
:100DB0009091CF03892B09F049C2A091D303B09140
:100DC000D4039C91992309F037C29C918AE0989FA3
:100DD000C00111249093CF038093CE031092D803C7
:100DE0001092D4031092D3031092D20368C28C36AF
:100DF000910509F410C18D3691050CF0B3C087360A
:100E0000910509F42BC18836910541F78FEF809346
:100E10000303E091D303F091D403808190911705EF
:100E2000892B80931705882311F01092DA0381E053
:100E30008093DE03D3CFE091D303F091D40390816C
:100E40008AE0989FC00111249093010380930003CE
:100E5000892B21F281E08093DD03C0CF8091C10610
:100E600099278037910509F4F2C0813791050CF478
:100E700085C08337910509F45BC1843791050CF077
:100E80003CC18137910509F078CFA091D303B0918F
:100E9000D4038C918F3F09F406C28C91882309F00A
:100EA000FDC181E08C93A091D303B091D4034DE5B3
:100EB0006DEF77E08C910E949D418091050388231E
:100EC000E1F3E091D303F091D403808189838BE433
:100ED0008A838DE590E09F938F938DEF97E09F93AA
:100EE0008F9321E030E03F932F93CE0102969F93A2
:100EF0008F933F932F93CE01820F931F9F938F93D6
:100F000083E08F9381E08F9381E58F930E94610549
:100F1000ADB7BEB71F960FB6F894BEBF0FBEADBF3C
:100F20002CCF8B34910509F059CFE091D303F09188
:100F3000D40380819181909355048093540420912F
:100F4000520430915304821B930B845E9D4F68E6DC
:100F500071E00E941B61845B904090934F048093EA
:100F60004E043CCF8437910509F47CC08637910547
:100F700009F034CF81E08093DC0330CF8D369105CA
:100F800029F18E3691050CF093C08B34910509F050
:100F9000F4CEA091D303B091D4038D919C91909302
:100FA0005504809354042091520430915304821BC1
:100FB000930B845E9D4F68E671E00E941B61845B29
:100FC000904090934F0480934E04D7CE80910503B8
:100FD0008823E1F3A091D303B091D4039C91913085
:100FE00009F439C1198281E090E09F938F93CE017B
:100FF00001969F938F9381E08F938F938DE48F93CE
:101000000E9461058DB79EB707960FB6F8949EBFF4
:101010000FBE8DBFB2CE8FEF80930303E091D30359
:10102000F091D40380818093180581E08093DF03E1
:10103000D5CEE091D303F091D403E081E03258F0B3
:101040008FE1809304038FEF80930303C7CE81E089
:101050008093DB0392CEE0930403F5CF81E080938D
:10106000E003BCCE8091D503853108F4D4C0E09173
:10107000D303F091D40380E1AAE9B6E001900D9288
:101080008A95E1F7809105038823E1F31F9280910F
:1010900002038F9384E58F930E9461058AEF80930A
:1010A000D0038FEF809303030F900F900F9096CE95
:1010B0008E36910509F061CE809105038823E1F316
:1010C0008DE490E09F938F9385E597E09F938F93B6
:1010D00081E08F938F938EE492CFA091D303B09150
:1010E000D4038BE0E2EBF6E00D9001928A95E1F7F4
:1010F0008091BB068093E407A6CF8437910509F061
:101100003CCE8091D503853108F4B6C0A091D303BD
:10111000B091D40380E1EAE9F6E00D9001928A955E
:10112000E1F780EF8093D0038FEF8093030325CE08
:101130002091D3033091D403F9018081815085300F
:1011400018F481818B34E9F019828091050388239A
:10115000E1F381E090E09F938F93CE0101969F93FE
:101160008F9381E08F938F9383E58F930E94610526
:10117000EDB7FEB737960FB6F894FEBF0FBEEDBFC2
:10118000FCCD6DEF77E08DE52E5F3F4FDB01F90180
:10119000982F01900D929A95E1F722503040482FF8
:1011A000D9018C910E94C64180912A089927AA27CB
:1011B000BB27BC01CD0124EC39E040E050E00E94A7
:1011C000DC60DC01CB018093330390933403A09364
:1011D0003503B093360380912B089927AA27BB27A4
:1011E000BC01CD010E94DC60DC01CB0180932F03A8
:1011F00090933003A0933103B0933203E091D30373
:10120000F091D40380810E94BA410E94F541898304
:101210000E94F7139ACFE091D303F091D403808119
:101220009181A281B38180939A0690939B06A093AB
:101230009C06B0939D0626CF8AE0989FC00111249A
:101240000E946B539093610580936005A091D30336
:10125000B091D403BACD45E557E08DE4FA01282FCB
:101260000D9001922A95E1F7A8EEB3E0FA01182E4D
:101270000E94D4609983B7CEA091D303B091D403D8
:101280008D919D910D90BC91A02D80939A06909385
:101290009B06A0939C06B0939D0643CF863008F42E
:1012A00006CE85E0FFCD0E94F541E091D303F09199
:1012B000D4038083A091D303B091D403EECD2296C2
:1012C0000FB6F894DEBF0FBECDBFDF91CF9108956A
:1012D000CF93C82F8A3029F08091C00085FFFCCFC2
:1012E00004C08DE00E946809F7CFC093C60080E07B
:1012F00090E0CF910895089588E18093C100809196
:10130000C00082608093C0008091C100806880939B
:10131000C1008091C10080648093C1008AE2809303
:10132000C40080910003909101030E946B5390933D
:101330008F0680938E068CED90E00E946B53909305
:10134000BE068093BD06109290068AE480939106B3
:1013500083E0809394068AE08093920681E08093F4
:1013600093061092D4031092D3031092D2030895DF
:10137000EF92FF920F931F9380910503882309F446
:1013800078C28091DE03882309F082C08091DF0358
:10139000882329F080910503882309F07FC180917B
:1013A000DC03882329F080910503882309F05BC1C1
:1013B0008091E003882329F080910503882309F0B8
:1013C00036C18091BD069091BE060E947453882359
:1013D00029F080910503882309F0C8C0809100039B
:1013E00090910103892B09F084C18091DD0388234A
:1013F00029F080910503882309F00FC28091CE0364
:101400009091CF03892B09F07EC1209104032F3FD7
:1014100059F180E190E09F938F93822F99278295D5
:101420009295907F9827807F982780509F4F9F9319
:101430008F9381E090E09F938F9384E093E09F935C
:101440008F9382E08F9381E08F9381E48F930E944A
:1014500061058FEF809304038DB79EB70B960FB68F
:10146000F8949EBF0FBE8DBF8091E407882329F0BA
:1014700080910503882309F05EC08091DB038823F7
:1014800009F4F7C180910503882309F4F2C139C03A
:1014900080910503882309F479CF0E94684684E18E
:1014A00090E09F938F939091DA0384E1989FC0011D
:1014B00011248F599C4F9F938F9381E090E09F93CD
:1014C0008F938AED93E09F938F9382E08F9381E0D7
:1014D0008F9388E48F930E9461058091DA038F5F78
:1014E0002DB73EB7255F3F4F0FB6F8943EBF0FBEF6
:1014F0002DBF843008F4B8C11092DA031092DE03D5
:1015000045CF86E190E09F938F938AEC98E09F937C
:101510008F9381E08F938F9380E58F930E94610575
:101520001092DB038DB79EB707960FB6F8949EBF57
:101530000FBE8DBF9EC181E090E09F938F9384EE9C
:1015400097E09F938F9381E08F938F9382E48F93A3
:101550000E9461051092E4072DB73EB7295F3F4F07
:101560000FB6F8943EBF0FBE2DBF87CF80911108F4
:101570009927880F991F880F991F7C010027F7FC76
:101580000095102F80918E0490918F04A09190046B
:10159000B0919104BC01CD01A80197010E94506156
:1015A0003093AB062093AA0680918604909187041D
:1015B000A0918804B0918904BC01CD01A8019701D4
:1015C0000E9450613093AD062093AC0680912804B0
:1015D0008093AE06809127048093AF0688E090E068
:1015E0009F938F938AEA96E09F938F9381E08F93E6
:1015F00083E08F9387E78F930E9461058091B00607
:101600002DB73EB7295F3F4F0FB6F8943EBF0FBED0
:101610002DBF853018F086E08093B00683E690E019
:101620000E946B539093BE068093BD06D7CE8BE08D
:1016300090E09F938F9382EB96E09F938F9381E04E
:101640008F93809102038F9387E48F930E946105AB
:101650001092E0038DB79EB707960FB6F8949EBF21
:101660000FBE8DBFAECE8AE090E09F938F9380E94E
:1016700096E09F938F9381E08F938F9386E58F936E
:101680000E9461051092DC032DB73EB7295F3F4FE2
:101690000FB6F8943EBF0FBE2DBF8ACE0E9468469B
:1016A00080E590E09F938F9381E693E09F938F93E3
:1016B00021E030E03F932F9380E693E09F938F9358
:1016C0003F932F9388E195E09F938F9383E08F93CF
:1016D00081E08F938CE48F930E9461051092DF0369
:1016E0008DB79EB70F960FB6F8949EBF0FBE8DBFF5
:1016F00056CE80918E0690918F060E947453882357
:1017000009F077CE72CE80916005909161050E94BC
:101710007453882309F479CE80910503882309F452
:1017200074CE809111089927880F991F880F991FEF
:101730007C010027F7FC0095102F80918E0490917A
:101740008F04A0919004B0919104BC01CD01A80137
:1017500097010E9450613093530520935205809168
:10176000860490918704A0918804B0918904BC01FB
:10177000CD01A80197010E94506130935505209337
:1017800054052091BF083091C0084091C108509184
:10179000C208DA01C90103E0880F991FAA1FBB1F05
:1017A0000A95D1F7820F931FA41FB51F820F931FB5
:1017B000A41FB51F209117033091180340911903FE
:1017C00050911A03BC01CD010E945061309357051E
:1017D000209356058EE090E09F938F9382E595E0ED
:1017E0009F938F9381E08F938F9383E48F930E94D5
:1017F00061058091CE039091CF030E946B5390932B
:101800006105809360052DB73EB7295F3F4F0FB646
:10181000F8943EBF0FBE2DBFF8CD82E490E09F93B9
:101820008F9382EA97E09F938F9381E08F938F93BA
:1018300084E48F930E9461051092DD038DB79EB7FB
:1018400007960FB6F8949EBF0FBE8DBF8091000320
:1018500090910103009709F4D1CD0E946B539093AE
:101860008F0680938E06CACD8093DA031092DE0332
:101870008DCD1F910F91FF90EF90089510927C00F5
:101880008FEC80937A000895EF92FF920F931F934D
:10189000CF93DF9303E010E0D8010E94BB60802D5E
:1018A000C82FDD27C531D10508F02A97C7BD109292
:1018B000F00384E690E00E948D5380910A0390919A
:1018C0000B038255934010F4C0E0D0E0CA3FD1052D
:1018D000E0F48EECE82E80E0F82EC7BD82E390E0C5
:1018E0000E948D53FF92EF921F920E94E64E8091CC
:1018F0000A0390910B030F900F900F908255934025
:1019000020F02196CA3FD10540F3D8010C2E0E9449
:10191000C860C093F2078CE291E00E948D53DF9182
:10192000CF911F910F91FF90EF900895EF92FF924A
:101930000F931F93CF93DF9300E00093EB0300938B
:10194000EA030093E90380ED97E00E946B53EC01FA
:101950001CE821E0F22E95EFE92E033009F4ABC02C
:1019600000E08091FC039091FD038C5F93400CF0AC
:1019700091C0809109038150809309038091FA03FB
:101980009091FB038C5F93400CF079C08091080329
:101990008150809308038091F8039091F9038C5F44
:1019A00093400CF04AC08091070381508093070355
:1019B00088E080933B050E94A057809109038A30FC
:1019C00008F055C0F092EB038AE080930903809100
:1019D00008038A3008F043C0F092EA038AE080935B
:1019E0000803809107038A3098F5F092E9038AE0B2
:1019F0008093070380913B05882379F0CE010E94F4
:101A000074538823B9F380ED90E09F938F931F92D6
:101A10000E94E64E0F900F900F901092ED078FEC02
:101A200080937A008091ED078823E1F31A3008F45F
:101A300047C0115009F091CF48C08091F8039091B0
:101A4000F903875094408CF1809107038F5FAECFEC
:101A5000863F80F2F092E903E0920703CBCF863F06
:101A600008F4BFCFF092EA03E0920803BACF863FB2
:101A700008F4ADCFF092EB03E0920903A8CF809178
:101A8000FA039091FB03875094408CF080910803F7
:101A90008F5F7FCF8091FC039091FD03875094402E
:101AA00044F0809109038F5F67CF0F5F81CF0F5F95
:101AB00072CF01E063CF1B3008F452CF19E050CF52
:101AC0008AE090E00E948D53B4CF86E490E00E94BB
:101AD0008D53DF91CF911F910F91FF90EF9008955B
:101AE0001F920F920FB60F921124EF92FF920F9355
:101AF0001F932F933F934F935F936F937F938F9396
:101B00009F93AF93BF93CF93DF93EF93FF93209176
:101B10000504822F9927AA27BB272F5FFC01429734
:101B200040F4E25CFF4FEE0FFF1F0590F491E02DB3
:101B300009941092050482E08093040480910404C7
:101B400080937C0080910504882309F4F9C38FEC0D
:101B500080937A00F5C320930504809178009091DA
:101B6000790020910A0430910B04820F931F909307
:101B70000B0480930A0481E0DFCF20930504809159
:101B80007800909179002091080430910904820F27
:101B9000931F909309048093080484E0CDCF209391
:101BA0000504809178009091790020919C043091F7
:101BB0009D04821B930B9093F1078093F007809113
:101BC000F0079091F107909313048093120482E040
:101BD000B3CF2093050480919A0490919B042091A7
:101BE000780030917900821B930B9093E6078093E5
:101BF000E5078091E5079091E607909311048093A3
:101C0000100487E099CF209305048091780090918B
:101C10007900909307048093060486E08DCF20938B
:101C200005042091780030917900309309042093C5
:101C300008041092040482CF2093050420917800B8
:101C40003091790030930B0420930A0481E074CF23
:101C50001092050481E0809306038091EC0390913B
:101C6000ED0301969093ED038093EC03809178004F
:101C7000909179002091F5073091F607820F931F1C
:101C80009093F6078093F5078091ED078F5F80931F
:101C9000ED078091ED07853008F44DCF8091F50771
:101CA0009091F60797FD36C3959587959093F60723
:101CB0008093F507809178009091790090930B03C1
:101CC00080930A031092ED078091EE039091EF0349
:101CD000BC01660F771F62957295707F7627607FD3
:101CE0007627681B790B80912C03482F552780910C
:101CF000F003282F332727FD30958FEF90E0289FA2
:101D00008001299F100D389F100D11248091E90743
:101D10009091EA07800F911F2091F5073091F60707
:101D2000821B930B2091350430913604821B930B58
:101D3000489F9001499F300D589F300D1124620F2C
:101D4000731F77FDE4C275956795759567957595D1
:101D5000679575956795759567957093EF03609393
:101D6000EE038091F5079091F607EC01EE27D7FD81
:101D7000E095FE2F20910C0330910D0340910E034E
:101D800050910F03DA01C90163E0880F991FAA1F60
:101D9000BB1F6A95D1F7821B930BA40BB50BC80F21
:101DA000D91FEA1FFB1FCE01DF010496A11DB11D43
:101DB000B7FDA7C243E0B595A795979587954A9536
:101DC000D1F780930C0390930D03A0930E03B0936F
:101DD0000F038091E9079091EA07800F911F2091EE
:101DE0000C0330910D0340910E0350910F03821BA1
:101DF000930B90933604809335048091F50790916E
:101E0000F60797FD7CC2959587959093F60780938A
:101E1000F50782E091CE209305042091780030915F
:101E200079008091080490910904280F391F80914E
:101E300056038A3009F44DC2220F331F220F331F7D
:101E40003093090420930804C90137FD51C29595C8
:101E5000879595958795959587959093FB038093A6
:101E6000FA0380910E0490910F04820F931F97FD47
:101E700044C29595879590930F0480930E0420910A
:101E8000A4043091A504821B930B909311038093BB
:101E9000100320910004309101048091100390916F
:101EA0001103280F391F37FD25C23595279530932B
:101EB00001042093000483E03FCE20930504209189
:101EC00078003091790080910A0490910B04280FDA
:101ED000391F809156038A3009F4F8C1220F331F4D
:101EE000220F331F30930B0420930A04C90137FDDE
:101EF000FDC195958795959587959595879590932F
:101F0000FD038093FC0380910C0490910D04820FDB
:101F1000931F97FDE9C19595879590930D04809344
:101F20000C042091A6043091A704821B930B90937C
:101F300013038093120320910204309103048091D3
:101F4000120390911303280F391F37FDCAC135952D
:101F50002795309303042093020481E0EDCD209374
:101F60000504809178009091790020919C04309133
:101F70009D04821B930B9093F1078093F00780914F
:101F8000F0079091F1072091120430911304820F11
:101F9000931F9093F5038093F40382E0CDCD2093BB
:101FA000050480919A0490919B04209178003091CF
:101FB0007900821B930B9093E6078093E50780914D
:101FC000E5079091E6072091100430911104820FEB
:101FD000931F9093F7038093F60387E0ADCD209392
:101FE0000504809156038A3009F462C1843109F4F2
:101FF00093C18091780090917900209106043091EE
:102000000704820F931F9093F9038093F80386E0EF
:1020100093CD2093050480917800909179002091D0
:10202000080430910904820F931F90930904809350
:1020300008041092040482CD2093050417CE209347
:1020400005048091780090917900AA2797FDA095CA
:10205000BA2FBC01CD010E9444607B018C018091AC
:10206000940490919504A0919604B09197049C01DA
:10207000AD01C801B7010E94E45FDC01CB01BC01E6
:10208000CD010E942760DC01CB019093F303809384
:10209000F2038091F2039091F30302970CF4BAC01B
:1020A0008091940490919504A0919604B091970426
:1020B00020E030E84BE354E4BC01CD010E944E60C7
:1020C0008823DCF58091940490919504A091960466
:1020D000B09197042AE037ED43EA5CE3BC01CD01FF
:1020E0000E94E55FDC01CB018093940490939504FA
:1020F000A0939604B09397048091150490911604D0
:10210000845F9140D0F48091940490919504A091C3
:102110009604B09197042DEC3CEC4CEC5DE3BC01D3
:10212000CD010E94E55FDC01CB0180939404909384
:102130009504A0939604B093970481E08093F103F3
:1021400080917800909179009093E8078093E70759
:102150008091F2039091F303AA2797FDA095BA2FDF
:1021600020915604309157044091580450915904DD
:10217000820F931FA41FB51F80935604909357049A
:10218000A0935804B09359042091560430915704F9
:10219000409158045091590457FD9EC07AE05595DE
:1021A0004795379527957A95D1F780915604909168
:1021B0005704A0915804B0915904821B930BA40BAF
:1021C000B50B8093560490935704A0935804B09392
:1021D000590483E0B1CC20930504809114039091BD
:1021E00015039C01220F331F280F391F809178009F
:1021F0009091790063E070E00E940761260F371F1D
:10220000369527953695279530931503209314031B
:1022100085E092CC8091F2039091F3038F5F9F4F02
:102220000CF08BCF8091940490919504A09196042A
:10223000B091970420E030E849E054E4BC01CD01BE
:102240000E94516018160CF078CF80919404909100
:102250009504A0919604B09197042AE037ED43EAE3
:102260005CE3BC01CD010E94E45FDC01CB01809303
:10227000940490939504A0939604B093970480914E
:10228000150490911604845F914008F056CF809118
:10229000940490919504A0919604B09197042DEC2C
:1022A0003CEC4CEC5DE3BC01CD010E94E45F3BCF14
:1022B0008091780090917900209106043091070474
:1022C000820F931F0196969587959DCE220F331FFF
:1022D00009CE220F331FB4CD21503C4F4F4F5F4FDB
:1022E0005DCF2F5F3F4F33CE019615CE079601CEBF
:1022F0000796ADCD2F5F3F4FD8CD0196BACD019651
:1023000082CDCE01DF010B96A11DB11D53CD615EC3
:102310007F4F19CD0196C8CC8091780090917900BB
:102320002091060430910704820F931F2FEF37E0AE
:10233000281B390B3093F9032093F80386E0FCCB7C
:10234000FF91EF91DF91CF91BF91AF919F918F91CD
:102350007F916F915F914F913F912F911F910F91BD
:10236000FF90EF900F900FBE0F901F90189581E097
:102370008093FD0782E08093FE0783E08093FF0750
:1023800084E08093000885E08093010886E08093D4
:10239000020887E08093030888E08093040808958A
:1023A0001F9388E6809305083EE1309306088BEF83
:1023B000809308088AE080930908309307083093D7
:1023C0000B08E4E0E0930A085FE050930C083093B8
:1023D0000D081CE010930E0878E070930F0886EE4D
:1023E000809310083093110880E88093120880E5EC
:1023F0008093130826E92093140883E0809315083E
:102400008EE58093160883E28093170830931808AE
:102410001092190860E260931A0810921B0810923B
:102420001C0810921D0810921E0810922F0810927E
:102430003008109231081092320844E640931F0889
:1024400088E2809320081092490892E39093210833
:102450002093220885E080932308909324082AE59E
:102460002093250890932608109248082093270867
:1024700083E4809328081092290885E580932A0830
:1024800080932B0880E180932C0860932D08409363
:102490002E088FE58093330883EF8093350850939F
:1024A0003408509336088DEF8093370840933808EE
:1024B0002093390820933A0820933B088BE48093BB
:1024C0003C0880933D0880933E0810923F0886E0C8
:1024D000809340087093410820934208309343084A
:1024E0004093440840934508E0934608ABE3B3E0CB
:1024F000EEE4F8E00D9001921A95E1F71F9108952E
:102500001F9388E6809305085EE1509306088BEFE1
:10251000809308088AE08093090850930708509335
:102520000B0893E090930A081CE010930C0880E1DC
:1025300080930D0876E070930E0868E060930F08B2
:1025400086EE809310085093110880E8809312085B
:1025500080E58093130888E780931408909315080A
:102560008EE58093160883E280931708509318082D
:102570001092190830E230931A0810921B0810923A
:102580001C0810921D0810921E0810922F0810921D
:102590003008109231081092320844E640931F0828
:1025A00088E2809320081092490892E390932108D2
:1025B00086E98093220885E080932308909324087D
:1025C0002AE5209325089093260810924808209326
:1025D000270883E4809328088CE38093290885E505
:1025E00080932A0880932B0830932C0830932D0871
:1025F0009BE490932E088FE58093330883EF8093BC
:10260000350884E180933408809336088DEF8093F9
:102610003708409338082093390820933A082093CC
:102620003B0890933C0890933D0890933E0810928D
:102630003F087093400860934108209342085093EC
:102640004308409344084093450884E0809346083B
:10265000A2E4B3E0EEE4F8E00D9001921A95E1F700
:102660001F91089588EE809305083EE13093060897
:102670008BEF809308088AE080930908309307085D
:1026800030930B0893E090930A0858E050930C089D
:1026900020E120930D0866E060930E0850930F0828
:1026A00086EE809310083093110880E8809312081A
:1026B00044E64093130888E7809314089093150824
:1026C0008EE58093160883E28093170884E1809357
:1026D00018081092190820931A0810921B081092DB
:1026E0001C0810921D0810921E0810922F081092BC
:1026F0003008109231081092320840931F0888E287
:10270000809320081092490892E39093210886E96B
:102710008093220885E080932308909324082AE57B
:1027200020932508909326081092480820932708A4
:1027300083E48093280886E48093290885E58093C4
:102740002A0880932B0880E280932C0880932D0820
:1027500090932E088FE58093330883EF809335089C
:1027600030933408309336088DEF809337084093C8
:1027700038082093390820933A0820933B088BE4CB
:1027800080933C0880933D0880933E0810923F0858
:1027900060934008509341082093420830934308C7
:1027A000409344084093450884E0809346088CE0B9
:1027B000AAE4B3E0EEE4F8E00D9001928A95E1F727
:1027C00008956817790744F4680F791F77FD09C0E9
:1027D000CB01959587950895681B790B861B970B00
:1027E00008956F5F7F4FCB019595879508950F935F
:1027F0001F93CF93C82FC150CF3F81F004E610E064
:1028000080913704882351F41093290500932805FB
:102810008AEF90E00E948053C15090F7CF911F91B2
:102820000F9108952F923F924F925F926F927F92F5
:102830008F929F92AF92BF92CF92DF92EF92FF92D0
:102840000F931F93CF93DF93CDB7DEB7ED970FB6FE
:10285000F894DEBF0FBECDBF2091A2043091A30437
:102860008091F8039091F903281B390B3A87298747
:102870003093B9082093B8082091020430910304E2
:1028800037FDD4C7359527953595279535952795E7
:102890003AA729A73C872B87790120910004309122
:1028A000010437FDC0C73595279535952795359592
:1028B00027953CA72BA73E872D87F0927908E092B9
:1028C000780830936F0820936E088091A708909144
:1028D000A808AA2797FDA095BA2F7C018D01EE0CC0
:1028E000FF1C001F111FE80EF91E0A1F1B1F8091FD
:1028F000F4039091F5039C01442737FD4095542F34
:10290000DA01C901880F991FAA1FBB1F880F991FE1
:10291000AA1FBB1F820F931FA41FB51F820F931FF7
:10292000A41FB51FE80EF91E0A1F1B1F17FD9CC729
:1029300015950795F794E79415950795F794E794FF
:10294000F092A808E092A7088091C3089091C4086B
:10295000AA2797FDA095BA2F7C018D01EE0CFF1CD4
:10296000001F111FE80EF91E0A1F1B1F8091F6039E
:102970009091F7039C01442737FD4095542FDA01CD
:10298000C901880F991FAA1FBB1F880F991FAA1F73
:10299000BB1F820F931FA41FB51F820F931FA41F7D
:1029A000B51FE80EF91E0A1F1B1F17FD54C715950A
:1029B0000795F794E79415950795F794E794F092A7
:1029C000C408E092C3088091760890917708AA27FE
:1029D00097FDA095BA2F9C01AD01220F331F441F14
:1029E000551F280F391F4A1F5B1F8091F2039091DA
:1029F000F303AA2797FDA095BA2F280F391F4A1F66
:102A00005B1F57FD16C755954795379527955595E3
:102A1000479537952795309377082093760820912E
:102A2000F4033091F503C901880F991F880F991F8E
:102A3000820F931F820F931FAA2797FDA095BA2F8D
:102A400020917E0430917F04409180045091810454
:102A5000820F931FA41FB51F80937E0490937F0461
:102A6000A0938004B09381042091F6033091F70382
:102A7000C901880F991F880F991F820F931F820F1A
:102A8000931FAA2797FDA095BA2F20917A04309121
:102A90007B0440917C0450917D04820F931FA41FFE
:102AA000B51F80937A0490937B04A0937C04B09329
:102AB0007D0480918108909182082091F4033091E7
:102AC000F503820F931F9093820880938108809171
:102AD000BB089091BC082091F6033091F703820F58
:102AE000931F9093BC088093BB08809198049091A9
:102AF00099040196909399048093980480917604A8
:102B000090917704A0917804B0917904BC01CD0133
:102B10000E9444605B016C018091E7079091E80797
:102B2000AA2797FDA095BA2FBC01CD010E94446051
:102B30007B018C018091940490919504A09196045E
:102B4000B09197049C01AD01C801B7010E94E45FF8
:102B5000DC01CB019C01AD01C601B5010E94E55F1E
:102B6000DC01CB01BC01CD010E942760DC01CB015F
:102B70008093760490937704A0937804B0937904BB
:102B80008FEC80937A0010920603209066043090B8
:102B90006704409068045090690439E423163BE6CA
:102BA000330631E0430630E053060CF414C188E4E8
:102BB0009BE6A1E0B0E08D839E83AF83B8876090F1
:102BC0006E0470906F04809070049090710439E4EA
:102BD00063163BE6730631E0830630E093060CF49F
:102BE000DCC488E49BE6A1E0B0E089839A83AB83F0
:102BF000BC8349855A85CA01AA2797FDA095BA2F9B
:102C000020915E0430915F04409160045091610412
:102C1000280F391F4A1F5B1F2DA33EA34FA358A7A0
:102C2000A090BF08B090C008C090C108D090C20862
:102C3000A80EB91ECA1EDB1E8601750130912E0436
:102C40003BA3332309F0DAC080912D04882309F0D7
:102C5000C2C4409105084CA346FF13C6EBA5FCA5D2
:102C6000CF01AA2797FDA095BA2FBC01CD012981DC
:102C70003A814B815C810E94DC609B01AC0197FD35
:102C80002CC7BBE05595479537952795BA95D1F751
:102C900080911F03E82EFF2400271127C801B701E8
:102CA0000E94DC6097FD14C7ACE0959587957795F9
:102CB0006795AA95D1F76F87788B898B9A8B6093EC
:102CC000B0047093B1048093B2049093B30429A527
:102CD0003AA5C901AA2797FDA095BA2FBC01CD013D
:102CE0002D813E814F8158850E94DC609B01AC01A3
:102CF00097FD01C7FBE05595479537952795FA95C0
:102D0000D1F7C801B7010E94DC6097FDEFC6DC0176
:102D1000CB01ECE0B595A79597958795EA95D1F706
:102D20008093B4049093B504A093B604B093B70411
:102D30002091B0043091B1043093F8072093F70745
:102D40002091B4043091B5043093FC072093FB0725
:102D50002F85388949895A89821B930BA40BB50B9F
:102D60008AAF9BAFACAFBDAF8093B4049093B50472
:102D7000A093B604B093B704A80EB91ECA1EDB1EFA
:102D80008601750130911E033DA7332309F0A3C5C9
:102D90008EA79FA7A8ABB9ABB7FD61C62EA53FA56F
:102DA00048A959A955954795379527958DA19EA175
:102DB000AFA1B8A5821B930BA40BB50B8DA39EA34B
:102DC000AFA3B8A780935E0490935F04A0936004C0
:102DD000B09361048CC598EB291694E939069EEFEF
:102DE00049069FEF59060CF0F1C328EB34E94EEF8A
:102DF0005FEF2D833E834F835887E1CE2DA13EA107
:102E00004FA158A520935E0430935F044093600463
:102E100050936104309105083CA31092FC07109276
:102E2000FB071092F8071092F7071092AC0410926B
:102E3000AD041092AE041092AF041092A804109248
:102E4000A9041092AA041092AB0430911E033DA76E
:102E50008091AC049091AD04A091AE04B091AF0408
:102E6000BC01CD0124E630E040E050E00E9450611A
:102E7000DA01C9014091A8045091A904481B590BDB
:102E800058A34F8F8091A8049091A904A091AA04FF
:102E9000B091AB04BC01CD0124E630E040E050E04D
:102EA0000E945061DA01C9012091AC043091AD0457
:102EB000821B930B9AA389A3809117039091180307
:102EC000A0911903B0911A03BC01CD0128E631E0AD
:102ED00040E050E00E94DC60E616F706080719079C
:102EE00044F057016801A61AB70AC80AD90A860130
:102EF000750117FDA3C4A092BF08B092C008C0928C
:102F0000C108D092C2082BA53CA58F8D98A1280F8F
:102F1000391F79010027F7FC0095102F809162047A
:102F200090916304A0916404B0916504E80EF91EC9
:102F30000A1F1B1F570168018091310490913204D0
:102F4000281B390BC901AA2797FDA095BA2F280E77
:102F5000391E4A1E5B1E20912F0330913003409191
:102F6000310350913203221533054405550574F49D
:102F7000A8EAEA2EA1E6FA2E012D112DE21AF30A93
:102F8000040B150B170128015701680188279927A1
:102F9000DC01821B930BA40BB50B281639064A06DD
:102FA0005B060CF0E9C2F8E52F2EFEE93F2EFFEF9D
:102FB0004F2EFFEF5F2E220E331E441E551E209211
:102FC000660430926704409268045092690482015A
:102FD0007101209262043092630440926404509222
:102FE000650429A53AA5A9A1BAA12A0F3B1FA901E9
:102FF000662757FD6095762F80916A0490916B0447
:10300000A0916C04B0916D04480F591F6A1F7B1F7B
:103010005A016B0180912F0490913004281B390BC9
:10302000C901AA2797FDA095BA2F680E791E8A1E9E
:103030009B1E8091330390913403A0913503B0918E
:1030400036038EAB9FABA8AFB9AF86159705A80521
:10305000B90564F448EA51E660E070E0481B590B9A
:103060006A0B7B0B3A014B015A016B018EA99FA998
:10307000A8ADB9ADB095A095909581959F4FAF4FF4
:10308000BF4F681679068A069B060CF064C2E8E515
:103090006E2EEEE97E2EEFEF8E2EEFEF9E2E2EA9F6
:1030A0003FA948AD59AD620E731E841E951E6092F5
:1030B0006E0470926F048092700490927104B40157
:1030C000A30160926A0470926B0480926C049092E7
:1030D0006D048DA19EA1AFA1B8A5809372049093B9
:1030E0007304A0937404B093750460928E0470927C
:1030F0008F048092900490929104209286043092E2
:103100008704409288045092890440938A04509323
:103110008B0460938C0470938D04E0928204F0928F
:10312000830400938404109385048091120390918A
:10313000130397FDA4C37C01F594E794F594E794F9
:10314000F594E794FAA6E9A68091100390911103F3
:1031500097FD93C38C0115950795159507951595C2
:1031600007951CA70BA78091FC039091FD030F9777
:1031700034F458E1E52E5CEFF52EFAA6E9A680912D
:10318000FC039091FD03079734F440E3E42E48EFED
:10319000F42EFAA6E9A6209156032A3009F46BC250
:1031A0008091FC039091FD03815D97400CF007C274
:1031B0008091FC039091FD03805E974034F080ED98
:1031C000E82E87E0F82EFAA6E9A68091FA039091FE
:1031D000FB030F9724F408E11CEF1CA70BA78091B9
:1031E000FA039091FB03079724F400E318EF1CA760
:1031F0000BA72A3009F455C28091FA039091FB0382
:10320000815D974024F008EE13E01CA70BA7809186
:10321000FA039091FB03805E974024F000ED17E0E5
:103220001CA70BA7A0912703AA2309F497C06091BC
:103230001203709113038091B8049091B904681B34
:10324000790B2091120330911303280F391F37FD9A
:103250003FC3359527953093B9042093B80461385E
:1032600071050CF43AC260E870E07093BF0460939B
:10327000BE048A2F9927869FF001879FF00D969FA5
:10328000F00D1124CF01F7FD21C37C01F594E794E3
:10329000F594E794F594E794F594E79429A53AA575
:1032A000E20EF31EFAA6E9A6409110035091110315
:1032B0008091BA049091BB04481B590B20911003D4
:1032C00030911103280F391F37FDFDC23595279521
:1032D0003093BB042093BA04413851050CF4F5C176
:1032E00040E850E05093BD044093BC048A2F9927D6
:1032F000849FD001859FB00D949FB00D1124AD0126
:103300009D01B7FDDDC289011595079515950795B6
:103310001595079515950795EBA5FCA50E0F1F1F95
:103320001CA70BA7869F9001879F300D969F300D9D
:103330001124C9012091120330911303820F931FAE
:1033400090931303809312038091100390911103C3
:10335000480F591F50931103409310034D855E850C
:10336000141615060CF0C1C18091F7079091F8076B
:1033700097FDA2C2AA2797FDA095BA2F6DA5262F6B
:10338000332744275527BC01CD010E94DC6097FDFF
:103390008EC2E6E09595879577956795EA95D1F782
:1033A000AF8DB8A1A60FB71FB0936A08A0936908A4
:1033B0004B855C85141615060CF0C1C18091FB0786
:1033C0009091FC0797FD6FC2AA2797FDA095BA2F91
:1033D0006DA5262F332744275527BC01CD010E9418
:1033E000DC6097FD5BC246E095958795779567957C
:1033F0004A95D1F7A9A1BAA1A60FB71FB0935F084C
:10340000A0935E083CA137FDC1C110935D080093F5
:103410005C08F0926C08E0926B0880910108E82F3C
:10342000FF27EE0FFF1FE653F74F808191818259EE
:103430009F4FA0914704B0914804A817B9070CF01A
:10344000EEC0CD0101969093480480934704DC01BF
:1034500080910208E82FFF27EE0FFF1FE653F74F7A
:103460008081918182599F4F6091450470914604FB
:10347000681779070CF0C4C0CB01019690934604FD
:1034800080934504BC0180910308E82FFF27EE0FCD
:10349000FF1FE653F74F8081918182599F4F4091E2
:1034A000430450914404481759070CF0D5C0CA0191
:1034B00001969093440480934304AC0180910408E6
:1034C000E82FFF27EE0FFF1FE653F74F8081918112
:1034D00082599F4F209141043091420428173907A7
:1034E0000CF0ABC0C9010196909342048093410453
:1034F0009C01B7FD93C1AF3FB10539F034F08FEFB8
:1035000090E0909348048093470477FD76C16F3F25
:10351000710539F034F08FEF90E09093460480937A
:10352000450457FD70C14F3F510539F034F08FEF1E
:1035300090E0909344048093430437FD6AC12F3F89
:10354000310509F00CF4EEC28FEF90E09093420445
:1035500080934104E7C260926E0470926F0480927F
:10356000700490927104A0926A04B0926B04C092AD
:103570006C04D0926D04ADCD209266043092670445
:103580004092680450926904A0926204B09263046D
:10359000C0926404D092650424CD98EB691694E936
:1035A00079069EEF89069FEF99062CF528EB34E902
:1035B0004EEF5FEF29833A834B835C831ACB98EEFF
:1035C000E92E93E0F92EFAA6E9A6F2CD2D823E82ED
:1035D0004F825886F4CA8DA19EA1AFA1B8A5809351
:1035E0005E0490935F04A0936004B0936104909193
:1035F00005089CA312CC69827A828B829C82F9CACC
:103600008081918182599F4F861797070CF03BCF9D
:103610006115710509F437CFCB0101972FCF808158
:10362000918182599F4F8A179B070CF011CF1097F9
:1036300009F40ECFCD01019706CF80819181825987
:103640009F4F821793070CF054CF2115310509F4D1
:1036500050CFC901019748CF8081918182599F4FF6
:10366000841795070CF02ACF4115510509F426CF90
:10367000CA0101971ECF8091FC039091FD03835FE7
:10368000934034F038EEE32E33E0F32EFAA6E9A6A9
:103690008091FC039091FD038A5F93400CF495CDDB
:1036A0008ECD8091FA039091FB03835F934024F0C9
:1036B00008EE13E01CA70BA78091FA039091FB037F
:1036C0008A5F93400CF4AECDA9CD3FEF403853074D
:1036D0000CF008CE40E85FEF05CE8FEF603878073A
:1036E0000CF0C3CD60E87FEFC0CD8091F7079091DB
:1036F000F80797FD9BC1AA2797FDA095BA2FEDA5C6
:103700002E2F332744275527BC01CD010E94DC60B2
:1037100097FDADC156E095958795779567955A9534
:10372000D1F72F8D38A1261B370B30936A082093D1
:1037300069084B855C85141615060CF43FCE809104
:10374000FB079091FC0797FD6DC1AA2797FDA095F7
:10375000BA2FEDA52E2F332744275527BC01CD01C5
:103760000E94DC6097FD88C136E095958795779536
:1037700067953A95D1F729A13AA1261B370B3093CB
:103780005F0820935E083CA137FF3FCE4BA1442346
:1037900009F03BCE80912D04882309F036CE8B852D
:1037A0009C85A1E081309A070CF044C12B853C85B3
:1037B0004FEF203034070CF0A3C189A59AA5280F3C
:1037C000391F3C872B8720503F4F30936C08209344
:1037D0006B08AD85BE85E1E0A130BE070CF465C184
:1037E0002BA53CA5A20FB31FBE87AD87A050B1404B
:1037F000B0935D08A0935C0810CE1092460410921E
:10380000450457FF90CE109244041092430437FFB2
:1038100096CE109242041092410484C11092480442
:103820001092470472CE295F3F4F3DC8295F3F4F3A
:1038300029C82D5F3F4F4F4F5F4FE5C8E60EF71E7B
:10384000081F191FE092BF08F092C0080093C1083A
:103850001093C20858CB23E030E040E050E0E20E85
:10386000F31E041F151FA3C883E090E0A0E0B0E0A2
:10387000E80EF91E0A1F1B1F5BC807966BCC079644
:103880005ACC2DA13EA14FA158A520935E043093A0
:103890005F044093600450936104BFCA615C7F4F32
:1038A0008F4F9F4FA0CD909581959F4F8DCD615C9F
:1038B0007F4F8F4F9F4F6DCD909581959F4F5ACDE4
:1038C000215F3F4F20CD2F5F3F4F00CD0F96DDCCC6
:1038D0002F5F3F4FBECC2DA13EA14FA158A52093F5
:1038E0005E0430935F0440936004509361048985C3
:1038F0009A85AA2797FDA095BA2F2AAD3BAD4CAD6E
:103900005DAD820F931FA41FB51F8B8B9C8BAD8B5E
:10391000BE8BBC01CD0129813A814B815C810E9423
:10392000DC609B01AC0197FDBBC06BE055954795F2
:10393000379527956A95D1F760912003862F9927AF
:10394000AA27BB278F8B988FA98FBA8FBC01CD0177
:103950000E94DC6097FD9FC02CE095958795779538
:1039600067952A95D1F76B8F7C8F8D8F9E8F609393
:10397000A8047093A9048093AA049093AB046B8964
:103980007C898D899E892D813E814F8158850E9439
:10399000DC609B01AC0197FD79C08BE055954795A4
:1039A000379527958A95D1F76F89788D898D9A8D6E
:1039B0000E94DC6097FD65C0BCE095958795779582
:1039C0006795BA95D1F76AAB7BAB8CAB9DAB609337
:1039D000AC047093AD048093AE049093AF0429853A
:1039E0003A8537FD7FC0213431050CF431CA6B8D27
:1039F0007C8D8D8D9E8D97FD2AC061387105810566
:103A0000910564F46AA97BA98CA99DA997FD82C040
:103A100061387105810591050CF41ACA81E0809323
:103A20004B0416CA909581959F4F8FCE90958195A6
:103A30009F4F61CEE9A5FAA58E0F9F1F9C878B87AC
:103A40008050914090936C0880936B08C2CE909503
:103A50008095709561957F4F8F4F9F4FCECF019688
:103A6000A11DB11D8EA79FA7A8ABB9AB97C9615C7B
:103A70007F4F8F4F9F4F4ECE615C7F4F8F4F9F4F39
:103A800073CE6150704F8F4F9F4F96CF2150384F5C
:103A90004F4F5F4F82CF6150704F8F4F9F4F5CCF22
:103AA0002150384F4F4F5F4F40CF4D855E856FEFB0
:103AB0004030560754F58BA59CA5480F591F5E87CB
:103AC0004D8740505F4F50935D0840935C08A5CCF4
:103AD0006150704F8F4F9F4FE7C82150384F4F4F65
:103AE0005F4FCFC8309521953F4F7DCF6150704FCC
:103AF0008F4F9F4F0CC92150384F4F4F5F4FFAC81F
:103B0000F0926C08E0926B0864CE10935D0800930D
:103B10005C0883CC90958095709561957F4F8F4F11
:103B20009F4F76CFED960FB6F894DEBF0FBECDBF98
:103B3000DF91CF911F910F91FF90EF90DF90CF9089
:103B4000BF90AF909F908F907F906F905F904F90BD
:103B50003F902F900895809156038D3009F455C100
:103B600010927A008091FC039091FD0390936C0871
:103B700080936B088091FA039091FB0390935D080A
:103B800080935C088091F8039091F9039093B908B1
:103B90008093B8088091F4039091F5039C01442729
:103BA00037FD4095542FDA01C901880F991FAA1FCC
:103BB000BB1F880F991FAA1FBB1F820F931FA41F33
:103BC000B51F820F931FA41FB51F9093A808809361
:103BD000A7088091F6039091F7039C01442737FDD5
:103BE0004095542FDA01C901880F991FAA1FBB1FE6
:103BF000880F991FAA1FBB1F820F931FA41FB51FF9
:103C0000820F931FA41FB51F9093C4088093C3080D
:103C10008091F2039091F303909377088093760854
:103C20008FEC80937A0080910108E82FFF27EE0F38
:103C3000FF1FE653F74F8081918182599F4FA091DA
:103C40004704B0914804A817B9070CF085C0CD010E
:103C500001969093480480934704DC018091020808
:103C6000E82FFF27EE0FFF1FE653F74F808191816A
:103C700082599F4F609145047091460468177907F7
:103C80000CF096C0CB0101969093460480934504B6
:103C9000BC0180910308E82FFF27EE0FFF1FE653BA
:103CA000F74F8081918182599F4F409143045091F9
:103CB0004404481759070CF06CC0CA010196909350
:103CC000440480934304AC0180910408E82FFF274B
:103CD000EE0FFF1FE653F74F8081918182599F4F6E
:103CE0002091410430914204281739070CF042C05A
:103CF000C901019690934204809341049C01B7FD51
:103D00007FC0AF3FB10511F00CF061C077FD67C017
:103D10006F3F710539F034F08FEF90E090934604D7
:103D20008093450457FD61C04F3F510539F034F091
:103D30008FEF90E0909344048093430437FD5BC081
:103D40002F3F310509F00CF463C08FEF90E09093A2
:103D50004204809341045CC08081918182599F4FCD
:103D60008A179B070CF07ACF109709F477CFCD0113
:103D700001976FCF8081918182599F4F821793075E
:103D80000CF0BDCF2115310509F4B9CFC901019758
:103D9000B1CF8081918182599F4F841795070CF094
:103DA00093CF4115510509F48FCFCA01019787CFF1
:103DB0008081918182599F4F861797070CF069CFB8
:103DC0006115710509F465CFCB0101975DCF8FEFC8
:103DD00090E0909348048093470477FF99CF109226
:103DE00046041092450457FF9FCF1092440410924E
:103DF000430437FFA5CF109242041092410408C03B
:103E0000109248041092470481CF0E94960CA8CECD
:103E100080912A089927AA27BB27BC01CD0124EC51
:103E200039E040E050E00E94DC60DC01CB0180938F
:103E3000330390933403A0933503B09336038091FA
:103E40002B089927AA27BB27BC01CD010E94DC6063
:103E5000DC01CB0180932F0390933003A0933103B7
:103E6000B093320308956F927F928F929F92AF9298
:103E7000BF92CF92DF92EF92FF920F931F93CF9357
:103E8000DF93C0E0D0E07E016E0110922605469AD5
:103E9000D0939D04C0939C04D0939B04C0939A0438
:103EA00080E090E0A0E0B0E08093940490939504CB
:103EB000A0939604B0939704D093A704C093A6044C
:103EC000D093A504C093A404D093A304C093A204E8
:103ED000D0938908C09388081092200310921F0382
:103EE0001092F0030E94AB1D84E690E00E948D5377
:103EF0000E94AB1D8091050880FF10C080910A03CD
:103F000090910B03875B934008F07BC080910A037C
:103F100090910B038E5E924008F473C01FE18AE01B
:103F200090E00E948D538091F8039091F903C80F9F
:103F3000D91F8091FC039091FD03E80EF91E80913A
:103F4000FA039091FB03C80ED91E115017FFE7CF5B
:103F5000A701405F5F4F56954795569547955093FB
:103F6000A7044093A6049601205F3F4F36952795FE
:103F7000369527953093A5042093A404CE0140964E
:103F800096958795929582958F7089279F7089273E
:103F90009093A3048093A204909389088093880847
:103FA0003093A1042093A00450939F0440939E0457
:103FB00044E050E0DA010E94BB60802D853020F1A2
:103FC0008091C3089091C40897FD53C06CE070E0E5
:103FD0000E941B6170939B0460939A048091A708D0
:103FE0009091A80897FD56C06CE070E00E941B619C
:103FF00070939D0460939C048091E7079091E8077B
:104000004DC00E94440C8ACFDA010E94BB60802D13
:104010009927982F8827DA0111960E94BB60202DDE
:10402000820F911D90939D0480939C04DA01129657
:104030000E94BB60802D9927982F8827DA0113965C
:104040000E94BB60202D820F911D90939B04809352
:104050009A04DA0114960E94BB60802D9927982F4C
:104060008827DA0115960E94BB60202D820F911DD2
:1040700015C0909581959F4F6CE070E00E941B6188
:1040800070939B0460939A048091A7089091A8086C
:1040900097FFAACF909581959F4FA6CFAA2797FD0E
:1040A000A095BA2FBC01CD010E944460DC01CB0178
:1040B0008093940490939504A0939604B0939704EE
:1040C00010926C0810926B0810925D0810925C08B8
:1040D0001092B9081092B80884E690E00E948D53BF
:1040E0008091F4039091F503AA2797FDA095BA2F2C
:1040F0009C01AD01220F331F441F551F220F331F98
:10410000441F551F280F391F4A1F5B1F280F391FD7
:104110004A1F5B1F3093A8082093A7088091F603DD
:104120009091F703AA2797FDA095BA2F7C018D01E6
:10413000EE0CFF1C001F111FEE0CFF1C001F111FB7
:10414000E80EF91E0A1F1B1FE80EF91E0A1F1B1F8F
:10415000F092C408E092C30880911108682E772479
:1041600088249924C9019C01442737FD4095542F88
:10417000C401B3010E94DC605B016C0160938E049A
:1041800070938F0480939004909391049701442737
:1041900037FD4095542FC401B3010E94DC60DC015F
:1041A000CB018093860490938704A0938804B093F6
:1041B0008904A0926A04B0926B04C0926C04D092FD
:1041C0006D048093620490936304A0936404B0939D
:1041D000650410925E0410925F04109260041092C5
:1041E000610480910C0390910D03A0910E03B09196
:1041F0000F039093EA078093E9071092EF03109260
:10420000EE03109256041092570410925804109224
:1042100059048091540490915504909353048093D1
:10422000520490935104809350040E94734182E39E
:1042300090E0909329058093280580912A0899277A
:10424000AA27BB27BC01CD0124EC39E040E050E0B7
:104250000E94DC60DC01CB018856954CAF4FBF4F0C
:104260008093330390933403A0933503B0933603C4
:1042700080912B089927AA27BB27BC01CD010E945A
:10428000DC60DC01CB018856954CAF4FBF4F80936B
:104290002F0390933003A0933103B0933203109215
:1042A0001C0310921B038091540490915504AA277B
:1042B00097FDA095BA2F20911703309118034091D4
:1042C000190350911A03BC01CD010E94DC60DC018E
:1042D000CB018093BF089093C008A093C108B0930E
:1042E000C20810924A041092490411E01093550339
:1042F0000E940B59809114048460809314048FEF02
:1043000080938D0910928E0980E280938F098091AD
:104310000108E82FFF27EE0FFF1FE653F74F8081BC
:10432000918182599F4F90934804809347048091D4
:104330000208E82FFF27EE0FFF1FE653F74F80819B
:10434000918182599F4F90934604809345048091B8
:104350000308E82FFF27EE0FFF1FE653F74F80817A
:10436000918182599F4F909344048093430480919C
:104370000408E82FFF27EE0FFF1FE653F74F808159
:10438000918182599F4F90934204809341041093EE
:10439000260584E680934004DF91CF911F910F9111
:1043A000FF90EF90DF90CF90BF90AF909F908F9055
:1043B0007F906F90089590913704992381F58091B3
:1043C00014048C7F8093140410C0A92FBB27FD0117
:1043D000E656F94F8083FD01E656F94F8081A655D8
:1043E000B74F8C939F5F9C3080F48091D0038823DB
:1043F00061F3A92FBB27FD01E656F94F8081A65531
:10440000B74F8C939F5F9C3080F38091D0038823BB
:1044100059F08091D00381508093D00305C08091E2
:1044200014048160809314048091AA0899279093C2
:10443000BD078093BC078091AB0899279093BF0775
:104440008093BE078091AD0899279093C107809310
:10445000C0078091AC0899279093C3078093C20747
:1044600010923B0510923A050E94A0570895809142
:1044700008088B3F68F08B3F09F45BC28C3F09F45E
:10448000F1C28D3F09F4B2C28E3F21F48091410404
:1044900080932B03809107088B3F08F4EDC18B3F7D
:1044A00009F4E8C18C3F09F4FBC28D3F09F47DC2D9
:1044B0008E3F09F404C380912C03882309F0E1C1E5
:1044C00080932C03809109088B3F08F4E1C18B3F56
:1044D00009F4DCC18C3F09F4DDC28D3F09F468C2E8
:1044E0008E3F09F4E9C280912A03882309F0D5C1DF
:1044F00080932A0380910B088B3F68F08B3F09F46F
:1045000024C28C3F09F4C9C28D3F09F44BC28E3FCF
:1045100021F48091410480932903809112088B3FFC
:1045200068F08B3F09F402C28C3F09F483C28D3FCF
:1045300009F435C28E3F21F4809141048093280311
:10454000809113088B3F08F4AFC18B3F09F4AAC1D7
:104550008C3F09F4AEC28D3F09F433C28E3F09F49B
:10456000B7C2809126038B3008F4A3C18F3F11F4AA
:1045700080932603809114088B3F68F08B3F09F4E9
:10458000DBC18C3F09F47DC28D3F09F417C28E3F19
:1045900021F48091410480932503809115088B3F7D
:1045A00068F08B3F09F4CBC18C3F09F467C28D3FA3
:1045B00009F4F2C18E3F21F48091410480932703D6
:1045C00020911A082B3F08F478C12B3F09F473C1DE
:1045D0002C3F09F444C22D3F09F4EDC12E3F09F4EC
:1045E0007AC22091230380911B088B3F08F06CC195
:1045F0008093280480911C088B3F68F08B3F09F45E
:10460000B3C18C3F09F428C28D3F09F4E9C18E3F44
:1046100021F4809141048093270480911D088B3FF1
:1046200068F08B3F09F4A3C18C3F09F412C28D3F9F
:1046300009F4E5C18E3F21F4809141048093260462
:1046400080911E088B3F68F08B3F09F45DC18C3F61
:1046500009F4E4C18D3F09F4DBC18E3F21F4809160
:1046600041048093250480912F088B3F68F08B3F95
:1046700009F44DC18C3F09F4D4C18D3F09F4CBC17D
:104680008E3F21F48091410480932404809130086E
:104690008B3F68F08B3F09F43DC18C3F09F4C4C1E6
:1046A0008D3F09F4AFC18E3F21F480914104809386
:1046B0002304809131088B3F68F08B3F09F42DC1B2
:1046C0008C3F09F4B4C18D3F09F49FC18E3F21F4A2
:1046D0008091410480932204809132088B3F68F0DE
:1046E0008B3F09F41DC18C3F09F4BFC18D3F09F414
:1046F00080C18E3F21F480914104809321048091F8
:104700001F088B3F68F08B3F09F40DC18C3F09F403
:104710009DC18D3F09F470C18E3F21F48091410409
:1047200080932203809124088B3F68F08B3F09F42B
:1047300021C18C3F09F4ABC18D3F09F424C18E3FE8
:1047400021F48091410480932103809127088B3FBD
:1047500068F08B3F09F411C18C3F09F489C18D3F8A
:1047600009F414C18E3F21F4809141048093200309
:10477000809128088B3F68F08B3F09F4E9C08C3F9B
:1047800009F45EC18D3F09F425C18E3F21F480916B
:10479000410480931F03809129088B3F68F08B3F71
:1047A00009F4D9C08C3F09F44EC18D3F09F415C1FD
:1047B0008E3F21F48091410480931E0380912E0846
:1047C0008B3F68F08B3F09F4C9C08C3F09F46BC183
:1047D0008D3F09F4F9C08E3F21F48091410480930C
:1047E0001D03809134088B3F08F47EC08B3F09F491
:1047F00079C08C3F09F45AC18D3F09F4E8C08E3F5F
:1048000009F460C180918308823008F472C08F3F40
:1048100011F480938308809136088B3F08F46DC0B3
:104820008B3F09F468C08C3F09F425C18D3F09F422
:10483000B0C08E3F09F449C18091B608823008F4B7
:1048400061C08F3F11F48093B608809147088B3F79
:1048500070F08B3F09F485C08C3F09F415C18D3F82
:1048600009F48EC08E3F09F039C1809141048093D4
:10487000C60834C18091470480932C03882309F42F
:104880001FCE843608F41ECE84E61ACE80914704EB
:1048900080932A03882309F42BCE843608F42ACE89
:1048A00084E626CE80914704809326038B3008F05F
:1048B0005DCE8AE05DCE2091470420932303809152
:1048C0001B088B3F08F494CE8B3FE1F18C3F09F439
:1048D000B4C08D3F09F487C08E3F09F08BCE809124
:1048E000410486CE8091470480938308823008F08B
:1048F0008ECF81E08ECF809147048093B6088230BE
:1049000008F09FCF81E09FCF80914704AACE80918D
:104910004704BACE80914704CACE80914704DACECC
:1049200080914704EACE80914704FACE80914704F3
:1049300005CE80914704ACCD809147042CCE809168
:1049400047043CCE8091470453CE80914704E3CD89
:10495000809147041ECF809147042ECF8091470459
:104960003ECF8091470483CF8091470454CE8091FD
:10497000470464CE80914704E6CE80914704F6CE8A
:104980008091430474CF80914304DDCE8091430431
:10499000EDCE80914304B1CF809143040FCE80913E
:1049A0004304CCCD80914304B6CD8091430464CFC1
:1049B000809143046DCF209143047FCF80914304C5
:1049C000EACD8091430470CF8091430408CF809159
:1049D00043048ACF80914304DCCE80914304ECCE23
:1049E0008091430418CE8091430402CE8091430409
:1049F0004FCD8091430481CE8091430491CE80912C
:104A000043041CCE8091430452CE8091430462CE75
:104A10008091430426CE8091430436CE8091450494
:104A200020CE8091450430CE8091450440CE8091C7
:104A3000450450CE8091450481CD80914504D8CD68
:104A400080914504A6CE80914504B6CE8091450460
:104A500067CE80914504F2CD80914504DCCD209154
:104A600045042BCF8091450413CD8091450445CE5C
:104A7000809145047BCE809145043FCF80914504D1
:104A80009DCD8091450487CD80914504F0CE8091E5
:104A9000450459CE80914504FBCE809145043BCD21
:104AA00080914504E9CE8091450499CE80914504DA
:104AB0001BCF80914504F8CE80914104E9CE8091CE
:104AC0004104DACE809141040FCF8091410415CF8B
:104AD00080914104E9CE20914104EFCE33272F5F2E
:104AE0003F4F8CE398E2B9010E941B6170932E0343
:104AF00060932D03809110088093B70880910F0870
:104B00008093700808952F923F924F925F926F9218
:104B10007F928F929F92AF92BF92CF92DF92EF924D
:104B2000FF920F931F93CF93DF93CDB7DEB7CD5492
:104B3000D0400FB6F894DEBF0FBECDBF0E94121456
:104B4000209156032C3008F0F8C1299AA09038041F
:104B5000B0903904BA82A9828091700899270A9688
:104B6000A816B90614F49A83898380914004843688
:104B700008F0E5C180910303882309F4D4C3809130
:104B8000DC049091DD04009711F40C942633019716
:104B90009093DD048093DC042A3011F40C942E33BE
:104BA000243111F40C942E3328988091150490919F
:104BB0001604895E934010F40C94223380911708F8
:104BC000282F33273A83298381E080934D048091F5
:104BD000FD07A82FBB27AA0FBB1FFD01E052F74F0F
:104BE000118210828091FE07282F3327220F331F56
:104BF000C9018052974FFC0111821082A653B74F12
:104C000011961C921E922653374FD90111961C9271
:104C10001E9280910008E82FFF27EE0FFF1FE6533A
:104C2000F74F118210828091BB0381508093BB03A8
:104C30008091BB038F3F31F0F0914D04FDABFF231A
:104C400009F486C30E94372280910C08A82EBB2449
:104C5000BC86AB8680910D08282E332480912104D8
:104C6000882311F40C94B130813810F00C94313356
:104C70008091BF089091C008A091C108B091C2086E
:104C800020911703309118034091190350911A0392
:104C9000BC01CD010E945061890180915004909126
:104CA0005104801B910B88599E4F68E671E00E9469
:104CB0001B618C010E94CF5F6C01C8010E94825F62
:104CC0002C01662457FC6094762CB090FE07BAAE97
:104CD0008B2C9924880C991C84010653174F1E872E
:104CE0000D87D8018D919C919C01442737FD4095FB
:104CF000542FC301B2010E94DC6097FF02C00C94E4
:104D00000C3E7B018C01FDE015950795F794E79427
:104D1000FA95D1F79601442737FD4095542F590154
:104D20006A013091FD073CA7432F5527440F551FBB
:104D30002A965FAF4EAF2A974653574F588B4F87EF
:104D4000DA018D919C919C01442737FD4095542FA9
:104D5000C601B5010E94DC6097FF02C00C94063EBC
:104D6000EDE09595879577956795EA95D1F7E60EED
:104D7000F71EFE82ED82ED85FE85808191819C018A
:104D8000442737FD4095542FC601B5010E94DC60D1
:104D900097FF02C00C94003E7B018C015DE01595ED
:104DA0000795F794E7945A95D1F7AF85B8898D9117
:104DB0009C919C01442737FD4095542FC301B201BB
:104DC0000E94DC6097FF02C00C94FA3D4DE095957F
:104DD0008795779567954A95D1F7E61AF70AFA8687
:104DE000E986E0EEF8E08E0E9F1ED4018D919C9135
:104DF0009C01442737FD4095542FC301B2010E9406
:104E0000DC6097FF02C00C94F43D7B018C013DE017
:104E100015950795F794E7943A95D1F72A96EEAD54
:104E2000FFAD2A97E052F74F2A96FFAFEEAF2A97D1
:104E3000808191819C01442737FD4095542FC60104
:104E4000B5010E94DC6097FF02C00C94EE3D2DE09E
:104E500095958795779567952A95D1F7E60EF71E74
:104E6000F886EF82D4018D919C919C01442737FDF7
:104E70004095542FC601B5010E94DC6097FF02C027
:104E80000C94E83D7B018C018DE015950795F79416
:104E9000E7948A95D1F72A96EEADFFAD2A978081E7
:104EA00091819C01442737FD4095542FC301B201E5
:104EB0000E94DC6097FF02C00C94E23D0DE09595E6
:104EC0008795779567950A95D1F7E61AF70AB7019E
:104ED000809121048F3F11F00C94DB30D0900008BA
:104EE000ED2DFF27EE0FFF1FE653F74F80819181D5
:104EF0000190F081E02DF7FF02C00C94AC3FE53645
:104F0000F10514F00C945A3EE333F10514F40C94BB
:104F1000A03FC10137FE02C00C94A6401C0135948D
:104F20002794359427941214130414F40C94DD3050
:104F3000F1E02F2E312C0C94DD30299807CE809192
:104F400040048D3808F46FCE10924D0490911808EB
:104F500082E3989FC00111249093DD048093DC04C8
:104F6000E981FA81B99714F00C94B6338091150455
:104F7000909116048F3F910519F010F00C94BD3CF0
:104F80001092C0041092C1041092C2041092C30483
:104F90001092C4041092C5041092C6041092C70463
:104FA0008A3F910511F40C94423F3091FF07E32FA3
:104FB000FF27EE0FFF1FE653F74F80819181813568
:104FC00091050CF4F7C040913704442309F0F2C076
:104FD00080910008E82FFF27EE0FFF1FE653F74FE1
:104FE000808191818C34910514F40C94A63E8091BB
:104FF000DE048F5F893C10F40C94B13F2C3010F02C
:105000000C9405402998109237041092DE041092F7
:10501000160410921504A090FD07ACA6AA2DBB277C
:10502000AA0FBB1FA653B74F8D919C918734910552
:1050300014F00C940040B090FE07BAAEAB2DBB2725
:10504000AA0FBB1FA653B74F8D919C911197ED915D
:10505000FC91F7FF02C00C94F140E734F1050CF429
:105060007BC021E0DAACAD2DBB27AA0FBB1FA65336
:10507000B74F8D919C9111978734910554F0ECA412
:105080004E2D5527440F551F4653574FFA01808127
:1050900091818D919C91873491056CF0FCA5AF2F87
:1050A000BB27AA0FBB1FA653B74F8D919C91873486
:1050B00091050CF022E0AAACAA2DBB27AA0FBB1FBA
:1050C000A653B74F8D919C91863491056CF4BCA486
:1050D000AB2DBB27AA0FBB1FA653B74F8D919C9139
:1050E000873491050CF023E0CAACAC2DBB27AA0F86
:1050F000BB1FA653B74F8D919C918A5B9F4F6CF459
:105100001CA5A12FBB27AA0FBB1FA653B74F8D917C
:105110009C91873491050CF024E03AADA32FBB2776
:10512000AA0FBB1FA653B74F8D919C918A5B9F4FCF
:105130006CF45CA5A52FBB27AA0FBB1FA653B74FC6
:105140008D919C91863491050CF425E0822F0E946C
:10515000BA416091FE076AAF7AADA72FBB27AA0FAD
:10516000BB1FA653B74F8D919C911197ED91FC9168
:10517000F7FF02C00C94AB407E9714F00C94E23F12
:105180008091FD07E82FFF27EE0FFF1FE653F74F33
:10519000808191818A5B9F4F14F00C94E23F81E003
:1051A0008093B00688EE93E09093290580932805BC
:1051B0003091FF07E32FFF27EE0FFF1FE653F74F56
:1051C000808191818B5A9F4F0CF02DCDD09000089B
:1051D000ED2DFF27EE0FFF1FE653F74F80819181E2
:1051E000855B9F4F14F00C949D3D8091DF048F5F91
:1051F000893C10F40C94313F88EC8093DF0481E00B
:1052000090E0909316048093150481E08093370416
:105210001092C8041092C9041092CA041092CB04D0
:1052200010925E0410925F04109260041092610468
:1052300010925A0410925B0410925C0410925D0468
:1052400080911108E82EFF24002711278091A708DC
:105250009091A8089C01442737FD4095542FC80120
:10526000B7010E94DC60DC01CB0180936E04909357
:105270006F04A0937004B09371048091C30890915F
:10528000C4089C01442737FD4095542FC801B7013D
:105290000E94DC60DC01CB0180936604909367047C
:1052A000A0936804B093690480918E0490918F0458
:1052B000A0919004B091910480936A0490936B0440
:1052C000A0936C04B0936D04809186049091870440
:1052D000A0918804B0918904809362049093630440
:1052E000A0936404B09365041092C0041092C104AA
:1052F0001092C2041092C3041092C4041092C50408
:105300001092C6041092C7048091140488608093A0
:105310001404809154049091550490935104809307
:1053200050040C949F3D8091BC039091BD038F5F0E
:105330009F4F09F024CC88E99AE390932905809344
:10534000280580E09CE09093BD038093BC0317CCBC
:10535000309105083BAF40912D044FA3442321F425
:1053600080912E04882369F080912408992769810F
:105370007A818617970714F49A83898381E0809352
:105380004B047DA9772309F4E8C610923B041092E0
:105390003A0410923F0410923E0410923D04109281
:1053A0003C049AE59093BD0888E780938A0890931F
:1053B000630888A780937A0810922D0410922E0417
:1053C0001FA220917D0830917E0840917F08509166
:1053D0008008A0908E04B0908F04C0909004D0906C
:1053E0009104AE8EBF8EC8A2D9A22A0D3B1D4C1DC2
:1053F0005D1D8091840890918508A0918608B091E8
:105400008708C0908604D0908704E0908804F090CC
:105410008904CDA6DEA6EFA6F8AA8C0D9D1DAE1DB3
:10542000BF1DE0907208F09073080091740810910D
:105430007508A0908A04B0908B04C0908C04D09022
:105440008D04A9AABAAACBAADCAAEA0CFB1C0C1DE3
:105450001D1D2496ECAEFDAE0EAF1FAF2497C0907D
:105460006408D0906508E0906608F0906708CCAEBC
:10547000DDAEEEAEFFAEE0908204F09083040091CA
:10548000840410918504EEAAFFAA08AF19AFACAC52
:10549000BDACCEACDFACAE0CBF1CC01ED11EACAEE2
:1054A000BDAECEAEDFAEB0902E04BAA6BB2009F0E2
:1054B000F1C50FA1002309F0EDC5809384089093F6
:1054C0008508A0938608B093870820937D083093C1
:1054D0007E0840937F08509380088091E707909161
:1054E000E807815092400CF09AC4809137048823D9
:1054F00009F095C48091EC039091ED038F3F9105E5
:1055000009F008F49BC5BAA5BB2311F00C94DC3359
:10551000EFA1EE2311F00C94DC33F0914B04FBA7C8
:10552000FF2311F00C94DC33A0902D08AD8EAA203F
:1055300011F40C94DC332496CCACDDACEEACFFACB7
:105540002497C0927208D0927308E0927408F09287
:105550007508ECACFDAC0EAD1FADE0926408F092A6
:105560006508009366081093670880917D08909104
:105570007E08A0917F08B0918008B7FF02C00C940C
:105580007840292E3A2E4B2E552447FC5A942092CF
:105590007D0830927E0840927F085092800880916A
:1055A000840890918508A0918608B0918708B7FF7C
:1055B00002C00C947240892F9A2FAB2FBB27A7FDF6
:1055C000BA95898B9A8BAB8BBC8B80938408909314
:1055D0008508A0938608B093870880911108E82E6B
:1055E000FF240027112720917E0430917F044091F1
:1055F000800450918104C801B7010E94DC6097FFCC
:1056000002C00C946C40672E782E892E992487FC5A
:105610009A9420917A0430917B0440917C045091BB
:105620007D04C801B7010E94DC6097FF02C00C94A2
:105630006640A72EB82EC92EDD24C7FCDA94D2010D
:10564000C10186199709A809B90920912C08E22EF1
:10565000FF2400271127BC01CD01A80197010E945A
:10566000506139014A0119012A0189899A89AB8956
:10567000BC898A199B09AC09BD09BC01CD01A801EF
:1056800097010E945061D401C30197FE02C00C949F
:105690006040892F9A2FAB2FBB27A7FDBA95BC017D
:1056A000DA01C90157FF02C00C945A40892F9A2F82
:1056B000AB2FBB27A7FDBA956C018091190490917F
:1056C0001A0481349105D4F4809117049091180440
:1056D000813491059CF480910008E82FFF27EE0F9C
:1056E000FF1FE653F74F808191810190F081E02DFB
:1056F000F7FF02C00C941E417A9734F080918D0917
:105700008F3F11F40C94364009A91AA92BA93CA982
:105710008E8D9F8DA8A1B9A1081B190B2A0B3B0BDD
:105720002E960CAF1DAF2EAF3FAF2E970093CC043B
:105730001093CD042093CE043093CF04EEA8FFA89D
:1057400008AD19AD2DA53EA54FA558A9E21AF30A3B
:10575000040B150BED8AFE8A0F8B188FE092D00494
:10576000F092D1040093D2041093D3042E968CAD02
:105770009DADAEADBFAD2E978093D4049093D5046C
:10578000A093D604B093D704E092D804F092D90441
:105790000093DA041093DB0480916A0490916B0407
:1057A000A0916C04B0916D042E96ECACFDAC0EADE6
:1057B0001FAD2E978E199F09A00BB10B80936A0421
:1057C00090936B04A0936C04B0936D048091620479
:1057D00090916304A0916404B09165040D891E89C1
:1057E0002F89388D801B910BA20BB30B8093620421
:1057F00090936304A0936404B09365041D8D1123FA
:1058000071F12091490430914A042138310594F016
:105810008091A2049091A30401969093A304809395
:10582000A204809188089091890801969093890834
:105830008093880820583F4F94F48091A20490915F
:10584000A30401979093A3048093A20480918808F5
:105850009091890801979093890880938808109205
:105860004A041092490401E0A02EB12C2E968CAD72
:105870009DADAEADBFAD2E97B7FF02C00C944C40AE
:1058800081509240A040B0401CF014E0A12EB12CF9
:105890008091F7049091F804A091F904B091FA0472
:1058A000E0907D08F0907E0800917F0810918008BC
:1058B0008E199F09A00BB10B815E914BAF4FBF4F6B
:1058C0008F539C49A040B04010F40C94B93FF09124
:1058D0008E09F9A7F93114F40C941E40B092F20429
:1058E000A092F1042E968CAD9DADAEADBFAD2E97BE
:1058F00081509041A040B04014F40C94C23F80917C
:10590000F304882311F40C947E4070933004609368
:105910002F042E968CAD9DADAEADBFAD2E97B7FFCB
:1059200002C00C9444419C01AD01B7FF02C00C942D
:105930003E41B9E05595479537952795BA95D1F7EA
:105940008091F1049091F204820F931F9093F204DE
:105950008093F1042E962CAD3DAD4EAD5FAD2E97EC
:1059600057FF02C00C94384139014A01A3E09594D5
:10597000879477946794AA95D1F713012401F9E8E5
:105980006F16F3E17F06F0E08F06F0E09F0644F02B
:10599000F8E86F2EF3E17F2E812C912C1301240166
:1059A000D401C30197FE02C00C943241892F9A2F73
:1059B000AB2FBB27A7FDBA95680F791F2E962CAD8C
:1059C0003DAD4EAD5FAD2E97203080EF38078FEFA5
:1059D00048078FEF580714F00C94D63F8091F404D9
:1059E000882311F40C9499407093300460932F0431
:1059F000DA01C90157FF02C00C94FC409C01AD01C3
:105A0000B7FF02C00C94F64069E05595479537956D
:105A100027956A95D1F78091F1049091F204820F55
:105A2000931F9093F2048093F1042E962CAD3DAD1C
:105A30004EAD5FAD2E9757FF02C00C94E840390180
:105A40004A0143E095948794779467944A95D1F7F7
:105A500098E769169CEE79069FEF89069FEF9906F5
:105A600044F438E7632E3CEE732E3FEF832E3FEF76
:105A7000932E6092E5047092E6048092E70490927F
:105A8000E804D401C30197FE02C00C94E240892FC0
:105A90009A2FAB2FBB27A7FDBA9560912F04709169
:105AA0003004680F791FAD8D2A2F33278091F104C0
:105AB0009091F2042817390724F43093F2042093CC
:105AC000F104B9A5BB2379F02B2F332727FD30959F
:105AD0008091F1049091F2042817390724F430934F
:105AE000F2042093F1042E962CAD3DAD4EAD5FAD8A
:105AF0002E97213831054105510574F08091A60497
:105B00009091A7042091F1043091F204820F931F29
:105B10009093A7048093A6042E968CAD9DADAEAD58
:105B2000BFAD2E9780589F4FAF4FBF4F74F48091F9
:105B3000A6049091A7042091F1043091F204821BF5
:105B4000930B9093A7048093A604B1E0AB2EB12CE5
:105B50008D899E89AF89B88DB7FF02C00C948340B0
:105B600081509240A040B0401CF0A4E0AA2EB12C7D
:105B700020E030E040E050E08091FB049091FC0494
:105B8000A091FD04B091FE04609084087090850897
:105B9000809086089090870886199709A809B90906
:105BA000815E914BAF4FBF4F8F539C49A040B04097
:105BB00028F0F9A5F93114F40C940840B092F204DD
:105BC000A092F1048D899E89AF89B88D8150904152
:105BD000A040B04014F40C94CA3F8091F50488238F
:105BE00011F40C948C40D0923204C09231048D890F
:105BF0009E89AF89B88DB7FF02C00C942941B7FFC9
:105C000002C00C942341F9E0B595A7959795879527
:105C1000FA95D1F7A80EB91EB092F204A092F10441
:105C20002D893E894F89588D57FF02C00C94DC4066
:105C3000E3E05595479537952795EA95D1F72938AB
:105C4000F3E13F07F0E04F07F0E05F0714F40C9436
:105C5000B64088E893E1A0E0B0E08093E904909337
:105C6000EA04A093EB04B093EC048091E9049091D2
:105C7000EA04A091EB04B091EC04B7FF02C00C94CD
:105C8000D640892F9A2FAB2FBB27A7FDBA95C0907E
:105C90003104D0903204C80ED91E2D893E894F8917
:105CA000588D203080EF38078FEF48078FEF580767
:105CB00014F00C94C63F8091F604882311F40C94E0
:105CC0005540D0923204C0923104DA01C90157FF25
:105CD00002C00C9415419C01AD01B7FF02C00C94A9
:105CE0000F41B9E05595479537952795BA95D1F766
:105CF0008091F1049091F204820F931F9093F2042B
:105D00008093F1042D893E894F89588D57FF02C039
:105D10000C940941A3E05595479537952795AA9589
:105D2000D1F728379CEE39079FEF49079FEF5907B6
:105D300014F00C94C04088E79CEEAFEFBFEF809367
:105D4000E9049093EA04A093EB04B093EC048091EF
:105D5000E9049091EA04A091EB04B091EC04B7FF40
:105D600002C00C94CA40892F9A2FAB2FBB27A7FDE6
:105D7000BA95C0903104D0903204C80ED91EAD8DB2
:105D80002A2F33278091F1049091F20428173907C4
:105D900024F43093F2042093F104B9A5BB2379F0E5
:105DA0002B2F332727FD30958091F1049091F20439
:105DB0002817390724F43093F2042093F1042D8935
:105DC0003E894F89588D213831054105510574F0C0
:105DD0008091A4049091A5042091F1043091F204E3
:105DE000820F931F9093A5048093A4048D899E89AC
:105DF000AF89B88D80589F4FAF4FBF4F0CF0F2C4A2
:105E00008091A4049091A5042091F1043091F204B2
:105E1000821B930B9093A5048093A404E3C49090F9
:105E20008D096FEF961611F40C94D43C80911108F3
:105E3000A82EBB24CC24DD246E8D7F8D88A199A152
:105E4000A60195010E94506179018A018091A708FD
:105E50009091A808AA2797FDA095BA2FE81AF90AE9
:105E60000A0B1B0B6DA57EA58FA598A9A601950110
:105E70000E94506159016A018091C3089091C40841
:105E8000AA2797FDA095BA2FA81AB90ACA0ADB0A51
:105E9000292C332427FC3094432C532CC201B1010C
:105EA000A80197010E94DC6097FD81C43B014C0171
:105EB000F9E09594879477946794FA95D1F7C201A5
:105EC000B101A60195010E94DC6097FF02C00C940D
:105ED0004B3E5B016C01E9E0D594C794B794A7945D
:105EE000EA95D1F78091190490911A0481349105B3
:105EF0003CF4809117049091180481349105C4F00A
:105F0000D401C30197FE02C00C94383F3C014D01FF
:105F10009594879477946794D601C501D7FE02C003
:105F20000C943D3F5C016D01D594C794B794A79440
:105F300080910008E82FFF27EE0FFF1FE653F74F71
:105F4000808191810190F081E02DF7FF02C00C94D7
:105F5000463E7A97A4F0C401B30123E030E040E06C
:105F600050E00E94506139014A01C601B50123E0A9
:105F700030E040E050E00E94506159016A01809198
:105F80008F09282F332727FD3095432F532F2615B0
:105F900037054805590514F439014A01992787FD49
:105FA0009095909581959F4FAA2797FDA095BA2F20
:105FB000681679068A069B0614F43C014D012A15E1
:105FC0003B054C055D0514F459016A01A816B90694
:105FD000CA06DB0614F45C016D0180916E04909199
:105FE0006F04A0917004B091710486199709A809F3
:105FF000B90980936E0490936F04A0937004B093DA
:1060000071048091660490916704A0916804B09136
:1060100069048A199B09AC09BD09809366049093B1
:106020006704A0936804B09369048091EC03909195
:10603000ED038F3F910511F008F065CA2496ACACD2
:10604000BDACCEACDFAC2497A0927208B0927308BE
:10605000C0927408D0927508CCACDDACEEACFFAC4D
:10606000C0926408D0926508E0926608F0926708D2
:10607000D0908A08DEA200914B040BA7A0903A04AE
:10608000B0903B04C501B7FE0FC4882799278A1931
:106090009B090AC410927E0410927F04109280041F
:1060A0001092810410927A0410927B0410927C0466
:1060B00010927D0410927D0810927E0810927F0845
:1060C0001092800810928408109285081092860819
:1060D000109287081CAE1DAE1EAE1FAE20E030E051
:1060E00040E050E024962CAF3DAF4EAF5FAF249719
:1060F00080916E0490916F04A0917004B09171042E
:1061000080936A0490936B04A0936C04B0936D0425
:106110008091660490916704A0916804B09169042D
:106120008093620490936304A0936404B093650425
:106130001092ED031092EC031092300410922F0491
:1061400010923204109231043AA5332309F0D2C9D7
:106150004FA1442309F0CEC9C0C980917A0888A70D
:1061600030C9F091FD07FCA7AF2FBB27AA0FBB1FBB
:10617000CD018653974FFC01808191819E838D8351
:10618000F091FE07FAAF2F2F3327220F331FC901DB
:106190008653974FFC01808191819A878987A0520D
:1061A000B74F0D90BC91A02DB887AF832052374FC9
:1061B000D9016D917C91D09000088091ED0490916F
:1061C000EE04AC01440F551F480F591FED81FE81AD
:1061D000AB84BC84EA9DC001EB9D900DFA9D900DAF
:1061E0001124480F591F57FF02C00C94CE3C5595FF
:1061F000479555954795EF80F884E29C9001E39C84
:10620000300DF29C300D1124240F351F3093EE0415
:106210002093ED048091150590911605409111058C
:1062200050911205840F951F281B390B30933F04A2
:1062300020933E048091EF049091F004AC01440F50
:10624000551F480F591F09851A852B853C85029FCC
:10625000C001039F900D129F900D1124480F591FEC
:1062600057FF02C00C94CA3C5595479555954795E4
:10627000629D9001639D300D729D300D1124240F9D
:10628000351F3093F0042093EF0480911305909113
:10629000140540910F0550911005840F951F281B80
:1062A000390B30933D0420933C04ED2DFF27EE0F76
:1062B000FF1FE653F74F80819181909581959F4F05
:1062C000833091050CF469C1029790933B0480934D
:1062D0003A048091FF07E82FFF27EE0FFF1FE653D8
:1062E000F74F0081118108581F4F8091260399278D
:1062F000AA2797FDA095BA2FBC01CD010E9444604A
:10630000DC01CB0120E030E040E251E4BC01CD01F2
:106310000E94E55FDC01CB01BC01CD010E9427603A
:10632000DC01CB018093BD08609125038093630855
:1063300060937A088091BC0680FF05C08091C608F2
:10634000813808F0ACC1109339040093380480916F
:1063500038049091390497FF02C00C94C43CF0912A
:106360000508FBAFF2FF5AC110928A0840913E0423
:1063700050913F04CA0157FD5AC19595879595954F
:10638000879597FD5BC12091190430911A04281755
:1063900039070CF009C1CA0157FF02C00C94D83D5F
:1063A00097FF02C00C94D53DBC0175956795759516
:1063B0006795653671050CF4FAC064E670E04091AB
:1063C0003C0450913D04CA0157FFF8C003969595CF
:1063D00087959595879597FFF7C0909581959F4FE5
:1063E0002091170430911804281739070CF4F4C0D1
:1063F000C9010197A0904D04ADAAAA2009F405C1D6
:1064000010921A0410921904109218041092170492
:10641000BAACAB2DBB27AA0FBB1FA653B74F4091F9
:106420002508242F33278D919C912817390724F4B0
:106430008091480882FD2FC1CAACAC2DBB27AA0FA2
:10644000BB1FA653B74F842F992720912608821B84
:1064500091092D913C912817390714F410922C04BE
:10646000DAACAD2DBB27AA0FBB1FA653B74F842FA5
:10647000992722273327281B390B8D919C9182174E
:10648000930724F48091480883FD01C180912B0477
:10649000882391F0EAACAE2DBB27AA0FBB1FA653F1
:1064A000B74F809126089927841B91092D913C9123
:1064B000821793070CF478C1FCA4AF2DBB27AA0F59
:1064C000BB1FA653B74F242F33278D919C912817BC
:1064D000390724F48091480880FDD4C050912904E4
:1064E000552399F00CA5A02FBB27AA0FBB1FA653BD
:1064F000B74F842F992720912608821B91092D914F
:106500003C91281739070CF44BC11CA5A12FBB27C0
:10651000AA0FBB1FA653B74F842F992722273327D3
:10652000281B390B8D919C918217930724F480913D
:10653000480881FDA3C080912A04882391F02CA5EE
:10654000A22FBB27AA0FBB1FA653B74F80912608C7
:106550009927841B91092D913C91821793070CF484
:106560001CC180912C04882329F480912B0488235A
:1065700009F482C091E0552329F480912A048823EC
:1065800009F4EEC081E080932E0410922D04109245
:106590002C0410922B040C94AB293FEF8E3F9307F1
:1065A0000CF065C0029691CEB901615070404091E7
:1065B0003C0450913D04CA0157FD08CF959587953D
:1065C0009595879597FD09CF209117043091180470
:1065D000281739070CF00CCFCA0157FF02C00C94E2
:1065E000DD3D97FF02C00C94D23D9595879595951A
:1065F0008795853691050CF4FDCE84E690E0A09059
:106600004D04ADAAAA2009F0FBCE90931804809304
:10661000170470931A0460931904FACE60938A08E1
:1066200040913E0450913F04CA0157FFA6CE039605
:10663000959587959595879597FFA5CE909581958A
:106640009F4FA1CE109237040C941326109237045A
:1066500010924D042A3011F00C94D025289A0C94F5
:10666000D52500915404109155040C944D26109298
:106670003B0410923A042DCE982F7DCF81E0809379
:106680002A046FCF81E080932904582F3ECF81E008
:1066900080932B0411CF81E080932C04E1CE809174
:1066A000B506282F332727FD309580910C08482FF9
:1066B0005527249FC001259F900D349F900D1124D4
:1066C00020913E0430913F04820F931F90933F042A
:1066D00080933E048091B606992787FD9095849F0C
:1066E000D001859FB00D949FB00D1124CD01209154
:1066F0003C0430913D04820F931F90933D0480939E
:106700003C048091B706992787FD909520913A0423
:1067100030913B04820F931F90933B0480933A0483
:106720008091B906282F332727FD309580910A08DC
:106730009927289FF001299FF00D389FF00D112413
:10674000F0931C03E0931B038091B80699278017F0
:1067500091070CF0F8CD9093390480933804F7CD6D
:1067600090932D0480932E040C94AB2980913704D0
:10677000882311F40C94B627809115049091160487
:10678000FFEF8F3F9F0711F40C94BA270196909367
:106790001604809315040C94BA2710922A04E1CEB3
:1067A0001092290450E0B1CE10922B0485CE615096
:1067B0007E4F8F4F9F4F7ACB60E070E06B0110925D
:1067C0004B041BA6E0907D08F0907E0800917F08A6
:1067D00010918008609084087090850880908608E9
:1067E00090908708F0918A08FEA3FF2311F00C9483
:1067F000663C1092320410923104109230041092D0
:106800002F04E092F704F092F8040093F904109337
:10681000FA046092FB047092FC048092FD04909252
:10682000FE0410927E0410927F0410928004109255
:10683000810410927A0410927B0410927C041092CE
:106840007D041092760410927704109278041092CE
:10685000790410927D0810927E0810927F081092A1
:106860008008109284081092850810928608109271
:106870008708109272081092730810927408109290
:1068800075081092640810926508109266081092BC
:1068900067081092ED031092EC03A0903A04B090B8
:1068A0003B04C501B7FCF1CB409774F068EE262E8F
:1068B00063E0362E30923803209237031BAD14FD6F
:1068C00003C081E08093E404D0900E08ED2CFF24F7
:1068D00000271127B501882777FD8095982F95010E
:1068E000B7FE02C00C94AE3C442737FD4095542FB0
:1068F0000E94DC609B01AC01C801B7010E94DC6012
:1069000097FF02C00C94A83C59E095958795779520
:1069100067955A95D1F79B018D2D99278A9DA001E6
:106920008B9D500D9A9D500D1124CA0157FF02C036
:106930000C94A53C9595879595958795280F391FBB
:10694000C901AA2797FDA095BA2F8093C8049093F8
:10695000C904A093CA04B093CB0420915E04309183
:106960005F044091600450916104281B390B4A0B6D
:106970005B0B213563EC360760E0460760E05607A5
:106980000CF47FC780E593ECA0E0B0E080935E0458
:1069900090935F04A0936004B093610480915E04BF
:1069A00090915F04A0916004B0916104805B9C436E
:1069B000AF4FBF4F64F480EB9CE3AFEFBFEF80932A
:1069C0005E0490935F04A0936004B0936104C09050
:1069D0005404D0905504C114D10409F447C68BADBA
:1069E00083FF44C68E8D9F8DA8A1B9A1B7FF02C0B9
:1069F0000C94123E09E0B595A795979587950A9551
:106A0000D1F72C969FAF8EAF2C9797FF02C00C94B6
:106A10001E3E8DA59EA5AFA5B8A9B7FF02C00C94D8
:106A2000183E19E0B595A795979587951A95D1F7D2
:106A3000BC0197FF02C00C94393E2C96EEADFFAD21
:106A40002C97E617F70724F42C967FAF6EAF2C97A0
:106A50002C966EAD7FAD2C9777FF02C00C94353E1F
:106A60002B01559447945594479455944794089412
:106A7000411C511CFCE1AF2EF2E0BF2ECA0CDB1C06
:106A800076010027F7FC0095102F24EE3DEFC20E93
:106A9000D31E6090BF087090C0088090C10890908D
:106AA000C208409117035091180360911903709127
:106AB0001A034AA35BA36CA37DA3C401B3012AA15B
:106AC0003BA14CA15DA10E945061E21AF30A040BA4
:106AD000150BC801B70128E631E040E050E00E9404
:106AE0005061DC01CB018C01045B1040A090B80820
:106AF000B090B908C501B7FE02C00C942F3E813892
:106B0000910514F000E010E0209037033090380336
:106B100021143104B9F42C966EAD7FAD2C976931F8
:106B2000710584F48091490490914A04800F911F6B
:106B300090934A04809349048091E404882311F0DF
:106B40000C94873EC801880F991F880F991F880FE2
:106B5000991FB2010E941B619B01442737FD40959C
:106B6000542F260D371D481D591D2093BF08309303
:106B7000C0084093C1085093C20880912803E82EB2
:106B8000FF242C96AEADBFAD2C97AE9DC001AF9D3E
:106B9000900DBE9D900D11249695879592958295A6
:106BA0008F7089279F708927F701E81BF90B2C96B6
:106BB000FFAFEEAF2C97F7FF02C00C94283E2114D4
:106BC000310411F00C943E3E0091190410911A0406
:106BD0008091170490911804080F191F17FF02C025
:106BE0000C947E3F15950795159507951595079576
:106BF000005C1F4FCA01B9012AA13BA14CA15DA1B4
:106C00000E945061DA01C90120915204309153046D
:106C1000442737FD4095542F821B930BA40BB50BD3
:106C2000845E9D4FAF4FBF4FBC01CD0128E631E0E0
:106C300040E050E00E945061DC01CB01845B904059
:106C40002C964EAD5FAD2C97849F9001859F300DA3
:106C5000949F300D1124C901B8010E941B61C70126
:106C6000880F991F8E0D9F1D2C969FAF8EAF2C976E
:106C70008617970754F02C968EAD9FAD2C97909564
:106C800081959F4F681779070CF4BC01CB01AA27A7
:106C900097FDA095BA2F20915E0430915F0440913A
:106CA000600450916104820F931FA41FB51F80934D
:106CB0005E0490935F04A0936004B093610480919C
:106CC000E30481508F3F09F4DAC48093E3049BA569
:106CD000992381F01092C4041092C5041092C60446
:106CE0001092C7041092C0041092C1041092C20402
:106CF0001092C304AAA5AA2309F089C5EEA18E2F7C
:106D00009927AA27BB27BC01CD012E8D3F8D48A115
:106D100059A10E94DC60DC01CB01BC01CD0128EF50
:106D20003AE240E050E00E9450611901FFA1FF23C8
:106D300009F06AC5CEA08C2D9927AA27BB27BC01D4
:106D4000CD012DA53EA54FA558A90E94DC60DC0110
:106D5000CB01BC01CD0128EF3AE240E050E00E94B7
:106D600050613C832B8380905E0890905F0809EC13
:106D7000801691040CF43DC5A8EC8A2E912C9092BB
:106D80005F0880925E080091690810916A08093CCA
:106D900011050CF426C508EC10E010936A08009366
:106DA000690880916B0890916C08AA2797FDA095BF
:106DB000BA2F2091BD08C22EDD24EE24FF24BC0191
:106DC000CD01A70196010E94DC609B01AC01C401CA
:106DD000AA2797FDA095BA2FE7E0880F991FAA1F51
:106DE000BB1FEA95D1F7280F391F4A1F5B1F57FDBC
:106DF0007CC576E055954795379527957A95D1F7D7
:106E00004101820E931E240180915C0890915D08DF
:106E1000AA2797FDA095BA2FBC01CD01A701960125
:106E20000E94DC609B01AC01C801AA2797FDA095D8
:106E3000BA2F67E0880F991FAA1FBB1F6A95D1F769
:106E4000280F391F4A1F5B1F57FD4AC596E055950D
:106E50004795379527959A95D1F76B807C80620E80
:106E6000731E6301AA0CBB1CC501AA2797FDA09540
:106E7000BA2F20916308332744275527BC01CD0141
:106E80000E94DC607B018C0197FD56C586E015955C
:106E90000795F794E7948A95D1F758A5852F9927F8
:106EA000AA27BB2720917204309173044091740487
:106EB00050917504BC01CD010E94DC60DC01CB0166
:106EC000BC01CD0120EF35E540E050E00E9450616B
:106ED0005701A20EB31EC50161E0861660E4960656
:106EE00024F0812C10E4912E240170E0871670ECC0
:106EF00097060CF0C1C4812CB0EC9B2E90926C08CC
:106F000080926B08A1E06A16A0E47A0624F0612C56
:106F1000A0E47A2E6301B0E06B16B0EC7B060CF0B7
:106F2000A6C4612CF0EC7F2E70925D0860925C0824
:106F3000E1E0AE16E0E4BE0624F0A12CE0E4BE2EB3
:106F4000C501F0E0AF16F0ECBF060CF08BC4A12C2D
:106F500070ECB72EB092B908A092B80880913805AD
:106F60008823C1F080911504909116040297C09770
:106F700088F4C980DA801C141D0464F481E090E078
:106F8000909316048093150480917008E82EFF24D6
:106F9000FA82E98209811A81000F111F000F111F67
:106FA0001A8309831BAD812F992780FFB8C081FF09
:106FB00071C480912B03823308F0DAC480915403AA
:106FC00081508F3F09F482C6809354032091350489
:106FD000309136045DA9552321F0109234041092AB
:106FE0003304890120913304309134042017310790
:106FF0000CF095C080914C04882309F490C0021BCA
:10700000130B80912A039927089FB001099F700DE7
:10701000189F700D1124CB0177FD6EC78C0115955B
:1070200007951595079589819A81801B910B8C0195
:107030008091EE039091EF0397FD5CC7959587953E
:10704000081B190BC0905604D0905704E0905804C8
:10705000F0905904F7FC45C737E0F594E794D794CE
:10706000C7943A95D1F780912903282F33274427D5
:107070005527C701B6010E94DC6097FD2DC725E0AA
:1070800095958795779567952A95D1F731E0693180
:1070900073070CF477C568E171E0061B170B80914C
:1070A000E1049091E2049C0122953295307F3227D1
:1070B000207F3227281B390B200F311F37FD09C7CE
:1070C000A9015595479555954795559547955595DA
:1070D0004795BA0180910608282F3327220F331FC6
:1070E000220F331F421753076CF489819A8182174C
:1070F00093070CF0B3C6A981BA81A217B30714F4A1
:10710000AD01BD01E981FA81E417F5070CF033C543
:10711000AF01F093E204E093E1045A834983509075
:10712000B708852D9927880F991F880F991F8055BB
:107130009040C980DA808C159D0514F49A83898368
:10714000E980FA80F092B307E092B2078091C80418
:107150009091C904A091CA04B091CB04880F991FE3
:10716000AA1FBB1F880F991FAA1FBB1FA81AB90A05
:107170002A96BFAEAEAE2A978701013A11050CF4EC
:1071800055C3C701F7FC0EC4959587952A962EAD79
:107190003FAD2A978217930724F42A969FAF8EAFAC
:1071A0002A97909581959F4F2A964EAD5FAD2A976D
:1071B0004817590724F42A969FAF8EAF2A97252D9A
:1071C0003327220F331F220F331FC90149815A81F0
:1071D000841B950B2A966EAD7FAD2A97861797076D
:1071E00024F42A969FAF8EAF2A9769817A81621B19
:1071F000730B2A968EAD9FAD2A978617970724F4B6
:107200002A967FAF6EAF2A9780913E0490913F04FB
:107210008401081B190B10937C0800937B08AEA116
:10722000AA2309F4FDC2281A390AC101AA2797FD29
:10723000A095BA2F2091C0043091C1044091C2049E
:107240005091C304820F931FA41FB51F8093C004E5
:107250009093C104A093C204B093C3046091C0048E
:107260007091C1048091C2049091C3046130BAEF5F
:107270007B07B0E08B07B0E09B0774F080E09AEFEB
:10728000A0E0B0E08093C0049093C104A093C20436
:10729000B093C304BC01CD016030E6E07E07EFEFA0
:1072A0008E07EFEF9E0774F480E096E0AFEFBFEF3C
:1072B0008093C0049093C104A093C204B093C3040C
:1072C000BC01CD01E0902D03F0902E0397014427DF
:1072D00037FD4095542F0E9450616801C20ED31EA5
:1072E000B0901D036B2D7727882799272A962EADFE
:1072F0003FAD2A9737FD38C337FD1BC3359527951A
:1073000009811A81200F311F442737FD4095542FE2
:107310000E94DC6097FD08C326E0959587957795D8
:1073200067952A95D1F79B016C157D050CF46B01CF
:1073300066277727621B730BC616D7060CF46B0102
:1073400080913C0490913D048301081B190B10931C
:107350005B0800935A082EA1222309F45BC24B81DB
:107360005C81481B590BCA01AA2797FDA095BA2F2B
:107370002091C4043091C5044091C6045091C704C3
:10738000820F931FA41FB51F8093C4049093C5045C
:10739000A093C604B093C7046091C4047091C5045F
:1073A0008091C6049091C70461305AEF750750E090
:1073B000850750E0950774F080E09AEFA0E0B0E018
:1073C0008093C4049093C504A093C604B093C704EB
:1073D000BC01CD016030A6E07A07AFEF8A07AFEFBE
:1073E0009A0774F480E096E0AFEFBFEF8093C40497
:1073F0009093C504A093C604B093C704BC01CD010B
:107400009701442737FD4095542F0E945061780121
:10741000E20EF31E6B2D7727882799272A962EAD2B
:107420003FAD2A9737FD66C237FD69C2359527956E
:10743000E981FA812E0F3F1F442737FD4095542FD5
:107440000E94DC6097FD6BC216E095958795779555
:1074500067951A95D1F79B016E157F050CF47B019A
:1074600066277727621B730BE616F7060CF47B0181
:107470008601222717FD2095322F098F1A8F2B8F17
:107480003C8F80917008282F332726963FAF2EAF70
:107490002697452D552728965FAF4EAF2897BAEA15
:1074A000CB2EB8E0DB2E05E517E02701662457FC5C
:1074B0006094762C2A966EAD7FAD2A974B01AA2454
:1074C00097FCA094BA2CABE03A2EFBE8EF2EF8E044
:1074D000FF2E0AC02C96FFAFEEAF2C972B96EFAD88
:1074E0002B97D601EC93D9C6F801258512160CF01E
:1074F000A5C049815A81CA01AA2797FDA095BA2F34
:10750000332727FD3095432F532FBC01CD010E9417
:10751000DC6097FD96C0E6E0959587957795679531
:10752000EA95D1F72C967FAF6EAF2C97F801868540
:10753000282F332727FD3095432F532F698D7A8DC0
:107540008B8D9C8D0E94DC6097FD8BC056E09595DD
:107550008795779567955A95D1F72C962EAD3FADC7
:107560002C97260F371F2C963FAF2EAF2C97F80184
:107570008785282F332727FD3095432F532FC301AD
:10758000B2010E94DC6097FD67C046E09595879543
:10759000779567954A95D1F72C962EAD3FAD2C97F0
:1075A000260F371F2C963FAF2EAF2C97F8018089FE
:1075B000282F332727FD3095432F532FC501B401C2
:1075C0000E94DC60DC01CB01B7FD42C036E0B5951E
:1075D000A795979587953A95D1F7F70160817181C5
:1075E0002C962EAD3FAD2C97820F931F0E94E11376
:1075F000D7018D939C9397FD29C095958795959577
:1076000087952C969FAF8EAF2C972696EEADFFAD4B
:1076100026978E179F070CF45DCF28962EAD3FADB1
:1076200028972C964EAD5FAD2C97241735070CF09C
:1076300055CF2C963FAF2EAF2C9750CFD6011C9232
:107640002CC6615C7F4F8F4F9F4F65CF0396D5CF80
:10765000CF96A11DB11DBACF615C7F4F8F4F9F4F59
:1076600094CF615C7F4F8F4F9F4F70CFA090B80831
:10767000B090B9088091E304815008F026CB88E1EE
:107680008093E304809111089927880F991F880F30
:10769000991F7C010027F7FC0095102F6E8D7F8DC0
:1076A00088A199A1A80197010E9450613093A50774
:1076B0002093A4076DA57EA58FA598A9A801970181
:1076C0000E9450613093A7072093A6078091A708D6
:1076D0009091A80897FD64C2959587959595879593
:1076E0009093A9078093A8078091C3089091C4083C
:1076F00097FD54C295958795959587959093AB077F
:107700008093AA07B092AD07A092AC0720913504F0
:10771000309136043093AF072093AE078091E7078E
:107720009091E8079093B1078093B007D092B50786
:10773000C092B40780911403909115039093B707FA
:107740008093B6078091BF089091C008A091C108AE
:10775000B091C2082091170330911803409119038A
:1077600050911A03BC01CD010E9450613093BB07B8
:107770002093BA078091400499279093B90780938A
:10778000B8078091B00699279093CB078093CA07DA
:1077900080912405909125059093CD078093CC0787
:1077A00080918E09992787FD90959093DB078093B0
:1077B000DA078091900999279093DF078093DE077D
:1077C00080911505909116059093E1078093E0074D
:1077D00080911305909114059093E3078093E2073D
:1077E00076CA2FEF083312070CF0DBCA08E31FEF4D
:1077F000D4CA18E381161FEF91060CF0C4CAF8E34F
:107800008F2EFFEF9F2EBBCA1C821B82ACCA222484
:1078100033248CCAC801AA2797FDA095BA2FA8CDFA
:10782000C801AA2797FDA095BA2F04CD2A966EAD60
:107830007FAD2A976135710534F080E590E02A9696
:107840009FAF8EAF2A972A96AEADBFAD2A97A05BA9
:10785000BF4F0CF0B4CC00EB1FEF2A961FAF0EAF5A
:107860002A97ADCC9093B9088093B80877CBD09283
:107870005D08C0925C085CCB50926C0840926B082B
:1078800041CB20935E0430935F0440936004509397
:10789000610484C820912B0380911B0390911C03E9
:1078A000820F911D20910A083327829FA001839F98
:1078B000500D929F500D1124CA01449790933404A7
:1078C0008093330481E080934C0480CBD0923204C7
:1078D000C09231047093300460932F040C940134EF
:1078E000215C3F4F4F4F5F4FB1CA215C3F4F4F4F1D
:1078F0005F4F7FCA309521953F4F37FF97CD2F5F60
:107900003F4F35952795E981FA812E0F3F1F442778
:1079100037FD4095542F0E94DC6097FF95CD615C48
:107920007F4F8F4F9F4F90CD615C7F4F8F4F9F4F09
:10793000F3CC2F5F3F4FE2CC4FE350E060E070E0CC
:10794000E40EF51E061F171FA1CA03960C949A3465
:1079500061507E4F8F4F9F4F0C94843422273327E2
:107960002A193B090C947434309521953F4FC4CCAF
:1079700081E080934C0488EC27CB809114048260D2
:10798000809314040C94D527109239041092380473
:107990000C94AF314D5F5F4F0C9434314D5F5F4FAE
:1079A0000C94F7300196F0CB80911108E82EFF245B
:1079B000002711276E8D7F8D88A199A1A8019701BD
:1079C0000E94506139014A018091A7089091A8084E
:1079D000AA2797FDA095BA2F681A790A8A0A9B0AE6
:1079E0006DA57EA58FA598A9A80197010E94506159
:1079F00059016A018091C3089091C408AA2797FD94
:107A0000A095BA2FA81AB90ACA0ADB0AD401C30181
:107A100097FC92C23C014D0154E095948794779471
:107A200067945A95D1F7D601C501D7FC81C25C0194
:107A30006D0144E0D594C794B794A7944A95D1F7C3
:107A40008091190490911A04813491050CF429C194
:107A5000C401B30123E030E040E050E00E945061F7
:107A600039014A01C601B50123E030E040E050E0B1
:107A70000E94506159016A0180910008E82FFF2798
:107A8000EE0FFF1FE653F74F808191810190F08147
:107A9000E02DF7FD49C27A97A4F0C401B30123E0B9
:107AA00030E040E050E00E94506139014A01C601D7
:107AB000B50123E030E040E050E00E945061590100
:107AC0006A0171E267167104810491042CF030E2BE
:107AD000632E712C812C912C80EE68168FEF780626
:107AE0008FEF88068FEF980644F420EE622E2FEF7A
:107AF000722E2FEF822E2FEF922E91E2A916B10453
:107B0000C104D1042CF090E2A92EB12CC12CD12CAF
:107B1000A0EEAA16AFEFBA06AFEFCA06AFEFDA06CD
:107B200014F00C94ED2F80EEA82E8FEFB82E8FEF6F
:107B3000C82E8FEFD82E0C94ED2F1092DF04ED2D70
:107B4000FF27EE0FFF1FE653F74F808191818C34A2
:107B5000910504F18091E0048F5F893C08F484C1B1
:107B60001092370488EC8093E0041092160410926F
:107B700015040C9413267093E2046093E1045A8375
:107B80004983CDCA4EEF683E74070CF086CA68EE92
:107B90007EEF83CA1092E0040C9413260396AACDBC
:107BA00003969ACD03960C94F53203960C94D43137
:107BB000909581959F4F0C94D031909581959F4FD2
:107BC0000C94F1326150704E8F4F9F4F0C945E2792
:107BD0006150704E8F4F9F4F0C9442276150704EF2
:107BE0008F4F9F4F0C9427276150704E8F4F9F4FA0
:107BF0000C9405276150704E8F4F9F4F0C94E626D2
:107C00006150704E8F4F9F4F0C94CC266150704E38
:107C10008F4F9F4F0C94B0266150704E8F4F9F4FE7
:107C20000C94812681509E4FAF4FBF4F0C94FA3475
:107C300081509E4FAF4FBF4F0C941135DC01B09572
:107C4000A195BF4F2C96BFAFAEAF2C970C940935C2
:107C500084EF91E0909338038093370330C88827EE
:107C600099278A199B090C947F35695F7F4F0C9483
:107C70003035709561957F4F0C941D35089421081F
:107C80003108309238032092370319C8F095E195F6
:107C9000FF4F0C94A92F61507E4F8F4F9F4F0C9434
:107CA000692F8091170490911804813491050CF488
:107CB000E3CECECEC10137FCD7C11C013594279449
:107CC00035942794359427940C94932780910A0334
:107CD00090910B03895E934008F4E9C087B58E3F0D
:107CE00008F0E5C087B5843F08F033C29091F003F7
:107CF0009A509093F0038091F207891B87BD8CE224
:107D000091E090932905809328058AEF5DC988EC5E
:107D100090E09093290580932805C601AA2797FD36
:107D2000A095BA2FBC01CD012AA13BA14CA15DA118
:107D30000E94DC603B014C010E945061309353046F
:107D4000209352041092E4040C94A2358081918116
:107D5000855B9F4F0CF009C18091DE048F5F80939B
:107D6000DE04893C10F40C94DA282C3008F0F8C1B9
:107D70002998A4E0B0E08FEF082E0E94C86010920E
:107D800037041092DE0410921604109215040E941B
:107D9000331FA4E0B0E080919C0490919D0497FD76
:107DA00002C2892F990F990B082E0E94C860A5E086
:107DB000B0E080919C0490919D04082E0E94C860C0
:107DC000A6E0B0E080919A0490919B0497FDE8C1F1
:107DD000892F990F990B082E0E94C860A7E0B0E088
:107DE00080919A0490919B04082E0E94C86008E03C
:107DF00010E08091940490919504A0919604B09124
:107E00009704BC01CD010E942760DC01CB019C01DD
:107E100097FDE4C1832F992787FD9A95D801082EF5
:107E20000E94C86009E010E080919404909195044C
:107E3000A0919604B0919704BC01CD010E942760E7
:107E4000DC01CB01D801082E0E94C8600E94F541D8
:107E50000E94F7133091FF070C94DA28A901B901A9
:107E60004AC98093DF046BCE8093E0040C94132600
:107E70000196A11DB11D0C94862F0196A11DB11D67
:107E80000C94922F81E08093E4041092C804109225
:107E9000C9041092CA041092CB0410925E0410928E
:107EA0005F0410926004109261040C94D5278091B5
:107EB0000A0390910B038436910520F587B5823033
:107EC00008F187B58B3008F44DC19091F003965FAF
:107ED00010CF215F3F4FF4C8615E7F4F8F4F9F4FA0
:107EE000CEC82FE730E040E050E0C20ED31EE41EC3
:107EF000F51EB2C80196A2C8039690C8095F1F4F2D
:107F00000C94F235209135043091360424513040E0
:107F100030933404209333042C5E3F4F10924C0472
:107F200081E08093540356C8F095E195FF4FB3CD9F
:107F30000F96A11DB11D7BCD0F96A11DB11D6ACD60
:107F4000759714F40C949327C10137FC0DC11C01E3
:107F5000359427940C949327F095E195FF4F0C945A
:107F60007F278093DE040C94DA284093DE040C947F
:107F7000DA28B092F204A092F10420918E0929A788
:107F80000C94722C1092F3040C94DE2C1092F604D4
:107F90000C94BF2E2093E9043093EA044093EB0441
:107FA0005093EC041092F5040C944D2E2092E504AD
:107FB0003092E6044092E7045092E8041092F404F0
:107FC0000C94532D0E94F5414DE56DEF77E00E9432
:107FD0009D418091050880FF10C080910A03909117
:107FE0000B03875B934038F480910A0390910B0355
:107FF0008E5E924010F40E94440C0E94331F26CFE4
:10800000C090FE07CAAE0C943128299A0C9403281C
:108010002093E9043093EA044093EB045093EC047A
:108020001092F2041092F104E8EE2E2EE3E03E2EC0
:1080300030923803209237030C94BF2E6092E504EF
:108040007092E6048092E7049092E8041092F204A1
:108050001092F10488EE282E83E0382E30923803F7
:10806000209237030C94532D079627CE709330043B
:1080700060932F04D0923204C0923104CB0177FD7B
:10808000C6C0BC0175956795C601D7FCBEC06C0122
:10809000D594C7940C94842BB095A0959095819518
:1080A0009F4FAF4FBF4F0C94402C81E08093F6045C
:1080B0000C94BF2E81509F4FAF4FBF4F0C94562B47
:1080C00081509F4FAF4FBF4F0C94492B61507F4F52
:1080D0008F4F9F4F0C94192B61507F4F8F4F9F4FA5
:1080E0000C94032B81509F4FAF4FBF4F0C94DB2A52
:1080F00081509F4FAF4FBF4F0C94C12A81E08093B6
:10810000F3040C94DE2CB095A095909581959F4F2B
:10811000AF4FBF4F0C94B02D2093E9043093EA0485
:108120004093EB045093EC0481E08093F5040C94AD
:108130004D2E2092E5043092E6044092E7045092DE
:10814000E80481E08093F4040C94532D03960C947E
:108150008E278EEFD3CDF095E195FF4F0C94BC2880
:10816000299A07CE81E0CACD0196F1CE2093E90489
:108170003093EA044093EB045093EC040C94352EB6
:108180002093E9043093EA044093EB045093EC0409
:108190000C94A72E81509F4FAF4FBF4F0C94B32E1E
:1081A00081509F4F15CE81509F4FFBCD81509F4FE7
:1081B000AF4FBF4F0C94412E295F3F4F4F4F5F4F42
:1081C0000C94182E81509F4FAF4FBF4F0C94472DEA
:1081D000295F3F4F4F4F5F4F0C941F2D21503F4F52
:1081E00019CEF095E195FF4F0C942D2821503E4F6C
:1081F0004F4F5F4F0C94042DB095A09590958195AD
:108200009F4FAF4FBF4F0C94FE2C019640CF01966D
:1082100038CF295F3F4F4F4F5F4F0C948A2E21502C
:108220003E4F4F4F5F4F0C94712EB095A095909597
:1082300081959F4FAF4FBF4F0C946B2EF095E195FA
:10824000FF4F0C947C2B81509E4FAF4FBF4F0C942F
:10825000032EB095A095909581959F4FAF4FBF4F3E
:108260000C94FF2D81509F4FAF4FBF4F0C94D62CD5
:10827000295F3F4F4F4F5F4F0C94B42C21503E4F1E
:108280004F4F5F4F0C94992CB095A0959095819588
:108290009F4FAF4FBF4F0C94932C3A94E2E0F0E025
:1082A000EE0EFF1E0C5F1F4F0894C11CD11C37FE41
:1082B0001BC9C35BDF4F0FB6F894DEBF0FBECDBF47
:1082C000DF91CF911F910F91FF90EF90DF90CF90B2
:1082D000BF90AF909F908F907F906F905F904F90E6
:1082E0003F902F90089580910B0590910C05A091DF
:1082F0000D05B0910E058093030590930405A0939E
:108300000505B09306058091070590910805A09199
:108310000905B0910A058093FF0490930005A0938E
:108320000105B093020508951092160510921505E7
:1083300010921405109213050895282FFB01815007
:10834000853008F023E0842F9927332721503040CF
:10835000829FD001839FB00D929FB00D1124AC5924
:10836000BF4F019724F00E94BB600192FACF0E9498
:108370000B590895863038F085E0A2E0B0E0082E71
:108380000E94C86008958823C1F70895582F863049
:1083900048F155E0842F9927252F3327215030406D
:1083A000829FD001839FB00D929FB00D1124AC59D4
:1083B000BF4FFB01019724F001900E94C860FACFE3
:1083C000A2E6B0E0042E0E94C860A0E5B0E088E01C
:1083D000FB01182E0E94D460852F0E94BA410E9492
:1083E0000B5908958823B1F60895CF93A2E0B0E029
:1083F0000E94BB60802DC82F8150853020F0C3E0E3
:108400008C2F0E94BA418C2F9927CF91089580918B
:10841000FD07E82FFF27EE0FFF1FE653F74F808180
:1084200091818D5E9F4F14F010925703808191814E
:108430008A5B9F4F24F480915703882319F0209181
:10844000B00615C081E0809357032091B006280F35
:108450002093B006253038F088EE93E090932905FC
:108460008093280504C0822F0E94F713E8CF822F43
:1084700099279093CB078093CA070895CFEFD0E157
:10848000DEBFCDBF14B815B807EE13E0025310409D
:1084900017FFFCCF08EE13E0189B6BC1199B74C14A
:1084A0002DE02093560381E887B93E9A8FEF88B973
:1084B0008BE184B981E085B98EE38AB9579A87E464
:1084C0008BB9469A84B7877F84BF809160008861AA
:1084D000809360001092600080ED97E090932905F2
:1084E0008093280510923B0410923A041092CF0812
:1084F0001092CE0810923D0410923C0410923F045A
:1085000010923E04243108F43AC188E894E0A0E0D7
:10851000B0E08093170390931803A0931903B093CE
:108520001A032A3009F460C1243109F45DC1289A84
:108530000E94D7530E94A7530E947C090E947B513E
:108540000E943E0C0E949A570E949359789487E0AB
:1085500091E09F938F931F920E94E64E0F900F9091
:108560000F9084E690E09F938F938AE490E09F932E
:108570008F931F921F92809156036AE00E94FB60C6
:10858000892F99279F938F93809156030E94FB60B8
:1085900099279F938F938DE291E09F938F931F92E2
:1085A0000E94E64E8091C8002DB73EB7235F3F4F33
:1085B0000FB6F8943EBF0FBE2DBF803209F40CC138
:1085C000809156038C3008F0D8C0299A49E06DEFAD
:1085D00077E083E00E949D41C8EED3E0DE010E9477
:1085E000BB60802D813009F4D1C081E691E09F937A
:1085F0008F931F920E94E64E0F900F900F9025E5EB
:1086000037E0F9018FE0158616861786108A8150AB
:10861000349687FFF8CF80E48093620780936307E6
:1086200010926407809365078093660790EC90939F
:108630006707109268078093690780936A07109212
:108640006B0790936C0790936D0780936E07109261
:108650006F07809370079093710781E080935507AF
:1086600046E557E08BE0E8E5F3E0DA0101900D9292
:108670008A95E1F78DE4DE01F901182E0E94D4609D
:108680008091160399279F938F935F934F9382E86E
:1086900091E09F938F931F920E94E64E2DB73EB7B5
:1086A000295F3F4F0FB6F8943EBF0FBE2DBF83EA40
:1086B00091E09F938F931F920E94E64E109239058E
:1086C00010922C050E94DB210F900F900F9080914B
:1086D0002C058823E1F310923905EE24FF24E5EB05
:1086E000CE2EE1E0DE2E10922C050E94DB2180913F
:1086F0002C058823E1F3F701EE5DF64F8081882396
:1087000009F074C0E70121967E012C9760F3EE24F6
:10871000FF2479EBC72E71E0D72E22C0F701EE0FB0
:10872000FF1FEE0FFF1FEB5AF84F85851816F4F464
:10873000E7012196DF93CF93DF92CF929F930E9420
:10874000E64E0F900F900F900F900F9086E099E0FB
:10875000E80EF91ED7011C927E012C9708F055C037
:10876000F701EE5DF64F90819923C1F2E701219662
:10877000EDCF199B2FC024E194CE299827CF8BE011
:1087800095E0A0E0B0E0C5CE2BE08BCEA1E0B0E05C
:108790000E94BB60802D8F3F09F427CF10921603F3
:1087A00025E537E08DE4DE01F901182E0E94C36053
:1087B00090911603F9013D962FE0808134961816AA
:1087C0000CF49F5F215027FFF8CF9093160346E5E6
:1087D00057E056CF2AE065CE8091CA00863009F076
:1087E000EFCE0E94095DECCE2898A2CEE70121963B
:1087F000DF93CF93DF92CF921F920E94E64E0F90AD
:108800000F900F900F900F907FCF87ED91E09F9387
:108810008F931F920E94E64E0F900F900F90A1E051
:10882000B0E00E94BB60802D8B3409F055C1A4E0FC
:10883000B0E00E94BB60802D853008F035C20E94F8
:10884000F5414DE56DEF77E00E949D410E94F541B5
:1088500099279F938F938BE592E09F938F931F921D
:108860000E94E64E809105080F900F900F900F9098
:108870000F9080FDF5C10E94331F809156038A300E
:1088800009F4ECC1843109F4E9C1289A80ED97E03C
:10889000909329058093280585E58093B20688E9A1
:1088A00092E09F938F931F920E94E64E809105085D
:1088B0000F900F900F9082FFF4C184EA92E09F9393
:1088C0008F931F920E94E64E0F900F900F9082ECB4
:1088D00092E09F938F931F920E94E64E0E945F4604
:1088E00088E893E190933A038093390381E0809381
:1088F000B1060F900F900F9080912C05882309F4FA
:108900008EC080910603882309F489C010922C053B
:108910008091B006882309F48AC00E9407420E9411
:10892000DB21209156032A3009F48AC0243109F44E
:1089300087C0289A80910303882309F487C0815057
:108940008093030380914004882329F080914004A0
:1089500081508093400480914505882369F08150BF
:1089600080934505882341F4109216051092150551
:1089700010921405109213058091390390913A03D7
:10898000019790933A038093390380913903909132
:108990003A03892B29F080913805882309F465C0B2
:1089A0008091390390913A03892B09F464C0809136
:1089B000BC039091BD038F5F9F4F09F46CC0809101
:1089C0002C05882321F080913704882311F40E941C
:1089D000B8090E94A706C8010E9474538823E9F0D1
:1089E00080911608282F3327809114039091150346
:1089F0008217930744F48091BC039091BD038F5F6D
:108A00009F4F09F45CC00E94305C84E0809327058E
:108A100084E190E00E946B538C010E941A5980916E
:108A20002705882309F068CF0E94745C65CF0E94F7
:108A300083250E94DB21209156032A3009F076CF4E
:108A4000289880910303882309F079CF8093BC068E
:108A50001092200410921F0410921E0410921D0404
:108A600010921C0410921B046DCF2A3031F1243176
:108A700021F1289AA4CF0E94B05785E090E090930E
:108A80003A03809339038091BC039091BD038F5FBB
:108A90009F4F09F094CF80913704882309F48FCF3A
:108AA00080E197E2909329058093280580E890E083
:108AB0009093BD038093BC0382CF289880CF80E73A
:108AC00097E1909329058093280580E093E09093A7
:108AD000BD038093BC0397CF0E94D0118DEF91E02E
:108AE0009F938F931F920E94E64E51E0952E0F9018
:108AF0000F900F90C0E5D0E07E010894E11CF11CBE
:108B000042E0C42ED12CCC0EDD1E33E0A32EB12CBE
:108B1000AC0EBD1E24E0622E712C6C0E7D1E95E005
:108B2000492E512C4C0E5D1E86E0282E312C2C0E29
:108B30003D1EE2E09E1609F48BC0F3E09F1609F497
:108B40008AC023E0291508F483C08091560384313C
:108B500068F085E08093150810922D088BE18093D2
:108B600011088EE480932A0880932B08DE010E946E
:108B7000BB60802D8C3008F068C0D7010E94BB60BC
:108B8000802D8C3008F061C0D6010E94BB60802D22
:108B90008C3008F05AC0D5010E94BB60802D8C300B
:108BA00008F053C0DE010E94BB60802D8093FD075A
:108BB000D7010E94BB60802D8093FE07D6010E94E2
:108BC000BB60802D8093FF07D5010E94BB60802D84
:108BD00080930008D3010E94BB60802D8093010820
:108BE000D2010E94BB60802D80930208D1010E94B7
:108BF000BB60802D80930308A7E5B0E00E94BB60B6
:108C0000802D8093040831E0931651F48CE092E0BB
:108C10009F938F931F920E94E64E0F900F900F909C
:108C20004DE56DEF77E0892D0E94C641939495E064
:108C3000991508F07ECF83E00E94BA418BE4A1E051
:108C4000B0E0082E0E94C860F2CD0E94B711E8CFB4
:108C50000E9480127ACF0E94321377CF289816CEC6
:108C600083E792E09F938F931F920E94E64E88EED7
:108C700093E00E946B538C010E94440C0F900F9064
:108C80000F90C8010E9474538823D9F383E992E0BE
:108C90009F938F931F920E94E64E0F900F900F901C
:108CA000EACD80EB92E00BCE84E492E09F938F9329
:108CB0001F920E94E64E0F900F900F90C0CD90E251
:108CC000E1E6F3E08FE49193815087FFFCCF0895B4
:108CD0001F93CF93DF93809118052091600328178D
:108CE00010F4209318059091170590FF08C080910B
:108CF0001805882309F40CC181508093180591FF51
:108D000008C080911805821709F4AAC18F5F80936B
:108D10001805892F992780FF02C081FDF6C00E94A7
:108D20005F46909118059A3008F0ABC081E18093BE
:108D30001905892F99279F938F938AEE92E09F932D
:108D40008F9381E08F930E94E64E0F900F900F90CB
:108D50000F900F9080911805C82FDD27C630D105E0
:108D600009F481C1C730D1050CF095C0C230D105DE
:108D700009F433C2C330D1050CF4CDC0C430D105E1
:108D800009F438C525970CF06AC310921905809133
:108D9000CE089091CF089F938F938091CC089091AB
:108DA000CD089F938F9381EE93E09F938F9311E073
:108DB0001F930E94E64E84E1809319056DB77EB73C
:108DC000695F7F4F0FB6F8947EBF0FBE6DBF809175
:108DD000D2089091D3089F938F938091D00890915F
:108DE000D1089F938F9381EF93E09F938F931F936D
:108DF0000E94E64E88E2809319058DB79EB70796CC
:108E00000FB6F8949EBF0FBE8DBF8091D60890918B
:108E1000D7089F938F938091D4089091D5089F9302
:108E20008F9381E094E09F938F931F930E94E64E6F
:108E30008CE3809319052DB73EB7295F3F4F0FB6DE
:108E4000F8943EBF0FBE2DBF8091DA089091DB08E9
:108E50009F938F938091D8089091D9089F938F9377
:108E600081E194E09F938F931F930E94E64E6DB72C
:108E70007EB7695F7F4F0FB6F8947EBF0FBE6DBFA0
:108E800036C780E180931905892F99279F938F9387
:108E90008FEE92E054CFCA30D10509F458C1CB30DF
:108EA000D1050CF044C0C830D10509F44EC529974E
:108EB0000CF08AC384E1809319058091140390918A
:108EC00015039F938F938BE495E09F938F9311E00D
:108ED0001F930E94E64E88E2809319050F900F9031
:108EE0000F900F900F908091400499279F938F933C
:108EF0008AE595E09F938F931F930E94E64E0F9013
:108F00000F900F900F900F90F2C61092180507CF98
:108F100020931805F4CE209709F4CAC1219709F4CB
:108F20009EC381508093600310921805E0C6CC3038
:108F3000D10509F4E2C3CC30D1050CF432C22D972F
:108F400081F71092190586E996E09F938F93C1E00F
:108F5000CF930E94E64E84E1809319050F900F9005
:108F60000F908091250999278D969F938F938091DB
:108F7000240999278D969F938F9380912309992790
:108F80008D969F938F938091220999278D969F9319
:108F90008F9385EA96E09F938F93CF930E94E64E3E
:108FA00088E2809319058DB79EB70B960FB6F8949B
:108FB0009EBF0FBE8DBF8091290999278D969F93E3
:108FC0008F938091280999278D969F938F938091F5
:108FD000270999278D969F938F938091260999272A
:108FE0008D969F938F9389EB96E09F938F93CF936A
:108FF0000E94E64E8CE3809319052DB73EB7255F9E
:109000003F4F0FB6F8943EBF0FBE2DBF80912A0987
:1090100099278D969F938F938DEC96E09F938F93D6
:10902000CF930E94E64E0F900F900F900F900F90ED
:1090300080912B09882309F02AC680912C09882366
:1090400009F017C680912D09882309F450C688E4D9
:109050008093190583EE96E09F938F93CF939BC1E6
:109060001092180556CE1092190581E195E09F9354
:109070008F9311E01F930E94E64E84E180931905BF
:109080000F900F900F9080919C0490919D049F935E
:109090008F938091F4039091F5039F938F938EE1CA
:1090A00095E09F938F931F930E94E64E88E28093F2
:1090B00019056DB77EB7695F7F4F0FB6F8947EBF15
:1090C0000FBE6DBF80919A0490919B049F938F93E4
:1090D0008091F6039091F7039F938F938DE295E033
:1090E0009F938F931F930E94E64E8CE38093190504
:1090F0008DB79EB707960FB6F8949EBF0FBE8DBF73
:109100008091940490919504A0919604B091970455
:10911000BC01CD010E942760DC01CB019F938F939E
:1091200080917608909177089F938F938CE395E0D8
:109130009F938F931F930E94E64E2DB73EB7295FF2
:109140003F4F0FB6F8943EBF0FBE2DBFD0C5109253
:10915000190585ED95E09F938F9311E01F930E9471
:10916000E64E84E1809319050F900F900F90809147
:10917000220399279F938F938DED95E09F938F9373
:109180001F930E94E64E88E2809319050F900F907E
:109190000F900F900F9080912405909125059F933B
:1091A0008F938BEE95E09F938F931F930E94E64ED3
:1091B0008CE3809319050F900F900F900F900F90F4
:1091C0008091220899279F938F9380912108992756
:1091D0009F938F9389EF95E045CE109219058AEA07
:1091E00093E09F938F93C1E0CF930E94E64E84E17A
:1091F000809319050F900F900F9080918E0490919D
:109200008F04A0919004B0919104B7FD2DC53AE070
:10921000B595A795979587953A95D1F7BF93AF9355
:109220009F938F9384EB93E09F938F93CF930E94B0
:10923000E64E88E2809319058DB79EB707960FB664
:10924000F8949EBF0FBE8DBF8091860490918704D5
:10925000A0918804B0918904B7FD01C52AE0B595B5
:10926000A795979587952A95D1F7BF93AF939F932D
:109270008F9383EC93E09F938F93CF930E94E64E5E
:109280008CE3809319052DB73EB7295F3F4F0FB68A
:10929000F8943EBF0FBE2DBF8091540490915504A9
:1092A0009F938F9382ED93E09F938F93CF9325CEDF
:1092B0001092190584EF92E09F938F9311E01F9312
:1092C0000E94E64E84E1809319050F900F900F9055
:1092D00084E690E09F938F938AE490E09F938F932E
:1092E000DF93CF93809156036AE00E94FB60892F41
:1092F00099279F938F93809156030E94FB60992733
:109300009F938F9384E093E09F938F931F930E948A
:10931000E64E88E2809319052DB73EB7235F3F4F95
:109320000FB6F8943EBF0FBE2DBF86E597E09F9322
:109330008F930E94F54199279F938F9389E193E042
:109340009F938F931F930E94E64E809139039091D3
:109350003A036DB77EB7695F7F4F0FB6F8947EBF53
:109360000FBE6DBF069778F090913805992309F4E8
:109370002FC38CE380931905892F99279F938F938F
:1093800084E393E0B7CD8CE38093190587E293E003
:109390009F938F931F930E94E64E0F900F900F9014
:1093A000A6C41092190587E096E09F938F9311E071
:1093B0001F930E94E64E84E1809319050F900F9051
:1093C0000F908091B606992787FD90959F938F9374
:1093D0008091B506992787FD90959F938F9387E19C
:1093E00096E09F938F931F930E94E64E88E28093AE
:1093F00019058DB79EB707960FB6F8949EBF0FBE9E
:109400008DBF8091B706992787FD90959F938F9385
:109410008091B80699279F938F9387E296E09F9358
:109420008F931F930E94E64E8CE3809319052DB70E
:109430003EB7295F3F4F0FB6F8943EBF0FBE2DBF1A
:109440008091BC0699279F938F938091B9069927A5
:1094500087FD90959F938F9387E396E003CD1092BD
:10946000190581E694E09F938F93C1E0CF930E940A
:10947000E64E809156030F900F900F908A3009F4BA
:1094800069C38B3009F4BEC2843109F4BBC28D308C
:1094900009F02DC484E1809319058091090399276F
:1094A0009F938F934091A6045091A704CA0157FD42
:1094B0001CC49595879595958795959587959595D0
:1094C00087959F938F939A0157FD0CC435952795E7
:1094D00035952795359527958091FC039091FD034F
:1094E000821B930B9F938F9385ED94E09F938F93B3
:1094F000CF930E94E64E88E2809319056DB77EB740
:10950000675F7F4F0FB6F8947EBF0FBE6DBF80912F
:10951000080399279F938F934091A4045091A50429
:10952000CA0157FDDDC395958795959587959595C6
:109530008795959587959F938F939A0157FDCDC3F6
:109540003595279535952795359527958091FA037B
:109550009091FB03821B930B9F938F9389EE94E072
:109560009F938F93CF930E94E64E8CE380931905CF
:109570008DB79EB709960FB6F8949EBF0FBE8DBFEC
:109580008091070399279F938F932091A204309194
:10959000A304C90137FD9FC3959587959F938F932A
:1095A0008091F8039091F903281B390B3F932F9377
:1095B0008DEF94E09F938F93CF930E94E64E2DB74B
:1095C0003EB7275F3F4FBDCD1092190580914704EC
:1095D000909148049F938F9385EA95E09F938F9392
:1095E00011E01F930E94E64E84E1809319050F90CD
:1095F0000F900F900F900F9080914504909146042A
:109600009F938F9381EB95E09F938F931F930E947D
:10961000E64E88E2809319050F900F900F900F90FF
:109620000F9080914304909144049F938F938DEB0E
:1096300095E09F938F931F930E94E64E8CE3809357
:1096400019050F900F900F900F900F90809141048B
:10965000909142049F938F9389EC95E04BCC80913D
:10966000050880FFBBC110921905809135049091C7
:1096700036049F938F9389E593E09F938F9311E036
:109680001F930E94E64E84E1809319050F900F907E
:109690000F900F900F9080913304909134049F931A
:1096A0008F9388E693E09F938F931F930E94E64EDB
:1096B00088E2809319050F900F900F900F900F90F4
:1096C00080910A0390910B039F938F9387E793E018
:1096D0009F938F931F930E94E64E8CE3809319050E
:1096E0000F900F900F900F900F908091F207992795
:1096F0009F938F9386E893E0FDCB1092190587E442
:1097000096E09F938F9311E01F930E94E64E84E1B1
:10971000809319050F900F900F9080910909992758
:109720009F938F938091080999279F938F9380919E
:10973000070999279F938F938091060999279F93F3
:109740008F9387E596E09F938F931F930E94E64E39
:1097500088E2809319058DB79EB70B960FB6F894E3
:109760009EBF0FBE8DBF80910D0999279F938F9348
:1097700080910C0999279F938F9380910B099927CA
:109780009F938F9380910A0999279F938F938CE6DB
:1097900096E09F938F931F930E94E64E8CE38093F5
:1097A00019052DB73EB7255F3F4F0FB6F8943EBF62
:1097B0000FBE2DBF8091110999279F938F938091A0
:1097C000100999279F938F9380910F0999279F9351
:1097D0008F9380910E0999279F938F9381E896E04C
:1097E0009F938F931F930E94E64E6DB77EB7655F80
:1097F0007F4F41CB109219058091FE07E82FFF277C
:10980000EE0FFF1FE653F74F808191819F938F9357
:109810008091FD07E82FFF27EE0FFF1FE653F74F5C
:10982000808191819F938F9381E294E09F938F93A6
:1098300011E01F930E94E64E84E1809319058DB7D5
:109840009EB707960FB6F8949EBF0FBE8DBF80914E
:109850000008E82FFF27EE0FFF1FE653F74F808128
:1098600091819F938F938091FF07E82FFF27EE0F41
:10987000FF1FE653F74F808191819F938F9381E380
:1098800094E09F938F931F930E94E64E88E280930B
:1098900019052DB73EB7295F3F4F0FB6F8943EBF6D
:1098A0000FBE2DBF80910208E82FFF27EE0FFF1F8C
:1098B000E653F74F808191819F938F9380910108A8
:1098C000E82FFF27EE0FFF1FE653F74F80819181AE
:1098D0009F938F9381E494E09F938F931F930E94B3
:1098E000E64E8CE3809319056DB77EB7695F7F4FB5
:1098F0000FB6F8947EBF0FBE6DBF80910408E82FAD
:10990000FF27EE0FFF1FE653F74F808191819F9352
:109910008F9380910308E82FFF27EE0FFF1FE65378
:10992000F74F808191819F938F9381E594E09F937E
:109930008F931F930E94E64E8DB79EB707960FB682
:10994000F8949EBF0FBE8DBFD2C11092190589E653
:1099500095E09F938F9311E01F930E94E64E84E160
:10996000809319050F900F900F9080914E04909165
:109970004F049F938F9388E795E09F938F931F9356
:109980000E94E64E88E2809319050F900F900F9089
:109990000F900F9080915404909155049F938F9352
:1099A00087E895E09F938F931F930E94E64E8CE388
:1099B000809319050F900F900F900F900F9080914A
:1099C0005204909153049F938F9386E995E092CA35
:1099D0008CE38093190589E493E0DACC84E18093E9
:1099E000190585E993E09F938F9311E01F930E94DF
:1099F000E64E88E2809319050F900F900F908CE946
:109A000093E0C6CC84E1809319054091A60450915F
:109A1000A704CA0157FD57C19C0135952795359577
:109A200027953595279535952795C9018295929566
:109A3000907F9827807F9827BA01681B790BCB010C
:109A400077FD3FC1959587959F938F933F932F9374
:109A50009A0157FD33C1359527953595279535954D
:109A600027958091FC039091FD03821B930B9F939C
:109A70008F9382EA94E09F938F93CF930E94E64E58
:109A800088E2809319058DB79EB709960FB6F894B2
:109A90009EBF0FBE8DBF4091A4045091A504CA0182
:109AA00057FD0AC19C013595279535952795359524
:109AB000279535952795C90182959295907F98278E
:109AC000807F9827BA01681B790BCB0177FDF2C024
:109AD000959587959F938F933F932F939A0157FD69
:109AE000E6C035952795359527953595279580912D
:109AF000FA039091FB03821B930B9F938F9384EB4C
:109B000094E09F938F93CF930E94E64E8CE38093D3
:109B100019058DB79EB709960FB6F8949EBF0FBE74
:109B20008DBF2091A2043091A304C90137FDBDC0AF
:109B3000959587959F938F938091F8039091F90362
:109B4000281B390B3F932F9386EC94E09F938F93C0
:109B5000CF93F1CA84E1809319054091A6045091F6
:109B6000A7049A0157FDB4C03595279535952795DB
:109B700035952795C901880F991F880F991F880F60
:109B8000991F481B590B5F934F933F932F938091DD
:109B9000FC039091FD03821B930B9F938F938FE6A1
:109BA00094E09F938F93CF930E94E64E88E2809338
:109BB00019052DB73EB7275F3F4F0FB6F8943EBF4C
:109BC0000FBE2DBF4091A4045091A5049A0157FDEA
:109BD0007CC0359527953595279535952795C901ED
:109BE000880F991F880F991F880F991F481B590BC1
:109BF0005F934F933F932F938091FA039091FB03D0
:109C0000821B930B9F938F9381E894E09F938F9394
:109C1000CF930E94E64E8CE3809319056DB77EB713
:109C2000675F7F4F0FB6F8947EBF0FBE6DBF809108
:109C3000A2049091A3049F938F938091A20490918A
:109C4000A3042091F8033091F903821B930B9F9397
:109C50008F9383E994E09F938F93CF936BCE815042
:109C60009C4FAF4FBF4FFACA81509C4FAF4FBF4F71
:109C7000CECA84E48093190580EE96E09F938F937B
:109C8000CF930E94E64E0F900F900F90DBC980E4B7
:109C9000809319058DED96E09F938F93CF930E944B
:109CA000E64E0F900F900F90C8C9019641CF295FE3
:109CB0003F4F17CF01960CCF0F96F4CE295F3F4F41
:109CC000CACE0196BFCE0F96A7CE295F3F4F81CF58
:109CD000295F3F4F49CF01965FCC295F3F4F30CC82
:109CE0000F9621CC295F3F4FF1CB0F96E2CB10921C
:109CF0001705DF91CF911F910895982F8091C90882
:109D0000813031F0892F0E946809282F33270CC039
:109D100080911905E82FFF27EF59FC4F90838F5F43
:109D20008093190521E030E0C90108950F931F9336
:109D3000CF93DF938C01EB01672B71F0F8018191D8
:109D40008F010E947D4E219739F0F80181918F019A
:109D50000E947D4E219791F7DF91CF911F910F9136
:109D600008950F931F93CF93DF938C01EB01672B23
:109D700081F0F8010F5F1F4F84910E947D4E219763
:109D800041F0F8010F5F1F4F84910E947D4E219793
:109D900081F7DF91CF911F910F910895CF93C82F35
:109DA000181634F480E20E947D4EC1501C16D4F384
:109DB000CF910895CF93C82F181634F480E30E94F2
:109DC0007D4EC1501C16D4F3CF9108952F923F922F
:109DD0004F925F926F927F928F929F92AF92BF92BB
:109DE000CF92DF92EF92FF920F931F93CF93DF9367
:109DF000CDB7DEB7E0970FB6F894DEBF0FBECDBF8C
:109E000026968FAD26972896EEADFFAD289788242D
:109E1000992454018093C90848E4C42ED12CCC0E57
:109E2000DD1E7F01C701F7011491112331F01532B6
:109E300021F00894E11CF11CF6CFB701681B790BE7
:109E400009F095C0112309F43DC20894E11CF11CEE
:109E50001FA63FA4232C0FEF39A6F7010894E11C9D
:109E6000F11C14911537C9F1812F80628837A9F14F
:109E7000103209F440C0133209F48DC01A3209F4CB
:109E800079C01D3209F476C01B32C9F11E32C9F106
:109E9000103309F48AC0812F8153893008F07EC0C5
:109EA00060E070E0CB01880F991F880F991F880F21
:109EB000991F860F971F680F791F610F711D6053DF
:109EC0007040F7010894E11CF11C1491812F80531C
:109ED0008A3040F3262E153739F630FE3DC0F601A4
:109EE00084E090E0C80ED91E80809180A280B3806B
:109EF000103209F0C0CF89A5882309F0AECF19A789
:109F0000ACCFF7010894E11CF11C14911A3209F44A
:109F100051C060E070E014C0CB01880F991F880F1A
:109F2000991F880F991F860F971F680F791F610F60
:109F3000711D60537040F7010894E11CF11C1491ED
:109F4000812F80538A3040F3EFEF6F3F7E0714F488
:109F50006FEF7FEF062F86CFF60182E090E0C80E0C
:109F6000D91E808191814C01AA24BB2481CF0E94FB
:109F7000B14E68CF1A3251F4F60182E090E0C80E7B
:109F8000D91E208022200CF068CF219490E1392A3C
:109F9000EFED3E2262CF98E0392A5FCF1836C9F044
:109FA0001C36D1F481E0382A58CF34FC56CFF0E289
:109FB0003F2A53CFF60182E090E0C80ED91E60819F
:109FC00071819FEF6F3F790714F46FEF7FEF062FDA
:109FD00044CF24E0322A41CF133609F44DC1143462
:109FE00009F41FC1143609F41CC1193609F419C14A
:109FF0001F3409F40FC11F3609F40CC1103709F4DE
:10A00000F9C0133709F4B2C0153509F4ECC015379F
:10A0100009F4E9C0183509F444C0183709F441C0FF
:10A02000112309F44FC1CE0101969DA78CA7198376
:10A0300081E0482E19A6632C7724042D5FA45418C0
:10A0400057FC2DC029A5222331F10F5F050DC30157
:10A0500080739070892B09F42FC1222309F027C146
:10A0600066FC1BC1C30180739070809709F410C116
:10A07000852D0E94DA4E842D992787FD9095BC018D
:10A080008CA59DA50E94964E64FECCCE822D801B91
:10A090000E94CE4EC7CE66FED9CF0E5FD7CF5524D5
:10A0A000D1CFE0E1EEA733FE07C081149104A104F3
:10A0B000B10411F0F0E43F2A19A60FA707FD02C072
:10A0C0002FED3222CE0189969DA78CA78114910491
:10A0D000A104B10419F49FA5992361F1EEA54E2EB8
:10A0E00055246624772418AA84149504A604B7047A
:10A0F00010F0F1E0F8ABC501B401A30192010E9498
:10A100002E61DC01CB01082F8A30F0F4005DECA554
:10A11000FDA50293FDA7ECA7C501B401A30192011F
:10A120000E942E6149015A01F8A9FF23E1F62EA5EC
:10A13000283079F0632C7724CE010196482EFCA5B7
:10A140004F1A28E2420E79CF095A183501F70F7DD0
:10A15000DECF632C772463FEEFCF003369F380E317
:10A16000ECA5FDA58293FDA7ECA7E6CFF60182E062
:10A1700090E0C80ED91E0190F081E02DFDA7ECA75C
:10A18000EF2B81F4FE013196FDA7ECA788E28983CD
:10A190008EE6818385E78B838CE68C838D8389E2D1
:10A1A0008E831F8207FD15C0802F992787FD90950C
:10A1B000AC0160E070E08CA59DA50E94D75F009780
:10A1C00031F0482EFCA54F1A04150CF033CF402E69
:10A1D00031CFECA5FDA501900020E9F731974E2E77
:10A1E0002CA5421A27CF153511F481E0382A9AE0C0
:10A1F0009EA762CFF60182E090E0C80ED91E808152
:10A2000091814C01AA24BB2490E19EA7E0E43E2A60
:10A2100018E752CF1F3411F4E1E03E2AF8E0FEA720
:10A220004BCF143411F491E0392A30FE18C0F601F6
:10A2300084E090E0C80ED91E80809180A280B38017
:10A24000B7FE0AC0B094A09490948094811C911C95
:10A25000A11CB11C8DE289A79AE09EA72ECFF60122
:10A2600082E090E0C80ED91E808191814C01AA2421
:10A2700097FCA094BA2CE4CFFE013196FDA7ECA781
:10A28000F60182E090E0C80ED91E80818983D0CE8D
:10A29000822D801B0E94DA4EEBCE80E38AA71BA79B
:10A2A00062E070E0CE018A960E94964EDBCE61E0BD
:10A2B00070E0CE018996F8CF822D801B0E94CE4E91
:10A2C00029A5CBCEE0960FB6F894DEBF0FBECDBF6A
:10A2D000DF91CF911F910F91FF90EF90DF90CF9082
:10A2E000BF90AF909F908F907F906F905F904F90B6
:10A2F0003F902F90089583EC8093810080916F00B0
:10A30000806280936F001092A3041092A2041092B6
:10A31000A5041092A4041092A7041092A604089514
:10A320001F920F920FB60F921124EF92FF920F938C
:10A330001F932F933F934F935F936F937F938F93CD
:10A340009F93AF93BF93CF93DF93EF93FF932091AE
:10A3500086003091870080911C0590911D05281B77
:10A36000390B809186009091870090931D05809312
:10A370001C05C9018D549440835F9A4178F4809103
:10A380001E0590911F05049714F01092BB03C1E0C5
:10A39000D0E0D0931F05C0931E05A3C0C0911E0539
:10A3A000D0911F05CA30D1050CF09BC0C9018B5F4D
:10A3B0009040845B9140A8F0FE013196F0931F0518
:10A3C000E0931E05E530F10509F46DC05D98E630B7
:10A3D000F10509F466C05C98379709F460C05B9892
:10A3E00080C0225D3140FE01EC0FFD1FE653F74FA8
:10A3F00080819181F901E81BF90BCF01F7FD6DC058
:10A40000069754F480914004883C08F05FC0809126
:10A410004004865F80934004FE01EC0FFD1FE6536D
:10A42000F74F80819181AC01440F551F480F591F90
:10A43000420F531F57FD4EC07A01F594E794F594EF
:10A44000E794C90101968E159F05BCF50894E108B3
:10A45000F10880914004833C40F18E010C0F1D1FD8
:10A46000F801E653F74F808191819701281B390B42
:10A47000C90163E070E00E941B61CB01880F991F46
:10A48000860F971F0052174FF80191838083FE01BA
:10A49000EC0FFD1FE653F74FF182E0828DCF5B9A00
:10A4A00020C05C9A99CF5D9A92CFFE01EC0FFD1F00
:10A4B000E052F74F11821082EACF21503040E2166D
:10A4C000F3063CF60894E11CF11CC3CF88EC8093A2
:10A4D0004004A2CF4D5F5F4FAFCF909581959F4FC6
:10A4E0008FCFFF91EF91DF91CF91BF91AF919F916E
:10A4F0008F917F916F915F914F913F912F911F911C
:10A500000F91FF90EF900F900FBE0F901F90189536
:10A510001F920F920FB60F9211242F933F935F93C8
:10A520006F937F938F939F93AF93BF93EF93FF931B
:10A5300080912705882329F08091270581508093F9
:10A54000270580912F0581508F3F09F493C0809398
:10A550002F058091280590912905029700F180919F
:10A560002805909129050197909329058093280546
:10A5700080912805909129052091BC033091BD035D
:10A5800082239323892B89F0809156038A3009F422
:10A590008BC0479A8091050883FF8DC010C08FEF54
:10A5A0009FEF9093BD038093BC03809156038A3044
:10A5B00009F478C047988091050883FF7CC086B174
:10A5C0009927FC01E071F07084FF0AC080912A0590
:10A5D00090912B05019690932B0580932A056BC0D3
:10A5E00080912A0590912B05892B49F180912A05AC
:10A5F00090912B058A56914010F580912A059091F3
:10A600002B0569E270E00E94076180912A05909114
:10A610002B05860F971F90932B0580932A05809119
:10A620002A0590912B050B9708F440C080912A05CC
:10A6300090912B050A979093550480935404809130
:10A640005404909155042091520430915304821B7C
:10A65000930B845E9D4F68E671E00E941B61845BF2
:10A66000904090934F0480934E0410922B051092CB
:10A670002A0521C089E080932F058091BE038F5F5A
:10A6800081708093BE03882319F481E080932C05A8
:10A6900080912D0590912E05019690932E05809323
:10A6A0002D0557CF5A9887CF5A9A85CFF0935504E6
:10A6B000E0935404C4CFFF91EF91BF91AF919F916C
:10A6C0008F917F916F915F913F912F910F900FBE6E
:10A6D0000F901F90189520912D0530912E05280F71
:10A6E000391FC9010196089520912D0530912E053D
:10A6F000821B930B892F99278695807490700895FB
:10A70000CF93DF930E946B53EC01CE010E947453F0
:10A710008823D9F3DF91CF9108951F93CF93DF93CF
:10A720000E946B53EC011FEC08C080910603882344
:10A7300021F09093060310937A00CE010E94745387
:10A74000982F882391F3DF91CF911F9108959FB7A0
:10A75000F894579A5F983E9A469A8091B0008F700D
:10A760008093B0008091B00083608093B0008091AE
:10A77000B1008B738093B1008091B1008B608093A6
:10A78000B1001092B2008FEF8093B3008091B000BF
:10A7900080688093B000809170008A7F8093700001
:10A7A000809170008260809370009FBF08958AE05E
:10A7B00090E00E946B53909337058093360582E0BA
:10A7C00085BD83EA84BD17BC88E788BD86E086BD69
:10A7D00080916E00816080936E0008951F920F92A9
:10A7E0000FB60F9211242F933F934F935F936F9364
:10A7F0007F938F939F93AF93BF93EF93FF9380913A
:10A8000056038431C0F480913005882309F446C092
:10A81000209131053091320541E02F37340708F49B
:10A820009CC08FEF8093B3002F5F30403093320590
:10A83000209331056EC380913005882349F78091BC
:10A84000B00086FFADC08091B0008F7B8093B000D8
:10A85000E0913505EE2309F0EEC080912308282F02
:10A8600033278DED96E0289FA001299F500D389F3A
:10A87000500D1124CA012091330530913405821BFB
:10A88000930B90933205809331051092340510920A
:10A890003305469A81E080933005BACF8091B000AD
:10A8A00086FFA7C08091B0008F7B8093B00089EABB
:10A8B00093E090933205809331058091BF0390918E
:10A8C000C0039C01220F331F280F391F80912203E0
:10A8D0009927880F991F880F991F280F391F37FD57
:10A8E00034C2C90195958795959587959093C00336
:10A8F0008093BF039093230580932205809149089C
:10A9000080FFDCC080912008682F7727882799274F
:10A9100020918E0430918F044091900450919104C5
:10A9200057FDF8C1E7E05595479537952795EA9586
:10A93000D1F70E94DC609B01AC0197FD09C2B6E033
:10A940005595479537952795BA95D1F7809122056A
:10A9500090912305820F931FDBC02F3F310569F0D3
:10A9600060F0A9014F5F50404F37510588F480E8EF
:10A970008093B3002058304059CF809131058093A7
:10A98000B300109232051092310510923005C1C209
:10A990008FEF8093B3005093320540933105B9C2D5
:10A9A0008091B00080648093B0008CEB90E0909335
:10A9B000320580933105809133059091340584549C
:10A9C0009F4F90933405809333058091260588230B
:10A9D00029F080914004853B08F0F9C0909135053D
:10A9E0009F5F80912308891708F0EEC0109235050B
:10A9F00051CF8091B00080648093B0008091230893
:10AA0000282F33278DED96E0289FA001299F500D18
:10AA1000389F500D1124CA0120913305309134051F
:10AA2000821B930B90933205809331059C0181E04A
:10AA300080933005F1CE89EA93E0909332058093BC
:10AA400031058E2F99278130910509F4C2C00297F4
:10AA500009F488C1FF27EE0FFF1FE653F74F8081EF
:10AA60009181880F991F2091310530913205820F15
:10AA7000931F9093320580933105209131053091D9
:10AA8000320555E02D3D350708F450C18CED95E0B9
:10AA900090933205809331059C012C5B30403093BC
:10AAA0003205209331058091330590913405820F52
:10AAB000931F9093340580933305ECCE809120084A
:10AAC000682F77278827992720918E0430918F044B
:10AAD000409190045091910457FD17C1A7E05595FE
:10AAE000479537952795AA95D1F70E94DC609B0181
:10AAF000AC0197FD32C1F6E05595479537952795FE
:10AB0000FA95D1F78091220590912305821B930B32
:10AB1000909323058093220580912108282F3327C5
:10AB2000220F331F220F331F80912205909123059E
:10AB3000821793077CF080912208282F3327220F59
:10AB4000331F220F331F8091220590912305281770
:10AB5000390724F430932305209322052091220500
:10AB6000309123058091310590913205280F391FCE
:10AB700020503240809122059091230597FDE3C03B
:10AB800095958795959587959093230580932205B4
:10AB900080912205909123059093CD078093CC0757
:10ABA00045E02D3D340708F4BAC08CED95E0909354
:10ABB0003205809331052091310530913205309373
:10ABC00034052093330533CF9093350563CE4698F3
:10ABD00005CF8091BF039091C0039C01220F331FCA
:10ABE000280F391F809122039927880F991F880FFA
:10ABF000991F280F391F37FD66C1C90195958795A3
:10AC0000959587959093C0038093BF0390932305F8
:10AC1000809322058091490880FF28C180912008F7
:10AC2000682F77278827992720918E0430918F04E9
:10AC3000409190045091910457FD5CC1A7E0559557
:10AC4000479537952795AA95D1F70E94DC609B011F
:10AC5000AC0197FD4AC1F6E0559547953795279584
:10AC6000FA95D1F78091220590912305820F931FC9
:10AC7000909323058093220580912108282F332764
:10AC8000220F331F220F331F80912205909123053D
:10AC9000821793077CF080912208282F3327220FF8
:10ACA000331F220F331F809122059091230528170F
:10ACB000390724F43093230520932205809122053F
:10ACC000909123052091310530913205820F931F19
:10ACD00080509240909332058093310580912205F7
:10ACE0009091230597FDEDC095958795959587954E
:10ACF000909323058093220580912205909123054E
:10AD00009093CD078093CC07B8CE21583F4F4F4F3B
:10AD10005F4FE4CE21583F4F4F4F5F4F03CE51E07E
:10AD20002737350758F487E791E041CF81E027378F
:10AD3000380708F0B2CE87E791E0AACE309332050B
:10AD40002093310538CF03961BCF2D5F3F4FC9CDE0
:10AD5000215C3F4F4F4F5F4FF2CD215C3F4F4F4F34
:10AD60005F4FC9CE8091C1039091C2039C01220F15
:10AD7000331F280F391F205C3E4F37FDB3C0C90178
:10AD800095958795959587959093C2038093C10378
:10AD9000909321058093200560918604709187042B
:10ADA000809188049091890497FD97C0F7E095956C
:10ADB000879577956795FA95D1F728EC30E040E0D4
:10ADC00050E00E94DC6097FD81C0272F382F492F6B
:10ADD000552747FD5A958091200590912105820FB6
:10ADE000931F909321058093200580912108282F9F
:10ADF0003327220F331F220F331F8091200590919C
:10AE00002105821793077CF080912208282F332791
:10AE1000220F331F220F331F8091200590912105AF
:10AE20002817390724F430932105209320058091B9
:10AE30002005909121052091310530913205820F36
:10AE4000931F8050924090933205809331058091FA
:10AE500020059091210597FD3EC095958795959584
:10AE60008795909321058093200507CE8091200837
:10AE7000682F77278827992720918E0430918F0497
:10AE8000409190045091910457FD3EC0E7E05595E4
:10AE9000479537952795EA95D1F70E94DC609B018D
:10AEA000AC0197FD2CC066E05595479537952795E1
:10AEB0006A95D1F78091220590912305821B930B0F
:10AEC000D7CE039611CF2D5F3F4F97CE61507F4F66
:10AED0008F4F9F4F7ACF0396C0CF61587F4F8F4FD0
:10AEE0009F4F64CF2D5F3F4F4ACF215C3F4F4F4F65
:10AEF0005F4FB1CE21583F4F4F4F5F4F9FCE215CE8
:10AF00003F4F4F4F5F4FCFCF21583F4F4F4F5F4F76
:10AF1000BDCFFF91EF91BF91AF919F918F917F91A5
:10AF20006F915F914F913F912F910F900FBE0F90B6
:10AF30001F9018951092B9008AE28093B800089586
:10AF400085EA8093BC00089584E98093BC0008954D
:10AF50001092B9008093BB0085E88093BC000895EF
:10AF60000E94A45710923B058091BB0010923A05B5
:10AF700080E88093BC001092BD001092BA0010923D
:10AF8000BB001092B9001092B8000E949A570E941C
:10AF9000A05780E00E94A85708958093BB0085E8E1
:10AFA0008093BC00089585EC8093BC00089585E8EB
:10AFB0008093BC0008951F920F920FB60F92112438
:10AFC0002F933F934F935F936F937F938F939F93B1
:10AFD000AF93BF93EF93FF9380913B05282F3327C7
:10AFE000442755278F5F80933B05F90127313105B1
:10AFF000C8F4E05BFF4FEE0FFF1F0590F491E02DCA
:10B00000099480913905E82FFF27EA50F74F909176
:10B01000BB0090838F5F8C3008F49DC0109239057F
:10B020000E94A45710923B05E0C080E80E94A857F8
:10B03000DCC088E90E94A857D8C00E94A4578AE0C3
:10B0400090E090933A03809339030E94A057CDC0BB
:10B0500084E10E94A857C9C082E10E94A857C5C0D8
:10B06000809109030E94A857C0C080E10E94A857A0
:10B07000BCC0809108030E94A857B7C08091070305
:10B080000E94A857B2C080913A05E82FFF27E655E5
:10B09000F74F8F5F80933A0580810E94A857A5C023
:10B0A00090913A05292FE92FFF27EE0FFF1FEE0F92
:10B0B000FF1FEB5AF84F858518160CF054C09C30D2
:10B0C00009F467C0990F892F8E5A0E94A8578DC026
:10B0D00080913905E82FFF27EE5EF64F8091BB0087
:10B0E00080830E94D75781C08091B900803409F4D1
:10B0F0006EC080913905E82FFF27EE5DF64F108274
:10B100008F5F8C3068F1109239050E94A45710921D
:10B110003B0580913C058093380510923C0565C045
:10B120008091B900803309F440C00E94A4578AE09E
:10B1300090E090933A038093390310923B050E946C
:10B14000A05753C00E94A4578AE090E090933A031E
:10B150008093390367CF809339050E94A45762CF4B
:10B1600080933905D2CF9C3008F0A9CF922F9F5FF2
:10B17000E92FFF27EE0FFF1FEE0FFF1FEB5AF84FCF
:10B18000858518161CF0292F9C3080F390933A0582
:10B1900096CF10923A0583E080933B058091390564
:10B1A000880F8D5A0E94A85720C080913C058823A3
:10B1B000C9F490913A0590933C05E92FFF27EB5F86
:10B1C000F64F80818F5F09F48FEF8083AECF80913F
:10B1D0003905E82FFF27EE5DF64F8C5F80830E94D4
:10B1E000D35797CF90913A05E8CF8091BC00806803
:10B1F0008093BC00FF91EF91BF91AF919F918F9190
:10B200007F916F915F914F913F912F910F900FBE62
:10B210000F901F90189587B18C6087B9429843981A
:10B2200010923E0580E88093C40310923D05809300
:10B23000C30308958091430581508F3F19F0809397
:10B240004305089584E080934305909134089B3F23
:10B2500060F49B3FA0F0809183088A3080F4809155
:10B260003308882354F0429A11C080918308873EA6
:10B2700080F3809133088823B4F3429807C080910B
:10B280003E0581508F3FB9F180933E05909136087D
:10B290009B3F50F08091B608873E30F08091350892
:10B2A000882364F0439808959B3F50F08091B6083E
:10B2B0008A3030F4809135088823A4F3439A0895A6
:10B2C00080913D0581508F3F19F080933D05089591
:10B2D0008091B608815080933D058091C3038130F1
:10B2E000F1F0982F96959093C303809135088923A8
:10B2F000C9F2439A089580918308815080933E0556
:10B300008091C403813069F0982F96959093C4037F
:10B3100080913308892309F4B0CF429AB7CF90E8DF
:10B32000E2CF90E8F3CF84B1806A84B93D9A82E598
:10B330008CBD1DBC459A81E080932E098AEA8093DA
:10B34000320983E8809333098AE0809334091092AC
:10B350003609109235091092380910923709109267
:10B36000900910925409109255098AE48093560965
:10B3700083E08093570986E0809358090895EF92FF
:10B38000FF920F931F93F894809111089927880FCB
:10B39000991F880F991F7C010027F7FC0095102F3B
:10B3A00080918E0490918F04A0919004B0919104AB
:10B3B000BC01CD01A80197010E945061309336096C
:10B3C000209335098091860490918704A091880488
:10B3D000B0918904BC01CD01A80197010E94506180
:10B3E00030933809209337092091BF083091C00865
:10B3F0004091C1085091C208DA01C90173E0880F79
:10B40000991FAA1FBB1F7A95D1F7820F931FA41F04
:10B41000B51F820F931FA41FB51F209117033091F2
:10B4200018034091190350911A03BC01CD010E94E9
:10B43000506130933E0920933D09E0919804F091CA
:10B4400099048091810890918208BF010E941B613C
:10B45000CB019B01220F331F220F331F280F391FEF
:10B46000280F391F37FDF2C035952795359527955B
:10B4700030933A09209339098091BB089091BC0818
:10B48000BF010E941B619B01220F331F220F331F3C
:10B49000260F371F260F371F37FDD5C03595279547
:10B4A0003595279530933C0920933B0910929904D8
:10B4B0001092980410928208109281081092BC0891
:10B4C0001092BB088091340999278C30910509F4BA
:10B4D0008AC08D3091050CF06AC08A30910509F45C
:10B4E00033C10B9709F4B5C078948091540988232F
:10B4F00009F4A0C020915A0930915B09C90181501B
:10B500009E4F8F5F9340C8F440915C0950915D0954
:10B51000CA0181509E4F8F5F934078F48091050857
:10B5200085FF0BC030931605209315055093140525
:10B53000409313058AEF80934505809160099091AF
:10B54000610921E0893692070CF0E8C09C019093D4
:10B550005504809354048091520490915304281B05
:10B56000390BC901845E9D4F68E671E00E941B6142
:10B57000845B904090934F0480934E042091640923
:10B5800030916509809128059091290582179307CC
:10B5900040F48091B006882321F43093290520934C
:10B5A000280580915909873609F055C1BCC08D30F6
:10B5B000910509F404C10E9709F096CF80915509C1
:10B5C00080934509809156098093460980915709D7
:10B5D00080934709809158098093480980915603C8
:10B5E0008093490981CF8091B006863018F010927F
:10B5F000B00685E08093450980913504909136042A
:10B6000090934809809347098091460880934609A2
:10B6100080913C088093490980913D0880934A09B4
:10B6200080913E0880934B09789480915409882337
:10B6300009F060CF109216051092150510921405AE
:10B640001092130508C12D5F3F4F28CF2D5F3F4F4C
:10B650000BCF8091FF07E82FFF27EE0FFF1FE65368
:10B66000F74F0190F081E02DE038F1050CF0D8C0E3
:10B670002FEFE138F20714F4E1E8FFEFE09345091A
:10B6800080910008E82FFF27EE0FFF1FE653F74FCA
:10B690000190F081E02DE038F1050CF4D4C0EFE723
:10B6A000F0E0E09346098091FE07E82FFF27EE0FB8
:10B6B000FF1FE653F74F0190F081E02DE038F105D0
:10B6C0000CF4B9C0EFE7F0E0E09347098091FD0783
:10B6D000E82FFF27EE0FFF1FE653F74F0190F08191
:10B6E000E02DE038F1050CF49EC0EFE7F0E0E093C8
:10B6F00048098091470480934909809145048093CB
:10B700004A098091430480934B09809141048093BE
:10B710004C098091400480934D09E6CE2091540459
:10B720003091550418CF8091660980938D098091DE
:10B73000670980938F098091680980938E098091B1
:10B7400069098093900987C08091280480934509F6
:10B7500080912704809346098091260480934709AD
:10B76000809125048093480980912404809349099D
:10B770008091230480934A098091220480934B098D
:10B780008091210480934C098091140480934D0989
:10B7900080911404837F809314048091140390910A
:10B7A000150380934E098091160880934F09A2E0FB
:10B7B000B0E00E94BB60802D8093500995CE8091AF
:10B7C0003708809345098091380880934609809115
:10B7D00039088093470980913A08809348098091FD
:10B7E0003B088093490980913F0880934A098091E2
:10B7F000400880934B098091410880934C098091C7
:10B80000440880934D098091420880934E098091AD
:10B81000430880934F09809145088093500964CE76
:10B82000EFE7F0E02BCF8FEFE138F8070CF05FCFB8
:10B83000E1E8FFEF5CCF6FEFE138F6070CF044CFA3
:10B84000E1E8FFEF41CF4FEFE138F4070CF029CFEB
:10B85000E1E8FFEF26CF1F910F91FF90EF90089541
:10B8600080912E09882309F43BC0459882E399E032
:10B870009093300980932F0980914405E82FFF278A
:10B88000EB53FC4F982F9F5F808180933409963053
:10B8900008F027C09093440510922E090E94BF59CA
:10B8A00081E08093310900000000000000000000EA
:10B8B0000000000000000000000000000000000088
:10B8C0000000000000000000000000000000000078
:10B8D00000000000000080913209809351098EBD64
:10B8E000089510924405D8CF20912E09222309F003
:10B8F00045C00DB407FE42C084E080932705459AF9
:10B900003EB58091460599278130910509F437C0ED
:10B91000823091050CF451C0029709F439C020918E
:10B920003109203208F030C04598000000000000C6
:10B930000000000000000000000000000000000007
:10B9400000000000000000000000000000000000F7
:10B9500000000000000000000000E0912F09F091BD
:10B960003009E20FF11D80818EBD809151099081D7
:10B97000890F809351092F5F209331090895353540
:10B9800051F120934605CBCF81E080932E09F3CF70
:10B9900080915309E82FFF27ED58F64F30838F5FD2
:10B9A000809353098A3100F180914705381711F1CE
:10B9B0002093540910924605B2CF892B09F0AFCFDE
:10B9C0002093530930934705313809F0A8CF81E01F
:10B9D00080934605A4CF80914705830F8093470548
:10B9E00082E0809346059BCF80914705830F80932B
:10B9F000470595CF8AE1E3E7F9E0A9E5B9E00190D1
:10BA00000D928A95E1F781E08093540910924605E2
:10BA100086CF8091C9008F778093C9008091C9003B
:10BA20008F7B8093C9008091C9008F7D8093C9006E
:10BA30005A9A52981092CD0084E190E08093CC0005
:10BA40008091C80082608093C80080E18093C90023
:10BA50008091CA008F778093CA008091CA008F7B43
:10BA60008093CA008091CA008F7D8093CA00809124
:10BA7000CA008F7E8093CA008091CA00877F80931E
:10BA8000CA008091C9008B7F8093C9008091CA0051
:10BA900084608093CA008091CA0082608093CA004B
:10BAA0008091C80087FF0CC08091CE008091C800B3
:10BAB000882334F48091CE008091C8008823A4F3B9
:10BAC0008091C90080688093C90008951F93CF9327
:10BAD000DF9380E197E20E946B53EC0110E08091CC
:10BAE000C9008F778093C9008091C9008F7E8093B1
:10BAF000C9005A9886EE96E09F938F931F930E94F9
:10BB0000E64E0F900F900F90CE010E947453882341
:10BB100009F066C04A9BF8CF8AE590E00E946B531B
:10BB2000EC018CE197E09F938F931F920E94E64E69
:10BB3000529A0F900F900F90CE010E947453882359
:10BB4000D9F383E690E05A9A019797FFFCCF8FE8EC
:10BB500091E05A98019797FFFCCF89E090E05A9ABC
:10BB6000019797FFFCCF89E090E05A98019797FFE3
:10BB7000FCCF8FE891E05A9A019797FFFCCF8FE8AE
:10BB800091E05A98019797FFFCCF89E090E05A9A8C
:10BB9000019797FFFCCF89E090E05A98019797FFB3
:10BBA000FCCF8FE891E05A9A019797FFFCCF8FE87E
:10BBB00091E05A98019797FFFCCF89E090E05A9A5C
:10BBC000019797FFFCCF89E090E05A98019797FF83
:10BBD000FCCF8FE891E05A9A019797FFFCCF0AC0FB
:10BBE00082E297E09F938F931F930E94E64E0F90FF
:10BBF0000F900F9052985A980E94095DDF91CF9153
:10BC00001F9108951F920F920FB60F921124EF9279
:10BC1000FF920F931F932F933F934F935F936F93D5
:10BC20007F938F939F93AF93BF93CF93DF93EF93C4
:10BC3000FF930091CE008091CB039091CC030197AC
:10BC400009F45EC080915005909151050E94745393
:10BC5000482F552760914805709149056115710578
:10BC6000E9F16130710509F4EAC06230710509F447
:10BC7000EDC06330710509F45CC081E090E0909301
:10BC8000CC038093CB0310924B0510924A0510927F
:10BC90004F0510924E0580914A0590914B054097B3
:10BCA000A0F080914E0590914F05892B11F41092D0
:10BCB000BB0310924B0510924A0510924F0510924B
:10BCC0004E05109249051092480587E090E00E94C9
:10BCD0006B539093510580935005FDC0452BD9F2CD
:10BCE00081E090E0909349058093480580914A0552
:10BCF00090914B05019690934B0580934A05CBCFCD
:10BD00001092CC031092CB0387E090E00E946B531B
:10BD1000909351058093500510924B0510924A055F
:10BD2000109249051092480510924D0510924C054D
:10BD3000D2C0452B09F0A1CF82E090E09093490555
:10BD40008093480580914A0590914B050196909308
:10BD50004B0580934A0580914C0590914D05FC015F
:10BD6000F695E795F695E795EF70F0703196982F78
:10BD70008827202F3327822B932B9370805092405B
:10BD80000E941B61EB30F10508F085CF7F01EE0EBC
:10BD9000FF1EF701E653F74F808191819B01281B1D
:10BDA000390BC90137FD90C0069754F480914004C7
:10BDB000883C08F087C080914004865F80934004EF
:10BDC000F701E653F74F808191819C01220F331FC9
:10BDD000280F391F260F371F37FD7AC0E901D59587
:10BDE000C795D595C795CB0101968C179D070CF08B
:10BDF0005CC0219780914004843B08F450C08701C7
:10BE00000052174FF701E653F74F80819181FE01F1
:10BE1000E81BF90BCF0163E070E00E941B61CB01CE
:10BE2000880F991F860F971FF801918380832AEC52
:10BE300038E0E20EF31EF701D183C0832CCF411509
:10BE4000510509F012CF82E090E04CCF4115510529
:10BE500009F00FCF802F992790934D0580934C05C3
:10BE600020914A0530914B052230310569F083E07D
:10BE700090E090934905809348052F5F3F4F3093A2
:10BE80004B0520934A0507CF80914C0587FF15C0CD
:10BE900081E090E090934F0580934E05E8CFF70145
:10BEA000E052F74F11821082C2CF61507040C61726
:10BEB000D7070CF09FCF21969DCF50934F0540930D
:10BEC0004E05D5CF88EC7ACF909581959F4F6CCF5A
:10BED0002D5F3F4F83CFFF91EF91DF91CF91BF91C6
:10BEE000AF919F918F917F916F915F914F913F9112
:10BEF0002F911F910F91FF90EF900F900FBE0F9019
:10BF00001F901895CF93FC0197FD21C0C1E028E652
:10BF100031E0CF01B9010E941B61FC018B35910515
:10BF200054F08B5590408A35910538F484EB90E0BD
:10BF30008E1B9F0BFC0141E013C0CF01855B90403D
:10BF40008A35910548F4E45BF0404FEF09C0CFEF2C
:10BF5000F095E195FF4FDBCF2E1B3F0BF9014FEF23
:10BF6000EE0FFF1FE35DF84F259134918C2F992739
:10BF700087FD9095829FB001839F700D929F700DF9
:10BF80001124842F992787FD9095689FA001699FB0
:10BF9000500D789F500D1124CA01CF9108952AE5C4
:10BFA00030E0281B390BC9010E94825F0895FC0113
:10BFB0004150504030F001900616D1F73197CF0133
:10BFC00008958827992708955058192EA6D001D092
:10BFD0008CC0BA176207730784079507B1F188F41C
:10BFE0000EF410940B2EBA2FA02D062E622F202DAA
:10BFF000072E732F302D082E842F402D092E952FBC
:10C00000502DFF275523B9F0591B49F0573E98F0A2
:10C01000469537952795A795F0405395C9F776F043
:10C02000BA0F621F731F841F30F487957795679549
:10C03000B795F040939517FA0F2E0895BF1BBB27B5
:10C04000BA0B620B730B840BF6CFDEF692C097FB34
:10C0500070D09F3738F0FEE9F91B982F872F762F85
:10C060006B2F05C083C09695879577956795F1509E
:10C07000D0F73EF490958095709561957F4F8F4FE6
:10C080009F4F0895E89403C097FB0EF4F3DFB62F9B
:10C09000672F782F892F9EE9002427C00ED05EF0ED
:10C0A00004C00BD026F001C008D019F020F48FEFA7
:10C0B000089580E0089581E0089597FB092E0526F4
:10C0C00000F868942DD0E89407FC07C06217730746
:10C0D0008407950721F008F4009407949894089534
:10C0E0009A95BB0F661F771F881F11249923A1F013
:10C0F0008823B2F79F3F59F0BB0F48F421F400208A
:10C1000011F460FF04C06F5F7F4F8F4F9F4F881FF8
:10C110009795879597F9089529C0052E092607FA5E
:10C12000440F551F5F3F79F0AA27A51708F051E08B
:10C130004795880F991F9F3F31F0BB27B91708F02B
:10C1400091E0879508959F919F91112432C097FBAC
:10C15000880F991F9F3F31F0BB27B91708F091E076
:10C16000879508959F919F91112423C06627772773
:10C17000882799270895F999FECFB2BDA1BDF89AF5
:10C18000119600B40895F7DF01921A94E1F708952B
:10C19000F999FECFB2BDA1BD00BC11960FB6F894BF
:10C1A000FA9AF99A0FBE08950190F2DF1A94E1F716
:10C1B00008959FEF80EC0895629FD001739FF00176
:10C1C000829FE00DF11D649FE00DF11D929FF00D27
:10C1D000839FF00D749FF00D659FF00D9927729F5E
:10C1E000B00DE11DF91F639FB00DE11DF91FBD01E9
:10C1F000CF0111240895991B79E004C0991F961767
:10C2000008F0961B881F7A95C9F780950895AA1B98
:10C21000BB1B51E107C0AA1FBB1FA617B70710F031
:10C22000A61BB70B881F991F5A95A9F78095909563
:10C23000BC01CD01089597FB092E07260AD077FD92
:10C2400004D0E5DF06D000201AF4709561957F4F89
:10C250000895F6F7909581959F4F0895A1E21A2EC3
:10C26000AA1BBB1BFD010DC0AA1FBB1FEE1FFF1F9A
:10C27000A217B307E407F50720F0A21BB30BE40BEA
:10C28000F50B661F771F881F991F1A9469F7609531
:10C290007095809590959B01AC01BD01CF010895EB
:10C2A00097FB092E05260ED057FD04D0D7DF0AD004
:10C2B000001C38F450954095309521953F4F4F4FD5
:10C2C0005F4F0895F6F790958095709561957F4F33
:06C2D0008F4F9F4F0895FF
:10C2D600416E676C654E69636B202020202020200C
:10C2E600416E676C65526F6C6C20202020202020E8
:10C2F6004163634E69636B2020202020202020208C
:10C30600416363526F6C6C20202020202020202067
:10C316004779726F476965722020202020202020EF
:10C3260048696768742056616C7565202020202056
:10C336004163635A20202020202020202020202016
:10C34600476173202020202020202020202020202C
:10C35600436F6D706173732056616C756520202084
:10C36600566F6C74616765202020202020202020D5
:10C37600456D7066616E67202020202020202020D9
:10C386004779726F204B6F6D706173732020202088
:10C396004D6F746F722046726F6E742020202020BD
:10C3A6004D6F746F7220526561722020202020200C
:10C3B6004D6F746F72204C656674202020202020FB
:10C3C6004D6F746F72205269676874202020202098
:10C3D6002020202020202020202020202020202057
:10C3E6002020202020202020202020202020202047
:10C3F6002020202020202020202020202020202037
:10C406004D4B334D61672043616C537461746520F5
:10C41600536572766F2020202020202020202020A7
:10C426002020202020202020202020202020202006
:10C4360020202020202020202020202020202020F6
:10C4460020202020202020202020202020202020E6
:10C4560020202020202020202020202020202020D6
:10C4660020202020202020202020202020202020C6
:10C4760020202020202020202020202020202020B6
:10C486004B616C6D616E5F4D6178447269667420B4
:10C496002020202020202020202020202020202096
:10C4A6004E6176692053657269616C2044617461DE
:10C4B6004750535F4E69636B2020202020202020A8
:10C4C6004750535F526F6C6C202020202020202084
:10C4D600C8000164FF0101737373FF03007D000050
:10C4E600C409C4096400040B050000ECFF64404164
:10C4F6005A46640A02969608403A10FB3038019074
:10C50600D0030090D00300F401640053706F72747E
:10C5160000004E6F726D616C0000426567696E6E59
:10C526006572000064010A0151756164726F000052
:10C536000D48616C6C6F2057656C7400000000003C
:10C5460000000000000000000000000000000000E5
:10C5560000000000000000000000000000000000D5
:10C5660000000000000000000000000000000000C5
:10C5760000000000000000000000000000000000B5
:10C58600000102030405060708090A01FFFF01FC72
:0EC5960001FC0101010A0B0D0B0C0E0100004F
:00000001FF
/branches/V0.74d-acid/Hex-Files/WasIstWas.txt
0,0 → 1,51
+++++++++++++++++++++++++
+ Flight-Ctrl:
+++++++++++++++++++++++++
BootLoader_MEGA644_20MHZ_V0_1.hex
Der Bootloader wird per ISP eingespielt
Der Bootloader nur dann eingespielt werden, wenn noch nie ein Bootloader eingespielt wurde!
Danach können Softwareupdates seriell eingespielt werden.
 
Flight-Ctrl_MEGA644_Vx_yy.hex
Aktuelle Firmware
Wird per serielle Schnittstelle (durch den Bootloader) eingespielt
 
 
 
 
//+++++++++++
// Quadro:
// 1
// 4 3
// 2
//+++++++++++
// Reverse Props on 1 2
 
//+++++++++++
// Octo:
// 1 2
// 8 3
// 7 4
// 6 5
//+++++++++++
 
//+++++++++++
// Octo2:
// 1
// 8 2
// 7 3
// 6 4
// 5
//+++++++++++
 
//+++++++++++
// Octo3:
// 1
// 2
// 8 7 3 4
// 5
// 6
//+++++++++++
// Reverse Props on octo: 1 3 5 7
 
/branches/V0.74d-acid/License.txt
0,0 → 1,52
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + Nur für den privaten Gebrauch
// + 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 und nichtkommerziellen 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 und genannt 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 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 permittet
// + for non-profit 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, our webpage (http://www.MikroKopter.de) must be
// + clearly linked and named as origin
// + * porting to systems other than 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.
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/branches/V0.74d-acid/Settings.h
--- Spectrum.c (nonexistent)
+++ Spectrum.c (revision 1300)
@@ -0,0 +1,310 @@
+/*#######################################################################################
+Decodieren eines RC Summen Signals oder Spektrum Empfänger-Satellit
+#######################################################################################*/
+
+#include "Spectrum.h"
+#include "main.h"
+
+//--------------------------------------------------------------//
+
+//--------------------------------------------------------------//
+void SpektrumBinding(void)
+{
+ unsigned int timerTimeout = SetDelay(10000); // Timeout 10 sec.
+ unsigned char connected = 0;
+ unsigned int delaycounter;
+
+ UCSR1B &= ~(1 << RXCIE1); // disable rx-interrupt
+ UCSR1B &= ~(1<<RXEN1); // disable Uart-Rx
+ PORTD &= ~(1 << PORTD2); // disable pull-up
+
+ printf("\n\rPlease connect Spektrum receiver for binding NOW...");
+
+ while(!CheckDelay(timerTimeout))
+ {
+ if (PIND & (1 << PORTD2)) { timerTimeout = SetDelay(90); connected = 1; break; }
+ }
+
+ if (connected)
+ {
+
+ printf("ok.\n\r");
+ DDRD |= (1 << DDD2); // Rx as output
+
+ while(!CheckDelay(timerTimeout)); // delay after startup of RX
+ for (delaycounter = 0; delaycounter < 100; delaycounter++) PORTD |= (1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 400; delaycounter++) PORTD &= ~(1 << PORTD2);
+
+ for (delaycounter = 0; delaycounter < 10; delaycounter++) PORTD |= (1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 10; delaycounter++) PORTD &= ~(1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 400; delaycounter++) PORTD |= (1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 400; delaycounter++) PORTD &= ~(1 << PORTD2);
+
+ for (delaycounter = 0; delaycounter < 10; delaycounter++) PORTD |= (1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 10; delaycounter++) PORTD &= ~(1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 400; delaycounter++) PORTD |= (1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 400; delaycounter++) PORTD &= ~(1 << PORTD2);
+
+ for (delaycounter = 0; delaycounter < 10; delaycounter++) PORTD |= (1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 10; delaycounter++) PORTD &= ~(1 << PORTD2);
+ for (delaycounter = 0; delaycounter < 400; delaycounter++) PORTD |= (1 << PORTD2);
+
+ }
+ else
+ { printf("Timeout.\n\r");
+
+
+ }
+
+ DDRD &= ~(1 << DDD2); // RX as input
+ PORTD &= ~(1 << PORTD2);
+
+ Uart1Init(); // init Uart again
+}
+
+//############################################################################
+// zum Decodieren des Spektrum Satelliten wird USART1 benutzt.
+// USART1 initialisation from killagreg
+void Uart1Init(void)
+//############################################################################
+ {
+ // -- Start of USART1 initialisation for Spekturm seriell-mode
+ // USART1 Control and Status Register A, B, C and baud rate register
+ uint16_t ubrr = (uint16_t) ((uint32_t) SYSCLK/(8 * 115200) - 1);
+ // disable RX-Interrupt
+ UCSR1B &= ~(1 << RXCIE1);
+ // disable TX-Interrupt
+ UCSR1B &= ~(1 << TXCIE1);
+ // disable DRE-Interrupt
+ UCSR1B &= ~(1 << UDRIE1);
+ // set direction of RXD1 and TXD1 pins
+ // set RXD1 (PD2) as an input pin
+ PORTD |= (1 << PORTD2);
+ DDRD &= ~(1 << DDD2);
+ // USART0 Baud Rate Register
+ // set clock divider
+
+ UBRR1H = (uint8_t)(ubrr>>8);
+ UBRR1L = (uint8_t)ubrr;
+ // enable double speed operation
+ UCSR1A |= (1 << U2X1);
+ // enable receiver and transmitter
+ //UCSR1B = (1<<RXEN1)|(1<<TXEN1);
+
+
+
+
+ UCSR1B = (1<<RXEN1);
+ // set asynchronous mode
+ UCSR1C &= ~(1 << UMSEL11);
+ UCSR1C &= ~(1 << UMSEL10);
+ // no parity
+ UCSR1C &= ~(1 << UPM11);
+ UCSR1C &= ~(1 << UPM10);
+ // 1 stop bit
+ UCSR1C &= ~(1 << USBS1);
+ // 8-bit
+ UCSR1B &= ~(1 << UCSZ12);
+ UCSR1C |= (1 << UCSZ11);
+ UCSR1C |= (1 << UCSZ10);
+ // flush receive buffer explicit
+ while(UCSR1A & (1<<RXC1)) UDR1;
+ // enable RX-interrupts at the end
+ UCSR1B |= (1 << RXCIE1);
+ // -- End of USART1 initialisation
+ return;
+ }
+
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// + Copyright (c) Rainer Walther
+// + RC-routines from original MK rc.c (c) H&I
+// + Useful infos from Walter: http://www.rcgroups.com/forums/showthread.php?t=714299&page=2
+// + only for non-profit use
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// 20080808 rw Modified for Spektrum AR6100 (PPM)
+// 20080823 rw Add Spektrum satellite receiver on USART1 (644P only)
+// 20081213 rw Add support for Spektrum DS9 Air-Tx-Module (9 channels)
+// Replace AR6100-coding with original composit-signal routines
+//
+// ---
+// Entweder Summensignal ODER Spektrum-Receiver anschließen. Nicht beides gleichzeitig betreiben!
+// Binding is not implemented. Bind with external Receiver.
+// Servo output J3, J4, J5 not serviced
+//
+// Anschuß Spektrum Receiver
+// Orange: 3V von der FC (keinesfalls an 5V anschließen!)
+// Schwarz: GND
+// Grau: RXD1 (Pin 3) auf 10-Pol FC-Stecker
+//
+// ---
+// Satellite-Reciever connected on USART1:
+//
+// DX7/DX6i: One data-frame at 115200 baud every 22ms.
+// DX7se: One data-frame at 115200 baud every 11ms.
+// byte1: unknown
+// byte2: unknown
+// byte3: and byte4: channel data (FLT-Mode)
+// byte5: and byte6: channel data (Roll)
+// byte7: and byte8: channel data (Nick)
+// byte9: and byte10: channel data (Gier)
+// byte11: and byte12: channel data (Gear Switch)
+// byte13: and byte14: channel data (Gas)
+// byte15: and byte16: channel data (AUX2)
+//
+// DS9 (9 Channel): One data-frame at 115200 baud every 11ms, alternating frame 1/2 for CH1-7 / CH8-9
+// 1st Frame:
+// byte1: unknown
+// byte2: unknown
+// byte3: and byte4: channel data
+// byte5: and byte6: channel data
+// byte7: and byte8: channel data
+// byte9: and byte10: channel data
+// byte11: and byte12: channel data
+// byte13: and byte14: channel data
+// byte15: and byte16: channel data
+// 2nd Frame:
+// byte1: unknown
+// byte2: unknown
+// byte3: and byte4: channel data
+// byte5: and byte6: channel data
+// byte7: and byte8: 0xffff
+// byte9: and byte10: 0xffff
+// byte11: and byte12: 0xffff
+// byte13: and byte14: 0xffff
+// byte15: and byte16: 0xffff
+//
+// Each channel data (16 bit= 2byte, first msb, second lsb) is arranged as:
+//
+// Bits: F 0 C3 C2 C1 C0 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
+//
+// 0 means a '0' bit
+// F: 1 = indicates beginning of 2nd frame for CH8-9 (DS9 only)
+// C3 to C0 is the channel number. 0 to 9 (4 bit, as assigned in the transmitter)
+// D9 to D0 is the channel data (10 bit) 0xaa..0x200..0x356 for 100% transmitter-travel
+//
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//############################################################################
+//Diese Routine startet und inizialisiert den USART1 für seriellen Spektrum satellite reciever
+SIGNAL(USART1_RX_vect)
+//############################################################################
+{
+static unsigned int Sync=0, FrameCnt=0, ByteHigh=0, ReSync=1, Frame2=0, FrameTimer;
+ unsigned int Channel, index;
+ signed int signal, tmp;
+ int bCheckDelay;
+ uint8_t c;
+
+ c = UDR1; // get data byte
+
+ if (ReSync == 1)
+ {
+ // wait for beginning of new frame
+ ReSync = 0;
+
+ FrameTimer = SetDelay(7); // minimum 7ms zwischen den frames
+ FrameCnt = 0;
+ Sync = 0;
+ ByteHigh = 0;
+ }
+ else
+ {
+ bCheckDelay = CheckDelay(FrameTimer);
+ if ( Sync == 0 )
+ {
+ if(bCheckDelay)
+ {
+ // nach einer Pause von mind. 7ms erstes Sync-Character gefunden
+ // Zeichen ignorieren, da Bedeutung unbekannt
+ Sync = 1;
+ FrameCnt ++;
+ }
+ else
+ {
+ // Zeichen kam vor Ablauf der 7ms Sync-Pause
+ // warten auf erstes Sync-Zeichen
+ }
+ }
+ else if((Sync == 1) && !bCheckDelay)
+ {
+ // zweites Sync-Character ignorieren, Bedeutung unbekannt
+ Sync = 2;
+ FrameCnt ++;
+ }
+ else if((Sync == 2) && !bCheckDelay)
+ {
+ // Datenbyte high
+ ByteHigh = c;
+
+ if (FrameCnt == 2)
+ {
+ // is 1st Byte of Channel-data
+ // Frame 1 with Channel 1-7 comming next
+ Frame2 = 0;
+ if(ByteHigh & 0x80)
+ {
+ // DS9: Frame 2 with Channel 8-9 comming next
+ Frame2 = 1;
+ }
+ }
+ Sync = 3;
+ FrameCnt ++;
+ }
+ else if((Sync == 3) && !bCheckDelay)
+ {
+ // Datenbyte low
+
+ // High-Byte for next channel comes next
+ Sync = 2;
+ FrameCnt ++;
+
+ index = (ByteHigh >> 2) & 0x0f;
+ index ++;
+ Channel = (ByteHigh << 8) | c;
+ signal = Channel & 0x3ff;
+ signal -= 0x200; // Offset, range 0x000..0x3ff?
+ signal = signal/3; // scaling to fit PPM resolution
+
+ if(index >= 0 && index <= 10)
+ {
+ // Stabiles Signal
+ if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10; else SenderOkay = 200;}
+ tmp = (3 * (PPM_in[index]) + signal) / 4;
+ if(tmp > signal+1) tmp--; else
+ if(tmp < signal-1) tmp++;
+ if(SenderOkay >= 180) PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3;
+ else PPM_diff[index] = 0;
+ PPM_in[index] = tmp;
+ }
+ }
+ else
+ {
+ // hier stimmt was nicht: neu synchronisieren
+ ReSync = 1;
+ FrameCnt = 0;
+ Frame2 = 0;
+ }
+
+ // 16 Bytes per frame
+ if(FrameCnt >= 16)
+ {
+ // Frame complete
+ if(Frame2 == 0)
+ {
+ // Null bedeutet: Neue Daten
+ // nur beim ersten Frame (CH 0-7) setzen
+ NewPpmData = 0;
+ }
+
+ // new frame next, nach fruehestens 7ms erwartet
+ FrameCnt = 0;
+ Frame2 = 0;
+ Sync = 0;
+ }
+ // Zeit bis zum nächsten Zeichen messen
+ FrameTimer = SetDelay(7);
+ }
+}
+
+
/branches/V0.74d-acid/Spectrum.h
0,0 → 1,9
/*#######################################################################################
Dekodieren eines Spectrum Signals
#######################################################################################*/
 
#ifndef _SPECTRUM_H
#define _SPECTRUM_H
void Uart1Init(void);
void SpektrumBinding(void);
#endif //_RC_H
/branches/V0.74d-acid/_Settings.h
0,0 → 1,43
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Abstimmung
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define ACC_AMPLIFY 6
#define FAKTOR_P 1
#define FAKTOR_I 0.0001
 
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Debug-Interface
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define SIO_DEBUG 1 // Soll der Debugger aktiviert sein?
#define MIN_DEBUG_INTERVALL 250 // in diesem Intervall werden Degugdaten ohne Aufforderung gesendet
 
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Sender
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define K_NICK 0
#define K_ROLL 1
#define K_GAS 2
#define K_GIER 3
#define K_POTI1 4
#define K_POTI2 5
#define K_POTI3 6
#define K_POTI4 7
// +++++++++++++++++++++++++++++++
// + Getestete Settings:
// +++++++++++++++++++++++++++++++
// Setting: Kamera
// Stick_P:3
// Stick_D:0
// Gyro_P: 175
// Gyro_I: 175
// Ki_Anteil: 10
// +++++++++++++++++++++++++++++++
// + Getestete Settings:
// +++++++++++++++++++++++++++++++
// Setting: Normal
// Stick_P:2
// Stick_D:8
// Gyro_P: 80
// Gyro_I: 150
// Ki_Anteil: 5
 
/branches/V0.74d-acid/analog.c
0,0 → 1,459
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + only for non-profit use
// + www.MikroKopter.com
// + see the File "License.txt" for further Informations
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
#include "main.h"
volatile int Aktuell_Nick,Aktuell_Roll,Aktuell_Gier,Aktuell_ax, Aktuell_ay,Aktuell_az, UBat = 100;
volatile int AdWertNickFilter = 0, AdWertRollFilter = 0, AdWertGierFilter = 0;
volatile int HiResNick = 2500, HiResRoll = 2500;
volatile int AdWertNick = 0, AdWertRoll = 0, AdWertGier = 0;
volatile int AdWertAccRoll = 0,AdWertAccNick = 0,AdWertAccHoch = 0;
volatile char messanzahl_AccHoch = 0;
volatile long Luftdruck = 32000;
volatile int StartLuftdruck;
volatile unsigned int MessLuftdruck = 1023;
unsigned char DruckOffsetSetting;
signed char ExpandBaro = 0;
volatile int HoeheD = 0;
volatile char messanzahl_Druck;
volatile int tmpLuftdruck;
volatile unsigned int ZaehlMessungen = 0;
unsigned char AnalogOffsetNick = 115,AnalogOffsetRoll = 115,AnalogOffsetGier = 115;
unsigned char GyroDefektN = 0,GyroDefektR = 0,GyroDefektG = 0;
volatile unsigned char AdReady = 1;
//#######################################################################################
//
void ADC_Init(void)
//#######################################################################################
{
ADMUX = 0;//Referenz ist extern
ANALOG_ON;
}
 
void SucheLuftruckOffset(void)
{
unsigned int off;
off = eeprom_read_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET]);
if(off > 20) off -= 10;
OCR0A = off;
ExpandBaro = 0;
Delay_ms_Mess(100);
if(MessLuftdruck < 850) off = 0;
for(; off < 250;off++)
{
OCR0A = off;
Delay_ms_Mess(50);
printf(".");
if(MessLuftdruck < 850) break;
}
eeprom_write_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET], off);
DruckOffsetSetting = off;
Delay_ms_Mess(300);
}
 
void SucheGyroOffset(void)
{
unsigned char i, ready = 0;
int timeout;
GyroDefektN = 0; GyroDefektR = 0; GyroDefektG = 0;
timeout = SetDelay(2000);
for(i=140; i != 0; i--)
{
if(ready == 3 && i > 10) i = 9;
ready = 0;
if(AdWertNick < 1020) AnalogOffsetNick--; else if(AdWertNick > 1030) AnalogOffsetNick++; else ready++;
if(AdWertRoll < 1020) AnalogOffsetRoll--; else if(AdWertRoll > 1030) AnalogOffsetRoll++; else ready++;
if(AdWertGier < 1020) AnalogOffsetGier--; else if(AdWertGier > 1030) AnalogOffsetGier++; else ready++;
twi_state = 8;
i2c_start();
if(AnalogOffsetNick < 10) { GyroDefektN = 1; AnalogOffsetNick = 10;}; if(AnalogOffsetNick > 245) { GyroDefektN = 1; AnalogOffsetNick = 245;};
if(AnalogOffsetRoll < 10) { GyroDefektR = 1; AnalogOffsetRoll = 10;}; if(AnalogOffsetRoll > 245) { GyroDefektR = 1; AnalogOffsetRoll = 245;};
if(AnalogOffsetGier < 10) { GyroDefektG = 1; AnalogOffsetGier = 10;}; if(AnalogOffsetGier > 245) { GyroDefektG = 1; AnalogOffsetGier = 245;};
while(twi_state) if(CheckDelay(timeout)) {printf("\n\r DAC or I2C ERROR! Check I2C, 3Vref, DAC and BL-Ctrl"); break;}
messanzahl_Druck = 0;
ANALOG_ON;
while(messanzahl_Druck == 0);
if(i<10) Delay_ms_Mess(10);
}
Delay_ms_Mess(70);
}
 
/*
0 n
1 r
2 g
3 y
4 x
5 n
6 r
7 u
8 z
9 L
10 n
11 r
12 g
13 y
14 x
15 n
16 r
17 L
*/
 
//#######################################################################################
//
SIGNAL(SIG_ADC)
//#######################################################################################
{
static unsigned char kanal=0,state = 0;
static signed int gier1, roll1, nick1, nick_filter, roll_filter;
static signed int accy, accx;
switch(state++)
{
case 0:
nick1 = ADC;
kanal = AD_ROLL;
break;
case 1:
roll1 = ADC;
kanal = AD_GIER;
break;
case 2:
gier1 = ADC;
kanal = AD_ACC_Y;
break;
case 3:
Aktuell_ay = NeutralAccY - ADC;
accy = Aktuell_ay;
kanal = AD_ACC_X;
break;
case 4:
Aktuell_ax = ADC - NeutralAccX;
accx = Aktuell_ax;
kanal = AD_NICK;
break;
case 5:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 6:
roll1 += ADC;
kanal = AD_UBAT;
break;
case 7:
UBat = (3 * UBat + ADC / 3) / 4;
kanal = AD_ACC_Z;
break;
case 8:
AdWertAccHoch = (signed int) ADC - NeutralAccZ;
if(AdWertAccHoch > 1)
{
if(NeutralAccZ < 750)
{
NeutralAccZ += 0.02;
if(modell_fliegt < 500) NeutralAccZ += 0.1;
}
}
else if(AdWertAccHoch < -1)
{
if(NeutralAccZ > 550)
{
NeutralAccZ-= 0.02;
if(modell_fliegt < 500) NeutralAccZ -= 0.1;
}
}
messanzahl_AccHoch = 1;
Aktuell_az = ADC;
Mess_Integral_Hoch += AdWertAccHoch; // Integrieren
Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen
kanal = AD_DRUCK;
break;
// "case 8:" fehlt hier absichtlich
case 10:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 11:
roll1 += ADC;
kanal = AD_GIER;
break;
case 12:
if(PlatinenVersion == 10) AdWertGier = (ADC + gier1 + 1) / 2;
else
if(PlatinenVersion == 20) AdWertGier = 2047 - (ADC + gier1);
else AdWertGier = (ADC + gier1);
kanal = AD_ACC_Y;
break;
case 13:
Aktuell_ay = NeutralAccY - ADC;
AdWertAccRoll = (Aktuell_ay + accy);
kanal = AD_ACC_X;
break;
case 14:
Aktuell_ax = ADC - NeutralAccX;
AdWertAccNick = (Aktuell_ax + accx);
kanal = AD_NICK;
break;
case 15:
nick1 += ADC;
if(PlatinenVersion == 10) nick1 *= 2; else nick1 *= 4;
AdWertNick = nick1 / 8;
nick_filter = (nick_filter + nick1) / 2;
HiResNick = nick_filter - AdNeutralNick;
AdWertNickFilter = (AdWertNickFilter + HiResNick) / 2;
kanal = AD_ROLL;
break;
case 16:
roll1 += ADC;
if(PlatinenVersion == 10) roll1 *= 2; else roll1 *= 4;
AdWertRoll = roll1 / 8;
roll_filter = (roll_filter + roll1) / 2;
HiResRoll = roll_filter - AdNeutralRoll;
AdWertRollFilter = (AdWertRollFilter + HiResRoll) / 2;
kanal = AD_DRUCK;
break;
case 17:
state = 0;
AdReady = 1;
ZaehlMessungen++;
// "break" fehlt hier absichtlich
case 9:
tmpLuftdruck += ADC;
if(++messanzahl_Druck >= 5)
{
tmpLuftdruck /= 2;
MessLuftdruck = ADC;
messanzahl_Druck = 0;
HoeheD = (31 * HoeheD + (int) Parameter_Luftdruck_D * (int)(255 * ExpandBaro + StartLuftdruck - tmpLuftdruck - HoehenWert))/32; // D-Anteil = neuerWert - AlterWert
Luftdruck = (tmpLuftdruck + 7 * Luftdruck + 4) / 8;
HoehenWert = 255 * ExpandBaro + StartLuftdruck - Luftdruck;
tmpLuftdruck /= 2;
}
kanal = AD_NICK;
break;
default:
kanal = 0; state = 0; kanal = AD_NICK;
break;
}
ADMUX = kanal;
if(state != 0) ANALOG_ON;
}
 
 
 
/*
//#######################################################################################
//
SIGNAL(SIG_ADC)
//#######################################################################################
{
static unsigned char kanal=0,state = 0;
static signed int gier1, roll1, nick1;
static signed long nick_filter, roll_filter;
static signed int accy, accx;
switch(state++)
{
case 0:
nick1 = ADC;
kanal = AD_ROLL;
break;
case 1:
roll1 = ADC;
kanal = AD_GIER;
break;
case 2:
gier1 = ADC;
kanal = AD_ACC_Y;
break;
case 3:
Aktuell_ay = NeutralAccY - ADC;
accy = Aktuell_ay;
kanal = AD_NICK;
break;
case 4:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 5:
roll1 += ADC;
kanal = AD_ACC_Z;
break;
case 6:
AdWertAccHoch = (signed int) ADC - NeutralAccZ;
if(AdWertAccHoch > 1)
{
if(NeutralAccZ < 750)
{
NeutralAccZ += 0.02;
if(modell_fliegt < 500) NeutralAccZ += 0.1;
}
}
else if(AdWertAccHoch < -1)
{
if(NeutralAccZ > 550)
{
NeutralAccZ-= 0.02;
if(modell_fliegt < 500) NeutralAccZ -= 0.1;
}
}
messanzahl_AccHoch = 1;
Aktuell_az = ADC;
Mess_Integral_Hoch += AdWertAccHoch; // Integrieren
Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen
kanal = AD_NICK;
break;
case 7:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 8:
roll1 += ADC;
kanal = AD_ACC_X;
break;
case 9:
Aktuell_ax = ADC - NeutralAccX;
accx = Aktuell_ax;
kanal = AD_GIER;
break;
case 10:
gier1 += ADC;
kanal = AD_NICK;
break;
case 11:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 12:
roll1 += ADC;
kanal = AD_UBAT;
break;
case 13:
UBat = (3 * UBat + ADC / 3) / 4;//(UBat + ((ADC * 39) / 256) + 19) / 2;
kanal = AD_ACC_Y;
break;
case 14:
Aktuell_ay = NeutralAccY - ADC;
accy += Aktuell_ay;
kanal = AD_NICK;
break;
case 15:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 16:
roll1 += ADC;
kanal = AD_ACC_X;
break;
case 17:
Aktuell_ax = ADC - NeutralAccX;
accx += Aktuell_ax;
kanal = AD_NICK;
break;
case 18:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 19:
roll1 += ADC;
kanal = AD_GIER;
break;
case 20:
gier1 += ADC;
kanal = AD_ACC_Y;
break;
case 21:
Aktuell_ay = NeutralAccY - ADC;
accy += Aktuell_ay;
kanal = AD_NICK;
break;
case 22:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 23:
roll1 += ADC;
kanal = AD_DRUCK;
break;
case 24:
tmpLuftdruck += ADC;
if(++messanzahl_Druck >= 5)
{
MessLuftdruck = ADC;
messanzahl_Druck = 0;
HoeheD = (7 * HoeheD + (int) Parameter_Luftdruck_D * (int)(255 * ExpandBaro + StartLuftdruck - tmpLuftdruck - HoehenWert)) / 8; // D-Anteil = neuerWert - AlterWert
Luftdruck = (tmpLuftdruck + 3 * Luftdruck) / 4;
HoehenWert = 255 * ExpandBaro + StartLuftdruck - Luftdruck;
tmpLuftdruck = 0;
}
kanal = AD_NICK;
break;
case 25:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 26:
roll1 += ADC;
kanal = AD_ACC_X;
break;
case 27:
Aktuell_ax = ADC - NeutralAccX;
accx += Aktuell_ax;
kanal = AD_GIER;
break;
case 28:
if(PlatinenVersion == 10) AdWertGier = (ADC + gier1 + 2) / 4;
else
if(PlatinenVersion == 20) AdWertGier = 2047 - (ADC + gier1 + 1) / 2;
else AdWertGier = (ADC + gier1 + 1) / 2;
kanal = AD_NICK;
break;
case 29:
nick1 += ADC;
kanal = AD_ROLL;
break;
case 30:
roll1 += ADC;
kanal = AD_ACC_Y;
break;
case 31:
Aktuell_ay = NeutralAccY - ADC;
AdWertAccRoll = (Aktuell_ay + accy);
kanal = AD_NICK;
break;
case 32:
AdWertNick = (ADC + nick1 + 3) / 5;
nick_filter = (long) (1 * (long) nick_filter + 4 * (long)(ADC + nick1) + 1) / 2;
if(PlatinenVersion == 10) { AdWertNick /= 2;nick_filter /=2;}
HiResNick = nick_filter - 20 * AdNeutralNick;
AdWertNickFilter = (long)(3L * (long)AdWertNickFilter + HiResNick + 2) / 4;
DebugOut.Analog[21] = AdWertNickFilter / 4;
kanal = AD_ROLL;
break;
case 33:
AdWertRoll = (ADC + roll1 + 3) / 5;
roll_filter = (long)(1 * (long)roll_filter + 4 * (long)(ADC + roll1) + 1) / 2;
if(PlatinenVersion == 10) { AdWertRoll /= 2;roll_filter /=2;}
HiResRoll = roll_filter - 20 * AdNeutralRoll;
AdWertRollFilter = (long)(3L * (long)AdWertRollFilter + HiResRoll + 2) / 4;
DebugOut.Analog[22] = AdWertRollFilter / 4;
kanal = AD_ACC_X;
break;
case 34:
Aktuell_ax = ADC - NeutralAccX;
AdWertAccNick = (Aktuell_ax + accx);
kanal = AD_NICK;
state = 0;
AdReady = 1;
ZaehlMessungen++;
break;
default:
kanal = 0;
state = 0;
break;
}
ADMUX = kanal;
if(state != 0) ANALOG_ON;
}
*/
/branches/V0.74d-acid/analog.h
0,0 → 1,45
#ifndef _ANALOG_H
#define _ANALOG_H
/*#######################################################################################
 
#######################################################################################*/
 
extern volatile int UBat;
extern volatile int AdWertNick, AdWertRoll, AdWertGier;
extern volatile int AdWertAccRoll,AdWertAccNick,AdWertAccHoch;
extern volatile int HiResNick, HiResRoll;
extern volatile int AdWertNickFilter, AdWertRollFilter, AdWertGierFilter;
extern volatile int Aktuell_Nick,Aktuell_Roll,Aktuell_Gier,Aktuell_ax, Aktuell_ay,Aktuell_az;
extern volatile long Luftdruck;
extern volatile char messanzahl_Druck;
extern volatile unsigned int ZaehlMessungen;
extern unsigned char DruckOffsetSetting;
extern signed char ExpandBaro;
extern volatile int HoeheD;
extern volatile unsigned int MessLuftdruck;
extern volatile int StartLuftdruck;
extern volatile char MessanzahlNick;
extern unsigned char AnalogOffsetNick,AnalogOffsetRoll,AnalogOffsetGier;
extern volatile unsigned char AdReady;
 
 
unsigned int ReadADC(unsigned char adc_input);
void ADC_Init(void);
void SucheLuftruckOffset(void);
void SucheGyroOffset(void);
 
#define AD_GIER 0
#define AD_ROLL 1
#define AD_NICK 2
#define AD_DRUCK 3
#define AD_UBAT 4
#define AD_ACC_Z 5
#define AD_ACC_Y 6
#define AD_ACC_X 7
 
 
#define ANALOG_OFF ADCSRA=0
 
#define ANALOG_ON ADCSRA=(1<<ADEN)|(1<<ADSC)|(0<<ADATE)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADIE)
//Signle trigger Mode, Interrupt on
#endif //_ANALOG_H
/branches/V0.74d-acid/eeprom.c
0,0 → 1,236
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Konstanten
// + 0-250 -> normale Werte
// + 251 -> Poti1
// + 252 -> Poti2
// + 253 -> Poti3
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DefaultStickMapping(void)
{
EE_Parameter.Kanalbelegung[K_NICK] = 1;
EE_Parameter.Kanalbelegung[K_ROLL] = 2;
EE_Parameter.Kanalbelegung[K_GAS] = 3;
EE_Parameter.Kanalbelegung[K_GIER] = 4;
EE_Parameter.Kanalbelegung[K_POTI1] = 5;
EE_Parameter.Kanalbelegung[K_POTI2] = 6;
EE_Parameter.Kanalbelegung[K_POTI3] = 7;
EE_Parameter.Kanalbelegung[K_POTI4] = 8;
}
 
void DefaultKonstanten1(void)
{
EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV;//CFG_HOEHEN_SCHALTER
EE_Parameter.Hoehe_MinGas = 30;
EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1
EE_Parameter.Hoehe_P = 10; // Wert : 0-32
EE_Parameter.Luftdruck_D = 30; // Wert : 0-250
EE_Parameter.Hoehe_ACC_Wirkung = 30; // Wert : 0-250
EE_Parameter.Hoehe_Verstaerkung = 4; // Wert : 0-50
EE_Parameter.Stick_P = 15; // Wert : 1-6
EE_Parameter.Stick_D = 30; // Wert : 0-64
EE_Parameter.Gier_P = 12; // Wert : 1-20
EE_Parameter.Gas_Min = 8; // Wert : 0-32
EE_Parameter.Gas_Max = 230; // Wert : 33-250
EE_Parameter.GyroAccFaktor = 30; // Wert : 1-64
EE_Parameter.KompassWirkung = 128; // Wert : 0-250
EE_Parameter.Gyro_P = 80; // Wert : 0-250
EE_Parameter.Gyro_I = 150; // Wert : 0-250
EE_Parameter.Gyro_D = 3; // Wert : 0-250
EE_Parameter.UnterspannungsWarnung = 94; // Wert : 0-250
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust
EE_Parameter.NotGasZeit = 30; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation
EE_Parameter.I_Faktor = 32;
EE_Parameter.UserParam1 = 0; // zur freien Verwendung
EE_Parameter.UserParam2 = 0; // zur freien Verwendung
EE_Parameter.UserParam3 = 0; // zur freien Verwendung
EE_Parameter.UserParam4 = 0; // zur freien Verwendung
EE_Parameter.UserParam5 = 0; // zur freien Verwendung
EE_Parameter.UserParam6 = 0; // zur freien Verwendung
EE_Parameter.UserParam7 = 0; // zur freien Verwendung
EE_Parameter.UserParam8 = 0; // zur freien Verwendung
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag
EE_Parameter.ServoNickRefresh = 5;
EE_Parameter.LoopGasLimit = 50;
EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag
EE_Parameter.LoopHysterese = 50;
EE_Parameter.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
EE_Parameter.AchsKopplung1 = 90;
EE_Parameter.AchsKopplung2 = 67;
EE_Parameter.CouplingYawCorrection = 0;
EE_Parameter.WinkelUmschlagNick = 85;
EE_Parameter.WinkelUmschlagRoll = 85;
EE_Parameter.GyroAccAbgleich = 16; // 1/k
EE_Parameter.Driftkomp = 32;
EE_Parameter.DynamicStability = 100;
EE_Parameter.J16Bitmask = 95;
EE_Parameter.J17Bitmask = 243;
EE_Parameter.J16Timing = 15;
EE_Parameter.J17Timing = 15;
EE_Parameter.NaviGpsModeControl = 253;
EE_Parameter.NaviGpsGain = 100;
EE_Parameter.NaviGpsP = 90;
EE_Parameter.NaviGpsI = 90;
EE_Parameter.NaviGpsD = 90;
EE_Parameter.NaviGpsPLimit = 75;
EE_Parameter.NaviGpsILimit = 75;
EE_Parameter.NaviGpsDLimit = 75;
EE_Parameter.NaviGpsACC = 0;
EE_Parameter.NaviGpsMinSat = 6;
EE_Parameter.NaviStickThreshold = 8;
EE_Parameter.NaviWindCorrection = 90;
EE_Parameter.NaviSpeedCompensation = 30;
EE_Parameter.NaviOperatingRadius = 100;
EE_Parameter.NaviAngleLimitation = 100;
EE_Parameter.NaviPH_LoginTime = 4;
memcpy(EE_Parameter.Name, "Sport\0", 12);
}
void DefaultKonstanten2(void)
{
EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV;///*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV;//0x01;
EE_Parameter.Hoehe_MinGas = 30;
EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1
EE_Parameter.Hoehe_P = 10; // Wert : 0-32
EE_Parameter.Luftdruck_D = 30; // Wert : 0-250
EE_Parameter.Hoehe_ACC_Wirkung = 30; // Wert : 0-250
EE_Parameter.Hoehe_Verstaerkung = 3; // Wert : 0-50
EE_Parameter.Stick_P = 12; // Wert : 1-6
EE_Parameter.Stick_D = 16; // Wert : 0-64
EE_Parameter.Gier_P = 6; // Wert : 1-20
EE_Parameter.Gas_Min = 8; // Wert : 0-32
EE_Parameter.Gas_Max = 230; // Wert : 33-250
EE_Parameter.GyroAccFaktor = 30; // Wert : 1-64
EE_Parameter.KompassWirkung = 128; // Wert : 0-250
EE_Parameter.Gyro_P = 80; // Wert : 0-250
EE_Parameter.Gyro_I = 120; // Wert : 0-250
EE_Parameter.Gyro_D = 3; // Wert : 0-250
EE_Parameter.UnterspannungsWarnung = 94; // Wert : 0-250
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust
EE_Parameter.NotGasZeit = 30; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation
EE_Parameter.I_Faktor = 32;
EE_Parameter.UserParam1 = 0; // zur freien Verwendung
EE_Parameter.UserParam2 = 0; // zur freien Verwendung
EE_Parameter.UserParam3 = 0; // zur freien Verwendung
EE_Parameter.UserParam4 = 0; // zur freien Verwendung
EE_Parameter.UserParam5 = 0; // zur freien Verwendung
EE_Parameter.UserParam6 = 0; // zur freien Verwendung
EE_Parameter.UserParam7 = 0; // zur freien Verwendung
EE_Parameter.UserParam8 = 0; // zur freien Verwendung
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag
EE_Parameter.ServoNickRefresh = 5;
EE_Parameter.LoopGasLimit = 50;
EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag
EE_Parameter.LoopHysterese = 50;
EE_Parameter.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts
EE_Parameter.AchsKopplung1 = 90;
EE_Parameter.AchsKopplung2 = 67;
EE_Parameter.CouplingYawCorrection = 60;
EE_Parameter.WinkelUmschlagNick = 85;
EE_Parameter.WinkelUmschlagRoll = 85;
EE_Parameter.GyroAccAbgleich = 32; // 1/k
EE_Parameter.Driftkomp = 32;
EE_Parameter.DynamicStability = 75;
EE_Parameter.J16Bitmask = 95;
EE_Parameter.J17Bitmask = 243;
EE_Parameter.J16Timing = 20;
EE_Parameter.J17Timing = 20;
EE_Parameter.NaviGpsModeControl = 253;
EE_Parameter.NaviGpsGain = 100;
EE_Parameter.NaviGpsP = 90;
EE_Parameter.NaviGpsI = 90;
EE_Parameter.NaviGpsD = 90;
EE_Parameter.NaviGpsPLimit = 75;
EE_Parameter.NaviGpsILimit = 75;
EE_Parameter.NaviGpsDLimit = 75;
EE_Parameter.NaviGpsACC = 0;
EE_Parameter.NaviGpsMinSat = 6;
EE_Parameter.NaviStickThreshold = 8;
EE_Parameter.NaviWindCorrection = 90;
EE_Parameter.NaviSpeedCompensation = 30;
EE_Parameter.NaviOperatingRadius = 100;
EE_Parameter.NaviAngleLimitation = 100;
EE_Parameter.NaviPH_LoginTime = 4;
memcpy(EE_Parameter.Name, "Normal\0", 12);
}
 
void DefaultKonstanten3(void)
{
EE_Parameter.GlobalConfig = CFG_DREHRATEN_BEGRENZER | CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV;///*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV;//0x01;
EE_Parameter.Hoehe_MinGas = 30;
EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1
EE_Parameter.Hoehe_P = 10; // Wert : 0-32
EE_Parameter.Luftdruck_D = 30; // Wert : 0-250
EE_Parameter.Hoehe_ACC_Wirkung = 30; // Wert : 0-250
EE_Parameter.Hoehe_Verstaerkung = 3; // Wert : 0-50
EE_Parameter.Stick_P = 8; // Wert : 1-6
EE_Parameter.Stick_D = 16; // Wert : 0-64
EE_Parameter.Gier_P = 6; // Wert : 1-20
EE_Parameter.Gas_Min = 8; // Wert : 0-32
EE_Parameter.Gas_Max = 230; // Wert : 33-250
EE_Parameter.GyroAccFaktor = 30; // Wert : 1-64
EE_Parameter.KompassWirkung = 128; // Wert : 0-250
EE_Parameter.Gyro_P = 100; // Wert : 0-250
EE_Parameter.Gyro_I = 120; // Wert : 0-250
EE_Parameter.Gyro_D = 3; // Wert : 0-250
EE_Parameter.UnterspannungsWarnung = 94; // Wert : 0-250
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust
EE_Parameter.NotGasZeit = 20; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation
EE_Parameter.I_Faktor = 16;
EE_Parameter.UserParam1 = 0; // zur freien Verwendung
EE_Parameter.UserParam2 = 0; // zur freien Verwendung
EE_Parameter.UserParam3 = 0; // zur freien Verwendung
EE_Parameter.UserParam4 = 0; // zur freien Verwendung
EE_Parameter.UserParam5 = 0; // zur freien Verwendung
EE_Parameter.UserParam6 = 0; // zur freien Verwendung
EE_Parameter.UserParam7 = 0; // zur freien Verwendung
EE_Parameter.UserParam8 = 0; // zur freien Verwendung
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag
EE_Parameter.ServoNickRefresh = 5;
EE_Parameter.LoopGasLimit = 50;
EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag
EE_Parameter.LoopHysterese = 50;
EE_Parameter.BitConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts
EE_Parameter.AchsKopplung1 = 90;
EE_Parameter.AchsKopplung2 = 67;
EE_Parameter.CouplingYawCorrection = 70;
EE_Parameter.WinkelUmschlagNick = 85;
EE_Parameter.WinkelUmschlagRoll = 85;
EE_Parameter.GyroAccAbgleich = 32; // 1/k
EE_Parameter.Driftkomp = 32;
EE_Parameter.DynamicStability = 50;
EE_Parameter.J16Bitmask = 95;
EE_Parameter.J17Bitmask = 243;
EE_Parameter.J16Timing = 30;
EE_Parameter.J17Timing = 30;
EE_Parameter.NaviGpsModeControl = 253;
EE_Parameter.NaviGpsGain = 100;
EE_Parameter.NaviGpsP = 90;
EE_Parameter.NaviGpsI = 90;
EE_Parameter.NaviGpsD = 90;
EE_Parameter.NaviGpsPLimit = 75;
EE_Parameter.NaviGpsILimit = 75;
EE_Parameter.NaviGpsDLimit = 75;
EE_Parameter.NaviGpsACC = 0;
EE_Parameter.NaviGpsMinSat = 6;
EE_Parameter.NaviStickThreshold = 8;
EE_Parameter.NaviWindCorrection = 90;
EE_Parameter.NaviSpeedCompensation = 30;
EE_Parameter.NaviOperatingRadius = 100;
EE_Parameter.NaviAngleLimitation = 100;
EE_Parameter.NaviPH_LoginTime = 4;
memcpy(EE_Parameter.Name, "Beginner\0", 12);
}
/branches/V0.74d-acid/fc.c
0,0 → 1,1492
/*#######################################################################################
Flight Control
#######################################################################################*/
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + Nur für den privaten Gebrauch
// + 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 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 permittet
// + 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 to systems other than 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 "main.h"
#include "eeprom.c"
#include "mymath.h"
 
unsigned char h,m,s;
volatile unsigned int I2CTimeout = 100;
int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll;
int TrimNick, TrimRoll;
int AdNeutralGierBias;
int AdNeutralNick = 0,AdNeutralRoll = 0,AdNeutralGier = 0,StartNeutralRoll = 0,StartNeutralNick = 0;
int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch, NeutralAccX=0, NeutralAccY=0;
int NaviAccNick, NaviAccRoll,NaviCntAcc = 0;
volatile float NeutralAccZ = 0;
unsigned char CosinusNickWinkel = 0, CosinusRollWinkel = 0;
long IntegralNick = 0,IntegralNick2 = 0;
long IntegralRoll = 0,IntegralRoll2 = 0;
long IntegralAccNick = 0,IntegralAccRoll = 0,IntegralAccZ = 0;
long Integral_Gier = 0;
long Mess_IntegralNick = 0,Mess_IntegralNick2 = 0;
long Mess_IntegralRoll = 0,Mess_IntegralRoll2 = 0;
long Mess_Integral_Gier = 0,Mess_Integral_Gier2 = 0;
long MittelIntegralNick,MittelIntegralRoll,MittelIntegralNick2,MittelIntegralRoll2;
volatile long Mess_Integral_Hoch = 0;
int KompassValue = 0;
int KompassStartwert = 0;
int KompassEinschaltStartwert = 0;
int KompassRichtung = 0;
unsigned int KompassSignalSchlecht = 500;
unsigned char MAX_GAS,MIN_GAS;
unsigned char Notlandung = 0;
unsigned char HoehenReglerAktiv = 0;
unsigned char TrichterFlug = 0;
long Umschlag180Nick = 250000L, Umschlag180Roll = 250000L;
long ErsatzKompass;
int ErsatzKompassInGrad; // Kompasswert in Grad
int GierGyroFehler = 0;
char GyroFaktor,GyroFaktorGier;
char IntegralFaktor,IntegralFaktorGier;
int DiffNick,DiffRoll;
int Poti1 = 0, Poti2 = 0, Poti3 = 0, Poti4 = 0;
volatile unsigned char SenderOkay = 0;
int StickNick = 0,StickRoll = 0,StickGier = 0,StickGas = 0;
char MotorenEin = 0;
int HoehenWert = 0;
int SollHoehe = 0;
int LageKorrekturRoll = 0,LageKorrekturNick = 0;
//float Ki = FAKTOR_I;
int Ki = 10300 / 33;
unsigned char Looping_Nick = 0,Looping_Roll = 0;
unsigned char Looping_Links = 0, Looping_Rechts = 0, Looping_Unten = 0, Looping_Oben = 0;
 
unsigned char Parameter_Luftdruck_D = 48; // Wert : 0-250
unsigned char Parameter_MaxHoehe = 251; // Wert : 0-250
unsigned char Parameter_Hoehe_P = 16; // Wert : 0-32
unsigned char Parameter_Hoehe_ACC_Wirkung = 58; // Wert : 0-250
unsigned char Parameter_KompassWirkung = 64; // Wert : 0-250
unsigned char Parameter_Gyro_D = 8; // Wert : 0-250
unsigned char Parameter_Gyro_P = 150; // Wert : 10-250
unsigned char Parameter_Gyro_I = 150; // Wert : 0-250
unsigned char Parameter_Gier_P = 2; // Wert : 1-20
unsigned char Parameter_I_Faktor = 10; // Wert : 1-20
unsigned char Parameter_UserParam1 = 0;
unsigned char Parameter_UserParam2 = 0;
unsigned char Parameter_UserParam3 = 0;
unsigned char Parameter_UserParam4 = 0;
unsigned char Parameter_UserParam5 = 0;
unsigned char Parameter_UserParam6 = 0;
unsigned char Parameter_UserParam7 = 0;
unsigned char Parameter_UserParam8 = 0;
unsigned char Parameter_ServoNickControl = 100;
unsigned char Parameter_LoopGasLimit = 70;
unsigned char Parameter_AchsKopplung1 = 90;
unsigned char Parameter_AchsKopplung2 = 65;
unsigned char Parameter_CouplingYawCorrection = 64;
//unsigned char Parameter_AchsGegenKopplung1 = 0;
unsigned char Parameter_DynamicStability = 100;
unsigned char Parameter_J16Bitmask; // for the J16 Output
unsigned char Parameter_J16Timing; // for the J16 Output
unsigned char Parameter_J17Bitmask; // for the J17 Output
unsigned char Parameter_J17Timing; // for the J17 Output
unsigned char Parameter_NaviGpsModeControl; // Parameters for the Naviboard
unsigned char Parameter_NaviGpsGain;
unsigned char Parameter_NaviGpsP;
unsigned char Parameter_NaviGpsI;
unsigned char Parameter_NaviGpsD;
unsigned char Parameter_NaviGpsACC;
unsigned char Parameter_NaviOperatingRadius;
unsigned char Parameter_NaviWindCorrection;
unsigned char Parameter_NaviSpeedCompensation;
unsigned char Parameter_ExternalControl;
struct mk_param_struct EE_Parameter;
signed int ExternStickNick = 0,ExternStickRoll = 0,ExternStickGier = 0, ExternHoehenValue = -20;
int MaxStickNick = 0,MaxStickRoll = 0;
unsigned int modell_fliegt = 0;
volatile unsigned char MikroKopterFlags = 0;
long GIER_GRAD_FAKTOR = 1291;
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
unsigned char RequiredMotors = 4;
unsigned char Motor[MAX_MOTORS];
signed int tmp_motorwert[MAX_MOTORS];
 
int MotorSmoothing(int neu, int alt)
{
int motor;
if(neu > alt) motor = (1*(int)alt + neu) / 2;
else motor = neu - (alt - neu)*1;
//if(Poti2 < 20) return(neu);
return(motor);
}
 
 
void Piep(unsigned char Anzahl)
{
while(Anzahl--)
{
if(MotorenEin) return; //auf keinen Fall im Flug!
beeptime = 100;
Delay_ms(250);
}
}
 
//############################################################################
// Nullwerte ermitteln
void SetNeutral(void)
//############################################################################
{
unsigned char i;
unsigned int gier_neutral=0, nick_neutral=0, roll_neutral=0;
ServoActive = 0; HEF4017R_ON;
NeutralAccX = 0;
NeutralAccY = 0;
NeutralAccZ = 0;
AdNeutralNick = 0;
AdNeutralRoll = 0;
AdNeutralGier = 0;
AdNeutralGierBias = 0;
Parameter_AchsKopplung1 = 0;
Parameter_AchsKopplung2 = 0;
ExpandBaro = 0;
CalibrierMittelwert();
Delay_ms_Mess(100);
CalibrierMittelwert();
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert?
{
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset();
}
#define NEUTRAL_FILTER 32
for(i=0; i<NEUTRAL_FILTER; i++)
{
Delay_ms_Mess(10);
gier_neutral += AdWertGier;
nick_neutral += AdWertNick;
roll_neutral += AdWertRoll;
}
AdNeutralNick= (nick_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER / 8);
AdNeutralRoll= (roll_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER / 8);
AdNeutralGier= (gier_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER);
AdNeutralGierBias = AdNeutralGier;
StartNeutralRoll = AdNeutralRoll;
StartNeutralNick = AdNeutralNick;
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) > 4)
{
NeutralAccY = abs(Mittelwert_AccRoll) / (2*ACC_AMPLIFY);
NeutralAccX = abs(Mittelwert_AccNick) / (2*ACC_AMPLIFY);
NeutralAccZ = Aktuell_az;
}
else
{
NeutralAccX = (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) * 256 + (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK+1]);
NeutralAccY = (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL]) * 256 + (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL+1]);
NeutralAccZ = (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_Z]) * 256 + (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_Z+1]);
}
 
MesswertNick = 0;
MesswertRoll = 0;
MesswertGier = 0;
Delay_ms_Mess(100);
Mittelwert_AccNick = ACC_AMPLIFY * (long)AdWertAccNick;
Mittelwert_AccRoll = ACC_AMPLIFY * (long)AdWertAccRoll;
IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick;
IntegralRoll = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccRoll;
Mess_IntegralNick2 = IntegralNick;
Mess_IntegralRoll2 = IntegralRoll;
Mess_Integral_Gier = 0;
StartLuftdruck = Luftdruck;
HoeheD = 0;
Mess_Integral_Hoch = 0;
KompassStartwert = KompassValue;
KompassEinschaltStartwert = KompassValue;
GPS_Neutral();
beeptime = 50;
Umschlag180Nick = ((long) EE_Parameter.WinkelUmschlagNick * 2500L) + 15000L;
Umschlag180Roll = ((long) EE_Parameter.WinkelUmschlagRoll * 2500L) + 15000L;
ExternHoehenValue = 0;
ErsatzKompass = KompassValue * GIER_GRAD_FAKTOR;
GierGyroFehler = 0;
SendVersionToNavi = 1;
LED_Init();
MikroKopterFlags |= FLAG_CALIBRATE;
FromNaviCtrl_Value.Kalman_K = -1;
FromNaviCtrl_Value.Kalman_MaxDrift = 0;
FromNaviCtrl_Value.Kalman_MaxFusion = 32;
Poti1 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110;
Poti2 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110;
Poti3 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110;
Poti4 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110;
ServoActive = 1;
SenderOkay = 100;
}
 
//############################################################################
// Bearbeitet die Messwerte
void Mittelwert(void)
//############################################################################
{
static signed long tmpl,tmpl2,tmpl3,tmpl4;
static signed int oldNick, oldRoll, d2Roll, d2Nick;
signed long winkel_nick, winkel_roll;
 
MesswertGier = (signed int) AdNeutralGier - AdWertGier;
// MesswertGierBias = (signed int) AdNeutralGierBias - AdWertGier;
MesswertNick = (signed int) AdWertNickFilter / 8;
MesswertRoll = (signed int) AdWertRollFilter / 8;
RohMesswertNick = MesswertNick;
RohMesswertRoll = MesswertRoll;
//DebugOut.Analog[21] = MesswertNick;
//DebugOut.Analog[22] = MesswertRoll;
//DebugOut.Analog[22] = Mess_Integral_Gier;
//DebugOut.Analog[21] = MesswertNick;
//DebugOut.Analog[22] = MesswertRoll;
 
// Beschleunigungssensor ++++++++++++++++++++++++++++++++++++++++++++++++
Mittelwert_AccNick = ((long)Mittelwert_AccNick * 3 + ((ACC_AMPLIFY * (long)AdWertAccNick))) / 4L;
Mittelwert_AccRoll = ((long)Mittelwert_AccRoll * 3 + ((ACC_AMPLIFY * (long)AdWertAccRoll))) / 4L;
Mittelwert_AccHoch = ((long)Mittelwert_AccHoch * 3 + ((long)AdWertAccHoch)) / 4L;
IntegralAccNick += ACC_AMPLIFY * AdWertAccNick;
IntegralAccRoll += ACC_AMPLIFY * AdWertAccRoll;
NaviAccNick += AdWertAccNick;
NaviAccRoll += AdWertAccRoll;
NaviCntAcc++;
IntegralAccZ += Aktuell_az - NeutralAccZ;
 
//++++++++++++++++++++++++++++++++++++++++++++++++
// ADC einschalten
ANALOG_ON;
AdReady = 0;
//++++++++++++++++++++++++++++++++++++++++++++++++
 
if(Mess_IntegralRoll > 93000L) winkel_roll = 93000L;
else if(Mess_IntegralRoll <-93000L) winkel_roll = -93000L;
else winkel_roll = Mess_IntegralRoll;
 
if(Mess_IntegralNick > 93000L) winkel_nick = 93000L;
else if(Mess_IntegralNick <-93000L) winkel_nick = -93000L;
else winkel_nick = Mess_IntegralNick;
 
// Gier ++++++++++++++++++++++++++++++++++++++++++++++++
Mess_Integral_Gier += MesswertGier;
ErsatzKompass += MesswertGier;
// Kopplungsanteil +++++++++++++++++++++++++++++++++++++
if(!Looping_Nick && !Looping_Roll && (EE_Parameter.GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV))
{
tmpl3 = (MesswertRoll * winkel_nick) / 2048L;
tmpl3 *= Parameter_AchsKopplung2; //65
tmpl3 /= 4096L;
tmpl4 = (MesswertNick * winkel_roll) / 2048L;
tmpl4 *= Parameter_AchsKopplung2; //65
tmpl4 /= 4096L;
KopplungsteilNickRoll = tmpl3;
KopplungsteilRollNick = tmpl4;
tmpl4 -= tmpl3;
ErsatzKompass += tmpl4;
if(!Parameter_CouplingYawCorrection) Mess_Integral_Gier -= tmpl4/2; // Gier nachhelfen
 
tmpl = ((MesswertGier + tmpl4) * winkel_nick) / 2048L;
tmpl *= Parameter_AchsKopplung1; // 90
tmpl /= 4096L;
tmpl2 = ((MesswertGier + tmpl4) * winkel_roll) / 2048L;
tmpl2 *= Parameter_AchsKopplung1;
tmpl2 /= 4096L;
if(abs(MesswertGier) > 64) if(labs(tmpl) > 128 || labs(tmpl2) > 128) TrichterFlug = 1;
//MesswertGier += (Parameter_CouplingYawCorrection * tmpl4) / 256;
}
else tmpl = tmpl2 = KopplungsteilNickRoll = KopplungsteilRollNick = 0;
 
TrimRoll = tmpl - tmpl2 / 100L;
TrimNick = -tmpl2 + tmpl / 100L;
 
// Kompasswert begrenzen ++++++++++++++++++++++++++++++++++++++++++++++++
if(ErsatzKompass >= (360L * GIER_GRAD_FAKTOR)) ErsatzKompass -= 360L * GIER_GRAD_FAKTOR; // 360° Umschlag
if(ErsatzKompass < 0) ErsatzKompass += 360L * GIER_GRAD_FAKTOR;
// Roll ++++++++++++++++++++++++++++++++++++++++++++++++
Mess_IntegralRoll2 += MesswertRoll + TrimRoll;
Mess_IntegralRoll += MesswertRoll + TrimRoll - LageKorrekturRoll;
if(Mess_IntegralRoll > Umschlag180Roll)
{
Mess_IntegralRoll = -(Umschlag180Roll - 25000L);
Mess_IntegralRoll2 = Mess_IntegralRoll;
}
if(Mess_IntegralRoll <-Umschlag180Roll)
{
Mess_IntegralRoll = (Umschlag180Roll - 25000L);
Mess_IntegralRoll2 = Mess_IntegralRoll;
}
// Nick ++++++++++++++++++++++++++++++++++++++++++++++++
Mess_IntegralNick2 += MesswertNick + TrimNick;
Mess_IntegralNick += MesswertNick + TrimNick - LageKorrekturNick;
if(Mess_IntegralNick > Umschlag180Nick)
{
Mess_IntegralNick = -(Umschlag180Nick - 25000L);
Mess_IntegralNick2 = Mess_IntegralNick;
}
if(Mess_IntegralNick <-Umschlag180Nick)
{
Mess_IntegralNick = (Umschlag180Nick - 25000L);
Mess_IntegralNick2 = Mess_IntegralNick;
}
 
Integral_Gier = Mess_Integral_Gier;
IntegralNick = Mess_IntegralNick;
IntegralRoll = Mess_IntegralRoll;
IntegralNick2 = Mess_IntegralNick2;
IntegralRoll2 = Mess_IntegralRoll2;
 
#define D_LIMIT 128
 
MesswertNick = HiResNick / 8;
MesswertRoll = HiResRoll / 8;
 
if(AdWertNick < 15) MesswertNick = -1000; if(AdWertNick < 7) MesswertNick = -2000;
if(PlatinenVersion == 10) { if(AdWertNick > 1010) MesswertNick = +1000; if(AdWertNick > 1017) MesswertNick = +2000; }
else { if(AdWertNick > 2000) MesswertNick = +1000; if(AdWertNick > 2015) MesswertNick = +2000; }
if(AdWertRoll < 15) MesswertRoll = -1000; if(AdWertRoll < 7) MesswertRoll = -2000;
if(PlatinenVersion == 10) { if(AdWertRoll > 1010) MesswertRoll = +1000; if(AdWertRoll > 1017) MesswertRoll = +2000; }
else { if(AdWertRoll > 2000) MesswertRoll = +1000; if(AdWertRoll > 2015) MesswertRoll = +2000; }
 
if(Parameter_Gyro_D)
{
d2Nick = HiResNick - oldNick;
oldNick = (oldNick + HiResNick)/2;
if(d2Nick > D_LIMIT) d2Nick = D_LIMIT;
else if(d2Nick < -D_LIMIT) d2Nick = -D_LIMIT;
MesswertNick += (d2Nick * (signed int) Parameter_Gyro_D) / 16;
d2Roll = HiResRoll - oldRoll;
oldRoll = (oldRoll + HiResRoll)/2;
if(d2Roll > D_LIMIT) d2Roll = D_LIMIT;
else if(d2Roll < -D_LIMIT) d2Roll = -D_LIMIT;
MesswertRoll += (d2Roll * (signed int) Parameter_Gyro_D) / 16;
HiResNick += (d2Nick * (signed int) Parameter_Gyro_D);
HiResRoll += (d2Roll * (signed int) Parameter_Gyro_D);
}
 
if(RohMesswertRoll > 0) TrimRoll += ((long) abs(KopplungsteilNickRoll) * Parameter_CouplingYawCorrection) / 64L;
else TrimRoll -= ((long) abs(KopplungsteilNickRoll) * Parameter_CouplingYawCorrection) / 64L;
if(RohMesswertNick > 0) TrimNick += ((long) abs(KopplungsteilRollNick) * Parameter_CouplingYawCorrection) / 64L;
else TrimNick -= ((long) abs(KopplungsteilRollNick) * Parameter_CouplingYawCorrection) / 64L;
 
if(EE_Parameter.GlobalConfig & CFG_DREHRATEN_BEGRENZER && !Looping_Nick && !Looping_Roll)
{
if(RohMesswertNick > 256) MesswertNick += 1 * (RohMesswertNick - 256);
else if(RohMesswertNick < -256) MesswertNick += 1 * (RohMesswertNick + 256);
if(RohMesswertRoll > 256) MesswertRoll += 1 * (RohMesswertRoll - 256);
else if(RohMesswertRoll < -256) MesswertRoll += 1 * (RohMesswertRoll + 256);
}
 
if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--;
if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--;
if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--;
if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--;
if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255;
if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255;
if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255;
if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255;
}
 
//############################################################################
// Messwerte beim Ermitteln der Nullage
void CalibrierMittelwert(void)
//############################################################################
{
if(PlatinenVersion == 13) SucheGyroOffset();
// ADC auschalten, damit die Werte sich nicht während der Berechnung ändern
ANALOG_OFF;
MesswertNick = AdWertNick;
MesswertRoll = AdWertRoll;
MesswertGier = AdWertGier;
Mittelwert_AccNick = ACC_AMPLIFY * (long)AdWertAccNick;
Mittelwert_AccRoll = ACC_AMPLIFY * (long)AdWertAccRoll;
Mittelwert_AccHoch = (long)AdWertAccHoch;
// ADC einschalten
ANALOG_ON;
if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--;
if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--;
if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--;
if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--;
if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255;
if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255;
if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255;
if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255;
 
Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L;
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L;
}
 
//############################################################################
// Senden der Motorwerte per I2C-Bus
void SendMotorData(void)
//############################################################################
{
unsigned char i;
if(!MotorenEin)
{
MikroKopterFlags &= ~(FLAG_MOTOR_RUN | FLAG_FLY);
for(i=0;i<MAX_MOTORS;i++)
{
if(!PC_MotortestActive) MotorTest[i] = 0;
Motor[i] = MotorTest[i];
}
if(PC_MotortestActive) PC_MotortestActive--;
}
else MikroKopterFlags |= FLAG_MOTOR_RUN;
 
DebugOut.Analog[12] = Motor[0];
DebugOut.Analog[13] = Motor[1];
DebugOut.Analog[14] = Motor[3];
DebugOut.Analog[15] = Motor[2];
 
//Start I2C Interrupt Mode
twi_state = 0;
motor = 0;
i2c_start();
}
 
 
 
//############################################################################
// Trägt ggf. das Poti als Parameter ein
void ParameterZuordnung(void)
//############################################################################
{
#define CHK_POTI_MM(b,a,min,max) { if(a > 250) { if(a == 251) b = Poti1; else if(a == 252) b = Poti2; else if(a == 253) b = Poti3; else if(a == 254) b = Poti4;} else b = a; if(b <= min) b = min; else if(b >= max) b = max;}
#define CHK_POTI(b,a,min,max) { if(a > 250) { if(a == 251) b = Poti1; else if(a == 252) b = Poti2; else if(a == 253) b = Poti3; else if(a == 254) b = Poti4;} else b = a; }
CHK_POTI(Parameter_MaxHoehe,EE_Parameter.MaxHoehe,0,255);
CHK_POTI_MM(Parameter_Luftdruck_D,EE_Parameter.Luftdruck_D,0,100);
CHK_POTI_MM(Parameter_Hoehe_P,EE_Parameter.Hoehe_P,0,100);
CHK_POTI(Parameter_Hoehe_ACC_Wirkung,EE_Parameter.Hoehe_ACC_Wirkung,0,255);
CHK_POTI(Parameter_KompassWirkung,EE_Parameter.KompassWirkung,0,255);
CHK_POTI_MM(Parameter_Gyro_P,EE_Parameter.Gyro_P,10,255);
CHK_POTI(Parameter_Gyro_I,EE_Parameter.Gyro_I,0,255);
CHK_POTI(Parameter_Gyro_D,EE_Parameter.Gyro_D,0,255);
CHK_POTI(Parameter_I_Faktor,EE_Parameter.I_Faktor,0,255);
CHK_POTI(Parameter_UserParam1,EE_Parameter.UserParam1,0,255);
CHK_POTI(Parameter_UserParam2,EE_Parameter.UserParam2,0,255);
CHK_POTI(Parameter_UserParam3,EE_Parameter.UserParam3,0,255);
CHK_POTI(Parameter_UserParam4,EE_Parameter.UserParam4,0,255);
CHK_POTI(Parameter_UserParam5,EE_Parameter.UserParam5,0,255);
CHK_POTI(Parameter_UserParam6,EE_Parameter.UserParam6,0,255);
CHK_POTI(Parameter_UserParam7,EE_Parameter.UserParam7,0,255);
CHK_POTI(Parameter_UserParam8,EE_Parameter.UserParam8,0,255);
CHK_POTI(Parameter_ServoNickControl,EE_Parameter.ServoNickControl,0,255);
CHK_POTI(Parameter_LoopGasLimit,EE_Parameter.LoopGasLimit,0,255);
CHK_POTI(Parameter_AchsKopplung1, EE_Parameter.AchsKopplung1,0,255);
CHK_POTI(Parameter_AchsKopplung2, EE_Parameter.AchsKopplung2,0,255);
CHK_POTI(Parameter_CouplingYawCorrection,EE_Parameter.CouplingYawCorrection,0,255);
// CHK_POTI(Parameter_AchsGegenKopplung1,EE_Parameter.AchsGegenKopplung1,0,255);
CHK_POTI(Parameter_DynamicStability,EE_Parameter.DynamicStability,0,255);
CHK_POTI_MM(Parameter_J16Timing,EE_Parameter.J16Timing,1,255);
CHK_POTI_MM(Parameter_J17Timing,EE_Parameter.J17Timing,1,255);
CHK_POTI(Parameter_ExternalControl,EE_Parameter.ExternalControl,0,255);
Ki = 10300 / (Parameter_I_Faktor + 1);
MAX_GAS = EE_Parameter.Gas_Max;
MIN_GAS = EE_Parameter.Gas_Min;
}
 
 
 
//############################################################################
//
void MotorRegler(void)
//############################################################################
{
int pd_ergebnis_nick,pd_ergebnis_roll,h,tmp_int;
int GierMischanteil,GasMischanteil;
static long SummeNick=0,SummeRoll=0;
static long sollGier = 0,tmp_long,tmp_long2;
static long IntegralFehlerNick = 0;
static long IntegralFehlerRoll = 0;
static unsigned int RcLostTimer;
static unsigned char delay_neutral = 0;
static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
static int hoehenregler = 0;
static char TimerWerteausgabe = 0;
static char NeueKompassRichtungMerken = 0;
static long ausgleichNick, ausgleichRoll;
int IntegralNickMalFaktor,IntegralRollMalFaktor;
unsigned char i;
Mittelwert();
 
GRN_ON;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gaswert ermitteln
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GasMischanteil = StickGas;
if(GasMischanteil < MIN_GAS + 10) GasMischanteil = MIN_GAS + 10;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Empfang schlecht
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(SenderOkay < 100)
{
if(!PcZugriff)
{
if(BeepMuster == 0xffff)
{
beeptime = 15000;
BeepMuster = 0x0c00;
}
}
if(RcLostTimer) RcLostTimer--;
else
{
MotorenEin = 0;
Notlandung = 0;
}
ROT_ON;
if(modell_fliegt > 1000) // wahrscheinlich in der Luft --> langsam absenken
{
GasMischanteil = EE_Parameter.NotGas;
Notlandung = 1;
PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] = 0;
}
else MotorenEin = 0;
}
else
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Emfang gut
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(SenderOkay > 140)
{
Notlandung = 0;
RcLostTimer = EE_Parameter.NotGasZeit * 50;
if(GasMischanteil > 40 && MotorenEin)
{
if(modell_fliegt < 0xffff) modell_fliegt++;
}
if((modell_fliegt < 256))
{
SummeNick = 0;
SummeRoll = 0;
if(modell_fliegt == 250)
{
NeueKompassRichtungMerken = 1;
sollGier = 0;
Mess_Integral_Gier = 0;
// Mess_Integral_Gier2 = 0;
}
} else MikroKopterFlags |= FLAG_FLY;
 
if((PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 80) && MotorenEin == 0)
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// auf Nullwerte kalibrieren
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) // Neutralwerte
{
if(++delay_neutral > 200) // nicht sofort
{
GRN_OFF;
MotorenEin = 0;
delay_neutral = 0;
modell_fliegt = 0;
if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) > 70)
{
unsigned char setting=1;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 1;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 2;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 3;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 4;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 5;
SetActiveParamSetNumber(setting); // aktiven Datensatz merken
}
// else
if(abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 30 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < -70)
{
WinkelOut.CalcState = 1;
beeptime = 1000;
}
else
{
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert?
{
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset();
}
SetNeutral();
Piep(GetActiveParamSetNumber());
}
}
}
else
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75) // ACC Neutralwerte speichern
{
if(++delay_neutral > 200) // nicht sofort
{
GRN_OFF;
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK],0xff); // Werte löschen
MotorenEin = 0;
delay_neutral = 0;
modell_fliegt = 0;
SetNeutral();
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK],NeutralAccX / 256); // ACC-NeutralWerte speichern
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK+1],NeutralAccX % 256); // ACC-NeutralWerte speichern
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL],NeutralAccY / 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL+1],NeutralAccY % 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_Z],(int)NeutralAccZ / 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_Z+1],(int)NeutralAccZ % 256);
Piep(GetActiveParamSetNumber());
}
}
else delay_neutral = 0;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gas ist unten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] < 35-120)
{
// Starten
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75)
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Einschalten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(++delay_einschalten > 200)
{
delay_einschalten = 200;
modell_fliegt = 1;
MotorenEin = 1;
sollGier = 0;
Mess_Integral_Gier = 0;
Mess_Integral_Gier2 = 0;
Mess_IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick;
Mess_IntegralRoll = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccRoll;
Mess_IntegralNick2 = IntegralNick;
Mess_IntegralRoll2 = IntegralRoll;
SummeNick = 0;
SummeRoll = 0;
MikroKopterFlags |= FLAG_START;
KompassEinschaltStartwert = KompassValue;
}
}
else delay_einschalten = 0;
//Auf Neutralwerte setzen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Auschalten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75)
{
if(++delay_ausschalten > 200) // nicht sofort
{
MotorenEin = 0;
delay_ausschalten = 200;
modell_fliegt = 0;
}
}
else delay_ausschalten = 0;
}
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// neue Werte von der Funke
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
if(!NewPpmData-- || Notlandung)
{
static int stick_nick,stick_roll;
int e_stick_nick, e_stick_nick_diff, e_stick_roll, e_stick_roll_diff;
ParameterZuordnung();
 
int stick_p, stick_d;
 
stick_p = EE_Parameter.Stick_P;
stick_d = EE_Parameter.Stick_D;
 
if (Parameter_UserParam8) {
 
int angle, stick_nick_tmp, stick_roll_tmp;
 
if (Parameter_UserParam8 == 254) {
angle = -45;
} else if (Parameter_UserParam8 > 128) {
angle = KompassValue;
} else {
angle = (ErsatzKompass / GIER_GRAD_FAKTOR);
}
 
angle = ((KompassEinschaltStartwert - angle + 360) % 360);
 
stick_nick_tmp = (long)c_cos_8192(angle) * (long)PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] / 8192L;
stick_roll_tmp = (long)c_sin_8192(angle) * (long)PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] / 8192L;
 
e_stick_nick = stick_roll_tmp + stick_nick_tmp;
e_stick_roll = stick_roll_tmp - stick_nick_tmp;
 
stick_nick_tmp = (long)c_cos_8192(angle) * (long)PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] / 8192L;
stick_roll_tmp = (long)c_sin_8192(angle) * (long)PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] / 8192L;
 
e_stick_nick_diff = stick_roll_tmp + stick_nick_tmp;
e_stick_roll_diff = stick_roll_tmp - stick_nick_tmp;
 
if (Parameter_UserParam8 == 255) {
 
int gier = abs(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]);
if (gier > 100) {
stick_d /= 3;
} else if (gier > 50) {
stick_d /= 2;
}
 
if (stick_d < 1) {
stick_d = 1;
}
 
}
 
/*
DebugOut.Analog[12] = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]];
DebugOut.Analog[13] = e_stick_nick;
DebugOut.Analog[14] = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]];
DebugOut.Analog[15] = e_stick_roll;
*/
 
} else {
 
e_stick_nick = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]];
e_stick_roll = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]];
e_stick_nick_diff = PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]];
e_stick_roll_diff = PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]];
 
}
 
stick_nick = (stick_nick * 3 + e_stick_nick * stick_p) / 4;
stick_nick += e_stick_nick_diff * stick_d;
StickNick = stick_nick - (GPS_Nick + GPS_Nick2);
 
stick_roll = (stick_roll * 3 + e_stick_roll * stick_p) / 4;
stick_roll += e_stick_roll_diff * stick_d;
StickRoll = stick_roll - (GPS_Roll + GPS_Roll2);
 
StickGier = -PPM_in[EE_Parameter.Kanalbelegung[K_GIER]];
if(StickGier > 2) StickGier -= 2; else
if(StickGier < -2) StickGier += 2; else StickGier = 0;
 
StickGas = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] + 120;
GyroFaktor = (Parameter_Gyro_P + 10.0);
IntegralFaktor = Parameter_Gyro_I;
GyroFaktorGier = (Parameter_Gyro_P + 10.0);
IntegralFaktorGier = Parameter_Gyro_I;
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Analoge Steuerung per Seriell
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(ExternControl.Config & 0x01 && Parameter_ExternalControl > 128)
{
StickNick += (int) ExternControl.Nick * (int) EE_Parameter.Stick_P;
StickRoll += (int) ExternControl.Roll * (int) EE_Parameter.Stick_P;
StickGier += ExternControl.Gier;
ExternHoehenValue = (int) ExternControl.Hight * (int)EE_Parameter.Hoehe_Verstaerkung;
if(ExternControl.Gas < StickGas) StickGas = ExternControl.Gas;
}
if(StickGas < 0) StickGas = 0;
 
if(EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) IntegralFaktor = 0;
if(GyroFaktor < 0) GyroFaktor = 0;
if(IntegralFaktor < 0) IntegralFaktor = 0;
 
if(abs(StickNick/STICK_GAIN) > MaxStickNick)
{
MaxStickNick = abs(StickNick)/STICK_GAIN;
if(MaxStickNick > 100) MaxStickNick = 100;
}
else MaxStickNick--;
if(abs(StickRoll/STICK_GAIN) > MaxStickRoll)
{
MaxStickRoll = abs(StickRoll)/STICK_GAIN;
if(MaxStickRoll > 100) MaxStickRoll = 100;
}
else MaxStickRoll--;
if(Notlandung) {MaxStickNick = 0; MaxStickRoll = 0;}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Looping?
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_LINKS) Looping_Links = 1;
else
{
{
if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < (EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese))) Looping_Links = 0;
}
}
if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < -EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_RECHTS) Looping_Rechts = 1;
else
{
if(Looping_Rechts) // Hysterese
{
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > -(EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese)) Looping_Rechts = 0;
}
}
 
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_OBEN) Looping_Oben = 1;
else
{
if(Looping_Oben) // Hysterese
{
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < (EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese))) Looping_Oben = 0;
}
}
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < -EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_UNTEN) Looping_Unten = 1;
else
{
if(Looping_Unten) // Hysterese
{
if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -(EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese)) Looping_Unten = 0;
}
}
 
if(Looping_Links || Looping_Rechts) Looping_Roll = 1; else Looping_Roll = 0;
if(Looping_Oben || Looping_Unten) { Looping_Nick = 1; Looping_Roll = 0; Looping_Links = 0; Looping_Rechts = 0;} else Looping_Nick = 0;
} // Ende neue Funken-Werte
 
if(Looping_Roll || Looping_Nick)
{
if(GasMischanteil > EE_Parameter.LoopGasLimit) GasMischanteil = EE_Parameter.LoopGasLimit;
TrichterFlug = 1;
}
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Bei Empfangsausfall im Flug
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(Notlandung)
{
StickGier = 0;
StickNick = 0;
StickRoll = 0;
GyroFaktor = 90;
IntegralFaktor = 120;
GyroFaktorGier = 90;
IntegralFaktorGier = 120;
Looping_Roll = 0;
Looping_Nick = 0;
}
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Integrale auf ACC-Signal abgleichen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define ABGLEICH_ANZAHL 256L
 
MittelIntegralNick += IntegralNick; // Für die Mittelwertbildung aufsummieren
MittelIntegralRoll += IntegralRoll;
MittelIntegralNick2 += IntegralNick2;
MittelIntegralRoll2 += IntegralRoll2;
 
if(Looping_Nick || Looping_Roll)
{
IntegralAccNick = 0;
IntegralAccRoll = 0;
MittelIntegralNick = 0;
MittelIntegralRoll = 0;
MittelIntegralNick2 = 0;
MittelIntegralRoll2 = 0;
Mess_IntegralNick2 = Mess_IntegralNick;
Mess_IntegralRoll2 = Mess_IntegralRoll;
ZaehlMessungen = 0;
LageKorrekturNick = 0;
LageKorrekturRoll = 0;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(!Looping_Nick && !Looping_Roll && (Aktuell_az > 512 || MotorenEin))
{
long tmp_long, tmp_long2;
if(FromNaviCtrl_Value.Kalman_K != -1 /*&& !TrichterFlug*/)
{
tmp_long = (long)(IntegralNick / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccNick);
tmp_long2 = (long)(IntegralRoll / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccRoll);
tmp_long = (tmp_long * FromNaviCtrl_Value.Kalman_K) / (32 * 16);
tmp_long2 = (tmp_long2 * FromNaviCtrl_Value.Kalman_K) / (32 * 16);
if((MaxStickNick > 64) || (MaxStickRoll > 64))
{
tmp_long /= 2;
tmp_long2 /= 2;
}
if(abs(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]) > 25)
{
tmp_long /= 3;
tmp_long2 /= 3;
}
if(tmp_long > (long) FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long = (long) FromNaviCtrl_Value.Kalman_MaxFusion;
if(tmp_long < (long)-FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long = (long)-FromNaviCtrl_Value.Kalman_MaxFusion;
if(tmp_long2 > (long) FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long2 = (long) FromNaviCtrl_Value.Kalman_MaxFusion;
if(tmp_long2 < (long)-FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long2 = (long)-FromNaviCtrl_Value.Kalman_MaxFusion;
}
else
{
tmp_long = (long)(IntegralNick / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccNick);
tmp_long2 = (long)(IntegralRoll / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccRoll);
tmp_long /= 16;
tmp_long2 /= 16;
if((MaxStickNick > 64) || (MaxStickRoll > 64))
{
tmp_long /= 3;
tmp_long2 /= 3;
}
if(abs(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]) > 25)
{
tmp_long /= 3;
tmp_long2 /= 3;
}
 
#define AUSGLEICH 32
if(tmp_long > AUSGLEICH) tmp_long = AUSGLEICH;
if(tmp_long < -AUSGLEICH) tmp_long =-AUSGLEICH;
if(tmp_long2 > AUSGLEICH) tmp_long2 = AUSGLEICH;
if(tmp_long2 <-AUSGLEICH) tmp_long2 =-AUSGLEICH;
}
 
//if(Poti2 > 20) { tmp_long = 0; tmp_long2 = 0;}
Mess_IntegralNick -= tmp_long;
Mess_IntegralRoll -= tmp_long2;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(ZaehlMessungen >= ABGLEICH_ANZAHL)
{
static int cnt = 0;
static char last_n_p,last_n_n,last_r_p,last_r_n;
static long MittelIntegralNick_Alt,MittelIntegralRoll_Alt;
if(!Looping_Nick && !Looping_Roll && !TrichterFlug && EE_Parameter.Driftkomp)
{
MittelIntegralNick /= ABGLEICH_ANZAHL;
MittelIntegralRoll /= ABGLEICH_ANZAHL;
IntegralAccNick = (EE_Parameter.GyroAccFaktor * IntegralAccNick) / ABGLEICH_ANZAHL;
IntegralAccRoll = (EE_Parameter.GyroAccFaktor * IntegralAccRoll) / ABGLEICH_ANZAHL;
IntegralAccZ = IntegralAccZ / ABGLEICH_ANZAHL;
#define MAX_I 0//(Poti2/10)
// Nick ++++++++++++++++++++++++++++++++++++++++++++++++
IntegralFehlerNick = (long)(MittelIntegralNick - (long)IntegralAccNick);
ausgleichNick = IntegralFehlerNick / EE_Parameter.GyroAccAbgleich;
// Roll ++++++++++++++++++++++++++++++++++++++++++++++++
IntegralFehlerRoll = (long)(MittelIntegralRoll - (long)IntegralAccRoll);
ausgleichRoll = IntegralFehlerRoll / EE_Parameter.GyroAccAbgleich;
 
LageKorrekturNick = ausgleichNick / ABGLEICH_ANZAHL;
LageKorrekturRoll = ausgleichRoll / ABGLEICH_ANZAHL;
 
if(((MaxStickNick > 64) || (MaxStickRoll > 64) || (abs(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]) > 25)) && (FromNaviCtrl_Value.Kalman_K == -1))
{
LageKorrekturNick /= 2;
LageKorrekturRoll /= 2;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gyro-Drift ermitteln
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MittelIntegralNick2 /= ABGLEICH_ANZAHL;
MittelIntegralRoll2 /= ABGLEICH_ANZAHL;
tmp_long = IntegralNick2 - IntegralNick;
tmp_long2 = IntegralRoll2 - IntegralRoll;
//DebugOut.Analog[25] = MittelIntegralRoll2 / 26;
 
IntegralFehlerNick = tmp_long;
IntegralFehlerRoll = tmp_long2;
Mess_IntegralNick2 -= IntegralFehlerNick;
Mess_IntegralRoll2 -= IntegralFehlerRoll;
 
// IntegralFehlerNick = (IntegralFehlerNick * 1 + tmp_long) / 2;
// IntegralFehlerRoll = (IntegralFehlerRoll * 1 + tmp_long2) / 2;
if(EE_Parameter.Driftkomp)
{
if(GierGyroFehler > ABGLEICH_ANZAHL/2) { AdNeutralGier++; AdNeutralGierBias++; }
if(GierGyroFehler <-ABGLEICH_ANZAHL/2) { AdNeutralGier--; AdNeutralGierBias--; }
}
//DebugOut.Analog[22] = MittelIntegralRoll / 26;
//DebugOut.Analog[24] = GierGyroFehler;
GierGyroFehler = 0;
 
 
/*DebugOut.Analog[17] = IntegralAccNick / 26;
DebugOut.Analog[18] = IntegralAccRoll / 26;
DebugOut.Analog[19] = IntegralFehlerNick;// / 26;
DebugOut.Analog[20] = IntegralFehlerRoll;// / 26;
*/
//DebugOut.Analog[21] = MittelIntegralNick / 26;
//MittelIntegralRoll = MittelIntegralRoll;
//DebugOut.Analog[28] = ausgleichNick;
/*
DebugOut.Analog[29] = ausgleichRoll;
DebugOut.Analog[30] = LageKorrekturRoll * 10;
*/
 
#define FEHLER_LIMIT (ABGLEICH_ANZAHL / 2)
#define FEHLER_LIMIT1 (ABGLEICH_ANZAHL * 2) //4
#define FEHLER_LIMIT2 (ABGLEICH_ANZAHL * 16) //16
#define BEWEGUNGS_LIMIT 20000
// Nick +++++++++++++++++++++++++++++++++++++++++++++++++
cnt = 1;// + labs(IntegralFehlerNick) / 4096;
if(labs(IntegralFehlerNick) > FEHLER_LIMIT1) cnt = 4;
if(labs(MittelIntegralNick_Alt - MittelIntegralNick) < BEWEGUNGS_LIMIT || (FromNaviCtrl_Value.Kalman_MaxDrift > 3*8))
{
if(IntegralFehlerNick > FEHLER_LIMIT2)
{
if(last_n_p)
{
cnt += labs(IntegralFehlerNick) / (FEHLER_LIMIT2 / 8);
ausgleichNick = IntegralFehlerNick / 8;
if(ausgleichNick > 5000) ausgleichNick = 5000;
LageKorrekturNick += ausgleichNick / ABGLEICH_ANZAHL;
}
else last_n_p = 1;
} else last_n_p = 0;
if(IntegralFehlerNick < -FEHLER_LIMIT2)
{
if(last_n_n)
{
cnt += labs(IntegralFehlerNick) / (FEHLER_LIMIT2 / 8);
ausgleichNick = IntegralFehlerNick / 8;
if(ausgleichNick < -5000) ausgleichNick = -5000;
LageKorrekturNick += ausgleichNick / ABGLEICH_ANZAHL;
}
else last_n_n = 1;
} else last_n_n = 0;
}
else
{
cnt = 0;
KompassSignalSchlecht = 1000;
}
if(cnt > EE_Parameter.Driftkomp) cnt = EE_Parameter.Driftkomp;
if(FromNaviCtrl_Value.Kalman_MaxDrift) if(cnt > FromNaviCtrl_Value.Kalman_MaxDrift) cnt = FromNaviCtrl_Value.Kalman_MaxDrift;
if(IntegralFehlerNick > FEHLER_LIMIT) AdNeutralNick += cnt;
if(IntegralFehlerNick < -FEHLER_LIMIT) AdNeutralNick -= cnt;
 
// Roll +++++++++++++++++++++++++++++++++++++++++++++++++
cnt = 1;// + labs(IntegralFehlerNick) / 4096;
if(labs(IntegralFehlerRoll) > FEHLER_LIMIT1) cnt = 4;
ausgleichRoll = 0;
if(labs(MittelIntegralRoll_Alt - MittelIntegralRoll) < BEWEGUNGS_LIMIT || (FromNaviCtrl_Value.Kalman_MaxDrift > 3*8))
{
if(IntegralFehlerRoll > FEHLER_LIMIT2)
{
if(last_r_p)
{
cnt += labs(IntegralFehlerRoll) / (FEHLER_LIMIT2 / 8);
ausgleichRoll = IntegralFehlerRoll / 8;
if(ausgleichRoll > 5000) ausgleichRoll = 5000;
LageKorrekturRoll += ausgleichRoll / ABGLEICH_ANZAHL;
}
else last_r_p = 1;
} else last_r_p = 0;
if(IntegralFehlerRoll < -FEHLER_LIMIT2)
{
if(last_r_n)
{
cnt += labs(IntegralFehlerRoll) / (FEHLER_LIMIT2 / 8);
ausgleichRoll = IntegralFehlerRoll / 8;
if(ausgleichRoll < -5000) ausgleichRoll = -5000;
LageKorrekturRoll += ausgleichRoll / ABGLEICH_ANZAHL;
}
else last_r_n = 1;
} else last_r_n = 0;
} else
{
cnt = 0;
KompassSignalSchlecht = 1000;
}
if(cnt > EE_Parameter.Driftkomp) cnt = EE_Parameter.Driftkomp;
if(FromNaviCtrl_Value.Kalman_MaxDrift) if(cnt > FromNaviCtrl_Value.Kalman_MaxDrift) cnt = FromNaviCtrl_Value.Kalman_MaxDrift;
if(IntegralFehlerRoll > FEHLER_LIMIT) AdNeutralRoll += cnt;
if(IntegralFehlerRoll < -FEHLER_LIMIT) AdNeutralRoll -= cnt;
}
else
{
LageKorrekturRoll = 0;
LageKorrekturNick = 0;
TrichterFlug = 0;
}
 
if(!IntegralFaktor) { LageKorrekturRoll = 0; LageKorrekturNick = 0;} // z.B. bei HH
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
MittelIntegralNick_Alt = MittelIntegralNick;
MittelIntegralRoll_Alt = MittelIntegralRoll;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
IntegralAccNick = 0;
IntegralAccRoll = 0;
IntegralAccZ = 0;
MittelIntegralNick = 0;
MittelIntegralRoll = 0;
MittelIntegralNick2 = 0;
MittelIntegralRoll2 = 0;
ZaehlMessungen = 0;
} // ZaehlMessungen >= ABGLEICH_ANZAHL
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gieren
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// if(GasMischanteil < 35) { if(StickGier > 10) StickGier = 10; else if(StickGier < -10) StickGier = -10;};
if(abs(StickGier) > 15) // war 35
{
KompassSignalSchlecht = 1000;
if(!(EE_Parameter.GlobalConfig & CFG_KOMPASS_FIX))
{
NeueKompassRichtungMerken = 1;
};
}
tmp_int = (long) EE_Parameter.Gier_P * ((long)StickGier * abs(StickGier)) / 512L; // expo y = ax + bx²
tmp_int += (EE_Parameter.Gier_P * StickGier) / 4;
sollGier = tmp_int;
Mess_Integral_Gier -= tmp_int;
if(Mess_Integral_Gier > 50000) Mess_Integral_Gier = 50000; // begrenzen
if(Mess_Integral_Gier <-50000) Mess_Integral_Gier =-50000;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Kompass
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//DebugOut.Analog[16] = KompassSignalSchlecht;
 
if(KompassValue && (EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV))
{
int w,v,r,fehler,korrektur;
unsigned int c;
w = abs(IntegralNick /512); // mit zunehmender Neigung den Einfluss drosseln
v = abs(IntegralRoll /512);
if(v > w) w = v; // grösste Neigung ermitteln
korrektur = w / 8 + 1;
fehler = ((540 + KompassValue - (ErsatzKompass/GIER_GRAD_FAKTOR)) % 360) - 180;
if(abs(MesswertGier) > 128)
{
fehler = 0;
}
if(!KompassSignalSchlecht && w < 25)
{
GierGyroFehler += fehler;
if(NeueKompassRichtungMerken)
{
beeptime = 200;
// KompassStartwert = KompassValue;
ErsatzKompass = KompassValue * GIER_GRAD_FAKTOR;
KompassStartwert = (ErsatzKompass/GIER_GRAD_FAKTOR);
NeueKompassRichtungMerken = 0;
}
}
ErsatzKompass += (fehler * 8) / korrektur;
c = Parameter_KompassWirkung;
/* experimental
if (StickGas > 128) {
c = c * (255 - ((StickGas - 128) * 255 / 128)) / 255; // wirkung bei mehr gas reduzieren
}
*/
w = (w * c) / 32; // auf die Wirkung normieren
w = c - w; // Wirkung ggf drosseln
if(w >= 0)
{
if(!KompassSignalSchlecht)
{
v = 64 + ((MaxStickNick + MaxStickRoll)) / 8;
r = ((540 + (ErsatzKompass/GIER_GRAD_FAKTOR) - KompassStartwert) % 360) - 180;
// r = KompassRichtung;
v = (r * w) / v; // nach Kompass ausrichten
w = 3 * c;
if(v > w) v = w; // Begrenzen
else
if(v < -w) v = -w;
Mess_Integral_Gier += v;
}
if(KompassSignalSchlecht) KompassSignalSchlecht--;
}
else KompassSignalSchlecht = 500; // so lange das Signal taub stellen --> ca. 1 sek
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Debugwerte zuordnen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(!TimerWerteausgabe--)
{
TimerWerteausgabe = 24;
 
DebugOut.Analog[0] = IntegralNick / (EE_Parameter.GyroAccFaktor * 4);
DebugOut.Analog[1] = IntegralRoll / (EE_Parameter.GyroAccFaktor * 4);
DebugOut.Analog[2] = Mittelwert_AccNick / 4;
DebugOut.Analog[3] = Mittelwert_AccRoll / 4;
DebugOut.Analog[4] = MesswertGier;
DebugOut.Analog[5] = HoehenWert;
DebugOut.Analog[6] = Aktuell_az;//(Mess_Integral_Hoch / 512);//Aktuell_az;
DebugOut.Analog[8] = KompassValue;
DebugOut.Analog[9] = UBat;
DebugOut.Analog[11] = ErsatzKompass / GIER_GRAD_FAKTOR;
DebugOut.Analog[10] = SenderOkay;
//DebugOut.Analog[16] = Mittelwert_AccHoch;
//DebugOut.Analog[17] = FromNaviCtrl_Value.Distance;
//DebugOut.Analog[18] = (int)FromNaviCtrl_Value.OsdBar;
DebugOut.Analog[19] = WinkelOut.CalcState;
DebugOut.Analog[20] = ServoValue;
// DebugOut.Analog[24] = MesswertNick/2;
// DebugOut.Analog[25] = MesswertRoll/2;
DebugOut.Analog[27] = (int)FromNaviCtrl_Value.Kalman_MaxDrift;
// DebugOut.Analog[28] = (int)FromNaviCtrl_Value.Kalman_MaxFusion;
// DebugOut.Analog[29] = (int)FromNaviCtrl_Value.Kalman_K;
DebugOut.Analog[29] = FromNaviCtrl_Value.SerialDataOkay;
DebugOut.Analog[30] = GPS_Nick;
DebugOut.Analog[31] = GPS_Roll;
 
 
// DebugOut.Analog[19] -= DebugOut.Analog[19]/128;
// if(DebugOut.Analog[19] > 0) DebugOut.Analog[19]--; else DebugOut.Analog[19]++;
 
/* DebugOut.Analog[16] = motor_rx[0];
DebugOut.Analog[17] = motor_rx[1];
DebugOut.Analog[18] = motor_rx[2];
DebugOut.Analog[19] = motor_rx[3];
DebugOut.Analog[20] = motor_rx[0] + motor_rx[1] + motor_rx[2] + motor_rx[3];
DebugOut.Analog[20] /= 14;
DebugOut.Analog[21] = motor_rx[4];
DebugOut.Analog[22] = motor_rx[5];
DebugOut.Analog[23] = motor_rx[6];
DebugOut.Analog[24] = motor_rx[7];
DebugOut.Analog[25] = motor_rx[4] + motor_rx[5] + motor_rx[6] + motor_rx[7];
*/
// DebugOut.Analog[9] = MesswertNick;
// DebugOut.Analog[9] = SollHoehe;
// DebugOut.Analog[10] = Mess_Integral_Gier / 128;
// DebugOut.Analog[11] = KompassStartwert;
// DebugOut.Analog[10] = Parameter_Gyro_I;
// DebugOut.Analog[10] = EE_Parameter.Gyro_I;
// DebugOut.Analog[9] = KompassRichtung;
// DebugOut.Analog[10] = GasMischanteil;
// DebugOut.Analog[3] = HoeheD * 32;
// DebugOut.Analog[4] = hoehenregler;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Drehgeschwindigkeit und -winkel zu einem Istwert zusammenfassen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(TrichterFlug) { SummeRoll = 0; SummeNick = 0;};
 
if(!Looping_Nick) IntegralNickMalFaktor = (IntegralNick * IntegralFaktor) / (44000 / STICK_GAIN); else IntegralNickMalFaktor = 0;
if(!Looping_Roll) IntegralRollMalFaktor = (IntegralRoll * IntegralFaktor) / (44000 / STICK_GAIN); else IntegralRollMalFaktor = 0;
 
#define TRIM_MAX 200
if(TrimNick > TRIM_MAX) TrimNick = TRIM_MAX; else if(TrimNick <-TRIM_MAX) TrimNick =-TRIM_MAX;
if(TrimRoll > TRIM_MAX) TrimRoll = TRIM_MAX; else if(TrimRoll <-TRIM_MAX) TrimRoll =-TRIM_MAX;
 
MesswertNick = IntegralNickMalFaktor + (long)((long)MesswertNick * GyroFaktor + (long)TrimNick * 128L) / (256L / STICK_GAIN);
MesswertRoll = IntegralRollMalFaktor + (long)((long)MesswertRoll * GyroFaktor + (long)TrimRoll * 128L) / (256L / STICK_GAIN);
MesswertGier = (long)(MesswertGier * 2 * (long)GyroFaktorGier) / (256L / STICK_GAIN) + (long)(Integral_Gier * IntegralFaktorGier) / (2 * (44000 / STICK_GAIN));
 
// Maximalwerte abfangen
// #define MAX_SENSOR (4096*STICK_GAIN)
#define MAX_SENSOR (4096*4)
if(MesswertNick > MAX_SENSOR) MesswertNick = MAX_SENSOR;
if(MesswertNick < -MAX_SENSOR) MesswertNick = -MAX_SENSOR;
if(MesswertRoll > MAX_SENSOR) MesswertRoll = MAX_SENSOR;
if(MesswertRoll < -MAX_SENSOR) MesswertRoll = -MAX_SENSOR;
if(MesswertGier > MAX_SENSOR) MesswertGier = MAX_SENSOR;
if(MesswertGier < -MAX_SENSOR) MesswertGier = -MAX_SENSOR;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// all BL-Ctrl connected?
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(MissingMotor) if(modell_fliegt > 1 && modell_fliegt < 50 && GasMischanteil > 0)
{
modell_fliegt = 1;
GasMischanteil = MIN_GAS;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Höhenregelung
// Die Höhenregelung schwächt lediglich das Gas ab, erhöht es allerdings nicht
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GasMischanteil *= STICK_GAIN;
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung
{
int tmp_int;
static char delay = 100;
if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER) // Regler wird über Schalter gesteuert
{
if(Parameter_MaxHoehe < 50)
{
if(!delay--)
{
if((MessLuftdruck > 1000) && OCR0A < 254)
{
if(OCR0A < 244)
{
ExpandBaro -= 10;
OCR0A = DruckOffsetSetting - ExpandBaro;
}
else OCR0A = 254;
beeptime = 300;
delay = 250;
}
else
if((MessLuftdruck < 100) && OCR0A > 1)
{
if(OCR0A > 10)
{
ExpandBaro += 10;
OCR0A = DruckOffsetSetting - ExpandBaro;
}
else OCR0A = 1;
beeptime = 300;
delay = 250;
}
else
{
SollHoehe = HoehenWert - 20; // Parameter_MaxHoehe ist der PPM-Wert des Schalters
HoehenReglerAktiv = 0;
delay = 1;
}
}
}
else
{
HoehenReglerAktiv = 1;
delay = 200;
}
}
else
{
SollHoehe = ((int) ExternHoehenValue + (int) Parameter_MaxHoehe) * (int)EE_Parameter.Hoehe_Verstaerkung - 20;
HoehenReglerAktiv = 1;
}
 
if(Notlandung) SollHoehe = 0;
h = HoehenWert;
if((h > SollHoehe) && HoehenReglerAktiv) // zu hoch --> drosseln
{
h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / (16 / STICK_GAIN); // Differenz bestimmen --> P-Anteil
h = GasMischanteil - h; // vom Gas abziehen
h -= (HoeheD)/(8/STICK_GAIN); // D-Anteil
tmp_int = ((Mess_Integral_Hoch / 128) * (signed long) Parameter_Hoehe_ACC_Wirkung) / (128 / STICK_GAIN);
if(tmp_int > 70*STICK_GAIN) tmp_int = 70*STICK_GAIN;
else if(tmp_int < -(70*STICK_GAIN)) tmp_int = -(70*STICK_GAIN);
h -= tmp_int;
hoehenregler = (hoehenregler*15 + h) / 16;
if(hoehenregler < EE_Parameter.Hoehe_MinGas * STICK_GAIN) // nicht unter MIN
{
if(GasMischanteil >= EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = EE_Parameter.Hoehe_MinGas * STICK_GAIN;
if(GasMischanteil < EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = GasMischanteil;
}
if(hoehenregler > GasMischanteil) hoehenregler = GasMischanteil; // nicht mehr als Gas
GasMischanteil = hoehenregler;
}
}
if(GasMischanteil > (MAX_GAS - 20) * STICK_GAIN) GasMischanteil = (MAX_GAS - 20) * STICK_GAIN;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Mischer und PI-Regler
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DebugOut.Analog[7] = GasMischanteil;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gier-Anteil
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define MUL_G 1.0
GierMischanteil = MesswertGier - sollGier * STICK_GAIN; // Regler für Gier
// GierMischanteil = 0;
#define MIN_GIERGAS (40*STICK_GAIN) // unter diesem Gaswert trotzdem Gieren
if(GasMischanteil > MIN_GIERGAS)
{
if(GierMischanteil > (GasMischanteil / 2)) GierMischanteil = GasMischanteil / 2;
if(GierMischanteil < -(GasMischanteil / 2)) GierMischanteil = -(GasMischanteil / 2);
}
else
{
if(GierMischanteil > (MIN_GIERGAS / 2)) GierMischanteil = MIN_GIERGAS / 2;
if(GierMischanteil < -(MIN_GIERGAS / 2)) GierMischanteil = -(MIN_GIERGAS / 2);
}
tmp_int = MAX_GAS*STICK_GAIN;
if(GierMischanteil > ((tmp_int - GasMischanteil))) GierMischanteil = ((tmp_int - GasMischanteil));
if(GierMischanteil < -((tmp_int - GasMischanteil))) GierMischanteil = -((tmp_int - GasMischanteil));
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Nick-Achse
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DiffNick = MesswertNick - StickNick; // Differenz bestimmen
if(IntegralFaktor) SummeNick += IntegralNickMalFaktor - StickNick; // I-Anteil bei Winkelregelung
else SummeNick += DiffNick; // I-Anteil bei HH
if(SummeNick > (STICK_GAIN * 16000L)) SummeNick = (STICK_GAIN * 16000L);
if(SummeNick < -(16000L * STICK_GAIN)) SummeNick = -(16000L * STICK_GAIN);
pd_ergebnis_nick = DiffNick + SummeNick / Ki; // PI-Regler für Nick
// Motor Vorn
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64;
if(pd_ergebnis_nick > tmp_int) pd_ergebnis_nick = tmp_int;
if(pd_ergebnis_nick < -tmp_int) pd_ergebnis_nick = -tmp_int;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Roll-Achse
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DiffRoll = MesswertRoll - StickRoll; // Differenz bestimmen
if(IntegralFaktor) SummeRoll += IntegralRollMalFaktor - StickRoll;// I-Anteil bei Winkelregelung
else SummeRoll += DiffRoll; // I-Anteil bei HH
if(SummeRoll > (STICK_GAIN * 16000L)) SummeRoll = (STICK_GAIN * 16000L);
if(SummeRoll < -(16000L * STICK_GAIN)) SummeRoll = -(16000L * STICK_GAIN);
pd_ergebnis_roll = DiffRoll + SummeRoll / Ki; // PI-Regler für Roll
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64;
if(pd_ergebnis_roll > tmp_int) pd_ergebnis_roll = tmp_int;
if(pd_ergebnis_roll < -tmp_int) pd_ergebnis_roll = -tmp_int;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Universal Mixer
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
for(i=0; i<MAX_MOTORS; i++)
{
signed int tmp_int;
if(Mixer.Motor[i][0] > 0)
{
tmp_int = ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L;
tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L;
tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter
tmp_int = tmp_motorwert[i] / STICK_GAIN;
CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS);
Motor[i] = tmp_int;
}
else Motor[i] = 0;
}
/*
if(Poti1 > 20) Motor1 = 0;
if(Poti1 > 90) Motor6 = 0;
if(Poti1 > 140) Motor2 = 0;
//if(Poti1 > 200) Motor7 = 0;
*/
}
/branches/V0.74d-acid/fc.c.orig
0,0 → 1,1417
/*#######################################################################################
Flight Control
#######################################################################################*/
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + Nur für den privaten Gebrauch
// + 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 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 permittet
// + 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 to systems other than 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 "main.h"
#include "eeprom.c"
 
unsigned char h,m,s;
volatile unsigned int I2CTimeout = 100;
int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll;
int TrimNick, TrimRoll;
int AdNeutralGierBias;
int AdNeutralNick = 0,AdNeutralRoll = 0,AdNeutralGier = 0,StartNeutralRoll = 0,StartNeutralNick = 0;
int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch, NeutralAccX=0, NeutralAccY=0;
int NaviAccNick, NaviAccRoll,NaviCntAcc = 0;
volatile float NeutralAccZ = 0;
unsigned char CosinusNickWinkel = 0, CosinusRollWinkel = 0;
long IntegralNick = 0,IntegralNick2 = 0;
long IntegralRoll = 0,IntegralRoll2 = 0;
long IntegralAccNick = 0,IntegralAccRoll = 0,IntegralAccZ = 0;
long Integral_Gier = 0;
long Mess_IntegralNick = 0,Mess_IntegralNick2 = 0;
long Mess_IntegralRoll = 0,Mess_IntegralRoll2 = 0;
long Mess_Integral_Gier = 0,Mess_Integral_Gier2 = 0;
long MittelIntegralNick,MittelIntegralRoll,MittelIntegralNick2,MittelIntegralRoll2;
volatile long Mess_Integral_Hoch = 0;
int KompassValue = 0;
int KompassStartwert = 0;
int KompassRichtung = 0;
unsigned int KompassSignalSchlecht = 500;
unsigned char MAX_GAS,MIN_GAS;
unsigned char Notlandung = 0;
unsigned char HoehenReglerAktiv = 0;
unsigned char TrichterFlug = 0;
long Umschlag180Nick = 250000L, Umschlag180Roll = 250000L;
long ErsatzKompass;
int ErsatzKompassInGrad; // Kompasswert in Grad
int GierGyroFehler = 0;
char GyroFaktor,GyroFaktorGier;
char IntegralFaktor,IntegralFaktorGier;
int DiffNick,DiffRoll;
int Poti1 = 0, Poti2 = 0, Poti3 = 0, Poti4 = 0;
volatile unsigned char SenderOkay = 0;
int StickNick = 0,StickRoll = 0,StickGier = 0,StickGas = 0;
char MotorenEin = 0;
int HoehenWert = 0;
int SollHoehe = 0;
int LageKorrekturRoll = 0,LageKorrekturNick = 0;
//float Ki = FAKTOR_I;
int Ki = 10300 / 33;
unsigned char Looping_Nick = 0,Looping_Roll = 0;
unsigned char Looping_Links = 0, Looping_Rechts = 0, Looping_Unten = 0, Looping_Oben = 0;
 
unsigned char Parameter_Luftdruck_D = 48; // Wert : 0-250
unsigned char Parameter_MaxHoehe = 251; // Wert : 0-250
unsigned char Parameter_Hoehe_P = 16; // Wert : 0-32
unsigned char Parameter_Hoehe_ACC_Wirkung = 58; // Wert : 0-250
unsigned char Parameter_KompassWirkung = 64; // Wert : 0-250
unsigned char Parameter_Gyro_D = 8; // Wert : 0-250
unsigned char Parameter_Gyro_P = 150; // Wert : 10-250
unsigned char Parameter_Gyro_I = 150; // Wert : 0-250
unsigned char Parameter_Gier_P = 2; // Wert : 1-20
unsigned char Parameter_I_Faktor = 10; // Wert : 1-20
unsigned char Parameter_UserParam1 = 0;
unsigned char Parameter_UserParam2 = 0;
unsigned char Parameter_UserParam3 = 0;
unsigned char Parameter_UserParam4 = 0;
unsigned char Parameter_UserParam5 = 0;
unsigned char Parameter_UserParam6 = 0;
unsigned char Parameter_UserParam7 = 0;
unsigned char Parameter_UserParam8 = 0;
unsigned char Parameter_ServoNickControl = 100;
unsigned char Parameter_LoopGasLimit = 70;
unsigned char Parameter_AchsKopplung1 = 90;
unsigned char Parameter_AchsKopplung2 = 65;
unsigned char Parameter_CouplingYawCorrection = 64;
//unsigned char Parameter_AchsGegenKopplung1 = 0;
unsigned char Parameter_DynamicStability = 100;
unsigned char Parameter_J16Bitmask; // for the J16 Output
unsigned char Parameter_J16Timing; // for the J16 Output
unsigned char Parameter_J17Bitmask; // for the J17 Output
unsigned char Parameter_J17Timing; // for the J17 Output
unsigned char Parameter_NaviGpsModeControl; // Parameters for the Naviboard
unsigned char Parameter_NaviGpsGain;
unsigned char Parameter_NaviGpsP;
unsigned char Parameter_NaviGpsI;
unsigned char Parameter_NaviGpsD;
unsigned char Parameter_NaviGpsACC;
unsigned char Parameter_NaviOperatingRadius;
unsigned char Parameter_NaviWindCorrection;
unsigned char Parameter_NaviSpeedCompensation;
unsigned char Parameter_ExternalControl;
struct mk_param_struct EE_Parameter;
signed int ExternStickNick = 0,ExternStickRoll = 0,ExternStickGier = 0, ExternHoehenValue = -20;
int MaxStickNick = 0,MaxStickRoll = 0;
unsigned int modell_fliegt = 0;
volatile unsigned char MikroKopterFlags = 0;
long GIER_GRAD_FAKTOR = 1291;
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
unsigned char RequiredMotors = 4;
unsigned char Motor[MAX_MOTORS];
signed int tmp_motorwert[MAX_MOTORS];
 
int MotorSmoothing(int neu, int alt)
{
int motor;
if(neu > alt) motor = (1*(int)alt + neu) / 2;
else motor = neu - (alt - neu)*1;
//if(Poti2 < 20) return(neu);
return(motor);
}
 
 
void Piep(unsigned char Anzahl)
{
while(Anzahl--)
{
if(MotorenEin) return; //auf keinen Fall im Flug!
beeptime = 100;
Delay_ms(250);
}
}
 
//############################################################################
// Nullwerte ermitteln
void SetNeutral(void)
//############################################################################
{
unsigned char i;
unsigned int gier_neutral=0, nick_neutral=0, roll_neutral=0;
ServoActive = 0; HEF4017R_ON;
NeutralAccX = 0;
NeutralAccY = 0;
NeutralAccZ = 0;
AdNeutralNick = 0;
AdNeutralRoll = 0;
AdNeutralGier = 0;
AdNeutralGierBias = 0;
Parameter_AchsKopplung1 = 0;
Parameter_AchsKopplung2 = 0;
ExpandBaro = 0;
CalibrierMittelwert();
Delay_ms_Mess(100);
CalibrierMittelwert();
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert?
{
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset();
}
#define NEUTRAL_FILTER 32
for(i=0; i<NEUTRAL_FILTER; i++)
{
Delay_ms_Mess(10);
gier_neutral += AdWertGier;
nick_neutral += AdWertNick;
roll_neutral += AdWertRoll;
}
AdNeutralNick= (nick_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER / 8);
AdNeutralRoll= (roll_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER / 8);
AdNeutralGier= (gier_neutral+NEUTRAL_FILTER/2) / (NEUTRAL_FILTER);
AdNeutralGierBias = AdNeutralGier;
StartNeutralRoll = AdNeutralRoll;
StartNeutralNick = AdNeutralNick;
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) > 4)
{
NeutralAccY = abs(Mittelwert_AccRoll) / (2*ACC_AMPLIFY);
NeutralAccX = abs(Mittelwert_AccNick) / (2*ACC_AMPLIFY);
NeutralAccZ = Aktuell_az;
}
else
{
NeutralAccX = (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) * 256 + (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK+1]);
NeutralAccY = (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL]) * 256 + (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL+1]);
NeutralAccZ = (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_Z]) * 256 + (int)eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_Z+1]);
}
 
MesswertNick = 0;
MesswertRoll = 0;
MesswertGier = 0;
Delay_ms_Mess(100);
Mittelwert_AccNick = ACC_AMPLIFY * (long)AdWertAccNick;
Mittelwert_AccRoll = ACC_AMPLIFY * (long)AdWertAccRoll;
IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick;
IntegralRoll = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccRoll;
Mess_IntegralNick2 = IntegralNick;
Mess_IntegralRoll2 = IntegralRoll;
Mess_Integral_Gier = 0;
StartLuftdruck = Luftdruck;
HoeheD = 0;
Mess_Integral_Hoch = 0;
KompassStartwert = KompassValue;
GPS_Neutral();
beeptime = 50;
Umschlag180Nick = ((long) EE_Parameter.WinkelUmschlagNick * 2500L) + 15000L;
Umschlag180Roll = ((long) EE_Parameter.WinkelUmschlagRoll * 2500L) + 15000L;
ExternHoehenValue = 0;
ErsatzKompass = KompassValue * GIER_GRAD_FAKTOR;
GierGyroFehler = 0;
SendVersionToNavi = 1;
LED_Init();
MikroKopterFlags |= FLAG_CALIBRATE;
FromNaviCtrl_Value.Kalman_K = -1;
FromNaviCtrl_Value.Kalman_MaxDrift = 0;
FromNaviCtrl_Value.Kalman_MaxFusion = 32;
Poti1 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110;
Poti2 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110;
Poti3 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110;
Poti4 = PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110;
ServoActive = 1;
SenderOkay = 100;
}
 
//############################################################################
// Bearbeitet die Messwerte
void Mittelwert(void)
//############################################################################
{
static signed long tmpl,tmpl2,tmpl3,tmpl4;
static signed int oldNick, oldRoll, d2Roll, d2Nick;
signed long winkel_nick, winkel_roll;
 
MesswertGier = (signed int) AdNeutralGier - AdWertGier;
// MesswertGierBias = (signed int) AdNeutralGierBias - AdWertGier;
MesswertNick = (signed int) AdWertNickFilter / 8;
MesswertRoll = (signed int) AdWertRollFilter / 8;
RohMesswertNick = MesswertNick;
RohMesswertRoll = MesswertRoll;
//DebugOut.Analog[21] = MesswertNick;
//DebugOut.Analog[22] = MesswertRoll;
//DebugOut.Analog[22] = Mess_Integral_Gier;
//DebugOut.Analog[21] = MesswertNick;
//DebugOut.Analog[22] = MesswertRoll;
 
// Beschleunigungssensor ++++++++++++++++++++++++++++++++++++++++++++++++
Mittelwert_AccNick = ((long)Mittelwert_AccNick * 3 + ((ACC_AMPLIFY * (long)AdWertAccNick))) / 4L;
Mittelwert_AccRoll = ((long)Mittelwert_AccRoll * 3 + ((ACC_AMPLIFY * (long)AdWertAccRoll))) / 4L;
Mittelwert_AccHoch = ((long)Mittelwert_AccHoch * 3 + ((long)AdWertAccHoch)) / 4L;
IntegralAccNick += ACC_AMPLIFY * AdWertAccNick;
IntegralAccRoll += ACC_AMPLIFY * AdWertAccRoll;
NaviAccNick += AdWertAccNick;
NaviAccRoll += AdWertAccRoll;
NaviCntAcc++;
IntegralAccZ += Aktuell_az - NeutralAccZ;
 
//++++++++++++++++++++++++++++++++++++++++++++++++
// ADC einschalten
ANALOG_ON;
AdReady = 0;
//++++++++++++++++++++++++++++++++++++++++++++++++
 
if(Mess_IntegralRoll > 93000L) winkel_roll = 93000L;
else if(Mess_IntegralRoll <-93000L) winkel_roll = -93000L;
else winkel_roll = Mess_IntegralRoll;
 
if(Mess_IntegralNick > 93000L) winkel_nick = 93000L;
else if(Mess_IntegralNick <-93000L) winkel_nick = -93000L;
else winkel_nick = Mess_IntegralNick;
 
// Gier ++++++++++++++++++++++++++++++++++++++++++++++++
Mess_Integral_Gier += MesswertGier;
ErsatzKompass += MesswertGier;
// Kopplungsanteil +++++++++++++++++++++++++++++++++++++
if(!Looping_Nick && !Looping_Roll && (EE_Parameter.GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV))
{
tmpl3 = (MesswertRoll * winkel_nick) / 2048L;
tmpl3 *= Parameter_AchsKopplung2; //65
tmpl3 /= 4096L;
tmpl4 = (MesswertNick * winkel_roll) / 2048L;
tmpl4 *= Parameter_AchsKopplung2; //65
tmpl4 /= 4096L;
KopplungsteilNickRoll = tmpl3;
KopplungsteilRollNick = tmpl4;
tmpl4 -= tmpl3;
ErsatzKompass += tmpl4;
if(!Parameter_CouplingYawCorrection) Mess_Integral_Gier -= tmpl4/2; // Gier nachhelfen
 
tmpl = ((MesswertGier + tmpl4) * winkel_nick) / 2048L;
tmpl *= Parameter_AchsKopplung1; // 90
tmpl /= 4096L;
tmpl2 = ((MesswertGier + tmpl4) * winkel_roll) / 2048L;
tmpl2 *= Parameter_AchsKopplung1;
tmpl2 /= 4096L;
if(abs(MesswertGier) > 64) if(labs(tmpl) > 128 || labs(tmpl2) > 128) TrichterFlug = 1;
//MesswertGier += (Parameter_CouplingYawCorrection * tmpl4) / 256;
}
else tmpl = tmpl2 = KopplungsteilNickRoll = KopplungsteilRollNick = 0;
 
TrimRoll = tmpl - tmpl2 / 100L;
TrimNick = -tmpl2 + tmpl / 100L;
 
// Kompasswert begrenzen ++++++++++++++++++++++++++++++++++++++++++++++++
if(ErsatzKompass >= (360L * GIER_GRAD_FAKTOR)) ErsatzKompass -= 360L * GIER_GRAD_FAKTOR; // 360° Umschlag
if(ErsatzKompass < 0) ErsatzKompass += 360L * GIER_GRAD_FAKTOR;
// Roll ++++++++++++++++++++++++++++++++++++++++++++++++
Mess_IntegralRoll2 += MesswertRoll + TrimRoll;
Mess_IntegralRoll += MesswertRoll + TrimRoll - LageKorrekturRoll;
if(Mess_IntegralRoll > Umschlag180Roll)
{
Mess_IntegralRoll = -(Umschlag180Roll - 25000L);
Mess_IntegralRoll2 = Mess_IntegralRoll;
}
if(Mess_IntegralRoll <-Umschlag180Roll)
{
Mess_IntegralRoll = (Umschlag180Roll - 25000L);
Mess_IntegralRoll2 = Mess_IntegralRoll;
}
// Nick ++++++++++++++++++++++++++++++++++++++++++++++++
Mess_IntegralNick2 += MesswertNick + TrimNick;
Mess_IntegralNick += MesswertNick + TrimNick - LageKorrekturNick;
if(Mess_IntegralNick > Umschlag180Nick)
{
Mess_IntegralNick = -(Umschlag180Nick - 25000L);
Mess_IntegralNick2 = Mess_IntegralNick;
}
if(Mess_IntegralNick <-Umschlag180Nick)
{
Mess_IntegralNick = (Umschlag180Nick - 25000L);
Mess_IntegralNick2 = Mess_IntegralNick;
}
 
Integral_Gier = Mess_Integral_Gier;
IntegralNick = Mess_IntegralNick;
IntegralRoll = Mess_IntegralRoll;
IntegralNick2 = Mess_IntegralNick2;
IntegralRoll2 = Mess_IntegralRoll2;
 
#define D_LIMIT 128
 
MesswertNick = HiResNick / 8;
MesswertRoll = HiResRoll / 8;
 
if(AdWertNick < 15) MesswertNick = -1000; if(AdWertNick < 7) MesswertNick = -2000;
if(PlatinenVersion == 10) { if(AdWertNick > 1010) MesswertNick = +1000; if(AdWertNick > 1017) MesswertNick = +2000; }
else { if(AdWertNick > 2000) MesswertNick = +1000; if(AdWertNick > 2015) MesswertNick = +2000; }
if(AdWertRoll < 15) MesswertRoll = -1000; if(AdWertRoll < 7) MesswertRoll = -2000;
if(PlatinenVersion == 10) { if(AdWertRoll > 1010) MesswertRoll = +1000; if(AdWertRoll > 1017) MesswertRoll = +2000; }
else { if(AdWertRoll > 2000) MesswertRoll = +1000; if(AdWertRoll > 2015) MesswertRoll = +2000; }
 
if(Parameter_Gyro_D)
{
d2Nick = HiResNick - oldNick;
oldNick = (oldNick + HiResNick)/2;
if(d2Nick > D_LIMIT) d2Nick = D_LIMIT;
else if(d2Nick < -D_LIMIT) d2Nick = -D_LIMIT;
MesswertNick += (d2Nick * (signed int) Parameter_Gyro_D) / 16;
d2Roll = HiResRoll - oldRoll;
oldRoll = (oldRoll + HiResRoll)/2;
if(d2Roll > D_LIMIT) d2Roll = D_LIMIT;
else if(d2Roll < -D_LIMIT) d2Roll = -D_LIMIT;
MesswertRoll += (d2Roll * (signed int) Parameter_Gyro_D) / 16;
HiResNick += (d2Nick * (signed int) Parameter_Gyro_D);
HiResRoll += (d2Roll * (signed int) Parameter_Gyro_D);
}
 
if(RohMesswertRoll > 0) TrimRoll += ((long) abs(KopplungsteilNickRoll) * Parameter_CouplingYawCorrection) / 64L;
else TrimRoll -= ((long) abs(KopplungsteilNickRoll) * Parameter_CouplingYawCorrection) / 64L;
if(RohMesswertNick > 0) TrimNick += ((long) abs(KopplungsteilRollNick) * Parameter_CouplingYawCorrection) / 64L;
else TrimNick -= ((long) abs(KopplungsteilRollNick) * Parameter_CouplingYawCorrection) / 64L;
 
if(EE_Parameter.GlobalConfig & CFG_DREHRATEN_BEGRENZER && !Looping_Nick && !Looping_Roll)
{
if(RohMesswertNick > 256) MesswertNick += 1 * (RohMesswertNick - 256);
else if(RohMesswertNick < -256) MesswertNick += 1 * (RohMesswertNick + 256);
if(RohMesswertRoll > 256) MesswertRoll += 1 * (RohMesswertRoll - 256);
else if(RohMesswertRoll < -256) MesswertRoll += 1 * (RohMesswertRoll + 256);
}
 
if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--;
if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--;
if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--;
if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--;
if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255;
if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255;
if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255;
if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255;
}
 
//############################################################################
// Messwerte beim Ermitteln der Nullage
void CalibrierMittelwert(void)
//############################################################################
{
if(PlatinenVersion == 13) SucheGyroOffset();
// ADC auschalten, damit die Werte sich nicht während der Berechnung ändern
ANALOG_OFF;
MesswertNick = AdWertNick;
MesswertRoll = AdWertRoll;
MesswertGier = AdWertGier;
Mittelwert_AccNick = ACC_AMPLIFY * (long)AdWertAccNick;
Mittelwert_AccRoll = ACC_AMPLIFY * (long)AdWertAccRoll;
Mittelwert_AccHoch = (long)AdWertAccHoch;
// ADC einschalten
ANALOG_ON;
if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--;
if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--;
if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--;
if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--;
if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255;
if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255;
if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255;
if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255;
 
Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L;
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L;
}
 
//############################################################################
// Senden der Motorwerte per I2C-Bus
void SendMotorData(void)
//############################################################################
{
unsigned char i;
if(!MotorenEin)
{
MikroKopterFlags &= ~(FLAG_MOTOR_RUN | FLAG_FLY);
for(i=0;i<MAX_MOTORS;i++)
{
if(!PC_MotortestActive) MotorTest[i] = 0;
Motor[i] = MotorTest[i];
}
if(PC_MotortestActive) PC_MotortestActive--;
}
else MikroKopterFlags |= FLAG_MOTOR_RUN;
 
DebugOut.Analog[12] = Motor[0];
DebugOut.Analog[13] = Motor[1];
DebugOut.Analog[14] = Motor[3];
DebugOut.Analog[15] = Motor[2];
 
//Start I2C Interrupt Mode
twi_state = 0;
motor = 0;
i2c_start();
}
 
 
 
//############################################################################
// Trägt ggf. das Poti als Parameter ein
void ParameterZuordnung(void)
//############################################################################
{
#define CHK_POTI_MM(b,a,min,max) { if(a > 250) { if(a == 251) b = Poti1; else if(a == 252) b = Poti2; else if(a == 253) b = Poti3; else if(a == 254) b = Poti4;} else b = a; if(b <= min) b = min; else if(b >= max) b = max;}
#define CHK_POTI(b,a,min,max) { if(a > 250) { if(a == 251) b = Poti1; else if(a == 252) b = Poti2; else if(a == 253) b = Poti3; else if(a == 254) b = Poti4;} else b = a; }
CHK_POTI(Parameter_MaxHoehe,EE_Parameter.MaxHoehe,0,255);
CHK_POTI_MM(Parameter_Luftdruck_D,EE_Parameter.Luftdruck_D,0,100);
CHK_POTI_MM(Parameter_Hoehe_P,EE_Parameter.Hoehe_P,0,100);
CHK_POTI(Parameter_Hoehe_ACC_Wirkung,EE_Parameter.Hoehe_ACC_Wirkung,0,255);
CHK_POTI(Parameter_KompassWirkung,EE_Parameter.KompassWirkung,0,255);
CHK_POTI_MM(Parameter_Gyro_P,EE_Parameter.Gyro_P,10,255);
CHK_POTI(Parameter_Gyro_I,EE_Parameter.Gyro_I,0,255);
CHK_POTI(Parameter_Gyro_D,EE_Parameter.Gyro_D,0,255);
CHK_POTI(Parameter_I_Faktor,EE_Parameter.I_Faktor,0,255);
CHK_POTI(Parameter_UserParam1,EE_Parameter.UserParam1,0,255);
CHK_POTI(Parameter_UserParam2,EE_Parameter.UserParam2,0,255);
CHK_POTI(Parameter_UserParam3,EE_Parameter.UserParam3,0,255);
CHK_POTI(Parameter_UserParam4,EE_Parameter.UserParam4,0,255);
CHK_POTI(Parameter_UserParam5,EE_Parameter.UserParam5,0,255);
CHK_POTI(Parameter_UserParam6,EE_Parameter.UserParam6,0,255);
CHK_POTI(Parameter_UserParam7,EE_Parameter.UserParam7,0,255);
CHK_POTI(Parameter_UserParam8,EE_Parameter.UserParam8,0,255);
CHK_POTI(Parameter_ServoNickControl,EE_Parameter.ServoNickControl,0,255);
CHK_POTI(Parameter_LoopGasLimit,EE_Parameter.LoopGasLimit,0,255);
CHK_POTI(Parameter_AchsKopplung1, EE_Parameter.AchsKopplung1,0,255);
CHK_POTI(Parameter_AchsKopplung2, EE_Parameter.AchsKopplung2,0,255);
CHK_POTI(Parameter_CouplingYawCorrection,EE_Parameter.CouplingYawCorrection,0,255);
// CHK_POTI(Parameter_AchsGegenKopplung1,EE_Parameter.AchsGegenKopplung1,0,255);
CHK_POTI(Parameter_DynamicStability,EE_Parameter.DynamicStability,0,255);
CHK_POTI_MM(Parameter_J16Timing,EE_Parameter.J16Timing,1,255);
CHK_POTI_MM(Parameter_J17Timing,EE_Parameter.J17Timing,1,255);
CHK_POTI(Parameter_ExternalControl,EE_Parameter.ExternalControl,0,255);
Ki = 10300 / (Parameter_I_Faktor + 1);
MAX_GAS = EE_Parameter.Gas_Max;
MIN_GAS = EE_Parameter.Gas_Min;
}
 
 
 
//############################################################################
//
void MotorRegler(void)
//############################################################################
{
int pd_ergebnis_nick,pd_ergebnis_roll,h,tmp_int;
int GierMischanteil,GasMischanteil;
static long SummeNick=0,SummeRoll=0;
static long sollGier = 0,tmp_long,tmp_long2;
static long IntegralFehlerNick = 0;
static long IntegralFehlerRoll = 0;
static unsigned int RcLostTimer;
static unsigned char delay_neutral = 0;
static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
static int hoehenregler = 0;
static char TimerWerteausgabe = 0;
static char NeueKompassRichtungMerken = 0;
static long ausgleichNick, ausgleichRoll;
int IntegralNickMalFaktor,IntegralRollMalFaktor;
unsigned char i;
Mittelwert();
 
GRN_ON;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gaswert ermitteln
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GasMischanteil = StickGas;
if(GasMischanteil < MIN_GAS + 10) GasMischanteil = MIN_GAS + 10;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Empfang schlecht
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(SenderOkay < 100)
{
if(!PcZugriff)
{
if(BeepMuster == 0xffff)
{
beeptime = 15000;
BeepMuster = 0x0c00;
}
}
if(RcLostTimer) RcLostTimer--;
else
{
MotorenEin = 0;
Notlandung = 0;
}
ROT_ON;
if(modell_fliegt > 1000) // wahrscheinlich in der Luft --> langsam absenken
{
GasMischanteil = EE_Parameter.NotGas;
Notlandung = 1;
PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] = 0;
}
else MotorenEin = 0;
}
else
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Emfang gut
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(SenderOkay > 140)
{
Notlandung = 0;
RcLostTimer = EE_Parameter.NotGasZeit * 50;
if(GasMischanteil > 40 && MotorenEin)
{
if(modell_fliegt < 0xffff) modell_fliegt++;
}
if((modell_fliegt < 256))
{
SummeNick = 0;
SummeRoll = 0;
if(modell_fliegt == 250)
{
NeueKompassRichtungMerken = 1;
sollGier = 0;
Mess_Integral_Gier = 0;
// Mess_Integral_Gier2 = 0;
}
} else MikroKopterFlags |= FLAG_FLY;
 
if((PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 80) && MotorenEin == 0)
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// auf Nullwerte kalibrieren
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) // Neutralwerte
{
if(++delay_neutral > 200) // nicht sofort
{
GRN_OFF;
MotorenEin = 0;
delay_neutral = 0;
modell_fliegt = 0;
if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) > 70)
{
unsigned char setting=1;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 1;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 2;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 3;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 4;
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 5;
SetActiveParamSetNumber(setting); // aktiven Datensatz merken
}
// else
if(abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < 30 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < -70)
{
WinkelOut.CalcState = 1;
beeptime = 1000;
}
else
{
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert?
{
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset();
}
SetNeutral();
Piep(GetActiveParamSetNumber());
}
}
}
else
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75) // ACC Neutralwerte speichern
{
if(++delay_neutral > 200) // nicht sofort
{
GRN_OFF;
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK],0xff); // Werte löschen
MotorenEin = 0;
delay_neutral = 0;
modell_fliegt = 0;
SetNeutral();
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK],NeutralAccX / 256); // ACC-NeutralWerte speichern
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK+1],NeutralAccX % 256); // ACC-NeutralWerte speichern
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL],NeutralAccY / 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL+1],NeutralAccY % 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_Z],(int)NeutralAccZ / 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_Z+1],(int)NeutralAccZ % 256);
Piep(GetActiveParamSetNumber());
}
}
else delay_neutral = 0;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gas ist unten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] < 35-120)
{
// Starten
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75)
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Einschalten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(++delay_einschalten > 200)
{
delay_einschalten = 200;
modell_fliegt = 1;
MotorenEin = 1;
sollGier = 0;
Mess_Integral_Gier = 0;
Mess_Integral_Gier2 = 0;
Mess_IntegralNick = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccNick;
Mess_IntegralRoll = EE_Parameter.GyroAccFaktor * (long)Mittelwert_AccRoll;
Mess_IntegralNick2 = IntegralNick;
Mess_IntegralRoll2 = IntegralRoll;
SummeNick = 0;
SummeRoll = 0;
MikroKopterFlags |= FLAG_START;
}
}
else delay_einschalten = 0;
//Auf Neutralwerte setzen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Auschalten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75)
{
if(++delay_ausschalten > 200) // nicht sofort
{
MotorenEin = 0;
delay_ausschalten = 200;
modell_fliegt = 0;
}
}
else delay_ausschalten = 0;
}
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// neue Werte von der Funke
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
if(!NewPpmData-- || Notlandung)
{
static int stick_nick,stick_roll;
ParameterZuordnung();
stick_nick = (stick_nick * 3 + PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_P) / 4;
stick_nick += PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_D;
StickNick = stick_nick - (GPS_Nick + GPS_Nick2);
 
stick_roll = (stick_roll * 3 + PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_P) / 4;
stick_roll += PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_D;
StickRoll = stick_roll - (GPS_Roll + GPS_Roll2);
 
StickGier = -PPM_in[EE_Parameter.Kanalbelegung[K_GIER]];
if(StickGier > 2) StickGier -= 2; else
if(StickGier < -2) StickGier += 2; else StickGier = 0;
 
StickGas = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] + 120;
GyroFaktor = (Parameter_Gyro_P + 10.0);
IntegralFaktor = Parameter_Gyro_I;
GyroFaktorGier = (Parameter_Gyro_P + 10.0);
IntegralFaktorGier = Parameter_Gyro_I;
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+ Analoge Steuerung per Seriell
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(ExternControl.Config & 0x01 && Parameter_ExternalControl > 128)
{
StickNick += (int) ExternControl.Nick * (int) EE_Parameter.Stick_P;
StickRoll += (int) ExternControl.Roll * (int) EE_Parameter.Stick_P;
StickGier += ExternControl.Gier;
ExternHoehenValue = (int) ExternControl.Hight * (int)EE_Parameter.Hoehe_Verstaerkung;
if(ExternControl.Gas < StickGas) StickGas = ExternControl.Gas;
}
if(StickGas < 0) StickGas = 0;
 
if(EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) IntegralFaktor = 0;
if(GyroFaktor < 0) GyroFaktor = 0;
if(IntegralFaktor < 0) IntegralFaktor = 0;
 
if(abs(StickNick/STICK_GAIN) > MaxStickNick)
{
MaxStickNick = abs(StickNick)/STICK_GAIN;
if(MaxStickNick > 100) MaxStickNick = 100;
}
else MaxStickNick--;
if(abs(StickRoll/STICK_GAIN) > MaxStickRoll)
{
MaxStickRoll = abs(StickRoll)/STICK_GAIN;
if(MaxStickRoll > 100) MaxStickRoll = 100;
}
else MaxStickRoll--;
if(Notlandung) {MaxStickNick = 0; MaxStickRoll = 0;}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Looping?
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_LINKS) Looping_Links = 1;
else
{
{
if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < (EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese))) Looping_Links = 0;
}
}
if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < -EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_RECHTS) Looping_Rechts = 1;
else
{
if(Looping_Rechts) // Hysterese
{
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > -(EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese)) Looping_Rechts = 0;
}
}
 
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_OBEN) Looping_Oben = 1;
else
{
if(Looping_Oben) // Hysterese
{
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < (EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese))) Looping_Oben = 0;
}
}
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < -EE_Parameter.LoopThreshold) && EE_Parameter.BitConfig & CFG_LOOP_UNTEN) Looping_Unten = 1;
else
{
if(Looping_Unten) // Hysterese
{
if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -(EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese)) Looping_Unten = 0;
}
}
 
if(Looping_Links || Looping_Rechts) Looping_Roll = 1; else Looping_Roll = 0;
if(Looping_Oben || Looping_Unten) { Looping_Nick = 1; Looping_Roll = 0; Looping_Links = 0; Looping_Rechts = 0;} else Looping_Nick = 0;
} // Ende neue Funken-Werte
 
if(Looping_Roll || Looping_Nick)
{
if(GasMischanteil > EE_Parameter.LoopGasLimit) GasMischanteil = EE_Parameter.LoopGasLimit;
TrichterFlug = 1;
}
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Bei Empfangsausfall im Flug
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(Notlandung)
{
StickGier = 0;
StickNick = 0;
StickRoll = 0;
GyroFaktor = 90;
IntegralFaktor = 120;
GyroFaktorGier = 90;
IntegralFaktorGier = 120;
Looping_Roll = 0;
Looping_Nick = 0;
}
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Integrale auf ACC-Signal abgleichen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define ABGLEICH_ANZAHL 256L
 
MittelIntegralNick += IntegralNick; // Für die Mittelwertbildung aufsummieren
MittelIntegralRoll += IntegralRoll;
MittelIntegralNick2 += IntegralNick2;
MittelIntegralRoll2 += IntegralRoll2;
 
if(Looping_Nick || Looping_Roll)
{
IntegralAccNick = 0;
IntegralAccRoll = 0;
MittelIntegralNick = 0;
MittelIntegralRoll = 0;
MittelIntegralNick2 = 0;
MittelIntegralRoll2 = 0;
Mess_IntegralNick2 = Mess_IntegralNick;
Mess_IntegralRoll2 = Mess_IntegralRoll;
ZaehlMessungen = 0;
LageKorrekturNick = 0;
LageKorrekturRoll = 0;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(!Looping_Nick && !Looping_Roll && (Aktuell_az > 512 || MotorenEin))
{
long tmp_long, tmp_long2;
if(FromNaviCtrl_Value.Kalman_K != -1 /*&& !TrichterFlug*/)
{
tmp_long = (long)(IntegralNick / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccNick);
tmp_long2 = (long)(IntegralRoll / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccRoll);
tmp_long = (tmp_long * FromNaviCtrl_Value.Kalman_K) / (32 * 16);
tmp_long2 = (tmp_long2 * FromNaviCtrl_Value.Kalman_K) / (32 * 16);
if((MaxStickNick > 64) || (MaxStickRoll > 64))
{
tmp_long /= 2;
tmp_long2 /= 2;
}
if(abs(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]) > 25)
{
tmp_long /= 3;
tmp_long2 /= 3;
}
if(tmp_long > (long) FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long = (long) FromNaviCtrl_Value.Kalman_MaxFusion;
if(tmp_long < (long)-FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long = (long)-FromNaviCtrl_Value.Kalman_MaxFusion;
if(tmp_long2 > (long) FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long2 = (long) FromNaviCtrl_Value.Kalman_MaxFusion;
if(tmp_long2 < (long)-FromNaviCtrl_Value.Kalman_MaxFusion) tmp_long2 = (long)-FromNaviCtrl_Value.Kalman_MaxFusion;
}
else
{
tmp_long = (long)(IntegralNick / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccNick);
tmp_long2 = (long)(IntegralRoll / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccRoll);
tmp_long /= 16;
tmp_long2 /= 16;
if((MaxStickNick > 64) || (MaxStickRoll > 64))
{
tmp_long /= 3;
tmp_long2 /= 3;
}
if(abs(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]) > 25)
{
tmp_long /= 3;
tmp_long2 /= 3;
}
 
#define AUSGLEICH 32
if(tmp_long > AUSGLEICH) tmp_long = AUSGLEICH;
if(tmp_long < -AUSGLEICH) tmp_long =-AUSGLEICH;
if(tmp_long2 > AUSGLEICH) tmp_long2 = AUSGLEICH;
if(tmp_long2 <-AUSGLEICH) tmp_long2 =-AUSGLEICH;
}
 
//if(Poti2 > 20) { tmp_long = 0; tmp_long2 = 0;}
Mess_IntegralNick -= tmp_long;
Mess_IntegralRoll -= tmp_long2;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(ZaehlMessungen >= ABGLEICH_ANZAHL)
{
static int cnt = 0;
static char last_n_p,last_n_n,last_r_p,last_r_n;
static long MittelIntegralNick_Alt,MittelIntegralRoll_Alt;
if(!Looping_Nick && !Looping_Roll && !TrichterFlug && EE_Parameter.Driftkomp)
{
MittelIntegralNick /= ABGLEICH_ANZAHL;
MittelIntegralRoll /= ABGLEICH_ANZAHL;
IntegralAccNick = (EE_Parameter.GyroAccFaktor * IntegralAccNick) / ABGLEICH_ANZAHL;
IntegralAccRoll = (EE_Parameter.GyroAccFaktor * IntegralAccRoll) / ABGLEICH_ANZAHL;
IntegralAccZ = IntegralAccZ / ABGLEICH_ANZAHL;
#define MAX_I 0//(Poti2/10)
// Nick ++++++++++++++++++++++++++++++++++++++++++++++++
IntegralFehlerNick = (long)(MittelIntegralNick - (long)IntegralAccNick);
ausgleichNick = IntegralFehlerNick / EE_Parameter.GyroAccAbgleich;
// Roll ++++++++++++++++++++++++++++++++++++++++++++++++
IntegralFehlerRoll = (long)(MittelIntegralRoll - (long)IntegralAccRoll);
ausgleichRoll = IntegralFehlerRoll / EE_Parameter.GyroAccAbgleich;
 
LageKorrekturNick = ausgleichNick / ABGLEICH_ANZAHL;
LageKorrekturRoll = ausgleichRoll / ABGLEICH_ANZAHL;
 
if(((MaxStickNick > 64) || (MaxStickRoll > 64) || (abs(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]) > 25)) && (FromNaviCtrl_Value.Kalman_K == -1))
{
LageKorrekturNick /= 2;
LageKorrekturRoll /= 2;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gyro-Drift ermitteln
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MittelIntegralNick2 /= ABGLEICH_ANZAHL;
MittelIntegralRoll2 /= ABGLEICH_ANZAHL;
tmp_long = IntegralNick2 - IntegralNick;
tmp_long2 = IntegralRoll2 - IntegralRoll;
//DebugOut.Analog[25] = MittelIntegralRoll2 / 26;
 
IntegralFehlerNick = tmp_long;
IntegralFehlerRoll = tmp_long2;
Mess_IntegralNick2 -= IntegralFehlerNick;
Mess_IntegralRoll2 -= IntegralFehlerRoll;
 
// IntegralFehlerNick = (IntegralFehlerNick * 1 + tmp_long) / 2;
// IntegralFehlerRoll = (IntegralFehlerRoll * 1 + tmp_long2) / 2;
if(EE_Parameter.Driftkomp)
{
if(GierGyroFehler > ABGLEICH_ANZAHL/2) { AdNeutralGier++; AdNeutralGierBias++; }
if(GierGyroFehler <-ABGLEICH_ANZAHL/2) { AdNeutralGier--; AdNeutralGierBias--; }
}
//DebugOut.Analog[22] = MittelIntegralRoll / 26;
//DebugOut.Analog[24] = GierGyroFehler;
GierGyroFehler = 0;
 
 
/*DebugOut.Analog[17] = IntegralAccNick / 26;
DebugOut.Analog[18] = IntegralAccRoll / 26;
DebugOut.Analog[19] = IntegralFehlerNick;// / 26;
DebugOut.Analog[20] = IntegralFehlerRoll;// / 26;
*/
//DebugOut.Analog[21] = MittelIntegralNick / 26;
//MittelIntegralRoll = MittelIntegralRoll;
//DebugOut.Analog[28] = ausgleichNick;
/*
DebugOut.Analog[29] = ausgleichRoll;
DebugOut.Analog[30] = LageKorrekturRoll * 10;
*/
 
#define FEHLER_LIMIT (ABGLEICH_ANZAHL / 2)
#define FEHLER_LIMIT1 (ABGLEICH_ANZAHL * 2) //4
#define FEHLER_LIMIT2 (ABGLEICH_ANZAHL * 16) //16
#define BEWEGUNGS_LIMIT 20000
// Nick +++++++++++++++++++++++++++++++++++++++++++++++++
cnt = 1;// + labs(IntegralFehlerNick) / 4096;
if(labs(IntegralFehlerNick) > FEHLER_LIMIT1) cnt = 4;
if(labs(MittelIntegralNick_Alt - MittelIntegralNick) < BEWEGUNGS_LIMIT || (FromNaviCtrl_Value.Kalman_MaxDrift > 3*8))
{
if(IntegralFehlerNick > FEHLER_LIMIT2)
{
if(last_n_p)
{
cnt += labs(IntegralFehlerNick) / (FEHLER_LIMIT2 / 8);
ausgleichNick = IntegralFehlerNick / 8;
if(ausgleichNick > 5000) ausgleichNick = 5000;
LageKorrekturNick += ausgleichNick / ABGLEICH_ANZAHL;
}
else last_n_p = 1;
} else last_n_p = 0;
if(IntegralFehlerNick < -FEHLER_LIMIT2)
{
if(last_n_n)
{
cnt += labs(IntegralFehlerNick) / (FEHLER_LIMIT2 / 8);
ausgleichNick = IntegralFehlerNick / 8;
if(ausgleichNick < -5000) ausgleichNick = -5000;
LageKorrekturNick += ausgleichNick / ABGLEICH_ANZAHL;
}
else last_n_n = 1;
} else last_n_n = 0;
}
else
{
cnt = 0;
KompassSignalSchlecht = 1000;
}
if(cnt > EE_Parameter.Driftkomp) cnt = EE_Parameter.Driftkomp;
if(FromNaviCtrl_Value.Kalman_MaxDrift) if(cnt > FromNaviCtrl_Value.Kalman_MaxDrift) cnt = FromNaviCtrl_Value.Kalman_MaxDrift;
if(IntegralFehlerNick > FEHLER_LIMIT) AdNeutralNick += cnt;
if(IntegralFehlerNick < -FEHLER_LIMIT) AdNeutralNick -= cnt;
 
// Roll +++++++++++++++++++++++++++++++++++++++++++++++++
cnt = 1;// + labs(IntegralFehlerNick) / 4096;
if(labs(IntegralFehlerRoll) > FEHLER_LIMIT1) cnt = 4;
ausgleichRoll = 0;
if(labs(MittelIntegralRoll_Alt - MittelIntegralRoll) < BEWEGUNGS_LIMIT || (FromNaviCtrl_Value.Kalman_MaxDrift > 3*8))
{
if(IntegralFehlerRoll > FEHLER_LIMIT2)
{
if(last_r_p)
{
cnt += labs(IntegralFehlerRoll) / (FEHLER_LIMIT2 / 8);
ausgleichRoll = IntegralFehlerRoll / 8;
if(ausgleichRoll > 5000) ausgleichRoll = 5000;
LageKorrekturRoll += ausgleichRoll / ABGLEICH_ANZAHL;
}
else last_r_p = 1;
} else last_r_p = 0;
if(IntegralFehlerRoll < -FEHLER_LIMIT2)
{
if(last_r_n)
{
cnt += labs(IntegralFehlerRoll) / (FEHLER_LIMIT2 / 8);
ausgleichRoll = IntegralFehlerRoll / 8;
if(ausgleichRoll < -5000) ausgleichRoll = -5000;
LageKorrekturRoll += ausgleichRoll / ABGLEICH_ANZAHL;
}
else last_r_n = 1;
} else last_r_n = 0;
} else
{
cnt = 0;
KompassSignalSchlecht = 1000;
}
if(cnt > EE_Parameter.Driftkomp) cnt = EE_Parameter.Driftkomp;
if(FromNaviCtrl_Value.Kalman_MaxDrift) if(cnt > FromNaviCtrl_Value.Kalman_MaxDrift) cnt = FromNaviCtrl_Value.Kalman_MaxDrift;
if(IntegralFehlerRoll > FEHLER_LIMIT) AdNeutralRoll += cnt;
if(IntegralFehlerRoll < -FEHLER_LIMIT) AdNeutralRoll -= cnt;
}
else
{
LageKorrekturRoll = 0;
LageKorrekturNick = 0;
TrichterFlug = 0;
}
 
if(!IntegralFaktor) { LageKorrekturRoll = 0; LageKorrekturNick = 0;} // z.B. bei HH
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
MittelIntegralNick_Alt = MittelIntegralNick;
MittelIntegralRoll_Alt = MittelIntegralRoll;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
IntegralAccNick = 0;
IntegralAccRoll = 0;
IntegralAccZ = 0;
MittelIntegralNick = 0;
MittelIntegralRoll = 0;
MittelIntegralNick2 = 0;
MittelIntegralRoll2 = 0;
ZaehlMessungen = 0;
} // ZaehlMessungen >= ABGLEICH_ANZAHL
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gieren
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// if(GasMischanteil < 35) { if(StickGier > 10) StickGier = 10; else if(StickGier < -10) StickGier = -10;};
if(abs(StickGier) > 15) // war 35
{
KompassSignalSchlecht = 1000;
if(!(EE_Parameter.GlobalConfig & CFG_KOMPASS_FIX))
{
NeueKompassRichtungMerken = 1;
};
}
tmp_int = (long) EE_Parameter.Gier_P * ((long)StickGier * abs(StickGier)) / 512L; // expo y = ax + bx²
tmp_int += (EE_Parameter.Gier_P * StickGier) / 4;
sollGier = tmp_int;
Mess_Integral_Gier -= tmp_int;
if(Mess_Integral_Gier > 50000) Mess_Integral_Gier = 50000; // begrenzen
if(Mess_Integral_Gier <-50000) Mess_Integral_Gier =-50000;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Kompass
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//DebugOut.Analog[16] = KompassSignalSchlecht;
 
if(KompassValue && (EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV))
{
int w,v,r,fehler,korrektur;
w = abs(IntegralNick /512); // mit zunehmender Neigung den Einfluss drosseln
v = abs(IntegralRoll /512);
if(v > w) w = v; // grösste Neigung ermitteln
korrektur = w / 8 + 1;
fehler = ((540 + KompassValue - (ErsatzKompass/GIER_GRAD_FAKTOR)) % 360) - 180;
if(abs(MesswertGier) > 128)
{
fehler = 0;
}
if(!KompassSignalSchlecht && w < 25)
{
GierGyroFehler += fehler;
if(NeueKompassRichtungMerken)
{
beeptime = 200;
// KompassStartwert = KompassValue;
ErsatzKompass = KompassValue * GIER_GRAD_FAKTOR;
KompassStartwert = (ErsatzKompass/GIER_GRAD_FAKTOR);
NeueKompassRichtungMerken = 0;
}
}
ErsatzKompass += (fehler * 8) / korrektur;
w = (w * Parameter_KompassWirkung) / 32; // auf die Wirkung normieren
w = Parameter_KompassWirkung - w; // Wirkung ggf drosseln
if(w >= 0)
{
if(!KompassSignalSchlecht)
{
v = 64 + ((MaxStickNick + MaxStickRoll)) / 8;
r = ((540 + (ErsatzKompass/GIER_GRAD_FAKTOR) - KompassStartwert) % 360) - 180;
// r = KompassRichtung;
v = (r * w) / v; // nach Kompass ausrichten
w = 3 * Parameter_KompassWirkung;
if(v > w) v = w; // Begrenzen
else
if(v < -w) v = -w;
Mess_Integral_Gier += v;
}
if(KompassSignalSchlecht) KompassSignalSchlecht--;
}
else KompassSignalSchlecht = 500; // so lange das Signal taub stellen --> ca. 1 sek
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Debugwerte zuordnen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(!TimerWerteausgabe--)
{
TimerWerteausgabe = 24;
 
DebugOut.Analog[0] = IntegralNick / (EE_Parameter.GyroAccFaktor * 4);
DebugOut.Analog[1] = IntegralRoll / (EE_Parameter.GyroAccFaktor * 4);
DebugOut.Analog[2] = Mittelwert_AccNick / 4;
DebugOut.Analog[3] = Mittelwert_AccRoll / 4;
DebugOut.Analog[4] = MesswertGier;
DebugOut.Analog[5] = HoehenWert;
DebugOut.Analog[6] = Aktuell_az;//(Mess_Integral_Hoch / 512);//Aktuell_az;
DebugOut.Analog[8] = KompassValue;
DebugOut.Analog[9] = UBat;
DebugOut.Analog[11] = ErsatzKompass / GIER_GRAD_FAKTOR;
DebugOut.Analog[10] = SenderOkay;
//DebugOut.Analog[16] = Mittelwert_AccHoch;
//DebugOut.Analog[17] = FromNaviCtrl_Value.Distance;
//DebugOut.Analog[18] = (int)FromNaviCtrl_Value.OsdBar;
DebugOut.Analog[19] = WinkelOut.CalcState;
DebugOut.Analog[20] = ServoValue;
// DebugOut.Analog[24] = MesswertNick/2;
// DebugOut.Analog[25] = MesswertRoll/2;
DebugOut.Analog[27] = (int)FromNaviCtrl_Value.Kalman_MaxDrift;
// DebugOut.Analog[28] = (int)FromNaviCtrl_Value.Kalman_MaxFusion;
// DebugOut.Analog[29] = (int)FromNaviCtrl_Value.Kalman_K;
DebugOut.Analog[29] = FromNaviCtrl_Value.SerialDataOkay;
DebugOut.Analog[30] = GPS_Nick;
DebugOut.Analog[31] = GPS_Roll;
 
 
// DebugOut.Analog[19] -= DebugOut.Analog[19]/128;
// if(DebugOut.Analog[19] > 0) DebugOut.Analog[19]--; else DebugOut.Analog[19]++;
 
/* DebugOut.Analog[16] = motor_rx[0];
DebugOut.Analog[17] = motor_rx[1];
DebugOut.Analog[18] = motor_rx[2];
DebugOut.Analog[19] = motor_rx[3];
DebugOut.Analog[20] = motor_rx[0] + motor_rx[1] + motor_rx[2] + motor_rx[3];
DebugOut.Analog[20] /= 14;
DebugOut.Analog[21] = motor_rx[4];
DebugOut.Analog[22] = motor_rx[5];
DebugOut.Analog[23] = motor_rx[6];
DebugOut.Analog[24] = motor_rx[7];
DebugOut.Analog[25] = motor_rx[4] + motor_rx[5] + motor_rx[6] + motor_rx[7];
*/
// DebugOut.Analog[9] = MesswertNick;
// DebugOut.Analog[9] = SollHoehe;
// DebugOut.Analog[10] = Mess_Integral_Gier / 128;
// DebugOut.Analog[11] = KompassStartwert;
// DebugOut.Analog[10] = Parameter_Gyro_I;
// DebugOut.Analog[10] = EE_Parameter.Gyro_I;
// DebugOut.Analog[9] = KompassRichtung;
// DebugOut.Analog[10] = GasMischanteil;
// DebugOut.Analog[3] = HoeheD * 32;
// DebugOut.Analog[4] = hoehenregler;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Drehgeschwindigkeit und -winkel zu einem Istwert zusammenfassen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(TrichterFlug) { SummeRoll = 0; SummeNick = 0;};
 
if(!Looping_Nick) IntegralNickMalFaktor = (IntegralNick * IntegralFaktor) / (44000 / STICK_GAIN); else IntegralNickMalFaktor = 0;
if(!Looping_Roll) IntegralRollMalFaktor = (IntegralRoll * IntegralFaktor) / (44000 / STICK_GAIN); else IntegralRollMalFaktor = 0;
 
#define TRIM_MAX 200
if(TrimNick > TRIM_MAX) TrimNick = TRIM_MAX; else if(TrimNick <-TRIM_MAX) TrimNick =-TRIM_MAX;
if(TrimRoll > TRIM_MAX) TrimRoll = TRIM_MAX; else if(TrimRoll <-TRIM_MAX) TrimRoll =-TRIM_MAX;
 
MesswertNick = IntegralNickMalFaktor + (long)((long)MesswertNick * GyroFaktor + (long)TrimNick * 128L) / (256L / STICK_GAIN);
MesswertRoll = IntegralRollMalFaktor + (long)((long)MesswertRoll * GyroFaktor + (long)TrimRoll * 128L) / (256L / STICK_GAIN);
MesswertGier = (long)(MesswertGier * 2 * (long)GyroFaktorGier) / (256L / STICK_GAIN) + (long)(Integral_Gier * IntegralFaktorGier) / (2 * (44000 / STICK_GAIN));
 
// Maximalwerte abfangen
// #define MAX_SENSOR (4096*STICK_GAIN)
#define MAX_SENSOR (4096*4)
if(MesswertNick > MAX_SENSOR) MesswertNick = MAX_SENSOR;
if(MesswertNick < -MAX_SENSOR) MesswertNick = -MAX_SENSOR;
if(MesswertRoll > MAX_SENSOR) MesswertRoll = MAX_SENSOR;
if(MesswertRoll < -MAX_SENSOR) MesswertRoll = -MAX_SENSOR;
if(MesswertGier > MAX_SENSOR) MesswertGier = MAX_SENSOR;
if(MesswertGier < -MAX_SENSOR) MesswertGier = -MAX_SENSOR;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// all BL-Ctrl connected?
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(MissingMotor) if(modell_fliegt > 1 && modell_fliegt < 50 && GasMischanteil > 0)
{
modell_fliegt = 1;
GasMischanteil = MIN_GAS;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Höhenregelung
// Die Höhenregelung schwächt lediglich das Gas ab, erhöht es allerdings nicht
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GasMischanteil *= STICK_GAIN;
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung
{
int tmp_int;
static char delay = 100;
if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER) // Regler wird über Schalter gesteuert
{
if(Parameter_MaxHoehe < 50)
{
if(!delay--)
{
if((MessLuftdruck > 1000) && OCR0A < 254)
{
if(OCR0A < 244)
{
ExpandBaro -= 10;
OCR0A = DruckOffsetSetting - ExpandBaro;
}
else OCR0A = 254;
beeptime = 300;
delay = 250;
}
else
if((MessLuftdruck < 100) && OCR0A > 1)
{
if(OCR0A > 10)
{
ExpandBaro += 10;
OCR0A = DruckOffsetSetting - ExpandBaro;
}
else OCR0A = 1;
beeptime = 300;
delay = 250;
}
else
{
SollHoehe = HoehenWert - 20; // Parameter_MaxHoehe ist der PPM-Wert des Schalters
HoehenReglerAktiv = 0;
delay = 1;
}
}
}
else
{
HoehenReglerAktiv = 1;
delay = 200;
}
}
else
{
SollHoehe = ((int) ExternHoehenValue + (int) Parameter_MaxHoehe) * (int)EE_Parameter.Hoehe_Verstaerkung - 20;
HoehenReglerAktiv = 1;
}
 
if(Notlandung) SollHoehe = 0;
h = HoehenWert;
if((h > SollHoehe) && HoehenReglerAktiv) // zu hoch --> drosseln
{
h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / (16 / STICK_GAIN); // Differenz bestimmen --> P-Anteil
h = GasMischanteil - h; // vom Gas abziehen
h -= (HoeheD)/(8/STICK_GAIN); // D-Anteil
tmp_int = ((Mess_Integral_Hoch / 128) * (signed long) Parameter_Hoehe_ACC_Wirkung) / (128 / STICK_GAIN);
if(tmp_int > 70*STICK_GAIN) tmp_int = 70*STICK_GAIN;
else if(tmp_int < -(70*STICK_GAIN)) tmp_int = -(70*STICK_GAIN);
h -= tmp_int;
hoehenregler = (hoehenregler*15 + h) / 16;
if(hoehenregler < EE_Parameter.Hoehe_MinGas * STICK_GAIN) // nicht unter MIN
{
if(GasMischanteil >= EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = EE_Parameter.Hoehe_MinGas * STICK_GAIN;
if(GasMischanteil < EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = GasMischanteil;
}
if(hoehenregler > GasMischanteil) hoehenregler = GasMischanteil; // nicht mehr als Gas
GasMischanteil = hoehenregler;
}
}
if(GasMischanteil > (MAX_GAS - 20) * STICK_GAIN) GasMischanteil = (MAX_GAS - 20) * STICK_GAIN;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Mischer und PI-Regler
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DebugOut.Analog[7] = GasMischanteil;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gier-Anteil
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define MUL_G 1.0
GierMischanteil = MesswertGier - sollGier * STICK_GAIN; // Regler für Gier
// GierMischanteil = 0;
#define MIN_GIERGAS (40*STICK_GAIN) // unter diesem Gaswert trotzdem Gieren
if(GasMischanteil > MIN_GIERGAS)
{
if(GierMischanteil > (GasMischanteil / 2)) GierMischanteil = GasMischanteil / 2;
if(GierMischanteil < -(GasMischanteil / 2)) GierMischanteil = -(GasMischanteil / 2);
}
else
{
if(GierMischanteil > (MIN_GIERGAS / 2)) GierMischanteil = MIN_GIERGAS / 2;
if(GierMischanteil < -(MIN_GIERGAS / 2)) GierMischanteil = -(MIN_GIERGAS / 2);
}
tmp_int = MAX_GAS*STICK_GAIN;
if(GierMischanteil > ((tmp_int - GasMischanteil))) GierMischanteil = ((tmp_int - GasMischanteil));
if(GierMischanteil < -((tmp_int - GasMischanteil))) GierMischanteil = -((tmp_int - GasMischanteil));
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Nick-Achse
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DiffNick = MesswertNick - StickNick; // Differenz bestimmen
if(IntegralFaktor) SummeNick += IntegralNickMalFaktor - StickNick; // I-Anteil bei Winkelregelung
else SummeNick += DiffNick; // I-Anteil bei HH
if(SummeNick > (STICK_GAIN * 16000L)) SummeNick = (STICK_GAIN * 16000L);
if(SummeNick < -(16000L * STICK_GAIN)) SummeNick = -(16000L * STICK_GAIN);
pd_ergebnis_nick = DiffNick + SummeNick / Ki; // PI-Regler für Nick
// Motor Vorn
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64;
if(pd_ergebnis_nick > tmp_int) pd_ergebnis_nick = tmp_int;
if(pd_ergebnis_nick < -tmp_int) pd_ergebnis_nick = -tmp_int;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Roll-Achse
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DiffRoll = MesswertRoll - StickRoll; // Differenz bestimmen
if(IntegralFaktor) SummeRoll += IntegralRollMalFaktor - StickRoll;// I-Anteil bei Winkelregelung
else SummeRoll += DiffRoll; // I-Anteil bei HH
if(SummeRoll > (STICK_GAIN * 16000L)) SummeRoll = (STICK_GAIN * 16000L);
if(SummeRoll < -(16000L * STICK_GAIN)) SummeRoll = -(16000L * STICK_GAIN);
pd_ergebnis_roll = DiffRoll + SummeRoll / Ki; // PI-Regler für Roll
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64;
if(pd_ergebnis_roll > tmp_int) pd_ergebnis_roll = tmp_int;
if(pd_ergebnis_roll < -tmp_int) pd_ergebnis_roll = -tmp_int;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Universal Mixer
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
for(i=0; i<MAX_MOTORS; i++)
{
signed int tmp_int;
if(Mixer.Motor[i][0] > 0)
{
tmp_int = ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L;
tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L;
tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter
tmp_int = tmp_motorwert[i] / STICK_GAIN;
CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS);
Motor[i] = tmp_int;
}
else Motor[i] = 0;
}
/*
if(Poti1 > 20) Motor1 = 0;
if(Poti1 > 90) Motor6 = 0;
if(Poti1 > 140) Motor2 = 0;
//if(Poti1 > 200) Motor7 = 0;
*/
}
/branches/V0.74d-acid/fc.h
0,0 → 1,182
/*#######################################################################################
Flight Control
#######################################################################################*/
 
#ifndef _FC_H
#define _FC_H
//#define GIER_GRAD_FAKTOR 1291L // Abhängigkeit zwischen GyroIntegral und Winkel
//#define GIER_GRAD_FAKTOR 1160L
extern long GIER_GRAD_FAKTOR; // Abhängigkeit zwischen GyroIntegral und Winkel
#define STICK_GAIN 4
 
#define FLAG_MOTOR_RUN 1
#define FLAG_FLY 2
#define FLAG_CALIBRATE 4
#define FLAG_START 8
#define MAX_MOTORS 12
 
#define CHECK_MIN_MAX(wert,min,max) {if(wert < min) wert = min; else if(wert > max) wert = max;}
 
extern volatile unsigned char MikroKopterFlags;
extern volatile unsigned int I2CTimeout;
extern unsigned char Sekunde,Minute;
 
extern long IntegralNick,IntegralNick2;
extern long IntegralRoll,IntegralRoll2;
//extern int IntegralNick,IntegralNick2;
//extern int IntegralRoll,IntegralRoll2;
 
extern long Mess_IntegralNick,Mess_IntegralNick2;
extern long Mess_IntegralRoll,Mess_IntegralRoll2;
extern long IntegralAccNick,IntegralAccRoll;
extern volatile long Mess_Integral_Hoch;
extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
extern int KompassValue;
extern int KompassStartwert;
extern int KompassRichtung;
extern int TrimNick, TrimRoll;
extern long ErsatzKompass;
extern int ErsatzKompassInGrad; // Kompasswert in Grad
extern int HoehenWert;
extern int SollHoehe;
extern int MesswertNick,MesswertRoll,MesswertGier;
extern int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll;
extern int NeutralAccX, NeutralAccY,Mittelwert_AccHoch;
extern unsigned char HoehenReglerAktiv;
extern volatile float NeutralAccZ;
extern long Umschlag180Nick, Umschlag180Roll;
extern signed int ExternStickNick,ExternStickRoll,ExternStickGier;
extern unsigned char Parameter_UserParam1,Parameter_UserParam2,Parameter_UserParam3,Parameter_UserParam4,Parameter_UserParam5,Parameter_UserParam6,Parameter_UserParam7,Parameter_UserParam8;
extern int NaviAccNick,NaviAccRoll,NaviCntAcc;
extern unsigned int modell_fliegt;
void MotorRegler(void);
void SendMotorData(void);
void CalibrierMittelwert(void);
void Mittelwert(void);
void SetNeutral(void);
void Piep(unsigned char Anzahl);
 
extern unsigned char h,m,s;
extern volatile unsigned char Timeout ;
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
extern int DiffNick,DiffRoll;
extern int Poti1, Poti2, Poti3, Poti4;
extern volatile unsigned char SenderOkay;
extern unsigned char RequiredMotors;
extern int StickNick,StickRoll,StickGier;
extern char MotorenEin;
extern void DefaultKonstanten1(void);
extern void DefaultKonstanten2(void);
extern void DefaultKonstanten3(void);
extern void DefaultStickMapping(void);
 
#define STRUCT_PARAM_LAENGE sizeof(EE_Parameter)
struct mk_param_struct
{
unsigned char Kanalbelegung[8]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
unsigned char Hoehe_MinGas; // Wert : 0-100
unsigned char Luftdruck_D; // Wert : 0-250
unsigned char MaxHoehe; // Wert : 0-32
unsigned char Hoehe_P; // Wert : 0-32
unsigned char Hoehe_Verstaerkung; // Wert : 0-50
unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250
unsigned char Stick_P; // Wert : 1-6
unsigned char Stick_D; // Wert : 0-64
unsigned char Gier_P; // Wert : 1-20
unsigned char Gas_Min; // Wert : 0-32
unsigned char Gas_Max; // Wert : 33-250
unsigned char GyroAccFaktor; // Wert : 1-64
unsigned char KompassWirkung; // Wert : 0-32
unsigned char Gyro_P; // Wert : 10-250
unsigned char Gyro_I; // Wert : 0-250
unsigned char Gyro_D; // Wert : 0-250
unsigned char UnterspannungsWarnung; // Wert : 0-250
unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust
unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
unsigned char UfoAusrichtung; // X oder + Formation
unsigned char I_Faktor; // Wert : 0-250
unsigned char UserParam1; // Wert : 0-250
unsigned char UserParam2; // Wert : 0-250
unsigned char UserParam3; // Wert : 0-250
unsigned char UserParam4; // Wert : 0-250
unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos
unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo
unsigned char ServoNickMin; // Wert : 0-250 // Anschlag
unsigned char ServoNickMax; // Wert : 0-250 // Anschlag
unsigned char ServoNickRefresh; //
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping
unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag
unsigned char LoopHysterese; // Wert: 0-250 Hysterese für Stickausschlag
unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
unsigned char AchsKopplung2; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden
unsigned char CouplingYawCorrection; // Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden
unsigned char WinkelUmschlagNick; // Wert: 0-250 180°-Punkt
unsigned char WinkelUmschlagRoll; // Wert: 0-250 180°-Punkt
unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung)
unsigned char Driftkomp;
unsigned char DynamicStability;
unsigned char UserParam5; // Wert : 0-250
unsigned char UserParam6; // Wert : 0-250
unsigned char UserParam7; // Wert : 0-250
unsigned char UserParam8; // Wert : 0-250
//---Output ---------------------------------------------
unsigned char J16Bitmask; // for the J16 Output
unsigned char J16Timing; // for the J16 Output
unsigned char J17Bitmask; // for the J17 Output
unsigned char J17Timing; // for the J17 Output
//---NaviCtrl---------------------------------------------
unsigned char NaviGpsModeControl; // Parameters for the Naviboard
unsigned char NaviGpsGain;
unsigned char NaviGpsP;
unsigned char NaviGpsI;
unsigned char NaviGpsD;
unsigned char NaviGpsPLimit;
unsigned char NaviGpsILimit;
unsigned char NaviGpsDLimit;
unsigned char NaviGpsACC;
unsigned char NaviGpsMinSat;
unsigned char NaviStickThreshold;
unsigned char NaviWindCorrection;
unsigned char NaviSpeedCompensation;
unsigned char NaviOperatingRadius;
unsigned char NaviAngleLimitation;
unsigned char NaviPH_LoginTime;
//---Ext.Ctrl---------------------------------------------
unsigned char ExternalControl; // for serial Control
//------------------------------------------------
unsigned char BitConfig; // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
unsigned char ServoNickCompInvert; // Wert : 0-250 0 oder 1 // WICHTIG!!! am Ende lassen
unsigned char Reserved[4];
char Name[12];
};
 
 
struct
{
char Revision;
char Name[12];
signed char Motor[16][4];
} Mixer;
extern struct mk_param_struct EE_Parameter;
extern unsigned char Parameter_Luftdruck_D;
extern unsigned char Parameter_MaxHoehe;
extern unsigned char Parameter_Hoehe_P;
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
extern unsigned char Parameter_KompassWirkung;
extern unsigned char Parameter_Gyro_P;
extern unsigned char Parameter_Gyro_I;
extern unsigned char Parameter_Gier_P;
extern unsigned char Parameter_ServoNickControl;
extern unsigned char Parameter_AchsKopplung1;
extern unsigned char Parameter_AchsKopplung2;
//extern unsigned char Parameter_AchsGegenKopplung1;
extern unsigned char Parameter_J16Bitmask; // for the J16 Output
extern unsigned char Parameter_J16Timing; // for the J16 Output
extern unsigned char Parameter_J17Bitmask; // for the J17 Output
extern unsigned char Parameter_J17Timing; // for the J17 Output
extern signed char MixerTable[MAX_MOTORS][4];
extern unsigned char Motor[MAX_MOTORS];
#endif //_FC_H
 
/branches/V0.74d-acid/flight.pnproj
0,0 → 1,0
<Project name="Flight-Ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="printf_P.h"></File><File path="printf_P.c"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="old_macros.h"></File><File path="twimaster.c"></File><File path="version.txt"></File><File path="twimaster.h"></File><File path="rc.c"></File><File path="rc.h"></File><File path="fc.h"></File><File path="menu.h"></File><File path="menu.c"></File><File path="_Settings.h"></File><File path="analog.c"></File><File path="analog.h"></File><File path="GPS.c"></File><File path="gps.h"></File><File path="License.txt"></File><File path="eeprom.c"></File><File path="spi.h"></File><File path="spi.c"></File><File path="led.h"></File><File path="led.c"></File><File path="fc.c"></File><File path="Spectrum.c"></File><File path="Spectrum.h"></File></Project>
/branches/V0.74d-acid/flight.pnps
0,0 → 1,0
<pd><ViewState><e p="Flight-Ctrl" x="true"></e></ViewState></pd>
/branches/V0.74d-acid/flightctrl.aws
0,0 → 1,0
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA644P"/><Files><File00000 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\main.c" Position="266 101 1542 590" LineCol="0 0" State="Maximized"/><File00001 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\uart.c" Position="288 130 1556 589" LineCol="0 0" State="Maximized"/><File00002 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\menu.c" Position="310 159 1578 618" LineCol="0 0" State="Maximized"/><File00003 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\timer0.c" Position="332 188 1600 647" LineCol="0 0" State="Maximized"/><File00004 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\fc.c" Position="262 71 1696 771" LineCol="763 0" State="Maximized"/><File00005 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\fc.h" Position="376 246 1644 705" LineCol="0 0" State="Maximized"/><File00006 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\TWIMASTER.C" Position="398 275 1666 734" LineCol="0 0" State="Maximized"/><File00007 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\_Settings.h" Position="420 304 1688 763" LineCol="0 0" State="Maximized"/><File00008 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\main.h" Position="266 101 1534 560" LineCol="0 0" State="Maximized"/><File00009 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\analog.c" Position="288 130 1556 589" LineCol="0 0" State="Maximized"/><File00010 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\GPS.c" Position="310 159 1578 618" LineCol="0 0" State="Maximized"/><File00011 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\spi.c" Position="332 188 1600 647" LineCol="0 0" State="Maximized"/><File00012 Name="P:\mksvn\FlightCtrl\tags\V0.74d-ctrl-mod\mymath.c" Position="354 217 1622 676" LineCol="0 0" State="Maximized"/></Files></AVRWorkspace>
/branches/V0.74d-acid/gps.h
0,0 → 1,7
extern signed int GPS_Nick;
extern signed int GPS_Roll;
extern signed int GPS_Nick2;
extern signed int GPS_Roll2;
 
void GPS_Neutral(void);
void GPS_BerechneZielrichtung(void);
/branches/V0.74d-acid/led.c
0,0 → 1,49
#include <inttypes.h>
#include "main.h"
 
uint16_t LED1_Timing = 0;
uint16_t LED2_Timing = 0;
unsigned char J16Blinkcount = 0, J16Mask = 1;
unsigned char J17Blinkcount = 0, J17Mask = 1;
 
// initializes the LED control outputs J16, J17
void LED_Init(void)
{
// set PC2 & PC3 as output (control of J16 & J17)
DDRC |= (1<<DDC2)|(1<<DDC3);
J16_OFF;
J17_OFF;
J16Blinkcount = 0; J16Mask = 128;
J17Blinkcount = 0; J17Mask = 128;
}
 
 
// called in UpdateMotors() every 2ms
void LED_Update(void)
{
static char delay = 0;
if(!delay--) // 10ms Intervall
{
delay = 4;
if((EE_Parameter.J16Timing > 250) && (Parameter_J16Timing > 230)) {if(EE_Parameter.J16Bitmask & 128) J16_ON; else J16_OFF;}
else
if((EE_Parameter.J16Timing > 250) && (Parameter_J16Timing < 10)) {if(EE_Parameter.J16Bitmask & 128) J16_OFF; else J16_ON;}
else
if(!J16Blinkcount--)
{
J16Blinkcount = Parameter_J16Timing-1;
if(J16Mask == 1) J16Mask = 128; else J16Mask /= 2;
if(J16Mask & EE_Parameter.J16Bitmask) J16_ON; else J16_OFF;
}
if((EE_Parameter.J17Timing > 250) && (Parameter_J17Timing > 230)) {if(EE_Parameter.J17Bitmask & 128) J17_ON; else J17_OFF;}
else
if((EE_Parameter.J17Timing > 250) && (Parameter_J17Timing < 10)) {if(EE_Parameter.J17Bitmask & 128) J17_OFF; else J17_ON;}
else
if(!J17Blinkcount--)
{
J17Blinkcount = Parameter_J17Timing-1;
if(J17Mask == 1) J17Mask = 128; else J17Mask /= 2;
if(J17Mask & EE_Parameter.J17Bitmask) J17_ON; else J17_OFF;
}
}
}
/branches/V0.74d-acid/led.h
0,0 → 1,11
#include <avr/io.h>
 
#define J16_ON PORTC |= (1<<PORTC2)
#define J16_OFF PORTC &= ~(1<<PORTC2)
#define J16_TOGGLE PORTC ^= (1<<PORTC2)
#define J17_ON PORTC |= (1<<PORTC3)
#define J17_OFF PORTC &= ~(1<<PORTC3)
#define J17_TOGGLE PORTC ^= (1<<PORTC3)
 
extern void LED_Init(void);
extern void LED_Update(void);
/branches/V0.74d-acid/main.c
0,0 → 1,365
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + Nur für den privaten Gebrauch
// + 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 und 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 Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de"
// + eindeutig als Ursprung verlinkt und genannt 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 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 permittet
// + 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 to systems other than 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 "main.h"
 
unsigned char EEPromArray[E2END+1] EEMEM;
unsigned char PlatinenVersion = 10;
unsigned char SendVersionToNavi = 1;
// -- Parametersatz aus EEPROM lesen ---
// number [1..5]
void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length)
{
if((number > 5)||(number < 1)) number = 3;
eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length);
LED_Init();
}
 
// -- Parametersatz ins EEPROM schreiben ---
// number [1..5]
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length)
{
if(number > 5) number = 5;
if(number < 1) return;
eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * (number - 1)], length);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_PARAM_LENGTH], length); // Länge der Datensätze merken
eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_CHANNELS], 8); // 8 Kanäle merken
SetActiveParamSetNumber(number);
LED_Init();
}
 
unsigned char GetActiveParamSetNumber(void)
{
unsigned char set;
set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]);
if((set > 5) || (set < 1))
{
set = 3;
SetActiveParamSetNumber(set); // diesen Parametersatz als aktuell merken
}
return(set);
}
 
 
void SetActiveParamSetNumber(unsigned char number)
{
if(number > 5) number = 5;
if(number < 1) return;
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken
}
 
 
void CalMk3Mag(void)
{
static unsigned char stick = 1;
 
if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -20) stick = 0;
if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < -70) && !stick)
{
stick = 1;
WinkelOut.CalcState++;
if(WinkelOut.CalcState > 4)
{
// WinkelOut.CalcState = 0; // in Uart.c
beeptime = 1000;
}
else Piep(WinkelOut.CalcState);
}
DebugOut.Analog[19] = WinkelOut.CalcState;
}
 
//############################################################################
//Hauptprogramm
int main (void)
//############################################################################
{
unsigned int timer,i;
DDRB = 0x00;
PORTB = 0x00;
for(timer = 0; timer < 1000; timer++); // verzögern
if(PINB & 0x01)
{
if(PINB & 0x02) PlatinenVersion = 13;
else PlatinenVersion = 11;
}
else
{
if(PINB & 0x02) PlatinenVersion = 20;
else PlatinenVersion = 10;
}
 
DDRC = 0x81; // SCL
DDRC |=0x40; // HEF4017 Reset
PORTC = 0xff; // Pullup SDA
DDRB = 0x1B; // LEDs und Druckoffset
PORTB = 0x01; // LED_Rot
DDRD = 0x3E; // Speaker & TXD & J3 J4 J5
DDRD |=0x80; // J7 -> Servo signal
PORTD = 0x47; // LED
HEF4017R_ON;
MCUSR &=~(1<<WDRF);
WDTCSR |= (1<<WDCE)|(1<<WDE);
WDTCSR = 0;
 
beeptime = 2000;
 
StickGier = 0; PPM_in[K_GAS] = 0;StickRoll = 0; StickNick = 0;
if(PlatinenVersion >= 20) GIER_GRAD_FAKTOR = 1160; else GIER_GRAD_FAKTOR = 1291; // unterschiedlich für ME und ENC
ROT_OFF;
 
Timer_Init();
TIMER2_Init();
UART_Init();
rc_sum_init();
ADC_Init();
i2c_init();
SPI_MasterInit();
 
sei();
 
printf("\n\r===================================");
printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",PlatinenVersion/10,PlatinenVersion%10, VERSION_MAJOR, VERSION_MINOR,VERSION_PATCH + 'a');
if(UCSR1A == 0x20 && UCSR1C == 0x06) // initial Values for 644P
{
Uart1Init();
}
GRN_ON;
ReadParameterSet(3, (unsigned char *) &EE_Parameter.Kanalbelegung[0], 9); // read only the first bytes
 
if((eeprom_read_byte(&EEPromArray[EEPROM_ADR_MIXER_TABLE]) == MIXER_REVISION) && // Check Revision in the first Byte
(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) != 0xff)) // Settings reset via Koptertool
{
unsigned char i;
RequiredMotors = 0;
eeprom_read_block(&Mixer, &EEPromArray[EEPROM_ADR_MIXER_TABLE], sizeof(Mixer));
for(i=0; i<16;i++) { if(Mixer.Motor[i][0] > 0) RequiredMotors++;}
}
else // default
{
unsigned char i;
printf("\n\rGenerating default Mixer Table");
for(i=0; i<16;i++) { Mixer.Motor[i][0] = 0;Mixer.Motor[i][1] = 0;Mixer.Motor[i][2] = 0;Mixer.Motor[i][3] = 0;};
// default = Quadro
Mixer.Motor[0][0] = 64; Mixer.Motor[0][1] = +64; Mixer.Motor[0][2] = 0; Mixer.Motor[0][3] = +64;
Mixer.Motor[1][0] = 64; Mixer.Motor[1][1] = -64; Mixer.Motor[1][2] = 0; Mixer.Motor[1][3] = +64;
Mixer.Motor[2][0] = 64; Mixer.Motor[2][1] = 0; Mixer.Motor[2][2] = -64; Mixer.Motor[2][3] = -64;
Mixer.Motor[3][0] = 64; Mixer.Motor[3][1] = 0; Mixer.Motor[3][2] = +64; Mixer.Motor[3][3] = -64;
Mixer.Revision = MIXER_REVISION;
memcpy(Mixer.Name, "Quadro\0", 11);
eeprom_write_block(&Mixer, &EEPromArray[EEPROM_ADR_MIXER_TABLE], sizeof(Mixer));
}
printf("\n\rMixer-Config: '%s' (%u Motors)",Mixer.Name,RequiredMotors);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Check connected BL-Ctrls
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
printf("\n\rFound BL-Ctrl: ");
motorread = 0; UpdateMotor = 0; SendMotorData(); while(!UpdateMotor); motorread = 0; // read the first I2C-Data
for(i=0; i < MAX_MOTORS; i++)
{
UpdateMotor = 0;
SendMotorData();
while(!UpdateMotor);
if(MotorPresent[i]) printf("%d ",i+1);
}
for(i=0; i < MAX_MOTORS; i++)
{
if(!MotorPresent[i] && Mixer.Motor[i][0] > 0) printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1);
MotorError[i] = 0;
}
printf("\n\r===================================");
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Check Settings
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) != EE_DATENREVISION)
{
DefaultKonstanten1();
printf("\n\rInit. EEPROM");
for (unsigned char i=1;i<6;i++)
{
if(i==2) DefaultKonstanten2(); // Kamera
if(i==3) DefaultKonstanten3(); // Beginner
if(i>3) DefaultKonstanten2(); // Kamera
if(PlatinenVersion >= 20)
{
EE_Parameter.Gyro_D = 5;
EE_Parameter.Driftkomp = 0;
EE_Parameter.GyroAccFaktor = 27;
EE_Parameter.WinkelUmschlagNick = 78;
EE_Parameter.WinkelUmschlagRoll = 78;
}
// valid Stick-Settings?
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS]) < 12 && eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+1]) < 12 && eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+2]) < 12 && eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+3]) < 12)
{
EE_Parameter.Kanalbelegung[0] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+0]);
EE_Parameter.Kanalbelegung[1] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+1]);
EE_Parameter.Kanalbelegung[2] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+2]);
EE_Parameter.Kanalbelegung[3] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+3]);
EE_Parameter.Kanalbelegung[4] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+4]);
EE_Parameter.Kanalbelegung[5] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+5]);
EE_Parameter.Kanalbelegung[6] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+6]);
EE_Parameter.Kanalbelegung[7] = eeprom_read_byte(&EEPromArray[EEPROM_ADR_CHANNELS+7]);
if(i==1) printf(": Generating Default-Parameter using old Stick Settings");
} else DefaultStickMapping();
WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
}
SetActiveParamSetNumber(3); // default-Setting
eeprom_write_byte(&EEPromArray[EEPROM_ADR_VALID], EE_DATENREVISION);
}
 
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) > 4)
{
printf("\n\rACC not calibrated !");
}
 
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
printf("\n\rUsing parameterset %d", GetActiveParamSetNumber());
 
 
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
{
printf("\n\rCalibrating pressure sensor..");
timer = SetDelay(1000);
SucheLuftruckOffset();
while (!CheckDelay(timer));
printf("OK\n\r");
}
 
SetNeutral();
 
ROT_OFF;
 
beeptime = 2000;
ExternControl.Digital[0] = 0x55;
 
 
printf("\n\rControl: ");
if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
else printf("Normal (ACC-Mode)");
 
printf("\n\r===================================\n\r");
 
LcdClear();
I2CTimeout = 5000;
WinkelOut.Orientation = 1;
while (1)
{
if(UpdateMotor && AdReady) // ReglerIntervall
{
UpdateMotor=0;
if(WinkelOut.CalcState) CalMk3Mag();
else MotorRegler();
SendMotorData();
ROT_OFF;
if(PcZugriff) PcZugriff--;
else
{
ExternControl.Config = 0;
ExternStickNick = 0;
ExternStickRoll = 0;
ExternStickGier = 0;
}
if(SenderOkay) SenderOkay--;
if(NaviDataOkay)
{
if(--NaviDataOkay == 0)
{
GPS_Nick = 0;
GPS_Roll = 0;
}
}
if(!--I2CTimeout || MissingMotor)
{
if(!I2CTimeout)
{
i2c_reset();
I2CTimeout = 5;
}
if((BeepMuster == 0xffff) && MotorenEin)
{
beeptime = 10000;
BeepMuster = 0x0080;
}
}
else
{
ROT_OFF;
}
if(SIO_DEBUG && (!UpdateMotor || !MotorenEin))
{
DatenUebertragung();
BearbeiteRxDaten();
}
else BearbeiteRxDaten();
if(CheckDelay(timer))
{
if(UBat < EE_Parameter.UnterspannungsWarnung)
{
if(BeepMuster == 0xffff)
{
beeptime = 6000;
BeepMuster = 0x0300;
}
}
SPI_StartTransmitPacket();
 
SendSPI = 4;
timer = SetDelay(20);
}
LED_Update();
}
if(!SendSPI) { SPI_TransmitByte(); }
}
return (1);
}
 
 
//if(HoehenReglerAktiv && NaviDataOkay && SenderOkay < 160 && SenderOkay > 10 && FromNaviCtrl_Value.SerialDataOkay > 220) SenderOkay = 160;
//if(HoehenReglerAktiv && NaviDataOkay && SenderOkay < 101 && SenderOkay > 10 && FromNaviCtrl_Value.SerialDataOkay > 1) SenderOkay = 101;
/branches/V0.74d-acid/main.h
0,0 → 1,166
#ifndef _MAIN_H
#define _MAIN_H
 
#define QUADRO
//#define OCTO // 2 Arms in Front
//#define OCTO2 // 1 Arm in front
//#define OCTO3 // 1 Arm with two Motors in front or Coax
 
//+++++++++++
// Quadro:
// 1
// 4 3
// 2
//+++++++++++
// Reverse Props on 1 2
 
//+++++++++++
// Octo:
// 1 2
// 8 3
// 7 4
// 6 5
//+++++++++++
 
//+++++++++++
// Octo2:
// 1
// 8 2
// 7 3
// 6 4
// 5
//+++++++++++
 
//+++++++++++
// Octo3:
// 1
// 2
// 8 7 3 4
// 5
// 6
//+++++++++++
// Reverse Props on octo: 1 3 5 7
 
 
//Hier die Quarz Frequenz einstellen
#if defined (__AVR_ATmega32__)
#define SYSCLK 20000000L //Quarz Frequenz in Hz
#endif
 
#if defined (__AVR_ATmega644__)
#define SYSCLK 20000000L //Quarz Frequenz in Hz
#endif
 
#if defined (__AVR_ATmega644P__)
#define SYSCLK 20000000L //Quarz Frequenz in Hz
#endif
 
// neue Hardware
#define ROT_OFF {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB &=~0x01; else PORTB |= 0x01;}
#define ROT_ON {if((PlatinenVersion == 10)||(PlatinenVersion == 20)) PORTB |= 0x01; else PORTB &=~0x01;}
#define ROT_FLASH PORTB ^= 0x01
#define GRN_OFF {if((PlatinenVersion < 12)) PORTB &=~0x02; else PORTB |= 0x02;}
#define GRN_ON {if((PlatinenVersion < 12)) PORTB |= 0x02; else PORTB &=~0x02;}
#define GRN_FLASH PORTB ^= 0x02
 
#define F_CPU SYSCLK
//#ifndef F_CPU
//#error ################## F_CPU nicht definiert oder ungültig #############
//#endif
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define EE_DATENREVISION 75 // wird angepasst, wenn sich die EEPROM-Daten geändert haben
#define MIXER_REVISION 1 // wird angepasst, wenn sich die Mixer-Daten geändert haben
 
#define EEPROM_ADR_VALID 1
#define EEPROM_ADR_ACTIVE_SET 2
#define EEPROM_ADR_LAST_OFFSET 3
 
#define EEPROM_ADR_ACC_NICK 4
#define EEPROM_ADR_ACC_ROLL 6
#define EEPROM_ADR_ACC_Z 8
 
#define EEPROM_ADR_CHANNELS 80
 
#define EEPROM_ADR_PARAM_LENGTH 98
#define EEPROM_ADR_PARAM_BEGIN 100
 
#define EEPROM_ADR_MIXER_TABLE 1000 // 1001 - 1100
 
#define CFG_HOEHENREGELUNG 0x01
#define CFG_HOEHEN_SCHALTER 0x02
#define CFG_HEADING_HOLD 0x04
#define CFG_KOMPASS_AKTIV 0x08
#define CFG_KOMPASS_FIX 0x10
#define CFG_GPS_AKTIV 0x20
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40
#define CFG_DREHRATEN_BEGRENZER 0x80
 
#define CFG_LOOP_OBEN 0x01
#define CFG_LOOP_UNTEN 0x02
#define CFG_LOOP_LINKS 0x04
#define CFG_LOOP_RECHTS 0x08
#define CFG_RES1 0x10
#define CFG_RES2 0x20
#define CFG_RES3 0x40
#define CFG_RES4 0x80
 
#define J3High PORTD |= 0x20
#define J3Low PORTD &= ~0x20
#define J4High PORTD |= 0x10
#define J4Low PORTD &= ~0x10
#define J5High PORTD |= 0x08
#define J5Low PORTD &= ~0x08
 
 
//#define SYSCLK
//extern unsigned long SYSCLK;
extern volatile unsigned char SenderOkay;
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
extern unsigned char PlatinenVersion;
extern unsigned char SendVersionToNavi;
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length);
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length);
extern unsigned char GetActiveParamSetNumber(void);
void SetActiveParamSetNumber(unsigned char number);
extern unsigned char EEPromArray[];
 
#include <stdlib.h>
#include <string.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <avr/boot.h>
#include <avr/wdt.h>
 
#include "old_macros.h"
 
#include "_Settings.h"
#include "printf_P.h"
#include "timer0.h"
#include "uart.h"
#include "analog.h"
#include "twimaster.h"
#include "menu.h"
#include "rc.h"
#include "fc.h"
#include "gps.h"
#include "spi.h"
#include "led.h"
 
#ifndef EEMEM
#define EEMEM __attribute__ ((section (".eeprom")))
#endif
 
#define DEBUG_DISPLAY_INTERVALL 123 // in ms
 
 
#define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU ))
 
#endif //_MAIN_H
 
 
 
 
 
 
/branches/V0.74d-acid/makefile
0,0 → 1,449
#--------------------------------------------------------------------
# MCU name
MCU = atmega644p
F_CPU = 20000000
#-------------------------------------------------------------------
VERSION_MAJOR = 0
VERSION_MINOR = 74
VERSION_PATCH = 3
 
VERSION_SERIAL_MAJOR = 10 # Serial Protocol
VERSION_SERIAL_MINOR = 1 # Serial Protocol
NC_SPI_COMPATIBLE = 6 # Navi-Kompatibilität
#-------------------------------------------------------------------
 
ifeq ($(MCU), atmega32)
# FUSE_SETTINGS= -u -U lfuse:w:0xff:m -U hfuse:w:0xcf:m
 
HEX_NAME = MEGA32
endif
 
ifeq ($(MCU), atmega644)
FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
#FUSE_SETTINGS = -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
# -u bei neuen Controllern wieder einspielen
HEX_NAME = MEGA644
endif
 
ifeq ($(MCU), atmega644p)
FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m
HEX_NAME = MEGA644
endif
 
ifeq ($(F_CPU), 16000000)
QUARZ = 16MHZ
endif
 
ifeq ($(F_CPU), 20000000)
QUARZ = 20MHZ
endif
 
 
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
 
# Target file name (without extension).
 
ifeq ($(VERSION_PATCH), 0)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a
endif
ifeq ($(VERSION_PATCH), 1)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b
endif
ifeq ($(VERSION_PATCH), 2)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c
endif
ifeq ($(VERSION_PATCH), 3)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d
endif
ifeq ($(VERSION_PATCH), 4)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e
endif
ifeq ($(VERSION_PATCH), 5)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f
endif
ifeq ($(VERSION_PATCH), 6)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g
endif
ifeq ($(VERSION_PATCH), 7)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h
endif
ifeq ($(VERSION_PATCH), 8)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i
endif
ifeq ($(VERSION_PATCH), 9)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j
endif
ifeq ($(VERSION_PATCH), 10)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k
endif
ifeq ($(VERSION_PATCH), 11)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)L
endif
ifeq ($(VERSION_PATCH), 12)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m
endif
ifeq ($(VERSION_PATCH), 13)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n
endif
ifeq ($(VERSION_PATCH), 14)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o
endif
ifeq ($(VERSION_PATCH), 15)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p
endif
ifeq ($(VERSION_PATCH), 16)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q
endif
 
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = 2
 
##########################################################################################################
# List C source files here. (C dependencies are automatically generated.)
SRC = main.c uart.c printf_P.c timer0.c analog.c menu.c
SRC += twimaster.c rc.c fc.c GPS.c spi.c led.c Spectrum.c
 
##########################################################################################################
 
 
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
 
 
 
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
EXTRAINCDIRS =
 
 
# Optional compiler flags.
# -g: generate debugging information (for GDB, or for COFF conversion)
# -O*: optimization level
# -f...: tuning, see gcc manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create assembler listing
CFLAGS = -O$(OPT) \
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \
-Wall -Wstrict-prototypes \
-Wa,-adhlns=$(<:.c=.lst) \
$(patsubst %,-I%,$(EXTRAINCDIRS))
 
 
# Set a "language standard" compiler flag.
# Unremark just one line below to set the language standard to use.
# gnu99 = C99 + GNU extensions. See GCC manual for more information.
#CFLAGS += -std=c89
#CFLAGS += -std=gnu89
#CFLAGS += -std=c99
CFLAGS += -std=gnu99
 
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) -DVERSION_MINOR=$(VERSION_MINOR) -DVERSION_PATCH=$(VERSION_PATCH) -DVERSION_SERIAL_MAJOR=$(VERSION_SERIAL_MAJOR) -DVERSION_SERIAL_MINOR=$(VERSION_SERIAL_MINOR) -DNC_SPI_COMPATIBLE=$(NC_SPI_COMPATIBLE)
 
 
# Optional assembler flags.
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
 
 
 
# Optional linker flags.
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
 
# Additional libraries
 
# Minimalistic printf version
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min
 
# Floating point printf version (requires -lm below)
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt
 
# -lm = math library
LDFLAGS += -lm
 
 
##LDFLAGS += -T./linkerfile/avr5.x
 
 
 
# Programming support using avrdude. Settings and variables.
 
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
#AVRDUDE_PROGRAMMER = dt006
#AVRDUDE_PROGRAMMER = stk200
#AVRDUDE_PROGRAMMER = ponyser
AVRDUDE_PROGRAMMER = avrispv2
#falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden
 
#AVRDUDE_PORT = com1 # programmer connected to serial device
#AVRDUDE_PORT = lpt1 # programmer connected to parallel port
AVRDUDE_PORT = usb # programmer connected to USB
 
#AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS)
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
 
#avrdude -c avrispv2 -P usb -p m32 -U flash:w:blink.hex
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
 
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE += -y
 
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
AVRDUDE_FLAGS += -V
 
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_FLAGS += -v -v
 
# ---------------------------------------------------------------------------
# Define directories, if needed.
DIRAVR = c:/winavr
DIRAVRBIN = $(DIRAVR)/bin
DIRAVRUTILS = $(DIRAVR)/utils/bin
DIRINC = .
DIRLIB = $(DIRAVR)/avr/lib
 
 
# Define programs and commands.
SHELL = sh
 
CC = avr-gcc
 
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
 
# Programming support using avrdude.
AVRDUDE = avrdude
 
REMOVE = rm -f
COPY = cp
 
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
 
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
 
 
# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
 
# Define all listing files.
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
 
# Combine all necessary flags and optional flags.
# Add target processor to flags.
#ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS)
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 
 
# Default target.
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \
$(TARGET).lss $(TARGET).sym sizeafter finished end
 
 
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
 
finished:
@echo $(MSG_ERRORS_NONE)
 
end:
@echo $(MSG_END)
@echo
 
 
# Display size of file.
# Display size of file.
sizebefore:
@if [ -f $(TARGET).elf ]; then echo Size before:; $(ELFSIZE); $(HEXSIZE); echo; fi
sizeafter:
@if [ -f $(TARGET).elf ]; then echo Size after:; $(ELFSIZE); $(HEXSIZE); echo; fi
 
 
# Display compiler version information.
gccversion :
@$(CC) --version
 
 
# Convert ELF to COFF for use in debugging / simulating in
# AVR Studio or VMLAB.
COFFCONVERT=$(OBJCOPY) --debugging \
--change-section-address .data-0x800000 \
--change-section-address .bss-0x800000 \
--change-section-address .noinit-0x800000 \
--change-section-address .eeprom-0x810000
 
 
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
 
 
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
 
 
 
 
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 
 
 
 
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
 
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
 
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@
 
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
avr-nm -n $< > $@
 
 
 
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
 
 
# Compile: create object files from C source files.
%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
 
 
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
 
 
# Assemble: create object files from assembler source files.
%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
 
 
 
 
 
 
# Target: clean project.
clean: begin clean_list finished end
 
clean_list :
@echo
@echo $(MSG_CLEANING)
# $(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).obj
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).obj
$(REMOVE) $(TARGET).a90
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lnk
$(REMOVE) $(TARGET).lss
$(REMOVE) $(OBJ)
$(REMOVE) $(LST)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
 
 
# Automatically generate C source code dependencies.
# (Code originally taken from the GNU make user manual and modified
# (See README.txt Credits).)
#
# Note that this will work with sh (bash) and sed that is shipped with WinAVR
# (see the SHELL variable defined above).
# This may not work with other shells or other seds.
#
%.d: %.c
set -e; $(CC) -MM $(ALL_CFLAGS) $< \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \
[ -s $@ ] || rm -f $@
 
 
# Remove the '-' if you want to see the dependency files generated.
-include $(SRC:.c=.d)
 
 
 
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \
clean clean_list program
 
/branches/V0.74d-acid/menu.c
0,0 → 1,168
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + only for non-profit use
// + www.MikroKopter.com
// + see the File "License.txt" for further Informations
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "main.h"
 
unsigned int TestInt = 0;
#define ARRAYGROESSE 10
unsigned char Array[ARRAYGROESSE] = {1,2,3,4,5,6,7,8,9,10};
char DisplayBuff[80] = "Hallo Welt";
unsigned char DispPtr = 0;
 
unsigned char MaxMenue = 13;
unsigned char MenuePunkt = 0;
unsigned char RemoteKeys = 0;
 
#define KEY1 0x01
#define KEY2 0x02
#define KEY3 0x04
#define KEY4 0x08
#define KEY5 0x10
 
void LcdClear(void)
{
unsigned char i;
for(i=0;i<80;i++) DisplayBuff[i] = ' ';
}
 
void Menu(void)
{
 
if(MenuePunkt > MaxMenue) MenuePunkt = MaxMenue;
 
if(RemoteKeys & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue;}
if(RemoteKeys & KEY2) { if(MenuePunkt == MaxMenue) MenuePunkt = 0; else MenuePunkt++;}
if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuePunkt = 0;
LcdClear();
if(MenuePunkt < 10) {LCD_printfxy(17,0,"[%i]",MenuePunkt);}
else {LCD_printfxy(16,0,"[%i]",MenuePunkt);};
 
 
switch(MenuePunkt)
{
case 0:
LCD_printfxy(0,0,"+ MikroKopter +");
LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",PlatinenVersion/10,PlatinenVersion%10, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH +'a');
LCD_printfxy(0,2,"Setting:%d %s",GetActiveParamSetNumber(),Mixer.Name);
if(I2CTimeout < 6) LCD_printfxy(0,3,"I2C ERROR!!!")
else
if(MissingMotor) LCD_printfxy(0,3,"Missing BL-Ctrl:%d!!",MissingMotor)
else LCD_printfxy(0,3,"(c) Holger Buss");
// if(RemoteTasten & KEY3) TestInt--;
// if(RemoteTasten & KEY4) TestInt++;
break;
case 1:
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
{
LCD_printfxy(0,0,"Hoehe: %5i",HoehenWert);
LCD_printfxy(0,1,"SollHoehe: %5i",SollHoehe);
LCD_printfxy(0,2,"Luftdruck: %5i",MessLuftdruck);
LCD_printfxy(0,3,"Off : %5i",DruckOffsetSetting);
}
else
{
LCD_printfxy(0,1,"Keine ");
LCD_printfxy(0,2,"Höhenregelung");
}
 
break;
case 2:
LCD_printfxy(0,0,"akt. Lage");
LCD_printfxy(0,1,"Nick: %5i",IntegralNick/1024);
LCD_printfxy(0,2,"Roll: %5i",IntegralRoll/1024);
LCD_printfxy(0,3,"Kompass: %5i",KompassValue);
break;
case 3:
LCD_printfxy(0,0,"K1:%4i K2:%4i ",PPM_in[1],PPM_in[2]);
LCD_printfxy(0,1,"K3:%4i K4:%4i ",PPM_in[3],PPM_in[4]);
LCD_printfxy(0,2,"K5:%4i K6:%4i ",PPM_in[5],PPM_in[6]);
LCD_printfxy(0,3,"K7:%4i K8:%4i ",PPM_in[7],PPM_in[8]);
break;
case 4:
LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]);
LCD_printfxy(0,1,"Gs:%4i Gi:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]],PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]);
LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]]);
LCD_printfxy(0,3,"P3:%4i P4:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]]);
break;
case 5:
LCD_printfxy(0,0,"Gyro - Sensor");
if(PlatinenVersion == 10)
{
LCD_printfxy(0,1,"Nick %4i (%3i.%i)",AdWertNick - AdNeutralNick/8, AdNeutralNick/8, AdNeutralNick%8);
LCD_printfxy(0,2,"Roll %4i (%3i.%i)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll/8, AdNeutralRoll%8);
LCD_printfxy(0,3,"Gier %4i (%3i)",AdNeutralGier - AdWertGier, AdNeutralGier);
}
else
if((PlatinenVersion == 11) || (PlatinenVersion == 20))
{
LCD_printfxy(0,1,"Nick %4i (%3i.%x)",AdWertNick - AdNeutralNick/8, AdNeutralNick/16, (AdNeutralNick%16)/2);
LCD_printfxy(0,2,"Roll %4i (%3i.%x)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll/16, (AdNeutralRoll%16)/2);
LCD_printfxy(0,3,"Gier %4i (%3i)",AdNeutralGier - AdWertGier, AdNeutralGier/2);
}
else
if(PlatinenVersion == 13)
{
LCD_printfxy(0,1,"Nick %4i (%3i)(%3i)",AdWertNick - AdNeutralNick/8, AdNeutralNick/16,AnalogOffsetNick);
LCD_printfxy(0,2,"Roll %4i (%3i)(%3i)",AdWertRoll - AdNeutralRoll/8, AdNeutralRoll/16,AnalogOffsetRoll);
LCD_printfxy(0,3,"Gier %4i (%3i)(%3i)",AdNeutralGier - AdWertGier, AdNeutralGier/2,AnalogOffsetGier);
}
 
break;
case 6:
LCD_printfxy(0,0,"ACC - Sensor");
LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertAccNick,NeutralAccX);
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertAccRoll,NeutralAccY);
LCD_printfxy(0,3,"Hoch %4i (%3i)",Mittelwert_AccHoch/*accumulate_AccHoch / messanzahl_AccHoch*/,(int)NeutralAccZ);
break;
case 7:
LCD_printfxy(0,1,"Spannung: %5i",UBat);
LCD_printfxy(0,2,"Empf.Pegel:%5i",SenderOkay);
break;
case 8:
LCD_printfxy(0,0,"Kompass ");
LCD_printfxy(0,1,"Richtung: %5i",KompassRichtung);
LCD_printfxy(0,2,"Messwert: %5i",KompassValue);
LCD_printfxy(0,3,"Start: %5i",KompassStartwert);
break;
case 9:
LCD_printfxy(0,0,"Poti1: %3i",Poti1);
LCD_printfxy(0,1,"Poti2: %3i",Poti2);
LCD_printfxy(0,2,"Poti3: %3i",Poti3);
LCD_printfxy(0,3,"Poti4: %3i",Poti4);
break;
case 10:
LCD_printfxy(0,0,"Servo " );
LCD_printfxy(0,1,"Setpoint %3i",Parameter_ServoNickControl);
LCD_printfxy(0,2,"Stellung: %3i",ServoValue);
LCD_printfxy(0,3,"Range:%3i-%3i",EE_Parameter.ServoNickMin,EE_Parameter.ServoNickMax);
break;
case 11:
LCD_printfxy(0,0,"ExternControl " );
LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",ExternControl.Nick,ExternControl.Roll);
LCD_printfxy(0,2,"Gs:%4i Gi:%4i ",ExternControl.Gas,ExternControl.Gier);
LCD_printfxy(0,3,"Hi:%4i Cf:%4i ",ExternControl.Hight,ExternControl.Config);
break;
case 12:
LCD_printfxy(0,0,"BL-Ctrl Errors " );
LCD_printfxy(0,1," %3d %3d %3d %3d ",MotorError[0],MotorError[1],MotorError[2],MotorError[3]);
LCD_printfxy(0,2," %3d %3d %3d %3d ",MotorError[4],MotorError[5],MotorError[6],MotorError[7]);
LCD_printfxy(0,3," %3d %3d %3d %3d ",MotorError[8],MotorError[9],MotorError[10],MotorError[11]);
break;
case 13:
LCD_printfxy(0,0,"BL-Ctrl found " );
LCD_printfxy(0,1," %c %c %c %c ",MotorPresent[0] + '-',MotorPresent[1] + '-',MotorPresent[2] + '-',MotorPresent[3] + '-');
LCD_printfxy(0,2," %c %c %c %c ",MotorPresent[4] + '-',MotorPresent[5] + '-',MotorPresent[6] + '-',MotorPresent[7] + '-');
LCD_printfxy(0,3," %c - - -",MotorPresent[8] + '-');
if(MotorPresent[9]) LCD_printfxy(4,3,"10");
if(MotorPresent[10]) LCD_printfxy(8,3,"11");
if(MotorPresent[11]) LCD_printfxy(12,3,"12");
break;
default: MaxMenue = MenuePunkt - 1;
MenuePunkt = 0;
break;
}
RemoteKeys = 0;
}
/branches/V0.74d-acid/menu.h
0,0 → 1,9
extern void Menu(void);
extern void LcdClear(void);
extern char DisplayBuff[80];
extern unsigned char DispPtr;
 
extern unsigned char MaxMenue;
extern unsigned char MenuePunkt;
extern unsigned char RemoteKeys;
 
/branches/V0.74d-acid/mymath.c
0,0 → 1,100
#include <stdlib.h>
#include <avr/pgmspace.h>
#include "mymath.h"
 
// discrete mathematics
 
// Sinus with argument in degree at an angular resolution of 1 degree and a discretisation of 13 bit.
const uint16_t pgm_sinlookup[91] PROGMEM = {0, 143, 286, 429, 571, 714, 856, 998, 1140, 1282, 1423, 1563, 1703, 1843, 1982, 2120, 2258, 2395, 2531, 2667, 2802, 2936, 3069, 3201, 3332, 3462, 3591, 3719, 3846, 3972, 4096, 4219, 4341, 4462, 4581, 4699, 4815, 4930, 5043, 5155, 5266, 5374, 5482, 5587, 5691, 5793, 5893, 5991, 6088, 6183, 6275, 6366, 6455, 6542, 6627, 6710, 6791, 6870, 6947, 7022, 7094, 7165, 7233, 7299, 7363, 7424, 7484, 7541, 7595, 7648, 7698, 7746, 7791, 7834, 7875, 7913, 7949, 7982, 8013, 8041, 8068, 8091, 8112, 8131, 8147, 8161, 8172, 8181, 8187, 8191, 8192};
 
int16_t c_sin_8192(int16_t angle)
{
int8_t m,n;
int16_t sinus;
 
// avoid negative angles
if (angle < 0)
{
m = -1;
angle = abs(angle);
}
else m = +1;
 
// fold angle to intervall 0 to 359
angle %= 360;
 
// check quadrant
if (angle <= 90) n=1; // first quadrant
else if ((angle > 90) && (angle <= 180)) {angle = 180 - angle; n = 1;} // second quadrant
else if ((angle > 180) && (angle <= 270)) {angle = angle - 180; n = -1;} // third quadrant
else {angle = 360 - angle; n = -1;} //fourth quadrant
// get lookup value
sinus = pgm_read_word(&pgm_sinlookup[angle]);
// calculate sinus value
return (sinus * m * n);
}
 
// Cosinus with argument in degree at an angular resolution of 1 degree and a discretisation of 13 bit.
int16_t c_cos_8192(int16_t angle)
{
return (c_sin_8192(90 - angle));
}
 
 
// Arcustangens returns degree in a range of +/. 180 deg
const uint8_t pgm_atanlookup[346] PROGMEM = {0,1,2,3,4,4,5,6,7,8,9,10,11,11,12,13,14,15,16,17,17,18,19,20,21,21,22,23,24,24,25,26,27,27,28,29,29,30,31,31,32,33,33,34,35,35,36,36,37,37,38,39,39,40,40,41,41,42,42,43,43,44,44,45,45,45,46,46,47,47,48,48,48,49,49,50,50,50,51,51,51,52,52,52,53,53,53,54,54,54,55,55,55,55,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,60,61,61,61,61,62,62,62,62,62,63,63,63,63,63,63,64,64,64,64,64,64,65,65,65,65,65,65,66,66,66,66,66,66,66,67,67,67,67,67,67,67,68,68,68,68,68,68,68,68,69,69,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79};
 
int16_t c_atan2(int16_t y, int16_t x)
{
int16_t index, angle;
int8_t m;
 
if (!x && !y) return 0; //atan2(0, 0) is undefined
 
if (y < 0) m = -1;
else m = 1;
 
if (!x) return (90 * m); // atan2(y,0) = +/- 90 deg
 
index = (int16_t)(((int32_t)y * 64) / x);// calculate index for lookup table
if (index < 0) index = -index;
 
if (index < 346) angle = pgm_read_byte(&pgm_atanlookup[index]); // lookup for 0 deg to 79 deg
else if (index > 7334) angle = 90; // limit is 90 deg
else if (index > 2444) angle = 89; // 89 deg to 80 deg is mapped via intervalls
else if (index > 1465) angle = 88;
else if (index > 1046) angle = 87;
else if (index > 813) angle = 86;
else if (index > 664) angle = 85;
else if (index > 561) angle = 84;
else if (index > 486) angle = 83;
else if (index > 428) angle = 82;
else if (index > 382) angle = 81;
else angle = 80; // (index>345)
 
if (x > 0) return (angle * m); // 1st and 4th quadrant
else if ((x < 0) && (m > 0)) return (180 - angle); // 2nd quadrant
else return (angle - 180); // ( (x < 0) && (y < 0)) 3rd quadrant
}
 
 
 
// integer square root
uint32_t c_sqrt(uint32_t number)
{
if(!number) return 0;
uint32_t s1, s2;
uint8_t iter = 0;
// initialization of iteration
s2 = number;
do // iterative formula to solve x^2 - n = 0
{
s1 = s2;
s2 = number / s1;
s2 += s1;
s2 /= 2;
iter++;
//if(iter > 40) break;
}while( ( (s1-s2) > 1) && (iter < 40));
return s2;
}
/branches/V0.74d-acid/mymath.h
0,0 → 1,11
#ifndef _MYMATH_H
#define _MYMATH_H
 
#include <inttypes.h>
 
extern int16_t c_sin_8192(int16_t angle);
extern int16_t c_cos_8192(int16_t angle);
extern int16_t c_atan2(int16_t y, int16_t x);
extern uint32_t c_sqrt(uint32_t number);
 
#endif // _MYMATH_H
/branches/V0.74d-acid/old_macros.h
0,0 → 1,47
/*
For backwards compatibility only.
Ingo Busker ingo@mikrocontroller.com
*/
 
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
 
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
 
#ifndef inb
#define inb(sfr) _SFR_BYTE(sfr)
#endif
 
#ifndef outb
#define outb(sfr, val) (_SFR_BYTE(sfr) = (val))
#endif
 
#ifndef inw
#define inw(sfr) _SFR_WORD(sfr)
#endif
 
#ifndef outw
#define outw(sfr, val) (_SFR_WORD(sfr) = (val))
#endif
 
#ifndef outp
#define outp(val, sfr) outb(sfr, val)
#endif
 
#ifndef inp
#define inp(sfr) inb(sfr)
#endif
 
#ifndef BV
#define BV(bit) _BV(bit)
#endif
 
 
#ifndef PRG_RDB
#define PRG_RDB pgm_read_byte
#endif
 
/branches/V0.74d-acid/printf_P.c
0,0 → 1,480
// Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist nicht von der Lizenz für den MikroKopter-Teil unterstellt
 
/*
Copyright (C) 1993 Free Software Foundation
 
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
 
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
 
/*
* Copyright (c) 1990 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*/
 
/******************************************************************************
This file is a patched version of printf called _printf_P
It is made to work with avr-gcc for Atmel AVR MCUs.
There are some differences from standard printf:
1. There is no floating point support (with fp the code is about 8K!)
2. Return type is void
3. Format string must be in program memory (by using macro printf this is
done automaticaly)
4. %n is not implemented (just remove the comment around it if you need it)
5. If LIGHTPRINTF is defined, the code is about 550 bytes smaller and the
folowing specifiers are disabled :
space # * . - + p s o O
6. A function void uart_sendchar(char c) is used for output. The UART must
be initialized before using printf.
 
Alexander Popov
sasho@vip.orbitel.bg
******************************************************************************/
 
/*
* Actual printf innards.
*
* This code is large and complicated...
*/
 
#include <string.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
 
#include "main.h"
 
 
//#define LIGHTPRINTF
char PrintZiel;
 
 
char Putchar(char zeichen)
{
if(PrintZiel == OUT_LCD) { DisplayBuff[DispPtr++] = zeichen; return(1);}
else return(uart_putchar(zeichen));
}
 
 
void PRINT(const char * ptr, unsigned int len)
{
for(;len;len--) Putchar(*ptr++);
}
void PRINTP(const char * ptr, unsigned int len)
{
for(;len;len--) Putchar(pgm_read_byte(ptr++));
}
 
void PAD_SP(signed char howmany)
{
for(;howmany>0;howmany--) Putchar(' ');
}
 
void PAD_0(signed char howmany)
{
for(;howmany>0;howmany--) Putchar('0');
}
 
#define BUF 40
 
/*
* Macros for converting digits to letters and vice versa
*/
#define to_digit(c) ((c) - '0')
#define is_digit(c) ((c)<='9' && (c)>='0')
#define to_char(n) ((n) + '0')
 
/*
* Flags used during conversion.
*/
#define LONGINT 0x01 /* long integer */
#define LONGDBL 0x02 /* long double; unimplemented */
#define SHORTINT 0x04 /* short integer */
#define ALT 0x08 /* alternate form */
#define LADJUST 0x10 /* left adjustment */
#define ZEROPAD 0x20 /* zero (as opposed to blank) pad */
#define HEXPREFIX 0x40 /* add 0x or 0X prefix */
 
void _printf_P (char ziel,char const *fmt0, ...) /* Works with string from FLASH */
{
va_list ap;
register const char *fmt; /* format string */
register char ch; /* character from fmt */
register int n; /* handy integer (short term usage) */
register char *cp; /* handy char pointer (short term usage) */
const char *fmark; /* for remembering a place in fmt */
register unsigned char flags; /* flags as above */
signed char width; /* width from format (%8d), or 0 */
signed char prec; /* precision from format (%.3d), or -1 */
char sign; /* sign prefix (' ', '+', '-', or \0) */
unsigned long _ulong=0; /* integer arguments %[diouxX] */
#define OCT 8
#define DEC 10
#define HEX 16
unsigned char base; /* base for [diouxX] conversion */
signed char dprec; /* a copy of prec if [diouxX], 0 otherwise */
signed char dpad; /* extra 0 padding needed for integers */
signed char fieldsz; /* field size expanded by sign, dpad etc */
/* The initialization of 'size' is to suppress a warning that
'size' might be used unitialized. It seems gcc can't
quite grok this spaghetti code ... */
signed char size = 0; /* size of converted field or string */
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */
char ox[2]; /* space for 0x hex-prefix */
 
PrintZiel = ziel; // bestimmt, LCD oder UART
va_start(ap, fmt0);
fmt = fmt0;
 
/*
* Scan the format for conversions (`%' character).
*/
for (;;) {
for (fmark = fmt; (ch = pgm_read_byte(fmt)) != '\0' && ch != '%'; fmt++)
/* void */;
if ((n = fmt - fmark) != 0) {
PRINTP(fmark, n);
}
if (ch == '\0')
goto done;
fmt++; /* skip over '%' */
 
flags = 0;
dprec = 0;
width = 0;
prec = -1;
sign = '\0';
 
rflag: ch = PRG_RDB(fmt++);
reswitch:
#ifdef LIGHTPRINTF
if (ch=='o' || ch=='u' || (ch|0x20)=='x') {
#else
if (ch=='u' || (ch|0x20)=='x') {
#endif
if (flags&LONGINT) {
_ulong=va_arg(ap, unsigned long);
} else {
register unsigned int _d;
_d=va_arg(ap, unsigned int);
_ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d;
}
}
#ifndef LIGHTPRINTF
if(ch==' ') {
/*
* ``If the space and + flags both appear, the space
* flag will be ignored.''
* -- ANSI X3J11
*/
if (!sign)
sign = ' ';
goto rflag;
} else if (ch=='#') {
flags |= ALT;
goto rflag;
} else if (ch=='*'||ch=='-') {
if (ch=='*') {
/*
* ``A negative field width argument is taken as a
* - flag followed by a positive field width.''
* -- ANSI X3J11
* They don't exclude field widths read from args.
*/
if ((width = va_arg(ap, int)) >= 0)
goto rflag;
width = -width;
}
flags |= LADJUST;
flags &= ~ZEROPAD; /* '-' disables '0' */
goto rflag;
} else if (ch=='+') {
sign = '+';
goto rflag;
} else if (ch=='.') {
if ((ch = PRG_RDB(fmt++)) == '*') {
n = va_arg(ap, int);
prec = n < 0 ? -1 : n;
goto rflag;
}
n = 0;
while (is_digit(ch)) {
n = n*10 + to_digit(ch);
ch = PRG_RDB(fmt++);
}
prec = n < 0 ? -1 : n;
goto reswitch;
} else
#endif /* LIGHTPRINTF */
if (ch=='0') {
/*
* ``Note that 0 is taken as a flag, not as the
* beginning of a field width.''
* -- ANSI X3J11
*/
if (!(flags & LADJUST))
flags |= ZEROPAD; /* '-' disables '0' */
goto rflag;
} else if (ch>='1' && ch<='9') {
n = 0;
do {
n = 10 * n + to_digit(ch);
ch = PRG_RDB(fmt++);
} while (is_digit(ch));
width = n;
goto reswitch;
} else if (ch=='h') {
flags |= SHORTINT;
goto rflag;
} else if (ch=='l') {
flags |= LONGINT;
goto rflag;
} else if (ch=='c') {
*(cp = buf) = va_arg(ap, int);
size = 1;
sign = '\0';
} else if (ch=='D'||ch=='d'||ch=='i') {
if(ch=='D')
flags |= LONGINT;
if (flags&LONGINT) {
_ulong=va_arg(ap, long);
} else {
register int _d;
_d=va_arg(ap, int);
_ulong = flags&SHORTINT ? (long)(short)_d : (long)_d;
}
if ((long)_ulong < 0) {
_ulong = -_ulong;
sign = '-';
}
base = DEC;
goto number;
} else
/*
if (ch=='n') {
if (flags & LONGINT)
*va_arg(ap, long *) = ret;
else if (flags & SHORTINT)
*va_arg(ap, short *) = ret;
else
*va_arg(ap, int *) = ret;
continue; // no output
} else
*/
#ifndef LIGHTPRINTF
if (ch=='O'||ch=='o') {
if (ch=='O')
flags |= LONGINT;
base = OCT;
goto nosign;
} else if (ch=='p') {
/*
* ``The argument shall be a pointer to void. The
* value of the pointer is converted to a sequence
* of printable characters, in an implementation-
* defined manner.''
* -- ANSI X3J11
*/
/* NOSTRICT */
_ulong = (unsigned int)va_arg(ap, void *);
base = HEX;
flags |= HEXPREFIX;
ch = 'x';
goto nosign;
} else if (ch=='s') { // print a string from RAM
if ((cp = va_arg(ap, char *)) == NULL) {
cp=buf;
cp[0] = '(';
cp[1] = 'n';
cp[2] = 'u';
cp[4] = cp[3] = 'l';
cp[5] = ')';
cp[6] = '\0';
}
if (prec >= 0) {
/*
* can't use strlen; can only look for the
* NUL in the first `prec' characters, and
* strlen() will go further.
*/
char *p = (char*)memchr(cp, 0, prec);
 
if (p != NULL) {
size = p - cp;
if (size > prec)
size = prec;
} else
size = prec;
} else
size = strlen(cp);
sign = '\0';
} else
#endif /* LIGHTPRINTF */
if(ch=='U'||ch=='u') {
if (ch=='U')
flags |= LONGINT;
base = DEC;
goto nosign;
} else if (ch=='X'||ch=='x') {
base = HEX;
/* leading 0x/X only if non-zero */
if (flags & ALT && _ulong != 0)
flags |= HEXPREFIX;
 
/* unsigned conversions */
nosign: sign = '\0';
/*
* ``... diouXx conversions ... if a precision is
* specified, the 0 flag will be ignored.''
* -- ANSI X3J11
*/
number: if ((dprec = prec) >= 0)
flags &= ~ZEROPAD;
 
/*
* ``The result of converting a zero value with an
* explicit precision of zero is no characters.''
* -- ANSI X3J11
*/
cp = buf + BUF;
if (_ulong != 0 || prec != 0) {
register unsigned char _d,notlastdigit;
do {
notlastdigit=(_ulong>=base);
_d = _ulong % base;
 
if (_d<10) {
_d+='0';
} else {
_d+='a'-10;
if (ch=='X') _d&=~0x20;
}
*--cp=_d;
_ulong /= base;
} while (notlastdigit);
#ifndef LIGHTPRINTF
// handle octal leading 0
if (base==OCT && flags & ALT && *cp != '0')
*--cp = '0';
#endif
}
 
size = buf + BUF - cp;
} else { //default
/* "%?" prints ?, unless ? is NUL */
if (ch == '\0')
goto done;
/* pretend it was %c with argument ch */
cp = buf;
*cp = ch;
size = 1;
sign = '\0';
}
 
/*
* All reasonable formats wind up here. At this point,
* `cp' points to a string which (if not flags&LADJUST)
* should be padded out to `width' places. If
* flags&ZEROPAD, it should first be prefixed by any
* sign or other prefix; otherwise, it should be blank
* padded before the prefix is emitted. After any
* left-hand padding and prefixing, emit zeroes
* required by a decimal [diouxX] precision, then print
* the string proper, then emit zeroes required by any
* leftover floating precision; finally, if LADJUST,
* pad with blanks.
*/
 
/*
* compute actual size, so we know how much to pad.
*/
fieldsz = size;
 
dpad = dprec - size;
if (dpad < 0)
dpad = 0;
 
if (sign)
fieldsz++;
else if (flags & HEXPREFIX)
fieldsz += 2;
fieldsz += dpad;
 
/* right-adjusting blank padding */
if ((flags & (LADJUST|ZEROPAD)) == 0)
PAD_SP(width - fieldsz);
 
/* prefix */
if (sign) {
PRINT(&sign, 1);
} else if (flags & HEXPREFIX) {
ox[0] = '0';
ox[1] = ch;
PRINT(ox, 2);
}
 
/* right-adjusting zero padding */
if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD)
PAD_0(width - fieldsz);
 
/* leading zeroes from decimal precision */
PAD_0(dpad);
 
/* the string or number proper */
PRINT(cp, size);
 
/* left-adjusting padding (always blank) */
if (flags & LADJUST)
PAD_SP(width - fieldsz);
}
done:
va_end(ap);
}
/branches/V0.74d-acid/printf_P.h
0,0 → 1,19
#ifndef _PRINTF_P_H_
#define _PRINTF_P_H_
 
#include <avr/pgmspace.h>
 
#define OUT_V24 0
#define OUT_LCD 1
 
 
void _printf_P (char, char const *fmt0, ...);
extern char PrintZiel;
 
 
#define printf_P(format, args...) _printf_P(OUT_V24,format , ## args)
#define printf(format, args...) _printf_P(OUT_V24,PSTR(format) , ## args)
#define LCD_printfxy(x,y,format, args...) { DispPtr = y * 20 + x; _printf_P(OUT_LCD,PSTR(format) , ## args);}
#define LCD_printf(format, args...) { _printf_P(OUT_LCD,PSTR(format) , ## args);}
 
#endif
/branches/V0.74d-acid/rc.c
0,0 → 1,122
/*#######################################################################################
Decodieren eines RC Summen Signals
#######################################################################################*/
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + only for non-profit use
// + www.MikroKopter.com
// + see the File "License.txt" for further Informations
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
#include "rc.h"
#include "main.h"
 
volatile int PPM_in[11];
volatile int PPM_diff[11]; // das diffenzierte Stick-Signal
volatile unsigned char NewPpmData = 1;
 
//############################################################################
//zum decodieren des PPM-Signals wird Timer1 mit seiner Input
//Capture Funktion benutzt:
void rc_sum_init (void)
//############################################################################
{
TCCR1B=(1<<CS11)|(1<<CS10)|(1<<ICES1)|(1<<ICNC1);//|(1 << WGM12); //timer1 prescale 64
// TCCR1B=(1<<CS11)|(0<<CS10)|(1<<ICES1)|(1<<ICNC1); //timer1 prescale 64
TIMSK1 |= _BV(ICIE1);
AdNeutralGier = 0;
AdNeutralRoll = 0;
AdNeutralNick = 0;
return;
}
 
//############################################################################
//Diese Routine startet und inizialisiert den Timer für RC
SIGNAL(SIG_INPUT_CAPTURE1)
//############################################################################
 
{
static unsigned int AltICR=0;
signed int signal = 0,tmp;
static int index;
signal = (unsigned int) ICR1 - AltICR;
AltICR = ICR1;
//Syncronisationspause?
if((signal > 1100) && (signal < 8000))
{
if(index >= 4) NewPpmData = 0; // Null bedeutet: Neue Daten
index = 1;
}
else
{
if(index < 10)
{
if((signal > 250) && (signal < 687))
{
signal -= 466;
// Stabiles Signal
if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10; else SenderOkay = 200;}
tmp = (3 * (PPM_in[index]) + signal) / 4;
if(tmp > signal+1) tmp--; else
if(tmp < signal-1) tmp++;
if(SenderOkay >= 195) PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3;
else PPM_diff[index] = 0;
PPM_in[index] = tmp;
}
index++;
if(index == 5) J3High; else J3Low; // Servosignal an J3 anlegen
if(index == 6) J4High; else J4Low; // Servosignal an J4 anlegen
if(index == 7) J5High; else J5Low; // Servosignal an J5 anlegen
}
}
}
 
/*
//############################################################################
//Diese Routine startet und inizialisiert den Timer für RC
SIGNAL(SIG_INPUT_CAPTURE1)
//############################################################################
 
{
static unsigned int AltICR=0;
signed int signal = 0,tmp;
static int index;
signal = (unsigned int) ICR1 - AltICR;
DebugOut.Analog[16] = signal;
signal /= 2;
AltICR = ICR1;
//Syncronisationspause?
if((signal > 1100*2) && (signal < 8000*2))
{
if(index >= 4) NewPpmData = 0; // Null bedeutet: Neue Daten
index = 1;
}
else
{
if(index < 10)
{
if((signal > 250) && (signal < 687*2))
{
signal -= 962;
// Stabiles Signal
if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10;}
tmp = (3 * (PPM_in[index]) + signal) / 4;
if(tmp > signal+1) tmp--; else
if(tmp < signal-1) tmp++;
if(SenderOkay >= 195) PPM_diff[index] = ((tmp - PPM_in[index]) / 3) * 3;
else PPM_diff[index] = 0;
PPM_in[index] = tmp;
}
index++;
if(index == 5) J3High; else J3Low; // Servosignal an J3 anlegen
if(index == 2) J4High; else J4Low; // Servosignal an J4 anlegen
if(index == 7) J5High; else J5Low; // Servosignal an J5 anlegen
}
}
}
*/
 
 
 
/branches/V0.74d-acid/rc.h
0,0 → 1,30
/*#######################################################################################
Derkodieren eines RC Summen Signals
#######################################################################################*/
 
#ifndef _RC_H
#define _RC_H
 
#if defined (__AVR_ATmega32__)
#define TIMER_TEILER CK64
#define TIMER_RELOAD_VALUE 250
#endif
 
#if defined (__AVR_ATmega644__)
#define TIMER_RELOAD_VALUE 250
#endif
 
#if defined (__AVR_ATmega644P__)
#define TIMER_RELOAD_VALUE 250
#endif
 
#define GAS PPM_in[2]
 
 
extern void rc_sum_init (void);
 
extern volatile int PPM_in[11];
extern volatile int PPM_diff[11]; // das diffenzierte Stick-Signal
extern volatile unsigned char NewPpmData;
 
#endif //_RC_H
/branches/V0.74d-acid/spi.c
0,0 → 1,281
// ######################## SPI - FlightCtrl ###################
#include "main.h"
 
 
//struct str_ToNaviCtrl_Version ToNaviCtrl_Version;
//struct str_FromNaviCtrl_Version FromNaviCtrl_Version;
struct str_ToNaviCtrl ToNaviCtrl;
struct str_FromNaviCtrl FromNaviCtrl;
struct str_FromNaviCtrl_Value FromNaviCtrl_Value;
struct str_SPI_VersionInfo SPI_VersionInfo;
 
unsigned char SPI_BufferIndex;
unsigned char SPI_RxBufferIndex;
 
volatile unsigned char SPI_Buffer[sizeof(FromNaviCtrl)];
unsigned char *SPI_TX_Buffer;
 
unsigned char SPITransferCompleted, SPI_ChkSum;
unsigned char SPI_RxDataValid,NaviDataOkay = 0;
 
unsigned char SPI_CommandSequence[] = { SPI_CMD_USER, SPI_CMD_STICK, SPI_CMD_PARAMETER1, SPI_CMD_STICK, SPI_CMD_MISC, SPI_CMD_VERSION };
unsigned char SPI_CommandCounter = 0;
 
#ifdef USE_SPI_COMMUNICATION
 
//------------------------------------------------------
void SPI_MasterInit(void)
{
DDR_SPI |= (1<<DD_MOSI)|(1<<DD_SCK); // Set MOSI and SCK output, all others input
SLAVE_SELECT_DDR_PORT |= (1 << SPI_SLAVE_SELECT);
 
SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(0<<SPR0)|(0<<SPIE); // Enable SPI, Master, set clock rate fck/64
SPSR = 0;//(1<<SPI2X);
 
SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT);
SPITransferCompleted = 1;
 
//SPDR = 0x00; // dummy write
 
ToNaviCtrl.Sync1 = 0xAA;
ToNaviCtrl.Sync2 = 0x83;
 
ToNaviCtrl.Command = SPI_CMD_USER;
ToNaviCtrl.IntegralNick = 0;
ToNaviCtrl.IntegralRoll = 0;
FromNaviCtrl_Value.SerialDataOkay = 0;
SPI_RxDataValid = 0;
 
SPI_VersionInfo.Major = VERSION_MAJOR;
SPI_VersionInfo.Minor = VERSION_MINOR;
SPI_VersionInfo.Patch = VERSION_PATCH;
SPI_VersionInfo.Compatible = NC_SPI_COMPATIBLE;
}
 
//------------------------------------------------------
void SPI_StartTransmitPacket(void)
{
//if ((SLAVE_SELECT_PORT & (1 << SPI_SLAVE_SELECT)) == 0) return; // transfer of prev. packet not completed
if (!SPITransferCompleted) return;
// _delay_us(30);
 
SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave
SPI_TX_Buffer = (unsigned char *) &ToNaviCtrl;
 
ToNaviCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++];
if (SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0;
 
SPITransferCompleted = 0;
UpdateSPI_Buffer(); // update buffer
 
SPI_BufferIndex = 1;
//ebugOut.Analog[16]++;
// -- Debug-Output ---
//----
asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
ToNaviCtrl.Chksum = ToNaviCtrl.Sync1;
SPDR = ToNaviCtrl.Sync1; // Start transmission
// SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave
 
}
 
//------------------------------------------------------
//SIGNAL(SIG_SPI)
void SPI_TransmitByte(void)
{
static unsigned char SPI_RXState = 0;
unsigned char rxdata;
static unsigned char rxchksum;
 
if (SPITransferCompleted) return;
if (!(SPSR & (1 << SPIF))) return;
SendSPI = 4;
 
// _delay_us(30);
SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave
 
rxdata = SPDR;
switch ( SPI_RXState)
{
case 0:
 
SPI_RxBufferIndex = 0;
//DebugOut.Analog[17]++;
rxchksum = rxdata;
if (rxdata == 0x81 ) { SPI_RXState = 1; } // 1. Syncbyte ok
 
break;
 
case 1:
if (rxdata == 0x55) { rxchksum += rxdata; SPI_RXState = 2; } // 2. Syncbyte ok
else SPI_RXState = 0;
//DebugOut.Analog[18]++;
break;
 
case 2:
SPI_Buffer[SPI_RxBufferIndex++]= rxdata; // get data
//DebugOut.Analog[19]++;
if (SPI_RxBufferIndex >= sizeof(FromNaviCtrl))
{
 
if (rxdata == rxchksum)
{
unsigned char *ptr = (unsigned char *)&FromNaviCtrl;
 
memcpy(ptr, (unsigned char *) SPI_Buffer, sizeof(SPI_Buffer));
 
SPI_RxDataValid = 1;
}
else SPI_RxDataValid = 0;
 
SPI_RXState = 0;
}
else rxchksum += rxdata;
break;
 
}
 
if (SPI_BufferIndex < sizeof(ToNaviCtrl))
{
SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave
asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop"); asm volatile ("nop");
 
SPDR = SPI_TX_Buffer[SPI_BufferIndex];
ToNaviCtrl.Chksum += SPI_TX_Buffer[SPI_BufferIndex];
// SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave
 
}
else SPITransferCompleted = 1;
 
SPI_BufferIndex++;
}
 
 
//------------------------------------------------------
void UpdateSPI_Buffer(void)
{
signed int tmp;
cli();
 
ToNaviCtrl.IntegralNick = (int) (IntegralNick / (long)(EE_Parameter.GyroAccFaktor * 4));
ToNaviCtrl.IntegralRoll = (int) (IntegralRoll / (long)(EE_Parameter.GyroAccFaktor * 4));
ToNaviCtrl.GyroCompass = (10 * ErsatzKompass) / GIER_GRAD_FAKTOR;
ToNaviCtrl.AccNick = ((int) ACC_AMPLIFY * (NaviAccNick / NaviCntAcc))/4;
ToNaviCtrl.AccRoll = ((int) ACC_AMPLIFY * (NaviAccRoll / NaviCntAcc))/4;
NaviCntAcc = 0; NaviAccNick = 0; NaviAccRoll = 0;
// ToNaviCtrl.User8 = Parameter_UserParam8;
// ToNaviCtrl.CalState = WinkelOut.CalcState;
 
switch(ToNaviCtrl.Command) //
{
case SPI_CMD_USER:
ToNaviCtrl.Param.Byte[0] = Parameter_UserParam1;
ToNaviCtrl.Param.Byte[1] = Parameter_UserParam2;
ToNaviCtrl.Param.Byte[2] = Parameter_UserParam3;
ToNaviCtrl.Param.Byte[3] = Parameter_UserParam4;
ToNaviCtrl.Param.Byte[4] = Parameter_UserParam5;
ToNaviCtrl.Param.Byte[5] = Parameter_UserParam6;
ToNaviCtrl.Param.Byte[6] = Parameter_UserParam7;
ToNaviCtrl.Param.Byte[7] = Parameter_UserParam8;
ToNaviCtrl.Param.Byte[8] = (unsigned char) MikroKopterFlags;
MikroKopterFlags &= ~(FLAG_CALIBRATE | FLAG_START);
ToNaviCtrl.Param.Byte[9] = (unsigned char) UBat;
ToNaviCtrl.Param.Byte[10] =(unsigned char) EE_Parameter.UnterspannungsWarnung;
ToNaviCtrl.Param.Byte[11] =(unsigned char) eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]);
break;
case SPI_CMD_PARAMETER1:
ToNaviCtrl.Param.Byte[0] = EE_Parameter.NaviGpsModeControl; // Parameters for the Naviboard
ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviGpsGain;
ToNaviCtrl.Param.Byte[2] = EE_Parameter.NaviGpsP;
ToNaviCtrl.Param.Byte[3] = EE_Parameter.NaviGpsI;
ToNaviCtrl.Param.Byte[4] = EE_Parameter.NaviGpsD;
ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsACC;
ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsMinSat;
ToNaviCtrl.Param.Byte[7] = EE_Parameter.NaviStickThreshold;
ToNaviCtrl.Param.Byte[8] = EE_Parameter.NaviOperatingRadius;
ToNaviCtrl.Param.Byte[9] = EE_Parameter.NaviWindCorrection;
ToNaviCtrl.Param.Byte[10] = EE_Parameter.NaviSpeedCompensation;
ToNaviCtrl.Param.Byte[11] = EE_Parameter.NaviAngleLimitation;
break;
case SPI_CMD_STICK:
tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127;
ToNaviCtrl.Param.Byte[0] = (char) tmp;
tmp = PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127;
ToNaviCtrl.Param.Byte[1] = (char) tmp;
tmp = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127;
ToNaviCtrl.Param.Byte[2] = (char) tmp;
tmp = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]]; if(tmp > 127) tmp = 127; else if(tmp < -127) tmp = -127;
ToNaviCtrl.Param.Byte[3] = (char) tmp;
ToNaviCtrl.Param.Byte[4] = (unsigned char) Poti1;
ToNaviCtrl.Param.Byte[5] = (unsigned char) Poti2;
ToNaviCtrl.Param.Byte[6] = (unsigned char) Poti3;
ToNaviCtrl.Param.Byte[7] = (unsigned char) Poti4;
ToNaviCtrl.Param.Byte[8] = (unsigned char) SenderOkay;
break;
case SPI_CMD_MISC:
if(WinkelOut.CalcState > 5)
{
WinkelOut.CalcState = 0;
ToNaviCtrl.Param.Byte[0] = 5;
}
else ToNaviCtrl.Param.Byte[0] = WinkelOut.CalcState;
ToNaviCtrl.Param.Int[1] = HoehenWert;
ToNaviCtrl.Param.Byte[1] = EE_Parameter.NaviPH_LoginTime;
ToNaviCtrl.Param.Byte[4] = EE_Parameter.NaviGpsPLimit;
ToNaviCtrl.Param.Byte[5] = EE_Parameter.NaviGpsILimit;
ToNaviCtrl.Param.Byte[6] = EE_Parameter.NaviGpsDLimit;
break;
 
case SPI_CMD_VERSION:
ToNaviCtrl.Param.Byte[0] = SPI_VersionInfo.Major;
ToNaviCtrl.Param.Byte[1] = SPI_VersionInfo.Minor;
ToNaviCtrl.Param.Byte[2] = SPI_VersionInfo.Patch;
ToNaviCtrl.Param.Byte[3] = SPI_VersionInfo.Compatible;
ToNaviCtrl.Param.Byte[4] = PlatinenVersion;
break;
}
 
sei();
 
if(SPI_RxDataValid)
{
if(abs(FromNaviCtrl.GPS_Nick) < 512 && abs(FromNaviCtrl.GPS_Roll) < 512 && (EE_Parameter.GlobalConfig & CFG_GPS_AKTIV))
{
GPS_Nick = FromNaviCtrl.GPS_Nick;
GPS_Roll = FromNaviCtrl.GPS_Roll;
NaviDataOkay = 250;
}
if(FromNaviCtrl.CompassValue <= 360) KompassValue = FromNaviCtrl.CompassValue;
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
 
if(FromNaviCtrl.BeepTime > beeptime && !WinkelOut.CalcState) beeptime = FromNaviCtrl.BeepTime;
 
switch (FromNaviCtrl.Command)
{
case SPI_KALMAN:
FromNaviCtrl_Value.Kalman_K = FromNaviCtrl.Param.Byte[0];
FromNaviCtrl_Value.Kalman_MaxFusion = FromNaviCtrl.Param.Byte[1];
FromNaviCtrl_Value.Kalman_MaxDrift = FromNaviCtrl.Param.Byte[2];
FromNaviCtrl_Value.SerialDataOkay = FromNaviCtrl.Param.Byte[3];
break;
 
default:
break;
}
}
else
{
// KompassValue = 0;
// KompassRichtung = 0;
GPS_Nick = 0;
GPS_Roll = 0;
}
}
 
#endif
 
 
/branches/V0.74d-acid/spi.h
0,0 → 1,140
// ######################## SPI - FlightCtrl ###################
#ifndef _SPI_H
#define _SPI_H
 
#include <util/delay.h>
 
#define USE_SPI_COMMUNICATION
 
#define SPI_PROTOCOL_COMP 1
 
//-----------------------------------------
#define DDR_SPI DDRB
#define DD_SS PB4
#define DD_SCK PB7
#define DD_MOSI PB5
#define DD_MISO PB6
 
// for compatibility reasons gcc3.x <-> gcc4.x
#ifndef SPCR
#define SPCR SPCR0
#endif
#ifndef SPE
#define SPE SPE0
#endif
#ifndef MSTR
#define MSTR MSTR0
#endif
#ifndef SPR1
#define SPR1 SPR01
#endif
#ifndef SPR0
#define SPR0 SPR00
#endif
#ifndef SPIE
#define SPIE SPIE0
#endif
#ifndef SPDR
#define SPDR SPDR0
#endif
#ifndef SPIF
#define SPIF SPIF0
#endif
#ifndef SPSR
#define SPSR SPSR0
#endif
// -------------------------
 
#define SLAVE_SELECT_DDR_PORT DDRC
#define SLAVE_SELECT_PORT PORTC
#define SPI_SLAVE_SELECT PC5
 
 
#define SPI_CMD_USER 10
#define SPI_CMD_STICK 11
#define SPI_CMD_MISC 12
#define SPI_CMD_PARAMETER1 13
#define SPI_CMD_VERSION 14
 
struct str_ToNaviCtrl
{
unsigned char Sync1, Sync2;
unsigned char Command;
signed int IntegralNick;
signed int IntegralRoll;
signed int AccNick;
signed int AccRoll;
signed int GyroCompass;
signed int GyroNick;
signed int GyroRoll;
signed int GyroGier;
union
{ char Byte[12];
int Int[6];
long Long[3];
float Float[3];
} Param;
unsigned char Chksum;
};
 
#define SPI_KALMAN 103
 
struct str_FromNaviCtrl
{
unsigned char Command;
signed int GPS_Nick;
signed int GPS_Roll;
signed int GPS_Gier;
signed int CompassValue;
signed int Status;
unsigned int BeepTime;
union
{ char Byte[12];
int Int[6];
long Long[3];
float Float[3];
} Param;
unsigned char Chksum;
};
 
struct str_FromNaviCtrl_Value
{
signed char Kalman_K;
signed char Kalman_MaxDrift;
signed char Kalman_MaxFusion;
unsigned char SerialDataOkay;
};
 
struct str_SPI_VersionInfo
{
unsigned char Major;
unsigned char Minor;
unsigned char Patch;
unsigned char Compatible;
};
 
#ifdef USE_SPI_COMMUNICATION
 
extern struct str_FromNaviCtrl_Value FromNaviCtrl_Value;
extern struct str_ToNaviCtrl ToNaviCtrl;
extern struct str_FromNaviCtrl FromNaviCtrl;
extern unsigned char SPI_CommandCounter,NaviDataOkay;
 
//#define SPI_CMD_VALUE 0x03
 
extern void SPI_MasterInit(void);
extern void SPI_StartTransmitPacket(void);
extern void UpdateSPI_Buffer(void);
extern void SPI_TransmitByte(void);
#else
 
 
// -------------------------------- Dummy -----------------------------------------
#define SPI_MasterInit() ;
#define SPI_StartTransmitPacket() ;
#define UpdateSPI_Buffer() ;
#define SPI_TransmitByte() ;
#endif
 
 
#endif
/branches/V0.74d-acid/timer0.c
0,0 → 1,440
#include "main.h"
 
volatile unsigned int CountMilliseconds = 0;
volatile static unsigned int tim_main;
volatile unsigned char UpdateMotor = 0;
volatile unsigned int cntKompass = 0;
volatile unsigned int beeptime = 0;
volatile unsigned char SendSPI = 0, ServoActive = 0;
 
unsigned int BeepMuster = 0xffff;
int ServoValue = 0;
 
volatile int16_t ServoNickValue = 0;
volatile int16_t ServoRollValue = 0;
 
 
enum {
STOP = 0,
CK = 1,
CK8 = 2,
CK64 = 3,
CK256 = 4,
CK1024 = 5,
T0_FALLING_EDGE = 6,
T0_RISING_EDGE = 7
};
 
 
SIGNAL (SIG_OVERFLOW0) // 8kHz
{
static unsigned char cnt_1ms = 1,cnt = 0;
unsigned char pieper_ein = 0;
// TCNT0 -= 250;//TIMER_RELOAD_VALUE;
if(SendSPI) SendSPI--;
if(!cnt--)
{
cnt = 9;
cnt_1ms++;
cnt_1ms %= 2;
if(!cnt_1ms) UpdateMotor = 1;
CountMilliseconds++;
}
 
if(beeptime > 1)
{
beeptime--;
if(beeptime & BeepMuster)
{
pieper_ein = 1;
}
else pieper_ein = 0;
}
else
{
pieper_ein = 0;
BeepMuster = 0xffff;
}
 
 
if(pieper_ein)
{
if(PlatinenVersion == 10) PORTD |= (1<<2); // Speaker an PORTD.2
else PORTC |= (1<<7); // Speaker an PORTC.7
}
else
{
if(PlatinenVersion == 10) PORTD &= ~(1<<2);
else PORTC &= ~(1<<7);
}
 
if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
{
if(PINC & 0x10)
{
cntKompass++;
}
else
{
if((cntKompass) && (cntKompass < 362))
{
cntKompass += cntKompass / 41;
if(cntKompass > 10) KompassValue = cntKompass - 10; else KompassValue = 0;
}
// if(cntKompass < 10) cntKompass = 10;
// KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
cntKompass = 0;
}
}
}
 
 
// -----------------------------------------------------------------------
 
unsigned int SetDelay (unsigned int t)
{
// TIMSK0 &= ~_BV(TOIE0);
return(CountMilliseconds + t + 1);
// TIMSK0 |= _BV(TOIE0);
}
 
// -----------------------------------------------------------------------
char CheckDelay(unsigned int t)
{
// TIMSK0 &= ~_BV(TOIE0);
return(((t - CountMilliseconds) & 0x8000) >> 9);
// TIMSK0 |= _BV(TOIE0);
}
 
// -----------------------------------------------------------------------
void Delay_ms(unsigned int w)
{
unsigned int akt;
akt = SetDelay(w);
while (!CheckDelay(akt));
}
 
void Delay_ms_Mess(unsigned int w)
{
unsigned int akt;
akt = SetDelay(w);
while (!CheckDelay(akt)) if(AdReady) {AdReady = 0; ANALOG_ON;}
}
 
/*****************************************************/
/* Initialize Timer 2 */
/*****************************************************/
// The timer 2 is used to generate the PWM at PD7 (J7)
// to control a camera servo for nick compensation.
void TIMER2_Init(void)
{
uint8_t sreg = SREG;
 
// disable all interrupts before reconfiguration
cli();
 
// set PD7 as output of the PWM for nick servo
DDRD |= (1<<DDD7);
PORTD &= ~(1<<PORTD7); // set PD7 to low
 
DDRC |= (1<<DDC6); // set PC6 as output (Reset for HEF4017)
HEF4017R_ON;
// Timer/Counter 2 Control Register A
 
// Timer Mode is FastPWM with timer reload at OCR2A (Bits: WGM22 = 1, WGM21 = 1, WGM20 = 1)
// PD7: Normal port operation, OC2A disconnected, (Bits: COM2A1 = 0, COM2A0 = 0)
// PD6: Normal port operation, OC2B disconnected, (Bits: COM2B1 = 0, COM2B0 = 0)
TCCR2A &= ~((1<<COM2A1)|(1<<COM2A0)|(1<<COM2B1)|(1<<COM2B0));
TCCR2A |= (1<<WGM21)|(1<<WGM20);
 
// Timer/Counter 2 Control Register B
 
// Set clock divider for timer 2 to SYSKLOCK/32 = 20MHz / 32 = 625 kHz
// The timer increments from 0x00 to 0xFF with an update rate of 625 kHz or 1.6 us
// hence the timer overflow interrupt frequency is 625 kHz / 256 = 2.44 kHz or 0.4096 ms
 
// divider 32 (Bits: CS022 = 0, CS21 = 1, CS20 = 1)
TCCR2B &= ~((1<<FOC2A)|(1<<FOC2B)|(1<<CS22));
TCCR2B |= (1<<CS21)|(1<<CS20)|(1<<WGM22);
 
// Initialize the Timer/Counter 2 Register
TCNT2 = 0;
 
// Initialize the Output Compare Register A used for PWM generation on port PD7.
OCR2A = 255;
TCCR2A |= (1<<COM2A1); // set or clear at compare match depends on value of COM2A0
 
// Timer/Counter 2 Interrupt Mask Register
// Enable timer output compare match A Interrupt only
TIMSK2 &= ~((1<<OCIE2B)|(1<<TOIE2));
TIMSK2 |= (1<<OCIE2A);
 
SREG = sreg;
}
 
//----------------------------
void Timer_Init(void)
{
tim_main = SetDelay(10);
TCCR0B = CK8;
TCCR0A = (1<<COM0A1)|(1<<COM0B1)|3;//fast PWM
OCR0A = 0;
OCR0B = 120;
TCNT0 = (unsigned char)-TIMER_RELOAD_VALUE; // reload
//OCR1 = 0x00;
 
TIMSK0 |= _BV(TOIE0);
}
 
 
/*****************************************************/
/* Control Servo Position */
/*****************************************************/
 
ISR(TIMER2_COMPA_vect)
{
 
// frame len 22.5 ms = 14063 * 1.6 us
// stop pulse: 0.3 ms = 188 * 1.6 us
// min servo pulse: 0.6 ms = 375 * 1.6 us
// max servo pulse: 2.4 ms = 1500 * 1.6 us
// resolution: 1500 - 375 = 1125 steps
 
#define IRS_RUNTIME 127
#define PPM_STOPPULSE 188
// #define PPM_FRAMELEN (14063
#define PPM_FRAMELEN (1757 * EE_Parameter.ServoNickRefresh)
#define MINSERVOPULSE 375
#define MAXSERVOPULSE 1500
#define SERVORANGE (MAXSERVOPULSE - MINSERVOPULSE)
 
static uint8_t PulseOutput = 0;
static uint16_t RemainingPulse = 0;
static uint16_t ServoFrameTime = 0;
static uint8_t ServoIndex = 0;
 
#define MULTIPLYER 4
static int16_t ServoNickOffset = (255 / 2) * MULTIPLYER; // initial value near center positon
static int16_t ServoRollOffset = (255 / 2) * MULTIPLYER; // initial value near center positon
 
if(PlatinenVersion < 20)
{
//---------------------------
// Nick servo state machine
//---------------------------
if(!PulseOutput) // pulse output complete
{
if(TCCR2A & (1<<COM2A0)) // we had a low pulse
{
TCCR2A &= ~(1<<COM2A0);// make a high pulse
RemainingPulse = MINSERVOPULSE + SERVORANGE/2; // center position ~ 1.5ms
 
ServoNickOffset = (ServoNickOffset * 3 + (int16_t)Parameter_ServoNickControl * MULTIPLYER) / 4; // lowpass offset
ServoNickValue = ServoNickOffset; // offset (Range from 0 to 255 * 3 = 765)
if (Parameter_UserParam8 == 254) {
if(EE_Parameter.ServoNickCompInvert & 0x01)
{ // inverting movement of servo
ServoNickValue += (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * ((IntegralNick - IntegralRoll) / 128L ) ) / (256L) );
}
else
{ // non inverting movement of servo
ServoNickValue -= (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * ((IntegralNick - IntegralRoll) / 128L ) ) / (256L) );
}
} else {
if(EE_Parameter.ServoNickCompInvert & 0x01)
{ // inverting movement of servo
ServoNickValue += (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * (IntegralNick / 128L ) ) / (256L) );
}
else
{ // non inverting movement of servo
ServoNickValue -= (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * (IntegralNick / 128L ) ) / (256L) );
}
}
// limit servo value to its parameter range definition
if(ServoNickValue < ((int16_t)EE_Parameter.ServoNickMin * MULTIPLYER) )
{
ServoNickValue = (int16_t)EE_Parameter.ServoNickMin * MULTIPLYER;
}
else
if(ServoNickValue > ((int16_t)EE_Parameter.ServoNickMax * MULTIPLYER) )
{
ServoNickValue = (int16_t)EE_Parameter.ServoNickMax * MULTIPLYER;
}
 
RemainingPulse += ServoNickValue - (256 / 2) * MULTIPLYER; // shift ServoNickValue to center position
 
ServoNickValue /= MULTIPLYER;
DebugOut.Analog[20] = ServoNickValue;
 
// range servo pulse width
if(RemainingPulse > MAXSERVOPULSE ) RemainingPulse = MAXSERVOPULSE; // upper servo pulse limit
else if(RemainingPulse < MINSERVOPULSE ) RemainingPulse = MINSERVOPULSE; // lower servo pulse limit
// accumulate time for correct update rate
ServoFrameTime = RemainingPulse;
}
else // we had a high pulse
{
TCCR2A |= (1<<COM2A0); // make a low pulse
RemainingPulse = PPM_FRAMELEN - ServoFrameTime;
}
// set pulse output active
PulseOutput = 1;
}
} // EOF Nick servo state machine
else
{
//-----------------------------------------------------
// PPM state machine, onboard demultiplexed by HEF4017
//-----------------------------------------------------
if(!PulseOutput) // pulse output complete
{
if(TCCR2A & (1<<COM2A0)) // we had a low pulse
{
TCCR2A &= ~(1<<COM2A0);// make a high pulse
 
if(ServoIndex == 0) // if we are at the sync gap
{
RemainingPulse = PPM_FRAMELEN - ServoFrameTime; // generate sync gap by filling time to full frame time
ServoFrameTime = 0; // reset servo frame time
HEF4017R_ON; // enable HEF4017 reset
}
else // servo channels
{
RemainingPulse = MINSERVOPULSE + SERVORANGE/2; // center position ~ 1.5ms
switch(ServoIndex) // map servo channels
{
case 1: // Nick Compensation Servo
ServoNickOffset = (ServoNickOffset * 3 + (int16_t)Parameter_ServoNickControl * MULTIPLYER) / 4; // lowpass offset
ServoNickValue = ServoNickOffset; // offset (Range from 0 to 255 * 3 = 765)
if(EE_Parameter.ServoNickCompInvert & 0x01)
{ // inverting movement of servo
ServoNickValue += (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * (IntegralNick / 128L ) ) / (256L) );
}
else
{ // non inverting movement of servo
ServoNickValue -= (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * (IntegralNick / 128L ) ) / (256L) );
}
// limit servo value to its parameter range definition
if(ServoNickValue < ((int16_t)EE_Parameter.ServoNickMin * MULTIPLYER) )
{
ServoNickValue = (int16_t)EE_Parameter.ServoNickMin * MULTIPLYER;
}
else
if(ServoNickValue > ((int16_t)EE_Parameter.ServoNickMax * MULTIPLYER) )
{
ServoNickValue = (int16_t)EE_Parameter.ServoNickMax * MULTIPLYER;
}
RemainingPulse += ServoNickValue - (256 / 2) * MULTIPLYER; // shift ServoNickValue to center position
ServoNickValue /= MULTIPLYER;
DebugOut.Analog[20] = ServoNickValue;
break;
case 2: // Roll Compensation Servo
ServoRollOffset = (ServoRollOffset * 3 + (int16_t) 80 * MULTIPLYER) / 4; // lowpass offset
ServoRollValue = ServoRollOffset; // offset (Range from 0 to 255 * 3 = 765)
//if(EE_Parameter.ServoRollCompInvert & 0x01)
{ // inverting movement of servo
ServoRollValue += (int16_t)( ( (int32_t) 50 * MULTIPLYER * (IntegralRoll / 128L ) ) / (256L) );
}
/* else
{ // non inverting movement of servo
ServoRollValue -= (int16_t)( ( (int32_t) 40 * MULTIPLYER * (IntegralRoll / 128L ) ) / (256L) );
}
*/ // limit servo value to its parameter range definition
if(ServoRollValue < ((int16_t)EE_Parameter.ServoNickMin * MULTIPLYER) )
{
ServoRollValue = (int16_t)EE_Parameter.ServoNickMin * MULTIPLYER;
}
else
if(ServoRollValue > ((int16_t)EE_Parameter.ServoNickMax * MULTIPLYER) )
{
ServoRollValue = (int16_t)EE_Parameter.ServoNickMax * MULTIPLYER;
}
RemainingPulse += ServoRollValue - (256 / 2) * MULTIPLYER; // shift ServoNickValue to center position
ServoRollValue /= MULTIPLYER;
//DebugOut.Analog[20] = ServoRollValue;
 
/* ServoRollOffset = (ServoRollOffset * 3 + (int16_t)Parameter_ServoRollControl * MULTIPLYER) / 4; // lowpass offset
ServoRollValue = ServoRollOffset; // offset (Range from 0 to 255 * 3 = 765)
if(EE_Parameter.ServoRollCompInvert & 0x01)
{ // inverting movement of servo
ServoRollValue += (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * (IntegralNick / 128L ) ) / (256L) );
}
else
{ // non inverting movement of servo
ServoRollValue -= (int16_t)( ( (int32_t)EE_Parameter.ServoNickComp * MULTIPLYER * (IntegralNick / 128L ) ) / (256L) );
}
// limit servo value to its parameter range definition
if(ServoRollValue < ((int16_t)EE_Parameter.ServoRollMin * MULTIPLYER) )
{
ServoRollValue = (int16_t)EE_Parameter.ServoRollMin * MULTIPLYER;
}
else
if(ServoRollValue > ((int16_t)EE_Parameter.ServoRollMax * MULTIPLYER) )
{
ServoRollValue = (int16_t)EE_Parameter.ServoRollMax * MULTIPLYER;
}
RemainingPulse += ServoRollValue - (256 / 2) * MULTIPLYER; // shift ServoNickValue to center position
ServoRollValue /= MULTIPLYER;
//DebugOut.Analog[20] = ServoRollValue;
*/ break;
 
default: // other servo channels
RemainingPulse += 2 * PPM_in[ServoIndex]; // add channel value, factor of 2 because timer 1 increments 3.2µs
break;
}
// range servo pulse width
if(RemainingPulse > MAXSERVOPULSE ) RemainingPulse = MAXSERVOPULSE; // upper servo pulse limit
else if(RemainingPulse < MINSERVOPULSE ) RemainingPulse = MINSERVOPULSE; // lower servo pulse limit
// substract stop pulse width
RemainingPulse -= PPM_STOPPULSE;
// accumulate time for correct sync gap
ServoFrameTime += RemainingPulse;
}
}
else // we had a high pulse
{
TCCR2A |= (1<<COM2A0); // make a low pulse
// set pulsewidth to stop pulse width
RemainingPulse = PPM_STOPPULSE;
// accumulate time for correct sync gap
ServoFrameTime += RemainingPulse;
if(ServoActive && SenderOkay > 180) HEF4017R_OFF; // disable HEF4017 reset
ServoIndex++; // change to next servo channel
if(ServoIndex > EE_Parameter.ServoNickRefresh) ServoIndex = 0; // reset to the sync gap
}
// set pulse output active
PulseOutput = 1;
}
} // EOF PPM state machine
 
// General pulse output generator
if(RemainingPulse > (255 + IRS_RUNTIME))
{
OCR2A = 255;
RemainingPulse -= 255;
}
else
{
if(RemainingPulse > 255) // this is the 2nd last part
{
if((RemainingPulse - 255) < IRS_RUNTIME)
{
OCR2A = 255 - IRS_RUNTIME;
RemainingPulse -= 255 - IRS_RUNTIME;
 
}
else // last part > ISR_RUNTIME
{
OCR2A = 255;
RemainingPulse -= 255;
}
}
else // this is the last part
{
OCR2A = RemainingPulse;
RemainingPulse = 0;
PulseOutput = 0; // trigger to stop pulse
}
} // EOF general pulse output generator
}
/branches/V0.74d-acid/timer0.h
0,0 → 1,20
 
#define TIMER_TEILER CK8
#define TIMER_RELOAD_VALUE 250
#define HEF4017R_ON PORTC |= (1<<PORTC6)
#define HEF4017R_OFF PORTC &= ~(1<<PORTC6)
 
void Timer_Init(void);
void TIMER2_Init(void);
void Delay_ms(unsigned int);
void Delay_ms_Mess(unsigned int);
unsigned int SetDelay (unsigned int t);
char CheckDelay (unsigned int t);
 
extern volatile unsigned int CountMilliseconds;
extern volatile unsigned char UpdateMotor;
extern volatile unsigned int beeptime;
extern volatile unsigned int cntKompass;
extern int ServoValue;
extern unsigned int BeepMuster;
extern volatile unsigned char SendSPI, ServoActive;
/branches/V0.74d-acid/twimaster.c
0,0 → 1,216
/*############################################################################
############################################################################*/
 
#include "main.h"
 
volatile unsigned char twi_state = 0;
unsigned char motor = 0;
unsigned char motorread = 0,MissingMotor = 0;
unsigned char motor_rx[16],motor_rx2[16];
unsigned char MotorPresent[MAX_MOTORS];
unsigned char MotorError[MAX_MOTORS];
 
//############################################################################
//Initzialisieren der I2C (TWI) Schnittstelle
void i2c_init(void)
//############################################################################
{
TWSR = 0;
TWBR = ((SYSCLK/SCL_CLOCK)-16)/2;
}
 
//############################################################################
//Start I2C
void i2c_start(void)
//############################################################################
{
TWCR = (1<<TWSTA) | (1<<TWEN) | (1<<TWINT) | (1<<TWIE);
}
 
//############################################################################
void i2c_stop(void)
//############################################################################
{
TWCR = (1<<TWEN) | (1<<TWSTO) | (1<<TWINT);
}
 
void i2c_reset(void)
//############################################################################
{
i2c_stop();
twi_state = 0;
motor = TWDR;
motor = 0;
TWCR = 0x80;
TWAMR = 0;
TWAR = 0;
TWDR = 0;
TWSR = 0;
TWBR = 0;
i2c_init();
i2c_start();
i2c_write_byte(0);
}
 
//############################################################################
void i2c_write_byte(char byte)
//############################################################################
{
TWSR = 0x00;
TWDR = byte;
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE);
}
 
/****************************************/
/* Write to I2C */
/****************************************/
void I2C_WriteByte(int8_t byte)
{
// move byte to send into TWI Data Register
TWDR = byte;
// clear interrupt flag (TWINT = 1)
// enable i2c bus (TWEN = 1)
// enable interrupt (TWIE = 1)
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE);
}
 
/****************************************/
/* Receive byte and send ACK */
/****************************************/
void I2C_ReceiveByte(void)
{
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE) | (1<<TWEA);
}
 
/****************************************/
/* I2C receive last byte and send no ACK*/
/****************************************/
void I2C_ReceiveLastByte(void)
{
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE);
}
 
 
 
//############################################################################
SIGNAL (TWI_vect)
//############################################################################
{
static unsigned char missing_motor;
switch(twi_state++)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Writing the Data
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
case 0:
while(Mixer.Motor[motor][0] <= 0 && motor < MAX_MOTORS) motor++; // skip if not used
if(motor == MAX_MOTORS) // writing finished -> now read
{
motor = 0;
twi_state = 3;
i2c_write_byte(0x53+(motorread*2));
}
else i2c_write_byte(0x52+(motor*2));
break;
case 1:
i2c_write_byte(Motor[motor++]);
break;
case 2:
if(TWSR == 0x30) { if(!missing_motor) missing_motor = motor; if(++MotorError[motor-1] == 0) MotorError[motor-1] = 255;}
i2c_stop();
I2CTimeout = 10;
twi_state = 0;
i2c_start();
break;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Reading Data
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
case 3:
//Transmit 1st byte for reading
if(TWSR != 0x40) // Error?
{
MotorPresent[motorread] = 0;
motorread++;
if(motorread >= MAX_MOTORS) motorread = 0;
i2c_stop();
twi_state = 0;
}
else
{
MotorPresent[motorread] = ('1' - '-') + motorread;
I2C_ReceiveByte();
}
MissingMotor = missing_motor;
missing_motor = 0;
break;
case 4: //Read 1st byte and transmit 2nd Byte
motor_rx[motorread] = TWDR;
I2C_ReceiveLastByte(); //nack
break;
case 5:
//Read 2nd byte
motor_rx2[motorread++] = TWDR;
if(motorread >= MAX_MOTORS) motorread = 0;
i2c_stop();
twi_state = 0;
break;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// writing Gyro-Offset
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
case 8:
i2c_write_byte(0x98); // Address of the DAC
break;
case 9:
i2c_write_byte(0x10); // Update Channel A
break;
case 10:
i2c_write_byte(AnalogOffsetNick); // Value
break;
case 11:
i2c_write_byte(0x80); // Value
break;
case 12:
i2c_stop();
I2CTimeout = 10;
i2c_start();
break;
case 13:
i2c_write_byte(0x98); // Address of the DAC
break;
case 14:
i2c_write_byte(0x12); // Update Channel B
break;
case 15:
i2c_write_byte(AnalogOffsetRoll); // Value
break;
case 16:
i2c_write_byte(0x80); // Value
break;
case 17:
i2c_stop();
I2CTimeout = 10;
i2c_start();
break;
case 18:
i2c_write_byte(0x98); // Address of the DAC
break;
case 19:
i2c_write_byte(0x14); // Update Channel C
break;
case 20:
i2c_write_byte(AnalogOffsetGier); // Value
break;
case 21:
i2c_write_byte(0x80); // Value
break;
case 22:
i2c_stop();
I2CTimeout = 10;
twi_state = 0;
break;
default: twi_state = 0;
break;
}
TWCR |= 0x80;
}
/branches/V0.74d-acid/twimaster.h
0,0 → 1,35
/*############################################################################
############################################################################*/
 
#ifndef _I2C_MASTER_H
#define _I2C_MASTER_H
 
//############################################################################
 
// I2C Konstanten
#define SCL_CLOCK 200000L
#define I2C_TIMEOUT 30000
#define I2C_START 0x08
#define I2C_REPEATED_START 0x10
#define I2C_TX_SLA_ACK 0x18
#define I2C_TX_DATA_ACK 0x28
#define I2C_RX_SLA_ACK 0x40
#define I2C_RX_DATA_ACK 0x50
 
//############################################################################
 
extern volatile unsigned char twi_state;
extern unsigned char motor,MissingMotor;
extern unsigned char motorread;
extern unsigned char motor_rx[];
extern unsigned char MotorPresent[];
extern unsigned char MotorError[];
 
void i2c_reset(void);
extern void i2c_init (void); // I2C initialisieren
extern void i2c_start (void); // Start I2C
extern void i2c_stop (void); // Stop I2C
extern void i2c_write_byte (char byte); // 1 Byte schreiben
extern void i2c_reset(void);
 
#endif
/branches/V0.74d-acid/uart.c
0,0 → 1,564
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Copyright (c) 04.2007 Holger Buss
// + only for non-profit use
// + www.MikroKopter.com
// + see the File "License.txt" for further Informations
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <stdarg.h>
#include <string.h>
#include "main.h"
#include "uart.h"
 
 
#define FC_ADDRESS 1
#define NC_ADDRESS 2
#define MK3MAG_ADDRESS 3
 
unsigned char GetExternalControl = 0,DebugDisplayAnforderung1 = 0, DebugDisplayAnforderung = 0,DebugDataAnforderung = 0,GetVersionAnforderung = 0, GetPPMChannelAnforderung = 0;
unsigned char DisplayLine = 0;
unsigned volatile char SioTmp = 0;
unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
unsigned volatile char NMEABuffer[MAX_EMPFANGS_BUFF];
unsigned volatile char NeuerDatensatzEmpfangen = 0;
unsigned volatile char NeueKoordinateEmpfangen = 0;
unsigned volatile char UebertragungAbgeschlossen = 1;
unsigned volatile char CntCrcError = 0;
unsigned volatile char AnzahlEmpfangsBytes = 0;
unsigned char *pRxData = 0;
unsigned char RxDataLen = 0;
unsigned volatile char PC_DebugTimeout = 0;
unsigned volatile char PC_MotortestActive = 0;
 
unsigned char DebugTextAnforderung = 255;
unsigned char PcZugriff = 100;
unsigned char MotorTest[16];
unsigned char MeineSlaveAdresse = 1; // Flight-Ctrl
unsigned char ConfirmFrame;
struct str_DebugOut DebugOut;
struct str_ExternControl ExternControl;
struct str_VersionInfo VersionInfo;
struct str_WinkelOut WinkelOut;
struct str_Data3D Data3D;
 
int Debug_Timer,Kompass_Timer,Timer3D;
unsigned int DebugDataIntervall = 200, Intervall3D = 0;
 
const unsigned char ANALOG_TEXT[32][16] =
{
//1234567890123456
"AngleNick ", //0
"AngleRoll ",
"AccNick ",
"AccRoll ",
"GyroGier ",
"Hight Value ", //5
"AccZ ",
"Gas ",
"Compass Value ",
"Voltage ",
"Empfang ", //10
"Gyro Kompass ",
"Motor Front ",
"Motor Rear ",
"Motor Left ",
"Motor Right ", //15
" ",
" ",
" ",
"MK3Mag CalState ",
"Servo ", //20
" ",
" ",
" ",
" ",
" ", //25
" ",
"Kalman_MaxDrift ",
" ",
"Navi Serial Data",
"GPS_Nick ", //30
"GPS_Roll "
};
 
 
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ Sende-Part der Datenübertragung
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SIGNAL(INT_VEC_TX)
{
static unsigned int ptr = 0;
unsigned char tmp_tx;
if(!UebertragungAbgeschlossen)
{
ptr++; // die [0] wurde schon gesendet
tmp_tx = SendeBuffer[ptr];
if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF))
{
ptr = 0;
UebertragungAbgeschlossen = 1;
}
UDR = tmp_tx;
}
else ptr = 0;
}
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ Empfangs-Part der Datenübertragung, incl. CRC-Auswertung
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SIGNAL(INT_VEC_RX)
{
static unsigned int crc;
static unsigned char crc1,crc2,buf_ptr;
static unsigned char UartState = 0;
unsigned char CrcOkay = 0;
 
SioTmp = UDR;
if(buf_ptr >= MAX_EMPFANGS_BUFF) UartState = 0;
if(SioTmp == '\r' && UartState == 2)
{
UartState = 0;
crc -= RxdBuffer[buf_ptr-2];
crc -= RxdBuffer[buf_ptr-1];
crc %= 4096;
crc1 = '=' + crc / 64;
crc2 = '=' + crc % 64;
CrcOkay = 0;
if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; CntCrcError++;};
if(!NeuerDatensatzEmpfangen && CrcOkay) // Datensatz schon verarbeitet
{
NeuerDatensatzEmpfangen = 1;
AnzahlEmpfangsBytes = buf_ptr + 1;
RxdBuffer[buf_ptr] = '\r';
if(RxdBuffer[2] == 'R') wdt_enable(WDTO_250MS); // Reset-Commando
}
}
else
switch(UartState)
{
case 0:
if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet
buf_ptr = 0;
RxdBuffer[buf_ptr++] = SioTmp;
crc = SioTmp;
break;
case 1: // Adresse auswerten
UartState++;
RxdBuffer[buf_ptr++] = SioTmp;
crc += SioTmp;
break;
case 2: // Eingangsdaten sammeln
RxdBuffer[buf_ptr] = SioTmp;
if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++;
else UartState = 0;
crc += SioTmp;
break;
default:
UartState = 0;
break;
}
}
 
 
// --------------------------------------------------------------------------
void AddCRC(unsigned int wieviele)
{
unsigned int tmpCRC = 0,i;
for(i = 0; i < wieviele;i++)
{
tmpCRC += SendeBuffer[i];
}
tmpCRC %= 4096;
SendeBuffer[i++] = '=' + tmpCRC / 64;
SendeBuffer[i++] = '=' + tmpCRC % 64;
SendeBuffer[i++] = '\r';
UebertragungAbgeschlossen = 0;
UDR = SendeBuffer[0];
}
 
 
 
// --------------------------------------------------------------------------
void SendOutData(unsigned char cmd,unsigned char address, unsigned char BufferAnzahl, ...) //unsigned char *snd, unsigned char len)
{
va_list ap;
unsigned int pt = 0;
unsigned char a,b,c;
unsigned char ptr = 0;
 
unsigned char *snd = 0;
int len = 0;
 
SendeBuffer[pt++] = '#'; // Startzeichen
SendeBuffer[pt++] = 'a' + address; // Adresse (a=0; b=1,...)
SendeBuffer[pt++] = cmd; // Commando
 
va_start(ap, BufferAnzahl);
if(BufferAnzahl)
{
snd = va_arg(ap, unsigned char*);
len = va_arg(ap, int);
ptr = 0;
BufferAnzahl--;
}
while(len)
{
if(len)
{
a = snd[ptr++];
len--;
if((!len) && BufferAnzahl)
{
snd = va_arg(ap, unsigned char*);
len = va_arg(ap, int);
ptr = 0;
BufferAnzahl--;
}
}
else a = 0;
if(len)
{
b = snd[ptr++];
len--;
if((!len) && BufferAnzahl)
{
snd = va_arg(ap, unsigned char*);
len = va_arg(ap, int);
ptr = 0;
BufferAnzahl--;
}
}
else b = 0;
if(len)
{
c = snd[ptr++];
len--;
if((!len) && BufferAnzahl)
{
snd = va_arg(ap, unsigned char*);
len = va_arg(ap, int);
ptr = 0;
BufferAnzahl--;
}
}
else c = 0;
SendeBuffer[pt++] = '=' + (a >> 2);
SendeBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4));
SendeBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6));
SendeBuffer[pt++] = '=' + ( c & 0x3f);
}
va_end(ap);
AddCRC(pt);
}
 
 
// --------------------------------------------------------------------------
void Decode64(void) // die daten werden im rx buffer dekodiert, das geht nur, weil aus 4 byte immer 3 gemacht werden.
{
unsigned char a,b,c,d;
unsigned char x,y,z;
unsigned char ptrIn = 3; // start at begin of data block
unsigned char ptrOut = 3;
unsigned char len = AnzahlEmpfangsBytes - 6; // von der Gesamtbytezahl eines Frames gehen 3 Bytes des Headers ('#',Addr, Cmd) und 3 Bytes des Footers (CRC1, CRC2, '\r') ab.
 
while(len)
{
a = RxdBuffer[ptrIn++] - '=';
b = RxdBuffer[ptrIn++] - '=';
c = RxdBuffer[ptrIn++] - '=';
d = RxdBuffer[ptrIn++] - '=';
 
x = (a << 2) | (b >> 4);
y = ((b & 0x0f) << 4) | (c >> 2);
z = ((c & 0x03) << 6) | d;
 
if(len--) RxdBuffer[ptrOut++] = x; else break;
if(len--) RxdBuffer[ptrOut++] = y; else break;
if(len--) RxdBuffer[ptrOut++] = z; else break;
}
pRxData = (unsigned char*)&RxdBuffer[3]; // decodierte Daten beginnen beim 4. Byte
RxDataLen = ptrOut - 3; // wie viele Bytes wurden dekodiert?
 
}
 
// --------------------------------------------------------------------------
void BearbeiteRxDaten(void)
{
if(!NeuerDatensatzEmpfangen) return;
 
unsigned char tempchar1, tempchar2;
Decode64(); // dekodiere datenblock im Empfangsbuffer
switch(RxdBuffer[1]-'a') // check for Slave Address
{
case FC_ADDRESS: // FC special commands
 
switch(RxdBuffer[2])
{
case 'K':// Kompasswert
memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue));
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
break;
case 't':// Motortest
if(AnzahlEmpfangsBytes > 20) memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest));
else memcpy(&MotorTest[0], (unsigned char *)pRxData, 4);
PC_MotortestActive = 240;
//while(!UebertragungAbgeschlossen);
//SendOutData('T', MeineSlaveAdresse, 0);
PcZugriff = 255;
break;
 
case 'n':// "Get Mixer
while(!UebertragungAbgeschlossen);
SendOutData('N', FC_ADDRESS, 1, (unsigned char *) &Mixer,sizeof(Mixer));
break;
 
case 'm':// "Write Mixer
while(!UebertragungAbgeschlossen);
if(pRxData[0] == MIXER_REVISION)
{
memcpy(&Mixer, (unsigned char *)pRxData, sizeof(Mixer));
eeprom_write_block(&Mixer, &EEPromArray[EEPROM_ADR_MIXER_TABLE], sizeof(Mixer));
tempchar1 = 1;
}
else tempchar1 = 0;
SendOutData('M', FC_ADDRESS, 1, &tempchar1, sizeof(tempchar1));
break;
 
case 'p': // get PPM Channels
GetPPMChannelAnforderung = 1;
break;
 
case 'q':// "Get"-Anforderung für Settings
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
if(pRxData[0] == 0xFF)
{
pRxData[0] = GetActiveParamSetNumber();
}
// limit settings range
if(pRxData[0] < 1) pRxData[0] = 1; // limit to 5
else if(pRxData[0] > 5) pRxData[0] = 5; // limit to 5
// load requested parameter set
ReadParameterSet(pRxData[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
 
while(!UebertragungAbgeschlossen);
tempchar1 = pRxData[0];
tempchar2 = EE_DATENREVISION;
SendOutData('Q', FC_ADDRESS, 3, &tempchar1, sizeof(tempchar1), &tempchar2, sizeof(tempchar2), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
break;
 
case 's': // Parametersatz speichern
if((1 <= pRxData[0]) && (pRxData[0] <= 5) && (pRxData[1] == EE_DATENREVISION)) // check for setting to be in range
{
memcpy((unsigned char *) &EE_Parameter.Kanalbelegung[0], (unsigned char *)&pRxData[2], STRUCT_PARAM_LAENGE);
WriteParameterSet(pRxData[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L;
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L;
SetActiveParamSetNumber(pRxData[0]);
tempchar1 = GetActiveParamSetNumber();
Piep(tempchar1);
}
else
{
tempchar1 = 0; // mark in response an invlid setting
}
while(!UebertragungAbgeschlossen);
SendOutData('S', FC_ADDRESS, 1, &tempchar1, sizeof(tempchar1));
break;
 
} // case FC_ADDRESS:
 
default: // any Slave Address
 
switch(RxdBuffer[2])
{
// 't' comand placed here only for compatibility to BL
case 't':// Motortest
if(AnzahlEmpfangsBytes > 20) memcpy(&MotorTest[0], (unsigned char *)pRxData, sizeof(MotorTest));
else memcpy(&MotorTest[0], (unsigned char *)pRxData, 4);
while(!UebertragungAbgeschlossen);
SendOutData('T', MeineSlaveAdresse, 0);
PC_MotortestActive = 250;
PcZugriff = 255;
break;
// 'K' comand placed here only for compatibility to old MK3MAG software, that does not send the right Slave Address
case 'K':// Kompasswert
memcpy((unsigned char *)&KompassValue , (unsigned char *)pRxData, sizeof(KompassValue));
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
break;
case 'a':// Texte der Analogwerte
DebugTextAnforderung = pRxData[0];
if (DebugTextAnforderung > 31) DebugTextAnforderung = 31;
PcZugriff = 255;
break;
case 'b':
memcpy((unsigned char *)&ExternControl, (unsigned char *)pRxData, sizeof(ExternControl));
ConfirmFrame = ExternControl.Frame;
PcZugriff = 255;
break;
case 'c': // Poll the 3D-Data
if(!Intervall3D) { if(pRxData[0]) Timer3D = SetDelay(pRxData[0] * 10);}
Intervall3D = pRxData[0] * 10;
break;
case 'd': // Poll the debug data
DebugDataIntervall = pRxData[0] * 10;
if(DebugDataIntervall > 0) DebugDataAnforderung = 1;
break;
 
case 'h':// x-1 Displayzeilen
PcZugriff = 255;
RemoteKeys |= pRxData[0];
if(RemoteKeys) DisplayLine = 0;
DebugDisplayAnforderung = 1;
break;
 
case 'l':// x-1 Displayzeilen
PcZugriff = 255;
MenuePunkt = pRxData[0];
DebugDisplayAnforderung1 = 1;
break;
case 'v': // Version-Anforderung und Ausbaustufe
GetVersionAnforderung = 1;
break;
 
case 'g'://
GetExternalControl = 1;
break;
}
break; // default:
}
NeuerDatensatzEmpfangen = 0;
pRxData = 0;
RxDataLen = 0;
}
 
//############################################################################
//Routine für die Serielle Ausgabe
int uart_putchar (char c)
//############################################################################
{
if (c == '\n')
uart_putchar('\r');
//Warten solange bis Zeichen gesendet wurde
loop_until_bit_is_set(USR, UDRE);
//Ausgabe des Zeichens
UDR = c;
 
return (0);
}
 
// --------------------------------------------------------------------------
void WriteProgramData(unsigned int pos, unsigned char wert)
{
//if (ProgramLocation == IN_RAM) Buffer[pos] = wert;
// else eeprom_write_byte(&EE_Buffer[pos], wert);
// Buffer[pos] = wert;
}
 
//############################################################################
//INstallation der Seriellen Schnittstelle
void UART_Init (void)
//############################################################################
{
//Enable TXEN im Register UCR TX-Data Enable & RX Enable
 
UCR=(1 << TXEN) | (1 << RXEN);
// UART Double Speed (U2X)
USR |= (1<<U2X);
// RX-Interrupt Freigabe
UCSRB |= (1<<RXCIE);
// TX-Interrupt Freigabe
UCSRB |= (1<<TXCIE);
 
//Teiler wird gesetzt
UBRR=(SYSCLK / (BAUD_RATE * 8L) - 1);
//UBRR = 33;
//öffnet einen Kanal für printf (STDOUT)
//fdevopen (uart_putchar, 0);
//sbi(PORTD,4);
Debug_Timer = SetDelay(DebugDataIntervall);
Kompass_Timer = SetDelay(220);
 
VersionInfo.SWMajor = VERSION_MAJOR;
VersionInfo.SWMinor = VERSION_MINOR;
VersionInfo.SWPatch = VERSION_PATCH;
VersionInfo.ProtoMajor = VERSION_SERIAL_MAJOR;
VersionInfo.ProtoMinor = VERSION_SERIAL_MINOR;
 
pRxData = 0;
RxDataLen = 0;
}
 
//---------------------------------------------------------------------------------------------
void DatenUebertragung(void)
{
if(!UebertragungAbgeschlossen) return;
 
if(DebugDisplayAnforderung && UebertragungAbgeschlossen)
{
Menu();
SendOutData('H', FC_ADDRESS, 2, &DisplayLine, sizeof(DisplayLine), &DisplayBuff[DisplayLine * 20], 20);
DisplayLine++;
if(DisplayLine >= 4) DisplayLine = 0;
DebugDisplayAnforderung = 0;
}
if(DebugDisplayAnforderung1 && UebertragungAbgeschlossen)
{
Menu();
SendOutData('L', FC_ADDRESS, 3, &MenuePunkt, sizeof(MenuePunkt), &MaxMenue, sizeof(MaxMenue), DisplayBuff, sizeof(DisplayBuff));
DebugDisplayAnforderung1 = 0;
}
if(GetVersionAnforderung && UebertragungAbgeschlossen)
{
SendOutData('V', FC_ADDRESS, 1, (unsigned char *) &VersionInfo, sizeof(VersionInfo));
GetVersionAnforderung = 0;
}
 
if(GetExternalControl && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
{
SendOutData('G',MeineSlaveAdresse, 1, (unsigned char *) &ExternControl, sizeof(ExternControl));
GetExternalControl = 0;
}
if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen)
{
WinkelOut.Winkel[0] = (int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad
WinkelOut.Winkel[1] = (int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad
WinkelOut.UserParameter[0] = Parameter_UserParam1;
WinkelOut.UserParameter[1] = Parameter_UserParam2;
SendOutData('w', MK3MAG_ADDRESS, 1, (unsigned char *) &WinkelOut,sizeof(WinkelOut));
if(WinkelOut.CalcState > 4) WinkelOut.CalcState = 6; // wird dann in SPI auf Null gesetzt
Kompass_Timer = SetDelay(99);
}
if(((DebugDataIntervall>0 && CheckDelay(Debug_Timer)) || DebugDataAnforderung) && UebertragungAbgeschlossen)
{
SendOutData('D', FC_ADDRESS, 1, (unsigned char *) &DebugOut,sizeof(DebugOut));
DebugDataAnforderung = 0;
if(DebugDataIntervall>0) Debug_Timer = SetDelay(DebugDataIntervall);
}
if(Intervall3D > 0 && CheckDelay(Timer3D) && UebertragungAbgeschlossen)
{
Data3D.Winkel[0] = (int) (IntegralNick / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad
Data3D.Winkel[1] = (int) (IntegralRoll / (EE_Parameter.GyroAccFaktor * 4)); // etwa in 0.1 Grad
Data3D.Winkel[2] = (int) ((10 * ErsatzKompass) / GIER_GRAD_FAKTOR);
SendOutData('C', FC_ADDRESS, 1, (unsigned char *) &Data3D,sizeof(Data3D));
Timer3D = SetDelay(Intervall3D);
}
if(DebugTextAnforderung != 255) // Texte für die Analogdaten
{
SendOutData('A', FC_ADDRESS, 2, (unsigned char *)&DebugTextAnforderung, sizeof(DebugTextAnforderung),(unsigned char *) ANALOG_TEXT[DebugTextAnforderung], 16);
DebugTextAnforderung = 255;
}
if(ConfirmFrame && UebertragungAbgeschlossen) // Datensatz bestätigen
{
SendOutData('B', FC_ADDRESS, 1, (uint8_t*)&ConfirmFrame, sizeof(ConfirmFrame));
ConfirmFrame = 0;
}
 
if(GetPPMChannelAnforderung && UebertragungAbgeschlossen)
{
SendOutData('P', FC_ADDRESS, 1, (unsigned char *) &PPM_in, sizeof(PPM_in));
GetPPMChannelAnforderung = 0;
}
 
}
 
/branches/V0.74d-acid/uart.h
0,0 → 1,136
#ifndef _UART_H
#define _UART_H
 
#define MAX_SENDE_BUFF 150
#define MAX_EMPFANGS_BUFF 150
 
void BearbeiteRxDaten(void);
 
extern unsigned char DebugGetAnforderung;
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
extern unsigned volatile char UebertragungAbgeschlossen;
extern unsigned volatile char PC_DebugTimeout;
extern unsigned volatile char NeueKoordinateEmpfangen;
extern unsigned volatile char PC_MotortestActive;
extern unsigned char MeineSlaveAdresse;
extern unsigned char PcZugriff;
extern unsigned char RemotePollDisplayLine;
extern int Debug_Timer,Kompass_Timer;
extern void UART_Init (void);
extern int uart_putchar (char c);
extern void boot_program_page (uint32_t page, uint8_t *buf);
extern void DatenUebertragung(void);
extern void Uart1Init(void);
extern void BearbeiteRxDaten(void);
extern unsigned char MotorTest[16];
struct str_DebugOut
{
unsigned char Digital[2];
signed int Analog[32]; // Debugwerte
};
 
extern struct str_DebugOut DebugOut;
 
struct str_WinkelOut
{
signed int Winkel[2];
unsigned char UserParameter[2];
unsigned char CalcState;
unsigned char Orientation;
};
extern struct str_WinkelOut WinkelOut;
 
struct str_Data3D
{
signed int Winkel[3]; // nick, roll, compass in 0,1°
signed char reserve[8];
};
extern struct str_Data3D Data3D;
 
struct str_ExternControl
{
unsigned char Digital[2];
unsigned char RemoteTasten;
signed char Nick;
signed char Roll;
signed char Gier;
unsigned char Gas;
signed char Hight;
unsigned char free;
unsigned char Frame;
unsigned char Config;
};
extern struct str_ExternControl ExternControl;
 
struct str_VersionInfo
{
unsigned char SWMajor;
unsigned char SWMinor;
unsigned char ProtoMajor;
unsigned char ProtoMinor;
unsigned char SWPatch;
unsigned char Reserved[5];
};
extern struct str_VersionInfo VersionInfo;
 
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
//#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle
//#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle
//#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle
//#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle
#define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle
 
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
#if defined (__AVR_ATmega128__)
# define USR UCSR0A
# define UCR UCSR0B
# define UDR UDR0
# define UBRR UBRR0L
# define EICR EICRB
#endif
 
#if defined (__AVR_ATmega32__)
# define USR UCSRA
# define UCR UCSRB
# define UBRR UBRRL
# define EICR EICRB
# define INT_VEC_RX SIG_UART_RECV
# define INT_VEC_TX SIG_UART_TRANS
#endif
 
#if defined (__AVR_ATmega644__)
# define USR UCSR0A
# define UCR UCSR0B
# define UDR UDR0
# define UBRR UBRR0L
# define EICR EICR0B
# define TXEN TXEN0
# define RXEN RXEN0
# define RXCIE RXCIE0
# define TXCIE TXCIE0
# define U2X U2X0
# define UCSRB UCSR0B
# define UDRE UDRE0
# define INT_VEC_RX SIG_USART_RECV
# define INT_VEC_TX SIG_USART_TRANS
#endif
 
#if defined (__AVR_ATmega644P__)
# define USR UCSR0A
# define UCR UCSR0B
# define UDR UDR0
# define UBRR UBRR0L
# define EICR EICR0B
# define TXEN TXEN0
# define RXEN RXEN0
# define RXCIE RXCIE0
# define TXCIE TXCIE0
# define U2X U2X0
# define UCSRB UCSR0B
# define UDRE UDRE0
# define INT_VEC_RX SIG_USART_RECV
# define INT_VEC_TX SIG_USART_TRANS
#endif
 
#endif //_UART_H
/branches/V0.74d-acid/version.txt
0,0 → 1,258
 
-------
V0.53 27.04.2007 H.Buss
- erste öffentliche Version
 
V0.53b 29.04.2007 H.Buss
- der FAKTOR_I war versehentlich auf Null, dann liegt der MikroKopter nicht so hart in der Luft
 
V0.53c 29.04.2007 H.Buss
- es gib ein Menü, in dem die Werte der Kanäle nach Nick, Roll, Gas,... sortiert sind.
Die angezeigten Werte waren nicht die Werte der Funke
 
V0.54 01.05.2007 H.Buss
- die Paramtersätze können jetzt vor dem Start ausgewählt werden
Dazu wird beim Kalibrieren der Messwerte (Gashebel oben links) der Nick-Rollhebel abgefragt:
2 3 4
1 x 5
- - -
Bedeutet: Nick-Rollhebel Links Mitte = Setting:1 Links Oben = Setting:2 usw.
- der Faktor_I für den Hauptregler ist hinzugekommen. Im Heading-Hold-Modus sollte er vergössert werden, was Stabilität bringt
 
V0.55 14.05.2007 H.Buss
- es können nun Servos an J3,J4,J5 mit den Kanälen 5-7 gesteuert werden
 
V0.56 14.05.2007 H.Buss
- es gab Probleme mit Funken, die mehr als 8 Kanäle haben, wenn mehrere Kanäle dann auf Null waren
- Funken, die nicht bis +-120 aussteuern können, sollten jetzt auch gehen
V0.57 24.05.2007 H.Buss
- Der Höhenregler kann nun auch mittels Schalter bedient werden
- Bug im Gier-Algorithmus behoben; Schnelles Gieren fürhrte dazu, dass der MK zu weit gedreht hat
- Kompass-Einfluss dämpfen bei Neigung
- Man kann zwischen Kompass FIX (Richtung beim Kalibrieren) und Variabel (einstellbar per Gier) wählen
- Der Motortest vom Kopter-Tool geht jetzt
- Man kann den Parametersätzen einen Namen geben
- Das Kamerasetting ist unter Setting 2 defaultmässig integriert
V0.58 30.05.2007 H.Buss
- Der Höhenregler-Algorithmus wird nun umgangen, wenn der Höhenreglerschalter aus ist
 
V0.60 17.08.2007 H.Buss
- "Schwindel-Bug" behoben
- Die Poti-Werte werden jetzt auf Unterlauf (<0) überprüft
- Poti4 zugefügt
- Es werden jetzt 8 Kanäle ausgewertet
- Kamera-Servo (an J7)
- Die Settings müssen überschrieben werden
V0.61 - V0.63 H.Buss 27.09.2007
- Poti 4 und Kanal 8 werden im Menü angezeigt
- ein paar Kleinigkeiten bei den DefaultKonstanten2 bereinigt
- Analog.c: Aktuell_ax korrigiert
- auf 32 Debug-Kanäle erweitert
- Loopings sind jetzt möglich und einzeln im KopterTool freischaltbar
- leichte Anpassungen im Gier - Geschwindigkeit und Drift
- die Hardwareversion V1.1 wird erkannt und das Programm stellt sich auf die geänderte Gyroverstärkung und die geänderten Portpins ein
- die Software startet nach dem Einschalten schneller, weil der Luftdruckoffset schneller gefunden wird
- die PPM-Ausgänge liegen wieder an den Pins an
- Details an der Sensordatenverarbeitung -> es fliegt sich geringfügig anders
- der MK ist bei wenig Gas nicht mehr so giftig -> soll das Landen vereinfachen
- I2C-Bus läuft jetzt sicher nach einer Störung wieder an
- Sticksignale werden präziser ausgewertet
- Stick-Kanäle werden ans Kopter-Tool übertragen
- Es muss die Version V1.47 des Kopter-Tool verwendet werden
- Die Settings werden auf Default zurückgesetzt
- am Piepen kann man die Fehlerart unterscheiden
1. einzelnes Piepen beim Einschalten und Kalibrieren
2. langsames Intervall mindestens 1 Sek -> Empfangsausfall
3. schnelleres Intervall mindestens 1 Sek -> Akku
4. sehr schnelles Intervall mindestens 1 Sek -> Kommunikation zu den Reglern gestört
V0.64 H.Buss 30.09.2007
- beim Gieren wurden die Achsen nicht hart genug geregelt
V0.65a H.Buss 15.10.2007
- Integral im Mischer wieder integriert
- Feinabstimmung im ACC/Gyro Abgleich -> 1/32 & 100
- ACC/Gyro Abgleich auch bei HH
 
V0.66a H.Buss 3.11.2007
- Messwertverarbeitung aus dem Analog-Interrupt entfernt
- Analogmessung hängt jetzt am FC-Timing
- Looping-Stick-Hysterese eingebaut
- Looping-180°-Umschlag einstellbar
- Achsenkopplung: Gierbewegung verkoppelt Nick und Roll
- Lageregelung nach ACC-Sensor verbessert
- zusätzlicher I-Anteil in der Lageregelung verbessert die Neutrallage
- Gyrodriftkompensation überarbeitet
- Bug in der Gier-Stick-Berechnung behoben
- Gyro-Messung auf 1kHz beschleunigt
V0.67a H.Buss 16.11.2007
- der Hauptregler-I-Anteil wirkt jetzt nur noch auf den Winkel (ausser im HH-Mode)
- Gyro-Acc-Abgleich jetzt wieder in jedem Zyklus
- Feinabstimmung
- Beim HH-Modus gab es noch Bugs
 
V0.67e H.Buss 29.11.2007
- Parameter: Dynamic Stability und Driftfaktor eingeführt
- Die Namen der Analogwerte werden jetzt zum Koptertool übertragen
- Kompatibilität zum Koptertool erhöht
 
V0.67f H.Buss 04.12.2007
- Das Integral des Hauptreglers wird jetzt linear entladen und nicht mehr proportional
- Schub für Gier wird jetzt auf den Gaswert begrenzt, dadurch steigt der MK nicht mehr beim Gieren. Gier ist allerdings nicht mehr so agressiv
- Die ACC-Nullwerte können jetzt dauerhaft im EEPROM gespeichert werden (Stick:Vollgas und Gier rechts)
V0.68a I.Busker 28.12.2007
- SPI.c & SPI.h ins Projekt aufgenommen
SPI-Kommuikation kann in SPI.h aktiviert/deaktivert werden
 
V0.68c H.Buss 05.01.2008
- Stickauswertung verbessert -> träger und präziser
- Alle Settings angepasst
 
V0.69e H.Buss 05.05.2008
- kleinere Bugs beseitigt
- Schneller Sinkflug jetzt möglich
- Min- und Maxgas in den Settings geändert
- Lagewinkel wird jetzt in 0,1 Grad an Kompass und Navi gesendet
- Kalibrierung für MK3Mag -> Nick unten beim Kalibrieren
- Kompassroutine um den Ersatzkompass (Gyro unterstützt Kompasswert) erweitert
V0.69h H.Buss 21.05.2008
- STICK_GAIN = 4 eingeführt. Das erhöht die Auflösung der Sollwerte. Stick_P und Stick_I müssen nun um Faktor 4 erhöht werden
- SenderOkay auch an das Naviboard übertragen
- Bessere Parameter bei Senderausfall
V0.69j H.Buss 30.05.2008
- Höhere Präzision der Achsenkopplung
 
V0.69k H.Buss 31.05.2008
- Bug in SPI.C behoben
- in 0.69h war ein Bug, der zu ungewollten Loopings führen konnte
 
V0.69L H.Buss 14.06.2008
- feinere Cam-Servo-Auflösung
V0.70a H.Buss 01.07.2008
- Unterstützung der V1.3-Hardware mit automatischem Hardware-Gyro-Abgleich
 
V0.70b H.Buss 14.07.2008
- flexible Einstellungsmöglichkeit von J16 und J17 (Transistorausgänge)
- eigene Parameter für GPS-Naviboard
- eigener Parameter für ExternalControl (war vorher UserParameter1 bzw. 8)
- neue Parameter im EEPROM-Datensatz: J16Bitmask, J16Timing, ExternalControl, Navi...
- MikroKopterFlags eingeführt, damit das Navi den Status des MKs kennt
- KopterTool-Kompatibilität auf 8 erhöht
V0.70c H.Buss 30.07.2008
- Parameter der Datenfusion leicht modifiziert
- EEPROM-Parameter für Looping-Umschlag angepasst (von 100 auf 85)
- MaxStick wird auf 100 begrenzt
 
V0.70d H.Buss 02.08.2008
- Transistorausgänge: das oberste Bit der Blinkmaske (im KopterTool linkes Bit) gibt nun den Zustand des Ausgangs im Schalterbetrieb an
0.71b: H.Buss 19.10.2008
Kommunikation zum Navi erweitert:
- Beeptime jetzt 32Bit
- Datenfusion und Driftkopensation wird durch NaviBoard unterstützt
0.71c: H.Buss 20.10.2008
- LoopConfig heisst jetzt BitConfig
- 3-Fach-Schalter für Höhensteuerung möglich -> kann man mit GPS-Schalter zusammenlegen
- bei den Settings wurde Setting[0] mit abgespeichert, welches es nicht gab.
- in Zukunft werden bei neuen EEPROM-Settings die Kanäle von Setting 1 übernommen
- Variablen NaviWindCorrection, NaviSpeedCompensation, NaviOperatingRadius eingeführt
 
0.71f: H.Buss 15.11.2008
- Ausschalten der Höhenregelung per Schalter um 0,3 sek verzögert
- bei der seriellen Übertragung hat die FC jetzt als SlaveAdresse die 1
- VersionInfo.NaviKompatibel eingeführt
- wenn manuell gegiert wird, wird der GyroKompass-Wert auf den Kompasswert gesetzt
- Luftdruckwert wird an das Navi übertragen
- Der Baro-Offset wird jetzt nachgeführt, um den Messbereich zu erweitern. Geht nur bei Höhenregler mit Schalter
- Debugdaten können jetzt mit 'f' gepollt werden
0.71g: Gregor 09.12.2008
- Kommunikation überarbeitet
Infos hier: http://www.mikrokopter.de/ucwiki/en/SerialCommands
0.71h: H.Buss 15.12.2008
- Freigegebene Version
- NaviAngleLimitation als Parameter zum Navi implementiert
- Antwort auf CMD: 't' entfernt
0.72d: H.Buss 22.01.2009
- OCTO als Compilerschalter
- Unterstützung der FC 2.0 (ME)
- GYRO_D eingeführt
- Achsenkopplung jetzt auch auf Nick/Roll-Bewegung
0.72e: H.Buss 27.01.2009
- die 0.72d hatte kein Integral im Gier
- Parameter eingeführt:
EE_Parameter.NaviGpsPLimit
EE_Parameter.NaviGpsILimit
EE_Parameter.NaviGpsDLimit
EE_Parameter.NaviPH_LoginTime
EE_Parameter.AchsKopplung2
EE_Parameter.CouplingYawCorrection
 
0.72f: H.Buss 28.01.2009
- Bug im Ersatzkompass entfernt
 
0.72h: H.Buss 05.02.2009
- Algorithmen beschleunigt -> Floats durch Fixkomma ersetzt
- Achsentkopplung weiter verbessert
- Nick- und Roll im Octo-Mischer auf jeweils vier Motoren aufgeteilt
 
0.72i: H.Buss 07.02.2009
- Abtastrate von 1kHz auf 2kHz erhöht
 
0.72j: H.Buss 09.02.2009
- neue Implementierung der Servoausgänge
 
0.72k: H.Buss 10.02.2009
- Abtastrate auf 5kHz erhöht
 
0.72L: H.Buss 13.02.2009
- Signalfilterung überarbeitet
- OCTO2 implementiert
 
0.72M: H.Buss 13.02.2009
- Code Cleanup
 
0.72o: H.Buss 24.02.2009
- Abtastrate auf 2kHz
- HW-Version an Navi
- neuer Datensatz 'c' -> Lagedaten für 3D-Grafik
- Auswerteroutine für Spectrum-Satteliten implementiert
- Kanalsettings werden beim Parameterreset nicht mehr gelöscht
- die Driftkompensation wird jetzt feiner aufgelöst --> EE_Parameter.Driftkomp muss mal 8 genommen werden
- die Integrale und ACC-Werte werden jetzt im Scope in ca. 0,1° angezeigt (wie beim NaviBrd)
0.72p: H.Buss 01.03.2009
- Octo3 erstellt
- Analogwerte umbenannt
 
0.73a-d: H.Buss 05.04.2009
- MixerTabelle implementiert
- I2C-Bus auf bis zu 12 Motoren erweitert
- die Busfehler der BL-Regler werden im Menü angezeigt
- Revision der MixerTabelle eingeführt
- MixerTabelle wird bei Parameterreset neu initialisiert
- Motortest auf [12] erweitert
- Motorschalter nicht mehr 3-Stufig
 
0.74a
- Datenfusion im Flug auch, wenn ACC-Z < 512
- Wert für die Luftdruck-Messbereichserweiterung abgefangen
 
0.74d
- Die Driftkompensation ist jetzt dreistufig -> 0,5% pro sekunde zusätzlich eingeführt