1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Merge remote-tracking branch 'upstream/next' into filnet/LP-29_osgearth_integration

Conflicts:
	ground/gcs/gcs.pri
	ground/gcs/gcs.pro
	ground/gcs/openpilotgcs.pri
	ground/gcs/openpilotgcs.pro
	ground/gcs/src/app/gcs.icns
	ground/gcs/src/app/gcs.ico
	ground/gcs/src/app/librepilotgcs.icns
	ground/gcs/src/app/librepilotgcs.ico
	ground/gcs/src/app/librepilotgcs.rc
	ground/gcs/src/app/openpilotgcs.icns
	ground/gcs/src/library.pri
	ground/gcs/src/openpilotgcslibrary.pri
	ground/gcs/src/openpilotgcsplugin.pri
	ground/gcs/src/plugin.pri
	ground/gcs/src/plugins/config/airframe.ui
	ground/gcs/src/plugins/config/images/calibration/board-dwn.png
	ground/gcs/src/plugins/config/images/calibration/board-enu.png
	ground/gcs/src/plugins/config/images/calibration/board-ned.png
	ground/gcs/src/plugins/config/images/calibration/board-suw.png
	ground/gcs/src/plugins/config/images/calibration/board-swd.png
	ground/gcs/src/plugins/config/images/calibration/board-use.png
	ground/gcs/src/plugins/config/images/calibration/board-wds.png
	ground/gcs/src/plugins/config/images/calibration/empty.png
	ground/gcs/src/plugins/config/images/calibration/plane-dwn.png
	ground/gcs/src/plugins/config/images/calibration/plane-enu.png
	ground/gcs/src/plugins/config/images/calibration/plane-horizontal-rotated.png
	ground/gcs/src/plugins/config/images/calibration/plane-ned.png
	ground/gcs/src/plugins/config/images/calibration/plane-suw.png
	ground/gcs/src/plugins/config/images/calibration/plane-swd.png
	ground/gcs/src/plugins/config/images/calibration/plane-use.png
	ground/gcs/src/plugins/config/images/calibration/plane-wds.png
	ground/gcs/src/plugins/setupwizard/vehicletemplateselectorwidget.ui
	ground/gcs/src/plugins/systemhealth/html/GPS-Error.html
	ground/gcs/src/plugins/systemhealth/html/fr/GPS-Error.html
	ground/gcs/src/share/cloudconfig/custom/whats_this.txt
	ground/gcs/src/share/cloudconfig/fixedwing/SoniModelMako-FixedWing-Elevon-7134e8ae5ce.optmpl
	ground/gcs/src/share/cloudconfig/fixedwing/Toro900-VoilureFixe-Elevon-d4a58d2cd50.optmpl
	ground/gcs/src/share/cloudconfig/fixedwing/whats_this.txt
	ground/gcs/src/share/cloudconfig/helicopter/whats_this.txt
	ground/gcs/src/share/cloudconfig/multirotor/(RACE)FPV260HobbyKin-Multirotor-QuadrocopterX-0482b7a25f7.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/(STOCK)HobbyKingFPV2-Multirotor-QuadrocopterX-0bb44b68883.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/ARRISX-SPEEDFPV250-Unsupported-2cbaaa14a01.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/BlackOutB330-Multirotor-QuadrocopterX-e9980c55302.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/BlackOutMiniH-Multirotor-QuadrocopterX-d415c242154.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/DJIF450-Multirotor-QuadrocopterX-cfa8ec67993.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/DroneframesDRQ250-cf-rc5 Multirotor-QuadrocopterX-425b90123f1.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/DroneframesDRQ430G-revo-rc5Multirotor-QuadrocopterX-fae90503b3f.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/EmaxNighthawk-Multirotor-QuadrocopterX-9a3aa9d9726.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/FlipFPVPro-Multirotor-QuadrocopterX-9eb7b719244.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/FlipFpvPro-Multirotor-QuadrocopterX-c117d151f95.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/FlipSport-Multirotor-QuadrocopterX-c27ae7b79ca.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/FlyingCinemaCinetan-Multirotor-QuadrocopterX-2c3f9181872.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/FlyingCinemaTankitoM-Multirotor-QuadrocopterX-385d9ac9ae1.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GenericHexa-Multirotor-Hexacopter+-c50a904f4a3.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GenericHexaH-Multirotor-HexacopterH-6cc3fed9073.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GenericHexaX-Multirotor-HexacopterX-b3b8c1d2f3c.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GenericHexaY6-Multirotor-HexacopterY6-0b5dc6bae4f.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GenericQuad+-Multirotor-Quadrocopter+-a87a4226820.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GenericQuadX-Multirotor-QuadrocopterX-5fce7315a5b.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GenericTricopter-Multirotor-Tricopter-5f46bc37c31.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/GuerrillaDronesToadQ-Multirotor-QuadrocopterX-8f838e43432.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/HKingDYS250CarbonFib-Multirotor-QuadrocopterX-969354c51c1.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/HKingDYS320CarbonFib-Multirotor-QuadrocopterX-0b41edda68f.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/HoverThingsFLIPFPV-Multirotor-QuadrocopterX-32bf14a10fc.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/InventorsSparrowRace-Multirotor-QuadrocopterX-314fff867fd.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/QAV250-Multirotor-QuadrocopterX-181dab0df01.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/QAV400-Multirotor-QuadrocopterX-90a90b9fb50.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/QAV500-Multirotor-QuadrocopterX-6da440c4d7c.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/QUADI250-Multirotor-QuadrocopterX-c6c6cfc4cf9.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/RCExplorerV3Tricopte-Multirotor-Tricopter-dcbce3f069c.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/RD290MiniHexfpv-Multirotor-HexacopterX-6587232be1a.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/XhoverMXP230Elite-Multirotor-QuadrocopterX-3b169a4fd1b.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/ZMR250( Attitude mode)-ChineseQAV250-Multirotor-QuadrocopterX-5d318c0526c (1).optmpl
	ground/gcs/src/share/cloudconfig/multirotor/ZMR250(4s race)-Multirotor-QuadrocopterX-fac61e7adb8.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/ZMR250(Race acro +)-Multirotor-QuadrocopterX-895b222d670.optmpl
	ground/gcs/src/share/cloudconfig/multirotor/whats_this.txt
	ground/gcs/src/share/cloudconfig/surface/whats_this.txt
	ground/gcs/src/share/translations/gcs_de.ts
	ground/gcs/src/share/translations/gcs_es.ts
	ground/gcs/src/share/translations/gcs_fr.ts
	ground/gcs/src/share/translations/gcs_ru.ts
	ground/gcs/src/share/translations/gcs_zh_CN.ts
	ground/gcs/src/share/translations/openpilotgcs_de.ts
	ground/gcs/src/share/translations/openpilotgcs_es.ts
	ground/gcs/src/share/translations/openpilotgcs_fr.ts
	ground/gcs/src/share/translations/openpilotgcs_ru.ts
	ground/gcs/src/share/translations/openpilotgcs_zh_CN.ts
	ground/gcs/src/share/vehicletemplates/custom/whats_this.txt
	ground/gcs/src/share/vehicletemplates/fixedwing/SoniModelMako-FixedWing-Elevon-7134e8ae5ce.optmpl
	ground/gcs/src/share/vehicletemplates/fixedwing/Toro900-VoilureFixe-Elevon-d4a58d2cd50.optmpl
	ground/gcs/src/share/vehicletemplates/fixedwing/whats_this.txt
	ground/gcs/src/share/vehicletemplates/helicopter/whats_this.txt
	ground/gcs/src/share/vehicletemplates/multirotor/(RACE)FPV260HobbyKin-Multirotor-QuadrocopterX-0482b7a25f7.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/(STOCK)HobbyKingFPV2-Multirotor-QuadrocopterX-0bb44b68883.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/ARRISX-SPEEDFPV250-Unsupported-2cbaaa14a01.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/BlackOutB330-Multirotor-QuadrocopterX-e9980c55302.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/BlackOutMiniH-Multirotor-QuadrocopterX-d415c242154.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/DJIF450-Multirotor-QuadrocopterX-cfa8ec67993.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/DroneframesDRQ250-cf-rc5 Multirotor-QuadrocopterX-425b90123f1.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/DroneframesDRQ430G-revo-rc5Multirotor-QuadrocopterX-fae90503b3f.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/EmaxNighthawk-Multirotor-QuadrocopterX-9a3aa9d9726.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/FlipFPVPro-Multirotor-QuadrocopterX-9eb7b719244.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/FlipFpvPro-Multirotor-QuadrocopterX-c117d151f95.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/FlipSport-Multirotor-QuadrocopterX-c27ae7b79ca.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/FlyingCinemaCinetan-Multirotor-QuadrocopterX-2c3f9181872.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/FlyingCinemaTankitoM-Multirotor-QuadrocopterX-385d9ac9ae1.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GenericHexa-Multirotor-Hexacopter+-c50a904f4a3.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GenericHexaH-Multirotor-HexacopterH-6cc3fed9073.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GenericHexaX-Multirotor-HexacopterX-b3b8c1d2f3c.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GenericHexaY6-Multirotor-HexacopterY6-0b5dc6bae4f.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GenericQuad+-Multirotor-Quadrocopter+-a87a4226820.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GenericQuadX-Multirotor-QuadrocopterX-5fce7315a5b.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GenericTricopter-Multirotor-Tricopter-5f46bc37c31.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/GuerrillaDronesToadQ-Multirotor-QuadrocopterX-8f838e43432.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/HKingDYS250CarbonFib-Multirotor-QuadrocopterX-969354c51c1.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/HKingDYS320CarbonFib-Multirotor-QuadrocopterX-0b41edda68f.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/HoverThingsFLIPFPV-Multirotor-QuadrocopterX-32bf14a10fc.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/InventorsSparrowRace-Multirotor-QuadrocopterX-314fff867fd.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/QAV250-Multirotor-QuadrocopterX-181dab0df01.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/QAV400-Multirotor-QuadrocopterX-90a90b9fb50.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/QAV500-Multirotor-QuadrocopterX-6da440c4d7c.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/QUADI250-Multirotor-QuadrocopterX-c6c6cfc4cf9.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/RCExplorerV3Tricopte-Multirotor-Tricopter-dcbce3f069c.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/RD290MiniHexfpv-Multirotor-HexacopterX-6587232be1a.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/XhoverMXP230Elite-Multirotor-QuadrocopterX-3b169a4fd1b.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/ZMR250( Attitude mode)-ChineseQAV250-Multirotor-QuadrocopterX-5d318c0526c (1).optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/ZMR250(4s race)-Multirotor-QuadrocopterX-fac61e7adb8.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/ZMR250(Race acro +)-Multirotor-QuadrocopterX-895b222d670.optmpl
	ground/gcs/src/share/vehicletemplates/multirotor/whats_this.txt
	ground/openpilotgcs/openpilotgcs.pri
	ground/openpilotgcs/openpilotgcs.pro
	ground/openpilotgcs/src/app/librepilotgcs.icns
	ground/openpilotgcs/src/app/librepilotgcs.ico
	ground/openpilotgcs/src/openpilotgcslibrary.pri
	ground/openpilotgcs/src/openpilotgcsplugin.pri
	ground/openpilotgcs/src/share/cloudconfig/custom/whats_this.txt
	ground/openpilotgcs/src/share/cloudconfig/fixedwing/SoniModelMako-FixedWing-Elevon-7134e8ae5ce.optmpl
	ground/openpilotgcs/src/share/cloudconfig/fixedwing/Toro900-VoilureFixe-Elevon-d4a58d2cd50.optmpl
	ground/openpilotgcs/src/share/cloudconfig/fixedwing/whats_this.txt
	ground/openpilotgcs/src/share/cloudconfig/helicopter/whats_this.txt
	ground/openpilotgcs/src/share/cloudconfig/multirotor/(RACE)FPV260HobbyKin-Multirotor-QuadrocopterX-0482b7a25f7.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/(STOCK)HobbyKingFPV2-Multirotor-QuadrocopterX-0bb44b68883.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/ARRISX-SPEEDFPV250-Unsupported-2cbaaa14a01.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/BlackOutB330-Multirotor-QuadrocopterX-e9980c55302.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/BlackOutMiniH-Multirotor-QuadrocopterX-d415c242154.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/DJIF450-Multirotor-QuadrocopterX-cfa8ec67993.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/DroneframesDRQ250-cf-rc5 Multirotor-QuadrocopterX-425b90123f1.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/DroneframesDRQ430G-revo-rc5Multirotor-QuadrocopterX-fae90503b3f.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/EmaxNighthawk-Multirotor-QuadrocopterX-9a3aa9d9726.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/FlipFPVPro-Multirotor-QuadrocopterX-9eb7b719244.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/FlipFpvPro-Multirotor-QuadrocopterX-c117d151f95.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/FlipSport-Multirotor-QuadrocopterX-c27ae7b79ca.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/FlyingCinemaCinetan-Multirotor-QuadrocopterX-2c3f9181872.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/FlyingCinemaTankitoM-Multirotor-QuadrocopterX-385d9ac9ae1.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GenericHexa-Multirotor-Hexacopter+-c50a904f4a3.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GenericHexaH-Multirotor-HexacopterH-6cc3fed9073.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GenericHexaX-Multirotor-HexacopterX-b3b8c1d2f3c.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GenericHexaY6-Multirotor-HexacopterY6-0b5dc6bae4f.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GenericQuad+-Multirotor-Quadrocopter+-a87a4226820.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GenericQuadX-Multirotor-QuadrocopterX-5fce7315a5b.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GenericTricopter-Multirotor-Tricopter-5f46bc37c31.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/GuerrillaDronesToadQ-Multirotor-QuadrocopterX-8f838e43432.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/HKingDYS250CarbonFib-Multirotor-QuadrocopterX-969354c51c1.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/HKingDYS320CarbonFib-Multirotor-QuadrocopterX-0b41edda68f.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/HoverThingsFLIPFPV-Multirotor-QuadrocopterX-32bf14a10fc.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/InventorsSparrowRace-Multirotor-QuadrocopterX-314fff867fd.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/QAV250-Multirotor-QuadrocopterX-181dab0df01.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/QAV400-Multirotor-QuadrocopterX-90a90b9fb50.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/QAV500-Multirotor-QuadrocopterX-6da440c4d7c.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/QUADI250-Multirotor-QuadrocopterX-c6c6cfc4cf9.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/RCExplorerV3Tricopte-Multirotor-Tricopter-dcbce3f069c.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/RD290MiniHexfpv-Multirotor-HexacopterX-6587232be1a.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/XhoverMXP230Elite-Multirotor-QuadrocopterX-3b169a4fd1b.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/ZMR250( Attitude mode)-ChineseQAV250-Multirotor-QuadrocopterX-5d318c0526c (1).optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/ZMR250(4s race)-Multirotor-QuadrocopterX-fac61e7adb8.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/ZMR250(Race acro +)-Multirotor-QuadrocopterX-895b222d670.optmpl
	ground/openpilotgcs/src/share/cloudconfig/multirotor/whats_this.txt
	ground/openpilotgcs/src/share/translations/openpilotgcs_de.ts
	ground/openpilotgcs/src/share/translations/openpilotgcs_es.ts
	ground/openpilotgcs/src/share/translations/openpilotgcs_fr.ts
	ground/openpilotgcs/src/share/translations/openpilotgcs_ru.ts
	ground/openpilotgcs/src/share/translations/openpilotgcs_zh_CN.ts
	make/tools.mk
This commit is contained in:
Philippe Renon 2015-08-29 17:03:48 +02:00
commit 955eecf33d
317 changed files with 110045 additions and 3056 deletions

42
.gitignore vendored
View File

@ -4,6 +4,10 @@
/build
/3rdparty
# Ignore user config
config
# Exclude temporary and system files
Thumbs.db
.DS_Store
@ -12,7 +16,7 @@ GRTAGS
GSYMS
GTAGS
core
*~
*~
# flight
/flight/*.pnproj
@ -25,29 +29,24 @@ core
/flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/*.pbxuser
# ground
openpilotgcs-build-desktop
ground/openpilotgcs/.cproject
ground/openpilotgcs/.project
ground/openpilotgcs/.settings
gcs-build-desktop
ground/gcs/.cproject
ground/gcs/.project
ground/gcs/.settings
# Ignore some of the .pro.user files
# Ignore .pro.user files
*.pro.user
/ground/openpilotgcs/openpilotgcs.pro.user
/ground/uavobjgenerator/uavobjgenerator.pro.user
/ground/uavobjects/uavobjects.pro.user
/ground/ground.pro.user
/ground/openpilotgcs/src/libs/sdlgamepad.pro.user
# Misc artifacts
/ground/openpilotgcs/share/openpilotgcs/sounds/normalize.exe
/ground/openpilotgcs/share/openpilotgcs/sounds/default/normalize.exe
/ground/openpilotgcs/share/openpilotgcs/translations/extract-mimetypes.xq
/ground/openpilotgcs/src/experimental/tools/DocumentationHelper/ui_mainwindow.h
/ground/openpilotgcs/src/libs/qextserialport/.hg
/ground/openpilotgcs/src/libs/qextserialport/.hgtags
/ground/openpilotgcs/src/libs/qwt/qwt.prf
/ground/openpilotgcs/src/libs/qwt/designer
/ground/openpilotgcs/src/plugins/ipconnection/ui_ipconnectionoptionspage.h
*.exe
/ground/gcs/share/translations/extract-mimetypes.xq
/ground/gcs/src/experimental/tools/DocumentationHelper/ui_mainwindow.h
/ground/gcs/src/libs/qextserialport/.hg
/ground/gcs/src/libs/qextserialport/.hgtags
/ground/gcs/src/libs/qwt/qwt.prf
/ground/gcs/src/libs/qwt/designer
/ground/gcs/src/plugins/ipconnection/ui_ipconnectionoptionspage.h
# Ignore intermediate files generated by command-line android builds
# Couldn't figure out how to force these files into the ./build directory
@ -74,3 +73,6 @@ RemoteSystemsTempFiles
*.rej
*.orig
*.diff~
# ignore ccache storage
.ccache

40
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,40 @@
How to build from source?
=========================
Both development environment and GCS are supported on Windows, Linux and Mac OS X
The first step is to Install all OS specific prerequisites.
###Mac OS X
Install XCode and its relatated command line tools (follow Apple documentation).
Install git, curl and p7zip. You can use brew `brew install git curl p7zip` or macport: `sudo port install git curl p7zip`
###Ubuntu
sudo apt-get install git build-essentials curl gdb wget debhelper p7zip-full unzip flex bison libsdl1.2-dev libudev-dev libusb-1.0-0-dev libc6-i386 mesa-common-dev
###Windows
Install [msysGIT](https://msysgit.github.io/) under `C:\git`
Clone LibrePilot Git repository.
Open Git Bash and run
cd /path/to/LibrePilot_root
./make/scripts/win_sdk_install.sh
You can build using the `/path/to/LibrePilot_root/make/winx86/bin/make` wrapper to call `mingw32-make.exe` as:
./make/winx86/bin/make all_sdk_install
or call `mingw32-make` directly
mingw32-make all_sdk_install
##Setup the build environment and build
The `all_sdk_install` target will automatically retrieve and install all needed tools (qt, arm gcc etc.) in a local folder `/path/to/LibrePilot_root/tools`
make all_sdk_install
make package
The `package` target will build the complete installable package for the current platform.
Run make with no arguments to show the complete list of supported targets.

186
Makefile
View File

@ -1,5 +1,6 @@
#
# Top level Makefile for the OpenPilot project build system.
# Top level Makefile for the LibrePilot Project build system.
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
# Use 'make help' for instructions.
#
@ -25,44 +26,38 @@
# existance by each sub-make.
export TOP_LEVEL_MAKEFILE := TRUE
# It is possible to set OPENPILOT_DL_DIR and/or OPENPILOT_TOOLS_DIR environment
# The root directory that this makefile resides in
export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
# Include some helper functions
include $(ROOT_DIR)/make/functions.mk
# This file can be used to override default options using the "override" keyword
CONFIG_FILE := config
-include $(CONFIG_FILE)
##############################
# It is possible to set DL_DIR and/or TOOLS_DIR environment
# variables to override local tools download and installation directorys. So the
# same toolchains can be used for all working copies. Particularly useful for CI
# server build agents, but also for local installations.
#
# If no OPENPILOT_* variables found, makefile internal DL_DIR and TOOLS_DIR paths
# will be used. They still can be overriden by the make command line parameters:
# make DL_DIR=/path/to/download/directory TOOLS_DIR=/path/to/tools/directory targets...
# Function for converting Windows style slashes into Unix style
slashfix = $(subst \,/,$(1))
# Function for converting an absolute path to one relative
# to the top of the source tree
toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
override DL_DIR := $(if $(DL_DIR),$(call slashfix,$(DL_DIR)),$(ROOT_DIR)/downloads)
override TOOLS_DIR := $(if $(TOOLS_DIR),$(call slashfix,$(TOOLS_DIR)),$(ROOT_DIR)/tools)
export DL_DIR
export TOOLS_DIR
# Set up some macros for common directories within the tree
export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
export DL_DIR := $(if $(OPENPILOT_DL_DIR),$(call slashfix,$(OPENPILOT_DL_DIR)),$(ROOT_DIR)/downloads)
export TOOLS_DIR := $(if $(OPENPILOT_TOOLS_DIR),$(call slashfix,$(OPENPILOT_TOOLS_DIR)),$(ROOT_DIR)/tools)
export BUILD_DIR := $(ROOT_DIR)/build
export PACKAGE_DIR := $(ROOT_DIR)/build/package
export DIST_DIR := $(ROOT_DIR)/build/dist
export BUILD_DIR := $(CURDIR)/build
export PACKAGE_DIR := $(BUILD_DIR)/package
export DIST_DIR := $(BUILD_DIR)/dist
DIRS = $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR)
# Function to convert to all lowercase
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
# Function to make all lowercase and replace spaces with -
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
smallify = $(subst $(SPACE),-,$(call lc,$1))
DIRS := $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR)
# Naming for binaries and packaging etc,.
ORG_BIG_NAME := LibrePilot
export ORG_BIG_NAME := LibrePilot
GCS_BIG_NAME := ${ORG_BIG_NAME} GCS
# These should be lowercase with no spaces
ORG_SMALL_NAME := $(call smallify,$(ORG_BIG_NAME))
export ORG_SMALL_NAME := $(call smallify,$(ORG_BIG_NAME))
GCS_SMALL_NAME := $(call smallify,$(GCS_BIG_NAME))
# Set up default build configurations (debug | release)
@ -130,17 +125,16 @@ include $(ROOT_DIR)/make/tools.mk
# We almost need to consider autoconf/automake instead of this
ifeq ($(UNAME), Linux)
QT_SPEC = linux-g++
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
QT_SPEC := linux-g++
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
else ifeq ($(UNAME), Darwin)
QT_SPEC = macx-g++
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
QT_SPEC := macx-g++
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
else ifeq ($(UNAME), Windows)
QT_SPEC = win32-g++
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
QT_SPEC := win32-g++
UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
endif
##############################
#
# All targets
#
@ -154,7 +148,7 @@ all_clean:
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
$(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
.PONY: clean
.PHONY: clean
clean: all_clean
@ -164,7 +158,7 @@ clean: all_clean
#
##############################
UAVOBJGENERATOR_DIR = $(BUILD_DIR)/uavobjgenerator
UAVOBJGENERATOR_DIR := $(BUILD_DIR)/uavobjgenerator
DIRS += $(UAVOBJGENERATOR_DIR)
.PHONY: uavobjgenerator
@ -209,14 +203,15 @@ export OPMODULEDIR := $(ROOT_DIR)/flight/modules
export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
export OPGCSSYNTHDIR := $(BUILD_DIR)/gcs-synthetics
DIRS += $(OPGCSSYNTHDIR)
# Define supported board lists
ALL_BOARDS := oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
# Short names of each board (used to display board name in parallel builds)
coptercontrol_short := 'cc '
oplinkmini_short := 'oplm'
revolution_short := 'revo'
osd_short := 'osd '
@ -456,13 +451,7 @@ sim_osx_%: uavobjects_flight
##############################
.PHONY: all_ground
all_ground: openpilotgcs uploader
# Convenience target for the GCS
.PHONY: gcs gcs_qmake gcs_clean
gcs: openpilotgcs
gcs_qmake: openpilotgcs_qmake
gcs_clean: openpilotgcs_clean
all_ground: gcs uploader
ifeq ($(V), 1)
GCS_SILENT :=
@ -470,28 +459,29 @@ else
GCS_SILENT := silent
endif
OPENPILOTGCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
DIRS += $(OPENPILOTGCS_DIR)
GCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
DIRS += $(GCS_DIR)
OPENPILOTGCS_MAKEFILE := $(OPENPILOTGCS_DIR)/Makefile
GCS_MAKEFILE := $(GCS_DIR)/Makefile
.PHONY: openpilotgcs_qmake
openpilotgcs_qmake $(OPENPILOTGCS_MAKEFILE): | $(OPENPILOTGCS_DIR)
$(V1) cd $(OPENPILOTGCS_DIR) && \
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro \
.PHONY: gcs_qmake
gcs_qmake $(GCS_MAKEFILE): | $(GCS_DIR)
$(V1) cd $(GCS_DIR) && \
$(QMAKE) $(ROOT_DIR)/ground/gcs/gcs.pro \
-spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) \
'GCS_BIG_NAME="$(GCS_BIG_NAME)"' GCS_SMALL_NAME=$(GCS_SMALL_NAME) \
'ORG_BIG_NAME="$(ORG_BIG_NAME)"' ORG_SMALL_NAME=$(ORG_SMALL_NAME) \
'GCS_LIBRARY_BASENAME=$(libbasename)' \
$(GCS_QMAKE_OPTS)
.PHONY: openpilotgcs
openpilotgcs: uavobjgenerator $(OPENPILOTGCS_MAKEFILE)
$(V1) $(MAKE) -w -C $(OPENPILOTGCS_DIR)/$(MAKE_DIR);
.PHONY: gcs
gcs: uavobjgenerator $(GCS_MAKEFILE)
$(V1) $(MAKE) -w -C $(GCS_DIR)/$(MAKE_DIR);
.PHONY: openpilotgcs_clean
openpilotgcs_clean:
@$(ECHO) " CLEAN $(call toprel, $(OPENPILOTGCS_DIR))"
$(V1) [ ! -d "$(OPENPILOTGCS_DIR)" ] || $(RM) -r "$(OPENPILOTGCS_DIR)"
.PHONY: gcs_clean
gcs_clean:
@$(ECHO) " CLEAN $(call toprel, $(GCS_DIR))"
$(V1) [ ! -d "$(GCS_DIR)" ] || $(RM) -r "$(GCS_DIR)"
@ -509,7 +499,7 @@ UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile
.PHONY: uploader_qmake
uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR)
$(V1) cd $(UPLOADER_DIR) && \
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
$(QMAKE) $(ROOT_DIR)/ground/gcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
-spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
.PHONY: uploader
@ -724,7 +714,7 @@ $(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR)
# If opfw_resource or all firmware are requested, GCS should depend on the resource
ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
$(OPENPILOTGCS_MAKEFILE): $(OPFW_RESOURCE)
$(GCS_MAKEFILE): $(OPFW_RESOURCE)
endif
# Packaging targets: package
@ -739,10 +729,40 @@ PACKAGE_SEP := -
PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
# Source distribution is never dirty because it uses git archive
DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar
DIST_LBL := $(subst -dirty,,$(PACKAGE_LBL))
DIST_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(DIST_LBL)
DIST_TAR := $(DIST_DIR)/$(DIST_NAME).tar
DIST_TAR_GZ := $(DIST_TAR).gz
DIST_VER_INFO := $(DIST_DIR)/version-info.json
include $(ROOT_DIR)/package/$(UNAME).mk
##############################
#
# Source for distribution
#
##############################
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
$(DIST_TAR): $(DIST_VER_INFO) .git/index | $(DIST_DIR)
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR))"
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_TAR)" HEAD
$(V1) tar --append --file="$(DIST_TAR)" \
--transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
$(call toprel, "$(DIST_VER_INFO)")
$(DIST_TAR_GZ): $(DIST_TAR)
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR_GZ))"
$(V1) gzip -kf "$(DIST_TAR)"
.PHONY: dist_tar_gz
dist_tar_gz: $(DIST_TAR_GZ)
.PHONY: dist
dist: dist_tar_gz
##############################
#
# Source code formatting
@ -819,26 +839,28 @@ build-info: | $(BUILD_DIR)
##############################
#
# Source for distribution
# Config
#
##############################
DIST_VER_INFO := $(DIST_DIR)/version-info.json
CONFIG_OPTS := $(addsuffix \n,$(MAKEOVERRIDES))
CONFIG_OPTS := $(addprefix override$(SPACE),$(CONFIG_OPTS))
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
.PHONY: config_new
config_new:
@printf '$(CONFIG_OPTS)' > $(CONFIG_FILE)
.PHONY: config_append
config_append:
@printf '$(CONFIG_OPTS)' >> $(CONFIG_FILE)
$(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)"
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD
$(V1) tar --append --file="$(DIST_NAME)" \
--transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
$(call toprel, "$(DIST_VER_INFO)")
$(V1) gzip -f "$(DIST_NAME)"
.PHONY: config_show
config_show:
@cat $(CONFIG_FILE)
.PHONY: dist
dist: $(DIST_NAME).gz
.PHONY: config_clean
config_clean:
rm -f $(CONFIG_FILE)
##############################
@ -880,6 +902,7 @@ help:
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
@$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
@$(ECHO) " gtest_install - Install the GoogleTest framework"
@$(ECHO) " ccache_install - Install ccache"
@$(ECHO) " These targets are not updated yet and are probably broken:"
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
@ -992,6 +1015,11 @@ help:
@$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
@$(ECHO) " docs_all_clean - Delete all generated documentation"
@$(ECHO)
@$(ECHO) " [Configuration]"
@$(ECHO) " config_new - Place your make arguments in the config file"
@$(ECHO) " config_append - Place your make arguments in the config file but append"
@$(ECHO) " config_clean - Removes the config file"
@$(ECHO)
@$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
@$(ECHO)
@$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
@ -999,7 +1027,7 @@ help:
@$(ECHO) " All build output will be placed in $(BUILD_DIR)"
@$(ECHO)
@$(ECHO) " Tool download and install directories can be changed using environment variables:"
@$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
@$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
@$(ECHO) " DL_DIR full path to downloads directory [downloads if not set]"
@$(ECHO) " TOOLS_DIR full path to installed tools directory [tools if not set]"
@$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
@$(ECHO)

View File

@ -1,42 +1,38 @@
About the LibrePilot Project
----------------------------
Open - Collaborative - Free
The LibrePilot open source project was founded in July 2015. It focuses on
research and development of software and hardware to be used in a variety of
applications including vehicle control and stabilization, unmanned autonomous
vehicles and robotics. One of the projects primary goals is to provide an open
and collaborative environment making it the ideal home for development of
innovative ideas.
LibrePilot welcomes and encourages exchange and collaboration with other
projects, like adding support for existing hardware or software in
collaboration under the spirit of open source.
LibrePilot finds its roots in the OpenPilot project and the founding members
are all long-standing contributors in that project.
The LibrePilot project will be governed by a board of members using consensual
methods to make important decisions and to set the overall direction of the
project.
The LibrePilot source code is released under the OSI approved GPL V3 license.
Integral text of the license can be found at http://www.gnu.org/licenses/gpl-3.0.en.html
Links for the LibrePilot Project
--------------------------------
Main project web site: https://www.librepilot.org/
Project forums: https://forum.librepilot.org/
Source code repository: https://github.com/librepilot
GitHub issue tracker: https://github.com/librepilot/LibrePilot/issues
How to build from source?
-------------------------
make all_sdk_install
make all
Both development environment and GCS are supported on Windows, Linux and Mac OS X
About the LibrePilot Project
============================
### Open - Collaborative - Free
The LibrePilot open source project was founded in July 2015. It focuses on
research and development of software and hardware to be used in a variety of
applications including vehicle control and stabilization, unmanned autonomous
vehicles and robotics. One of the projects primary goals is to provide an open
and collaborative environment making it the ideal home for development of
innovative ideas.
LibrePilot welcomes and encourages exchange and collaboration with other
projects, like adding support for existing hardware or software in
collaboration under the spirit of open source.
LibrePilot finds its roots in the OpenPilot project and the founding members
are all long-standing contributors in that project.
The LibrePilot Project will be governed by a board of members using consensual
methods to make important decisions and to set the overall direction of the
project.
The LibrePilot source code is released under the OSI approved GPLv3 license.
Integral text of the license can be found at [www.gnu.org](http://www.gnu.org/licenses/gpl-3.0.en.html)
Links for the LibrePilot Project
--------------------------------
- [Main project web site](https://www.librepilot.org)
- [Project forums](https://forum.librepilot.org)
- [Source code repository](https://bitbucket.org/librepilot)
- [Mirror](https://github.com/librepilot)
- [Issue tracker](https://librepilot.atlassian.net)
- [Gitter Chat](https://gitter.im/librepilot/LibrePilot)
- IRC: #LibrePilot on FreeNode

View File

@ -8,7 +8,8 @@
* @{
*
* @file actuator.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Actuator module. Drives the actuators (servos, motors etc).
*
* @see The GNU Public License (GPL) Version 3
@ -85,8 +86,6 @@ static xTaskHandle taskHandle;
static FrameType_t frameType = FRAME_TYPE_MULTIROTOR;
static SystemSettingsThrustControlOptions thrustType = SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE;
static float lastResult[MAX_MIX_ACTUATORS] = { 0 };
static float filterAccumulator[MAX_MIX_ACTUATORS] = { 0 };
static uint8_t pinsMode[MAX_MIX_ACTUATORS];
// used to inform the actuator thread that actuator update rate is changed
static ActuatorSettingsData actuatorSettings;
@ -110,7 +109,7 @@ static void ActuatorSettingsUpdatedCb(UAVObjEvent *ev);
static void SettingsUpdatedCb(UAVObjEvent *ev);
float ProcessMixer(const int index, const float curve1, const float curve2,
ActuatorDesiredData *desired,
const float period, bool multirotor);
bool multirotor, bool fixedwing);
// this structure is equivalent to the UAVObjects for one mixer.
typedef struct {
@ -195,7 +194,6 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
UAVObjEvent ev;
portTickType lastSysTime;
portTickType thisSysTime;
float dTSeconds;
uint32_t dTMilliseconds;
ActuatorCommandData command;
@ -245,7 +243,6 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
thisSysTime = xTaskGetTickCount();
dTMilliseconds = (thisSysTime == lastSysTime) ? 1 : (thisSysTime - lastSysTime) * portTICK_RATE_MS;
lastSysTime = thisSysTime;
dTSeconds = dTMilliseconds * 0.001f;
FlightStatusGet(&flightStatus);
FlightModeSettingsGet(&settings);
@ -271,6 +268,7 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
bool activeThrottle = (throttleDesired < -0.001f || throttleDesired > 0.001f); // for ground and reversible motors
bool positiveThrottle = (throttleDesired > 0.00f);
bool multirotor = (GetCurrentFrameType() == FRAME_TYPE_MULTIROTOR); // check if frame is a multirotor.
bool fixedwing = (GetCurrentFrameType() == FRAME_TYPE_FIXED_WING); // check if frame is a fixedwing.
bool alwaysArmed = settings.Arming == FLIGHTMODESETTINGS_ARMING_ALWAYSARMED;
bool AlwaysStabilizeWhenArmed = settings.AlwaysStabilizeWhenArmed == FLIGHTMODESETTINGS_ALWAYSSTABILIZEWHENARMED_TRUE;
@ -406,12 +404,10 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
nonreversible_curve2 = 0.0f;
}
}
status[ct] = ProcessMixer(ct, nonreversible_curve1, nonreversible_curve2, &desired, dTSeconds, multirotor);
status[ct] = ProcessMixer(ct, nonreversible_curve1, nonreversible_curve2, &desired, multirotor, fixedwing);
// If not armed or motors aren't meant to spin all the time
if (!armed ||
(!spinWhileArmed && !positiveThrottle)) {
filterAccumulator[ct] = 0;
lastResult[ct] = 0;
status[ct] = -1; // force min throttle
}
// If armed meant to keep spinning,
@ -424,16 +420,14 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
}
}
} else if (mixer_type == MIXERSETTINGS_MIXER1TYPE_REVERSABLEMOTOR) {
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, dTSeconds, multirotor);
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, multirotor, fixedwing);
// Reversable Motors are like Motors but go to neutral instead of minimum
// If not armed or motor is inactive - no "spinwhilearmed" for this engine type
if (!armed || !activeThrottle) {
filterAccumulator[ct] = 0;
lastResult[ct] = 0;
status[ct] = 0; // force neutral throttle
}
} else if (mixer_type == MIXERSETTINGS_MIXER1TYPE_SERVO) {
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, dTSeconds, multirotor);
status[ct] = ProcessMixer(ct, curve1, curve2, &desired, multirotor, fixedwing);
} else {
status[ct] = -1;
@ -555,56 +549,44 @@ static void actuatorTask(__attribute__((unused)) void *parameters)
* Process mixing for one actuator
*/
float ProcessMixer(const int index, const float curve1, const float curve2,
ActuatorDesiredData *desired, const float period, bool multirotor)
ActuatorDesiredData *desired, bool multirotor, bool fixedwing)
{
static float lastFilteredResult[MAX_MIX_ACTUATORS];
const Mixer_t *mixers = (Mixer_t *)&mixerSettings.Mixer1Type; // pointer to array of mixers in UAVObjects
const Mixer_t *mixer = &mixers[index];
float differential = 1.0f;
// Apply differential only for fixedwing and Roll servos
if (fixedwing && (mixerSettings.FirstRollServo > 0) &&
(mixer->type == MIXERSETTINGS_MIXER1TYPE_SERVO) &&
(mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_ROLL] != 0)) {
// Positive differential
if (mixerSettings.RollDifferential > 0) {
// Check for first Roll servo (should be left aileron or elevon) and Roll desired (positive/negative)
if (((index == mixerSettings.FirstRollServo - 1) && (desired->Roll > 0.0f))
|| ((index != mixerSettings.FirstRollServo - 1) && (desired->Roll < 0.0f))) {
differential -= (mixerSettings.RollDifferential * 0.01f);
}
} else if (mixerSettings.RollDifferential < 0) {
if (((index == mixerSettings.FirstRollServo - 1) && (desired->Roll < 0.0f))
|| ((index != mixerSettings.FirstRollServo - 1) && (desired->Roll > 0.0f))) {
differential -= (-mixerSettings.RollDifferential * 0.01f);
}
}
}
float result = ((((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_THROTTLECURVE1]) * curve1) +
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_THROTTLECURVE2]) * curve2) +
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_ROLL]) * desired->Roll) +
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_ROLL]) * desired->Roll * differential) +
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_PITCH]) * desired->Pitch) +
(((float)mixer->matrix[MIXERSETTINGS_MIXER1VECTOR_YAW]) * desired->Yaw)) / 128.0f;
// note: no feedforward for reversable motors yet for safety reasons
if (mixer->type == MIXERSETTINGS_MIXER1TYPE_MOTOR) {
if (!multirotor) { // we allow negative throttle with a multirotor
if (result < 0.0f) { // zero throttle
result = 0.0f;
}
}
// feed forward
float accumulator = filterAccumulator[index];
accumulator += (result - lastResult[index]) * mixerSettings.FeedForward;
lastResult[index] = result;
result += accumulator;
if (period > 0.0f) {
if (accumulator > 0.0f) {
float invFilter = period / mixerSettings.AccelTime;
if (invFilter > 1) {
invFilter = 1;
}
accumulator -= accumulator * invFilter;
} else {
float invFilter = period / mixerSettings.DecelTime;
if (invFilter > 1) {
invFilter = 1;
}
accumulator -= accumulator * invFilter;
}
}
filterAccumulator[index] = accumulator;
result += accumulator;
// acceleration limit
float dt = result - lastFilteredResult[index];
float maxDt = mixerSettings.MaxAccel * period;
if (dt > maxDt) { // we are accelerating too hard
result = lastFilteredResult[index] + maxDt;
}
lastFilteredResult[index] = result;
}
return result;

