Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 671 → Rev 672

/branches/salvo_gps/Basis_v0067g/tags/v0007/Flight-Ctrl_MEGA644_V0_07a.hex
0,0 → 1,2422
:100000000C946C020C9489020C9489020C94890261
:100010000C9489020C9489020C9489020C94890234
:100020000C9489020C94810C0C9489020C94890222
:100030000C949C150C9489020C9489020C948902EE
:100040000C9489020C9489020C94840B0C94890200
:100050000C94A9070C9489020C94C4040C94890292
:100060000C94870D0C9489020C94D0140C94890282
:100070000A0A0D004E65757472616C004865616412
:10008000696E67486F6C64000A0D5374657565721C
:10009000756E673A20004F4B0A0D000A0D416267EA
:1000A0006C65696368204C756674647275636B7304
:1000B000656E736F722E2E000A0D42656E75747A2E
:1000C0006520506172616D657465727361747A2028
:1000D0002564000A0D414343206E69636874206102
:1000E000626765676C696368656E21000A0D496E19
:1000F00069742E20454550524F4D3A2047656E6534
:1001000072696572652044656661756C742D506115
:1001100072616D657465722E2E2E000A0D3D3D3D97
:100120003D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3DFF
:100130003D3D3D3D3D3D3D3D3D3D3D000A0D466C57
:1001400069676874436F6E74726F6C0A0D486172F0
:1001500064776172653A25642E25640A0D536F66D3
:1001600074776172653A5625642E256425632000F4
:100170002E0052616E67653A2533692D253369007B
:100180005374656C6C756E673A202533690053654E
:1001900074706F696E742020253369005365727620
:1001A0006F202000506F7469343A20202533690095
:1001B000506F7469333A202025336900506F746999
:1001C000323A202025336900506F7469313A20207B
:1001D0002533690053746172743A20202020202551
:1001E0003569004D657373776572743A2020253543
:1001F00069005269636874756E673A202025356915
:10020000004B6F6D70617373202020202020200030
:10021000456D70662E506567656C3A2535690053EB
:1002200070616E6E756E673A202025356900486FE3
:1002300063682025346920282533692900526F6CB2
:100240006C20253469202825336929004E69636BA9
:100250002025346920282533692900414343202D76
:100260002053656E736F720047696572202534698B
:1002700020282533692900526F6C6C2025346920B1
:100280002825336929004E69636B202534692028AD
:10029000253369290047696572202534692028259E
:1002A00033692900526F6C6C20253469202825336E
:1002B0006929004E69636B2025346920282533693C
:1002C00029004779726F202D2053656E736F72007D
:1002D00050333A253469202050343A2534692000BF
:1002E00050313A253469202050323A2534692000B3
:1002F00047733A253469202047693A25346920003C
:100300004E693A2534692020526F3A25346920001D
:100310004B373A25346920204B383A253469200080
:100320004B353A25346920204B363A253469200074
:100330004B333A25346920204B343A253469200068
:100340004B313A25346920204B323A25346920005C
:100350004B6F6D706173733A202020253569005210
:100360006F6C6C3A202020202020253569004E69D2
:10037000636B3A20202020202025356900616B74B2
:100380002E204C6167650048F668656E726567658A
:100390006C756E67004B65696E6520004F66662060
:1003A00020202020203A20253569004C7566746491
:1003B0007275636B3A2025356900536F6C6C486F1A
:1003C0006568653A2025356900486F6568653A209B
:1003D000202020202535690028632920486F6C677C
:1003E000657220427573730053657474696E673A61
:1003F000202564200048573A5625642E2564205352
:10040000573A25642E25642563002B2B204D696BFC
:10041000726F4B6F70746572202B2B005B25695DCA
:100420000000001100230034004600570069007AE4
:10043000008B009C00AE00BF00D000E100F2000382
:100440000114012401350146015601660177018737
:10045000019701A701B601C601D501E501F4010329
:1004600002120221022F023E024C025A0268027559
:1004700002830290029D02AA02B702C302CF02DBEE
:1004800002E702F302FE02090314031F03290333E8
:10049000033D0347035003590362036B0373037B5C
:1004A0000383038A03920399039F03A603AC03B259
:1004B00003B703BC03C103C603CA03CE03D203D6EA
:1004C00003D903DC03DE03E103E303E403E603E70C
:1004D00003E703E803E8030011241FBECFEFD0E1D8
:1004E000DEBFCDBF14E0A0E0B1E0EAE9F3E902C06D
:1004F00005900D92A23AB107D9F719E0A2EAB4E04B
:1005000001C01D92A339B107E1F70E94C4020C9407
:10051000CC490C94000022E030E0D9010E94B84997
:10052000802D863028F082E0D901082E0E94C04933
:1005300090E00895FB01282F863008F025E0429FC7
:10054000D0011124AC59BF4F842F90E0019724F0C3
:1005500001900E94C049FACFA2E0B0E0022E0E94B2
:10056000C0490895FB01863008F085E0489FD0011E
:100570001124AC59BF4F842F90E0019724F00E94C2
:10058000B8490192FACF0895EF92FF921F93CF934B
:10059000DF9314B815B8189B02C08BE001C08AE045
:1005A000809300018DEC87B98FEF88B98BE184B916
:1005B00081E085B98EE38AB9579A87EF8BB984B702
:1005C000877F84BF80916000886180936000109273
:1005D000600080ED97E09093C5048093C40410926E
:1005E000640510926305109243081092420810921D
:1005F0006205109261051092600510925F0580916E
:1006000000018A3011F4289801C0289A0E94240D14
:100610000E94FC050E9487150E94810D0E94B6145D
:1006200078941092410787E08093420780934307B4
:1006300020910001822F6AE00E941149492F50E069
:10064000822F0E94114990E021E630E03F932F93E2
:1006500027E030E03F932F931F921F925F934F93B9
:100660009F938F938CE391E09F938F931F920E94AF
:10067000E0088BE191E09F938F931F920E94E00826
:10068000299AA1E0B0E00E94B849802D2DB73EB76D
:10069000205F3F4F0FB6F8943EBF0FBE2DBF84348E
:1006A000A9F18CEE90E09F938F931F920E94E00837
:1006B0000E94CC23C0E0D0E00F900F900F908CE60A
:1006C000E82E88E0F82E1C2FC23039F0C33019F420
:1006D0000E94A92204C0C43010F00E943A2347E4CB
:1006E000B701812F0E949A022196C630D10559F791
:1006F00083E022E030E0D901082E0E94C04984E462
:1007000021503040D901082E0E94C049C4E0D0E0F9
:10071000DE010E94B849802D853050F083ED90E0D5
:100720009F938F931F920E94E0080F900F900F905D
:100730002297DE010E94B849802D863028F082E0A1
:10074000DE01082E0E94C04947E46CE678E00E9472
:10075000B202DE010E94B849802D863028F082E086
:10076000DE01082E0E94C04990E09F938F9388EB92
:1007700090E09F938F931F920E94E00880917408ED
:100780000F900F900F900F900F9080FD03C0C8EE58
:10079000D3E020C08BE990E09F938F931F920E943B
:1007A000E00888EE93E00E946C0CEC010E941F10A0
:1007B0000F900F900F90CE010E94750C8823D9F3F3
:1007C00086E990E09F938F931F920E94E0080F901C
:1007D0000F900F900E941B21809100018A3011F42C
:1007E000289801C0289A469880ED97E09093C50418
:1007F0008093C40488EE93E090933C0780933B077A
:1008000085E58093360788E890E09F938F931F9249
:100810000E94E008809174080F900F900F9082FF63
:1008200003C08CE790E002C084E790E09F938F9331
:100830001F920E94E0080F900F900F9080E790E0C9
:100840009F938F931F920E94E0080E94681088E88F
:1008500093E190938603809385030F900F900F9000
:100860008091C104882309F462C01092C1040E94DF
:100870005F240E94D420209100012A3011F428988E
:1008800001C0289A80910301882321F08150809330
:10089000030110C01092B2041092B30410927F05AD
:1008A00010927E05109281051092800510928305AA
:1008B0001092820580915E05882329F080915E0563
:1008C000815080935E058091850390918603892BEA
:1008D00001F585E090E090938603809385030E9464
:1008E000611580910403909105038F5F9F4FF9F488
:1008F000809165058823D9F080E197E29093C50443
:100900008093C40480E890E09093050380930403EF
:100910000EC0809185039091860301979093860382
:10092000809385032A3011F4289801C0289A0E94E8
:1009300017060E94B006CE010E94750C882309F4A8
:100940008FCF20910803309109038091840890E0B3
:10095000281739079CF480910403909105038F5F59
:100960009F4F61F480E797E19093C5048093C4049E
:1009700080E093E0909305038093040384E690E085
:100980000E946C0CEC016CCF1F920F920FB60F926D
:1009900011248F939F93EF93FF93809101018823FC
:1009A000E1F48091BD049091BE0401969093BE0441
:1009B0008093BD04FC01E85FF94FE081ED3019F050
:1009C0008639910539F41092BE041092BD0481E07D
:1009D00080930101E093C60004C01092BE041092FF
:1009E000BD04FF91EF919F918F910F900FBE0F90DB
:1009F0001F901895DC0120E030E040E050E008C096
:100A0000FA01E85FF94F8081280F311D4F5F5F4F7A
:100A10004A175B07A9F73F70C90136E0969587959D
:100A20003A95E1F7835CFD01E85FF94F8083119609
:100A30002F73235CFD01E85FF94F2083A75FB94F57
:100A40008DE08C9310920101809108068093C6007E
:100A500008951F93CF93DF93EA01722F93E290934F
:100A600008066093090680930A06A3E0B0E060E000
:100A70004FC0FE01E60FF11D90816F5F715019F4B8
:100A800010E040E00FC0FE01E60FF11D40816F5FF6
:100A9000715011F410E006C0FE01E60FF11D108147
:100AA0006F5F7150892F86958695835CFD01E85FA5
:100AB000F94F808350E09A0184E0369527958A9516
:100AC000E1F7892F90E083709070F4E0880F991F10
:100AD000FA95E1F7282B235CFD01E75FF94F2083AE
:100AE000812F82958695869583704F705070440F44
:100AF000551F440F551F842B835CFD01E65FF94FA2
:100B000080831F73135CFD01E55FF94F108314961A
:100B1000772309F0AECFCD010E94FA04DF91CF9187
:100B20001F9108951F93CF93DF93EC0170E0A22FE4
:100B3000B0E0129748C0E42FF0E0E55BF84F308159
:100B40004F5FE42FF0E0E55BF84F50814F5FE42FFB
:100B5000F0E0E55BF84F10814F5FE42FF0E0E55BDC
:100B6000F84F20814F5F842F90E0A817B90774F1E8
:100B70005D53FE01E70FF11D852F82958F703D5368
:100B8000330F330F382B3083613001F1912F9D5398
:100B90007F5FFE01E70FF11D71505295507F892F45
:100BA00086958695582B508363506F3F79F07E5F12
:100BB000FE01E70FF11D9295990F990F907C2D532F
:100BC000922B90837F5F662309F0B5CFDF91CF91A1
:100BD0001F9108951F93182F8A3019F48DE00E94F9
:100BE000EA058091C00085FFFCCF1093C60080E02D
:100BF00090E01F9108950895E1ECF0E088E1808392
:100C0000A0ECB0E08C9182608C93808180688083BE
:100C10008081806480838AE28093C40088EC90E0C5
:100C20000E946C0C9093350780933407089580914F
:100C30000101882309F493C08091A204882371F0F4
:100C400080910101882351F0609107062BE046E373
:100C500057E087E40E9429051092A204809134078E
:100C6000909135070E94750C882321F48091A4048B
:100C70008823F9F0809101018823D9F0609107065B
:100C800022E441EE57E084E40E9429051092A40476
:100C90008091B5049091B60401969093B604809328
:100CA000B5048AEF90E00E946C0C90933507809316
:100CB0003407609102016F3F89F0462F50E094E0C5
:100CC000440F551F9A95E1F74C5F5E4F605D20E140
:100CD00081E40E9429058FEF809302018091A30493
:100CE000882359F180910101882339F10E94711004
:100CF0001092A3043091AC04932F9F5F9093AC04A7
:100D0000943021F08091AD04882359F026E14EE320
:100D100058E060E084E30E9429058FEF8093AC04E3
:100D20000CC044E1949FA0011124465E5C4F24E175
:100D300060E0832F8F5C0E9429058091A5048823A1
:100D400071F080910101882351F0609107062AE03B
:100D500041E457E086E50E9429051092A504089514
:100D60001F93CF93DF93CDB7DEB722970FB6F894DA
:100D7000DEBF0FBECDBF8091A704882309F4DFC07A
:100D80008FEF8093030180914D078B3609F45EC08D
:100D90008C3678F4833629F1843620F4813609F0D4
:100DA000CCC013C0873609F45EC0883609F0C5C0D0
:100DB0002BC0813709F45BC0813708F480C08437C9
:100DC000F1F1863709F0B9C04AC02091AA0443E086
:100DD00062E0CE0101960E94920589818093020112
:100DE000ACC02091AA0443E06BE086E397E00E9448
:100DF00092058091F10490913807892B8093F1043A
:100E000081E08093A40499C02091AA0443E062E0A9
:100E1000CE0101960E9492058091F1049981892B5F
:100E20008093F1048A818F3F21F481E08093AD04A7
:100E300002C01092AD0481E08093A3047EC0209193
:100E4000AA0443E064E08EEA94E006C02091AA047C
:100E500043E063E082EB94E00E9492056EC081E083
:100E60008093A5046AC081E08093A20466C02091AB
:100E7000AA0443E062E0CE0101960E9492058981B6
:100E80008F3F89F0863010F085E0898347E46CE677
:100E900078E089810E94B20260910706898127E487
:100EA0004CE658E008C0109107060E948B0227E428
:100EB0004CE658E0612F855B0E9429053EC02091D9
:100EC000AA0443E067E48CE698E00E9492058091D2
:100ED0004D0747E46CE678E08B560E949A028091B9
:100EE0004D078B56A2E0B0E0082E0E94C0496091E9
:100EF000970870E080E090E024EC39E040E050E0BA
:100F00000E94F2486093870370938803809389035B
:100F100090938A036091980870E080E090E00E94CE
:100F2000F24860938B0370938C0380938D039093AE
:100F30008E030E948B020E94BF201092A70422966B
:100F40000FB6F894DEBF0FBECDBFDF91CF911F91DA
:100F500008951F920F920FB60F9211242F933F9373
:100F60004F935F936F937F938F939F93AF93BF93B1
:100F7000CF93DF93EF93FF938091C6008093A604F5
:100F80008091A6040E94E63B4091B804463910F0D7
:100F90001092B7048091A6048D3009F05DC0809155
:100FA000B704823009F058C01092B704A42FB0E003
:100FB000FD01E75BF84F3081ED01C65BD84F28811A
:100FC0008091BB049091BC04831B9109821B910901
:100FD0009F709093BC048093BB049C01689415F8A7
:100FE000369527951694E1F7235C2093BA04982F41
:100FF0009F73935C9093B9048081281729F48881AA
:10100000981711F491E006C08091A9048F5F809336
:10101000A90490E08091A704882309F065C0992372
:1010200009F462C081E08093A7044093AA04A55B01
:10103000B84F8DE08C9380914D07823509F054C0F4
:1010400088E190E02CE00FB6F894A89580936000BA
:101050000FBE2093600048C08091B7048130D9F062
:10106000813018F08230F1F521C08091A6048332DE
:1010700039F48091A704882319F481E08093B704A0
:101080008091A60480934B0781E08093B8048091FF
:10109000A60490E022C082E08093B704E42FF0E041
:1010A0008091A604E55BF84F808309C0E42FF0E04F
:1010B0008091A604E55BF84F8083463920F44F5FAA
:1010C0004093B80402C01092B7042091A604809106
:1010D000BB049091BC04820F911D9093BC0480933B
:1010E000BB0402C01092B704FF91EF91DF91CF9142
:1010F000BF91AF919F918F917F916F915F914F9130
:101100003F912F910F900FBE0F901F901895982F21
:1011100080912308813069F48091F004E82FF0E099
:10112000E65EFC4F90838F5F8093F00421E030E017
:1011300005C0892F0E94EA05282F30E0C9010895D3
:101140001F93182F04C080E30E94870811501116C6
:10115000D4F31F9108951F93182F04C080E20E94BA
:10116000870811501116D4F31F9108950F931F9300
:10117000CF93DF938C01EB0108C0F8010F5F1F4F85
:10118000E4918E2F0E94870821972097B1F7DF9175
:10119000CF911F910F9108950F931F93CF93DF93DA
:1011A0008C01EB0106C0F80181918F010E94870834
:1011B00021972097C1F7DF91CF911F910F9108954B
:1011C0002F923F924F925F926F927F928F929F9257
:1011D000AF92BF92CF92DF92EF92FF920F931F9345
:1011E000CF93DF93CDB7DEB7E5970FB6F894DEBFA8
:1011F0000FBECDBF2B968FAD2B9780932308CE01CA
:10120000835B9F4F9B838A832D964EAC5FAC2D975B
:101210001EA61FA618AA19AA9E01225D3F4F3DAB2C
:101220002CAB820102C00F5F1F4FF801F490FF202A
:1012300019F0F5E2FF16B9F7B8016419750919F04C
:10124000C2010E94B608FF2009F445C22801089493
:10125000411C511C1982AA81BB8133241BAA2FEF88
:101260002AABF2010894411C511CB490632D70E02C
:101270006170707035E7B31621F08B2D806288376E
:10128000C9F46115710559F02D913D914D915C9115
:1012900013972EA73FA748AB59AB14960BC08D915F
:1012A0009C9111979C0140E050E02EA73FA748ABCE
:1012B00059AB129630E2B31621F48981882389F65E
:1012C0001CC043E2B41611F458E055C08AE2B816C7
:1012D00021F09DE2B91671F408C0FD011296E0817B
:1012E000EBABE7FFBECFE195EBABE0E13E2AFFEDD4
:1012F0003F22B7CF2BE2B21611F4B982B2CF3EE251
:10130000B31699F5F2010894411C511C84918A325C
:1013100021F0B82E20E030E01DC0FD011296408182
:10132000518157FF02C04FEF5FEF4AAB9ACFC9011F
:1013300053E0880F991F5A95E1F7220F331F280FAA
:10134000391F2B0D311D20533040F2010894411CF0
:10135000511CB4908B2D80538A3048F3A90137FF7C
:1013600002C04FEF5FEF4AAB85CF40E3B41629F4DC
:1013700034FC77CF50E2352A74CF8B2D81538930DE
:10138000D8F420E030E0C90103E0880F991F0A95E6
:10139000E1F7220F331F280F391F2B0D311D20536A
:1013A0003040F2010894411C511CB4908B2D8053A5
:1013B0008A3048F32BAB5ECF88E6B81619F494E078
:1013C000392A4FCFECE6BE1619F4F1E03F2A49CF97
:1013D000BB83AA8323E6B21639F41296BB83AA8391
:1013E00012978C918E8322C134E4B31639F044E60F
:1013F000B41631F059E6B516A9F502C081E0382AD5
:1014000030FE08C01496BB83AA835E914E913E9134
:101410002E910AC01296BB83AA839E918E919C0145
:10142000442737FD4095542F2EA73FA748AB59AB13
:101430008EA59FA5A8A9B9A9BB238CF42EA53FA56D
:1014400048A959A950954095309521953F4F4F4F48
:101450005F4F2EA73FA748AB59AB8DE28983BAE017
:101460002B2E80C03FE4B31621F04FE6B41631F4C2
:1014700002C051E0352AA8E02A2E73C080E7B816D2
:1014800089F41296BB83AA839E918E919C0140E0C1
:1014900050E02EA73FA748AB59AB30E4332AF8E71A
:1014A000BF2E5DC043E7B416D1F51296BB83AA8365
:1014B000DE90CE90C114D10489F488E28E838EE64A
:1014C0008F8385E788878CE689878A8789E28B877F
:1014D0001C86E6E0CE2ED12CCC0EDD1E5AA957FD7F
:1014E00014C0452F552747FD509560E070E0C601B8
:1014F0000E94CA46009711F4FAA80EC0F82EFC18F4
:101500008AA98F154CF4F82E07C0F601019000202F
:10151000E9F73197FE2EFC18198240E090C095E55E
:10152000B91621F0A5E7BA1631F402C0B1E03B2AA2
:101530007AE0272E16C0E8E5BE1621F0F8E7BF16C0
:1015400009F070C033FE0BC02EA53FA548A959A9CC
:10155000211531054105510511F030E4332A60E1D0
:10156000262E19824AA947FD02C05FED35228EA5BD
:101570009FA5A8A9B9A90097A105B10549F49AA901
:10158000992331F45EE2C52ED12CCC0EDD1E46C06F
:101590006EA47FA488A899A84EE2C42ED12CCC0EAC
:1015A000DD1EE22CFF2400E010E06EA57FA588A9D7
:1015B00099A9A80197010E9444496A3020F430E3B8
:1015C000A32EA60E08C027E5A22EA60EA8E5BA16E1
:1015D00011F4BFEDAB22F601A2926F016EA57FA5BB
:1015E00088A999A9A80197010E9444492EA73FA75D
:1015F00048AB59AB6E147F048006910618F0390190
:101600004A01D3CFF8E02F1649F433FE07C020E398
:10161000A21621F080E3D6018E936D01FCA8FC1880
:101620004AA90DC0BB2009F456C0BE82198296E0BB
:10163000C92ED12CCC0EDD1E40E0FF24F394E42E05
:10164000EF18E7FCEE248981882319F08F2D8F5F36
:1016500006C036FC02C08F2D02C08F2D8E5FA82ED3
:10166000AE0C032D10E080E3882E912C8022912275
:101670008114910421F48BA98A190E94AB088981F5
:10168000882329F061E070E0CE01019609C006FFD1
:1016900009C080E38C83BD8262E070E0CE010496D5
:1016A0000E94CC08B0E28B16910421F48BA98A1910
:1016B0000E94A0088E2D0E94A0086F2D772767FD3D
:1016C0007095C6010E94CC0804FFABCD8BA98A1986
:1016D0000E94AB08A6CDE5960FB6F894DEBF0FBE0C
:1016E000CDBFDF91CF911F910F91FF90EF90DF90D1
:1016F000CF90BF90AF909F908F907F906F905F90B2
:101700004F903F902F9008951F920F920FB60F9217
:1017100011242F933F935F936F937F938F939F93A6
:10172000AF93BF938091CD0481508093CD048F3FC0
:1017300011F58091CB049091CC04009729F001978A
:101740009093CC048093CB0489E08093CD04809166
:1017500007038F5F817080930703882319F481E06A
:101760008093C1048091BF049091C004019690932E
:10177000C0048093BF048091C4049091C504029773
:10178000B8F08091C4049091C50401979093C5046A
:101790008093C4048091C4049091C50420910403F3
:1017A0003091050382239323892B09F081C006C061
:1017B0008FEF9FEF909305038093040380910001C6
:1017C0008A3039F404C05A9A05C0479A03C05A981F
:1017D00001C04798349B0AC08091C2049091C30411
:1017E00001969093C3048093C20468C08091C204A0
:1017F0009091C304892B09F43DC08091C20490915B
:10180000C304805A9F40B0F58FEF90E09093CC04D2
:101810008093CB042091C2043091C304809177055A
:1018200090E0880F991F281B390B30934B052093AC
:101830004A0580914A0590914B0597FF0AC0809117
:101840004A0590914B0588599E4F90934B05809384
:101850004A0580914A0590914B058856914054F075
:1018600080914A0590914B058856914090934B0585
:1018700080934A0580914A0590914B0520914C0533
:1018800030914D05845E9D4F821B930B68E671E09D
:101890000E943149845B904090934F0580934E05A0
:1018A00081E08093C8041092C3041092C20406C061
:1018B000809100018A3009F088CF85CFBF91AF9128
:1018C0009F918F917F916F915F913F912F910F9099
:1018D0000FBE0F901F9018952091BF043091C00447
:1018E0002F5F3F4F820F931F08952091BF043091C7
:1018F000C004821B930B892F99278695807490E0F2
:1019000008951F920F920FB60F9211241F932F93D9
:101910003F934F935F936F937F938F939F93AF9377
:10192000BF93CF93DF93EF93FF9380910603815092
:10193000809306038F3F09F06FC083E88093B00067
:1019400080919C03C82FD0E0D093C704C093C604F5
:101950008091A10810918E0880FF1FC060910E0534
:1019600070910F05809110059091110520E830E0ED
:1019700040E050E00E946649CA01B901212F30E0E1
:1019800040E050E00E94F24820E032E040E050E0C9
:101990000E946649C20FD31F1EC060910E05709150
:1019A0000F05809110059091110520E830E040E08E
:1019B00050E00E946649CA01B901212F30E040E0A1
:1019C00050E00E94F24820E032E040E050E00E9407
:1019D0006649C21BD30BD093C704C093C6042091A1
:1019E000C6043091C70480918F0890E0281739070A
:1019F00034F08091900890E08217930724F490933C
:101A0000C7048093C6048091C6048093B30080917C
:101A100091088093060304C083E08093B0005F9830
:101A2000FF91EF91DF91CF91BF91AF919F918F91F6
:101A30007F916F915F914F913F912F911F910F90E7
:101A40000FBE0F901F9018958091BF049091C00415
:101A50000B969093CF048093CE0482E085BD83EAF9
:101A600084BD17BC88E788BD96E096BD83EC809363
:101A7000B0009093B100E0E7F0E080818260808365
:101A8000EEE6F0E08081816080838AE08093B3009D
:101A90001092B2000895AC012091BF043091C004AF
:101AA0002F5F3F4F03C08FEE80937A008091BF0479
:101AB0009091C004B901681B790BCB01840F951F6D
:101AC00080709078892F99278695882361F30895EF
:101AD000AC012091BF043091C0042F5F3F4F809133
:101AE000BF049091C004B901681B790BCB01840F2E
:101AF000951F80709078892F99278695882379F390
:101B0000089510927C008FEE80937A0008951F92C2
:101B10000F920FB60F921124EF92FF920F931F9323
:101B20002F933F934F935F936F937F938F939F93E5
:101B3000AF93BF93CF93DF93EF93FF9310927A000D
:101B40008091EC048F5F8093EC048150853009F420
:101B500086C0863090F4823009F440C0833030F47F
:101B60008823F1F0813009F044C22FC0833009F49A
:101B700041C0843009F03DC25AC0883009F4C2C067
:101B8000893038F4863009F483C0873009F031C2D7
:101B90009CC0893009F4D3C08A3009F02AC2B1C18F
:101BA00080917800909179009093EB048093EA04FF
:101BB00081E08093ED048091E4049091E504019626
:101BC0009093E5048093E40418C28091780090918A
:101BD00079009093E9048093E80492C080917800A2
:101BE000909179009093E7048093E60484E08093D9
:101BF000ED0403C2409108035091090380917800DD
:101C0000909179009A01220F331F240F351F63E052
:101C100070E00E941D49260F371F3695279536958F
:101C20002795309309032093080386E0E0CF809145
:101C30000605909107052091780030917900821B6C
:101C4000930B909325088093240880912408909109
:101C500025089093D7048093D60487E0C8CF80915D
:101C60007800909179002091040530910505821B40
:101C7000930B9093300880932F0880912F089091B8
:101C800030089093D9048093D8041092ED04B5C124
:101C9000809100012091EA043091EB048A3049F4EC
:101CA0008091780090917900820F931F9695879587
:101CB00006C08091780090917900820F931F9093D5
:101CC000D5048093D40481E092CF809100012091CB
:101CD000E8043091E9048A3049F4809178009091C9
:101CE0007900820F931F9695879506C080917800A2
:101CF00090917900820F931F9093D3048093D20424
:101D000082E075CF809100012091E6043091E704D4
:101D10008A3049F48091780090917900820F931F66
:101D20009695879506C08091780090917900820FF2
:101D3000931F9093D1048093D00485E058CF609195
:101D4000780070917900E0900805F0900905009105
:101D50000A0510910B05882777FD8095982F0E9422
:101D6000D747A80197010E94D7460E94A4477093C5
:101D7000DB046093DA04E091DA04F091DB048091F3
:101D8000240890912508C0912F08D091300897FF22
:101D900003C0909581959F4F64E070E00E943149A7
:101DA0009B01CE01D7FF03C0909581959F4F64E0C2
:101DB00070E00E943149260F371FE20FF31FF093A6
:101DC000DB04E093DA048091DA049091DB0402975B
:101DD00004F1609108057091090580910A059091C0
:101DE0000B0520E030E048E454E40E9412488823C8
:101DF0000CF03CC0609108057091090580910A05BE
:101E000090910B052AE037ED43EA5CE30E94D84647
:101E100025C08091DA049091DB048F5F9F4F34F5E9
:101E2000609108057091090580910A0590910B0554
:101E300020E030E046E154E40E9416481816B4F45D
:101E4000609108057091090580910A0590910B0534
:101E50002AE037ED43EA5CE30E94D7466093080529
:101E60007093090580930A0590930B0581E0809398
:101E7000E1048091780090917900909327088093F5
:101E8000260820914605309147054091480550911C
:101E900049058091DA049091DB04AA2797FDA0956B
:101EA000BA2F820F931FA41FB51F809346059093EE
:101EB0004705A0934805B0934905E0904605F0908A
:101EC00047050091480510914905609146057091BC
:101ED0004705809148059091490520E034E040E0B5
:101EE00050E00E946649E21AF30A040B150BE092D7
:101EF0004605F0924705009348051093490583E095
:101F000076CE8091340890913508209178003091F8
:101F10007900820F931F9093350880933408809145
:101F20002C088F5F80932C0880912C08853008F452
:101F300060C0809178009091790090930F03809316
:101F40000E0310922C088091280890912908209166
:101F5000340830913508821B930B2091660530912F
:101F60006705821B930B9093E3048093E204209116
:101F7000340830913508E0900A03F0900B0300918B
:101F80000C0310910D03C801B701660F771F881F5E
:101F9000991F6E0D7F1D801F911F442737FD4095AF
:101FA000542F620F731F841F951F24E030E040E020
:101FB00050E00E94664920930A0330930B0340933C
:101FC0000C0350930D03209128083091290880912B
:101FD0000A0390910B03A0910C03B0910D03281BF1
:101FE000390B3093670520936605109235081092DF
:101FF00034081092ED041092EC048091ED0480936B
:102000007C008091EC04882319F08FEE80937A0095
:10201000FF91EF91DF91CF91BF91AF919F918F9100
:102020007F916F915F914F913F912F911F910F91F0
:10203000FF90EF900F900FBE0F901F9018950F9389
:102040001F93CF93DF93A3E0B0E00E94B849802DA7
:10205000C82FD0E0C531D10508F02A97C7BD84E666
:1020600090E00E944B0D80910E0390910F038255DA
:102070009340C8F4C0E0D0E016C0C7BD82E390E052
:102080000E944B0D1F930F931F920E94E0088091B6
:102090000E0390910F030F900F900F908458934070
:1020A00038F0219602C000E711E0CA3FD10528F3BD
:1020B000A3E0B0E00C2E0E94C049C09331088CE22E
:1020C00091E00E944B0DDF91CF911F910F910895E8
:1020D000EAE1F3E080E2819383E0EA36F807D1F7A2
:1020E00008950F931F938091F104282F30E0C901C8
:1020F00081709070682F8823A9F08091F204882362
:1021000011F0815002C080916A038093F204EAE1E9
:10211000F3E080E2819383E0EA36F807D1F78FEFAE
:102120008093AC04A9014270507021FF10C08091CF
:10213000F2048F5F8093F204EAE1F3E080E281939E
:1021400093E0EA36F907D1F78FEF8093AC0466236A
:1021500021F0452B11F01092F20481E18093F004FC
:102160008091F20490E09F938F938CE194E09F9391
:102170008F9301E00F930E94E0081091F2040F90FA
:102180000F900F900F900F90153009F4FCC116308E
:1021900090F4123009F4CCC0133030F41123F1F074
:1021A000113009F0D9C361C0133009F416C11430DD
:1021B00009F0D2C365C1183009F416C3193038F4D8
:1021C000163009F499C2173009F0C6C3EAC21930B3
:1021D00009F447C31A3009F0BFC381C31092F00459
:1021E0008AE094E09F938F930F930E94E00884E12C
:1021F0008093F00420910001822F6AE00E9411492F
:10220000492F50E0822F0E94114990E021E630E0F2
:102210003F932F9327E030E03F932F931F921F921D
:102220005F934F939F938F9385EF93E09F938F934B
:102230000F930E94E00888E28093F0040E948B02D2
:1022400090E09F938F9388EE93E09F938F930F93EB
:102250000E94E0088CE38093F00488ED93E09F9364
:102260008F930F930E94E00898C28091740880FFBA
:1022700047C01092F00480916605909167059F9386
:102280008F9389EC93E09F938F931F930E94E008B4
:1022900084E18093F00480916805909169059F9393
:1022A0008F938AEB93E09F938F931F930E94E00894
:1022B00088E28093F00480910E0390910F039F9326
:1022C0008F938BEA93E09F938F931F930E94E00874
:1022D0008CE38093F0048091310890E09F938F937A
:1022E0008CE993E09F938F931F930E94E0088DB732
:1022F0009EB744960FB6F8949EBF0FBE8DBF31C3F4
:1023000084E18093F00485E993E09F938F931F937A
:102310000E94E00888E28093F00487E893E09F93AE
:102320008F931F930E94E0088DB79EB70696E2CF69
:102330001092F0048DE793E09F938F930F930E9488
:10234000E00884E18093F00460910E0570910F0520
:10235000809110059091110520E034E040E050E0BC
:102360000E9466495F934F933F932F938EE693E0CD
:102370009F938F930F930E94E00888E28093F0046C
:1023800060911605709117058091180590911905B7
:1023900020E034E040E050E00E9466495F934F93B4
:1023A0003F932F938FE593E09F938F930F930E941A
:1023B000E0088CE38093F00480914A0590914B05EE
:1023C0009F938F9380E593E09F938F930F930E9449
:1023D000E0088DB79EB746968DCF1092F00480919D
:1023E00042089091430820914008309141089F9302
:1023F0008F933F932F9380E493E09F938F930F935A
:102400000E94E00884E18093F00480914608909156
:10241000470820914408309145089F938F933F933C
:102420002F9380E393E09F938F930F930E94E00894
:1024300088E28093F00480914A0890914B082091A3
:102440004808309149089F938F933F932F9380E2E0
:1024500093E09F938F930F930E94E0088CE3809307
:10246000F00480914E0890914F0820914C083091D3
:102470004D089F938F933F932F9380E193E07AC011
:102480001092F004E0916D08F0E0EE0FFF1FE25CA7
:10249000F74F20813181E0916C08F0E0EE0FFF1FD3
:1024A000E25CF74F808191813F932F939F938F93AD
:1024B00080E093E09F938F930F930E94E00884E164
:1024C0008093F004E0916F08F0E0EE0FFF1FE25CF4
:1024D000F74F20813181E0916E08F0E0EE0FFF1F91
:1024E000E25CF74F808191813F932F939F938F936D
:1024F00080EF92E09F938F930F930E94E00888E211
:102500008093F004E0917108F0E0EE0FFF1FE25CB1
:10251000F74F20813181E0917008F0E0EE0FFF1F4E
:10252000E25CF74F808191813F932F939F938F932C
:1025300080EE92E09F938F930F930E94E0088CE3CC
:102540008093F004E0917308F0E0EE0FFF1FE25C6F
:10255000F74F20813181E0917208F0E0EE0FFF1F0C
:10256000E25CF74F808191813F932F939F938F93EC
:1025700080ED92E09F938F930F930E94E0088DB7B8
:102580009EB74C96B7CE1092F00482EC92E09F93E7
:102590008F930F930E94E0080F900F900F908091FF
:1025A00000018A3009F04AC084E18093F004409130
:1025B000FA045091FB048091D0049091D1042091B1
:1025C000FA043091FB04821B930B5F934F939F930C
:1025D0008F9383EB92E09F938F930F930E94E00879
:1025E00088E28093F0044091FC045091FD048091B6
:1025F000D2049091D3042091FC043091FD04821BFD
:10260000930B5F934F939F938F9384EA92E09F93F2
:102610008F930F930E94E0088CE38093F0048091E5
:10262000FE049091FF042091F3083091F4089F93E9
:102630008F933F932F9385E992E055C084E1809377
:10264000F0048091FA049091FB0462E070E00E9433
:1026500031498091D0049091D1042091FA043091B5
:10266000FB04821B930B7F936F939F938F9386E85A
:1026700092E09F938F930F930E94E00888E28093EB
:10268000F0048091FC049091FD0462E070E00E94EF
:1026900031498091D2049091D3042091FC0430916F
:1026A000FD04821B930B7F936F939F938F9387E718
:1026B00092E09F938F930F930E94E0088CE38093A6
:1026C000F0048091FE049091FF0462E070E00E94AB
:1026D00031498091F3089091F4087F936F939F9311
:1026E0008F9388E692E09F938F930F930E94E00868
:1026F0008DB79EB74596FECD1092F0048BE592E023
:102700009F938F930F930E94E00884E18093F004DD
:1027100080910405909105052091D8043091D90449
:102720009F938F933F932F938CE492E09F938F938B
:102730000F930E94E00888E28093F00480910605E0
:10274000909107052091D6043091D7049F938F93E1
:102750003F932F938DE392E09F938F930F930E946B
:10276000E0088CE38093F0046091080570910905FE
:1027700080910A0590910B050E94A4472091C708FB
:102780003091C8087F936F933F932F938EE292E02E
:102790009F938F930F930E94E0088DB79EB7489642
:1027A000A9CD84E18093F0048091080390910903FE
:1027B0009F938F938FE192E09F938F930F930E944B
:1027C000E00888E28093F00480915E0590E09F939A
:1027D0008F9380E192E09F938F930F930E94E00884
:1027E0008DB79EB70A9686CD1092F00481E092E0F4
:1027F0009F938F930F930E94E00884E18093F004ED
:1028000080914E0590914F059F938F9382EF91E0B9
:102810009F938F930F930E94E00888E28093F004C7
:1028200080914A0590914B059F938F9383EE91E0A1
:102830009F938F930F930E94E0088CE38093F004A2
:1028400080914C0590914D059F938F9384ED91E07D
:102850009F938F930F930E94E0088DB79EB7429687
:1028600049CD1092F00480915605909157059F93A1
:102870008F9388EC91E09F938F930F930E94E008D1
:1028800084E18093F00480915805909159059F93BD
:102890008F938CEB91E09F938F930F930E94E008AE
:1028A00088E28093F00480915A0590915B059F9394
:1028B0008F9380EB91E09F938F930F930E94E0089A
:1028C0008CE38093F00480915C0590915D059F936B
:1028D0008F9384EA91E09F938F930F9306CD10928C
:1028E000F0048CE991E09F938F930F930E94E0088E
:1028F00084E18093F00480919C0390E09F938F93F8
:102900008EE891E09F938F930F930E94E00888E2F6
:102910008093F0048091C6049091C7049F938F9395
:1029200080E891E09F938F930F930E94E0088CE3DF
:102930008093F0042091900830E080918F0890E01F
:102940003F932F939F938F9382E791E09F938F9371
:102950000F930E94E008CBCC115010936A031092A1
:10296000F2041092F1041F910F9108951092B90092
:102970008AE28093B800089585EA8093BC0080E0E5
:1029800090E0089584E98093BC0008951092B90006
:102990008093BB0085E88093BC0080E090E00895C0
:1029A0001F920F920FB60F9211248F939F93EF9364
:1029B000FF938091F3048F5F8093F3048150833001
:1029C000C1F1843028F4813091F0823020F50AC0C2
:1029D0008530B9F18530E8F18630D9F1873009F0DA
:1029E00062C046C08091F404880F8E5A0CC080915A
:1029F000F4048F5F8093F40481502DC0833009F07C
:102A000052C08091EB081092B9008093BB0085E81A
:102A10008093BC0048C084E98093BC008091F4049A
:102A2000843018F41092F30402C01092F40485EA82
:102A3000EFCF8091F504880F8D5AE5CF8230A9F051
:102A4000DDCF8091BB00E091F504F0E0EA5CF74F48
:102A500080838091F504813029F0813078F780916E
:102A6000B608D1CF8091BB08CECF8091DF08CBCF05
:102A70008091F5049091BB00E82FF0E0EA5CF74FFD
:102A800094838F5F8093F504843010F01092F504E6
:102A900084E98093BC008AE090E090938603809361
:102AA00085031092F3048091BC0080688093BC0081
:102AB000FF91EF919F918F910F900FBE0F901F90FC
:102AC00018954CEB50E084E9DA018C931092F304F2
:102AD0002BEB30E0F90180811092F40480E88C93B4
:102AE0001092BD001092BA001082E9EBF0E0108263
:102AF000A8EBB0E01C9210828AE28C9385EADA019E
:102B00008C931082F901108285E88C93089583ECF0
:102B100080938100EFE6F0E08081806280831092F4
:102B2000FF041092FE041092FD041092FC04109217
:102B3000FB041092FA0408951F920F920FB60F92A1
:102B400011240F931F932F933F934F935F936F9392
:102B50007F938F939F93AF93BF93CF93DF93EF9325
:102B6000FF9320918600309187008091F804909126
:102B7000F904281B390B809186009091870090936F
:102B8000F9048093F804C9018D549440C091F6046F
:102B9000D091F704835F9A4158F4249714F010926F
:102BA0006B0381E090E09093F7048093F60462C099
:102BB000CA30D1050CF05EC0C9018B5F9040845BC8
:102BC000914008F040C0A901425D5140FE01EE0F66
:102BD000FF1FE25CF74F80819181FA01E81BF90B3E
:102BE000CF01F7FF03C0909581959F4F06974CF456
:102BF00080915E05883C28F480915E05865F809315
:102C00005E05FE01EE0FFF1F8F01025C174FD8011A
:102C10002D913C91C901880F991F820F931F840F3A
:102C2000951F64E070E00E943149D8018D919C911C
:102C300011979B01281B390BEC5AF74F31832083E6
:102C400011967C936E93FE013196F093F704E09316
:102C5000F604E530F10511F45D9A06C05D98E630A2
:102C6000F10511F45C9A05C05C98379711F45B9AF2
:102C700001C05B98FF91EF91DF91CF91BF91AF9130
:102C80009F918F917F916F915F914F913F912F9184
:102C90001F910F910F900FBE0F901F9018952F92BC
:102CA0003F924F925F926F927F928F929F92AF92DC
:102CB000BF92CF92DF92EF92FF920F931F93CF9329
:102CC000DF93CDB7DEB722970FB6F894DEBF0FBE05
:102CD000CDBF8091FE049091FF042091D4043091E7
:102CE000D504821B930B9093F4088093F308809192
:102CF000D2049091D3042091FC043091FD04821BF6
:102D0000930B9093B5088093B4088091D004909170
:102D1000D1042091FA043091FB04821B930B909311
:102D2000BD088093BC082091EE083091EF086091B7
:102D3000D8047091D904882777FD8095982FB4E046
:102D4000660F771F881F991FBA95D1F7442737FD63
:102D50004095542F620F731F841F951F22E030E0AF
:102D600040E050E00E9466493093EF082093EE085F
:102D70002091FA083091FB086091D6047091D70435
:102D8000882777FD8095982FA4E0660F771F881F0E
:102D9000991FAA95D1F7442737FD4095542F620F0C
:102DA000731F841F951F22E030E040E050E00E9436
:102DB00066493093FB082093FA082091C7083091A8
:102DC000C8086091DA047091DB04882777FD80954C
:102DD000982F442737FD4095542F620F731F841F8F
:102DE000951F22E030E040E050E00E9466493093B9
:102DF000C8082093C70820911E0530911F054091F7
:102E00002005509121058091D8049091D904F4E0D7
:102E1000880F991FFA95E1F7AA2797FDA095BA2F79
:102E2000820F931FA41FB51F80931E0590931F054B
:102E3000A0932005B0932105209122053091230510
:102E400040912405509125058091D6049091D70496
:102E5000E4E0880F991FEA95E1F7AA2797FDA0956E
:102E6000BA2F820F931FA41FB51F80932205909342
:102E70002305A0932405B093250560912605709144
:102E800027058091280590912905E0902608F0906B
:102E90002708A0900805B0900905C0900A05D090B9
:102EA0000B050E94D7473B014C010027F7FC00951A
:102EB000102FC801B7010E94D747A60195010E94B3
:102EC000D7469B01AC01C401B3010E94D8460E94C1
:102ED000A447609326057093270580932805909357
:102EE00029052091F3083091F408442737FD4095D7
:102EF000542F8091030990910409A0910509B09184
:102F00000609820F931FA41FB51F80930309909396
:102F10000409A0930509B09306092091F3083091A4
:102F2000F408442737FD4095542F8091CB089091A9
:102F3000CC08A091CD08B091CE08820F931FA41F9A
:102F4000B51F8093CB089093CC08A093CD08B09385
:102F5000CE0820913E0530913F05409140055091AB
:102F600041058091F3089091F408AA2797FDA09558
:102F7000BA2F820F931FA41FB51F80933E05909315
:102F80003F05A0934005B093410520914205309143
:102F9000430540914405509145058091F308909177
:102FA000F408AA2797FDA095BA2F820F931FA41F9C
:102FB000B51F8093420590934305A0934405B093B9
:102FC000450520916E052A83222309F069C080916E
:102FD0006F05882309F064C08091740886FF60C083
:102FE00060912E0570912F058091300590913105EB
:102FF000E090F308F090F408A0907C05BB24CC246A
:10300000DD240027F7FC0095102F20E030E140E0A0
:1030100050E00E946649C801B7010E94F248A6012B
:1030200095010E94F24820E038E040E050E00E9424
:1030300066492093C7053093C8054093C90550934E
:10304000CA056091360570913705809138059091D9
:103050003905E090F308F090F40820E030E140E01A
:1030600050E00E946649CA01B901A60195010E947B
:10307000F2480027F7FC0095102FA80197010E9445
:10308000F24820E038E040E050E00E94664920939A
:10309000C3053093C4054093C5055093C60510C0C1
:1030A0001092C3051092C4051092C5051092C60572
:1030B0001092C7051092C8051092C9051092CA0552
:1030C0008091B4089091B5082090C7053090C8054C
:1030D0004090C9055090CA05820D931D9093B50884
:1030E0008093B4080091B4081091B508A090C3056E
:1030F000B090C405C090C505D090C60580917D05EF
:10310000682E772488249924C401B301A60195016F
:103110000E94F24820E032E040E050E00E94664920
:10312000020F131F1093B5080093B40820913A05BD
:1031300030913B0540913C0550913D058091B4088C
:103140009091B508AA2797FDA095BA2F820F931FDB
:10315000A41FB51F80933A0590933B05A0933C05AF
:10316000B0933D0540913605509137056091380583
:10317000709139058091B4089091B50820916A0545
:1031800030916B05821B930BAA2797FDA095BA2F50
:10319000840F951FA61FB71F8093360590933705A0
:1031A000A0933805B0933905809136059091370585
:1031B000A0913805B0913905E0908B03F0908C0315
:1031C00000918D0310918E03E816F9060A071B077C
:1031D00004F580E197E2A0E0B0E08E199F09A00B12
:1031E000B10B8093360590933705A0933805B093C3
:1031F00039058091360590913705A0913805B09139
:10320000390580933A0590933B05A0933C05B09314
:103210003D05209136053091370540913805509194
:10322000390588279927DC018E199F09A00BB10B5E
:10323000281739074A075B0704F580EF98EDAFEFD1
:10324000BFEFE80EF91E0A1F1B1FE0923605F09231
:103250003705009338051093390580913605909114
:103260003705A0913805B091390580933A059093C0
:103270003B05A0933C05B0933D058091D20490910D
:10328000D3040F9734F488E19CEF9093B5088093B2
:10329000B4088091D2049091D304079734F480E36A
:1032A00098EF9093B5088093B408909100019983AA
:1032B0009A30A9F48091D2049091D304835F934013
:1032C00034F088EE93E09093B5088093B408809131
:1032D000D2049091D3048A5F9340DCF014C08091B3
:1032E000D2049091D304855E974034F088EE93E049
:1032F0009093B5088093B4088091D2049091D30440
:10330000835F974034F080ED97E09093B508809309
:10331000B4088091BC089091BD088A199B099093CC
:10332000BD088093BC080091BC081091BD08C40181
:10333000B301A20191010E94F24820E032E040E096
:1033400050E00E946649021B130B1093BD080093C6
:10335000BC082091320530913305409134055091DD
:1033600035058091BC089091BD08AA2797FDA095CE
:10337000BA2F820F931FA41FB51F8093320590931D
:103380003305A0933405B093350540912E05509137
:103390002F0560913005709131058091BC089091A6
:1033A000BD0820916C0530916D05821B930BAA27F7
:1033B00097FDA095BA2F840F951FA61FB71F809366
:1033C0002E0590932F05A0933005B0933105809181
:1033D0002E0590912F05A0913005B0913105E09018
:1033E0008703F09088030091890310918A03E816FF
:1033F000F9060A071B0704F580E197E2A0E0B0E0B8
:103400008E199F09A00BB10B80932E0590932F0569
:10341000A0933005B093310580912E0590912F0532
:10342000A0913005B091310580933205909333051A
:10343000A0933405B093350520912E0530912F05CA
:10344000409130055091310588279927DC018E196C
:103450009F09A00BB10B281739074A075B0704F532
:1034600080EF98EDAFEFBFEFE80EF91E0A1F1B1FAC
:10347000E0922E05F0922F05009330051093310550
:1034800080912E0590912F05A0913005B0913105C6
:103490008093320590933305A0933405B09335059E
:1034A0008091D0049091D1040F9734F488E19CEF7F
:1034B0009093BD088093BC088091D0049091D10472
:1034C000079734F480E398EF9093BD088093BC088D
:1034D00099819A30A9F48091D0049091D104835FAE
:1034E000934034F088EE93E09093BD088093BC083D
:1034F0008091D0049091D1048A5F9340DCF014C095
:103500008091D0049091D104855E974034F088EE8C
:1035100093E09093BD088093BC088091D004909173
:10352000D104835F974034F080ED97E09093BD081D
:103530008093BC088FEE80937A0080913E05909135
:103540003F05A0914005B091410580932A059093D5
:103550002B05A0932C05B0932D0580912E059091FD
:103560002F05A0913005B091310580930E05909301
:103570000F05A0931005B093110580913605909129
:103580003705A0913805B0913905809316059093C1
:103590001705A0931805B0931905809132059091F5
:1035A0003305A0913405B0913505809312059093B1
:1035B0001305A0931405B093150580913A059091D9
:1035C0003B05A0913C05B0913D0580931A05909371
:1035D0001B05A0931C05B0931D058091740887FFFF
:1035E00063C02A81222309F05FC080916F05882380
:1035F00009F05AC08091BC089091BD08893C9105A2
:103600005CF02091BC083091BD088091BC0890917D
:10361000BD082052334011C08091BC089091BD0874
:1036200088539F4FA4F42091BC083091BD0880912D
:10363000BC089091BD08205E3C4F880F991F880FF1
:10364000991F280F391F3093BD082093BC08809123
:10365000B4089091B508893C91055CF02091B408BC
:103660003091B5088091B4089091B508205233404C
:1036700011C08091B4089091B50888539F4FA4F46D
:103680002091B4083091B5088091B4089091B508A4
:10369000205E3C4F880F991F880F991F280F391FF4
:1036A0003093B5082093B408209156053091570502
:1036B00080917008E82FF0E0EE0FFF1FE25CF74FFB
:1036C0008081918182599F4F281739071CF42F5F01
:1036D0003F4F0CC08081918182599F4F8217930781
:1036E0004CF42115310531F021503040309357050D
:1036F0002093560520915805309159058091710805
:10370000E82FF0E0EE0FFF1FE25CF74F8081918120
:1037100082599F4F281739071CF42F5F3F4F0CC069
:103720008081918182599F4F821793074CF4211514
:10373000310531F021503040309359052093580520
:1037400020915A0530915B0580917208E82FF0E0D6
:10375000EE0FFF1FE25CF74F8081918182599F4FEE
:10376000281739071CF42F5F3F4F0CC080819181CF
:1037700082599F4F821793074CF42115310531F080
:103780002150304030935B0520935A0520915C0511
:1037900030915D0580917308E82FF0E0EE0FFF1F78
:1037A000E25CF74F8081918182599F4F281739073A
:1037B0001CF42F5F3F4F0CC08081918182599F4F35
:1037C000821793074CF42115310531F02150304018
:1037D00030935D0520935C058091560590915705C7
:1037E00097FF05C010925705109256050AC08F3FEB
:1037F000910539F034F08FEF90E090935705809366
:103800005605809158059091590597FF05C0109273
:103810005905109258050AC08F3F910539F034F0D0
:103820008FEF90E0909359058093580580915A0549
:1038300090915B0597FF05C010925B0510925A05A9
:103840000AC08F3F910539F034F08FEF90E09093EC
:103850005B0580935A0580915C0590915D0597FF0B
:1038600005C010925D0510925C050AC08F3F91055E
:1038700039F034F08FEF90E090935D0580935C0514
:1038800022960FB6F894DEBF0FBECDBFDF91CF9169
:103890001F910F91FF90EF90DF90CF90BF90AF906E
:1038A0009F908F907F906F905F904F903F902F9060
:1038B000089510927A008091D0049091D104909351
:1038C000BD088093BC088091D2049091D30490935A
:1038D000B5088093B4088091D4049091D504909356
:1038E000F4088093F3088091D8049091D904AA2712
:1038F00097FDA095BA2F74E0880F991FAA1FBB1FD0
:103900007A95D1F79093EF088093EE088091D604D2
:103910009091D704AA2797FDA095BA2F64E0880F4D
:10392000991FAA1FBB1F6A95D1F79093FB0880933C
:10393000FA088091DA049091DB049093C808809390
:10394000C7088FEE80937A00209156053091570575
:1039500080917008E82FF0E0EE0FFF1FE25CF74F58
:103960008081918182599F4F281739071CF42F5F5E
:103970003F4F0CC08081918182599F4F82179307DE
:103980004CF42115310531F021503040309357056A
:103990002093560520915805309159058091710862
:1039A000E82FF0E0EE0FFF1FE25CF74F808191817E
:1039B00082599F4F281739071CF42F5F3F4F0CC0C7
:1039C0008081918182599F4F821793074CF4211572
:1039D000310531F02150304030935905209358057E
:1039E00020915A0530915B0580917208E82FF0E034
:1039F000EE0FFF1FE25CF74F8081918182599F4F4C
:103A0000281739071CF42F5F3F4F0CC0808191812C
:103A100082599F4F821793074CF42115310531F0DD
:103A20002150304030935B0520935A0520915C056E
:103A300030915D0580917308E82FF0E0EE0FFF1FD5
:103A4000E25CF74F8081918182599F4F2817390797
:103A50001CF42F5F3F4F0CC08081918182599F4F92
:103A6000821793074CF42115310531F02150304075
:103A700030935D0520935C05809156059091570524
:103A800097FF05C010925705109256050AC08F3F48
:103A9000910539F034F08FEF90E0909357058093C3
:103AA0005605809158059091590597FF05C01092D1
:103AB0005905109258050AC08F3F910539F034F02E
:103AC0008FEF90E0909359058093580580915A05A7
:103AD00090915B0597FF05C010925B0510925A0507
:103AE0000AC08F3F910539F034F08FEF90E090934A
:103AF0005B0580935A0580915C0590915D0597FF69
:103B000005C010925D0510925C050AC08F3F9105BB
:103B100039F034F08FEF90E090935D0580935C0571
:103B20006091970870E080E090E024EC39E040E09C
:103B300050E00E94F248609387037093880380935B
:103B4000890390938A0360938B0370938C03809313
:103B50008D0390938E030895809177088B3F98F0A2
:103B60008B3F19F4809156050EC08C3F19F480915B
:103B7000580509C08D3F19F480915A0504C08E3F45
:103B800021F480915C0580939403809194038823B1
:103B900019F41092940304C08F3F11F4809394039E
:103BA000809176088B3F98F08B3F19F480915605F1
:103BB0000EC08C3F19F48091580509C08D3F19F44F
:103BC00080915A0504C08E3F21F480915C0580935A
:103BD000930380919303882319F41092930305C0F3
:103BE000843618F084E680939303809178088B3FA5
:103BF00098F08B3F19F4809156050EC08C3F19F454
:103C00008091580509C08D3F19F480915A0504C070
:103C10008E3F21F480915C058093950380919503FC
:103C2000882319F41092950305C0843618F084E6B1
:103C30008093950380917A088B3F98F08B3F19F41D
:103C4000809156050EC08C3F19F48091580509C02B
:103C50008D3F19F480915A0504C08E3F21F4809164
:103C60005C058093960380919603882319F4109243
:103C7000960304C08F3F11F48093960380918108CE
:103C80008B3F98F08B3F19F4809156050EC08C3F06
:103C900019F48091580509C08D3F19F480915A0597
:103CA00004C08E3F21F480915C058093970380913E
:103CB0009703882319F41092970304C08F3F11F4DF
:103CC00080939703809182088B3F98F08B3F19F483
:103CD000809156050EC08C3F19F48091580509C09B
:103CE0008D3F19F480915A0504C08E3F21F48091D4
:103CF0005C0580939803809198038B3010F48AE0E0
:103D000002C08F3F11F480939803809183088B3F0A
:103D100098F08B3F19F4809156050EC08C3F19F432
:103D20008091580509C08D3F19F480915A0504C04F
:103D30008E3F21F480915C058093990380919903D3
:103D4000882319F41092990304C08F3F11F48093D3
:103D50009903809188088B3F98F08B3F19F48091EC
:103D600056050EC08C3F19F48091580509C08D3F4F
:103D700019F480915A0504C08E3F21F480915C05AE
:103D800080939B0380919B03882319F410929B03DB
:103D900004C08F3F11F480939B03809189088B3F6F
:103DA00098F08B3F19F4809156050EC08C3F19F4A2
:103DB0008091580509C08D3F19F480915A0504C0BF
:103DC0008E3F21F480915C05809374058091740589
:103DD000882319F41092740504C08F3F11F4809366
:103DE000740580918A088B3F98F08B3F19F480917D
:103DF00056050EC08C3F19F48091580509C08D3FBF
:103E000019F480915A0504C08E3F21F480915C051D
:103E10008093750580917505882319F410927505B6
:103E200004C08F3F11F48093750580918B088B3F00
:103E300098F08B3F19F4809156050EC08C3F19F411
:103E40008091580509C08D3F19F480915A0504C02E
:103E50008E3F21F480915C058093760580917605F4
:103E6000882319F41092760504C08F3F11F48093D3
:103E7000760580918C088B3F98F08B3F19F48091E8
:103E800056050EC08C3F19F48091580509C08D3F2E
:103E900019F480915A0504C08E3F21F480915C058D
:103EA0008093770580917705882319F41092770520
:103EB00004C08F3F11F48093770580919C088B3F5D
:103EC00098F08B3F19F4809156050EC08C3F19F481
:103ED0008091580509C08D3F19F480915A0504C09E
:103EE0008E3F21F480915C05809378058091780560
:103EF000882319F41092780504C08F3F11F4809341
:103F0000780580919D088B3F98F08B3F19F4809144
:103F100056050EC08C3F19F48091580509C08D3F9D
:103F200019F480915A0504C08E3F21F480915C05FC
:103F30008093790580917905882319F41092790589
:103F400004C08F3F11F48093790580919E088B3FC8
:103F500098F08B3F19F4809156050EC08C3F19F4F0
:103F60008091580509C08D3F19F480915A0504C00D
:103F70008E3F21F480915C0580937A0580917A05CB
:103F8000882319F410927A0504C08F3F11F48093AE
:103F90007A0580919F088B3F98F08B3F19F48091B0
:103FA00056050EC08C3F19F48091580509C08D3F0D
:103FB00019F480915A0504C08E3F21F480915C056C
:103FC00080937B0580917B05882319F410927B05F3
:103FD00004C08F3F11F480937B0580918D088B3F47
:103FE00098F08B3F19F4809156050EC08C3F19F460
:103FF0008091580509C08D3F19F480915A0504C07D
:104000008E3F21F480915C0580939C0380919C03FA
:10401000882319F410929C0304C08F3F11F48093FD
:104020009C03809192088B3F98F08B3F19F480910C
:1040300056050EC08C3F19F48091580509C08D3F7C
:1040400019F480915A0504C08E3F21F480915C05DB
:1040500080939D0380919D03882319F410929D0302
:1040600004C08F3F11F480939D03809195088B3F8E
:1040700098F08B3F19F4809156050EC08C3F19F4CF
:104080008091580509C08D3F19F480915A0504C0EC
:104090008E3F21F480915C0580937C0580917C05A6
:1040A000882319F410927C0504C08F3F11F480938B
:1040B0007C05809196088B3F98F08B3F19F4809196
:1040C00056050EC08C3F19F48091580509C08D3FEC
:1040D00019F480915A0504C08E3F21F480915C054B
:1040E00080937D0580917D05882319F410927D05CC
:1040F00004C08F3F11F480937D0580919B088B3F16
:1041000098F08B3F19F4809156050EC08C3F19F43E
:104110008091580509C08D3F19F480915A0504C05B
:104120008E3F21F480915C0580939E0380919E03D5
:10413000882319F410929E0304C08F3F11F48093DA
:104140009E0360919B0370E080E090E00E942A450E
:1041500027E137EB41ED58E30E948F4860938F03CE
:1041600070939003809391039093920380917F08C2
:104170008093F20880917E088093BE0808951F9373
:10418000182F0EC080916505882361F484E690E0C5
:104190009093C5048093C4048AEF90E00E94680D58
:1041A000115080F71F91089580916505882301F5CE
:1041B0001092BB081092B6081092DF081092EB081C
:1041C0008091AE04882311F08093B6088091AF04EB
:1041D000882311F08093BB088091B004882311F0EC
:1041E0008093EB088091B104882311F08093DF085D
:1041F0008091B60890E09093FC078093FB07809134
:10420000BB0890E09093FE078093FD078091EB0838
:1042100090E0909300088093FF078091DF0890E082
:1042200090930208809301081092F3041092F40412
:104230000E94BC140895469A109205051092040538
:10424000109207051092060580E090E0A0E0B0E033
:104250008093080590930905A0930A05B0930B0578
:104260001092FB041092FA041092FD041092FC04C8
:104270001092FF041092FE0410927C0510927D05AE
:104280000E94591C84E690E00E944B0D0E94591C2C
:104290008091740880FF10C080910E0390910F03ED
:1042A000875B934038F480910E0390910F038E5EEC
:1042B000924010F40E941F108091D0049091D1047C
:1042C0009093FB048093FA048091D2049091D304DC
:1042D0009093FD048093FC048091D4049091D504C4
:1042E0009093FF048093FE048091FC049091FD0460
:1042F00090930105809300058091FA049091FB044E
:10430000909303058093020544E050E0DA010E9497
:10431000B849802D853038F18091FA089091FB08DA
:1043200097FF03C0909581959F4F60E170E00E94D8
:10433000314970930705609306058091EE089091CE
:10434000EF0897FF03C0909581959F4F60E170E063
:104350000E94314970930505609304056091260819
:104360007091270839C0DA010E94B849802D4F5F4B
:104370005F4FDA010E94B849202D90E0982F8827DE
:10438000820F911D90930505809304054F5F5F4F49
:10439000DA010E94B849802D4F5F5F4FDA010E9419
:1043A000B849202D90E0982F8827820F911D909377
:1043B0000705809306054F5F5F4FDA010E94B849F9
:1043C000602D4F5F5F4FDA010E94B849202D70E0E9
:1043D000762F6627620F711D882777FD8095982FAD
:1043E0000E94D747609308057093090580930A05DA
:1043F00090930B0510922E0510922F051092300508
:104400001092310510923205109233051092340546
:104410001092350510923605109237051092380526
:104420001092390510923A0510923B0510923C0506
:1044300010923D0510923E0510923F0510924005E6
:10444000109241051092BD081092BC081092B50858
:104450001092B4081092F4081092F3081092CB084E
:104460001092CC081092CD081092CE0880910A03C9
:1044700090910B03A0910C03B0910D039093290828
:10448000809328081092E3041092E20410924605EB
:1044900010924705109248051092490580914A05EF
:1044A00090914B0590934D0580934C050E94973A4F
:1044B00082E390E09093C5048093C40460919708D0
:1044C00070E080E090E024EC39E040E050E00E94B1
:1044D000F2486093870370938803809389039093D5
:1044E0008A036091980870E080E090E00E94F248B2
:1044F00060938B0370938C0380938D0390938E0352
:104500001092A00310929F0320914A0530914B0511
:1045100084E195E0AC01249FC001259F900D349F5C
:10452000900D1124AA2797FDA095BA2F8093030917
:1045300090930409A0930509B09306098EE190E0D9
:104540009093CE058093CD059093CC058093CB05B9
:10455000089581E080936C0852E050936D0843E029
:1045600040936E0874E070936F0865E06093700884
:1045700086E08093710887E08093720898E09093BA
:10458000730880EC809374088EE1809375088BEF3C
:10459000809377083AE03093780822E320937608F6
:1045A00020937A085093790840937B0810927C08F6
:1045B00090937D088FE080937E088AEF80937F0838
:1045C0008AE18093800880E88093810888EC80935A
:1045D00082088FEA8093830882E6809384088FE5BF
:1045E000809385088CE38093860810928708309327
:1045F000880880E58093890810928A0810928B08B9
:1046000010928C0810929C0810929D0810929E089F
:1046100010929F0894E690938D0888E280938E080C
:104620001092A10820938F0886E9809390086093E8
:104630009108209392088AE5809393082093940828
:104640001092A0089093950830939608909397083D
:10465000909398089093990870939A0820939B08D8
:10466000A6EAB8E0ECE6F3E08CE001900D92815010
:10467000E1F7089581E080936C0892E090936D08D3
:1046800083E080936E0844E040936F0855E05093B8
:10469000700886E08093710887E08093720888E054
:1046A0008093730880E4809374088EE1809375088A
:1046B0008BEF809377083AE03093780822E32093D9
:1046C000760820937A089093790840937B0810929B
:1046D0007C0830937D088FE080937E088AEF80937A
:1046E0007F088AE18093800880E8809381088FEAC0
:1046F000809382088093830882E6809384088FE504
:10470000809385088CE3809386081092870880E266
:104710008093880880E58093890810928A08109217
:104720008B0810928C0810929C0810929D08109291
:104730009E0810929F0894E690938D0888E28093DB
:104740008E081092A10820938F0886E98093900824
:1047500050939108209392088AE5809393082093C0
:1047600094081092A008909395083093960890931F
:104770009708909398089093990840939A088BE42F
:1047800080939B08A6EAB8E0E6E7F3E08CE00190AE
:104790000D928150E1F7089581E080936C0882E0EA
:1047A00080936D0893E090936E0844E040936F0807
:1047B00075E07093700886E08093710887E08093BD
:1047C000720888E08093730880E4809374088EE117
:1047D000809375088BEF809377086AE06093780880
:1047E00022E32093760820937A08409379089093E7
:1047F0007B0840937C088EE080937D088FE0809357
:104800007E088AEF80937F088AE18093800880E8A1
:104810008093810888E78093820856E95093830843
:1048200082E6809384088FE5809385088CE38093EB
:1048300086081092870880E2809388083AE53093D2
:10484000890888E180938A0882E880938B08109217
:104850008C0810929C0810929D0810929E0810924D
:104860009F0894E690938D0888E280938E081092BA
:10487000A10820938F08509390087093910820937B
:10488000920830939308209394081092A008909374
:1048900095086093960890939708909398082093B2
:1048A000990840939A0890939B08A6EAB8E0EEE72F
:1048B000F3E08CE001900D928150E1F708952F9282
:1048C0003F924F925F926F927F928F929F92AF92A0
:1048D000BF92CF92DF92EF92FF920F931F93CF93ED
:1048E000DF93CDB7DEB766970FB6F894DEBF0FBE85
:1048F000CDBF0E944F1680916E0990916F0900976D
:1049000029F0019790936F0980936E090E945B3B99
:10491000892B39F4809100018A3011F4289A01C062
:104920002898299AE0916E08F0E0EE0FFF1FE25CF4
:10493000F74F008111818091F20890E04497085868
:104940001F4F801791070CF48C01209108033091C0
:1049500009038091840890E0049740918405509168
:10496000850582179307C4F123E0493E520724F1DD
:1049700010928505109284058090CB059090CC050F
:104980002091CD053091CE05C901880F991F820F66
:10499000931F880F991F880F991F6FE070E00E9486
:1049A00031496815790574F408948108910890924A
:1049B000CC058092CB0506C04F5F5F4F50938505B5
:1049C000409384058091CB059091CC058017910789
:1049D0000CF03FC08C013DC033E0493E5307C4F0AA
:1049E0008091CD059091CE059C0143E0220F331FAD
:1049F0004A95E1F7280F391FC801820F931F6AE01B
:104A000070E00E9431497093CE056093CD0519C0C6
:104A1000CA01019690938505809384056AE070E051
:104A20000E943149892B89F48091CB059091CC0566
:104A30008017910734F401969093CC058093CB05B1
:104A400004C01093CC050093CB050091CB051091C9
:104A5000CC051A83098317FF02C01A82198280913C
:104A60005E05843608F05DC080910301882399F4C7
:104A700080910403909105038F5F9F4F61F488E953
:104A80009AE39093C5048093C40480E09CE09093E3
:104A90000503809304038091A5059091A6050097D6
:104AA00031F001979093A6058093A50504C010925C
:104AB000650510925005809100018A3011F4289A02
:104AC00001C028988091A0059091A105815D974033
:104AD00028F180918508682F70E07A83698381E0EE
:104AE00080935005E0916C08F0E0EE0FFF1FE25C50
:104AF000F74F11821082E0916D08F0E0EE0FFF1F7A
:104B0000E25CF74F11821082E0916F08F0E0EE0F47
:104B1000FF1FE25CF74F118210826EC21092650592
:104B20006BC280915E058D3808F466C21092500504
:104B30008091860822E3829FC00111249093A605EC
:104B40008093A50589819A8189976CF08091A00551
:104B50009091A105AFEF8F3F9A0729F001969093AE
:104B6000A1058093A0058091A0059091A105883CA6
:104B7000910520F0E981FA81B89704F51092BF05FC
:104B80001092C0051092C1051092C2051092BB058B
:104B90001092BC051092BD051092BE0510923E0504
:104BA00010923F0510924005109241051092420567
:104BB00010924305109244051092450529813A81CF
:104BC000293C31050CF472C180916505882309F0F8
:104BD00013C280916F08E82FF0E0EE0FFF1FE25C38
:104BE000F74F808191818C3491050CF4D5C0809170
:104BF000A4058F5F8093A405893C08F4FDC1299822
:104C00000E941B21109265051092A4051092A10527
:104C10001092A00580916C08282F30E0F901EE0F6A
:104C2000FF1FE25CF74F80819181873491059CF4EE
:104C3000E0916D08F0E0EE0FFF1FE25CF74F01908E
:104C4000F081E02DF7FF03C0F095E195FF4FE734C9
:104C5000F1050CF46CC080916D08682F70E0DB01E9
:104C6000AA0FBB1FA25CB74F8D919C9111978734FF
:104C700091053CF0F901EE0FFF1FE25CF74F8081D8
:104C800091818D919C918734910564F0F901EE0F2B
:104C9000FF1FE25CF74F808191818734910514F00A
:104CA00042E001C041E0FB01EE0FFF1FE25CF74F65
:104CB00080819181863491055CF4F901EE0FFF1F2C
:104CC000E25CF74F80819181873491050CF043E0DD
:104CD000FB01EE0FFF1FE25CF74F808191818A5B41
:104CE0009F4F5CF4F901EE0FFF1FE25CF74F8081EC
:104CF0009181873491050CF044E0660F771F625C68
:104D0000774FDB018D919C918A5B9F4F5CF4220F62
:104D1000331F225C374FF9018081918186349105E0
:104D20000CF445E0A2E0B0E0042E0E94C0490E94CD
:104D30008B0247E46CE678E00E94B2020E948B028C
:104D40000E94BF208091740880FF10C080910E03E4
:104D500090910F03875B934038F480910E039091FC
:104D60000F038E5E924010F40E941F100E94AE3B13
:104D700080915809882309F43FC188EE93E00E948E
:104D8000680D88EE93E09093C5048093C40484EF8B
:104D900091E00E94680D30C180819181855B9F4FB9
:104DA0000CF081C08091A4058F5F8093A405893C9D
:104DB00008F422C129988FEF04E010E0D801082EF2
:104DC0000E94C049109265051092A4051092A10599
:104DD0001092A0050E941B21809104059091050569
:104DE00060E071E00E943149D801062E0E94C0495E
:104DF000809104059091050560E071E00E943149C1
:104E00000F5F1F4FD801082E0E94C04980910605F0
:104E10009091070560E071E00E9431490F5F1F4FDC
:104E2000D801062E0E94C049809106059091070581
:104E300060E071E00E9431490F5F1F4FD801082EDA
:104E40000E94C049609108057091090580910A058A
:104E500090910B050E94A447DC01CB0160E071E05A
:104E60000E9431490F5F1F4FD801062E0E94C04992
:104E7000609108057091090580910A0590910B05D4
:104E80000E94A447DC01CB0160E071E00E9431493F
:104E90000F5F1F4FD801082E0E94C0490E948B024D
:104EA0000E94BF20A9C01092A405A6C0E981FA8182
:104EB000B3970CF0A1C0E0916F08F0E0EE0FFF1F78
:104EC000E25CF74F80819181855B9F4F0CF072C04F
:104ED0008091A3058F5F8093A305893C08F46CC083
:104EE000469A88EC8093A30581E090E09093A10519
:104EF0008093A00581E0809365051092B70510921C
:104F0000B8051092B9051092BA0510923E0510929C
:104F10003F051092400510924105109242051092F3
:104F20004305109244051092450510922E051092EB
:104F30002F0510923005109231051092360510920F
:104F40003705109238051092390580910E05909121
:104F50000F05A0911005B091110580933205909333
:104F60003305A0933405B0933505809116059091D3
:104F70001705A0911805B091190580933A059093F3
:104F80003B05A0933C05B0933D051092BF051092E0
:104F9000C0051092C1051092C2051092BB05109277
:104FA000BC051092BD051092BE0580E090E00E9405
:104FB000033D02C01092A305E0916F08F0E0EE0FF0
:104FC000FF1FE25CF74F808191818C34910594F052
:104FD0008091A2058F5F8093A205893C68F0469876
:104FE0001092650588EC8093A2051092A10510929D
:104FF000A00502C01092A20580916B03815080939E
:105000006B0380916B038F3F29F0809150058823BB
:1050100009F429C30E94AC1D80916C08882E992444
:10502000D401AA0FBB1FCD01825C974FFC01808188
:1050300091819A8B898B80917B08E82EFF24AC5A52
:10504000B74F0D90BC91A02DBC8BAB8B80917C0891
:10505000282E332480916D08C82EDD24C601880FC8
:10506000991FDC01A25CB74F0D90BC91A02DB88BAD
:10507000AF878C5A974FDC01AD90BC90E0916F08E0
:10508000AE2FB0E0AA0FBB1FA25CB74F0D90BC9132
:10509000A02DBE87AD876091980370E080E090E01E
:1050A0000E942A4520E030E040E251E40E94D846C8
:1050B00020E030E040E85BE30E948F482B013C0198
:1050C0006093F5087093F6088093F7089093F808BA
:1050D0006091990370E080E090E00E942A4520E012
:1050E00030EE4BE257E40E943C476093DB0870933C
:1050F000DC088093DD089093DE082091B30422231E
:1051000031F08AE090E09093C5048093C404E22FCC
:1051100022FF09C080917405482F50E0440F551FAD
:10512000440F551F10C023FD03C040E050E00BC0EA
:105130008091740590E0880F991F880F991F44276C
:105140005527481B590B20917E0530917F05C901D9
:1051500013E0880F991F1A95E1F7821B930B840FB8
:10516000951F68E070E00E9431498B0170937F05C4
:1051700060937E05E4FF09C080917405482F50E0DC
:10518000440F551F440F551F10C0E5FD03C040E0FC
:1051900050E00BC08091740590E0880F991F880F34
:1051A000991F44275527481B590B809180059091E2
:1051B00081059C01F3E0220F331FFA95E1F7281BCC
:1051C000390BCA01820F931F68E070E00E943149D9
:1051D0007E8B6D8B70938105609380058091B20406
:1051E000282F83FF03C082E390E004C082FF07C042
:1051F0008EEC9FEF909383058093820504C01092FC
:1052000083051092820521FF09C080919F03909130
:10521000A00301969093A00380939F0324FF09C0ED
:1052200080919F039091A00301979093A003809396
:105230009F032B893C89229DF001239DF00D329D17
:10524000F00D112449895A894E9DC0014F9D900D42
:105250005E9D900D1124E80FF91FC80168E070E011
:105260000E943149E60FF71FFC8BEB8BF093600532
:10527000E0935F05A29C8001A39C100DB29C100DD1
:1052800011246F8578896E9DC0016F9D900D7E9D64
:10529000900D1124080F191F8D899E8968E070E018
:1052A0000E943149060F171F109362050093610594
:1052B0008091820590918305AD85BE858A1B9B0BED
:1052C00090936405809363058091740882FF0CC0FD
:1052D00080E090E0A0E0B0E08093DB089093DC08F1
:1052E000A093DD08B093DE0820E030E040E050E01D
:1052F000C301B2010E941248882364F480E090E068
:10530000A0E0B0E08093F5089093F608A093F7082A
:10531000B093F80820E030E040E050E06091DB0816
:105320007091DC088091DD089091DE080E9412489F
:10533000882364F480E090E0A0E0B0E08093DB0894
:105340009093DC08A093DD08B093DE088091A0085C
:10535000682F70E0E4E06E2E712C6622772282FDC9
:10536000C4C083FDC2C080910E0590910F05A0912D
:105370001005B091110581569A4EA040B040E4F05E
:10538000C70173E0880F991F7A95E1F72B893C8953
:10539000281B390B3093600520935F0580910E0523
:1053A00090910F05A0911005B09111058158984377
:1053B000A140B040ACF128C080910E0590910F053E
:1053C000A0911005B0911105805A9541AF4FBF4F84
:1053D0003CF5970153E0220F331F5A95E1F74B89B3
:1053E0005C89240F351F3093600520935F05809101
:1053F0000E0590910F05A0911005B09111058158EF
:105400009843A140B04064F0C70144E0880F991F61
:105410004A95E1F7281B390B3093600520935F050F
:105420008091160590911705A0911805B091190566
:1054300081569A4EA040B0403CF1C701B3E0880FBE
:10544000991FBA95E1F7F801E81BF90BF093620593
:10545000E09361058091160590911705A0911805BC
:10546000B091190581589843A140B0400CF43DC05B
:10547000A4E0EE0CFF1CAA95E1F7EE19FF09F093EA
:105480006205E093610531C0809116059091170582
:10549000A0911805B0911905805A9541AF4FBF4FA3
:1054A00024F5970173E0220F331F7A95E1F7200F5F
:1054B000311F30936205209361058091160590910C
:1054C0001705A0911805B091190581589843A1407E
:1054D000B0405CF054E0EE0CFF1C5A95E1F72E1939
:1054E0003F093093620520936105F601EE0FFF1F1F
:1054F000E25CF74F2081318180919308482F50E082
:105500004217530734F4672821F081E08093700537
:1055100011C0F601EE0FFF1FE25CF74F20813181D1
:1055200080919408DA01A81BB1092A173B0714F4EB
:1055300010927005F601EE0FFF1FE25CF74F8081BD
:105540009181AA27BB27A41BB50B8A179B0734F4AC
:1055500063FF04C081E08093710517C080917105DD
:10556000882399F0CC0CDD1CEEE3F8E0CE0EDF1EB4
:10557000F601208131818091940890E0841B950B85
:105580008217930714F410927105F401EE0FFF1FB8
:10559000E25CF74F808191814817590734F460FF2E
:1055A00004C081E08093730515C080917305882342
:1055B00089F0F401EE0FFF1FE25CF74F208131818B
:1055C00080919408FA01E81BF1092E173F0714F4A3
:1055D00010927305F401EE0FFF1FE25CF74F80811C
:1055E00091818A179B0734F461FF04C081E08093A6
:1055F000720517C080917205882399F0880C991C58
:105600002EE338E0820E931ED4012D913C918091BF
:10561000940890E0841B950B8217930714F4109262
:10562000720580917005882321F48091710588238B
:1056300021F081E080936F0502C010926F05809188
:105640007305882321F480917205882351F081E04D
:1056500080936E0510926F0510927005109271057F
:1056600002C010926E0580916F05882311F40C948E
:10567000743A84E690E09093C5048093C4048091CA
:10568000920890E0E981FA818E179F0714F49A83BB
:10569000898380915005882341F11092640510920E
:1056A00063051092600510925F05109262051092DA
:1056B00061058DEC9CECACECBDE38093F508909318
:1056C000F608A093F708B093F8088AE097EDA3EAEC
:1056D000BBE38093DB089093DC08A093DD08B093D4
:1056E000DE0810926F0510926E052091D10830915E
:1056F000D2084091D3085091D40880910E05909122
:105700000F05A0911005B0911105820F931FA41FE2
:10571000B51F8093D1089093D208A093D308B0937B
:10572000D4082091D5083091D6084091D7085091DF
:10573000D8088091160590911705A0911805B09191
:105740001905820F931FA41FB51F8093D50890934E
:10575000D608A093D708B093D8082091C3083091F9
:10576000C4084091C5085091C608809112059091D7
:105770001305A0911405B0911505820F931FA41F66
:10578000B51F8093C3089093C408A093C508B09335
:10579000C6082091B7083091B8084091B9085091D7
:1057A000BA0880911A0590911B05A0911C05B09133
:1057B0001D05820F931FA41FB51F8093B7089093F8
:1057C000B808A093B908B093BA0850906E05552058
:1057D00029F480916F05882309F45FC010921E059B
:1057E00010921F051092200510922105109222059B
:1057F0001092230510922405109225051092D108CD
:105800001092D2081092D3081092D4081092D508A2
:105810001092D6081092D7081092D8081092C30898
:105820001092C4081092C5081092C6081092B708CA
:105830001092B8081092B9081092BA0880912E05FB
:1058400090912F05A0913005B091310580933205DC
:1058500090933305A0933405B093350580913605B8
:1058600090913705A0913805B091390580933A059C
:1058700090933B05A0933C05B0933D051092E50441
:105880001092E40410926D0510926C0510926B0555
:1058900010926A05552009F0A7C080916F058823F2
:1058A00009F0A2C060910E0570910F05809110055E
:1058B00090911105A0908008BB24CC24DD24E090B9
:1058C000EE08F090EF08A60195010E9466490027B6
:1058D000F7FC0095102F2E193F09400B510BCA0100
:1058E000B90120E130E040E050E00E946649390112
:1058F0004A016091160570911705809118059091E5
:105900001905E090FA08F090FB08A60195010E94A5
:1059100066490027F7FC0095102F2E193F09400B10
:10592000510BCA01B90120E130E040E050E00E9493
:105930006649F1E26F1671048104910434F0F0E2DB
:105940006F2E712C812C912C11C060EE66166FEFBA
:1059500076066FEF86066FEF960644F4E0EE6E2E45
:10596000EFEF7E2EEFEF8E2EEFEF9E2E21323105E0
:10597000410551052CF020E230E040E050E00CC041
:10598000203E7FEF37077FEF47077FEF570724F46D
:1059900020EE3FEF4FEF5FEF80912E0590912F05A6
:1059A000A0913005B091310586199709A809B90968
:1059B00080932E0590932F05A0933005B093310569
:1059C0008091360590913705A0913805B091390541
:1059D000821B930BA40BB50B809336059093370570
:1059E000A0933805B09339058091E4049091E504C3
:1059F0008F3F910509F008F4A9C4552009F02AC485
:105A000080916F05882309F025C46091D1087091B9
:105A1000D2088091D3089091D40820E031E040E092
:105A200050E00E9466492093D1083093D2084093F9
:105A3000D3085093D4086091D5087091D60880910E
:105A4000D7089091D80820E031E040E050E00E9473
:105A500066492093D5083093D6084093D7085093D1
:105A6000D808E0908008FF2400E010E020911E0597
:105A700030911F054091200550912105C801B701C3
:105A80000E94F24820E031E040E050E00E94664988
:105A900020931E0530931F05409320055093210548
:105AA0002091220530912305409124055091250530
:105AB000C801B7010E94F24820E031E040E050E028
:105AC0000E946649209322053093230540932405C4
:105AD0005093250560912605709127058091280532
:105AE0009091290520E031E040E050E00E946649B5
:105AF00020932605309327054093280550932905C8
:105B00006091D1087091D2088091D3089091D40807
:105B100020911E0530911F054091200550912105CF
:105B2000E0909908FF2400E010E0621B730B840BE7
:105B3000950BA80197010E94664920939805309320
:105B4000990540939A0550939B05CA01B90120E03D
:105B500031E040E050E00E946649690130936D05F4
:105B600020936C056091D5087091D6088091D70874
:105B70009091D80820912205309123054091240569
:105B800050912505621B730B840B950BA80197019F
:105B90000E946649CA01B90120E031E040E050E0CE
:105BA0000E946649290130936B0520936A05609134
:105BB000C3087091C4088091C5089091C60820E080
:105BC00031E040E050E00E9466492093C3083093E2
:105BD000C4084093C5085093C6086091B7087091F7
:105BE000B8088091B9089091BA0820E031E040E00F
:105BF00050E00E9466492093B7083093B80840935C
:105C0000B9085093BA0860901205709013058090FF
:105C100014059090150580910E0590910F05A091A7
:105C20001005B0911105681A790A8A0A9B0A6092D8
:105C3000B3057092B4058092B5059092B605E090D8
:105C40001A05F0901B0500911C0510911D0580910F
:105C5000160590911705A0911805B0911905E81A3D
:105C6000F90A0A0B1B0BE092AF05F092B005009306
:105C7000B1051093B2056092AB057092AC058092AD
:105C8000AD059092AE05E092A705F092A8050093AD
:105C9000A9051093AA058091320590913305A09132
:105CA0003405B091350586199709A809B90980937B
:105CB000320590933305A0933405B0933505809158
:105CC0003A0590913B05A0913C05B0913D058E1998
:105CD0009F09A00BB10B80933A0590933B05A093CD
:105CE0003C05B0933D058091030990910409A09172
:105CF0000509B09106098032E4E29E07E7E0AE07AD
:105D0000E0E0BE0764F080529442A740B040809328
:105D1000030990930409A0930509B09306098091A3
:105D2000030990910409A0910509B0910609B7FFF4
:105D30000CC0805E9B4DA84FBF4F8093030990938A
:105D40000409A0930509B0930609809100018A30E7
:105D500011F4289801C0289A81E090E0909393056F
:105D6000809392058091D1089091D208A091D30898
:105D7000B091D40820918A0530918B0540918C0513
:105D800050918D05281B390B4A0B5B0B57FF07C041
:105D900050954095309521953F4F4F4F5F4F205282
:105DA0003E44404050400CF0B9C021E0621620E172
:105DB000720620E0820620E092060CF44EC080912C
:105DC0009105882309F445C0D401C3017CE0B59551
:105DD000A795979587957A95D1F701969093930516
:105DE00080939205D401C30163E0B595A79597957B
:105DF00087956A95D1F78093980590939905A0931C
:105E00009A05B0939B0589589341A040B04064F037
:105E100088E893E1A0E0B0E080939805909399051D
:105E2000A0939A05B0939B05609198057091990590
:105E300080919A0590919B0520E031E040E050E090
:105E40000E946649C20ED31ED0926D05C0926C05A9
:105E500062C081E0809391055EC01092910540E0A0
:105E6000641640EF74064FEF84064FEF94060CF073
:105E700052C080919005882309F449C0882799274A
:105E8000DC0186199709A809B9095CE0B595A795C1
:105E9000979587955A95D1F701969093930580939E
:105EA0009205C401B30128E030E040E050E00E94D8
:105EB0006649209398053093990540939A0550932D
:105EC0009B0528573C4E4F4F5F4F64F488E79CEE8C
:105ED000AFEFBFEF8093980590939905A0939A0533
:105EE000B0939B05609198057091990580919A05F2
:105EF00090919B0520E031E040E050E00E9466492F
:105F0000C20ED31ED0926D05C0926C050BC081E00D
:105F10008093900507C01092900504C010929305DD
:105F200010929205C090EE08D090EF08D7FE04C002
:105F3000D094C194D108D394D092C008C092BF0825
:105F4000A090FA08B090FB08B7FE04C0B094A194EA
:105F5000B108B394B092E608A092E50874E6C716BB
:105F6000D1040CF041C084E6A816B104ECF5809190
:105F70009A08282F30E08091920590919305281778
:105F8000390724F4309393052093920591E0691624
:105F900094E0790690E0890690E0990674F080918B
:105FA000FA049091FB042091920530919305820FA1
:105FB000931F9093FB048093FA04A0E06A16ACEF61
:105FC0007A06AFEF8A06AFEF9A0674F48091FA046E
:105FD0009091FB042091920530919305821B930BC5
:105FE0009093FB048093FA0481E090E090939305F2
:105FF0008093920510929405109295051092960543
:10600000109297058091D5089091D608A091D70855
:10601000B091D80820918605309187054091880578
:1060200050918905281B390B4A0B5B0B57FF07C0A2
:1060300050954095309521953F4F4F4F5F4F2052DF
:106040003E44404050400CF0B9C0E1E0EE16E0E1C3
:10605000FE06E0E00E07E0E01E070CF44EC0809163
:106060008F05882309F445C0D801C7014CE0B595D8
:10607000A795979587954A95D1F7019690939305A3
:1060800080939205D801C70133E0B595A795979500
:1060900087953A95D1F78093940590939505A093B1
:1060A0009605B093970589589341A040B04064F09D
:1060B00088E893E1A0E0B0E0809394059093950583
:1060C000A0939605B09397056091940570919505FE
:1060D000809196059091970520E031E040E050E0F6
:1060E0000E946649420E531E50926B0540926A050B
:1060F00062C081E080938F055EC010928F0520E022
:10610000E21620EFF2062FEF02072FEF12070CF036
:1061100052C080918E05882309F449C088279927A9
:10612000DC018E199F09A00BB10B2CE0B595A7954A
:10613000979587952A95D1F701969093930580932B
:106140009205C801B70128E030E040E050E00E942D
:106150006649209394053093950540939605509396
:10616000970528573C4E4F4F5F4F64F488E79CEEED
:10617000AFEFBFEF8093940590939505A09396059C
:10618000B09397056091940570919505809196055F
:106190009091970520E031E040E050E00E94664990
:1061A000420E531E50926B0540926A050BC081E06F
:1061B00080938E0507C010928E0504C0109293053F
:1061C0001092920578ECC716D1040CF04BC088EC05
:1061D000A816B1040CF046C080919A08282F30E030
:1061E00080919205909193052817390724F43093F4
:1061F00093052093920591E0E91694E0F90690E06A
:10620000090790E0190774F08091FC049091FD0457
:106210002091920530919305820F931F9093FD0476
:106220008093FC04A0E0EA16ACEFFA06AFEF0A0791
:10623000AFEF1A07BCF48091FC049091FD0420910B
:10624000920530919305821B930B9093FD048093EC
:10625000FC0408C010926B0510926A0510926D053F
:1062600010926C0520E030E040E050E06091DB08E7
:106270007091DC088091DD089091DE080E94124840
:10628000882341F410926B0510926A0510926D05F7
:1062900010926C058091D1089091D208A091D308FA
:1062A000B091D40880938A0590938B05A0938C05B8
:1062B000B0938D058091D5089091D608A091D7080C
:1062C000B091D8088093860590938705A0938805A0
:1062D000B093890510921E0510921F05109220059B
:1062E0001092210510922205109223051092240588
:1062F0001092250510922605109227051092280568
:10630000109229051092D1081092D2081092D30849
:106310001092D4081092D5081092D6081092D7087F
:106320001092D8081092C3081092C4081092C508A1
:106330001092C6081092B7081092B8081092B908C7
:106340001092BA081092E5041092E4048091C804F7
:10635000882309F46EC11092C8042091EE08309190
:10636000EF0837FF03C0309521953F4F3093C008A9
:106370002093BF088091FA089091FB0897FF03C013
:10638000909581959F4F9093E6088093E508243679
:1063900031050CF03CC1843691050CF038C12091D8
:1063A0004A0530914B058091C9049091CA04281B7D
:1063B000390B37FF03C0309521953F4F263031050B
:1063C0000CF02FC1809163059091640543968797E7
:1063D00008F091C080915405909155058F3F91052B
:1063E0002CF40196909355058093540580915405A3
:1063F0009091550503970CF492C06091CB08709171
:10640000CC088091CD089091CE0824E135E040E0A1
:1064100050E00E946649F9013093C0082093BF08FC
:1064200060914A0570914B0580916A0890916B08C4
:10643000681B790B7093E6086093E508BFEF6C3436
:106440007B0734F468597E4F7093E6086093E50843
:106450008091E5089091E608853B910534F08856D7
:1064600091409093E6088093E5088091E50890912B
:10647000E608E81BF90BF093E608E093E508399786
:1064800034F088E090E09093E6088093E5088091EE
:10649000E5089091E608885F9F4F34F488EF9FEFFE
:1064A0009093E6088093E508C90137FF03C09095F3
:1064B00081959F4F02979CF11092CB081092CC08C7
:1064C0001092CD081092CE0880914A0590914B050C
:1064D00090936B0880936A088091FE049091FF046A
:1064E0002091E5083091E608821B930B9093FF04FE
:1064F0008093FE0414C080914A0590914B059093BF
:106500006B0880936A0810925505109254051092FA
:10651000CB081092CC081092CD081092CE0881E0E2
:1065200080935205609103097091040980910509D7
:106530009091060924E135E040E050E00E94664970
:1065400020930309309304094093050950930609E9
:1065500060914A0570914B05621B730B7093C008E4
:106560006093BF08CB010197833B910588F0643BA2
:10657000710534F4CB018C549F4F843B910528F472
:10658000215030404040504007C06C547F4F64F46D
:106590002F5F3F4F4F4F5F4F209303093093040904
:1065A00040930509509306098091030990910409CD
:1065B000A0910509B0910609B7FF0CC088599E4FFC
:1065C000AF4FBF4F8093030990930409A09305092F
:1065D000B09306096091030970910409809105093F
:1065E0009091060928E631E040E050E00E946649BB
:1065F00024E135E040E050E00E94F2486093030956
:106600007093040980930509909306090AC01092BB
:1066100052051092CB081092CC081092CD0810921F
:10662000CE0880914A0590914B059093CA048093BF
:10663000C9048091740885FF3EC0E0916C08F0E0C9
:10664000EE0FFF1FE25CF74F0190F081E02DF7FFA6
:1066500003C0F095E195FF4F74976CF5E0916D08DC
:10666000F0E0EE0FFF1FE25CF74F0190F081E02DAC
:10667000F7FF03C0F095E195FF4F7497E4F4809124
:106680006E0990916F09892BB1F0809194039091DC
:106690005305893C20F0933021F084E006C094300B
:1066A00019F41092530503C083E080935305809141
:1066B000530590E008C080915305882331F0109273
:1066C000530580E090E00E94033DA0905909B090EE
:1066D0005A09A114B10429F080919D058C3009F468
:1066E0004298C0906305D09064058601D7FE04C02F
:1066F000002711270C191D09053111053CF0809167
:10670000740884FD03C081E080939C05E0907D08BF
:10671000B601882777FD8095982F2E2D30E040E038
:1067200050E00E94F2489801442737FD4095542FCD
:106730000E94F24820E032E040E050E00E946649CA
:1067400089019A01FF24EC9CC001ED9C900DFC9CFA
:10675000900D112464E070E00E943149600F711FB8
:106760001B01442437FC4094542C2092B7053092EE
:10677000B8054092B9055092BA0580913E059091B6
:106780003F05A0914005B091410582199309A409E4
:10679000B50980933E0590933F05A0934005B093C3
:1067A000410580913E0590913F05A0914005B09133
:1067B00041058155934CA040B04064F080E593ECD6
:1067C000A0E0B0E080933E0590933F05A093400584
:1067D000B093410580913E0590913F05A091400501
:1067E000B0914105805B9C43AF4FBF4F64F480EB99
:1067F0009CE3AFEFBFEF80933E0590933F05A093DE
:106800004005B093410580914A0590914B05892B35
:1068100009F460C08091740883FF5CC08091CB0450
:106820009091CC04892B09F455C02091E508309152
:10683000E6088091BF089091C0088217930724F45E
:106840003093C0082093BF0820915205222371F095
:1068500080919C05882351F080914A0590914B05C9
:1068600090934D0580934C0510929C058091970361
:10687000482F50E05093C0084093BF08882351F13F
:10688000222341F100913E0510913F0520914005E2
:106890003091410580914E0590914F05BC01469F76
:1068A000C001479F900D569F900D112460E270E04B
:1068B0000E943149882777FD8095982F600F711FBE
:1068C000821F931F60933E0570933F0580934005A0
:1068D0009093410580919D05815080939D058F3F48
:1068E00009F02AC188E180939D058091C4049091AC
:1068F000C504209104033091050382239323892B3F
:1069000029F488B194E0892788B907C0809165058A
:10691000882311F0429A01C0429860910E0570914F
:106920000F058091100590911105E0908008FF24DB
:1069300000E010E0A80197010E9466493093E40747
:106940002093E30760911605709117058091180553
:1069500090911905A80197010E9466493093E607B6
:106960002093E5078091EE089091EF089093E80757
:106970008093E7078091FA089091FB089093EA07CB
:106980008093E9078091F3089091F4089093EC07C5
:106990008093EB0780916605909167059093EE07D1
:1069A0008093ED07609146057091470580914805F9
:1069B0009091490520E032E040E050E00E946649B5
:1069C0003093F0072093EF0780914A0590914B0593
:1069D0009093F4078093F307609103097091040981
:1069E000809105099091060924E135E040E050E0EE
:1069F0000E9466493093F6072093F5078091B5040D
:106A00009091B60490930408809303088091080342
:106A10009091090390930608809305088091BC0823
:106A20009091BD0890930808809307088091B4085E
:106A30009091B50890930A08809309088091F30813
:106A40009091F40890930C0880930B0880915F0557
:106A50009091600590930E0880930D0880916105D8
:106A6000909162059093100880930F08D0921208BD
:106A7000C09211088091740590E09093F80780937C
:106A8000F7078091760590E09093FA078093F907D5
:106A90008091CF059091D0059093140880931308AE
:106AA0008091D1059091D205909316088093150896
:106AB000809177099091780990931808809317082E
:106AC0008091790990917A0990931A088093190816
:106AD00080917B0990917C0990931C0880931B08FE
:106AE00080918009909181099C0163E0220F331FFE
:106AF0006A95E1F7880F991F820F931F8A0D9B1DDE
:106B00002091530542E3249F90011124820F931F8B
:106B100090931E0880931D088091E3089091E408EB
:106B20009093200880931F088091E7089091E808CF
:106B3000909322088093210880916E058823A9F004
:106B40006091BC087091BD08882777FD8095982FCB
:106B50000E94D7472091F5083091F6084091F70838
:106B60005091F8080E948F4832C060910E057091D4
:106B70000F058091100590911105E090BC08F090F0
:106B8000BD080E94D7472091DB083091DC08409176
:106B9000DD085091DE080E948F485B016C010027E0
:106BA000F7FC0095102FC801B7010E94D74720912C
:106BB000F5083091F6084091F7085091F8080E94C6
:106BC0008F489B01AC01C601B5010E94D8460E94C6
:106BD000A4477093BD086093BC0880916F0588231B
:106BE000A9F06091B4087091B508882777FD809569
:106BF000982F0E94D7472091F5083091F6084091D0
:106C0000F7085091F8080E948F4832C0609116052D
:106C1000709117058091180590911905E090B408BE
:106C2000F090B5080E94D7472091DB083091DC082E
:106C30004091DD085091DE080E948F485B016C0195
:106C40000027F7FC0095102FC801B7010E94D74715
:106C50002091F5083091F6084091F7085091F80816
:106C60000E948F489B01AC01C601B5010E94D84625
:106C70000E94A4477093B5086093B4086091F3082C
:106C80007091F408E0902A05F0902B0500912C05F6
:106C900010912D058091DB089091DC08A091DD0812
:106CA000B091DE088B839C83AD83BE83882777FDFC
:106CB0008095982F0E94D7472091F5083091F608CB
:106CC0004091F7085091F8080E948F485B016C01D1
:106CD000C801B7010E94D7472B813C814D815E815D
:106CE0000E948F4820E030E040E05FE30E948F4840
:106CF0009B01AC01C601B5010E94D8460E94A44781
:106D00007093F4086093F3088091BC089091BD08DB
:106D10008150984034F080E098E09093BD088093D3
:106D2000BC088091BC089091BD088050984F34F405
:106D300080E098EF9093BD088093BC088091B408E0
:106D40009091B5088150984034F080E098E090939D
:106D5000B5088093B4088091B4089091B50880502C
:106D6000984F34F480E098EF9093B5088093B4087E
:106D70008091F3089091F4088150984034F080E0BD
:106D800098E09093F4088093F3088091F308909131
:106D9000F4088050984F34F480E098EF9093F40812
:106DA0008093F3088091740880FFD8C040919403C9
:106DB00081FF0EC0423310F5809166059091670502
:106DC000449790936905809368051092510519C006
:106DD00020919F033091A003240F311D80917908E9
:106DE00090E0AC01249FC001259F900D349F900D31
:106DF00011244497909369058093680581E08093FE
:106E0000510580915005882321F010926905109258
:106E1000680520916605309167054091680550919D
:106E20006905421753070CF099C0809151058823DA
:106E300009F494C08091950390E0241B350BBC01AC
:106E4000629FC001639F900D729F900D112460E1BD
:106E500070E00E9431496B01A090E204B090E3041D
:106E600060914605709147058091480590914905CC
:106E7000E0909603FF2400E010E020E032E040E0E4
:106E800050E00E946649C801B7010E94F24820E222
:106E900030E040E050E00E9466497FEF2E3C37072B
:106EA00014F42EEC3FEF80919E0590919F058C018C
:106EB00044E0000F111F4A95E1F7081B190B809160
:106EC000930390E0DC01AA9DC001AB9D900DBA9D9B
:106ED000900D112468E070E00E943149061B170BE9
:106EE0002333310514F022E330E0021B130B8981B8
:106EF0009A818C199D09800F911F60E170E00E94BA
:106F0000314970939F0560939E058091750890E0CC
:106F10006817790784F4E981FA81E817F9072CF0FA
:106F200090939F0580939E0506C029813A813093F6
:106F30009F0520939E0580919E0590919F05498114
:106F40005A814817590724F450939F0540939E0592
:106F500060919E0570919F057A83698389819A81EA
:106F60009093F2078093F1072091F3083091F40891
:106F70008091F208682E7724A981BA8154971CF475
:106F800018861F822DC0B9016219730929813A81BF
:106F900035952795621773070CF49B0189819A81B7
:106FA00062E070E00E943149709561957F4FC901A0
:106FB000261737070CF4CB019301E981FA812E1BC8
:106FC0003F0B281739070CF4C90129813A8126198A
:106FD000370998878F838217930714F438872F8394
:106FE0002091BC083091BD0880905F0590906005AD
:106FF0008091CF059091D005881A990A28193909EE
:107000003093D0082093CF0820E030E040E050E0FB
:107010006B817C818D819E810E9412488823F1F1D1
:10702000E0900E05F0900F050091100510911105EC
:107030006091BF057091C0058091C1059091C20516
:107040000E94D7475B016C01C801B7010E94D74776
:107050002B813C814D815E810E948F487B018C0198
:10706000B401882777FD8095982F0E94D7479B0110
:10707000AC01C801B7010E94D7469B01AC01C60113
:10708000B5010E94D8460E94A4476093BF05709343
:10709000C0058093C1059093C2051CC02091CF0804
:1070A0003091D008442737FD4095542F8091BF057B
:1070B0009091C005A091C105B091C205820F931FA8
:1070C000A41FB51F8093BF059093C005A093C10571
:1070D000B093C2058091BF059091C005A091C105F4
:1070E000B091C205181619061A061B0624F4029759
:1070F000A109B10903C00296A11DB11D8093BF056E
:107100009093C005A093C105B093C2058091BF05BF
:107110009091C005A091C105B091C20581589E43D0
:10712000A040B04064F080E89EE3A0E0B0E080932F
:10713000BF059093C005A093C105B093C20580918F
:10714000BF059091C005A091C105B091C2058058BE
:10715000914CAF4FBF4F64F480E891ECAFEFBFEFBD
:107160008093BF059093C005A093C105B093C2055D
:107170006091CF087091D00880918F039091900317
:10718000A0919103B091920389879A87AB87BC87BE
:10719000882777FD8095982F0E94D7477B018C0127
:1071A0006091BF057091C0058091C1059091C205A5
:1071B0000E94D7479B01AC0169857A858B859C85A8
:1071C0000E948F489B01AC01C801B7010E94D846BC
:1071D0000E94A4477B018C016B018F81988597FFEA
:1071E00003C0909581959F4F62E070E00E94314905
:1071F000A981BA816A0F7B1F882777FD8095982F18
:1072000020919E0330E040E050E00E94F24820E4EC
:1072100030E040E050E00E9466491901C216D306F2
:107220000CF49701442455244218530824153505BD
:107230000CF492014F815885E981FA814E0F5F1F4E
:10724000CA01820F931F97FF03C060E070E005C082
:10725000BC01681679060CF4B3018091BE08882E33
:107260009924CB01681579050CF4C4018093B60804
:10727000421B530B9A0157FF03C020E030E004C0CB
:10728000641675060CF49301281539050CF4940165
:107290002093BB082091B4083091B5084091610556
:1072A000509162058091D1059091D205481B590BF0
:1072B0005C8B4B8B241B350B3093B3082093B208A7
:1072C00020E030E040E050E06B817C818D819E8148
:1072D0000E941248882309F440C0E0901605F090FF
:1072E000170500911805109119056091BB05709163
:1072F000BC058091BD059091BE050E94D7475B01FA
:107300006C01C801B7010E94D7472B813C814D8198
:107310005E810E948F487B018C01AB89BC89BD01D5
:10732000882777FD8095982F0E94D7479B01AC0155
:10733000C801B7010E94D7469B01AC01C601B50147
:107340000E94D8460E94A4476093BB057093BC0579
:107350008093BD059093BE051CC02091B20830916A
:10736000B308442737FD4095542F8091BB05909179
:10737000BC05A091BD05B091BE05820F931FA41F4F
:10738000B51F8093BB059093BC05A093BD05B0933A
:10739000BE058091BB059091BC05A091BD05B09143
:1073A000BE05181619061A061B0624F40297A10931
:1073B000B10903C00296A11DB11D8093BB05909336
:1073C000BC05A093BD05B093BE058091BB0590910F
:1073D000BC05A091BD05B091BE0581589E43A0405B
:1073E000B04064F080E89EE3A0E0B0E08093BB058D
:1073F0009093BC05A093BD05B093BE058091BB05DD
:107400009091BC05A091BD05B091BE058058914CEE
:10741000AF4FBF4F64F480E891ECAFEFBFEF8093C4
:10742000BB059093BC05A093BD05B093BE056091CC
:10743000B2087091B308882777FD8095982F0E9435
:10744000D7477B018C016091BB057091BC05809191
:10745000BD059091BE050E94D7479B01AC0169858F
:107460007A858B859C850E948F489B01AC01C80161
:10747000B7010E94D8460E94A44791016215730586
:107480000CF49B01241535050CF4920169817A8175
:107490004F815885641B750B620F731F77FF03C004
:1074A00060E070E004C0661677060CF4B30168155E
:1074B00079050CF4B4016093EB0869817A81621B51
:1074C000730B9B018F819885281B390B37FF03C0F5
:1074D00020E030E004C0621673060CF49301281516
:1074E000390554F4940108C080916E05882311F089
:1074F0000C943F2B0C94492B2093DF0866960FB613
:10750000F894DEBF0FBECDBFDF91CF911F910F91D9
:10751000FF90EF90DF90CF90BF90AF909F908F90B3
:107520007F906F905F904F903F902F9008951092B2
:10753000D4051092D30510925A091092590910924D
:107540008109109280091092450910922B0910921E
:1075500092091092580910926D0910927D091092AB
:10756000D0051092CF051092D2051092D10510923D
:107570007F0910927E0910926F0910926E0908958A
:1075800080914509882319F481E090E00895809165
:107590009209882309F48CC080912B09882309F46F
:1075A00087C08091860990E08370907002970CF4F8
:1075B00074C08091870980FF70C010929209609119
:1075C0003709709138098091390990913A092AE078
:1075D00030E040E050E00E94664920935B09309320
:1075E0005C0940935D0950935E0960913B0970917D
:1075F0003C0980913D0990913E092AE030E040E04D
:1076000050E00E94664920935F09309360094093DF
:1076100061095093620960913F097091400980911E
:107620004109909142092AE030E040E050E00E9498
:107630006649209363093093640940936509509328
:1076400066091092450980911B0990911C09A0912F
:107650001D09B0911E098093670990936809A09352
:107660006909B0936A0960911F097091200980919E
:1076700021099091220920EA36E841E050E00E9479
:10768000664930936C0920936B0910922B0981E0B5
:1076900080936D0980E090E0089510926D0910923A
:1076A0002B09109292091092450982E090E008950A
:1076B00081E090E008950E94C03A181619060CF473
:1076C0004CC080916E0990916F0923E0883E92072B
:1076D00030F4885A9D4F90936F0980936E09809182
:1076E00058098823B1F180915B0990915C09209140
:1076F000460930914709821B930B90937809809338
:10770000770980915F099091600920914A09309131
:107710004B09821B930B90937A098093790980918E
:1077200063099091640920914E0930914F09821BA1
:10773000930B90937C0980937B0981E080937D0972
:1077400081E090E090937F0980937E0980E090E053
:10775000089510927D0982E090E008950E94C03A59
:10776000892B99F580915B0990915C09A0915D0945
:10777000B0915E098093460990934709A093480908
:10778000B093490980915F0990916009A0916109C6
:10779000B091620980934A0990934B09A0934C09D8
:1077A000B0934D098091630990916409A091650996
:1077B000B091660980934E0990934F09A0935009A8
:1077C000B093510981E0809358090895482F209182
:1077D000D3053091D4052530310509F49AC02630FF
:1077E00031058CF42130310529F1223031051CF4AA
:1077F000232BD1F003C12230310571F12330310543
:1078000009F0FCC02FC02730310509F4E2C0273051
:1078100031050CF490C02830310509F4E5C0293059
:10782000310509F0EBC0A2C0853B09F0E7C081E05B
:1078300090E0D5C0823639F482E090E09093D40590
:107840008093D30504C01092D4051092D3051092F2
:10785000E5051092E6050895813009F0CFC083E078
:1078600090E0BDC0883031F0823151F1833009F0B1
:1078700044C013C025E439E0309300062093FF058F
:10788000809145098823C9F5225130403093FE0587
:107890002093FD052E5E3F4F25C022E939E030934D
:1078A00000062093FF0580919209882331F520512D
:1078B00030403093FE052093FD05205F3F4F12C0FE
:1078C0002BE239E0309300062093FF0580912B09CD
:1078D000882399F4245230403093FE052093FD050F
:1078E0002C5D3F4F3093F2052093F10585E090E049
:1078F0009093D4058093D30504C01092D4051092C0
:10790000D305842F8F5F8093E5058F5F8093E60515
:10791000089590E09093F0058093EF059091E50530
:10792000940F9093E5058091E605890F8093E60515
:1079300086E090E054C0282F30E0322F222780913B
:10794000EF059091F005820F931F9093F0058093BF
:10795000EF059091E505940F9093E5058091E6057C
:10796000890F8093E60589E090E039C06091EF05CA
:107970007091F0056115710509F440C0E091FD05B5
:10798000F091FE0580838091E505840F8093E505E5
:107990009091E605980F9093E605CB01019790939F
:1079A000F0058093EF05892B89F08091F105909186
:1079B000F2058E179F0750F03196F093FE05E09385
:1079C000FD053093D4052093D305089587E090E01A
:1079D00006C08091E505481789F488E090E090930F
:1079E000D4058093D30508958091E605481731F4B6
:1079F000E091FF05F091000681E080831092D405AC
:107A00001092D30508952F923F924F925F926F92FA
:107A10007F928F929F92AF92BF92CF92DF92EF921E
:107A2000FF920F931F93CF93DF93CDB7DEB76A9783
:107A30000FB6F894DEBF0FBECDBF988F8F8B83300B
:107A4000910509F4B2C08430910521F0892B09F425
:107A500018C152C68091590990915A09019702970D
:107A600008F424C18091E3059091E4050196909378
:107A7000E4058093E305C39708F441C61092E4053A
:107A80001092E3051092F8051092F7051092FA058E
:107A90001092F9051092FC051092FB051092D80582
:107AA0001092D7051092D6051092D5051092E705D1
:107AB0001092E8051092E9051092EA051092EB0584
:107AC0001092EC051092ED051092EE051092DB0578
:107AD0001092DC051092DD051092DE051092DF0594
:107AE0001092E0051092E1051092E2051092020654
:107AF000109201061092DA051092D90510928109B0
:107B00001092800980917D09882309F44BC08091EF
:107B10007709909178099093710980937009609129
:107B2000790970917A09709373096093720921E061
:107B30002093760990932D0980932C0970932F0937
:107B400060932E0920933209709561957F4F90952F
:107B500081959F4F0E949D439C019093F4058093D3
:107B6000F305E0917009F0917109F7FF03C08AE510
:107B700090E002C08EE091E0821B930B9093F4059D
:107B80008093F3054091F3055091F40560917209DB
:107B900070917309CF010E94D7447093F6056093EA
:107BA000F5059FC510927609A3C58091590990915A
:107BB0005A09019709F47AC08091E3059091E40590
:107BC00001969093E4058093E3058955924008F46B
:107BD00096C51092E4051092E30580917D098823F3
:107BE00009F44CC01092FA051092F9051092FC05A8
:107BF0001092FB051092D8051092D7051092D60569
:107C00001092D5051092E7051092E8051092E9054B
:107C10001092EA051092EB051092EC051092ED051A
:107C20001092EE051092DB051092DC051092DD0536
:107C30001092DE051092DF051092E0051092E1052A
:107C40001092E205109204061092030610920606A6
:107C500010920506809177099091780990932D09EB
:107C600080932C098091790990917A0990932F093A
:107C700080932E0981E08093320973C110923209FA
:107C800037C51092E4051092E3051092D0051092CA
:107C9000CF051092D2051092D10510928109109251
:107CA000800910925A09109259092CC580915909DE
:107CB00090915A098130910509F456C1823091059D
:107CC00041F0892B09F014C51092E4051092E305E8
:107CD00019C580917609882309F40AC580917E0927
:107CE00090917F09181619060CF03BC1809180090C
:107CF00090918109099709F434C18091F705909119
:107D0000F80501969093F8058093F70540912C09AA
:107D100050912D098091770990917809DA01A81B7B
:107D2000B90BB7FF03C0B095A195BF4F60912E0965
:107D300070912F098091790990917A09FB01E81BD4
:107D4000F90BF7FF03C0F095E195FF4F2091010675
:107D5000309102068091F5059091F605821B930BF8
:107D60008536910574F1A83CB105E4F4E83CF105D1
:107D7000CCF48091D9059091DA058C3091052CF4E2
:107D800004969093DA058093D9058091D905909156
:107D9000DA05820F931F909302068093010683E019
:107DA00090E029C08091D9059091DA058230910543
:107DB0002CF001979093DA058093D90584E090E048
:107DC0001AC0C3970CF478C0A436B10564F4E43645
:107DD000F1054CF4285F3F4F3093020620930106D3
:107DE00085E090E008C02F5F3F4F3093020620935C
:107DF000010686E090E090938109809380091092BB
:107E0000FC051092FB0581E090E09093FA058093C9
:107E1000F905A0900106B0900206CC24B7FCC094EE
:107E2000DC2C8091F3059091F4050E9479447C014B
:107E30002090010630900206442437FC4094542CD4
:107E40008091F3059091F4050E94CF443C010027F6
:107E5000F7FC0095102FC801B701A60195010E94FB
:107E6000F24828EE33E040E050E00E9466498091FD
:107E7000700990917109820F931F90932D0980933F
:107E80002C09882477FC8094982CC401B301A201AA
:107E900091010E94F24828EE33E040E050E00E9459
:107EA00066498091720990917309820F931F909394
:107EB0002F0980932E0955C0A436B1050CF04BC094
:107EC000E436F1050CF047C087E090E0909381091B
:107ED000809380091092FA051092F9051092FC0522
:107EE0001092FB05433051051CF04350504006C032
:107EF0003FEF4E3F530734F44D5F5F4F50932D09D2
:107F000040932C09633071051CF06350704006C02B
:107F10004FEF6E3F740734F46D5F7F4F70932F09FE
:107F200060932E0980912C0990912D090396079753
:107F3000C0F480912E0990912F090396079788F439
:107F400010922D0910922C0910922F0910922E09CF
:107F500089E090E002C088E090E0909381098093EE
:107F6000800981E090E0BFC380917E0990917F09F4
:107F7000181619060CF0B1C38091050690910606FB
:107F8000019690930606809305068091770990915B
:107F900078099E8B8D8B80912C0990912D09AD894C
:107FA000BE89A81BB90BBE8BAD8BE0917909F0910E
:107FB0007A0980912E0990912F09E81BF90BFC8B0F
:107FC000EB8B6091D7057091D8056A0F7B1F70937A
:107FD000D8056093D7050091D5051091D6050E0FF1
:107FE0001F1F1093D6050093D505A0900F09B090E0
:107FF0001009C0901109D090120960900B0970907F
:108000000C0980900D0990900E0910927F09109232
:108010007E09CB0177FF04C088279927861B970B21
:10802000895B9B4054F4C80117FF04C08827992737
:10803000801B910B895B9B4064F0809103069091BB
:1080400004068832910528F40196909304068093E3
:1080500003068091030690910406009729F1019789
:108060009093040680930306CB01A3E0880F991F29
:10807000AA95E1F7861B970B68E070E00E943149F2
:108080007093D8056093D705C801F3E0880F991F56
:10809000FA95E1F7801B910B68E070E00E9431498E
:1080A0007093D6056093D5058091FB059091FC05F2
:1080B0001816190644F41092D8051092D70510929C
:1080C000D6051092D5054091D7055091D8055A8311
:1080D000498380917505282F30E040E050E02F87DC
:1080E000388B498B5A8B4091D5055091D6055C83CE
:1080F0004B838091F9059091FA059A8F898FE090D2
:108100007605181619060CF05CC0E694E694FF2478
:108110000027F7FC0095102FC801B701A6019501B3
:108120000E94F24822E330E040E050E00E946649BD
:1081300059016A01C801B701A40193010E94F248E4
:1081400022E330E040E050E00E946649D601C501DC
:108150008835EFEF9E07EFEFAE07EFEFBE0724F491
:1081600088E59FEFAFEFBFEF3C014D01893A9105E4
:10817000A105B1052CF0E8EA6E2E712C812C912C12
:1081800028356FEF36076FEF46076FEF560724F479
:1081900028E53FEF4FEF5FEF19012A01293A31053A
:1081A000410551052CF078EA272E312C412C512C19
:1081B0009091740583E0989FC001112464E070E001
:1081C00058C0E694E694FF240027F7FC0095102F92
:1081D000C801B701A60195010E94F24829E130E0EB
:1081E00040E050E00E94664959016A01C801B701A8
:1081F000A40193010E94F24829E130E040E050E000
:108200000E946649D601C5018034EFEF9E07EFEF6B
:10821000AE07EFEFBE0724F480E49FEFAFEFBFEFB0
:108220003C014D01813C9105A105B1052CF060ECAC
:10823000662E712C812C912C20346FEF36076FEF56
:1082400046076FEF560724F420E43FEF4FEF5FEF50
:1082500019012A01213C3105410551052CF090EC12
:10826000292E312C412C512C8091740590E062E034
:1082700070E00E9431497B010027F7FC0095102F28
:10828000AD89BE899D01442737FD4095542FC80113
:10829000B7010E94F24824E130E040E050E00E9443
:1082A000664959016A012093DB053093DC05409350
:1082B000DD055093DE05EB89FC899F01442737FDDE
:1082C0004095542FC801B7010E94F24824E130E0E4
:1082D00040E050E00E9466492093DF053093E005BE
:1082E0004093E1055093E205898D9A8D1816190681
:1082F000ACF591ECA916B104C104D1042CF080ECCA
:1083000090E0A0E0B0E00DC0A0E4AA16AFEFBA067E
:10831000AFEFCA06AFEFDA0664F480E49FEFAFEF89
:10832000BFEF8093DB059093DC05A093DD05B09350
:10833000DE05213C3105410551052CF080EC90E033
:10834000A0E0B0E03EC020543F4F4F4F5F4F0CF0D5
:1083500040C080E49FEFAFEFBFEF33C0E9EAAE1655
:10836000B104C104D1042CF088EA90E0A0E0B0E0B0
:108370000DC0F8E5AF16FFEFBF06FFEFCF06FFEF2A
:10838000DF0664F488E59FEFAFEFBFEF8093DB0576
:108390009093DC05A093DD05B093DE05293A310505
:1083A000410551052CF088EA90E0A0E0B0E009C05A
:1083B00028553F4F4F4F5F4F64F488E59FEFAFEF75
:1083C000BFEF8093DF059093E005A093E105B093A4
:1083D000E205E090DB05F090DC050091DD051091F1
:1083E000DE05F092C208E092C108A090DF05B090CF
:1083F000E005C090E105D090E205B0920209A0929C
:10840000010989819A819C01442737FD4095542FA9
:108410006F85788989899A890E94F24820E830E03E
:1084200040E050E00E94664928389FEF39079FEFEF
:1084300049079FEF590724F428E83FEF4FEF5FEF1C
:10844000293731054105510524F028E730E040E0A7
:1084500050E02E0D3F1D401F511F260D371D481D9A
:10846000591DEE24FF248701E21AF30A040B150BB1
:10847000E092E705F092E8050093E9051093EA051C
:10848000AB81BC81BD01882777FD8095982F2F8512
:10849000388949895A890E94F24820E830E040E052
:1084A00050E00E9466492838BFEF3B07BFEF4B07FB
:1084B000BFEF5B0724F428E83FEF4FEF5FEF29376A
:1084C00031054105510524F028E730E040E050E057
:1084D0002A0D3B1D4C1D5D1D220D331D441D551DD8
:1084E000AA24BB246501A21AB30AC40AD50AA09221
:1084F000EB05B092EC05C092ED05D092EE05F0923E
:10850000E408E092E308B092E808A092E7086091DE
:10851000030970910409809105099091060924E1ED
:1085200035E040E050E00E94664979018A01C901C6
:108530000E94CF449A8789872091E7053091E8050A
:108540004091E9055091EA052B873C874D875E876E
:10855000C7010E94794498878F836090E7057090E7
:10856000E8058090E9059090EA05C7010E94CF4494
:108570009A8F898F2090EB053090EC054090ED05A7
:108580005090EE05C7010E9479449E838D832D890A
:108590003E8937FF03C0309521953F4F2159314027
:1085A00054F42B893C8937FF03C0309521953F4F08
:1085B000215931404CF01092D2051092D105109201
:1085C000D0051092CF0594C080914C0890914D0831
:1085D00080914C0890914D08A98DBA8DBD018827D6
:1085E00077FD8095982FA40193010E94F2487B01AA
:1085F0008C01ED81FE81BF01882777FD8095982F42
:10860000A20191010E94F248E61AF70A080B190B21
:10861000C801B70120E43FE140E050E00E94664914
:10862000223EFFEF3F07FFEF4F07FFEF5F0724F406
:1086300022EE3FEF4FEF5FEF2F313105410551053E
:1086400024F02EE130E040E050E03093D20520935A
:10865000D1052F813885B901882777FD8095982F1E
:108660002B853C854D855E850E94F2487B018C01FF
:1086700049855A85BA01882777FD8095982FA601EC
:1086800095010E94F248E60EF71E081F191FC80147
:10869000B70120EC30EE4FEF5FEF0E946649223EBB
:1086A0006FEF36076FEF46076FEF560724F422EEA1
:1086B0003FEF4FEF5FEF2F3131054105510524F0BA
:1086C0002EE130E040E050E03093D0052093CF051C
:1086D0008F89988D0497B1F404C0AF89B88D149731
:1086E00089F482E090E090935A09809359090AC076
:1086F00010925A091092590982E090E005C081E079
:1087000090E002C080E090E06A960FB6F894DEBF79
:108710000FBECDBFDF91CF911F910F91FF90EF90D2
:10872000DF90CF90BF90AF909F908F907F906F9091
:108730005F904F903F902F900895EF92FF920F938C
:108740001F93CF93DF938C01EB019C0197FF04C033
:1087500022273327281B390BCE01D7FF04C08827D7
:1087600099278C1B9D0B821793073CF4CE01E801DF
:108770008C01B1E0EB2EF12C02C0EE24FF242097F7
:1087800041F40115110529F461E070E080E090E00A
:1087900024C0B801882777FD8095982F28EE33E014
:1087A00040E050E00E94F2489E01442737FD40958A
:1087B000542F0E946649B90137FF03C07095619537
:1087C0007F4F882777FD8095982F6D3021E07207C5
:1087D00020E0820720E0920704F524E630E040E044
:1087E00050E00E94F2482CE031E040E050E00E946E
:1087F0006649CA01B901A4E0660F771F881F991F57
:10880000AA95D1F7621B730B840B950B24E630E01D
:1088100040E050E00E94664953C0633422E0720792
:1088200020E0820720E0920734F524E630E040E0C3
:1088300050E00E94F248605B78468040904026E31A
:1088400031E040E050E00E946649CA01B901F4E01D
:10885000660F771F881F991FFA95D1F7621B730B5C
:10886000840B950B24E630E040E050E00E9466491E
:10887000215F3F4F25C022E330E040E050E00E94FE
:10888000F248645E70478040904026EA31E040E064
:1088900050E00E946649CA01B901E4E0660F771F03
:1088A000881F991FEA95D1F7621B730B840B950BF8
:1088B00022E330E040E050E00E946649225E3F4FF4
:1088C000EF2829F48AE590E0821B930B9C0117FDA9
:1088D00003C0D7FF06C002C0D7FD03C03095219565
:1088E0003F4FC901DF91CF911F910F91FF90EF9002
:1088F0000895FC01F7FF04C0882799278E1B9F0B62
:108900008856914034F0CF0168E671E00E94314909
:10891000FC01F7FD03C041E050E005C0F095E19592
:10892000FF4F4FEF5FEFCF018B5590408A35910598
:1089300030F484EB90E08E1B9F0BFC010FC0CF0145
:10894000855B90408A35910518F4E45BF0400EC0D9
:10895000CF018F5091408A35910518F081E090E069
:1089600007C088E691E08E1B9F0BFC018FEF9FEF05
:10897000EE0FFF1FEF5DFB4F25913491BC01649F0B
:10898000C001659F900D749F900D1124AC01429F12
:10899000C001439F900D529F900D112408952AE528
:1089A00030E0281B390BC9010E9479440895EF92E9
:1089B000FF920F931F93CF93DF93EA01AC0197FFD0
:1089C00004C044275527481B590B9B0177FF04C05F
:1089D00022273327261B370B2417350794F49C01D5
:1089E000B901882777FD8095982F28EE33E040E085
:1089F00050E00E94F2487B018C01CE010E94794434
:108A00000FC0882777FD8095982F28EE33E040E04F
:108A100050E00E94F2487B018C01CE010E94CF44BD
:108A20009C01442737FD4095542FC801B7010E948F
:108A30006649B90137FF03C0709561957F4F88275C
:108A400077FD8095982FDF91CF911F910F91FF9027
:108A5000EF900895A8E0B0E0E0E3F5E40C948B49D2
:108A60007B018C01611571058105910519F482E086
:108A700089835AC083E089838EE1C82ED12CDC82A1
:108A8000CB82ED82FE820F831887C801B7010E9456
:108A90009D45BC016150704077FF33C0EE27FF2732
:108AA000E61BF70B20E030E040E050E081E090E092
:108AB000A0E0B0E00E2E04C0880F991FAA1FBB1FB4
:108AC0000A94D2F70197A109B1098E219F21A02311
:108AD000B1230097A105B10521F021E030E040E08D
:108AE00050E004C016950795F794E794EA95D2F7FD
:108AF0002E293F29402B512B2D833E834F835887AE
:108B00000FC06115710581F0062E04C0EE0CFF1C2C
:108B1000001F111F0A94D2F7ED82FE820F8318877F
:108B2000C61AD70ADC82CB821A82CE0101960E9435
:108B3000EA45E8E028960C94A749EF92FF920F933C
:108B40001F939B01AC01203080E0380781E048078B
:108B500080E0580780F42F3F31054105510509F0A9
:108B600020F4EE24FF24870119C068E0E62EF12CE2
:108B7000012D112D13C0203080E0380780E0480718
:108B800081E0580730F490E1E92EF12C012D112DF0
:108B900005C088E1E82EF12C012D112D80E290E036
:108BA000A0E0B0E08E199F09A00BB10B04C0569550
:108BB000479537952795EA94D2F7F901EF55FC4F81
:108BC0002081821B9109A109B1091F910F91FF908A
:108BD000EF9008959F92AF92BF92CF92DF92EF9263
:108BE000FF920F931F93EE24FF248701FC01248141
:108BF00035814681578191808081823010F44061B7
:108C0000A2C0843009F49BC0823029F420E030E017
:108C100040E050E005C0211531054105510519F42A
:108C2000E0E0F0E092C0828193816FEF8238960796
:108C30000CF05AC062E87FEF681B790B6A3171054E
:108C40002CF020E030E040E050E02AC0AA24BB2411
:108C5000650181E090E0A0E0B0E0062E04C0880F3E
:108C6000991FAA1FBB1F0A94D2F70197A109B10946
:108C700082239323A423B5230097A105B10529F0EE
:108C800071E0A72EB12CC12CD12C04C0569547956C
:108C9000379527956A95D2F72A293B294C295D29D2
:108CA000DA01C9018F779070A070B070803491059F
:108CB000A105B10539F427FF09C0205C3F4F4F4F94
:108CC0005F4F04C0215C3F4F4F4F5F4F80E090E00B
:108CD000203060E0360760E0460760E4560710F099
:108CE00081E090E0FC0123C08038910544F5FC014F
:108CF000E158FF4FDA01C9018F779070A070B07012
:108D000080349105A105B10539F427FF09C0205C25
:108D10003F4F4F4F5F4F04C0215C3F4F4F4F5F4F5E
:108D200057FF05C05695479537952795319687E0AB
:108D300056954795379527958A95D1F706C020E037
:108D400030E040E050E0EFEFF0E0E22EF32E942F21
:108D50009F77802F8078892B9E2F979599279795BD
:108D60008F77082F092B9E2F9695812F8078892B3E
:108D70009794992497948F77182F1929C801B701D0
:108D80001F910F91FF90EF90DF90CF90BF90AF9029
:108D90009F900895FC014150504030F0019006161C
:108DA000D1F73197CF010895882799270895505812
:108DB000BB27AA270ED079C16AD130F06FD120F03D
:108DC00031F49F3F11F41EF45FC10EF4E095E7FB10
:108DD00055C1E92F7BD180F3BA1762077307840767
:108DE000950718F071F49EF593C10EF4E0950B2EE3
:108DF000BA2FA02D0B01B90190010C01CA01A001ED
:108E00001124FF27591B99F0593F50F4503E68F147
:108E10001A16F040A22F232F342F4427585FF3CF88
:108E2000469537952795A795F0405395C9F77EF459
:108E30001F16BA0B620B730B840BBAF09150A1F0A2
:108E4000FF0FBB1F661F771F881FC2F70EC0BA0F28
:108E5000621F731F841F48F4879577956795B795B0
:108E6000F7959E3F08F0B3CF9395880F08F09927A8
:108E7000EE0F9795879508950CD017C10FD140F04C
:108E800006D130F021F45F3F19F0F8C0511141C113
:108E9000FBC01CD198F39923C9F35523B1F3951B5B
:108EA000550BBB27AA2762177307840738F09F5F0B
:108EB0005F4F220F331F441FAA1FA9F333D00E2E7A
:108EC0003AF0E0E830D091505040E695001CCAF7E7
:108ED00029D0FE2F27D0660F771F881FBB1F2617AC
:108EE00037074807AB07B0E809F0BB0B802DBF017F
:108EF000FF2793585F4F2AF09E3F510568F0BEC090
:108F000008C15F3FECF3983EDCF386957795679553
:108F1000B795F7959F5FC9F7880F911D969587952F
:108F200097F90895E1E0660F771F881FBB1F62174E
:108F300073078407BA0720F0621B730B840BBA0B0C
:108F4000EE1F88F7E095089504D06894B111E1C050
:108F50000895C4D088F09F5790F0B92F9927B75142
:108F6000A0F0D1F0660F771F881F991F1AF0BA95ED
:108F7000C9F712C0B13081F0CBD0B1E00895C8C0BC
:108F8000672F782F8827B85F39F0B93FCCF38695E3
:108F900077956795B395D9F73EF490958095709540
:108FA00061957F4F8F4F9F4F0895E89409C097FBBD
:108FB0003EF490958095709561957F4F8F4F9F4FB0
:108FC0009923A9F0F92F96E9BB279395F6958795F4
:108FD00077956795B795F111F8CFFAF4BB0F11F4B7
:108FE00060FF1BC06F5F7F4F8F4F9F4F16C088235E
:108FF00011F096E911C0772321F09EE8872F762F94
:1090000005C0662371F096E8862F70E060E02AF0D4
:109010009A95660F771F881FDAF7880F96958795C0
:1090200097F9089507D008F481E0089503D008F473
:109030008FEF0895990F0008550FAA0BE0E8FEEF97
:1090400016161706E807F907C0F012161306E4070C
:10905000F50798F0621B730B840B950B39F40A2605
:1090600061F0232B242B252B21F408950A2609F4E3
:10907000A140A6958FEF811D811D089597F99F67E7
:1090800080E870E060E008959FEF80EC0895002490
:109090000A941616170618060906089500240A945D
:1090A00012161306140605060895092E0394000CE3
:1090B00011F4882352F0BB0F40F4BF2B11F460FF72
:1090C00004C06F5F7F4F8F4F9F4F089557FD90589B
:1090D000440F551F59F05F3F71F04795880F97FB7C
:1090E000991F61F09F3F79F0879508951216130636
:1090F0001406551FF2CF4695F1DF08C01616170665
:109100001806991FF1CF8695710561050894089599
:10911000E894BB2766277727CB0197F908950BD0F2
:10912000C4CFB5DF28F0BADF18F0952309F0A6CF39
:10913000ABCF1124EECFCADFA0F3959FD1F3950FEB
:1091400050E0551F629FF001729FBB27F00DB11DCB
:10915000639FAA27F00DB11DAA1F649F6627B00D5B
:10916000A11D661F829F2227B00DA11D621F739F44
:10917000B00DA11D621F839FA00D611D221F749F52
:109180003327A00D611D231F849F600D211D822F99
:10919000762F6A2F11249F5750408AF0E1F08823E0
:1091A0004AF0EE0FFF1FBB1F661F771F881F9150ED
:1091B0005040A9F79E3F510570F060CFAACF5F3FA6
:1091C000ECF3983EDCF3869577956795B795F79520
:1091D000E7959F5FC1F7FE2B880F911D96958795A8
:1091E00097F90895629FD001739FF001829FE00D6F
:1091F000F11D649FE00DF11D929FF00D839FF00D16
:10920000749FF00D659FF00D9927729FB00DE11DC1
:10921000F91F639FB00DE11DF91FBD01CF0111249E
:109220000895991B79E004C0991F961708F0961BC2
:10923000881F7A95C9F780950895AA1BBB1B51E139
:1092400007C0AA1FBB1FA617B70710F0A61BB70BB6
:10925000881F991F5A95A9F780959095BC01CD015B
:10926000089597FB092E07260AD077FD04D0E5DF85
:1092700006D000201AF4709561957F4F0895F6F797
:10928000909581959F4F0895A1E21A2EAA1BBB1BB2
:10929000FD010DC0AA1FBB1FEE1FFF1FA217B307C2
:1092A000E407F50720F0A21BB30BE40BF50B661FD8
:1092B000771F881F991F1A9469F76095709580959C
:1092C00090959B01AC01BD01CF01089597FB092E3C
:1092D00005260ED057FD04D0D7DF0AD0001C38F485
:1092E00050954095309521953F4F4F4F5F4F0895D2
:1092F000F6F790958095709561957F4F8F4F9F4FB2
:1093000008952F923F924F925F926F927F928F9229
:109310009F92AF92BF92CF92DF92EF92FF920F9304
:109320001F93CF93DF93CDB7DEB7CA1BDB0B0FB60E
:10933000F894DEBF0FBECDBF09942A8839884888CB
:109340005F846E847D848C849B84AA84B984C88461
:10935000DF80EE80FD800C811B81AA81B981CE0F58
:10936000D11D0FB6F894DEBF0FBECDBFED0108953D
:10937000F999FECFB2BDA1BDF89A119600B4089537
:10938000F999FECFB2BDA1BD00BC11960FB6F894FD
:0A939000FA9AF99A0FBE0895FFCF74
:10939A000A01FF64496E74656772616C4E69636B9A
:1093AA0020202020496E74656772616C526F6C6C64
:1093BA00202020204163634E69636B2020202020F7
:1093CA0020202020416363526F6C6C2020202020D3
:1093DA00202020204779726F47696572202020205B
:1093EA0020202020486F6568656E576572742020BA
:1093FA00202020204163635A202020202020202082
:10940A002020202047617320202020202020202097
:10941A00202020204B6F6D7061737356616C7565E7
:10942A002020202045727361747A6B6F6D706173AE
:10943A00732020205573725F5061723120202020E2
:10944A00202020205573725F706172332020202003
:10945A00202020204D6F746F725F566F726E6520E8
:10946A00202020204D6F746F725F48696E74656E9C
:10947A00202020204D6F746F725F4C696E6B7320D1
:10948A00202020204D6F746F725F52656368747379
:10949A0020202020496E646578202020202020206A
:1094AA0020202020554261742020202020202020C6
:1094BA00202020204D657373776572745F4E69634F
:1094CA006B2020204D657373776572745F526F6CE1
:1094DA006C2020204D657373776572745F476965E8
:1094EA0072202020537469636B5F4E69636B20207E
:1094FA0020202020537469636B5F526F6C6C2020AC
:10950A0020202020537469636B5F476965722020AD
:10951A00202020204750535F4E69636B2020202073
:10952A00202020204750535F526F6C6C202020204F
:10953A002020202075746D5F6561737420202020BF
:10954A002020202075746D5F6E6F72746820202051
:10955A002020202075746D5F616C742020202020EB
:10956A00202020206770735F737461746520202047
:10957A002020202067705F7265675F782020202096
:10958A002020202067705F7265675F792020202085
:10959A0020202020FFFF0A016400007D0000FF0355
:1095AA000102030405060708090A48616C6C6F206A
:1095BA0057656C7400000000000000000000000005
:1095CA000000000000000000000000000000000091
:1095DA000000000000000000000000000000000081
:1095EA000000000000000000000000000000000071
:1095FA00000000000000000000000A0142656769DF
:10960A006E6E657200004E6F726D616C0000537071
:10961A006F72740000640090D0030090D0030017AA
:10962A00B7D13830FB103A409696020A644664EC89
:10963A00FF000102020303030304040404040404F4
:10964A0004050505050505050505050505050505C1
:10965A0005060606060606060606060606060606A1
:10966A000606060606060606060606060606060690
:10967A000607070707070707070707070707070771
:10968A000707070707070707070707070707070760
:10969A000707070707070707070707070707070750
:1096AA000707070707070707070707070707070740
:1096BA000708080808080808080808080808080821
:1096CA000808080808080808080808080808080810
:1096DA000808080808080808080808080808080800
:1096EA0008080808080808080808080808080808F0
:1096FA0008080808080808080808080808080808E0
:10970A0008080808080808080808080808080808CF
:10971A0008080808080808080808080808080808BF
:10972A0008080808080808080808080808080808AF
:02973A00080025
:00000001FF
/branches/salvo_gps/Basis_v0067g/tags/v0007/FlightCtrl.aps
0,0 → 1,0
<AVRStudio><MANAGEMENT><ProjectName>FlightCtrl</ProjectName><Created>15-May-2007 11:20:41</Created><LastEdit>22-Dec-2007 14:15:04</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.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>G:\Mikrokopter\Flight_Crtl\v0067g\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega644.xml</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>eeprom.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>math.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><HEADERFILE>math.h</HEADERFILE><OTHERFILE>makefile</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>YES</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE>makefile</EXTERNALMAKEFILE><PART>atmega644</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>Flight-Ctrl.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_HAUPTVERSION=0 -DVERSION_NEBENVERSION=64 -DVERSION_KOMPATIBEL=5 -Os -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-20071221\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20071221\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/></IOView><Files><File00000><FileId>00000</FileId><FileName>timer0.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>analog.h</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>makefile</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>main.c</FileName><Status>1</Status></File00003></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
/branches/salvo_gps/Basis_v0067g/tags/v0007/GPS.c
0,0 → 1,668
/*
This program (files gps.c and gps.h) is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 3 of the License, or (at your option) any later version.
This program 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 and GNU Lesser General Public License for more details.
You should have received a copy of GNU General Public License (License_GPL.txt) and
GNU Lesser General Public License (License_LGPL.txt) along with this program.
If not, see <http://www.gnu.org/licenses/>.
 
Please note: All the other files for the project "Mikrokopter" by H.Buss are under the license (license_buss.txt) published by www.mikrokopter.de
*/
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
von Peter Muehlenbrock alias Salvo
Auswertung der Daten vom GPS im ublox Format
Hold Modus mit PID Regler
Rückstuerz zur Basis Funktion
Stand 20.1.2008
 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