View File

@ -9,7 +9,8 @@
* @{
*
* @file innerloop.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @brief Attitude stabilization module.
*
* @see The GNU Public License (GPL) Version 3
@ -301,10 +302,15 @@ static void stabilizationInnerloopTask()
-StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t],
StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t]
);
const float acroFactors[] = {
stabSettings.stabBank.AcroInsanityFactor.Roll,
stabSettings.stabBank.AcroInsanityFactor.Pitch,
stabSettings.stabBank.AcroInsanityFactor.Yaw
};
pid_scaler ascaler = create_pid_scaler(t);
ascaler.i *= boundf(1.0f - (1.5f * fabsf(stickinput[t])), 0.0f, 1.0f); // this prevents Integral from getting too high while controlled manually
float arate = pid_apply_setpoint(&stabSettings.innerPids[t], &ascaler, rate[t], gyro_filtered[t], dT);
float factor = fabsf(stickinput[t]) * stabSettings.stabBank.AcroInsanityFactor;
float factor = fabsf(stickinput[t]) * acroFactors[t];
actuatorDesiredAxis[t] = factor * stickinput[t] + (1.0f - factor) * arate;
}
break;

View File

@ -9,7 +9,8 @@
* @{
*
* @file outerloop.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @brief Attitude stabilization module.
*
* @see The GNU Public License (GPL) Version 3
@ -105,8 +106,9 @@ static void stabilizationOuterloopTask()
int t;
float dT = PIOS_DELTATIME_GetAverageSeconds(&timeval);
StabilizationStatusOuterLoopOptions newThrustMode = StabilizationStatusOuterLoopToArray(enabled)[STABILIZATIONSTATUS_OUTERLOOP_THRUST];
bool reinit = (newThrustMode != previous_mode[STABILIZATIONSTATUS_OUTERLOOP_THRUST]);
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
// Trigger a disable message to the alt hold on reinit to prevent that loop from running when not in use.
if (reinit) {
if (previous_mode[STABILIZATIONSTATUS_OUTERLOOP_THRUST] == STABILIZATIONSTATUS_OUTERLOOP_ALTITUDE ||
@ -117,17 +119,20 @@ static void stabilizationOuterloopTask()
}
}
}
#endif
// update previous mode
previous_mode[STABILIZATIONSTATUS_OUTERLOOP_THRUST] = newThrustMode;
// calculate the thrust desired
switch (newThrustMode) {
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
case STABILIZATIONSTATUS_OUTERLOOP_ALTITUDE:
rateDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST] = stabilizationAltitudeHold(stabilizationDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST], ALTITUDEHOLD, reinit);
break;
case STABILIZATIONSTATUS_OUTERLOOP_ALTITUDEVARIO:
rateDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST] = stabilizationAltitudeHold(stabilizationDesiredAxis[STABILIZATIONSTATUS_OUTERLOOP_THRUST], ALTITUDEVARIO, reinit);
break;
#endif
case STABILIZATIONSTATUS_OUTERLOOP_DIRECT:
case STABILIZATIONSTATUS_OUTERLOOP_DIRECTWITHLIMITS:
default:

View File