#include "main.h"
#include "math.h"
//#include "gps.h"
 
// Defines fuer ublox Messageformat um Auswertung zu steuern
#define UBLOX_IDLE 0
#define UBLOX_SYNC1 1
#define UBLOX_SYNC2 2
#define UBLOX_CLASS 3
#define UBLOX_ID 4
#define UBLOX_LEN1 5
#define UBLOX_LEN2 6
#define UBLOX_CKA 7
#define UBLOX_CKB 8
#define UBLOX_PAYLOAD 9
 
// ublox Protokoll Identifier
#define UBLOX_NAV_POSUTM 0x08
#define UBLOX_NAV_STATUS 0x03
#define UBLOX_NAV_VELED 0x12
#define UBLOX_NAV_CLASS 0x01
#define UBLOX_SYNCH1_CHAR 0xB5
#define UBLOX_SYNCH2_CHAR 0x62
 
signed int GPS_Nick = 0;
signed int GPS_Roll = 0;
short int ublox_msg_state = UBLOX_IDLE;
static uint8_t chk_a =0; //Checksum
static uint8_t chk_b =0;
short int gps_state,gps_sub_state; //Zustaende der Statemachine
short int gps_updte_flag;
static long signed gps_reg_x,gps_reg_y;
static unsigned int rx_len;
static unsigned int ptr_payload_data_end;
unsigned int gps_alive_cnt; // Wird bei jedem gueltigen GPS Telegramm hochgezaehlt
static signed int hdng_2home,dist_2home; //Richtung und Entfernung zur home Position
static signed gps_tick; //wird bei jedem Update durch das GPS Modul hochgezaehlt
static short int hold_fast,hold_reset_int; //Flags fuer Hold Regler
static uint8_t *ptr_payload_data;
static uint8_t *ptr_pac_status;
static int dist_flown;
static unsigned int int_ovfl_cnt; // Zaehler fuer Overflows des Integrators
static int gps_quiet_cnt; // zaheler fuer GPS Off Time beim Kameraausloesen
 
 
short int Get_GPS_data(void);
 