@ -9,8 +9,10 @@
* @{
*
* @file telemetry.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
* @brief Telemetry module, handles telemetry and UAVObject updates
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
@ -95,6 +97,9 @@
#define STATS_UPDATE_PERIOD_MS 4000
#define CONNECTION_TIMEOUT_MS 8000
#ifdef PIOS_INCLUDE_RFM22B
#define HAS_RADIO
#endif
// Private types
typedef struct {
// Determine port on which to communicate telemetry information
@ -111,12 +116,14 @@ typedef struct {
// Telemetry stream
UAVTalkConnection uavTalkCon;
} channelContext;
#ifdef HAS_RADIO
// Main telemetry channel
static channelContext localChannel;
static int32_t transmitLocalData(uint8_t *data, int32_t length);
static void registerLocalObject(UAVObjHandle obj);
static uint32_t localPort();
static void updateSettings(channelContext *channel);
#endif
// OPLink telemetry channel
static channelContext radioChannel;
@ -150,7 +157,6 @@ static int32_t setLoggingPeriod(
int32_t updatePeriodMs);
static void updateTelemetryStats();
static void gcsTelemetryStatsUpdated();
static void updateSettings(channelContext *channel);
/**
* Initialise the telemetry module
@ -159,6 +165,7 @@ static void updateSettings(channelContext *channel);
*/
int32_t TelemetryStart(void)
{
#ifdef HAS_RADIO
// Only start the local telemetry tasks if needed
if (localPort()) {
UAVObjIterate(&registerLocalObject);
@ -187,8 +194,8 @@ int32_t TelemetryStart(void)
PIOS_TASK_MONITOR_RegisterTask(TASKINFO_RUNNING_TELEMETRYRX,
localChannel.rxTaskHandle);
}
// Start the telemetry tasks associated with Radio/USB
#endif /* ifdef HAS_RADIO */
// Start the telemetry tasks associated with Radio/USB
UAVObjIterate(&registerRadioObject);
// Listen to objects of interest
@ -229,9 +236,6 @@ void TelemetryInitializeChannel(channelContext *channel)
sizeof(UAVObjEvent));
#endif /* PIOS_TELEM_PRIORITY_QUEUE */
// Initialise UAVTalk
channel->uavTalkCon = UAVTalkInitialize(&transmitLocalData);
// Create periodic event that will be used to update the telemetry stats
UAVObjEvent ev;
memset(&ev, 0, sizeof(UAVObjEvent));
@ -267,7 +271,7 @@ int32_t TelemetryInitialize(void)
radio_port = PIOS_COM_RF;
}
#else /* PIOS_INCLUDE_RFM22B */
radio_port = 0;
radio_port = PIOS_COM_TELEM_RF;
#endif /* PIOS_INCLUDE_RFM22B */
FlightTelemetryStatsInitialize();
@ -279,10 +283,9 @@ int32_t TelemetryInitialize(void)
// Reset link stats
txErrors = 0;
txRetries = 0;
#ifdef HAS_RADIO
// Set channel port handlers
localChannel.getPort = localPort;
radioChannel.getPort = radioPort;
// Set the local telemetry baud rate
updateSettings(&localChannel);
@ -295,6 +298,9 @@ int32_t TelemetryInitialize(void)
localChannel.uavTalkCon = UAVTalkInitialize(&transmitLocalData);
}
#endif
// Set channel port handlers
radioChannel.getPort = radioPort;
// Initialise channel
TelemetryInitializeChannel(&radioChannel);
// Initialise UAVTalk
@ -304,7 +310,7 @@ int32_t TelemetryInitialize(void)
}
MODULE_INITCALL(TelemetryInitialize, TelemetryStart);
#ifdef HAS_RADIO
/**
* Register a new object, adds object to local list and connects the queue depending on the object's
* telemetry settings.
@ -327,7 +333,7 @@ static void registerLocalObject(UAVObjHandle obj)
EV_NONE);
}
}
#endif
static void registerRadioObject(UAVObjHandle obj)
{
if (UAVObjIsMetaobject(obj)) {
@ -635,7 +641,7 @@ static void telemetryRxTask(void *parameters)
}
}
#ifdef HAS_RADIO
/**
* Determine the port to be used for communication on the telemetry channel
* \return com port number
@ -644,7 +650,7 @@ static uint32_t localPort()
{
return PIOS_COM_TELEM_RF;
}
#endif
/**
* Determine the port to be used for communication on the radio channel
@ -664,7 +670,7 @@ static uint32_t radioPort()
return port;
}
#ifdef HAS_RADIO
/**
* Transmit data buffer to the modem or USB port.
* \param[in] data Data buffer to send
@ -682,7 +688,7 @@ static int32_t transmitLocalData(uint8_t *data, int32_t length)
return -1;
}
#endif
/**
* Transmit data buffer to the radioport.
@ -804,9 +810,10 @@ static void updateTelemetryStats()
uint32_t timeNow;
// Get stats
UAVTalkGetStats(localChannel.uavTalkCon, &utalkStats, true);
UAVTalkAddStats(radioChannel.uavTalkCon, &utalkStats, true);
UAVTalkGetStats(radioChannel.uavTalkCon, &utalkStats, true);
#ifdef HAS_RADIO
UAVTalkAddStats(localChannel.uavTalkCon, &utalkStats, true);
#endif
// Get object data
FlightTelemetryStatsGet(&flightStats);
GCSTelemetryStatsGet(&gcsStats);
@ -888,6 +895,7 @@ static void updateTelemetryStats()
}
}
#ifdef HAS_RADIO
/**
* Update the telemetry settings, called on startup.
* FIXME: This should be in the TelemetrySettings object. But objects
@ -931,7 +939,7 @@ static void updateSettings(channelContext *channel)
}
}
#endif /* ifdef HAS_RADIO */
/**
* @}
* @}

View File

@ -8,7 +8,8 @@
* @{
*
* @file txpid.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
* @brief Optional module to tune PID settings using R/C transmitter.
*
* @see The GNU Public License (GPL) Version 3
@ -252,6 +253,16 @@ static void updatePIDs(UAVObjEvent *ev)
case TXPIDSETTINGS_PIDS_ROLLRATEKP:
needsUpdateBank |= update(&bank.RollRatePID.Kp, value);
break;
case TXPIDSETTINGS_PIDS_ROLLRATEPID:
needsUpdateBank |= update(&bank.RollRatePID.Kp, value);
needsUpdateBank |= update(&bank.RollRatePID.Ki, value * inst.PitchRollRateFactors.I);
needsUpdateBank |= update(&bank.RollRatePID.Kd, value * inst.PitchRollRateFactors.D);
break;
case TXPIDSETTINGS_PIDS_PITCHRATEPID:
needsUpdateBank |= update(&bank.PitchRatePID.Kp, value);
needsUpdateBank |= update(&bank.PitchRatePID.Ki, value * inst.PitchRollRateFactors.I);
needsUpdateBank |= update(&bank.PitchRatePID.Kd, value * inst.PitchRollRateFactors.D);
break;
case TXPIDSETTINGS_PIDS_ROLLRATEKI:
needsUpdateBank |= update(&bank.RollRatePID.Ki, value);
break;
@ -382,8 +393,15 @@ static void updatePIDs(UAVObjEvent *ev)
case TXPIDSETTINGS_PIDS_GYROTAU:
needsUpdateStab |= update(&stab.GyroTau, value);
break;
case TXPIDSETTINGS_PIDS_ACROPLUSFACTOR:
needsUpdateBank |= update(&bank.AcroInsanityFactor, value);
case TXPIDSETTINGS_PIDS_ACROROLLFACTOR:
needsUpdateBank |= update(&bank.AcroInsanityFactor.Roll, value);
break;
case TXPIDSETTINGS_PIDS_ACROPITCHFACTOR:
needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value);
break;
case TXPIDSETTINGS_PIDS_ACROROLLPITCHFACTOR:
needsUpdateBank |= update(&bank.AcroInsanityFactor.Roll, value);
needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value);
break;
case TXPIDSETTINGS_PIDS_ACCELTAU:
needsUpdateAtt |= update(&att.AccelTau, value);
@ -428,6 +446,12 @@ static void updatePIDs(UAVObjEvent *ev)
AltitudeHoldSettingsSet(&altitude);
}
#endif
if (inst.RatePIDRecalculateYaw != TXPIDSETTINGS_RATEPIDRECALCULATEYAW_FALSE) {
float newKp = (bank.RollRatePID.Kp + bank.PitchRatePID.Kp) * .5f * inst.YawRateFactors.P;
needsUpdateBank |= update(&bank.YawRatePID.Kp, newKp);
needsUpdateBank |= update(&bank.YawRatePID.Ki, newKp * inst.YawRateFactors.I);
needsUpdateBank |= update(&bank.YawRatePID.Kd, newKp * inst.YawRateFactors.D);
}
if (needsUpdateBank) {
switch (inst.BankNumber) {
case 0:

View File

@ -103,7 +103,7 @@ static uint8_t *pucAlignedHeap = NULL;
size_t mask = alignment - 1;
/* Ensure that blocks are always aligned to the required number of bytes. */
#if portBYTE_ALIGNMENT != 1
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
if( xWantedSize & mask )
{
/* Byte alignment required. */
xWantedSize += ( alignment - ( xWantedSize & mask ) );

View File

@ -7,7 +7,8 @@
* @{
*
* @file pios_usb_defs.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief USB Standard types and definitions
* @see The GNU Public License (GPL) Version 3
*
@ -353,6 +354,7 @@ enum usb_cdc_notification {
enum usb_product_ids {
USB_PRODUCT_ID_OPENPILOT_MAIN = 0x415A,
USB_PRODUCT_ID_COPTERCONTROL = 0x415B,
USB_PRODUCT_ID_OPLINK = 0x415C,
USB_PRODUCT_ID_CC3D = 0x415D,
USB_PRODUCT_ID_REVOLUTION = 0x415E,
@ -363,9 +365,9 @@ enum usb_product_ids {
enum usb_op_board_ids {
USB_OP_BOARD_ID_OPENPILOT_MAIN = 1,
/* Board ID 2 may be unused or AHRS */
USB_OP_BOARD_ID_OPLINK = 3,
/* USB_OP_BOARD_ID_COPTERCONTROL = 4, */
USB_OP_BOARD_ID_REVOLUTION = 5,
USB_OP_BOARD_ID_OPLINK = 3,
USB_OP_BOARD_ID_COPTERCONTROL = 4,
USB_OP_BOARD_ID_REVOLUTION = 5,
USB_OP_BOARD_ID_OSD = 6,
} __attribute__((packed));

View File

@ -0,0 +1,23 @@
BOARD_TYPE := 0x04
BOARD_REVISION := 0x02
BOOTLOADER_VERSION := 0x04
HW_TYPE := 0x01
MCU := cortex-m3
CHIP := STM32F103CBT
BOARD := STM32103CB_CC_Rev1
MODEL := MD
MODEL_SUFFIX := _CC
OPENOCD_JTAG_CONFIG := foss-jtag.revb.cfg
OPENOCD_CONFIG := stm32f1x.cfg
# Note: These must match the values in link_$(BOARD)_memory.ld
BL_BANK_BASE := 0x08000000 # Start of bootloader flash
BL_BANK_SIZE := 0x00003000 # Should include BD_INFO region
FW_BANK_BASE := 0x08003000 # Start of firmware flash
FW_BANK_SIZE := 0x0001D000 # Should include FW_DESC_SIZE
FW_DESC_SIZE := 0x00000064
OSCILLATOR_FREQ := 8000000

View File

@ -0,0 +1,1570 @@
/**
******************************************************************************
* @file board_hw_defs.c
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
*
* @addtogroup OpenPilotSystem OpenPilot System
* @{
* @addtogroup OpenPilotCore OpenPilot Core
* @{
* @brief Defines board specific static initializers for hardware for the CopterControl board.
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define BOARD_REVISION_CC 1
#define BOARD_REVISION_CC3D 2
#if defined(PIOS_INCLUDE_LED)
#include <pios_led_priv.h>
static const struct pios_gpio pios_leds_cc[] = {
[PIOS_LED_HEARTBEAT] = {
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_6,
.GPIO_Mode = GPIO_Mode_Out_PP,
.GPIO_Speed = GPIO_Speed_50MHz,
},
},
.active_low = true
},
};
static const struct pios_gpio_cfg pios_led_cfg_cc = {
.gpios = pios_leds_cc,
.num_gpios = NELEMENTS(pios_leds_cc),
};
static const struct pios_gpio pios_leds_cc3d[] = {
[PIOS_LED_HEARTBEAT] = {
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_3,
.GPIO_Mode = GPIO_Mode_Out_PP,
.GPIO_Speed = GPIO_Speed_50MHz,
},
},
.remap = GPIO_Remap_SWJ_JTAGDisable,
.active_low = true
},
};
static const struct pios_gpio_cfg pios_led_cfg_cc3d = {
.gpios = pios_leds_cc3d,
.num_gpios = NELEMENTS(pios_leds_cc3d),
};
const struct pios_gpio_cfg *PIOS_BOARD_HW_DEFS_GetLedCfg(uint32_t board_revision)
{
switch (board_revision) {
case BOARD_REVISION_CC: return &pios_led_cfg_cc;
case BOARD_REVISION_CC3D: return &pios_led_cfg_cc3d;
default: return NULL;
}
}
#endif /* PIOS_INCLUDE_LED */
#if defined(PIOS_INCLUDE_SPI)
#include <pios_spi_priv.h>
/* Gyro interface */
void PIOS_SPI_gyro_irq_handler(void);
void DMA1_Channel2_IRQHandler() __attribute__((alias("PIOS_SPI_gyro_irq_handler")));
void DMA1_Channel3_IRQHandler() __attribute__((alias("PIOS_SPI_gyro_irq_handler")));
static const struct pios_spi_cfg pios_spi_gyro_cfg = {
.regs = SPI1,
.init = {
.SPI_Mode = SPI_Mode_Master,
.SPI_Direction = SPI_Direction_2Lines_FullDuplex,
.SPI_DataSize = SPI_DataSize_8b,
.SPI_NSS = SPI_NSS_Soft,
.SPI_FirstBit = SPI_FirstBit_MSB,
.SPI_CRCPolynomial = 7,
.SPI_CPOL = SPI_CPOL_High,
.SPI_CPHA = SPI_CPHA_2Edge,
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16, /* 10 Mhz */
},
.use_crc = false,
.dma = {
.ahb_clk = RCC_AHBPeriph_DMA1,
.irq = {
.flags = (DMA1_FLAG_TC2 | DMA1_FLAG_TE2 | DMA1_FLAG_HT2 | DMA1_FLAG_GL2),
.init = {
.NVIC_IRQChannel = DMA1_Channel2_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.channel = DMA1_Channel2,
.init = {
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
.DMA_DIR = DMA_DIR_PeripheralSRC,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
.DMA_MemoryInc = DMA_MemoryInc_Enable,
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
.DMA_Mode = DMA_Mode_Normal,
.DMA_Priority = DMA_Priority_Medium,
.DMA_M2M = DMA_M2M_Disable,
},
},
.tx = {
.channel = DMA1_Channel3,
.init = {
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI1->DR),
.DMA_DIR = DMA_DIR_PeripheralDST,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
.DMA_MemoryInc = DMA_MemoryInc_Enable,
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
.DMA_Mode = DMA_Mode_Normal,
.DMA_Priority = DMA_Priority_Medium,
.DMA_M2M = DMA_M2M_Disable,
},
},
},
.sclk = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_5,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
.miso = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_6,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.mosi = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_7,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
.slave_count = 1,
.ssel = {
{
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_4,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_Out_PP,
},
}
},
};
static uint32_t pios_spi_gyro_id;
void PIOS_SPI_gyro_irq_handler(void)
{
/* Call into the generic code to handle the IRQ for this specific device */
PIOS_SPI_IRQ_Handler(pios_spi_gyro_id);
}
/* Flash/Accel Interface
*
* NOTE: Leave this declared as const data so that it ends up in the
* .rodata section (ie. Flash) rather than in the .bss section (RAM).
*/
void PIOS_SPI_flash_accel_irq_handler(void);
void DMA1_Channel4_IRQHandler() __attribute__((alias("PIOS_SPI_flash_accel_irq_handler")));
void DMA1_Channel5_IRQHandler() __attribute__((alias("PIOS_SPI_flash_accel_irq_handler")));
static const struct pios_spi_cfg pios_spi_flash_accel_cfg_cc3d = {
.regs = SPI2,
.init = {
.SPI_Mode = SPI_Mode_Master,
.SPI_Direction = SPI_Direction_2Lines_FullDuplex,
.SPI_DataSize = SPI_DataSize_8b,
.SPI_NSS = SPI_NSS_Soft,
.SPI_FirstBit = SPI_FirstBit_MSB,
.SPI_CRCPolynomial = 7,
.SPI_CPOL = SPI_CPOL_High,
.SPI_CPHA = SPI_CPHA_2Edge,
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
},
.use_crc = false,
.dma = {
.ahb_clk = RCC_AHBPeriph_DMA1,
.irq = {
.flags = (DMA1_FLAG_TC4 | DMA1_FLAG_TE4 | DMA1_FLAG_HT4 | DMA1_FLAG_GL4),
.init = {
.NVIC_IRQChannel = DMA1_Channel4_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.channel = DMA1_Channel4,
.init = {
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
.DMA_DIR = DMA_DIR_PeripheralSRC,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
.DMA_MemoryInc = DMA_MemoryInc_Enable,
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
.DMA_Mode = DMA_Mode_Normal,
.DMA_Priority = DMA_Priority_High,
.DMA_M2M = DMA_M2M_Disable,
},
},
.tx = {
.channel = DMA1_Channel5,
.init = {
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
.DMA_DIR = DMA_DIR_PeripheralDST,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
.DMA_MemoryInc = DMA_MemoryInc_Enable,
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
.DMA_Mode = DMA_Mode_Normal,
.DMA_Priority = DMA_Priority_High,
.DMA_M2M = DMA_M2M_Disable,
},
},
},
.sclk = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_13,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
.miso = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_14,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
.mosi = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_15,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
.slave_count = 2,
.ssel = {
{
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_12,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_Out_PP,
}
},{
.gpio = GPIOC,
.init = {
.GPIO_Pin = GPIO_Pin_15,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_Out_PP,
},
}
},
};
static const struct pios_spi_cfg pios_spi_flash_accel_cfg_cc = {
.regs = SPI2,
.init = {
.SPI_Mode = SPI_Mode_Master,
.SPI_Direction = SPI_Direction_2Lines_FullDuplex,
.SPI_DataSize = SPI_DataSize_8b,
.SPI_NSS = SPI_NSS_Soft,
.SPI_FirstBit = SPI_FirstBit_MSB,
.SPI_CRCPolynomial = 7,
.SPI_CPOL = SPI_CPOL_High,
.SPI_CPHA = SPI_CPHA_2Edge,
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8,
},
.use_crc = false,
.dma = {
.ahb_clk = RCC_AHBPeriph_DMA1,
.irq = {
.flags = (DMA1_FLAG_TC4 | DMA1_FLAG_TE4 | DMA1_FLAG_HT4 | DMA1_FLAG_GL4),
.init = {
.NVIC_IRQChannel = DMA1_Channel4_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.channel = DMA1_Channel4,
.init = {
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
.DMA_DIR = DMA_DIR_PeripheralSRC,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
.DMA_MemoryInc = DMA_MemoryInc_Enable,
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
.DMA_Mode = DMA_Mode_Normal,
.DMA_Priority = DMA_Priority_High,
.DMA_M2M = DMA_M2M_Disable,
},
},
.tx = {
.channel = DMA1_Channel5,
.init = {
.DMA_PeripheralBaseAddr = (uint32_t)&(SPI2->DR),
.DMA_DIR = DMA_DIR_PeripheralDST,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
.DMA_MemoryInc = DMA_MemoryInc_Enable,
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
.DMA_Mode = DMA_Mode_Normal,
.DMA_Priority = DMA_Priority_High,
.DMA_M2M = DMA_M2M_Disable,
},
},
},
.sclk = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_13,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
.miso = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_14,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
.mosi = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_15,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
.slave_count = 2,
.ssel = {
{
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_12,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_Out_PP,
}
},{
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_7,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_Out_PP,
},
}
},
};
static uint32_t pios_spi_flash_accel_id;
void PIOS_SPI_flash_accel_irq_handler(void)
{
/* Call into the generic code to handle the IRQ for this specific device */
PIOS_SPI_IRQ_Handler(pios_spi_flash_accel_id);
}
#endif /* PIOS_INCLUDE_SPI */
#if defined(PIOS_INCLUDE_FLASH)
#include "pios_flashfs_logfs_priv.h"
#include "pios_flash_jedec_priv.h"
static const struct flashfs_logfs_cfg flashfs_w25x_cfg = {
.fs_magic = 0x99abcdef,
.total_fs_size = 0x00080000, /* 512K bytes (128 sectors = entire chip) */
.arena_size = 0x00010000, /* 256 * slot size */
.slot_size = 0x00000100, /* 256 bytes */
.start_offset = 0, /* start at the beginning of the chip */
.sector_size = 0x00001000, /* 4K bytes */
.page_size = 0x00000100, /* 256 bytes */
};
static const struct flashfs_logfs_cfg flashfs_m25p_cfg = {
.fs_magic = 0x99abceef,
.total_fs_size = 0x00200000, /* 2M bytes (32 sectors = entire chip) */
.arena_size = 0x00010000, /* 256 * slot size */
.slot_size = 0x00000100, /* 256 bytes */
.start_offset = 0, /* start at the beginning of the chip */
.sector_size = 0x00010000, /* 64K bytes */
.page_size = 0x00000100, /* 256 bytes */
};
#include "pios_flash.h"
#endif /* PIOS_INCLUDE_FLASH */
/*
* ADC system
*/
#if defined(PIOS_INCLUDE_ADC)
#include "pios_adc_priv.h"
extern void PIOS_ADC_handler(void);
void DMA1_Channel1_IRQHandler() __attribute__((alias("PIOS_ADC_handler")));
// Remap the ADC DMA handler to this one
static const struct pios_adc_cfg pios_adc_cfg = {
.dma = {
.ahb_clk = RCC_AHBPeriph_DMA1,
.irq = {
.flags = (DMA1_FLAG_TC1 | DMA1_FLAG_TE1 | DMA1_FLAG_HT1 | DMA1_FLAG_GL1),
.init = {
.NVIC_IRQChannel = DMA1_Channel1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.channel = DMA1_Channel1,
.init = {
.DMA_PeripheralBaseAddr = (uint32_t)&ADC1->DR,
.DMA_DIR = DMA_DIR_PeripheralSRC,
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
.DMA_MemoryInc = DMA_MemoryInc_Enable,
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word,
.DMA_MemoryDataSize = DMA_MemoryDataSize_Word,
.DMA_Mode = DMA_Mode_Circular,
.DMA_Priority = DMA_Priority_High,
.DMA_M2M = DMA_M2M_Disable,
},
}
},
.half_flag = DMA1_IT_HT1,
.full_flag = DMA1_IT_TC1,
};
void PIOS_ADC_handler()
{
PIOS_ADC_DMA_Handler();
}
#endif /* if defined(PIOS_INCLUDE_ADC) */
#include "pios_tim_priv.h"
static const TIM_TimeBaseInitTypeDef tim_1_2_3_4_time_base = {
.TIM_Prescaler = (PIOS_MASTER_CLOCK / 1000000) - 1,
.TIM_ClockDivision = TIM_CKD_DIV1,
.TIM_CounterMode = TIM_CounterMode_Up,
.TIM_Period = ((1000000 / PIOS_SERVO_UPDATE_HZ) - 1),
.TIM_RepetitionCounter = 0x0000,
};
static const struct pios_tim_clock_cfg tim_1_cfg = {
.timer = TIM1,
.time_base_init = &tim_1_2_3_4_time_base,
.irq = {
.init = {
.NVIC_IRQChannel = TIM1_CC_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
};
static const struct pios_tim_clock_cfg tim_2_cfg = {
.timer = TIM2,
.time_base_init = &tim_1_2_3_4_time_base,
.irq = {
.init = {
.NVIC_IRQChannel = TIM2_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
};
static const struct pios_tim_clock_cfg tim_3_cfg = {
.timer = TIM3,
.time_base_init = &tim_1_2_3_4_time_base,
.irq = {
.init = {
.NVIC_IRQChannel = TIM3_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
};
static const struct pios_tim_clock_cfg tim_4_cfg = {
.timer = TIM4,
.time_base_init = &tim_1_2_3_4_time_base,
.irq = {
.init = {
.NVIC_IRQChannel = TIM4_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
};
static const struct pios_tim_channel pios_tim_rcvrport_all_channels[] = {
{
.timer = TIM4,
.timer_chan = TIM_Channel_1,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_6,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM3,
.timer_chan = TIM_Channel_2,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_5,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
.remap = GPIO_PartialRemap_TIM3,
},
{
.timer = TIM3,
.timer_chan = TIM_Channel_3,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_0,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM3,
.timer_chan = TIM_Channel_4,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_1,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM2,
.timer_chan = TIM_Channel_1,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_0,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM2,
.timer_chan = TIM_Channel_2,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_1,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
};
static const struct pios_tim_channel pios_tim_servoport_all_pins[] = {
{
.timer = TIM4,
.timer_chan = TIM_Channel_4,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM4,
.timer_chan = TIM_Channel_3,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_8,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM4,
.timer_chan = TIM_Channel_2,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_7,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM1,
.timer_chan = TIM_Channel_1,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_8,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM3,
.timer_chan = TIM_Channel_1,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_4,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
.remap = GPIO_PartialRemap_TIM3,
},
{
.timer = TIM2,
.timer_chan = TIM_Channel_3,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_2,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
};
static const struct pios_tim_channel pios_tim_servoport_rcvrport_pins[] = {
{
.timer = TIM4,
.timer_chan = TIM_Channel_4,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM4,
.timer_chan = TIM_Channel_3,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_8,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM4,
.timer_chan = TIM_Channel_2,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_7,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM1,
.timer_chan = TIM_Channel_1,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_8,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM3,
.timer_chan = TIM_Channel_1,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_4,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
.remap = GPIO_PartialRemap_TIM3,
},
{
.timer = TIM2,
.timer_chan = TIM_Channel_3,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_2,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
// Receiver port pins
// S3-S6 inputs are used as outputs in this case
{
.timer = TIM3,
.timer_chan = TIM_Channel_3,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_0,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM3,
.timer_chan = TIM_Channel_4,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_1,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM2,
.timer_chan = TIM_Channel_1,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_0,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
{
.timer = TIM2,
.timer_chan = TIM_Channel_2,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_1,
.GPIO_Mode = GPIO_Mode_AF_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
},
};
static const struct pios_tim_channel pios_tim_ppm_flexi_port = {
.timer = TIM2,
.timer_chan = TIM_Channel_4,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
.remap = GPIO_PartialRemap2_TIM2,
};
#if defined(PIOS_INCLUDE_USART)
#include "pios_usart_priv.h"
static const struct pios_usart_cfg pios_usart_generic_main_cfg = {
.regs = USART1,
.init = {
.USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
};
static const struct pios_usart_cfg pios_usart_generic_flexi_cfg = {
.regs = USART3,
.init = {
.USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART3_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
};
#if defined(PIOS_INCLUDE_DSM)
/*
* Spektrum/JR DSM USART
*/
#include <pios_dsm_priv.h>
static const struct pios_usart_cfg pios_usart_dsm_main_cfg = {
.regs = USART1,
.init = {
.USART_BaudRate = 115200,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
};
static const struct pios_dsm_cfg pios_dsm_main_cfg = {
.bind = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_Out_PP,
},
},
};
static const struct pios_usart_cfg pios_usart_dsm_flexi_cfg = {
.regs = USART3,
.init = {
.USART_BaudRate = 115200,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART3_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
};
static const struct pios_dsm_cfg pios_dsm_flexi_cfg = {
.bind = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_Out_PP,
},
},
};
#endif /* PIOS_INCLUDE_DSM */
#if defined(PIOS_INCLUDE_SRXL)
/*
* SRXL USART
*/
#include <pios_srxl_priv.h>
static const struct pios_usart_cfg pios_usart_srxl_flexi_cfg = {
.regs = USART3,
.init = {
.USART_BaudRate = 115200,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART3_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
};
#endif /* PIOS_INCLUDE_SRXL */
#if defined(PIOS_INCLUDE_SBUS)
/*
* S.Bus USART
*/
#include <pios_sbus_priv.h>
static const struct pios_usart_cfg pios_usart_sbus_main_cfg = {
.regs = USART1,
.init = {
.USART_BaudRate = 100000,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_Even,
.USART_StopBits = USART_StopBits_2,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
};
static const struct pios_sbus_cfg pios_sbus_cfg = {
/* Inverter configuration */
.inv = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_2,
.GPIO_Mode = GPIO_Mode_Out_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
.gpio_clk_func = RCC_APB2PeriphClockCmd,
.gpio_clk_periph = RCC_APB2Periph_GPIOB,
.gpio_inv_enable = Bit_SET,
};
#endif /* PIOS_INCLUDE_SBUS */
/*
* HK OSD
*/
static const struct pios_usart_cfg pios_usart_hkosd_main_cfg = {
.regs = USART1,
.init = {
.USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
};
static const struct pios_usart_cfg pios_usart_hkosd_flexi_cfg = {
.regs = USART3,
.init = {
.USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART3_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
};
#endif /* PIOS_INCLUDE_USART */
#if defined(PIOS_INCLUDE_COM)
#include "pios_com_priv.h"
#endif /* PIOS_INCLUDE_COM */
#if defined(PIOS_INCLUDE_RTC)
/*
* Realtime Clock (RTC)
*/
#include <pios_rtc_priv.h>
void PIOS_RTC_IRQ_Handler(void);
void RTC_IRQHandler() __attribute__((alias("PIOS_RTC_IRQ_Handler")));
static const struct pios_rtc_cfg pios_rtc_main_cfg = {
.clksrc = RCC_RTCCLKSource_HSE_Div128,
.prescaler = 100,
.irq = {
.init = {
.NVIC_IRQChannel = RTC_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
};
void PIOS_RTC_IRQ_Handler(void)
{
PIOS_RTC_irq_handler();
}
#endif /* if defined(PIOS_INCLUDE_RTC) */
#if defined(PIOS_INCLUDE_SERVO) && defined(PIOS_INCLUDE_TIM)
/*
* Servo outputs
*/
#include <pios_servo_priv.h>
const struct pios_servo_cfg pios_servo_cfg = {
.tim_oc_init = {
.TIM_OCMode = TIM_OCMode_PWM1,
.TIM_OutputState = TIM_OutputState_Enable,
.TIM_OutputNState = TIM_OutputNState_Disable,
.TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
.TIM_OCPolarity = TIM_OCPolarity_High,
.TIM_OCNPolarity = TIM_OCPolarity_High,
.TIM_OCIdleState = TIM_OCIdleState_Reset,
.TIM_OCNIdleState = TIM_OCNIdleState_Reset,
},
.channels = pios_tim_servoport_all_pins,
.num_channels = NELEMENTS(pios_tim_servoport_all_pins),
};
const struct pios_servo_cfg pios_servo_rcvr_cfg = {
.tim_oc_init = {
.TIM_OCMode = TIM_OCMode_PWM1,
.TIM_OutputState = TIM_OutputState_Enable,
.TIM_OutputNState = TIM_OutputNState_Disable,
.TIM_Pulse = PIOS_SERVOS_INITIAL_POSITION,
.TIM_OCPolarity = TIM_OCPolarity_High,
.TIM_OCNPolarity = TIM_OCPolarity_High,
.TIM_OCIdleState = TIM_OCIdleState_Reset,
.TIM_OCNIdleState = TIM_OCNIdleState_Reset,
},
.channels = pios_tim_servoport_rcvrport_pins,
.num_channels = NELEMENTS(pios_tim_servoport_rcvrport_pins),
};
#endif /* PIOS_INCLUDE_SERVO && PIOS_INCLUDE_TIM */
/*
* PPM Inputs
*/
#if defined(PIOS_INCLUDE_PPM)
#include <pios_ppm_priv.h>
const struct pios_ppm_cfg pios_ppm_cfg = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
/* Use only the first channel for ppm */
.channels = &pios_tim_rcvrport_all_channels[0],
.num_channels = 1,
};
const struct pios_ppm_cfg pios_ppm_pin8_cfg = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
/* Use only the first channel for ppm */
.channels = &pios_tim_rcvrport_all_channels[5],
.num_channels = 1,
};
#endif /* PIOS_INCLUDE_PPM */
#if defined(PIOS_INCLUDE_PPM_FLEXI)
#include <pios_ppm_priv.h>
const struct pios_ppm_cfg pios_ppm_flexi_cfg = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
.channels = &pios_tim_ppm_flexi_port,
.num_channels = 1,
};
#endif /* PIOS_INCLUDE_PPM_FLEXI */
/*
* PWM Inputs
*/
#if defined(PIOS_INCLUDE_PWM)
#include <pios_pwm_priv.h>
const struct pios_pwm_cfg pios_pwm_cfg = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
.channels = pios_tim_rcvrport_all_channels,
.num_channels = NELEMENTS(pios_tim_rcvrport_all_channels),
};
const struct pios_pwm_cfg pios_pwm_with_ppm_cfg = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
/* Leave the first channel for PPM use and use the rest for PWM */
.channels = &pios_tim_rcvrport_all_channels[1],
.num_channels = NELEMENTS(pios_tim_rcvrport_all_channels) - 1,
};
#endif /* if defined(PIOS_INCLUDE_PWM) */
/*
* SONAR Inputs
*/
#if defined(PIOS_INCLUDE_HCSR04)
#include <pios_hcsr04_priv.h>
static const struct pios_tim_channel pios_tim_hcsr04_port_all_channels[] = {
{
.timer = TIM3,
.timer_chan = TIM_Channel_2,
.pin = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_5,
.GPIO_Mode = GPIO_Mode_IPD,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
.remap = GPIO_PartialRemap_TIM3,
},
};
const struct pios_hcsr04_cfg pios_hcsr04_cfg = {
.tim_ic_init = {
.TIM_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
.TIM_ICFilter = 0x0,
},
.channels = pios_tim_hcsr04_port_all_channels,
.num_channels = NELEMENTS(pios_tim_hcsr04_port_all_channels),
.trigger = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_6,
.GPIO_Mode = GPIO_Mode_Out_PP,
.GPIO_Speed = GPIO_Speed_2MHz,
},
},
};
#endif /* if defined(PIOS_INCLUDE_HCSR04) */
#if defined(PIOS_INCLUDE_I2C)
#include <pios_i2c_priv.h>
/*
* I2C Adapters
*/
void PIOS_I2C_flexi_adapter_ev_irq_handler(void);
void PIOS_I2C_flexi_adapter_er_irq_handler(void);
void I2C2_EV_IRQHandler() __attribute__((alias("PIOS_I2C_flexi_adapter_ev_irq_handler")));
void I2C2_ER_IRQHandler() __attribute__((alias("PIOS_I2C_flexi_adapter_er_irq_handler")));
static const struct pios_i2c_adapter_cfg pios_i2c_flexi_adapter_cfg = {
.regs = I2C2,
.init = {
.I2C_Mode = I2C_Mode_I2C,
.I2C_OwnAddress1 = 0,
.I2C_Ack = I2C_Ack_Enable,
.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit,
.I2C_DutyCycle = I2C_DutyCycle_2,
.I2C_ClockSpeed = 400000, /* bits/s */
},
.transfer_timeout_ms = 50,
.scl = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_AF_OD,
},
},
.sda = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_AF_OD,
},
},
.event = {
.flags = 0, /* FIXME: check this */
.init = {
.NVIC_IRQChannel = I2C2_EV_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.error = {
.flags = 0, /* FIXME: check this */
.init = {
.NVIC_IRQChannel = I2C2_ER_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
};
uint32_t pios_i2c_flexi_adapter_id;
void PIOS_I2C_flexi_adapter_ev_irq_handler(void)
{
/* Call into the generic code to handle the IRQ for this specific device */
PIOS_I2C_EV_IRQ_Handler(pios_i2c_flexi_adapter_id);
}
void PIOS_I2C_flexi_adapter_er_irq_handler(void)
{
/* Call into the generic code to handle the IRQ for this specific device */
PIOS_I2C_ER_IRQ_Handler(pios_i2c_flexi_adapter_id);
}
#endif /* PIOS_INCLUDE_I2C */
#if defined(PIOS_INCLUDE_GCSRCVR)
#include "pios_gcsrcvr_priv.h"
#endif /* PIOS_INCLUDE_GCSRCVR */
#if defined(PIOS_INCLUDE_RCVR)
#include "pios_rcvr_priv.h"
#endif /* PIOS_INCLUDE_RCVR */
#if defined(PIOS_INCLUDE_USB)
#include "pios_usb_priv.h"
static const struct pios_usb_cfg pios_usb_main_cfg_cc = {
.irq = {
.init = {
.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.vsense = {
.gpio = GPIOC,
.init = {
.GPIO_Pin = GPIO_Pin_15,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_AF_OD,
},
},
.vsense_active_low = false
};
static const struct pios_usb_cfg pios_usb_main_cfg_cc3d = {
.irq = {
.init = {
.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.vsense = {
.gpio = GPIOC,
.init = {
.GPIO_Pin = GPIO_Pin_14,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_AF_OD,
},
},
.vsense_active_low = false
};
#include "pios_usb_board_data_priv.h"
#include "pios_usb_desc_hid_cdc_priv.h"
#include "pios_usb_desc_hid_only_priv.h"
#endif /* PIOS_INCLUDE_USB */
#if defined(PIOS_INCLUDE_COM_MSG)
#include <pios_com_msg_priv.h>
#endif /* PIOS_INCLUDE_COM_MSG */
#if defined(PIOS_INCLUDE_USB_HID)
#include <pios_usb_hid_priv.h>
const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
.data_if = 2,
.data_rx_ep = 1,
.data_tx_ep = 1,
};
#endif /* PIOS_INCLUDE_USB_HID */
#if defined(PIOS_INCLUDE_USB_RCTX)
#include <pios_usb_rctx_priv.h>
const struct pios_usb_rctx_cfg pios_usb_rctx_cfg = {
.data_if = 2,
.data_tx_ep = 1,
};
#endif /* PIOS_INCLUDE_USB_RCTX */
#if defined(PIOS_INCLUDE_USB_CDC)
#include <pios_usb_cdc_priv.h>
const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
.ctrl_if = 0,
.ctrl_tx_ep = 2,
.data_if = 1,
.data_rx_ep = 3,
.data_tx_ep = 3,
};
#endif /* PIOS_INCLUDE_USB_CDC */

View File

@ -0,0 +1,33 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# 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, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
ifndef TOP_LEVEL_MAKEFILE
$(error Top level Makefile must be used to build this target)
endif
## The standard CMSIS startup
SRC += $(CMSIS_DEVICEDIR)/system_stm32f10x.c
include ../board-info.mk
include $(ROOT_DIR)/make/firmware-defs.mk
include $(ROOT_DIR)/make/boot-defs.mk
include $(ROOT_DIR)/make/common-defs.mk
$(info Making bootloader for CopterControl, board revision $(BOARD_REVISION))
$(info Use BOARD_REVISION=1 for CC, BOARD_REVISION=2 for CC3D (default))

View File

@ -0,0 +1,115 @@
/**
******************************************************************************
* @addtogroup CopterControlBL CopterControl BootLoader
* @brief These files contain the code to the CopterControl Bootloader.
*
* @{
* @file common.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief This file contains various common defines for the BootLoader
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COMMON_H_
#define COMMON_H_
// #include "board.h"
typedef enum {
start, keepgoing,
} DownloadAction;
/**************************************************/
/* OP_DFU states */
/**************************************************/
typedef enum {
DFUidle, // 0
uploading, // 1
wrong_packet_received, // 2
too_many_packets, // 3
too_few_packets, // 4
Last_operation_Success, // 5
downloading, // 6
BLidle, // 7
Last_operation_failed, // 8
uploadingStarting, // 9
outsideDevCapabilities, // 10
CRC_Fail, // 11
failed_jump,
// 12
} DFUStates;
/**************************************************/
/* OP_DFU commands */
/**************************************************/
typedef enum {
Reserved, // 0
Req_Capabilities, // 1
Rep_Capabilities, // 2
EnterDFU, // 3
JumpFW, // 4
Reset, // 5
Abort_Operation, // 6
Upload, // 7
Op_END, // 8
Download_Req, // 9
Download, // 10
Status_Request, // 11
Status_Rep
// 12
} DFUCommands;
typedef enum {
High_Density, Medium_Density
} DeviceType;
/**************************************************/
/* OP_DFU transfer types */
/**************************************************/
typedef enum {
FW, // 0
Descript
// 2
} DFUTransfer;
/**************************************************/
/* OP_DFU transfer port */
/**************************************************/
typedef enum {
Usb, // 0
Serial
// 2
} DFUPort;
/**************************************************/
/* OP_DFU programable programable HW types */
/**************************************************/
typedef enum {
Self_flash, // 0
Remote_flash_via_spi
// 1
} DFUProgType;
/**************************************************/
/* OP_DFU programable sources */
/**************************************************/
#define USB 0
#define SPI 1
#define DownloadDelay 100000
#define MAX_DEL_RETRYS 3
#define MAX_WRI_RETRYS 3
#endif /* COMMON_H_ */

View File

@ -0,0 +1,53 @@
/**
******************************************************************************
* @addtogroup CopterControlBL CopterControl BootLoader
* @brief These files contain the code to the CopterControl Bootloader.
* @{
* @file pios_config.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief PiOS configuration header.
* Central compile time config for the project.
* In particular, pios_config.h is where you define which PiOS libraries
* and features are included in the firmware.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_CONFIG_H
#define PIOS_CONFIG_H
/* Enable/Disable PiOS modules */
#define PIOS_INCLUDE_DELAY
#define PIOS_INCLUDE_SYS
#define PIOS_INCLUDE_IRQ
#define PIOS_INCLUDE_GPIO
#define PIOS_INCLUDE_USB
#define PIOS_INCLUDE_USB_HID
#define PIOS_INCLUDE_LED
#define PIOS_INCLUDE_IAP
#define PIOS_INCLUDE_COM
#define PIOS_INCLUDE_COM_MSG
#define PIOS_INCLUDE_BL_HELPER
#define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT
#endif /* PIOS_CONFIG_H */
/**
* @}
* @}
*/

View File

@ -0,0 +1,53 @@
/**
******************************************************************************
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup PIOS_USB_BOARD Board specific USB definitions
* @brief Board specific USB definitions
* @{
*
* @file pios_usb_board_data.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Board specific USB definitions
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_USB_BOARD_DATA_H
#define PIOS_USB_BOARD_DATA_H
// Note : changing below length will require changes to the USB buffer setup
#define PIOS_USB_BOARD_HID_DATA_LENGTH 64
#define PIOS_USB_BOARD_EP_NUM 2
#include <pios_usb_defs.h> /* struct usb_* */
#define PIOS_USB_BOARD_PRODUCT_ID USB_PRODUCT_ID_COPTERCONTROL
#define PIOS_USB_BOARD_DEVICE_VER USB_OP_DEVICE_VER(USB_OP_BOARD_ID_COPTERCONTROL, USB_OP_BOARD_MODE_BL)
#define PIOS_USB_BOARD_SN_SUFFIX "+BL"
/*
* The bootloader uses a simplified report structure
* BL: <REPORT_ID><DATA>...<DATA>
* FW: <REPORT_ID><LENGTH><DATA>...<DATA>
* This define changes the behaviour in pios_usb_hid.c
*/
#define PIOS_USB_BOARD_BL_HID_HAS_NO_LENGTH_BYTE
#endif /* PIOS_USB_BOARD_DATA_H */

View File

@ -0,0 +1,223 @@
/**
******************************************************************************
* @addtogroup CopterControlBL CopterControl BootLoader
* @brief These files contain the code to the CopterControl Bootloader.
*
* @{
* @file main.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief This is the file with the main function of the OpenPilot BootLoader
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <pios.h>
#include <pios_board_info.h>
#include <op_dfu.h>
#include <usb_lib.h>
#include <pios_iap.h>
#include <fifo_buffer.h>
#include <pios_com_msg.h>
/* Prototype of PIOS_Board_Init() function */
extern void PIOS_Board_Init(void);
extern void FLASH_Download();
#define BSL_HOLD_STATE ((PIOS_USB_DETECT_GPIO_PORT->IDR & PIOS_USB_DETECT_GPIO_PIN) ? 0 : 1)
/* Private typedef -----------------------------------------------------------*/
typedef void (*pFunction)(void);
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
pFunction Jump_To_Application;
uint32_t JumpAddress;
/// LEDs PWM
uint32_t period1 = 5000; // 5 mS
uint32_t sweep_steps1 = 100; // * 5 mS -> 500 mS
uint32_t period2 = 5000; // 5 mS
uint32_t sweep_steps2 = 100; // * 5 mS -> 500 mS
////////////////////////////////////////
uint8_t tempcount = 0;
/* Extern variables ----------------------------------------------------------*/
DFUStates DeviceState;
int16_t status = 0;
uint8_t JumpToApp = FALSE;
uint8_t GO_dfu = FALSE;
uint8_t USB_connected = FALSE;
uint8_t User_DFU_request = FALSE;
static uint8_t mReceive_Buffer[63];
/* Private function prototypes -----------------------------------------------*/
uint32_t LedPWM(uint32_t pwm_period, uint32_t pwm_sweep_steps, uint32_t count);
uint8_t processRX();
void jump_to_app();
int main()
{
PIOS_SYS_Init();
PIOS_Board_Init();
PIOS_IAP_Init();
USB_connected = PIOS_USB_CableConnected(0);
if (PIOS_IAP_CheckRequest() == TRUE) {
PIOS_DELAY_WaitmS(1000);
User_DFU_request = TRUE;
PIOS_IAP_ClearRequest();
}
GO_dfu = (USB_connected == TRUE) || (User_DFU_request == TRUE);
if (GO_dfu == TRUE) {
PIOS_Board_Init();
if (User_DFU_request == TRUE) {
DeviceState = DFUidle;
} else {
DeviceState = BLidle;
}
} else {
JumpToApp = TRUE;
}
uint32_t stopwatch = 0;
uint32_t prev_ticks = PIOS_DELAY_GetuS();
while (TRUE) {
/* Update the stopwatch */
uint32_t elapsed_ticks = PIOS_DELAY_GetuSSince(prev_ticks);
prev_ticks += elapsed_ticks;
stopwatch += elapsed_ticks;
if (JumpToApp == TRUE) {
jump_to_app();
}
switch (DeviceState) {
case Last_operation_Success:
case uploadingStarting:
case DFUidle:
period1 = 5000;
sweep_steps1 = 100;
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
period2 = 0;
break;
case uploading:
period1 = 5000;
sweep_steps1 = 100;
period2 = 2500;
sweep_steps2 = 50;
break;
case downloading:
period1 = 2500;
sweep_steps1 = 50;
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
period2 = 0;
break;
case BLidle:
period1 = 0;
PIOS_LED_On(PIOS_LED_HEARTBEAT);
period2 = 0;
break;
default: // error
period1 = 5000;
sweep_steps1 = 100;
period2 = 5000;
sweep_steps2 = 100;
}
if (period1 != 0) {
if (LedPWM(period1, sweep_steps1, stopwatch)) {
PIOS_LED_On(PIOS_LED_HEARTBEAT);
} else {
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
}
} else {
PIOS_LED_On(PIOS_LED_HEARTBEAT);
}
if (period2 != 0) {
if (LedPWM(period2, sweep_steps2, stopwatch)) {
PIOS_LED_On(PIOS_LED_HEARTBEAT);
} else {
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
}
} else {
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
}
if (stopwatch > 50 * 1000 * 1000) {
stopwatch = 0;
}
if ((stopwatch > 6 * 1000 * 1000) && ((DeviceState == BLidle) || (DeviceState == DFUidle && !USB_connected))) {
JumpToApp = TRUE;
}
processRX();
DataDownload(start);
}
}
void jump_to_app()
{
const struct pios_board_info *bdinfo = &pios_board_info_blob;
if (((*(__IO uint32_t *)bdinfo->fw_base) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */
FLASH_Lock();
RCC_APB2PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB1PeriphResetCmd(0xffffffff, ENABLE);
RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
_SetCNTR(0); // clear interrupt mask
_SetISTR(0); // clear all requests
JumpAddress = *(__IO uint32_t *)(bdinfo->fw_base + 4);
Jump_To_Application = (pFunction)JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t *)bdinfo->fw_base);
Jump_To_Application();
} else {
DeviceState = failed_jump;
return;
}
}
uint32_t LedPWM(uint32_t pwm_period, uint32_t pwm_sweep_steps, uint32_t count)
{
uint32_t curr_step = (count / pwm_period) % pwm_sweep_steps; /* 0 - pwm_sweep_steps */
uint32_t pwm_duty = pwm_period * curr_step / pwm_sweep_steps; /* fraction of pwm_period */
uint32_t curr_sweep = (count / (pwm_period * pwm_sweep_steps)); /* ticks once per full sweep */
if (curr_sweep & 1) {
pwm_duty = pwm_period - pwm_duty; /* reverse direction in odd sweeps */
}
return ((count % pwm_period) > pwm_duty) ? 1 : 0;
}
uint8_t processRX()
{
if (PIOS_COM_MSG_Receive(PIOS_COM_TELEM_USB, mReceive_Buffer, sizeof(mReceive_Buffer))) {
processComand(mReceive_Buffer);
}
return TRUE;
}
int32_t platform_senddata(const uint8_t *msg, uint16_t msg_len)
{
return PIOS_COM_MSG_Send(PIOS_COM_TELEM_USB, msg, msg_len);
}

View File

@ -0,0 +1,106 @@
/**
******************************************************************************
*
* @file pios_board.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Defines board specific static initializers for hardware for the CopterControl board.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <pios.h>
#include <pios_board_info.h>
/*
* Pull in the board-specific static HW definitions.
* Including .c files is a bit ugly but this allows all of
* the HW definitions to be const and static to limit their
* scope.
*
* NOTE: THIS IS THE ONLY PLACE THAT SHOULD EVER INCLUDE THIS FILE
*/
#include "../board_hw_defs.c"
uint32_t pios_com_telem_usb_id;
/**
* PIOS_Board_Init()
* initializes all the core subsystems on this specific hardware
* called from System/openpilot.c
*/
static bool board_init_complete = false;
void PIOS_Board_Init(void)
{
if (board_init_complete) {
return;
}
/* Enable Prefetch Buffer */
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
/* Flash 2 wait state */
FLASH_SetLatency(FLASH_Latency_2);
/* Delay system */
PIOS_DELAY_Init();
const struct pios_board_info *bdinfo = &pios_board_info_blob;
#if defined(PIOS_INCLUDE_LED)
const struct pios_gpio_cfg *led_cfg = PIOS_BOARD_HW_DEFS_GetLedCfg(bdinfo->board_rev);
PIOS_Assert(led_cfg);
PIOS_LED_Init(led_cfg);
#endif /* PIOS_INCLUDE_LED */
#if defined(PIOS_INCLUDE_USB)
/* Initialize board specific USB data */
PIOS_USB_BOARD_DATA_Init();
/* Activate the HID-only USB configuration */
PIOS_USB_DESC_HID_ONLY_Init();
uint32_t pios_usb_id;
switch (bdinfo->board_rev) {
case BOARD_REVISION_CC:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc);
break;
case BOARD_REVISION_CC3D:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc3d);
break;
default:
PIOS_Assert(0);
}
#if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_COM_MSG)
uint32_t pios_usb_hid_id;
if (PIOS_USB_HID_Init(&pios_usb_hid_id, &pios_usb_hid_cfg, pios_usb_id)) {
PIOS_Assert(0);
}
if (PIOS_COM_MSG_Init(&pios_com_telem_usb_id, &pios_usb_hid_com_driver, pios_usb_hid_id)) {
PIOS_Assert(0);
}
#endif /* PIOS_INCLUDE_USB_HID && PIOS_INCLUDE_COM_MSG */
#endif /* PIOS_INCLUDE_USB */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE); // TODO Tirar
board_init_complete = true;
}
void PIOS_ADC_DMA_Handler()
{}

View File

@ -0,0 +1,153 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot
#
# 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, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
ifndef TOP_LEVEL_MAKEFILE
$(error Top level Makefile must be used to build this target)
endif
include ../board-info.mk
include $(ROOT_DIR)/make/firmware-defs.mk
# ARM DSP library
USE_DSP_LIB ?= NO
# Set to YES to build a FW version that will erase data flash memory
ERASE_FLASH ?= NO
# Set to yes to include Gcsreceiver module
GCSRECEIVER ?= NO
# Enable Diag tasks ?
DIAG_TASKS ?= NO
# List of mandatory modules to include
MODULES += Attitude
MODULES += Stabilization
MODULES += Actuator
MODULES += Receiver
MODULES += ManualControl
MODULES += FirmwareIAP
MODULES += Telemetry
# List of optional modules to include
OPTMODULES += CameraStab
OPTMODULES += ComUsbBridge
OPTMODULES += GPS
OPTMODULES += TxPID
OPTMODULES += Osd/osdoutput
#OPTMODULES += Altitude
#OPTMODULES += Fault
SRC += $(FLIGHTLIB)/notification.c
# Include all camera options
CDEFS += -DUSE_INPUT_LPF -DUSE_GIMBAL_LPF -DUSE_GIMBAL_FF
# Erase flash firmware should be buildable from command line
ifeq ($(ERASE_FLASH), YES)
CDEFS += -DERASE_FLASH
endif
# List C source files here (C dependencies are automatically generated).
# Use file-extension c for "c-only"-files
ifndef TESTAPP
## The standard CMSIS startup
SRC += $(CMSIS_DEVICEDIR)/system_stm32f10x.c
## Application Core
SRC += ../pios_usb_board_data.c
SRC += $(OPMODULEDIR)/System/systemmod.c
SRC += $(OPSYSTEM)/coptercontrol.c
SRC += $(OPSYSTEM)/pios_board.c
SRC += $(FLIGHTLIB)/alarms.c
SRC += $(FLIGHTLIB)/instrumentation.c
SRC += $(OPUAVTALK)/uavtalk.c
SRC += $(OPUAVOBJ)/uavobjectmanager.c
SRC += $(OPUAVOBJ)/uavobjectpersistence.c
SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c
SRC += $(PIOSCOMMON)/pios_flash_jedec.c
SRC += $(OPUAVOBJ)/eventdispatcher.c
## UAVObjects
SRC += $(OPUAVSYNTHDIR)/accessorydesired.c
SRC += $(OPUAVSYNTHDIR)/objectpersistence.c
SRC += $(OPUAVSYNTHDIR)/gcstelemetrystats.c
SRC += $(OPUAVSYNTHDIR)/flighttelemetrystats.c
SRC += $(OPUAVSYNTHDIR)/faultsettings.c
SRC += $(OPUAVSYNTHDIR)/flightstatus.c
SRC += $(OPUAVSYNTHDIR)/systemstats.c
SRC += $(OPUAVSYNTHDIR)/systemalarms.c
SRC += $(OPUAVSYNTHDIR)/systemsettings.c
SRC += $(OPUAVSYNTHDIR)/stabilizationdesired.c
SRC += $(OPUAVSYNTHDIR)/stabilizationsettings.c
SRC += $(OPUAVSYNTHDIR)/stabilizationsettingsbank1.c
SRC += $(OPUAVSYNTHDIR)/stabilizationsettingsbank2.c
SRC += $(OPUAVSYNTHDIR)/stabilizationsettingsbank3.c
SRC += $(OPUAVSYNTHDIR)/stabilizationstatus.c
SRC += $(OPUAVSYNTHDIR)/stabilizationbank.c
SRC += $(OPUAVSYNTHDIR)/actuatorcommand.c
SRC += $(OPUAVSYNTHDIR)/actuatordesired.c
SRC += $(OPUAVSYNTHDIR)/actuatorsettings.c
SRC += $(OPUAVSYNTHDIR)/accelstate.c
SRC += $(OPUAVSYNTHDIR)/accelgyrosettings.c
SRC += $(OPUAVSYNTHDIR)/gyrostate.c
SRC += $(OPUAVSYNTHDIR)/attitudestate.c
SRC += $(OPUAVSYNTHDIR)/manualcontrolcommand.c
SRC += $(OPUAVSYNTHDIR)/watchdogstatus.c
SRC += $(OPUAVSYNTHDIR)/manualcontrolsettings.c
SRC += $(OPUAVSYNTHDIR)/flightmodesettings.c
SRC += $(OPUAVSYNTHDIR)/mixersettings.c
SRC += $(OPUAVSYNTHDIR)/firmwareiapobj.c
SRC += $(OPUAVSYNTHDIR)/attitudesettings.c
SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c
SRC += $(OPUAVSYNTHDIR)/cameradesired.c
SRC += $(OPUAVSYNTHDIR)/gpspositionsensor.c
SRC += $(OPUAVSYNTHDIR)/gpsvelocitysensor.c
SRC += $(OPUAVSYNTHDIR)/gpssettings.c
SRC += $(OPUAVSYNTHDIR)/hwsettings.c
SRC += $(OPUAVSYNTHDIR)/receiveractivity.c
SRC += $(OPUAVSYNTHDIR)/receiverstatus.c
SRC += $(OPUAVSYNTHDIR)/mixerstatus.c
SRC += $(OPUAVSYNTHDIR)/ratedesired.c
SRC += $(OPUAVSYNTHDIR)/txpidsettings.c
SRC += $(OPUAVSYNTHDIR)/txpidstatus.c
SRC += $(OPUAVSYNTHDIR)/mpugyroaccelsettings.c
# Command line option for Gcsreceiver module
ifeq ($(GCSRECEIVER), YES)
SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c
endif
# Enable Diag tasks and UAVOs needed
ifeq ($(DIAG_TASKS), YES)
CDEFS += -DDIAG_TASKS
SRC += $(OPUAVSYNTHDIR)/taskinfo.c
SRC += $(OPUAVSYNTHDIR)/callbackinfo.c
SRC += $(OPUAVSYNTHDIR)/perfcounter.c
SRC += $(OPUAVSYNTHDIR)/i2cstats.c
endif
else
## Test Code
SRC += $(OPTESTS)/test_common.c
SRC += $(OPTESTS)/$(TESTAPP).c
endif
include $(ROOT_DIR)/make/apps-defs.mk
include $(ROOT_DIR)/make/common-defs.mk

View File

@ -0,0 +1,117 @@
/**
******************************************************************************
* @addtogroup OpenPilotSystem OpenPilot System
* @brief These files are the core system files of OpenPilot.
* They are the ground layer just above PiOS. In practice, OpenPilot actually starts
* in the main() function of openpilot.c
* @{
* @addtogroup OpenPilotCore OpenPilot Core
* @brief This is where the OP firmware starts. Those files also define the compile-time
* options of the firmware.
* @{
* @file openpilot.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Sets up and runs main OpenPilot tasks.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inc/openpilot.h"
#include <uavobjectsinit.h>
#include <hwsettings.h>
/* Task Priorities */
#define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
/* Global Variables */
/* Prototype of PIOS_Board_Init() function */
extern void PIOS_Board_Init(void);
extern void Stack_Change(void);
/**
* OpenPilot Main function:
*
* Initialize PiOS<BR>
* Create the "System" task (SystemModInitializein Modules/System/systemmod.c) <BR>
* Start FreeRTOS Scheduler (vTaskStartScheduler) (Now handled by caller)
* If something goes wrong, blink LED1 and LED2 every 100ms
*
*/
int main()
{
/* NOTE: Do NOT modify the following start-up sequence */
/* Any new initialization functions should be added in OpenPilotInit() */
/* Brings up System using CMSIS functions, enables the LEDs. */
PIOS_SYS_Init();
/* Architecture dependant Hardware and
* core subsystem initialisation
* (see pios_board.c for your arch)
* */
PIOS_Board_Init();
#ifdef ERASE_FLASH
PIOS_Flash_Jedec_EraseChip();
#if defined(PIOS_LED_HEARTBEAT)
PIOS_LED_Off(PIOS_LED_HEARTBEAT);
#endif /* PIOS_LED_HEARTBEAT */
while (1) {
;
}
#endif
/* Initialize modules */
MODULE_INITIALISE_ALL
/* swap the stack to use the IRQ stack */
Stack_Change();
/* Start the FreeRTOS scheduler, which should never return.
*
* NOTE: OpenPilot runs an operating system (FreeRTOS), which constantly calls
* (schedules) function files (modules). These functions never return from their
* while loops, which explains why each module has a while(1){} segment. Thus,
* the OpenPilot software actually starts at the vTaskStartScheduler() function,
* even though this is somewhat obscure.
*
* In addition, there are many main() functions in the OpenPilot firmware source tree
* This is because each main() refers to a separate hardware platform. Of course,
* C only allows one main(), so only the relevant main() function is compiled when
* making a specific firmware.
*
*/
vTaskStartScheduler();
/* If all is well we will never reach here as the scheduler will now be running. */
/* Do some indication to user that something bad just happened */
while (1) {
#if defined(PIOS_LED_HEARTBEAT)
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
#endif /* PIOS_LED_HEARTBEAT */
PIOS_DELAY_WaitmS(100);
}
return 0;
}
/**
* @}
* @}
*/

View File

@ -0,0 +1,99 @@
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
/**
* @addtogroup PIOS PIOS
* @{
* @addtogroup FreeRTOS FreeRTOS
* @{
*/
/* Notes: We use 5 task priorities */
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configUSE_MALLOC_FAILED_HOOK 1
#define configCPU_CLOCK_HZ ((unsigned long)72000000)
#define configTICK_RATE_HZ ((portTickType)1000)
#define configMAX_PRIORITIES ((unsigned portBASE_TYPE)5)
#define configMINIMAL_STACK_SIZE ((unsigned short)48)
#define configTOTAL_HEAP_SIZE ((size_t)(53 * 256))
#define configMAX_TASK_NAME_LEN (6)
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 0
#define configUSE_ALTERNATIVE_API 0
#define configQUEUE_REGISTRY_SIZE 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES (2)
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetSchedulerState 0
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */
#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3 << 4 /* equivalent to NVIC priority 3 */
/* This is the value being used as per the ST library which permits 16
priority values, 0 to 15. This must correspond to the
configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15
#if !defined(ARCH_POSIX) && !defined(ARCH_WIN32)
#define CHECK_IRQ_STACK
#endif
/* Enable run time stats collection */
#define configGENERATE_RUN_TIME_STATS 1
#define INCLUDE_uxTaskGetRunTime 1
#define INCLUDE_xTaskGetIdleTaskHandle 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \
do { \
(*(unsigned long *)0xe000edfc) |= (1 << 24); /* DEMCR |= DEMCR_TRCENA */ \
(*(unsigned long *)0xe0001000) |= 1; /* DWT_CTRL |= DWT_CYCCNT_ENA */ \
} \
while (0)
#define portGET_RUN_TIME_COUNTER_VALUE() (*(unsigned long *)0xe0001004) /* DWT_CYCCNT */
#ifdef DIAG_TASKS
#define configCHECK_FOR_STACK_OVERFLOW 2
#else
#define configCHECK_FOR_STACK_OVERFLOW 1
#endif
/**
* @}
*/
#endif /* FREERTOS_CONFIG_H */

View File

@ -0,0 +1,52 @@
/**
******************************************************************************
* @addtogroup OpenPilotSystem OpenPilot System
* @{
* @addtogroup OpenPilotCore OpenPilot Core
* @{
* @file openpilot.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Main OpenPilot header.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OPENPILOT_H
#define OPENPILOT_H
/* PIOS Includes */
#include <pios.h>
/* OpenPilot Libraries */
#include <utlist.h>
#include <uavobjectmanager.h>
#include <eventdispatcher.h>
#include <uavtalk.h>
#include "alarms.h"
#include <mathmisc.h>
/* Global Functions */
void OpenPilotInit(void);
#endif /* OPENPILOT_H */
/**
* @}
* @}
*/

View File

@ -0,0 +1,81 @@
/**
******************************************************************************
*
* @file pios_board.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_BOARD_H
#define PIOS_BOARD_H
// ------------------------
// PIOS_LED
// ------------------------
// #define PIOS_LED_LED1_GPIO_PORT GPIOC
// #define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_12
// #define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOC
// #define PIOS_LED_LED2_GPIO_PORT GPIOC
// #define PIOS_LED_LED2_GPIO_PIN GPIO_Pin_13
// #define PIOS_LED_LED2_GPIO_CLK RCC_APB2Periph_GPIOC
#define PIOS_LED_NUM 2
// #define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT }
// #define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN }
// #define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK }
// -------------------------
// COM
//
// See also pios_board_posix.c
// -------------------------
// #define PIOS_USART_TX_BUFFER_SIZE 256
#define PIOS_COM_BUFFER_SIZE 1024
#define PIOS_UDP_RX_BUFFER_SIZE PIOS_COM_BUFFER_SIZE
#define PIOS_COM_TELEM_RF 0
#define PIOS_COM_GPS 1
#define PIOS_COM_TELEM_USB 2
#ifdef PIOS_ENABLE_AUX_UART
#define PIOS_COM_AUX 3
#define PIOS_COM_DEBUG PIOS_COM_AUX
#endif
/**
* glue macros for file IO
* STM32 uses DOSFS for file IO
*/
#define PIOS_FOPEN_READ(filename, file) (file = fopen((char *)filename, "r")) == NULL
#define PIOS_FOPEN_WRITE(filename, file) (file = fopen((char *)filename, "w")) == NULL
#define PIOS_FREAD(file, bufferadr, length, resultadr) (*resultadr = fread((uint8_t *)bufferadr, 1, length, *file)) != length
#define PIOS_FWRITE(file, bufferadr, length, resultadr) *resultadr = fwrite((uint8_t *)bufferadr, 1, length, *file)
#define PIOS_FCLOSE(file) fclose(file)
#define PIOS_FUNLINK(file) unlink((char *)filename)
#endif /* PIOS_BOARD_H */

View File

@ -0,0 +1,190 @@
/**
******************************************************************************
* @addtogroup OpenPilotSystem OpenPilot System
* @{
* @addtogroup OpenPilotCore OpenPilot Core
* @{
* @file pios_config.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010-2013.
* @author LibrePilot, https://bitbucket.org/librepilot, Copyright (C) 2015
* @brief PiOS configuration header, the compile time config file for the PIOS.
* Defines which PiOS libraries and features are included in the firmware.
* @see The GNU Public License (GPL) Version 3
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_CONFIG_H
#define PIOS_CONFIG_H
/*
* Below is a complete list of PIOS configurable options.
* Please do not remove or rearrange them. Only comment out
* unused options in the list. See main pios.h header for more
* details.
*/
/* #define PIOS_INCLUDE_DEBUG_CONSOLE */
/* #define DEBUG_LEVEL 0 */
/* #define PIOS_ENABLE_DEBUG_PINS */
/* PIOS FreeRTOS support */
#define PIOS_INCLUDE_FREERTOS
/* PIOS CallbackScheduler support */
#define PIOS_INCLUDE_CALLBACKSCHEDULER
/* PIOS bootloader helper */
#define PIOS_INCLUDE_BL_HELPER
/* #define PIOS_INCLUDE_BL_HELPER_WRITE_SUPPORT */
/* PIOS system functions */
#define PIOS_INCLUDE_DELAY
#define PIOS_INCLUDE_INITCALL
#define PIOS_INCLUDE_SYS
#define PIOS_INCLUDE_TASK_MONITOR
// #define PIOS_INCLUDE_INSTRUMENTATION
#define PIOS_INSTRUMENTATION_MAX_COUNTERS 5
/* PIOS hardware peripherals */
#define PIOS_INCLUDE_IRQ
#define PIOS_INCLUDE_RTC
#define PIOS_INCLUDE_TIM
#define PIOS_INCLUDE_USART
#define PIOS_INCLUDE_ADC
/* #define PIOS_INCLUDE_I2C */
#define PIOS_INCLUDE_SPI
#define PIOS_INCLUDE_GPIO
#define PIOS_INCLUDE_EXTI
#define PIOS_INCLUDE_WDG
/* PIOS USB functions */
#define PIOS_INCLUDE_USB
#define PIOS_INCLUDE_USB_HID
#define PIOS_INCLUDE_USB_CDC
#define PIOS_INCLUDE_USB_RCTX
/* PIOS sensor interfaces */
#define PIOS_INCLUDE_ADXL345
/* #define PIOS_INCLUDE_BMA180 */
/* #define PIOS_INCLUDE_L3GD20 */
#define PIOS_INCLUDE_MPU6000
#define PIOS_MPU6000_ACCEL
/* #define PIOS_INCLUDE_HMC5843 */
/* #define PIOS_INCLUDE_HMC5X83 */
/* #define PIOS_HMC5883_HAS_GPIOS */
/* #define PIOS_INCLUDE_BMP085 */
/* #define PIOS_INCLUDE_MS5611 */
/* #define PIOS_INCLUDE_MPXV */
/* #define PIOS_INCLUDE_ETASV3 */
/* #define PIOS_INCLUDE_HCSR04 */
#define PIOS_SENSOR_RATE 500.0f
/* PIOS receiver drivers */
#define PIOS_INCLUDE_PWM
#define PIOS_INCLUDE_PPM
#define PIOS_INCLUDE_PPM_FLEXI
#define PIOS_INCLUDE_DSM
#define PIOS_INCLUDE_SBUS
#define PIOS_INCLUDE_SRXL
/* #define PIOS_INCLUDE_GCSRCVR */
/* #define PIOS_INCLUDE_OPLINKRCVR */
/* PIOS abstract receiver interface */
#define PIOS_INCLUDE_RCVR
/* PIOS common peripherals */
#define PIOS_INCLUDE_LED
#define PIOS_INCLUDE_IAP
#define PIOS_INCLUDE_SERVO
/* #define PIOS_INCLUDE_I2C_ESC */
/* #define PIOS_INCLUDE_OVERO */
/* #define PIOS_OVERO_SPI */
/* #define PIOS_INCLUDE_SDCARD */
/* #define LOG_FILENAME "startup.log" */
#define PIOS_INCLUDE_FLASH
#define PIOS_INCLUDE_FLASH_LOGFS_SETTINGS
/* #define FLASH_FREERTOS */
/* #define PIOS_INCLUDE_FLASH_EEPROM */
/* #define PIOS_INCLUDE_FLASH_INTERNAL */
/* PIOS radio modules */
/* #define PIOS_INCLUDE_RFM22B */
/* #define PIOS_INCLUDE_RFM22B_COM */
/* #define PIOS_INCLUDE_PPM_OUT */
/* #define PIOS_RFM22B_DEBUG_ON_TELEM */
/* PIOS misc peripherals */
/* #define PIOS_INCLUDE_VIDEO */
/* #define PIOS_INCLUDE_WAVE */
/* #define PIOS_INCLUDE_UDP */
/* PIOS abstract comms interface with options */
#define PIOS_INCLUDE_COM
/* #define PIOS_INCLUDE_COM_MSG */
#define PIOS_INCLUDE_TELEMETRY_RF
/* #define PIOS_INCLUDE_COM_TELEM */
/* #define PIOS_INCLUDE_COM_FLEXI */
/* #define PIOS_INCLUDE_COM_AUX */
/* #define PIOS_TELEM_PRIORITY_QUEUE */
#define PIOS_INCLUDE_GPS
#define PIOS_GPS_MINIMAL
/* #define PIOS_INCLUDE_GPS_NMEA_PARSER */
#define PIOS_INCLUDE_GPS_UBX_PARSER
/* #define PIOS_GPS_SETS_HOMELOCATION */
/* Stabilization options */
/* #define PIOS_QUATERNION_STABILIZATION */
#define PIOS_EXCLUDE_ADVANCED_FEATURES
/* Performance counters */
#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 1995998
/* Alarm Thresholds */
#define HEAP_LIMIT_WARNING 220
#define HEAP_LIMIT_CRITICAL 40
#define IRQSTACK_LIMIT_WARNING 100
#define IRQSTACK_LIMIT_CRITICAL 60
#define CPULOAD_LIMIT_WARNING 85
#define CPULOAD_LIMIT_CRITICAL 95
/* Task stack sizes */
#define PIOS_ACTUATOR_STACK_SIZE 700
#define PIOS_MANUAL_STACK_SIZE 735
#define PIOS_RECEIVER_STACK_SIZE 620
#define PIOS_STABILIZATION_STACK_SIZE 400
#ifdef DIAG_TASKS
#define PIOS_SYSTEM_STACK_SIZE 760
#else
#define PIOS_SYSTEM_STACK_SIZE 660
#endif
#define PIOS_TELEM_RX_STACK_SIZE 410
#define PIOS_TELEM_TX_STACK_SIZE 560
#define PIOS_EVENTDISPATCHER_STACK_SIZE 95
/* This can't be too high to stop eventdispatcher thread overflowing */
#define PIOS_EVENTDISAPTCHER_QUEUE 10
/* Revolution series */
/* #define REVOLUTION */
#endif /* PIOS_CONFIG_H */
/**
* @}
* @}
*/

View File

@ -0,0 +1,48 @@
/**
******************************************************************************
*
* @file pios_config.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief PiOS configuration header.
* Central compile time config for the project.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_CONFIG_POSIX_H
#define PIOS_CONFIG_POSIX_H
/* Enable/Disable PiOS Modules */
#define PIOS_INCLUDE_SYS
#define PIOS_INCLUDE_DELAY
#define PIOS_INCLUDE_LED
#define PIOS_INCLUDE_FREERTOS
#define PIOS_INCLUDE_CALLBACKSCHEDULER
#define PIOS_INCLUDE_TASK_MONITOR
#define PIOS_INCLUDE_COM
#define PIOS_INCLUDE_UDP
#define PIOS_INCLUDE_SERVO
/* Defaults for Logging */
#define LOG_FILENAME "PIOS.LOG"
#define STARTUP_LOG_ENABLED 1
#endif /* PIOS_CONFIG_POSIX_H */

View File

@ -0,0 +1,47 @@
/**
******************************************************************************
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup PIOS_USB_BOARD Board specific USB definitions
* @brief Board specific USB definitions
* @{
*
* @file pios_usb_board_data.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Board specific USB definitions
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_USB_BOARD_DATA_H
#define PIOS_USB_BOARD_DATA_H
// Note : changing below length will require changes to the USB buffer setup
#define PIOS_USB_BOARD_CDC_DATA_LENGTH 64
#define PIOS_USB_BOARD_CDC_MGMT_LENGTH 32
#define PIOS_USB_BOARD_HID_DATA_LENGTH 64
#define PIOS_USB_BOARD_EP_NUM 4
#include <pios_usb_defs.h> /* USB_* macros */
#define PIOS_USB_BOARD_PRODUCT_ID USB_PRODUCT_ID_COPTERCONTROL
#define PIOS_USB_BOARD_DEVICE_VER USB_OP_DEVICE_VER(USB_OP_BOARD_ID_COPTERCONTROL, USB_OP_BOARD_MODE_FW)
#define PIOS_USB_BOARD_SN_SUFFIX "+FW"
#endif /* PIOS_USB_BOARD_DATA_H */

View File

@ -0,0 +1,944 @@
/**
*****************************************************************************
* @file pios_board.c
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
*
* @addtogroup OpenPilotSystem OpenPilot System
* @{
* @addtogroup OpenPilotCore OpenPilot Core
* @{
* @brief Defines board specific static initializers for hardware for the CopterControl board.
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inc/openpilot.h"
#include <pios_board_info.h>
#include <uavobjectsinit.h>
#include <hwsettings.h>
#include <manualcontrolsettings.h>
#include <gcsreceiver.h>
#include <taskinfo.h>
#include <sanitycheck.h>
#include <actuatorsettings.h>
#ifdef PIOS_INCLUDE_INSTRUMENTATION
#include <pios_instrumentation.h>
#endif
#if defined(PIOS_INCLUDE_ADXL345)
#include <pios_adxl345.h>
#endif
/*
* Pull in the board-specific static HW definitions.
* Including .c files is a bit ugly but this allows all of
* the HW definitions to be const and static to limit their
* scope.
*
* NOTE: THIS IS THE ONLY PLACE THAT SHOULD EVER INCLUDE THIS FILE
*/
#include "../board_hw_defs.c"
/* One slot per selectable receiver group.
* eg. PWM, PPM, GCS, DSMMAINPORT, DSMFLEXIPORT, SBUS
* NOTE: No slot in this map for NONE.
*/
uint32_t pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE];
static SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook();
static void ActuatorSettingsUpdatedCb(UAVObjEvent *ev);
#define PIOS_COM_TELEM_RF_RX_BUF_LEN 32
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 12
#define PIOS_COM_GPS_RX_BUF_LEN 32
#define PIOS_COM_TELEM_USB_RX_BUF_LEN 65
#define PIOS_COM_TELEM_USB_TX_BUF_LEN 65
#define PIOS_COM_BRIDGE_RX_BUF_LEN 65
#define PIOS_COM_BRIDGE_TX_BUF_LEN 12
#define PIOS_COM_HKOSD_TX_BUF_LEN 22
#if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
#define PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN 40
uint32_t pios_com_debug_id;
#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
uint32_t pios_com_telem_rf_id;
uint32_t pios_com_telem_usb_id;
uint32_t pios_com_vcp_id;
uint32_t pios_com_gps_id;
uint32_t pios_com_bridge_id;
uint32_t pios_com_hkosd_id;
uint32_t pios_usb_rctx_id;
uintptr_t pios_uavo_settings_fs_id;
uintptr_t pios_user_fs_id = 0;
/**
* Configuration for MPU6000 chip
*/
#if defined(PIOS_INCLUDE_MPU6000)
#include "pios_mpu6000.h"
#include "pios_mpu6000_config.h"
static const struct pios_exti_cfg pios_exti_mpu6000_cfg __exti_config = {
.vector = PIOS_MPU6000_IRQHandler,
.line = EXTI_Line3,
.pin = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_3,
.GPIO_Speed = GPIO_Speed_10MHz,
.GPIO_Mode = GPIO_Mode_IN_FLOATING,
},
},
.irq = {
.init = {
.NVIC_IRQChannel = EXTI3_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.exti = {
.init = {
.EXTI_Line = EXTI_Line3, // matches above GPIO pin
.EXTI_Mode = EXTI_Mode_Interrupt,
.EXTI_Trigger = EXTI_Trigger_Rising,
.EXTI_LineCmd = ENABLE,
},
},
};
static const struct pios_mpu6000_cfg pios_mpu6000_cfg = {
.exti_cfg = &pios_exti_mpu6000_cfg,
.Fifo_store = PIOS_MPU6000_FIFO_TEMP_OUT | PIOS_MPU6000_FIFO_GYRO_X_OUT | PIOS_MPU6000_FIFO_GYRO_Y_OUT | PIOS_MPU6000_FIFO_GYRO_Z_OUT,
// Clock at 8 khz, downsampled by 8 for 1000 Hz
.Smpl_rate_div_no_dlp = 7,
// Clock at 1 khz, downsampled by 1 for 1000 Hz
.Smpl_rate_div_dlp = 0,
.interrupt_cfg = PIOS_MPU6000_INT_CLR_ANYRD,
.interrupt_en = PIOS_MPU6000_INTEN_DATA_RDY,
.User_ctl = PIOS_MPU6000_USERCTL_DIS_I2C,
.Pwr_mgmt_clk = PIOS_MPU6000_PWRMGMT_PLL_X_CLK,
.accel_range = PIOS_MPU6000_ACCEL_8G,
.gyro_range = PIOS_MPU6000_SCALE_2000_DEG,
.filter = PIOS_MPU6000_LOWPASS_256_HZ,
.orientation = PIOS_MPU6000_TOP_180DEG,
.fast_prescaler = PIOS_SPI_PRESCALER_4,
.std_prescaler = PIOS_SPI_PRESCALER_64,
.max_downsample = 2
};
#endif /* PIOS_INCLUDE_MPU6000 */
/**
* PIOS_Board_Init()
* initializes all the core subsystems on this specific hardware
* called from System/openpilot.c
*/
int32_t init_test;
void PIOS_Board_Init(void)
{
/* Delay system */
PIOS_DELAY_Init();
const struct pios_board_info *bdinfo = &pios_board_info_blob;
#if defined(PIOS_INCLUDE_LED)
const struct pios_gpio_cfg *led_cfg = PIOS_BOARD_HW_DEFS_GetLedCfg(bdinfo->board_rev);
PIOS_Assert(led_cfg);
PIOS_LED_Init(led_cfg);
#endif /* PIOS_INCLUDE_LED */
#ifdef PIOS_INCLUDE_INSTRUMENTATION
PIOS_Instrumentation_Init(PIOS_INSTRUMENTATION_MAX_COUNTERS);
#endif
#if defined(PIOS_INCLUDE_SPI)
/* Set up the SPI interface to the serial flash */
switch (bdinfo->board_rev) {
case BOARD_REVISION_CC:
if (PIOS_SPI_Init(&pios_spi_flash_accel_id, &pios_spi_flash_accel_cfg_cc)) {
PIOS_Assert(0);
}
break;
case BOARD_REVISION_CC3D:
if (PIOS_SPI_Init(&pios_spi_flash_accel_id, &pios_spi_flash_accel_cfg_cc3d)) {
PIOS_Assert(0);
}
break;
default:
PIOS_Assert(0);
}
#endif
uintptr_t flash_id;
switch (bdinfo->board_rev) {
case BOARD_REVISION_CC:
if (PIOS_Flash_Jedec_Init(&flash_id, pios_spi_flash_accel_id, 1)) {
PIOS_DEBUG_Assert(0);
}
if (PIOS_FLASHFS_Logfs_Init(&pios_uavo_settings_fs_id, &flashfs_w25x_cfg, &pios_jedec_flash_driver, flash_id)) {
PIOS_DEBUG_Assert(0);
}
break;
case BOARD_REVISION_CC3D:
if (PIOS_Flash_Jedec_Init(&flash_id, pios_spi_flash_accel_id, 0)) {
PIOS_DEBUG_Assert(0);
}
if (PIOS_FLASHFS_Logfs_Init(&pios_uavo_settings_fs_id, &flashfs_m25p_cfg, &pios_jedec_flash_driver, flash_id)) {
PIOS_DEBUG_Assert(0);
}
break;
default:
PIOS_DEBUG_Assert(0);
}
/* Initialize the task monitor */
if (PIOS_TASK_MONITOR_Initialize(TASKINFO_RUNNING_NUMELEM)) {
PIOS_Assert(0);
}
/* Initialize the delayed callback library */
PIOS_CALLBACKSCHEDULER_Initialize();
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
PIOS_RTC_Init(&pios_rtc_main_cfg);
#endif
PIOS_IAP_Init();
// check for safe mode commands from gcs
if (PIOS_IAP_ReadBootCmd(0) == PIOS_IAP_CLEAR_FLASH_CMD_0 &&
PIOS_IAP_ReadBootCmd(1) == PIOS_IAP_CLEAR_FLASH_CMD_1 &&
PIOS_IAP_ReadBootCmd(2) == PIOS_IAP_CLEAR_FLASH_CMD_2) {
PIOS_FLASHFS_Format(pios_uavo_settings_fs_id);
PIOS_IAP_WriteBootCmd(0, 0);
PIOS_IAP_WriteBootCmd(1, 0);
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */
PIOS_WDG_Init();
#endif
#endif
/* Initialize the alarms library */
AlarmsInitialize();
/* Check for repeated boot failures */
uint16_t boot_count = PIOS_IAP_ReadBootCount();
if (boot_count < 3) {
PIOS_IAP_WriteBootCount(++boot_count);
AlarmsClear(SYSTEMALARMS_ALARM_BOOTFAULT);
} else {
/* Too many failed boot attempts, force hwsettings to defaults */
HwSettingsSetDefaults(HwSettingsHandle(), 0);
AlarmsSet(SYSTEMALARMS_ALARM_BOOTFAULT, SYSTEMALARMS_ALARM_CRITICAL);
}
/* Set up pulse timers */
PIOS_TIM_InitClock(&tim_1_cfg);
PIOS_TIM_InitClock(&tim_2_cfg);
PIOS_TIM_InitClock(&tim_3_cfg);
PIOS_TIM_InitClock(&tim_4_cfg);
#if defined(PIOS_INCLUDE_USB)
/* Initialize board specific USB data */
PIOS_USB_BOARD_DATA_Init();
/* Flags to determine if various USB interfaces are advertised */
bool usb_hid_present = false;
bool usb_cdc_present = false;
#if defined(PIOS_INCLUDE_USB_CDC)
if (PIOS_USB_DESC_HID_CDC_Init()) {
PIOS_Assert(0);
}
usb_hid_present = true;
usb_cdc_present = true;
#else
if (PIOS_USB_DESC_HID_ONLY_Init()) {
PIOS_Assert(0);
}
usb_hid_present = true;
#endif
uint32_t pios_usb_id;
switch (bdinfo->board_rev) {
case BOARD_REVISION_CC:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc);
break;
case BOARD_REVISION_CC3D:
PIOS_USB_Init(&pios_usb_id, &pios_usb_main_cfg_cc3d);
break;
default:
PIOS_Assert(0);
}
#if defined(PIOS_INCLUDE_USB_CDC)
uint8_t hwsettings_usb_vcpport;
/* Configure the USB VCP port */
HwSettingsUSB_VCPPortGet(&hwsettings_usb_vcpport);
if (!usb_cdc_present) {
/* Force VCP port function to disabled if we haven't advertised VCP in our USB descriptor */
hwsettings_usb_vcpport = HWSETTINGS_USB_VCPPORT_DISABLED;
}
switch (hwsettings_usb_vcpport) {
case HWSETTINGS_USB_VCPPORT_DISABLED:
break;
case HWSETTINGS_USB_VCPPORT_USBTELEMETRY:
#if defined(PIOS_INCLUDE_COM)
{
uint32_t pios_usb_cdc_id;
if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_USB_RX_BUF_LEN);
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_USB_TX_BUF_LEN);
PIOS_Assert(rx_buffer);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_telem_usb_id, &pios_usb_cdc_com_driver, pios_usb_cdc_id,
rx_buffer, PIOS_COM_TELEM_USB_RX_BUF_LEN,
tx_buffer, PIOS_COM_TELEM_USB_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_COM */
break;
case HWSETTINGS_USB_VCPPORT_COMBRIDGE:
#if defined(PIOS_INCLUDE_COM)
{
uint32_t pios_usb_cdc_id;
if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_BRIDGE_RX_BUF_LEN);
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_BRIDGE_TX_BUF_LEN);
PIOS_Assert(rx_buffer);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_vcp_id, &pios_usb_cdc_com_driver, pios_usb_cdc_id,
rx_buffer, PIOS_COM_BRIDGE_RX_BUF_LEN,
tx_buffer, PIOS_COM_BRIDGE_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_COM */
break;
case HWSETTINGS_USB_VCPPORT_DEBUGCONSOLE:
#if defined(PIOS_INCLUDE_COM)
#if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
{
uint32_t pios_usb_cdc_id;
if (PIOS_USB_CDC_Init(&pios_usb_cdc_id, &pios_usb_cdc_cfg, pios_usb_id)) {
PIOS_Assert(0);
}
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_debug_id, &pios_usb_cdc_com_driver, pios_usb_cdc_id,
NULL, 0,
tx_buffer, PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
#endif /* PIOS_INCLUDE_COM */
break;
}
#endif /* PIOS_INCLUDE_USB_CDC */
#if defined(PIOS_INCLUDE_USB_HID)
/* Configure the usb HID port */
uint8_t hwsettings_usb_hidport;
HwSettingsUSB_HIDPortGet(&hwsettings_usb_hidport);
if (!usb_hid_present) {
/* Force HID port function to disabled if we haven't advertised HID in our USB descriptor */
hwsettings_usb_hidport = HWSETTINGS_USB_HIDPORT_DISABLED;
}
switch (hwsettings_usb_hidport) {
case HWSETTINGS_USB_HIDPORT_DISABLED:
break;
case HWSETTINGS_USB_HIDPORT_USBTELEMETRY:
#if defined(PIOS_INCLUDE_COM)
{
uint32_t pios_usb_hid_id;
if (PIOS_USB_HID_Init(&pios_usb_hid_id, &pios_usb_hid_cfg, pios_usb_id)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_USB_RX_BUF_LEN);
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_USB_TX_BUF_LEN);
PIOS_Assert(rx_buffer);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_telem_usb_id, &pios_usb_hid_com_driver, pios_usb_hid_id,
rx_buffer, PIOS_COM_TELEM_USB_RX_BUF_LEN,
tx_buffer, PIOS_COM_TELEM_USB_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_COM */
break;
case HWSETTINGS_USB_HIDPORT_RCTRANSMITTER:
#if defined(PIOS_INCLUDE_USB_RCTX)
{
if (PIOS_USB_RCTX_Init(&pios_usb_rctx_id, &pios_usb_rctx_cfg, pios_usb_id)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_USB_RCTX */
break;
}
#endif /* PIOS_INCLUDE_USB_HID */
#endif /* PIOS_INCLUDE_USB */
/* Configure the main IO port */
uint8_t hwsettings_DSMxBind;
HwSettingsDSMxBindGet(&hwsettings_DSMxBind);
uint8_t hwsettings_cc_mainport;
HwSettingsCC_MainPortGet(&hwsettings_cc_mainport);
switch (hwsettings_cc_mainport) {
case HWSETTINGS_CC_MAINPORT_DISABLED:
break;
case HWSETTINGS_CC_MAINPORT_TELEMETRY:
#if defined(PIOS_INCLUDE_TELEMETRY_RF)
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_main_cfg)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_RF_RX_BUF_LEN);
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_RF_TX_BUF_LEN);
PIOS_Assert(rx_buffer);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_telem_rf_id, &pios_usart_com_driver, pios_usart_generic_id,
rx_buffer, PIOS_COM_TELEM_RF_RX_BUF_LEN,
tx_buffer, PIOS_COM_TELEM_RF_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_TELEMETRY_RF */
break;
case HWSETTINGS_CC_MAINPORT_SBUS:
#if defined(PIOS_INCLUDE_SBUS)
{
uint32_t pios_usart_sbus_id;
if (PIOS_USART_Init(&pios_usart_sbus_id, &pios_usart_sbus_main_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_sbus_id;
if (PIOS_SBus_Init(&pios_sbus_id, &pios_sbus_cfg, &pios_usart_com_driver, pios_usart_sbus_id)) {
PIOS_Assert(0);
}
uint32_t pios_sbus_rcvr_id;
if (PIOS_RCVR_Init(&pios_sbus_rcvr_id, &pios_sbus_rcvr_driver, pios_sbus_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_SBUS] = pios_sbus_rcvr_id;
}
#endif /* PIOS_INCLUDE_SBUS */
break;
case HWSETTINGS_CC_MAINPORT_GPS:
#if defined(PIOS_INCLUDE_GPS)
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_main_cfg)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_GPS_RX_BUF_LEN);
PIOS_Assert(rx_buffer);
if (PIOS_COM_Init(&pios_com_gps_id, &pios_usart_com_driver, pios_usart_generic_id,
rx_buffer, PIOS_COM_GPS_RX_BUF_LEN,
NULL, 0)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_GPS */
break;
case HWSETTINGS_CC_MAINPORT_DSM:
#if defined(PIOS_INCLUDE_DSM)
{
uint32_t pios_usart_dsm_id;
if (PIOS_USART_Init(&pios_usart_dsm_id, &pios_usart_dsm_main_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_dsm_id;
if (PIOS_DSM_Init(&pios_dsm_id,
&pios_dsm_main_cfg,
&pios_usart_com_driver,
pios_usart_dsm_id,
0)) {
PIOS_Assert(0);
}
uint32_t pios_dsm_rcvr_id;
if (PIOS_RCVR_Init(&pios_dsm_rcvr_id, &pios_dsm_rcvr_driver, pios_dsm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT] = pios_dsm_rcvr_id;
}
#endif /* PIOS_INCLUDE_DSM */
break;
case HWSETTINGS_CC_MAINPORT_DEBUGCONSOLE:
#if defined(PIOS_INCLUDE_COM)
#if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_main_cfg)) {
PIOS_Assert(0);
}
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_debug_id, &pios_usart_com_driver, pios_usart_generic_id,
NULL, 0,
tx_buffer, PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
#endif /* PIOS_INCLUDE_COM */
break;
case HWSETTINGS_CC_MAINPORT_COMBRIDGE:
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_main_cfg)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_BRIDGE_RX_BUF_LEN);
PIOS_Assert(rx_buffer);
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_BRIDGE_TX_BUF_LEN);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_bridge_id, &pios_usart_com_driver, pios_usart_generic_id,
rx_buffer, PIOS_COM_BRIDGE_RX_BUF_LEN,
tx_buffer, PIOS_COM_BRIDGE_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
break;
case HWSETTINGS_CC_MAINPORT_OSDHK:
{
uint32_t pios_usart_hkosd_id;
if (PIOS_USART_Init(&pios_usart_hkosd_id, &pios_usart_hkosd_main_cfg)) {
PIOS_Assert(0);
}
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_HKOSD_TX_BUF_LEN);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_hkosd_id, &pios_usart_com_driver, pios_usart_hkosd_id,
NULL, 0,
tx_buffer, PIOS_COM_HKOSD_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
break;
}
/* Configure the flexi port */
uint8_t hwsettings_cc_flexiport;
HwSettingsCC_FlexiPortGet(&hwsettings_cc_flexiport);
switch (hwsettings_cc_flexiport) {
case HWSETTINGS_CC_FLEXIPORT_DISABLED:
break;
case HWSETTINGS_CC_FLEXIPORT_TELEMETRY:
#if defined(PIOS_INCLUDE_TELEMETRY_RF)
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_flexi_cfg)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_RF_RX_BUF_LEN);
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_TELEM_RF_TX_BUF_LEN);
PIOS_Assert(rx_buffer);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_telem_rf_id, &pios_usart_com_driver, pios_usart_generic_id,
rx_buffer, PIOS_COM_TELEM_RF_RX_BUF_LEN,
tx_buffer, PIOS_COM_TELEM_RF_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_TELEMETRY_RF */
break;
case HWSETTINGS_CC_FLEXIPORT_COMBRIDGE:
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_flexi_cfg)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_BRIDGE_RX_BUF_LEN);
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_BRIDGE_TX_BUF_LEN);
PIOS_Assert(rx_buffer);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_bridge_id, &pios_usart_com_driver, pios_usart_generic_id,
rx_buffer, PIOS_COM_BRIDGE_RX_BUF_LEN,
tx_buffer, PIOS_COM_BRIDGE_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
break;
case HWSETTINGS_CC_FLEXIPORT_GPS:
#if defined(PIOS_INCLUDE_GPS)
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_flexi_cfg)) {
PIOS_Assert(0);
}
uint8_t *rx_buffer = (uint8_t *)pios_malloc(PIOS_COM_GPS_RX_BUF_LEN);
PIOS_Assert(rx_buffer);
if (PIOS_COM_Init(&pios_com_gps_id, &pios_usart_com_driver, pios_usart_generic_id,
rx_buffer, PIOS_COM_GPS_RX_BUF_LEN,
NULL, 0)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_GPS */
break;
case HWSETTINGS_CC_FLEXIPORT_PPM:
#if defined(PIOS_INCLUDE_PPM_FLEXI)
{
uint32_t pios_ppm_id;
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_flexi_cfg);
uint32_t pios_ppm_rcvr_id;
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PPM] = pios_ppm_rcvr_id;
}
#endif /* PIOS_INCLUDE_PPM_FLEXI */
break;
case HWSETTINGS_CC_FLEXIPORT_DSM:
#if defined(PIOS_INCLUDE_DSM)
{
uint32_t pios_usart_dsm_id;
if (PIOS_USART_Init(&pios_usart_dsm_id, &pios_usart_dsm_flexi_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_dsm_id;
if (PIOS_DSM_Init(&pios_dsm_id,
&pios_dsm_flexi_cfg,
&pios_usart_com_driver,
pios_usart_dsm_id,
hwsettings_DSMxBind)) {
PIOS_Assert(0);
}
uint32_t pios_dsm_rcvr_id;
if (PIOS_RCVR_Init(&pios_dsm_rcvr_id, &pios_dsm_rcvr_driver, pios_dsm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMFLEXIPORT] = pios_dsm_rcvr_id;
}
#endif /* PIOS_INCLUDE_DSM */
break;
case HWSETTINGS_CC_FLEXIPORT_SRXL:
#if defined(PIOS_INCLUDE_SRXL)
{
uint32_t pios_usart_srxl_id;
if (PIOS_USART_Init(&pios_usart_srxl_id, &pios_usart_srxl_flexi_cfg)) {
PIOS_Assert(0);
}
uint32_t pios_srxl_id;
if (PIOS_SRXL_Init(&pios_srxl_id, &pios_usart_com_driver, pios_usart_srxl_id)) {
PIOS_Assert(0);
}
uint32_t pios_srxl_rcvr_id;
if (PIOS_RCVR_Init(&pios_srxl_rcvr_id, &pios_srxl_rcvr_driver, pios_srxl_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_SRXL] = pios_srxl_rcvr_id;
}
#endif /* PIOS_INCLUDE_SRXL */
break;
case HWSETTINGS_CC_FLEXIPORT_DEBUGCONSOLE:
#if defined(PIOS_INCLUDE_COM)
#if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
{
uint32_t pios_usart_generic_id;
if (PIOS_USART_Init(&pios_usart_generic_id, &pios_usart_generic_flexi_cfg)) {
PIOS_Assert(0);
}
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_debug_id, &pios_usart_com_driver, pios_usart_generic_id,
NULL, 0,
tx_buffer, PIOS_COM_DEBUGCONSOLE_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
#endif /* PIOS_INCLUDE_COM */
break;
case HWSETTINGS_CC_FLEXIPORT_I2C:
#if defined(PIOS_INCLUDE_I2C)
{
if (PIOS_I2C_Init(&pios_i2c_flexi_adapter_id, &pios_i2c_flexi_adapter_cfg)) {
PIOS_Assert(0);
}
}
#endif /* PIOS_INCLUDE_I2C */
break;
case HWSETTINGS_CC_FLEXIPORT_OSDHK:
{
uint32_t pios_usart_hkosd_id;
if (PIOS_USART_Init(&pios_usart_hkosd_id, &pios_usart_hkosd_flexi_cfg)) {
PIOS_Assert(0);
}
uint8_t *tx_buffer = (uint8_t *)pios_malloc(PIOS_COM_HKOSD_TX_BUF_LEN);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_hkosd_id, &pios_usart_com_driver, pios_usart_hkosd_id,
NULL, 0,
tx_buffer, PIOS_COM_HKOSD_TX_BUF_LEN)) {
PIOS_Assert(0);
}
}
break;
}
/* Configure the rcvr port */
uint8_t hwsettings_rcvrport;
HwSettingsCC_RcvrPortGet(&hwsettings_rcvrport);
switch ((HwSettingsCC_RcvrPortOptions)hwsettings_rcvrport) {
case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT:
#if defined(PIOS_INCLUDE_HCSR04)
{
uint32_t pios_hcsr04_id;
PIOS_HCSR04_Init(&pios_hcsr04_id, &pios_hcsr04_cfg);
}
#endif
break;
case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT:
#if defined(PIOS_INCLUDE_PWM)
{
uint32_t pios_pwm_id;
PIOS_PWM_Init(&pios_pwm_id, &pios_pwm_cfg);
uint32_t pios_pwm_rcvr_id;
if (PIOS_RCVR_Init(&pios_pwm_rcvr_id, &pios_pwm_rcvr_driver, pios_pwm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PWM] = pios_pwm_rcvr_id;
}
#endif /* PIOS_INCLUDE_PWM */
break;
case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPM_PIN8ONESHOT:
#if defined(PIOS_INCLUDE_PPM)
{
uint32_t pios_ppm_id;
if (hwsettings_rcvrport == HWSETTINGS_CC_RCVRPORT_PPM_PIN8ONESHOT) {
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_pin8_cfg);
} else {
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg);
}
uint32_t pios_ppm_rcvr_id;
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PPM] = pios_ppm_rcvr_id;
}
#endif /* PIOS_INCLUDE_PPM */
break;
case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT:
/* This is a combination of PPM and PWM inputs */
#if defined(PIOS_INCLUDE_PPM)
{
uint32_t pios_ppm_id;
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg);
uint32_t pios_ppm_rcvr_id;
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PPM] = pios_ppm_rcvr_id;
}
#endif /* PIOS_INCLUDE_PPM */
#if defined(PIOS_INCLUDE_PWM)
{
uint32_t pios_pwm_id;
PIOS_PWM_Init(&pios_pwm_id, &pios_pwm_with_ppm_cfg);
uint32_t pios_pwm_rcvr_id;
if (PIOS_RCVR_Init(&pios_pwm_rcvr_id, &pios_pwm_rcvr_driver, pios_pwm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PWM] = pios_pwm_rcvr_id;
}
#endif /* PIOS_INCLUDE_PWM */
break;
case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT:
break;
}
#if defined(PIOS_INCLUDE_GCSRCVR)
GCSReceiverInitialize();
uint32_t pios_gcsrcvr_id;
PIOS_GCSRCVR_Init(&pios_gcsrcvr_id);
uint32_t pios_gcsrcvr_rcvr_id;
if (PIOS_RCVR_Init(&pios_gcsrcvr_rcvr_id, &pios_gcsrcvr_rcvr_driver, pios_gcsrcvr_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_GCS] = pios_gcsrcvr_rcvr_id;
#endif /* PIOS_INCLUDE_GCSRCVR */
/* Remap AFIO pin for PB4 (Servo 5 Out)*/
GPIO_PinRemapConfig(GPIO_Remap_SWJ_NoJTRST, ENABLE);
#ifndef PIOS_ENABLE_DEBUG_PINS
switch ((HwSettingsCC_RcvrPortOptions)hwsettings_rcvrport) {
case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT:
case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPM_PIN8ONESHOT:
PIOS_Servo_Init(&pios_servo_cfg);
break;
case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT:
PIOS_Servo_Init(&pios_servo_rcvr_cfg);
break;
}
#else
PIOS_DEBUG_Init(pios_tim_servoport_all_pins, NELEMENTS(pios_tim_servoport_all_pins));
#endif /* PIOS_ENABLE_DEBUG_PINS */
switch (bdinfo->board_rev) {
case BOARD_REVISION_CC:
// Revision 1 with invensense gyros, start the ADC
#if defined(PIOS_INCLUDE_ADC)
PIOS_ADC_Init(&pios_adc_cfg);
#endif
#if defined(PIOS_INCLUDE_ADXL345)
PIOS_ADXL345_Init(pios_spi_flash_accel_id, 0);
#endif
break;
case BOARD_REVISION_CC3D:
// Revision 2 with MPU6000 gyros, start a SPI interface and connect to it
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
#if defined(PIOS_INCLUDE_MPU6000)
// Set up the SPI interface to the serial flash
if (PIOS_SPI_Init(&pios_spi_gyro_id, &pios_spi_gyro_cfg)) {
PIOS_Assert(0);
}
PIOS_MPU6000_Init(pios_spi_gyro_id, 0, &pios_mpu6000_cfg);
PIOS_MPU6000_CONFIG_Configure();
init_test = !PIOS_MPU6000_Driver.test(0);
#endif /* PIOS_INCLUDE_MPU6000 */
break;
default:
PIOS_Assert(0);
}
/* Make sure we have at least one telemetry link configured or else fail initialization */
PIOS_Assert(pios_com_telem_rf_id || pios_com_telem_usb_id);
// Attach the board config check hook
SANITYCHECK_AttachHook(&CopterControlConfigHook);
// trigger a config check if actuatorsettings are updated
ActuatorSettingsInitialize();
ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb);
}
SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook()
{
// inhibit usage of oneshot for non supported RECEIVER port modes
uint8_t recmode;
HwSettingsCC_RcvrPortGet(&recmode);
uint8_t flexiMode;
uint8_t modes[ACTUATORSETTINGS_BANKMODE_NUMELEM];
ActuatorSettingsBankModeGet(modes);
HwSettingsCC_FlexiPortGet(&flexiMode);
switch ((HwSettingsCC_RcvrPortOptions)recmode) {
// Those modes allows oneshot usage
case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT:
case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPM_PIN8ONESHOT:
if ((recmode == HWSETTINGS_CC_RCVRPORT_PPM_PIN8ONESHOT ||
flexiMode == HWSETTINGS_CC_FLEXIPORT_PPM) &&
(modes[3] == ACTUATORSETTINGS_BANKMODE_PWMSYNC ||
modes[3] == ACTUATORSETTINGS_BANKMODE_ONESHOT125)) {
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;
} else {
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
}
// inhibit oneshot for the following modes
case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT:
case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT:
for (uint8_t i = 0; i < ACTUATORSETTINGS_BANKMODE_NUMELEM; i++) {
if (modes[i] == ACTUATORSETTINGS_BANKMODE_PWMSYNC ||
modes[i] == ACTUATORSETTINGS_BANKMODE_ONESHOT125) {
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;;
}
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
}
}
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;;
}
// trigger a configuration check if ActuatorSettings are changed.
void ActuatorSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{
configuration_check();
}
/**
* @}
*/

View File

@ -0,0 +1,145 @@
/**
******************************************************************************
*
* @file pios_board.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Defines board specific static initializers for hardware for the OpenPilot board.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inc/openpilot.h"
#include <pios_udp_priv.h>
#include <pios_com_priv.h>
#include <uavobjectsinit.h>
/**
* PIOS_Board_Init()
* initializes all the core systems on this specific hardware
* called from System/openpilot.c
*/
void PIOS_Board_Init(void)
{
/* Delay system */
PIOS_DELAY_Init();
/* Initialize the delayed callback library */
PIOS_CALLBACKSCHEDULER_Initialize();
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
/* Initialize the alarms library */
AlarmsInitialize();
/* Initialize the task monitor */
if (PIOS_TASK_MONITOR_Initialize(TASKINFO_RUNNING_NUMELEM)) {
PIOS_Assert(0);
}
/* Initialize the PiOS library */
PIOS_COM_Init();
}
const struct pios_udp_cfg pios_udp0_cfg = {
.ip = "0.0.0.0",
.port = 9000,
};
const struct pios_udp_cfg pios_udp1_cfg = {
.ip = "0.0.0.0",
.port = 9001,
};
const struct pios_udp_cfg pios_udp2_cfg = {
.ip = "0.0.0.0",
.port = 9002,
};
#ifdef PIOS_COM_AUX
/*
* AUX USART
*/
const struct pios_udp_cfg pios_udp3_cfg = {
.ip = "0.0.0.0",
.port = 9003,
};
#endif
/*
* Board specific number of devices.
*/
struct pios_udp_dev pios_udp_devs[] = {
#define PIOS_UDP_TELEM 0
{
.cfg = &pios_udp0_cfg,
},
#define PIOS_UDP_GPS 1
{
.cfg = &pios_udp1_cfg,
},
#define PIOS_UDP_LOCAL 2
{
.cfg = &pios_udp2_cfg,
},
#ifdef PIOS_COM_AUX
#define PIOS_UDP_AUX 3
{
.cfg = &pios_udp3_cfg,
},
#endif
};
uint8_t pios_udp_num_devices = NELEMENTS(pios_udp_devs);
/*
* COM devices
*/
/*
* Board specific number of devices.
*/
extern const struct pios_com_driver pios_serial_com_driver;
extern const struct pios_com_driver pios_udp_com_driver;
struct pios_com_dev pios_com_devs[] = {
{
.id = PIOS_UDP_TELEM,
.driver = &pios_udp_com_driver,
},
{
.id = PIOS_UDP_GPS,
.driver = &pios_udp_com_driver,
},
{
.id = PIOS_UDP_LOCAL,
.driver = &pios_udp_com_driver,
},
#ifdef PIOS_COM_AUX
{
.id = PIOS_UDP_AUX,
.driver = &pios_udp_com_driver,
},
#endif
};
const uint8_t pios_com_num_devices = NELEMENTS(pios_com_devs);
/**
* @}
*/

View File

@ -0,0 +1,287 @@
/**
******************************************************************************
*
* @file pios_board.h
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
*
* @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PIOS_BOARD_H
#define PIOS_BOARD_H
// ------------------------
// Timers and Channels Used
// ------------------------
/*
Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
------+-----------+-----------+-----------+----------
TIM1 | Servo 4 | | |
TIM2 | RC In 5 | RC In 6 | Servo 6 |
TIM3 | Servo 5 | RC In 2 | RC In 3 | RC In 4
TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
------+-----------+-----------+-----------+----------
*/
// ------------------------
// DMA Channels Used
// ------------------------
/* Channel 1 - */
/* Channel 2 - */
/* Channel 3 - */
/* Channel 4 - */
/* Channel 5 - */
/* Channel 6 - */
/* Channel 7 - */
/* Channel 8 - */
/* Channel 9 - */
/* Channel 10 - */
/* Channel 11 - */
/* Channel 12 - */
// ------------------------
// BOOTLOADER_SETTINGS
// ------------------------
#define BOARD_READABLE TRUE
#define BOARD_WRITABLE TRUE
#define MAX_DEL_RETRYS 3
// ------------------------
// WATCHDOG_SETTINGS
// ------------------------
#define PIOS_WATCHDOG_TIMEOUT 250
#define PIOS_WDG_REGISTER BKP_DR4
#define PIOS_WDG_ACTUATOR 0x0001
#define PIOS_WDG_STABILIZATION 0x0002
#define PIOS_WDG_ATTITUDE 0x0004
#define PIOS_WDG_MANUAL 0x0008
#define PIOS_WDG_AUTOTUNE 0x0010
// ------------------------
// TELEMETRY
// ------------------------
#define TELEM_QUEUE_SIZE 10
// ------------------------
// PIOS_LED
// ------------------------
#define PIOS_LED_HEARTBEAT 0
// -------------------------
// System Settings
// -------------------------
#define PIOS_MASTER_CLOCK 72000000
#define PIOS_PERIPHERAL_CLOCK (PIOS_MASTER_CLOCK / 2)
// -------------------------
// Interrupt Priorities
// -------------------------
#define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
#define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
#define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
#define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
// ------------------------
// PIOS_I2C
// See also pios_board.c
// ------------------------
#define PIOS_I2C_MAX_DEVS 1
extern uint32_t pios_i2c_flexi_adapter_id;
#define PIOS_I2C_MAIN_ADAPTER (pios_i2c_flexi_adapter_id)
#define PIOS_I2C_ESC_ADAPTER (pios_i2c_flexi_adapter_id)
#define PIOS_I2C_BMP085_ADAPTER (pios_i2c_flexi_adapter_id)
// ------------------------
// PIOS_BMP085
// ------------------------
#define PIOS_BMP085_OVERSAMPLING 3
// -------------------------
// SPI
//
// See also pios_board.c
// -------------------------
#define PIOS_SPI_MAX_DEVS 2
// -------------------------
// PIOS_USART
// -------------------------
#define PIOS_USART_MAX_DEVS 2
// -------------------------
// PIOS_COM
//
// See also pios_board.c
// -------------------------
#define PIOS_COM_MAX_DEVS 3
extern uint32_t pios_com_telem_rf_id;
#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
#if defined(PIOS_INCLUDE_GPS)
extern uint32_t pios_com_gps_id;
#define PIOS_COM_GPS (pios_com_gps_id)
#endif /* PIOS_INCLUDE_GPS */
extern uint32_t pios_com_bridge_id;
#define PIOS_COM_BRIDGE (pios_com_bridge_id)
extern uint32_t pios_com_vcp_id;
#define PIOS_COM_VCP (pios_com_vcp_id)
extern uint32_t pios_com_telem_usb_id;
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
#if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
extern uint32_t pios_com_debug_id;
#define PIOS_COM_DEBUG (pios_com_debug_id)
#endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
extern uint32_t pios_com_hkosd_id;
#define PIOS_COM_OSDHK (pios_com_hkosd_id)
// -------------------------
// ADC
// PIOS_ADC_PinGet(0) = Gyro Z
// PIOS_ADC_PinGet(1) = Gyro Y
// PIOS_ADC_PinGet(2) = Gyro X
// -------------------------
// #define PIOS_ADC_OVERSAMPLING_RATE 1
#define PIOS_ADC_USE_TEMP_SENSOR 1
#define PIOS_ADC_TEMP_SENSOR_ADC ADC1
#define PIOS_ADC_TEMP_SENSOR_ADC_CHANNEL 1
#define PIOS_ADC_PIN1_GPIO_PORT GPIOA // PA4 (Gyro X)
#define PIOS_ADC_PIN1_GPIO_PIN GPIO_Pin_4 // ADC12_IN4
#define PIOS_ADC_PIN1_GPIO_CHANNEL ADC_Channel_4
#define PIOS_ADC_PIN1_ADC ADC2
#define PIOS_ADC_PIN1_ADC_NUMBER 1
#define PIOS_ADC_PIN2_GPIO_PORT GPIOA // PA5 (Gyro Y)
#define PIOS_ADC_PIN2_GPIO_PIN GPIO_Pin_5 // ADC123_IN5
#define PIOS_ADC_PIN2_GPIO_CHANNEL ADC_Channel_5
#define PIOS_ADC_PIN2_ADC ADC1
#define PIOS_ADC_PIN2_ADC_NUMBER 2
#define PIOS_ADC_PIN3_GPIO_PORT GPIOA // PA3 (Gyro Z)
#define PIOS_ADC_PIN3_GPIO_PIN GPIO_Pin_3 // ADC12_IN3
#define PIOS_ADC_PIN3_GPIO_CHANNEL ADC_Channel_3
#define PIOS_ADC_PIN3_ADC ADC2
#define PIOS_ADC_PIN3_ADC_NUMBER 2
#define PIOS_ADC_NUM_PINS 3
#define PIOS_ADC_PORTS { PIOS_ADC_PIN1_GPIO_PORT, PIOS_ADC_PIN2_GPIO_PORT, PIOS_ADC_PIN3_GPIO_PORT }
#define PIOS_ADC_PINS { PIOS_ADC_PIN1_GPIO_PIN, PIOS_ADC_PIN2_GPIO_PIN, PIOS_ADC_PIN3_GPIO_PIN }
#define PIOS_ADC_CHANNELS { PIOS_ADC_PIN1_GPIO_CHANNEL, PIOS_ADC_PIN2_GPIO_CHANNEL, PIOS_ADC_PIN3_GPIO_CHANNEL }
#define PIOS_ADC_MAPPING { PIOS_ADC_PIN1_ADC, PIOS_ADC_PIN2_ADC, PIOS_ADC_PIN3_ADC }
#define PIOS_ADC_CHANNEL_MAPPING { PIOS_ADC_PIN1_ADC_NUMBER, PIOS_ADC_PIN2_ADC_NUMBER, PIOS_ADC_PIN3_ADC_NUMBER }
#define PIOS_ADC_NUM_CHANNELS (PIOS_ADC_NUM_PINS + PIOS_ADC_USE_TEMP_SENSOR)
#define PIOS_ADC_NUM_ADC_CHANNELS 2
#define PIOS_ADC_USE_ADC2 1
#define PIOS_ADC_CLOCK_FUNCTION RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2, ENABLE)
#define PIOS_ADC_ADCCLK RCC_PCLK2_Div8
/* RCC_PCLK2_Div2: ADC clock = PCLK2/2 */
/* RCC_PCLK2_Div4: ADC clock = PCLK2/4 */
/* RCC_PCLK2_Div6: ADC clock = PCLK2/6 */
/* RCC_PCLK2_Div8: ADC clock = PCLK2/8 */
#define PIOS_ADC_SAMPLE_TIME ADC_SampleTime_239Cycles5
/* Sample time: */
/* With an ADCCLK = 14 MHz and a sampling time of 239.5 cycles: */
/* Tconv = 239.5 + 12.5 = 252 cycles = 18<31>s */
/* (1 / (ADCCLK / CYCLES)) = Sample Time (<28>S) */
#define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_LOW
// Currently analog acquistion hard coded at 480 Hz
// PCKL2 = HCLK / 16
// ADCCLK = PCLK2 / 2
#define PIOS_ADC_RATE (72.0e6f / 1.0f / 8.0f / 252.0f / (PIOS_ADC_NUM_CHANNELS >> PIOS_ADC_USE_ADC2))
#define PIOS_ADC_MAX_OVERSAMPLING 48
#define PIOS_ADC_TEMPERATURE_PIN 0
// ------------------------
// PIOS_RCVR
// See also pios_board.c
// ------------------------
#define PIOS_RCVR_MAX_DEVS 3
#define PIOS_RCVR_MAX_CHANNELS 12
#define PIOS_GCSRCVR_TIMEOUT_MS 100
// -------------------------
// Receiver PPM input
// -------------------------
#define PIOS_PPM_MAX_DEVS 1
#define PIOS_PPM_NUM_INPUTS 12
// -------------------------
// Receiver PWM input
// -------------------------
#define PIOS_PWM_MAX_DEVS 1
#define PIOS_PWM_NUM_INPUTS 6
// -------------------------
// Receiver DSM input
// -------------------------
#define PIOS_DSM_MAX_DEVS 2
#define PIOS_DSM_NUM_INPUTS 12
// -------------------------
// Receiver S.Bus input
// -------------------------
#define PIOS_SBUS_MAX_DEVS 1
#define PIOS_SBUS_NUM_INPUTS (16 + 2)
// -------------------------
// Receiver Multiplex SRXL input
// -------------------------
#define PIOS_SRXL_MAX_DEVS 1
#define PIOS_SRXL_NUM_INPUTS 16
// -------------------------
// Servo outputs
// -------------------------
#define PIOS_SERVO_UPDATE_HZ 50
#define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
#define PIOS_SERVO_BANKS 6
// --------------------------
// Timer controller settings
// --------------------------
#define PIOS_TIM_MAX_DEVS 3
// -------------------------
// GPIO
// -------------------------
#define PIOS_GPIO_PORTS {}
#define PIOS_GPIO_PINS {}
#define PIOS_GPIO_CLKS {}
#define PIOS_GPIO_NUM 0
// -------------------------
// USB
// -------------------------
#define PIOS_USB_HID_MAX_DEVS 1
#define PIOS_USB_ENABLED 1
#define PIOS_USB_DETECT_GPIO_PORT GPIOC
#define PIOS_USB_MAX_DEVS 1
#define PIOS_USB_DETECT_GPIO_PIN GPIO_Pin_15
#endif /* PIOS_BOARD_H */

View File

@ -0,0 +1,102 @@
/**
******************************************************************************
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup PIOS_USB_BOARD Board specific USB definitions
* @brief Board specific USB definitions
* @{
*
* @file pios_usb_board_data.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Board specific USB definitions
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inc/pios_usb_board_data.h" /* struct usb_*, USB_* */
#include <pios_sys.h> /* PIOS_SYS_SerialNumberGet */
#include <pios_usbhook.h> /* PIOS_USBHOOK_* */
#include <pios_usb_util.h> /* PIOS_USB_UTIL_AsciiToUtf8 */
static const uint8_t usb_product_id[28] = {
sizeof(usb_product_id),
USB_DESC_TYPE_STRING,
'C', 0,
'o', 0,
'p', 0,
't', 0,
'e', 0,
'r', 0,
'C', 0,
'o', 0,
'n', 0,
't', 0,
'r', 0,
'o', 0,
'l', 0,
};
static uint8_t usb_serial_number[2 + PIOS_SYS_SERIAL_NUM_ASCII_LEN * 2 + (sizeof(PIOS_USB_BOARD_SN_SUFFIX) - 1) * 2] = {
sizeof(usb_serial_number),
USB_DESC_TYPE_STRING,
};
static const struct usb_string_langid usb_lang_id = {
.bLength = sizeof(usb_lang_id),
.bDescriptorType = USB_DESC_TYPE_STRING,
.bLangID = htousbs(USB_LANGID_ENGLISH_US),
};
static const uint8_t usb_vendor_id[28] = {
sizeof(usb_vendor_id),
USB_DESC_TYPE_STRING,
'o', 0,
'p', 0,
'e', 0,
'n', 0,
'p', 0,
'i', 0,
'l', 0,
'o', 0,
't', 0,
'.', 0,
'o', 0,
'r', 0,
'g', 0
};
int32_t PIOS_USB_BOARD_DATA_Init(void)
{
/* Load device serial number into serial number string */
uint8_t sn[PIOS_SYS_SERIAL_NUM_ASCII_LEN + 1];
PIOS_SYS_SerialNumberGet((char *)sn);
/* Concatenate the device serial number and the appropriate suffix ("+BL" or "+FW") into the USB serial number */
uint8_t *utf8 = &(usb_serial_number[2]);
utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, sn, PIOS_SYS_SERIAL_NUM_ASCII_LEN);
utf8 = PIOS_USB_UTIL_AsciiToUtf8(utf8, (uint8_t *)PIOS_USB_BOARD_SN_SUFFIX, sizeof(PIOS_USB_BOARD_SN_SUFFIX) - 1);
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_PRODUCT, (uint8_t *)&usb_product_id, sizeof(usb_product_id));
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_SERIAL, (uint8_t *)&usb_serial_number, sizeof(usb_serial_number));
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_LANG, (uint8_t *)&usb_lang_id, sizeof(usb_lang_id));
PIOS_USBHOOK_RegisterString(USB_STRING_DESC_VENDOR, (uint8_t *)&usb_vendor_id, sizeof(usb_vendor_id));
return 0;
}

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot
#

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot
#

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot
#

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2014, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
#
# This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
#
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
# Copyright (c) 2012, PhoenixPilot, http://github.com/PhoenixPilot
#