NAV_POSUTM_t actual_pos; // Aktuelle Nav Daten werden hier im ublox Format abgelegt
NAV_STATUS_t actual_status; // Aktueller Nav Status
NAV_VELNED_t actual_speed; // Aktueller Geschwindigkeits und Richtungsdaten
 
GPS_ABS_POSITION_t gps_act_position; // Alle wichtigen Daten zusammengefasst
GPS_ABS_POSITION_t gps_home_position; // Die Startposition, beim Kalibrieren ermittelt
GPS_REL_POSITION_t gps_rel_act_position; // Die aktuelle relative Position bezogen auf Home Position
GPS_REL_POSITION_t gps_rel_hold_position; // Die gespeicherte Sollposition fuer GPS_ Hold Mode
GPS_REL_POSITION_t gps_rel_start_position; // Die gespeicherte Ausgangsposition fuer GPS_ Home Mode
 
// Initialisierung
void GPS_Neutral(void)
{
ublox_msg_state = UBLOX_IDLE;
gps_state = GPS_CRTL_IDLE;
gps_sub_state = GPS_CRTL_IDLE;
actual_pos.status = 0;
actual_speed.status = 0;
actual_status.status = 0;
gps_home_position.status = 0; // Noch keine gueltige Home Position
gps_act_position.status = 0;
gps_rel_act_position.status = 0;
GPS_Nick = 0;
GPS_Roll = 0;
gps_updte_flag = 0;
gps_alive_cnt = 0;
}
 
// Home Position sichern falls Daten verfuegbar sind.
void GPS_Save_Home(void)
{
short int n;
n = Get_GPS_data();
if (n == 0) // Gueltige und aktuelle Daten ?
{
// Neue GPS Daten liegen vor
gps_home_position.utm_east = gps_act_position.utm_east;
gps_home_position.utm_north = gps_act_position.utm_north;
gps_home_position.utm_alt = gps_act_position.utm_alt;
gps_home_position.status = 1; // Home Position gueltig
}
}
 
// Relative Position zur Home Position bestimmen
// Rueckgabewert 0= Daten sind aktuell und gueltig. 1= Keine Aenderung. 2= Daten ungueltig
short int Get_Rel_Position(void)
{
short int n = 0;
n = Get_GPS_data();
if (n >=1) return (n); // nix zu tun, weil keine neue Daten da sind
if (gps_alive_cnt < 1000) gps_alive_cnt += 600; // Timeoutzaehler. Wird in Motorregler Routine ueberwacht und dekrementiert
if (gps_home_position.status > 0) //Nur wenn Home Position vorliegt
{
gps_rel_act_position.utm_east = (int) (gps_act_position.utm_east - gps_home_position.utm_east);
gps_rel_act_position.utm_north = (int) (gps_act_position.utm_north - gps_home_position.utm_north);
gps_rel_act_position.utm_alt = (int) (gps_act_position.utm_alt - gps_home_position.utm_alt);
gps_rel_act_position.status = 1; // gueltige Positionsdaten
n = 0;
gps_updte_flag = 1; // zeigt an, dass neue Daten vorliegen.
}
else
{
n = 2; //keine gueltigen Daten vorhanden
gps_rel_act_position.status = 0; //keine gueltige Position weil keine home Position da ist.
}
return (n);
}
 