View File

@ -1,7 +1,9 @@
###############################################################################
# @file Makefile
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
# @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
# PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
#
# @addtogroup
# @{
# @addtogroup

View File

@ -1,7 +1,8 @@
###############################################################################
# @file Makefile
# @author PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
# @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
# Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
# PhoenixPilot, http://github.com/PhoenixPilot, Copyright (C) 2012
# @addtogroup
# @{
# @addtogroup

View File

@ -1,4 +1,4 @@
include(openpilotgcs.pri)
include(gcs.pri)
TEMPLATE = aux

View File

@ -118,13 +118,8 @@ isEmpty(GCS_BUILD_TREE) {
# Find the tools directory,
# try from Makefile (not run by Qt Creator),
TOOLS_DIR = $$(TOOLS_DIR)
isEmpty(TOOLS_DIR) {
# check for custom enviroment variable,
TOOLS_DIR = $$(OPENPILOT_TOOLS_DIR)
# fallback to default location.
isEmpty(TOOLS_DIR):TOOLS_DIR = $$clean_path($$ROOT_DIR/tools)
}
isEmpty(TOOLS_DIR):TOOLS_DIR = $$(TOOLS_DIR)
isEmpty(TOOLS_DIR):TOOLS_DIR = $$clean_path($$ROOT_DIR/tools)
# Set the default name of the application
isEmpty(GCS_SMALL_NAME):GCS_SMALL_NAME = gcs
@ -145,6 +140,8 @@ isEmpty(ORG_BIG_NAME) {
ORG_BIG_NAME = "$$ORG_BIG_NAME"
}
isEmpty(GCS_LIBRARY_BASENAME):GCS_LIBRARY_BASENAME = lib
macx {
GCS_APP_TARGET = $$GCS_BIG_NAME
GCS_PATH = $$GCS_BUILD_TREE/$${GCS_APP_TARGET}.app/Contents
@ -160,7 +157,7 @@ macx {
GCS_APP_TARGET = $$GCS_SMALL_NAME
GCS_PATH = $$GCS_BUILD_TREE
GCS_APP_PATH = $$GCS_PATH/bin
GCS_LIBRARY_PATH = $$GCS_PATH/lib/$$GCS_SMALL_NAME
GCS_LIBRARY_PATH = $$GCS_PATH/$$GCS_LIBRARY_BASENAME/$$GCS_SMALL_NAME
GCS_PLUGIN_PATH = $$GCS_LIBRARY_PATH/plugins
GCS_DATA_PATH = $$GCS_PATH/share/$$GCS_SMALL_NAME
GCS_DOC_PATH = $$GCS_PATH/share/doc
@ -205,6 +202,11 @@ DEPENDPATH += \
LIBS += -L$$GCS_LIBRARY_PATH
DEFINES += ORG_BIG_NAME=$$shell_quote(\"$$ORG_BIG_NAME\")
DEFINES += GCS_BIG_NAME=$$shell_quote(\"$$GCS_BIG_NAME\")
DEFINES += ORG_SMALL_NAME=$$shell_quote(\"$$ORG_SMALL_NAME\")
DEFINES += GCS_SMALL_NAME=$$shell_quote(\"$$GCS_SMALL_NAME\")
# DEFINES += QT_NO_CAST_FROM_ASCII
DEFINES += QT_NO_CAST_TO_ASCII
#DEFINES += QT_USE_FAST_OPERATOR_PLUS
@ -243,3 +245,9 @@ macx {
QMAKE_CXXFLAGS_WARN_ON += -Wno-gnu-static-float-init
}
}
# use ccache when available
QMAKE_CC = $$(CCACHE) $$QMAKE_CC
QMAKE_CXX = $$(CCACHE) $$QMAKE_CXX

View File

@ -24,7 +24,7 @@ macx {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
}
include(openpilotgcs.pri)
include(gcs.pri)
TEMPLATE = subdirs
CONFIG += ordered

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>OpenPilot GCS; Copyright OpenPilot</string>
<string>LibrePilot GCS; Copyright LibrePilot</string>
<key>CFBundleIconFile</key>
<string>@ICON@</string>
<key>CFBundlePackageType</key>
@ -13,7 +13,7 @@
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
<string>org.openpilot.openpilotgcs</string>
<string>org.librepilot.gcs</string>
<key>CFBundleVersion</key>
<string>1.3.1</string>
<key>CFBundleShortVersionString</key>

View File

@ -1,4 +1,4 @@
include(../../openpilotgcs.pri)
include(../../gcs.pri)
include(../shared/qtsingleapplication/qtsingleapplication.pri)
TEMPLATE = app
@ -21,16 +21,14 @@ include(../libs/version_info/version_info.pri)
LIBS *= -l$$qtLibraryName(ExtensionSystem) -l$$qtLibraryName(Aggregation)
DEFINES += PLUGIN_REL_PATH=$$shell_quote(\"$$relative_path($$GCS_PLUGIN_PATH, $$GCS_APP_PATH)\")
DEFINES += GCS_NAME=$$shell_quote(\"$$GCS_BIG_NAME\")
DEFINES += ORG_BIG_NAME=$$shell_quote(\"$$ORG_BIG_NAME\")
win32 {
RC_FILE = librepilotgcs.rc
RC_FILE = gcs.rc
target.path = /bin
INSTALLS += target
} else:macx {
LIBS += -framework CoreFoundation
ICON = librepilotgcs.icns
ICON = gcs.icns
QMAKE_INFO_PLIST = Info.plist
FILETYPES.files = profile.icns prifile.icns
FILETYPES.path = Contents/Resources
@ -53,7 +51,7 @@ win32 {
}
}
OTHER_FILES += librepilotgcs.rc
OTHER_FILES += gcs.rc
RESOURCES += \
appresources.qrc

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "gcs.ico"

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file gcssplashscreen.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup [Group]
* @{
* @addtogroup GCSSplashScreen
@ -28,6 +29,7 @@
#include "gcssplashscreen.h"
#include "version_info/version_info.h"
#include <QDebug>
#include <QApplication>
const QChar CopyrightSymbol(0x00a9);
@ -44,7 +46,7 @@ GCSSplashScreen::GCSSplashScreen() :
m_painter->drawText(405, 170, QString(CopyrightSymbol) +
QString(" ") + VersionInfo::year() +
QString(tr(" The LibrePilot Project - All Rights Reserved")));
QString(tr(" The %1 Project - All Rights Reserved").arg(ORG_BIG_NAME)));
m_painter->drawText(405, 182, QString(CopyrightSymbol) +
QString(tr(" 2010-2015 The OpenPilot Project - All Rights Reserved")));
@ -74,4 +76,5 @@ void GCSSplashScreen::showPluginLoadingProgress(ExtensionSystem::PluginSpec *plu
QString message(tr("Loading ") + pluginSpec->name() + " plugin...");
drawMessageText(message);
qApp->processEvents();
}

View File

@ -1 +0,0 @@
IDI_ICON1 ICON DISCARDABLE "librepilotgcs.ico"

View File

@ -29,7 +29,7 @@
/*
The GCS application name is defined in the top level makefile - GCS_BIG_NAME / GCS_SMALL_NAME, and
set for the build in ../../openpilotgcs.pri and ./app.pro
set for the build in ../../gcs.pri and ./app.pro
The GCS locale is set to the system locale by default unless the "hidden" setting General/Locale has a value.
The user can not change General/Locale from the Options dialog.
@ -116,7 +116,7 @@ typedef QMap<QString, QString> AppOptionValues;
const int OptionIndent = 4;
const int DescriptionIndent = 24;
const QLatin1String APP_NAME(GCS_NAME);
const QLatin1String APP_NAME(GCS_BIG_NAME);
const QLatin1String ORG_NAME(ORG_BIG_NAME);
const QLatin1String CORE_PLUGIN_NAME("Core");
@ -433,7 +433,7 @@ void loadTranslators(QString language, QTranslator &translator, QTranslator &qtT
{
const QString &creatorTrPath = Utils::GetDataPath() + QLatin1String("translations");
if (translator.load(QLatin1String("openpilotgcs_") + language, creatorTrPath)) {
if (translator.load(QLatin1String("gcs_") + language, creatorTrPath)) {
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString &qtTrFile = QLatin1String("qt_") + language;
// Binary installer puts Qt tr files into creatorTrPath
@ -606,7 +606,7 @@ int main(int argc, char * *argv)
}
if (!errors.isEmpty()) {
QMessageBox::warning(0,
QCoreApplication::translate("Application", "OpenPilot GCS - Plugin loader messages"),
QCoreApplication::translate("Application", "%1 - Plugin loader messages").arg(GCS_BIG_NAME),
errors.join(QString::fromLatin1("\n\n")));
}
}

Binary file not shown.

View File

@ -1,4 +1,4 @@
include(../openpilotgcs.pri)
include(../gcs.pri)
win32 {
DLLDESTDIR = $$GCS_APP_PATH
@ -19,10 +19,9 @@ macx {
} else {
QMAKE_RPATHDIR = $$shell_quote(\$$ORIGIN)
QMAKE_RPATHDIR += $$shell_quote(\$$ORIGIN/$$relative_path($$GCS_QT_LIBRARY_PATH, $$GCS_LIBRARY_PATH))
QMAKE_RPATHDIR += $$shell_quote(\$$ORIGIN/$$relative_path($$GCS_LIBRARY_PATH/osg, $$GCS_LIBRARY_PATH))
include(rpath.pri)
target.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs
target.path = /$$GCS_LIBRARY_BASENAME/gcs
}
INSTALLS += target
}

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
TARGET = Aggregation
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
DEFINES += AGGREGATION_LIBRARY

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
TARGET = ExtensionSystem
DEFINES += EXTENSIONSYSTEM_LIBRARY
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
include(extensionsystem_dependencies.pri)
unix:!macx:!freebsd*:LIBS += -ldl

View File

@ -3,7 +3,7 @@ TARGET = GLC_lib
#VERSION = 2.2.0
DEFINES += GLC_LIB_LIBRARY
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
QT += core opengl

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
TARGET = opmapwidget
DEFINES += OPMAPWIDGET_LIBRARY
include(../../../../openpilotgcslibrary.pri)
include(../../../../library.pri)
# DESTDIR = ../build
SOURCES += mapgraphicitem.cpp \

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
TARGET = QScienceSpinBox
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
QT += widgets

View File

@ -2,7 +2,7 @@ TEMPLATE = lib
TARGET = QtConcurrent
DEFINES += BUILD_QTCONCURRENT
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
HEADERS += \
qtconcurrent_global.h \

View File

@ -33,7 +33,7 @@ DEFINES += QWT_LIBRARY
# defined. Otherwise the debug version of the library
# will not have the 'd' suffix it needs.
#
include(../../../openpilotgcslibrary.pri)
include(../../../library.pri)
# disable all warnings (no need for warnings as qwt sources are imported)
CONFIG += warn_off

View File

@ -22,7 +22,7 @@ TEMPLATE = lib
TARGET = sdlgamepad
DEFINES += SDLGAMEPAD_LIBRARY
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
macx {
# Ensures that SDL framework and header files are found when compiled with Qt5.2.1

View File

@ -5,7 +5,7 @@ QT += network xml svg opengl gui widgets qml quick quickwidgets
DEFINES += QTCREATOR_UTILS_LIB
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
DEFINES += DATA_REL_PATH=$$shell_quote(\"$$relative_path($$GCS_DATA_PATH, $$GCS_APP_PATH)\")
DEFINES += LIB_REL_PATH=$$shell_quote(\"$$relative_path($$GCS_LIBRARY_PATH, $$GCS_PATH)\")

View File

@ -36,6 +36,7 @@
#include <QSettings>
#include <QDomElement>
#include <QObject>
#include <QDataStream>
class XMLCONFIG_EXPORT XmlConfig : QObject {
Q_OBJECT

View File

@ -1,7 +1,8 @@
/**
******************************************************************************
* @file version_info.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013.
* @addtogroup VersionInfo
* @{
* @brief This file includes autogenerated version info data file.
@ -24,4 +25,4 @@
*/
#include "version_info.h"
#include "../../../../build/openpilotgcs-synthetics/version_info.cpp"
#include "../../../../build/gcs-synthetics/version_info.cpp"

View File

@ -1,11 +1,12 @@
/**
******************************************************************************
* @file version_info.cpp.template
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013.
* @addtogroup VersionInfo
* @{
* @brief The template file used to generate the real source file called
* build/openpilotgcs-synthetics/version_info.cpp
* build/gcs-synthetics/version_info.cpp
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
TARGET = VersionInfo
include(../../openpilotgcslibrary.pri)
include(../../library.pri)
include(../../python.pri)
HEADERS = version_info.h
@ -17,7 +17,7 @@ SOURCES = version_info.cpp
# Since debug_and_release option is set, we need this
!debug_and_release|build_pass {
# Define other variables
VERSION_INFO_DIR = $$GCS_BUILD_TREE/../openpilotgcs-synthetics
VERSION_INFO_DIR = $$GCS_BUILD_TREE/../gcs-synthetics
VERSION_INFO_SCRIPT = $$ROOT_DIR/make/scripts/version-info.py
VERSION_INFO_COMMAND = $$PYTHON \"$$VERSION_INFO_SCRIPT\"
VERSION_INFO_TEMPLATE = $$GCS_SOURCE_TREE/src/libs/version_info/version_info.cpp.template

View File

@ -1,8 +1,6 @@
include(../openpilotgcs.pri)
include(../gcs.pri)
isEmpty(PROVIDER) {
PROVIDER = OpenPilot
}
isEmpty(PROVIDER):PROVIDER = "$$ORG_BIG_NAME"
DESTDIR = $$GCS_PLUGIN_PATH/$$PROVIDER
LIBS += -L$$DESTDIR
@ -33,7 +31,6 @@ macx {
QMAKE_RPATHDIR = $$shell_quote(\$$ORIGIN)
QMAKE_RPATHDIR += $$shell_quote(\$$ORIGIN/$$relative_path($$GCS_LIBRARY_PATH, $$DESTDIR))
QMAKE_RPATHDIR += $$shell_quote(\$$ORIGIN/$$relative_path($$GCS_QT_LIBRARY_PATH, $$DESTDIR))
QMAKE_RPATHDIR += $$shell_quote(\$$ORIGIN/$$relative_path($$GCS_LIBRARY_PATH/osg, $$DESTDIR))
include(rpath.pri)
}
@ -43,8 +40,8 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hGCS_symbols
CONFIG += plugin plugin_with_soname
!macx {
target.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs/plugins/$$PROVIDER
target.path = /$$GCS_LIBRARY_BASENAME/gcs/plugins/$$PROVIDER
pluginspec.files += $${TARGET}.pluginspec
pluginspec.path = /$$GCS_LIBRARY_BASENAME/openpilotgcs/plugins/$$PROVIDER
pluginspec.path = /$$GCS_LIBRARY_BASENAME/gcs/plugins/$$PROVIDER
INSTALLS += target pluginspec
}

View File

@ -1,7 +1,7 @@
TEMPLATE = lib
TARGET = AntennaTrack
QT += serialport
include(../../openpilotgcsplugin.pri)
include(../../plugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(antennatrack_dependencies.pri)
include(../../libs/qwt/qwt.pri)

View File

@ -1050,7 +1050,7 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>200</width>
<width>220</width>
<height>0</height>
</size>
</property>
@ -1098,13 +1098,13 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>85</width>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>25</height>
</size>
</property>
@ -1120,13 +1120,13 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>85</width>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>25</height>
</size>
</property>
@ -1195,7 +1195,7 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>200</width>
<width>220</width>
<height>0</height>
</size>
</property>
@ -1265,13 +1265,13 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>85</width>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>25</height>
</size>
</property>
@ -1287,13 +1287,13 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>85</width>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>25</height>
</size>
</property>
@ -1312,13 +1312,13 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>85</width>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>25</height>
</size>
</property>
@ -1359,13 +1359,13 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>85</width>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>16777215</height>
</size>
</property>
@ -1426,13 +1426,13 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>85</width>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<width>120</width>
<height>25</height>
</size>
</property>
@ -1504,7 +1504,7 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>200</width>
<width>220</width>
<height>0</height>
</size>
</property>
@ -1844,7 +1844,7 @@ margin:1px;
</property>
<property name="minimumSize">
<size>
<width>200</width>
<width>220</width>
<height>0</height>
</size>
</property>

View File

@ -222,7 +222,7 @@ margin:1px;</string>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<width>65</width>
<height>0</height>
</size>
</property>
@ -290,7 +290,7 @@ margin:1px;</string>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<width>65</width>
<height>0</height>
</size>
</property>
@ -326,6 +326,77 @@ margin:1px;</string>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="elevonLabel3">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string> Roll Diff</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="elevonSlider3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Value of Roll differential in percent</string>
</property>
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="elevonSliderLabel3">
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
@ -735,5 +806,21 @@ margin:1px;</string>
</hint>
</hints>
</connection>
<connection>
<sender>elevonSlider3</sender>
<signal>valueChanged(int)</signal>
<receiver>elevonSliderLabel3</receiver>
<slot>setNum(int)</slot>
<hints>
<hint type="sourcelabel">
<x>511</x>
<y>222</y>
</hint>
<hint type="destinationlabel">
<x>511</x>
<y>378</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,658 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CC_HW_Widget</class>
<widget class="QWidget" name="CC_HW_Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>646</width>
<height>596</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>HW settings</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>624</width>
<height>510</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<item row="6" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="title">
<string>Messages</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="problems">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Changes on this page only take effect after board reset or power cycle</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QComboBox" name="telemetrySpeed">
<property name="toolTip">
<string>Select the speed here.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="GpsSpeedLabel">
<property name="minimumSize">
<size>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>GPS speed:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="telemetrySpeedLabel">
<property name="text">
<string>Telemetry speed:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comUsbBridgeSpeed">
<property name="toolTip">
<string>Select the speed here.</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="gpsSpeed">
<property name="toolTip">
<string>Select the speed here.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="ComUsbBridgeSpeedLabel">
<property name="minimumSize">
<size>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>ComUsbBridge speed:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="GpsProtocolLabel">
<property name="text">
<string>GPS protocol :</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="gpsProtocol"/>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0">
<item row="4" column="0">
<widget class="QComboBox" name="cbFlexi"/>
</item>
<item row="6" column="0">
<widget class="QComboBox" name="cbTele"/>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_8">
<property name="text">
<string>USB HID Port</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>USB VCP Port</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="3" column="1" rowspan="5" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Main Port</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Flexi Port</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QComboBox" name="cbUsbHid"/>
</item>
<item row="4" column="4">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="3">
<widget class="QComboBox" name="cbUsbVcp"/>
</item>
<item row="2" column="1" colspan="2" alignment="Qt::AlignLeft">
<widget class="QComboBox" name="cbRcvr"/>
</item>
<item row="1" column="1" colspan="2" alignment="Qt::AlignLeft">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Receiver Port</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>4</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>369</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cchwHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>Takes you to the wiki page</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/core/images/helpicon.svg</normaloff>:/core/images/helpicon.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="saveTelemetryToRAM">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="toolTip">
<string>Send to board but don't write in SD.
Beware of not locking yourself out!</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Apply</string>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="saveTelemetryToSD">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Applies and Saves all settings to SD.
Beware of not locking yourself out!</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,597 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ccattitude</class>
<widget class="QWidget" name="ccattitude">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>780</width>
<height>566</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="Attitude">
<attribute name="title">
<string>Attitude</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>758</width>
<height>486</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Rotate virtual attitude relative to board</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0,1,0,1,0">
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
margin:1px;
font:bold;</string>
</property>
<property name="text">
<string>Roll</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="rollBias">
<property name="minimum">
<number>-180</number>
</property>
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="5">
<widget class="QSpinBox" name="yawBias">
<property name="minimum">
<number>-180</number>
</property>
<property name="maximum">
<number>180</number>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="label_4">
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
margin:1px;
font:bold;</string>
</property>
<property name="text">
<string>Yaw</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_3">
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
margin:1px;
font:bold;</string>
</property>
<property name="text">
<string>Pitch</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="pitchBias">
<property name="minimum">
<number>-90</number>
</property>
<property name="maximum">
<number>90</number>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="6">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Calibration</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Place aircraft very flat, and then click level to compute the accelerometer and gyro bias</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="zeroBias">
<property name="maximumSize">
<size>
<width>500</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Launch horizontal calibration.</string>
</property>
<property name="text">
<string>Level</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QProgressBar" name="zeroBiasProgress">
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="zeroGyroBiasOnArming">
<property name="toolTip">
<string>If enabled, a fast recalibration of gyro zero point will be done
whenever the frame is armed. Do not move the airframe while
arming it in that case!</string>
</property>
<property name="text">
<string>Zero gyros while arming aircraft</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Filtering</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Accelerometers</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="accelTauSpinbox">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Accelerometer filtering.
Sets the amount of lowpass filtering of accelerometer data
for the attitude estimation. Higher values apply a stronger
filter, which may help with drifting in attitude mode.
Range: 0.00 - 0.20, Good starting value: 0.05 - 0.10
Start low and raise until drift stops.
A setting of 0.00 disables the filter.</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>0.200000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>4</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>380</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ccAttitudeHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>Takes you to the wiki page</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/core/images/helpicon.svg</normaloff>:/core/images/helpicon.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="applyButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="saveButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Click to permanently save the accel bias in the CopterControl Flash.</string>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file configccpmwidget.cpp
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
@ -254,7 +255,7 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) :
connect(m_aircraft->ccpmCollectivespinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateMixer()));
connect(m_aircraft->ccpmType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
connect(m_aircraft->ccpmSingleServo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
connect(m_aircraft->TabObject, SIGNAL(currentChanged(QWidget *)), this, SLOT(UpdateType()));
connect(m_aircraft->TabObject, SIGNAL(currentChanged(int)), this, SLOT(UpdateType()));
connect(m_aircraft->SwashLvlStartButton, SIGNAL(clicked()), this, SLOT(SwashLvlStartButtonPressed()));
connect(m_aircraft->SwashLvlNextButton, SIGNAL(clicked()), this, SLOT(SwashLvlNextButtonPressed()));
@ -384,49 +385,21 @@ QString ConfigCcpmWidget::updateConfigObjectsFromWidgets()
void ConfigCcpmWidget::UpdateType()
{
int TypeInt, SingleServoIndex, NumServosDefined;
int SingleServoIndex, NumServosDefined;
double AdjustmentAngle = 0;
SetUIComponentVisibilities();
TypeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
TypeText = m_aircraft->ccpmType->currentText();
typeText = m_aircraft->ccpmType->currentText();
SingleServoIndex = m_aircraft->ccpmSingleServo->currentIndex();
// set visibility of user settings (When Custom)
m_aircraft->ccpmAdvancedSettingsTable->setEnabled(TypeInt == 0);
// Clear advanced settings table if not Custom selected (Keep previous settings)
if (TypeText.compare(QString::fromUtf8("Custom - Advanced Settings"), Qt::CaseInsensitive) != 0) {
m_aircraft->ccpmAdvancedSettingsTable->clearFocus();
}
m_aircraft->ccpmAngleW->setEnabled(TypeInt == 1);
m_aircraft->ccpmAngleX->setEnabled(TypeInt == 1);
m_aircraft->ccpmAngleY->setEnabled(TypeInt == 1);
m_aircraft->ccpmAngleZ->setEnabled(TypeInt == 1);
m_aircraft->ccpmCorrectionAngle->setEnabled(TypeInt != 0);
m_aircraft->ccpmServoWChannel->setEnabled(TypeInt > 0);
m_aircraft->ccpmServoXChannel->setEnabled(TypeInt > 0);
m_aircraft->ccpmServoYChannel->setEnabled(TypeInt > 0);
m_aircraft->ccpmServoZChannel->setEnabled(TypeInt > 0);
m_aircraft->ccpmSingleServo->setEnabled(TypeInt > 1);
m_aircraft->ccpmEngineChannel->setEnabled(TypeInt > 0);
m_aircraft->ccpmTailChannel->setEnabled(TypeInt > 0);
m_aircraft->ccpmCollectiveSlider->setEnabled(TypeInt > 0);
m_aircraft->ccpmCollectivespinBox->setEnabled(TypeInt > 0);
m_aircraft->ccpmRevoSlider->setEnabled(TypeInt > 0);
m_aircraft->ccpmREVOspinBox->setEnabled(TypeInt > 0);
AdjustmentAngle = SingleServoIndex * 90;
AdjustmentAngle = SingleServoIndex * 90;
m_aircraft->PitchCurve->setVisible(1);
NumServosDefined = 4;
// set values for pre defined heli types
if (TypeText.compare(QString::fromUtf8("CCPM 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare(QString::fromUtf8("CCPM 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(0);
@ -438,7 +411,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoYChannel->setEnabled(0);
m_aircraft->ccpmServoZChannel->setEnabled(0);
NumServosDefined = 2;
} else if (TypeText.compare(QString::fromUtf8("CCPM 3 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare(QString::fromUtf8("CCPM 3 Servo 90º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 180, 360));
@ -447,7 +420,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoZChannel->setCurrentIndex(0);
m_aircraft->ccpmServoZChannel->setEnabled(0);
NumServosDefined = 3;
} else if (TypeText.compare(QString::fromUtf8("CCPM 4 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare(QString::fromUtf8("CCPM 4 Servo 90º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 180, 360));
@ -455,7 +428,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmSingleServo->setEnabled(0);
m_aircraft->ccpmSingleServo->setCurrentIndex(0);
NumServosDefined = 4;
} else if (TypeText.compare(QString::fromUtf8("CCPM 3 Servo 120º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare(QString::fromUtf8("CCPM 3 Servo 120º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 120, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 240, 360));
@ -464,7 +437,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoZChannel->setCurrentIndex(0);
m_aircraft->ccpmServoZChannel->setEnabled(0);
NumServosDefined = 3;
} else if (TypeText.compare(QString::fromUtf8("CCPM 3 Servo 140º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare(QString::fromUtf8("CCPM 3 Servo 140º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 140, 360));
m_aircraft->ccpmAngleY->setValue(fmod(AdjustmentAngle + 220, 360));
@ -473,7 +446,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmServoZChannel->setCurrentIndex(0);
m_aircraft->ccpmServoZChannel->setEnabled(0);
NumServosDefined = 3;
} else if (TypeText.compare(QString::fromUtf8("FP 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare(QString::fromUtf8("FP 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(0);
@ -491,7 +464,7 @@ void ConfigCcpmWidget::UpdateType()
m_aircraft->ccpmCollectiveSlider->setValue(0);
m_aircraft->PitchCurve->setVisible(0);
NumServosDefined = 2;
} else if (TypeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
} else if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmAngleW->setValue(AdjustmentAngle + 0);
m_aircraft->ccpmAngleX->setValue(fmod(AdjustmentAngle + 90, 360));
m_aircraft->ccpmAngleY->setValue(0);
@ -512,7 +485,7 @@ void ConfigCcpmWidget::UpdateType()
}
// Set the text of the motor boxes
if (TypeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
m_aircraft->ccpmEngineLabel->setText("CW motor");
m_aircraft->ccpmTailLabel->setText("CCW motor");
} else {
@ -671,9 +644,14 @@ void ConfigCcpmWidget::UpdateMixer()
float ThisAngle[6];
QString Channel;
if (throwConfigError(QString("HeliCP"))) {
int typeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
// Exit if currently updatingToHardware or ConfigError
// Avoid mixer changes if something wrong in config
if (throwConfigError(typeInt) || updatingToHardware) {
return;
}
GUIConfigDataUnion config = getConfigData();
useCCPM = !(config.heli.ccpmCollectivePassthroughState || !config.heli.ccpmLinkCyclicState);
@ -694,16 +672,18 @@ void ConfigCcpmWidget::UpdateMixer()
;
}
}
int TypeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
if (TypeInt != 0) { // not advanced settings
// get the channel data from the ui
MixerChannelData[0] = m_aircraft->ccpmEngineChannel->currentIndex();
MixerChannelData[1] = m_aircraft->ccpmTailChannel->currentIndex();
MixerChannelData[2] = m_aircraft->ccpmServoWChannel->currentIndex();
MixerChannelData[3] = m_aircraft->ccpmServoXChannel->currentIndex();
MixerChannelData[4] = m_aircraft->ccpmServoYChannel->currentIndex();
MixerChannelData[5] = m_aircraft->ccpmServoZChannel->currentIndex();
// get the channel data from the ui
MixerChannelData[0] = m_aircraft->ccpmEngineChannel->currentIndex();
MixerChannelData[1] = m_aircraft->ccpmTailChannel->currentIndex();
MixerChannelData[2] = m_aircraft->ccpmServoWChannel->currentIndex();
MixerChannelData[3] = m_aircraft->ccpmServoXChannel->currentIndex();
MixerChannelData[4] = m_aircraft->ccpmServoYChannel->currentIndex();
MixerChannelData[5] = m_aircraft->ccpmServoZChannel->currentIndex();
QTableWidget *table = m_aircraft->ccpmAdvancedSettingsTable;
if (typeInt != 0) { // not advanced settings
// get the angle data from the ui
ThisAngle[2] = m_aircraft->ccpmAngleW->value();
ThisAngle[3] = m_aircraft->ccpmAngleX->value();
@ -722,11 +702,9 @@ void ConfigCcpmWidget::UpdateMixer()
ServosText[3]->setPlainText(QString("%1").arg(MixerChannelData[5]));
// go through the user data and update the mixer matrix
QTableWidget *table = m_aircraft->ccpmAdvancedSettingsTable;
for (int i = 0; i < 6; i++) {
if ((MixerChannelData[i] > 0) && ((ThisEnable[i]) || (i < 2))) {
if (((MixerChannelData[i] > 0) && ThisEnable[i]) || (i < 2)) {
table->item(i, 0)->setText(QString("%1").arg(MixerChannelData[i]));
// Generate the mixer vector
if (i == 0) { // main motor-engine
table->item(i, 1)->setText(QString("%1").arg(127)); // ThrottleCurve1
@ -734,7 +712,7 @@ void ConfigCcpmWidget::UpdateMixer()
table->item(i, 3)->setText(QString("%1").arg(0)); // Roll
table->item(i, 4)->setText(QString("%1").arg(0)); // Pitch
if (TypeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
// Yaw
table->item(i, 5)->setText(QString("%1").arg(-127));
} else {
@ -744,7 +722,7 @@ void ConfigCcpmWidget::UpdateMixer()
}
if (i == 1) {
// tailrotor --or-- counter-clockwise motor
if (TypeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
// ThrottleCurve1
table->item(i, 1)->setText(QString("%1").arg(127));
// Yaw
@ -787,14 +765,34 @@ void ConfigCcpmWidget::UpdateMixer()
}
} else {
// advanced settings
QTableWidget *table = m_aircraft->ccpmAdvancedSettingsTable;
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
// Populate custom mixer table from board values
for (int i = 0; i < 6; i++) {
Channel = table->item(i, 0)->text();
if (Channel == "-") {
Channel = QString((int)ConfigCcpmWidget::CHANNEL_NUMELEM + 1);
if (MixerChannelData[i] > 0) {
// Channel number
table->item(i, 0)->setText(QString("%1").arg(MixerChannelData[i]));
// Throttle1
table->item(i, 1)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
VehicleConfig::MIXERVECTOR_THROTTLECURVE1)));
// Throttle2
table->item(i, 2)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
VehicleConfig::MIXERVECTOR_THROTTLECURVE2)));
// Roll
table->item(i, 3)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
VehicleConfig::MIXERVECTOR_ROLL)));
// Pitch
table->item(i, 4)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
VehicleConfig::MIXERVECTOR_PITCH)));
// Yaw
table->item(i, 5)->setText(QString("%1").arg(getMixerVectorValue(mixer, MixerChannelData[i] - 1,
VehicleConfig::MIXERVECTOR_YAW)));
} else {
for (int j = 0; j < 6; j++) {
table->item(i, j)->setText(QString("-"));
}
}
MixerChannelData[i] = Channel.toInt();
}
}
}
@ -893,6 +891,31 @@ void ConfigCcpmWidget::SetUIComponentVisibilities()
m_aircraft->SwashLvlStepList->item(1)->setBackground(Qt::transparent);
m_aircraft->SwashLvlStepList->item(2)->setBackground(Qt::transparent);
m_aircraft->SwashLvlStepList->item(3)->setBackground(Qt::transparent);
// Enable / disable by typeInt : 0 is custom
int typeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
// set visibility of user settings (When Custom)
m_aircraft->ccpmAdvancedSettingsTable->setEnabled(typeInt == 0);
m_aircraft->ccpmAngleW->setEnabled(typeInt == 1);
m_aircraft->ccpmAngleX->setEnabled(typeInt == 1);
m_aircraft->ccpmAngleY->setEnabled(typeInt == 1);
m_aircraft->ccpmAngleZ->setEnabled(typeInt == 1);
m_aircraft->ccpmCorrectionAngle->setEnabled(typeInt != 0);
m_aircraft->ccpmServoWChannel->setEnabled(typeInt > 0);
m_aircraft->ccpmServoXChannel->setEnabled(typeInt > 0);
m_aircraft->ccpmServoYChannel->setEnabled(typeInt > 0);
m_aircraft->ccpmServoZChannel->setEnabled(typeInt > 0);
m_aircraft->ccpmSingleServo->setEnabled(typeInt > 1);
m_aircraft->ccpmEngineChannel->setEnabled(typeInt > 0);
m_aircraft->ccpmTailChannel->setEnabled(typeInt > 0);
m_aircraft->ccpmCollectiveSlider->setEnabled(typeInt > 0);
m_aircraft->ccpmCollectivespinBox->setEnabled(typeInt > 0);
m_aircraft->ccpmRevoSlider->setEnabled(typeInt > 0);
m_aircraft->ccpmREVOspinBox->setEnabled(typeInt > 0);
}
/**
@ -942,6 +965,14 @@ void ConfigCcpmWidget::setMixer()
{
int i, j;
int typeInt = m_aircraft->ccpmType->count() - m_aircraft->ccpmType->currentIndex() - 1;
// Exit if currently updatingToHardware or ConfigError
// Avoid mixer changes if something wrong in config
if (throwConfigError(typeInt) || updatingToHardware) {
return;
}
if (SwashLvlConfigurationInProgress) {
return;
}
@ -986,15 +1017,16 @@ void ConfigCcpmWidget::setMixer()
&mixerSettingsData.Mixer12Type
};
// reset all to Disabled
for (i = 0; i < 8; i++) {
// reset all outputs to Disabled
for (i = 0; i < (int)ConfigCcpmWidget::CHANNEL_NUMELEM; i++) {
*mixerTypes[i] = 0;
}
// go through the user data and update the mixer matrix
for (i = 0; i < 6; i++) {
if ((MixerChannelData[i] > 0) && (MixerChannelData[i] < (int)ConfigCcpmWidget::CHANNEL_NUMELEM + 1)) {
// Set the mixer type. If Coax, then first two are motors. Otherwise, only first is motor
if (TypeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
if (typeText.compare(QString::fromUtf8("Coax 2 Servo 90º"), Qt::CaseInsensitive) == 0) {
*(mixerTypes[MixerChannelData[i] - 1]) = i > 1 ?
MixerSettings::MIXER1TYPE_SERVO :
MixerSettings::MIXER1TYPE_MOTOR;
@ -1560,52 +1592,44 @@ void ConfigCcpmWidget::SwashLvlSpinBoxChanged(int value)
/**
This function displays text and color formatting in order to help the user understand what channels have not yet been configured.
*/
bool ConfigCcpmWidget::throwConfigError(QString airframeType)
bool ConfigCcpmWidget::throwConfigError(int typeInt)
{
Q_UNUSED(airframeType);
bool error = false;
if ((m_aircraft->ccpmServoWChannel->currentIndex() == 0) && (m_aircraft->ccpmServoWChannel->isVisible())) {
m_aircraft->ccpmServoWLabel->setText("<font color=red>" + m_aircraft->ccpmServoWLabel->text() + "</font>");
error = true;
} else {
m_aircraft->ccpmServoWLabel->setText(QTextEdit(m_aircraft->ccpmServoWLabel->text()).toPlainText());
// Custom no need check, always return no error
if (typeInt == 0) {
return false;
}
if ((m_aircraft->ccpmServoXChannel->currentIndex() == 0) && (m_aircraft->ccpmServoXChannel->isVisible())) {
m_aircraft->ccpmServoXLabel->setText("<font color=red>" + m_aircraft->ccpmServoXLabel->text() + "</font>");
error = true;
} else {
m_aircraft->ccpmServoXLabel->setText(QTextEdit(m_aircraft->ccpmServoXLabel->text()).toPlainText());
}
QList<QComboBox *> comboChannelsName;
comboChannelsName << m_aircraft->ccpmEngineChannel << m_aircraft->ccpmTailChannel << m_aircraft->ccpmServoWChannel
<< m_aircraft->ccpmServoXChannel << m_aircraft->ccpmServoYChannel << m_aircraft->ccpmServoZChannel;
QString channelNames = "";
if ((m_aircraft->ccpmServoYChannel->currentIndex() == 0) && (m_aircraft->ccpmServoYChannel->isVisible())) {
m_aircraft->ccpmServoYLabel->setText("<font color=red>" + m_aircraft->ccpmServoYLabel->text() + "</font>");
error = true;
} else {
m_aircraft->ccpmServoYLabel->setText(QTextEdit(m_aircraft->ccpmServoYLabel->text()).toPlainText());
for (int i = 0; i < 6; i++) {
QComboBox *combobox = comboChannelsName[i];
if (combobox && (combobox->isVisible())) {
if (combobox->currentText() == "None") {
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size);
pixmap.fill(QColor("red"));
combobox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) {
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size);
pixmap.fill(QColor("orange"));
combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes
combobox->setToolTip(tr("Channel already used"));
error = true;
} else {
for (int index = 0; index < (int)ConfigCcpmWidget::CHANNEL_NUMELEM; index++) {
combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
combobox->setToolTip("");
}
}
channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText();
}
}
if ((m_aircraft->ccpmServoZChannel->currentIndex() == 0) && (m_aircraft->ccpmServoZChannel->isVisible())) {
m_aircraft->ccpmServoZLabel->setText("<font color=red>" + m_aircraft->ccpmServoZLabel->text() + "</font>");
error = true;
} else {
m_aircraft->ccpmServoZLabel->setText(QTextEdit(m_aircraft->ccpmServoZLabel->text()).toPlainText());
}
if ((m_aircraft->ccpmEngineChannel->currentIndex() == 0) && (m_aircraft->ccpmEngineChannel->isEnabled())) {
m_aircraft->ccpmEngineLabel->setText("<font color=red>" + m_aircraft->ccpmEngineLabel->text() + "</font>");
} else {
m_aircraft->ccpmEngineLabel->setText(QTextEdit(m_aircraft->ccpmEngineLabel->text()).toPlainText());
}
if ((m_aircraft->ccpmTailChannel->currentIndex() == 0) && (m_aircraft->ccpmTailChannel->isEnabled())) {
m_aircraft->ccpmTailLabel->setText("<font color=red>" + m_aircraft->ccpmTailLabel->text() + "</font>");
error = true;
} else {
m_aircraft->ccpmTailLabel->setText(QTextEdit(m_aircraft->ccpmTailLabel->text()).toPlainText());
}
return error;
}

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file configccpmtwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
@ -84,7 +85,7 @@ private:
QGraphicsEllipseItem *ServosTextCircles[CCPM_MAX_SWASH_SERVOS];
QSpinBox *SwashLvlSpinBoxes[CCPM_MAX_SWASH_SERVOS];
QString TypeText;
QString typeText;
bool SwashLvlConfigurationInProgress;
UAVObject::Metadata SwashLvlaccInitialData;
@ -112,7 +113,7 @@ private:
private slots:
virtual void setupUI(QString airframeType);
virtual bool throwConfigError(QString airframeType);
virtual bool throwConfigError(int typeInt);
void ccpmSwashplateUpdate();
void ccpmSwashplateRedraw();

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file configfixedwingwidget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
@ -136,9 +137,17 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->elevonSlider1->setEnabled(false);
m_aircraft->elevonSlider2->setEnabled(false);
m_aircraft->elevonSlider3->setEnabled(true);
m_aircraft->elevonSlider1->setValue(100);
m_aircraft->elevonSlider2->setValue(100);
// Get values saved if frameType = current frameType set on board
if (field->getValue().toString() == "FixedWing") {
m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential"));
} else {
m_aircraft->elevonSlider3->setValue(0);
}
} else if (frameType == "FixedWingElevon" || frameType == "Elevon") {
planeimg->setElementId("elevon");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevon"));
@ -157,22 +166,27 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->elevonSlider1->setEnabled(true);
m_aircraft->elevonSlider2->setEnabled(true);
m_aircraft->elevonSlider3->setEnabled(true);
// Get values saved if frameType = current frameType set on board
if (field->getValue().toString() == "FixedWingElevon") {
m_aircraft->elevonSlider1->setValue(getMixerValue(mixer, "MixerValueRoll"));
m_aircraft->elevonSlider2->setValue(getMixerValue(mixer, "MixerValuePitch"));
m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential"));
} else {
m_aircraft->elevonSlider1->setValue(100);
m_aircraft->elevonSlider2->setValue(100);
m_aircraft->elevonSlider3->setValue(0);
}
} else if (frameType == "FixedWingVtail" || frameType == "Vtail") {
planeimg->setElementId("vtail");
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Vtail"));
m_aircraft->fwRudder1ChannelBox->setEnabled(false);
m_aircraft->fwRudder1ChannelBox->setCurrentText("None");
m_aircraft->fwRudder1ChannelBox->setToolTip("");
m_aircraft->fwRudder2ChannelBox->setEnabled(false);
m_aircraft->fwRudder2ChannelBox->setCurrentText("None");
m_aircraft->fwRudder2ChannelBox->setToolTip("");
m_aircraft->fwElevator1Label->setText("Vtail 1");
m_aircraft->fwElevator1ChannelBox->setEnabled(true);
@ -187,14 +201,17 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
m_aircraft->elevonSlider1->setEnabled(true);
m_aircraft->elevonSlider2->setEnabled(true);
m_aircraft->elevonSlider3->setEnabled(true);
// Get values saved if frameType = current frameType set on board
if (field->getValue().toString() == "FixedWingVtail") {
m_aircraft->elevonSlider1->setValue(getMixerValue(mixer, "MixerValueYaw"));
m_aircraft->elevonSlider2->setValue(getMixerValue(mixer, "MixerValuePitch"));
m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential"));
} else {
m_aircraft->elevonSlider1->setValue(100);
m_aircraft->elevonSlider2->setValue(100);
m_aircraft->elevonSlider3->setValue(0);
}
}
@ -220,6 +237,7 @@ void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent)
parent.addWidget(m_aircraft->fwRudder2ChannelBox);
parent.addWidget(m_aircraft->elevonSlider1);
parent.addWidget(m_aircraft->elevonSlider2);
parent.addWidget(m_aircraft->elevonSlider3);
}
void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData)
@ -270,6 +288,7 @@ void ConfigFixedWingWidget::refreshWidgetsValues(QString frameType)
setComboCurrentIndex(m_aircraft->fwRudder2ChannelBox, fixed.FixedWingYaw2);
// Get mixing values for GUI sliders (values stored onboard)
m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential"));
if (frameType == "FixedWingElevon" || frameType == "Elevon") {
m_aircraft->elevonSlider1->setValue(getMixerValue(mixer, "MixerValueRoll"));
m_aircraft->elevonSlider2->setValue(getMixerValue(mixer, "MixerValuePitch"));
@ -291,9 +310,6 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets()
Q_ASSERT(mixer);
// Remove Feed Forward, it is pointless on a plane:
setMixerValue(mixer, "FeedForward", 0.0);
// Set the throttle curve
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve());
@ -336,6 +352,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
config.fixedwing.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex();
config.fixedwing.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex();
config.fixedwing.FixedWingYaw1 = m_aircraft->fwRudder1ChannelBox->currentIndex();
config.fixedwing.FixedWingYaw2 = m_aircraft->fwRudder2ChannelBox->currentIndex();
config.fixedwing.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex();
setConfigData(config);
@ -361,8 +378,12 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127);
// ailerons
setMixerValue(mixer, "FirstRollServo", m_aircraft->fwAileron1ChannelBox->currentIndex());
channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1;
if (channel > -1) {
// Store differential value onboard
setMixerValue(mixer, "RollDifferential", m_aircraft->elevonSlider3->value());
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, 127);
@ -442,6 +463,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yaw);
// ailerons
setMixerValue(mixer, "FirstRollServo", m_aircraft->fwAileron1ChannelBox->currentIndex());
channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1;
if (channel > -1) {
// Compute mixer absolute values
@ -449,6 +471,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
roll = (double)(m_aircraft->elevonSlider1->value() * 1.27);
// Store sliders values onboard
setMixerValue(mixer, "RollDifferential", m_aircraft->elevonSlider3->value());
setMixerValue(mixer, "MixerValuePitch", m_aircraft->elevonSlider2->value());
setMixerValue(mixer, "MixerValueRoll", m_aircraft->elevonSlider1->value());
@ -511,12 +534,14 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
// ailerons
setMixerValue(mixer, "FirstRollServo", m_aircraft->fwAileron1ChannelBox->currentIndex());
channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1;
if (channel > -1) {
// Roll mixer value, currently no slider (should be added for Ailerons response ?)
roll = 127;
// Store Roll fixed value onboard
// Store Roll fixed and RollDifferential values onboard
setMixerValue(mixer, "MixerValueRoll", 100);
setMixerValue(mixer, "RollDifferential", m_aircraft->elevonSlider3->value());
// First Aileron (left)
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
@ -572,85 +597,57 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType)
// Initialize configuration error flag
bool error = false;
// Create a red block. All combo boxes are the same size, so any one should do as a model
int size = m_aircraft->fwEngineChannelBox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size);
QList<QComboBox *> comboChannelsName;
comboChannelsName << m_aircraft->fwEngineChannelBox
<< m_aircraft->fwAileron1ChannelBox << m_aircraft->fwAileron2ChannelBox
<< m_aircraft->fwElevator1ChannelBox << m_aircraft->fwElevator2ChannelBox
<< m_aircraft->fwRudder1ChannelBox << m_aircraft->fwRudder2ChannelBox;
QString channelNames = "";
pixmap.fill(QColor("red"));
if (airframeType == "FixedWing") {
if (m_aircraft->fwEngineChannelBox->currentText() == "None") {
m_aircraft->fwEngineChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwEngineChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
if (m_aircraft->fwElevator1ChannelBox->currentText() == "None") {
m_aircraft->fwElevator1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwElevator1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
if ((m_aircraft->fwAileron1ChannelBox->currentText() == "None")
&& (m_aircraft->fwRudder1ChannelBox->currentText() == "None")) {
pixmap.fill(QColor("green"));
m_aircraft->fwAileron1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
m_aircraft->fwRudder1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwAileron1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
m_aircraft->fwRudder1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
} else if (airframeType == "FixedWingElevon") {
if (m_aircraft->fwEngineChannelBox->currentText() == "None") {
m_aircraft->fwEngineChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwEngineChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
if (m_aircraft->fwAileron1ChannelBox->currentText() == "None") {
m_aircraft->fwAileron1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwAileron1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
if (m_aircraft->fwAileron2ChannelBox->currentText() == "None") {
m_aircraft->fwAileron2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwAileron2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
} else if (airframeType == "FixedWingVtail") {
if (m_aircraft->fwEngineChannelBox->currentText() == "None") {
m_aircraft->fwEngineChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwEngineChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
if (m_aircraft->fwElevator1ChannelBox->currentText() == "None") {
m_aircraft->fwElevator1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwElevator1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
}
if (m_aircraft->fwElevator2ChannelBox->currentText() == "None") {
m_aircraft->fwElevator2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true;
} else {
m_aircraft->fwElevator2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
for (int i = 0; i < 7; i++) {
QComboBox *combobox = comboChannelsName[i];
if (combobox && (combobox->isEnabled())) {
if (combobox->currentText() == "None") {
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size);
if ((airframeType == "FixedWingElevon") && (i > 2)) {
pixmap.fill(QColor("green"));
// Rudders are optional for elevon frame
combobox->setToolTip(tr("Rudders are optional for Elevon frame"));
} else if (((airframeType == "FixedWing") || (airframeType == "FixedWingVtail")) && (i == 2)) {
pixmap.fill(QColor("green"));
// Second aileron servo is optional for FixedWing frame
combobox->setToolTip(tr("Second aileron servo is optional"));
} else if ((airframeType == "FixedWing") && (i > 3)) {
pixmap.fill(QColor("green"));
// Second elevator and rudders are optional for FixedWing frame
combobox->setToolTip(tr("Second elevator servo is optional"));
if (i > 4) {
combobox->setToolTip(tr("Rudder is highly recommended for fixed wing."));
}
} else {
pixmap.fill(QColor("red"));
combobox->setToolTip(tr("Please assign Channel"));
m_aircraft->fwStatusLabel->setText(tr("<font color='red'>ERROR: Assign all necessary channels</font>"));
error = true;
}
combobox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
} else if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) {
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size);
pixmap.fill(QColor("orange"));
combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes
combobox->setToolTip(tr("Channel already used"));
error = true;
} else {
for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) {
combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
combobox->setToolTip("");
}
}
channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText();
}
}
if (error) {
m_aircraft->fwStatusLabel->setText(QString("<font color='red'>ERROR: Assign all necessary channels</font>"));
}
return error;
}

View File

@ -2,6 +2,7 @@
******************************************************************************
*
* @file configgroundvehiclemwidget.cpp
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* @author K. Sebesta & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
@ -353,9 +354,6 @@ QString ConfigGroundVehicleWidget::updateConfigObjectsFromWidgets()
// Save the curve (common to all ground vehicle frames)
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
// Remove Feed Forward, it is pointless on a ground vehicle:
setMixerValue(mixer, "FeedForward", 0.0);
// set the throttle curves
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->groundVehicleThrottle1->getCurve());
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->groundVehicleThrottle2->getCurve());

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file vehicleconfig.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
@ -60,7 +61,7 @@ typedef struct {
} __attribute__((packed)) multiGUISettingsStruct;
typedef struct {
uint SwashplateType : 3;
uint SwashplateType : 4;
uint FirstServoIndex : 2;
uint CorrectionAngle : 9;
uint ccpmCollectivePassthroughState : 1;
@ -75,7 +76,7 @@ typedef struct {
uint ServoIndexZ : 4; // 57 bits
uint Throttle : 4;
uint Tail : 4; // 65bits
quint32 padding : 31; // 96 bits
quint32 padding : 30; // 96 bits
quint32 padding1; // 128 bits
} __attribute__((packed)) heliGUISettingsStruct;

View File

@ -21,6 +21,8 @@ HEADERS += \
configinputwidget.h \
configoutputwidget.h \
configvehicletypewidget.h \
config_cc_hw_widget.h \
configccattitudewidget.h \
configstabilizationwidget.h \
assertions.h \
defaultattitudewidget.h \
@ -67,6 +69,8 @@ SOURCES += \
configinputwidget.cpp \
configoutputwidget.cpp \
configvehicletypewidget.cpp \
config_cc_hw_widget.cpp \
configccattitudewidget.cpp \
configstabilizationwidget.cpp \
defaultattitudewidget.cpp \
defaulthwsettingswidget.cpp \
@ -104,10 +108,12 @@ FORMS += \
airframe_ground.ui \
airframe_multirotor.ui \
airframe_custom.ui \
cc_hw_settings.ui \
stabilization.ui \
input.ui \
input_wizard.ui \
output.ui \
ccattitude.ui \
defaultattitude.ui \
defaulthwsettings.ui \
inputchannelform.ui \

View File

@ -0,0 +1,157 @@
/**
******************************************************************************
*
* @file configtelemetrywidget.h
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief The Configuration Gadget used to update settings in the firmware
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config_cc_hw_widget.h"
#include "hwsettings.h"
#include <QDebug>
#include <QStringList>
#include <QWidget>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QPushButton>
#include <QDesktopServices>
#include <QUrl>
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/generalsettings.h>
ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
m_telemetry = new Ui_CC_HW_Widget();
m_telemetry->setupUi(this);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
m_telemetry->saveTelemetryToRAM->setVisible(false);
}
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
int id = utilMngr->getBoardModel();
switch (id) {
case 0x0101:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0101.svg"));
break;
case 0x0301:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0301.svg"));
break;
case 0x0401:
m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg"));
break;
case 0x0402:
m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/cc3d_top.png"));
break;
case 0x0201:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0201.svg"));
break;
default:
m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg"));
break;
}
addApplySaveButtons(m_telemetry->saveTelemetryToRAM, m_telemetry->saveTelemetryToSD);
addWidgetBinding("HwSettings", "CC_FlexiPort", m_telemetry->cbFlexi);
addWidgetBinding("HwSettings", "CC_MainPort", m_telemetry->cbTele);
addWidgetBinding("HwSettings", "CC_RcvrPort", m_telemetry->cbRcvr);
addWidgetBinding("HwSettings", "USB_HIDPort", m_telemetry->cbUsbHid);
addWidgetBinding("HwSettings", "USB_VCPPort", m_telemetry->cbUsbVcp);
addWidgetBinding("HwSettings", "TelemetrySpeed", m_telemetry->telemetrySpeed);
addWidgetBinding("HwSettings", "GPSSpeed", m_telemetry->gpsSpeed);
// Add Gps protocol configuration
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
HwSettings::DataFields hwSettingsData = hwSettings->getData();
if (hwSettingsData.OptionalModules[HwSettings::OPTIONALMODULES_GPS] != HwSettings::OPTIONALMODULES_ENABLED) {
m_telemetry->gpsProtocol->setEnabled(false);
m_telemetry->gpsProtocol->setToolTip(tr("Enable GPS module and reboot the board to be able to select GPS protocol"));
} else {
addWidgetBinding("GPSSettings", "DataProtocol", m_telemetry->gpsProtocol);
}
addWidgetBinding("HwSettings", "ComUsbBridgeSpeed", m_telemetry->comUsbBridgeSpeed);
connect(m_telemetry->cchwHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
enableSaveButtons(false);
populateWidgets();
refreshWidgetsValues();
forceConnectedState();
}
ConfigCCHWWidget::~ConfigCCHWWidget()
{
// Do nothing
}
void ConfigCCHWWidget::refreshValues()
{}
void ConfigCCHWWidget::widgetsContentsChanged()
{
ConfigTaskWidget::widgetsContentsChanged();
if (((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_DEBUGCONSOLE) &&
(m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_DEBUGCONSOLE)) ||
((m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_DEBUGCONSOLE) &&
(m_telemetry->cbUsbVcp->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE)) ||
((m_telemetry->cbUsbVcp->currentIndex() == HwSettings::USB_VCPPORT_DEBUGCONSOLE) &&
(m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_DEBUGCONSOLE))) {
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have configured more than one DebugConsole, this currently is not supported"));
} else if (((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_TELEMETRY) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_TELEMETRY)) ||
((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_GPS) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_GPS)) ||
((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_DEBUGCONSOLE) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_DEBUGCONSOLE)) ||
((m_telemetry->cbTele->currentIndex() == HwSettings::CC_MAINPORT_COMBRIDGE) && (m_telemetry->cbFlexi->currentIndex() == HwSettings::CC_FLEXIPORT_COMBRIDGE))) {
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have configured both MainPort and FlexiPort for the same function, this currently is not supported"));
} else if ((m_telemetry->cbUsbHid->currentIndex() == HwSettings::USB_HIDPORT_USBTELEMETRY) && (m_telemetry->cbUsbVcp->currentIndex() == HwSettings::USB_VCPPORT_USBTELEMETRY)) {
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have configured both USB HID Port and USB VCP Port for the same function, this currently is not supported"));
} else if ((m_telemetry->cbUsbHid->currentIndex() != HwSettings::USB_HIDPORT_USBTELEMETRY) && (m_telemetry->cbUsbVcp->currentIndex() != HwSettings::USB_VCPPORT_USBTELEMETRY)) {
enableSaveButtons(false);
m_telemetry->problems->setText(tr("Warning: you have disabled USB Telemetry on both USB HID Port and USB VCP Port, this currently is not supported"));
} else {
m_telemetry->problems->setText("");
enableSaveButtons(true);
}
}
void ConfigCCHWWidget::enableSaveButtons(bool enable)
{
m_telemetry->saveTelemetryToRAM->setEnabled(enable);
m_telemetry->saveTelemetryToSD->setEnabled(enable);
}
void ConfigCCHWWidget::openHelp()
{
QDesktopServices::openUrl(QUrl(tr("http://wiki.openpilot.org/x/D4AUAQ"), QUrl::StrictMode));
}
/**
* @}
* @}
*/

View File

@ -0,0 +1,56 @@
/**
******************************************************************************
*
* @file configtelemetrytwidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief Telemetry configuration panel
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CONFIGCCHWWIDGET_H
#define CONFIGCCHWWIDGET_H
#include "ui_cc_hw_settings.h"
#include "../uavobjectwidgetutils/configtaskwidget.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavobject.h"
#include <QWidget>
#include <QList>
#include "smartsavebutton.h"
class ConfigCCHWWidget : public ConfigTaskWidget {
Q_OBJECT
public:
ConfigCCHWWidget(QWidget *parent = 0);
~ConfigCCHWWidget();
private slots:
void openHelp();
void refreshValues();
void widgetsContentsChanged();
void enableSaveButtons(bool enable);
private:
Ui_CC_HW_Widget *m_telemetry;
QSvgRenderer *m_renderer;
};
#endif // CONFIGCCHWWIDGET_H

View File

@ -1,4 +1,4 @@
include(../../openpilotgcsplugin.pri)
include(../../plugin.pri)
include(../../libs/utils/utils.pri)
include(../../plugins/uavtalk/uavtalk.pri)
include(../../plugins/coreplugin/coreplugin.pri)

View File

@ -0,0 +1,239 @@
/**
******************************************************************************
*
* @file configccattitudewidget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief Configure Attitude module on CopterControl
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "configccattitudewidget.h"
#include "ui_ccattitude.h"
#include "utils/coordinateconversions.h"
#include "attitudesettings.h"
#include <QMutexLocker>
#include <QMessageBox>
#include <QDebug>
#include <QDesktopServices>
#include <QUrl>
#include "accelstate.h"
#include "accelgyrosettings.h"
#include "gyrostate.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/generalsettings.h>
#include <calibration/calibrationutils.h>
ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
ConfigTaskWidget(parent),
ui(new Ui_ccattitude)
{
ui->setupUi(this);
connect(ui->zeroBias, SIGNAL(clicked()), this, SLOT(startAccelCalibration()));
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
if (!settings->useExpertMode()) {
ui->applyButton->setVisible(false);
}
addApplySaveButtons(ui->applyButton, ui->saveButton);
addUAVObject("AttitudeSettings");
addUAVObject("AccelGyroSettings");
// Connect the help button
connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
addWidgetBinding("AttitudeSettings", "ZeroDuringArming", ui->zeroGyroBiasOnArming);
addWidgetBinding("AttitudeSettings", "AccelTau", ui->accelTauSpinbox);
addWidgetBinding("AttitudeSettings", "BoardRotation", ui->rollBias, AttitudeSettings::BOARDROTATION_ROLL);
addWidgetBinding("AttitudeSettings", "BoardRotation", ui->pitchBias, AttitudeSettings::BOARDROTATION_PITCH);
addWidgetBinding("AttitudeSettings", "BoardRotation", ui->yawBias, AttitudeSettings::BOARDROTATION_YAW);
addWidget(ui->zeroBias);
populateWidgets();
refreshWidgetsValues();
forceConnectedState();
}
ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget()
{
delete ui;
}
void ConfigCCAttitudeWidget::sensorsUpdated(UAVObject *obj)
{
if (!timer.isActive()) {
// ignore updates that come in after the timer has expired
return;
}
AccelState *accelState = AccelState::GetInstance(getObjectManager());
GyroState *gyroState = GyroState::GetInstance(getObjectManager());
// Accumulate samples until we have _at least_ NUM_SENSOR_UPDATES samples
// for both gyros and accels.
// Note that, at present, we stash the samples and then compute the bias
// at the end, even though the mean could be accumulated as we go.
// In future, a better algorithm could be used.
if (obj->getObjID() == AccelState::OBJID) {
accelUpdates++;
AccelState::DataFields accelStateData = accelState->getData();
x_accum.append(accelStateData.x);
y_accum.append(accelStateData.y);
z_accum.append(accelStateData.z);
} else if (obj->getObjID() == GyroState::OBJID) {
gyroUpdates++;
GyroState::DataFields gyroStateData = gyroState->getData();
x_gyro_accum.append(gyroStateData.x);
y_gyro_accum.append(gyroStateData.y);
z_gyro_accum.append(gyroStateData.z);
}
// update the progress indicator
ui->zeroBiasProgress->setValue((float)qMin(accelUpdates, gyroUpdates) / NUM_SENSOR_UPDATES * 100);
// If we have enough samples, then stop sampling and compute the biases
if (accelUpdates >= NUM_SENSOR_UPDATES && gyroUpdates >= NUM_SENSOR_UPDATES) {
timer.stop();
disconnect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(sensorsUpdated(UAVObject *)));
disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
float x_bias = OpenPilot::CalibrationUtils::listMean(x_accum);
float y_bias = OpenPilot::CalibrationUtils::listMean(y_accum);
float z_bias = OpenPilot::CalibrationUtils::listMean(z_accum) + 9.81;
float x_gyro_bias = OpenPilot::CalibrationUtils::listMean(x_gyro_accum);
float y_gyro_bias = OpenPilot::CalibrationUtils::listMean(y_gyro_accum);
float z_gyro_bias = OpenPilot::CalibrationUtils::listMean(z_gyro_accum);
accelState->setMetadata(initialAccelStateMdata);
gyroState->setMetadata(initialGyroStateMdata);
AccelGyroSettings::DataFields accelGyroSettingsData = AccelGyroSettings::GetInstance(getObjectManager())->getData();
AttitudeSettings::DataFields attitudeSettingsData = AttitudeSettings::GetInstance(getObjectManager())->getData();
// We offset the gyro bias by current bias to help precision
accelGyroSettingsData.accel_bias[0] += x_bias;
accelGyroSettingsData.accel_bias[1] += y_bias;
accelGyroSettingsData.accel_bias[2] += z_bias;
accelGyroSettingsData.gyro_bias[0] = -x_gyro_bias;
accelGyroSettingsData.gyro_bias[1] = -y_gyro_bias;
accelGyroSettingsData.gyro_bias[2] = -z_gyro_bias;
attitudeSettingsData.BiasCorrectGyro = AttitudeSettings::BIASCORRECTGYRO_TRUE;
AttitudeSettings::GetInstance(getObjectManager())->setData(attitudeSettingsData);
AccelGyroSettings::GetInstance(getObjectManager())->setData(accelGyroSettingsData);
this->setDirty(true);
// reenable controls
enableControls(true);
}
}
void ConfigCCAttitudeWidget::timeout()
{
UAVDataObject *obj = AccelState::GetInstance(getObjectManager());
disconnect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(sensorsUpdated(UAVObject *)));
disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
AccelState *accelState = AccelState::GetInstance(getObjectManager());
GyroState *gyroState = GyroState::GetInstance(getObjectManager());
accelState->setMetadata(initialAccelStateMdata);
gyroState->setMetadata(initialGyroStateMdata);
QMessageBox msgBox;
msgBox.setText(tr("Calibration timed out before receiving required updates."));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
// reset progress indicator
ui->zeroBiasProgress->setValue(0);
// reenable controls
enableControls(true);
}
void ConfigCCAttitudeWidget::startAccelCalibration()
{
// disable controls during sampling
enableControls(false);
accelUpdates = 0;
gyroUpdates = 0;
x_accum.clear();
y_accum.clear();
z_accum.clear();
x_gyro_accum.clear();
y_gyro_accum.clear();
z_gyro_accum.clear();
// Disable gyro bias correction to see raw data
AttitudeSettings::DataFields attitudeSettingsData = AttitudeSettings::GetInstance(getObjectManager())->getData();
attitudeSettingsData.BiasCorrectGyro = AttitudeSettings::BIASCORRECTGYRO_FALSE;
AttitudeSettings::GetInstance(getObjectManager())->setData(attitudeSettingsData);
// Set up to receive updates
UAVDataObject *accelState = AccelState::GetInstance(getObjectManager());
UAVDataObject *gyroState = GyroState::GetInstance(getObjectManager());
connect(accelState, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(sensorsUpdated(UAVObject *)));
connect(gyroState, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(sensorsUpdated(UAVObject *)));
// Speed up updates
initialAccelStateMdata = accelState->getMetadata();
UAVObject::Metadata accelStateMdata = initialAccelStateMdata;
UAVObject::SetFlightTelemetryUpdateMode(accelStateMdata, UAVObject::UPDATEMODE_PERIODIC);
accelStateMdata.flightTelemetryUpdatePeriod = 30; // ms
accelState->setMetadata(accelStateMdata);
initialGyroStateMdata = gyroState->getMetadata();
UAVObject::Metadata gyroStateMdata = initialGyroStateMdata;
UAVObject::SetFlightTelemetryUpdateMode(gyroStateMdata, UAVObject::UPDATEMODE_PERIODIC);
gyroStateMdata.flightTelemetryUpdatePeriod = 30; // ms
gyroState->setMetadata(gyroStateMdata);
// Set up timeout timer
timer.setSingleShot(true);
timer.start(5000 + (NUM_SENSOR_UPDATES * qMax(accelStateMdata.flightTelemetryUpdatePeriod,
gyroStateMdata.flightTelemetryUpdatePeriod)));
connect(&timer, SIGNAL(timeout()), this, SLOT(timeout()));
}
void ConfigCCAttitudeWidget::openHelp()
{
QDesktopServices::openUrl(QUrl(tr("http://wiki.openpilot.org/x/44Cf"), QUrl::StrictMode));
}
void ConfigCCAttitudeWidget::setAccelFiltering(bool active)
{
Q_UNUSED(active);
setDirty(true);
}
void ConfigCCAttitudeWidget::enableControls(bool enable)
{
ui->zeroBias->setEnabled(enable);
ui->zeroGyroBiasOnArming->setEnabled(enable);
ui->accelTauSpinbox->setEnabled(enable);
ConfigTaskWidget::enableControls(enable);
}
void ConfigCCAttitudeWidget::updateObjectsFromWidgets()
{
ConfigTaskWidget::updateObjectsFromWidgets();
ui->zeroBiasProgress->setValue(0);
}

View File

@ -0,0 +1,74 @@
/**
******************************************************************************
*
* @file configccattitudewidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief Configure the properties of the attitude module in CopterControl
*****************************************************************************/
/*
* 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, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CCATTITUDEWIDGET_H
#define CCATTITUDEWIDGET_H
#include "ui_ccattitude.h"
#include "../uavobjectwidgetutils/configtaskwidget.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavobject.h"
#include <QWidget>
#include <QTimer>
class Ui_Widget;
class ConfigCCAttitudeWidget : public ConfigTaskWidget {
Q_OBJECT
public:
explicit ConfigCCAttitudeWidget(QWidget *parent = 0);
~ConfigCCAttitudeWidget();
virtual void updateObjectsFromWidgets();
private slots:
void sensorsUpdated(UAVObject *obj);
void timeout();
void startAccelCalibration();
void openHelp();
void setAccelFiltering(bool active);
private:
Ui_ccattitude *ui;
QTimer timer;
UAVObject::Metadata initialAccelStateMdata;
UAVObject::Metadata initialGyroStateMdata;
int accelUpdates;
int gyroUpdates;
QList<double> x_accum, y_accum, z_accum;
QList<double> x_gyro_accum, y_gyro_accum, z_gyro_accum;
static const float DEFAULT_ENABLED_ACCEL_TAU = 0.1;
static const int NUM_SENSOR_UPDATES = 300;
protected:
virtual void enableControls(bool enable);
};
#endif // CCATTITUDEWIDGET_H

View File

@ -12,7 +12,9 @@
<file>images/fixedwing-shapes.svg</file>
<file>images/ground-shapes.svg</file>
<file>images/ccpm_setup.svg</file>
<file>images/PipXtreme.png</file>
<file>images/help.png</file>
<file>images/coptercontrol.svg</file>
<file>images/TX2.svg</file>
<file>images/output_selected.png</file>
<file>images/output_normal.png</file>
@ -54,5 +56,6 @@
<file>images/gear.png</file>
<file>images/error.svg</file>
<file>images/nano_top.png</file>
<file>images/cc3d_top.png</file>
</qresource>
</RCC>

View File

@ -28,12 +28,14 @@
#include "configgadgetwidget.h"
#include "configvehicletypewidget.h"
#include "configccattitudewidget.h"
#include "configinputwidget.h"
#include "configoutputwidget.h"
#include "configstabilizationwidget.h"
#include "configcamerastabilizationwidget.h"
#include "configtxpidwidget.h"
#include "configrevohwwidget.h"
#include "config_cc_hw_widget.h"
#include "configoplinkwidget.h"
#include "configrevowidget.h"
#include "configrevonanohwwidget.h"
@ -182,7 +184,13 @@ void ConfigGadgetWidget::onAutopilotConnect()
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
if (utilMngr) {
int board = utilMngr->getBoardModel();
if ((board & 0xff00) == 0x0900) {
if ((board & 0xff00) == 0x0400) {
// CopterControl family
QWidget *qwd = new ConfigCCAttitudeWidget(this);
stackWidget->replaceTab(ConfigGadgetWidget::sensors, qwd);
qwd = new ConfigCCHWWidget(this);
stackWidget->replaceTab(ConfigGadgetWidget::hardware, qwd);
} else if ((board & 0xff00) == 0x0900) {
// Revolution family
QWidget *qwd = new ConfigRevoWidget(this);
stackWidget->replaceTab(ConfigGadgetWidget::sensors, qwd);

View File

@ -354,7 +354,11 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *obj)
if (utilMngr) {
int board = utilMngr->getBoardModel();
// Setup labels and combos for banks according to board type
if (board == 0x0903) {
if ((board & 0xff00) == 0x0400) {
// Coptercontrol family of boards 4 timer banks
bankLabels << "1 (1-3)" << "2 (4)" << "3 (5,7-8)" << "4 (6,9-10)";
channelBanks << 1 << 1 << 1 << 2 << 3 << 4 << 3 << 3 << 4 << 4;
} else if (board == 0x0903) {
// Revolution family of boards 6 timer banks
bankLabels << "1 (1-2)" << "2 (3)" << "3 (4)" << "4 (5-6)" << "5 (7,12)" << "6 (8-11)";
channelBanks << 1 << 1 << 2 << 3 << 4 << 4 << 5 << 6 << 6 << 6 << 6 << 5;
@ -472,7 +476,10 @@ void ConfigOutputWidget::updateWarnings(UAVObject *)
if (systemAlarms.Alarm[SystemAlarms::ALARM_SYSTEMCONFIGURATION] > SystemAlarms::ALARM_WARNING) {
switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) {
case SystemAlarms::EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT:
setWarning(tr("OneShot and PWMSync output DO NOT work with Receiver Port is 'PWM'<br>"));
setWarning(tr("OneShot and PWMSync output only works with Receiver Port settings marked with '+OneShot'<br>"
"When using Receiver Port setting 'PPM_PIN8+OneShot' "
"<b><font color='%1'>Bank %2</font></b> must be set to PWM")
.arg(m_banks.at(3).color().name()).arg(m_banks.at(3).label()->text()));
return;
}
}

View File

@ -868,7 +868,7 @@
</palette>
</property>
<property name="toolTip">
<string>Send to OpenPilot but don't write in SD.
<string>Send to board but don't write in SD.
Beware of not locking yourself out!</string>
</property>
<property name="autoFillBackground">

View File

@ -652,7 +652,7 @@
</palette>
</property>
<property name="toolTip">
<string>Send to OpenPilot but don't write in SD.
<string>Send to board but don't write in SD.
Beware of not locking yourself out!</string>
</property>
<property name="autoFillBackground">

View File

@ -91,7 +91,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
m_ui->calibrationVisualHelp->setScene(new QGraphicsScene(this));
m_ui->calibrationVisualHelp->setRenderHint(QPainter::HighQualityAntialiasing, true);
m_ui->calibrationVisualHelp->setRenderHint(QPainter::SmoothPixmapTransform, true);
m_ui->calibrationVisualHelp->setBackgroundBrush(QBrush(QColor(51, 51, 51)));
m_ui->calibrationVisualHelp->setBackgroundBrush(QBrush(QColor(200, 200, 200)));
displayVisualHelp("empty");
// Must set up the UI (above) before setting up the UAVO mappings or refreshWidgetValues

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file configstabilizationwidget.cpp
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
@ -91,6 +92,9 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
connect(ui->checkBox_3, SIGNAL(toggled(bool)), this, SLOT(linkCheckBoxes(bool)));
addWidget(ui->checkBox_3);
connect(ui->checkBoxLinkAcroFactors, SIGNAL(toggled(bool)), this, SLOT(linkCheckBoxes(bool)));
addWidget(ui->checkBoxLinkAcroFactors);
addWidget(ui->pushButton_2);
addWidget(ui->pushButton_3);
addWidget(ui->pushButton_4);
@ -568,6 +572,8 @@ void ConfigStabilizationWidget::linkCheckBoxes(bool value)
ui->basicResponsivenessCheckBox->setChecked(!value);
ui->basicResponsivenessControls->setEnabled(!value);
ui->advancedResponsivenessControls->setEnabled(value);
} else if(sender() == ui->checkBoxLinkAcroFactors) {
processLinkedWidgets(ui->AcroFactorRollSlider);
}
}
@ -608,6 +614,13 @@ void ConfigStabilizationWidget::processLinkedWidgets(QWidget *widget)
ui->ratePitchKi_4->setValue(ui->RateResponsivenessSlider->value());
}
}
if (ui->checkBoxLinkAcroFactors->isChecked()) {
if (widget == ui->AcroFactorRollSlider) {
ui->AcroFactorPitchSlider->setValue(ui->AcroFactorRollSlider->value());
} else if (widget == ui->AcroFactorPitchSlider) {
ui->AcroFactorRollSlider->setValue(ui->AcroFactorPitchSlider->value());
}
}
}
void ConfigStabilizationWidget::onBoardConnected()

View File

@ -2,7 +2,8 @@
******************************************************************************
*
* @file configtxpidswidget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
@ -88,8 +89,10 @@ ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent)
addWidgetBinding("TxPIDSettings", "UpdateMode", m_txpid->UpdateMode);
addWidget(m_txpid->TxPIDEnable);
connect(this, SIGNAL(widgetContentsChanged(QWidget *)), this, SLOT(processLinkedWidgets(QWidget *)));
addWidget(m_txpid->TxPIDEnable);
addWidget(m_txpid->enableAutoCalcYaw);
enableControls(false);
populateWidgets();
refreshWidgetsValues();
@ -160,9 +163,29 @@ static bool isExpoOption(int pidOption)
}
}
static bool isFullPIDOption(int pidOption)
{
switch (pidOption) {
case TxPIDSettings::PIDS_ROLLRATEPID:
case TxPIDSettings::PIDS_PITCHRATEPID:
return true;
default:
return false;
}
}
static bool isAcroPlusFactorOption(int pidOption)
{
return pidOption == TxPIDSettings::PIDS_ACROPLUSFACTOR;
switch (pidOption) {
case TxPIDSettings::PIDS_ACROPITCHFACTOR:
case TxPIDSettings::PIDS_ACROROLLFACTOR:
case TxPIDSettings::PIDS_ACROROLLPITCHFACTOR:
return true;
default:
return false;
}
}
template <class StabilizationSettingsBankX>
@ -173,9 +196,11 @@ static float defaultValueForPidOption(const StabilizationSettingsBankX *bank, in
return 0.0f;
case TxPIDSettings::PIDS_ROLLRATEKP:
case TxPIDSettings::PIDS_ROLLRATEPID:
return bank->getRollRatePID_Kp();
case TxPIDSettings::PIDS_PITCHRATEKP:
case TxPIDSettings::PIDS_PITCHRATEPID:
return bank->getPitchRatePID_Kp();
case TxPIDSettings::PIDS_ROLLPITCHRATEKP:
@ -292,6 +317,13 @@ static float defaultValueForPidOption(const StabilizationSettingsBankX *bank, in
case TxPIDSettings::PIDS_YAWEXPO:
return bank->getStickExpo_Yaw();
case TxPIDSettings::PIDS_ACROROLLFACTOR:
case TxPIDSettings::PIDS_ACROROLLPITCHFACTOR:
return bank->getAcroInsanityFactor_Roll();
case TxPIDSettings::PIDS_ACROPITCHFACTOR:
return bank->getAcroInsanityFactor_Pitch();
case -1: // The PID Option field was uninitialized.
return 0.0f;
@ -432,3 +464,23 @@ void ConfigTxPIDWidget::saveSettings()
UAVObject *obj = HwSettings::GetInstance(getObjectManager());
saveObjectToSD(obj);
}
void ConfigTxPIDWidget::processLinkedWidgets(QWidget *widget)
{
Q_UNUSED(widget);
bool fullPidEnabled =
isFullPIDOption(m_txpid->PID1->currentIndex()) ||
isFullPIDOption(m_txpid->PID2->currentIndex()) ||
isFullPIDOption(m_txpid->PID3->currentIndex());
bool calcYawEnabled = fullPidEnabled && m_txpid->enableAutoCalcYaw->isChecked();
m_txpid->fullPID_Y_P_FactorSlider->setEnabled(calcYawEnabled);
m_txpid->fullPID_Y_P_FactorSpinBox->setEnabled(calcYawEnabled);
m_txpid->fullPID_Y_I_FactorSpinBox->setEnabled(calcYawEnabled);
m_txpid->fullPID_Y_D_FactorSpinBox->setEnabled(calcYawEnabled);
m_txpid->enableAutoCalcYaw->setEnabled(fullPidEnabled);
m_txpid->fullPID_RP_I_FactorSlider->setEnabled(fullPidEnabled);
m_txpid->fullPID_RP_I_FactorSpinBox->setEnabled(fullPidEnabled);
m_txpid->fullPID_RP_D_FactorSpinBox->setEnabled(fullPidEnabled);
m_txpid->groupBox_FullPids->setEnabled(fullPidEnabled);
}

View File

@ -38,8 +38,8 @@ public:
~ConfigTxPIDWidget();
private:
Ui_TxPIDWidget *m_txpid;
private slots:
void processLinkedWidgets(QWidget *widget);
void updateSpinBoxProperties(int selectedPidOption);
float getDefaultValueForPidOption(int pidOption);
void refreshValues();

View File

@ -135,9 +135,6 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
addUAVObject("MixerSettings");
addUAVObject("ActuatorSettings");
m_ffTuningInProgress = false;
m_ffTuningPhase = false;
// The order of the tabs is important since they correspond with the AirframCategory enum
m_aircraft->aircraftType->addTab(tr("Multirotor"));
m_aircraft->aircraftType->addTab(tr("Fixed Wing"));
@ -148,24 +145,11 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
// Connect aircraft type selection dropbox to callback function
connect(m_aircraft->aircraftType, SIGNAL(currentChanged(int)), this, SLOT(switchAirframeType(int)));
// Connect the three feed forward test checkboxes
connect(m_aircraft->ffTestBox1, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
// Connect the help pushbutton
connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
refreshWidgetsValues();
// register FF widgets for dirty state management
addWidget(m_aircraft->feedForwardSlider);
addWidget(m_aircraft->accelTime);
addWidget(m_aircraft->decelTime);
addWidget(m_aircraft->maxAccelSlider);
addWidget(m_aircraft->ffTestBox1);
addWidget(m_aircraft->ffTestBox2);
addWidget(m_aircraft->ffTestBox3);
addWidget(m_aircraft->nameEdit);
disableMouseWheelEvents();
@ -183,7 +167,6 @@ ConfigVehicleTypeWidget::~ConfigVehicleTypeWidget()
void ConfigVehicleTypeWidget::switchAirframeType(int index)
{
m_aircraft->airframesWidget->setCurrentWidget(getVehicleConfigWidget(index));
m_aircraft->tabWidget->setTabEnabled(1, index != 1);
}
/**
@ -247,7 +230,6 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *object)
}
m_aircraft->nameEdit->setText(name);
updateFeedForwardUI();
setDirty(dirty);
}
@ -281,17 +263,6 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
field->setValue(airframeType);
}
// Update feed forward settings
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
QPointer<VehicleConfig> vconfig = new VehicleConfig();
vconfig->setMixerValue(mixer, "FeedForward", m_aircraft->feedForwardSlider->value() / 100.0);
vconfig->setMixerValue(mixer, "AccelTime", m_aircraft->accelTime->value());
vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value());
vconfig->setMixerValue(mixer, "MaxAccel", m_aircraft->maxAccelSlider->value());
field = system->getField(QString("VehicleName"));
Q_ASSERT(field);
QString name = m_aircraft->nameEdit->text();
@ -306,7 +277,6 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
// call refreshWidgetsValues() to reflect actual saved values
refreshWidgetsValues();
ConfigTaskWidget::updateObjectsFromWidgets();
updateFeedForwardUI();
}
int ConfigVehicleTypeWidget::frameCategory(QString frameType)
@ -372,86 +342,6 @@ VehicleConfig *ConfigVehicleTypeWidget::createVehicleConfigWidget(int frameCateg
return NULL;
}
/**
Enables and runs feed forward testing
*/
void ConfigVehicleTypeWidget::enableFFTest()
{
// Role:
// - Check if all three checkboxes are checked
// - Every other timer event: toggle engine from 45% to 55%
// - Every other time event: send FF settings to flight FW
if (m_aircraft->ffTestBox1->isChecked() && m_aircraft->ffTestBox2->isChecked()
&& m_aircraft->ffTestBox3->isChecked()) {
if (!m_ffTuningInProgress) {
// Initiate tuning:
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(
QString("ManualControlCommand")));
UAVObject::Metadata mdata = obj->getMetadata();
m_accInitialData = mdata;
UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY);
obj->setMetadata(mdata);
}
// Depending on phase, either move actuator or send FF settings:
if (m_ffTuningPhase) {
// Send FF settings to the board
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
QPointer<VehicleConfig> vconfig = new VehicleConfig();
// Update feed forward settings
vconfig->setMixerValue(mixer, "FeedForward", m_aircraft->feedForwardSlider->value() / 100.0);
vconfig->setMixerValue(mixer, "AccelTime", m_aircraft->accelTime->value());
vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value());
vconfig->setMixerValue(mixer, "MaxAccel", m_aircraft->maxAccelSlider->value());
mixer->updated();
} else {
// Toggle motor state
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(
QString("ManualControlCommand")));
double value = obj->getField("Throttle")->getDouble();
double target = (value < 0.5) ? 0.55 : 0.45;
obj->getField("Throttle")->setValue(target);
obj->updated();
}
m_ffTuningPhase = !m_ffTuningPhase;
m_ffTuningInProgress = true;
QTimer::singleShot(1000, this, SLOT(enableFFTest()));
} else {
// - If no: disarm timer, restore actuatorcommand metadata
// Disarm!
if (m_ffTuningInProgress) {
m_ffTuningInProgress = false;
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(
QString("ManualControlCommand")));
UAVObject::Metadata mdata = obj->getMetadata();
mdata = m_accInitialData; // Restore metadata
obj->setMetadata(mdata);
}
}
}
/**
Updates the custom airframe settings based on the current airframe.
Note: does NOT ask for an object refresh itself!
*/
void ConfigVehicleTypeWidget::updateFeedForwardUI()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
QPointer<VehicleConfig> vconfig = new VehicleConfig();
// Update feed forward settings
m_aircraft->feedForwardSlider->setValue(vconfig->getMixerValue(mixer, "FeedForward") * 100);
m_aircraft->accelTime->setValue(vconfig->getMixerValue(mixer, "AccelTime"));
m_aircraft->decelTime->setValue(vconfig->getMixerValue(mixer, "DecelTime"));
m_aircraft->maxAccelSlider->setValue(vconfig->getMixerValue(mixer, "MaxAccel"));
}
/**
Opens the wiki from the user's default browser
*/

Some files were not shown because too many files have changed in this diff Show More