// Daten aus aktuellen ublox Messages extrahieren
// Rueckgabewert 0= Daten sind aktuell und gueltig. 1= Keine Aenderung. 2= Daten ungueltig
short int Get_GPS_data(void)
{
short int n = 1;
 
if (actual_pos.status == 0) return (1); //damit es schnell geht, wenn nix zu tun ist
if ((actual_pos.status > 0) && (actual_status.status > 0) && (actual_speed.status > 0))
{
if (((actual_status.gpsfix_type & 0x03) >=2) && ((actual_status.nav_status_flag & 0x01) >=1)) // nur wenn Daten aktuell und gueltig sind
{
actual_status.status = 0;
gps_act_position.utm_east = actual_pos.utm_east/10;
gps_act_position.utm_north = actual_pos.utm_north/10;
gps_act_position.utm_alt = actual_pos.utm_alt/10;
actual_pos.status = 0; //neue ublox Messages anfordern
gps_act_position.speed_gnd = actual_speed.speed_gnd;
gps_act_position.speed_gnd = actual_speed.speed_gnd;
gps_act_position.heading = actual_speed.heading/100000;
actual_speed.status = 0;
gps_act_position.status = 1;
n = 0; //Daten gueltig
}
else
{
gps_act_position.status = 0; //Keine gueltigen Daten
actual_speed.status = 0;
actual_status.status = 0;
actual_pos.status = 0; //neue ublox Messages anfordern
n = 2;
}
}
return (n);
}
 
/*
Daten vom GPS im ublox MSG Format auswerten
Die Routine wird bei jedem Empfang eines Zeichens vom GPS Modul durch den UART IRQ aufgerufen
// Die UBX Messages NAV_POSUTM, NAV_STATUS und NAV_VALED muessen aktiviert sein
*/
void Get_Ublox_Msg(uint8_t rx)
{
switch (ublox_msg_state)
{
 
case UBLOX_IDLE: // Zuerst Synchcharacters pruefen
if ( rx == UBLOX_SYNCH1_CHAR ) ublox_msg_state = UBLOX_SYNC1;
else ublox_msg_state = UBLOX_IDLE;
break;
 
case UBLOX_SYNC1:
 
if (rx == UBLOX_SYNCH2_CHAR) ublox_msg_state = UBLOX_SYNC2;
else ublox_msg_state = UBLOX_IDLE;
chk_a = 0,chk_b = 0;
break;
 
case UBLOX_SYNC2:
if (rx == UBLOX_NAV_CLASS) ublox_msg_state = UBLOX_CLASS;
else ublox_msg_state = UBLOX_IDLE;
break;
 
case UBLOX_CLASS: // Nur NAV Meldungen auswerten
switch (rx)
{
case UBLOX_NAV_POSUTM:
ptr_pac_status = &actual_pos.status;
if (*ptr_pac_status > 0) ublox_msg_state = UBLOX_IDLE; //Abbruch weil Daten noch nicht verwendet wurden
else
{
ptr_payload_data = &actual_pos;
ptr_payload_data_end = &actual_pos.status;
ublox_msg_state = UBLOX_LEN1;
}
break;
 
case UBLOX_NAV_STATUS:
ptr_pac_status = &actual_status.status;
if (*ptr_pac_status > 0) ublox_msg_state = UBLOX_IDLE;
else
{
ptr_payload_data = &actual_status;
ptr_payload_data_end = &actual_status.status;
ublox_msg_state = UBLOX_LEN1;
}
break;
 
case UBLOX_NAV_VELED:
ptr_pac_status = &actual_speed.status;
if (*ptr_pac_status > 0) ublox_msg_state = UBLOX_IDLE;
else
{
ptr_payload_data = &actual_speed;
ptr_payload_data_end = &actual_speed.status;
ublox_msg_state = UBLOX_LEN1;
}
break;
 
default:
ublox_msg_state = UBLOX_IDLE;
break;
}
chk_a = UBLOX_NAV_CLASS + rx;
chk_b = UBLOX_NAV_CLASS + chk_a;
break;
 
case UBLOX_LEN1: // Laenge auswerten
rx_len = rx;
chk_a += rx;
chk_b += chk_a;
ublox_msg_state = UBLOX_LEN2;
break;
 
 
case UBLOX_LEN2: // Laenge auswerten
rx_len = rx_len + (rx *256); // Laenge ermitteln
chk_a += rx;
chk_b += chk_a;
ublox_msg_state = UBLOX_PAYLOAD;
break;
 
case UBLOX_PAYLOAD: // jetzt Nutzdaten einlesen
if (rx_len > 0)
{
*ptr_payload_data = rx;
chk_a += rx;
chk_b += chk_a;
--rx_len;
if ((rx_len > 0) && (ptr_payload_data <= ptr_payload_data_end))
{
ptr_payload_data++;
ublox_msg_state = UBLOX_PAYLOAD;
}
else ublox_msg_state = UBLOX_CKA;
}
else ublox_msg_state = UBLOX_IDLE; // Abbruch wegen Fehler
break;
 
case UBLOX_CKA: // Checksum pruefen
if (rx == chk_a) ublox_msg_state = UBLOX_CKB;
else ublox_msg_state = UBLOX_IDLE; // Abbruch wegen Fehler
break;
 
case UBLOX_CKB: // Checksum pruefen
if (rx == chk_b) *ptr_pac_status = 1; // Paket ok
ublox_msg_state = UBLOX_IDLE;
break;
 
default:
ublox_msg_state = UBLOX_IDLE;
break;
}
}
//Zentrale Statemachine fuer alle GPS relevanten Regelungsablauefe
short int GPS_CRTL(short int cmd)
{
static unsigned int cnt; // Zaehler fuer diverse Verzoegerungen
static long int delta_north,delta_east; // Mass fuer Distanz zur Sollposition
signed int n;
static signed int gps_g2t_act_v; // Aktuelle Geschwindigkeitsvorgabe fuer Home Funktion
signed int dist_frm_start_east,dist_frm_start_north;
int amplfy_speed_east,amplfy_speed_north; //Verstaerkungsfaktoren fuer D-Anteil
static signed int int_east,int_north; //Integrierer
long int speed_east,speed_north; //Aktuelle Geschwindigkeit
signed long int_east1,int_north1;
int dist_east,dist_north;
int diff_p; //Vom Modus abhaengige zusaetzliche Verstaerkung
long ni,ro; // Nick und Roll Zwischenwerte
 
 
switch (cmd)
{
 
case GPS_CMD_REQ_HOME: // Es soll zum Startpunkt zurueckgeflogen werden.
if ((gps_state != GPS_CRTL_HOLD_ACTIVE) && (gps_state != GPS_CRTL_HOME_ACTIVE))
{
cnt++;
if (cnt > 50) // erst nach Verzoegerung
{
// Erst mal initialisieren
cnt = 0;
gps_tick = 0;
hold_fast = 0;
hold_reset_int = 0; // Integrator enablen
int_east = 0, int_north = 0;
gps_reg_x = 0, gps_reg_y = 0;
delta_east = 0, delta_north = 0;
dist_flown = 0;
gps_g2t_act_v = 0;
gps_sub_state = GPS_CRTL_IDLE;
// aktuelle positionsdaten abspeichern
if (gps_rel_act_position.status > 0)
{
gps_rel_start_position.utm_east = gps_rel_act_position.utm_east;
gps_rel_start_position.utm_north= gps_rel_act_position.utm_north;
gps_rel_start_position.status = 1; // gueltige Positionsdaten
gps_rel_hold_position.utm_east = gps_rel_act_position.utm_east;
gps_rel_hold_position.utm_north = gps_rel_act_position.utm_north;
gps_rel_hold_position.status = 1; // gueltige Positionsdaten
//Richtung zur Home Position bezogen auf Nordpol bestimmen
hdng_2home = arctan_i(-gps_rel_start_position.utm_east,-gps_rel_start_position.utm_north);
// in Winkel 0...360 Grad umrechnen
if (( gps_rel_start_position.utm_east < 0)) hdng_2home = ( 90-hdng_2home);
else hdng_2home = (270 - hdng_2home);
dist_2home = (int) get_dist(gps_rel_start_position.utm_east,gps_rel_start_position.utm_north,hdng_2home); //Entfernung zur Home Position bestimmen
gps_state = GPS_CRTL_HOME_ACTIVE;
return (GPS_STST_OK);
}
else
{
gps_rel_start_position.status = 0; //Keine Daten verfuegbar
gps_state = GPS_CRTL_IDLE;
return(GPS_STST_ERR); // Keine Daten da
}
}
else return(GPS_STST_PEND); // noch warten
}
break;
// ******************************
 
case GPS_CMD_REQ_HOLD: // Die Lageregelung soll aktiviert werden.
if (gps_state != GPS_CRTL_HOLD_ACTIVE)
{
cnt++;
if (cnt > 600) // erst nach Verzoegerung
{
cnt = 0;
// aktuelle positionsdaten abspeichern
if (gps_rel_act_position.status > 0)
{
hold_fast = 0;
hold_reset_int = 0; // Integrator enablen
int_east = 0, int_north = 0;
gps_reg_x = 0, gps_reg_y = 0;
delta_east = 0, delta_north = 0;
speed_east = 0; speed_north= 0;
int_ovfl_cnt = 0;
gps_quiet_cnt = 0;
gps_rel_hold_position.utm_east = gps_rel_act_position.utm_east;
gps_rel_hold_position.utm_north = gps_rel_act_position.utm_north;
gps_rel_hold_position.status = 1; // gueltige Positionsdaten
gps_state = GPS_CRTL_HOLD_ACTIVE;
return (GPS_STST_OK);
}
else
{
gps_rel_hold_position.status = 0; //Keine Daten verfuegbar
gps_state = GPS_CRTL_IDLE;
return(GPS_STST_ERR); // Keine Daten da
}
}
else return(GPS_STST_PEND); // noch warten
}
break;
 
case GPS_CMD_STOP: // Lageregelung beenden
cnt = 0;
GPS_Nick = 0;
GPS_Roll = 0;
gps_sub_state = GPS_CRTL_IDLE;
gps_state = GPS_CRTL_IDLE;
return (GPS_STST_OK);
break;
 
default:
return (GPS_STST_ERR);
break;
}
 
switch (gps_state)
{
case GPS_CRTL_IDLE:
cnt = 0;
return (GPS_STST_OK);
break;
 
case GPS_CRTL_HOME_ACTIVE: // Rueckflug zur Basis
//Der Sollwert des Lagereglers wird der Homeposition angenaehert
if (gps_rel_start_position.status >0)
{
if ((gps_updte_flag > 0) && (gps_sub_state !=GPS_HOME_FINISHED)) // nur wenn neue GPS Daten vorliegen und nicht schon alles fertig ist
{
gps_tick++;
int d1,d2,d3;
d1 = abs (gps_rel_hold_position.utm_east - gps_rel_act_position.utm_east );
d2 = abs (gps_rel_hold_position.utm_north - gps_rel_act_position.utm_north );
d3 = (dist_2home - dist_flown); // Restdistanz zum Ziel
if (d3 > GPS_G2T_DIST_MAX_STOP) // Schneller Rueckflug, noch weit weg vom Ziel
{
if ((d1 < GPS_G2T_FAST_TOL) && (d2 < GPS_G2T_FAST_TOL)) //nur weiter wenn Lage innerhalb der Toleranz
{
if (gps_g2t_act_v < GPS_G2T_V_MAX-3) gps_g2t_act_v += 4; //Geschwindigkeit erhoehen
dist_flown +=gps_g2t_act_v; // Vorgabe der Strecke anhand der Geschwindigkeit
gps_sub_state = GPS_HOME_FAST_IN_TOL;
}
else //Den Lageregler in Ruhe arbeiten lassen weil ausserhalb der Toleranz
{
if (gps_g2t_act_v > 1) gps_g2t_act_v--; // Geschwindigkeit reduzieren
// dist_flown++; //Auch ausserhalb der Toleranz langsam erhoehen
gps_sub_state = GPS_HOME_FAST_OUTOF_TOL;
}
hold_reset_int = 0; // Integrator einsschalten
hold_fast = 1; // Regler fuer schnellen Flug
dist_frm_start_east = (int)(((long)dist_flown * (long)sin_i(hdng_2home))/1000);
dist_frm_start_north = (int)(((long)dist_flown * (long)cos_i(hdng_2home))/1000);
gps_rel_hold_position.utm_east = gps_rel_start_position.utm_east + dist_frm_start_east; //naechster Zielpunkt
gps_rel_hold_position.utm_north = gps_rel_start_position.utm_north + dist_frm_start_north; //naechster Zielpunkt
}
else if (d3 > GPS_G2T_DIST_HOLD) //Das Ziel naehert sich, deswegen abbremsen
{
if ((d1 < GPS_G2T_NRML_TOL) && (d2 < GPS_G2T_NRML_TOL))
{
dist_flown += GPS_G2T_V_RAMP_DWN; // Vorgabe der Strecke anhand der Geschwindigkeit
gps_sub_state = GPS_HOME_RMPDWN_IN_TOL;
}
else
{
dist_flown++; //Auch ausserhalb der Toleranz langsam erhoehen
gps_sub_state = GPS_HOME_RMPDWN_OUTOF_TOL;
}
hold_reset_int = 0; // Integrator einsschalten
hold_fast = 1; // Regler fuer schnellen Flug
dist_frm_start_east = (int)(((long)dist_flown * (long)sin_i(hdng_2home))/1000);
dist_frm_start_north = (int)(((long)dist_flown * (long)cos_i(hdng_2home))/1000);
gps_rel_hold_position.utm_east = gps_rel_start_position.utm_east + dist_frm_start_east; //naechster Zielpunkt
gps_rel_hold_position.utm_north = gps_rel_start_position.utm_north + dist_frm_start_north; //naechster Zielpunkt
}
else //Soll-Ziel fast erreicht, Jetzt noch Reste ausgleichen, weil Zielpunkt nicht exakt bestimmt werden konnte (Fehler in Winkelfkt)
{
if ((d1 < GPS_G2T_NRML_TOL) && (d2 < GPS_G2T_NRML_TOL)) // Jetzt bis zum Zielpunkt regeln
{
gps_sub_state = GPS_HOME_IN_TOL;
hold_fast = 0; // Wieder normal regeln
hold_reset_int = 0; // Integrator einsschalten
if (gps_rel_hold_position.utm_east >= GPS_G2T_V_MIN) gps_rel_hold_position.utm_east -= GPS_G2T_V_MIN;
else if (gps_rel_hold_position.utm_east <= -GPS_G2T_V_MIN ) gps_rel_hold_position.utm_east += GPS_G2T_V_MIN;
if (gps_rel_hold_position.utm_north >= GPS_G2T_V_MIN) gps_rel_hold_position.utm_north -= GPS_G2T_V_MIN;
else if (gps_rel_hold_position.utm_north <= - GPS_G2T_V_MIN ) gps_rel_hold_position.utm_north += GPS_G2T_V_MIN;
if ((abs(gps_rel_hold_position.utm_east) <= GPS_G2T_V_MIN) && (abs(gps_rel_hold_position.utm_north) <=GPS_G2T_V_MIN))
{
gps_rel_hold_position.utm_east = 0;
gps_rel_hold_position.utm_north = 0;
gps_sub_state = GPS_HOME_FINISHED;
}
}
else gps_sub_state = GPS_HOME_OUTOF_TOL;
}
}
gps_state = GPS_CRTL_HOLD_ACTIVE; //Zwischensprung
return (GPS_STST_OK);
}
else // Keine GPS Daten verfuegbar, deswegen Abbruch
{
gps_state = GPS_CRTL_IDLE;
return (GPS_STST_ERR);
}
break;
 
 
case GPS_CRTL_HOLD_ACTIVE: // Hier werden die Daten fuer Nick und Roll errechnet
if (gps_updte_flag >0) // nur wenn neue GPS Daten vorliegen
{
gps_quiet_cnt++;
// ab hier wird geregelt
delta_east = (long) (gps_rel_act_position.utm_east - gps_rel_hold_position.utm_east);
delta_north = (long) (gps_rel_act_position.utm_north - gps_rel_hold_position.utm_north);
int_east += (int)delta_east;
int_north += (int)delta_north;
speed_east = actual_speed.speed_e;
speed_north = actual_speed.speed_n;
gps_updte_flag = 0; // Neue Werte koennen vom GPS geholt werden
dist_east = (int)delta_east; //merken
dist_north = (int)delta_north;
 
#define GPSINT_MAX 3000 // Neues Verfahren ab 30.12.2007 bei Integratoroverflow
if ((abs(int_east) > GPSINT_MAX) || (abs(int_north)> GPSINT_MAX))
{
if (int_ovfl_cnt < 40) int_ovfl_cnt += 1; // Zahl der Overflows zaehlen
}
if (int_ovfl_cnt > 0) //bei Overflow Wert Integratorwert reduzieren
{
int_ovfl_cnt -= 1;
int_east = (int_east*7)/8; // Wert reduzieren
int_north = (int_north*7)/8;
}
 
if (hold_reset_int > 0) //Im Schnellen Mode Integrator abschalten
{
int_east = 0;
int_north = 0;
}
 
//I Werte begrenzen
#define INT1_MAX (GPS_NICKROLL_MAX * GPS_V*5)/10// auf 40 Prozent des maximalen Nick/Rollwert begrenzen
int_east1 = ((((long)int_east) * Parameter_UserParam2)/32)/GPS_USR_PAR_FKT;
int_north1 = ((((long)int_north) * Parameter_UserParam2)/32)/GPS_USR_PAR_FKT;
if (int_east1 > INT1_MAX) int_east1 = INT1_MAX; //begrenzen
else if (int_east1 < -INT1_MAX) int_east1 = -INT1_MAX;
if (int_north1 > INT1_MAX) int_north1 = INT1_MAX; //begrenzen
else if (int_north1 < -INT1_MAX) int_north1 = -INT1_MAX;
 
if (hold_fast > 0) //schneller Coming Home Modus
{
amplfy_speed_east = DIFF_Y_F_MAX;
amplfy_speed_north = DIFF_Y_F_MAX;
amplfy_speed_east *= (Parameter_UserParam3/GPS_USR_PAR_FKT);
amplfy_speed_north *= (Parameter_UserParam3/GPS_USR_PAR_FKT);
speed_east = (speed_east * (long)amplfy_speed_east) /50;
speed_north = (speed_north * (long)amplfy_speed_north)/50;
// D Werte begrenzen
#define D_F_MAX (GPS_NICKROLL_MAX * GPS_V*7)/10 // auf 70 Prozent des Maximalen Nick/Rollwert begrenzen
if (speed_east > D_F_MAX) speed_east = D_F_MAX;
else if (speed_east < -D_F_MAX) speed_east = -D_F_MAX;
if (speed_north > D_F_MAX) speed_north = D_F_MAX;
else if (speed_north < -D_F_MAX) speed_north = -D_F_MAX;
 
diff_p = (Parameter_UserParam1 * GPS_PROP_FAST_V)/GPS_USR_PAR_FKT; //Verstaerkung fuer P-Anteil
}
else //langsamer Holdmodus
{
amplfy_speed_east = DIFF_Y_N_MAX;
amplfy_speed_north = DIFF_Y_N_MAX;
amplfy_speed_east *= (Parameter_UserParam3/GPS_USR_PAR_FKT);
amplfy_speed_north *= (Parameter_UserParam3/GPS_USR_PAR_FKT);
speed_east = (speed_east * (long)amplfy_speed_east) /25;
speed_north = (speed_north * (long)amplfy_speed_north)/25;
// D Werte begrenzen
#define D_N_MAX (GPS_NICKROLL_MAX * GPS_V*8)/10 // auf 80 Prozent des Maximalen Nick/Rollwert begrenzen
if (speed_east > D_N_MAX) speed_east = D_N_MAX;
else if (speed_east < -D_N_MAX) speed_east = -D_N_MAX;
if (speed_north > D_N_MAX) speed_north = D_N_MAX;
else if (speed_north < -D_N_MAX) speed_north = -D_N_MAX;
 
diff_p = (Parameter_UserParam1 * GPS_PROP_NRML_V)/GPS_USR_PAR_FKT; //Verstaerkung fuer P-Anteil
}
 
// debug_gp_4 = (int)speed_east; // zum Debuggen
// debug_gp_5 = (int)speed_north; // zum Debuggen
 
//P-Werte verstaerken
delta_east = (delta_east * (long)diff_p)/(20);
delta_north = (delta_north * (long)diff_p)/(20);
 
if (hold_fast > 0) //schneller Coming Home Modus
{
// P Werte begrenzen
#define P1_F_MAX (GPS_NICKROLL_MAX * GPS_V*8)/10 // auf 80 Prozent des Maximalen Nick/Rollwert begrenzen
if (delta_east > P1_F_MAX) delta_east = P1_F_MAX;
else if (delta_east < -P1_F_MAX) delta_east = -P1_F_MAX;
if (delta_north > P1_F_MAX) delta_north = P1_F_MAX;
else if (delta_north < -P1_F_MAX) delta_north = -P1_F_MAX;
}
else // Hold modus
{
// P Werte begrenzen
#define P1_N_MAX (GPS_NICKROLL_MAX * GPS_V*7)/10 // auf 70 Prozent des Maximalen Nick/Rollwert begrenzen
if (delta_east > P1_N_MAX) delta_east = P1_N_MAX;
else if (delta_east < -P1_N_MAX) delta_east = -P1_N_MAX;
if (delta_north > P1_N_MAX) delta_north = P1_N_MAX;
else if (delta_north < -P1_N_MAX) delta_north = -P1_N_MAX;
}
 
debug_gp_2 = (int)delta_east; // zum Debuggen
debug_gp_3 = (int)delta_north; // zum Debuggen
 
 
//PID Regler Werte aufsummieren
gps_reg_x = -(int_east1 + delta_east + speed_east); // I + P +D Anteil X Achse
gps_reg_y = -(int_north1 + delta_north + speed_north); // I + P +D Anteil Y Achse
debug_gp_0 = (int)gps_reg_x; // zum Debuggen
debug_gp_1 = (int)gps_reg_y; // zum Debuggen
 
// Werte fuer Nick und Roll direkt aus gps_reg_x und gps_reg_y bestimmen
n = GyroKomp_Int/GYROKOMP_INC_GRAD_DEFAULT; //Ausrichtung Kopter
ni = -((gps_reg_y * (long)cos_i(n)) + (gps_reg_x * (long)sin_i(n)))/(1000*GPS_V);
ro = ((gps_reg_x * (long)cos_i(n)) - (gps_reg_y * (long)sin_i(n)))/(1000*GPS_V);
if (ni > (GPS_NICKROLL_MAX )) ni = (GPS_NICKROLL_MAX);
else if (ni < -(GPS_NICKROLL_MAX )) ni = -(GPS_NICKROLL_MAX );
if (ro > (GPS_NICKROLL_MAX )) ro = (GPS_NICKROLL_MAX );
else if (ro < -(GPS_NICKROLL_MAX)) ro = -(GPS_NICKROLL_MAX );
 
if ((abs(dist_east) > GPS_DIST_MAX) || (abs(dist_north) > GPS_DIST_MAX)) // bei zu grossem Abstand abbrechen
{
GPS_Roll = 0;
GPS_Nick = 0;
gps_state = GPS_CRTL_IDLE;
return (GPS_STST_ERR);
break;
}
else if ((PPM_in[7] > 100) && (CAM_GPS_QUIET > 0) && (gps_quiet_cnt <=4) ) // Wenn Fotoausloeser gedruckt wird, GPS Stellwerte kurzzeitig auf 0 setzen
{
gps_quiet_cnt++;
GPS_Roll = 0;
GPS_Nick = 0;
if ( cmd == GPS_CMD_REQ_HOME ) gps_state = GPS_CRTL_HOME_ACTIVE; // State umsetzen
return (GPS_STST_OK);
}
else if ((PPM_in[7] < 50) && (CAM_GPS_QUIET > 0) && (gps_quiet_cnt >= 4))
{
gps_quiet_cnt = 0;
if ( cmd == GPS_CMD_REQ_HOME ) gps_state = GPS_CRTL_HOME_ACTIVE; // State umsetzen
return (GPS_STST_OK);
}
else
{
GPS_Roll = (int)ro;
GPS_Nick = (int)ni;
if ( cmd == GPS_CMD_REQ_HOME ) gps_state = GPS_CRTL_HOME_ACTIVE; // State umsetzen
return (GPS_STST_OK);
}
}
else
{
if ( cmd == GPS_CMD_REQ_HOME ) gps_state = GPS_CRTL_HOME_ACTIVE; // State umsetzen
return (GPS_STST_OK);
}
break;
 
default:
gps_state = GPS_CRTL_IDLE;
return (GPS_STST_ERR);
break;
}
return (GPS_STST_ERR);
}
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/License_GPL.txt
0,0 → 1,674
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
Preamble
 
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
 
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
 
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
 
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
 
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
 
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
 
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
 
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
 
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
 
The precise terms and conditions for copying, distribution and
modification follow.
 
TERMS AND CONDITIONS
 
0. Definitions.
 
"This License" refers to version 3 of the GNU General Public License.
 
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
 
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
 
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
 
A "covered work" means either the unmodified Program or a work based
on the Program.
 
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
 
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
 
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
 
1. Source Code.
 
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
 
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
 
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
 
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
 
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
 
The Corresponding Source for a work in source code form is that
same work.
 
2. Basic Permissions.
 
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
 
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
 
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
 
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
 
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
 
4. Conveying Verbatim Copies.
 
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
 
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
 
5. Conveying Modified Source Versions.
 
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
 
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
 
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
 
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
 
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
 
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
 
6. Conveying Non-Source Forms.
 
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
 
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
 
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
 
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
 
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
 
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
 
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
 
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
 
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
 
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
 
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
 
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
 
7. Additional Terms.
 
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
 
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
 
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
 
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
 
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
 
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
 
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
 
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
 
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
 
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
 
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
 
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
 
8. Termination.
 
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
 
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
 
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
 
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
 
9. Acceptance Not Required for Having Copies.
 
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
 
10. Automatic Licensing of Downstream Recipients.
 
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
 
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
 
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
 
11. Patents.
 
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
 
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
 
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
 
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
 
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
 
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
 
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
 
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
 
12. No Surrender of Others' Freedom.
 
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
 
13. Use with the GNU Affero General Public License.
 
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
 
14. Revised Versions of this License.
 
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
 
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
 
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
 
15. Disclaimer of Warranty.
 
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 
16. Limitation of Liability.
 
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
 
17. Interpretation of Sections 15 and 16.
 
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
 
END OF TERMS AND CONDITIONS
 
How to Apply These Terms to Your New Programs
 
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
 
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
 
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
 
This program 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 3 of the License, or
(at your option) any later version.
 
This program 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 program. If not, see <http://www.gnu.org/licenses/>.
 
Also add information on how to contact you by electronic and paper mail.
 
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
 
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
 
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
 
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
 
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
/branches/salvo_gps/Basis_v0067g/tags/v0007/License_LPGL.txt
0,0 → 1,165
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
 
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
 
 
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
 
0. Additional Definitions.
 
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
 
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
 
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
 
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
 
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
 
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
 
1. Exception to Section 3 of the GNU GPL.
 
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
 
2. Conveying Modified Versions.
 
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
 
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
 
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
 
3. Object Code Incorporating Material from Library Header Files.
 
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
 
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the object code with a copy of the GNU GPL and this license
document.
 
4. Combined Works.
 
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
 
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
 
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
 
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
 
d) Do one of the following:
 
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
 
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
 
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
 
5. Combined Libraries.
 
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
 
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
 
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
 
6. Revised Versions of the GNU Lesser General Public License.
 
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
 
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
 
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
/branches/salvo_gps/Basis_v0067g/tags/v0007/License_buss.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/salvo_gps/Basis_v0067g/tags/v0007/README_Gps_Deutsch.txt
0,0 → 1,90
*********************************************************************
GPS Implementierung von Peter Muehlenbrock ("Salvo") für Mikrokopter/FlightCrtl
Stand 21.1.2008
Verwendung der SW ohne Gewaehr. Siehe auch die Lizenzbedingungen in File Licensce_LPGL.txt und Licensce_GPL.txt
Die Version basiert auf Holgers V00.67g.
*********************************************************************
Hardware-Voraussetzungen:
Kalibrierter Kompass vom Typ CMPS03, waagrecht eingebaut
GPS Modul vom Typ ublox, Die Meldungungen "NAV_STATUS", "NAV_POSUTM" und "NAV_VELNED"
mussen mit 4 HZ Updaterate aktiviert sein. Alle Meldungen im NMEA Format muessen deaktivert sein.
Anschluss an RX Port der FlightCRtl. Baudrate ist 57600 wie beim Kopter Tool.
 
Software-Voraussetzungen:
In timer0.h muss die Ausrichtung des Kompasses bezogen auf die Nordachse des Kopters
eingetragen sein. Wenn KOMPASS_OFFSET > 0 wird dieser Wert genommen
Wenn KOMPASS_OFFSET = 0 ist wird der UserParameter4 verwendet (=hexfile). Da die Userparameter nur ein Byte lang sind werden
Offsets von 0...358 Grad durch einen Wert von 0...179 dargestellt.
 
Betriebs-Voraussetzungen:
Damit der Kompass sauber funktioniert, muss die waagrechte Lage (Gashebel Vollanschlag und Gier rechts)
im Eeprom abgespeichert worden sein.
 
Parametrierung:
Der GPS Hold Regler ist ein PID Regler, der ueber die UserParameter1(P), 2(I) und D(3) gesteuert wird.
UserParameter1 beschreibt den P(roportional)-Anteil, UserParameter2 den I(ntegral)-Anteil und UserParameter3 den D(ifferential)-Anteil.
Hier kann und muss gespielt werden.Alle Parameter koennen direkt im Mikrokoptertool in den Settings eingestellt werden.
 
Der P-Anteil wirkt einer Lageänderung entgegen. Je größer er ist, desto geringer die Regelabweichung, desto höher aber auch die Schwingneigung.
Der D-Anteil wirkt einer Geschwindigkeitsänderung entgegen und dient zur Reduzierung von Schwingungen, darf aber auch nicht zu gross sein.
Der I-Anteil dient nur dazu die Lageabweichung auf Null zu bringen.
P und D Anteil mussen gut aufeinander abgestimmt sein, damit die Einschwingzeit klein bei gleichzeitig geringer Schwingneigung ist.
Standarddwerte für P,I,D sind 80,16,80.
Wenn alle 0 sind, ist der Regler deaktiviert.
 
Voraussetzungen für GPS_Hold:
Neben den genannten HW und SW Voraussetzungen muß beim Kalibrieren das GPS MOdul bereits Positionsdaten liefern.
Nur dann wird die Home Position abgespeichert und nur dann wird GPS_Hold aktiviert.
Kenntlich gemacht wird dies durch einen etwas längeren Piepser nach dem Kalibrieren. Die Rote Led auf der FlightCrtl blitzt bei jedem Empfang eines kompletten
und korrekten Meldungsset ( "NAV_STATUS", "NAV_POSUTM" und "NAV_VELNED").
Das GPS Aktiv Flag im Setting muss aktiviert sein.
Eine Ausrichtung des Kopters nach Nord etc. ist nicht erforderlich.
 
Aktivierung GPS_Hold im Flug:
Wenn alle genannten Voraussetzungen erfüllt sind, wird GPS Hold im Flug automatisch aktiviert, sobald der Nick und Roll Stick
für ca. 500msec in Neutrallage sind. Weicht einer der Sticks davon ab (Parameter GPS_STICK_HOLDOFF) oder liefert das GPS Modul oder fällt der
Kompass aus wird GPS_Hold sofort deaktiviert.
Damit kann jederzeit die manuelle Kontrolle wieder übernommen werden.
 
GPS_Hold regelt nur horizontale Abweichungen, keine Hoehe.
Der Magnetkompass wird nur in waagrechter Lage dazu benutzt einen internen aus dem Giergyro ermittelten "Ersatz"kompasswert
nach zu kalibrieren. Daher funktioniert die Bstimmung der Kopterausrichtung in jeder Lebenslage, sofern nur ab und zu
der Magnetkompass in die waagrechte Lage kommt. Da der Giergyro per Kompass automatisch offsetkorrigiert wird, ist er spätestens nach
einigen wenigen Minuten auch bei Temperatursprüngen ausreichend stabil.
Ein 3D Kompass ist damit überflüssig.
Die GPS Regelung benötigt zwar pro Durchlauf eine erhebliche Rechenzeit. Da sie aber nur einmal je neuem Meldungsblock vom
GPS Modul (also alle 250ms) aufgerufen wird, wird die Gesamtbelastung der CPU nur minimal erhöht.
Ein externes Naviboard ist daher nicht notwendig.
 
GPS Rücksturz zur Basis (GPS Home) Funktion
Voraussetzungen wie bei GPS Hold.
Die Funktion kann im Flug aktiviert werden durch Setzen des Hoehenreglerschalters.
Holgers Code habe ich so abgeändert daß der Höhenregler mit "Parameter_MaxHoehe" ab 50 aktiviert wird.
Mit einem Schalter mit Neutrallage können damit die Funktionen
Alles aus - Hoehenregler ein, GPS Home Aus - Hoehenregler Ein UND GPS Home ein
aktiviert werden. Ist noch nicht die beste Lösung und werde ich noch anpassen
 
Weitere Änderungen:
-Bei Unterschreiten der eingestellten Warnschwelle für UBAT ertönt zunächst wie gewohnt der Piepser. Geht die Spannung weiter
runter wird zwangsweise die Gaseinstellung langsam reduziert um den Kopter zum Landen zu bringen.
 
-Der Ausgang PC6 kann benutzt werden um einen Externen Multiplexer zu schalten. Dieser schaltet entweder die GPS Daten
(Wenn Motoren eingeschaltet sind) oder den Ausgang des Bluetoothmoduls (wenn Motoren ausgeschaltet sind) auf den RX
Eingang der FlightCrtl. Damit kann eine zweite UART Schnittstelle bzw. die manuelle Umschaltung entfallen
 
-Bei vorhandenem Kompass wird eine automatische Kompensation der Giergyrodrift durchgeführt.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/README_Gps_English.txt
0,0 → 1,66
*********************************************************************
GPS Implementation by Peter Muehlenbrock ("Salvo") for Mikrokopter/FlightCrtl
As of Jan, 20th 2007
Please note the files Licensce_LPGL.txt and Licensce_GPL.txt
This SW is based on Holgers V00.67g.
*********************************************************************
Hardware-requirements:
Calibrated compass of type CMPS03, horizontally adjusted
GPS module of type ublox, The messages "NAV_STATUS", "NAV_POSUTM" and "NAV_VELNED"
must be activated with 4 HZ update rate. All messages of type NMEA should be disabled.
The TX port of the GPS module must be connected to the RX input of the Flight Crtl. Baudrate is 57600 (like Kopter Tool).
 
UserParameter 4 tells the software the orientation for the compass. The difference between the "north" direction
( = Motor "vorne" or 1 as described in Holgers Flight Crtl manual) of the kopter
and the north direction of the compass is represented as follows: 0...360 degree offset corresponds to a value of 0...180.
(A userparameter ist only 1 byte long and therefore can not directly represent 0..360 degree). Please check the
correct value via the Koptertool. The "Kompass" debug value has to show the correct orientation:
kopter Motor vorne orientated to north => value approx 0 Degree)
 
Other requirements:
Please calibrate the ACC Sensor values (pitch full, yaw full right) in horizontal orientation of the kopter
as exactly as possible.
 
Parameters:
The GPS Hold regulator is of type PID: UserParameter1 =P(proportional), UserParameter2 = I(ntegral),
UserParameter3 = D(ifferential). Standardvalues for P,I and D are 80,16,80.
The I-Part may be set to 0 if a small deviation from hold position is acceptable. The D-Part is important to avoid
oscillating.
Please find out the best values yourself.
It might be useful to put the P and D Part on potis and test the behaviour in flight.
 
Requirements for GPS_Hold:
The gps module has do provide a 3D-fix. If succesfull, you can hear a longer beep when performing a gyro calibration.
Without a succesfull position fix at calibration the GPS functionality ist completely disabled.
The red led on the FlightCrtl flashes with a 4 Hz rate if the gps module delivers a position fix.
 
Enabling GPS_Hold in fligh:
GPS Hold is automatically activated if the sticks for roll and nick are in neutral position for about 400ms.
Moving the stick immediately disables the Hold mode. The GPS Hold function doesn not change height, pitch or yaw.
 
 
GPS Coming-Home function
The coming-home function is activated by the same switch as for the height regulator, if the switch is set to maximum.
The height regulator itself is activated at approx. Maximum/2.
 
 
Other changes:
- automatic pitch reduction if the battery voltage falls more than 0.2V below the warning limit.
- Output PC6 can be used to switch TX data between a Bluetooth and the GPS Module (further hardware required) to the RX input of the FlightCrtl
- automatic Yaw gyro compensation if compass is available.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/Settings.h
--- tags/v0007/_Settings.h (nonexistent)
+++ tags/v0007/_Settings.h (revision 672)
@@ -0,0 +1,50 @@
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Testmodi
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#define MOTOR_OFF 0
+#define MOTOR_TEST 0
+
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Abstimmung
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#define ACC_AMPLIFY 16
+#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 Debugdaten 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/salvo_gps/Basis_v0067g/tags/v0007/analog.c
0,0 → 1,145
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + 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 AdWertNick = 0, AdWertRoll = 0, AdWertGier = 0;
volatile int AdWertAccRoll = 0,AdWertAccNick = 0,AdWertAccHoch = 0;
volatile char MessanzahlNick = 0, MessanzahlRoll = 0, MessanzahlGier = 0;
volatile char messanzahl_AccNick = 0, messanzahl_AccRoll = 0, messanzahl_AccHoch = 0;
volatile long Luftdruck = 32000;
volatile int StartLuftdruck;
volatile unsigned int MessLuftdruck = 1023;
unsigned char DruckOffsetSetting;
volatile int HoeheD = 0;
volatile char messanzahl_Druck;
volatile int tmpLuftdruck;
volatile unsigned int ZaehlMessungen = 0;
 
//#######################################################################################
//
void ADC_Init(void)
//#######################################################################################
{
ADMUX = 0;//Referenz ist extern
ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADATE)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADIE);
//Free Running Mode, Division Factor 128, Interrupt on
}
 
void SucheLuftruckOffset(void)
{
unsigned int off;
off = eeprom_read_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET]);
if(off > 20) off -= 10;
OCR0A = off;
Delay_ms_Mess(100);
if(MessLuftdruck < 850) off = 0;
for(; off < 250;off++)
{
OCR0A = off;
Delay_ms_Mess(50);
printf(".");
if(MessLuftdruck < 900) break;
}
eeprom_write_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET], off);
DruckOffsetSetting = off;
Delay_ms_Mess(300);
}
 
 
//#######################################################################################
//
SIGNAL(SIG_ADC)
//#######################################################################################
{
static unsigned char kanal=0,state = 0;
static unsigned int gier1, roll1, nick1;
ANALOG_OFF;
switch(state++)
{
case 0:
gier1 = ADC;
kanal = 1;
ZaehlMessungen++;
break;
case 1:
roll1 = ADC;
kanal = 2;
break;
case 2:
nick1 = ADC;
kanal = 4;
break;
case 3:
UBat = (3 * UBat + ADC / 3) / 4;//(UBat + ((ADC * 39) / 256) + 19) / 2;
kanal = 6;
break;
case 4:
Aktuell_ay = NeutralAccY - ADC;
AdWertAccRoll = Aktuell_ay;
kanal = 7;
break;
case 5:
Aktuell_ax = ADC - NeutralAccX;
AdWertAccNick = Aktuell_ax;
kanal = 0;
break;
case 6:
if(PlatinenVersion == 10) AdWertGier = (ADC + gier1) / 2;
else AdWertGier = ADC + gier1;
kanal = 1;
break;
case 7:
if(PlatinenVersion == 10) AdWertRoll = (ADC + roll1) / 2;
else AdWertRoll = ADC + roll1;
kanal = 2;
break;
case 8:
if(PlatinenVersion == 10) AdWertNick = (ADC + nick1) / 2;
else AdWertNick = ADC + nick1;
kanal = 5;
break;
case 9:
AdWertAccHoch = (signed int) ADC - NeutralAccZ;
AdWertAccHoch += abs(Aktuell_ay) / 4 + abs(Aktuell_ax) / 4;
if(AdWertAccHoch > 1)
{
if(NeutralAccZ < 800) NeutralAccZ+= 0.02;
}
else if(AdWertAccHoch < -1)
{
if(NeutralAccZ > 600) NeutralAccZ-= 0.02;
}
messanzahl_AccHoch = 1;
Aktuell_az = ADC;
Mess_Integral_Hoch += AdWertAccHoch; // Integrieren
Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen
kanal = 3;
break;
case 10:
tmpLuftdruck += ADC;
if(++messanzahl_Druck >= 5)
{
MessLuftdruck = ADC;
messanzahl_Druck = 0;
HoeheD = (int)(StartLuftdruck - tmpLuftdruck - HoehenWert); // D-Anteil = neuerWert - AlterWert
Luftdruck = (tmpLuftdruck + 3 * Luftdruck) / 4;
HoehenWert = StartLuftdruck - Luftdruck;
tmpLuftdruck = 0;
}
kanal = 0;
state = 0;
break;
default:
kanal = 0;
state = 0;
break;
}
ADMUX = kanal;
if(state != 0) ANALOG_ON;
}
/branches/salvo_gps/Basis_v0067g/tags/v0007/analog.h
0,0 → 1,24
/*#######################################################################################
 
#######################################################################################*/
 
extern volatile int UBat;
extern volatile int AdWertNick, AdWertRoll, AdWertGier;
extern volatile int AdWertAccRoll,AdWertAccNick,AdWertAccHoch;
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 volatile int HoeheD;
extern volatile unsigned int MessLuftdruck;
extern volatile int StartLuftdruck;
extern volatile char MessanzahlNick;
 
unsigned int ReadADC(unsigned char adc_input);
void ADC_Init(void);
void SucheLuftruckOffset(void);
 
 
#define ANALOG_OFF ADCSRA=0
#define ANALOG_ON ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADATE)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADIE)
/branches/salvo_gps/Basis_v0067g/tags/v0007/eeprom.c
0,0 → 1,183
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Konstanten
// + 0-250 -> normale Werte
// + 251 -> Poti1
// + 252 -> Poti2
// + 253 -> Poti3
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DefaultKonstanten1(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;
EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV;//CFG_HOEHENREGELUNG | /*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV | CFG_KOMPASS_FIX;//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 = 50; // Wert : 0-250
EE_Parameter.Hoehe_ACC_Wirkung = 50; // Wert : 0-250
EE_Parameter.Hoehe_Verstaerkung = 4; // Wert : 0-50
EE_Parameter.Stick_P = 3; //2 // Wert : 1-6
//EE_Parameter.Stick_D = 8; //8 // Wert : 0-64
EE_Parameter.Stick_D = 4; //8 // Wert : 0-64 Salvo
EE_Parameter.Gier_P = 14; // Wert : 1-20
EE_Parameter.Gas_Min = 15; // Wert : 0-32
EE_Parameter.Gas_Max = 250; // Wert : 33-250
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64
EE_Parameter.KompassWirkung = 128; // Wert : 0-250
EE_Parameter.Gyro_P = 120; //80 // Wert : 0-250
EE_Parameter.Gyro_I = 150; // Wert : 0-250
EE_Parameter.UnterspannungsWarnung = 98; // Wert : 0-250
EE_Parameter.NotGas = 95; // Wert : 0-250 // Gaswert bei Empangsverlust
EE_Parameter.NotGasZeit = 60; // 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 = 90; // P Anteil GPS
EE_Parameter.UserParam2 = 24; // I Anteil GPS
EE_Parameter.UserParam3 = 130; //D Anteil GPS
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.LoopConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
EE_Parameter.AchsKopplung1 = 100;
EE_Parameter.AchsGegenKopplung1 = 10;
EE_Parameter.WinkelUmschlagNick = 100;
EE_Parameter.WinkelUmschlagRoll = 100;
EE_Parameter.GyroAccAbgleich = 50; // 1/k
EE_Parameter.Driftkomp = 4;
EE_Parameter.DynamicStability = 100;
memcpy(EE_Parameter.Name, "Sport\0", 12);
}
void DefaultKonstanten2(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;
EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV;//CFG_HOEHENREGELUNG | /*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 = 50; // Wert : 0-250
EE_Parameter.Hoehe_ACC_Wirkung = 50; // Wert : 0-250
EE_Parameter.Hoehe_Verstaerkung = 2; // Wert : 0-50
EE_Parameter.Stick_P = 4; //2 // Wert : 1-6
EE_Parameter.Stick_D = 0; //8 // Wert : 0-64
EE_Parameter.Gier_P = 10; // Wert : 1-20
EE_Parameter.Gas_Min = 15; // Wert : 0-32
EE_Parameter.Gas_Max = 250; // Wert : 33-250
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64
EE_Parameter.KompassWirkung = 128; // Wert : 0-250
EE_Parameter.Gyro_P = 175; //80 // Wert : 0-250
EE_Parameter.Gyro_I = 175; // Wert : 0-250
EE_Parameter.UnterspannungsWarnung = 98; // Wert : 0-250
EE_Parameter.NotGas = 95; // Wert : 0-250 // Gaswert bei Empangsverlust
EE_Parameter.NotGasZeit = 60; // 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 = 20 * 4; // 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.LoopConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts
EE_Parameter.AchsKopplung1 = 100; // Faktor, mit dem Gier die Achsen Roll und Nick verkoppelt
EE_Parameter.AchsGegenKopplung1 = 10;
EE_Parameter.WinkelUmschlagNick = 100;
EE_Parameter.WinkelUmschlagRoll = 100;
EE_Parameter.GyroAccAbgleich = 100; // 1/k
EE_Parameter.Driftkomp = 4;
EE_Parameter.DynamicStability = 75;
memcpy(EE_Parameter.Name, "Normal\0", 12);
}
 
void DefaultKonstanten3(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;
EE_Parameter.GlobalConfig = CFG_DREHRATEN_BEGRENZER | CFG_ACHSENKOPPLUNG_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 = 50; // Wert : 0-250
EE_Parameter.Hoehe_ACC_Wirkung = 50; // Wert : 0-250
EE_Parameter.Hoehe_Verstaerkung = 2; // Wert : 0-50
EE_Parameter.Stick_P = 3; //2 // Wert : 1-6
EE_Parameter.Stick_D = 0; //8 // Wert : 0-64
EE_Parameter.Gier_P = 8; // Wert : 1-20
EE_Parameter.Gas_Min = 15; // Wert : 0-32
EE_Parameter.Gas_Max = 250; // Wert : 33-250
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64
EE_Parameter.KompassWirkung = 128; // Wert : 0-250
EE_Parameter.Gyro_P = 200; //80 // Wert : 0-250
EE_Parameter.Gyro_I = 175; // Wert : 0-250
EE_Parameter.UnterspannungsWarnung = 98; // Wert : 0-250
EE_Parameter.NotGas = 95; // Wert : 0-250 // Gaswert bei Empangsverlust
EE_Parameter.NotGasZeit = 60; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation
EE_Parameter.I_Faktor = 10;
EE_Parameter.UserParam1 = 20 * 4; // 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.LoopConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts
EE_Parameter.AchsKopplung1 = 100; // Faktor, mit dem Gier die Achsen Roll und Nick verkoppelt
EE_Parameter.AchsGegenKopplung1 = 10;
EE_Parameter.WinkelUmschlagNick = 100;
EE_Parameter.WinkelUmschlagRoll = 100;
EE_Parameter.GyroAccAbgleich = 100; // 1/k
EE_Parameter.Driftkomp = 4;
EE_Parameter.DynamicStability = 50;
memcpy(EE_Parameter.Name, "Beginner\0", 12);
}
/branches/salvo_gps/Basis_v0067g/tags/v0007/fc.c
0,0 → 1,1384
/*#######################################################################################
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.
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Aenderungen von Peter Muehlenbrock ("Salvo") Stand 9.11.2008
/*
Driftkompensation fuer Gyros verbessert
Linearsensor optional mit fixem Neutralwert
Ersatzkompass abgeleitet aus Magnetkompass und Giergyro fuer nahezu neigungsunabhaengige Kompassfunktion
*/
 
#include "main.h"
#include "eeprom.c"
 
unsigned char h,m,s;
volatile unsigned int I2CTimeout = 100;
volatile int MesswertNick,MesswertRoll,MesswertGier;
volatile int AdNeutralNick = 0,AdNeutralRoll = 0,AdNeutralGier = 0,StartNeutralRoll = 0,StartNeutralNick = 0;
volatile int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch, NeutralAccX=0, NeutralAccY=0;
volatile float NeutralAccZ = 0;
unsigned char CosinusNickWinkel = 0, CosinusRollWinkel = 0;
volatile long IntegralNick = 0,IntegralNick2 = 0;
volatile long IntegralRoll = 0,IntegralRoll2 = 0;
volatile long IntegralAccNick = 0,IntegralAccRoll = 0,IntegralAccZ = 0;
volatile long Integral_Gier = 0;
volatile long Mess_IntegralNick = 0,Mess_IntegralNick2 = 0;
volatile long Mess_IntegralRoll = 0,Mess_IntegralRoll2 = 0;
volatile long Mess_Integral_Gier = 0,Mess_Integral_Gier2 = 0;
volatile long MittelIntegralNick,MittelIntegralRoll,MittelIntegralNick2,MittelIntegralRoll2;
volatile long Mess_Integral_Hoch = 0;
volatile int KompassValue = 0;
volatile int KompassStartwert = 0;
volatile int KompassRichtung = 0;
unsigned char MAX_GAS,MIN_GAS;
unsigned char Notlandung = 0;
unsigned char HoehenReglerAktiv = 0;
long Umschlag180Nick = 250000L, Umschlag180Roll = 250000L;
 
//Salvo 12.10.2007
uint8_t magkompass_ok=0;
uint8_t gps_cmd = GPS_CMD_STOP;
static int ubat_cnt =0;
static int gas_actual,gas_mittel; //Parameter fuer Gasreduzierung bei unterspannung
int w,v;
//Salvo End
 
//Salvo 15.12.2007 Ersatzkompass und Giergyrokompensation
long GyroKomp_Int;
long int GyroGier_Comp;
int GyroKomp_Value; // Der ermittelte Kompasswert aus Gyro und Magnetkompass
short int cnt_stickgier_zero =0;
int gyrogier_kompass;
//Salvo End
 
//Salvo 2.1.2008 Allgemeine Debugvariablen
int debug_gp_0,debug_gp_1,debug_gp_2,debug_gp_3,debug_gp_4,debug_gp_5,debug_gp_6,debug_gp_7;
//Salvo End
 
float GyroFaktor;
float IntegralFaktor;
volatile int DiffNick,DiffRoll;
int Poti1 = 0, Poti2 = 0, Poti3 = 0, Poti4 = 0;
volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
unsigned char MotorWert[5];
volatile unsigned char SenderOkay = 0;
int StickNick = 0,StickRoll = 0,StickGier = 0;
char MotorenEin = 0;
int HoehenWert = 0;
int SollHoehe = 0;
int LageKorrekturRoll = 0,LageKorrekturNick = 0;
float Ki = FAKTOR_I;
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_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 = 0;
unsigned char Parameter_AchsGegenKopplung1 = 0;
unsigned char Parameter_DynamicStability = 100;
struct mk_param_struct EE_Parameter;
signed int ExternStickNick = 0,ExternStickRoll = 0,ExternStickGier = 0, ExternHoehenValue = -20;
 
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)
//############################################################################
{
// Salvo 9.12.2007
RX_SWTCH_ON; //GPS Daten auf RX eingang schalten
// Salvo End
NeutralAccX = 0;
NeutralAccY = 0;
NeutralAccZ = 0;
AdNeutralNick = 0;
AdNeutralRoll = 0;
AdNeutralGier = 0;
Parameter_AchsKopplung1 = 0;
Parameter_AchsGegenKopplung1 = 0;
CalibrierMittelwert();
Delay_ms_Mess(100);
CalibrierMittelwert();
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert?
{
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset();
}
 
AdNeutralNick= AdWertNick;
AdNeutralRoll= AdWertRoll;
AdNeutralGier= AdWertGier;
StartNeutralRoll = AdNeutralRoll;
StartNeutralNick = AdNeutralNick;
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACC_NICK]) > 4)
{
NeutralAccY = abs(Mittelwert_AccRoll) / ACC_AMPLIFY;
NeutralAccX = abs(Mittelwert_AccNick) / 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]);
}
Mess_IntegralNick = 0;
Mess_IntegralNick2 = 0;
Mess_IntegralRoll = 0;
Mess_IntegralRoll2 = 0;
Mess_Integral_Gier = 0;
MesswertNick = 0;
MesswertRoll = 0;
MesswertGier = 0;
GyroGier_Comp =0;
StartLuftdruck = Luftdruck;
HoeheD = 0;
Mess_Integral_Hoch = 0;
KompassStartwert = KompassValue;
GPS_Neutral();
beeptime = 50;
Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L;
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L;
ExternHoehenValue = 0;
 
 
//Salvo 13.10.2007 Ersatzkompass und Gas
GyroKomp_Int = KompassValue * GYROKOMP_INC_GRAD_DEFAULT; //Neu ab 3.1.2007
gas_mittel = 30;
gas_actual = gas_mittel;
// Salvo End
}
 
//############################################################################
// Bearbeitet die Messwerte
void Mittelwert(void)
//############################################################################
{
static signed long tmpl,tmpl2;
MesswertGier = (signed int) AdNeutralGier - AdWertGier;
MesswertRoll = (signed int) AdWertRoll - AdNeutralRoll;
MesswertNick = (signed int) AdWertNick - AdNeutralNick;
 
// Beschleunigungssensor ++++++++++++++++++++++++++++++++++++++++++++++++
Mittelwert_AccNick = ((long)Mittelwert_AccNick * 1 + ((ACC_AMPLIFY * (long)AdWertAccNick))) / 2L;
Mittelwert_AccRoll = ((long)Mittelwert_AccRoll * 1 + ((ACC_AMPLIFY * (long)AdWertAccRoll))) / 2L;
Mittelwert_AccHoch = ((long)Mittelwert_AccHoch * 1 + ((long)AdWertAccHoch)) / 2L;
IntegralAccNick += ACC_AMPLIFY * AdWertAccNick;
IntegralAccRoll += ACC_AMPLIFY * AdWertAccRoll;
IntegralAccZ += Aktuell_az - NeutralAccZ;
// Gier ++++++++++++++++++++++++++++++++++++++++++++++++
//Salvo 12.11.2007
GyroKomp_Int += (long)MesswertGier;
GyroGier_Comp += (long)MesswertGier;
//Salvo End
Mess_Integral_Gier += MesswertGier;
Mess_Integral_Gier2 += MesswertGier;
// Kopplungsanteil +++++++++++++++++++++++++++++++++++++
if(!Looping_Nick && !Looping_Roll && (EE_Parameter.GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV))
{
tmpl = Mess_IntegralNick / 4096L;
tmpl *= MesswertGier;
tmpl *= Parameter_AchsKopplung1; //125
tmpl /= 2048L;
tmpl2 = Mess_IntegralRoll / 4096L;
tmpl2 *= MesswertGier;
tmpl2 *= Parameter_AchsKopplung1;
tmpl2 /= 2048L;
}
else tmpl = tmpl2 = 0;
// Roll ++++++++++++++++++++++++++++++++++++++++++++++++
MesswertRoll += tmpl;
MesswertRoll += (tmpl2*Parameter_AchsGegenKopplung1)/512L; //109
Mess_IntegralRoll2 += MesswertRoll;
Mess_IntegralRoll += MesswertRoll - LageKorrekturRoll;
if(Mess_IntegralRoll > Umschlag180Roll)
{
Mess_IntegralRoll = -(Umschlag180Roll - 10000L);
Mess_IntegralRoll2 = Mess_IntegralRoll;
}
if(Mess_IntegralRoll <-Umschlag180Roll)
{
Mess_IntegralRoll = (Umschlag180Roll - 10000L);
Mess_IntegralRoll2 = Mess_IntegralRoll;
}
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 > 2020) MesswertRoll = +1000;
if(AdWertRoll > 2034) MesswertRoll = +2000;
}
// Nick ++++++++++++++++++++++++++++++++++++++++++++++++
MesswertNick -= tmpl2;
MesswertNick -= (tmpl*Parameter_AchsGegenKopplung1)/512L;
Mess_IntegralNick2 += MesswertNick;
Mess_IntegralNick += MesswertNick - LageKorrekturNick;
if(Mess_IntegralNick > Umschlag180Nick)
{
Mess_IntegralNick = -(Umschlag180Nick - 10000L);
Mess_IntegralNick2 = Mess_IntegralNick;
}
if(Mess_IntegralNick <-Umschlag180Nick)
{
Mess_IntegralNick = (Umschlag180Nick - 10000L);
Mess_IntegralNick2 = Mess_IntegralNick;
}
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 > 2020) MesswertNick = +1000;
if(AdWertNick > 2034) MesswertNick = +2000;
}
//++++++++++++++++++++++++++++++++++++++++++++++++
// ADC einschalten
ANALOG_ON;
//++++++++++++++++++++++++++++++++++++++++++++++++
 
Integral_Gier = Mess_Integral_Gier;
IntegralNick = Mess_IntegralNick;
IntegralRoll = Mess_IntegralRoll;
IntegralNick2 = Mess_IntegralNick2;
IntegralRoll2 = Mess_IntegralRoll2;
 
if(EE_Parameter.GlobalConfig & CFG_DREHRATEN_BEGRENZER && !Looping_Nick && !Looping_Roll)
{
if(MesswertNick > 200) MesswertNick += 4 * (MesswertNick - 200);
else if(MesswertNick < -200) MesswertNick += 4 * (MesswertNick + 200);
if(MesswertRoll > 200) MesswertRoll += 4 * (MesswertRoll - 200);
else if(MesswertRoll < -200) MesswertRoll += 4 * (MesswertRoll + 200);
}
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)
//############################################################################
{
// 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.WinkelUmschlagNick * 2500L;
}
 
//############################################################################
// Senden der Motorwerte per I2C-Bus
void SendMotorData(void)
//############################################################################
{
if(MOTOR_OFF || !MotorenEin)
{
Motor_Hinten = 0;
Motor_Vorne = 0;
Motor_Rechts = 0;
Motor_Links = 0;
if(MotorTest[0]) Motor_Vorne = MotorTest[0];
if(MotorTest[1]) Motor_Hinten = MotorTest[1];
if(MotorTest[2]) Motor_Links = MotorTest[2];
if(MotorTest[3]) Motor_Rechts = MotorTest[3];
}
 
DebugOut.Analog[12] = Motor_Vorne;
DebugOut.Analog[13] = Motor_Hinten;
DebugOut.Analog[14] = Motor_Links;
DebugOut.Analog[15] = Motor_Rechts;
 
//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(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;}
CHK_POTI(Parameter_MaxHoehe,EE_Parameter.MaxHoehe,0,255);
CHK_POTI(Parameter_Luftdruck_D,EE_Parameter.Luftdruck_D,0,100);
CHK_POTI(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(Parameter_Gyro_P,EE_Parameter.Gyro_P,10,255);
CHK_POTI(Parameter_Gyro_I,EE_Parameter.Gyro_I,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_AchsGegenKopplung1,EE_Parameter.AchsGegenKopplung1,0,255);
CHK_POTI(Parameter_DynamicStability,EE_Parameter.DynamicStability,0,255);
 
Ki = (float) Parameter_I_Faktor * 0.0001;
MAX_GAS = EE_Parameter.Gas_Max;
MIN_GAS = EE_Parameter.Gas_Min;
}
 
 
//############################################################################
//
void MotorRegler(void)
//############################################################################
{
int motorwert,pd_ergebnis,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 unsigned int modell_fliegt = 0;
static int hoehenregler = 0;
static char TimerWerteausgabe = 0;
static char NeueKompassRichtungMerken = 0;
static long ausgleichNick, ausgleichRoll;
Mittelwert();
//****** GPS Daten holen ***************
short int n;
if (gps_alive_cnt > 0) gps_alive_cnt--; //Dekrementieren. Wenn 0 kommen keine ausreichenden GPS Meldungen (Timeout)
n = Get_Rel_Position();
if (n == 0)
{
ROT_ON; //led blitzen lassen
}
//******PROVISORISCH***************
GRN_ON;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gaswert ermitteln
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
GasMischanteil = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] + 120;
if(GasMischanteil > MAX_GAS - 20) GasMischanteil = MAX_GAS - 20;
//Salvo 13.10.2007 langsame Gasreduktion bei Unterspannung. Als Ausgangswert wird der bei UBAT=k gemessen Mittelwert genommen
// und dieser dann langsam zwangsweise reduziert
if (UBat <= EE_Parameter.UnterspannungsWarnung - 4) //Unterhalb der Piepser Schwelle aktivieren
{
if (ubat_cnt > 1000)
{
ubat_cnt = 0;
if (gas_actual > ((gas_mittel*12)/15)) gas_actual--;
}
else ubat_cnt++;
if (GasMischanteil > gas_actual) GasMischanteil = gas_actual;
}
else //Falls UBAT wieder ok ist
{
if (ubat_cnt > 1000)
{
gas_mittel = ((gas_mittel*9) + GasMischanteil)/10; //Filtern
gas_actual = GasMischanteil;
}
else
{
ubat_cnt++;
if ((ubat_cnt % 10) == 0)
{
if (gas_actual < GasMischanteil) gas_actual++;
else gas_actual = GasMischanteil;
}
}
GasMischanteil = gas_actual;
}
// Salvo End
if(GasMischanteil < 0) GasMischanteil = 0;
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// 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 > 2000) // wahrscheinlich in der Luft --> langsam absenken
{
GasMischanteil = EE_Parameter.NotGas;
Notlandung = 1;
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)
{
if(modell_fliegt < 0xffff) modell_fliegt++;
}
if((modell_fliegt < 200) || (GasMischanteil < 40))
{
SummeNick = 0;
SummeRoll = 0;
Mess_Integral_Gier = 0;
Mess_Integral_Gier2 = 0;
}
if((GasMischanteil > 200) && MotorenEin == 0)
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// auf Nullwerte kalibrieren
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) // Neutralwerte
{
if(++delay_neutral > 200) // nicht sofort
{
GRN_OFF;
SetNeutral();
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;
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], setting); // aktiven Datensatz merken
}
 
 
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
 
Piep(GetActiveParamSetNumber());
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert?
{
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset();
}
GPS_Save_Home(); //Daten sind jetzt hoffentlich verfuegbar
if (gps_home_position.status > 0 )
{
Delay_ms(1000); //akustisch verkuenden dass GPS Home Daten da sind
beeptime = 1000;
Delay_ms(500);
}
}
}
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();
if (ACC_FIXED > 0)
{
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK],ACC_NICK_NEUTRAL / 256); // ACC-NeutralWerte speichern
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_NICK+1],ACC_NICK_NEUTRAL % 256); // ACC-NeutralWerte speichern
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL],ACC_ROLL_NEUTRAL / 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_ROLL+1],ACC_ROLL_NEUTRAL % 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_Z],(int)ACC_Z_NEUTRAL / 256);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACC_Z+1],(int)ACC_Z_NEUTRAL % 256);
}
else
{
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(GasMischanteil < 35)
{
// Starten
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75)
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Einschalten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(++delay_einschalten > 200)
{
int n;
// Salvo 9.12.2007
RX_SWTCH_ON; //GPS Daten auf RX eingang schalten
// Salvo End
delay_einschalten = 200;
modell_fliegt = 1;
MotorenEin = 1;
sollGier = 0;
Mess_Integral_Gier = 0;
Mess_Integral_Gier2 = 0;
Mess_IntegralNick = 0;
Mess_IntegralRoll = 0;
Mess_IntegralNick2 = IntegralNick;
Mess_IntegralRoll2 = IntegralRoll;
SummeNick = 0;
SummeRoll = 0;
n= GPS_CRTL(GPS_CMD_STOP); //GPS Lageregelung beenden
}
}
else delay_einschalten = 0;
//Auf Neutralwerte setzen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Auschalten
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75)
{
if(++delay_ausschalten > 200) // nicht sofort
{
// Salvo 9.12.2007
RX_SWTCH_OFF; //Bluetooth Daten auf RX eingang schalten
// Salvo End
MotorenEin = 0;
delay_ausschalten = 200;
modell_fliegt = 0;
}
}
else delay_ausschalten = 0;
}
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// neue Werte von der Funke
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(!NewPpmData-- || Notlandung)
{
int tmp_int;
ParameterZuordnung();
StickNick = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_P;
StickNick += PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_D;
StickRoll = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_P;
StickRoll += PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_D;
StickGier = -PPM_in[EE_Parameter.Kanalbelegung[K_GIER]];
GyroFaktor = ((float)Parameter_Gyro_P + 10.0) / 256.0;
IntegralFaktor = ((float) Parameter_Gyro_I) / 44000;
 
#define KEY_VALUE (Parameter_UserParam1 * 4) //(Poti3 * 8)
if(DubWiseKeys[1]) beeptime = 10;
if(DubWiseKeys[1] & DUB_KEY_UP) tmp_int = KEY_VALUE; else
if(DubWiseKeys[1] & DUB_KEY_DOWN) tmp_int = -KEY_VALUE; else tmp_int = 0;
ExternStickNick = (ExternStickNick * 7 + tmp_int) / 8;
if(DubWiseKeys[1] & DUB_KEY_LEFT) tmp_int = KEY_VALUE; else
if(DubWiseKeys[1] & DUB_KEY_RIGHT) tmp_int = -KEY_VALUE; else tmp_int = 0;
ExternStickRoll = (ExternStickRoll * 7 + tmp_int) / 8;
 
if(DubWiseKeys[0] & 8) ExternStickGier = 50;else
if(DubWiseKeys[0] & 4) ExternStickGier =-50;else ExternStickGier = 0;
if(DubWiseKeys[0] & 2) ExternHoehenValue++;
if(DubWiseKeys[0] & 16) ExternHoehenValue--;
 
StickNick += ExternStickNick / 8;
StickRoll += ExternStickRoll / 8;
StickGier += ExternStickGier;
 
if(EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) IntegralFaktor = 0;
if(GyroFaktor < 0) GyroFaktor = 0;
if(IntegralFaktor < 0) IntegralFaktor = 0;
// greift in den Stick ein, um ungewolltes überschlagen zu verhindern
if(!(EE_Parameter.LoopConfig & CFG_LOOP_LINKS) && !(EE_Parameter.LoopConfig & CFG_LOOP_RECHTS))
{
if(IntegralNick > 60000)
{
StickNick -= 8 * EE_Parameter.Stick_P;
if(IntegralNick > 80000) StickNick -= 16 * EE_Parameter.Stick_P;
}
else
if(IntegralNick < -60000)
{
StickNick += 8 * EE_Parameter.Stick_P;
if(IntegralNick > 80000) StickNick -= 16 * EE_Parameter.Stick_P;
}
if(IntegralRoll > 60000)
{
StickRoll -= 8 * EE_Parameter.Stick_P;
if(IntegralRoll > 80000) StickRoll -= 16 * EE_Parameter.Stick_P;
}
else
if(IntegralRoll < -60000)
{
StickRoll += 8 * EE_Parameter.Stick_P;
if(IntegralRoll > 80000) StickRoll -= 16 * EE_Parameter.Stick_P;
}
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Looping?
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > EE_Parameter.LoopThreshold) && EE_Parameter.LoopConfig & 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.LoopConfig & 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.LoopConfig & 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.LoopConfig & 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) beeptime = 100;
if(Looping_Roll || Looping_Nick)
{
if(GasMischanteil > EE_Parameter.LoopGasLimit) GasMischanteil = EE_Parameter.LoopGasLimit;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Bei Empfangsausfall im Flug
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(Notlandung)
{
StickGier = 0;
StickNick = 0;
StickRoll = 0;
GyroFaktor = 0.1;
IntegralFaktor = 0.005;
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)
{
long tmp_long, tmp_long2;
tmp_long = (long)(IntegralNick / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccNick);
tmp_long /= 16;
tmp_long2 = (long)(IntegralRoll / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccRoll);
tmp_long2 /= 16;
#define AUSGLEICH 32 //(Parameter_UserParam1 / 2)
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;
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)
{
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;
LageKorrekturNick = ausgleichNick / ABGLEICH_ANZAHL;
// Roll ++++++++++++++++++++++++++++++++++++++++++++++++
IntegralFehlerRoll = (long)(MittelIntegralRoll - (long)IntegralAccRoll);
ausgleichRoll = IntegralFehlerRoll / EE_Parameter.GyroAccAbgleich;
LageKorrekturRoll = ausgleichRoll / ABGLEICH_ANZAHL;
 
// Mess_IntegralNick -= ausgleichNick;
// Mess_IntegralRoll -= ausgleichRoll;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gyro-Drift ermitteln
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MittelIntegralNick2 /= ABGLEICH_ANZAHL;
MittelIntegralRoll2 /= ABGLEICH_ANZAHL;
// tmp_long = (long)(MittelIntegralNick2 - (long)IntegralAccNick);
// tmp_long2 = (long)(MittelIntegralRoll2 - (long)IntegralAccRoll);
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;
 
//Salvo Ersatzkompass Ueberlauf korrigieren
if (GyroKomp_Int >= ((long)360 * GYROKOMP_INC_GRAD_DEFAULT)) GyroKomp_Int = GyroKomp_Int - (GYROKOMP_INC_GRAD_DEFAULT *(long)360); //neu ab 3.11.2007
if (GyroKomp_Int < 0) GyroKomp_Int = GyroKomp_Int + (GYROKOMP_INC_GRAD_DEFAULT *(long)360); //neu ab 3.11.2007
ROT_OFF;
// Salvo End
 
/*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;
DebugOut.Analog[22] = MittelIntegralRoll / 26;
DebugOut.Analog[28] = ausgleichNick;
DebugOut.Analog[29] = ausgleichRoll;
DebugOut.Analog[30] = LageKorrekturRoll * 10;
*/
 
#define FEHLER_LIMIT (ABGLEICH_ANZAHL * 4)
#define FEHLER_LIMIT2 (ABGLEICH_ANZAHL * 16)
#define BEWEGUNGS_LIMIT 20000
// Nick +++++++++++++++++++++++++++++++++++++++++++++++++
cnt = 1;// + labs(IntegralFehlerNick) / 4096;
if(labs(MittelIntegralNick_Alt - MittelIntegralNick) < BEWEGUNGS_LIMIT)
{
if(IntegralFehlerNick > FEHLER_LIMIT2)
{
if(last_n_p)
{
cnt += labs(IntegralFehlerNick) / FEHLER_LIMIT2;
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;
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;
//Salvo 26.12.2007
w = (abs(Mittelwert_AccNick));
v = (abs(Mittelwert_AccRoll));
if ((w < ACC_WAAGRECHT_LIMIT) && (v < ACC_WAAGRECHT_LIMIT)) // Gyro nur in annaehend waagrechter Lage nachtrimmen
{
if(cnt > EE_Parameter.Driftkomp) cnt = EE_Parameter.Driftkomp;
if(IntegralFehlerNick > FEHLER_LIMIT) AdNeutralNick += cnt;
if(IntegralFehlerNick < -FEHLER_LIMIT) AdNeutralNick -= cnt;
}
//Salvo End
// Roll +++++++++++++++++++++++++++++++++++++++++++++++++
cnt = 1;// + labs(IntegralFehlerNick) / 4096;
 
ausgleichRoll = 0;
if(labs(MittelIntegralRoll_Alt - MittelIntegralRoll) < BEWEGUNGS_LIMIT)
{
if(IntegralFehlerRoll > FEHLER_LIMIT2)
{
if(last_r_p)
{
cnt += labs(IntegralFehlerRoll) / FEHLER_LIMIT2;
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;
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;
}
//Salvo 26.12.2007
if ((w < ACC_WAAGRECHT_LIMIT*2) && (v < ACC_WAAGRECHT_LIMIT*2)) // Gyro nur inannaehernd waagrechter Lage nachtrimmen
{
if(cnt > EE_Parameter.Driftkomp) cnt = EE_Parameter.Driftkomp;
if(IntegralFehlerRoll > FEHLER_LIMIT) AdNeutralRoll += cnt;
if(IntegralFehlerRoll < -FEHLER_LIMIT) AdNeutralRoll -= cnt;
}
//Salvo End
//DebugOut.Analog[23] = AdNeutralNick;//10*(AdNeutralNick - StartNeutralNick);
//DebugOut.Analog[24] = 10*(AdNeutralRoll - StartNeutralRoll);
}
else
{
LageKorrekturRoll = 0;
LageKorrekturNick = 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;
} // Ende Abgleich
 
// Salvo Ersatzkompass und Giergyrokompensation 15.12.2007 **********************
if ((Kompass_Neuer_Wert > 0)) //nur wenn Kompass einen neuen Wert geliefert hat
{
Kompass_Neuer_Wert = 0;
w = (abs(Mittelwert_AccNick));
v = (abs(Mittelwert_AccRoll));
if ((w < ACC_WAAGRECHT_LIMIT) && (v < ACC_WAAGRECHT_LIMIT)) //Ersatzkompass und Giergyro nur mit Magnetkompass aktualisieren wenn alles ok
{
if ((abs(KompassValue - Kompass_Value_Old)) <= 5) // Aufeinanderfolgende Werte duerfen nur minimal abweichen
{
 
if ((abs(StickGier) < 20)) //Giergyroabgleich mit Kompass
{
if (cnt_stickgier_zero < 255) cnt_stickgier_zero += 1;
if (cnt_stickgier_zero > 2) // nur Abgleichen wenn keine Stickbewegung da
{
w = (int) (GyroGier_Comp/(long)GYROKOMP_INC_GRAD_DEFAULT);
v = KompassValue - gyrogier_kompass; // realen Drehwinkel seit letztem Ruecksetzen von GyroGier_Comp bestimmen
if (v <-180) v +=360; // Uberlaufkorrektur
if (v > 180) v -=360; // Uberlaufkorrektur
 
v = w-v; //Differenz Gyro zu Kompass ist der Driftfehler
 
#define GIER_COMP_MAX 8
if (v > GIER_COMP_MAX) v= GIER_COMP_MAX;
if (v < -GIER_COMP_MAX) v= - GIER_COMP_MAX;
if (abs(w) > 1)
{
GyroGier_Comp = 0;
gyrogier_kompass = KompassValue; // Kompasswert merken
AdNeutralGier -= v;
}
}
}
else
{
gyrogier_kompass = KompassValue; // Kompasswert merken
cnt_stickgier_zero = 0;
GyroGier_Comp = 0;
}
 
magkompass_ok = 1; // Flag dass Magnetkompass stabil arbeitet
GyroKomp_Int = (GyroKomp_Int )/(long)GYROKOMP_INC_GRAD_DEFAULT;
 
w = KompassValue - GyroKomp_Int;
if ((w > 0) && (w < 180))
{
++GyroKomp_Int;
}
else if ((w > 0) && (w >= 180))
{
--GyroKomp_Int;
}
else if ((w < 0) && (w >= -180))
{
--GyroKomp_Int;
}
else if ((w < 0) && (w < -180))
{
++GyroKomp_Int;
}
if (GyroKomp_Int < 0) GyroKomp_Int = GyroKomp_Int + 360L;
GyroKomp_Int = (GyroKomp_Int%360L) * (long)GYROKOMP_INC_GRAD_DEFAULT; // An Magnetkompasswert annaehern
}
}
else //Kompassfehler
{
magkompass_ok = 0;
GyroGier_Comp = 0;
}
Kompass_Value_Old = KompassValue;
}
// Salvo End *************************
 
// Salvo 6.10.2007
// GPS Home aktivieren wenn Knueppel in Ruhelage und Hoehenschalter aktiviert ist
//GPS Hold Aktiveren wenn Knueppel in Ruhelage sind
if ((EE_Parameter.GlobalConfig & CFG_GPS_AKTIV) && (abs(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]]) < GPS_STICK_HOLDOFF)
&& (abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) < GPS_STICK_HOLDOFF) && (gps_alive_cnt > 0))
{
if (Parameter_MaxHoehe > 200)
{
if ( gps_cmd == GPS_CMD_REQ_HOLD) gps_cmd = GPS_CMD_STOP; // erst mal stoppen, denn altes Kommando wurde noch nicht beendet
else gps_cmd = GPS_CMD_REQ_HOME;
n = GPS_CRTL(gps_cmd);
}
else
{
if ( gps_cmd == GPS_CMD_REQ_HOME) gps_cmd = GPS_CMD_STOP; // erst mal stoppen, denn altes Kommando wurde noch nicht beendet
else gps_cmd = GPS_CMD_REQ_HOLD;
n= GPS_CRTL(gps_cmd);
}
}
else
{
if (gps_cmd != GPS_CMD_STOP)
{
gps_cmd = GPS_CMD_STOP;
n= GPS_CRTL(gps_cmd); //GPS Lageregelung beenden
}
}
if (gps_state != GPS_CRTL_IDLE) if (TimerWerteausgabe == 12) LED_J16_OFF; //led im GPS Mode schnell blinken lassen
 
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gieren
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(abs(StickGier) > 20) // war 35
{
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
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(KompassValue && (EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) && (Kompass_present > 0))
{
if(v > w) w = v; // grösste Neigung ermitteln
 
// Salvo 13.9.2007 Nur wenn Magnetkompass ordentliche Werte liefert
if ((magkompass_ok > 0) && NeueKompassRichtungMerken)
{
KompassStartwert = KompassValue;
NeueKompassRichtungMerken = 0;
}
// Salvo 13.9.2007
w=0;
// Salvo End
w = (w * Parameter_KompassWirkung) / 64; // auf die Wirkung normieren
w = Parameter_KompassWirkung - w; // Wirkung ggf drosseln
if(w > 0)
{
// Salvo Kompasssteuerung **********************
if (magkompass_ok > 0) Mess_Integral_Gier += (KompassRichtung * w) / 32; // nach Kompass ausrichten
// Salvo End
}
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Debugwerte zuordnen
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(!TimerWerteausgabe--)
{
TimerWerteausgabe = 24;
 
// Salvo 13.12.2007 Beleuchtung steuern
if (!(beeptime & BeepMuster)) LED_J16_FLASH;
else if (MotorenEin) LED_J16_ON;
else LED_J16_OFF;
// Salvo End
DebugOut.Analog[0] = IntegralNick / EE_Parameter.GyroAccFaktor;
DebugOut.Analog[1] = IntegralRoll / EE_Parameter.GyroAccFaktor;
DebugOut.Analog[2] = Mittelwert_AccNick;
DebugOut.Analog[3] = Mittelwert_AccRoll;
DebugOut.Analog[4] = MesswertGier;
DebugOut.Analog[5] = HoehenWert;
DebugOut.Analog[6] =(Mess_Integral_Hoch / 512);
DebugOut.Analog[8] = KompassValue;
DebugOut.Analog[9] = GyroKomp_Int/GYROKOMP_INC_GRAD_DEFAULT;
 
// Diverse parameter Debugging
DebugOut.Analog[16] = dataset_cnt;
DebugOut.Analog[17] = UBat;
DebugOut.Analog[18] = MesswertNick;
DebugOut.Analog[19] = MesswertRoll;
DebugOut.Analog[20] = MesswertGier;
DebugOut.Analog[21] = StickNick;
DebugOut.Analog[22] = StickRoll;
DebugOut.Analog[23] = StickGier;
// GPS Debugging
// DebugOut.Analog[10] = GPS_dist_2trgt/10;
// DebugOut.Analog[11] = GPS_hdng_rel_2trgt;
DebugOut.Analog[10] = Parameter_UserParam1;
DebugOut.Analog[11] = Parameter_UserParam3;
DebugOut.Analog[24] = GPS_Nick;
DebugOut.Analog[25] = GPS_Roll;
DebugOut.Analog[26] = gps_rel_act_position.utm_east; //in 10cm ausgeben
DebugOut.Analog[27] = gps_rel_act_position.utm_north;
DebugOut.Analog[28] = gps_rel_act_position.utm_alt;
DebugOut.Analog[29] = gps_state + (gps_sub_state*10)+(50*gps_cmd);
DebugOut.Analog[30] = debug_gp_0;
DebugOut.Analog[31] = debug_gp_1;
/* DebugOut.Analog[12] = debug_gp_2;
DebugOut.Analog[13] = debug_gp_3;
DebugOut.Analog[14] = debug_gp_4;
DebugOut.Analog[15] = debug_gp_5;
*/
// DebugOut.Analog[30] = dist_flown;
// DebugOut.Analog[31] = (int) dist_2home;
// DebugOut.Analog[31] = (int) GPS_hdng_abs_2trgt;
// DebugOut.Analog[31] = (int) GyroGier_Comp;
/*
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(Looping_Nick) MesswertNick = MesswertNick * GyroFaktor;
else MesswertNick = IntegralNick * IntegralFaktor + MesswertNick * GyroFaktor;
if(Looping_Roll) MesswertRoll = MesswertRoll * GyroFaktor;
else MesswertRoll = IntegralRoll * IntegralFaktor + MesswertRoll * GyroFaktor;
// MesswertGier = MesswertGier * (GyroFaktor/2) + Integral_Gier * IntegralFaktor;
MesswertGier = MesswertGier * (GyroFaktor) + Integral_Gier * IntegralFaktor/2;
 
//DebugOut.Analog[28] = MesswertRoll;
//DebugOut.Analog[25] = IntegralRoll * IntegralFaktor;
//DebugOut.Analog[31] = StickRoll;// / (26*IntegralFaktor);
 
// Maximalwerte abfangen
#define MAX_SENSOR 2048
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;
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Höhenregelung
// Die Höhenregelung schwächt lediglich das Gas ab, erhöht es allerdings nicht
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//OCR0B = 180 - (Poti1 + 120) / 4;
//DruckOffsetSetting = OCR0B;
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung
{
int tmp_int;
if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER) // Regler wird über Schalter gesteuert
{
if(Parameter_MaxHoehe < 50)
{
SollHoehe = HoehenWert - 20; // Parameter_MaxHoehe ist der PPM-Wert des Schalters
HoehenReglerAktiv = 0;
}
else
HoehenReglerAktiv = 1;
}
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; // Differenz bestimmen --> P-Anteil
h = GasMischanteil - h; // vom Gas abziehen
h -= (HoeheD * Parameter_Luftdruck_D)/8; // D-Anteil
tmp_int = ((Mess_Integral_Hoch / 512) * (signed long) Parameter_Hoehe_ACC_Wirkung) / 32;
if(tmp_int > 50) tmp_int = 50;
else if(tmp_int < -50) tmp_int = -50;
h -= tmp_int;
hoehenregler = (hoehenregler*15 + h) / 16;
if(hoehenregler < EE_Parameter.Hoehe_MinGas) // nicht unter MIN
{
if(GasMischanteil >= EE_Parameter.Hoehe_MinGas) hoehenregler = EE_Parameter.Hoehe_MinGas;
if(GasMischanteil < EE_Parameter.Hoehe_MinGas) hoehenregler = GasMischanteil;
}
if(hoehenregler > GasMischanteil) hoehenregler = GasMischanteil; // nicht mehr als Gas
GasMischanteil = hoehenregler;
}
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + Mischer und PI-Regler
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DebugOut.Analog[7] = GasMischanteil;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Gier-Anteil
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define MUL_G 1.0
GierMischanteil = MesswertGier - sollGier; // Regler für Gier
//GierMischanteil = 0;
 
if(GierMischanteil > (GasMischanteil / 2)) GierMischanteil = GasMischanteil / 2;
if(GierMischanteil < -(GasMischanteil / 2)) GierMischanteil = -(GasMischanteil / 2);
if(GierMischanteil > ((MAX_GAS - GasMischanteil))) GierMischanteil = ((MAX_GAS - GasMischanteil));
if(GierMischanteil < -((MAX_GAS - GasMischanteil))) GierMischanteil = -((MAX_GAS - GasMischanteil));
 
if(GasMischanteil < 20) GierMischanteil = 0;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Nick-Achse
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DiffNick = MesswertNick - (StickNick - GPS_Nick); // Differenz bestimmen
if(IntegralFaktor) SummeNick += IntegralNick * IntegralFaktor - (StickNick - GPS_Nick); // I-Anteil bei Winkelregelung
else SummeNick += DiffNick; // I-Anteil bei HH
if(SummeNick > 0) SummeNick-= 2 ; else SummeNick += 2 ;
if(SummeNick > 16000) SummeNick = 16000;
if(SummeNick < -16000) SummeNick = -16000;
pd_ergebnis = DiffNick + Ki * SummeNick; // PI-Regler für Nick
// Motor Vorn
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64;
if(pd_ergebnis > tmp_int) pd_ergebnis = tmp_int;
if(pd_ergebnis < -tmp_int) pd_ergebnis = -tmp_int;
 
motorwert = GasMischanteil + pd_ergebnis + GierMischanteil; // Mischer
if ((motorwert < 0)) motorwert = 0;
else if(motorwert > MAX_GAS) motorwert = MAX_GAS;
if (motorwert < MIN_GAS) motorwert = MIN_GAS;
Motor_Vorne = motorwert;
// Motor Heck
motorwert = GasMischanteil - pd_ergebnis + GierMischanteil;
if ((motorwert < 0)) motorwert = 0;
else if(motorwert > MAX_GAS) motorwert = MAX_GAS;
if (motorwert < MIN_GAS) motorwert = MIN_GAS;
Motor_Hinten = motorwert;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Roll-Achse
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DiffRoll = MesswertRoll - (StickRoll - GPS_Roll); // Differenz bestimmen
if(IntegralFaktor) SummeRoll += IntegralRoll * IntegralFaktor - (StickRoll - GPS_Roll);// I-Anteil bei Winkelregelung
else SummeRoll += DiffRoll; // I-Anteil bei HH
if(SummeRoll > 0) SummeRoll-= 2 ; else SummeRoll += 2 ;
if(SummeRoll > 16000) SummeRoll = 16000;
if(SummeRoll < -16000) SummeRoll = -16000;
pd_ergebnis = DiffRoll + Ki * SummeRoll; // PI-Regler für Roll
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64;
if(pd_ergebnis > tmp_int) pd_ergebnis = tmp_int;
if(pd_ergebnis < -tmp_int) pd_ergebnis = -tmp_int;
// Motor Links
motorwert = GasMischanteil + pd_ergebnis - GierMischanteil;
if ((motorwert < 0)) motorwert = 0;
else if(motorwert > MAX_GAS) motorwert = MAX_GAS;
if (motorwert < MIN_GAS) motorwert = MIN_GAS;
Motor_Links = motorwert;
// Motor Rechts
motorwert = GasMischanteil - pd_ergebnis - GierMischanteil;
if ((motorwert < 0)) motorwert = 0;
else if(motorwert > MAX_GAS) motorwert = MAX_GAS;
if (motorwert < MIN_GAS) motorwert = MIN_GAS;
Motor_Rechts = motorwert;
// +++++++++++++++++++++++++++++++++++++++++++++++
}
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/fc.h
0,0 → 1,169
/*#######################################################################################
Flight Control
#######################################################################################*/
 
#ifndef _FC_H
#define _FC_H
 
extern volatile unsigned int I2CTimeout;
//Salvo 9.12.2007 Neutralwerte fuer ACC Sensor nur verwendet wenn ACC_FIXED >0
#define ACC_FIXED 0 // wenn > 0werden diese Werte beim ACC Kalbibrieren ins Eeprom geschrieben
#define ACC_NICK_NEUTRAL 518 // ADC Wandler Wert in Neutrallage (0g): Vom individuellen Sensor abhaengig
#define ACC_ROLL_NEUTRAL 516 // ADC Wandler wert in Neutrallage (0g)
#define ACC_Z_NEUTRAL 740 // ADC Wandler wert in Neutrallage (0g)
#define ACC_WAAGRECHT_LIMIT 100 // Nick und Roll kleiner als dieser Wert gelten als Kriterium fuer waagrechte Lage
 
#define CAM_GPS_QUIET 0 // wenn dieses Flag gesetzt ist, wird GPS beim Ausloesen kurzzeitig deaktiviert um eine ruhige Lage zu bekommen
 
//Salvo 2.9.2007 Ersatzkompass: Gyroincrements/Grad als Defaultwert *****
// Laut Datenblatt sind di; Werte ueber Zeit und Temperatur sehr stabil.
#define GYROKOMP_INC_GRAD_DEFAULT 1300 // Gyroincrements/Grad als Defaultwert
// Salvo End
 
extern unsigned char Sekunde,Minute;
extern volatile long IntegralNick,IntegralNick2;
extern volatile long IntegralRoll,IntegralRoll2;
extern volatile long Mess_IntegralNick,Mess_IntegralNick2;
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
extern volatile long IntegralAccNick,IntegralAccRoll;
extern volatile long Mess_Integral_Hoch;
extern volatile long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
extern volatile int KompassValue;
extern volatile int KompassStartwert;
extern volatile int KompassRichtung;
extern int HoehenWert;
extern int SollHoehe;
extern volatile int MesswertNick,MesswertRoll,MesswertGier;
extern volatile int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll;
extern volatile int NeutralAccX, NeutralAccY,Mittelwert_AccHoch;
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;
 
//Salvo 2.1.2008 Debugvariablens
extern int debug_gp_0,debug_gp_1,debug_gp_2,debug_gp_3,debug_gp_4,debug_gp_5,debug_gp_6,debug_gp_7; //Allgemeine Debugvariablen
//Salvo End
 
//Salvo 2.9.2007 Ersatzkompass
extern long GyroKomp_Int;
extern long int GyroGier_Comp;
extern int GyroKomp_Inc_Grad;
extern int GyroKomp_Value; // Der ermittelte Kompasswert aus Gyro und Magnetkompass
// Salvo End
 
void MotorRegler(void);
void SendMotorData(void);
void CalibrierMittelwert(void);
void Mittelwert(void);
void SetNeutral(void);
void Piep(unsigned char Anzahl);
extern void DefaultKonstanten(void);
void DefaultKonstanten1(void);
void DefaultKonstanten2(void);
 
extern unsigned char h,m,s;
extern volatile unsigned char Timeout ;
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
extern volatile long IntegralNick,IntegralNick2;
extern volatile long IntegralRoll,IntegralRoll2;
extern volatile long Integral_Gier;
extern volatile long Mess_IntegralNick,Mess_IntegralNick2;
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
extern volatile long Mess_Integral_Gier;
extern volatile int DiffNick,DiffRoll;
extern int Poti1, Poti2, Poti3, Poti4;
extern volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
extern unsigned char MotorWert[5];
extern volatile unsigned char SenderOkay;
extern int StickNick,StickRoll,StickGier;
extern char MotorenEin;
extern void DefaultKonstanten1(void);
extern void DefaultKonstanten2(void);
 
#define STRUCT_PARAM_LAENGE 71
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 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 AchsGegenKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick Gegenkoppelt (NickRollGegenkopplung)
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
 
//------------------------------------------------
unsigned char LoopConfig; // 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];
};
 
 
/*
unsigned char ServoNickMax; // Wert : 0-250
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 LoopConfig; // 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];
*/
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_AchsGegenKopplung1;
 
 
#endif //_FC_H
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/flightctrl.aws
0,0 → 1,0
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA644"/><Files><File00000 Name="G:\Mikrokopter\Flight_Crtl\v0067g\timer0.c" Position="266 101 1182 710" LineCol="164 0" State="Maximized"/><File00001 Name="G:\Mikrokopter\Flight_Crtl\v0067g\analog.h" Position="288 130 1218 738" LineCol="0 0" State="Maximized"/><File00002 Name="G:\Mikrokopter\Flight_Crtl\v0067g\makefile" Position="310 159 1240 767" LineCol="157 0" State="Maximized"/><File00003 Name="G:\Mikrokopter\Flight_Crtl\v0067g\main.c" Position="332 188 1262 796" LineCol="227 13" State="Maximized"/><File00004 Name="G:\Mikrokopter\Flight_Crtl\v0067g\timer0.h" Position="262 71 1402 978" LineCol="12 33" State="Maximized"/></Files></AVRWorkspace>
/branches/salvo_gps/Basis_v0067g/tags/v0007/gps.h
0,0 → 1,131
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Peter Muehlenbrock alias Salvo
// Definitionen fuer Modul GPS
// Stand 20.1.2008
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
extern signed int GPS_Nick;
extern signed int GPS_Roll;
extern void GPS_Neutral(void);
extern void Get_Ublox_Msg(uint8_t rx) ;
extern short int Get_GPS_data(void);
extern short int Get_Rel_Position(void);
extern void GPS_Save_Home(void);
extern short int GPS_CRTL(short int cmd);
 
typedef struct {
unsigned long utm_itow; // time of week
long utm_east; // UTM Ost in cm
long utm_north; // UTM Nord in cm
long utm_alt; // hoehe in cm
uint8_t utm_zone; //
uint8_t utm_hem; // Hemisphere Indicator
uint8_t status; // 0: kein gueltiges Paket 1: alles ok
} NAV_POSUTM_t;
 
typedef struct {
unsigned long itow; // time of week
uint8_t gpsfix_type;// 3=3D Fix
uint8_t nav_status_flag;
uint8_t nav_diff_status;
uint8_t nav_resevd;
long nav_tff; // Time to First Fix in ms
long nav_msss; // ms since startup
uint8_t status; // 0: kein gueltiges Paket 1: alles ok
} NAV_STATUS_t;
 
typedef struct {
unsigned long itow;
long speed_n; // in cm/s
long speed_e; // in cm/s
long speed_alt; // in cm/s
unsigned long speed_3d; // in cm/s
unsigned long speed_gnd; // V ueber Grund in cm/s
long heading; // Richtung in deg/10000
unsigned long sacc; // Speed Genauigkeit in cm/s
unsigned long cacc; // Richtungsgenauigkeit in deg
uint8_t status; // 0: kein gueltiges Paket 1: alles ok
} NAV_VELNED_t;
 
 
typedef struct {
long utm_east; // UTM Ost in 10 cm
long utm_north; // UTM Nord in 10 cm
long utm_alt; // hoehe in 10 cm
unsigned long speed_gnd; // V ueber Grund in 10cm/s
unsigned heading; // Richtung in Grad
uint8_t status; // 0: keine gueltigen Daten 1: alles ok
 
} GPS_ABS_POSITION_t;
 
 
typedef struct { // Struktur fuer Relative GPS Daten (bezogen z.B. auf Home Position)
int utm_east; // UTM Ost in 10 cm
int utm_north; // UTM Nord in 10 cm
int utm_alt ; // UTM Altitude in 10 cm
uint8_t status; // 0: keine gueltigen Daten 1: alles ok
 
} GPS_REL_POSITION_t;
 
 
extern GPS_ABS_POSITION_t gps_act_position;
extern GPS_ABS_POSITION_t gps_home_position;
extern GPS_REL_POSITION_t gps_rel_act_position;
extern GPS_REL_POSITION_t gps_rel_hold_position;
extern short int gps_state,gps_sub_state;
extern unsigned int gps_alive_cnt;
 
 
 
// Zustaende der zentralen GPS statemachine
#define GPS_CRTL_IDLE 0 // Inaktiv
#define GPS_CRTL_HOLD_ACTIVE 1 // Lageregelung aktiv
#define GPS_CRTL_HOME_ACTIVE 2 // Rueckflug zur Basis Aktiv
#define GPS_HOME_FAST_IN_TOL 3 // Rueckflug: Aktuelle Position innerhalb der Toleranz
#define GPS_HOME_FAST_OUTOF_TOL 4 // Rueckflug: Aktuelle Position ausserhalb der Toleranz
#define GPS_HOME_RMPDWN_IN_TOL 5 // Rueckflug: beim Abbremsen Position innerhalb der Toleranz
#define GPS_HOME_RMPDWN_OUTOF_TOL 6 // Rueckflug: beim Abbremsen Position ausserhalb der Toleranz
#define GPS_HOME_IN_TOL 7 // Rueckflug: Nahe am Ziel innerhalb der Toleranz
#define GPS_HOME_OUTOF_TOL 8 // Rueckflug: Nahe am Ziel ausserhalb der Toleranz
#define GPS_HOME_FINISHED 9 // Rueckflug zur Basis abgeschlossen
 
// Kommandokonstanten fuer die zentrale GPS Statemachine
#define GPS_CMD_STOP 0 // Lageregelung soll deaktiviert werden
#define GPS_CMD_REQ_INIT 1 // Initialisierung
#define GPS_CMD_REQ_HOLD 3 // Lageregelung soll aktiviert werden
#define GPS_CMD_REQ_HOME 4 // Das Heimfliegen soll aktiviert werden
 
// Statusmeldungen der zentralen GPS statemachine
#define GPS_STST_OK 0 // Kommando erfolgreich und abgeschlossen
#define GPS_STST_PEND 1 // Kommando noch nicht komplett durchgefuehrt
#define GPS_STST_ERR 2 // Fehler
 
// GPS Lageregler
#define GPS_USR_PAR_FKT 4 //Faktor durch den die Userparameter geteilt werden
 
#define GPS_NICKROLL_MAX 30 // Maximaler Einfluss des GPS Lagereglers auf Nick und Roll
#define GPS_DIST_MAX 400 // Maximal zulaessige Distanz bevor Regelung gestoppt wird (in 10cm)
#define GPS_STICK_HOLDOFF 20 // Wenn der Nick oder Roll Stickwerte groesser sind, wird GPS_HOLD deaktiviert
#define GPS_V 8 // Teilerfaktor Regelabweichung zu Ausgabewert
 
 
// Konstanten fuer Verstaerkung fuer Speed Werte in Abhaengigkeit vom SpeedWert (cm/sek)
// um eine exponentielle Verstaerkung zu erreichen
#define DIFF_Y_N_MAX 1 // Verstaerkung bei Eingangswert = DIFF_X_N_MAX im Normal (Hold) Mode
//#define DIFF_X_N_MAX 200 // bei diesem Eingangswert ist die Verstaerkung = DIFF_Y_N_MAX
 
#define DIFF_Y_F_MAX 1 // Verstaerkung bei Eingangswert = DIFF_X_F_MAX im Fast (Coming Home) Mode
//#define DIFF_X_F_MAX 500 // bei diesem Eingangswert ist die Verstaerkung = DIFF_Y_F_MAX
 
// P-Regler Verstaerkung
#define GPS_PROP_NRML_V 2 //maximale Verstaerkung im Normalen Holdmode
#define GPS_PROP_FAST_V 3 //maximale Verstaerkung im Fast mode
 
// GPS G2T /Go to Target Regler
#define GPS_G2T_DIST_MAX_STOP 100 // Ab dieser Entfernung vom Zielpunkt soll die Geschwindigkeit runtergeregelt werden( in 10 cm)
#define GPS_G2T_DIST_HOLD 50 // Ab dieser Entfernung vom Zielpunkt wird mit Minimaler Geschwindigkeit eingeregelt
#define GPS_G2T_FAST_TOL 200 // Bei grosser Entfernung vom Ziel: Der Sollwert wird nur geaendert wenn die aktuelle Position nicht mehr als diesem Wert vom Sollwert abweicht
#define GPS_G2T_NRML_TOL 100 // Bei kleiner Entfernung vom Ziel: Der Sollwert wird nur geaendert wenn die aktuelle Position nicht mehr als diesem Wert vom Sollwert abweicht
#define GPS_G2T_V_MAX 15 // Maximale Geschwindigkeit (in 10cm/0.25 Sekunden) mit der der Sollpunkt geaendert wird.
#define GPS_G2T_V_RAMP_DWN 8 // Geschwindigkeit (in 10cm/0.25ekunden) in der Naehe der Home Position um abzubremsen
#define GPS_G2T_V_MIN 3 // Minimale (in 10cm/0.25 Sekunden) ganz nahe an Homeposition.
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/main.c
0,0 → 1,251
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + 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;
 
// -- Parametersatz aus EEPROM lesen ---
// number [0..5]
void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length)
{
if (number > 5) number = 5;
eeprom_read_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length);
}
 
// -- Parametersatz ins EEPROM schreiben ---
// number [0..5]
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length)
{
if(number > 5) number = 5;
eeprom_write_block(buffer, &EEPromArray[EEPROM_ADR_PARAM_BEGIN + length * number], length);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken
}
 
unsigned char GetActiveParamSetNumber(void)
{
unsigned char set;
set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]);
if(set > 5)
{
set = 2;
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], set); // diesen Parametersatz als aktuell merken
}
return(set);
}
 
//############################################################################
//Hauptprogramm
int main (void)
//############################################################################
{
unsigned int timer;
 
//unsigned int timer2 = 0;
DDRB = 0x00;
PORTB = 0x00;
for(timer = 0; timer < 1000; timer++); // verzögern
if(PINB & 0x01) PlatinenVersion = 11; else PlatinenVersion = 10;
// Salvo 9.12.2007 PC6 als Ausgang
// DDRC = 0x81; // SCL
DDRC = 0xCD; // SCL und PC2,PC3, PC6 als Ausgang
PORTC = 0xff; // Pullup SDA
DDRB = 0x1B; // LEDs und Druckoffset
PORTB = 0x01; // LED_Rot
DDRD = 0x3E; // Speaker & TXD & J3 J4 J5
DDRD |=0x80; // J7
PORTD = 0xF7; // LED
MCUSR &=~(1<<WDRF);
WDTCSR |= (1<<WDCE)|(1<<WDE);
WDTCSR = 0;
 
beeptime = 2000;
 
StickGier = 0; PPM_in[K_GAS] = 0;StickRoll = 0; StickNick = 0;
 
ROT_OFF;
 
Timer_Init();
UART_Init();
rc_sum_init();
ADC_Init();
i2c_init();
// SPI_MasterInit();
sei();
 
VersionInfo.Hauptversion = VERSION_HAUPTVERSION;
VersionInfo.Nebenversion = VERSION_NEBENVERSION;
VersionInfo.PCKompatibel = VERSION_KOMPATIBEL;
printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",PlatinenVersion/10,PlatinenVersion%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a');
printf("\n\r==============================");
GRN_ON;
 
#define EE_DATENREVISION 68 // wird angepasst, wenn sich die EEPROM-Daten geändert haben
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) != EE_DATENREVISION)
{
printf("\n\rInit. EEPROM: Generiere Default-Parameter...");
DefaultKonstanten1();
for (unsigned char i=0;i<6;i++)
{
if(i==2) DefaultKonstanten2(); // Kamera
if(i==3) DefaultKonstanten3(); // Beginner
if(i>3) DefaultKonstanten2(); // Kamera
WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
}
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], 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 nicht abgeglichen!");
}
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
printf("\n\rBenutze Parametersatz %d", GetActiveParamSetNumber());
 
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
{
printf("\n\rAbgleich Luftdrucksensor..");
timer = SetDelay(1000);
SucheLuftruckOffset();
while (!CheckDelay(timer));
printf("OK\n\r");
}
SetNeutral();
 
ROT_OFF;
// Salvo 9.12.2007 Defaultwert fuer Umschaltsignal fuer RX: Bluettooth Modul aktiv
RX_SWTCH_OFF;
// Salvo End
beeptime = 2000;
DebugIn.Analog[1] = 1000;
DebugIn.Digital[0] = 0x55;
 
printf("\n\rSteuerung: ");
if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold");
else printf("Neutral");
printf("\n\n\r");
LcdClear();
I2CTimeout = 5000;
while (1)
{
if (UpdateMotor) // ReglerIntervall
{
// SPI_TransmitByte();
UpdateMotor=0;
//PORTD |= 0x08;
MotorRegler();
//PORTD &= ~0x08;
SendMotorData();
ROT_OFF;
 
if(PcZugriff) PcZugriff--;
else
{
DubWiseKeys[0] = 0;
DubWiseKeys[1] = 0;
ExternStickNick = 0;
ExternStickRoll = 0;
ExternStickGier = 0;
}
if(SenderOkay) SenderOkay--;
if(!I2CTimeout)
{
I2CTimeout = 5;
i2c_reset();
if((BeepMuster == 0xffff) && MotorenEin)
{
beeptime = 10000;
BeepMuster = 0x0080;
}
}
else
{
I2CTimeout--;
ROT_OFF;
}
}
if(SIO_DEBUG)
{
DatenUebertragung();
BearbeiteRxDaten();
}
else BearbeiteRxDaten();
if(CheckDelay(timer))
{
if(UBat < EE_Parameter.UnterspannungsWarnung)
{
if(BeepMuster == 0xffff)
{
beeptime = 6000;
BeepMuster = 0x0300;
}
}
// SPI_StartTransmitPacket();
timer = SetDelay(100);
}
}
return (1);
}
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/main.h
0,0 → 1,112
#ifndef _MAIN_H
#define _MAIN_H
 
//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
//#define SYSCLK 16000000L //Quarz Frequenz in Hz
#endif
 
// neue Hardware
#define ROT_OFF {if(PlatinenVersion == 10) PORTB &=~0x01; else PORTB |= 0x01;}
#define ROT_ON {if(PlatinenVersion == 10) PORTB |= 0x01; else PORTB &=~0x01;}
#define ROT_FLASH PORTB ^= 0x01
#define GRN_OFF PORTB &=~0x02
#define GRN_ON PORTB |= 0x02
#define GRN_FLASH PORTB ^= 0x02
 
 
//Salvo 9.12.2007 Umschaltsignal fuer Bluetooth bzw. GPS Daten auf PC7
#define RX_SWTCH_ON PORTC |= 0x40
#define RX_SWTCH_OFF PORTC &= ~0x40
#define LED_J16_ON PORTC |= 0x04
#define LED_J16_OFF PORTC &= ~0x04
#define LED_J16_FLASH PORTC ^= 0x04
//Salvo End
 
#define F_CPU SYSCLK
//#ifndef F_CPU
//#error ################## F_CPU nicht definiert oder ungültig #############
//#endif
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
#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_PARAM_BEGIN 100
 
#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 SYSCLK
//extern unsigned long SYSCLK;
extern volatile int i_Nick[20],i_Roll[20],DiffNick,DiffRoll;
extern volatile unsigned char SenderOkay;
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
extern unsigned char PlatinenVersion;
 
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);
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"
 
 
#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/salvo_gps/Basis_v0067g/tags/v0007/makefile
0,0 → 1,411
#--------------------------------------------------------------------
# MCU name
MCU = atmega644
F_CPU = 20000000
#-------------------------------------------------------------------
HAUPT_VERSION = 0
NEBEN_VERSION = 07
VERSION_INDEX = 0
 
VERSION_KOMPATIBEL = 7 # PC-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 ($(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_INDEX), 0)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)a
endif
ifeq ($(VERSION_INDEX), 1)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)b
endif
ifeq ($(VERSION_INDEX), 2)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)c
endif
ifeq ($(VERSION_INDEX), 3)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)d
endif
ifeq ($(VERSION_INDEX), 4)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)e
endif
ifeq ($(VERSION_INDEX), 5)
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)f
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 = s
 
##########################################################################################################
# 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 math.c
#spi.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_HAUPTVERSION=$(HAUPT_VERSION) -DVERSION_NEBENVERSION=$(NEBEN_VERSION) -DVERSION_KOMPATIBEL=$(VERSION_KOMPATIBEL) -DVERSION_INDEX=$(VERSION_INDEX)
 
 
# 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 = stk200
AVRDUDE_PROGRAMMER = dt006
#AVRDUDE_PROGRAMMER = ponyser
#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_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_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.
sizebefore:
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi
 
sizeafter:
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); 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/salvo_gps/Basis_v0067g/tags/v0007/math.c
0,0 → 1,127
/*
This program (files math.c and math.h) is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 3 of the License, or (at your option) any later version.
This program 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 and GNU Lesser General Public License for more details.
You should have received a copy of GNU General Public License (License_GPL.txt) and
GNU Lesser General Public License (License_LGPL.txt) along with this program.
If not, see <http://www.gnu.org/licenses/>.
 
Please note: All the other files for the project "Mikrokopter" by H.Buss are under the license (license_buss.txt) published by www.mikrokopter.de
*/
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Peter Muehlenbrock
Winkelfunktionen sin, cos und arctan in
brute-force Art: Sehr Schnell, nicht sonderlich genau, aber ausreichend
get_dist Funktion fuer Entfernungsermittlung
Stand 12.10.2007
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
#include "main.h"
#include "math.h"
 
 
// arctan Funktion: Eingabewert x,y Rueckgabe =arctan(x,y) in grad
int arctan_i( signed int x, signed int y)
{
short int change_xy = 0;
signed int i;
long signed int wert;
int return_value;
 
if ((abs(x)) > (abs(y))) // x,y Werte vertauschen damit arctan <45 grad bleibt
{
change_xy = 1;
i = x;
x = y;
y = i;
}
// Quadranten ermitteln
 
// Wert durch lineare Interpolation ermitteln
if ((y == 0) && (x == 0)) wert =1; // Division durch 0 nicht erlaubt
else wert= abs(((long)x*1000)/((long)y));
 
if (wert <=268) //0...0.0,268 entsprechend 0..15 Grad
{
return_value = (signed int)((wert*100)/(268-0)*(15-0)/100) +0;
}
else if (wert <=578) //0,268...0.0,568 entsprechend 15..30 Grad
{
return_value = (signed int)((((wert-268)*100)/(578-268)*(30-15))/100) +15;
}
else //0,568...1 entsprechend 30..45 Grad
{
return_value = (signed int)((((wert-578)*50)/(1000-578)*(45-30))/50) +30;
}
 
if (change_xy == 0) return_value = 90-return_value; //Quadrant 45..90 Grad
if ((x >= 0) && (y <0)) return_value = - return_value;
else if ((x < 0) && (y >= 0)) return_value = - return_value;
 
return return_value;
}
 
 
// cosinus Funktion: Eingabewert Winkel in Grad, Rueckgabe =cos(winkel)*1000
signed int cos_i(signed int winkel)
{
winkel = sin_i(90-winkel);
return winkel;
}
 
 
const unsigned int pgm_sinus[91] PROGMEM = {0,17,35,52,70,87,105,122,139,156,174,191,208,225,242,259,276,292,309,326,342,358,375,391,407,423,438,454,469,485,500,515,530,545,559,574,588,602,616,629,643,656,669,682,695,707,719,731,743,755,766,777,788,799,809,819,829,839,848,857,866,875,883,891,899,906,914,921,927,934,940,946,951,956,961,966,970,974,978,982,985,988,990,993,995,996,998,999,999,1000,1000};
//von Nick666, Stand 28.9.2007
// sinus Funktion: Eingabewert Winkel in Grad, Rueckgabe =sin(winkel)*1000
signed int sin_i(signed int winkel)
{
short int m,n;
 
if (abs(winkel) >=360) winkel = winkel % 360;
if (winkel < 0)
{
m = -1;
winkel = abs(winkel);
}
else m = +1;
n =1;
 
// Quadranten auswerten
if ((winkel > 90 ) && (winkel <= 180)) winkel = 180 - winkel;
else if ((winkel > 180 ) && (winkel <= 270))
{
winkel = winkel -180;
n = -1;
}
else if ((winkel > 270) && (winkel <= 360))
{
winkel = 360 - winkel;
n = -1;
}
// else //0 - 90 Grad
 
winkel = pgm_read_word(&pgm_sinus[winkel]);
return (winkel*m*n);
}
 
// Aus x,y und Winkel Distanz ermitteln
long get_dist(signed int x, signed int y, signed int phi)
{
long dist;
if (abs(x) > abs(y) )
{
dist = (long) x; //Groesseren Wert wegen besserer Genauigkeit nehmen
dist = abs((dist *1000) / (long) sin_i(phi));
}
else
{
dist = (long) y;
dist = abs((dist *1000) / (long) cos_i(phi));
}
return dist;
}
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/math.h
0,0 → 1,11
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Peter Muehlenbrock
// Definitionen fuer Modul math
 
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "main.h"
 
extern signed int sin_i(signed int winkel);
extern signed int cos_i(signed int winkel);
extern signed int arctan_i(signed int x, signed int y);
extern long get_dist(signed int x, signed int y, signed int phi);
/branches/salvo_gps/Basis_v0067g/tags/v0007/menu.c
0,0 → 1,127
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + 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 RemoteTasten = 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)
{
static unsigned char MaxMenue = 10,MenuePunkt=0;
if(RemoteTasten & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue; LcdClear(); RemotePollDisplayLine = -1; }
if(RemoteTasten & KEY2) { MenuePunkt++; LcdClear(); RemotePollDisplayLine = -1;}
if((RemoteTasten & KEY1) && (RemoteTasten & KEY2)) MenuePunkt = 0;
LCD_printfxy(17,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_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX+'a');
LCD_printfxy(0,2,"Setting: %d ",GetActiveParamSetNumber());
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)",AdWertNick - AdNeutralNick, AdNeutralNick);
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertRoll - AdNeutralRoll, AdNeutralRoll);
LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier);
}
else
{
LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertNick - AdNeutralNick, AdNeutralNick/2);
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertRoll - AdNeutralRoll, AdNeutralRoll/2);
LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier/2);
}
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;
default: MaxMenue = MenuePunkt - 1;
MenuePunkt = 0;
break;
}
RemoteTasten = 0;
}
/branches/salvo_gps/Basis_v0067g/tags/v0007/menu.h
0,0 → 1,6
extern void Menu(void);
extern void LcdClear(void);
extern char DisplayBuff[80];
extern unsigned char DispPtr;
extern unsigned char RemoteTasten;
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/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/salvo_gps/Basis_v0067g/tags/v0007/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/salvo_gps/Basis_v0067g/tags/v0007/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/salvo_gps/Basis_v0067g/tags/v0007/rc.c
0,0 → 1,84
/*#######################################################################################
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
 
// PWM
//TCCR1A = (1 << COM1B1) | (1 << WGM11) | (1 << WGM10);
//TCCR1B |= (1 << WGM12);
//OCR1B = 55;
TIMSK1 |= _BV(ICIE1);
AdNeutralGier = 0;
AdNeutralRoll = 0;
AdNeutralNick = 0;
return;
}
 
//############################################################################
//Diese Routine startet und initialisiert 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 > (int) Parameter_UserParam2 * 10) && (signal < 8000))
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;}
tmp = (3 * (PPM_in[index]) + signal) / 4;
// if(tmp > signal+1) tmp--; else
// if(tmp < signal-1) tmp++;
PPM_diff[index] = tmp - PPM_in[index];
PPM_in[index] = tmp;
}
index++;
if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen
if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen
if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08; // Servosignal an J5 anlegen
}
}
}
 
 
 
 
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/rc.h
0,0 → 1,29
/*#######################################################################################
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_TEILER CK64
#define TIMER_RELOAD_VALUE 250
//#define TIMER_TEILER CK256 // bei 20MHz
//#define TIMER_RELOAD_VALUE -78 // bei 20MHz
#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/salvo_gps/Basis_v0067g/tags/v0007/spi.c
0,0 → 1,86
// ######################## SPI - FlightCtrl ###################
#include "main.h"
 
 
struct str_ToNaviCtrl ToNaviCtrl;
struct str_FromNaviCtrl FromNaviCtrl;
unsigned char SPI_BufferIndex;
volatile unsigned char SPI_Buffer[sizeof(FromNaviCtrl)];
unsigned char *Ptr_buffer = (unsigned char *) &ToNaviCtrl;
 
//------------------------------------------------------
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<<SPIE); // Enable SPI, Master, set clock rate fck/64
SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT);
}
 
//------------------------------------------------------
void SPI_StartTransmitPacket(void)
{
if ((SLAVE_SELECT_PORT & (1 << SPI_SLAVE_SELECT)) == 0) return; // transfer of prev. packet not completed
SLAVE_SELECT_PORT &= ~(1 << SPI_SLAVE_SELECT); // SelectSlave
UpdateSPI_Buffer(); // update buffer
SPI_BufferIndex = 1;
DebugOut.Analog[16]++;
// -- Debug-Output ---
cli();
DebugOut.Analog[20] = FromNaviCtrl.Comp;
DebugOut.Analog[21] = FromNaviCtrl.GPS_Nick;
DebugOut.Analog[22] = FromNaviCtrl.GPS_Roll;
DebugOut.Analog[23] = FromNaviCtrl.CompassValue;
sei();
//----
SPDR = ToNaviCtrl.Comp; // Start transmission
}
 
//------------------------------------------------------
//SIGNAL(SIG_SPI)
void SPI_TransmitByte(void)
{
if (!(SPSR & (1 << SPIF))) return;
if (SPI_BufferIndex < sizeof(FromNaviCtrl))
{ SPI_Buffer[SPI_BufferIndex]= SPDR; // get data
//if(SPDR!= 0x00) DebugOut.Analog[19]++; ;
}
if (SPI_BufferIndex < sizeof(ToNaviCtrl))
{ SPDR = Ptr_buffer[SPI_BufferIndex];
}
else
{
unsigned char *ptr = (unsigned char *)&FromNaviCtrl;
unsigned char i;
SLAVE_SELECT_PORT |= (1 << SPI_SLAVE_SELECT); // DeselectSlave
memcpy(ptr, (unsigned char *) SPI_Buffer, sizeof(SPI_Buffer));
}
SPI_BufferIndex++;
}
 
//------------------------------------------------------
void UpdateSPI_Buffer(void)
{
cli();
ToNaviCtrl.Comp = SPI_PROTOCOL_COMP;
ToNaviCtrl.IntegralNick = (int) (IntegralNick >> 4);
ToNaviCtrl.IntegralRoll = (int) (IntegralRoll >> 4);
ToNaviCtrl.StickNick = (char) StickNick;
ToNaviCtrl.StickRoll = (char) StickRoll;
ToNaviCtrl.StickGier = (char) StickGier;
sei();
}
 
 
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/spi.h
0,0 → 1,46
// ######################## SPI - FlightCtrl ###################
#ifndef _SPI_H
#define _SPI_H
 
#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
 
 
#define SLAVE_SELECT_DDR_PORT DDRC
#define SLAVE_SELECT_PORT PORTC
#define SPI_SLAVE_SELECT PC5
 
struct str_ToNaviCtrl
{
unsigned char Comp;
int IntegralNick;
int IntegralRoll;
char StickNick,StickRoll,StickGier;
};
 
struct str_FromNaviCtrl
{
unsigned char Comp;
int GPS_Nick;
int GPS_Roll;
int CompassValue;
};
 
extern struct str_ToNaviCtrl ToNaviCtrl;
extern struct str_FromNaviCtrl FromNaviCtrl;
 
 
extern void SPI_MasterInit(void);
extern void SPI_StartTransmitPacket(void);
extern void UpdateSPI_Buffer(void);
extern void SPI_TransmitByte(void);
 
 
 
#endif
/branches/salvo_gps/Basis_v0067g/tags/v0007/timer0.c
0,0 → 1,192
#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;
unsigned int BeepMuster = 0xffff;
int ServoValue = 0;
//Salvo 8.9.2007
volatile uint8_t Kompass_Neuer_Wert= 0;
volatile unsigned int Kompass_Value_Old = 0;
// Salvo End
//Salvo 21.9.2007
short unsigned int Kompass_present= 0; //>0 bedeutet dass der Kompass vorhanden ist
// Salvo End
enum {
STOP = 0,
CK = 1,
CK8 = 2,
CK64 = 3,
CK256 = 4,
CK1024 = 5,
T0_FALLING_EDGE = 6,
T0_RISING_EDGE = 7
};
 
// Aenderungen von Peter Muehlenbrock ("Salvo") Stand 24.12.2007
/*
Ersatzkompass abgeleitet aus Magnetkompass und Giergyro fuer nahezu neigungsubhaengige Kompassfunktion
*/
SIGNAL (SIG_OVERFLOW0) // 8kHz
{
static unsigned char cnt_1ms = 1,cnt = 0;
unsigned char pieper_ein = 0;
// TCNT0 -= 250;//TIMER_RELOAD_VALUE;
 
if(!cnt--)
{
if (Kompass_present > 0) Kompass_present--; //Runterzaehlen. Wenn 0 ist der Kompass nicht vorhanden
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 < 4000))
{
// Salvo Kompassoffset 23.12.2007 ***********
Kompass_present = 255;
// Kompass_Value_Old = KompassValue;
if (KOMPASS_OFFSET > 0) KompassValue = cntKompass -KOMPASS_OFFSET;
else KompassValue = cntKompass - ((int) (Parameter_UserParam4*2));
 
if (KompassValue < 0)
{
KompassValue += 360;
}
if (KompassValue >= 360)
{
KompassValue -= 360;
}
// Salvo End
}
// if(cntKompass < 10) cntKompass = 10;
// KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
//Salvo 13.9.2007 Ok Erkennung des Magnetkompasses
Kompass_Neuer_Wert = 1;
// Salvo End
cntKompass = 0;
}
}
}
 
 
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;
 
TCCR2A=(1<<COM2A1)|(1<<COM2A0)|3;
TCCR2B=(0<<CS20)|(1<<CS21)|(1<<CS22);
// TIMSK2 |= _BV(TOIE2);
TIMSK2 |= _BV(OCIE2A);
 
TIMSK0 |= _BV(TOIE0);
OCR2A = 10;
TCNT2 = 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)) ANALOG_ON;
}
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Servo ansteuern
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SIGNAL(SIG_OUTPUT_COMPARE2A)
{
static unsigned char timer = 10;
if(!timer--)
{
TCCR2A=(1<<COM2A1)|(0<<COM2A0)|3;
ServoValue = Parameter_ServoNickControl;
if(EE_Parameter.ServoNickCompInvert & 0x01) ServoValue += ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512;
else ServoValue -= ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512;
if(ServoValue < EE_Parameter.ServoNickMin) ServoValue = EE_Parameter.ServoNickMin;
else if(ServoValue > EE_Parameter.ServoNickMax) ServoValue = EE_Parameter.ServoNickMax;
 
OCR2A = ServoValue;// + 75;
timer = EE_Parameter.ServoNickRefresh;
}
else
{
TCCR2A =3;
PORTD&=~0x80;
}
}
/branches/salvo_gps/Basis_v0067g/tags/v0007/timer0.h
0,0 → 1,28
 
#define TIMER_TEILER CK8
#define TIMER_RELOAD_VALUE 250
 
// Salvo Kompassoffset 24.12.2007 ***********
//#define KOMPASS_OFFSET 135// Winkel zwischen Nordachse Kopter und Nordachse Kompass
#define KOMPASS_OFFSET 0 // Winkel zwischen Nordachse Kopter und Nordachse Kompass
// Wenn 0 wird der UserParameter4 fuer den Offset verwendet (0..360 Grad entspricht 0 ..180)
// Salvo End
 
void Timer_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;
 
//Salvo 21.9.2007
extern volatile uint8_t Kompass_Neuer_Wert;
extern volatile unsigned int Kompass_Value_Old;
extern unsigned short int Kompass_present;
// Salvo End
/branches/salvo_gps/Basis_v0067g/tags/v0007/twimaster.c
0,0 → 1,152
/*############################################################################
############################################################################*/
 
#include "main.h"
 
unsigned char twi_state = 0;
unsigned char motor = 0;
unsigned char motorread = 0;
unsigned char motor_rx[8];
 
//############################################################################
//Initzialisieren der I2C (TWI) Schnittstelle
void i2c_init(void)
//############################################################################
{
TWSR = 0;
TWBR = ((SYSCLK/SCL_CLOCK)-16)/2;
}
 
//############################################################################
//Start I2C
char i2c_start(void)
//############################################################################
{
TWCR = (1<<TWSTA) | (1<<TWEN) | (1<<TWINT) | (1<<TWIE);
return(0);
}
 
//############################################################################
//Start I2C
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);
}
 
//############################################################################
//Start I2C
char i2c_write_byte(char byte)
//############################################################################
{
TWSR = 0x00;
TWDR = byte;
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE);
return(0);
}
 
//############################################################################
//Start I2C
SIGNAL (TWI_vect)
//############################################################################
{
switch (twi_state++)
{
case 0:
i2c_write_byte(0x52+(motor*2));
break;
case 1:
switch(motor++)
{
case 0:
i2c_write_byte(Motor_Vorne);
break;
case 1:
i2c_write_byte(Motor_Hinten);
break;
case 2:
i2c_write_byte(Motor_Rechts);
break;
case 3:
i2c_write_byte(Motor_Links);
break;
}
break;
case 2:
i2c_stop();
if (motor<4) twi_state = 0;
else motor = 0;
i2c_start();
break;
//Liest Daten von Motor
case 3:
i2c_write_byte(0x53+(motorread*2));
break;
case 4:
switch(motorread)
{
case 0:
i2c_write_byte(Motor_Vorne);
break;
case 1:
i2c_write_byte(Motor_Hinten);
break;
case 2:
i2c_write_byte(Motor_Rechts);
break;
case 3:
i2c_write_byte(Motor_Links);
break;
}
break;
case 5: //1 Byte vom Motor lesen
motor_rx[motorread] = TWDR;
 
case 6:
switch(motorread)
{
case 0:
i2c_write_byte(Motor_Vorne);
break;
case 1:
i2c_write_byte(Motor_Hinten);
break;
case 2:
i2c_write_byte(Motor_Rechts);
break;
case 3:
i2c_write_byte(Motor_Links);
break;
}
break;
case 7: //2 Byte vom Motor lesen
motor_rx[motorread+4] = TWDR;
motorread++;
if (motorread>3) motorread=0;
i2c_stop();
I2CTimeout = 10;
twi_state = 0;
}
TWCR |= 0x80;
}
/branches/salvo_gps/Basis_v0067g/tags/v0007/twimaster.h
0,0 → 1,33
/*############################################################################
############################################################################*/
 
#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 unsigned char twi_state;
extern unsigned char motor;
extern unsigned char motorread;
extern unsigned char motor_rx[8];
 
void i2c_reset(void);
extern void i2c_init (void); // I2C initialisieren
extern char i2c_start (void); // Start I2C
extern void i2c_stop (void); // Stop I2C
extern char i2c_write_byte (char byte); // 1 Byte schreiben
extern void i2c_reset(void);
 
#endif
/branches/salvo_gps/Basis_v0067g/tags/v0007/uart.c
0,0 → 1,406
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + 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"
#include "uart.h"
 
unsigned char DebugGetAnforderung = 0,DebugDisplayAnforderung = 0,DebugDataAnforderung = 0,GetVersionAnforderung = 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 volatile char PC_DebugTimeout = 0;
unsigned char RemotePollDisplayLine = 0;
unsigned char NurKanalAnforderung = 0;
unsigned char DebugTextAnforderung = 255;
unsigned char PcZugriff = 100;
unsigned char MotorTest[4] = {0,0,0,0};
unsigned char DubWiseKeys[3] = {0,0,0};
unsigned char MeineSlaveAdresse;
struct str_DebugOut DebugOut;
struct str_Debug DebugIn;
struct str_VersionInfo VersionInfo;
int Debug_Timer;
//Salvo 26.10.2007
int dataset_cnt=0; //Zaehlt die uebertragenen Debugdaten
//Salvo End
 
const unsigned char ANALOG_TEXT[32][16] =
{
//1234567890123456
"IntegralNick ", //0
"IntegralRoll ",
"AccNick ",
"AccRoll ",
"GyroGier ",
"HoehenWert ", //5
"AccZ ",
"Gas ",
"KompassValue ",
"Ersatzkompass ",
"Usr_Par1 ", //10
"Usr_par3 ",
"Motor_Vorne ",
"Motor_Hinten ",
"Motor_Links ",
"Motor_Rechts ", //15
 
/* "delta_east ",
"delta_north ",
"speed_e ",
"speed_n ", //15
*/
"Index ",
"UBat ",
"Messwert_Nick ",
"Messwert_Roll ",
"Messwert_Gier ", //20
"Stick_Nick ",
"Stick_Roll ",
"Stick_Gier ",
"GPS_Nick ",
"GPS_Roll ", //25
"utm_east ",
"utm_north ",
"utm_alt ",
"gps_state ",
// "dist_flown ", //30
// "dist_2home "
"gp_reg_x ", //30
"gp_reg_y "
};
 
 
 
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ 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;
//Salvo 11.9.2007 GPS Daten holen
Get_Ublox_Msg(SioTmp); // Daten vom GPS Modul holen
// Salvo End
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;
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 modul, unsigned char *snd, unsigned char len)
{
unsigned int pt = 0;
unsigned char a,b,c;
unsigned char ptr = 0;
 
SendeBuffer[pt++] = '#'; // Startzeichen
SendeBuffer[pt++] = modul; // Adresse (a=0; b=1,...)
SendeBuffer[pt++] = cmd; // Commando
 
while(len)
{
if(len) { a = snd[ptr++]; len--;} else a = 0;
if(len) { b = snd[ptr++]; len--;} else b = 0;
if(len) { c = snd[ptr++]; len--;} 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);
}
AddCRC(pt);
}
 
 
// --------------------------------------------------------------------------
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max) // Wohin mit den Daten; Wie lang; Wo im RxdBuffer
{
unsigned char a,b,c,d;
unsigned char ptr = 0;
unsigned char x,y,z;
while(len)
{
a = RxdBuffer[ptrIn++] - '=';
b = RxdBuffer[ptrIn++] - '=';
c = RxdBuffer[ptrIn++] - '=';
d = RxdBuffer[ptrIn++] - '=';
if(ptrIn > max - 2) break; // nicht mehr Daten verarbeiten, als empfangen wurden
 
x = (a << 2) | (b >> 4);
y = ((b & 0x0f) << 4) | (c >> 2);
z = ((c & 0x03) << 6) | d;
 
if(len--) ptrOut[ptr++] = x; else break;
if(len--) ptrOut[ptr++] = y; else break;
if(len--) ptrOut[ptr++] = z; else break;
}
 
}
 
// --------------------------------------------------------------------------
void BearbeiteRxDaten(void)
{
if(!NeuerDatensatzEmpfangen) return;
 
// unsigned int tmp_int_arr1[1];
// unsigned int tmp_int_arr2[2];
// unsigned int tmp_int_arr3[3];
unsigned char tmp_char_arr2[2];
// unsigned char tmp_char_arr3[3];
// unsigned char tmp_char_arr4[4];
//if(!MotorenEin)
PcZugriff = 255;
switch(RxdBuffer[2])
{
case 'a':// Texte der Analogwerte
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
DebugTextAnforderung = tmp_char_arr2[0];
break;
case 'c':// Debugdaten incl. Externe IOs usw
Decode64((unsigned char *) &DebugIn,sizeof(DebugIn),3,AnzahlEmpfangsBytes);
/* for(unsigned char i=0; i<4;i++)
{
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2], DebugIn.Analog[i]);
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2 + 1], DebugIn.Analog[i] >> 8);
}*/
RemoteTasten |= DebugIn.RemoteTasten;
DebugDataAnforderung = 1;
break;
case 'h':// x-1 Displayzeilen
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
RemoteTasten |= tmp_char_arr2[0];
if(tmp_char_arr2[1] == 255) NurKanalAnforderung = 1; else NurKanalAnforderung = 0; // keine Displaydaten
DebugDisplayAnforderung = 1;
break;
case 't':// Motortest
Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes);
break;
case 'k':// Keys von DubWise
Decode64((unsigned char *) &DubWiseKeys[0],sizeof(DubWiseKeys),3,AnzahlEmpfangsBytes);
break;
case 'v': // Version-Anforderung und Ausbaustufe
GetVersionAnforderung = 1;
break;
case 'g':// "Get"-Anforderung für Debug-Daten
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
DebugGetAnforderung = 1;
break;
case 'q':// "Get"-Anforderung für Settings
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
if(tmp_char_arr2[0] != 0xff)
{
if(tmp_char_arr2[0] > 5) tmp_char_arr2[0] = 5;
ReadParameterSet(tmp_char_arr2[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
SendOutData('L' + tmp_char_arr2[0] -1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE);
}
else
SendOutData('L' + GetActiveParamSetNumber()-1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE);
break;
case 'l':
case 'm':
case 'n':
case 'o':
case 'p': // Parametersatz speichern
Decode64((unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE,3,AnzahlEmpfangsBytes);
WriteParameterSet(RxdBuffer[2] - 'l' + 1, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1); // aktiven Datensatz merken
Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L;
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L;
Piep(GetActiveParamSetNumber());
break;
}
// DebugOut.AnzahlZyklen = Debug_Timer_Intervall;
NeuerDatensatzEmpfangen = 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(200);
}
 
//---------------------------------------------------------------------------------------------
void DatenUebertragung(void)
{
// static char dis_zeile = 0;
if(!UebertragungAbgeschlossen) return;
 
if(DebugGetAnforderung && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen
{
SendOutData('G',MeineSlaveAdresse,(unsigned char *) &DebugIn,sizeof(DebugIn));
DebugGetAnforderung = 0;
}
 
if((CheckDelay(Debug_Timer) || DebugDataAnforderung) && UebertragungAbgeschlossen)
{
SendOutData('D',MeineSlaveAdresse,(unsigned char *) &DebugOut,sizeof(DebugOut));
DebugDataAnforderung = 0;
//Salvo 26.10.2007 Counter fuer Erkennung von fehlenden Daten per Bluetoothuebertragung
dataset_cnt++;
// Salvo End
Debug_Timer = SetDelay(MIN_DEBUG_INTERVALL);
}
if(DebugTextAnforderung != 255) // Texte für die Analogdaten
{
SendOutData('A',DebugTextAnforderung + '0',(unsigned char *) ANALOG_TEXT[DebugTextAnforderung],16);
DebugTextAnforderung = 255;
}
 
if(DebugDisplayAnforderung && UebertragungAbgeschlossen)
{
Menu();
DebugDisplayAnforderung = 0;
if(++RemotePollDisplayLine == 4 || NurKanalAnforderung)
{
SendOutData('4',0,(unsigned char *)&PPM_in,sizeof(PPM_in)); // DisplayZeile übertragen
RemotePollDisplayLine = -1;
}
else SendOutData('0' + RemotePollDisplayLine,0,(unsigned char *)&DisplayBuff[20 * RemotePollDisplayLine],20); // DisplayZeile übertragen
}
if(GetVersionAnforderung && UebertragungAbgeschlossen)
{
SendOutData('V',MeineSlaveAdresse,(unsigned char *) &VersionInfo,sizeof(VersionInfo));
GetVersionAnforderung = 0;
}
 
}
 
/branches/salvo_gps/Basis_v0067g/tags/v0007/uart.h
0,0 → 1,106
#ifndef _UART_H
#define _UART_H
 
#define MAX_SENDE_BUFF 150
#define MAX_EMPFANGS_BUFF 150
#define DUB_KEY_UP 4
#define DUB_KEY_DOWN 8
#define DUB_KEY_RIGHT 32
#define DUB_KEY_LEFT 16
#define DUB_KEY_FIRE 64
 
 
 
//Salvo 26.10.2007
extern int dataset_cnt;
// salvo End
 
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 char MeineSlaveAdresse;
extern unsigned char PcZugriff;
extern unsigned char RemotePollDisplayLine;
extern int Debug_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 DecodeNMEA(void);
extern void BearbeiteRxDaten(void);
extern unsigned char MotorTest[4];
extern unsigned char DubWiseKeys[3];
struct str_DebugOut
{
unsigned char Digital[2];
unsigned int Analog[32]; // Debugwerte
};
 
extern struct str_DebugOut DebugOut;
 
struct str_Debug
{
unsigned char Digital[2];
unsigned char RemoteTasten;
unsigned int Analog[4];
};
extern struct str_Debug DebugIn;
 
struct str_VersionInfo
{
unsigned char Hauptversion;
unsigned char Nebenversion;
unsigned char PCKompatibel;
unsigned char Rserved[7];
};
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
 
 
#endif //_UART_H
/branches/salvo_gps/Basis_v0067g/tags/v0007
Property changes:
Added: svn:ignore
+*.bak
+*.aps
+*.elf
+*.sym
+*.map
+*.lss
+*.eep
+*.txt
+*.mkp